(function(global,undefined$1){!function(e,t,i){var n=global.protobuf=function i(n){var r=t[n];return r||e[n][0].call(r=t[n]={exports:{}},i,r,r.exports),r.exports}(i[0]);"function"==typeof undefined$1&&undefined$1.amd&&undefined$1(["long"],(function(e){return e&&e.isLong&&(n.util.Long=e,n.configure()),n})),module&&module.exports&&(module.exports=n)}({1:[function(e,t,i){t.exports=function(e,t){for(var i=[],n=2;n<arguments.length;)i.push(arguments[n++]);var r=!0;return new Promise((function(n,o){i.push((function(e){if(r)if(r=!1,e)o(e);else{for(var t=[],i=1;i<arguments.length;)t.push(arguments[i++]);n.apply(null,t)}}));try{e.apply(t||this,i)}catch(e){r&&(r=!1,o(e))}}))}},{}],2:[function(e,t,i){var n=i;n.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var r=new Array(64),o=new Array(123),a=0;a<64;)o[r[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;n.encode=function(e,t,i){for(var n,o=[],a=0,s=0;t<i;){var c=e[t++];switch(s){case 0:o[a++]=r[c>>2],n=(3&c)<<4,s=1;break;case 1:o[a++]=r[n|c>>4],n=(15&c)<<2,s=2;break;case 2:o[a++]=r[n|c>>6],o[a++]=r[63&c],s=0}}return s&&(o[a++]=r[n],o[a]=61,1===s&&(o[a+1]=61)),String.fromCharCode.apply(String,o)};var s="invalid encoding";n.decode=function(e,t,i){for(var n,r=i,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if((l=o[l])===undefined$1)throw Error(s);switch(a){case 0:n=l,a=1;break;case 1:t[i++]=n<<2|(48&l)>>4,n=l,a=2;break;case 2:t[i++]=(15&n)<<4|(60&l)>>2,n=l,a=3;break;case 3:t[i++]=(3&n)<<6|l,a=0}}if(1===a)throw Error(s);return i-r},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],3:[function(e,t,i){function n(){this._listeners={}}t.exports=n,n.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},n.prototype.off=function(e,t){if(e===undefined$1)this._listeners={};else if(t===undefined$1)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n<i.length;)i[n].fn===t?i.splice(n,1):++n;return this},n.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,i)}return this}},{}],4:[function(e,t,i){function n(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),n=128===i[3];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3]}function o(e,n,r){t[0]=e,n[r]=i[3],n[r+1]=i[2],n[r+2]=i[1],n[r+3]=i[0]}function a(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],t[0]}function s(e,n){return i[3]=e[n],i[2]=e[n+1],i[1]=e[n+2],i[0]=e[n+3],t[0]}e.writeFloatLE=n?r:o,e.writeFloatBE=n?o:r,e.readFloatLE=n?a:s,e.readFloatBE=n?s:a}():function(){function t(e,t,i,n){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,i,n);else if(isNaN(t))e(2143289344,i,n);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,i,n);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,i,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((r<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,i,n)}}function i(e,t,i){var n=e(t,i),r=2*(n>>31)+1,o=n>>>23&255,a=8388607&n;return 255===o?a?NaN:r*(1/0):0===o?1401298464324817e-60*r*a:r*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,o),e.readFloatLE=i.bind(null,a),e.readFloatBE=i.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),n=128===i[7];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3],n[r+4]=i[4],n[r+5]=i[5],n[r+6]=i[6],n[r+7]=i[7]}function o(e,n,r){t[0]=e,n[r]=i[7],n[r+1]=i[6],n[r+2]=i[5],n[r+3]=i[4],n[r+4]=i[3],n[r+5]=i[2],n[r+6]=i[1],n[r+7]=i[0]}function a(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[6]=e[n+6],i[7]=e[n+7],t[0]}function s(e,n){return i[7]=e[n],i[6]=e[n+1],i[5]=e[n+2],i[4]=e[n+3],i[3]=e[n+4],i[2]=e[n+5],i[1]=e[n+6],i[0]=e[n+7],t[0]}e.writeDoubleLE=n?r:o,e.writeDoubleBE=n?o:r,e.readDoubleLE=n?a:s,e.readDoubleBE=n?s:a}():function(){function t(e,t,i,n,r,o){var a=n<0?1:0;if(a&&(n=-n),0===n)e(0,r,o+t),e(1/n>0?0:2147483648,r,o+i);else if(isNaN(n))e(0,r,o+t),e(2146959360,r,o+i);else if(n>17976931348623157e292)e(0,r,o+t),e((a<<31|2146435072)>>>0,r,o+i);else{var s;if(n<22250738585072014e-324)e((s=n/5e-324)>>>0,r,o+t),e((a<<31|s/4294967296)>>>0,r,o+i);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(s=n*Math.pow(2,-c))>>>0,r,o+t),e((a<<31|c+1023<<20|1048576*s&1048575)>>>0,r,o+i)}}}function i(e,t,i,n,r){var o=e(n,r+t),a=e(n,r+i),s=2*(a>>31)+1,c=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===c?l?NaN:s*(1/0):0===c?5e-324*s*l:s*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,o,4,0),e.readDoubleLE=i.bind(null,a,0,4),e.readDoubleBE=i.bind(null,s,4,0)}(),e}function r(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function o(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function a(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}t.exports=n(n)},{}],5:[function(require,module,exports){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],6:[function(e,t,i){t.exports=function(e,t,i){var n=i||8192,r=n>>>1,o=null,a=n;return function(i){if(i<1||i>r)return e(i);a+i>n&&(o=e(n),a=0);var s=t.call(o,a,a+=i);return 7&a&&(a=1+(7|a)),s}}},{}],7:[function(e,t,i){var n=i;n.length=function(e){for(var t=0,i=0,n=0;n<e.length;++n)(i=e.charCodeAt(n))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},n.read=function(e,t,i){if(i-t<1)return"";for(var n,r=null,o=[],a=0;t<i;)(n=e[t++])<128?o[a++]=n:n>191&&n<224?o[a++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[a++]=55296+(n>>10),o[a++]=56320+(1023&n)):o[a++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),a=0);return r?(a&&r.push(String.fromCharCode.apply(String,o.slice(0,a))),r.join("")):String.fromCharCode.apply(String,o.slice(0,a))},n.write=function(e,t,i){for(var n,r,o=i,a=0;a<e.length;++a)(n=e.charCodeAt(a))<128?t[i++]=n:n<2048?(t[i++]=n>>6|192,t[i++]=63&n|128):55296==(64512&n)&&56320==(64512&(r=e.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&r),++a,t[i++]=n>>18|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128,t[i++]=63&n|128):(t[i++]=n>>12|224,t[i++]=n>>6&63|128,t[i++]=63&n|128);return i-o}},{}],8:[function(e,t,i){var n=i;function r(){n.Reader._configure(n.BufferReader),n.util._configure()}n.build="minimal",n.roots={},n.Writer=e(15),n.BufferWriter=e(16),n.Reader=e(9),n.BufferReader=e(10),n.util=e(14),n.rpc=e(11),n.configure=r,n.Writer._configure(n.BufferWriter),r()},{10:10,11:11,14:14,15:15,16:16,9:9}],9:[function(e,t,i){t.exports=c;var n,r=e(14),o=r.LongBits,a=r.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")};function d(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw s(this,8);return new o(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}c.create=r.Buffer?function(e){return(c.create=function(e){return r.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u,c.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return h(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|h(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw s(this,e);return this.pos+=e,t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)},c.prototype.string=function(){var e=this.bytes();return a.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4==(e=7&this.uint32()))break;this.skipType(e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e;var t=r.Long?"toLong":"toNumber";r.merge(c.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},{14:14}],10:[function(e,t,i){t.exports=o;var n=e(9);(o.prototype=Object.create(n.prototype)).constructor=o;var r=e(14);function o(e){n.call(this,e)}r.Buffer&&(o.prototype._slice=r.Buffer.prototype.slice),o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},{14:14,9:9}],11:[function(e,t,i){i.Service=e(12)},{12:12}],12:[function(e,t,i){t.exports=r;var n=e(14);function r(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(r.prototype=Object.create(n.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,i,r,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return n.asPromise(e,s,t,i,r,o);if(!s.rpcImpl)return setTimeout((function(){a(Error("already ended"))}),0),undefined$1;try{return s.rpcImpl(t,i[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,i){if(e)return s.emit("error",e,t),a(e);if(null===i)return s.end(!0),undefined$1;if(!(i instanceof r))try{i=r[s.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return s.emit("error",e,t),a(e)}return s.emit("data",i,t),a(null,i)}))}catch(e){return s.emit("error",e,t),setTimeout((function(){a(e)}),0),undefined$1}},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{14:14}],13:[function(e,t,i){t.exports=r;var n=e(14);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=r.zero=new r(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var a=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(n.isString(e)){if(!n.Long)return r.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):o},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;r.fromHash=function(e){return e===a?o:new r((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},r.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},r.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},{14:14}],14:[function(e,t,i){var n=i;function r(e,t,i){for(var n=Object.keys(t),r=0;r<n.length;++r)e[n[r]]!==undefined$1&&i||(e[n[r]]=t[n[r]]);return e}function o(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&r(this,i)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=e(1),n.base64=e(2),n.EventEmitter=e(3),n.float=e(4),n.inquire=e(5),n.utf8=e(7),n.pool=e(6),n.LongBits=e(13),n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isNode=Boolean(global.process&&global.process.versions&&global.process.versions.node),n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=global.dcodeIO&&global.dcodeIO.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var i=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},n.merge=r,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&this[e[i]]!==undefined$1&&null!==this[e[i]])return e[i]}},n.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},n.lazyResolve=function(e,t){for(var i=0;i<t.length;++i)for(var n=Object.keys(t[i]),r=0;r<n.length;++r){for(var o=t[i][n[r]].split("."),a=e;o.length;)a=a[o.shift()];t[i][n[r]]=a}},n.toJSONOptions={longs:String,enums:String,bytes:String},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},{1:1,13:13,2:2,3:3,4:4,5:5,6:6,7:7}],15:[function(e,t,i){t.exports=d;var n,r=e(14),o=r.LongBits,a=r.base64,s=r.utf8;function c(e,t,i){this.fn=e,this.len=t,this.next=undefined$1,this.val=i}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}function h(e,t,i){t[i]=255&e}function p(e,t){this.len=e,this.next=undefined$1,this.val=t}function f(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function m(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}d.create=r.Buffer?function(){return(d.create=function(){return new n})()}:function(){return new d},d.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(d.alloc=r.pool(d.alloc,r.Array.prototype.subarray)),d.prototype.push=function(e,t,i){return this.tail=this.tail.next=new c(e,t,i),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this.push(f,10,o.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=o.from(e);return this.push(f,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this.push(f,t.length(),t)},d.prototype.bool=function(e){return this.push(h,1,e?1:0)},d.prototype.fixed32=function(e){return this.push(m,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=o.from(e);return this.push(m,4,t.lo).push(m,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this.push(r.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this.push(r.float.writeDoubleLE,8,e)};var g=r.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n<e.length;++n)t[i+n]=e[n]};d.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this.push(h,1,0);if(r.isString(e)){var i=d.alloc(t=a.length(e));a.decode(e,i,0),e=i}return this.uint32(t).push(g,t,e)},d.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t).push(s.write,t,e):this.push(h,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},d.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},d._configure=function(e){n=e}},{14:14}],16:[function(e,t,i){t.exports=a;var n=e(15);(a.prototype=Object.create(n.prototype)).constructor=a;var r=e(14),o=r.Buffer;function a(){n.call(this)}a.alloc=function(e){return(a.alloc=r._Buffer_allocUnsafe)(e)};var s=o&&o.prototype instanceof Uint8Array&&"set"===o.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n<e.length;)t[i++]=e[n++]};function c(e,t,i){e.length<40?r.utf8.write(e,t,i):t.utf8Write(e,i)}a.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this.push(s,t,e),this},a.prototype.string=function(e){var t=o.byteLength(e);return this.uint32(t),t&&this.push(c,t,e),this}},{14:14,15:15}]},{},[8])})("object"==typeof window&&window||"object"==typeof self&&self||commonjsGlobal)})),protobuf$1=Object.freeze(_mergeNamespaces$1({__proto__:null,default:protobuf},[protobuf]));function isBitSet(e,t){return 0!=(e&t)}const childrenBitmasks=[1,2,4,8],anyChildBitmask=15,cacheFlagBitmask=16,imageBitmask=64,terrainBitmask=128;function GoogleEarthEnterpriseTileInformation(e,t,i,n,r,o){this._bits=e,this.cnodeVersion=t,this.imageryVersion=i,this.terrainVersion=n,this.imageryProvider=r,this.terrainProvider=o,this.ancestorHasTerrain=!1,this.terrainState=void 0}function stringToBuffer(e){const t=e.length,i=new ArrayBuffer(t),n=new Uint8Array(i);for(let i=0;i<t;++i)n[i]=e.charCodeAt(i);return i}GoogleEarthEnterpriseTileInformation.clone=function(e,t){return defined(t)?(t._bits=e._bits,t.cnodeVersion=e.cnodeVersion,t.imageryVersion=e.imageryVersion,t.terrainVersion=e.terrainVersion,t.imageryProvider=e.imageryProvider,t.terrainProvider=e.terrainProvider):t=new GoogleEarthEnterpriseTileInformation(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),t.ancestorHasTerrain=e.ancestorHasTerrain,t.terrainState=e.terrainState,t},GoogleEarthEnterpriseTileInformation.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()},GoogleEarthEnterpriseTileInformation.prototype.hasSubtree=function(){return isBitSet(this._bits,cacheFlagBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasImagery=function(){return isBitSet(this._bits,imageBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasTerrain=function(){return isBitSet(this._bits,terrainBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChildren=function(){return isBitSet(this._bits,anyChildBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChild=function(e){return isBitSet(this._bits,childrenBitmasks[e])},GoogleEarthEnterpriseTileInformation.prototype.getChildBitmask=function(){return this._bits&anyChildBitmask};const defaultKey=stringToBuffer('Eô½\vyâjE",ÍqøIFgQ\0B%Æèa,f)\bÆ4Üjb%y\nwmiÖðk¡½NuàA[ß@V\fÙ»r|3SîOlÔq°{ÀEVZwUe\v3*¬l5Å0sø3>mF8J´Ýð.ÝuÚDt"úa"\f3"So¯9D\v9Ù9L¹¿«\\P_"uxéqh;ÁÄð<VqH\'UfYNeu£aF}a?A\0×´4MÎF°Õ¸\'{Ü+»Mg0ÈÑö\\Pú[/Fn5/\'C.ë\n\f^¥se4ål.jC\'c#U©?q{gC}:¯ÍâTUýKÆâ/(íË\\Æ-f§;/*"N°k.Ý\r}}GºC²²+>Mª>}æÎIÆæx\fa1-¤O¥~q ì\r1èN\v\0nPh}=\b\r¦n£h$[kó#ó¶s³\r\v@ÀØQ]ú".jßI\0¹ wUÆïj¿{GLîÜÜF
©S+S4ÿYä8è1N¹XFkË-#p\x005"Ï1²&/çÃu-6,rt°#G·ÓÑ&
7râ\0DÏÚ3-Þ`i#i*|ÍKQ\rT9w.)ê¦P¢joP\\>TûïP[\vEm(w7ÛJfJo åpâ¹q~\fmI-zþrÇòY0»]såÉ êxì ðB|G`°½&·q¶ÇÑ3=Ó«îcÈ+S D\\qÆÌD2O<ÊÀ)=RÓaX©}e´ÜÏ\rô=ñ\b©BÚ#\tØ¿^PIøMÀËGLO÷{+ØÅ1;µoÜl\rÑÛ?âéÚ_ÔâFaZÞUϤ\0¾ýÎgñJiæ HØ]~®q N®ÀV©<rçvì)IÖ]-ãÛ6©;fjÕ¶=P^R¹KÇsWxÉô.YoÐKW>\'\'Ç`Û;íSD>?mw¢\në?R¨ÆU^1I7
ôÅ&-©¿\'TÚÃj å*x°Öprªh½÷_H±~ÀXL?fù>áeÀp§Ï8i¯ðVldI\'xtOÂÞV9\0Úw\vË-û5Oõ\bQ`Á\nZGM&30xÚÀFGâ[y`In7gS\n>éìF9²ñ4\rÆSuná\fYÙÞ)
{II¥wy¾IV.6ç\v:»Ob{ÒM1/½8{¨O!áìFpv})"x\nÝ\\ÚÞQÏðüYRe|3ßóHÚ»*uÛ`²Ôüíì5¨ÿ(1-ÈÜF|["');function GoogleEarthEnterpriseMetadata(e){let t=e;"string"==typeof t||t instanceof Resource||(t=e.url);const i=Resource.createIfNeeded(t);i.appendForwardSlash(),this._resource=i,this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=CesiumMath.EPSILON12,this.providers={},this.key=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={};const n=this;this._readyPromise=requestDbRoot(this).then((function(){return n.getQuadTreePacket("",n._quadPacketVersion)})).then((function(){return!0})).catch((function(e){const t=`An error occurred while accessing ${getMetadataResource(n,"",1).url}.`;return Promise.reject(new RuntimeError(t))}))}Object.defineProperties(GoogleEarthEnterpriseMetadata.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}},readyPromise:{get:function(){return this._readyPromise}}}),GoogleEarthEnterpriseMetadata.tileXYToQuadKey=function(e,t,i){let n="";for(let r=i;r>=0;--r){const i=1<<r;let o=0;isBitSet(t,i)?isBitSet(e,i)&&(o|=1):(o|=2,isBitSet(e,i)||(o|=1)),n+=o}return n},GoogleEarthEnterpriseMetadata.quadKeyToTileXY=function(e){let t=0,i=0;const n=e.length-1;for(let r=n;r>=0;--r){const o=1<<r,a=+e[n-r];isBitSet(a,2)?isBitSet(a,1)||(t|=o):(i|=o,isBitSet(a,1)&&(t|=o))}return{x:t,y:i,level:n}},GoogleEarthEnterpriseMetadata.prototype.isValid=function(e){let t=this.getTileInformationFromQuadKey(e);if(defined(t))return null!==t;let i,n=!0,r=e;for(;r.length>1;){if(i=r.substring(r.length-1),r=r.substring(0,r.length-1),t=this.getTileInformationFromQuadKey(r),defined(t)){t.hasSubtree()||t.hasChild(parseInt(i))||(n=!1);break}if(null===t){n=!1;break}}return n};const taskProcessor$1=new TaskProcessor("decodeGoogleEarthEnterprisePacket");function populateSubtree(e,t,i){const n=e._tileInfo;let r,o=t,a=n[o];if(defined(a)&&(!a.hasSubtree()||a.hasChildren()))return a;for(;void 0===a&&o.length>1;)o=o.substring(0,o.length-1),a=n[o];const s=e._subtreePromises;let c=s[o];return defined(c)?c.then((function(){return r=new Request({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction}),populateSubtree(e,t,r)})):defined(a)&&a.hasSubtree()?(c=e.getQuadTreePacket(o,a.cnodeVersion,i),defined(c)?(s[o]=c,c.then((function(){return r=new Request({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction}),populateSubtree(e,t,r)})).finally((function(){delete s[o]}))):void 0):Promise.reject(new RuntimeError(`Couldn't load metadata for tile ${t}`))}function getMetadataResource(e,t,i,n){return e._resource.getDerivedResource({url:`flatfile?q2-0${t}-q.${i.toString()}`,request:n})}let dbrootParser,dbrootParserPromise;function requestDbRoot(e){const t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!defined(dbrootParserPromise)){const e=buildModuleUrl("ThirdParty/google-earth-dbroot-parser.js"),t=window.cesiumGoogleEarthDbRootParser;dbrootParserPromise=loadAndExecuteScript(e).then((function(){dbrootParser=window.cesiumGoogleEarthDbRootParser(protobuf$1),defined(t)?window.cesiumGoogleEarthDbRootParser=t:delete window.cesiumGoogleEarthDbRootParser}))}return dbrootParserPromise.then((function(){return t.fetchArrayBuffer()})).then((function(t){const i=dbrootParser.EncryptedDbRootProto.decode(new Uint8Array(t));let n=i.encryptionData,r=n.byteOffset,o=r+n.byteLength;const a=e.key=n.buffer.slice(r,o);n=i.dbrootData,r=n.byteOffset,o=r+n.byteLength;const s=n.buffer.slice(r,o);return taskProcessor$1.scheduleTask({buffer:s,type:"DbRoot",key:a},[s])})).then((function(t){const i=dbrootParser.DbRootProto.decode(new Uint8Array(t.buffer));if(e.imageryPresent=defaultValue(i.imageryPresent,e.imageryPresent),e.protoImagery=i.protoImagery,e.terrainPresent=defaultValue(i.terrainPresent,e.terrainPresent),defined(i.endSnippet)&&defined(i.endSnippet.model)){const t=i.endSnippet.model;e.negativeAltitudeExponentBias=defaultValue(t.negativeAltitudeExponentBias,e.negativeAltitudeExponentBias),e.negativeAltitudeThreshold=defaultValue(t.compressedNegativeAltitudeThreshold,e.negativeAltitudeThreshold)}defined(i.databaseVersion)&&(e._quadPacketVersion=defaultValue(i.databaseVersion.quadtreeVersion,e._quadPacketVersion));const n=e.providers,r=defaultValue(i.providerInfo,[]),o=r.length;for(let e=0;e<o;++e){const t=r[e],i=t.copyrightString;defined(i)&&(n[t.providerId]=new Credit(i.value))}})).catch((function(){console.log(`Failed to retrieve ${t.url}. Using defaults.`),e.key=defaultKey}))}function GoogleEarthEnterpriseTerrainData(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._buffer=e.buffer,this._credits=e.credits,this._negativeAltitudeExponentBias=e.negativeAltitudeExponentBias,this._negativeElevationThreshold=e.negativeElevationThreshold;const t=defaultValue(e.childTileMask,15);let i=3&t;i|=4&t?8:0,i|=8&t?4:0,this._childTileMask=i,this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._skirtHeight=void 0,this._bufferType=this._buffer.constructor,this._mesh=void 0,this._minimumHeight=void 0,this._maximumHeight=void 0}GoogleEarthEnterpriseMetadata.prototype.getQuadTreePacket=function(e,t,i){t=defaultValue(t,1);const n=getMetadataResource(this,e=defaultValue(e,""),t,i).fetchArrayBuffer();if(!defined(n))return;const r=this._tileInfo,o=this.key;return n.then((function(t){return taskProcessor$1.scheduleTask({buffer:t,quadKey:e,type:"Metadata",key:o},[t]).then((function(t){let i,n=-1;if(""!==e){n=e.length+1;const o=t[e];i=r[e],i._bits|=o._bits,delete t[e]}const o=Object.keys(t);o.sort((function(e,t){return e.length-t.length}));const a=o.length;for(let e=0;e<a;++e){const a=o[e];if(null!==t[a]){const e=GoogleEarthEnterpriseTileInformation.clone(t[a]),o=a.length;if(o===n)e.setParent(i);else if(o>1){const t=r[a.substring(0,a.length-1)];e.setParent(t)}r[a]=e}else r[a]=null}}))}))},GoogleEarthEnterpriseMetadata.prototype.populateSubtree=function(e,t,i,n){return populateSubtree(this,GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),n)},GoogleEarthEnterpriseMetadata.prototype.getTileInformation=function(e,t,i){const n=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i);return this._tileInfo[n]},GoogleEarthEnterpriseMetadata.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]},Object.defineProperties(GoogleEarthEnterpriseTerrainData.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){}}});const createMeshTaskName="createVerticesFromGoogleEarthEnterpriseBuffer",createMeshTaskProcessorNoThrottle=new TaskProcessor(createMeshTaskName),createMeshTaskProcessorThrottle=new TaskProcessor(createMeshTaskName,TerrainData.maximumAsynchronousTasks),nativeRectangleScratch=new Rectangle,rectangleScratch$6=new Rectangle;GoogleEarthEnterpriseTerrainData.prototype.createMesh=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tilingScheme,i=e.x,n=e.y,r=e.level,o=defaultValue(e.exaggeration,1),a=defaultValue(e.exaggerationRelativeHeight,0),s=defaultValue(e.throttle,!0),c=t.ellipsoid;t.tileXYToNativeRectangle(i,n,r,nativeRectangleScratch),t.tileXYToRectangle(i,n,r,rectangleScratch$6);const l=c.cartographicToCartesian(Rectangle.center(rectangleScratch$6)),u=40075.16/(1<<r);this._skirtHeight=Math.min(8*u,1e3);const d=(s?createMeshTaskProcessorThrottle:createMeshTaskProcessorNoThrottle).scheduleTask({buffer:this._buffer,nativeRectangle:nativeRectangleScratch,rectangle:rectangleScratch$6,relativeToCenter:l,ellipsoid:c,skirtHeight:this._skirtHeight,exaggeration:o,exaggerationRelativeHeight:a,includeWebMercatorT:!0,negativeAltitudeExponentBias:this._negativeAltitudeExponentBias,negativeElevationThreshold:this._negativeElevationThreshold});if(!defined(d))return;const h=this;return d.then((function(e){return h._mesh=new TerrainMesh(l,new Float32Array(e.vertices),new Uint16Array(e.indices),e.indexCountWithoutSkirts,e.vertexCountWithoutSkirts,e.minimumHeight,e.maximumHeight,BoundingSphere.clone(e.boundingSphere3D),Cartesian3.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,OrientedBoundingBox.clone(e.orientedBoundingBox),TerrainEncoding.clone(e.encoding),e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),h._minimumHeight=e.minimumHeight,h._maximumHeight=e.maximumHeight,h._buffer=void 0,h._mesh}))},GoogleEarthEnterpriseTerrainData.prototype.interpolateHeight=function(e,t,i){const n=CesiumMath.clamp((t-e.west)/e.width,0,1),r=CesiumMath.clamp((i-e.south)/e.height,0,1);return defined(this._mesh)?interpolateMeshHeight(this,n,r):interpolateHeight(this,n,r,e)};const upsampleTaskProcessor=new TaskProcessor("upsampleQuantizedTerrainMesh",TerrainData.maximumAsynchronousTasks);GoogleEarthEnterpriseTerrainData.prototype.upsample=function(e,t,i,n,r,o,a){const s=this._mesh;if(!defined(this._mesh))return;const c=2*t!==r,l=2*i===o,u=e.ellipsoid,d=e.tileXYToRectangle(r,o,a),h=upsampleTaskProcessor.scheduleTask({vertices:s.vertices,indices:s.indices,indexCountWithoutSkirts:s.indexCountWithoutSkirts,vertexCountWithoutSkirts:s.vertexCountWithoutSkirts,encoding:s.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:c,isNorthChild:l,childRectangle:d,ellipsoid:u});if(!defined(h))return;const p=this;return h.then((function(e){const t=new Uint16Array(e.vertices),i=IndexDatatype$1.createTypedArray(t.length/3,e.indices),n=p._skirtHeight;return new QuantizedMeshTerrainData({quantizedVertices:t,indices:i,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:BoundingSphere.clone(e.boundingSphere),orientedBoundingBox:OrientedBoundingBox.clone(e.orientedBoundingBox),horizonOcclusionPoint:Cartesian3.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:n,southSkirtHeight:n,eastSkirtHeight:n,northSkirtHeight:n,childTileMask:0,createdByUpsampling:!0,credits:p._credits})}))},GoogleEarthEnterpriseTerrainData.prototype.isChildAvailable=function(e,t,i,n){let r=2;return i!==2*e&&++r,n!==2*t&&(r-=2),0!=(this._childTileMask&1<<r)},GoogleEarthEnterpriseTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};const texCoordScratch0=new Cartesian2,texCoordScratch1=new Cartesian2,texCoordScratch2=new Cartesian2,barycentricCoordinateScratch=new Cartesian3;function interpolateMeshHeight(e,t,i){const n=e._mesh,r=n.vertices,o=n.encoding,a=n.indices;for(let e=0,n=a.length;e<n;e+=3){const n=a[e],s=a[e+1],c=a[e+2],l=o.decodeTextureCoordinates(r,n,texCoordScratch0),u=o.decodeTextureCoordinates(r,s,texCoordScratch1),d=o.decodeTextureCoordinates(r,c,texCoordScratch2),h=Intersections2D.computeBarycentricCoordinates(t,i,l.x,l.y,u.x,u.y,d.x,d.y,barycentricCoordinateScratch);if(h.x>=-1e-15&&h.y>=-1e-15&&h.z>=-1e-15){const e=o.decodeHeight(r,n),t=o.decodeHeight(r,s),i=o.decodeHeight(r,c);return h.x*e+h.y*t+h.z*i}}}const sizeOfUint16=Uint16Array.BYTES_PER_ELEMENT,sizeOfUint32$7=Uint32Array.BYTES_PER_ELEMENT,sizeOfInt32=Int32Array.BYTES_PER_ELEMENT,sizeOfFloat=Float32Array.BYTES_PER_ELEMENT,sizeOfDouble=Float64Array.BYTES_PER_ELEMENT;function interpolateHeight(e,t,i,n){const r=e._buffer;let o=0,a=0,s=0;i>.5?(t>.5?(o=2,a=.5):o=3,s=.5):t>.5&&(o=1,a=.5);const c=new DataView(r);let l=0;for(let e=0;e<o;++e)l+=c.getUint32(l,!0),l+=sizeOfUint32$7;l+=sizeOfUint32$7,l+=2*sizeOfDouble;const u=CesiumMath.toRadians(180*c.getFloat64(l,!0));l+=sizeOfDouble;const d=CesiumMath.toRadians(180*c.getFloat64(l,!0));l+=sizeOfDouble;const h=n.width/u/2,p=n.height/d/2,f=c.getInt32(l,!0);l+=sizeOfInt32;const m=3*c.getInt32(l,!0);l+=sizeOfInt32,l+=sizeOfInt32;const g=new Array(f),_=new Array(f),y=new Array(f);let C;for(C=0;C<f;++C)g[C]=a+c.getUint8(l++)*h,_[C]=s+c.getUint8(l++)*p,y[C]=6371010*c.getFloat32(l,!0),l+=sizeOfFloat;const T=new Array(m);for(C=0;C<m;++C)T[C]=c.getUint16(l,!0),l+=sizeOfUint16;for(C=0;C<m;C+=3){const e=T[C],n=T[C+1],r=T[C+2],o=g[e],a=g[n],s=g[r],c=_[e],l=_[n],u=_[r],d=Intersections2D.computeBarycentricCoordinates(t,i,o,c,a,l,s,u,barycentricCoordinateScratch);if(d.x>=-1e-15&&d.y>=-1e-15&&d.z>=-1e-15)return d.x*y[e]+d.y*y[n]+d.z*y[r]}}const TerrainState$2={UNKNOWN:0,NONE:1,SELF:2,PARENT:3},julianDateScratch=new JulianDate;function TerrainCache(){this._terrainCache={},this._lastTidy=JulianDate.now()}function GoogleEarthEnterpriseTerrainProvider(e){let t;if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).metadata))t=e.metadata;else{const i=Resource.createIfNeeded(e.url);t=new GoogleEarthEnterpriseMetadata(i)}this._metadata=t,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});let i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this._levelZeroMaximumGeometricError=40075.16,this._terrainCache=new TerrainCache,this._terrainPromises={},this._terrainRequests={},this._errorEvent=new Event,this._ready=!1;const n=this;let r;this._readyPromise=t.readyPromise.then((function(e){if(!t.terrainPresent){const e=new RuntimeError(`The server ${t.url} doesn't have terrain`);return r=TileProviderError.handleError(r,n,n._errorEvent,e.message,void 0,void 0,void 0,e),Promise.reject(e)}return TileProviderError.handleSuccess(r),n._ready=e,e})).catch((function(e){return r=TileProviderError.handleError(r,n,n._errorEvent,e.message,void 0,void 0,void 0,e),Promise.reject(e)}))}TerrainCache.prototype.add=function(e,t){this._terrainCache[e]={buffer:t,timestamp:JulianDate.now()}},TerrainCache.prototype.get=function(e){const t=this._terrainCache[e];if(defined(t))return delete this._terrainCache[e],t.buffer},TerrainCache.prototype.tidy=function(){if(JulianDate.now(julianDateScratch),JulianDate.secondsDifference(julianDateScratch,this._lastTidy)>10){const e=this._terrainCache,t=Object.keys(e),i=t.length;for(let n=0;n<i;++n){const i=t[n],r=e[i];JulianDate.secondsDifference(julianDateScratch,r.timestamp)>10&&delete e[i]}JulianDate.clone(julianDateScratch,this._lastTidy)}},Object.defineProperties(GoogleEarthEnterpriseTerrainProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tilingScheme:{get:function(){return this._tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});const taskProcessor=new TaskProcessor("decodeGoogleEarthEnterprisePacket");function computeChildMask(e,t,i){let n=t.getChildBitmask();if(t.terrainState===TerrainState$2.PARENT){n=0;for(let t=0;t<4;++t){const r=i.getTileInformationFromQuadKey(e+t.toString());defined(r)&&r.hasTerrain()&&(n|=1<<t)}}return n}function buildTerrainResource(e,t,i,n){return i=defined(i)&&i>0?i:1,e._metadata.resource.getDerivedResource({url:`flatfile?f1c-0${t}-t.${i.toString()}`,request:n})}GoogleEarthEnterpriseTerrainProvider.prototype.requestTileGeometry=function(e,t,i,n){const r=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),o=this._terrainCache,a=this._metadata,s=a.getTileInformationFromQuadKey(r);if(!defined(s))return Promise.reject(new RuntimeError("Terrain tile doesn't exist"));let c=s.terrainState;defined(c)||(c=s.terrainState=TerrainState$2.UNKNOWN);const l=o.get(r);if(defined(l)){const e=a.providers[s.terrainProvider];return Promise.resolve(new GoogleEarthEnterpriseTerrainData({buffer:l,childTileMask:computeChildMask(r,s,a),credits:defined(e)?[e]:void 0,negativeAltitudeExponentBias:a.negativeAltitudeExponentBias,negativeElevationThreshold:a.negativeAltitudeThreshold}))}if(o.tidy(),!s.ancestorHasTerrain)return Promise.resolve(new HeightmapTerrainData({buffer:new Uint8Array(256),width:16,height:16}));if(c===TerrainState$2.NONE)return Promise.reject(new RuntimeError("Terrain tile doesn't exist"));let u,d=r,h=-1;switch(c){case TerrainState$2.SELF:h=s.terrainVersion;break;case TerrainState$2.PARENT:d=d.substring(0,d.length-1),u=a.getTileInformationFromQuadKey(d),h=u.terrainVersion;break;case TerrainState$2.UNKNOWN:s.hasTerrain()?h=s.terrainVersion:(d=d.substring(0,d.length-1),u=a.getTileInformationFromQuadKey(d),defined(u)&&u.hasTerrain()&&(h=u.terrainVersion))}if(h<0)return Promise.reject(new RuntimeError("Terrain tile doesn't exist"));const p=this._terrainPromises,f=this._terrainRequests;let m,g;if(defined(p[d]))m=p[d],g=f[d];else{g=n;const e=buildTerrainResource(this,d,h,g).fetchArrayBuffer();if(!defined(e))return;m=e.then((function(e){return defined(e)?taskProcessor.scheduleTask({buffer:e,type:"Terrain",key:a.key},[e]).then((function(e){const t=a.getTileInformationFromQuadKey(d);t.terrainState=TerrainState$2.SELF,o.add(d,e[0]);const i=t.terrainProvider,n=e.length-1;for(let t=0;t<n;++t){const n=d+t.toString(),r=a.getTileInformationFromQuadKey(n);defined(r)&&(o.add(n,e[t+1]),r.terrainState=TerrainState$2.PARENT,0===r.terrainProvider&&(r.terrainProvider=i))}})):Promise.reject(new RuntimeError("Failed to load terrain."))})),p[d]=m,f[d]=g,m=m.finally((function(){delete p[d],delete f[d]}))}return m.then((function(){const e=o.get(r);if(defined(e)){const t=a.providers[s.terrainProvider];return new GoogleEarthEnterpriseTerrainData({buffer:e,childTileMask:computeChildMask(r,s,a),credits:defined(t)?[t]:void 0,negativeAltitudeExponentBias:a.negativeAltitudeExponentBias,negativeElevationThreshold:a.negativeAltitudeThreshold})}return Promise.reject(new RuntimeError("Failed to load terrain."))})).catch((function(e){return g.state===RequestState$1.CANCELLED?(n.state=g.state,Promise.reject(e)):(s.terrainState=TerrainState$2.NONE,Promise.reject(e))}))},GoogleEarthEnterpriseTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},GoogleEarthEnterpriseTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){const n=this._metadata;let r=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i);const o=n.getTileInformation(e,t,i);if(null===o)return!1;if(defined(o)){if(!o.ancestorHasTerrain)return!0;const e=o.terrainState;if(e===TerrainState$2.NONE)return!1;if(!(defined(e)&&e!==TerrainState$2.UNKNOWN||(o.terrainState=TerrainState$2.UNKNOWN,o.hasTerrain()))){r=r.substring(0,r.length-1);const e=n.getTileInformationFromQuadKey(r);if(!defined(e)||!e.hasTerrain())return!1}return!0}if(n.isValid(r)){const r=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});n.populateSubtree(e,t,i,r)}return!1},GoogleEarthEnterpriseTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};const PROJECTIONS=[GeographicProjection,WebMercatorProjection],PROJECTION_COUNT=PROJECTIONS.length,MITER_BREAK_SMALL=Math.cos(CesiumMath.toRadians(30)),MITER_BREAK_LARGE=Math.cos(CesiumMath.toRadians(150)),WALL_INITIAL_MIN_HEIGHT=0,WALL_INITIAL_MAX_HEIGHT=1e3;function GroundPolylineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;this.width=defaultValue(e.width,1),this._positions=t,this.granularity=defaultValue(e.granularity,9999),this.loop=defaultValue(e.loop,!1),this.arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._ellipsoid=Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(GroundPolylineGeometry.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+Ellipsoid.packedLength+1+1}}}),GroundPolylineGeometry.setProjectionAndEllipsoid=function(e,t){let i=0;for(let e=0;e<PROJECTION_COUNT;e++)if(t instanceof PROJECTIONS[e]){i=e;break}e._projectionIndex=i,e._ellipsoid=t.ellipsoid};const cart3Scratch1=new Cartesian3,cart3Scratch2=new Cartesian3,cart3Scratch3=new Cartesian3;function computeRightNormal(e,t,i,n,r){const o=getPosition$2(n,e,0,cart3Scratch1),a=getPosition$2(n,e,i,cart3Scratch2),s=getPosition$2(n,t,0,cart3Scratch3),c=direction(a,o,cart3Scratch2),l=direction(s,o,cart3Scratch3);return Cartesian3.cross(l,c,r),Cartesian3.normalize(r,r)}const interpolatedCartographicScratch$1=new Cartographic,interpolatedBottomScratch=new Cartesian3,interpolatedTopScratch=new Cartesian3,interpolatedNormalScratch=new Cartesian3;function interpolateSegment(e,t,i,n,r,o,a,s,c,l,u){if(0===r)return;let d;o===ArcType$1.GEODESIC?d=new EllipsoidGeodesic(e,t,a):o===ArcType$1.RHUMB&&(d=new EllipsoidRhumbLine(e,t,a));const h=d.surfaceDistance;if(h<r)return;const p=computeRightNormal(e,t,n,a,interpolatedNormalScratch),f=Math.ceil(h/r),m=h/f;let g=m;const _=f-1;let y=s.length;for(let e=0;e<_;e++){const e=d.interpolateUsingSurfaceDistance(g,interpolatedCartographicScratch$1),t=getPosition$2(a,e,i,interpolatedBottomScratch),r=getPosition$2(a,e,n,interpolatedTopScratch);Cartesian3.pack(p,s,y),Cartesian3.pack(t,c,y),Cartesian3.pack(r,l,y),u.push(e.latitude),u.push(e.longitude),y+=3,g+=m}}const heightlessCartographicScratch=new Cartographic;function getPosition$2(e,t,i,n){return Cartographic.clone(t,heightlessCartographicScratch),heightlessCartographicScratch.height=i,Cartographic.toCartesian(heightlessCartographicScratch,e,n)}function direction(e,t,i){return Cartesian3.subtract(e,t,i),Cartesian3.normalize(i,i),i}function tangentDirection(e,t,i,n){return n=direction(e,t,n),n=Cartesian3.cross(n,i,n),n=Cartesian3.normalize(n,n),n=Cartesian3.cross(i,n,n)}GroundPolylineGeometry.pack=function(e,t,i){let n=defaultValue(i,0);const r=e._positions,o=r.length;t[n++]=o;for(let e=0;e<o;++e){const i=r[e];Cartesian3.pack(i,t,n),n+=3}return t[n++]=e.granularity,t[n++]=e.loop?1:0,t[n++]=e.arcType,Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,t[n++]=e._projectionIndex,t[n++]=e._scene3DOnly?1:0,t},GroundPolylineGeometry.unpack=function(e,t,i){let n=defaultValue(t,0);const r=e[n++],o=new Array(r);for(let t=0;t<r;t++)o[t]=Cartesian3.unpack(e,n),n+=3;const a=e[n++],s=1===e[n++],c=e[n++],l=Ellipsoid.unpack(e,n);n+=Ellipsoid.packedLength;const u=e[n++],d=1===e[n++];return defined(i)||(i=new GroundPolylineGeometry({positions:o})),i._positions=o,i.granularity=a,i.loop=s,i.arcType=c,i._ellipsoid=l,i._projectionIndex=u,i._scene3DOnly=d,i};const toPreviousScratch=new Cartesian3,toNextScratch=new Cartesian3,forwardScratch=new Cartesian3,vertexUpScratch=new Cartesian3,cosine90=0,cosine180=-1;function computeVertexMiterNormal(e,t,i,n,r){const o=direction(i,t,vertexUpScratch),a=tangentDirection(e,t,o,toPreviousScratch),s=tangentDirection(n,t,o,toNextScratch);if(CesiumMath.equalsEpsilon(Cartesian3.dot(a,s),cosine180,CesiumMath.EPSILON5))return r=Cartesian3.cross(o,a,r),r=Cartesian3.normalize(r,r);r=Cartesian3.add(s,a,r),r=Cartesian3.normalize(r,r);const c=Cartesian3.cross(o,r,forwardScratch);return Cartesian3.dot(s,c)<cosine90&&(r=Cartesian3.negate(r,r)),r}const XZ_PLANE=Plane.fromPointNormal(Cartesian3.ZERO,Cartesian3.UNIT_Y),previousBottomScratch=new Cartesian3,vertexBottomScratch=new Cartesian3,vertexTopScratch=new Cartesian3,nextBottomScratch=new Cartesian3,vertexNormalScratch=new Cartesian3,intersectionScratch$1=new Cartesian3,cartographicScratch0=new Cartographic,cartographicScratch1=new Cartographic,cartographicIntersectionScratch=new Cartographic;GroundPolylineGeometry.createGeometry=function(e){const t=!e._scene3DOnly;let i=e.loop;const n=e._ellipsoid,r=e.granularity,o=e.arcType,a=new PROJECTIONS[e._projectionIndex](n),s=WALL_INITIAL_MIN_HEIGHT,c=WALL_INITIAL_MAX_HEIGHT;let l,u;const d=e._positions,h=d.length;let p,f,m,g;2===h&&(i=!1);const _=new EllipsoidRhumbLine(void 0,void 0,n);let y,C,T;const S=[d[0]];for(u=0;u<h-1;u++)p=d[u],f=d[u+1],y=IntersectionTests.lineSegmentPlane(p,f,XZ_PLANE,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?S.push(Cartesian3.clone(y)):e.arcType===ArcType$1.RHUMB&&(T=n.cartesianToCartographic(y,cartographicScratch0).longitude,m=n.cartesianToCartographic(p,cartographicScratch0),g=n.cartesianToCartographic(f,cartographicScratch1),_.setEndPoints(m,g),C=_.findIntersectionWithLongitude(T,cartographicIntersectionScratch),y=n.cartographicToCartesian(C,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||S.push(Cartesian3.clone(y)))),S.push(f);i&&(p=d[h-1],f=d[0],y=IntersectionTests.lineSegmentPlane(p,f,XZ_PLANE,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?S.push(Cartesian3.clone(y)):e.arcType===ArcType$1.RHUMB&&(T=n.cartesianToCartographic(y,cartographicScratch0).longitude,m=n.cartesianToCartographic(p,cartographicScratch0),g=n.cartesianToCartographic(f,cartographicScratch1),_.setEndPoints(m,g),C=_.findIntersectionWithLongitude(T,cartographicIntersectionScratch),y=n.cartographicToCartesian(C,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||S.push(Cartesian3.clone(y)))));let v=S.length,A=new Array(v);for(u=0;u<v;u++){const e=Cartographic.fromCartesian(S[u],n);e.height=0,A[u]=e}if(A=arrayRemoveDuplicates(A,Cartographic.equalsEpsilon),v=A.length,v<2)return;const E=[],b=[],x=[],P=[];let D=previousBottomScratch,w=vertexBottomScratch,M=vertexTopScratch,I=nextBottomScratch,R=vertexNormalScratch;const O=A[0],B=A[1];for(D=getPosition$2(n,A[v-1],s,D),I=getPosition$2(n,B,s,I),w=getPosition$2(n,O,s,w),M=getPosition$2(n,O,c,M),R=i?computeVertexMiterNormal(D,w,M,I,R):computeRightNormal(O,B,c,n,R),Cartesian3.pack(R,b,0),Cartesian3.pack(w,x,0),Cartesian3.pack(M,P,0),E.push(O.latitude),E.push(O.longitude),interpolateSegment(O,B,s,c,r,o,n,b,x,P,E),u=1;u<v-1;++u){D=Cartesian3.clone(w,D),w=Cartesian3.clone(I,w);const e=A[u];getPosition$2(n,e,c,M),getPosition$2(n,A[u+1],s,I),computeVertexMiterNormal(D,w,M,I,R),l=b.length,Cartesian3.pack(R,b,l),Cartesian3.pack(w,x,l),Cartesian3.pack(M,P,l),E.push(e.latitude),E.push(e.longitude),interpolateSegment(A[u],A[u+1],s,c,r,o,n,b,x,P,E)}const L=A[v-1],F=A[v-2];if(w=getPosition$2(n,L,s,w),M=getPosition$2(n,L,c,M),i){const e=A[0];D=getPosition$2(n,F,s,D),I=getPosition$2(n,e,s,I),R=computeVertexMiterNormal(D,w,M,I,R)}else R=computeRightNormal(F,L,c,n,R);if(l=b.length,Cartesian3.pack(R,b,l),Cartesian3.pack(w,x,l),Cartesian3.pack(M,P,l),E.push(L.latitude),E.push(L.longitude),i){for(interpolateSegment(L,O,s,c,r,o,n,b,x,P,E),l=b.length,u=0;u<3;++u)b[l+u]=b[u],x[l+u]=x[u],P[l+u]=P[u];E.push(O.latitude),E.push(O.longitude)}return generateGeometryAttributes(i,a,x,P,b,E,t)};const lineDirectionScratch=new Cartesian3,matrix3Scratch$1=new Matrix3,quaternionScratch$1=new Quaternion;function breakMiter(e,t,i,n){const r=direction(i,t,lineDirectionScratch),o=Cartesian3.dot(r,e);if(o>MITER_BREAK_SMALL||o<MITER_BREAK_LARGE){const t=direction(n,i,vertexUpScratch),r=o<MITER_BREAK_LARGE?CesiumMath.PI_OVER_TWO:-CesiumMath.PI_OVER_TWO,a=Quaternion.fromAxisAngle(t,r,quaternionScratch$1),s=Matrix3.fromQuaternion(a,matrix3Scratch$1);return Matrix3.multiplyByVector(s,e,e),!0}return!1}const endPosCartographicScratch=new Cartographic,normalStartpointScratch=new Cartesian3,normalEndpointScratch=new Cartesian3;function projectNormal(e,t,i,n,r){const o=Cartographic.toCartesian(t,e._ellipsoid,normalStartpointScratch);let a=Cartesian3.add(o,i,normalEndpointScratch),s=!1;const c=e._ellipsoid;let l=c.cartesianToCartographic(a,endPosCartographicScratch);Math.abs(t.longitude-l.longitude)>CesiumMath.PI_OVER_TWO&&(s=!0,a=Cartesian3.subtract(o,i,normalEndpointScratch),l=c.cartesianToCartographic(a,endPosCartographicScratch)),l.height=0;const u=e.project(l,r);return(r=Cartesian3.subtract(u,n,r)).z=0,r=Cartesian3.normalize(r,r),s&&Cartesian3.negate(r,r),r}const adjustHeightNormalScratch=new Cartesian3,adjustHeightOffsetScratch=new Cartesian3;function adjustHeights(e,t,i,n,r,o){const a=Cartesian3.subtract(t,e,adjustHeightNormalScratch);Cartesian3.normalize(a,a);const s=i-WALL_INITIAL_MIN_HEIGHT;let c=Cartesian3.multiplyByScalar(a,s,adjustHeightOffsetScratch);Cartesian3.add(e,c,r);const l=n-WALL_INITIAL_MAX_HEIGHT;c=Cartesian3.multiplyByScalar(a,l,adjustHeightOffsetScratch),Cartesian3.add(t,c,o)}const nudgeDirectionScratch=new Cartesian3;function nudgeXZ(e,t){const i=Plane.getPointDistance(XZ_PLANE,e),n=Plane.getPointDistance(XZ_PLANE,t);let r=nudgeDirectionScratch;CesiumMath.equalsEpsilon(i,0,CesiumMath.EPSILON2)?(r=direction(t,e,r),Cartesian3.multiplyByScalar(r,CesiumMath.EPSILON2,r),Cartesian3.add(e,r,e)):CesiumMath.equalsEpsilon(n,0,CesiumMath.EPSILON2)&&(r=direction(e,t,r),Cartesian3.multiplyByScalar(r,CesiumMath.EPSILON2,r),Cartesian3.add(t,r,t))}function nudgeCartographic(e,t){const i=Math.abs(e.longitude),n=Math.abs(t.longitude);if(CesiumMath.equalsEpsilon(i,CesiumMath.PI,CesiumMath.EPSILON11)){const n=CesiumMath.sign(t.longitude);return e.longitude=n*(i-CesiumMath.EPSILON11),1}if(CesiumMath.equalsEpsilon(n,CesiumMath.PI,CesiumMath.EPSILON11)){const i=CesiumMath.sign(e.longitude);return t.longitude=i*(n-CesiumMath.EPSILON11),2}return 0}const startCartographicScratch$1=new Cartographic,endCartographicScratch$1=new Cartographic,segmentStartTopScratch=new Cartesian3,segmentEndTopScratch=new Cartesian3,segmentStartBottomScratch=new Cartesian3,segmentEndBottomScratch=new Cartesian3,segmentStartNormalScratch=new Cartesian3,segmentEndNormalScratch=new Cartesian3,getHeightCartographics=[startCartographicScratch$1,endCartographicScratch$1],getHeightRectangleScratch=new Rectangle,adjustHeightStartTopScratch=new Cartesian3,adjustHeightEndTopScratch=new Cartesian3,adjustHeightStartBottomScratch=new Cartesian3,adjustHeightEndBottomScratch=new Cartesian3,segmentStart2DScratch=new Cartesian3,segmentEnd2DScratch=new Cartesian3,segmentStartNormal2DScratch=new Cartesian3,segmentEndNormal2DScratch=new Cartesian3,offsetScratch$b=new Cartesian3,startUpScratch=new Cartesian3,endUpScratch=new Cartesian3,rightScratch=new Cartesian3,startPlaneNormalScratch=new Cartesian3,endPlaneNormalScratch=new Cartesian3,encodeScratch$1=new EncodedCartesian3,encodeScratch2D=new EncodedCartesian3,forwardOffset2DScratch=new Cartesian3,right2DScratch=new Cartesian3,normalNudgeScratch=new Cartesian3,scratchBoundingSpheres=[new BoundingSphere,new BoundingSphere],REFERENCE_INDICES=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],REFERENCE_INDICES_LENGTH=REFERENCE_INDICES.length;function generateGeometryAttributes(e,t,i,n,r,o,a){let s,c;const l=t._ellipsoid,u=i.length/3-1,d=8*u,h=4*d,p=36*u,f=d>65535?new Uint32Array(p):new Uint16Array(p),m=new Float64Array(3*d),g=new Float32Array(h),_=new Float32Array(h),y=new Float32Array(h),C=new Float32Array(h),T=new Float32Array(h);let S,v,A,E;a&&(S=new Float32Array(h),v=new Float32Array(h),A=new Float32Array(h),E=new Float32Array(2*d));const b=o.length/2;let x=0;const P=startCartographicScratch$1;P.height=0;const D=endCartographicScratch$1;D.height=0;let w=segmentStartTopScratch,M=segmentEndTopScratch;if(a)for(c=0,s=1;s<b;s++)P.latitude=o[c],P.longitude=o[c+1],D.latitude=o[c+2],D.longitude=o[c+3],w=t.project(P,w),M=t.project(D,M),x+=Cartesian3.distance(w,M),c+=2;const I=n.length/3;M=Cartesian3.unpack(n,0,M);let R,O=0;for(c=3,s=1;s<I;s++)w=Cartesian3.clone(M,w),M=Cartesian3.unpack(n,c,M),O+=Cartesian3.distance(w,M),c+=3;c=3;let B=0,L=0,F=0,N=0,V=!1,$=Cartesian3.unpack(i,0,segmentEndBottomScratch),k=Cartesian3.unpack(n,0,segmentEndTopScratch),U=Cartesian3.unpack(r,0,segmentEndNormalScratch);if(e){breakMiter(U,Cartesian3.unpack(i,i.length-6,segmentStartBottomScratch),$,k)&&(U=Cartesian3.negate(U,U))}let G=0,z=0,H=0;for(s=0;s<u;s++){const e=Cartesian3.clone($,segmentStartBottomScratch),s=Cartesian3.clone(k,segmentStartTopScratch);let u,d,h,p,f=Cartesian3.clone(U,segmentStartNormalScratch);if(V&&(f=Cartesian3.negate(f,f)),$=Cartesian3.unpack(i,c,segmentEndBottomScratch),k=Cartesian3.unpack(n,c,segmentEndTopScratch),U=Cartesian3.unpack(r,c,segmentEndNormalScratch),V=breakMiter(U,e,$,k),P.latitude=o[B],P.longitude=o[B+1],D.latitude=o[B+2],D.longitude=o[B+3],a){const e=nudgeCartographic(P,D);u=t.project(P,segmentStart2DScratch),d=t.project(D,segmentEnd2DScratch);const i=direction(d,u,forwardOffset2DScratch);i.y=Math.abs(i.y),h=segmentStartNormal2DScratch,p=segmentEndNormal2DScratch,0===e||Cartesian3.dot(i,Cartesian3.UNIT_Y)>MITER_BREAK_SMALL?(h=projectNormal(t,P,f,u,segmentStartNormal2DScratch),p=projectNormal(t,D,U,d,segmentEndNormal2DScratch)):1===e?(p=projectNormal(t,D,U,d,segmentEndNormal2DScratch),h.x=0,h.y=CesiumMath.sign(P.longitude-Math.abs(D.longitude)),h.z=0):(h=projectNormal(t,P,f,u,segmentStartNormal2DScratch),p.x=0,p.y=CesiumMath.sign(P.longitude-D.longitude),p.z=0)}const b=Cartesian3.distance(s,k),w=EncodedCartesian3.fromCartesian(e,encodeScratch$1),M=Cartesian3.subtract($,e,offsetScratch$b),I=Cartesian3.normalize(M,rightScratch);let W=Cartesian3.subtract(s,e,startUpScratch);W=Cartesian3.normalize(W,W);let q=Cartesian3.cross(I,W,rightScratch);q=Cartesian3.normalize(q,q);let j=Cartesian3.cross(W,f,startPlaneNormalScratch);j=Cartesian3.normalize(j,j);let X=Cartesian3.subtract(k,$,endUpScratch);X=Cartesian3.normalize(X,X);let Y=Cartesian3.cross(U,X,endPlaneNormalScratch);Y=Cartesian3.normalize(Y,Y);const K=b/O,J=G/O;let Q,Z,ee,te=0,ie=0,ne=0;if(a){te=Cartesian3.distance(u,d),Q=EncodedCartesian3.fromCartesian(u,encodeScratch2D),Z=Cartesian3.subtract(d,u,forwardOffset2DScratch),ee=Cartesian3.normalize(Z,right2DScratch);const e=ee.x;ee.x=ee.y,ee.y=-e,ie=te/x,ne=z/x}for(R=0;R<8;R++){const e=N+4*R,t=L+2*R,i=e+3,n=R<4?1:-1,r=2===R||3===R||6===R||7===R?1:-1;Cartesian3.pack(w.high,g,e),g[i]=M.x,Cartesian3.pack(w.low,_,e),_[i]=M.y,Cartesian3.pack(j,y,e),y[i]=M.z,Cartesian3.pack(Y,C,e),C[i]=K*n,Cartesian3.pack(q,T,e);let o=J*r;0===o&&r<0&&(o=9),T[i]=o,a&&(S[e]=Q.high.x,S[e+1]=Q.high.y,S[e+2]=Q.low.x,S[e+3]=Q.low.y,A[e]=-h.y,A[e+1]=h.x,A[e+2]=p.y,A[e+3]=-p.x,v[e]=Z.x,v[e+1]=Z.y,v[e+2]=ee.x,v[e+3]=ee.y,E[t]=ie*n,o=ne*r,0===o&&r<0&&(o=9),E[t+1]=o)}const re=adjustHeightStartBottomScratch,oe=adjustHeightEndBottomScratch,ae=adjustHeightStartTopScratch,se=adjustHeightEndTopScratch,ce=Rectangle.fromCartographicArray(getHeightCartographics,getHeightRectangleScratch),le=ApproximateTerrainHeights.getMinimumMaximumHeights(ce,l),ue=le.minimumTerrainHeight,de=le.maximumTerrainHeight;H+=ue,H+=de,adjustHeights(e,s,ue,de,re,ae),adjustHeights($,k,ue,de,oe,se);let he=Cartesian3.multiplyByScalar(q,CesiumMath.EPSILON5,normalNudgeScratch);Cartesian3.add(re,he,re),Cartesian3.add(oe,he,oe),Cartesian3.add(ae,he,ae),Cartesian3.add(se,he,se),nudgeXZ(re,oe),nudgeXZ(ae,se),Cartesian3.pack(re,m,F),Cartesian3.pack(oe,m,F+3),Cartesian3.pack(se,m,F+6),Cartesian3.pack(ae,m,F+9),he=Cartesian3.multiplyByScalar(q,-2*CesiumMath.EPSILON5,normalNudgeScratch),Cartesian3.add(re,he,re),Cartesian3.add(oe,he,oe),Cartesian3.add(ae,he,ae),Cartesian3.add(se,he,se),nudgeXZ(re,oe),nudgeXZ(ae,se),Cartesian3.pack(re,m,F+12),Cartesian3.pack(oe,m,F+15),Cartesian3.pack(se,m,F+18),Cartesian3.pack(ae,m,F+21),B+=2,c+=3,L+=16,F+=24,N+=32,G+=b,z+=te}c=0;let W=0;for(s=0;s<u;s++){for(R=0;R<REFERENCE_INDICES_LENGTH;R++)f[c+R]=REFERENCE_INDICES[R]+W;W+=8,c+=REFERENCE_INDICES_LENGTH}const q=scratchBoundingSpheres;BoundingSphere.fromVertices(i,Cartesian3.ZERO,3,q[0]),BoundingSphere.fromVertices(n,Cartesian3.ZERO,3,q[1]);const j=BoundingSphere.fromBoundingSpheres(q);j.radius+=H/(2*u);const X={position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,normalize:!1,values:m}),startHiAndForwardOffsetX:getVec4GeometryAttribute(g),startLoAndForwardOffsetY:getVec4GeometryAttribute(_),startNormalAndForwardOffsetZ:getVec4GeometryAttribute(y),endNormalAndTextureCoordinateNormalizationX:getVec4GeometryAttribute(C),rightNormalAndTextureCoordinateNormalizationY:getVec4GeometryAttribute(T)};return a&&(X.startHiLo2D=getVec4GeometryAttribute(S),X.offsetAndRight2D=getVec4GeometryAttribute(v),X.startEndNormals2D=getVec4GeometryAttribute(A),X.texcoordNormalization2D=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,normalize:!1,values:E})),new Geometry({attributes:X,indices:f,boundingSphere:j})}function getVec4GeometryAttribute(e){return new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}function HeadingPitchRange(e,t,i){this.heading=defaultValue(e,0),this.pitch=defaultValue(t,0),this.range=defaultValue(i,0)}GroundPolylineGeometry._projectNormal=projectNormal,HeadingPitchRange.clone=function(e,t){if(defined(e))return defined(t)||(t=new HeadingPitchRange),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};const factorial=CesiumMath.factorial;function calculateCoefficientTerm(e,t,i,n,r,o){let a,s,c,l=0;if(n>0){for(s=0;s<r;s++){for(a=!1,c=0;c<o.length&&!a;c++)s===o[c]&&(a=!0);a||(o.push(s),l+=calculateCoefficientTerm(e,t,i,n-1,r,o),o.splice(o.length-1,1))}return l}for(l=1,s=0;s<r;s++){for(a=!1,c=0;c<o.length&&!a;c++)s===o[c]&&(a=!0);a||(l*=e-i[t[s]])}return l}const HermitePolynomialApproximation={type:"Hermite",getRequiredDataPoints:function(e,t){return t=defaultValue(t,0),Math.max(Math.floor((e+1)/(t+1)),2)},interpolateOrderZero:function(e,t,i,n,r){let o,a,s,c,l,u;defined(r)||(r=new Array(n));const d=t.length,h=new Array(n);for(o=0;o<n;o++){r[o]=0;const e=new Array(d);for(h[o]=e,a=0;a<d;a++)e[a]=[]}const p=d,f=new Array(p);for(o=0;o<p;o++)f[o]=o;let m=d-1;for(c=0;c<n;c++){for(a=0;a<p;a++)u=f[a]*n+c,h[c][0].push(i[u]);for(o=1;o<p;o++){let e=!1;for(a=0;a<p-o;a++){const r=t[f[a]],s=t[f[a+o]];let l;s-r<=0?(u=f[a]*n+n*o+c,l=i[u],h[c][o].push(l/factorial(o))):(l=h[c][o-1][a+1]-h[c][o-1][a],h[c][o].push(l/(s-r))),e=e||0!==l}e||(m=o-1)}}for(s=0,l=0;s<=0;s++)for(o=s;o<=m;o++){const i=calculateCoefficientTerm(e,f,t,s,o,[]);for(c=0;c<n;c++){const e=h[c][o][0];r[c+s*n]+=e*i}}return r}},arrayScratch=[];function fillCoefficientList(e,t,i,n,r,o){let a,s,c=-1;const l=t.length,u=l*(l+1)/2;for(let d=0;d<r;d++){const h=Math.floor(d*u);for(a=0;a<l;a++)s=t[a]*r*(o+1)+d,e[h+a]=n[s];for(let u=1;u<l;u++){let p=0;const f=Math.floor(u*(1-u)/2)+l*u;let m=!1;for(a=0;a<l-u;a++){const c=i[t[a]],g=i[t[a+u]];let _,y;if(g-c<=0)s=t[a]*r*(o+1)+r*u+d,_=n[s],y=_/CesiumMath.factorial(u),e[h+f+p]=y,p++;else{const t=Math.floor((u-1)*(2-u)/2)+l*(u-1);_=e[h+t+a+1]-e[h+t+a],y=_/(g-c),e[h+f+p]=y,p++}m=m||0!==_}m&&(c=Math.max(c,u))}}return c}HermitePolynomialApproximation.interpolate=function(e,t,i,n,r,o,a){const s=n*(o+1);defined(a)||(a=new Array(s));for(let e=0;e<s;e++)a[e]=0;const c=t.length,l=new Array(c*(r+1));let u;for(u=0;u<c;u++)for(let e=0;e<r+1;e++)l[u*(r+1)+e]=u;const d=l.length,h=arrayScratch,p=fillCoefficientList(h,l,t,i,n,r),f=[],m=d*(d+1)/2,g=Math.min(p,o);for(let i=0;i<=g;i++)for(u=i;u<=p;u++){f.length=0;const r=calculateCoefficientTerm(e,l,t,i,u,f),o=Math.floor(u*(1-u)/2)+d*u;for(let e=0;e<n;e++){const t=h[Math.floor(e*m)+o];a[e+i*n]+=t*r}}return a};const HilbertOrder={};function rotate$1(e,t,i,n){if(0!==n)return;1===i&&(t.x=e-1-t.x,t.y=e-1-t.y);const r=t.x;t.x=t.y,t.y=r}function IauOrientationParameters(e,t,i,n){this.rightAscension=e,this.declination=t,this.rotation=i,this.rotationRate=n}HilbertOrder.encode2D=function(e,t,i){const n=Math.pow(2,e),r={x:t,y:i};let o,a,s,c=BigInt(0);for(s=n/2;s>0;s/=2)o=(r.x&s)>0?1:0,a=(r.y&s)>0?1:0,c+=BigInt((3*o^a)*s*s),rotate$1(n,r,o,a);return c},HilbertOrder.decode2D=function(e,t){const i=Math.pow(2,e),n={x:0,y:0};let r,o,a,s;for(a=1,s=t;a<i;a*=2)r=1&Number(s/BigInt(2)),o=1&Number(s^BigInt(r)),rotate$1(a,n,r,o),n.x+=a*r,n.y+=a*o,s/=BigInt(4);return[n.x,n.y]};const Iau2000Orientation={},TdtMinusTai$1=32.184,J2000d$1=2451545,c1=-.0529921,c2=-.1059842,c3=13.0120009,c4=13.3407154,c5=.9856003,c6=26.4057084,c7=13.064993,c8=.3287146,c9=1.7484877,c10=-.1589763,c11=.0036096,c12=.1643573,c13=12.9590088;let dateTT=new JulianDate;function IauOrientationAxes(e){defined(e)&&"function"==typeof e||(e=Iau2000Orientation.ComputeMoon),this._computeFunction=e}Iau2000Orientation.ComputeMoon=function(e,t){defined(e)||(e=JulianDate.now()),dateTT=JulianDate.addSeconds(e,TdtMinusTai$1,dateTT);const i=JulianDate.totalDays(dateTT)-J2000d$1,n=i/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,r=(125.045+c1*i)*CesiumMath.RADIANS_PER_DEGREE,o=(250.089+c2*i)*CesiumMath.RADIANS_PER_DEGREE,a=(260.008+c3*i)*CesiumMath.RADIANS_PER_DEGREE,s=(176.625+c4*i)*CesiumMath.RADIANS_PER_DEGREE,c=(357.529+c5*i)*CesiumMath.RADIANS_PER_DEGREE,l=(311.589+c6*i)*CesiumMath.RADIANS_PER_DEGREE,u=(134.963+c7*i)*CesiumMath.RADIANS_PER_DEGREE,d=(276.617+c8*i)*CesiumMath.RADIANS_PER_DEGREE,h=(34.226+c9*i)*CesiumMath.RADIANS_PER_DEGREE,p=(15.134+c10*i)*CesiumMath.RADIANS_PER_DEGREE,f=(119.743+c11*i)*CesiumMath.RADIANS_PER_DEGREE,m=(239.961+c12*i)*CesiumMath.RADIANS_PER_DEGREE,g=(25.053+c13*i)*CesiumMath.RADIANS_PER_DEGREE,_=Math.sin(r),y=Math.sin(o),C=Math.sin(a),T=Math.sin(s),S=Math.sin(c),v=Math.sin(l),A=Math.sin(u),E=Math.sin(d),b=Math.sin(h),x=Math.sin(p),P=Math.sin(f),D=Math.sin(m),w=Math.sin(g),M=Math.cos(r),I=Math.cos(o),R=Math.cos(a),O=Math.cos(s),B=Math.cos(c),L=Math.cos(l),F=Math.cos(u),N=Math.cos(d),V=Math.cos(h),$=Math.cos(p),k=Math.cos(f),U=Math.cos(m),G=Math.cos(g),z=(269.9949+.0031*n-3.8787*_-.1204*y+.07*C-.0172*T+.0072*v-.0052*x+.0043*w)*CesiumMath.RADIANS_PER_DEGREE,H=(66.5392+.013*n+1.5419*M+.0239*I-.0278*R+.0068*O-.0029*L+9e-4*F+8e-4*$-9e-4*G)*CesiumMath.RADIANS_PER_DEGREE,W=(38.3213+13.17635815*i-14e-13*i*i+3.561*_+.1208*y-.0642*C+.0158*T+.0252*S-.0066*v-.0047*A-.0046*E+.0028*b+.0052*x+.004*P+.0019*D-.0044*w)*CesiumMath.RADIANS_PER_DEGREE,q=(13.17635815-2*i*14e-13+3.561*M*c1+.1208*I*c2-.0642*R*c3+.0158*O*c4+.0252*B*c5-.0066*L*c6-.0047*F*c7-.0046*N*c8+.0028*V*c9+.0052*$*c10+.004*k*c11+.0019*U*c12-.0044*G*c13)/86400*CesiumMath.RADIANS_PER_DEGREE;return defined(t)||(t=new IauOrientationParameters),t.rightAscension=z,t.declination=H,t.rotation=W,t.rotationRate=q,t};const xAxisScratch=new Cartesian3,yAxisScratch=new Cartesian3,zAxisScratch=new Cartesian3;function computeRotationMatrix(e,t,i){const n=xAxisScratch;n.x=Math.cos(e+CesiumMath.PI_OVER_TWO),n.y=Math.sin(e+CesiumMath.PI_OVER_TWO),n.z=0;const r=Math.cos(t),o=zAxisScratch;o.x=r*Math.cos(e),o.y=r*Math.sin(e),o.z=Math.sin(t);const a=Cartesian3.cross(o,n,yAxisScratch);return defined(i)||(i=new Matrix3),i[0]=n.x,i[1]=a.x,i[2]=o.x,i[3]=n.y,i[4]=a.y,i[5]=o.y,i[6]=n.z,i[7]=a.z,i[8]=o.z,i}const rotMtxScratch=new Matrix3,quatScratch=new Quaternion;IauOrientationAxes.prototype.evaluate=function(e,t){defined(e)||(e=JulianDate.now());const i=this._computeFunction(e),n=computeRotationMatrix(i.rightAscension,i.declination,t),r=CesiumMath.zeroToTwoPi(i.rotation),o=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,r,quatScratch),a=Matrix3.fromQuaternion(Quaternion.conjugate(o,o),rotMtxScratch);return Matrix3.multiply(a,n,n)};const InterpolationAlgorithm={};function PeliasGeocoderService(e){this._url=Resource.createIfNeeded(e),this._url.appendForwardSlash()}function IonGeocoderService(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.accessToken,Ion.defaultAccessToken),i=Resource.createIfNeeded(defaultValue(e.server,Ion.defaultServer));i.appendForwardSlash();const n=Ion.getDefaultTokenCredit(t);defined(n)&&e.scene.frameState.creditDisplay.addDefaultCredit(Credit.clone(n));const r=i.getDerivedResource({url:"v1/geocode"});defined(t)&&r.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=i,this._pelias=new PeliasGeocoderService(r)}function TimeInterval(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.start=defined(e.start)?JulianDate.clone(e.start):new JulianDate,this.stop=defined(e.stop)?JulianDate.clone(e.stop):new JulianDate,this.data=e.data,this.isStartIncluded=defaultValue(e.isStartIncluded,!0),this.isStopIncluded=defaultValue(e.isStopIncluded,!0)}InterpolationAlgorithm.type=void 0,InterpolationAlgorithm.getRequiredDataPoints=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolateOrderZero=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolate=DeveloperError.throwInstantiationError,Object.defineProperties(PeliasGeocoderService.prototype,{url:{get:function(){return this._url}}}),PeliasGeocoderService.prototype.geocode=function(e,t){return this._url.getDerivedResource({url:t===GeocodeType$1.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then((function(e){return e.features.map((function(e){let t;const i=e.bbox;if(defined(i))t=Rectangle.fromDegrees(i[0],i[1],i[2],i[3]);else{const i=e.geometry.coordinates[0],n=e.geometry.coordinates[1];t=Cartesian3.fromDegrees(i,n)}return{displayName:e.properties.label,destination:t}}))}))},IonGeocoderService.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)},Object.defineProperties(TimeInterval.prototype,{isEmpty:{get:function(){const e=JulianDate.compare(this.stop,this.start);return e<0||0===e&&(!this.isStartIncluded||!this.isStopIncluded)}}});const scratchInterval={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};TimeInterval.fromIso8601=function(e,t){const i=e.iso8601.split("/");if(2!==i.length)throw new DeveloperError("options.iso8601 is an invalid ISO 8601 interval.");const n=JulianDate.fromIso8601(i[0]),r=JulianDate.fromIso8601(i[1]),o=defaultValue(e.isStartIncluded,!0),a=defaultValue(e.isStopIncluded,!0),s=e.data;return defined(t)?(t.start=n,t.stop=r,t.isStartIncluded=o,t.isStopIncluded=a,t.data=s,t):(scratchInterval.start=n,scratchInterval.stop=r,scratchInterval.isStartIncluded=o,scratchInterval.isStopIncluded=a,scratchInterval.data=s,new TimeInterval(scratchInterval))},TimeInterval.toIso8601=function(e,t){return`${JulianDate.toIso8601(e.start,t)}/${JulianDate.toIso8601(e.stop,t)}`},TimeInterval.clone=function(e,t){if(defined(e))return defined(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new TimeInterval(e)},TimeInterval.equals=function(e,t,i){return e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equals(e.start,t.start)&&JulianDate.equals(e.stop,t.stop)&&(e.data===t.data||defined(i)&&i(e.data,t.data)))},TimeInterval.equalsEpsilon=function(e,t,i,n){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equalsEpsilon(e.start,t.start,i)&&JulianDate.equalsEpsilon(e.stop,t.stop,i)&&(e.data===t.data||defined(n)&&n(e.data,t.data)))},TimeInterval.intersect=function(e,t,i,n){if(!defined(t))return TimeInterval.clone(TimeInterval.EMPTY,i);const r=e.start,o=e.stop,a=t.start,s=t.stop,c=JulianDate.greaterThanOrEquals(a,r)&&JulianDate.greaterThanOrEquals(o,a),l=!c&&JulianDate.lessThanOrEquals(a,r)&&JulianDate.lessThanOrEquals(r,s);if(!c&&!l)return TimeInterval.clone(TimeInterval.EMPTY,i);const u=e.isStartIncluded,d=e.isStopIncluded,h=t.isStartIncluded,p=t.isStopIncluded,f=JulianDate.lessThan(o,s);return defined(i)||(i=new TimeInterval),i.start=c?a:r,i.isStartIncluded=u&&h||!JulianDate.equals(a,r)&&(c&&h||l&&u),i.stop=f?o:s,i.isStopIncluded=f?d:d&&p||!JulianDate.equals(s,o)&&p,i.data=defined(n)?n(e.data,t.data):e.data,i},TimeInterval.contains=function(e,t){if(e.isEmpty)return!1;const i=JulianDate.compare(e.start,t);if(0===i)return e.isStartIncluded;const n=JulianDate.compare(t,e.stop);return 0===n?e.isStopIncluded:i<0&&n<0},TimeInterval.prototype.clone=function(e){return TimeInterval.clone(this,e)},TimeInterval.prototype.equals=function(e,t){return TimeInterval.equals(this,e,t)},TimeInterval.prototype.equalsEpsilon=function(e,t,i){return TimeInterval.equalsEpsilon(this,e,t,i)},TimeInterval.prototype.toString=function(){return TimeInterval.toIso8601(this)},TimeInterval.EMPTY=Object.freeze(new TimeInterval({start:new JulianDate,stop:new JulianDate,isStartIncluded:!1,isStopIncluded:!1}));const MINIMUM_VALUE=Object.freeze(JulianDate.fromIso8601("0000-01-01T00:00:00Z")),MAXIMUM_VALUE=Object.freeze(JulianDate.fromIso8601("9999-12-31T24:00:00Z")),MAXIMUM_INTERVAL=Object.freeze(new TimeInterval({start:MINIMUM_VALUE,stop:MAXIMUM_VALUE})),Iso8601={MINIMUM_VALUE:MINIMUM_VALUE,MAXIMUM_VALUE:MAXIMUM_VALUE,MAXIMUM_INTERVAL:MAXIMUM_INTERVAL},KeyboardEventModifier={SHIFT:0,CTRL:1,ALT:2};var KeyboardEventModifier$1=Object.freeze(KeyboardEventModifier);function KTX2Transcoder(){}function makeReadyPromise(){const e=KTX2Transcoder._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then((function(){return KTX2Transcoder._transcodeTaskProcessor}));KTX2Transcoder._readyPromise=e}KTX2Transcoder._transcodeTaskProcessor=new TaskProcessor("transcodeKTX2",Number.POSITIVE_INFINITY),KTX2Transcoder._readyPromise=void 0,KTX2Transcoder.transcode=function(e,t){return defined(KTX2Transcoder._readyPromise)||makeReadyPromise(),KTX2Transcoder._readyPromise.then((function(i){let n;if(e instanceof ArrayBuffer){const r=new Uint8Array(e);return n={supportedTargetFormats:t,ktx2Buffer:r},i.scheduleTask(n,[e])}return n={supportedTargetFormats:t,ktx2Buffer:e},i.scheduleTask(n,[e.buffer])})).then((function(e){const t=e.length,i=Object.keys(e[0]),n=i.length;let r;for(r=0;r<t;r++){const t=e[r];for(let e=0;e<n;e++){const n=t[i[e]];t[i[e]]=new CompressedTextureBuffer(n.internalFormat,n.datatype,n.width,n.height,n.levelBuffer)}}if(1===n){for(r=0;r<t;++r)e[r]=e[r][i[0]];1===t&&(e=e[0])}return e})).catch((function(e){throw e}))};const LagrangePolynomialApproximation={type:"Lagrange",getRequiredDataPoints:function(e){return Math.max(e+1,2)},interpolateOrderZero:function(e,t,i,n,r){let o,a;defined(r)||(r=new Array(n));const s=t.length;for(o=0;o<n;o++)r[o]=0;for(o=0;o<s;o++){let c=1;for(a=0;a<s;a++)if(a!==o){const i=t[o]-t[a];c*=(e-t[a])/i}for(a=0;a<n;a++)r[a]+=c*i[o*n+a]}return r}},LinearApproximation={type:"Linear"};function loadImageFromTypedArray(e){const t=e.uint8Array,i=e.format,n=e.request,r=defaultValue(e.flipY,!1),o=defaultValue(e.skipColorSpaceConversion,!1),a=new Blob([t],{type:i});let s;return Resource.supportsImageBitmapOptions().then((function(e){if(e)return Promise.resolve(Resource.createImageBitmapFromBlob(a,{flipY:r,premultiplyAlpha:!1,skipColorSpaceConversion:o}));s=window.URL.createObjectURL(a);return new Resource({url:s,request:n}).fetchImage({flipY:r,skipColorSpaceConversion:o})})).then((function(e){return defined(s)&&window.URL.revokeObjectURL(s),e})).catch((function(e){return defined(s)&&window.URL.revokeObjectURL(s),Promise.reject(e)}))}let supportedTranscoderFormats;function loadKTX2(e){let t;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))t=Promise.resolve(e);else{t=Resource.createIfNeeded(e).fetchArrayBuffer()}return t.then((function(e){return KTX2Transcoder.transcode(e,supportedTranscoderFormats)}))}function ManagedArray(e){e=defaultValue(e,0),this._array=new Array(e),this._length=e}function MapProjection(){DeveloperError.throwInstantiationError()}LinearApproximation.getRequiredDataPoints=function(e){return 2},LinearApproximation.interpolateOrderZero=function(e,t,i,n,r){let o,a,s;defined(r)||(r=new Array(n));const c=t[0],l=t[1];for(o=0;o<n;o++)a=i[o],s=i[o+n],r[o]=((s-a)*e+l*a-c*s)/(l-c);return r},loadKTX2.setKTX2SupportedFormats=function(e,t,i,n,r,o){supportedTranscoderFormats={s3tc:e,pvrtc:t,astc:i,etc:n,etc1:r,bc7:o}},Object.defineProperties(ManagedArray.prototype,{length:{get:function(){return this._length},set:function(e){const t=this._array,i=this._length;if(e<i)for(let n=e;n<i;++n)t[n]=void 0;else e>t.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}}),ManagedArray.prototype.get=function(e){return this._array[e]},ManagedArray.prototype.set=function(e,t){e>=this._length&&(this.length=e+1),this._array[e]=t},ManagedArray.prototype.peek=function(){return this._array[this._length-1]},ManagedArray.prototype.push=function(e){const t=this.length++;this._array[t]=e},ManagedArray.prototype.pop=function(){if(0===this._length)return;const e=this._array[this._length-1];return--this.length,e},ManagedArray.prototype.reserve=function(e){e>this._array.length&&(this._array.length=e)},ManagedArray.prototype.resize=function(e){this.length=e},ManagedArray.prototype.trim=function(e){e=defaultValue(e,this._length),this._array.length=e},Object.defineProperties(MapProjection.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError}}),MapProjection.prototype.project=DeveloperError.throwInstantiationError,MapProjection.prototype.unproject=DeveloperError.throwInstantiationError;const leftScratchArray=[],rightScratchArray=[];function merge$1(e,t,i,n,r,o){const a=r-n+1,s=o-r,c=leftScratchArray,l=rightScratchArray;let u,d;for(u=0;u<a;++u)c[u]=e[n+u];for(d=0;d<s;++d)l[d]=e[r+d+1];u=0,d=0;for(let r=n;r<=o;++r){const n=c[u],o=l[d];u<a&&(d>=s||t(n,o,i)<=0)?(e[r]=n,++u):d<s&&(e[r]=o,++d)}}function sort(e,t,i,n,r){if(n>=r)return;const o=Math.floor(.5*(n+r));sort(e,t,i,n,o),sort(e,t,i,o+1,r),merge$1(e,t,i,n,o,r)}function mergeSort(e,t,i){const n=e.length,r=Math.ceil(.5*n);leftScratchArray.length=r,rightScratchArray.length=r,sort(e,t,i,0,n-1),leftScratchArray.length=0,rightScratchArray.length=0}const MortonOrder={};function insertOneSpacing(e){return e=1431655765&((e=858993459&((e=252645135&((e=16711935&(e^e<<8))^e<<4))^e<<2))^e<<1)}function insertTwoSpacing(e){return e=153391689&((e=51130563&((e=50393103&((e=50331903&(e^e<<16))^e<<8))^e<<4))^e<<2)}function removeOneSpacing(e){return e=65535&((e=16711935&((e=252645135&((e=858993459&((e&=1431655765)^e>>1))^e>>2))^e>>4))^e>>8)}function removeTwoSpacing(e){return e=1023&((e=4278190335&((e=50393103&((e=51130563&((e&=153391689)^e>>2))^e>>4))^e>>8))^e>>16)}function NearFarScalar(e,t,i,n){this.near=defaultValue(e,0),this.nearValue=defaultValue(t,0),this.far=defaultValue(i,1),this.farValue=defaultValue(n,0)}MortonOrder.encode2D=function(e,t){return(insertOneSpacing(e)|insertOneSpacing(t)<<1)>>>0},MortonOrder.decode2D=function(e,t){return defined(t)||(t=new Array(2)),t[0]=removeOneSpacing(e),t[1]=removeOneSpacing(e>>1),t},MortonOrder.encode3D=function(e,t,i){return insertTwoSpacing(e)|insertTwoSpacing(t)<<1|insertTwoSpacing(i)<<2},MortonOrder.decode3D=function(e,t){return defined(t)||(t=new Array(3)),t[0]=removeTwoSpacing(e),t[1]=removeTwoSpacing(e>>1),t[2]=removeTwoSpacing(e>>2),t},NearFarScalar.clone=function(e,t){if(defined(e))return defined(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new NearFarScalar(e.near,e.nearValue,e.far,e.farValue)},NearFarScalar.packedLength=4,NearFarScalar.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.near,t[i++]=e.nearValue,t[i++]=e.far,t[i]=e.farValue,t},NearFarScalar.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new NearFarScalar),i.near=e[t++],i.nearValue=e[t++],i.far=e[t++],i.farValue=e[t],i},NearFarScalar.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue},NearFarScalar.prototype.clone=function(e){return NearFarScalar.clone(this,e)},NearFarScalar.prototype.equals=function(e){return NearFarScalar.equals(this,e)};const Visibility={NONE:-1,PARTIAL:0,FULL:1};var Visibility$1=Object.freeze(Visibility);function Occluder(e,t){this._occluderPosition=Cartesian3.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}const scratchCartesian3$6=new Cartesian3;Object.defineProperties(Occluder.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){e=Cartesian3.clone(e,this._cameraPosition);const t=Cartesian3.subtract(this._occluderPosition,e,scratchCartesian3$6);let i=Cartesian3.magnitudeSquared(t);const n=this._occluderRadius*this._occluderRadius;let r,o,a;if(i>n){r=Math.sqrt(i-n),i=1/Math.sqrt(i),o=Cartesian3.multiplyByScalar(t,i,scratchCartesian3$6);const s=r*r*i;a=Cartesian3.add(e,Cartesian3.multiplyByScalar(o,s,scratchCartesian3$6),scratchCartesian3$6)}else r=Number.MAX_VALUE;this._horizonDistance=r,this._horizonPlaneNormal=o,this._horizonPlanePosition=a,this._cameraPosition=e}}}),Occluder.fromBoundingSphere=function(e,t,i){return defined(i)?(Cartesian3.clone(e.center,i._occluderPosition),i._occluderRadius=e.radius,i.cameraPosition=t,i):new Occluder(e,t)};const tempVecScratch=new Cartesian3;Occluder.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=Cartesian3.subtract(e,this._occluderPosition,tempVecScratch),i=this._occluderRadius;if(i=Cartesian3.magnitudeSquared(t)-i*i,i>0)return i=Math.sqrt(i)+this._horizonDistance,t=Cartesian3.subtract(e,this._cameraPosition,t),i*i>Cartesian3.magnitudeSquared(t)}return!1};const occludeePositionScratch=new Cartesian3;Occluder.prototype.isBoundingSphereVisible=function(e){const t=Cartesian3.clone(e.center,occludeePositionScratch),i=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let e=Cartesian3.subtract(t,this._occluderPosition,tempVecScratch),n=this._occluderRadius-i;if(n=Cartesian3.magnitudeSquared(e)-n*n,i<this._occluderRadius)return n>0&&(n=Math.sqrt(n)+this._horizonDistance,e=Cartesian3.subtract(t,this._cameraPosition,e),n*n+i*i>Cartesian3.magnitudeSquared(e));if(n>0){e=Cartesian3.subtract(t,this._cameraPosition,e);const r=Cartesian3.magnitudeSquared(e),o=this._occluderRadius*this._occluderRadius,a=i*i;return(this._horizonDistance*this._horizonDistance+o)*a>r*o||(n=Math.sqrt(n)+this._horizonDistance,n*n+a>r)}return!0}return!1};const tempScratch=new Cartesian3;Occluder.prototype.computeVisibility=function(e){const t=Cartesian3.clone(e.center),i=e.radius;if(i>this._occluderRadius)return Visibility$1.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let e=Cartesian3.subtract(t,this._occluderPosition,tempScratch),n=this._occluderRadius-i;const r=Cartesian3.magnitudeSquared(e);if(n=r-n*n,n>0){n=Math.sqrt(n)+this._horizonDistance,e=Cartesian3.subtract(t,this._cameraPosition,e);const o=Cartesian3.magnitudeSquared(e);return n*n+i*i<o?Visibility$1.NONE:(n=this._occluderRadius+i,n=r-n*n,n>0?(n=Math.sqrt(n)+this._horizonDistance,o<n*n+i*i?Visibility$1.FULL:Visibility$1.PARTIAL):(e=Cartesian3.subtract(t,this._horizonPlanePosition,e),Cartesian3.dot(e,this._horizonPlaneNormal)>-i?Visibility$1.PARTIAL:Visibility$1.FULL))}}return Visibility$1.NONE};const occludeePointScratch=new Cartesian3;Occluder.computeOccludeePoint=function(e,t,i){const n=Cartesian3.clone(t),r=Cartesian3.clone(e.center),o=e.radius,a=i.length,s=Cartesian3.normalize(Cartesian3.subtract(n,r,occludeePointScratch),occludeePointScratch),c=-Cartesian3.dot(s,r),l=Occluder._anyRotationVector(r,s,c);let u,d=Occluder._horizonToPlaneNormalDotProduct(e,s,c,l,i[0]);if(!d)return;for(let t=1;t<a;++t){if(u=Occluder._horizonToPlaneNormalDotProduct(e,s,c,l,i[t]),!u)return;u<d&&(d=u)}if(d<.0017453283658983088)return;const h=o/d;return Cartesian3.add(r,Cartesian3.multiplyByScalar(s,h,occludeePointScratch),occludeePointScratch)};const computeOccludeePointFromRectangleScratch=[];Occluder.computeOccludeePointFromRectangle=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);const i=Rectangle.subsample(e,t,0,computeOccludeePointFromRectangleScratch),n=BoundingSphere.fromPoints(i),r=Cartesian3.ZERO;if(!Cartesian3.equals(r,n.center))return Occluder.computeOccludeePoint(new BoundingSphere(r,t.minimumRadius),n.center,i)};const tempVec0Scratch=new Cartesian3;Occluder._anyRotationVector=function(e,t,i){const n=Cartesian3.abs(t,tempVec0Scratch);let r=n.x>n.y?0:1;(0===r&&n.z>n.x||1===r&&n.z>n.y)&&(r=2);const o=new Cartesian3;let a;0===r?(n.x=e.x,n.y=e.y+1,n.z=e.z+1,a=Cartesian3.UNIT_X):1===r?(n.x=e.x+1,n.y=e.y,n.z=e.z+1,a=Cartesian3.UNIT_Y):(n.x=e.x+1,n.y=e.y+1,n.z=e.z,a=Cartesian3.UNIT_Z);const s=(Cartesian3.dot(t,n)+i)/-Cartesian3.dot(t,a);return Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(n,Cartesian3.multiplyByScalar(a,s,o),n),e,n),n)};const posDirectionScratch=new Cartesian3;Occluder._rotationVector=function(e,t,i,n,r){let o=Cartesian3.subtract(n,e,posDirectionScratch);if(o=Cartesian3.normalize(o,o),Cartesian3.dot(t,o)<.9999999847691291){const e=Cartesian3.cross(t,o,o);if(Cartesian3.magnitude(e)>CesiumMath.EPSILON13)return Cartesian3.normalize(e,new Cartesian3)}return r};const posScratch1=new Cartesian3,occluerPosScratch=new Cartesian3,posScratch2=new Cartesian3,horizonPlanePosScratch=new Cartesian3;function OffsetGeometryInstanceAttribute(e,t,i){e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,0),this.value=new Float32Array([e,t,i])}function OpenCageGeocoderService(e,t,i){(e=Resource.createIfNeeded(e)).appendForwardSlash(),e.setQueryParameters({key:t}),this._url=e,this._params=defaultValue(i,{})}Occluder._horizonToPlaneNormalDotProduct=function(e,t,i,n,r){const o=Cartesian3.clone(r,posScratch1),a=Cartesian3.clone(e.center,occluerPosScratch),s=e.radius;let c=Cartesian3.subtract(a,o,posScratch2);const l=Cartesian3.magnitudeSquared(c),u=s*s;if(l<u)return!1;const d=l-u,h=Math.sqrt(d),p=h*(1/Math.sqrt(l))*h;c=Cartesian3.normalize(c,c);const f=Cartesian3.add(o,Cartesian3.multiplyByScalar(c,p,horizonPlanePosScratch),horizonPlanePosScratch),m=Math.sqrt(d-p*p);let g=this._rotationVector(a,t,i,o,n),_=Cartesian3.fromElements(g.x*g.x*c.x+(g.x*g.y-g.z)*c.y+(g.x*g.z+g.y)*c.z,(g.x*g.y+g.z)*c.x+g.y*g.y*c.y+(g.y*g.z-g.x)*c.z,(g.x*g.z-g.y)*c.x+(g.y*g.z+g.x)*c.y+g.z*g.z*c.z,posScratch1);_=Cartesian3.normalize(_,_);const y=Cartesian3.multiplyByScalar(_,m,posScratch1);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(f,y,posScratch2),a,posScratch2),posScratch2);const C=Cartesian3.dot(t,g);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.subtract(f,y,g),a,g),g);const T=Cartesian3.dot(t,g);return C<T?C:T},Object.defineProperties(OffsetGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),OffsetGeometryInstanceAttribute.fromCartesian3=function(e){return new OffsetGeometryInstanceAttribute(e.x,e.y,e.z)},OffsetGeometryInstanceAttribute.toValue=function(e,t){return defined(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t},Object.defineProperties(OpenCageGeocoderService.prototype,{url:{get:function(){return this._url}},params:{get:function(){return this._params}}}),OpenCageGeocoderService.prototype.geocode=function(e){return this._url.getDerivedResource({url:"json",queryParameters:combine$2(this._params,{q:e})}).fetchJson().then((function(e){return e.results.map((function(e){let t;const i=e.bounds;if(defined(i))t=Rectangle.fromDegrees(i.southwest.lng,i.southwest.lat,i.northeast.lng,i.northeast.lat);else{const i=e.geometry.lat,n=e.geometry.lng;t=Cartesian3.fromDegrees(i,n)}return{displayName:e.formatted,destination:t}}))}))};const Packable={packedLength:void 0,pack:DeveloperError.throwInstantiationError,unpack:DeveloperError.throwInstantiationError},PackableForInterpolation={packedInterpolationLength:void 0,convertPackedArrayForInterpolation:DeveloperError.throwInstantiationError,unpackInterpolationResult:DeveloperError.throwInstantiationError};function measureText(e,t,i,n,r){const o=e.measureText(t);if(!!/\S/.test(t)){const a=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),s=document.createElement("canvas"),c=100,l=o.width+c|0,u=3*a,d=u/2;s.width=l,s.height=u;const h=s.getContext("2d");h.font=i,h.fillStyle="white",h.fillRect(0,0,s.width+1,s.height+1),n&&(h.strokeStyle="black",h.lineWidth=e.lineWidth,h.strokeText(t,c/2,d)),r&&(h.fillStyle="black",h.fillText(t,c/2,d));const p=h.getImageData(0,0,l,u).data,f=p.length,m=4*l;let g,_,y,C;for(g=0;g<f;++g)if(255!==p[g]){y=g/m|0;break}for(g=f-1;g>=0;--g)if(255!==p[g]){C=g/m|0;break}let T=-1;for(g=0;g<l&&-1===T;++g)for(_=0;_<u;++_){const e=4*g+_*m;if(255!==p[e]||255!==p[e+1]||255!==p[e+2]||255!==p[e+3]){T=g;break}}return{width:o.width,height:C-y,ascent:d-y,descent:C-d,minx:T-c/2}}return{width:o.width,height:0,ascent:0,descent:0,minx:0}}let imageSmoothingEnabledName;function writeTextToCanvas(e,t){if(""===e)return;t=defaultValue(t,defaultValue.EMPTY_OBJECT);const i=defaultValue(t.font,"10px sans-serif"),n=defaultValue(t.stroke,!1),r=defaultValue(t.fill,!0),o=defaultValue(t.strokeWidth,1),a=defaultValue(t.backgroundColor,Color.TRANSPARENT),s=defaultValue(t.padding,0),c=2*s,l=document.createElement("canvas");l.width=1,l.height=1,l.style.font=i;const u=l.getContext("2d");defined(imageSmoothingEnabledName)||(defined(u.imageSmoothingEnabled)?imageSmoothingEnabledName="imageSmoothingEnabled":defined(u.mozImageSmoothingEnabled)?imageSmoothingEnabledName="mozImageSmoothingEnabled":defined(u.webkitImageSmoothingEnabled)?imageSmoothingEnabledName="webkitImageSmoothingEnabled":defined(u.msImageSmoothingEnabled)&&(imageSmoothingEnabledName="msImageSmoothingEnabled")),u.font=i,u.lineJoin="round",u.lineWidth=o,u[imageSmoothingEnabledName]=!1,l.style.visibility="hidden",document.body.appendChild(l);const d=measureText(u,e,i,n,r);l.dimensions=d,document.body.removeChild(l),l.style.visibility="";const h=-d.minx,p=Math.ceil(d.width)+h+c,f=d.height+c,m=f-(f-d.ascent+s)+c;if(l.width=p,l.height=f,u.font=i,u.lineJoin="round",u.lineWidth=o,u[imageSmoothingEnabledName]=!1,a!==Color.TRANSPARENT&&(u.fillStyle=a.toCssColorString(),u.fillRect(0,0,l.width,l.height)),n){const i=defaultValue(t.strokeColor,Color.BLACK);u.strokeStyle=i.toCssColorString(),u.strokeText(e,h+s,m)}if(r){const i=defaultValue(t.fillColor,Color.WHITE);u.fillStyle=i.toCssColorString(),u.fillText(e,h+s,m)}return l}function PinBuilder(){this._cache={}}PinBuilder.prototype.fromColor=function(e,t){return createPin(void 0,void 0,e,t,this._cache)},PinBuilder.prototype.fromUrl=function(e,t,i){return createPin(e,void 0,t,i,this._cache)},PinBuilder.prototype.fromMakiIconId=function(e,t,i){return createPin(buildModuleUrl(`Assets/Textures/maki/${encodeURIComponent(e)}.png`),void 0,t,i,this._cache)},PinBuilder.prototype.fromText=function(e,t,i){return createPin(void 0,e,t,i,this._cache)};const colorScratch$7=new Color;function drawPin(e,t,i){e.save(),e.scale(i/24,i/24),e.fillStyle=t.toCssColorString(),e.strokeStyle=t.brighten(.6,colorScratch$7).toCssColorString(),e.lineWidth=.846,e.beginPath(),e.moveTo(6.72,.422),e.lineTo(17.28,.422),e.bezierCurveTo(18.553,.422,19.577,1.758,19.577,3.415),e.lineTo(19.577,10.973),e.bezierCurveTo(19.577,12.63,18.553,13.966,17.282,13.966),e.lineTo(14.386,14.008),e.lineTo(11.826,23.578),e.lineTo(9.614,14.008),e.lineTo(6.719,13.965),e.bezierCurveTo(5.446,13.983,4.422,12.629,4.422,10.972),e.lineTo(4.422,3.416),e.bezierCurveTo(4.423,1.76,5.447,.423,6.718,.423),e.closePath(),e.fill(),e.stroke(),e.restore()}function drawIcon(e,t,i){const n=i/2.5;let r=n,o=n;t.width>t.height?o=n*(t.height/t.width):t.width<t.height&&(r=n*(t.width/t.height));const a=Math.round((i-r)/2),s=Math.round(7/24*i-o/2);e.globalCompositeOperation="destination-out",e.drawImage(t,a-1,s,r,o),e.drawImage(t,a,s-1,r,o),e.drawImage(t,a+1,s,r,o),e.drawImage(t,a,s+1,r,o),e.globalCompositeOperation="destination-over",e.fillStyle=Color.BLACK.toCssColorString(),e.fillRect(a-1,s-1,r+2,o+2),e.globalCompositeOperation="destination-out",e.drawImage(t,a,s,r,o),e.globalCompositeOperation="destination-over",e.fillStyle=Color.WHITE.toCssColorString(),e.fillRect(a-1,s-2,r+2,o+2)}const stringifyScratch=new Array(4);function createPin(e,t,i,n,r){stringifyScratch[0]=e,stringifyScratch[1]=t,stringifyScratch[2]=i,stringifyScratch[3]=n;const o=JSON.stringify(stringifyScratch),a=r[o];if(defined(a))return a;const s=document.createElement("canvas");s.width=n,s.height=n;const c=s.getContext("2d");if(drawPin(c,i,n),defined(e)){const t=Resource.createIfNeeded(e).fetchImage().then((function(e){return drawIcon(c,e,n),r[o]=s,s}));return r[o]=t,t}if(defined(t)){const e=writeTextToCanvas(t,{font:`bold ${n}px sans-serif`});drawIcon(c,e,n)}return r[o]=s,s}function PlaneGeometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}PlaneGeometry.packedLength=VertexFormat.packedLength,PlaneGeometry.pack=function(e,t,i){return i=defaultValue(i,0),VertexFormat.pack(e._vertexFormat,t,i),t};const scratchVertexFormat$5=new VertexFormat,scratchOptions$9={vertexFormat:scratchVertexFormat$5};PlaneGeometry.unpack=function(e,t,i){t=defaultValue(t,0);const n=VertexFormat.unpack(e,t,scratchVertexFormat$5);return defined(i)?(i._vertexFormat=VertexFormat.clone(n,i._vertexFormat),i):new PlaneGeometry(scratchOptions$9)};const min$1=new Cartesian3(-.5,-.5,0),max$1=new Cartesian3(.5,.5,0);function PlaneOutlineGeometry(){this._workerName="createPlaneOutlineGeometry"}PlaneGeometry.createGeometry=function(e){const t=e._vertexFormat,i=new GeometryAttributes;let n,r;if(t.position){if(r=new Float64Array(12),r[0]=min$1.x,r[1]=min$1.y,r[2]=0,r[3]=max$1.x,r[4]=min$1.y,r[5]=0,r[6]=max$1.x,r[7]=max$1.y,r[8]=0,r[9]=min$1.x,r[10]=max$1.y,r[11]=0,i.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:r}),t.normal){const e=new Float32Array(12);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=1,e[9]=0,e[10]=0,e[11]=1,i.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}if(t.st){const e=new Float32Array(8);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=1,e[5]=1,e[6]=0,e[7]=1,i.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:e})}if(t.tangent){const e=new Float32Array(12);e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=1,e[7]=0,e[8]=0,e[9]=1,e[10]=0,e[11]=0,i.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}if(t.bitangent){const e=new Float32Array(12);e[0]=0,e[1]=1,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=1,e[8]=0,e[9]=0,e[10]=1,e[11]=0,i.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}n=new Uint16Array(6),n[0]=0,n[1]=1,n[2]=2,n[3]=0,n[4]=2,n[5]=3}return new Geometry({attributes:i,indices:n,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})},PlaneOutlineGeometry.packedLength=0,PlaneOutlineGeometry.pack=function(e,t){return t},PlaneOutlineGeometry.unpack=function(e,t,i){return defined(i)?i:new PlaneOutlineGeometry};const min=new Cartesian3(-.5,-.5,0),max=new Cartesian3(.5,.5,0);PlaneOutlineGeometry.createGeometry=function(){const e=new GeometryAttributes,t=new Uint16Array(8),i=new Float64Array(12);return i[0]=min.x,i[1]=min.y,i[2]=min.z,i[3]=max.x,i[4]=min.y,i[5]=min.z,i[6]=max.x,i[7]=max.y,i[8]=min.z,i[9]=min.x,i[10]=max.y,i[11]=min.z,e.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i}),t[0]=0,t[1]=1,t[2]=1,t[3]=2,t[4]=2,t[5]=3,t[6]=3,t[7]=0,new Geometry({attributes:e,indices:t,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})};const scratchBarycentricCoords=new Cartesian3;function pointInsideTriangle(e,t,i,n){const r=barycentricCoordinates(e,t,i,n,scratchBarycentricCoords);return!!defined(r)&&(r.x>0&&r.y>0&&r.z>0)}const scratchCarto1=new Cartographic,scratchCarto2=new Cartographic;function adjustPosHeightsForNormal(e,t,i,n){const r=n.cartesianToCartographic(e,scratchCarto1).height,o=n.cartesianToCartographic(t,scratchCarto2);o.height=r,n.cartographicToCartesian(o,t);const a=n.cartesianToCartographic(i,scratchCarto2);a.height=r-100,n.cartographicToCartesian(a,i)}const scratchBoundingRectangle=new BoundingRectangle,scratchPosition$c=new Cartesian3,scratchNormal$2=new Cartesian3,scratchTangent$1=new Cartesian3,scratchBitangent$1=new Cartesian3,p1Scratch=new Cartesian3,p2Scratch=new Cartesian3;let scratchPerPosNormal=new Cartesian3,scratchPerPosTangent=new Cartesian3,scratchPerPosBitangent=new Cartesian3;const appendTextureCoordinatesOrigin=new Cartesian2,appendTextureCoordinatesCartesian2=new Cartesian2,appendTextureCoordinatesCartesian3=new Cartesian3,appendTextureCoordinatesQuaternion=new Quaternion,appendTextureCoordinatesMatrix3=new Matrix3,tangentMatrixScratch=new Matrix3;function computeAttributes$2(e){const t=e.vertexFormat,i=e.geometry,n=e.shadowVolume,r=i.attributes.position.values;let o=r.length;const a=e.wall,s=e.top||a,c=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||n){const l=e.boundingRectangle,u=e.tangentPlane,d=e.ellipsoid,h=e.stRotation,p=e.perPositionHeight,f=appendTextureCoordinatesOrigin;f.x=l.x,f.y=l.y;const m=t.st?new Float32Array(o/3*2):void 0;let g;t.normal&&(g=p&&s&&!a?i.attributes.normal.values:new Float32Array(o));const _=t.tangent?new Float32Array(o):void 0,y=t.bitangent?new Float32Array(o):void 0,C=n?new Float32Array(o):void 0;let T=0,S=0,v=scratchNormal$2,A=scratchTangent$1,E=scratchBitangent$1,b=!0,x=appendTextureCoordinatesMatrix3,P=tangentMatrixScratch;if(0!==h){let e=Quaternion.fromAxisAngle(u._plane.normal,h,appendTextureCoordinatesQuaternion);x=Matrix3.fromQuaternion(e,x),e=Quaternion.fromAxisAngle(u._plane.normal,-h,appendTextureCoordinatesQuaternion),P=Matrix3.fromQuaternion(e,P)}else x=Matrix3.clone(Matrix3.IDENTITY,x),P=Matrix3.clone(Matrix3.IDENTITY,P);let D=0,w=0;s&&c&&(D=o/2,w=o/3,o/=2);for(let i=0;i<o;i+=3){const h=Cartesian3.fromArray(r,i,appendTextureCoordinatesCartesian3);if(t.st){let e=Matrix3.multiplyByVector(x,h,scratchPosition$c);e=d.scaleToGeodeticSurface(e,e);const t=u.projectPointOntoPlane(e,appendTextureCoordinatesCartesian2);Cartesian2.subtract(t,f,t);const i=CesiumMath.clamp(t.x/l.width,0,1),n=CesiumMath.clamp(t.y/l.height,0,1);c&&(m[T+w]=i,m[T+1+w]=n),s&&(m[T]=i,m[T+1]=n),T+=2}if(t.normal||t.tangent||t.bitangent||n){const l=S+1,u=S+2;if(a){if(i+3<o){const e=Cartesian3.fromArray(r,i+3,p1Scratch);if(b){const t=Cartesian3.fromArray(r,i+o,p2Scratch);p&&adjustPosHeightsForNormal(h,e,t,d),Cartesian3.subtract(e,h,e),Cartesian3.subtract(t,h,t),v=Cartesian3.normalize(Cartesian3.cross(t,e,v),v),b=!1}Cartesian3.equalsEpsilon(e,h,CesiumMath.EPSILON10)&&(b=!0)}(t.tangent||t.bitangent)&&(E=d.geodeticSurfaceNormal(h,E),t.tangent&&(A=Cartesian3.normalize(Cartesian3.cross(E,v,A),A)))}else v=d.geodeticSurfaceNormal(h,v),(t.tangent||t.bitangent)&&(p&&(scratchPerPosNormal=Cartesian3.fromArray(g,S,scratchPerPosNormal),scratchPerPosTangent=Cartesian3.cross(Cartesian3.UNIT_Z,scratchPerPosNormal,scratchPerPosTangent),scratchPerPosTangent=Cartesian3.normalize(Matrix3.multiplyByVector(P,scratchPerPosTangent,scratchPerPosTangent),scratchPerPosTangent),t.bitangent&&(scratchPerPosBitangent=Cartesian3.normalize(Cartesian3.cross(scratchPerPosNormal,scratchPerPosTangent,scratchPerPosBitangent),scratchPerPosBitangent))),A=Cartesian3.cross(Cartesian3.UNIT_Z,v,A),A=Cartesian3.normalize(Matrix3.multiplyByVector(P,A,A),A),t.bitangent&&(E=Cartesian3.normalize(Cartesian3.cross(v,A,E),E)));t.normal&&(e.wall?(g[S+D]=v.x,g[l+D]=v.y,g[u+D]=v.z):c&&(g[S+D]=-v.x,g[l+D]=-v.y,g[u+D]=-v.z),(s&&!p||a)&&(g[S]=v.x,g[l]=v.y,g[u]=v.z)),n&&(a&&(v=d.geodeticSurfaceNormal(h,v)),C[S+D]=-v.x,C[l+D]=-v.y,C[u+D]=-v.z),t.tangent&&(e.wall?(_[S+D]=A.x,_[l+D]=A.y,_[u+D]=A.z):c&&(_[S+D]=-A.x,_[l+D]=-A.y,_[u+D]=-A.z),s&&(p?(_[S]=scratchPerPosTangent.x,_[l]=scratchPerPosTangent.y,_[u]=scratchPerPosTangent.z):(_[S]=A.x,_[l]=A.y,_[u]=A.z))),t.bitangent&&(c&&(y[S+D]=E.x,y[l+D]=E.y,y[u+D]=E.z),s&&(p?(y[S]=scratchPerPosBitangent.x,y[l]=scratchPerPosBitangent.y,y[u]=scratchPerPosBitangent.z):(y[S]=E.x,y[l]=E.y,y[u]=E.z))),S+=3}}t.st&&(i.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:m})),t.normal&&(i.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:g})),t.tangent&&(i.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),t.bitangent&&(i.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:y})),n&&(i.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C}))}if(e.extrude&&defined(e.offsetAttribute)){const t=r.length/3;let n=new Uint8Array(t);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)s&&c||a?n=arrayFill(n,1,0,t/2):s&&(n=arrayFill(n,1));else{n=arrayFill(n,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1)}i.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return i}const startCartographicScratch=new Cartographic,endCartographicScratch=new Cartographic,idlCross={westOverIDL:0,eastOverIDL:0};let ellipsoidGeodesic=new EllipsoidGeodesic;function computeRectangle$1(e,t,i,n,r){if(r=defaultValue(r,new Rectangle),!defined(e)||e.length<3)return r.west=0,r.north=0,r.south=0,r.east=0,r;if(i===ArcType$1.RHUMB)return Rectangle.fromCartesianArray(e,t,r);ellipsoidGeodesic.ellipsoid.equals(t)||(ellipsoidGeodesic=new EllipsoidGeodesic(void 0,void 0,t)),r.west=Number.POSITIVE_INFINITY,r.east=Number.NEGATIVE_INFINITY,r.south=Number.POSITIVE_INFINITY,r.north=Number.NEGATIVE_INFINITY,idlCross.westOverIDL=Number.POSITIVE_INFINITY,idlCross.eastOverIDL=Number.NEGATIVE_INFINITY;const o=1/CesiumMath.chordLength(n,t.maximumRadius),a=e.length;let s,c=t.cartesianToCartographic(e[0],endCartographicScratch),l=startCartographicScratch;for(let i=1;i<a;i++)s=l,l=c,c=t.cartesianToCartographic(e[i],s),ellipsoidGeodesic.setEndPoints(l,c),interpolateAndGrowRectangle(ellipsoidGeodesic,o,r,idlCross);return s=l,l=c,c=t.cartesianToCartographic(e[0],s),ellipsoidGeodesic.setEndPoints(l,c),interpolateAndGrowRectangle(ellipsoidGeodesic,o,r,idlCross),r.east-r.west>idlCross.eastOverIDL-idlCross.westOverIDL&&(r.west=idlCross.westOverIDL,r.east=idlCross.eastOverIDL,r.east>CesiumMath.PI&&(r.east=r.east-CesiumMath.TWO_PI),r.west>CesiumMath.PI&&(r.west=r.west-CesiumMath.TWO_PI)),r}const interpolatedCartographicScratch=new Cartographic;function interpolateAndGrowRectangle(e,t,i,n){const r=e.surfaceDistance,o=Math.ceil(r*t),a=o>0?r/(o-1):Number.POSITIVE_INFINITY;let s=0;for(let t=0;t<o;t++){const t=e.interpolateUsingSurfaceDistance(s,interpolatedCartographicScratch);s+=a;const r=t.longitude,o=t.latitude;i.west=Math.min(i.west,r),i.east=Math.max(i.east,r),i.south=Math.min(i.south,o),i.north=Math.max(i.north,o);const c=r>=0?r:r+CesiumMath.TWO_PI;n.westOverIDL=Math.min(n.westOverIDL,c),n.eastOverIDL=Math.max(n.eastOverIDL,c)}}const createGeometryFromPositionsExtrudedPositions=[];function createGeometryFromPositionsExtruded$1(e,t,i,n,r,o,a,s,c){const l={walls:[]};let u;if(o||a){const n=PolygonGeometryLibrary.createGeometryFromPositions(e,t,i,r,s,c),d=n.attributes.position.values,h=n.indices;let p,f;if(o&&a){const e=d.concat(d);p=e.length/3,f=IndexDatatype$1.createTypedArray(p,2*h.length),f.set(h);const t=h.length,i=p/2;for(u=0;u<t;u+=3){const e=f[u]+i,n=f[u+1]+i,r=f[u+2]+i;f[u+t]=r,f[u+1+t]=n,f[u+2+t]=e}if(n.attributes.position.values=e,r&&s.normal){const t=n.attributes.normal.values;n.attributes.normal.values=new Float32Array(e.length),n.attributes.normal.values.set(t)}n.indices=f}else if(a){for(p=d.length/3,f=IndexDatatype$1.createTypedArray(p,h.length),u=0;u<h.length;u+=3)f[u]=h[u+2],f[u+1]=h[u+1],f[u+2]=h[u];n.indices=f}l.topAndBottom=new GeometryInstance({geometry:n})}let d=n.outerRing,h=EllipsoidTangentPlane.fromPoints(d,e),p=h.projectPointsOntoPlane(d,createGeometryFromPositionsExtrudedPositions),f=PolygonPipeline.computeWindingOrder2D(p);f===WindingOrder$1.CLOCKWISE&&(d=d.slice().reverse());let m=PolygonGeometryLibrary.computeWallGeometry(d,e,i,r,c);l.walls.push(new GeometryInstance({geometry:m}));const g=n.holes;for(u=0;u<g.length;u++){let t=g[u];h=EllipsoidTangentPlane.fromPoints(t,e),p=h.projectPointsOntoPlane(t,createGeometryFromPositionsExtrudedPositions),f=PolygonPipeline.computeWindingOrder2D(p),f===WindingOrder$1.COUNTER_CLOCKWISE&&(t=t.slice().reverse()),m=PolygonGeometryLibrary.computeWallGeometry(t,e,i,r,c),l.walls.push(new GeometryInstance({geometry:m}))}return l}function PolygonGeometry(e){const t=e.polygonHierarchy,i=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),n=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.stRotation,0),a=defaultValue(e.perPositionHeight,!1),s=a&&defined(e.extrudedHeight);let c=defaultValue(e.height,0),l=defaultValue(e.extrudedHeight,c);if(!s){const e=Math.max(c,l);l=Math.min(c,l),c=e}this._vertexFormat=VertexFormat.clone(i),this._ellipsoid=Ellipsoid.clone(n),this._granularity=r,this._stRotation=o,this._height=c,this._extrudedHeight=l,this._closeTop=defaultValue(e.closeTop,!0),this._closeBottom=defaultValue(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=s,this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+VertexFormat.packedLength+12}PolygonGeometry.fromPositions=function(e){return new PolygonGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType})},PolygonGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._stRotation,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._closeTop?1:0,t[i++]=e._closeBottom?1:0,t[i++]=e._shadowVolume?1:0,t[i++]=defaultValue(e._offsetAttribute,-1),t[i++]=e._arcType,t[i]=e.packedLength,t};const scratchEllipsoid$9=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$4=new VertexFormat,dummyOptions$1={polygonHierarchy:{}};function textureCoordinateRotationPoints$1(e){const t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];const i=e._ellipsoid,n=e._polygonHierarchy.positions,r=e.rectangle;return Geometry._textureCoordinateRotationPoints(n,t,i,r)}function PolygonHierarchy(e,t){this.positions=defined(e)?e:[],this.holes=defined(t)?t:[]}PolygonGeometry.unpack=function(e,t,i){t=defaultValue(t,0);const n=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$9);t+=Ellipsoid.packedLength;const o=VertexFormat.unpack(e,t,scratchVertexFormat$4);t+=VertexFormat.packedLength;const a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=1===e[t++],d=1===e[t++],h=1===e[t++],p=1===e[t++],f=1===e[t++],m=e[t++],g=e[t++],_=e[t];return defined(i)||(i=new PolygonGeometry(dummyOptions$1)),i._polygonHierarchy=n,i._ellipsoid=Ellipsoid.clone(r,i._ellipsoid),i._vertexFormat=VertexFormat.clone(o,i._vertexFormat),i._height=a,i._extrudedHeight=s,i._granularity=c,i._stRotation=l,i._perPositionHeightExtrude=u,i._perPositionHeight=d,i._closeTop=h,i._closeBottom=p,i._shadowVolume=f,i._offsetAttribute=-1===m?void 0:m,i._arcType=g,i.packedLength=_,i},PolygonGeometry.computeRectangle=function(e,t){const i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),n=defaultValue(e.arcType,ArcType$1.GEODESIC),r=e.polygonHierarchy,o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle$1(r.positions,o,n,i,t)},PolygonGeometry.createGeometry=function(e){const t=e._vertexFormat,i=e._ellipsoid,n=e._granularity,r=e._stRotation,o=e._polygonHierarchy,a=e._perPositionHeight,s=e._closeTop,c=e._closeBottom,l=e._arcType;let u=o.positions;if(u.length<3)return;const d=EllipsoidTangentPlane.fromPoints(u,i),h=PolygonGeometryLibrary.polygonsFromHierarchy(o,d.projectPointsOntoPlane.bind(d),!a,i),p=h.hierarchy,f=h.polygons;if(0===p.length)return;u=p[0].outerRing;const m=PolygonGeometryLibrary.computeBoundingRectangle(d.plane.normal,d.projectPointOntoPlane.bind(d),u,r,scratchBoundingRectangle),g=[],_=e._height,y=e._extrudedHeight,C={perPositionHeight:a,vertexFormat:t,geometry:void 0,tangentPlane:d,boundingRectangle:m,ellipsoid:i,stRotation:r,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:l};let T;if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(_,y,0,CesiumMath.EPSILON2))for(C.extrude=!0,C.top=s,C.bottom=c,C.shadowVolume=e._shadowVolume,C.offsetAttribute=e._offsetAttribute,T=0;T<f.length;T++){const e=createGeometryFromPositionsExtruded$1(i,f[T],n,p[T],a,s,c,t,l);let r;s&&c?(r=e.topAndBottom,C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(r.geometry,_,y,i,a)):s?(r=e.topAndBottom,r.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.geometry.attributes.position.values,_,i,!a),C.geometry=r.geometry):c&&(r=e.topAndBottom,r.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.geometry.attributes.position.values,y,i,!0),C.geometry=r.geometry),(s||c)&&(C.wall=!1,r.geometry=computeAttributes$2(C),g.push(r));const o=e.walls;C.wall=!0;for(let e=0;e<o.length;e++){const t=o[e];C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(t.geometry,_,y,i,a),t.geometry=computeAttributes$2(C),g.push(t)}}else for(T=0;T<f.length;T++){const r=new GeometryInstance({geometry:PolygonGeometryLibrary.createGeometryFromPositions(i,f[T],n,a,t,l)});if(r.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.geometry.attributes.position.values,_,i,!a),C.geometry=r.geometry,r.geometry=computeAttributes$2(C),defined(e._offsetAttribute)){const t=r.geometry.attributes.position.values.length,i=new Uint8Array(t/3);arrayFill(i,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),r.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}g.push(r)}const S=GeometryPipeline.combineInstances(g)[0];S.attributes.position.values=new Float64Array(S.attributes.position.values),S.indices=IndexDatatype$1.createTypedArray(S.attributes.position.values.length/3,S.indices);const v=S.attributes,A=BoundingSphere.fromVertices(v.position.values);return t.position||delete v.position,new Geometry({attributes:v,indices:S.indices,primitiveType:S.primitiveType,boundingSphere:A,offsetAttribute:e._offsetAttribute})},PolygonGeometry.createShadowVolume=function(e,t,i){const n=e._granularity,r=e._ellipsoid,o=t(n,r),a=i(n,r);return new PolygonGeometry({polygonHierarchy:e._polygonHierarchy,ellipsoid:r,stRotation:e._stRotation,granularity:n,perPositionHeight:!1,extrudedHeight:o,height:a,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})},Object.defineProperties(PolygonGeometry.prototype,{rectangle:{get:function(){if(!defined(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=computeRectangle$1(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints$1(this)),this._textureCoordinateRotationPoints}}});const createGeometryFromPositionsPositions=[],createGeometryFromPositionsSubdivided=[];function createGeometryFromPositions(e,t,i,n,r){const o=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);let a,s;PolygonPipeline.computeWindingOrder2D(o)===WindingOrder$1.CLOCKWISE&&(o.reverse(),t=t.slice().reverse());let c=t.length,l=0;if(n)for(a=new Float64Array(2*c*3),s=0;s<c;s++){const e=t[s],i=t[(s+1)%c];a[l++]=e.x,a[l++]=e.y,a[l++]=e.z,a[l++]=i.x,a[l++]=i.y,a[l++]=i.z}else{let n=0;if(r===ArcType$1.GEODESIC)for(s=0;s<c;s++)n+=PolygonGeometryLibrary.subdivideLineCount(t[s],t[(s+1)%c],i);else if(r===ArcType$1.RHUMB)for(s=0;s<c;s++)n+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[s],t[(s+1)%c],i);for(a=new Float64Array(3*n),s=0;s<c;s++){let n;r===ArcType$1.GEODESIC?n=PolygonGeometryLibrary.subdivideLine(t[s],t[(s+1)%c],i,createGeometryFromPositionsSubdivided):r===ArcType$1.RHUMB&&(n=PolygonGeometryLibrary.subdivideRhumbLine(e,t[s],t[(s+1)%c],i,createGeometryFromPositionsSubdivided));const o=n.length;for(let e=0;e<o;++e)a[l++]=n[e]}}c=a.length/3;const u=2*c,d=IndexDatatype$1.createTypedArray(c,u);for(l=0,s=0;s<c-1;s++)d[l++]=s,d[l++]=s+1;return d[l++]=c-1,d[l++]=0,new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:d,primitiveType:PrimitiveType$1.LINES})})}function createGeometryFromPositionsExtruded(e,t,i,n,r){const o=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);let a,s;PolygonPipeline.computeWindingOrder2D(o)===WindingOrder$1.CLOCKWISE&&(o.reverse(),t=t.slice().reverse());let c=t.length;const l=new Array(c);let u=0;if(n)for(a=new Float64Array(2*c*3*2),s=0;s<c;++s){l[s]=u/3;const e=t[s],i=t[(s+1)%c];a[u++]=e.x,a[u++]=e.y,a[u++]=e.z,a[u++]=i.x,a[u++]=i.y,a[u++]=i.z}else{let n=0;if(r===ArcType$1.GEODESIC)for(s=0;s<c;s++)n+=PolygonGeometryLibrary.subdivideLineCount(t[s],t[(s+1)%c],i);else if(r===ArcType$1.RHUMB)for(s=0;s<c;s++)n+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[s],t[(s+1)%c],i);for(a=new Float64Array(3*n*2),s=0;s<c;++s){let n;l[s]=u/3,r===ArcType$1.GEODESIC?n=PolygonGeometryLibrary.subdivideLine(t[s],t[(s+1)%c],i,createGeometryFromPositionsSubdivided):r===ArcType$1.RHUMB&&(n=PolygonGeometryLibrary.subdivideRhumbLine(e,t[s],t[(s+1)%c],i,createGeometryFromPositionsSubdivided));const o=n.length;for(let e=0;e<o;++e)a[u++]=n[e]}}c=a.length/6;const d=l.length,h=2*(2*c+d),p=IndexDatatype$1.createTypedArray(c+d,h);for(u=0,s=0;s<c;++s)p[u++]=s,p[u++]=(s+1)%c,p[u++]=s+c,p[u++]=(s+1)%c+c;for(s=0;s<d;s++){const e=l[s];p[u++]=e,p[u++]=e+c}return new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:p,primitiveType:PrimitiveType$1.LINES})})}function PolygonOutlineGeometry(e){const t=e.polygonHierarchy,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.perPositionHeight,!1),o=r&&defined(e.extrudedHeight),a=defaultValue(e.arcType,ArcType$1.GEODESIC);let s=defaultValue(e.height,0),c=defaultValue(e.extrudedHeight,s);if(!o){const e=Math.max(s,c);c=Math.min(s,c),s=e}this._ellipsoid=Ellipsoid.clone(i),this._granularity=n,this._height=s,this._extrudedHeight=c,this._arcType=a,this._polygonHierarchy=t,this._perPositionHeight=r,this._perPositionHeightExtrude=o,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+8}PolygonOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._arcType,t[i++]=defaultValue(e._offsetAttribute,-1),t[i]=e.packedLength,t};const scratchEllipsoid$8=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),dummyOptions={polygonHierarchy:{}};PolygonOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);const n=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$8);t+=Ellipsoid.packedLength;const o=e[t++],a=e[t++],s=e[t++],c=1===e[t++],l=1===e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)||(i=new PolygonOutlineGeometry(dummyOptions)),i._polygonHierarchy=n,i._ellipsoid=Ellipsoid.clone(r,i._ellipsoid),i._height=o,i._extrudedHeight=a,i._granularity=s,i._perPositionHeight=l,i._perPositionHeightExtrude=c,i._arcType=u,i._offsetAttribute=-1===d?void 0:d,i.packedLength=h,i},PolygonOutlineGeometry.fromPositions=function(e){return new PolygonOutlineGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute})},PolygonOutlineGeometry.createGeometry=function(e){const t=e._ellipsoid,i=e._granularity,n=e._polygonHierarchy,r=e._perPositionHeight,o=e._arcType,a=PolygonGeometryLibrary.polygonOutlinesFromHierarchy(n,!r,t);if(0===a.length)return;let s;const c=[],l=CesiumMath.chordLength(i,t.maximumRadius),u=e._height,d=e._extrudedHeight;let h,p;if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(u,d,0,CesiumMath.EPSILON2))for(p=0;p<a.length;p++){if(s=createGeometryFromPositionsExtruded(t,a[p],l,r,o),s.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(s.geometry,u,d,t,r),defined(e._offsetAttribute)){const t=s.geometry.attributes.position.values.length/3;let i=new Uint8Array(t);e._offsetAttribute===GeometryOffsetAttribute$1.TOP?i=arrayFill(i,1,0,t/2):(h=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,i=arrayFill(i,h)),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}c.push(s)}else for(p=0;p<a.length;p++){if(s=createGeometryFromPositions(t,a[p],l,r,o),s.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(s.geometry.attributes.position.values,u,t,!r),defined(e._offsetAttribute)){const t=s.geometry.attributes.position.values.length,i=new Uint8Array(t/3);h=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,arrayFill(i,h),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}c.push(s)}const f=GeometryPipeline.combineInstances(c)[0],m=BoundingSphere.fromVertices(f.attributes.position.values);return new Geometry({attributes:f.attributes,indices:f.indices,primitiveType:f.primitiveType,boundingSphere:m,offsetAttribute:e._offsetAttribute})};const scratchInterpolateColorsArray=[];function interpolateColors$1(e,t,i,n,r){const o=scratchInterpolateColorsArray;let a;o.length=r;const s=i.red,c=i.green,l=i.blue,u=i.alpha,d=n.red,h=n.green,p=n.blue,f=n.alpha;if(Color.equals(i,n)){for(a=0;a<r;a++)o[a]=Color.clone(i);return o}const m=(d-s)/r,g=(h-c)/r,_=(p-l)/r,y=(f-u)/r;for(a=0;a<r;a++)o[a]=new Color(s+a*m,c+a*g,l+a*_,u+a*y);return o}function PolylineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.colors,n=defaultValue(e.width,1),r=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=i,this._width=n,this._colorsPerVertex=r,this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";let o=1+t.length*Cartesian3.packedLength;o+=defined(i)?1+i.length*Color.packedLength:1,this.packedLength=o+Ellipsoid.packedLength+VertexFormat.packedLength+4}PolylineGeometry.pack=function(e,t,i){let n;i=defaultValue(i,0);const r=e._positions;let o=r.length;for(t[i++]=o,n=0;n<o;++n,i+=Cartesian3.packedLength)Cartesian3.pack(r[n],t,i);const a=e._colors;for(o=defined(a)?a.length:0,t[i++]=o,n=0;n<o;++n,i+=Color.packedLength)Color.pack(a[n],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._width,t[i++]=e._colorsPerVertex?1:0,t[i++]=e._arcType,t[i]=e._granularity,t};const scratchEllipsoid$7=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$3=new VertexFormat,scratchOptions$8={positions:void 0,colors:void 0,ellipsoid:scratchEllipsoid$7,vertexFormat:scratchVertexFormat$3,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};PolylineGeometry.unpack=function(e,t,i){let n;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(n=0;n<r;++n,t+=Cartesian3.packedLength)o[n]=Cartesian3.unpack(e,t);r=e[t++];const a=r>0?new Array(r):void 0;for(n=0;n<r;++n,t+=Color.packedLength)a[n]=Color.unpack(e,t);const s=Ellipsoid.unpack(e,t,scratchEllipsoid$7);t+=Ellipsoid.packedLength;const c=VertexFormat.unpack(e,t,scratchVertexFormat$3);t+=VertexFormat.packedLength;const l=e[t++],u=1===e[t++],d=e[t++],h=e[t];return defined(i)?(i._positions=o,i._colors=a,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=VertexFormat.clone(c,i._vertexFormat),i._width=l,i._colorsPerVertex=u,i._arcType=d,i._granularity=h,i):(scratchOptions$8.positions=o,scratchOptions$8.colors=a,scratchOptions$8.width=l,scratchOptions$8.colorsPerVertex=u,scratchOptions$8.arcType=d,scratchOptions$8.granularity=h,new PolylineGeometry(scratchOptions$8))};const scratchCartesian3$5=new Cartesian3,scratchPosition$b=new Cartesian3,scratchPrevPosition=new Cartesian3,scratchNextPosition=new Cartesian3;function computeAttributes$1(e,t,i,n){const r=new GeometryAttributes;n.position&&(r.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e}));const o=t.length,a=e.length/3,s=(a-2*o)/(2*o),c=PolygonPipeline.triangulate(t),l=(s-1)*o*6+2*c.length,u=IndexDatatype$1.createTypedArray(a,l);let d,h,p,f,m,g;const _=2*o;let y=0;for(d=0;d<s-1;d++){for(h=0;h<o-1;h++)p=2*h+d*o*2,g=p+_,f=p+1,m=f+_,u[y++]=f,u[y++]=p,u[y++]=m,u[y++]=m,u[y++]=p,u[y++]=g;p=2*o-2+d*o*2,f=p+1,m=f+_,g=p+_,u[y++]=f,u[y++]=p,u[y++]=m,u[y++]=m,u[y++]=p,u[y++]=g}if(n.st||n.tangent||n.bitangent){const e=new Float32Array(2*a),n=1/(s-1),c=1/i.height,l=i.height/2;let u,p,f=0;for(d=0;d<s;d++){for(u=d*n,p=c*(t[0].y+l),e[f++]=u,e[f++]=p,h=1;h<o;h++)p=c*(t[h].y+l),e[f++]=u,e[f++]=p,e[f++]=u,e[f++]=p;p=c*(t[0].y+l),e[f++]=u,e[f++]=p}for(h=0;h<o;h++)u=0,p=c*(t[h].y+l),e[f++]=u,e[f++]=p;for(h=0;h<o;h++)u=(s-1)*n,p=c*(t[h].y+l),e[f++]=u,e[f++]=p;r.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:new Float32Array(e)})}const C=a-2*o;for(d=0;d<c.length;d+=3){const e=c[d]+C,t=c[d+1]+C,i=c[d+2]+C;u[y++]=e,u[y++]=t,u[y++]=i,u[y++]=i+o,u[y++]=t+o,u[y++]=e+o}let T=new Geometry({attributes:r,indices:u,boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.TRIANGLES});if(n.normal&&(T=GeometryPipeline.computeNormal(T)),n.tangent||n.bitangent){try{T=GeometryPipeline.computeTangentAndBitangent(T)}catch(e){oneTimeWarning("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}n.tangent||(T.attributes.tangent=void 0),n.bitangent||(T.attributes.bitangent=void 0),n.st||(T.attributes.st=void 0)}return T}function PolylineVolumeGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,i=e.shapePositions;this._positions=t,this._shape=i,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let n=1+t.length*Cartesian3.packedLength;n+=1+i.length*Cartesian2.packedLength,this.packedLength=n+Ellipsoid.packedLength+VertexFormat.packedLength+2}PolylineGeometry.createGeometry=function(e){const t=e._width,i=e._vertexFormat;let n=e._colors;const r=e._colorsPerVertex,o=e._arcType,a=e._granularity,s=e._ellipsoid;let c,l,u;const d=[];let h=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon,!1,d);if(defined(n)&&d.length>0){let e=0,t=d[0];n=n.filter((function(i,n){let o=!1;return o=r?n===t||0===n&&1===t:n+1===t,!o||(e++,t=d[e],!1)}))}let p=h.length;if(p<2||t<=0)return;if(o===ArcType$1.GEODESIC||o===ArcType$1.RHUMB){let e,t;o===ArcType$1.GEODESIC?(e=CesiumMath.chordLength(a,s.maximumRadius),t=PolylinePipeline.numberOfPoints):(e=a,t=PolylinePipeline.numberOfPointsRhumbLine);const i=PolylinePipeline.extractHeights(h,s);if(defined(n)){let i=1;for(c=0;c<p-1;++c)i+=t(h[c],h[c+1],e);const o=new Array(i);let a=0;for(c=0;c<p-1;++c){const s=h[c],u=h[c+1],d=n[c],p=t(s,u,e);if(r&&c<i){const e=interpolateColors$1(s,u,d,n[c+1],p),t=e.length;for(l=0;l<t;++l)o[a++]=e[l]}else for(l=0;l<p;++l)o[a++]=Color.clone(d)}o[a]=Color.clone(n[n.length-1]),n=o,scratchInterpolateColorsArray.length=0}h=o===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc({positions:h,minDistance:e,ellipsoid:s,height:i}):PolylinePipeline.generateCartesianRhumbArc({positions:h,granularity:e,ellipsoid:s,height:i})}p=h.length;const f=4*p-4,m=new Float64Array(3*f),g=new Float64Array(3*f),_=new Float64Array(3*f),y=new Float32Array(2*f),C=i.st?new Float32Array(2*f):void 0,T=defined(n)?new Uint8Array(4*f):void 0;let S,v=0,A=0,E=0,b=0;for(l=0;l<p;++l){let e,o;0===l?(S=scratchCartesian3$5,Cartesian3.subtract(h[0],h[1],S),Cartesian3.add(h[0],S,S)):S=h[l-1],Cartesian3.clone(S,scratchPrevPosition),Cartesian3.clone(h[l],scratchPosition$b),l===p-1?(S=scratchCartesian3$5,Cartesian3.subtract(h[p-1],h[p-2],S),Cartesian3.add(h[p-1],S,S)):S=h[l+1],Cartesian3.clone(S,scratchNextPosition),defined(T)&&(e=0===l||r?n[l]:n[l-1],l!==p-1&&(o=n[l]));const a=l===p-1?2:4;for(u=0===l?2:0;u<a;++u){Cartesian3.pack(scratchPosition$b,m,v),Cartesian3.pack(scratchPrevPosition,g,v),Cartesian3.pack(scratchNextPosition,_,v),v+=3;const n=u-2<0?-1:1;if(y[A++]=u%2*2-1,y[A++]=n*t,i.st&&(C[E++]=l/(p-1),C[E++]=Math.max(y[A-2],0)),defined(T)){const t=u<2?e:o;T[b++]=Color.floatToByte(t.red),T[b++]=Color.floatToByte(t.green),T[b++]=Color.floatToByte(t.blue),T[b++]=Color.floatToByte(t.alpha)}}}const x=new GeometryAttributes;x.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:m}),x.prevPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:g}),x.nextPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:_}),x.expandAndWidth=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:y}),i.st&&(x.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:C})),defined(T)&&(x.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:T,normalize:!0}));const P=IndexDatatype$1.createTypedArray(f,6*p-6);let D=0,w=0;const M=p-1;for(l=0;l<M;++l)P[w++]=D,P[w++]=D+2,P[w++]=D+1,P[w++]=D+1,P[w++]=D+2,P[w++]=D+3,D+=4;return new Geometry({attributes:x,indices:P,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromPoints(h),geometryType:GeometryType$1.POLYLINES})},PolylineVolumeGeometry.pack=function(e,t,i){let n;i=defaultValue(i,0);const r=e._positions;let o=r.length;for(t[i++]=o,n=0;n<o;++n,i+=Cartesian3.packedLength)Cartesian3.pack(r[n],t,i);const a=e._shape;for(o=a.length,t[i++]=o,n=0;n<o;++n,i+=Cartesian2.packedLength)Cartesian2.pack(a[n],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._cornerType,t[i]=e._granularity,t};const scratchEllipsoid$6=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$2=new VertexFormat,scratchOptions$7={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$6,vertexFormat:scratchVertexFormat$2,cornerType:void 0,granularity:void 0};PolylineVolumeGeometry.unpack=function(e,t,i){let n;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(n=0;n<r;++n,t+=Cartesian3.packedLength)o[n]=Cartesian3.unpack(e,t);r=e[t++];const a=new Array(r);for(n=0;n<r;++n,t+=Cartesian2.packedLength)a[n]=Cartesian2.unpack(e,t);const s=Ellipsoid.unpack(e,t,scratchEllipsoid$6);t+=Ellipsoid.packedLength;const c=VertexFormat.unpack(e,t,scratchVertexFormat$2);t+=VertexFormat.packedLength;const l=e[t++],u=e[t];return defined(i)?(i._positions=o,i._shape=a,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=VertexFormat.clone(c,i._vertexFormat),i._cornerType=l,i._granularity=u,i):(scratchOptions$7.polylinePositions=o,scratchOptions$7.shapePositions=a,scratchOptions$7.cornerType=l,scratchOptions$7.granularity=u,new PolylineVolumeGeometry(scratchOptions$7))};const brScratch$1=new BoundingRectangle;function computeAttributes(e,t){const i=new GeometryAttributes;i.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e});const n=t.length,r=i.position.values.length/3,o=e.length/3/n,a=IndexDatatype$1.createTypedArray(r,2*n*(o+1));let s,c,l=0;s=0;let u=s*n;for(c=0;c<n-1;c++)a[l++]=c+u,a[l++]=c+u+1;for(a[l++]=n-1+u,a[l++]=u,s=o-1,u=s*n,c=0;c<n-1;c++)a[l++]=c+u,a[l++]=c+u+1;for(a[l++]=n-1+u,a[l++]=u,s=0;s<o-1;s++){const e=n*s,t=e+n;for(c=0;c<n;c++)a[l++]=c+e,a[l++]=c+t}return new Geometry({attributes:i,indices:IndexDatatype$1.createTypedArray(r,a),boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.LINES})}function PolylineVolumeOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,i=e.shapePositions;this._positions=t,this._shape=i,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let n=1+t.length*Cartesian3.packedLength;n+=1+i.length*Cartesian2.packedLength,this.packedLength=n+Ellipsoid.packedLength+2}PolylineVolumeGeometry.createGeometry=function(e){const t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon);let i=e._shape;if(i=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(i),t.length<2||i.length<3)return;PolygonPipeline.computeWindingOrder2D(i)===WindingOrder$1.CLOCKWISE&&i.reverse();const n=BoundingRectangle.fromPoints(i,brScratch$1);return computeAttributes$1(PolylineVolumeGeometryLibrary.computePositions(t,i,n,e,!0),i,n,e._vertexFormat)},PolylineVolumeOutlineGeometry.pack=function(e,t,i){let n;i=defaultValue(i,0);const r=e._positions;let o=r.length;for(t[i++]=o,n=0;n<o;++n,i+=Cartesian3.packedLength)Cartesian3.pack(r[n],t,i);const a=e._shape;for(o=a.length,t[i++]=o,n=0;n<o;++n,i+=Cartesian2.packedLength)Cartesian2.pack(a[n],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._cornerType,t[i]=e._granularity,t};const scratchEllipsoid$5=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$6={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$5,height:void 0,cornerType:void 0,granularity:void 0};PolylineVolumeOutlineGeometry.unpack=function(e,t,i){let n;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(n=0;n<r;++n,t+=Cartesian3.packedLength)o[n]=Cartesian3.unpack(e,t);r=e[t++];const a=new Array(r);for(n=0;n<r;++n,t+=Cartesian2.packedLength)a[n]=Cartesian2.unpack(e,t);const s=Ellipsoid.unpack(e,t,scratchEllipsoid$5);t+=Ellipsoid.packedLength;const c=e[t++],l=e[t];return defined(i)?(i._positions=o,i._shape=a,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._cornerType=c,i._granularity=l,i):(scratchOptions$6.polylinePositions=o,scratchOptions$6.shapePositions=a,scratchOptions$6.cornerType=c,scratchOptions$6.granularity=l,new PolylineVolumeOutlineGeometry(scratchOptions$6))};const brScratch=new BoundingRectangle;function Proxy(){DeveloperError.throwInstantiationError()}function createEvaluateFunction(e){const t=e.points,i=e.times;return function(n,r){defined(r)||(r=new Quaternion);const o=e._lastTimeIndex=e.findTimeInterval(n,e._lastTimeIndex),a=(n-i[o])/(i[o+1]-i[o]),s=t[o],c=t[o+1];return Quaternion.fastSlerp(s,c,a,r)}}function QuaternionSpline(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times;this._times=i,this._points=t,this._evaluateFunction=createEvaluateFunction(this),this._lastTimeIndex=0}function quickselect(e,t,i,n,r){quickselectStep(e,t,i||0,n||e.length-1,r||defaultCompare)}function quickselectStep(e,t,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,a=t-i+1,s=Math.log(o),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(o-c)/o)*(a-o/2<0?-1:1);quickselectStep(e,t,Math.max(i,Math.floor(t-a*c/o+l)),Math.min(n,Math.floor(t+(o-a)*c/o+l)),r)}var u=e[t],d=i,h=n;for(swap$1(e,i,t),r(e[n],u)>0&&swap$1(e,i,n);d<h;){for(swap$1(e,d,h),d++,h--;r(e[d],u)<0;)d++;for(;r(e[h],u)>0;)h--}0===r(e[i],u)?swap$1(e,i,h):swap$1(e,++h,n),h<=t&&(i=h+1),t<=h&&(n=h-1)}}function swap$1(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function defaultCompare(e,t){return e<t?-1:e>t?1:0}PolylineVolumeOutlineGeometry.createGeometry=function(e){const t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon);let i=e._shape;if(i=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(i),t.length<2||i.length<3)return;PolygonPipeline.computeWindingOrder2D(i)===WindingOrder$1.CLOCKWISE&&i.reverse();const n=BoundingRectangle.fromPoints(i,brScratch);return computeAttributes(PolylineVolumeGeometryLibrary.computePositions(t,i,n,e,!1),i)},Proxy.prototype.getURL=DeveloperError.throwInstantiationError,Object.defineProperties(QuaternionSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),QuaternionSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,QuaternionSpline.prototype.wrapTime=Spline.prototype.wrapTime,QuaternionSpline.prototype.clampTime=Spline.prototype.clampTime,QuaternionSpline.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};class RBush{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!intersects(e,t))return i;const n=this.toBBox,r=[];for(;t;){for(let o=0;o<t.children.length;o++){const a=t.children[o],s=t.leaf?n(a):a;intersects(e,s)&&(t.leaf?i.push(a):contains$1(e,s)?this._all(a,i):r.push(a))}t=r.pop()}return i}collides(e){let t=this.data;if(!intersects(e,t))return!1;const i=[];for(;t;){for(let n=0;n<t.children.length;n++){const r=t.children[n],o=t.leaf?this.toBBox(r):r;if(intersects(e,o)){if(t.leaf||contains$1(e,o))return!0;i.push(r)}}t=i.pop()}return!1}load(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=createNode([]),this}remove(e,t){if(!e)return this;let i=this.data;const n=this.toBBox(e),r=[],o=[];let a,s,c;for(;i||r.length;){if(i||(i=r.pop(),s=r[r.length-1],a=o.pop(),c=!0),i.leaf){const n=findItem(e,i.children,t);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}c||i.leaf||!contains$1(i,n)?s?(a++,i=s.children[a],c=!1):i=null:(r.push(i),o.push(a),a=0,s=i,i=i.children[0])}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,n){const r=i-t+1;let o,a=this._maxEntries;if(r<=a)return o=createNode(e.slice(t,i+1)),calcBBox(o,this.toBBox),o;n||(n=Math.ceil(Math.log(r)/Math.log(a)),a=Math.ceil(r/Math.pow(a,n-1))),o=createNode([]),o.leaf=!1,o.height=n;const s=Math.ceil(r/a),c=s*Math.ceil(Math.sqrt(a));multiSelect(e,t,i,c,this.compareMinX);for(let r=t;r<=i;r+=c){const t=Math.min(r+c-1,i);multiSelect(e,r,t,s,this.compareMinY);for(let i=r;i<=t;i+=s){const r=Math.min(i+s-1,t);o.children.push(this._build(e,i,r,n-1))}}return calcBBox(o,this.toBBox),o}_chooseSubtree(e,t,i,n){for(;n.push(t),!t.leaf&&n.length-1!==i;){let i,n=1/0,r=1/0;for(let o=0;o<t.children.length;o++){const a=t.children[o],s=bboxArea(a),c=enlargedArea(e,a)-s;c<r?(r=c,n=s<n?s:n,i=a):c===r&&s<n&&(n=s,i=a)}t=i||t.children[0]}return t}_insert(e,t,i){const n=i?e:this.toBBox(e),r=[],o=this._chooseSubtree(n,this.data,t,r);for(o.children.push(e),extend(o,n);t>=0&&r[t].children.length>this._maxEntries;)this._split(r,t),t--;this._adjustParentBBoxes(n,r,t)}_split(e,t){const i=e[t],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),a=createNode(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,calcBBox(i,this.toBBox),calcBBox(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(i,a)}_splitRoot(e,t){this.data=createNode([e,t]),this.data.height=e.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let n,r=1/0,o=1/0;for(let a=t;a<=i-t;a++){const t=distBBox(e,0,a,this.toBBox),s=distBBox(e,a,i,this.toBBox),c=intersectionArea(t,s),l=bboxArea(t)+bboxArea(s);c<r?(r=c,n=a,o=l<o?l:o):c===r&&l<o&&(o=l,n=a)}return n||i-t}_chooseSplitAxis(e,t,i){const n=e.leaf?this.compareMinX:compareNodeMinX,r=e.leaf?this.compareMinY:compareNodeMinY;this._allDistMargin(e,t,i,n)<this._allDistMargin(e,t,i,r)&&e.children.sort(n)}_allDistMargin(e,t,i,n){e.children.sort(n);const r=this.toBBox,o=distBBox(e,0,t,r),a=distBBox(e,i-t,i,r);let s=bboxMargin(o)+bboxMargin(a);for(let n=t;n<i-t;n++){const t=e.children[n];extend(o,e.leaf?r(t):t),s+=bboxMargin(o)}for(let n=i-t-1;n>=t;n--){const t=e.children[n];extend(a,e.leaf?r(t):t),s+=bboxMargin(a)}return s}_adjustParentBBoxes(e,t,i){for(let n=i;n>=0;n--)extend(t[n],e)}_condense(e){for(let t,i=e.length-1;i>=0;i--)0===e[i].children.length?i>0?(t=e[i-1].children,t.splice(t.indexOf(e[i]),1)):this.clear():calcBBox(e[i],this.toBBox)}}function findItem(e,t,i){if(!i)return t.indexOf(e);for(let n=0;n<t.length;n++)if(i(e,t[n]))return n;return-1}function calcBBox(e,t){distBBox(e,0,e.children.length,t,e)}function distBBox(e,t,i,n,r){r||(r=createNode(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=t;o<i;o++){const t=e.children[o];extend(r,e.leaf?n(t):t)}return r}function extend(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function compareNodeMinX(e,t){return e.minX-t.minX}function compareNodeMinY(e,t){return e.minY-t.minY}function bboxArea(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function bboxMargin(e){return e.maxX-e.minX+(e.maxY-e.minY)}function enlargedArea(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function intersectionArea(e,t){const i=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,r-i)*Math.max(0,o-n)}function contains$1(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function intersects(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function createNode(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(e,t,i,n,r){const o=[t,i];for(;o.length;){if((i=o.pop())-(t=o.pop())<=n)continue;const a=t+Math.ceil((i-t)/n/2)*n;quickselect(e,a,t,i,r),o.push(t,a,a,i)}}function RectangleCollisionChecker(){this._tree=new RBush}function RectangleWithId(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}function idCompare(e,t){return e.id===t.id}RectangleWithId.fromRectangleAndId=function(e,t,i){return i.minX=t.west,i.minY=t.south,i.maxX=t.east,i.maxY=t.north,i.id=e,i},RectangleCollisionChecker.prototype.insert=function(e,t){const i=RectangleWithId.fromRectangleAndId(e,t,new RectangleWithId);this._tree.insert(i)};const removalScratch=new RectangleWithId;RectangleCollisionChecker.prototype.remove=function(e,t){const i=RectangleWithId.fromRectangleAndId(e,t,removalScratch);this._tree.remove(i,idCompare)};const collisionScratch=new RectangleWithId;RectangleCollisionChecker.prototype.collides=function(e){const t=RectangleWithId.fromRectangleAndId("",e,collisionScratch);return this._tree.collides(t)};const cos=Math.cos,sin=Math.sin,sqrt=Math.sqrt,RectangleGeometryLibrary={computePosition:function(e,t,i,n,r,o,a){const s=t.radiiSquared,c=e.nwCorner,l=e.boundingRectangle;let u=c.latitude-e.granYCos*n+r*e.granXSin;const d=cos(u),h=sin(u),p=s.z*h;let f=c.longitude+n*e.granYSin+r*e.granXCos;const m=d*cos(f),g=d*sin(f),_=s.x*m,y=s.y*g,C=sqrt(_*m+y*g+p*h);if(o.x=_/C,o.y=y/C,o.z=p/C,i){const t=e.stNwCorner;defined(t)?(u=t.latitude-e.stGranYCos*n+r*e.stGranXSin,f=t.longitude+n*e.stGranYSin+r*e.stGranXCos,a.x=(f-e.stWest)*e.lonScalar,a.y=(u-e.stSouth)*e.latScalar):(a.x=(f-l.west)*e.lonScalar,a.y=(u-l.south)*e.latScalar)}}},rotationMatrixScratch=new Matrix2;let nwCartesian=new Cartesian3;const centerScratch$4=new Cartographic;let centerCartesian=new Cartesian3;const proj=new GeographicProjection;function getRotationOptions(e,t,i,n,r,o,a){const s=Math.cos(t),c=n*s,l=i*s,u=Math.sin(t),d=n*u,h=i*u;nwCartesian=proj.project(e,nwCartesian),nwCartesian=Cartesian3.subtract(nwCartesian,centerCartesian,nwCartesian);const p=Matrix2.fromRotation(t,rotationMatrixScratch);nwCartesian=Matrix2.multiplyByVector(p,nwCartesian,nwCartesian),nwCartesian=Cartesian3.add(nwCartesian,centerCartesian,nwCartesian),o-=1,a-=1;const f=(e=proj.unproject(nwCartesian,e)).latitude,m=f+o*h,g=f-c*a,_=f-c*a+o*h,y=Math.max(f,m,g,_),C=Math.min(f,m,g,_),T=e.longitude,S=T+o*l,v=T+a*d,A=T+a*d+o*l;return{north:y,south:C,east:Math.max(T,S,v,A),west:Math.min(T,S,v,A),granYCos:c,granYSin:d,granXCos:l,granXSin:h,nwCorner:e}}RectangleGeometryLibrary.computeOptions=function(e,t,i,n,r,o,a){let s,c=e.east,l=e.west,u=e.north,d=e.south,h=!1,p=!1;u===CesiumMath.PI_OVER_TWO&&(h=!0),d===-CesiumMath.PI_OVER_TWO&&(p=!0);const f=u-d;s=l>c?CesiumMath.TWO_PI-l+c:c-l;const m=Math.ceil(s/t)+1,g=Math.ceil(f/t)+1,_=s/(m-1),y=f/(g-1),C=Rectangle.northwest(e,o),T=Rectangle.center(e,centerScratch$4);0===i&&0===n||(T.longitude<C.longitude&&(T.longitude+=CesiumMath.TWO_PI),centerCartesian=proj.project(T,centerCartesian));const S=y,v=_,A=Rectangle.clone(e,r),E={granYCos:S,granYSin:0,granXCos:v,granXSin:0,nwCorner:C,boundingRectangle:A,width:m,height:g,northCap:h,southCap:p};if(0!==i){const e=getRotationOptions(C,i,_,y,T,m,g);u=e.north,d=e.south,c=e.east,l=e.west,E.granYCos=e.granYCos,E.granYSin=e.granYSin,E.granXCos=e.granXCos,E.granXSin=e.granXSin,A.north=u,A.south=d,A.east=c,A.west=l}if(0!==n){i-=n;const e=Rectangle.northwest(A,a),t=getRotationOptions(e,i,_,y,T,m,g);E.stGranYCos=t.granYCos,E.stGranXCos=t.granXCos,E.stGranYSin=t.granYSin,E.stGranXSin=t.granXSin,E.stNwCorner=e,E.stWest=t.west,E.stSouth=t.south}return E};const positionScratch$a=new Cartesian3,normalScratch$2=new Cartesian3,tangentScratch=new Cartesian3,bitangentScratch=new Cartesian3,rectangleScratch$5=new Rectangle,stScratch=new Cartesian2,bottomBoundingSphere$1=new BoundingSphere,topBoundingSphere$1=new BoundingSphere;function createAttributes(e,t){const i=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.TRIANGLES});return i.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(i.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(i.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(i.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.bitangents})),i}function calculateAttributes(e,t,i,n){const r=e.length,o=t.normal?new Float32Array(r):void 0,a=t.tangent?new Float32Array(r):void 0,s=t.bitangent?new Float32Array(r):void 0;let c=0;const l=bitangentScratch,u=tangentScratch;let d=normalScratch$2;if(t.normal||t.tangent||t.bitangent)for(let h=0;h<r;h+=3){const r=Cartesian3.fromArray(e,h,positionScratch$a),p=c+1,f=c+2;d=i.geodeticSurfaceNormal(r,d),(t.tangent||t.bitangent)&&(Cartesian3.cross(Cartesian3.UNIT_Z,d,u),Matrix3.multiplyByVector(n,u,u),Cartesian3.normalize(u,u),t.bitangent&&Cartesian3.normalize(Cartesian3.cross(d,u,l),l)),t.normal&&(o[c]=d.x,o[p]=d.y,o[f]=d.z),t.tangent&&(a[c]=u.x,a[p]=u.y,a[f]=u.z),t.bitangent&&(s[c]=l.x,s[p]=l.y,s[f]=l.z),c+=3}return createAttributes(t,{positions:e,normals:o,tangents:a,bitangents:s})}const v1Scratch=new Cartesian3,v2Scratch=new Cartesian3;function calculateAttributesWall(e,t,i){const n=e.length,r=t.normal?new Float32Array(n):void 0,o=t.tangent?new Float32Array(n):void 0,a=t.bitangent?new Float32Array(n):void 0;let s=0,c=0,l=0,u=!0,d=bitangentScratch,h=tangentScratch,p=normalScratch$2;if(t.normal||t.tangent||t.bitangent)for(let f=0;f<n;f+=6){const m=Cartesian3.fromArray(e,f,positionScratch$a),g=Cartesian3.fromArray(e,(f+6)%n,v1Scratch);if(u){const t=Cartesian3.fromArray(e,(f+3)%n,v2Scratch);Cartesian3.subtract(g,m,g),Cartesian3.subtract(t,m,t),p=Cartesian3.normalize(Cartesian3.cross(t,g,p),p),u=!1}Cartesian3.equalsEpsilon(g,m,CesiumMath.EPSILON10)&&(u=!0),(t.tangent||t.bitangent)&&(d=i.geodeticSurfaceNormal(m,d),t.tangent&&(h=Cartesian3.normalize(Cartesian3.cross(d,p,h),h))),t.normal&&(r[s++]=p.x,r[s++]=p.y,r[s++]=p.z,r[s++]=p.x,r[s++]=p.y,r[s++]=p.z),t.tangent&&(o[c++]=h.x,o[c++]=h.y,o[c++]=h.z,o[c++]=h.x,o[c++]=h.y,o[c++]=h.z),t.bitangent&&(a[l++]=d.x,a[l++]=d.y,a[l++]=d.z,a[l++]=d.x,a[l++]=d.y,a[l++]=d.z)}return createAttributes(t,{positions:e,normals:r,tangents:o,bitangents:a})}function constructRectangle$1(e,t){const i=e._vertexFormat,n=e._ellipsoid,r=t.height,o=t.width,a=t.northCap,s=t.southCap;let c=0,l=r,u=r,d=0;a&&(c=1,u-=1,d+=1),s&&(l-=1,u-=1,d+=1),d+=o*u;const h=i.position?new Float64Array(3*d):void 0,p=i.st?new Float32Array(2*d):void 0;let f=0,m=0;const g=positionScratch$a,_=stScratch;let y=Number.MAX_VALUE,C=Number.MAX_VALUE,T=-Number.MAX_VALUE,S=-Number.MAX_VALUE;for(let e=c;e<l;++e)for(let r=0;r<o;++r)RectangleGeometryLibrary.computePosition(t,n,i.st,e,r,g,_),h[f++]=g.x,h[f++]=g.y,h[f++]=g.z,i.st&&(p[m++]=_.x,p[m++]=_.y,y=Math.min(y,_.x),C=Math.min(C,_.y),T=Math.max(T,_.x),S=Math.max(S,_.y));if(a&&(RectangleGeometryLibrary.computePosition(t,n,i.st,0,0,g,_),h[f++]=g.x,h[f++]=g.y,h[f++]=g.z,i.st&&(p[m++]=_.x,p[m++]=_.y,y=_.x,C=_.y,T=_.x,S=_.y)),s&&(RectangleGeometryLibrary.computePosition(t,n,i.st,r-1,0,g,_),h[f++]=g.x,h[f++]=g.y,h[f]=g.z,i.st&&(p[m++]=_.x,p[m]=_.y,y=Math.min(y,_.x),C=Math.min(C,_.y),T=Math.max(T,_.x),S=Math.max(S,_.y))),i.st&&(y<0||C<0||T>1||S>1))for(let e=0;e<p.length;e+=2)p[e]=(p[e]-y)/(T-y),p[e+1]=(p[e+1]-C)/(S-C);const v=calculateAttributes(h,i,n,t.tangentRotationMatrix);let A=6*(o-1)*(u-1);a&&(A+=3*(o-1)),s&&(A+=3*(o-1));const E=IndexDatatype$1.createTypedArray(d,A);let b,x=0,P=0;for(b=0;b<u-1;++b){for(let e=0;e<o-1;++e){const e=x,t=e+o,i=t+1,n=e+1;E[P++]=e,E[P++]=t,E[P++]=n,E[P++]=n,E[P++]=t,E[P++]=i,++x}++x}if(a||s){let e=d-1;const t=d-1;let i,n;if(a&&s&&(e=d-2),x=0,a)for(b=0;b<o-1;b++)i=x,n=i+1,E[P++]=e,E[P++]=i,E[P++]=n,++x;if(s)for(x=(u-1)*o,b=0;b<o-1;b++)i=x,n=i+1,E[P++]=i,E[P++]=t,E[P++]=n,++x}return v.indices=E,i.st&&(v.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:p})),v}function addWallPositions(e,t,i,n,r){return e[t++]=n[i],e[t++]=n[i+1],e[t++]=n[i+2],e[t++]=r[i],e[t++]=r[i+1],e[t]=r[i+2],e}function addWallTextureCoordinates(e,t,i,n){return e[t++]=n[i],e[t++]=n[i+1],e[t++]=n[i],e[t]=n[i+1],e}const scratchVertexFormat$1=new VertexFormat;function constructExtrudedRectangle$1(e,t){const i=e._shadowVolume,n=e._offsetAttribute,r=e._vertexFormat,o=e._extrudedHeight,a=e._surfaceHeight,s=e._ellipsoid,c=t.height,l=t.width;let u;if(i){const t=VertexFormat.clone(r,scratchVertexFormat$1);t.normal=!0,e._vertexFormat=t}const d=constructRectangle$1(e,t);i&&(e._vertexFormat=r);let h=PolygonPipeline.scaleToGeodeticHeight(d.attributes.position.values,a,s,!1);h=new Float64Array(h);let p=h.length;const f=2*p,m=new Float64Array(f);m.set(h);const g=PolygonPipeline.scaleToGeodeticHeight(d.attributes.position.values,o,s);m.set(g,p),d.attributes.position.values=m;const _=r.normal?new Float32Array(f):void 0,y=r.tangent?new Float32Array(f):void 0,C=r.bitangent?new Float32Array(f):void 0,T=r.st?new Float32Array(f/3*2):void 0;let S,v,A;if(r.normal){for(v=d.attributes.normal.values,_.set(v),u=0;u<p;u++)v[u]=-v[u];_.set(v,p),d.attributes.normal.values=_}if(i){v=d.attributes.normal.values,r.normal||(d.attributes.normal=void 0);const e=new Float32Array(f);for(u=0;u<p;u++)v[u]=-v[u];e.set(v,p),d.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}const E=defined(n);if(E){const e=p/3*2;let t=new Uint8Array(e);n===GeometryOffsetAttribute$1.TOP?t=arrayFill(t,1,0,e/2):(A=n===GeometryOffsetAttribute$1.NONE?0:1,t=arrayFill(t,A)),d.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}if(r.tangent){const e=d.attributes.tangent.values;for(y.set(e),u=0;u<p;u++)e[u]=-e[u];y.set(e,p),d.attributes.tangent.values=y}if(r.bitangent){const e=d.attributes.bitangent.values;C.set(e),C.set(e,p),d.attributes.bitangent.values=C}r.st&&(S=d.attributes.st.values,T.set(S),T.set(S,p/3*2),d.attributes.st.values=T);const b=d.indices,x=b.length,P=p/3,D=IndexDatatype$1.createTypedArray(f/3,2*x);for(D.set(b),u=0;u<x;u+=3)D[u+x]=b[u+2]+P,D[u+1+x]=b[u+1]+P,D[u+2+x]=b[u]+P;d.indices=D;const w=t.northCap,M=t.southCap;let I=c,R=2,O=0,B=4,L=4;w&&(R-=1,I-=1,O+=1,B-=2,L-=1),M&&(R-=1,I-=1,O+=1,B-=2,L-=1),O+=R*l+2*I-B;const F=2*(O+L);let N=new Float64Array(3*F);const V=i?new Float32Array(3*F):void 0;let $=E?new Uint8Array(F):void 0,k=r.st?new Float32Array(2*F):void 0;const U=n===GeometryOffsetAttribute$1.TOP;E&&!U&&(A=n===GeometryOffsetAttribute$1.ALL?1:0,$=arrayFill($,A));let G=0,z=0,H=0,W=0;const q=l*I;let j;for(u=0;u<q;u+=l)j=3*u,N=addWallPositions(N,G,j,h,g),G+=6,r.st&&(k=addWallTextureCoordinates(k,z,2*u,S),z+=4),i&&(H+=3,V[H++]=v[j],V[H++]=v[j+1],V[H++]=v[j+2]),U&&($[W++]=1,W+=1);if(M){const e=w?q+1:q;for(j=3*e,u=0;u<2;u++)N=addWallPositions(N,G,j,h,g),G+=6,r.st&&(k=addWallTextureCoordinates(k,z,2*e,S),z+=4),i&&(H+=3,V[H++]=v[j],V[H++]=v[j+1],V[H++]=v[j+2]),U&&($[W++]=1,W+=1)}else for(u=q-l;u<q;u++)j=3*u,N=addWallPositions(N,G,j,h,g),G+=6,r.st&&(k=addWallTextureCoordinates(k,z,2*u,S),z+=4),i&&(H+=3,V[H++]=v[j],V[H++]=v[j+1],V[H++]=v[j+2]),U&&($[W++]=1,W+=1);for(u=q-1;u>0;u-=l)j=3*u,N=addWallPositions(N,G,j,h,g),G+=6,r.st&&(k=addWallTextureCoordinates(k,z,2*u,S),z+=4),i&&(H+=3,V[H++]=v[j],V[H++]=v[j+1],V[H++]=v[j+2]),U&&($[W++]=1,W+=1);if(w){const e=q;for(j=3*e,u=0;u<2;u++)N=addWallPositions(N,G,j,h,g),G+=6,r.st&&(k=addWallTextureCoordinates(k,z,2*e,S),z+=4),i&&(H+=3,V[H++]=v[j],V[H++]=v[j+1],V[H++]=v[j+2]),U&&($[W++]=1,W+=1)}else for(u=l-1;u>=0;u--)j=3*u,N=addWallPositions(N,G,j,h,g),G+=6,r.st&&(k=addWallTextureCoordinates(k,z,2*u,S),z+=4),i&&(H+=3,V[H++]=v[j],V[H++]=v[j+1],V[H++]=v[j+2]),U&&($[W++]=1,W+=1);let X=calculateAttributesWall(N,r,s);r.st&&(X.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:k})),i&&(X.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:V})),E&&(X.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:$}));const Y=IndexDatatype$1.createTypedArray(F,6*O);let K,J,Q,Z;p=N.length/3;let ee=0;for(u=0;u<p-1;u+=2){K=u,Z=(K+2)%p;const e=Cartesian3.fromArray(N,3*K,v1Scratch),t=Cartesian3.fromArray(N,3*Z,v2Scratch);Cartesian3.equalsEpsilon(e,t,CesiumMath.EPSILON10)||(J=(K+1)%p,Q=(J+2)%p,Y[ee++]=K,Y[ee++]=J,Y[ee++]=Z,Y[ee++]=Z,Y[ee++]=J,Y[ee++]=Q)}return X.indices=Y,X=GeometryPipeline.combineInstances([new GeometryInstance({geometry:d}),new GeometryInstance({geometry:X})]),X[0]}const scratchRectanglePoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3],nwScratch$1=new Cartographic,stNwScratch=new Cartographic;function computeRectangle(e,t,i,n,r){if(0===i)return Rectangle.clone(e,r);const o=RectangleGeometryLibrary.computeOptions(e,t,i,0,rectangleScratch$5,nwScratch$1),a=o.height,s=o.width,c=scratchRectanglePoints;return RectangleGeometryLibrary.computePosition(o,n,!1,0,0,c[0]),RectangleGeometryLibrary.computePosition(o,n,!1,0,s-1,c[1]),RectangleGeometryLibrary.computePosition(o,n,!1,a-1,0,c[2]),RectangleGeometryLibrary.computePosition(o,n,!1,a-1,s-1,c[3]),Rectangle.fromCartesianArray(c,n,r)}function RectangleGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,i=defaultValue(e.height,0),n=defaultValue(e.extrudedHeight,i);this._rectangle=Rectangle.clone(t),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._surfaceHeight=Math.max(i,n),this._rotation=defaultValue(e.rotation,0),this._stRotation=defaultValue(e.stRotation,0),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._extrudedHeight=Math.min(i,n),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}RectangleGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+7,RectangleGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Rectangle.pack(e._rectangle,t,i),i+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._stRotation,t[i++]=e._extrudedHeight,t[i++]=e._shadowVolume?1:0,t[i]=defaultValue(e._offsetAttribute,-1),t};const scratchRectangle$8=new Rectangle,scratchEllipsoid$4=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$5={rectangle:scratchRectangle$8,ellipsoid:scratchEllipsoid$4,vertexFormat:scratchVertexFormat$1,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};RectangleGeometry.unpack=function(e,t,i){t=defaultValue(t,0);const n=Rectangle.unpack(e,t,scratchRectangle$8);t+=Rectangle.packedLength;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$4);t+=Ellipsoid.packedLength;const o=VertexFormat.unpack(e,t,scratchVertexFormat$1);t+=VertexFormat.packedLength;const a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=1===e[t++],h=e[t];return defined(i)?(i._rectangle=Rectangle.clone(n,i._rectangle),i._ellipsoid=Ellipsoid.clone(r,i._ellipsoid),i._vertexFormat=VertexFormat.clone(o,i._vertexFormat),i._granularity=a,i._surfaceHeight=s,i._rotation=c,i._stRotation=l,i._extrudedHeight=u,i._shadowVolume=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$5.granularity=a,scratchOptions$5.height=s,scratchOptions$5.rotation=c,scratchOptions$5.stRotation=l,scratchOptions$5.extrudedHeight=u,scratchOptions$5.shadowVolume=d,scratchOptions$5.offsetAttribute=-1===h?void 0:h,new RectangleGeometry(scratchOptions$5))},RectangleGeometry.computeRectangle=function(e,t){const i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle(i,n,defaultValue(e.rotation,0),r,t)};const tangentRotationMatrixScratch=new Matrix3,quaternionScratch=new Quaternion,centerScratch$3=new Cartographic;RectangleGeometry.createGeometry=function(e){if(CesiumMath.equalsEpsilon(e._rectangle.north,e._rectangle.south,CesiumMath.EPSILON10)||CesiumMath.equalsEpsilon(e._rectangle.east,e._rectangle.west,CesiumMath.EPSILON10))return;let t=e._rectangle;const i=e._ellipsoid,n=e._rotation,r=e._stRotation,o=e._vertexFormat,a=RectangleGeometryLibrary.computeOptions(t,e._granularity,n,r,rectangleScratch$5,nwScratch$1,stNwScratch),s=tangentRotationMatrixScratch;if(0!==r||0!==n){const e=Rectangle.center(t,centerScratch$3),n=i.geodeticSurfaceNormalCartographic(e,v1Scratch);Quaternion.fromAxisAngle(n,-r,quaternionScratch),Matrix3.fromQuaternion(quaternionScratch,s)}else Matrix3.clone(Matrix3.IDENTITY,s);const c=e._surfaceHeight,l=e._extrudedHeight,u=!CesiumMath.equalsEpsilon(c,l,0,CesiumMath.EPSILON2);let d,h;if(a.lonScalar=1/e._rectangle.width,a.latScalar=1/e._rectangle.height,a.tangentRotationMatrix=s,t=e._rectangle,u){d=constructExtrudedRectangle$1(e,a);const n=BoundingSphere.fromRectangle3D(t,i,c,topBoundingSphere$1),r=BoundingSphere.fromRectangle3D(t,i,l,bottomBoundingSphere$1);h=BoundingSphere.union(n,r)}else{if(d=constructRectangle$1(e,a),d.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(d.attributes.position.values,c,i,!1),defined(e._offsetAttribute)){const t=d.attributes.position.values.length,i=new Uint8Array(t/3);arrayFill(i,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),d.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}h=BoundingSphere.fromRectangle3D(t,i,c)}return o.position||delete d.attributes.position,new Geometry({attributes:d.attributes,indices:d.indices,primitiveType:d.primitiveType,boundingSphere:h,offsetAttribute:e._offsetAttribute})},RectangleGeometry.createShadowVolume=function(e,t,i){const n=e._granularity,r=e._ellipsoid,o=t(n,r),a=i(n,r);return new RectangleGeometry({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:r,stRotation:e._stRotation,granularity:n,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})};const unrotatedTextureRectangleScratch=new Rectangle,points2DScratch$1=[new Cartesian2,new Cartesian2,new Cartesian2],rotation2DScratch=new Matrix2,rectangleCenterScratch$2=new Cartographic;function textureCoordinateRotationPoints(e){if(0===e._stRotation)return[0,0,0,1,1,0];const t=Rectangle.clone(e._rectangle,unrotatedTextureRectangleScratch),i=e._granularity,n=e._ellipsoid,r=computeRectangle(t,i,e._rotation-e._stRotation,n,unrotatedTextureRectangleScratch),o=points2DScratch$1;o[0].x=r.west,o[0].y=r.south,o[1].x=r.west,o[1].y=r.north,o[2].x=r.east,o[2].y=r.south;const a=e.rectangle,s=Matrix2.fromRotation(e._stRotation,rotation2DScratch),c=Rectangle.center(a,rectangleCenterScratch$2);for(let e=0;e<3;++e){const t=o[e];t.x-=c.longitude,t.y-=c.latitude,Matrix2.multiplyByVector(s,t,t),t.x+=c.longitude,t.y+=c.latitude,t.x=(t.x-a.west)/a.width,t.y=(t.y-a.south)/a.height}const l=o[0],u=o[1],d=o[2],h=new Array(6);return Cartesian2.pack(l,h),Cartesian2.pack(u,h,2),Cartesian2.pack(d,h,4),h}Object.defineProperties(RectangleGeometry.prototype,{rectangle:{get:function(){return defined(this._rotatedRectangle)||(this._rotatedRectangle=computeRectangle(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints(this)),this._textureCoordinateRotationPoints}}});const bottomBoundingSphere=new BoundingSphere,topBoundingSphere=new BoundingSphere,positionScratch$9=new Cartesian3,rectangleScratch$4=new Rectangle;function constructRectangle(e,t){const i=e._ellipsoid,n=t.height,r=t.width,o=t.northCap,a=t.southCap;let s=n,c=2,l=0,u=4;o&&(c-=1,s-=1,l+=1,u-=2),a&&(c-=1,s-=1,l+=1,u-=2),l+=c*r+2*s-u;const d=new Float64Array(3*l);let h,p=0,f=0;const m=positionScratch$9;if(o)RectangleGeometryLibrary.computePosition(t,i,!1,f,0,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;else for(h=0;h<r;h++)RectangleGeometryLibrary.computePosition(t,i,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;for(h=r-1,f=1;f<n;f++)RectangleGeometryLibrary.computePosition(t,i,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;if(f=n-1,!a)for(h=r-2;h>=0;h--)RectangleGeometryLibrary.computePosition(t,i,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;for(h=0,f=n-2;f>0;f--)RectangleGeometryLibrary.computePosition(t,i,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;const g=d.length/3*2,_=IndexDatatype$1.createTypedArray(d.length/3,g);let y=0;for(let e=0;e<d.length/3-1;e++)_[y++]=e,_[y++]=e+1;_[y++]=d.length/3-1,_[y++]=0;const C=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.LINES});return C.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d}),C.indices=_,C}function constructExtrudedRectangle(e,t){const i=e._surfaceHeight,n=e._extrudedHeight,r=e._ellipsoid,o=n,a=i,s=constructRectangle(e,t),c=t.height,l=t.width,u=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,a,r,!1);let d=u.length;const h=new Float64Array(2*d);h.set(u);const p=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,o,r);h.set(p,d),s.attributes.position.values=h;const f=t.northCap,m=t.southCap;let g=4;f&&(g-=1),m&&(g-=1);const _=2*(h.length/3+g),y=IndexDatatype$1.createTypedArray(h.length/3,_);d=h.length/6;let C,T=0;for(let e=0;e<d-1;e++)y[T++]=e,y[T++]=e+1,y[T++]=e+d,y[T++]=e+d+1;if(y[T++]=d-1,y[T++]=0,y[T++]=d+d-1,y[T++]=d,y[T++]=0,y[T++]=d,f)C=c-1;else{const e=l-1;y[T++]=e,y[T++]=e+d,C=l+c-2}if(y[T++]=C,y[T++]=C+d,!m){const e=l+C-1;y[T++]=e,y[T]=e+d}return s.indices=y,s}function RectangleOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),n=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=defaultValue(e.rotation,0),o=defaultValue(e.height,0),a=defaultValue(e.extrudedHeight,o);this._rectangle=Rectangle.clone(t),this._granularity=i,this._ellipsoid=n,this._surfaceHeight=Math.max(o,a),this._rotation=r,this._extrudedHeight=Math.min(o,a),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}RectangleOutlineGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+5,RectangleOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Rectangle.pack(e._rectangle,t,i),i+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._extrudedHeight,t[i]=defaultValue(e._offsetAttribute,-1),t};const scratchRectangle$7=new Rectangle,scratchEllipsoid$3=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$4={rectangle:scratchRectangle$7,ellipsoid:scratchEllipsoid$3,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};RectangleOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);const n=Rectangle.unpack(e,t,scratchRectangle$7);t+=Rectangle.packedLength;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$3);t+=Ellipsoid.packedLength;const o=e[t++],a=e[t++],s=e[t++],c=e[t++],l=e[t];return defined(i)?(i._rectangle=Rectangle.clone(n,i._rectangle),i._ellipsoid=Ellipsoid.clone(r,i._ellipsoid),i._surfaceHeight=a,i._rotation=s,i._extrudedHeight=c,i._offsetAttribute=-1===l?void 0:l,i):(scratchOptions$4.granularity=o,scratchOptions$4.height=a,scratchOptions$4.rotation=s,scratchOptions$4.extrudedHeight=c,scratchOptions$4.offsetAttribute=-1===l?void 0:l,new RectangleOutlineGeometry(scratchOptions$4))};const nwScratch=new Cartographic;RectangleOutlineGeometry.createGeometry=function(e){const t=e._rectangle,i=e._ellipsoid,n=RectangleGeometryLibrary.computeOptions(t,e._granularity,e._rotation,0,rectangleScratch$4,nwScratch);let r,o;if(CesiumMath.equalsEpsilon(t.north,t.south,CesiumMath.EPSILON10)||CesiumMath.equalsEpsilon(t.east,t.west,CesiumMath.EPSILON10))return;const a=e._surfaceHeight,s=e._extrudedHeight;let c;if(!CesiumMath.equalsEpsilon(a,s,0,CesiumMath.EPSILON2)){if(r=constructExtrudedRectangle(e,n),defined(e._offsetAttribute)){const t=r.attributes.position.values.length/3;let i=new Uint8Array(t);e._offsetAttribute===GeometryOffsetAttribute$1.TOP?i=arrayFill(i,1,0,t/2):(c=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,i=arrayFill(i,c)),r.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}const l=BoundingSphere.fromRectangle3D(t,i,a,topBoundingSphere),u=BoundingSphere.fromRectangle3D(t,i,s,bottomBoundingSphere);o=BoundingSphere.union(l,u)}else{if(r=constructRectangle(e,n),r.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.attributes.position.values,a,i,!1),defined(e._offsetAttribute)){const t=r.attributes.position.values.length,i=new Uint8Array(t/3);c=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,arrayFill(i,c),r.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}o=BoundingSphere.fromRectangle3D(t,i,a)}return new Geometry({attributes:r.attributes,indices:r.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:o,offsetAttribute:e._offsetAttribute})};const ReferenceFrame={FIXED:0,INERTIAL:1};var ReferenceFrame$1=Object.freeze(ReferenceFrame);let implementation;function requestAnimationFramePolyFill(e){return implementation(e)}"undefined"!=typeof requestAnimationFrame&&(implementation=requestAnimationFrame),function(){if(!defined(implementation)&&"undefined"!=typeof window){const e=["webkit","moz","ms","o"];let t=0;const i=e.length;for(;t<i&&!defined(implementation);)implementation=window[`${e[t]}RequestAnimationFrame`],++t}if(!defined(implementation)){const e=1e3/60;let t=0;implementation=function(i){const n=getTimestamp$1(),r=Math.max(e-(n-t),0);return t=n+r,setTimeout((function(){i(t)}),r)}}}();const S2_MAX_LEVEL=30,S2_LIMIT_IJ=1<<S2_MAX_LEVEL,S2_MAX_SITI=1<<S2_MAX_LEVEL+1>>>0,S2_POSITION_BITS=2*S2_MAX_LEVEL+1,S2_LOOKUP_BITS=4,S2_LOOKUP_POSITIONS=[],S2_LOOKUP_IJ=[],S2_POSITION_TO_IJ=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],S2_SWAP_MASK=1,S2_INVERT_MASK=2,S2_POSITION_TO_ORIENTATION_MASK=[S2_SWAP_MASK,0,0,S2_SWAP_MASK|S2_INVERT_MASK];function S2Cell(e){if(!FeatureDetection.supportsBigInt())throw new RuntimeError("S2 required BigInt support");this._cellId=e,this._level=S2Cell.getLevel(e)}function getS2Center(e,t){const i=convertCellIdToFaceSiTi(e,t);return convertFaceSiTitoXYZ(i[0],i[1],i[2])}function getS2Vertex(e,t,i){const n=convertCellIdToFaceIJ(e),r=convertIJLeveltoBoundUV([n[1],n[2]],t),o=i>>1&1;return convertFaceUVtoXYZ(n[0],r[0][o^1&i],r[1][o])}function convertCellIdToFaceSiTi(e,t){const i=convertCellIdToFaceIJ(e),n=i[0],r=i[1],o=i[2],a=30===t,s=!a&&(BigInt(r)^e>>BigInt(2))&BigInt(1),c=a?1:s?2:0;return[n,(r<<1)+c,(o<<1)+c]}function convertCellIdToFaceIJ(e){0===S2_LOOKUP_POSITIONS.length&&generateLookupTable();const t=Number(e>>BigInt(S2_POSITION_BITS));let i=t&S2_SWAP_MASK;const n=(1<<S2_LOOKUP_BITS)-1;let r=0,o=0;for(let t=7;t>=0;t--){const a=(1<<2*(7===t?S2_MAX_LEVEL-7*S2_LOOKUP_BITS:S2_LOOKUP_BITS))-1;i+=Number(e>>BigInt(2*t*S2_LOOKUP_BITS+1)&BigInt(a))<<2,i=S2_LOOKUP_IJ[i];const s=t*S2_LOOKUP_BITS;r+=i>>S2_LOOKUP_BITS+2<<s,o+=(i>>2&n)<<s,i&=S2_SWAP_MASK|S2_INVERT_MASK}return[t,r,o]}function convertFaceSiTitoXYZ(e,t,i){const n=convertSiTitoST(t),r=convertSiTitoST(i);return convertFaceUVtoXYZ(e,convertSTtoUV(n),convertSTtoUV(r))}function convertFaceUVtoXYZ(e,t,i){switch(e){case 0:return new Cartesian3(1,t,i);case 1:return new Cartesian3(-t,1,i);case 2:return new Cartesian3(-t,-i,1);case 3:return new Cartesian3(-1,-i,-t);case 4:return new Cartesian3(i,-1,-t);default:return new Cartesian3(i,t,-1)}}function convertSTtoUV(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function convertSiTitoST(e){return 1/S2_MAX_SITI*e}function convertIJLeveltoBoundUV(e,t){const i=[[],[]],n=getSizeIJ(t);for(let t=0;t<2;++t){const r=e[t]&-n,o=r+n;i[t][0]=convertSTtoUV(convertIJtoSTMinimum(r)),i[t][1]=convertSTtoUV(convertIJtoSTMinimum(o))}return i}function getSizeIJ(e){return 1<<S2_MAX_LEVEL-e>>>0}function convertIJtoSTMinimum(e){return 1/S2_LIMIT_IJ*e}function generateLookupCell(e,t,i,n,r,o){if(e===S2_LOOKUP_BITS){const e=(t<<S2_LOOKUP_BITS)+i;S2_LOOKUP_POSITIONS[(e<<2)+n]=(r<<2)+o,S2_LOOKUP_IJ[(r<<2)+n]=(e<<2)+o}else{e++,t<<=1,i<<=1,r<<=2;const a=S2_POSITION_TO_IJ[o];generateLookupCell(e,t+(a[0]>>1),i+(1&a[0]),n,r,o^S2_POSITION_TO_ORIENTATION_MASK[0]),generateLookupCell(e,t+(a[1]>>1),i+(1&a[1]),n,r+1,o^S2_POSITION_TO_ORIENTATION_MASK[1]),generateLookupCell(e,t+(a[2]>>1),i+(1&a[2]),n,r+2,o^S2_POSITION_TO_ORIENTATION_MASK[2]),generateLookupCell(e,t+(a[3]>>1),i+(1&a[3]),n,r+3,o^S2_POSITION_TO_ORIENTATION_MASK[3])}}function generateLookupTable(){generateLookupCell(0,0,0,0,0,0),generateLookupCell(0,0,0,S2_SWAP_MASK,0,S2_SWAP_MASK),generateLookupCell(0,0,0,S2_INVERT_MASK,0,S2_INVERT_MASK),generateLookupCell(0,0,0,S2_SWAP_MASK|S2_INVERT_MASK,0,S2_SWAP_MASK|S2_INVERT_MASK)}function lsb(e){return e&~e+BigInt(1)}function lsbForLevel(e){return BigInt(1)<<BigInt(2*(S2_MAX_LEVEL-e))}S2Cell.fromToken=function(e){return new S2Cell(S2Cell.getIdFromToken(e))},S2Cell.isValidId=function(e){if(e<=0)return!1;if(e>>BigInt(S2_POSITION_BITS)>5)return!1;return!!(e&~e+BigInt(1)&BigInt("0x1555555555555555"))},S2Cell.isValidToken=function(e){return!!/^[0-9a-fA-F]{1,16}$/.test(e)&&S2Cell.isValidId(S2Cell.getIdFromToken(e))},S2Cell.getIdFromToken=function(e){return BigInt("0x"+e+"0".repeat(16-e.length))},S2Cell.getTokenFromId=function(e){const t=Math.floor(countTrailingZeroBits(e)/4),i=e.toString(16).replace(/0*$/,"");return Array(17-t-i.length).join("0")+i},S2Cell.getLevel=function(e){let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e>>=BigInt(1);return S2_MAX_LEVEL-(t>>1)},S2Cell.prototype.getChild=function(e){const t=lsb(this._cellId)>>BigInt(2);return new S2Cell(this._cellId+BigInt(2*e+1-4)*t)},S2Cell.prototype.getParent=function(){const e=lsb(this._cellId)<<BigInt(2);return new S2Cell(this._cellId&~e+BigInt(1)|e)},S2Cell.prototype.getParentAtLevel=function(e){const t=lsbForLevel(e);return new S2Cell(this._cellId&-t|t)},S2Cell.prototype.getCenter=function(e){e=defaultValue(e,Ellipsoid.WGS84);let t=getS2Center(this._cellId,this._level);t=Cartesian3.normalize(t,t);const i=new Cartographic.fromCartesian(t,Ellipsoid.UNIT_SPHERE);return Cartographic.toCartesian(i,e,new Cartesian3)},S2Cell.prototype.getVertex=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);let i=getS2Vertex(this._cellId,this._level,e);i=Cartesian3.normalize(i,i);const n=new Cartographic.fromCartesian(i,Ellipsoid.UNIT_SPHERE);return Cartographic.toCartesian(n,t,new Cartesian3)},S2Cell.fromFacePositionLevel=function(e,t,i){const n=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),r=t.toString(2),o=Array(2*i-r.length+1).join("0"),a=Array(S2_POSITION_BITS-2*i).join("0");return new S2Cell(BigInt(`0b${n}${o}${r}1${a}`))};const Mod67BitPosition=[64,0,1,39,2,15,40,23,3,12,16,59,41,19,24,54,4,64,13,10,17,62,60,28,42,30,20,51,25,44,55,47,5,32,65,38,14,22,11,58,18,53,63,9,61,27,29,50,43,46,31,37,21,57,52,8,26,49,45,36,56,7,48,35,6,34,33,0];function countTrailingZeroBits(e){return Mod67BitPosition[(-e&e)%BigInt(67)]}function sampleTerrain(e,t,i){return e.readyPromise.then((function(){return doSampling(e,t,i)}))}function doSampling(e,t,i){const n=e.tilingScheme;let r;const o=[],a={};for(r=0;r<i.length;++r){const s=n.positionToTileXY(i[r],t),c=s.toString();if(!a.hasOwnProperty(c)){const i={x:s.x,y:s.y,level:t,tilingScheme:n,terrainProvider:e,positions:[]};a[c]=i,o.push(i)}a[c].positions.push(i[r])}const s=[];for(r=0;r<o.length;++r){const e=o[r],t=e.terrainProvider.requestTileGeometry(e.x,e.y,e.level).then(createInterpolateFunction(e)).catch(createMarkFailedFunction(e));s.push(t)}return Promise.all(s).then((function(){return i}))}function interpolateAndAssignHeight(e,t,i){const n=t.interpolateHeight(i,e.longitude,e.latitude);return void 0!==n&&(e.height=n,!0)}function createInterpolateFunction(e){const t=e.positions,i=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(n){let r=!1;for(let e=0;e<t.length;++e){if(!interpolateAndAssignHeight(t[e],n,i)){r=!0;break}}return r?n.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then((function(){for(let e=0;e<t.length;++e){interpolateAndAssignHeight(t[e],n,i)}})):Promise.resolve()}}function createMarkFailedFunction(e){const t=e.positions;return function(){for(let e=0;e<t.length;++e){t[e].height=void 0}}}const scratchCartesian2$4=new Cartesian2;function sampleTerrainMostDetailed(e,t){return e.readyPromise.then((function(){const i=[],n=[],r=e.availability,o=[];for(let a=0;a<t.length;++a){const s=t[a],c=r.computeMaximumLevelAtPosition(s);if(n[a]=c,0===c){e.tilingScheme.positionToTileXY(s,1,scratchCartesian2$4);const t=e.loadTileDataAvailability(scratchCartesian2$4.x,scratchCartesian2$4.y,1);defined(t)&&o.push(t)}let l=i[c];defined(l)||(i[c]=l=[]),l.push(s)}return Promise.all(o).then((function(){return Promise.all(i.map((function(t,i){if(defined(t))return sampleTerrain(e,i,t)})))})).then((function(){const i=[];for(let e=0;e<t.length;++e){const o=t[e];r.computeMaximumLevelAtPosition(o)!==n[e]&&i.push(o)}if(i.length>0)return sampleTerrainMostDetailed(e,i)})).then((function(){return t}))}))}const ScreenSpaceEventType={LEFT_DOWN:0,LEFT_UP:1,LEFT_CLICK:2,LEFT_DOUBLE_CLICK:3,RIGHT_DOWN:5,RIGHT_UP:6,RIGHT_CLICK:7,MIDDLE_DOWN:10,MIDDLE_UP:11,MIDDLE_CLICK:12,MOUSE_MOVE:15,WHEEL:16,PINCH_START:17,PINCH_END:18,PINCH_MOVE:19};var ScreenSpaceEventType$1=Object.freeze(ScreenSpaceEventType);function getPosition$1(e,t,i){const n=e._element;if(n===document)return i.x=t.clientX,i.y=t.clientY,i;const r=n.getBoundingClientRect();return i.x=t.clientX-r.left,i.y=t.clientY-r.top,i}function getInputEventKey(e,t){let i=e;return defined(t)&&(i+=`+${t}`),i}function getModifier(e){return e.shiftKey?KeyboardEventModifier$1.SHIFT:e.ctrlKey?KeyboardEventModifier$1.CTRL:e.altKey?KeyboardEventModifier$1.ALT:void 0}const MouseButton={LEFT:0,MIDDLE:1,RIGHT:2};function registerListener(e,t,i,n){function r(t){n(e,t)}FeatureDetection.isInternetExplorer()?i.addEventListener(t,r,!1):i.addEventListener(t,r,{capture:!1,passive:!1}),e._removalFunctions.push((function(){i.removeEventListener(t,r,!1)}))}function registerListeners(e){const t=e._element,i=defined(t.disableRootEvents)?t:document;let n;FeatureDetection.supportsPointerEvents()?(registerListener(e,"pointerdown",t,handlePointerDown),registerListener(e,"pointerup",t,handlePointerUp),registerListener(e,"pointermove",t,handlePointerMove),registerListener(e,"pointercancel",t,handlePointerUp)):(registerListener(e,"mousedown",t,handleMouseDown),registerListener(e,"mouseup",i,handleMouseUp),registerListener(e,"mousemove",i,handleMouseMove),registerListener(e,"touchstart",t,handleTouchStart),registerListener(e,"touchend",i,handleTouchEnd),registerListener(e,"touchmove",i,handleTouchMove),registerListener(e,"touchcancel",i,handleTouchEnd)),registerListener(e,"dblclick",t,handleDblClick),n="onwheel"in t?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",registerListener(e,n,t,handleWheel)}function unregisterListeners(e){const t=e._removalFunctions;for(let e=0;e<t.length;++e)t[e]()}const mouseDownEvent={position:new Cartesian2};function gotTouchEvent(e){e._lastSeenTouchEvent=getTimestamp$1()}function canProcessMouseEvent(e){return getTimestamp$1()-e._lastSeenTouchEvent>ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds}function checkPixelTolerance(e,t,i){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)<i}function handleMouseDown(e,t){if(!canProcessMouseEvent(e))return;const i=t.button;let n;if(e._buttonDown[i]=!0,i===MouseButton.LEFT)n=ScreenSpaceEventType$1.LEFT_DOWN;else if(i===MouseButton.MIDDLE)n=ScreenSpaceEventType$1.MIDDLE_DOWN;else{if(i!==MouseButton.RIGHT)return;n=ScreenSpaceEventType$1.RIGHT_DOWN}const r=getPosition$1(e,t,e._primaryPosition);Cartesian2.clone(r,e._primaryStartPosition),Cartesian2.clone(r,e._primaryPreviousPosition);const o=getModifier(t),a=e.getInputAction(n,o);defined(a)&&(Cartesian2.clone(r,mouseDownEvent.position),a(mouseDownEvent),t.preventDefault())}const mouseUpEvent={position:new Cartesian2},mouseClickEvent={position:new Cartesian2};function cancelMouseEvent(e,t,i,n){const r=getModifier(n),o=e.getInputAction(t,r),a=e.getInputAction(i,r);if(defined(o)||defined(a)){const t=getPosition$1(e,n,e._primaryPosition);if(defined(o)&&(Cartesian2.clone(t,mouseUpEvent.position),o(mouseUpEvent)),defined(a)){checkPixelTolerance(e._primaryStartPosition,t,e._clickPixelTolerance)&&(Cartesian2.clone(t,mouseClickEvent.position),a(mouseClickEvent))}}}function handleMouseUp(e,t){if(!canProcessMouseEvent(e))return;const i=t.button;i!==MouseButton.LEFT&&i!==MouseButton.MIDDLE&&i!==MouseButton.RIGHT||(e._buttonDown[MouseButton.LEFT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.LEFT_UP,ScreenSpaceEventType$1.LEFT_CLICK,t),e._buttonDown[MouseButton.LEFT]=!1),e._buttonDown[MouseButton.MIDDLE]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.MIDDLE_UP,ScreenSpaceEventType$1.MIDDLE_CLICK,t),e._buttonDown[MouseButton.MIDDLE]=!1),e._buttonDown[MouseButton.RIGHT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.RIGHT_UP,ScreenSpaceEventType$1.RIGHT_CLICK,t),e._buttonDown[MouseButton.RIGHT]=!1))}const mouseMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2};function handleMouseMove(e,t){if(!canProcessMouseEvent(e))return;const i=getModifier(t),n=getPosition$1(e,t,e._primaryPosition),r=e._primaryPreviousPosition,o=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,i);defined(o)&&(Cartesian2.clone(r,mouseMoveEvent.startPosition),Cartesian2.clone(n,mouseMoveEvent.endPosition),o(mouseMoveEvent)),Cartesian2.clone(n,r),(e._buttonDown[MouseButton.LEFT]||e._buttonDown[MouseButton.MIDDLE]||e._buttonDown[MouseButton.RIGHT])&&t.preventDefault()}const mouseDblClickEvent={position:new Cartesian2};function handleDblClick(e,t){let i;if(t.button!==MouseButton.LEFT)return;i=ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK;const n=getModifier(t),r=e.getInputAction(i,n);defined(r)&&(getPosition$1(e,t,mouseDblClickEvent.position),r(mouseDblClickEvent))}function handleWheel(e,t){let i;if(defined(t.deltaY)){const e=t.deltaMode;i=e===t.DOM_DELTA_PIXEL?-t.deltaY:e===t.DOM_DELTA_LINE?40*-t.deltaY:120*-t.deltaY}else i=t.detail>0?-120*t.detail:t.wheelDelta;if(!defined(i))return;const n=getModifier(t),r=e.getInputAction(ScreenSpaceEventType$1.WHEEL,n);defined(r)&&(r(i),t.preventDefault())}function handleTouchStart(e,t){gotTouchEvent(e);const i=t.changedTouches;let n;const r=i.length;let o,a;const s=e._positions;for(n=0;n<r;++n)o=i[n],a=o.identifier,s.set(a,getPosition$1(e,o,new Cartesian2));fireTouchEvents(e,t);const c=e._previousPositions;for(n=0;n<r;++n)o=i[n],a=o.identifier,c.set(a,Cartesian2.clone(s.get(a)))}function handleTouchEnd(e,t){gotTouchEvent(e);const i=t.changedTouches;let n;const r=i.length;let o,a;const s=e._positions;for(n=0;n<r;++n)o=i[n],a=o.identifier,s.remove(a);fireTouchEvents(e,t);const c=e._previousPositions;for(n=0;n<r;++n)o=i[n],a=o.identifier,c.remove(a)}const touchStartEvent={position:new Cartesian2},touch2StartEvent={position1:new Cartesian2,position2:new Cartesian2},touchEndEvent={position:new Cartesian2},touchClickEvent={position:new Cartesian2},touchHoldEvent={position:new Cartesian2};function fireTouchEvents(e,t){const i=getModifier(t),n=e._positions,r=n.length;let o,a;const s=e._isPinching;if(1!==r&&e._buttonDown[MouseButton.LEFT]){if(e._buttonDown[MouseButton.LEFT]=!1,defined(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),o=e.getInputAction(ScreenSpaceEventType$1.LEFT_UP,i),defined(o)&&(Cartesian2.clone(e._primaryPosition,touchEndEvent.position),o(touchEndEvent)),0===r&&!e._isTouchHolding&&(a=e.getInputAction(ScreenSpaceEventType$1.LEFT_CLICK,i),defined(a))){checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._clickPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchClickEvent.position),a(touchClickEvent))}e._isTouchHolding=!1}if(0===r&&s&&(e._isPinching=!1,o=e.getInputAction(ScreenSpaceEventType$1.PINCH_END,i),defined(o)&&o()),1===r&&!s){const r=n.values[0];Cartesian2.clone(r,e._primaryPosition),Cartesian2.clone(r,e._primaryStartPosition),Cartesian2.clone(r,e._primaryPreviousPosition),e._buttonDown[MouseButton.LEFT]=!0,o=e.getInputAction(ScreenSpaceEventType$1.LEFT_DOWN,i),defined(o)&&(Cartesian2.clone(r,touchStartEvent.position),o(touchStartEvent)),e._touchHoldTimer=setTimeout((function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,a=e.getInputAction(ScreenSpaceEventType$1.RIGHT_CLICK,i),defined(a))){checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._holdPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchHoldEvent.position),a(touchHoldEvent))}}),ScreenSpaceEventHandler.touchHoldDelayMilliseconds),t.preventDefault()}2!==r||s||(e._isPinching=!0,o=e.getInputAction(ScreenSpaceEventType$1.PINCH_START,i),defined(o)&&(Cartesian2.clone(n.values[0],touch2StartEvent.position1),Cartesian2.clone(n.values[1],touch2StartEvent.position2),o(touch2StartEvent),t.preventDefault()))}function handleTouchMove(e,t){gotTouchEvent(e);const i=t.changedTouches;let n;const r=i.length;let o,a;const s=e._positions;for(n=0;n<r;++n){o=i[n],a=o.identifier;const t=s.get(a);defined(t)&&getPosition$1(e,o,t)}fireTouchMoveEvents(e,t);const c=e._previousPositions;for(n=0;n<r;++n)o=i[n],a=o.identifier,Cartesian2.clone(s.get(a),c.get(a))}const touchMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2},touchPinchMovementEvent={distance:{startPosition:new Cartesian2,endPosition:new Cartesian2},angleAndHeight:{startPosition:new Cartesian2,endPosition:new Cartesian2}};function fireTouchMoveEvents(e,t){const i=getModifier(t),n=e._positions,r=e._previousPositions,o=n.length;let a;if(1===o&&e._buttonDown[MouseButton.LEFT]){const r=n.values[0];Cartesian2.clone(r,e._primaryPosition);const o=e._primaryPreviousPosition;a=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,i),defined(a)&&(Cartesian2.clone(o,touchMoveEvent.startPosition),Cartesian2.clone(r,touchMoveEvent.endPosition),a(touchMoveEvent)),Cartesian2.clone(r,o),t.preventDefault()}else if(2===o&&e._isPinching&&(a=e.getInputAction(ScreenSpaceEventType$1.PINCH_MOVE,i),defined(a))){const e=n.values[0],t=n.values[1],i=r.values[0],o=r.values[1],s=t.x-e.x,c=t.y-e.y,l=.25*Math.sqrt(s*s+c*c),u=o.x-i.x,d=o.y-i.y,h=.25*Math.sqrt(u*u+d*d),p=.125*(t.y+e.y),f=.125*(o.y+i.y),m=Math.atan2(c,s),g=Math.atan2(d,u);Cartesian2.fromElements(0,h,touchPinchMovementEvent.distance.startPosition),Cartesian2.fromElements(0,l,touchPinchMovementEvent.distance.endPosition),Cartesian2.fromElements(g,f,touchPinchMovementEvent.angleAndHeight.startPosition),Cartesian2.fromElements(m,p,touchPinchMovementEvent.angleAndHeight.endPosition),a(touchPinchMovementEvent)}}function handlePointerDown(e,t){if(t.target.setPointerCapture(t.pointerId),"touch"===t.pointerType){const i=e._positions,n=t.pointerId;i.set(n,getPosition$1(e,t,new Cartesian2)),fireTouchEvents(e,t);e._previousPositions.set(n,Cartesian2.clone(i.get(n)))}else handleMouseDown(e,t)}function handlePointerUp(e,t){if("touch"===t.pointerType){const i=e._positions,n=t.pointerId;i.remove(n),fireTouchEvents(e,t);e._previousPositions.remove(n)}else handleMouseUp(e,t)}function handlePointerMove(e,t){if("touch"===t.pointerType){const i=e._positions,n=t.pointerId,r=i.get(n);if(!defined(r))return;getPosition$1(e,t,r),fireTouchMoveEvents(e,t);const o=e._previousPositions;Cartesian2.clone(i.get(n),o.get(n))}else handleMouseMove(e,t)}function ScreenSpaceEventHandler(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new Cartesian2,this._primaryPosition=new Cartesian2,this._primaryPreviousPosition=new Cartesian2,this._positions=new AssociativeArray,this._previousPositions=new AssociativeArray,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=defaultValue(e,document),registerListeners(this)}function ShowGeometryInstanceAttribute(e){e=defaultValue(e,!0),this.value=ShowGeometryInstanceAttribute.toValue(e)}ScreenSpaceEventHandler.prototype.setInputAction=function(e,t,i){const n=getInputEventKey(t,i);this._inputEvents[n]=e},ScreenSpaceEventHandler.prototype.getInputAction=function(e,t){const i=getInputEventKey(e,t);return this._inputEvents[i]},ScreenSpaceEventHandler.prototype.removeInputAction=function(e,t){const i=getInputEventKey(e,t);delete this._inputEvents[i]},ScreenSpaceEventHandler.prototype.isDestroyed=function(){return!1},ScreenSpaceEventHandler.prototype.destroy=function(){return unregisterListeners(this),destroyObject(this)},ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds=800,ScreenSpaceEventHandler.touchHoldDelayMilliseconds=1500,Object.defineProperties(ShowGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}}),ShowGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?(t[0]=e,t):new Uint8Array([e])};const Simon1994PlanetaryPositions={};function computeTdbMinusTtSpice(e){const t=6.239996+.0172019696544*e;return.001657*Math.sin(t+.01671*Math.sin(t))}const TdtMinusTai=32.184,J2000d=2451545;function taiToTdb(e,t){t=JulianDate.addSeconds(e,TdtMinusTai,t);const i=JulianDate.totalDays(t)-J2000d;return t=JulianDate.addSeconds(t,computeTdbMinusTtSpice(i),t)}const epoch=new JulianDate(2451545,0,TimeStandard$1.TAI),MetersPerKilometer=1e3,RadiansPerDegree=CesiumMath.RADIANS_PER_DEGREE,RadiansPerArcSecond=CesiumMath.RADIANS_PER_ARCSECOND,MetersPerAstronomicalUnit=14959787e4,perifocalToEquatorial=new Matrix3;function elementsToCartesian(e,t,i,n,r,o,a){i<0&&(i=-i,r+=CesiumMath.PI);const s=e*(1-t),c=n-r,l=r,u=meanAnomalyToTrueAnomaly(o-n,t);perifocalToCartesianMatrix(c,i,l,perifocalToEquatorial);const d=s*(1+t),h=Math.cos(u),p=Math.sin(u),f=d/(1+t*h);return defined(a)?(a.x=f*h,a.y=f*p,a.z=0):a=new Cartesian3(f*h,f*p,0),Matrix3.multiplyByVector(perifocalToEquatorial,a,a)}function meanAnomalyToTrueAnomaly(e,t){return eccentricAnomalyToTrueAnomaly(meanAnomalyToEccentricAnomaly(e,t),t)}const maxIterationCount=50,keplerEqConvergence=CesiumMath.EPSILON8;function meanAnomalyToEccentricAnomaly(e,t){const i=Math.floor(e/CesiumMath.TWO_PI);let n,r=(e-=i*CesiumMath.TWO_PI)+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),o=Number.MAX_VALUE;for(n=0;n<maxIterationCount&&Math.abs(o-r)>keplerEqConvergence;++n){o=r;r=o-(o-t*Math.sin(o)-e)/(1-t*Math.cos(o))}return o=r+i*CesiumMath.TWO_PI,o}function eccentricAnomalyToTrueAnomaly(e,t){const i=Math.floor(e/CesiumMath.TWO_PI);e-=i*CesiumMath.TWO_PI;const n=Math.cos(e)-t,r=Math.sin(e)*Math.sqrt(1-t*t);let o=Math.atan2(r,n);return o=CesiumMath.zeroToTwoPi(o),e<0&&(o-=CesiumMath.TWO_PI),o+=i*CesiumMath.TWO_PI,o}function perifocalToCartesianMatrix(e,t,i,n){const r=Math.cos(e),o=Math.sin(e),a=Math.cos(t),s=Math.sin(t),c=Math.cos(i),l=Math.sin(i);return defined(n)?(n[0]=c*r-l*o*a,n[1]=l*r+c*o*a,n[2]=o*s,n[3]=-c*o-l*r*a,n[4]=-l*o+c*r*a,n[5]=r*s,n[6]=l*s,n[7]=-c*s,n[8]=a):n=new Matrix3(c*r-l*o*a,-c*o-l*r*a,l*s,l*r+c*o*a,-l*o+c*r*a,-c*s,o*s,r*s,a),n}const semiMajorAxis0=1.0000010178*MetersPerAstronomicalUnit,meanLongitude0=100.46645683*RadiansPerDegree,meanLongitude1=1295977422.83429*RadiansPerArcSecond,p1u=16002,p2u=21863,p3u=32004,p4u=10931,p5u=14529,p6u=16368,p7u=15318,p8u=32794,Ca1=64*1e-7*MetersPerAstronomicalUnit,Ca2=1e-7*-152*MetersPerAstronomicalUnit,Ca3=62*1e-7*MetersPerAstronomicalUnit,Ca4=-8e-7*MetersPerAstronomicalUnit,Ca5=32*1e-7*MetersPerAstronomicalUnit,Ca6=1e-7*-41*MetersPerAstronomicalUnit,Ca7=19*1e-7*MetersPerAstronomicalUnit,Ca8=1e-7*-11*MetersPerAstronomicalUnit,Sa1=1e-7*-150*MetersPerAstronomicalUnit,Sa2=1e-7*-46*MetersPerAstronomicalUnit,Sa3=68*1e-7*MetersPerAstronomicalUnit,Sa4=54*1e-7*MetersPerAstronomicalUnit,Sa5=14*1e-7*MetersPerAstronomicalUnit,Sa6=24*1e-7*MetersPerAstronomicalUnit,Sa7=1e-7*-28*MetersPerAstronomicalUnit,Sa8=22*1e-7*MetersPerAstronomicalUnit,q1u=10,q2u=16002,q3u=21863,q4u=10931,q5u=1473,q6u=32004,q7u=4387,q8u=73,Cl1=1e-7*-325,Cl2=1e-7*-322,Cl3=1e-7*-79,Cl4=232*1e-7,Cl5=1e-7*-52,Cl6=97*1e-7,Cl7=55*1e-7,Cl8=1e-7*-41,Sl1=1e-7*-105,Sl2=1e-7*-137,Sl3=258*1e-7,Sl4=35*1e-7,Sl5=1e-7*-116,Sl6=1e-7*-88,Sl7=1e-7*-112,Sl8=1e-7*-80,scratchDate$1=new JulianDate(0,0,TimeStandard$1.TAI);function computeSimonEarthMoonBarycenter(e,t){taiToTdb(e,scratchDate$1);const i=(scratchDate$1.dayNumber-epoch.dayNumber+(scratchDate$1.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/(10*TimeConstants$1.DAYS_PER_JULIAN_CENTURY),n=.3595362*i,r=semiMajorAxis0+Ca1*Math.cos(p1u*n)+Sa1*Math.sin(p1u*n)+Ca2*Math.cos(p2u*n)+Sa2*Math.sin(p2u*n)+Ca3*Math.cos(p3u*n)+Sa3*Math.sin(p3u*n)+Ca4*Math.cos(p4u*n)+Sa4*Math.sin(p4u*n)+Ca5*Math.cos(p5u*n)+Sa5*Math.sin(p5u*n)+Ca6*Math.cos(p6u*n)+Sa6*Math.sin(p6u*n)+Ca7*Math.cos(p7u*n)+Sa7*Math.sin(p7u*n)+Ca8*Math.cos(p8u*n)+Sa8*Math.sin(p8u*n),o=meanLongitude0+meanLongitude1*i+Cl1*Math.cos(q1u*n)+Sl1*Math.sin(q1u*n)+Cl2*Math.cos(q2u*n)+Sl2*Math.sin(q2u*n)+Cl3*Math.cos(q3u*n)+Sl3*Math.sin(q3u*n)+Cl4*Math.cos(q4u*n)+Sl4*Math.sin(q4u*n)+Cl5*Math.cos(q5u*n)+Sl5*Math.sin(q5u*n)+Cl6*Math.cos(q6u*n)+Sl6*Math.sin(q6u*n)+Cl7*Math.cos(q7u*n)+Sl7*Math.sin(q7u*n)+Cl8*Math.cos(q8u*n)+Sl8*Math.sin(q8u*n);return elementsToCartesian(r,.0167086342-.0004203654*i,469.97289*RadiansPerArcSecond*i,102.93734808*RadiansPerDegree+11612.3529*RadiansPerArcSecond*i,174.87317577*RadiansPerDegree-8679.27034*RadiansPerArcSecond*i,o,t)}function computeSimonMoon(e,t){taiToTdb(e,scratchDate$1);const i=(scratchDate$1.dayNumber-epoch.dayNumber+(scratchDate$1.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,n=i*i,r=n*i,o=r*i;let a=383397.7725+.004*i,s=.055545526-16e-9*i;const c=5.15668983*RadiansPerDegree;let l=-8e-5*i+.02966*n-42e-6*r-13e-8*o;const u=83.35324312*RadiansPerDegree;let d=14643420.2669*i-38.2702*n-.045047*r+21301e-8*o;const h=125.04455501*RadiansPerDegree;let p=-6967919.3631*i+6.3602*n+.007625*r-3586e-8*o;const f=218.31664563*RadiansPerDegree;let m=1732559343.4847*i-6.391*n+.006588*r-3169e-8*o;const g=297.85019547*RadiansPerDegree+RadiansPerArcSecond*(1602961601.209*i-6.3706*n+.006593*r-3169e-8*o),_=134.96340251*RadiansPerDegree+RadiansPerArcSecond*(1717915923.2178*i+31.8792*n+.051635*r-2447e-7*o),y=357.52910918*RadiansPerDegree+RadiansPerArcSecond*(129596581.0481*i-.5532*n+136e-6*r-1149e-8*o),C=310.17137918*RadiansPerDegree-RadiansPerArcSecond*(6967051.436*i+6.2068*n+.007618*r-3219e-8*o),T=2*g,S=4*g,v=6*g,A=2*_,E=3*_,b=4*_,x=2*(93.27209062*RadiansPerDegree+RadiansPerArcSecond*(1739527262.8478*i-12.7512*n-.001037*r+417e-8*o));a+=3400.4*Math.cos(T)-635.6*Math.cos(T-_)-235.6*Math.cos(_)+218.1*Math.cos(T-y)+181*Math.cos(T+_),s+=.014216*Math.cos(T-_)+.008551*Math.cos(T-A)-.001383*Math.cos(_)+.001356*Math.cos(T+_)-.001147*Math.cos(S-E)-914e-6*Math.cos(S-A)+869e-6*Math.cos(T-y-_)-627e-6*Math.cos(T)-394e-6*Math.cos(S-b)+282e-6*Math.cos(T-y-A)-279e-6*Math.cos(g-_)-236e-6*Math.cos(A)+231e-6*Math.cos(S)+229e-6*Math.cos(v-b)-201e-6*Math.cos(A-x),l+=486.26*Math.cos(T-x)-40.13*Math.cos(T)+37.51*Math.cos(x)+25.73*Math.cos(A-x)+19.97*Math.cos(T-y-x),d+=-55609*Math.sin(T-_)-34711*Math.sin(T-A)-9792*Math.sin(_)+9385*Math.sin(S-E)+7505*Math.sin(S-A)+5318*Math.sin(T+_)+3484*Math.sin(S-b)-3417*Math.sin(T-y-_)-2530*Math.sin(v-b)-2376*Math.sin(T)-2075*Math.sin(T-E)-1883*Math.sin(A)-1736*Math.sin(v-5*_)+1626*Math.sin(y)-1370*Math.sin(v-E),p+=-5392*Math.sin(T-x)-540*Math.sin(y)-441*Math.sin(T)+423*Math.sin(x)-288*Math.sin(A-x),m+=-3332.9*Math.sin(T)+1197.4*Math.sin(T-_)-662.5*Math.sin(y)+396.3*Math.sin(_)-218*Math.sin(T-y);const P=2*C,D=3*C;l+=46.997*Math.cos(C)*i-.614*Math.cos(T-x+C)*i+.614*Math.cos(T-x-C)*i-.0297*Math.cos(P)*n-.0335*Math.cos(C)*n+.0012*Math.cos(T-x+P)*n-16e-5*Math.cos(C)*r+4e-5*Math.cos(D)*r+4e-5*Math.cos(P)*r;const w=2.116*Math.sin(C)*i-.111*Math.sin(T-x-C)*i-.0015*Math.sin(C)*n;d+=w,m+=w,p+=-520.77*Math.sin(C)*i+13.66*Math.sin(T-x+C)*i+1.12*Math.sin(T-C)*i-1.06*Math.sin(x-C)*i+.66*Math.sin(P)*n+.371*Math.sin(C)*n-.035*Math.sin(T-x+P)*n-.015*Math.sin(T-x+C)*n+.0014*Math.sin(C)*r-.0011*Math.sin(D)*r-9e-4*Math.sin(P)*r,a*=MetersPerKilometer;return elementsToCartesian(a,s,c+l*RadiansPerArcSecond,u+d*RadiansPerArcSecond,h+p*RadiansPerArcSecond,f+m*RadiansPerArcSecond,t)}const moonEarthMassRatio=.012300034,factor=moonEarthMassRatio/(moonEarthMassRatio+1)*-1;function computeSimonEarth(e,t){return t=computeSimonMoon(e,t),Cartesian3.multiplyByScalar(t,factor,t)}const axesTransformation=new Matrix3(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let translation=new Cartesian3;function interpolateColors(e,t,i,n,r,o,a){const s=PolylinePipeline.numberOfPoints(e,t,r);let c;const l=i.red,u=i.green,d=i.blue,h=i.alpha,p=n.red,f=n.green,m=n.blue,g=n.alpha;if(Color.equals(i,n)){for(c=0;c<s;c++)o[a++]=Color.floatToByte(l),o[a++]=Color.floatToByte(u),o[a++]=Color.floatToByte(d),o[a++]=Color.floatToByte(h);return a}const _=(p-l)/s,y=(f-u)/s,C=(m-d)/s,T=(g-h)/s;let S=a;for(c=0;c<s;c++)o[S++]=Color.floatToByte(l+c*_),o[S++]=Color.floatToByte(u+c*y),o[S++]=Color.floatToByte(d+c*C),o[S++]=Color.floatToByte(h+c*T);return S}function SimplePolylineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.colors,n=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=i,this._colorsPerVertex=n,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";let r=1+t.length*Cartesian3.packedLength;r+=defined(i)?1+i.length*Color.packedLength:1,this.packedLength=r+Ellipsoid.packedLength+3}Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),defined(t)||(t=new Cartesian3),translation=computeSimonEarthMoonBarycenter(e,translation),t=Cartesian3.negate(translation,t),computeSimonEarth(e,translation),Cartesian3.subtract(t,translation,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),t=computeSimonMoon(e,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},SimplePolylineGeometry.pack=function(e,t,i){let n;i=defaultValue(i,0);const r=e._positions;let o=r.length;for(t[i++]=o,n=0;n<o;++n,i+=Cartesian3.packedLength)Cartesian3.pack(r[n],t,i);const a=e._colors;for(o=defined(a)?a.length:0,t[i++]=o,n=0;n<o;++n,i+=Color.packedLength)Color.pack(a[n],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._colorsPerVertex?1:0,t[i++]=e._arcType,t[i]=e._granularity,t},SimplePolylineGeometry.unpack=function(e,t,i){let n;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(n=0;n<r;++n,t+=Cartesian3.packedLength)o[n]=Cartesian3.unpack(e,t);r=e[t++];const a=r>0?new Array(r):void 0;for(n=0;n<r;++n,t+=Color.packedLength)a[n]=Color.unpack(e,t);const s=Ellipsoid.unpack(e,t);t+=Ellipsoid.packedLength;const c=1===e[t++],l=e[t++],u=e[t];return defined(i)?(i._positions=o,i._colors=a,i._ellipsoid=s,i._colorsPerVertex=c,i._arcType=l,i._granularity=u,i):new SimplePolylineGeometry({positions:o,colors:a,ellipsoid:s,colorsPerVertex:c,arcType:l,granularity:u})};const scratchArray1=new Array(2),scratchArray2=new Array(2),generateArcOptionsScratch$1={positions:scratchArray1,height:scratchArray2,ellipsoid:void 0,minDistance:void 0,granularity:void 0};function SphereGeometry(e){const t=defaultValue(e.radius,1),i={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,vertexFormat:e.vertexFormat};this._ellipsoidGeometry=new EllipsoidGeometry(i),this._workerName="createSphereGeometry"}SimplePolylineGeometry.createGeometry=function(e){const t=e._positions,i=e._colors,n=e._colorsPerVertex,r=e._arcType,o=e._granularity,a=e._ellipsoid,s=CesiumMath.chordLength(o,a.maximumRadius),c=defined(i)&&!n;let l;const u=t.length;let d,h,p,f,m=0;if(r===ArcType$1.GEODESIC||r===ArcType$1.RHUMB){let e,n,h;r===ArcType$1.GEODESIC?(e=CesiumMath.chordLength(o,a.maximumRadius),n=PolylinePipeline.numberOfPoints,h=PolylinePipeline.generateArc):(e=o,n=PolylinePipeline.numberOfPointsRhumbLine,h=PolylinePipeline.generateRhumbArc);const g=PolylinePipeline.extractHeights(t,a),_=generateArcOptionsScratch$1;if(r===ArcType$1.GEODESIC?_.minDistance=s:_.granularity=o,_.ellipsoid=a,c){let r=0;for(l=0;l<u-1;l++)r+=n(t[l],t[l+1],e)+1;d=new Float64Array(3*r),p=new Uint8Array(4*r),_.positions=scratchArray1,_.height=scratchArray2;let o=0;for(l=0;l<u-1;++l){scratchArray1[0]=t[l],scratchArray1[1]=t[l+1],scratchArray2[0]=g[l],scratchArray2[1]=g[l+1];const e=h(_);if(defined(i)){const t=e.length/3;f=i[l];for(let e=0;e<t;++e)p[o++]=Color.floatToByte(f.red),p[o++]=Color.floatToByte(f.green),p[o++]=Color.floatToByte(f.blue),p[o++]=Color.floatToByte(f.alpha)}d.set(e,m),m+=e.length}}else if(_.positions=t,_.height=g,d=new Float64Array(h(_)),defined(i)){for(p=new Uint8Array(d.length/3*4),l=0;l<u-1;++l){m=interpolateColors(t[l],t[l+1],i[l],i[l+1],s,p,m)}const e=i[u-1];p[m++]=Color.floatToByte(e.red),p[m++]=Color.floatToByte(e.green),p[m++]=Color.floatToByte(e.blue),p[m++]=Color.floatToByte(e.alpha)}}else{h=c?2*u-2:u,d=new Float64Array(3*h),p=defined(i)?new Uint8Array(4*h):void 0;let e=0,n=0;for(l=0;l<u;++l){const r=t[l];if(c&&l>0&&(Cartesian3.pack(r,d,e),e+=3,f=i[l-1],p[n++]=Color.floatToByte(f.red),p[n++]=Color.floatToByte(f.green),p[n++]=Color.floatToByte(f.blue),p[n++]=Color.floatToByte(f.alpha)),c&&l===u-1)break;Cartesian3.pack(r,d,e),e+=3,defined(i)&&(f=i[l],p[n++]=Color.floatToByte(f.red),p[n++]=Color.floatToByte(f.green),p[n++]=Color.floatToByte(f.blue),p[n++]=Color.floatToByte(f.alpha))}}const g=new GeometryAttributes;g.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d}),defined(i)&&(g.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:p,normalize:!0})),h=d.length/3;const _=2*(h-1),y=IndexDatatype$1.createTypedArray(h,_);let C=0;for(l=0;l<h-1;++l)y[C++]=l,y[C++]=l+1;return new Geometry({attributes:g,indices:y,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromPoints(t)})},SphereGeometry.packedLength=EllipsoidGeometry.packedLength,SphereGeometry.pack=function(e,t,i){return EllipsoidGeometry.pack(e._ellipsoidGeometry,t,i)};const scratchEllipsoidGeometry$1=new EllipsoidGeometry,scratchOptions$3={radius:void 0,radii:new Cartesian3,vertexFormat:new VertexFormat,stackPartitions:void 0,slicePartitions:void 0};function SphereOutlineGeometry(e){const t=defaultValue(e.radius,1),i={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new EllipsoidOutlineGeometry(i),this._workerName="createSphereOutlineGeometry"}SphereGeometry.unpack=function(e,t,i){const n=EllipsoidGeometry.unpack(e,t,scratchEllipsoidGeometry$1);return scratchOptions$3.vertexFormat=VertexFormat.clone(n._vertexFormat,scratchOptions$3.vertexFormat),scratchOptions$3.stackPartitions=n._stackPartitions,scratchOptions$3.slicePartitions=n._slicePartitions,defined(i)?(Cartesian3.clone(n._radii,scratchOptions$3.radii),i._ellipsoidGeometry=new EllipsoidGeometry(scratchOptions$3),i):(scratchOptions$3.radius=n._radii.x,new SphereGeometry(scratchOptions$3))},SphereGeometry.createGeometry=function(e){return EllipsoidGeometry.createGeometry(e._ellipsoidGeometry)},SphereOutlineGeometry.packedLength=EllipsoidOutlineGeometry.packedLength,SphereOutlineGeometry.pack=function(e,t,i){return EllipsoidOutlineGeometry.pack(e._ellipsoidGeometry,t,i)};const scratchEllipsoidGeometry=new EllipsoidOutlineGeometry,scratchOptions$2={radius:void 0,radii:new Cartesian3,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};function Spherical(e,t,i){this.clock=defaultValue(e,0),this.cone=defaultValue(t,0),this.magnitude=defaultValue(i,1)}function subdivideArray(e,t){const i=[],n=e.length;let r=0;for(;r<n;){const o=Math.ceil((n-r)/t--);i.push(e.slice(r,r+o)),r+=o}return i}SphereOutlineGeometry.unpack=function(e,t,i){const n=EllipsoidOutlineGeometry.unpack(e,t,scratchEllipsoidGeometry);return scratchOptions$2.stackPartitions=n._stackPartitions,scratchOptions$2.slicePartitions=n._slicePartitions,scratchOptions$2.subdivisions=n._subdivisions,defined(i)?(Cartesian3.clone(n._radii,scratchOptions$2.radii),i._ellipsoidGeometry=new EllipsoidOutlineGeometry(scratchOptions$2),i):(scratchOptions$2.radius=n._radii.x,new SphereOutlineGeometry(scratchOptions$2))},SphereOutlineGeometry.createGeometry=function(e){return EllipsoidOutlineGeometry.createGeometry(e._ellipsoidGeometry)},Spherical.fromCartesian3=function(e,t){const i=e.x,n=e.y,r=e.z,o=i*i+n*n;return defined(t)||(t=new Spherical),t.clock=Math.atan2(n,i),t.cone=Math.atan2(Math.sqrt(o),r),t.magnitude=Math.sqrt(o+r*r),t},Spherical.clone=function(e,t){if(defined(e))return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=e.magnitude,t):new Spherical(e.clock,e.cone,e.magnitude)},Spherical.normalize=function(e,t){return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=1,t):new Spherical(e.clock,e.cone,1)},Spherical.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.clock===t.clock&&e.cone===t.cone&&e.magnitude===t.magnitude},Spherical.equalsEpsilon=function(e,t,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e.clock-t.clock)<=i&&Math.abs(e.cone-t.cone)<=i&&Math.abs(e.magnitude-t.magnitude)<=i},Spherical.prototype.equals=function(e){return Spherical.equals(this,e)},Spherical.prototype.clone=function(e){return Spherical.clone(this,e)},Spherical.prototype.equalsEpsilon=function(e,t){return Spherical.equalsEpsilon(this,e,t)},Spherical.prototype.toString=function(){return`(${this.clock}, ${this.cone}, ${this.magnitude})`};const TileEdge={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7};function TilingScheme(e){}function compareIntervalStartTimes(e,t){return JulianDate.compare(e.start,t.start)}function TimeIntervalCollection(e){if(this._intervals=[],this._changedEvent=new Event,defined(e)){const t=e.length;for(let i=0;i<t;i++)this.addInterval(e[i])}}Object.defineProperties(TilingScheme.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},projection:{get:DeveloperError.throwInstantiationError}}),TilingScheme.prototype.getNumberOfXTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.getNumberOfYTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.rectangleToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.positionToTileXY=DeveloperError.throwInstantiationError,Object.defineProperties(TimeIntervalCollection.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){const e=this._intervals;return 0===e.length?void 0:e[0].start}},isStartIncluded:{get:function(){const e=this._intervals;return 0!==e.length&&e[0].isStartIncluded}},stop:{get:function(){const e=this._intervals,t=e.length;return 0===t?void 0:e[t-1].stop}},isStopIncluded:{get:function(){const e=this._intervals,t=e.length;return 0!==t&&e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return 0===this._intervals.length}}}),TimeIntervalCollection.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof TimeIntervalCollection))return!1;const i=this._intervals,n=e._intervals,r=i.length;if(r!==n.length)return!1;for(let e=0;e<r;e++)if(!TimeInterval.equals(i[e],n[e],t))return!1;return!0},TimeIntervalCollection.prototype.get=function(e){return this._intervals[e]},TimeIntervalCollection.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))},TimeIntervalCollection.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0},TimeIntervalCollection.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0},TimeIntervalCollection.prototype.contains=function(e){return this.indexOf(e)>=0};const indexOfScratch=new TimeInterval;TimeIntervalCollection.prototype.indexOf=function(e){const t=this._intervals;indexOfScratch.start=e,indexOfScratch.stop=e;let i=binarySearch(t,indexOfScratch,compareIntervalStartTimes);return i>=0?t[i].isStartIncluded?i:i>0&&t[i-1].stop.equals(e)&&t[i-1].isStopIncluded?i-1:~i:(i=~i,i>0&&i-1<t.length&&TimeInterval.contains(t[i-1],e)?i-1:~i)},TimeIntervalCollection.prototype.findInterval=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).start,i=e.stop,n=e.isStartIncluded,r=e.isStopIncluded,o=this._intervals;for(let e=0,a=o.length;e<a;e++){const a=o[e];if((!defined(t)||a.start.equals(t))&&(!defined(i)||a.stop.equals(i))&&(!defined(n)||a.isStartIncluded===n)&&(!defined(r)||a.isStopIncluded===r))return o[e]}},TimeIntervalCollection.prototype.addInterval=function(e,t){if(e.isEmpty)return;const i=this._intervals;if(0===i.length||JulianDate.greaterThan(e.start,i[i.length-1].stop))return i.push(e),void this._changedEvent.raiseEvent(this);let n,r=binarySearch(i,e,compareIntervalStartTimes);for(r<0?r=~r:r>0&&e.isStartIncluded&&i[r-1].isStartIncluded&&i[r-1].start.equals(e.start)?--r:r<i.length&&!e.isStartIncluded&&i[r].isStartIncluded&&i[r].start.equals(e.start)&&++r,r>0&&(n=JulianDate.compare(i[r-1].stop,e.start),(n>0||0===n&&(i[r-1].isStopIncluded||e.isStartIncluded))&&((defined(t)?t(i[r-1].data,e.data):i[r-1].data===e.data)?(e=JulianDate.greaterThan(e.stop,i[r-1].stop)?new TimeInterval({start:i[r-1].start,stop:e.stop,isStartIncluded:i[r-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):new TimeInterval({start:i[r-1].start,stop:i[r-1].stop,isStartIncluded:i[r-1].isStartIncluded,isStopIncluded:i[r-1].isStopIncluded||e.stop.equals(i[r-1].stop)&&e.isStopIncluded,data:e.data}),i.splice(r-1,1),--r):(n=JulianDate.compare(i[r-1].stop,e.stop),(n>0||0===n&&i[r-1].isStopIncluded&&!e.isStopIncluded)&&i.splice(r,0,new TimeInterval({start:e.stop,stop:i[r-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:i[r-1].isStopIncluded,data:i[r-1].data})),i[r-1]=new TimeInterval({start:i[r-1].start,stop:e.start,isStartIncluded:i[r-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:i[r-1].data}))));r<i.length&&(n=JulianDate.compare(e.stop,i[r].start),n>0||0===n&&(e.isStopIncluded||i[r].isStartIncluded));)if(defined(t)?t(i[r].data,e.data):i[r].data===e.data)e=new TimeInterval({start:e.start,stop:JulianDate.greaterThan(i[r].stop,e.stop)?i[r].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:JulianDate.greaterThan(i[r].stop,e.stop)?i[r].isStopIncluded:e.isStopIncluded,data:e.data}),i.splice(r,1);else{if(i[r]=new TimeInterval({start:e.stop,stop:i[r].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:i[r].isStopIncluded,data:i[r].data}),!i[r].isEmpty)break;i.splice(r,1)}i.splice(r,0,e),this._changedEvent.raiseEvent(this)},TimeIntervalCollection.prototype.removeInterval=function(e){if(e.isEmpty)return!1;const t=this._intervals;let i=binarySearch(t,e,compareIntervalStartTimes);i<0&&(i=~i);let n=!1;for(i>0&&(JulianDate.greaterThan(t[i-1].stop,e.start)||t[i-1].stop.equals(e.start)&&t[i-1].isStopIncluded&&e.isStartIncluded)&&(n=!0,(JulianDate.greaterThan(t[i-1].stop,e.stop)||t[i-1].isStopIncluded&&!e.isStopIncluded&&t[i-1].stop.equals(e.stop))&&t.splice(i,0,new TimeInterval({start:e.stop,stop:t[i-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[i-1].isStopIncluded,data:t[i-1].data})),t[i-1]=new TimeInterval({start:t[i-1].start,stop:e.start,isStartIncluded:t[i-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[i-1].data})),i<t.length&&!e.isStartIncluded&&t[i].isStartIncluded&&e.start.equals(t[i].start)&&(n=!0,t.splice(i,0,new TimeInterval({start:t[i].start,stop:t[i].start,isStartIncluded:!0,isStopIncluded:!0,data:t[i].data})),++i);i<t.length&&JulianDate.greaterThan(e.stop,t[i].stop);)n=!0,t.splice(i,1);return i<t.length&&e.stop.equals(t[i].stop)&&(n=!0,!e.isStopIncluded&&t[i].isStopIncluded?i+1<t.length&&t[i+1].start.equals(e.stop)&&t[i].data===t[i+1].data?(t.splice(i,1),t[i]=new TimeInterval({start:t[i].start,stop:t[i].stop,isStartIncluded:!0,isStopIncluded:t[i].isStopIncluded,data:t[i].data})):t[i]=new TimeInterval({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[i].data}):t.splice(i,1)),i<t.length&&(JulianDate.greaterThan(e.stop,t[i].start)||e.stop.equals(t[i].start)&&e.isStopIncluded&&t[i].isStartIncluded)&&(n=!0,t[i]=new TimeInterval({start:e.stop,stop:t[i].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[i].isStopIncluded,data:t[i].data})),n&&this._changedEvent.raiseEvent(this),n},TimeIntervalCollection.prototype.intersect=function(e,t,i){const n=new TimeIntervalCollection;let r=0,o=0;const a=this._intervals,s=e._intervals;for(;r<a.length&&o<s.length;){const e=a[r],c=s[o];if(JulianDate.lessThan(e.stop,c.start))++r;else if(JulianDate.lessThan(c.stop,e.start))++o;else{if(defined(i)||defined(t)&&t(e.data,c.data)||!defined(t)&&c.data===e.data){const r=TimeInterval.intersect(e,c,new TimeInterval,i);r.isEmpty||n.addInterval(r,t)}JulianDate.lessThan(e.stop,c.stop)||e.stop.equals(c.stop)&&!e.isStopIncluded&&c.isStopIncluded?++r:++o}}return n},TimeIntervalCollection.fromJulianDateArray=function(e,t){defined(t)||(t=new TimeIntervalCollection);const i=e.julianDates,n=i.length,r=e.dataCallback,o=defaultValue(e.isStartIncluded,!0),a=defaultValue(e.isStopIncluded,!0),s=defaultValue(e.leadingInterval,!1),c=defaultValue(e.trailingInterval,!1);let l,u=0;s&&(++u,l=new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:i[0],isStartIncluded:!0,isStopIncluded:!o}),l.data=defined(r)?r(l,t.length):t.length,t.addInterval(l));for(let e=0;e<n-1;++e){let s=i[e];const c=i[e+1];l=new TimeInterval({start:s,stop:c,isStartIncluded:t.length!==u||o,isStopIncluded:e===n-2&&a}),l.data=defined(r)?r(l,t.length):t.length,t.addInterval(l),s=c}return c&&(l=new TimeInterval({start:i[n-1],stop:Iso8601.MAXIMUM_VALUE,isStartIncluded:!a,isStopIncluded:!0}),l.data=defined(r)?r(l,t.length):t.length,t.addInterval(l)),t};const scratchGregorianDate=new GregorianDate,monthLengths=[0,31,28,31,30,31,30,31,31,30,31,30,31];function addToDate(e,t,i){defined(i)||(i=new JulianDate),JulianDate.toGregorianDate(e,scratchGregorianDate);let n=scratchGregorianDate.millisecond+t.millisecond,r=scratchGregorianDate.second+t.second,o=scratchGregorianDate.minute+t.minute,a=scratchGregorianDate.hour+t.hour,s=scratchGregorianDate.day+t.day,c=scratchGregorianDate.month+t.month,l=scratchGregorianDate.year+t.year;for(n>=1e3&&(r+=Math.floor(n/1e3),n%=1e3),r>=60&&(o+=Math.floor(r/60),r%=60),o>=60&&(a+=Math.floor(o/60),o%=60),a>=24&&(s+=Math.floor(a/24),a%=24),monthLengths[2]=isLeapYear(l)?29:28;s>monthLengths[c]||c>=13;)s>monthLengths[c]&&(s-=monthLengths[c],++c),c>=13&&(--c,l+=Math.floor(c/12),c%=12,++c),monthLengths[2]=isLeapYear(l)?29:28;return scratchGregorianDate.millisecond=n,scratchGregorianDate.second=r,scratchGregorianDate.minute=o,scratchGregorianDate.hour=a,scratchGregorianDate.day=s,scratchGregorianDate.month=c,scratchGregorianDate.year=l,JulianDate.fromGregorianDate(scratchGregorianDate,i)}const scratchJulianDate$2=new JulianDate,durationRegex=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function parseDuration(e,t){if(!defined(e)||0===e.length)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,t.millisecond=0,"P"===e[0]){const i=e.match(durationRegex);if(!defined(i))return!1;if(defined(i[1])&&(t.year=Number(i[1].replace(",","."))),defined(i[2])&&(t.month=Number(i[2].replace(",","."))),defined(i[3])&&(t.day=7*Number(i[3].replace(",","."))),defined(i[4])&&(t.day+=Number(i[4].replace(",","."))),defined(i[5])&&(t.hour=Number(i[5].replace(",","."))),defined(i[6])&&(t.minute=Number(i[6].replace(",","."))),defined(i[7])){const e=Number(i[7].replace(",","."));t.second=Math.floor(e),t.millisecond=e%1*1e3}}else"Z"!==e[e.length-1]&&(e+="Z"),JulianDate.toGregorianDate(JulianDate.fromIso8601(e,scratchJulianDate$2),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const scratchDuration=new GregorianDate;TimeIntervalCollection.fromIso8601=function(e,t){const i=e.iso8601.split("/"),n=JulianDate.fromIso8601(i[0]),r=JulianDate.fromIso8601(i[1]),o=[];if(parseDuration(i[2],scratchDuration)){let e=JulianDate.clone(n);for(o.push(e);JulianDate.compare(e,r)<0;){e=addToDate(e,scratchDuration);JulianDate.compare(r,e)<=0&&JulianDate.clone(r,e),o.push(e)}}else o.push(n,r);return TimeIntervalCollection.fromJulianDateArray({julianDates:o,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DateArray=function(e,t){return TimeIntervalCollection.fromJulianDateArray({julianDates:e.iso8601Dates.map((function(e){return JulianDate.fromIso8601(e)})),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DurationArray=function(e,t){const i=e.epoch,n=e.iso8601Durations,r=defaultValue(e.relativeToPrevious,!1),o=[];let a,s;const c=n.length;for(let e=0;e<c;++e)(parseDuration(n[e],scratchDuration)||0===e)&&(a=r&&defined(s)?addToDate(s,scratchDuration):addToDate(i,scratchDuration),o.push(a),s=a);return TimeIntervalCollection.fromJulianDateArray({julianDates:o,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};const defaultScale$4=new Cartesian3(1,1,1),defaultTranslation=Cartesian3.ZERO,defaultRotation$1=Quaternion.IDENTITY;function TranslationRotationScale(e,t,i){this.translation=Cartesian3.clone(defaultValue(e,defaultTranslation)),this.rotation=Quaternion.clone(defaultValue(t,defaultRotation$1)),this.scale=Cartesian3.clone(defaultValue(i,defaultScale$4))}function VideoSynchronizer(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._clock=void 0,this._element=void 0,this._clockSubscription=void 0,this._seekFunction=void 0,this._lastPlaybackRate=void 0,this.clock=e.clock,this.element=e.element,this.epoch=defaultValue(e.epoch,Iso8601.MINIMUM_VALUE),this.tolerance=defaultValue(e.tolerance,1),this._seeking=!1,this._seekFunction=void 0,this._firstTickAfterSeek=!1}function createSeekFunction(e){return function(){e._seeking=!1,e._firstTickAfterSeek=!0}}function DataRectangle(e,t){this.rectangle=e,this.maxLevel=t}function VRTheWorldTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=Resource.createIfNeeded(e.url);this._resource=t,this._errorEvent=new Event,this._ready=!1,this._readyPromise=defer(),this._terrainDataStructure={heightScale:.001,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0,lowestEncodedHeight:0,highestEncodedHeight:16777215};let i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this._tilingScheme=void 0,this._rectangles=[];const n=this;let r;const o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);function a(e){const t=e.getElementsByTagName("SRS")[0].textContent;if("EPSG:4326"!==t)return void s(`SRS ${t} is not supported.`);n._tilingScheme=new GeographicTilingScheme({ellipsoid:o});const i=e.getElementsByTagName("TileFormat")[0];n._heightmapWidth=parseInt(i.getAttribute("width"),10),n._heightmapHeight=parseInt(i.getAttribute("height"),10),n._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(o,Math.min(n._heightmapWidth,n._heightmapHeight),n._tilingScheme.getNumberOfXTilesAtLevel(0));const r=e.getElementsByTagName("DataExtent");for(let e=0;e<r.length;++e){const t=r[e],i=CesiumMath.toRadians(parseFloat(t.getAttribute("minx"))),o=CesiumMath.toRadians(parseFloat(t.getAttribute("miny"))),a=CesiumMath.toRadians(parseFloat(t.getAttribute("maxx"))),s=CesiumMath.toRadians(parseFloat(t.getAttribute("maxy"))),c=parseInt(t.getAttribute("maxlevel"),10);n._rectangles.push(new DataRectangle(new Rectangle(i,o,a,s),c))}n._ready=!0,n._readyPromise.resolve(!0)}function s(e){const t=defaultValue(e,`An error occurred while accessing ${n._resource.url}.`);r=TileProviderError.handleError(r,n,n._errorEvent,t,void 0,void 0,void 0,c)}function c(){n._resource.fetchXML().then(a).catch(s)}c()}TranslationRotationScale.prototype.equals=function(e){return this===e||defined(e)&&Cartesian3.equals(this.translation,e.translation)&&Quaternion.equals(this.rotation,e.rotation)&&Cartesian3.equals(this.scale,e.scale)},Object.defineProperties(VideoSynchronizer.prototype,{clock:{get:function(){return this._clock},set:function(e){const t=this._clock;t!==e&&(defined(t)&&(this._clockSubscription(),this._clockSubscription=void 0),defined(e)&&(this._clockSubscription=e.onTick.addEventListener(VideoSynchronizer.prototype._onTick,this)),this._clock=e)}},element:{get:function(){return this._element},set:function(e){const t=this._element;t!==e&&(defined(t)&&t.removeEventListener("seeked",this._seekFunction,!1),defined(e)&&(this._seeking=!1,this._seekFunction=createSeekFunction(this),e.addEventListener("seeked",this._seekFunction,!1)),this._element=e,this._seeking=!1,this._firstTickAfterSeek=!1)}}}),VideoSynchronizer.prototype.destroy=function(){return this.element=void 0,this.clock=void 0,destroyObject(this)},VideoSynchronizer.prototype.isDestroyed=function(){return!1},VideoSynchronizer.prototype._trySetPlaybackRate=function(e){if(this._lastPlaybackRate===e.multiplier)return;const t=this._element;try{t.playbackRate=e.multiplier}catch(e){t.playbackRate=0}this._lastPlaybackRate=e.multiplier},VideoSynchronizer.prototype._onTick=function(e){const t=this._element;if(!defined(t)||t.readyState<2)return;const i=t.paused,n=e.shouldAnimate;if(n===i&&(n?t.play():t.pause()),this._seeking||this._firstTickAfterSeek)return void(this._firstTickAfterSeek=!1);this._trySetPlaybackRate(e);const r=e.currentTime,o=defaultValue(this.epoch,Iso8601.MINIMUM_VALUE);let a=JulianDate.secondsDifference(r,o);const s=t.duration;let c;const l=t.currentTime;t.loop?(a%=s,a<0&&(a=s-a),c=a):c=a>s?s:a<0?0:a;const u=n?defaultValue(this.tolerance,1):.001;Math.abs(c-l)>u&&(this._seeking=!0,t.currentTime=c)},Object.defineProperties(VRTheWorldTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}}),VRTheWorldTerrainProvider.prototype.requestTileGeometry=function(e,t,i,n){const r=this._tilingScheme.getNumberOfYTilesAtLevel(i),o=this._resource.getDerivedResource({url:`${i}/${e}/${r-t-1}.tif`,queryParameters:{cesium:!0},request:n}).fetchImage({preferImageBitmap:!0});if(!defined(o))return;const a=this;return Promise.resolve(o).then((function(n){return new HeightmapTerrainData({buffer:getImagePixels(n),width:a._heightmapWidth,height:a._heightmapHeight,childTileMask:getChildMask(a,e,t,i),structure:a._terrainDataStructure})}))},VRTheWorldTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};const rectangleScratch$3=new Rectangle;function getChildMask(e,t,i,n){const r=e._tilingScheme,o=e._rectangles,a=r.tileXYToRectangle(t,i,n);let s=0;for(let e=0;e<o.length&&15!==s;++e){const c=o[e];if(c.maxLevel<=n)continue;const l=c.rectangle;defined(Rectangle.intersection(l,a,rectangleScratch$3))&&(isTileInRectangle(r,l,2*t,2*i,n+1)&&(s|=4),isTileInRectangle(r,l,2*t+1,2*i,n+1)&&(s|=8),isTileInRectangle(r,l,2*t,2*i+1,n+1)&&(s|=1),isTileInRectangle(r,l,2*t+1,2*i+1,n+1)&&(s|=2))}return s}function isTileInRectangle(e,t,i,n,r){const o=e.tileXYToRectangle(i,n,r);return defined(Rectangle.intersection(o,t,rectangleScratch$3))}VRTheWorldTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){},VRTheWorldTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};const VulkanConstants={VK_FORMAT_UNDEFINED:0,VK_FORMAT_R4G4_UNORM_PACK8:1,VK_FORMAT_R4G4B4A4_UNORM_PACK16:2,VK_FORMAT_B4G4R4A4_UNORM_PACK16:3,VK_FORMAT_R5G6B5_UNORM_PACK16:4,VK_FORMAT_B5G6R5_UNORM_PACK16:5,VK_FORMAT_R5G5B5A1_UNORM_PACK16:6,VK_FORMAT_B5G5R5A1_UNORM_PACK16:7,VK_FORMAT_A1R5G5B5_UNORM_PACK16:8,VK_FORMAT_R8_UNORM:9,VK_FORMAT_R8_SNORM:10,VK_FORMAT_R8_USCALED:11,VK_FORMAT_R8_SSCALED:12,VK_FORMAT_R8_UINT:13,VK_FORMAT_R8_SINT:14,VK_FORMAT_R8_SRGB:15,VK_FORMAT_R8G8_UNORM:16,VK_FORMAT_R8G8_SNORM:17,VK_FORMAT_R8G8_USCALED:18,VK_FORMAT_R8G8_SSCALED:19,VK_FORMAT_R8G8_UINT:20,VK_FORMAT_R8G8_SINT:21,VK_FORMAT_R8G8_SRGB:22,VK_FORMAT_R8G8B8_UNORM:23,VK_FORMAT_R8G8B8_SNORM:24,VK_FORMAT_R8G8B8_USCALED:25,VK_FORMAT_R8G8B8_SSCALED:26,VK_FORMAT_R8G8B8_UINT:27,VK_FORMAT_R8G8B8_SINT:28,VK_FORMAT_R8G8B8_SRGB:29,VK_FORMAT_B8G8R8_UNORM:30,VK_FORMAT_B8G8R8_SNORM:31,VK_FORMAT_B8G8R8_USCALED:32,VK_FORMAT_B8G8R8_SSCALED:33,VK_FORMAT_B8G8R8_UINT:34,VK_FORMAT_B8G8R8_SINT:35,VK_FORMAT_B8G8R8_SRGB:36,VK_FORMAT_R8G8B8A8_UNORM:37,VK_FORMAT_R8G8B8A8_SNORM:38,VK_FORMAT_R8G8B8A8_USCALED:39,VK_FORMAT_R8G8B8A8_SSCALED:40,VK_FORMAT_R8G8B8A8_UINT:41,VK_FORMAT_R8G8B8A8_SINT:42,VK_FORMAT_R8G8B8A8_SRGB:43,VK_FORMAT_B8G8R8A8_UNORM:44,VK_FORMAT_B8G8R8A8_SNORM:45,VK_FORMAT_B8G8R8A8_USCALED:46,VK_FORMAT_B8G8R8A8_SSCALED:47,VK_FORMAT_B8G8R8A8_UINT:48,VK_FORMAT_B8G8R8A8_SINT:49,VK_FORMAT_B8G8R8A8_SRGB:50,VK_FORMAT_A8B8G8R8_UNORM_PACK32:51,VK_FORMAT_A8B8G8R8_SNORM_PACK32:52,VK_FORMAT_A8B8G8R8_USCALED_PACK32:53,VK_FORMAT_A8B8G8R8_SSCALED_PACK32:54,VK_FORMAT_A8B8G8R8_UINT_PACK32:55,VK_FORMAT_A8B8G8R8_SINT_PACK32:56,VK_FORMAT_A8B8G8R8_SRGB_PACK32:57,VK_FORMAT_A2R10G10B10_UNORM_PACK32:58,VK_FORMAT_A2R10G10B10_SNORM_PACK32:59,VK_FORMAT_A2R10G10B10_USCALED_PACK32:60,VK_FORMAT_A2R10G10B10_SSCALED_PACK32:61,VK_FORMAT_A2R10G10B10_UINT_PACK32:62,VK_FORMAT_A2R10G10B10_SINT_PACK32:63,VK_FORMAT_A2B10G10R10_UNORM_PACK32:64,VK_FORMAT_A2B10G10R10_SNORM_PACK32:65,VK_FORMAT_A2B10G10R10_USCALED_PACK32:66,VK_FORMAT_A2B10G10R10_SSCALED_PACK32:67,VK_FORMAT_A2B10G10R10_UINT_PACK32:68,VK_FORMAT_A2B10G10R10_SINT_PACK32:69,VK_FORMAT_R16_UNORM:70,VK_FORMAT_R16_SNORM:71,VK_FORMAT_R16_USCALED:72,VK_FORMAT_R16_SSCALED:73,VK_FORMAT_R16_UINT:74,VK_FORMAT_R16_SINT:75,VK_FORMAT_R16_SFLOAT:76,VK_FORMAT_R16G16_UNORM:77,VK_FORMAT_R16G16_SNORM:78,VK_FORMAT_R16G16_USCALED:79,VK_FORMAT_R16G16_SSCALED:80,VK_FORMAT_R16G16_UINT:81,VK_FORMAT_R16G16_SINT:82,VK_FORMAT_R16G16_SFLOAT:83,VK_FORMAT_R16G16B16_UNORM:84,VK_FORMAT_R16G16B16_SNORM:85,VK_FORMAT_R16G16B16_USCALED:86,VK_FORMAT_R16G16B16_SSCALED:87,VK_FORMAT_R16G16B16_UINT:88,VK_FORMAT_R16G16B16_SINT:89,VK_FORMAT_R16G16B16_SFLOAT:90,VK_FORMAT_R16G16B16A16_UNORM:91,VK_FORMAT_R16G16B16A16_SNORM:92,VK_FORMAT_R16G16B16A16_USCALED:93,VK_FORMAT_R16G16B16A16_SSCALED:94,VK_FORMAT_R16G16B16A16_UINT:95,VK_FORMAT_R16G16B16A16_SINT:96,VK_FORMAT_R16G16B16A16_SFLOAT:97,VK_FORMAT_R32_UINT:98,VK_FORMAT_R32_SINT:99,VK_FORMAT_R32_SFLOAT:100,VK_FORMAT_R32G32_UINT:101,VK_FORMAT_R32G32_SINT:102,VK_FORMAT_R32G32_SFLOAT:103,VK_FORMAT_R32G32B32_UINT:104,VK_FORMAT_R32G32B32_SINT:105,VK_FORMAT_R32G32B32_SFLOAT:106,VK_FORMAT_R32G32B32A32_UINT:107,VK_FORMAT_R32G32B32A32_SINT:108,VK_FORMAT_R32G32B32A32_SFLOAT:109,VK_FORMAT_R64_UINT:110,VK_FORMAT_R64_SINT:111,VK_FORMAT_R64_SFLOAT:112,VK_FORMAT_R64G64_UINT:113,VK_FORMAT_R64G64_SINT:114,VK_FORMAT_R64G64_SFLOAT:115,VK_FORMAT_R64G64B64_UINT:116,VK_FORMAT_R64G64B64_SINT:117,VK_FORMAT_R64G64B64_SFLOAT:118,VK_FORMAT_R64G64B64A64_UINT:119,VK_FORMAT_R64G64B64A64_SINT:120,VK_FORMAT_R64G64B64A64_SFLOAT:121,VK_FORMAT_B10G11R11_UFLOAT_PACK32:122,VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:123,VK_FORMAT_D16_UNORM:124,VK_FORMAT_X8_D24_UNORM_PACK32:125,VK_FORMAT_D32_SFLOAT:126,VK_FORMAT_S8_UINT:127,VK_FORMAT_D16_UNORM_S8_UINT:128,VK_FORMAT_D24_UNORM_S8_UINT:129,VK_FORMAT_D32_SFLOAT_S8_UINT:130,VK_FORMAT_BC1_RGB_UNORM_BLOCK:131,VK_FORMAT_BC1_RGB_SRGB_BLOCK:132,VK_FORMAT_BC1_RGBA_UNORM_BLOCK:133,VK_FORMAT_BC1_RGBA_SRGB_BLOCK:134,VK_FORMAT_BC2_UNORM_BLOCK:135,VK_FORMAT_BC2_SRGB_BLOCK:136,VK_FORMAT_BC3_UNORM_BLOCK:137,VK_FORMAT_BC3_SRGB_BLOCK:138,VK_FORMAT_BC4_UNORM_BLOCK:139,VK_FORMAT_BC4_SNORM_BLOCK:140,VK_FORMAT_BC5_UNORM_BLOCK:141,VK_FORMAT_BC5_SNORM_BLOCK:142,VK_FORMAT_BC6H_UFLOAT_BLOCK:143,VK_FORMAT_BC6H_SFLOAT_BLOCK:144,VK_FORMAT_BC7_UNORM_BLOCK:145,VK_FORMAT_BC7_SRGB_BLOCK:146,VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:147,VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:148,VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:149,VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:150,VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:151,VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:152,VK_FORMAT_EAC_R11_UNORM_BLOCK:153,VK_FORMAT_EAC_R11_SNORM_BLOCK:154,VK_FORMAT_EAC_R11G11_UNORM_BLOCK:155,VK_FORMAT_EAC_R11G11_SNORM_BLOCK:156,VK_FORMAT_ASTC_4x4_UNORM_BLOCK:157,VK_FORMAT_ASTC_4x4_SRGB_BLOCK:158,VK_FORMAT_ASTC_5x4_UNORM_BLOCK:159,VK_FORMAT_ASTC_5x4_SRGB_BLOCK:160,VK_FORMAT_ASTC_5x5_UNORM_BLOCK:161,VK_FORMAT_ASTC_5x5_SRGB_BLOCK:162,VK_FORMAT_ASTC_6x5_UNORM_BLOCK:163,VK_FORMAT_ASTC_6x5_SRGB_BLOCK:164,VK_FORMAT_ASTC_6x6_UNORM_BLOCK:165,VK_FORMAT_ASTC_6x6_SRGB_BLOCK:166,VK_FORMAT_ASTC_8x5_UNORM_BLOCK:167,VK_FORMAT_ASTC_8x5_SRGB_BLOCK:168,VK_FORMAT_ASTC_8x6_UNORM_BLOCK:169,VK_FORMAT_ASTC_8x6_SRGB_BLOCK:170,VK_FORMAT_ASTC_8x8_UNORM_BLOCK:171,VK_FORMAT_ASTC_8x8_SRGB_BLOCK:172,VK_FORMAT_ASTC_10x5_UNORM_BLOCK:173,VK_FORMAT_ASTC_10x5_SRGB_BLOCK:174,VK_FORMAT_ASTC_10x6_UNORM_BLOCK:175,VK_FORMAT_ASTC_10x6_SRGB_BLOCK:176,VK_FORMAT_ASTC_10x8_UNORM_BLOCK:177,VK_FORMAT_ASTC_10x8_SRGB_BLOCK:178,VK_FORMAT_ASTC_10x10_UNORM_BLOCK:179,VK_FORMAT_ASTC_10x10_SRGB_BLOCK:180,VK_FORMAT_ASTC_12x10_UNORM_BLOCK:181,VK_FORMAT_ASTC_12x10_SRGB_BLOCK:182,VK_FORMAT_ASTC_12x12_UNORM_BLOCK:183,VK_FORMAT_ASTC_12x12_SRGB_BLOCK:184,VK_FORMAT_G8B8G8R8_422_UNORM:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:1000156006,VK_FORMAT_R10X6_UNORM_PACK16:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:1000156016,VK_FORMAT_R12X4_UNORM_PACK16:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:1000156033,VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:1000054e3,VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:1000054001,VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:1000054002,VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:1000054003,VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:1000054004,VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:1000054005,VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:1000054006,VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:1000054007,VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:1000066e3,VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:1000066001,VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:1000066002,VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:1000066003,VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:1000066004,VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:1000066005,VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:1000066006,VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:1000066007,VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:1000066008,VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:1000066009,VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:1000066010,VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:1000066011,VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:1000066012,VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:1000066013,VK_FORMAT_G8B8G8R8_422_UNORM_KHR:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM_KHR:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:1000156006,VK_FORMAT_R10X6_UNORM_PACK16_KHR:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:1000156016,VK_FORMAT_R12X4_UNORM_PACK16_KHR:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM_KHR:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM_KHR:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:1000156033};var VulkanConstants$1=Object.freeze(VulkanConstants);const WallGeometryLibrary={};function latLonEquals(e,t){return CesiumMath.equalsEpsilon(e.latitude,t.latitude,CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(e.longitude,t.longitude,CesiumMath.EPSILON10)}const scratchCartographic1=new Cartographic,scratchCartographic2=new Cartographic;function removeDuplicates$1(e,t,i,n){const r=(t=arrayRemoveDuplicates(t,Cartesian3.equalsEpsilon)).length;if(r<2)return;const o=defined(n),a=defined(i),s=new Array(r),c=new Array(r),l=new Array(r),u=t[0];s[0]=u;const d=e.cartesianToCartographic(u,scratchCartographic1);a&&(d.height=i[0]),c[0]=d.height,l[0]=o?n[0]:0;let h=c[0]===l[0],p=1;for(let u=1;u<r;++u){const r=t[u],f=e.cartesianToCartographic(r,scratchCartographic2);a&&(f.height=i[u]),h=h&&0===f.height,latLonEquals(d,f)?d.height<f.height&&(c[p-1]=f.height):(s[p]=r,c[p]=f.height,l[p]=o?n[u]:0,h=h&&c[p]===l[p],Cartographic.clone(f,d),++p)}return h||p<2?void 0:(s.length=p,c.length=p,l.length=p,{positions:s,topHeights:c,bottomHeights:l})}const positionsArrayScratch=new Array(2),heightsArrayScratch=new Array(2),generateArcOptionsScratch={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};WallGeometryLibrary.computePositions=function(e,t,i,n,r,o){const a=removeDuplicates$1(e,t,i,n);if(!defined(a))return;t=a.positions,i=a.topHeights,n=a.bottomHeights;const s=t.length,c=s-2;let l,u;const d=CesiumMath.chordLength(r,e.maximumRadius),h=generateArcOptionsScratch;if(h.minDistance=d,h.ellipsoid=e,o){let e,r=0;for(e=0;e<s-1;e++)r+=PolylinePipeline.numberOfPoints(t[e],t[e+1],d)+1;l=new Float64Array(3*r),u=new Float64Array(3*r);const o=positionsArrayScratch,a=heightsArrayScratch;h.positions=o,h.height=a;let c=0;for(e=0;e<s-1;e++){o[0]=t[e],o[1]=t[e+1],a[0]=i[e],a[1]=i[e+1];const r=PolylinePipeline.generateArc(h);l.set(r,c),a[0]=n[e],a[1]=n[e+1],u.set(PolylinePipeline.generateArc(h),c),c+=r.length}}else h.positions=t,h.height=i,l=new Float64Array(PolylinePipeline.generateArc(h)),h.height=n,u=new Float64Array(PolylinePipeline.generateArc(h));return{bottomPositions:u,topPositions:l,numCorners:c}};const scratchCartesian3Position1$1=new Cartesian3,scratchCartesian3Position2$1=new Cartesian3,scratchCartesian3Position4=new Cartesian3,scratchCartesian3Position5=new Cartesian3,scratchBitangent=new Cartesian3,scratchTangent=new Cartesian3,scratchNormal$1=new Cartesian3;function WallGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.maximumHeights,n=e.minimumHeights,r=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),o=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=n,this._maximumHeights=i,this._vertexFormat=VertexFormat.clone(r),this._granularity=o,this._ellipsoid=Ellipsoid.clone(a),this._workerName="createWallGeometry";let s=1+t.length*Cartesian3.packedLength+2;defined(n)&&(s+=n.length),defined(i)&&(s+=i.length),this.packedLength=s+Ellipsoid.packedLength+VertexFormat.packedLength+1}WallGeometry.pack=function(e,t,i){let n;i=defaultValue(i,0);const r=e._positions;let o=r.length;for(t[i++]=o,n=0;n<o;++n,i+=Cartesian3.packedLength)Cartesian3.pack(r[n],t,i);const a=e._minimumHeights;if(o=defined(a)?a.length:0,t[i++]=o,defined(a))for(n=0;n<o;++n)t[i++]=a[n];const s=e._maximumHeights;if(o=defined(s)?s.length:0,t[i++]=o,defined(s))for(n=0;n<o;++n)t[i++]=s[n];return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),t[i+=VertexFormat.packedLength]=e._granularity,t};const scratchEllipsoid$2=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat=new VertexFormat,scratchOptions$1={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$2,vertexFormat:scratchVertexFormat,granularity:void 0};WallGeometry.unpack=function(e,t,i){let n;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(n=0;n<r;++n,t+=Cartesian3.packedLength)o[n]=Cartesian3.unpack(e,t);let a,s;if(r=e[t++],r>0)for(a=new Array(r),n=0;n<r;++n)a[n]=e[t++];if(r=e[t++],r>0)for(s=new Array(r),n=0;n<r;++n)s[n]=e[t++];const c=Ellipsoid.unpack(e,t,scratchEllipsoid$2);t+=Ellipsoid.packedLength;const l=VertexFormat.unpack(e,t,scratchVertexFormat),u=e[t+=VertexFormat.packedLength];return defined(i)?(i._positions=o,i._minimumHeights=a,i._maximumHeights=s,i._ellipsoid=Ellipsoid.clone(c,i._ellipsoid),i._vertexFormat=VertexFormat.clone(l,i._vertexFormat),i._granularity=u,i):(scratchOptions$1.positions=o,scratchOptions$1.minimumHeights=a,scratchOptions$1.maximumHeights=s,scratchOptions$1.granularity=u,new WallGeometry(scratchOptions$1))},WallGeometry.fromConstantHeights=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;let i,n;const r=e.minimumHeight,o=e.maximumHeight,a=defined(r),s=defined(o);if(a||s){const e=t.length;i=a?new Array(e):void 0,n=s?new Array(e):void 0;for(let t=0;t<e;++t)a&&(i[t]=r),s&&(n[t]=o)}return new WallGeometry({positions:t,maximumHeights:n,minimumHeights:i,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat})},WallGeometry.createGeometry=function(e){const t=e._positions,i=e._minimumHeights,n=e._maximumHeights,r=e._vertexFormat,o=e._granularity,a=e._ellipsoid,s=WallGeometryLibrary.computePositions(a,t,n,i,o,!0);if(!defined(s))return;const c=s.bottomPositions,l=s.topPositions,u=s.numCorners;let d=l.length,h=2*d;const p=r.position?new Float64Array(h):void 0,f=r.normal?new Float32Array(h):void 0,m=r.tangent?new Float32Array(h):void 0,g=r.bitangent?new Float32Array(h):void 0,_=r.st?new Float32Array(h/3*2):void 0;let y,C=0,T=0,S=0,v=0,A=0,E=scratchNormal$1,b=scratchTangent,x=scratchBitangent,P=!0;d/=3;let D=0;const w=1/(d-u-1);for(y=0;y<d;++y){const e=3*y,t=Cartesian3.fromArray(l,e,scratchCartesian3Position1$1),i=Cartesian3.fromArray(c,e,scratchCartesian3Position2$1);if(r.position&&(p[C++]=i.x,p[C++]=i.y,p[C++]=i.z,p[C++]=t.x,p[C++]=t.y,p[C++]=t.z),r.st&&(_[A++]=D,_[A++]=0,_[A++]=D,_[A++]=1),r.normal||r.tangent||r.bitangent){let i=Cartesian3.clone(Cartesian3.ZERO,scratchCartesian3Position5);const n=Cartesian3.subtract(t,a.geodeticSurfaceNormal(t,scratchCartesian3Position2$1),scratchCartesian3Position2$1);if(y+1<d&&(i=Cartesian3.fromArray(l,e+3,scratchCartesian3Position5)),P){const e=Cartesian3.subtract(i,t,scratchCartesian3Position4),r=Cartesian3.subtract(n,t,scratchCartesian3Position1$1);E=Cartesian3.normalize(Cartesian3.cross(r,e,E),E),P=!1}Cartesian3.equalsEpsilon(t,i,CesiumMath.EPSILON10)?P=!0:(D+=w,r.tangent&&(b=Cartesian3.normalize(Cartesian3.subtract(i,t,b),b)),r.bitangent&&(x=Cartesian3.normalize(Cartesian3.cross(E,b,x),x))),r.normal&&(f[T++]=E.x,f[T++]=E.y,f[T++]=E.z,f[T++]=E.x,f[T++]=E.y,f[T++]=E.z),r.tangent&&(m[v++]=b.x,m[v++]=b.y,m[v++]=b.z,m[v++]=b.x,m[v++]=b.y,m[v++]=b.z),r.bitangent&&(g[S++]=x.x,g[S++]=x.y,g[S++]=x.z,g[S++]=x.x,g[S++]=x.y,g[S++]=x.z)}}const M=new GeometryAttributes;r.position&&(M.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:p})),r.normal&&(M.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),r.tangent&&(M.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),r.bitangent&&(M.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:g})),r.st&&(M.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:_}));const I=h/3;h-=6*(u+1);const R=IndexDatatype$1.createTypedArray(I,h);let O=0;for(y=0;y<I-2;y+=2){const e=y,t=y+2,i=Cartesian3.fromArray(p,3*e,scratchCartesian3Position1$1),n=Cartesian3.fromArray(p,3*t,scratchCartesian3Position2$1);if(Cartesian3.equalsEpsilon(i,n,CesiumMath.EPSILON10))continue;const r=y+1,o=y+3;R[O++]=r,R[O++]=e,R[O++]=o,R[O++]=o,R[O++]=e,R[O++]=t}return new Geometry({attributes:M,indices:R,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere.fromVertices(p)})};const scratchCartesian3Position1=new Cartesian3,scratchCartesian3Position2=new Cartesian3;function WallOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.maximumHeights,n=e.minimumHeights,r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=n,this._maximumHeights=i,this._granularity=r,this._ellipsoid=Ellipsoid.clone(o),this._workerName="createWallOutlineGeometry";let a=1+t.length*Cartesian3.packedLength+2;defined(n)&&(a+=n.length),defined(i)&&(a+=i.length),this.packedLength=a+Ellipsoid.packedLength+1}WallOutlineGeometry.pack=function(e,t,i){let n;i=defaultValue(i,0);const r=e._positions;let o=r.length;for(t[i++]=o,n=0;n<o;++n,i+=Cartesian3.packedLength)Cartesian3.pack(r[n],t,i);const a=e._minimumHeights;if(o=defined(a)?a.length:0,t[i++]=o,defined(a))for(n=0;n<o;++n)t[i++]=a[n];const s=e._maximumHeights;if(o=defined(s)?s.length:0,t[i++]=o,defined(s))for(n=0;n<o;++n)t[i++]=s[n];return Ellipsoid.pack(e._ellipsoid,t,i),t[i+=Ellipsoid.packedLength]=e._granularity,t};const scratchEllipsoid$1=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$1,granularity:void 0};function webGLConstantToGlslType(e){switch(e){case WebGLConstants$1.FLOAT:return"float";case WebGLConstants$1.FLOAT_VEC2:return"vec2";case WebGLConstants$1.FLOAT_VEC3:return"vec3";case WebGLConstants$1.FLOAT_VEC4:return"vec4";case WebGLConstants$1.FLOAT_MAT2:return"mat2";case WebGLConstants$1.FLOAT_MAT3:return"mat3";case WebGLConstants$1.FLOAT_MAT4:return"mat4";case WebGLConstants$1.SAMPLER_2D:return"sampler2D";case WebGLConstants$1.BOOL:return"bool"}}function WeightSpline(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).weights,i=e.times;this._times=i,this._weights=t,this._count=t.length/i.length,this._lastTimeIndex=0}function wrapFunction(e,t,i){return function(){i.apply(e,arguments),t.apply(e,arguments)}}function ConstantProperty(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Event,this.setValue(e)}function createProperty(e,t,i,n,r){return{configurable:n,get:function(){return this[t]},set:function(n){const o=this[t],a=this[i];defined(a)&&(a(),this[i]=void 0);!(void 0!==n)||defined(n)&&defined(n.getValue)||!defined(r)||(n=r(n)),o!==n&&(this[t]=n,this._definitionChanged.raiseEvent(this,e,n,o)),defined(n)&&defined(n.definitionChanged)&&(this[i]=n.definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this,e,n,n)}),this))}}}function createConstantProperty$1(e){return new ConstantProperty(e)}function createPropertyDescriptor(e,t,i){return createProperty(e,`_${e.toString()}`,`_${e.toString()}Subscription`,defaultValue(t,!1),defaultValue(i,createConstantProperty$1))}function BillboardGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._image=void 0,this._imageSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._sizeInMeters=void 0,this._sizeInMetersSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}WallOutlineGeometry.unpack=function(e,t,i){let n;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(n=0;n<r;++n,t+=Cartesian3.packedLength)o[n]=Cartesian3.unpack(e,t);let a,s;if(r=e[t++],r>0)for(a=new Array(r),n=0;n<r;++n)a[n]=e[t++];if(r=e[t++],r>0)for(s=new Array(r),n=0;n<r;++n)s[n]=e[t++];const c=Ellipsoid.unpack(e,t,scratchEllipsoid$1),l=e[t+=Ellipsoid.packedLength];return defined(i)?(i._positions=o,i._minimumHeights=a,i._maximumHeights=s,i._ellipsoid=Ellipsoid.clone(c,i._ellipsoid),i._granularity=l,i):(scratchOptions.positions=o,scratchOptions.minimumHeights=a,scratchOptions.maximumHeights=s,scratchOptions.granularity=l,new WallOutlineGeometry(scratchOptions))},WallOutlineGeometry.fromConstantHeights=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;let i,n;const r=e.minimumHeight,o=e.maximumHeight,a=defined(r),s=defined(o);if(a||s){const e=t.length;i=a?new Array(e):void 0,n=s?new Array(e):void 0;for(let t=0;t<e;++t)a&&(i[t]=r),s&&(n[t]=o)}return new WallOutlineGeometry({positions:t,maximumHeights:n,minimumHeights:i,ellipsoid:e.ellipsoid})},WallOutlineGeometry.createGeometry=function(e){const t=e._positions,i=e._minimumHeights,n=e._maximumHeights,r=e._granularity,o=e._ellipsoid,a=WallGeometryLibrary.computePositions(o,t,n,i,r,!1);if(!defined(a))return;const s=a.bottomPositions,c=a.topPositions;let l=c.length,u=2*l;const d=new Float64Array(u);let h,p=0;for(l/=3,h=0;h<l;++h){const e=3*h,t=Cartesian3.fromArray(c,e,scratchCartesian3Position1),i=Cartesian3.fromArray(s,e,scratchCartesian3Position2);d[p++]=i.x,d[p++]=i.y,d[p++]=i.z,d[p++]=t.x,d[p++]=t.y,d[p++]=t.z}const f=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d})}),m=u/3;u=2*m-4+m;const g=IndexDatatype$1.createTypedArray(m,u);let _=0;for(h=0;h<m-2;h+=2){const e=h,t=h+2,i=Cartesian3.fromArray(d,3*e,scratchCartesian3Position1),n=Cartesian3.fromArray(d,3*t,scratchCartesian3Position2);if(Cartesian3.equalsEpsilon(i,n,CesiumMath.EPSILON10))continue;const r=h+1,o=h+3;g[_++]=r,g[_++]=e,g[_++]=r,g[_++]=o,g[_++]=e,g[_++]=t}return g[_++]=m-2,g[_++]=m-1,new Geometry({attributes:f,indices:g,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere.fromVertices(d)})},Object.defineProperties(WeightSpline.prototype,{times:{get:function(){return this._times}},weights:{get:function(){return this._weights}}}),WeightSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,WeightSpline.prototype.wrapTime=Spline.prototype.wrapTime,WeightSpline.prototype.clampTime=Spline.prototype.clampTime,WeightSpline.prototype.evaluate=function(e,t){const i=this.weights,n=this.times,r=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),o=(e-n[r])/(n[r+1]-n[r]);defined(t)||(t=new Array(this._count));for(let e=0;e<this._count;e++){const n=r*this._count+e;t[e]=i[n]*(1-o)+i[n+this._count]*o}return t},Object.defineProperties(ConstantProperty.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}}),ConstantProperty.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value},ConstantProperty.prototype.setValue=function(e){const t=this._value;if(t!==e){const i=defined(e),n=i&&"function"==typeof e.clone,r=i&&"function"==typeof e.equals;(!r||!e.equals(t))&&(this._hasClone=n,this._hasEquals=r,this._value=n?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}},ConstantProperty.prototype.equals=function(e){return this===e||e instanceof ConstantProperty&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))},ConstantProperty.prototype.valueOf=function(){return this._value},ConstantProperty.prototype.toString=function(){return String(this._value)},Object.defineProperties(BillboardGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),image:createPropertyDescriptor("image"),scale:createPropertyDescriptor("scale"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),rotation:createPropertyDescriptor("rotation"),alignedAxis:createPropertyDescriptor("alignedAxis"),sizeInMeters:createPropertyDescriptor("sizeInMeters"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),imageSubRegion:createPropertyDescriptor("imageSubRegion"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),BillboardGraphics.prototype.clone=function(e){return defined(e)?(e.show=this._show,e.image=this._image,e.scale=this._scale,e.pixelOffset=this._pixelOffset,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.verticalOrigin=this._verticalOrigin,e.heightReference=this._heightReference,e.color=this._color,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.sizeInMeters=this._sizeInMeters,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e.imageSubRegion=this._imageSubRegion,e.distanceDisplayCondition=this._distanceDisplayCondition,e.disableDepthTestDistance=this._disableDepthTestDistance,e):new BillboardGraphics(this)},BillboardGraphics.prototype.merge=function(e){this.show=defaultValue(this._show,e.show),this.image=defaultValue(this._image,e.image),this.scale=defaultValue(this._scale,e.scale),this.pixelOffset=defaultValue(this._pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this._verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this._heightReference,e.heightReference),this.color=defaultValue(this._color,e.color),this.rotation=defaultValue(this._rotation,e.rotation),this.alignedAxis=defaultValue(this._alignedAxis,e.alignedAxis),this.sizeInMeters=defaultValue(this._sizeInMeters,e.sizeInMeters),this.width=defaultValue(this._width,e.width),this.height=defaultValue(this._height,e.height),this.scaleByDistance=defaultValue(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=defaultValue(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=defaultValue(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this._disableDepthTestDistance,e.disableDepthTestDistance)};const HeightReference={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2};var HeightReference$1=Object.freeze(HeightReference);const HorizontalOrigin={CENTER:0,LEFT:1,RIGHT:-1};var HorizontalOrigin$1=Object.freeze(HorizontalOrigin);const VerticalOrigin={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1};var VerticalOrigin$1=Object.freeze(VerticalOrigin);const BoundingSphereState={DONE:0,PENDING:1,FAILED:2};var BoundingSphereState$1=Object.freeze(BoundingSphereState);function Property(){DeveloperError.throwInstantiationError()}Object.defineProperties(Property.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),Property.prototype.getValue=DeveloperError.throwInstantiationError,Property.prototype.equals=DeveloperError.throwInstantiationError,Property.equals=function(e,t){return e===t||defined(e)&&e.equals(t)},Property.arrayEquals=function(e,t){if(e===t)return!0;if(!defined(e)||!defined(t)||e.length!==t.length)return!1;const i=e.length;for(let n=0;n<i;n++)if(!Property.equals(e[n],t[n]))return!1;return!0},Property.isConstant=function(e){return!defined(e)||e.isConstant},Property.getValueOrUndefined=function(e,t,i){return defined(e)?e.getValue(t,i):void 0},Property.getValueOrDefault=function(e,t,i,n){return defined(e)?defaultValue(e.getValue(t,n),i):i},Property.getValueOrClonedDefault=function(e,t,i,n){let r;return defined(e)&&(r=e.getValue(t,n)),defined(r)||(r=i.clone(r)),r};const defaultColor$8=Color.WHITE,defaultEyeOffset$1=Cartesian3.ZERO,defaultHeightReference$2=HeightReference$1.NONE,defaultPixelOffset$1=Cartesian2.ZERO,defaultScale$3=1,defaultRotation=0,defaultAlignedAxis=Cartesian3.ZERO,defaultHorizontalOrigin$1=HorizontalOrigin$1.CENTER,defaultVerticalOrigin$1=VerticalOrigin$1.CENTER,defaultSizeInMeters=!1,positionScratch$8=new Cartesian3,colorScratch$6=new Color,eyeOffsetScratch$1=new Cartesian3,pixelOffsetScratch$1=new Cartesian2,scaleByDistanceScratch$2=new NearFarScalar,translucencyByDistanceScratch$2=new NearFarScalar,pixelOffsetScaleByDistanceScratch$1=new NearFarScalar,boundingRectangleScratch=new BoundingRectangle,distanceDisplayConditionScratch$8=new DistanceDisplayCondition;function EntityData$3(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function BillboardVisualizer(e,t){t.collectionChanged.addEventListener(BillboardVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$2(e,t,i){defined(e)&&(e.billboard=void 0,i.removeBillboard(t))}BillboardVisualizer.prototype.update=function(e){const t=this._items.values,i=this._cluster;for(let n=0,r=t.length;n<r;n++){const r=t[n],o=r.entity,a=o._billboard;let s,c,l=r.billboard,u=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(u&&(c=Property.getValueOrUndefined(o._position,e,positionScratch$8),s=Property.getValueOrUndefined(a._image,e),u=defined(c)&&defined(s)),!u){returnPrimitive$2(r,o,i);continue}Property.isConstant(o._position)||(i._clusterDirty=!0),defined(l)||(l=i.getBillboard(o),l.id=o,l.image=void 0,r.billboard=l),l.show=u,defined(l.image)&&r.textureValue===s||(l.image=s,r.textureValue=s),l.position=c,l.color=Property.getValueOrDefault(a._color,e,defaultColor$8,colorScratch$6),l.eyeOffset=Property.getValueOrDefault(a._eyeOffset,e,defaultEyeOffset$1,eyeOffsetScratch$1),l.heightReference=Property.getValueOrDefault(a._heightReference,e,defaultHeightReference$2),l.pixelOffset=Property.getValueOrDefault(a._pixelOffset,e,defaultPixelOffset$1,pixelOffsetScratch$1),l.scale=Property.getValueOrDefault(a._scale,e,defaultScale$3),l.rotation=Property.getValueOrDefault(a._rotation,e,defaultRotation),l.alignedAxis=Property.getValueOrDefault(a._alignedAxis,e,defaultAlignedAxis),l.horizontalOrigin=Property.getValueOrDefault(a._horizontalOrigin,e,defaultHorizontalOrigin$1),l.verticalOrigin=Property.getValueOrDefault(a._verticalOrigin,e,defaultVerticalOrigin$1),l.width=Property.getValueOrUndefined(a._width,e),l.height=Property.getValueOrUndefined(a._height,e),l.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch$2),l.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch$2),l.pixelOffsetScaleByDistance=Property.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch$1),l.sizeInMeters=Property.getValueOrDefault(a._sizeInMeters,e,defaultSizeInMeters),l.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$8),l.disableDepthTestDistance=Property.getValueOrUndefined(a._disableDepthTestDistance,e);const d=Property.getValueOrUndefined(a._imageSubRegion,e,boundingRectangleScratch);defined(d)&&l.setImageSubRegion(l._imageId,d)}return!0},BillboardVisualizer.prototype.getBoundingSphere=function(e,t){const i=this._items.get(e.id);if(!defined(i)||!defined(i.billboard))return BoundingSphereState$1.FAILED;const n=i.billboard;if(n.heightReference===HeightReference$1.NONE)t.center=Cartesian3.clone(n.position,t.center);else{if(!defined(n._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(n._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},BillboardVisualizer.prototype.isDestroyed=function(){return!1},BillboardVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(BillboardVisualizer.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return destroyObject(this)},BillboardVisualizer.prototype._onCollectionChanged=function(e,t,i,n){let r,o;const a=this._items,s=this._cluster;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._billboard)&&defined(o._position)&&a.set(o.id,new EntityData$3(o));for(r=n.length-1;r>-1;r--)o=n[r],defined(o._billboard)&&defined(o._position)?a.contains(o.id)||a.set(o.id,new EntityData$3(o)):(returnPrimitive$2(a.get(o.id),o,s),a.remove(o.id));for(r=i.length-1;r>-1;r--)o=i[r],returnPrimitive$2(a.get(o.id),o,s),a.remove(o.id)};var AllMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nmat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = tangentToEyeMatrix;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",AllMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec3 tangent;\nattribute vec3 bitangent;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_tangentEC = czm_normal * tangent;\nv_bitangentEC = czm_normal * bitangent;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",BasicMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",BasicMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",TexturedMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",TexturedMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";const BlendEquation={ADD:WebGLConstants$1.FUNC_ADD,SUBTRACT:WebGLConstants$1.FUNC_SUBTRACT,REVERSE_SUBTRACT:WebGLConstants$1.FUNC_REVERSE_SUBTRACT,MIN:WebGLConstants$1.MIN,MAX:WebGLConstants$1.MAX};var BlendEquation$1=Object.freeze(BlendEquation);const BlendFunction={ZERO:WebGLConstants$1.ZERO,ONE:WebGLConstants$1.ONE,SOURCE_COLOR:WebGLConstants$1.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:WebGLConstants$1.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:WebGLConstants$1.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:WebGLConstants$1.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:WebGLConstants$1.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:WebGLConstants$1.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:WebGLConstants$1.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:WebGLConstants$1.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:WebGLConstants$1.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:WebGLConstants$1.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:WebGLConstants$1.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:WebGLConstants$1.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:WebGLConstants$1.SRC_ALPHA_SATURATE};var BlendFunction$1=Object.freeze(BlendFunction);const BlendingState={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE})};var BlendingState$1=Object.freeze(BlendingState);const CullFace={FRONT:WebGLConstants$1.FRONT,BACK:WebGLConstants$1.BACK,FRONT_AND_BACK:WebGLConstants$1.FRONT_AND_BACK};var CullFace$1=Object.freeze(CullFace);function Appearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.material=e.material,this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=defaultValue(e.closed,!1)}function CubeMapFace(e,t,i,n,r,o,a,s,c,l,u){this._context=e,this._texture=t,this._textureTarget=i,this._targetFace=n,this._pixelDatatype=a,this._internalFormat=r,this._pixelFormat=o,this._size=s,this._preMultiplyAlpha=c,this._flipY=l,this._initialized=u}function CubeMap(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,i=e.source;let n;if(defined(i)){const e=[i.positiveX,i.negativeX,i.positiveY,i.negativeY,i.positiveZ,i.negativeZ];n=e[0].width}else n=e.width;const r=n,o=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),a=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),s=PixelFormat$1.toInternalFormat(a,o,t),c=6*PixelFormat$1.textureSizeInBytes(a,o,r,r),l=e.preMultiplyAlpha||a===PixelFormat$1.RGB||a===PixelFormat$1.LUMINANCE,u=defaultValue(e.flipY,!0),d=defaultValue(e.skipColorSpaceConversion,!1),h=t._gl,p=h.TEXTURE_CUBE_MAP,f=h.createTexture();function m(e,i,c,l,u){let d=i.arrayBufferView;defined(d)||(d=i.bufferView);let p=4;defined(d)&&(p=PixelFormat$1.alignmentInBytes(a,o,n)),h.pixelStorei(h.UNPACK_ALIGNMENT,p),u?h.pixelStorei(h.UNPACK_COLORSPACE_CONVERSION_WEBGL,h.NONE):h.pixelStorei(h.UNPACK_COLORSPACE_CONVERSION_WEBGL,h.BROWSER_DEFAULT_WEBGL),defined(d)?(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,!1),l&&(d=PixelFormat$1.flipY(d,a,o,r,r)),h.texImage2D(e,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),d)):(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,c),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,l),h.texImage2D(e,0,s,a,PixelDatatype$1.toWebGLConstant(o,t),i))}h.activeTexture(h.TEXTURE0),h.bindTexture(p,f),defined(i)?(m(h.TEXTURE_CUBE_MAP_POSITIVE_X,i.positiveX,l,u,d),m(h.TEXTURE_CUBE_MAP_NEGATIVE_X,i.negativeX,l,u,d),m(h.TEXTURE_CUBE_MAP_POSITIVE_Y,i.positiveY,l,u,d),m(h.TEXTURE_CUBE_MAP_NEGATIVE_Y,i.negativeY,l,u,d),m(h.TEXTURE_CUBE_MAP_POSITIVE_Z,i.positiveZ,l,u,d),m(h.TEXTURE_CUBE_MAP_NEGATIVE_Z,i.negativeZ,l,u,d)):(h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_NEGATIVE_X,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_Y,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_Z,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null)),h.bindTexture(p,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=p,this._texture=f,this._pixelFormat=a,this._pixelDatatype=o,this._size=r,this._hasMipmap=!1,this._sizeInBytes=c,this._preMultiplyAlpha=l,this._flipY=u,this._sampler=void 0;const g=defined(i);this._positiveX=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_POSITIVE_X,s,a,o,r,l,u,g),this._negativeX=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_NEGATIVE_X,s,a,o,r,l,u,g),this._positiveY=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_POSITIVE_Y,s,a,o,r,l,u,g),this._negativeY=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_NEGATIVE_Y,s,a,o,r,l,u,g),this._positiveZ=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_POSITIVE_Z,s,a,o,r,l,u,g),this._negativeZ=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_NEGATIVE_Z,s,a,o,r,l,u,g),this.sampler=defined(e.sampler)?e.sampler:new Sampler}Object.defineProperties(Appearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}}),Appearance.prototype.getFragmentShaderSource=function(){const e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),defined(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join("\n")},Appearance.prototype.isTranslucent=function(){return defined(this.material)&&this.material.isTranslucent()||!defined(this.material)&&this.translucent},Appearance.prototype.getRenderState=function(){const e=this.isTranslucent(),t=clone$1(this.renderState,!1);return e?(t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND):t.depthMask=!0,t},Appearance.getDefaultRenderState=function(e,t,i){let n={depthTest:{enabled:!0}};return e&&(n.depthMask=!1,n.blending=BlendingState$1.ALPHA_BLEND),t&&(n.cull={enabled:!0,face:CullFace$1.BACK}),defined(i)&&(n=combine$2(i,n,!0)),n},Object.defineProperties(CubeMapFace.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}}),CubeMapFace.prototype.copyFrom=function(e){const t=defaultValue(e.xOffset,0),i=defaultValue(e.yOffset,0),n=e.source,r=this._context._gl,o=this._textureTarget,a=this._targetFace;r.activeTexture(r.TEXTURE0),r.bindTexture(o,this._texture);const s=n.width,c=n.height;let l=n.arrayBufferView;const u=this._size,d=this._pixelFormat,h=this._internalFormat,p=this._pixelDatatype,f=this._preMultiplyAlpha,m=this._flipY,g=defaultValue(e.skipColorSpaceConversion,!1);let _=4;defined(l)&&(_=PixelFormat$1.alignmentInBytes(d,p,s)),r.pixelStorei(r.UNPACK_ALIGNMENT,_),g?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let y=!1;if(!this._initialized){if(0===t&&0===i&&s===u&&c===u)defined(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),m&&(l=PixelFormat$1.flipY(l,d,p,u,u)),r.texImage2D(a,0,h,u,u,0,d,PixelDatatype$1.toWebGLConstant(p,this._context),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,m),r.texImage2D(a,0,h,d,PixelDatatype$1.toWebGLConstant(p,this._context),n)),y=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const e=PixelFormat$1.createTypedArray(d,p,u,u);r.texImage2D(a,0,h,u,u,0,d,PixelDatatype$1.toWebGLConstant(p,this._context),e)}this._initialized=!0}y||(defined(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),m&&(l=PixelFormat$1.flipY(l,d,p,s,c)),r.texSubImage2D(a,0,t,i,s,c,d,PixelDatatype$1.toWebGLConstant(p,this._context),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,m),r.texSubImage2D(a,0,t,i,d,PixelDatatype$1.toWebGLConstant(p,this._context),n))),r.bindTexture(o,null)},CubeMapFace.prototype.copyFromFramebuffer=function(e,t,i,n,r,o){e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,0),n=defaultValue(n,0),r=defaultValue(r,this._size),o=defaultValue(o,this._size);const a=this._context._gl,s=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(s,this._texture),a.copyTexSubImage2D(this._targetFace,0,e,t,i,n,r,o),a.bindTexture(s,null),this._initialized=!0},Object.defineProperties(CubeMap.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,i=e.magnificationFilter;const n=t===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||t===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||t===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||t===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,r=this._context,o=this._pixelDatatype;(o===PixelDatatype$1.FLOAT&&!r.textureFloatLinear||o===PixelDatatype$1.HALF_FLOAT&&!r.textureHalfFloatLinear)&&(t=n?TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST:TextureMinificationFilter$1.NEAREST,i=TextureMagnificationFilter$1.NEAREST);const a=r._gl,s=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(s,this._texture),a.texParameteri(s,a.TEXTURE_MIN_FILTER,t),a.texParameteri(s,a.TEXTURE_MAG_FILTER,i),a.texParameteri(s,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(s,a.TEXTURE_WRAP_T,e.wrapT),defined(this._textureFilterAnisotropic)&&a.texParameteri(s,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(s,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(4*this._sizeInBytes/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}}),CubeMap.prototype.generateMipmap=function(e){e=defaultValue(e,MipmapHint$1.DONT_CARE),this._hasMipmap=!0;const t=this._context._gl,i=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(i,this._texture),t.generateMipmap(i),t.bindTexture(i,null)},CubeMap.prototype.isDestroyed=function(){return!1},CubeMap.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=destroyObject(this._positiveX),this._negativeX=destroyObject(this._negativeX),this._positiveY=destroyObject(this._positiveY),this._negativeY=destroyObject(this._negativeY),this._positiveZ=destroyObject(this._positiveZ),this._negativeZ=destroyObject(this._negativeZ),destroyObject(this)};var AspectRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",BumpMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 centerPixel = fract(repeat * st);\nfloat centerBump = texture2D(image, centerPixel).channel;\nfloat imageWidth = float(imageDimensions.x);\nvec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\nfloat rightBump = texture2D(image, rightPixel).channel;\nfloat imageHeight = float(imageDimensions.y);\nvec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\nfloat topBump = texture2D(image, leftPixel).channel;\nvec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nmaterial.diffuse = vec3(0.01);\nreturn material;\n}\n",CheckerboardMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\nfloat scaledWidth = fract(repeat.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(repeat.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value = min(scaledWidth, scaledHeight);\nvec4 currentColor = mix(lightColor, darkColor, b);\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",DotMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));\nvec4 color = mix(lightColor, darkColor, b);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",ElevationBandMaterial="uniform sampler2D heights;\nuniform sampler2D colors;\nfloat getHeight(int idx, float invTexSize)\n{\nvec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);\n#ifdef OES_texture_float\nreturn texture2D(heights, uv).x;\n#else\nreturn czm_unpackFloat(texture2D(heights, uv));\n#endif\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat height = materialInput.height;\nfloat invTexSize = 1.0 / float(heightsDimensions.x);\nfloat minHeight = getHeight(0, invTexSize);\nfloat maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);\nif (height < minHeight || height > maxHeight) {\nmaterial.diffuse = vec3(0.0);\nmaterial.alpha = 0.0;\nreturn material;\n}\nint idxBelow = 0;\nint idxAbove = heightsDimensions.x;\nfloat heightBelow = minHeight;\nfloat heightAbove = maxHeight;\nconst int maxIterations = 16;\nfor (int i = 0; i < maxIterations; i++) {\nif (idxBelow >= idxAbove - 1) {\nbreak;\n}\nint idxMid = (idxBelow + idxAbove) / 2;\nfloat heightTex = getHeight(idxMid, invTexSize);\nif (height > heightTex) {\nidxBelow = idxMid;\nheightBelow = heightTex;\n} else {\nidxAbove = idxMid;\nheightAbove = heightTex;\n}\n}\nfloat lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);\nvec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);\nvec4 color = texture2D(colors, colorUv);\nif (color.a > 0.0)\n{\ncolor.rgb /= color.a;\n}\ncolor.rgb = czm_gammaCorrect(color.rgb);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",ElevationContourMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float spacing;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat distanceToContour = mod(materialInput.height, spacing);\n#ifdef GL_OES_standard_derivatives\nfloat dxc = abs(dFdx(materialInput.height));\nfloat dyc = abs(dFdy(materialInput.height));\nfloat dF = max(dxc, dyc) * czm_pixelRatio * width;\nfloat alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n#else\nfloat alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n#endif\nvec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",ElevationRampMaterial="uniform sampler2D image;\nuniform float minimumHeight;\nuniform float maximumHeight;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);\nvec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",FadeMaterial="uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\nfloat getTime(float t, float coord)\n{\nfloat scalar = 1.0 / maximumDistance;\nfloat q = distance(t, coord) * scalar;\nif (repeat)\n{\nfloat r = distance(t, coord + 1.0) * scalar;\nfloat s = distance(t, coord - 1.0) * scalar;\nq = min(min(r, s), q);\n}\nreturn clamp(q, 0.0, 1.0);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat s = getTime(time.x, st.s) * fadeDirection.s;\nfloat t = getTime(time.y, st.t) * fadeDirection.t;\nfloat u = length(vec2(s, t));\nvec4 color = mix(fadeInColor, fadeOutColor, u);\ncolor = czm_gammaCorrect(color);\nmaterial.emission = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",GridMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value;\n#ifdef GL_OES_standard_derivatives\nconst float fuzz = 1.2;\nvec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;\nvec2 dx = abs(dFdx(st));\nvec2 dy = abs(dFdy(st));\nvec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\nvalue = min(\nsmoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\nsmoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\nconst float fuzz = 0.05;\nvec2 range = 0.5 - (lineThickness * 0.05);\nvalue = min(\n1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\nfloat dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\nfloat sRim = smoothstep(0.8, 1.0, dRim);\nvalue *= (1.0 - sRim);\nvec4 halfColor;\nhalfColor.rgb = color.rgb * 0.5;\nhalfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));\nhalfColor = czm_gammaCorrect(halfColor);\nmaterial.diffuse = halfColor.rgb;\nmaterial.emission = halfColor.rgb;\nmaterial.alpha = halfColor.a;\nreturn material;\n}\n",NormalMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\nvec3 normalTangentSpace = textureValue.channels;\nnormalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\nnormalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\nnormalTangentSpace = normalize(normalTangentSpace);\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nreturn material;\n}\n",PolylineArrowMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\nfloat slope = (p0.y - p1.y) / (p0.x - p1.x);\nreturn slope * (x - p0.x) + p0.y;\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\n#ifdef GL_OES_standard_derivatives\nfloat base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;\n#else\nfloat base = 0.975;\n#endif\nvec2 center = vec2(1.0, 0.5);\nfloat ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\nfloat ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\nfloat halfWidth = 0.15;\nfloat s = step(0.5 - halfWidth, st.t);\ns *= 1.0 - step(0.5 + halfWidth, st.t);\ns *= 1.0 - step(base, st.s);\nfloat t = step(base, materialInput.st.s);\nt *= 1.0 - step(ptOnUpperLine, st.t);\nt *= step(ptOnLowerLine, st.t);\nfloat dist;\nif (st.s < base)\n{\nfloat d1 = abs(st.t - (0.5 - halfWidth));\nfloat d2 = abs(st.t - (0.5 + halfWidth));\ndist = min(d1, d2);\n}\nelse\n{\nfloat d1 = czm_infinity;\nif (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n{\nd1 = abs(st.s - base);\n}\nfloat d2 = abs(st.t - ptOnUpperLine);\nfloat d3 = abs(st.t - ptOnLowerLine);\ndist = min(min(d1, d2), d3);\n}\nvec4 outsideColor = vec4(0.0);\nvec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\nvec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",PolylineDashMaterial="uniform vec4 color;\nuniform vec4 gapColor;\nuniform float dashLength;\nuniform float dashPattern;\nvarying float v_polylineAngle;\nconst float maskLength = 16.0;\nmat2 rotate(float rad) {\nfloat c = cos(rad);\nfloat s = sin(rad);\nreturn mat2(\nc, s,\n-s, c\n);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\nfloat dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));\nfloat maskIndex = floor(dashPosition * maskLength);\nfloat maskTest = floor(dashPattern / pow(2.0, maskIndex));\nvec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\nif (fragColor.a < 0.005) {\ndiscard;\n}\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineGlowMaterial="uniform vec4 color;\nuniform float glowPower;\nuniform float taperPower;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\nif (taperPower <= 0.99999) {\nglow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));\n}\nvec4 fragColor;\nfragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);\nfragColor.a = clamp(0.0, 1.0, glow) * color.a;\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineOutlineMaterial="uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\nfloat b = step(0.5 - halfInteriorWidth, st.t);\nb *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\nfloat d1 = abs(st.t - (0.5 - halfInteriorWidth));\nfloat d2 = abs(st.t - (0.5 + halfInteriorWidth));\nfloat dist = min(d1, d2);\nvec4 currentColor = mix(outlineColor, color, b);\nvec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",RimLightingMaterial="uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat s = smoothstep(1.0 - width, 1.0, d);\nvec4 outColor = czm_gammaCorrect(color);\nvec4 outRimColor = czm_gammaCorrect(rimColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.emission = outRimColor.rgb * s;\nmaterial.alpha = mix(outColor.a, outRimColor.a, s);\nreturn material;\n}\n",SlopeRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",StripeMaterial="uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\nfloat value = fract((coord - offset) * (repeat * 0.5));\nfloat dist = min(value, min(abs(value - 0.5), 1.0 - value));\nvec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\nvec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",WaterMaterial="uniform sampler2D specularMap;\nuniform sampler2D normalMap;\nuniform vec4 baseWaterColor;\nuniform vec4 blendColor;\nuniform float frequency;\nuniform float animationSpeed;\nuniform float amplitude;\nuniform float specularIntensity;\nuniform float fadeFactor;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat time = czm_frameNumber * animationSpeed;\nfloat fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\nfloat specularMapValue = texture2D(specularMap, materialInput.st).r;\nvec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\nnormalTangentSpace.xy /= fade;\nnormalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\nnormalTangentSpace = normalize(normalTangentSpace);\nfloat tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\nmaterial.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;\nmaterial.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\nmaterial.diffuse += (0.1 * tsPerturbationRatio);\nmaterial.diffuse = material.diffuse;\nmaterial.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\nmaterial.specular = specularIntensity;\nmaterial.shininess = 10.0;\nreturn material;\n}\n";function Material$4(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=defaultValue(e.minificationFilter,TextureMinificationFilter$1.LINEAR),this._magnificationFilter=defaultValue(e.magnificationFilter,TextureMagnificationFilter$1.LINEAR),this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,initializeMaterial(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),defined(Material$4._uniformList[this.type])||(Material$4._uniformList[this.type]=Object.keys(this._uniforms))}function initializeMaterial(e,t){let i;e=defaultValue(e,defaultValue.EMPTY_OBJECT),t._strict=defaultValue(e.strict,!1),t._count=defaultValue(e.count,0),t._template=clone$1(defaultValue(e.fabric,defaultValue.EMPTY_OBJECT)),t._template.uniforms=clone$1(defaultValue(t._template.uniforms,defaultValue.EMPTY_OBJECT)),t._template.materials=clone$1(defaultValue(t._template.materials,defaultValue.EMPTY_OBJECT)),t.type=defined(t._template.type)?t._template.type:createGuid(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];const n=Material$4._materialCache.getMaterial(t.type);if(defined(n)){const e=clone$1(n.fabric,!0);t._template=combine$2(t._template,e,!0),i=n.translucent}checkForTemplateErrors(t),defined(n)||Material$4._materialCache.addMaterial(t.type,t),createMethodDefinition(t),createUniforms(t),createSubMaterials(t);const r=0===t._translucentFunctions.length||void 0;if(i=defaultValue(i,r),i=defaultValue(e.translucent,i),defined(i))if("function"==typeof i){const e=function(){return i(t)};t._translucentFunctions.push(e)}else t._translucentFunctions.push(i)}function checkForValidProperties(e,t,i,n){if(defined(e))for(const r in e)if(e.hasOwnProperty(r)){const e=-1!==t.indexOf(r);(n&&!e||!n&&e)&&i(r,t)}}function invalidNameError(e,t){}function duplicateNameError(e,t){}Material$4._uniformList={},Material$4.fromType=function(e,t){const i=new Material$4({fabric:{type:e}});if(defined(t))for(const e in t)t.hasOwnProperty(e)&&(i.uniforms[e]=t[e]);return i},Material$4.prototype.isTranslucent=function(){if(defined(this.translucent))return"function"==typeof this.translucent?this.translucent():this.translucent;let e=!0;const t=this._translucentFunctions,i=t.length;for(let n=0;n<i;++n){const i=t[n];if(e="function"==typeof i?e&&i():e&&i,!e)break}return e},Material$4.prototype.update=function(e){let t,i;this._defaultTexture=e.defaultTexture;const n=this._loadedImages;let r=n.length;for(t=0;t<r;++t){const r=n[t];i=r.id;let o,a=r.image;Array.isArray(a)&&(o=a.slice(1,a.length).map((function(e){return e.bufferView})),a=a[0]);const s=new Sampler({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});let c;c=defined(a.internalFormat)?new Texture({context:e,pixelFormat:a.internalFormat,width:a.width,height:a.height,source:{arrayBufferView:a.bufferView,mipLevels:o},sampler:s}):new Texture({context:e,source:a,sampler:s});const l=this._textures[i];defined(l)&&l!==this._defaultTexture&&l.destroy(),this._textures[i]=c;const u=`${i}Dimensions`;if(this.uniforms.hasOwnProperty(u)){const e=this.uniforms[u];e.x=c._width,e.y=c._height}}n.length=0;const o=this._loadedCubeMaps;for(r=o.length,t=0;t<r;++t){const n=o[t];i=n.id;const r=n.images,a=new CubeMap({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]},sampler:new Sampler({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[i]=a}o.length=0;const a=this._updateFunctions;for(r=a.length,t=0;t<r;++t)a[t](this,e);const s=this.materials;for(const t in s)s.hasOwnProperty(t)&&s[t].update(e)},Material$4.prototype.isDestroyed=function(){return!1},Material$4.prototype.destroy=function(){const e=this._textures;for(const t in e)if(e.hasOwnProperty(t)){const i=e[t];i!==this._defaultTexture&&i.destroy()}const t=this.materials;for(const e in t)t.hasOwnProperty(e)&&t[e].destroy();return destroyObject(this)};const templateProperties=["type","materials","uniforms","components","source"],componentProperties=["diffuse","specular","shininess","normal","emission","alpha"];function checkForTemplateErrors(e){const t=e._template,i=t.uniforms,n=t.materials,r=t.components;checkForValidProperties(t,templateProperties,invalidNameError,!0),checkForValidProperties(r,componentProperties,invalidNameError,!0);const o=[];for(const e in n)n.hasOwnProperty(e)&&o.push(e);checkForValidProperties(i,o,duplicateNameError,!1)}function isMaterialFused(e,t){const i=t._template.materials;for(const t in i)if(i.hasOwnProperty(t)&&e.indexOf(t)>-1)return!0;return!1}function createMethodDefinition(e){const t=e._template.components,i=e._template.source;if(defined(i))e.shaderSource+=`${i}\n`;else{if(e.shaderSource+="czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n",e.shaderSource+="czm_material material = czm_getDefaultMaterial(materialInput);\n",defined(t)){const i=Object.keys(e._template.materials).length>0;for(const n in t)if(t.hasOwnProperty(n))if("diffuse"===n||"emission"===n){const r=i&&isMaterialFused(t[n],e)?t[n]:`czm_gammaCorrect(${t[n]})`;e.shaderSource+=`material.${n} = ${r}; \n`}else e.shaderSource+="alpha"===n?`material.alpha = ${t.alpha}; \n`:`material.${n} = ${t[n]};\n`}e.shaderSource+="return material;\n}\n"}}const matrixMap={mat2:Matrix2,mat3:Matrix3,mat4:Matrix4},ktx2Regex$3=/\.ktx2$/i;function createTexture2DUpdateFunction(e){let t;return function(i,n){const r=i.uniforms,o=r[e],a=t!==o,s=!defined(o)||o===Material$4.DefaultImageId;t=o;let c,l,u=i._textures[e];if(o instanceof HTMLVideoElement){if(o.readyState>=2){if(a&&defined(u)&&(u!==n.defaultTexture&&u.destroy(),u=void 0),!defined(u)||u===n.defaultTexture){const t=new Sampler({minificationFilter:i._minificationFilter,magnificationFilter:i._magnificationFilter});return u=new Texture({context:n,source:o,sampler:t}),void(i._textures[e]=u)}u.copyFrom({source:o})}else defined(u)||(i._textures[e]=n.defaultTexture);return}if(o instanceof Texture&&o!==u){i._texturePaths[e]=void 0;const t=i._textures[e];return defined(t)&&t!==i._defaultTexture&&t.destroy(),i._textures[e]=o,c=`${e}Dimensions`,void(r.hasOwnProperty(c)&&(l=r[c],l.x=o._width,l.y=o._height))}if(a&&defined(u)&&s&&(u!==i._defaultTexture&&u.destroy(),u=void 0),defined(u)||(i._texturePaths[e]=void 0,u=i._textures[e]=i._defaultTexture,c=`${e}Dimensions`,r.hasOwnProperty(c)&&(l=r[c],l.x=u._width,l.y=u._height)),s)return;const d=o instanceof Resource;if(!defined(i._texturePaths[e])||d&&o.url!==i._texturePaths[e].url||!d&&o!==i._texturePaths[e]){if("string"==typeof o||d){const t=d?o:Resource.createIfNeeded(o);let n;n=ktx2Regex$3.test(t.url)?loadKTX2(t.url):t.fetchImage(),Promise.resolve(n).then((function(t){i._loadedImages.push({id:e,image:t})})).catch((function(){defined(u)&&u!==i._defaultTexture&&u.destroy(),i._textures[e]=i._defaultTexture}))}else(o instanceof HTMLCanvasElement||o instanceof HTMLImageElement)&&i._loadedImages.push({id:e,image:o});i._texturePaths[e]=o}}}function createCubeMapUpdateFunction(e){return function(t,i){const n=t.uniforms[e];if(n instanceof CubeMap){const i=t._textures[e];return i!==t._defaultTexture&&i.destroy(),t._texturePaths[e]=void 0,void(t._textures[e]=n)}if(defined(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=i.defaultCubeMap),n===Material$4.DefaultCubeMapId)return;const r=n.positiveX+n.negativeX+n.positiveY+n.negativeY+n.positiveZ+n.negativeZ;if(r!==t._texturePaths[e]){const i=[Resource.createIfNeeded(n.positiveX).fetchImage(),Resource.createIfNeeded(n.negativeX).fetchImage(),Resource.createIfNeeded(n.positiveY).fetchImage(),Resource.createIfNeeded(n.negativeY).fetchImage(),Resource.createIfNeeded(n.positiveZ).fetchImage(),Resource.createIfNeeded(n.negativeZ).fetchImage()];Promise.all(i).then((function(i){t._loadedCubeMaps.push({id:e,images:i})})),t._texturePaths[e]=r}}}function createUniforms(e){const t=e._template.uniforms;for(const i in t)t.hasOwnProperty(i)&&createUniform$1(e,i)}function createUniform$1(e,t){e._strict;const i=e._template.uniforms,n=i[t],r=getUniformType(n);if("channels"===r)replaceToken(e,t,n,!1);else{if("sampler2D"===r){const n=`${t}Dimensions`;getNumberOfTokens(e,n)>0&&(i[n]={type:"ivec3",x:1,y:1},createUniform$1(e,n))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){const i=`uniform ${r} ${t};`;e.shaderSource=i+e.shaderSource}const o=`${t}_${e._count++}`;if(replaceToken(e,t,o),e.uniforms[t]=n,"sampler2D"===r)e._uniforms[o]=function(){return e._textures[t]},e._updateFunctions.push(createTexture2DUpdateFunction(t));else if("samplerCube"===r)e._uniforms[o]=function(){return e._textures[t]},e._updateFunctions.push(createCubeMapUpdateFunction(t));else if(-1!==r.indexOf("mat")){const i=new matrixMap[r];e._uniforms[o]=function(){return matrixMap[r].fromColumnMajorArray(e.uniforms[t],i)}}else e._uniforms[o]=function(){return e.uniforms[t]}}}function getUniformType(e){let t=e.type;if(!defined(t)){const i=typeof e;if("number"===i)t="float";else if("boolean"===i)t="bool";else if("string"===i||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)t=/^([rgba]){1,4}$/i.test(e)?"channels":e===Material$4.DefaultCubeMapId?"samplerCube":"sampler2D";else if("object"===i)if(Array.isArray(e))4!==e.length&&9!==e.length&&16!==e.length||(t=`mat${Math.sqrt(e.length)}`);else{let i=0;for(const t in e)e.hasOwnProperty(t)&&(i+=1);i>=2&&i<=4?t=`vec${i}`:6===i&&(t="samplerCube")}}return t}function createSubMaterials(e){const t=e._strict,i=e._template.materials;for(const n in i)if(i.hasOwnProperty(n)){const r=new Material$4({strict:t,fabric:i[n],count:e._count});e._count=r._count,e._uniforms=combine$2(e._uniforms,r._uniforms,!0),e.materials[n]=r,e._translucentFunctions=e._translucentFunctions.concat(r._translucentFunctions);const o="czm_getMaterial",a=`${o}_${e._count++}`;replaceToken(r,o,a),e.shaderSource=r.shaderSource+e.shaderSource;replaceToken(e,n,`${a}(materialInput)`)}}function replaceToken(e,t,i,n){n=defaultValue(n,!0);let r=0;const o=new RegExp(`([\\w${n?".":""}])?`+t+"([\\w])?","g");return e.shaderSource=e.shaderSource.replace(o,(function(e,t,n){return t||n?e:(r+=1,i)})),r}function getNumberOfTokens(e,t,i){return replaceToken(e,t,t,i)}function MaterialAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),i=defaultValue(e.closed,!1),n=defaultValue(e.materialSupport,MaterialAppearance.MaterialSupport.TEXTURED);this.material=defined(e.material)?e.material:Material$4.fromType(Material$4.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,n.vertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,n.fragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,i,e.renderState),this._closed=i,this._materialSupport=n,this._vertexFormat=n.vertexFormat,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,!i)}Material$4._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}},Material$4.DefaultImageId="czm_defaultImage",Material$4.DefaultCubeMapId="czm_defaultCubeMap",Material$4.ColorType="Color",Material$4._materialCache.addMaterial(Material$4.ColorType,{fabric:{type:Material$4.ColorType,uniforms:{color:new Color(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material$4.ImageType="Image",Material$4._materialCache.addMaterial(Material$4.ImageType,{fabric:{type:Material$4.ImageType,uniforms:{image:Material$4.DefaultImageId,repeat:new Cartesian2(1,1),color:new Color(1,1,1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material$4.DiffuseMapType="DiffuseMap",Material$4._materialCache.addMaterial(Material$4.DiffuseMapType,{fabric:{type:Material$4.DiffuseMapType,uniforms:{image:Material$4.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material$4.AlphaMapType="AlphaMap",Material$4._materialCache.addMaterial(Material$4.AlphaMapType,{fabric:{type:Material$4.AlphaMapType,uniforms:{image:Material$4.DefaultImageId,channel:"a",repeat:new Cartesian2(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0}),Material$4.SpecularMapType="SpecularMap",Material$4._materialCache.addMaterial(Material$4.SpecularMapType,{fabric:{type:Material$4.SpecularMapType,uniforms:{image:Material$4.DefaultImageId,channel:"r",repeat:new Cartesian2(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1}),Material$4.EmissionMapType="EmissionMap",Material$4._materialCache.addMaterial(Material$4.EmissionMapType,{fabric:{type:Material$4.EmissionMapType,uniforms:{image:Material$4.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material$4.BumpMapType="BumpMap",Material$4._materialCache.addMaterial(Material$4.BumpMapType,{fabric:{type:Material$4.BumpMapType,uniforms:{image:Material$4.DefaultImageId,channel:"r",strength:.8,repeat:new Cartesian2(1,1)},source:BumpMapMaterial},translucent:!1}),Material$4.NormalMapType="NormalMap",Material$4._materialCache.addMaterial(Material$4.NormalMapType,{fabric:{type:Material$4.NormalMapType,uniforms:{image:Material$4.DefaultImageId,channels:"rgb",strength:.8,repeat:new Cartesian2(1,1)},source:NormalMapMaterial},translucent:!1}),Material$4.GridType="Grid",Material$4._materialCache.addMaterial(Material$4.GridType,{fabric:{type:Material$4.GridType,uniforms:{color:new Color(0,1,0,1),cellAlpha:.1,lineCount:new Cartesian2(8,8),lineThickness:new Cartesian2(1,1),lineOffset:new Cartesian2(0,0)},source:GridMaterial},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}}),Material$4.StripeType="Stripe",Material$4._materialCache.addMaterial(Material$4.StripeType,{fabric:{type:Material$4.StripeType,uniforms:{horizontal:!0,evenColor:new Color(1,1,1,.5),oddColor:new Color(0,0,1,.5),offset:0,repeat:5},source:StripeMaterial},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}}),Material$4.CheckerboardType="Checkerboard",Material$4._materialCache.addMaterial(Material$4.CheckerboardType,{fabric:{type:Material$4.CheckerboardType,uniforms:{lightColor:new Color(1,1,1,.5),darkColor:new Color(0,0,0,.5),repeat:new Cartesian2(5,5)},source:CheckerboardMaterial},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material$4.DotType="Dot",Material$4._materialCache.addMaterial(Material$4.DotType,{fabric:{type:Material$4.DotType,uniforms:{lightColor:new Color(1,1,0,.75),darkColor:new Color(0,1,1,.75),repeat:new Cartesian2(5,5)},source:DotMaterial},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material$4.WaterType="Water",Material$4._materialCache.addMaterial(Material$4.WaterType,{fabric:{type:Material$4.WaterType,uniforms:{baseWaterColor:new Color(.2,.3,.6,1),blendColor:new Color(0,1,.699,1),specularMap:Material$4.DefaultImageId,normalMap:Material$4.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:WaterMaterial},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}}),Material$4.RimLightingType="RimLighting",Material$4._materialCache.addMaterial(Material$4.RimLightingType,{fabric:{type:Material$4.RimLightingType,uniforms:{color:new Color(1,0,0,.7),rimColor:new Color(1,1,1,.4),width:.3},source:RimLightingMaterial},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}}),Material$4.FadeType="Fade",Material$4._materialCache.addMaterial(Material$4.FadeType,{fabric:{type:Material$4.FadeType,uniforms:{fadeInColor:new Color(1,0,0,1),fadeOutColor:new Color(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new Cartesian2(.5,.5)},source:FadeMaterial},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}}),Material$4.PolylineArrowType="PolylineArrow",Material$4._materialCache.addMaterial(Material$4.PolylineArrowType,{fabric:{type:Material$4.PolylineArrowType,uniforms:{color:new Color(1,1,1,1)},source:PolylineArrowMaterial},translucent:!0}),Material$4.PolylineDashType="PolylineDash",Material$4._materialCache.addMaterial(Material$4.PolylineDashType,{fabric:{type:Material$4.PolylineDashType,uniforms:{color:new Color(1,0,1,1),gapColor:new Color(0,0,0,0),dashLength:16,dashPattern:255},source:PolylineDashMaterial},translucent:!0}),Material$4.PolylineGlowType="PolylineGlow",Material$4._materialCache.addMaterial(Material$4.PolylineGlowType,{fabric:{type:Material$4.PolylineGlowType,uniforms:{color:new Color(0,.5,1,1),glowPower:.25,taperPower:1},source:PolylineGlowMaterial},translucent:!0}),Material$4.PolylineOutlineType="PolylineOutline",Material$4._materialCache.addMaterial(Material$4.PolylineOutlineType,{fabric:{type:Material$4.PolylineOutlineType,uniforms:{color:new Color(1,1,1,1),outlineColor:new Color(1,0,0,1),outlineWidth:1},source:PolylineOutlineMaterial},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}}),Material$4.ElevationContourType="ElevationContour",Material$4._materialCache.addMaterial(Material$4.ElevationContourType,{fabric:{type:Material$4.ElevationContourType,uniforms:{spacing:100,color:new Color(1,0,0,1),width:1},source:ElevationContourMaterial},translucent:!1}),Material$4.ElevationRampType="ElevationRamp",Material$4._materialCache.addMaterial(Material$4.ElevationRampType,{fabric:{type:Material$4.ElevationRampType,uniforms:{image:Material$4.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:ElevationRampMaterial},translucent:!1}),Material$4.SlopeRampMaterialType="SlopeRamp",Material$4._materialCache.addMaterial(Material$4.SlopeRampMaterialType,{fabric:{type:Material$4.SlopeRampMaterialType,uniforms:{image:Material$4.DefaultImageId},source:SlopeRampMaterial},translucent:!1}),Material$4.AspectRampMaterialType="AspectRamp",Material$4._materialCache.addMaterial(Material$4.AspectRampMaterialType,{fabric:{type:Material$4.AspectRampMaterialType,uniforms:{image:Material$4.DefaultImageId},source:AspectRampMaterial},translucent:!1}),Material$4.ElevationBandType="ElevationBand",Material$4._materialCache.addMaterial(Material$4.ElevationBandType,{fabric:{type:Material$4.ElevationBandType,uniforms:{heights:Material$4.DefaultImageId,colors:Material$4.DefaultImageId},source:ElevationBandMaterial},translucent:!0}),Object.defineProperties(MaterialAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},materialSupport:{get:function(){return this._materialSupport}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),MaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,MaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,MaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,MaterialAppearance.MaterialSupport={BASIC:Object.freeze({vertexFormat:VertexFormat.POSITION_AND_NORMAL,vertexShaderSource:BasicMaterialAppearanceVS,fragmentShaderSource:BasicMaterialAppearanceFS}),TEXTURED:Object.freeze({vertexFormat:VertexFormat.POSITION_NORMAL_AND_ST,vertexShaderSource:TexturedMaterialAppearanceVS,fragmentShaderSource:TexturedMaterialAppearanceFS}),ALL:Object.freeze({vertexFormat:VertexFormat.ALL,vertexShaderSource:AllMaterialAppearanceVS,fragmentShaderSource:AllMaterialAppearanceFS})};var PerInstanceColorAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nvec4 color = czm_gammaCorrect(v_color);\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n}\n",PerInstanceColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",PerInstanceFlatColorAppearanceFS="varying vec4 v_color;\nvoid main()\n{\ngl_FragColor = czm_gammaCorrect(v_color);\n}\n",PerInstanceFlatColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";function PerInstanceColorAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),i=defaultValue(e.closed,!1),n=defaultValue(e.flat,!1),r=n?PerInstanceFlatColorAppearanceVS:PerInstanceColorAppearanceVS,o=n?PerInstanceFlatColorAppearanceFS:PerInstanceColorAppearanceFS,a=n?PerInstanceColorAppearance.FLAT_VERTEX_FORMAT:PerInstanceColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,r),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,o),this._renderState=Appearance.getDefaultRenderState(t,i,e.renderState),this._closed=i,this._vertexFormat=a,this._flat=n,this._faceForward=defaultValue(e.faceForward,!i)}function ColorMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(PerInstanceColorAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),PerInstanceColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_NORMAL,PerInstanceColorAppearance.FLAT_VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PerInstanceColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PerInstanceColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PerInstanceColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,Object.defineProperties(ColorMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),ColorMaterialProperty.prototype.getType=function(e){return"Color"},ColorMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},ColorMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ColorMaterialProperty&&Property.equals(this._color,e._color)};const Flags={CULL:1,OCCLUDE:2,EXECUTE_IN_CLOSEST_FRUSTUM:4,DEBUG_SHOW_BOUNDING_VOLUME:8,CAST_SHADOWS:16,RECEIVE_SHADOWS:32,PICK_ONLY:64,DEPTH_FOR_TRANSLUCENT_CLASSIFICATION:128};function DrawCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=defaultValue(e.primitiveType,PrimitiveType$1.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=defaultValue(e.offset,0),this._instanceCount=defaultValue(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._owner=e.owner,this._debugOverlappingFrustums=0,this._pickId=e.pickId,this._flags=0,this.cull=defaultValue(e.cull,!0),this.occlude=defaultValue(e.occlude,!0),this.executeInClosestFrustum=defaultValue(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.castShadows=defaultValue(e.castShadows,!1),this.receiveShadows=defaultValue(e.receiveShadows,!1),this.pickOnly=defaultValue(e.pickOnly,!1),this.depthForTranslucentClassification=defaultValue(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function hasFlag(e,t){return(e._flags&t)===t}function setFlag(e,t,i){i?e._flags|=t:e._flags&=~t}Object.defineProperties(DrawCommand.prototype,{boundingVolume:{get:function(){return this._boundingVolume},set:function(e){this._boundingVolume!==e&&(this._boundingVolume=e,this.dirty=!0)}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox},set:function(e){this._orientedBoundingBox!==e&&(this._orientedBoundingBox=e,this.dirty=!0)}},cull:{get:function(){return hasFlag(this,Flags.CULL)},set:function(e){hasFlag(this,Flags.CULL)!==e&&(setFlag(this,Flags.CULL,e),this.dirty=!0)}},occlude:{get:function(){return hasFlag(this,Flags.OCCLUDE)},set:function(e){hasFlag(this,Flags.OCCLUDE)!==e&&(setFlag(this,Flags.OCCLUDE,e),this.dirty=!0)}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix!==e&&(this._modelMatrix=e,this.dirty=!0)}},primitiveType:{get:function(){return this._primitiveType},set:function(e){this._primitiveType!==e&&(this._primitiveType=e,this.dirty=!0)}},vertexArray:{get:function(){return this._vertexArray},set:function(e){this._vertexArray!==e&&(this._vertexArray=e,this.dirty=!0)}},count:{get:function(){return this._count},set:function(e){this._count!==e&&(this._count=e,this.dirty=!0)}},offset:{get:function(){return this._offset},set:function(e){this._offset!==e&&(this._offset=e,this.dirty=!0)}},instanceCount:{get:function(){return this._instanceCount},set:function(e){this._instanceCount!==e&&(this._instanceCount=e,this.dirty=!0)}},shaderProgram:{get:function(){return this._shaderProgram},set:function(e){this._shaderProgram!==e&&(this._shaderProgram=e,this.dirty=!0)}},castShadows:{get:function(){return hasFlag(this,Flags.CAST_SHADOWS)},set:function(e){hasFlag(this,Flags.CAST_SHADOWS)!==e&&(setFlag(this,Flags.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return hasFlag(this,Flags.RECEIVE_SHADOWS)},set:function(e){hasFlag(this,Flags.RECEIVE_SHADOWS)!==e&&(setFlag(this,Flags.RECEIVE_SHADOWS,e),this.dirty=!0)}},uniformMap:{get:function(){return this._uniformMap},set:function(e){this._uniformMap!==e&&(this._uniformMap=e,this.dirty=!0)}},renderState:{get:function(){return this._renderState},set:function(e){this._renderState!==e&&(this._renderState=e,this.dirty=!0)}},framebuffer:{get:function(){return this._framebuffer},set:function(e){this._framebuffer!==e&&(this._framebuffer=e,this.dirty=!0)}},pass:{get:function(){return this._pass},set:function(e){this._pass!==e&&(this._pass=e,this.dirty=!0)}},executeInClosestFrustum:{get:function(){return hasFlag(this,Flags.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){hasFlag(this,Flags.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(setFlag(this,Flags.EXECUTE_IN_CLOSEST_FRUSTUM,e),this.dirty=!0)}},owner:{get:function(){return this._owner},set:function(e){this._owner!==e&&(this._owner=e,this.dirty=!0)}},debugShowBoundingVolume:{get:function(){return hasFlag(this,Flags.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){hasFlag(this,Flags.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(setFlag(this,Flags.DEBUG_SHOW_BOUNDING_VOLUME,e),this.dirty=!0)}},debugOverlappingFrustums:{get:function(){return this._debugOverlappingFrustums},set:function(e){this._debugOverlappingFrustums!==e&&(this._debugOverlappingFrustums=e,this.dirty=!0)}},pickId:{get:function(){return this._pickId},set:function(e){this._pickId!==e&&(this._pickId=e,this.dirty=!0)}},pickOnly:{get:function(){return hasFlag(this,Flags.PICK_ONLY)},set:function(e){hasFlag(this,Flags.PICK_ONLY)!==e&&(setFlag(this,Flags.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return hasFlag(this,Flags.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){hasFlag(this,Flags.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(setFlag(this,Flags.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}}),DrawCommand.shallowClone=function(e,t){if(defined(e))return defined(t)||(t=new DrawCommand),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._modelMatrix=e._modelMatrix,t._primitiveType=e._primitiveType,t._vertexArray=e._vertexArray,t._count=e._count,t._offset=e._offset,t._instanceCount=e._instanceCount,t._shaderProgram=e._shaderProgram,t._uniformMap=e._uniformMap,t._renderState=e._renderState,t._framebuffer=e._framebuffer,t._pass=e._pass,t._owner=e._owner,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._pickId=e._pickId,t._flags=e._flags,t.dirty=!0,t.lastDirtyTime=0,t},DrawCommand.prototype.execute=function(e,t){e.draw(this,t)};const Pass={ENVIRONMENT:0,COMPUTE:1,GLOBE:2,TERRAIN_CLASSIFICATION:3,CESIUM_3D_TILE:4,CESIUM_3D_TILE_CLASSIFICATION:5,CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW:6,OPAQUE:7,TRANSLUCENT:8,OVERLAY:9,NUMBER_OF_PASSES:10};var Pass$1=Object.freeze(Pass);function freezeRenderState(e){if("object"!=typeof e||null===e)return e;let t;const i=Object.keys(e);for(let n=0;n<i.length;n++)t=i[n],e.hasOwnProperty(t)&&"_applyFunctions"!==t&&(e[t]=freezeRenderState(e[t]));return Object.freeze(e)}function RenderState(e){const t=defaultValue(e,defaultValue.EMPTY_OBJECT),i=defaultValue(t.cull,defaultValue.EMPTY_OBJECT),n=defaultValue(t.polygonOffset,defaultValue.EMPTY_OBJECT),r=defaultValue(t.scissorTest,defaultValue.EMPTY_OBJECT),o=defaultValue(r.rectangle,defaultValue.EMPTY_OBJECT),a=defaultValue(t.depthRange,defaultValue.EMPTY_OBJECT),s=defaultValue(t.depthTest,defaultValue.EMPTY_OBJECT),c=defaultValue(t.colorMask,defaultValue.EMPTY_OBJECT),l=defaultValue(t.blending,defaultValue.EMPTY_OBJECT),u=defaultValue(l.color,defaultValue.EMPTY_OBJECT),d=defaultValue(t.stencilTest,defaultValue.EMPTY_OBJECT),h=defaultValue(d.frontOperation,defaultValue.EMPTY_OBJECT),p=defaultValue(d.backOperation,defaultValue.EMPTY_OBJECT),f=defaultValue(t.sampleCoverage,defaultValue.EMPTY_OBJECT),m=t.viewport;this.frontFace=defaultValue(t.frontFace,WindingOrder$1.COUNTER_CLOCKWISE),this.cull={enabled:defaultValue(i.enabled,!1),face:defaultValue(i.face,WebGLConstants$1.BACK)},this.lineWidth=defaultValue(t.lineWidth,1),this.polygonOffset={enabled:defaultValue(n.enabled,!1),factor:defaultValue(n.factor,0),units:defaultValue(n.units,0)},this.scissorTest={enabled:defaultValue(r.enabled,!1),rectangle:BoundingRectangle.clone(o)},this.depthRange={near:defaultValue(a.near,0),far:defaultValue(a.far,1)},this.depthTest={enabled:defaultValue(s.enabled,!1),func:defaultValue(s.func,WebGLConstants$1.LESS)},this.colorMask={red:defaultValue(c.red,!0),green:defaultValue(c.green,!0),blue:defaultValue(c.blue,!0),alpha:defaultValue(c.alpha,!0)},this.depthMask=defaultValue(t.depthMask,!0),this.stencilMask=defaultValue(t.stencilMask,-1),this.blending={enabled:defaultValue(l.enabled,!1),color:new Color(defaultValue(u.red,0),defaultValue(u.green,0),defaultValue(u.blue,0),defaultValue(u.alpha,0)),equationRgb:defaultValue(l.equationRgb,WebGLConstants$1.FUNC_ADD),equationAlpha:defaultValue(l.equationAlpha,WebGLConstants$1.FUNC_ADD),functionSourceRgb:defaultValue(l.functionSourceRgb,WebGLConstants$1.ONE),functionSourceAlpha:defaultValue(l.functionSourceAlpha,WebGLConstants$1.ONE),functionDestinationRgb:defaultValue(l.functionDestinationRgb,WebGLConstants$1.ZERO),functionDestinationAlpha:defaultValue(l.functionDestinationAlpha,WebGLConstants$1.ZERO)},this.stencilTest={enabled:defaultValue(d.enabled,!1),frontFunction:defaultValue(d.frontFunction,WebGLConstants$1.ALWAYS),backFunction:defaultValue(d.backFunction,WebGLConstants$1.ALWAYS),reference:defaultValue(d.reference,0),mask:defaultValue(d.mask,-1),frontOperation:{fail:defaultValue(h.fail,WebGLConstants$1.KEEP),zFail:defaultValue(h.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(h.zPass,WebGLConstants$1.KEEP)},backOperation:{fail:defaultValue(p.fail,WebGLConstants$1.KEEP),zFail:defaultValue(p.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(p.zPass,WebGLConstants$1.KEEP)}},this.sampleCoverage={enabled:defaultValue(f.enabled,!1),value:defaultValue(f.value,1),invert:defaultValue(f.invert,!1)},this.viewport=defined(m)?new BoundingRectangle(m.x,m.y,m.width,m.height):void 0,this.id=0,this._applyFunctions=[]}let nextRenderStateId=0,renderStateCache={};function enableOrDisable(e,t,i){i?e.enable(t):e.disable(t)}function applyFrontFace(e,t){e.frontFace(t.frontFace)}function applyCull(e,t){const i=t.cull,n=i.enabled;enableOrDisable(e,e.CULL_FACE,n),n&&e.cullFace(i.face)}function applyLineWidth(e,t){e.lineWidth(t.lineWidth)}function applyPolygonOffset(e,t){const i=t.polygonOffset,n=i.enabled;enableOrDisable(e,e.POLYGON_OFFSET_FILL,n),n&&e.polygonOffset(i.factor,i.units)}function applyScissorTest(e,t,i){const n=t.scissorTest,r=defined(i.scissorTest)?i.scissorTest.enabled:n.enabled;if(enableOrDisable(e,e.SCISSOR_TEST,r),r){const t=defined(i.scissorTest)?i.scissorTest.rectangle:n.rectangle;e.scissor(t.x,t.y,t.width,t.height)}}function applyDepthRange(e,t){const i=t.depthRange;e.depthRange(i.near,i.far)}function applyDepthTest(e,t){const i=t.depthTest,n=i.enabled;enableOrDisable(e,e.DEPTH_TEST,n),n&&e.depthFunc(i.func)}function applyColorMask(e,t){const i=t.colorMask;e.colorMask(i.red,i.green,i.blue,i.alpha)}function applyDepthMask(e,t){e.depthMask(t.depthMask)}function applyStencilMask(e,t){e.stencilMask(t.stencilMask)}function applyBlendingColor(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function applyBlending(e,t,i){const n=t.blending,r=defined(i.blendingEnabled)?i.blendingEnabled:n.enabled;enableOrDisable(e,e.BLEND,r),r&&(applyBlendingColor(e,n.color),e.blendEquationSeparate(n.equationRgb,n.equationAlpha),e.blendFuncSeparate(n.functionSourceRgb,n.functionDestinationRgb,n.functionSourceAlpha,n.functionDestinationAlpha))}function applyStencilTest(e,t){const i=t.stencilTest,n=i.enabled;if(enableOrDisable(e,e.STENCIL_TEST,n),n){const t=i.frontFunction,n=i.backFunction,r=i.reference,o=i.mask;e.stencilFunc(t,r,o),e.stencilFuncSeparate(e.BACK,n,r,o),e.stencilFuncSeparate(e.FRONT,t,r,o);const a=i.frontOperation,s=a.fail,c=a.zFail,l=a.zPass;e.stencilOpSeparate(e.FRONT,s,c,l);const u=i.backOperation,d=u.fail,h=u.zFail,p=u.zPass;e.stencilOpSeparate(e.BACK,d,h,p)}}function applySampleCoverage(e,t){const i=t.sampleCoverage,n=i.enabled;enableOrDisable(e,e.SAMPLE_COVERAGE,n),n&&e.sampleCoverage(i.value,i.invert)}RenderState.fromCache=function(e){const t=JSON.stringify(e);let i=renderStateCache[t];if(defined(i))return++i.referenceCount,i.state;let n=new RenderState(e);const r=JSON.stringify(n);return i=renderStateCache[r],defined(i)||(n.id=nextRenderStateId++,i={referenceCount:0,state:n},renderStateCache[r]=i),++i.referenceCount,renderStateCache[t]={referenceCount:1,state:i.state},i.state},RenderState.removeFromCache=function(e){const t=new RenderState(e),i=JSON.stringify(t),n=renderStateCache[i],r=JSON.stringify(e),o=renderStateCache[r];defined(o)&&(--o.referenceCount,0===o.referenceCount&&(delete renderStateCache[r],defined(n)&&--n.referenceCount)),defined(n)&&0===n.referenceCount&&delete renderStateCache[i]},RenderState.getCache=function(){return renderStateCache},RenderState.clearCache=function(){renderStateCache={}};const scratchViewport$2=new BoundingRectangle;function applyViewport(e,t,i){let n=defaultValue(t.viewport,i.viewport);defined(n)||(n=scratchViewport$2,n.width=i.context.drawingBufferWidth,n.height=i.context.drawingBufferHeight),i.context.uniformState.viewport=n,e.viewport(n.x,n.y,n.width,n.height)}function createFuncs(e,t){const i=[];return e.frontFace!==t.frontFace&&i.push(applyFrontFace),e.cull.enabled===t.cull.enabled&&e.cull.face===t.cull.face||i.push(applyCull),e.lineWidth!==t.lineWidth&&i.push(applyLineWidth),e.polygonOffset.enabled===t.polygonOffset.enabled&&e.polygonOffset.factor===t.polygonOffset.factor&&e.polygonOffset.units===t.polygonOffset.units||i.push(applyPolygonOffset),e.depthRange.near===t.depthRange.near&&e.depthRange.far===t.depthRange.far||i.push(applyDepthRange),e.depthTest.enabled===t.depthTest.enabled&&e.depthTest.func===t.depthTest.func||i.push(applyDepthTest),e.colorMask.red===t.colorMask.red&&e.colorMask.green===t.colorMask.green&&e.colorMask.blue===t.colorMask.blue&&e.colorMask.alpha===t.colorMask.alpha||i.push(applyColorMask),e.depthMask!==t.depthMask&&i.push(applyDepthMask),e.stencilMask!==t.stencilMask&&i.push(applyStencilMask),e.stencilTest.enabled===t.stencilTest.enabled&&e.stencilTest.frontFunction===t.stencilTest.frontFunction&&e.stencilTest.backFunction===t.stencilTest.backFunction&&e.stencilTest.reference===t.stencilTest.reference&&e.stencilTest.mask===t.stencilTest.mask&&e.stencilTest.frontOperation.fail===t.stencilTest.frontOperation.fail&&e.stencilTest.frontOperation.zFail===t.stencilTest.frontOperation.zFail&&e.stencilTest.backOperation.fail===t.stencilTest.backOperation.fail&&e.stencilTest.backOperation.zFail===t.stencilTest.backOperation.zFail&&e.stencilTest.backOperation.zPass===t.stencilTest.backOperation.zPass||i.push(applyStencilTest),e.sampleCoverage.enabled===t.sampleCoverage.enabled&&e.sampleCoverage.value===t.sampleCoverage.value&&e.sampleCoverage.invert===t.sampleCoverage.invert||i.push(applySampleCoverage),i}RenderState.apply=function(e,t,i){applyFrontFace(e,t),applyCull(e,t),applyLineWidth(e,t),applyPolygonOffset(e,t),applyDepthRange(e,t),applyDepthTest(e,t),applyColorMask(e,t),applyDepthMask(e,t),applyStencilMask(e,t),applyStencilTest(e,t),applySampleCoverage(e,t),applyScissorTest(e,t,i),applyBlending(e,t,i),applyViewport(e,t,i)},RenderState.partialApply=function(e,t,i,n,r,o){if(t!==i){let n=i._applyFunctions[t.id];defined(n)||(n=createFuncs(t,i),i._applyFunctions[t.id]=n);const r=n.length;for(let t=0;t<r;++t)n[t](e,i)}((defined(n.scissorTest)?n.scissorTest:t.scissorTest)!==(defined(r.scissorTest)?r.scissorTest:i.scissorTest)||o)&&applyScissorTest(e,i,r);const a=defined(n.blendingEnabled)?n.blendingEnabled:t.blending.enabled,s=defined(r.blendingEnabled)?r.blendingEnabled:i.blending.enabled;(a!==s||s&&t.blending!==i.blending)&&applyBlending(e,i,r),t===i&&n===r&&n.context===r.context||applyViewport(e,i,r)},RenderState.getState=function(e){return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:BoundingRectangle.clone(e.scissorTest.rectangle)},depthRange:{near:e.depthRange.near,far:e.depthRange.far},depthTest:{enabled:e.depthTest.enabled,func:e.depthTest.func},colorMask:{red:e.colorMask.red,green:e.colorMask.green,blue:e.colorMask.blue,alpha:e.colorMask.alpha},depthMask:e.depthMask,stencilMask:e.stencilMask,blending:{enabled:e.blending.enabled,color:Color.clone(e.blending.color),equationRgb:e.blending.equationRgb,equationAlpha:e.blending.equationAlpha,functionSourceRgb:e.blending.functionSourceRgb,functionSourceAlpha:e.blending.functionSourceAlpha,functionDestinationRgb:e.blending.functionDestinationRgb,functionDestinationAlpha:e.blending.functionDestinationAlpha},stencilTest:{enabled:e.stencilTest.enabled,frontFunction:e.stencilTest.frontFunction,backFunction:e.stencilTest.backFunction,reference:e.stencilTest.reference,mask:e.stencilTest.mask,frontOperation:{fail:e.stencilTest.frontOperation.fail,zFail:e.stencilTest.frontOperation.zFail,zPass:e.stencilTest.frontOperation.zPass},backOperation:{fail:e.stencilTest.backOperation.fail,zFail:e.stencilTest.backOperation.zFail,zPass:e.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:e.sampleCoverage.enabled,value:e.sampleCoverage.value,invert:e.sampleCoverage.invert},viewport:defined(e.viewport)?BoundingRectangle.clone(e.viewport):void 0}};const viewerPositionWCScratch=new Cartesian3;function AutomaticUniform(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}const datatypeToGlsl={};datatypeToGlsl[WebGLConstants$1.FLOAT]="float",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC2]="vec2",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC3]="vec3",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC4]="vec4",datatypeToGlsl[WebGLConstants$1.INT]="int",datatypeToGlsl[WebGLConstants$1.INT_VEC2]="ivec2",datatypeToGlsl[WebGLConstants$1.INT_VEC3]="ivec3",datatypeToGlsl[WebGLConstants$1.INT_VEC4]="ivec4",datatypeToGlsl[WebGLConstants$1.BOOL]="bool",datatypeToGlsl[WebGLConstants$1.BOOL_VEC2]="bvec2",datatypeToGlsl[WebGLConstants$1.BOOL_VEC3]="bvec3",datatypeToGlsl[WebGLConstants$1.BOOL_VEC4]="bvec4",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT2]="mat2",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT3]="mat3",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT4]="mat4",datatypeToGlsl[WebGLConstants$1.SAMPLER_2D]="sampler2D",datatypeToGlsl[WebGLConstants$1.SAMPLER_CUBE]="samplerCube",AutomaticUniform.prototype.getDeclaration=function(e){let t=`uniform ${datatypeToGlsl[this._datatype]} ${e}`;const i=this._size;return t+=1===i?";":`[${i.toString()}];`,t};const AutomaticUniforms={czm_viewport:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return Matrix4.getTranslation(e.inverseView,viewerPositionWCScratch)}}),czm_frameNumber:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new AutomaticUniform({size:9,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.fogDensity}}),czm_splitPosition:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.splitPosition}}),czm_imagerySplitPosition:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.imagerySplitPosition}}),czm_geometricToleranceOverMeter:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})};function createUniform(e,t,i,n){switch(t.type){case e.FLOAT:return new UniformFloat(e,t,i,n);case e.FLOAT_VEC2:return new UniformFloatVec2(e,t,i,n);case e.FLOAT_VEC3:return new UniformFloatVec3(e,t,i,n);case e.FLOAT_VEC4:return new UniformFloatVec4(e,t,i,n);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformSampler(e,t,i,n);case e.INT:case e.BOOL:return new UniformInt(e,t,i,n);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformIntVec2(e,t,i,n);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformIntVec3(e,t,i,n);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformIntVec4(e,t,i,n);case e.FLOAT_MAT2:return new UniformMat2(e,t,i,n);case e.FLOAT_MAT3:return new UniformMat3(e,t,i,n);case e.FLOAT_MAT4:return new UniformMat4(e,t,i,n);default:throw new RuntimeError(`Unrecognized uniform type: ${t.type} for uniform "${i}".`)}}function UniformFloat(e,t,i,n){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=n}function UniformFloatVec2(e,t,i,n){this.name=i,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=n}function UniformFloatVec3(e,t,i,n){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=n}function UniformFloatVec4(e,t,i,n){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=n}function UniformSampler(e,t,i,n){this.name=i,this.value=void 0,this._gl=e,this._location=n,this.textureUnitIndex=void 0}function UniformInt(e,t,i,n){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=n}function UniformIntVec2(e,t,i,n){this.name=i,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=n}function UniformIntVec3(e,t,i,n){this.name=i,this.value=void 0,this._value=new Cartesian3,this._gl=e,this._location=n}function UniformIntVec4(e,t,i,n){this.name=i,this.value=void 0,this._value=new Cartesian4,this._gl=e,this._location=n}UniformFloat.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))},UniformFloatVec2.prototype.set=function(){const e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))},UniformFloatVec3.prototype.set=function(){const e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue)):defined(e.x)&&(Cartesian3.equals(e,this._value)||(this._value=Cartesian3.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z)))},UniformFloatVec4.prototype.set=function(){const e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha)):defined(e.x)&&(Cartesian4.equals(e,this._value)||(this._value=Cartesian4.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w)))},UniformSampler.prototype.set=function(){const e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);const t=this.value;e.bindTexture(t._target,t._texture)},UniformSampler.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1},UniformInt.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))},UniformIntVec2.prototype.set=function(){const e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))},UniformIntVec3.prototype.set=function(){const e=this.value;Cartesian3.equals(e,this._value)||(Cartesian3.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))},UniformIntVec4.prototype.set=function(){const e=this.value;Cartesian4.equals(e,this._value)||(Cartesian4.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};const scratchUniformArray$1=new Float32Array(4);function UniformMat2(e,t,i,n){this.name=i,this.value=void 0,this._value=new Matrix2,this._gl=e,this._location=n}UniformMat2.prototype.set=function(){if(!Matrix2.equalsArray(this.value,this._value,0)){Matrix2.clone(this.value,this._value);const e=Matrix2.toArray(this.value,scratchUniformArray$1);this._gl.uniformMatrix2fv(this._location,!1,e)}};const scratchMat3Array=new Float32Array(9);function UniformMat3(e,t,i,n){this.name=i,this.value=void 0,this._value=new Matrix3,this._gl=e,this._location=n}UniformMat3.prototype.set=function(){if(!Matrix3.equalsArray(this.value,this._value,0)){Matrix3.clone(this.value,this._value);const e=Matrix3.toArray(this.value,scratchMat3Array);this._gl.uniformMatrix3fv(this._location,!1,e)}};const scratchMat4Array=new Float32Array(16);function UniformMat4(e,t,i,n){this.name=i,this.value=void 0,this._value=new Matrix4,this._gl=e,this._location=n}function createUniformArray(e,t,i,n){switch(t.type){case e.FLOAT:return new UniformArrayFloat(e,t,i,n);case e.FLOAT_VEC2:return new UniformArrayFloatVec2(e,t,i,n);case e.FLOAT_VEC3:return new UniformArrayFloatVec3(e,t,i,n);case e.FLOAT_VEC4:return new UniformArrayFloatVec4(e,t,i,n);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformArraySampler(e,t,i,n);case e.INT:case e.BOOL:return new UniformArrayInt(e,t,i,n);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformArrayIntVec2(e,t,i,n);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformArrayIntVec3(e,t,i,n);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformArrayIntVec4(e,t,i,n);case e.FLOAT_MAT2:return new UniformArrayMat2(e,t,i,n);case e.FLOAT_MAT3:return new UniformArrayMat3(e,t,i,n);case e.FLOAT_MAT4:return new UniformArrayMat4(e,t,i,n);default:throw new RuntimeError(`Unrecognized uniform type: ${t.type} for uniform "${i}".`)}}function UniformArrayFloat(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(r),this._gl=e,this._location=n[0]}function UniformArrayFloatVec2(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(2*r),this._gl=e,this._location=n[0]}function UniformArrayFloatVec3(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(3*r),this._gl=e,this._location=n[0]}function UniformArrayFloatVec4(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(4*r),this._gl=e,this._location=n[0]}function UniformArraySampler(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(r),this._gl=e,this._locations=n,this.textureUnitIndex=void 0}function UniformArrayInt(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Int32Array(r),this._gl=e,this._location=n[0]}function UniformArrayIntVec2(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Int32Array(2*r),this._gl=e,this._location=n[0]}function UniformArrayIntVec3(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Int32Array(3*r),this._gl=e,this._location=n[0]}function UniformArrayIntVec4(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Int32Array(4*r),this._gl=e,this._location=n[0]}function UniformArrayMat2(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(4*r),this._gl=e,this._location=n[0]}function UniformArrayMat3(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(9*r),this._gl=e,this._location=n[0]}function UniformArrayMat4(e,t,i,n){const r=n.length;this.name=i,this.value=new Array(r),this._value=new Float32Array(16*r),this._gl=e,this._location=n[0]}UniformMat4.prototype.set=function(){if(!Matrix4.equalsArray(this.value,this._value,0)){Matrix4.clone(this.value,this._value);const e=Matrix4.toArray(this.value,scratchMat4Array);this._gl.uniformMatrix4fv(this._location,!1,e)}},UniformArrayFloat.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1;for(let r=0;r<t;++r){const t=e[r];t!==i[r]&&(i[r]=t,n=!0)}n&&this._gl.uniform1fv(this._location,i)},UniformArrayFloatVec2.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian2.equalsArray(t,i,r)||(Cartesian2.pack(t,i,r),n=!0),r+=2}n&&this._gl.uniform2fv(this._location,i)},UniformArrayFloatVec3.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];defined(t.red)?t.red===i[r]&&t.green===i[r+1]&&t.blue===i[r+2]||(i[r]=t.red,i[r+1]=t.green,i[r+2]=t.blue,n=!0):defined(t.x)&&(Cartesian3.equalsArray(t,i,r)||(Cartesian3.pack(t,i,r),n=!0)),r+=3}n&&this._gl.uniform3fv(this._location,i)},UniformArrayFloatVec4.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];defined(t.red)?Color.equalsArray(t,i,r)||(Color.pack(t,i,r),n=!0):defined(t.x)&&(Cartesian4.equalsArray(t,i,r)||(Cartesian4.pack(t,i,r),n=!0)),r+=4}n&&this._gl.uniform4fv(this._location,i)},UniformArraySampler.prototype.set=function(){const e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,i=this.value,n=i.length;for(let r=0;r<n;++r){const n=i[r];e.activeTexture(t+r),e.bindTexture(n._target,n._texture)}},UniformArraySampler.prototype._setSampler=function(e){this.textureUnitIndex=e;const t=this._locations,i=t.length;for(let n=0;n<i;++n){const i=e+n;this._gl.uniform1i(t[n],i)}return e+i},UniformArrayInt.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1;for(let r=0;r<t;++r){const t=e[r];t!==i[r]&&(i[r]=t,n=!0)}n&&this._gl.uniform1iv(this._location,i)},UniformArrayIntVec2.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian2.equalsArray(t,i,r)||(Cartesian2.pack(t,i,r),n=!0),r+=2}n&&this._gl.uniform2iv(this._location,i)},UniformArrayIntVec3.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian3.equalsArray(t,i,r)||(Cartesian3.pack(t,i,r),n=!0),r+=3}n&&this._gl.uniform3iv(this._location,i)},UniformArrayIntVec4.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian4.equalsArray(t,i,r)||(Cartesian4.pack(t,i,r),n=!0),r+=4}n&&this._gl.uniform4iv(this._location,i)},UniformArrayMat2.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Matrix2.equalsArray(t,i,r)||(Matrix2.pack(t,i,r),n=!0),r+=4}n&&this._gl.uniformMatrix2fv(this._location,!1,i)},UniformArrayMat3.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Matrix3.equalsArray(t,i,r)||(Matrix3.pack(t,i,r),n=!0),r+=9}n&&this._gl.uniformMatrix3fv(this._location,!1,i)},UniformArrayMat4.prototype.set=function(){const e=this.value,t=e.length,i=this._value;let n=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Matrix4.equalsArray(t,i,r)||(Matrix4.pack(t,i,r),n=!0),r+=16}n&&this._gl.uniformMatrix4fv(this._location,!1,i)};let nextShaderProgramId=0;function ShaderProgram(e){let t=e.vertexShaderText,i=e.fragmentShaderText;"undefined"!=typeof spector&&(t=t.replace(/^#line/gm,"//#line"),i=i.replace(/^#line/gm,"//#line"));const n=handleUniformPrecisionMismatches(t,i);this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._duplicateUniformNames=n.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=n.fragmentShaderText,this.id=nextShaderProgramId++}function extractUniforms(e){const t=[],i=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(defined(i)){const e=i.length;for(let n=0;n<e;n++){const e=i[n].trim(),r=e.slice(e.lastIndexOf(" ")+1);t.push(r)}}return t}function handleUniformPrecisionMismatches(e,t){const i={};if(!ContextLimits.highpFloatSupported||!ContextLimits.highpIntSupported){let n,r,o,a;const s=extractUniforms(e),c=extractUniforms(t),l=s.length,u=c.length;for(n=0;n<l;n++)for(r=0;r<u;r++)if(s[n]===c[r]){o=s[n],a=`czm_mediump_${o}`;const e=new RegExp(`${o}\\b`,"g");t=t.replace(e,a),i[a]=o}}return{fragmentShaderText:t,duplicateUniformNames:i}}ShaderProgram.fromCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.getShaderProgram(e)},ShaderProgram.replaceCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.replaceShaderProgram(e)},Object.defineProperties(ShaderProgram.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return initialize$d(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return initialize$d(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return initialize$d(this),this._uniformsByName}}});const consolePrefix="[Cesium WebGL] ";function createAndLinkProgram(e,t){const i=t._vertexShaderText,n=t._fragmentShaderText,r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,i),e.compileShader(r);const o=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(o,n),e.compileShader(o);const a=e.createProgram();e.attachShader(a,r),e.attachShader(a,o),e.deleteShader(r),e.deleteShader(o);const s=t._attributeLocations;if(defined(s))for(const t in s)s.hasOwnProperty(t)&&e.bindAttribLocation(a,s[t],t);let c;if(e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS)){const i=t._debugShaders;if(!e.getShaderParameter(o,e.COMPILE_STATUS)){if(c=e.getShaderInfoLog(o),console.error(`${consolePrefix}Fragment shader compile log: ${c}`),defined(i)){const e=i.getTranslatedShaderSource(o);""!==e?console.error(`${consolePrefix}Translated fragment shader source:\n${e}`):console.error(`${consolePrefix}Fragment shader translation failed.`)}throw e.deleteProgram(a),new RuntimeError(`Fragment shader failed to compile. Compile log: ${c}`)}if(!e.getShaderParameter(r,e.COMPILE_STATUS)){if(c=e.getShaderInfoLog(r),console.error(`${consolePrefix}Vertex shader compile log: ${c}`),defined(i)){const e=i.getTranslatedShaderSource(r);""!==e?console.error(`${consolePrefix}Translated vertex shader source:\n${e}`):console.error(`${consolePrefix}Vertex shader translation failed.`)}throw e.deleteProgram(a),new RuntimeError(`Vertex shader failed to compile. Compile log: ${c}`)}throw c=e.getProgramInfoLog(a),console.error(`${consolePrefix}Shader program link log: ${c}`),defined(i)&&(console.error(`${consolePrefix}Translated vertex shader source:\n${i.getTranslatedShaderSource(r)}`),console.error(`${consolePrefix}Translated fragment shader source:\n${i.getTranslatedShaderSource(o)}`)),e.deleteProgram(a),new RuntimeError(`Program failed to link. Link log: ${c}`)}const l=t._logShaderCompilation;return l&&(c=e.getShaderInfoLog(r),defined(c)&&c.length>0&&console.log(`${consolePrefix}Vertex shader compile log: ${c}`)),l&&(c=e.getShaderInfoLog(o),defined(c)&&c.length>0&&console.log(`${consolePrefix}Fragment shader compile log: ${c}`)),l&&(c=e.getProgramInfoLog(a),defined(c)&&c.length>0&&console.log(`${consolePrefix}Shader program link log: ${c}`)),a}function findVertexAttributes(e,t,i){const n={};for(let r=0;r<i;++r){const i=e.getActiveAttrib(t,r),o=e.getAttribLocation(t,i.name);n[i.name]={name:i.name,type:i.type,index:o}}return n}function findUniforms(e,t){const i={},n=[],r=[],o=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<o;++a){const o=e.getActiveUniform(t,a),s="[0]",c=-1!==o.name.indexOf(s,o.name.length-s.length)?o.name.slice(0,o.name.length-3):o.name;if(0!==c.indexOf("gl_"))if(o.name.indexOf("[")<0){const a=e.getUniformLocation(t,c);if(null!==a){const t=createUniform(e,o,c,a);i[c]=t,n.push(t),t._setSampler&&r.push(t)}}else{let a,s,l,u;const d=c.indexOf("[");if(d>=0){if(a=i[c.slice(0,d)],!defined(a))continue;s=a._locations,s.length<=1&&(l=a.value,u=e.getUniformLocation(t,c),null!==u&&(s.push(u),l.push(e.getUniform(t,u))))}else{s=[];for(let i=0;i<o.size;++i)u=e.getUniformLocation(t,`${c}[${i}]`),null!==u&&s.push(u);a=createUniformArray(e,o,c,s),i[c]=a,n.push(a),a._setSampler&&r.push(a)}}}return{uniformsByName:i,uniforms:n,samplerUniforms:r}}function partitionUniforms(e,t){const i=[],n=[];for(const r in t)if(t.hasOwnProperty(r)){const o=t[r];let a=r;const s=e._duplicateUniformNames[a];defined(s)&&(o.name=s,a=s);const c=AutomaticUniforms[a];defined(c)?i.push({uniform:o,automaticUniform:c}):n.push(o)}return{automaticUniforms:i,manualUniforms:n}}function setSamplerUniforms(e,t,i){e.useProgram(t);let n=0;const r=i.length;for(let e=0;e<r;++e)n=i[e]._setSampler(n);return e.useProgram(null),n}function initialize$d(e){defined(e._program)||reinitialize(e)}function reinitialize(e){const t=e._program,i=e._gl,n=createAndLinkProgram(i,e,e._debugShaders),r=i.getProgramParameter(n,i.ACTIVE_ATTRIBUTES),o=findUniforms(i,n),a=partitionUniforms(e,o.uniformsByName);e._program=n,e._numberOfVertexAttributes=r,e._vertexAttributes=findVertexAttributes(i,n,r),e._uniformsByName=o.uniformsByName,e._uniforms=o.uniforms,e._automaticUniforms=a.automaticUniforms,e._manualUniforms=a.manualUniforms,e.maximumTextureUnitIndex=setSamplerUniforms(i,n,o.samplerUniforms),t&&e._gl.deleteProgram(t),"undefined"!=typeof spector&&(e._program.__SPECTOR_rebuildProgram=function(t,i,n,r){const o=e._vertexShaderText,a=e._fragmentShaderText,s=/ ! = /g;e._vertexShaderText=t.replace(s," != "),e._fragmentShaderText=i.replace(s," != ");try{reinitialize(e),n(e._program)}catch(t){e._vertexShaderText=o,e._fragmentShaderText=a;const i=/(?:Compile|Link) error: ([^]*)/.exec(t.message);r(i?i[1]:t.message)}})}function modernizeShader(e,t){const i=/#define OUTPUT_DECLARATION/,n=e.split("\n");if(/#version 300 es/g.test(e))return e;let r,o,a=-1;for(r=0;r<n.length;++r)if(o=n[r],i.test(o)){a=r;break}if(-1===a)throw new DeveloperError("Could not find a #define OUTPUT_DECLARATION!");const s=[];for(r=0;r<10;r++){const t=`gl_FragData\\[${r}\\]`,i=`czm_out${r}`;new RegExp(t,"g").test(e)&&(setAdd(i,s),replaceInSourceString(t,i,n),n.splice(a,0,`layout(location = ${r}) out vec4 ${i};`),a+=1)}const c="czm_fragColor";findInSource("gl_FragColor",n)&&(setAdd(c,s),replaceInSourceString("gl_FragColor",c,n),n.splice(a,0,"layout(location = 0) out vec4 czm_fragColor;"),a+=1);const l=getVariablePreprocessorBranch(s,n),u={};for(r=0;r<n.length;r++){o=n[r];for(const e in l)if(l.hasOwnProperty(e)){new RegExp(`(layout)[^]+(out)[^]+(${e})[^]+`,"g").test(o)&&(u[o]=e)}}for(const e in u)if(u.hasOwnProperty(e)){const t=u[e];let i=n.indexOf(e);const r=l[t],o=r.length;for(let e=0;e<o;e++)n.splice(i,0,r[e]);i+=o+1;for(let e=o-1;e>=0;e--)n.splice(i,0,`#endif //${r[e]}`)}const d="WEBGL_2",h="#version 300 es";let p=!1;for(r=0;r<n.length;r++)if(/#version/.test(n[r])){n[r]=h,p=!0;break}return p||n.splice(0,0,h),n.splice(1,0,"#define WEBGL_2"),removeExtension("EXT_draw_buffers",d,n),removeExtension("EXT_frag_depth",d,n),removeExtension("OES_standard_derivatives",d,n),replaceInSourceString("texture2D","texture",n),replaceInSourceString("texture3D","texture",n),replaceInSourceString("textureCube","texture",n),replaceInSourceString("gl_FragDepthEXT","gl_FragDepth",n),t?replaceInSourceString("varying","in",n):(replaceInSourceString("attribute","in",n),replaceInSourceString("varying","out",n)),compileSource(n)}function replaceInSourceString(e,t,i){const n=new RegExp(`(^|[^\\w])(${e})($|[^\\w])`,"g"),r=i.length;for(let e=0;e<r;++e){const r=i[e];i[e]=r.replace(n,`$1${t}$3`)}}function replaceInSourceRegex(e,t,i){const n=i.length;for(let r=0;r<n;++r){const n=i[r];i[r]=n.replace(e,t)}}function findInSource(e,t){const i=new RegExp(`(^|[^\\w])(${e})($|[^\\w])`,"g"),n=t.length;for(let e=0;e<n;++e){const n=t[e];if(i.test(n))return!0}return!1}function compileSource(e){let t="";const i=e.length;for(let n=0;n<i;++n)t+=`${e[n]}\n`;return t}function setAdd(e,t){-1===t.indexOf(e)&&t.push(e)}function getVariablePreprocessorBranch(e,t){const i={},n=e.length,r=[];for(let o=0;o<t.length;++o){const a=t[o],s=/(#ifdef|#if)/g.test(a),c=/#else/g.test(a),l=/#endif/g.test(a);if(s)r.push(a);else if(c){let e=r[r.length-1].replace("ifdef","ifndef");/if/g.test(e)&&(e=e.replace(/(#if\s+)(\S*)([^]*)/,"$1!($2)$3")),r.pop(),r.push(e)}else if(l)r.pop();else if(!/layout/g.test(a))for(let t=0;t<n;++t){const n=e[t];-1!==a.indexOf(n)&&(defined(i[n])?i[n]=i[n].filter((function(e){return r.indexOf(e)>=0})):i[n]=r.slice())}}return i}function removeExtension(e,t,i){replaceInSourceRegex(new RegExp(`#extension\\s+GL_${e}\\s+:\\s+[a-zA-Z0-9]+\\s*$`,"g"),"",i),replaceInSourceString(`GL_${e}`,t,i)}ShaderProgram.prototype._bind=function(){initialize$d(this),this._gl.useProgram(this._program)},ShaderProgram.prototype._setUniforms=function(e,t,i){let n,r;if(defined(e)){const t=this._manualUniforms;for(n=t.length,r=0;r<n;++r){const i=t[r];i.value=e[i.name]()}}const o=this._automaticUniforms;for(n=o.length,r=0;r<n;++r){const e=o[r];e.uniform.value=e.automaticUniform.getValue(t)}const a=this._uniforms;for(n=a.length,r=0;r<n;++r)a[r].set();if(i){const e=this._gl,t=this._program;e.validateProgram(t)}},ShaderProgram.prototype.isDestroyed=function(){return!1},ShaderProgram.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)},ShaderProgram.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),destroyObject(this)};var czm_degreesPerRadian="const float czm_degreesPerRadian = 57.29577951308232;\n",czm_depthRange="const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n",czm_epsilon1="const float czm_epsilon1 = 0.1;\n",czm_epsilon2="const float czm_epsilon2 = 0.01;\n",czm_epsilon3="const float czm_epsilon3 = 0.001;\n",czm_epsilon4="const float czm_epsilon4 = 0.0001;\n",czm_epsilon5="const float czm_epsilon5 = 0.00001;\n",czm_epsilon6="const float czm_epsilon6 = 0.000001;\n",czm_epsilon7="const float czm_epsilon7 = 0.0000001;\n",czm_infinity="const float czm_infinity = 5906376272000.0;\n",czm_oneOverPi="const float czm_oneOverPi = 0.3183098861837907;\n",czm_oneOverTwoPi="const float czm_oneOverTwoPi = 0.15915494309189535;\n",czm_passCesium3DTile="const float czm_passCesium3DTile = 4.0;\n",czm_passCesium3DTileClassification="const float czm_passCesium3DTileClassification = 5.0;\n",czm_passCesium3DTileClassificationIgnoreShow="const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;\n",czm_passClassification="const float czm_passClassification = 7.0;\n",czm_passCompute="const float czm_passCompute = 1.0;\n",czm_passEnvironment="const float czm_passEnvironment = 0.0;\n",czm_passGlobe="const float czm_passGlobe = 2.0;\n",czm_passOpaque="const float czm_passOpaque = 7.0;\n",czm_passOverlay="const float czm_passOverlay = 9.0;\n",czm_passTerrainClassification="const float czm_passTerrainClassification = 3.0;\n",czm_passTranslucent="const float czm_passTranslucent = 8.0;\n",czm_pi="const float czm_pi = 3.141592653589793;\n",czm_piOverFour="const float czm_piOverFour = 0.7853981633974483;\n",czm_piOverSix="const float czm_piOverSix = 0.5235987755982988;\n",czm_piOverThree="const float czm_piOverThree = 1.0471975511965976;\n",czm_piOverTwo="const float czm_piOverTwo = 1.5707963267948966;\n",czm_radiansPerDegree="const float czm_radiansPerDegree = 0.017453292519943295;\n",czm_sceneMode2D="const float czm_sceneMode2D = 2.0;\n",czm_sceneMode3D="const float czm_sceneMode3D = 3.0;\n",czm_sceneModeColumbusView="const float czm_sceneModeColumbusView = 1.0;\n",czm_sceneModeMorphing="const float czm_sceneModeMorphing = 0.0;\n",czm_solarRadius="const float czm_solarRadius = 695500000.0;\n",czm_threePiOver2="const float czm_threePiOver2 = 4.71238898038469;\n",czm_twoPi="const float czm_twoPi = 6.283185307179586;\n",czm_webMercatorMaxLatitude="const float czm_webMercatorMaxLatitude = 1.4844222297453324;\n",czm_depthRangeStruct="struct czm_depthRangeStruct\n{\nfloat near;\nfloat far;\n};\n",czm_ellipsoid="struct czm_ellipsoid\n{\nvec3 center;\nvec3 radii;\nvec3 inverseRadii;\nvec3 inverseRadiiSquared;\n};\n",czm_material="struct czm_material\n{\nvec3 diffuse;\nfloat specular;\nfloat shininess;\nvec3 normal;\nvec3 emission;\nfloat alpha;\n};\n",czm_materialInput="struct czm_materialInput\n{\nfloat s;\nvec2 st;\nvec3 str;\nvec3 normalEC;\nmat3 tangentToEyeMatrix;\nvec3 positionToEyeEC;\nfloat height;\nfloat slope;\nfloat aspect;\n};\n",czm_modelMaterial="struct czm_modelMaterial {\nvec3 diffuse;\nfloat alpha;\nvec3 specular;\nfloat roughness;\nvec3 normalEC;\nfloat occlusion;\nvec3 emissive;\n};\n",czm_modelVertexOutput="struct czm_modelVertexOutput {\nvec3 positionMC;\nfloat pointSize;\n};\n",czm_pbrParameters="struct czm_pbrParameters\n{\nvec3 diffuseColor;\nfloat roughness;\nvec3 f0;\n};\n",czm_ray="struct czm_ray\n{\nvec3 origin;\nvec3 direction;\n};\n",czm_raySegment="struct czm_raySegment\n{\nfloat start;\nfloat stop;\n};\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n",czm_shadowParameters="struct czm_shadowParameters\n{\n#ifdef USE_CUBE_MAP_SHADOW\nvec3 texCoords;\n#else\nvec2 texCoords;\n#endif\nfloat depthBias;\nfloat depth;\nfloat nDotL;\nvec2 texelStepSize;\nfloat normalShadingSmooth;\nfloat darkness;\n};\n",czm_acesTonemapping="vec3 czm_acesTonemapping(vec3 color) {\nfloat g = 0.985;\nfloat a = 0.065;\nfloat b = 0.0001;\nfloat c = 0.433;\nfloat d = 0.238;\ncolor = (color * (color + a) - b) / (color * (g * color + c) + d);\ncolor = clamp(color, 0.0, 1.0);\nreturn color;\n}\n",czm_alphaWeight="float czm_alphaWeight(float a)\n{\nfloat z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nreturn pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n}\n",czm_antialias="vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\nfloat val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\nfloat val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\nval1 = val1 * (1.0 - val2);\nval1 = val1 * val1 * (3.0 - (2.0 * val1));\nval1 = pow(val1, 0.5);\nvec4 midColor = (color1 + color2) * 0.5;\nreturn mix(midColor, currentColor, val1);\n}\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\nreturn czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n",czm_approximateSphericalCoordinates="vec2 czm_approximateSphericalCoordinates(vec3 normal) {\nfloat latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\nfloat longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\nreturn vec2(latitudeApproximation, longitudeApproximation);\n}\n",czm_backFacing="bool czm_backFacing()\n{\nreturn gl_FrontFacing == false;\n}\n",czm_branchFreeTernary="float czm_branchFreeTernary(bool comparison, float a, float b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\n",czm_cascadeColor="vec4 czm_cascadeColor(vec4 weights)\n{\nreturn vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\nvec4(0.0, 1.0, 0.0, 1.0) * weights.y +\nvec4(0.0, 0.0, 1.0, 1.0) * weights.z +\nvec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n}\n",czm_cascadeDistance="uniform vec4 shadowMap_cascadeDistances;\nfloat czm_cascadeDistance(vec4 weights)\n{\nreturn dot(shadowMap_cascadeDistances, weights);\n}\n",czm_cascadeMatrix="uniform mat4 shadowMap_cascadeMatrices[4];\nmat4 czm_cascadeMatrix(vec4 weights)\n{\nreturn shadowMap_cascadeMatrices[0] * weights.x +\nshadowMap_cascadeMatrices[1] * weights.y +\nshadowMap_cascadeMatrices[2] * weights.z +\nshadowMap_cascadeMatrices[3] * weights.w;\n}\n",czm_cascadeWeights="uniform vec4 shadowMap_cascadeSplits[2];\nvec4 czm_cascadeWeights(float depthEye)\n{\nvec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\nvec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\nreturn near * far;\n}\n",czm_columbusViewMorph="vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\nvec3 p = mix(position2D.xyz, position3D.xyz, time);\nreturn vec4(p, 1.0);\n}\n",czm_computePosition="vec4 czm_computePosition();\n",czm_cosineAndSine="vec2 cordic(float angle)\n{\nvec2 vector = vec2(6.0725293500888267e-1, 0.0);\nfloat sense = (angle < 0.0) ? -1.0 : 1.0;\nmat2 rotation = mat2(1.0, sense, -sense, 1.0);\nvector = rotation * vector;\nangle -= sense * 7.8539816339744828e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfloat factor = sense * 5.0e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.6364760900080609e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.5e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4497866312686414e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.25e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2435499454676144e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.25e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.2418809995957350e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.125e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.1239833430268277e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.5625e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5623728620476831e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.8125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.8123410601011111e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.90625e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.9062301319669718e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.953125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9531225164788188e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.765625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.7656218955931946e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.8828125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.8828121119489829e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.44140625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4414062014936177e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.220703125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2207031189367021e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.103515625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.1035156174208773e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.0517578125e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.0517578115526096e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.52587890625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5258789061315762e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.62939453125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.6293945311019700e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.814697265625e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.8146972656064961e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.9073486328125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9073486328101870e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.5367431640625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.5367431640596084e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.76837158203125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.7683715820308884e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.384185791015625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.3841857910155797e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.1920928955078125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nreturn vector;\n}\nvec2 czm_cosineAndSine(float angle)\n{\nif (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n{\nif (angle < 0.0)\n{\nreturn -cordic(angle + czm_pi);\n}\nelse\n{\nreturn -cordic(angle - czm_pi);\n}\n}\nelse\n{\nreturn cordic(angle);\n}\n}\n",czm_decompressTextureCoordinates="vec2 czm_decompressTextureCoordinates(float encoded)\n{\nfloat temp = encoded / 4096.0;\nfloat xZeroTo4095 = floor(temp);\nfloat stx = xZeroTo4095 / 4095.0;\nfloat sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\nreturn vec2(stx, sty);\n}\n",czm_defaultPbrMaterial="czm_pbrParameters czm_defaultPbrMaterial()\n{\nczm_pbrParameters results;\nresults.diffuseColor = vec3(1.0);\nresults.roughness = 1.0;\nconst vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\nresults.f0 = REFLECTANCE_DIELECTRIC;\nreturn results;\n}\n",czm_depthClamp="#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\nvec4 czm_depthClamp(vec4 coords)\n{\n#ifndef LOG_DEPTH\n#ifdef GL_EXT_frag_depth\nv_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\ncoords.z = 0.0;\n#else\ncoords.z = min(coords.z, coords.w);\n#endif\n#endif\nreturn coords;\n}\n",czm_eastNorthUpToEyeCoordinates="mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\nvec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));\nvec3 tangentEC = normalize(czm_normal3D * tangentMC);\nvec3 bitangentEC = normalize(cross(normalEC, tangentEC));\nreturn mat3(\ntangentEC.x, tangentEC.y, tangentEC.z,\nbitangentEC.x, bitangentEC.y, bitangentEC.z,\nnormalEC.x, normalEC.y, normalEC.z);\n}\n",czm_ellipsoidContainsPoint="bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)\n{\nvec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\nreturn (dot(scaled, scaled) <= 1.0);\n}\n",czm_ellipsoidWgs84TextureCoordinates="vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\nreturn vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n",czm_equalsEpsilon="bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\nreturn (abs(left - right) <= epsilon);\n}\n",czm_eyeOffset="vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\nvec4 p = positionEC;\nvec4 zEyeOffset = normalize(p) * eyeOffset.z;\np.xy += eyeOffset.xy + zEyeOffset.xy;\np.z += zEyeOffset.z;\nreturn p;\n}\n",czm_eyeToWindowCoordinates="vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\nvec4 q = czm_projection * positionEC;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_fastApproximateAtan="float czm_fastApproximateAtan(float x) {\nreturn x * (-0.1784 * x - 0.0663 * x * x + 1.0301);\n}\nfloat czm_fastApproximateAtan(float x, float y) {\nfloat t = abs(x);\nfloat opposite = abs(y);\nfloat adjacent = max(t, opposite);\nopposite = min(t, opposite);\nt = czm_fastApproximateAtan(opposite / adjacent);\nt = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);\nt = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);\nt = czm_branchFreeTernary(y < 0.0, -t, t);\nreturn t;\n}\n",czm_fog="vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-(scalar * scalar));\nreturn mix(color, fogColor, fog);\n}\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));\nreturn mix(color, fogColor, fog);\n}\n",czm_gammaCorrect="vec3 czm_gammaCorrect(vec3 color) {\n#ifdef HDR\ncolor = pow(color, vec3(czm_gamma));\n#endif\nreturn color;\n}\nvec4 czm_gammaCorrect(vec4 color) {\n#ifdef HDR\ncolor.rgb = pow(color.rgb, vec3(czm_gamma));\n#endif\nreturn color;\n}\n",czm_geodeticSurfaceNormal="vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\nreturn normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n",czm_getDefaultMaterial="czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\nczm_material material;\nmaterial.diffuse = vec3(0.0);\nmaterial.specular = 0.0;\nmaterial.shininess = 1.0;\nmaterial.normal = materialInput.normalEC;\nmaterial.emission = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\n",czm_getLambertDiffuse="float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\nreturn max(dot(lightDirectionEC, normalEC), 0.0);\n}\n",czm_getSpecular="float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\nvec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\nfloat specular = max(dot(toReflectedLight, toEyeEC), 0.0);\nreturn pow(specular, max(shininess, czm_epsilon2));\n}\n",czm_getWaterNoise="vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\nfloat cosAngle = cos(angleInRadians);\nfloat sinAngle = sin(angleInRadians);\nvec2 s0 = vec2(1.0/17.0, 0.0);\nvec2 s1 = vec2(-1.0/29.0, 0.0);\nvec2 s2 = vec2(1.0/101.0, 1.0/59.0);\nvec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\ns0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\ns1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\ns2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\ns3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\nvec2 uv0 = (uv/103.0) + (time * s0);\nvec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\nvec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\nvec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\nuv0 = fract(uv0);\nuv1 = fract(uv1);\nuv2 = fract(uv2);\nuv3 = fract(uv3);\nvec4 noise = (texture2D(normalMap, uv0)) +\n(texture2D(normalMap, uv1)) +\n(texture2D(normalMap, uv2)) +\n(texture2D(normalMap, uv3));\nreturn ((noise / 4.0) - 0.5) * 2.0;\n}\n",czm_HSBToRGB="const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 czm_HSBToRGB(vec3 hsb)\n{\nvec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\nreturn hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n}\n",czm_HSLToRGB="vec3 hueToRGB(float hue)\n{\nfloat r = abs(hue * 6.0 - 3.0) - 1.0;\nfloat g = 2.0 - abs(hue * 6.0 - 2.0);\nfloat b = 2.0 - abs(hue * 6.0 - 4.0);\nreturn clamp(vec3(r, g, b), 0.0, 1.0);\n}\nvec3 czm_HSLToRGB(vec3 hsl)\n{\nvec3 rgb = hueToRGB(hsl.x);\nfloat c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\nreturn (rgb - 0.5) * c + hsl.z;\n}\n",czm_hue="vec3 czm_hue(vec3 rgb, float adjustment)\n{\nconst mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n0.595716, -0.274453, -0.321263,\n0.211456, -0.522591, 0.311135);\nconst mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n1.0, -0.2721, -0.6474,\n1.0, -1.107, 1.7046);\nvec3 yiq = toYIQ * rgb;\nfloat hue = atan(yiq.z, yiq.y) + adjustment;\nfloat chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\nvec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\nreturn toRGB * color;\n}\n",czm_inverseGamma="vec3 czm_inverseGamma(vec3 color) {\nreturn pow(color, vec3(1.0 / czm_gamma));\n}\n",czm_isEmpty="bool czm_isEmpty(czm_raySegment interval)\n{\nreturn (interval.stop < 0.0);\n}\n",czm_isFull="bool czm_isFull(czm_raySegment interval)\n{\nreturn (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n",czm_latitudeToWebMercatorFraction="float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n{\nfloat sinLatitude = sin(latitude);\nfloat mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\nreturn (mercatorY - southMercatorY) * oneOverMercatorHeight;\n}\n",czm_linearToSrgb="vec3 czm_linearToSrgb(vec3 linearIn)\n{\nreturn pow(linearIn, vec3(1.0/2.2));\n}\nvec4 czm_linearToSrgb(vec4 linearIn)\n{\nvec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));\nreturn vec4(srgbOut, linearIn.a);\n}\n",czm_lineDistance="float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {\nreturn abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);\n}\n",czm_luminance="float czm_luminance(vec3 rgb)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nreturn dot(rgb, W);\n}\n",czm_metersPerPixel="float czm_metersPerPixel(vec4 positionEC, float pixelRatio)\n{\nfloat width = czm_viewport.z;\nfloat height = czm_viewport.w;\nfloat pixelWidth;\nfloat pixelHeight;\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nif (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n{\nfloat frustumWidth = right - left;\nfloat frustumHeight = top - bottom;\npixelWidth = frustumWidth / width;\npixelHeight = frustumHeight / height;\n}\nelse\n{\nfloat distanceToPixel = -positionEC.z;\nfloat inverseNear = 1.0 / czm_currentFrustum.x;\nfloat tanTheta = top * inverseNear;\npixelHeight = 2.0 * distanceToPixel * tanTheta / height;\ntanTheta = right * inverseNear;\npixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n}\nreturn max(pixelWidth, pixelHeight) * pixelRatio;\n}\nfloat czm_metersPerPixel(vec4 positionEC)\n{\nreturn czm_metersPerPixel(positionEC, czm_pixelRatio);\n}\n",czm_modelToWindowCoordinates="vec4 czm_modelToWindowCoordinates(vec4 position)\n{\nvec4 q = czm_modelViewProjection * position;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_multiplyWithColorBalance="vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 target = left * right;\nfloat leftLuminance = dot(left, W);\nfloat rightLuminance = dot(right, W);\nfloat targetLuminance = dot(target, W);\nreturn ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n",czm_nearFarScalar="float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n{\nfloat valueAtMin = nearFarScalar.y;\nfloat valueAtMax = nearFarScalar.w;\nfloat nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\nfloat farDistanceSq = nearFarScalar.z * nearFarScalar.z;\nfloat t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\nt = pow(clamp(t, 0.0, 1.0), 0.2);\nreturn mix(valueAtMin, valueAtMax, t);\n}\n",czm_octDecode="vec3 czm_octDecode(vec2 encoded, float range)\n{\nif (encoded.x == 0.0 && encoded.y == 0.0) {\nreturn vec3(0.0, 0.0, 0.0);\n}\nencoded = encoded / range * 2.0 - 1.0;\nvec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\nif (v.z < 0.0)\n{\nv.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n}\nreturn normalize(v);\n}\nvec3 czm_octDecode(vec2 encoded)\n{\nreturn czm_octDecode(encoded, 255.0);\n}\nvec3 czm_octDecode(float encoded)\n{\nfloat temp = encoded / 256.0;\nfloat x = floor(temp);\nfloat y = (temp - x) * 256.0;\nreturn czm_octDecode(vec2(x, y));\n}\nvoid czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n{\nfloat temp = encoded.x / 65536.0;\nfloat x = floor(temp);\nfloat encodedFloat1 = (temp - x) * 65536.0;\ntemp = encoded.y / 65536.0;\nfloat y = floor(temp);\nfloat encodedFloat2 = (temp - y) * 65536.0;\nvector1 = czm_octDecode(encodedFloat1);\nvector2 = czm_octDecode(encodedFloat2);\nvector3 = czm_octDecode(vec2(x, y));\n}\n",czm_packDepth="vec4 czm_packDepth(float depth)\n{\nvec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\nenc = fract(enc);\nenc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\nreturn enc;\n}\n",czm_pbrLighting="vec3 lambertianDiffuse(vec3 diffuseColor)\n{\nreturn diffuseColor / czm_pi;\n}\nvec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)\n{\nreturn f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\nfloat smithVisibilityG1(float NdotV, float roughness)\n{\nfloat k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\nreturn NdotV / (NdotV * (1.0 - k) + k);\n}\nfloat smithVisibilityGGX(float roughness, float NdotL, float NdotV)\n{\nreturn (\nsmithVisibilityG1(NdotL, roughness) *\nsmithVisibilityG1(NdotV, roughness)\n);\n}\nfloat GGX(float roughness, float NdotH)\n{\nfloat roughnessSquared = roughness * roughness;\nfloat f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\nreturn roughnessSquared / (czm_pi * f * f);\n}\nvec3 czm_pbrLighting(\nvec3 positionEC,\nvec3 normalEC,\nvec3 lightDirectionEC,\nvec3 lightColorHdr,\nczm_pbrParameters pbrParameters\n)\n{\nvec3 v = -normalize(positionEC);\nvec3 l = normalize(lightDirectionEC);\nvec3 h = normalize(v + l);\nvec3 n = normalEC;\nfloat NdotL = clamp(dot(n, l), 0.001, 1.0);\nfloat NdotV = abs(dot(n, v)) + 0.001;\nfloat NdotH = clamp(dot(n, h), 0.0, 1.0);\nfloat LdotH = clamp(dot(l, h), 0.0, 1.0);\nfloat VdotH = clamp(dot(v, h), 0.0, 1.0);\nvec3 f0 = pbrParameters.f0;\nfloat reflectance = max(max(f0.r, f0.g), f0.b);\nvec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\nvec3 F = fresnelSchlick2(f0, f90, VdotH);\nfloat alpha = pbrParameters.roughness;\nfloat G = smithVisibilityGGX(alpha, NdotL, NdotV);\nfloat D = GGX(alpha, NdotH);\nvec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\nvec3 diffuseColor = pbrParameters.diffuseColor;\nvec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\nreturn (diffuseContribution + specularContribution) * NdotL * lightColorHdr;\n}\n",czm_pbrMetallicRoughnessMaterial="czm_pbrParameters czm_pbrMetallicRoughnessMaterial(\nvec3 baseColor,\nfloat metallic,\nfloat roughness\n)\n{\nczm_pbrParameters results;\nroughness = clamp(roughness, 0.0, 1.0);\nresults.roughness = roughness * roughness;\nmetallic = clamp(metallic, 0.0, 1.0);\nconst vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\nvec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);\nresults.f0 = f0;\nresults.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);\nreturn results;\n}\n",czm_pbrSpecularGlossinessMaterial="czm_pbrParameters czm_pbrSpecularGlossinessMaterial(\nvec3 diffuse,\nvec3 specular,\nfloat glossiness\n)\n{\nczm_pbrParameters results;\nfloat roughness = 1.0 - glossiness;\nresults.roughness = roughness * roughness;\nresults.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));\nresults.f0 = specular;\nreturn results;\n}\n",czm_phong="float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\nreturn czm_getLambertDiffuse(lightDirectionEC, material.normal);\n}\nfloat czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\nreturn czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\nvec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n}\nfloat specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\nvec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);\nfloat specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\nvec3 ambient = vec3(0.0);\nvec3 color = ambient + material.emission;\ncolor += material.diffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\n",czm_planeDistance="float czm_planeDistance(vec4 plane, vec3 point) {\nreturn (dot(plane.xyz, point) + plane.w);\n}\nfloat czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {\nreturn (dot(planeNormal, point) + planeDistance);\n}\n",czm_pointAlongRay="vec3 czm_pointAlongRay(czm_ray ray, float time)\n{\nreturn ray.origin + (time * ray.direction);\n}\n",czm_rayEllipsoidIntersectionInterval="czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)\n{\nvec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\nvec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\nq = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;\nfloat q2 = dot(q, q);\nfloat qw = dot(q, w);\nif (q2 > 1.0)\n{\nif (qw >= 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nelse\n{\nfloat qw2 = qw * qw;\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nif (qw2 < product)\n{\nreturn czm_emptyRaySegment;\n}\nelse if (qw2 > product)\n{\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nfloat root0 = temp / w2;\nfloat root1 = difference / temp;\nif (root0 < root1)\n{\nczm_raySegment i = czm_raySegment(root0, root1);\nreturn i;\n}\nelse\n{\nczm_raySegment i = czm_raySegment(root1, root0);\nreturn i;\n}\n}\nelse\n{\nfloat root = sqrt(difference / w2);\nczm_raySegment i = czm_raySegment(root, root);\nreturn i;\n}\n}\n}\nelse if (q2 < 1.0)\n{\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nczm_raySegment i = czm_raySegment(0.0, temp / w2);\nreturn i;\n}\nelse\n{\nif (qw < 0.0)\n{\nfloat w2 = dot(w, w);\nczm_raySegment i = czm_raySegment(0.0, -qw / w2);\nreturn i;\n}\nelse\n{\nreturn czm_emptyRaySegment;\n}\n}\n}\n",czm_readDepth="float czm_readDepth(sampler2D depthTexture, vec2 texCoords)\n{\nreturn czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);\n}\n",czm_readNonPerspective="float czm_readNonPerspective(float value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec2 czm_readNonPerspective(vec2 value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec3 czm_readNonPerspective(vec3 value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec4 czm_readNonPerspective(vec4 value, float oneOverW) {\nreturn value * oneOverW;\n}\n",czm_reverseLogDepth="float czm_reverseLogDepth(float logZ)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nfloat log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;\nfloat depthFromNear = pow(2.0, log2Depth) - 1.0;\nreturn far * (1.0 - near / (depthFromNear + near)) / (far - near);\n#endif\nreturn logZ;\n}\n",czm_RGBToHSB="const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec3 czm_RGBToHSB(vec3 rgb)\n{\nvec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\nvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\nfloat d = q.x - min(q.w, q.y);\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n}\n",czm_RGBToHSL="vec3 RGBtoHCV(vec3 rgb)\n{\nvec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\nvec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\nfloat c = q.x - min(q.w, q.y);\nfloat h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\nreturn vec3(h, c, q.x);\n}\nvec3 czm_RGBToHSL(vec3 rgb)\n{\nvec3 hcv = RGBtoHCV(rgb);\nfloat l = hcv.z - hcv.y * 0.5;\nfloat s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\nreturn vec3(hcv.x, s, l);\n}\n",czm_RGBToXYZ="vec3 czm_RGBToXYZ(vec3 rgb)\n{\nconst mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n0.3576, 0.7152, 0.1192,\n0.1805, 0.0722, 0.9505);\nvec3 xyz = RGB2XYZ * rgb;\nvec3 Yxy;\nYxy.r = xyz.g;\nfloat temp = dot(vec3(1.0), xyz);\nYxy.gb = xyz.rg / temp;\nreturn Yxy;\n}\n",czm_round="float czm_round(float value) {\nreturn floor(value + 0.5);\n}\nvec2 czm_round(vec2 value) {\nreturn floor(value + 0.5);\n}\nvec3 czm_round(vec3 value) {\nreturn floor(value + 0.5);\n}\nvec4 czm_round(vec4 value) {\nreturn floor(value + 0.5);\n}\n",czm_sampleOctahedralProjection="vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)\n{\ndirection /= dot(vec3(1.0), abs(direction));\nvec2 rev = abs(direction.zx) - vec2(1.0);\nvec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,\ndirection.z < 0.0 ? rev.y : -rev.y);\nvec2 uv = direction.y < 0.0 ? neg : direction.xz;\nvec2 coord = 0.5 * uv + vec2(0.5);\nvec2 pixel = 1.0 / textureSize;\nif (lod > 0.0)\n{\nfloat scale = 1.0 / pow(2.0, lod);\nfloat offset = ((textureSize.y + 1.0) / textureSize.x);\ncoord.x *= offset;\ncoord *= scale;\ncoord.x += offset + pixel.x;\ncoord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;\n}\nelse\n{\ncoord.x *= (textureSize.y / textureSize.x);\n}\n#ifndef OES_texture_float_linear\nvec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;\nvec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;\nvec3 color3 = texture2D(projectedMap, coord + pixel).rgb;\nvec3 color4 = texture2D(projectedMap, coord).rgb;\nvec2 texturePosition = coord * textureSize;\nfloat fu = fract(texturePosition.x);\nfloat fv = fract(texturePosition.y);\nvec3 average1 = mix(color4, color2, fu);\nvec3 average2 = mix(color1, color3, fu);\nvec3 color = mix(average1, average2, fv);\n#else\nvec3 color = texture2D(projectedMap, coord).rgb;\n#endif\nreturn color;\n}\nvec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {\nfloat currentLod = floor(lod + 0.5);\nfloat nextLod = min(currentLod + 1.0, maxLod);\nvec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);\nvec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);\nreturn mix(colorNextLod, colorCurrentLod, nextLod - lod);\n}\n",czm_saturation="vec3 czm_saturation(vec3 rgb, float adjustment)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 intensity = vec3(dot(rgb, W));\nreturn mix(intensity, rgb, adjustment);\n}\n",czm_shadowDepthCompare="float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)\n{\nreturn czm_unpackDepth(textureCube(shadowMap, d));\n}\nfloat czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)\n{\n#ifdef USE_SHADOW_DEPTH_TEXTURE\nreturn texture2D(shadowMap, uv).r;\n#else\nreturn czm_unpackDepth(texture2D(shadowMap, uv));\n#endif\n}\nfloat czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\nfloat czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n",czm_shadowVisibility="float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n{\n#ifdef USE_NORMAL_SHADING\n#ifdef USE_NORMAL_SHADING_SMOOTH\nfloat strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n#else\nfloat strength = step(0.0, nDotL);\n#endif\nvisibility *= strength;\n#endif\nvisibility = max(visibility, darkness);\nreturn visibility;\n}\n#ifdef USE_CUBE_MAP_SHADOW\nfloat czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec3 uvw = shadowParameters.texCoords;\ndepth -= depthBias;\nfloat visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#else\nfloat czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec2 uv = shadowParameters.texCoords;\ndepth -= depthBias;\n#ifdef USE_SOFT_SHADOWS\nvec2 texelStepSize = shadowParameters.texelStepSize;\nfloat radius = 1.0;\nfloat dx0 = -texelStepSize.x * radius;\nfloat dy0 = -texelStepSize.y * radius;\nfloat dx1 = texelStepSize.x * radius;\nfloat dy1 = texelStepSize.y * radius;\nfloat visibility = (\nczm_shadowDepthCompare(shadowMap, uv, depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n) * (1.0 / 9.0);\n#else\nfloat visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n#endif\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#endif\n",czm_signNotZero="float czm_signNotZero(float value)\n{\nreturn value >= 0.0 ? 1.0 : -1.0;\n}\nvec2 czm_signNotZero(vec2 value)\n{\nreturn vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n}\nvec3 czm_signNotZero(vec3 value)\n{\nreturn vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n}\nvec4 czm_signNotZero(vec4 value)\n{\nreturn vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n}\n",czm_sphericalHarmonics="vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])\n{\nvec3 L00 = coefficients[0];\nvec3 L1_1 = coefficients[1];\nvec3 L10 = coefficients[2];\nvec3 L11 = coefficients[3];\nvec3 L2_2 = coefficients[4];\nvec3 L2_1 = coefficients[5];\nvec3 L20 = coefficients[6];\nvec3 L21 = coefficients[7];\nvec3 L22 = coefficients[8];\nfloat x = normal.x;\nfloat y = normal.y;\nfloat z = normal.z;\nreturn\nL00\n+ L1_1 * y\n+ L10 * z\n+ L11 * x\n+ L2_2 * (y * x)\n+ L2_1 * (y * z)\n+ L20 * (3.0 * z * z - 1.0)\n+ L21 * (z * x)\n+ L22 * (x * x - y * y);\n}\n",czm_srgbToLinear="vec3 czm_srgbToLinear(vec3 srgbIn)\n{\nreturn pow(srgbIn, vec3(2.2));\n}\nvec4 czm_srgbToLinear(vec4 srgbIn)\n{\nvec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\nreturn vec4(linearOut, srgbIn.a);\n}\n",czm_tangentToEyeSpaceMatrix="mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n{\nvec3 normal = normalize(normalEC);\nvec3 tangent = normalize(tangentEC);\nvec3 bitangent = normalize(bitangentEC);\nreturn mat3(tangent.x , tangent.y , tangent.z,\nbitangent.x, bitangent.y, bitangent.z,\nnormal.x , normal.y , normal.z);\n}\n",czm_transformPlane="vec4 czm_transformPlane(vec4 plane, mat4 transform) {\nvec4 transformedPlane = transform * plane;\nfloat normalMagnitude = length(transformedPlane.xyz);\nreturn transformedPlane / normalMagnitude;\n}\n",czm_translateRelativeToEye="vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\nvec3 highDifference = high - czm_encodedCameraPositionMCHigh;\nvec3 lowDifference = low - czm_encodedCameraPositionMCLow;\nreturn vec4(highDifference + lowDifference, 1.0);\n}\n",czm_translucentPhong="vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n}\ndiffuse = clamp(diffuse, 0.0, 1.0);\nfloat specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\n",czm_transpose="mat2 czm_transpose(mat2 matrix)\n{\nreturn mat2(\nmatrix[0][0], matrix[1][0],\nmatrix[0][1], matrix[1][1]);\n}\nmat3 czm_transpose(mat3 matrix)\n{\nreturn mat3(\nmatrix[0][0], matrix[1][0], matrix[2][0],\nmatrix[0][1], matrix[1][1], matrix[2][1],\nmatrix[0][2], matrix[1][2], matrix[2][2]);\n}\nmat4 czm_transpose(mat4 matrix)\n{\nreturn mat4(\nmatrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\nmatrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\nmatrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\nmatrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n",czm_unpackDepth="float czm_unpackDepth(vec4 packedDepth)\n{\nreturn dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n}\n",czm_unpackFloat="float czm_unpackFloat(vec4 packedFloat)\n{\npackedFloat = floor(packedFloat * 255.0 + 0.5);\nfloat sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;\nfloat exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0;\nif (exponent == -127.0)\n{\nreturn 0.0;\n}\nfloat mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);\nfloat result = sign * exp2(exponent - 23.0) * mantissa;\nreturn result;\n}\n",czm_unpackUint="int czm_unpackUint(float packedValue) {\nfloat rounded = czm_round(packedValue * 255.0);\nreturn int(rounded);\n}\nint czm_unpackUint(vec2 packedValue) {\nvec2 rounded = czm_round(packedValue * 255.0);\nreturn int(dot(rounded, vec2(1.0, 256.0)));\n}\nint czm_unpackUint(vec3 packedValue) {\nvec3 rounded = czm_round(packedValue * 255.0);\nreturn int(dot(rounded, vec3(1.0, 256.0, 65536.0)));\n}\nint czm_unpackUint(vec4 packedValue) {\nvec4 rounded = czm_round(packedValue * 255.0);\nreturn int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0)));\n}\n",czm_vertexLogDepth="#ifdef LOG_DEPTH\nvarying float v_depthFromNearPlusOne;\n#ifdef SHADOW_MAP\nvarying vec3 v_logPositionEC;\n#endif\n#endif\nvec4 czm_updatePositionDepth(vec4 coords) {\n#if defined(LOG_DEPTH)\n#ifdef SHADOW_MAP\nvec3 logPositionEC = (czm_inverseProjection * coords).xyz;\nv_logPositionEC = logPositionEC;\n#endif\ncoords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;\n#endif\nreturn coords;\n}\nvoid czm_vertexLogDepth()\n{\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;\ngl_Position = czm_updatePositionDepth(gl_Position);\n#endif\n}\nvoid czm_vertexLogDepth(vec4 clipCoords)\n{\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;\nczm_updatePositionDepth(clipCoords);\n#endif\n}\n",czm_windowToEyeCoordinates="vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\nfloat x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\nfloat y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\nfloat z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nvec4 q = vec4(x, y, z, 1.0);\nq /= fragmentCoordinate.w;\nif (!(czm_inverseProjection == mat4(0.0)))\n{\nq = czm_inverseProjection * q;\n}\nelse\n{\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nq.x = (q.x * (right - left) + left + right) * 0.5;\nq.y = (q.y * (top - bottom) + bottom + top) * 0.5;\nq.z = (q.z * (near - far) - near - far) * 0.5;\nq.w = 1.0;\n}\nreturn q;\n}\nvec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nfloat log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;\nfloat depthFromNear = pow(2.0, log2Depth) - 1.0;\nfloat depthFromCamera = depthFromNear + near;\nvec4 windowCoord = vec4(fragmentCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\neyeCoordinate.w = 1.0 / depthFromCamera;\nreturn eyeCoordinate;\n#else\nvec4 windowCoord = vec4(fragmentCoordinateXY, depthOrLogDepth, 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\n#endif\nreturn eyeCoordinate;\n}\n",czm_writeDepthClamp="#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\nvoid czm_writeDepthClamp()\n{\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\ngl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);\n#endif\n}\n",czm_writeLogDepth="#ifdef LOG_DEPTH\nvarying float v_depthFromNearPlusOne;\n#ifdef POLYGON_OFFSET\nuniform vec2 u_polygonOffset;\n#endif\n#endif\nvoid czm_writeLogDepth(float depth)\n{\n#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH)\nif (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {\ndiscard;\n}\n#ifdef POLYGON_OFFSET\nfloat factor = u_polygonOffset[0];\nfloat units = u_polygonOffset[1];\n#ifdef GL_OES_standard_derivatives\nfloat x = dFdx(depth);\nfloat y = dFdy(depth);\nfloat m = sqrt(x * x + y * y);\ndepth += m * factor;\n#endif\n#endif\ngl_FragDepthEXT = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;\n#ifdef POLYGON_OFFSET\ngl_FragDepthEXT += czm_epsilon7 * units;\n#endif\n#endif\n}\nvoid czm_writeLogDepth() {\n#ifdef LOG_DEPTH\nczm_writeLogDepth(v_depthFromNearPlusOne);\n#endif\n}\n",czm_writeNonPerspective="float czm_writeNonPerspective(float value, float w) {\nreturn value * w;\n}\nvec2 czm_writeNonPerspective(vec2 value, float w) {\nreturn value * w;\n}\nvec3 czm_writeNonPerspective(vec3 value, float w) {\nreturn value * w;\n}\nvec4 czm_writeNonPerspective(vec4 value, float w) {\nreturn value * w;\n}\n",czm_XYZToRGB="vec3 czm_XYZToRGB(vec3 Yxy)\n{\nconst mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n-1.5371, 1.8760, -0.2040,\n-0.4985, 0.0416, 1.0572);\nvec3 xyz;\nxyz.r = Yxy.r * Yxy.g / Yxy.b;\nxyz.g = Yxy.r;\nxyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\nreturn XYZ2RGB * xyz;\n}\n",CzmBuiltins={czm_degreesPerRadian:czm_degreesPerRadian,czm_depthRange:czm_depthRange,czm_epsilon1:czm_epsilon1,czm_epsilon2:czm_epsilon2,czm_epsilon3:czm_epsilon3,czm_epsilon4:czm_epsilon4,czm_epsilon5:czm_epsilon5,czm_epsilon6:czm_epsilon6,czm_epsilon7:czm_epsilon7,czm_infinity:czm_infinity,czm_oneOverPi:czm_oneOverPi,czm_oneOverTwoPi:czm_oneOverTwoPi,czm_passCesium3DTile:czm_passCesium3DTile,czm_passCesium3DTileClassification:czm_passCesium3DTileClassification,czm_passCesium3DTileClassificationIgnoreShow:czm_passCesium3DTileClassificationIgnoreShow,czm_passClassification:czm_passClassification,czm_passCompute:czm_passCompute,czm_passEnvironment:czm_passEnvironment,czm_passGlobe:czm_passGlobe,czm_passOpaque:czm_passOpaque,czm_passOverlay:czm_passOverlay,czm_passTerrainClassification:czm_passTerrainClassification,czm_passTranslucent:czm_passTranslucent,czm_pi:czm_pi,czm_piOverFour:czm_piOverFour,czm_piOverSix:czm_piOverSix,czm_piOverThree:czm_piOverThree,czm_piOverTwo:czm_piOverTwo,czm_radiansPerDegree:czm_radiansPerDegree,czm_sceneMode2D:czm_sceneMode2D,czm_sceneMode3D:czm_sceneMode3D,czm_sceneModeColumbusView:czm_sceneModeColumbusView,czm_sceneModeMorphing:czm_sceneModeMorphing,czm_solarRadius:czm_solarRadius,czm_threePiOver2:czm_threePiOver2,czm_twoPi:czm_twoPi,czm_webMercatorMaxLatitude:czm_webMercatorMaxLatitude,czm_depthRangeStruct:czm_depthRangeStruct,czm_ellipsoid:czm_ellipsoid,czm_material:czm_material,czm_materialInput:czm_materialInput,czm_modelMaterial:czm_modelMaterial,czm_modelVertexOutput:czm_modelVertexOutput,czm_pbrParameters:czm_pbrParameters,czm_ray:czm_ray,czm_raySegment:czm_raySegment,czm_shadowParameters:czm_shadowParameters,czm_acesTonemapping:czm_acesTonemapping,czm_alphaWeight:czm_alphaWeight,czm_antialias:czm_antialias,czm_approximateSphericalCoordinates:czm_approximateSphericalCoordinates,czm_backFacing:czm_backFacing,czm_branchFreeTernary:czm_branchFreeTernary,czm_cascadeColor:czm_cascadeColor,czm_cascadeDistance:czm_cascadeDistance,czm_cascadeMatrix:czm_cascadeMatrix,czm_cascadeWeights:czm_cascadeWeights,czm_columbusViewMorph:czm_columbusViewMorph,czm_computePosition:czm_computePosition,czm_cosineAndSine:czm_cosineAndSine,czm_decompressTextureCoordinates:czm_decompressTextureCoordinates,czm_defaultPbrMaterial:czm_defaultPbrMaterial,czm_depthClamp:czm_depthClamp,czm_eastNorthUpToEyeCoordinates:czm_eastNorthUpToEyeCoordinates,czm_ellipsoidContainsPoint:czm_ellipsoidContainsPoint,czm_ellipsoidWgs84TextureCoordinates:czm_ellipsoidWgs84TextureCoordinates,czm_equalsEpsilon:czm_equalsEpsilon,czm_eyeOffset:czm_eyeOffset,czm_eyeToWindowCoordinates:czm_eyeToWindowCoordinates,czm_fastApproximateAtan:czm_fastApproximateAtan,czm_fog:czm_fog,czm_gammaCorrect:czm_gammaCorrect,czm_geodeticSurfaceNormal:czm_geodeticSurfaceNormal,czm_getDefaultMaterial:czm_getDefaultMaterial,czm_getLambertDiffuse:czm_getLambertDiffuse,czm_getSpecular:czm_getSpecular,czm_getWaterNoise:czm_getWaterNoise,czm_HSBToRGB:czm_HSBToRGB,czm_HSLToRGB:czm_HSLToRGB,czm_hue:czm_hue,czm_inverseGamma:czm_inverseGamma,czm_isEmpty:czm_isEmpty,czm_isFull:czm_isFull,czm_latitudeToWebMercatorFraction:czm_latitudeToWebMercatorFraction,czm_linearToSrgb:czm_linearToSrgb,czm_lineDistance:czm_lineDistance,czm_luminance:czm_luminance,czm_metersPerPixel:czm_metersPerPixel,czm_modelToWindowCoordinates:czm_modelToWindowCoordinates,czm_multiplyWithColorBalance:czm_multiplyWithColorBalance,czm_nearFarScalar:czm_nearFarScalar,czm_octDecode:czm_octDecode,czm_packDepth:czm_packDepth,czm_pbrLighting:czm_pbrLighting,czm_pbrMetallicRoughnessMaterial:czm_pbrMetallicRoughnessMaterial,czm_pbrSpecularGlossinessMaterial:czm_pbrSpecularGlossinessMaterial,czm_phong:czm_phong,czm_planeDistance:czm_planeDistance,czm_pointAlongRay:czm_pointAlongRay,czm_rayEllipsoidIntersectionInterval:czm_rayEllipsoidIntersectionInterval,czm_readDepth:czm_readDepth,czm_readNonPerspective:czm_readNonPerspective,czm_reverseLogDepth:czm_reverseLogDepth,czm_RGBToHSB:czm_RGBToHSB,czm_RGBToHSL:czm_RGBToHSL,czm_RGBToXYZ:czm_RGBToXYZ,czm_round:czm_round,czm_sampleOctahedralProjection:czm_sampleOctahedralProjection,czm_saturation:czm_saturation,czm_shadowDepthCompare:czm_shadowDepthCompare,czm_shadowVisibility:czm_shadowVisibility,czm_signNotZero:czm_signNotZero,czm_sphericalHarmonics:czm_sphericalHarmonics,czm_srgbToLinear:czm_srgbToLinear,czm_tangentToEyeSpaceMatrix:czm_tangentToEyeSpaceMatrix,czm_transformPlane:czm_transformPlane,czm_translateRelativeToEye:czm_translateRelativeToEye,czm_translucentPhong:czm_translucentPhong,czm_transpose:czm_transpose,czm_unpackDepth:czm_unpackDepth,czm_unpackFloat:czm_unpackFloat,czm_unpackUint:czm_unpackUint,czm_vertexLogDepth:czm_vertexLogDepth,czm_windowToEyeCoordinates:czm_windowToEyeCoordinates,czm_writeDepthClamp:czm_writeDepthClamp,czm_writeLogDepth:czm_writeLogDepth,czm_writeNonPerspective:czm_writeNonPerspective,czm_XYZToRGB:czm_XYZToRGB};function removeComments(e){return(e=e.replace(/\/\/.*/g,"")).replace(/\/\*\*[\s\S]*?\*\//gm,(function(e){const t=e.match(/\n/gm).length;let i="";for(let e=0;e<t;++e)i+="\n";return i}))}function getDependencyNode(e,t,i){let n;for(let t=0;t<i.length;++t)i[t].name===e&&(n=i[t]);return defined(n)||(n={name:e,glslSource:t=removeComments(t),dependsOn:[],requiredBy:[],evaluated:!1},i.push(n)),n}function generateDependencies(e,t){if(e.evaluated)return;e.evaluated=!0;let i=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);defined(i)&&null!==i&&(i=i.filter((function(e,t){return i.indexOf(e)===t})),i.forEach((function(i){if(i!==e.name&&ShaderSource._czmBuiltinsAndUniforms.hasOwnProperty(i)){const n=getDependencyNode(i,ShaderSource._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(n),n.requiredBy.push(e),generateDependencies(n,t)}})))}function sortDependencies(e){const t=[],i=[];for(;e.length>0;){const n=e.pop();i.push(n),0===n.requiredBy.length&&t.push(n)}for(;t.length>0;){const i=t.shift();e.push(i);for(let e=0;e<i.dependsOn.length;++e){const n=i.dependsOn[e],r=n.requiredBy.indexOf(i);n.requiredBy.splice(r,1),0===n.requiredBy.length&&t.push(n)}}for(let e=0;e<i.length;++e)i[e].requiredBy.length}function getBuiltinsAndAutomaticUniforms(e){const t=[],i=getDependencyNode("main",e,t);generateDependencies(i,t),sortDependencies(t);let n="";for(let e=t.length-1;e>=0;--e)n=`${n+t[e].glslSource}\n`;return n.replace(i.glslSource,"")}function combineShader(e,t,i){let n,r,o="";const a=e.sources;if(defined(a))for(n=0,r=a.length;n<r;++n)o+=`\n#line 0\n${a[n]}`;let s;o=removeComments(o),o=o.replace(/#version\s+(.*?)\n/gm,(function(e,t){return s=t,"\n"}));const c=[];o=o.replace(/#extension.*\n/gm,(function(e){return c.push(e),"\n"})),o=o.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");const l=e.pickColorQualifier;defined(l)&&(o=ShaderSource.createPickFragmentShaderSource(o,l));let u="";defined(s)&&(u=`#version ${s}\n`);const d=c.length;for(n=0;n<d;n++)u+=c[n];t&&(u+="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n #define highp mediump\n#endif\n\n");const h=e.defines;if(defined(h))for(n=0,r=h.length;n<r;++n){const e=h[n];0!==e.length&&(u+=`#define ${e}\n`)}return i.webgl2&&(u+="#define OUTPUT_DECLARATION\n\n"),i.textureFloatLinear&&(u+="#define OES_texture_float_linear\n\n"),i.floatingPointTexture&&(u+="#define OES_texture_float\n\n"),e.includeBuiltIns&&(u+=getBuiltinsAndAutomaticUniforms(o)),u+="\n#line 0\n",u+=o,i.webgl2&&(u=modernizeShader(u,t)),u}function ShaderSource(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).pickColorQualifier;this.defines=defined(e.defines)?e.defines.slice(0):[],this.sources=defined(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=defaultValue(e.includeBuiltIns,!0)}ShaderSource.prototype.clone=function(){return new ShaderSource({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})},ShaderSource.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)},ShaderSource.prototype.createCombinedVertexShader=function(e){return combineShader(this,!1,e)},ShaderSource.prototype.createCombinedFragmentShader=function(e){return combineShader(this,!0,e)},ShaderSource._czmBuiltinsAndUniforms={};for(const e in CzmBuiltins)CzmBuiltins.hasOwnProperty(e)&&(ShaderSource._czmBuiltinsAndUniforms[e]=CzmBuiltins[e]);for(const e in AutomaticUniforms)if(AutomaticUniforms.hasOwnProperty(e)){const t=AutomaticUniforms[e];"function"==typeof t.getDeclaration&&(ShaderSource._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}function containsString(e,t){const i=e.sources,n=i.length;for(let e=0;e<n;++e)if(-1!==i[e].indexOf(t))return!0;return!1}function findFirstString(e,t){const i=t.length;for(let n=0;n<i;++n){const i=t[n];if(containsString(e,i))return i}}ShaderSource.createPickVertexShaderSource=function(e){return`${ShaderSource.replaceMain(e,"czm_old_main")}\nattribute vec4 pickColor; \nvarying vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n czm_pickColor = pickColor; \n}`},ShaderSource.createPickFragmentShaderSource=function(e,t){return`${ShaderSource.replaceMain(e,"czm_old_main")}\n${`${t} vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n if (gl_FragColor.a == 0.0) { \n discard; \n } \n gl_FragColor = czm_pickColor; \n}`}`};const normalVaryingNames=["v_normalEC","v_normal"];ShaderSource.findNormalVarying=function(e){return containsString(e,"#ifdef HAS_NORMALS")?containsString(e,"#define HAS_NORMALS")?"v_normalEC":void 0:findFirstString(e,normalVaryingNames)};const positionVaryingNames=["v_positionEC"];ShaderSource.findPositionVarying=function(e){return findFirstString(e,positionVaryingNames)};var ShadowVolumeAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n#ifdef EXTRUDED_GEOMETRY\nattribute vec3 extrudeDirection;\nuniform float u_globeMinimumAltitude;\n#endif // EXTRUDED_GEOMETRY\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif // PER_INSTANCE_COLOR\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\nvoid main()\n{\nvec4 position = czm_computePosition();\n#ifdef EXTRUDED_GEOMETRY\nfloat delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\ndelta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\nposition = position + vec4(extrudeDirection * delta, 0.0);\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nv_sphericalExtents = czm_batchTable_sphericalExtents(batchId);\nv_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);\n#else // SPHERICAL\n#ifdef COLUMBUS_VIEW_2D\nvec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);\nvec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);\nvec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));\nbool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;\nplanes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);\nplanes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);\nidlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;\nidlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));\nplanes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);\nplanes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;\nvec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;\nvec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;\n#else // COLUMBUS_VIEW_2D\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;\nvec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;\nvec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;\n#endif // COLUMBUS_VIEW_2D\nvec3 eastWard = southEastCorner - southWestCorner;\nfloat eastExtent = length(eastWard);\neastWard /= eastExtent;\nvec3 northWard = northWestCorner - southWestCorner;\nfloat northExtent = length(northWard);\nnorthWard /= northExtent;\nv_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));\nv_southPlane = vec4(northWard, -dot(northWard, southWestCorner));\nv_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);\n#endif // SPHERICAL\nvec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);\nvec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);\nv_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);\nv_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);\nv_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif\ngl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);\n}\n",ShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvoid main(void)\n{\n#ifdef VECTOR_TILE\ngl_FragColor = czm_gammaCorrect(u_highlightColor);\n#else\ngl_FragColor = vec4(1.0);\n#endif\nczm_writeDepthClamp();\n}\n";const ClassificationType={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2,NUMBER_OF_CLASSIFICATION_TYPES:3};var ClassificationType$1=Object.freeze(ClassificationType);const DepthFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS};var DepthFunction$1=Object.freeze(DepthFunction);const BufferUsage={STREAM_DRAW:WebGLConstants$1.STREAM_DRAW,STATIC_DRAW:WebGLConstants$1.STATIC_DRAW,DYNAMIC_DRAW:WebGLConstants$1.DYNAMIC_DRAW,validate:function(e){return e===BufferUsage.STREAM_DRAW||e===BufferUsage.STATIC_DRAW||e===BufferUsage.DYNAMIC_DRAW}};var BufferUsage$1=Object.freeze(BufferUsage);function Buffer$1(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl,i=e.bufferTarget,n=e.typedArray;let r=e.sizeInBytes;const o=e.usage,a=defined(n);a&&(r=n.byteLength);const s=t.createBuffer();t.bindBuffer(i,s),t.bufferData(i,a?n:r,o),t.bindBuffer(i,null),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=i,this._sizeInBytes=r,this._usage=o,this._buffer=s,this.vertexArrayDestroyable=!0}function addAttribute(e,t,i,n){const r=defined(t.vertexBuffer),o=defined(t.value),a=t.value?t.value.length:t.componentsPerAttribute,s={index:defaultValue(t.index,i),enabled:defaultValue(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:o?t.value.slice(0):void 0,componentsPerAttribute:a,componentDatatype:defaultValue(t.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(t.normalize,!1),offsetInBytes:defaultValue(t.offsetInBytes,0),strideInBytes:defaultValue(t.strideInBytes,0),instanceDivisor:defaultValue(t.instanceDivisor,0)};if(r)s.vertexAttrib=function(e){const t=this.index;e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),e.vertexAttribPointer(t,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),e.enableVertexAttribArray(t),this.instanceDivisor>0&&(n.glVertexAttribDivisor(t,this.instanceDivisor),n._vertexAttribDivisors[t]=this.instanceDivisor,n._previousDrawInstanced=!0)},s.disableVertexAttribArray=function(e){e.disableVertexAttribArray(this.index),this.instanceDivisor>0&&n.glVertexAttribDivisor(i,0)};else{switch(s.componentsPerAttribute){case 1:s.vertexAttrib=function(e){e.vertexAttrib1fv(this.index,this.value)};break;case 2:s.vertexAttrib=function(e){e.vertexAttrib2fv(this.index,this.value)};break;case 3:s.vertexAttrib=function(e){e.vertexAttrib3fv(this.index,this.value)};break;case 4:s.vertexAttrib=function(e){e.vertexAttrib4fv(this.index,this.value)}}s.disableVertexAttribArray=function(e){}}e.push(s)}function bind(e,t,i){for(let i=0;i<t.length;++i){const n=t[i];n.enabled&&n.vertexAttrib(e)}defined(i)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i._getBuffer())}function VertexArray(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,i=t._gl,n=e.attributes,r=e.indexBuffer;let o;const a=[];let s,c=1,l=!1,u=!1,d=n.length;for(o=0;o<d;++o)addAttribute(a,n[o],o,t);for(d=a.length,o=0;o<d;++o){const e=a[o];if(defined(e.vertexBuffer)&&0===e.instanceDivisor){const t=e.strideInBytes||e.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(e.componentDatatype);c=e.vertexBuffer.sizeInBytes/t;break}}for(o=0;o<d;++o)a[o].instanceDivisor>0&&(l=!0),defined(a[o].value)&&(u=!0);t.vertexArrayObject&&(s=t.glCreateVertexArray(),t.glBindVertexArray(s),bind(i,a,r),t.glBindVertexArray(null)),this._numberOfVertices=c,this._hasInstancedAttributes=l,this._hasConstantAttributes=u,this._context=t,this._gl=i,this._vao=s,this._attributes=a,this._indexBuffer=r}function computeNumberOfVertices(e){return e.values.length/e.componentsPerAttribute}function computeAttributeSizeInBytes(e){return ComponentDatatype$1.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function interleaveAttributes(e){let t,i,n;const r=[];for(i in e)e.hasOwnProperty(i)&&defined(e[i])&&defined(e[i].values)&&(r.push(i),e[i].componentDatatype===ComponentDatatype$1.DOUBLE&&(e[i].componentDatatype=ComponentDatatype$1.FLOAT,e[i].values=ComponentDatatype$1.createTypedArray(ComponentDatatype$1.FLOAT,e[i].values)));let o;const a=r.length;if(a>0)for(o=computeNumberOfVertices(e[r[0]]),t=1;t<a;++t){const i=computeNumberOfVertices(e[r[t]]);if(i!==o)throw new RuntimeError(`Each attribute list must have the same number of vertices. Attribute ${r[t]} has a different number of vertices (${i.toString()}) than attribute ${r[0]} (${o.toString()}).`)}r.sort((function(t,i){return ComponentDatatype$1.getSizeInBytes(e[i].componentDatatype)-ComponentDatatype$1.getSizeInBytes(e[t].componentDatatype)}));let s=0;const c={};for(t=0;t<a;++t)i=r[t],n=e[i],c[i]=s,s+=computeAttributeSizeInBytes(n);if(s>0){const l=ComponentDatatype$1.getSizeInBytes(e[r[0]].componentDatatype),u=s%l;0!==u&&(s+=l-u);const d=new ArrayBuffer(o*s),h={};for(t=0;t<a;++t){i=r[t];const n=ComponentDatatype$1.getSizeInBytes(e[i].componentDatatype);h[i]={pointer:ComponentDatatype$1.createTypedArray(e[i].componentDatatype,d),index:c[i]/n,strideInComponentType:s/n}}for(t=0;t<o;++t)for(let o=0;o<a;++o){i=r[o],n=e[i];const a=n.values,s=h[i],c=s.pointer,l=n.componentsPerAttribute;for(let e=0;e<l;++e)c[s.index+e]=a[t*l+e];s.index+=s.strideInComponentType}return{buffer:d,offsetsInBytes:c,vertexSizeInBytes:s}}}function setVertexAttribDivisor(e){const t=e._context,i=e._hasInstancedAttributes;if(!i&&!t._previousDrawInstanced)return;t._previousDrawInstanced=i;const n=t._vertexAttribDivisors,r=e._attributes,o=ContextLimits.maximumVertexAttributes;let a;if(i){const e=r.length;for(a=0;a<e;++a){const e=r[a];if(e.enabled){const i=e.instanceDivisor,r=e.index;i!==n[r]&&(t.glVertexAttribDivisor(r,i),n[r]=i)}}}else for(a=0;a<o;++a)n[a]>0&&(t.glVertexAttribDivisor(a,0),n[a]=0)}function setConstantAttributes(e,t){const i=e._attributes,n=i.length;for(let e=0;e<n;++e){const n=i[e];n.enabled&&defined(n.value)&&n.vertexAttrib(t)}}function BatchTable(e,t,i){if(this._attributes=t,this._numberOfInstances=i,0===t.length)return;const n=getDatatype(t),r=e.floatingPointTexture,o=n===PixelDatatype$1.FLOAT&&!r,a=createOffsets(t,o),s=getStride(a,t,o),c=Math.floor(ContextLimits.maximumTextureSize/s),l=Math.min(i,c),u=s*l,d=Math.ceil(i/l),h=1/u,p=.5*h,f=1/d,m=.5*f;this._textureDimensions=new Cartesian2(u,d),this._textureStep=new Cartesian4(h,p,f,m),this._pixelDatatype=o?PixelDatatype$1.UNSIGNED_BYTE:n,this._packFloats=o,this._offsets=a,this._stride=s,this._texture=void 0;const g=4*u*d;this._batchValues=n!==PixelDatatype$1.FLOAT||o?new Uint8Array(g):new Float32Array(g),this._batchValuesDirty=!1}function getDatatype(e){let t=!1;const i=e.length;for(let n=0;n<i;++n)if(e[n].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE){t=!0;break}return t?PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE}function getAttributeType(e,t){const i=e[t].componentsPerAttribute;return 2===i?Cartesian2:3===i?Cartesian3:4===i?Cartesian4:Number}function createOffsets(e,t){const i=new Array(e.length);let n=0;const r=e.length;for(let o=0;o<r;++o){const r=e[o].componentDatatype;i[o]=n,r!==ComponentDatatype$1.UNSIGNED_BYTE&&t?n+=4:++n}return i}function getStride(e,t,i){const n=e.length,r=e[n-1];return t[n-1].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE&&i?r+4:r+1}Buffer$1.createVertexBuffer=function(e){return new Buffer$1({context:e.context,bufferTarget:WebGLConstants$1.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})},Buffer$1.createIndexBuffer=function(e){const t=e.context,i=e.indexDatatype,n=IndexDatatype$1.getSizeInBytes(i),r=new Buffer$1({context:t,bufferTarget:WebGLConstants$1.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),o=r.sizeInBytes/n;return Object.defineProperties(r,{indexDatatype:{get:function(){return i}},bytesPerIndex:{get:function(){return n}},numberOfIndices:{get:function(){return o}}}),r},Object.defineProperties(Buffer$1.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}}),Buffer$1.prototype._getBuffer=function(){return this._buffer},Buffer$1.prototype.copyFromArrayView=function(e,t){t=defaultValue(t,0);const i=this._gl,n=this._bufferTarget;i.bindBuffer(n,this._buffer),i.bufferSubData(n,t,e),i.bindBuffer(n,null)},Buffer$1.prototype.copyFromBuffer=function(e,t,i,n){const r=WebGLConstants$1.COPY_READ_BUFFER,o=WebGLConstants$1.COPY_WRITE_BUFFER,a=this._gl;a.bindBuffer(o,this._buffer),a.bindBuffer(r,e._buffer),a.copyBufferSubData(r,o,t,i,n),a.bindBuffer(o,null),a.bindBuffer(r,null)},Buffer$1.prototype.getBufferData=function(e,t,i,n){t=defaultValue(t,0),i=defaultValue(i,0);const r=this._gl,o=WebGLConstants$1.COPY_READ_BUFFER;r.bindBuffer(o,this._buffer),r.getBufferSubData(o,t,e,i,n),r.bindBuffer(o,null)},Buffer$1.prototype.isDestroyed=function(){return!1},Buffer$1.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),destroyObject(this)},VertexArray.fromGeometry=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,i=defaultValue(e.geometry,defaultValue.EMPTY_OBJECT),n=defaultValue(e.bufferUsage,BufferUsage$1.DYNAMIC_DRAW),r=defaultValue(e.attributeLocations,defaultValue.EMPTY_OBJECT),o=defaultValue(e.interleave,!1),a=e.vertexArrayAttributes;let s,c,l;const u=defined(a)?a:[],d=i.attributes;if(o){const e=interleaveAttributes(d);if(defined(e)){l=Buffer$1.createVertexBuffer({context:t,typedArray:e.buffer,usage:n});const i=e.offsetsInBytes,o=e.vertexSizeInBytes;for(s in d)d.hasOwnProperty(s)&&defined(d[s])&&(c=d[s],defined(c.values)?u.push({index:r[s],vertexBuffer:l,componentDatatype:c.componentDatatype,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,offsetInBytes:i[s],strideInBytes:o}):u.push({index:r[s],value:c.value,componentDatatype:c.componentDatatype,normalize:c.normalize}))}}else for(s in d)if(d.hasOwnProperty(s)&&defined(d[s])){c=d[s];let e=c.componentDatatype;e===ComponentDatatype$1.DOUBLE&&(e=ComponentDatatype$1.FLOAT),l=void 0,defined(c.values)&&(l=Buffer$1.createVertexBuffer({context:t,typedArray:ComponentDatatype$1.createTypedArray(e,c.values),usage:n})),u.push({index:r[s],vertexBuffer:l,value:c.value,componentDatatype:e,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize})}let h;const p=i.indices;return defined(p)&&(h=Geometry.computeNumberOfVertices(i)>=CesiumMath.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?Buffer$1.createIndexBuffer({context:t,typedArray:new Uint32Array(p),usage:n,indexDatatype:IndexDatatype$1.UNSIGNED_INT}):Buffer$1.createIndexBuffer({context:t,typedArray:new Uint16Array(p),usage:n,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})),new VertexArray({context:t,attributes:u,indexBuffer:h})},Object.defineProperties(VertexArray.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}}),VertexArray.prototype.getAttribute=function(e){return this._attributes[e]},VertexArray.prototype._bind=function(){defined(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&setVertexAttribDivisor(this),this._hasConstantAttributes&&setConstantAttributes(this,this._gl)):bind(this._gl,this._attributes,this._indexBuffer)},VertexArray.prototype._unBind=function(){if(defined(this._vao))this._context.glBindVertexArray(null);else{const e=this._attributes,t=this._gl;for(let i=0;i<e.length;++i){const n=e[i];n.enabled&&n.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}},VertexArray.prototype.isDestroyed=function(){return!1},VertexArray.prototype.destroy=function(){const e=this._attributes;for(let t=0;t<e.length;++t){const i=e[t].vertexBuffer;defined(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}const t=this._indexBuffer;return defined(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),defined(this._vao)&&this._context.glDeleteVertexArray(this._vao),destroyObject(this)},Object.defineProperties(BatchTable.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});const scratchPackedFloatCartesian4=new Cartesian4;function getPackedFloat(e,t,i){let n=Cartesian4.unpack(e,t,scratchPackedFloatCartesian4);const r=Cartesian4.unpackFloat(n);n=Cartesian4.unpack(e,t+4,scratchPackedFloatCartesian4);const o=Cartesian4.unpackFloat(n);n=Cartesian4.unpack(e,t+8,scratchPackedFloatCartesian4);const a=Cartesian4.unpackFloat(n);n=Cartesian4.unpack(e,t+12,scratchPackedFloatCartesian4);const s=Cartesian4.unpackFloat(n);return Cartesian4.fromElements(r,o,a,s,i)}function setPackedAttribute(e,t,i){let n=Cartesian4.packFloat(e.x,scratchPackedFloatCartesian4);Cartesian4.pack(n,t,i),n=Cartesian4.packFloat(e.y,n),Cartesian4.pack(n,t,i+4),n=Cartesian4.packFloat(e.z,n),Cartesian4.pack(n,t,i+8),n=Cartesian4.packFloat(e.w,n),Cartesian4.pack(n,t,i+12)}const scratchGetAttributeCartesian4$1=new Cartesian4;BatchTable.prototype.getBatchedAttribute=function(e,t,i){const n=this._attributes,r=this._offsets[t],o=4*this._stride*e+4*r;let a;a=this._packFloats&&n[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?getPackedFloat(this._batchValues,o,scratchGetAttributeCartesian4$1):Cartesian4.unpack(this._batchValues,o,scratchGetAttributeCartesian4$1);const s=getAttributeType(n,t);return defined(s.fromCartesian4)?s.fromCartesian4(a,i):defined(s.clone)?s.clone(a,i):a.x};const setAttributeScratchValues=[void 0,void 0,new Cartesian2,new Cartesian3,new Cartesian4],setAttributeScratchCartesian4=new Cartesian4;function createTexture$5(e,t){const i=e._textureDimensions;e._texture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:e._pixelDatatype,width:i.x,height:i.y,sampler:Sampler.NEAREST,flipY:!1})}function updateTexture(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}function getGlslComputeSt$1(e){const t=e._stride;return 1===e._textureDimensions.y?`uniform vec4 batchTextureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float numberOfAttributes = float(${t}); \n return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5); \n} \n`:`uniform vec4 batchTextureStep; \nuniform vec2 batchTextureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float stepY = batchTextureStep.z; \n float centerY = batchTextureStep.w; \n float numberOfAttributes = float(${t}); \n float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x); \n float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x); \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n`}function getComponentType(e){return 1===e?"float":`vec${e}`}function getComponentSwizzle(e){return 1===e?".x":2===e?".xy":3===e?".xyz":""}function getGlslAttributeFunction(e,t){const i=e._attributes[t],n=i.componentsPerAttribute,r=i.functionName,o=getComponentType(n),a=getComponentSwizzle(n);let s=`${o} ${r}(float batchId) \n{ \n vec2 st = computeSt(batchId); \n st.x += batchTextureStep.x * float(${e._offsets[t]}); \n`;return e._packFloats&&i.componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?s+="vec4 textureValue; \ntextureValue.x = czm_unpackFloat(texture2D(batchTexture, st)); \ntextureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0))); \ntextureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); \ntextureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); \n":s+=" vec4 textureValue = texture2D(batchTexture, st); \n",s+=` ${o} value = textureValue${a}; \n`,e._pixelDatatype!==PixelDatatype$1.UNSIGNED_BYTE||i.componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE||i.normalize?e._pixelDatatype===PixelDatatype$1.FLOAT&&i.componentDatatype===ComponentDatatype$1.UNSIGNED_BYTE&&i.normalize&&(s+="value /= 255.0; \n"):s+="value *= 255.0; \n",s+=" return value; \n} \n",s}function transformToWorldCoordinates(e,t,i){let n=!i;const r=e.length;let o;if(!n&&r>1){const t=e[0].modelMatrix;for(o=1;o<r;++o)if(!Matrix4.equals(t,e[o].modelMatrix)){n=!0;break}}if(n)for(o=0;o<r;++o)defined(e[o].geometry)&&GeometryPipeline.transformToWorldCoordinates(e[o]);else Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}function addGeometryBatchId(e,t){const i=e.attributes,n=i.position,r=n.values.length/n.componentsPerAttribute;i.batchId=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,values:new Float32Array(r)});const o=i.batchId.values;for(let e=0;e<r;++e)o[e]=t}function addBatchIds(e){const t=e.length;for(let i=0;i<t;++i){const t=e[i];defined(t.geometry)?addGeometryBatchId(t.geometry,i):defined(t.westHemisphereGeometry)&&defined(t.eastHemisphereGeometry)&&(addGeometryBatchId(t.westHemisphereGeometry,i),addGeometryBatchId(t.eastHemisphereGeometry,i))}}function geometryPipeline(e){const t=e.instances,i=e.projection,n=e.elementIndexUintSupported,r=e.scene3DOnly,o=e.vertexCacheOptimize,a=e.compressVertices,s=e.modelMatrix;let c,l,u=t.length;for(c=0;c<u;++c)if(defined(t[c].geometry)){t[c].geometry.primitiveType;break}if(transformToWorldCoordinates(t,s,r),!r)for(c=0;c<u;++c)defined(t[c].geometry)&&GeometryPipeline.splitLongitude(t[c]);if(addBatchIds(t),o)for(c=0;c<u;++c){const e=t[c];defined(e.geometry)?(GeometryPipeline.reorderForPostVertexCache(e.geometry),GeometryPipeline.reorderForPreVertexCache(e.geometry)):defined(e.westHemisphereGeometry)&&defined(e.eastHemisphereGeometry)&&(GeometryPipeline.reorderForPostVertexCache(e.westHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(e.westHemisphereGeometry),GeometryPipeline.reorderForPostVertexCache(e.eastHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(e.eastHemisphereGeometry))}let d=GeometryPipeline.combineInstances(t);for(u=d.length,c=0;c<u;++c){l=d[c];const e=l.attributes;if(r)for(const t in e)e.hasOwnProperty(t)&&e[t].componentDatatype===ComponentDatatype$1.DOUBLE&&GeometryPipeline.encodeAttribute(l,t,`${t}3DHigh`,`${t}3DLow`);else for(const t in e)if(e.hasOwnProperty(t)&&e[t].componentDatatype===ComponentDatatype$1.DOUBLE){const e=`${t}3D`,n=`${t}2D`;GeometryPipeline.projectTo2D(l,t,e,n,i),defined(l.boundingSphere)&&"position"===t&&(l.boundingSphereCV=BoundingSphere.fromVertices(l.attributes.position2D.values)),GeometryPipeline.encodeAttribute(l,e,`${e}High`,`${e}Low`),GeometryPipeline.encodeAttribute(l,n,`${n}High`,`${n}Low`)}a&&GeometryPipeline.compressVertices(l)}if(!n){let e=[];for(u=d.length,c=0;c<u;++c)l=d[c],e=e.concat(GeometryPipeline.fitToUnsignedShortIndices(l));d=e}return d}function createPickOffsets(e,t,i,n){let r,o,a;const s=n.length-1;if(s>=0){const e=n[s];r=e.offset+e.count,a=e.index,o=i[a].indices.length}else r=0,a=0,o=i[a].indices.length;const c=e.length;for(let s=0;s<c;++s){const c=e[s][t];if(!defined(c))continue;const l=c.indices.length;r+l>o&&(r=0,o=i[++a].indices.length),n.push({index:a,offset:r,count:l}),r+=l}}function createInstancePickOffsets(e,t){const i=[];return createPickOffsets(e,"geometry",t,i),createPickOffsets(e,"westHemisphereGeometry",t,i),createPickOffsets(e,"eastHemisphereGeometry",t,i),i}BatchTable.prototype.setBatchedAttribute=function(e,t,i){const n=this._attributes,r=setAttributeScratchValues[n[t].componentsPerAttribute],o=this.getBatchedAttribute(e,t,r),a=getAttributeType(this._attributes,t);if(defined(a.equals)?a.equals(o,i):o===i)return;const s=setAttributeScratchCartesian4;s.x=defined(i.x)?i.x:i,s.y=defined(i.y)?i.y:0,s.z=defined(i.z)?i.z:0,s.w=defined(i.w)?i.w:0;const c=this._offsets[t],l=4*this._stride*e+4*c;this._packFloats&&n[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?setPackedAttribute(s,this._batchValues,l):Cartesian4.pack(s,this._batchValues,l),this._batchValuesDirty=!0},BatchTable.prototype.update=function(e){defined(this._texture)&&!this._batchValuesDirty||0===this._attributes.length||(this._batchValuesDirty=!1,defined(this._texture)||createTexture$5(this,e.context),updateTexture(this))},BatchTable.prototype.getUniformMapCallback=function(){const e=this;return function(t){if(0===e._attributes.length)return t;return combine$2(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}},BatchTable.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(0===e.length)return function(e){return e};let t="uniform highp sampler2D batchTexture; \n";t+=`${getGlslComputeSt$1(this)}\n`;const i=e.length;for(let e=0;e<i;++e)t+=getGlslAttributeFunction(this,e);return function(e){const i=e.indexOf("void main"),n=e.substring(0,i),r=e.substring(i);return`${n}\n${t}\n${r}`}},BatchTable.prototype.isDestroyed=function(){return!1},BatchTable.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};const PrimitivePipeline={};function transferGeometry(e,t){const i=e.attributes;for(const e in i)if(i.hasOwnProperty(e)){const n=i[e];defined(n)&&defined(n.values)&&t.push(n.values.buffer)}defined(e.indices)&&t.push(e.indices.buffer)}function transferGeometries(e,t){const i=e.length;for(let n=0;n<i;++n)transferGeometry(e[n],t)}function countCreateGeometryResults(e){let t=1;const i=e.length;for(let n=0;n<i;n++){const i=e[n];if(++t,!defined(i))continue;const r=i.attributes;t+=7+2*BoundingSphere.packedLength+(defined(i.indices)?i.indices.length:0);for(const e in r)if(r.hasOwnProperty(e)&&defined(r[e])){t+=5+r[e].values.length}}return t}function packInstancesForCombine(e,t){const i=e.length,n=new Float64Array(1+19*i);let r=0;n[r++]=i;for(let t=0;t<i;t++){const i=e[t];if(Matrix4.pack(i.modelMatrix,n,r),r+=Matrix4.packedLength,defined(i.attributes)&&defined(i.attributes.offset)){const e=i.attributes.offset.value;n[r]=e[0],n[r+1]=e[1],n[r+2]=e[2]}r+=3}return t.push(n.buffer),n}function unpackInstancesForCombine(e){const t=e,i=new Array(t[0]);let n=0,r=1;for(;r<t.length;){const e=Matrix4.unpack(t,r);let o;r+=Matrix4.packedLength,defined(t[r])&&(o={offset:new OffsetGeometryInstanceAttribute(t[r],t[r+1],t[r+2])}),r+=3,i[n++]={modelMatrix:e,attributes:o}}return i}function packBoundingSpheres(e){const t=e.length,i=1+(BoundingSphere.packedLength+1)*t,n=new Float32Array(i);let r=0;n[r++]=t;for(let i=0;i<t;++i){defined(e[i])?(n[r++]=1,BoundingSphere.pack(e[i],n,r)):n[r++]=0,r+=BoundingSphere.packedLength}return n}function unpackBoundingSpheres(e){const t=new Array(e[0]);let i=0,n=1;for(;n<e.length;)1===e[n++]&&(t[i]=BoundingSphere.unpack(e,n)),++i,n+=BoundingSphere.packedLength;return t}PrimitivePipeline.combineGeometry=function(e){let t,i;const n=e.instances,r=n.length;let o,a,s=!1;r>0&&(t=geometryPipeline(e),t.length>0&&(i=GeometryPipeline.createAttributeLocations(t[0]),e.createPickOffsets&&(o=createInstancePickOffsets(n,t))),defined(n[0].attributes)&&defined(n[0].attributes.offset)&&(a=new Array(r),s=!0));const c=new Array(r),l=new Array(r);for(let e=0;e<r;++e){const t=n[e],i=t.geometry;defined(i)&&(c[e]=i.boundingSphere,l[e]=i.boundingSphereCV,s&&(a[e]=t.geometry.offsetAttribute));const r=t.eastHemisphereGeometry,o=t.westHemisphereGeometry;defined(r)&&defined(o)&&(defined(r.boundingSphere)&&defined(o.boundingSphere)&&(c[e]=BoundingSphere.union(r.boundingSphere,o.boundingSphere)),defined(r.boundingSphereCV)&&defined(o.boundingSphereCV)&&(l[e]=BoundingSphere.union(r.boundingSphereCV,o.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:i,pickOffsets:o,offsetInstanceExtend:a,boundingSpheres:c,boundingSpheresCV:l}},PrimitivePipeline.packCreateGeometryResults=function(e,t){const i=new Float64Array(countCreateGeometryResults(e)),n=[],r={},o=e.length;let a=0;i[a++]=o;for(let t=0;t<o;t++){const o=e[t],s=defined(o);if(i[a++]=s?1:0,!s)continue;i[a++]=o.primitiveType,i[a++]=o.geometryType,i[a++]=defaultValue(o.offsetAttribute,-1);const c=defined(o.boundingSphere)?1:0;i[a++]=c,c&&BoundingSphere.pack(o.boundingSphere,i,a),a+=BoundingSphere.packedLength;const l=defined(o.boundingSphereCV)?1:0;i[a++]=l,l&&BoundingSphere.pack(o.boundingSphereCV,i,a),a+=BoundingSphere.packedLength;const u=o.attributes,d=[];for(const e in u)u.hasOwnProperty(e)&&defined(u[e])&&(d.push(e),defined(r[e])||(r[e]=n.length,n.push(e)));i[a++]=d.length;for(let e=0;e<d.length;e++){const t=d[e],n=u[t];i[a++]=r[t],i[a++]=n.componentDatatype,i[a++]=n.componentsPerAttribute,i[a++]=n.normalize?1:0,i[a++]=n.values.length,i.set(n.values,a),a+=n.values.length}const h=defined(o.indices)?o.indices.length:0;i[a++]=h,h>0&&(i.set(o.indices,a),a+=h)}return t.push(i.buffer),{stringTable:n,packedData:i}},PrimitivePipeline.unpackCreateGeometryResults=function(e){const t=e.stringTable,i=e.packedData;let n;const r=new Array(i[0]);let o=0,a=1;for(;a<i.length;){if(!(1===i[a++])){r[o++]=void 0;continue}const e=i[a++],s=i[a++];let c,l,u=i[a++];-1===u&&(u=void 0);1===i[a++]&&(c=BoundingSphere.unpack(i,a)),a+=BoundingSphere.packedLength;let d,h,p;1===i[a++]&&(l=BoundingSphere.unpack(i,a)),a+=BoundingSphere.packedLength;const f=new GeometryAttributes,m=i[a++];for(n=0;n<m;n++){const e=t[i[a++]],n=i[a++];p=i[a++];const r=0!==i[a++];d=i[a++],h=ComponentDatatype$1.createTypedArray(n,d);for(let e=0;e<d;e++)h[e]=i[a++];f[e]=new GeometryAttribute({componentDatatype:n,componentsPerAttribute:p,normalize:r,values:h})}let g;if(d=i[a++],d>0){const e=h.length/p;for(g=IndexDatatype$1.createTypedArray(e,d),n=0;n<d;n++)g[n]=i[a++]}r[o++]=new Geometry({primitiveType:e,geometryType:s,boundingSphere:c,boundingSphereCV:l,indices:g,attributes:f,offsetAttribute:u})}return r},PrimitivePipeline.packCombineGeometryParameters=function(e,t){const i=e.createGeometryResults,n=i.length;for(let e=0;e<n;e++)t.push(i[e].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:packInstancesForCombine(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof GeographicProjection,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}},PrimitivePipeline.unpackCombineGeometryParameters=function(e){const t=unpackInstancesForCombine(e.packedInstances),i=e.createGeometryResults,n=i.length;let r=0;for(let e=0;e<n;e++){const n=PrimitivePipeline.unpackCreateGeometryResults(i[e]),o=n.length;for(let e=0;e<o;e++){const i=n[e];t[r].geometry=i,++r}}const o=Ellipsoid.clone(e.ellipsoid);return{instances:t,ellipsoid:o,projection:e.isGeographic?new GeographicProjection(o):new WebMercatorProjection(o),elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:Matrix4.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}},PrimitivePipeline.packCombineGeometryResults=function(e,t){defined(e.geometries)&&transferGeometries(e.geometries,t);const i=packBoundingSpheres(e.boundingSpheres),n=packBoundingSpheres(e.boundingSpheresCV);return t.push(i.buffer,n.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:i,boundingSpheresCV:n}},PrimitivePipeline.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:unpackBoundingSpheres(e.boundingSpheres),boundingSpheresCV:unpackBoundingSpheres(e.boundingSpheresCV)}};const PrimitiveState={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6};var PrimitiveState$1=Object.freeze(PrimitiveState);const SceneMode={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3,getMorphTime:function(e){return e===SceneMode.SCENE3D?1:e!==SceneMode.MORPHING?0:void 0}};var SceneMode$1=Object.freeze(SceneMode);const ShadowMode={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3,NUMBER_OF_SHADOW_MODES:4,castShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.CAST_ONLY},receiveShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.RECEIVE_ONLY},fromCastReceive:function(e,t){return e&&t?ShadowMode.ENABLED:e?ShadowMode.CAST_ONLY:t?ShadowMode.RECEIVE_ONLY:ShadowMode.DISABLED}};var ShadowMode$1=Object.freeze(ShadowMode);function Primitive$3(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this._isUpdateQuad=e.isUpdateQuad||0,this._tile=e.tile||void 0,this.depthFailAppearance=e.depthFailAppearance,this._depthFailAppearance=void 0,this._depthFailMaterial=void 0,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this._vertexCacheOptimize=defaultValue(e.vertexCacheOptimize,!1),this._interleave=defaultValue(e.interleave,!1),this._releaseGeometryInstances=defaultValue(e.releaseGeometryInstances,!0),this._allowPicking=defaultValue(e.allowPicking,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this._compressVertices=defaultValue(e.compressVertices,!0),this.cull=defaultValue(e.cull,!0),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,this.shadows=defaultValue(e.shadows,ShadowMode$1.DISABLED),this._translucent=void 0,this._state=PrimitiveState$1.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=[],this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._depthFailAppearance=void 0,this._spDepthFail=void 0,this._frontFaceDepthFailRS=void 0,this._backFaceDepthFailRS=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._createRenderStatesFunction=e._createRenderStatesFunction,this._createShaderProgramFunction=e._createShaderProgramFunction,this._createCommandsFunction=e._createCommandsFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._createPickOffsets=e._createPickOffsets,this._pickOffsets=void 0,this._createGeometryResults=void 0,this._ready=!1,this._readyPromise=defer(),this._batchTable=void 0,this._batchTableAttributeIndices=void 0,this._offsetInstanceExtend=void 0,this._batchTableOffsetAttribute2DIndex=void 0,this._batchTableOffsetsUpdated=!1,this._instanceBoundingSpheres=void 0,this._instanceBoundingSpheresCV=void 0,this._tempBoundingSpheres=void 0,this._recomputeBoundingSpheres=!1,this._batchTableBoundingSpheresUpdated=!1,this._batchTableBoundingSphereAttributeIndices=void 0}function getCommonPerInstanceAttributeNames(e){const t=e.length,i=[],n=e[0].attributes;let r;for(r in n)if(n.hasOwnProperty(r)&&defined(n[r])){const o=n[r];let a=!0;for(let i=1;i<t;++i){const t=e[i].attributes[r];if(!defined(t)||o.componentDatatype!==t.componentDatatype||o.componentsPerAttribute!==t.componentsPerAttribute||o.normalize!==t.normalize){a=!1;break}}a&&i.push(r)}return i}Object.defineProperties(Primitive$3.prototype,{vertexCacheOptimize:{get:function(){return this._vertexCacheOptimize}},interleave:{get:function(){return this._interleave}},releaseGeometryInstances:{get:function(){return this._releaseGeometryInstances}},allowPicking:{get:function(){return this._allowPicking}},asynchronous:{get:function(){return this._asynchronous}},compressVertices:{get:function(){return this._compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}});const scratchGetAttributeCartesian2=new Cartesian2,scratchGetAttributeCartesian3=new Cartesian3,scratchGetAttributeCartesian4=new Cartesian4;function getAttributeValue(e){const t=e.length;return 1===t?e[0]:2===t?Cartesian2.unpack(e,0,scratchGetAttributeCartesian2):3===t?Cartesian3.unpack(e,0,scratchGetAttributeCartesian3):4===t?Cartesian4.unpack(e,0,scratchGetAttributeCartesian4):void 0}function createBatchTable$1(e,t){const i=e.geometryInstances,n=Array.isArray(i)?i:[i],r=n.length;if(0===r)return;const o=getCommonPerInstanceAttributeNames(n),a=o.length,s=[],c={},l={};let u;let d,h,p,f=n[0].attributes;for(d=0;d<a;++d)h=o[d],p=f[h],c[h]=d,s.push({functionName:`czm_batchTable_${h}`,componentDatatype:p.componentDatatype,componentsPerAttribute:p.componentsPerAttribute,normalize:p.normalize});-1!==o.indexOf("distanceDisplayCondition")&&(s.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1}),l.center3DHigh=s.length-5,l.center3DLow=s.length-4,l.center2DHigh=s.length-3,l.center2DLow=s.length-2,l.radius=s.length-1),-1!==o.indexOf("offset")&&(s.push({functionName:"czm_batchTable_offset2D",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3}),u=s.length-1),s.push({functionName:"czm_batchTable_pickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});const m=s.length,g=new BatchTable(t,s,r);for(d=0;d<r;++d){const i=n[d];f=i.attributes;for(let e=0;e<a;++e){h=o[e],p=f[h];const t=getAttributeValue(p.value),i=c[h];g.setBatchedAttribute(d,i,t)}const r={primitive:defaultValue(i.pickPrimitive,e)};defined(i.id)&&(r.id=i.id);const s=t.createPickId(r);e._pickIds.push(s);const l=s.color,u=scratchGetAttributeCartesian4;u.x=Color.floatToByte(l.red),u.y=Color.floatToByte(l.green),u.z=Color.floatToByte(l.blue),u.w=Color.floatToByte(l.alpha),g.setBatchedAttribute(d,m-1,u)}e._batchTable=g,e._batchTableAttributeIndices=c,e._batchTableBoundingSphereAttributeIndices=l,e._batchTableOffsetAttribute2DIndex=u}function cloneAttribute(e){let t;return t=Array.isArray(e.values)?e.values.slice(0):new e.values.constructor(e.values),new GeometryAttribute({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function cloneGeometry(e){const t=e.attributes,i=new GeometryAttributes;for(const e in t)t.hasOwnProperty(e)&&defined(t[e])&&(i[e]=cloneAttribute(t[e]));let n;if(defined(e.indices)){const t=e.indices;n=Array.isArray(t)?t.slice(0):new t.constructor(t)}return new Geometry({attributes:i,indices:n,primitiveType:e.primitiveType,boundingSphere:BoundingSphere.clone(e.boundingSphere)})}function cloneInstance(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:Matrix4.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}const positionRegex=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;function appendPickToVertexShader(e){return`${ShaderSource.replaceMain(e,"czm_non_pick_main")}\nvarying vec4 v_pickColor; \nvoid main() \n{ \n czm_non_pick_main(); \n v_pickColor = czm_batchTable_pickColor(batchId); \n}`}function appendPickToFragmentShader(e){return`varying vec4 v_pickColor;\n${e}`}function modifyForEncodedNormals$1(e,t){if(!e.compressVertices)return t;const i=-1!==t.search(/attribute\s+vec3\s+normal;/g),n=-1!==t.search(/attribute\s+vec2\s+st;/g);if(!i&&!n)return t;const r=-1!==t.search(/attribute\s+vec3\s+tangent;/g),o=-1!==t.search(/attribute\s+vec3\s+bitangent;/g);let a=n&&i?2:1;a+=r||o?1:0;const s="compressedAttributes",c=`attribute ${a>1?`vec${a}`:"float"} ${s};`;let l="",u="";if(n){l+="vec2 st;\n";u+=` st = czm_decompressTextureCoordinates(${a>1?`${s}.x`:s});\n`}i&&r&&o?(l+="vec3 normal;\nvec3 tangent;\nvec3 bitangent;\n",u+=` czm_octDecode(${s}.${n?"yz":"xy"}, normal, tangent, bitangent);\n`):(i&&(l+="vec3 normal;\n",u+=` normal = czm_octDecode(${s}${a>1?"."+(n?"y":"x"):""});\n`),r&&(l+="vec3 tangent;\n",u+=` tangent = czm_octDecode(${s}.${n&&i?"z":"y"});\n`),o&&(l+="vec3 bitangent;\n",u+=` bitangent = czm_octDecode(${s}.${n&&i?"z":"y"});\n`));let d=t;d=d.replace(/attribute\s+vec3\s+normal;/g,""),d=d.replace(/attribute\s+vec2\s+st;/g,""),d=d.replace(/attribute\s+vec3\s+tangent;/g,""),d=d.replace(/attribute\s+vec3\s+bitangent;/g,""),d=ShaderSource.replaceMain(d,"czm_non_compressed_main");return[c,l,d,`void main() \n{ \n${u} czm_non_compressed_main(); \n}`].join("\n")}function depthClampVS(e){let t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t+="void main() {\n czm_non_depth_clamp_main();\n gl_Position = czm_depthClamp(gl_Position);}\n",t}function depthClampFS(e){let t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t+="void main() {\n czm_non_depth_clamp_main();\n#if defined(GL_EXT_frag_depth)\n #if defined(LOG_DEPTH)\n czm_writeLogDepth();\n #else\n czm_writeDepthClamp();\n #endif\n#endif\n}\n",t=`#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n${t}`,t}function validateShaderMatching(e,t){e.vertexAttributes}function getUniformFunction(e,t){return function(){return e[t]}}Primitive$3._modifyShaderPosition=function(e,t,i){let n,r="",o="",a="";for(;null!==(n=positionRegex.exec(t));){const s=n[1],c=`vec4 czm_compute${s[0].toUpperCase()}${s.substr(1)}()`;"vec4 czm_computePosition()"!==c&&(r+=`${c};\n`),defined(e.rtcCenter)?(r+="uniform mat4 u_modifiedModelView;\n",o+="attribute vec4 position;\n",a+=`${c}\n{\n return u_modifiedModelView * position;\n}\n\n`,t=(t=(t=(t=t.replace(/attribute\s+vec(?:3|4)\s+position3DHigh;/g,"")).replace(/attribute\s+vec(?:3|4)\s+position3DLow;/g,"")).replace(/czm_modelViewRelativeToEye\s+\*\s+/g,"")).replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):i?a+=`${c}\n{\n return czm_translateRelativeToEye(${s}3DHigh, ${s}3DLow);\n}\n\n`:(o+=`attribute vec3 ${s}2DHigh;\nattribute vec3 ${s}2DLow;\n`,a+=`${c}\n{\n vec4 p;\n if (czm_morphTime == 1.0)\n {\n p = czm_translateRelativeToEye(${s}3DHigh, ${s}3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n p = czm_translateRelativeToEye(${s}2DHigh.zxy, ${s}2DLow.zxy);\n }\n else\n {\n p = czm_columbusViewMorph(\n czm_translateRelativeToEye(${s}2DHigh.zxy, ${s}2DLow.zxy),\n czm_translateRelativeToEye(${s}3DHigh, ${s}3DLow),\n czm_morphTime);\n }\n return p;\n}\n\n`)}return[r,o,t,a].join("\n")},Primitive$3._appendShowToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.show))return t;return`${ShaderSource.replaceMain(t,"czm_non_show_main")}\nvoid main() \n{ \n czm_non_show_main(); \n gl_Position *= czm_batchTable_show(batchId); \n}`},Primitive$3._updateColorAttribute=function(e,t,i){if(!defined(e._batchTableAttributeIndices.color)&&!defined(e._batchTableAttributeIndices.depthFailColor))return t;if(-1===t.search(/attribute\s+vec4\s+color;/g))return t;let n=t;return n=n.replace(/attribute\s+vec4\s+color;/g,""),n=i?n.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):n.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2"),n},Primitive$3._updatePickColorAttribute=function(e){let t=e.replace(/attribute\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t},Primitive$3._appendOffsetToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.offset))return t;let i="attribute float batchId;\n";i+="attribute float applyOffset;";let n=t.replace(/attribute\s+float\s+batchId;/g,"attribute float batchId;\nattribute float applyOffset;"),r="vec4 $1 = czm_computePosition();\n";return r+=" if (czm_sceneMode == czm_sceneMode3D)\n",r+=" {\n",r+=" $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);",r+=" }\n",r+=" else\n",r+=" {\n",r+=" $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);",r+=" }\n",n=n.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,"vec4 $1 = czm_computePosition();\n if (czm_sceneMode == czm_sceneMode3D)\n {\n $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0); }\n else\n {\n $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0); }\n"),n},Primitive$3._appendDistanceDisplayConditionToShader=function(e,t,i){if(!defined(e._batchTableAttributeIndices.distanceDisplayCondition))return t;let n="void main() \n{ \n czm_non_distanceDisplayCondition_main(); \n vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);\n vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);\n vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);\n float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);\n";return n+=i?" vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n":" vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);\n vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);\n vec4 centerRTE;\n if (czm_morphTime == 1.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);\n }\n else\n {\n centerRTE = czm_columbusViewMorph(\n czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),\n czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),\n czm_morphTime);\n }\n",n+=" float radiusSq = boundingSphereRadius * boundingSphereRadius; \n float distanceSq; \n if (czm_sceneMode == czm_sceneMode2D) \n { \n distanceSq = czm_eyeHeight2D.y - radiusSq; \n } \n else \n { \n distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq; \n } \n distanceSq = max(distanceSq, 0.0); \n float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; \n float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; \n float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0; \n gl_Position *= show; \n}",`${ShaderSource.replaceMain(t,"czm_non_distanceDisplayCondition_main")}\n${n}`};const numberOfCreationWorkers=Math.max(FeatureDetection.hardwareConcurrency-1,1);let createGeometryTaskProcessors;const combineGeometryTaskProcessor=new TaskProcessor("combineGeometry");function loadAsynchronous(e,t){let i,n,r,o;const a=e._instanceIds;if(e._state===PrimitiveState$1.READY){i=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const s=e._numberOfInstances=i.length,c=[];let l,u=[];for(r=0;r<s;++r)n=i[r].geometry,a.push(i[r].id),u.push({moduleName:n._workerName,geometry:n});if(!defined(createGeometryTaskProcessors))for(createGeometryTaskProcessors=new Array(numberOfCreationWorkers),r=0;r<numberOfCreationWorkers;r++)createGeometryTaskProcessors[r]=new TaskProcessor("createGeometry");for(u=subdivideArray(u,numberOfCreationWorkers),r=0;r<u.length;r++){let e=0;const t=u[r],i=t.length;for(o=0;o<i;++o)l=t[o],n=l.geometry,defined(n.constructor.pack)&&(l.offset=e,e+=defaultValue(n.constructor.packedLength,n.packedLength));let a;if(e>0){const r=new Float64Array(e);for(a=[r.buffer],o=0;o<i;++o)l=t[o],n=l.geometry,defined(n.constructor.pack)&&(n.constructor.pack(n,r,l.offset),l.geometry=r)}c.push(createGeometryTaskProcessors[r].scheduleTask({subTasks:u[r]},a))}e._state=PrimitiveState$1.CREATING,Promise.all(c).then((function(t){e._createGeometryResults=t,e._state=PrimitiveState$1.CREATED})).catch((function(i){setReady(e,t,PrimitiveState$1.FAILED,i)}))}else if(e._state===PrimitiveState$1.CREATED){const n=[];i=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const r=t.scene3DOnly,o=t.mapProjection,a=combineGeometryTaskProcessor.scheduleTask(PrimitivePipeline.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:i,ellipsoid:o.ellipsoid,projection:o,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:r,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},n),n);e._createGeometryResults=void 0,e._state=PrimitiveState$1.COMBINING,Promise.resolve(a).then((function(i){const n=PrimitivePipeline.unpackCombineGeometryResults(i);e._geometries=n.geometries,e._attributeLocations=n.attributeLocations,e.modelMatrix=Matrix4.clone(n.modelMatrix,e.modelMatrix),e._pickOffsets=n.pickOffsets,e._offsetInstanceExtend=n.offsetInstanceExtend,e._instanceBoundingSpheres=n.boundingSpheres,e._instanceBoundingSpheresCV=n.boundingSpheresCV,defined(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=PrimitiveState$1.COMBINED):setReady(e,t,PrimitiveState$1.FAILED,void 0)})).catch((function(i){setReady(e,t,PrimitiveState$1.FAILED,i)}))}}function loadSynchronous(e,t){const i=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],n=e._numberOfInstances=i.length,r=new Array(n),o=e._instanceIds;let a,s,c=0;for(s=0;s<n;s++){a=i[s];const e=a.geometry;let t;t=defined(e.attributes)&&defined(e.primitiveType)?cloneGeometry(e):e.constructor.createGeometry(e),r[c++]=cloneInstance(a,t),o.push(a.id)}r.length=c;const l=t.scene3DOnly,u=t.mapProjection,d=PrimitivePipeline.combineGeometry({instances:r,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:l,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=d.geometries,e._attributeLocations=d.attributeLocations,e.modelMatrix=Matrix4.clone(d.modelMatrix,e.modelMatrix),e._pickOffsets=d.pickOffsets,e._offsetInstanceExtend=d.offsetInstanceExtend,e._instanceBoundingSpheres=d.boundingSpheres,e._instanceBoundingSpheresCV=d.boundingSpheresCV,defined(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=PrimitiveState$1.COMBINED):setReady(e,t,PrimitiveState$1.FAILED,void 0)}function recomputeBoundingSpheres(e,t){const i=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!defined(i))return void(e._recomputeBoundingSpheres=!1);let n;const r=e._offsetInstanceExtend,o=e._instanceBoundingSpheres,a=o.length;let s=e._tempBoundingSpheres;if(!defined(s)){for(s=new Array(a),n=0;n<a;n++)s[n]=new BoundingSphere;e._tempBoundingSpheres=s}for(n=0;n<a;++n){let t=s[n];const a=e._batchTable.getBatchedAttribute(n,i,new Cartesian3);t=o[n].clone(t),transformBoundingSphere(t,a,r[n])}const c=[],l=[],u=[];for(n=0;n<a;++n){const e=s[n];e.center.x-e.radius>0||BoundingSphere.intersectPlane(e,Plane.ORIGIN_ZX_PLANE)!==Intersect$1.INTERSECTING?c.push(e):(l.push(e),u.push(e))}let d=c[0],h=u[0],p=l[0];for(n=1;n<c.length;n++)d=BoundingSphere.union(d,c[n]);for(n=1;n<u.length;n++)h=BoundingSphere.union(h,u[n]);for(n=1;n<l.length;n++)p=BoundingSphere.union(p,l[n]);const f=[];for(defined(d)&&f.push(d),defined(h)&&f.push(h),defined(p)&&f.push(p),n=0;n<f.length;n++){const i=f[n].clone(e._boundingSpheres[n]);e._boundingSpheres[n]=i,e._boundingSphereCV[n]=BoundingSphere.projectTo2D(i,t.mapProjection,e._boundingSphereCV[n])}Primitive$3._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}const scratchBoundingSphereCenterEncoded=new EncodedCartesian3,scratchBoundingSphereCartographic=new Cartographic,scratchBoundingSphereCenter2D=new Cartesian3,scratchBoundingSphere$3=new BoundingSphere;function updateBatchTableBoundingSpheres(e,t){if(!defined(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;const i=e._batchTableBoundingSphereAttributeIndices,n=i.center3DHigh,r=i.center3DLow,o=i.center2DHigh,a=i.center2DLow,s=i.radius,c=t.mapProjection,l=c.ellipsoid,u=e._batchTable,d=e._instanceBoundingSpheres,h=d.length;for(let i=0;i<h;++i){let h=d[i];if(!defined(h))continue;const p=e.modelMatrix;defined(p)&&(h=BoundingSphere.transform(h,p,scratchBoundingSphere$3));const f=h.center,m=h.radius;let g=EncodedCartesian3.fromCartesian(f,scratchBoundingSphereCenterEncoded);if(u.setBatchedAttribute(i,n,g.high),u.setBatchedAttribute(i,r,g.low),!t.scene3DOnly){const e=l.cartesianToCartographic(f,scratchBoundingSphereCartographic),t=c.project(e,scratchBoundingSphereCenter2D);g=EncodedCartesian3.fromCartesian(t,scratchBoundingSphereCenterEncoded),u.setBatchedAttribute(i,o,g.high),u.setBatchedAttribute(i,a,g.low)}u.setBatchedAttribute(i,s,m)}e._batchTableBoundingSpheresUpdated=!0}const offsetScratchCartesian=new Cartesian3,offsetCenterScratch=new Cartesian3;function updateBatchTableOffsets(e,t){if(!defined(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;const i=e._batchTableOffsetAttribute2DIndex,n=t.mapProjection,r=n.ellipsoid,o=e._batchTable,a=e._instanceBoundingSpheres,s=a.length;for(let t=0;t<s;++t){let s=a[t];if(!defined(s))continue;const c=o.getBatchedAttribute(t,e._batchTableAttributeIndices.offset);if(Cartesian3.equals(c,Cartesian3.ZERO)){o.setBatchedAttribute(t,i,Cartesian3.ZERO);continue}const l=e.modelMatrix;defined(l)&&(s=BoundingSphere.transform(s,l,scratchBoundingSphere$3));let u=s.center;u=r.scaleToGeodeticSurface(u,offsetCenterScratch);let d=r.cartesianToCartographic(u,scratchBoundingSphereCartographic);const h=n.project(d,scratchBoundingSphereCenter2D),p=Cartesian3.add(c,u,offsetScratchCartesian);d=r.cartesianToCartographic(p,d);const f=n.project(d,offsetScratchCartesian),m=Cartesian3.subtract(f,h,offsetScratchCartesian),g=m.x;m.x=m.z,m.z=m.y,m.y=g,o.setBatchedAttribute(t,i,m)}e._batchTableOffsetsUpdated=!0}function createVertexArray$6(e,t){const i=e._attributeLocations,n=e._geometries,r=t.scene3DOnly,o=t.context,a=[],s=n.length;for(let c=0;c<s;++c){const s=n[c];if(a.push(VertexArray.fromGeometry({context:o,geometry:s,attributeLocations:i,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:e._interleave})),defined(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,s);else if(e._boundingSpheres.push(BoundingSphere.clone(s.boundingSphere)),e._boundingSphereWC.push(new BoundingSphere),!r){const t=s.boundingSphereCV.center,i=t.x,n=t.y,r=t.z;t.x=r,t.y=i,t.z=n,e._boundingSphereCV.push(BoundingSphere.clone(s.boundingSphereCV)),e._boundingSphere2D.push(new BoundingSphere),e._boundingSphereMorph.push(new BoundingSphere)}}e._va=a,e._primitiveType=n[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,setReady(e,t,PrimitiveState$1.COMPLETE,void 0)}function createRenderStates$6(e,t,i,n){let r,o=i.getRenderState();n?(r=clone$1(o,!1),r.cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceRS=RenderState.fromCache(r),r.cull.face=CullFace$1.FRONT,e._backFaceRS=RenderState.fromCache(r)):(e._frontFaceRS=RenderState.fromCache(o),e._backFaceRS=e._frontFaceRS),r=clone$1(o,!1),defined(e._depthFailAppearance)&&(r.depthTest.enabled=!1),defined(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=clone$1(o,!1),r.depthTest.func=DepthFunction$1.GREATER,n?(r.cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceDepthFailRS=RenderState.fromCache(r),r.cull.face=CullFace$1.FRONT,e._backFaceDepthFailRS=RenderState.fromCache(r)):(e._frontFaceDepthFailRS=RenderState.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function createShaderProgram$3(e,t,i){const n=t.context,r=e._attributeLocations;let o=e._batchTable.getVertexShaderCallback()(i.vertexShaderSource);o=Primitive$3._appendOffsetToShader(e,o),o=Primitive$3._appendShowToShader(e,o),o=Primitive$3._appendDistanceDisplayConditionToShader(e,o,t.scene3DOnly),o=appendPickToVertexShader(o),o=Primitive$3._updateColorAttribute(e,o,!1),o=modifyForEncodedNormals$1(e,o),o=Primitive$3._modifyShaderPosition(e,o,t.scene3DOnly);let a=i.getFragmentShaderSource();a=appendPickToFragmentShader(a),e._sp=ShaderProgram.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:r}),validateShaderMatching(e._sp),defined(e._depthFailAppearance)&&(o=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),o=Primitive$3._appendShowToShader(e,o),o=Primitive$3._appendDistanceDisplayConditionToShader(e,o,t.scene3DOnly),o=appendPickToVertexShader(o),o=Primitive$3._updateColorAttribute(e,o,!0),o=modifyForEncodedNormals$1(e,o),o=Primitive$3._modifyShaderPosition(e,o,t.scene3DOnly),o=depthClampVS(o),a=e._depthFailAppearance.getFragmentShaderSource(),a=appendPickToFragmentShader(a),a=depthClampFS(a),e._spDepthFail=ShaderProgram.replaceCache({context:n,shaderProgram:e._spDepthFail,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:r}),validateShaderMatching(e._spDepthFail))}const modifiedModelViewScratch$4=new Matrix4,rtcScratch$4=new Cartesian3;function getUniforms(e,t,i,n){const r=defined(i)?i._uniforms:void 0,o={},a=t.uniforms;if(defined(a))for(const e in a)a.hasOwnProperty(e)&&(o[e]=getUniformFunction(a,e));let s=combine$2(o,r);return s=e._batchTable.getUniformMapCallback()(s),defined(e.rtcCenter)&&(s.u_modifiedModelView=function(){const t=n.context.uniformState.view;return Matrix4.multiply(t,e._modelMatrix,modifiedModelViewScratch$4),Matrix4.multiplyByPoint(modifiedModelViewScratch$4,e.rtcCenter,rtcScratch$4),Matrix4.setTranslation(modifiedModelViewScratch$4,rtcScratch$4,modifiedModelViewScratch$4),modifiedModelViewScratch$4}),s}function createCommands$5(e,t,i,n,r,o,a,s){const c=getUniforms(e,t,i,s);let l;defined(e._depthFailAppearance)&&(l=getUniforms(e,e._depthFailAppearance,e._depthFailAppearance.material,s));const u=n?Pass$1.TRANSLUCENT:Pass$1.OPAQUE;let d=r?2:1;d*=defined(e._depthFailAppearance)?2:1,o.length=e._va.length*d;const h=o.length;let p=0;for(let t=0;t<h;++t){let i;r&&(i=o[t],defined(i)||(i=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),i.vertexArray=e._va[p],i.renderState=e._backFaceRS,i.shaderProgram=e._sp,i.uniformMap=c,i.pass=u,++t),i=o[t],defined(i)||(i=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),i.vertexArray=e._va[p],i.renderState=e._frontFaceRS,i.shaderProgram=e._sp,i.uniformMap=c,i.pass=u,defined(e._depthFailAppearance)&&(r&&(++t,i=o[t],defined(i)||(i=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),i.vertexArray=e._va[p],i.renderState=e._backFaceDepthFailRS,i.shaderProgram=e._spDepthFail,i.uniformMap=l,i.pass=u),++t,i=o[t],defined(i)||(i=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),i.vertexArray=e._va[p],i.renderState=e._frontFaceDepthFailRS,i.shaderProgram=e._spDepthFail,i.uniformMap=l,i.pass=u),++p}}function updateAndQueueCommands$3(e,t,i,n,r,o,a,s){let c;Primitive$3._updateBoundingVolumes(e,t,r),t.mode===SceneMode$1.SCENE3D?c=e._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?c=e._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(e._boundingSphere2D)?c=e._boundingSphere2D:defined(e._boundingSphereMorph)&&(c=e._boundingSphereMorph);const l=t.commandList,u=t.passes;if(u.render||u.pick){const t=e.allowPicking,n=ShadowMode$1.castShadows(e.shadows),u=ShadowMode$1.receiveShadows(e.shadows),d=i.length;let h=s?2:1;h*=defined(e._depthFailAppearance)?2:1;for(let e=0;e<d;++e){const s=Math.floor(e/h),d=i[e];d.modelMatrix=r,d.boundingVolume=c[s],d.cull=o,d.debugShowBoundingVolume=a,d.castShadows=n,d.receiveShadows=u,d.pickId=t?"v_pickColor":void 0,l.push(d)}}}Primitive$3._updateBoundingVolumes=function(e,t,i,n){let r,o,a;if(n||!Matrix4.equals(i,e._modelMatrix))for(Matrix4.clone(i,e._modelMatrix),o=e._boundingSpheres.length,r=0;r<o;++r)a=e._boundingSpheres[r],defined(a)&&(e._boundingSphereWC[r]=BoundingSphere.transform(a,i,e._boundingSphereWC[r]),t.scene3DOnly||(e._boundingSphere2D[r]=BoundingSphere.clone(e._boundingSphereCV[r],e._boundingSphere2D[r]),e._boundingSphere2D[r].center.x=0,e._boundingSphereMorph[r]=BoundingSphere.union(e._boundingSphereWC[r],e._boundingSphereCV[r])));const s=e.appearance.pixelSize;if(defined(s))for(o=e._boundingSpheres.length,r=0;r<o;++r){a=e._boundingSpheres[r];const i=e._boundingSphereWC[r],n=t.camera.getPixelSize(a,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*s;i.radius=a.radius+n}},Primitive$3.prototype.update=function(e){if(!defined(this.geometryInstances)&&0===this._va.length||defined(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&0===this.geometryInstances.length||!defined(this.appearance)||e.mode!==SceneMode$1.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(defined(this._error))throw this._error;if(this._state===PrimitiveState$1.FAILED)return;const t=e.context;if(defined(this._batchTable)||createBatchTable$1(this,t),this._batchTable.attributes.length>0){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.");this._batchTable.update(e)}if(this._state!==PrimitiveState$1.COMPLETE&&this._state!==PrimitiveState$1.COMBINED&&(this.asynchronous?loadAsynchronous(this,e):loadSynchronous(this,e)),this._state===PrimitiveState$1.COMBINED&&(updateBatchTableBoundingSpheres(this,e),updateBatchTableOffsets(this,e),createVertexArray$6(this,e)),!this.show||this._state!==PrimitiveState$1.COMPLETE)return;this._batchTableOffsetsUpdated||updateBatchTableOffsets(this,e),this._recomputeBoundingSpheres&&recomputeBoundingSpheres(this,e);const i=this.appearance,n=i.material;let r=!1,o=!1;this._appearance!==i?(this._appearance=i,this._material=n,r=!0,o=!0):this._material!==n&&(this._material=n,o=!0);const a=this.depthFailAppearance,s=defined(a)?a.material:void 0;this._depthFailAppearance!==a?(this._depthFailAppearance=a,this._depthFailMaterial=s,r=!0,o=!0):this._depthFailMaterial!==s&&(this._depthFailMaterial=s,o=!0);const c=this._appearance.isTranslucent();this._translucent!==c&&(this._translucent=c,r=!0),defined(this._material)&&this._material.update(t);const l=i.closed&&c;if(r){defaultValue(this._createRenderStatesFunction,createRenderStates$6)(this,t,i,l)}if(o){defaultValue(this._createShaderProgramFunction,createShaderProgram$3)(this,e,i)}if(r||o){defaultValue(this._createCommandsFunction,createCommands$5)(this,i,n,c,l,this._colorCommands,this._pickCommands,e)}defaultValue(this._updateAndQueueCommandsFunction,updateAndQueueCommands$3)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,l)};const offsetBoundingSphereScratch1=new BoundingSphere,offsetBoundingSphereScratch2=new BoundingSphere;function transformBoundingSphere(e,t,i){if(i===GeometryOffsetAttribute$1.TOP){const i=BoundingSphere.clone(e,offsetBoundingSphereScratch1),n=BoundingSphere.clone(e,offsetBoundingSphereScratch2);n.center=Cartesian3.add(n.center,t,n.center),e=BoundingSphere.union(i,n,e)}else i===GeometryOffsetAttribute$1.ALL&&(e.center=Cartesian3.add(e.center,t,e.center));return e}function createGetFunction(e,t,i){return function(){const n=e.getBatchedAttribute(t,i),r=e.attributes[i],o=r.componentsPerAttribute,a=ComponentDatatype$1.createTypedArray(r.componentDatatype,o);return defined(n.constructor.pack)?n.constructor.pack(n,a,0):a[0]=n,a}}function createSetFunction(e,t,i,n,r){return function(o){const a=getAttributeValue(o);e.setBatchedAttribute(t,i,a),"offset"===r&&(n._recomputeBoundingSpheres=!0,n._batchTableOffsetsUpdated=!1)}}const offsetScratch$a=new Cartesian3;function createBoundingSphereProperties(e,t,i){t.boundingSphere={get:function(){let n=e._instanceBoundingSpheres[i];if(defined(n)){n=n.clone();const r=e.modelMatrix,o=t.offset;defined(o)&&transformBoundingSphere(n,Cartesian3.fromArray(o.get(),0,offsetScratch$a),e._offsetInstanceExtend[i]),defined(r)&&(n=BoundingSphere.transform(n,r))}return n}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[i]}}}function createPickIdProperty(e,t,i){t.pickId={get:function(){return e._pickIds[i]}}}function setReady(e,t,i,n){e._error=n,e._state=i,t.afterRender.push((function(){e._ready=e._state===PrimitiveState$1.COMPLETE||e._state===PrimitiveState$1.FAILED,defined(n)?e._readyPromise.reject(n):e._readyPromise.resolve(e)}))}Primitive$3.prototype.getGeometryInstanceAttributes=function(e){let t=-1;const i=this._lastPerInstanceAttributeIndex,n=this._instanceIds,r=n.length;for(let o=0;o<r;++o){const a=(i+o)%r;if(e===n[a]){t=a;break}}if(-1===t)return;let o=this._perInstanceAttributeCache[t];if(defined(o))return o;const a=this._batchTable,s=this._batchTableAttributeIndices;o={};const c={};for(const e in s)if(s.hasOwnProperty(e)){const i=s[e];c[e]={get:createGetFunction(a,t,i),set:createSetFunction(a,t,i,this,e)}}return createBoundingSphereProperties(this,c,t),createPickIdProperty(this,c,t),Object.defineProperties(o,c),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=o,o},Primitive$3.prototype.isDestroyed=function(){return!1},Primitive$3.prototype.destroy=function(){let e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();const i=this._va;for(e=i.length,t=0;t<e;++t)i[t].destroy();this._va=void 0;const n=this._pickIds;for(e=n.length,t=0;t<e;++t)n[t].destroy();return this._pickIds=void 0,this._batchTable=this._batchTable&&this._batchTable.destroy(),this._instanceIds=void 0,this._perInstanceAttributeCache=void 0,this._attributeLocations=void 0,destroyObject(this)};var ShadowVolumeAppearanceFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\n#ifdef NORMAL_EC\nvec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\nreturn eyeCoordinate.xyz / eyeCoordinate.w;\n}\nvec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {\nvec2 glFragCoordXY = gl_FragCoord.xy;\nfloat upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\nfloat downOrLeftLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\nbvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\nfloat useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\nfloat useDownOrLeft = float(useUpOrRight == 0.0);\nvec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\nvec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\nreturn (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n}\n#endif // NORMAL_EC\nvoid main(void)\n{\n#ifdef REQUIRES_EC\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n#endif\n#ifdef REQUIRES_WC\nvec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\nvec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n#endif\n#ifdef TEXTURE_COORDINATES\nvec2 uv;\n#ifdef SPHERICAL\nvec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);\nsphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;\nsphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\nuv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;\nuv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;\n#else // SPHERICAL\nuv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;\nuv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;\n#endif // SPHERICAL\n#endif // TEXTURE_COORDINATES\n#ifdef PICK\n#ifdef CULL_FRAGMENTS\nif (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {\ngl_FragColor.a = 1.0;\nczm_writeDepthClamp();\n}\n#else // CULL_FRAGMENTS\ngl_FragColor.a = 1.0;\n#endif // CULL_FRAGMENTS\n#else // PICK\n#ifdef CULL_FRAGMENTS\nif (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {\ndiscard;\n}\n#endif\n#ifdef NORMAL_EC\nvec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));\nvec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));\nvec3 normalEC = normalize(cross(leftRight, downUp));\n#endif\n#ifdef PER_INSTANCE_COLOR\nvec4 color = czm_gammaCorrect(v_color);\n#ifdef FLAT\ngl_FragColor = color;\n#else // FLAT\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\ngl_FragColor.rgb *= gl_FragColor.a;\n#else // PER_INSTANCE_COLOR\nczm_materialInput materialInput;\n#ifdef USES_NORMAL_EC\nmaterialInput.normalEC = normalEC;\n#endif\n#ifdef USES_POSITION_TO_EYE_EC\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\n#endif\n#ifdef USES_TANGENT_TO_EYE\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);\n#endif\n#ifdef USES_ST\nmaterialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;\nmaterialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;\n#endif\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else // FLAT\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\ngl_FragColor.rgb *= gl_FragColor.a;\n#endif // PER_INSTANCE_COLOR\nczm_writeDepthClamp();\n#endif // PICK\n}\n";function ShadowVolumeAppearance(e,t,i){this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const n=new ShaderDependencies;n.requiresTextureCoordinates=e,n.requiresEC=!i.flat;const r=new ShaderDependencies;if(r.requiresTextureCoordinates=e,i instanceof PerInstanceColorAppearance)n.requiresNormalEC=!i.flat;else{const e=`${i.material.shaderSource}\n${i.fragmentShaderSource}`;n.normalEC=-1!==e.indexOf("materialInput.normalEC")||-1!==e.indexOf("czm_getDefaultMaterial"),n.positionToEyeEC=-1!==e.indexOf("materialInput.positionToEyeEC"),n.tangentToEyeMatrix=-1!==e.indexOf("materialInput.tangentToEyeMatrix"),n.st=-1!==e.indexOf("materialInput.st")}this._colorShaderDependencies=n,this._pickShaderDependencies=r,this._appearance=i,this._extentsCulling=e,this._planarExtents=t}ShadowVolumeAppearance.prototype.createFragmentShader=function(e){const t=this._appearance,i=this._colorShaderDependencies,n=[];e||this._planarExtents||n.push("SPHERICAL"),i.requiresEC&&n.push("REQUIRES_EC"),i.requiresWC&&n.push("REQUIRES_WC"),i.requiresTextureCoordinates&&n.push("TEXTURE_COORDINATES"),this._extentsCulling&&n.push("CULL_FRAGMENTS"),i.requiresNormalEC&&n.push("NORMAL_EC"),t instanceof PerInstanceColorAppearance&&n.push("PER_INSTANCE_COLOR"),i.normalEC&&n.push("USES_NORMAL_EC"),i.positionToEyeEC&&n.push("USES_POSITION_TO_EYE_EC"),i.tangentToEyeMatrix&&n.push("USES_TANGENT_TO_EYE"),i.st&&n.push("USES_ST"),t.flat&&n.push("FLAT");let r="";return t instanceof PerInstanceColorAppearance||(r=t.material.shaderSource),new ShaderSource({defines:n,sources:[r,ShadowVolumeAppearanceFS]})},ShadowVolumeAppearance.prototype.createPickFragmentShader=function(e){const t=this._pickShaderDependencies,i=["PICK"];return e||this._planarExtents||i.push("SPHERICAL"),t.requiresEC&&i.push("REQUIRES_EC"),t.requiresWC&&i.push("REQUIRES_WC"),t.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),new ShaderSource({defines:i,sources:[ShadowVolumeAppearanceFS],pickColorQualifier:"varying"})},ShadowVolumeAppearance.prototype.createVertexShader=function(e,t,i,n){return createShadowVolumeAppearanceVS(this._colorShaderDependencies,this._planarExtents,i,e,t,this._appearance,n,this._projectionExtentDefines)},ShadowVolumeAppearance.prototype.createPickVertexShader=function(e,t,i,n){return createShadowVolumeAppearanceVS(this._pickShaderDependencies,this._planarExtents,i,e,t,void 0,n,this._projectionExtentDefines)};const longitudeExtentsCartesianScratch=new Cartesian3,longitudeExtentsCartographicScratch=new Cartographic,longitudeExtentsEncodeScratch={high:0,low:0};function createShadowVolumeAppearanceVS(e,t,i,n,r,o,a,s){const c=n.slice();if(""===s.eastMostYhighDefine){const e=longitudeExtentsCartographicScratch;e.longitude=CesiumMath.PI,e.latitude=0,e.height=0;const t=a.project(e,longitudeExtentsCartesianScratch);let i=EncodedCartesian3.encode(t.x,longitudeExtentsEncodeScratch);s.eastMostYhighDefine=`EAST_MOST_X_HIGH ${i.high.toFixed(`${i.high}`.length+1)}`,s.eastMostYlowDefine=`EAST_MOST_X_LOW ${i.low.toFixed(`${i.low}`.length+1)}`;const n=longitudeExtentsCartographicScratch;n.longitude=-CesiumMath.PI,n.latitude=0,n.height=0;const r=a.project(n,longitudeExtentsCartesianScratch);i=EncodedCartesian3.encode(r.x,longitudeExtentsEncodeScratch),s.westMostYhighDefine=`WEST_MOST_X_HIGH ${i.high.toFixed(`${i.high}`.length+1)}`,s.westMostYlowDefine=`WEST_MOST_X_LOW ${i.low.toFixed(`${i.low}`.length+1)}`}return i&&(c.push(s.eastMostYhighDefine),c.push(s.eastMostYlowDefine),c.push(s.westMostYhighDefine),c.push(s.westMostYlowDefine)),defined(o)&&o instanceof PerInstanceColorAppearance&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||i||c.push("SPHERICAL"),i&&c.push("COLUMBUS_VIEW_2D")),new ShaderSource({defines:c,sources:[r]})}function ShaderDependencies(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}function pointLineDistance(e,t,i){return Math.abs((t.y-e.y)*i.x-(t.x-e.x)*i.y+t.x*e.y-t.y*e.x)/Cartesian2.distance(t,e)}Object.defineProperties(ShaderDependencies.prototype,{requiresEC:{get:function(){return this._requiresEC},set:function(e){this._requiresEC=e||this._requiresEC}},requiresWC:{get:function(){return this._requiresWC},set:function(e){this._requiresWC=e||this._requiresWC,this.requiresEC=this._requiresWC}},requiresNormalEC:{get:function(){return this._requiresNormalEC},set:function(e){this._requiresNormalEC=e||this._requiresNormalEC,this.requiresEC=this._requiresNormalEC}},requiresTextureCoordinates:{get:function(){return this._requiresTextureCoordinates},set:function(e){this._requiresTextureCoordinates=e||this._requiresTextureCoordinates,this.requiresWC=this._requiresTextureCoordinates}},normalEC:{set:function(e){this.requiresNormalEC=e,this._usesNormalEC=e},get:function(){return this._usesNormalEC}},tangentToEyeMatrix:{set:function(e){this.requiresWC=e,this.requiresNormalEC=e,this._usesTangentToEyeMat=e},get:function(){return this._usesTangentToEyeMat}},positionToEyeEC:{set:function(e){this.requiresEC=e,this._usesPositionToEyeEC=e},get:function(){return this._usesPositionToEyeEC}},st:{set:function(e){this.requiresTextureCoordinates=e,this._usesSt=e},get:function(){return this._usesSt}}});const points2DScratch=[new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2];function addTextureCoordinateRotationAttributes(e,t){const i=points2DScratch,n=Cartesian2.unpack(t,0,i[0]),r=Cartesian2.unpack(t,2,i[1]),o=Cartesian2.unpack(t,4,i[2]);e.uMaxVmax=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r.x,r.y,o.x,o.y]});const a=1/pointLineDistance(n,r,o),s=1/pointLineDistance(n,o,r);e.uvMinAndExtents=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[n.x,n.y,a,s]})}const cartographicScratch$4=new Cartographic,cornerScratch=new Cartesian3,northWestScratch=new Cartesian3,southEastScratch=new Cartesian3,highLowScratch={high:0,low:0};function add2DTextureCoordinateAttributes(e,t,i){const n=cartographicScratch$4;n.height=0,n.longitude=e.west,n.latitude=e.south;const r=t.project(n,cornerScratch);n.latitude=e.north;const o=t.project(n,northWestScratch);n.longitude=e.east,n.latitude=e.south;const a=t.project(n,southEastScratch),s=[0,0,0,0],c=[0,0,0,0];let l=EncodedCartesian3.encode(r.x,highLowScratch);s[0]=l.high,c[0]=l.low,l=EncodedCartesian3.encode(r.y,highLowScratch),s[1]=l.high,c[1]=l.low,l=EncodedCartesian3.encode(o.y,highLowScratch),s[2]=l.high,c[2]=l.low,l=EncodedCartesian3.encode(a.x,highLowScratch),s[3]=l.high,c[3]=l.low,i.planes2D_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:s}),i.planes2D_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:c})}const enuMatrixScratch=new Matrix4,inverseEnuScratch=new Matrix4,rectanglePointCartesianScratch=new Cartesian3,rectangleCenterScratch$1=new Cartographic,pointsCartographicScratch=[new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic];function computeRectangleBounds(e,t,i,n,r,o){const a=Rectangle.center(e,rectangleCenterScratch$1);a.height=i;const s=Cartographic.toCartesian(a,t,rectanglePointCartesianScratch),c=Transforms.eastNorthUpToFixedFrame(s,t,enuMatrixScratch),l=Matrix4.inverse(c,inverseEnuScratch),u=e.west,d=e.east,h=e.north,p=e.south,f=pointsCartographicScratch;f[0].latitude=p,f[0].longitude=u,f[1].latitude=h,f[1].longitude=u,f[2].latitude=h,f[2].longitude=d,f[3].latitude=p,f[3].longitude=d;const m=.5*(u+d),g=.5*(h+p);f[4].latitude=p,f[4].longitude=m,f[5].latitude=h,f[5].longitude=m,f[6].latitude=g,f[6].longitude=u,f[7].latitude=g,f[7].longitude=d;let _=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;for(let e=0;e<8;e++){f[e].height=i;const n=Cartographic.toCartesian(f[e],t,rectanglePointCartesianScratch);Matrix4.multiplyByPoint(l,n,n),n.z=0,_=Math.min(_,n.x),y=Math.max(y,n.x),C=Math.min(C,n.y),T=Math.max(T,n.y)}const S=n;S.x=_,S.y=C,S.z=0,Matrix4.multiplyByPoint(c,S,S);const v=r;v.x=y,v.y=C,v.z=0,Matrix4.multiplyByPoint(c,v,v),Cartesian3.subtract(v,S,r);const A=o;A.x=_,A.y=T,A.z=0,Matrix4.multiplyByPoint(c,A,A),Cartesian3.subtract(A,S,o)}const eastwardScratch=new Cartesian3,northwardScratch=new Cartesian3,encodeScratch=new EncodedCartesian3;ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes=function(e,t,i,n,r){const o=cornerScratch,a=eastwardScratch,s=northwardScratch;computeRectangleBounds(e,i,defaultValue(r,0),o,a,s);const c={};addTextureCoordinateRotationAttributes(c,t);const l=EncodedCartesian3.fromCartesian(o,encodeScratch);return c.southWest_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(l.high,[0,0,0])}),c.southWest_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(l.low,[0,0,0])}),c.eastward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(a,[0,0,0])}),c.northward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(s,[0,0,0])}),add2DTextureCoordinateAttributes(e,n,c),c};const spherePointScratch=new Cartesian3;function latLongToSpherical(e,t,i,n){const r=cartographicScratch$4;r.latitude=e,r.longitude=t,r.height=0;const o=Cartographic.toCartesian(r,i,spherePointScratch),a=Math.sqrt(o.x*o.x+o.y*o.y),s=CesiumMath.fastApproximateAtan2(a,o.z),c=CesiumMath.fastApproximateAtan2(o.x,o.y);return n.x=s,n.y=c,n}const sphericalScratch=new Cartesian2;function shouldUseSpherical(e){return Math.max(e.width,e.height)>ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS}ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes=function(e,t,i,n){const r=latLongToSpherical(e.south,e.west,i,sphericalScratch);let o=r.x,a=r.y;const s=latLongToSpherical(e.north,e.east,i,sphericalScratch);let c=s.x,l=s.y,u=0;a>l&&(u=CesiumMath.PI-a,a=-CesiumMath.PI,l+=u),o-=CesiumMath.EPSILON5,a-=CesiumMath.EPSILON5,c+=CesiumMath.EPSILON5,l+=CesiumMath.EPSILON5;const d=1/(l-a),h=1/(c-o),p={sphericalExtents:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o,a,h,d]}),longitudeRotation:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,normalize:!1,value:[u]})};return addTextureCoordinateRotationAttributes(p,t),add2DTextureCoordinateAttributes(e,n,p),p},ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes=function(e){return defined(e.southWest_HIGH)&&defined(e.southWest_LOW)&&defined(e.northward)&&defined(e.eastward)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents)},ShadowVolumeAppearance.hasAttributesForSphericalExtents=function(e){return defined(e.sphericalExtents)&&defined(e.longitudeRotation)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents)},ShadowVolumeAppearance.shouldUseSphericalCoordinates=function(e){return shouldUseSpherical(e)},ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS=CesiumMath.toRadians(1);const StencilFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS};var StencilFunction$1=Object.freeze(StencilFunction);const StencilOperation={ZERO:WebGLConstants$1.ZERO,KEEP:WebGLConstants$1.KEEP,REPLACE:WebGLConstants$1.REPLACE,INCREMENT:WebGLConstants$1.INCR,DECREMENT:WebGLConstants$1.DECR,INVERT:WebGLConstants$1.INVERT,INCREMENT_WRAP:WebGLConstants$1.INCR_WRAP,DECREMENT_WRAP:WebGLConstants$1.DECR_WRAP};var StencilOperation$1=Object.freeze(StencilOperation);const StencilConstants={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15,setCesium3DTileBit:function(){return{enabled:!0,frontFunction:StencilFunction$1.ALWAYS,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},backFunction:StencilFunction$1.ALWAYS,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},reference:StencilConstants.CESIUM_3D_TILE_MASK,mask:StencilConstants.CESIUM_3D_TILE_MASK}}};var StencilConstants$1=Object.freeze(StencilConstants);function ClassificationPrimitive(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometryInstances;this.geometryInstances=t,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=defaultValue(e._extruded,!1),this._uniformMap=e._uniformMap,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._spColor=void 0,this._spPick2D=void 0,this._spColor2D=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1,this._readyPromise=defer(),this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}function getStencilDepthRenderState$1(e,t){const i=t?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:i,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.KEEP},backFunction:i,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}function getColorRenderState(e){return{stencilTest:{enabled:e,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND}}Object.defineProperties(ClassificationPrimitive.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}}),ClassificationPrimitive.isSupported=function(e){return e.context.stencilBuffer};const pickRenderState$1={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$5(e,t,i,n){if(defined(e._rsStencilDepthPass))return;const r=!e.debugShowShadowVolume;e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(r,!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(r,!0)),e._rsColorPass=RenderState.fromCache(getColorRenderState(r)),e._rsPickPass=RenderState.fromCache(pickRenderState$1)}function modifyForEncodedNormals(e,t){if(!e.compressVertices)return t;if(-1!==t.search(/attribute\s+vec3\s+extrudeDirection;/g)){const e="compressedAttributes",i=`attribute vec2 ${e};`,n="vec3 extrudeDirection;\n",r=` extrudeDirection = czm_octDecode(${e}, 65535.0);\n`;let o=t;o=o.replace(/attribute\s+vec3\s+extrudeDirection;/g,""),o=ShaderSource.replaceMain(o,"czm_non_compressed_main");return[i,n,o,`void main() \n{ \n${r} czm_non_compressed_main(); \n}`].join("\n")}}function createShaderProgram$2(e,t){const i=t.context,n=e._primitive;let r=ShadowVolumeAppearanceVS;r=e._primitive._batchTable.getVertexShaderCallback()(r),r=Primitive$3._appendDistanceDisplayConditionToShader(n,r),r=Primitive$3._modifyShaderPosition(e,r,t.scene3DOnly),r=Primitive$3._updateColorAttribute(n,r);const o=e._hasPlanarExtentsAttributes,a=o||e._hasSphericalExtentsAttribute;e._extruded&&(r=modifyForEncodedNormals(n,r));const s=e._extruded?"EXTRUDED_GEOMETRY":"";let c=new ShaderSource({defines:[s],sources:[r]});const l=new ShaderSource({sources:[ShadowVolumeFS]}),u=e._primitive._attributeLocations,d=new ShadowVolumeAppearance(a,o,e.appearance);if(e._spStencil=ShaderProgram.replaceCache({context:i,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u}),e._primitive.allowPicking){let o=ShaderSource.createPickVertexShaderSource(r);o=Primitive$3._appendShowToShader(n,o),o=Primitive$3._updatePickColorAttribute(o);const c=d.createPickFragmentShader(!1),l=d.createPickVertexShader([s],o,!1,t.mapProjection);if(e._spPick=ShaderProgram.replaceCache({context:i,shaderProgram:e._spPick,vertexShaderSource:l,fragmentShaderSource:c,attributeLocations:u}),a){let n=i.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!defined(n)){const r=d.createPickFragmentShader(!0),a=d.createPickVertexShader([s],o,!0,t.mapProjection);n=i.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:a,fragmentShaderSource:r,attributeLocations:u})}e._spPick2D=n}}else e._spPick=ShaderProgram.fromCache({context:i,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u});r=Primitive$3._appendShowToShader(n,r),c=new ShaderSource({defines:[s],sources:[r]}),e._sp=ShaderProgram.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u});const h=d.createFragmentShader(!1),p=d.createVertexShader([s],r,!1,t.mapProjection);if(e._spColor=ShaderProgram.replaceCache({context:i,shaderProgram:e._spColor,vertexShaderSource:p,fragmentShaderSource:h,attributeLocations:u}),a){let n=i.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!defined(n)){const o=d.createFragmentShader(!0),a=d.createVertexShader([s],r,!0,t.mapProjection);n=i.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:u})}e._spColor2D=n}}function createColorCommands$1(e,t){const i=e._primitive;let n,r,o,a=2*i._va.length;t.length=a;let s=0,c=i._batchTable.getUniformMapCallback()(e._uniformMap);const l=e._needs2DShader;for(n=0;n<a;n+=2){const a=i._va[s++];r=t[n],defined(r)||(r=t[n]=new DrawCommand({owner:e,primitiveType:i._primitiveType})),r.vertexArray=a,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=Pass$1.TERRAIN_CLASSIFICATION,o=DrawCommand.shallowClone(r,r.derivedCommands.tileset),o.renderState=e._rsStencilDepthPass3DTiles,o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=o,r=t[n+1],defined(r)||(r=t[n+1]=new DrawCommand({owner:e,primitiveType:i._primitiveType})),r.vertexArray=a,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Pass$1.TERRAIN_CLASSIFICATION;const u=e.appearance.material;if(defined(u)&&(c=combine$2(c,u._uniforms)),r.uniformMap=c,o=DrawCommand.shallowClone(r,r.derivedCommands.tileset),o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=o,l){let t=DrawCommand.shallowClone(r,r.derivedCommands.appearance2D);t.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=t,t=DrawCommand.shallowClone(o,o.derivedCommands.appearance2D),t.shaderProgram=e._spColor2D,o.derivedCommands.appearance2D=t}}const u=e._commandsIgnoreShow,d=e._spStencil;let h=0;a=u.length=a/2;for(let e=0;e<a;++e){const i=u[e]=DrawCommand.shallowClone(t[h],u[e]);i.shaderProgram=d,i.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,h+=2}}function createPickCommands$1(e,t){const i=e._usePickOffsets,n=e._primitive;let r,o,a,s,c,l=2*n._va.length,u=0;i&&(r=n._pickOffsets,l=2*r.length),t.length=l;let d=0;const h=n._batchTable.getUniformMapCallback()(e._uniformMap),p=e._needs2DShader;for(a=0;a<l;a+=2){let l=n._va[d++];if(i&&(o=r[u++],l=n._va[o.index]),s=t[a],defined(s)||(s=t[a]=new DrawCommand({owner:e,primitiveType:n._primitiveType,pickOnly:!0})),s.vertexArray=l,s.renderState=e._rsStencilDepthPass,s.shaderProgram=e._sp,s.uniformMap=h,s.pass=Pass$1.TERRAIN_CLASSIFICATION,i&&(s.offset=o.offset,s.count=o.count),c=DrawCommand.shallowClone(s,s.derivedCommands.tileset),c.renderState=e._rsStencilDepthPass3DTiles,c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,s.derivedCommands.tileset=c,s=t[a+1],defined(s)||(s=t[a+1]=new DrawCommand({owner:e,primitiveType:n._primitiveType,pickOnly:!0})),s.vertexArray=l,s.renderState=e._rsPickPass,s.shaderProgram=e._spPick,s.uniformMap=h,s.pass=Pass$1.TERRAIN_CLASSIFICATION,i&&(s.offset=o.offset,s.count=o.count),c=DrawCommand.shallowClone(s,s.derivedCommands.tileset),c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,s.derivedCommands.tileset=c,p){let t=DrawCommand.shallowClone(s,s.derivedCommands.pick2D);t.shaderProgram=e._spPick2D,s.derivedCommands.pick2D=t,t=DrawCommand.shallowClone(c,c.derivedCommands.pick2D),t.shaderProgram=e._spPick2D,c.derivedCommands.pick2D=t}}}function createCommands$4(e,t,i,n,r,o,a){createColorCommands$1(e,o),createPickCommands$1(e,a)}function boundingVolumeIndex$1(e,t){return Math.floor(e%t/2)}function updateAndQueueRenderCommand$1(e,t,i,n,r,o){e.modelMatrix=i,e.boundingVolume=r,e.cull=n,e.debugShowBoundingVolume=o,t.commandList.push(e)}function updateAndQueuePickCommand$1(e,t,i,n,r){e.modelMatrix=i,e.boundingVolume=r,e.cull=n,t.commandList.push(e)}function updateAndQueueCommands$2(e,t,i,n,r,o,a,s){const c=e._primitive;let l;Primitive$3._updateBoundingVolumes(c,t,r),t.mode===SceneMode$1.SCENE3D?l=c._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?l=c._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(c._boundingSphere2D)?l=c._boundingSphere2D:defined(c._boundingSphereMorph)&&(l=c._boundingSphereMorph);const u=e.classificationType,d=u!==ClassificationType$1.CESIUM_3D_TILE,h=u!==ClassificationType$1.TERRAIN,p=t.passes;let f,m,g;if(p.render){const n=i.length;for(f=0;f<n;++f)m=l[boundingVolumeIndex$1(f,n)],d&&(g=i[f],updateAndQueueRenderCommand$1(g,t,r,o,m,a)),h&&(g=i[f].derivedCommands.tileset,updateAndQueueRenderCommand$1(g,t,r,o,m,a));if(t.invertClassification){const i=e._commandsIgnoreShow,n=i.length;for(f=0;f<n;++f)m=l[f],g=i[f],updateAndQueueRenderCommand$1(g,t,r,o,m,a)}}if(p.pick){const e=n.length,i=c._pickOffsets;for(f=0;f<e;++f){m=l[i[boundingVolumeIndex$1(f,e)].index],d&&(g=n[f],updateAndQueuePickCommand$1(g,t,r,o,m)),h&&(g=n[f].derivedCommands.tileset,updateAndQueuePickCommand$1(g,t,r,o,m))}}}ClassificationPrimitive.prototype.update=function(e){if(!defined(this._primitive)&&!defined(this.geometryInstances))return;let t=this.appearance;defined(t)&&defined(t.material)&&t.material.update(e.context);const i=this,n=this._primitiveOptions;if(!defined(this._primitive)){const e=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=e.length;let o,a,s,c,l=!1,u=!0,d=!1,h=!1;for(r>0&&(s=e[0].attributes,d=ShadowVolumeAppearance.hasAttributesForSphericalExtents(s),h=ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes(s),c=s.color),o=0;o<r;o++){a=e[o];const t=a.attributes.color;defined(t)&&(l=!0),u=u&&defined(t)&&ColorGeometryInstanceAttribute.equals(c,t)}if(!u&&!d&&!h)throw new DeveloperError("All GeometryInstances must have the same color attribute except via GroundPrimitives");l&&!defined(t)&&(t=new PerInstanceColorAppearance({flat:!0}),this.appearance=t),this._usePickOffsets=!d&&!h,this._hasSphericalExtentsAttribute=d,this._hasPlanarExtentsAttributes=h,this._hasPerColorAttribute=l;const p=new Array(r);for(o=0;o<r;++o)a=e[o],p[o]=new GeometryInstance({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:defaultValue(this._pickPrimitive,i)});n.appearance=t,n.geometryInstances=p,defined(this._createBoundingVolumeFunction)&&(n._createBoundingVolumeFunction=function(e,t){i._createBoundingVolumeFunction(e,t)}),n._createRenderStatesFunction=function(e,t,n,r){createRenderStates$5(i)},n._createShaderProgramFunction=function(e,t,n){createShaderProgram$2(i,t)},n._createCommandsFunction=function(e,t,n,r,o,a,s){createCommands$4(i,void 0,void 0,!0,!1,a,s)},defined(this._updateAndQueueCommandsFunction)?n._updateAndQueueCommandsFunction=function(e,t,n,r,o,a,s,c){i._updateAndQueueCommandsFunction(e,t,n,r,o,a,s,c)}:n._updateAndQueueCommandsFunction=function(e,t,n,r,o,a,s,c){updateAndQueueCommands$2(i,t,n,r,o,a,s)},this._primitive=new Primitive$3(n),this._primitive.readyPromise.then((function(e){i._ready=!0,i.releaseGeometryInstances&&(i.geometryInstances=void 0);const t=e._error;defined(t)?i._readyPromise.reject(t):i._readyPromise.resolve(i)}))}this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(!1,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(!1,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(!0,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(!0,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!0))),this._primitive.appearance!==t&&(this._primitive.appearance=t),this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)},ClassificationPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},ClassificationPrimitive.prototype.isDestroyed=function(){return!1},ClassificationPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._spColor=this._spColor&&this._spColor.destroy(),this._spPick2D=void 0,this._spColor2D=void 0,destroyObject(this)};const GroundPrimitiveUniformMap={u_globeMinimumAltitude:function(){return 55e3}};function GroundPrimitive(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).appearance;const i=e.geometryInstances;if(!defined(t)&&defined(i)){const e=Array.isArray(i)?i:[i],n=e.length;for(let i=0;i<n;i++){const n=e[i].attributes;if(defined(n)&&defined(n.color)){t=new PerInstanceColorAppearance({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._readyPromise=defer(),this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=ApproximateTerrainHeights._defaultMaxTerrainHeight,this._minTerrainHeight=ApproximateTerrainHeights._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:this,_extruded:!0,_uniformMap:GroundPrimitiveUniformMap}}function getComputeMaximumHeightFunction(e){return function(t,i){const n=i.maximumRadius,r=n/Math.cos(.5*t)-n;return e._maxHeight+r}}function getComputeMinimumHeightFunction(e){return function(t,i){return e._minHeight}}Object.defineProperties(GroundPrimitive.prototype,{vertexCacheOptimize:{get:function(){return this._classificationPrimitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._classificationPrimitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._classificationPrimitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._classificationPrimitiveOptions.allowPicking}},asynchronous:{get:function(){return this._classificationPrimitiveOptions.asynchronous}},compressVertices:{get:function(){return this._classificationPrimitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),GroundPrimitive.isSupported=ClassificationPrimitive.isSupported;const scratchBVCartesianHigh=new Cartesian3,scratchBVCartesianLow=new Cartesian3,scratchBVCartesian=new Cartesian3,scratchBVCartographic=new Cartographic,scratchBVRectangle=new Rectangle;function getRectangle(e,t){const i=e.mapProjection.ellipsoid;if(!defined(t.attributes)||!defined(t.attributes.position3DHigh))return defined(t.rectangle)?t.rectangle:void 0;const n=t.attributes.position3DHigh.values,r=t.attributes.position3DLow.values,o=n.length;let a=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let e=0;e<o;e+=3){const t=Cartesian3.unpack(n,e,scratchBVCartesianHigh),o=Cartesian3.unpack(r,e,scratchBVCartesianLow),u=Cartesian3.add(t,o,scratchBVCartesian),d=i.cartesianToCartographic(u,scratchBVCartographic),h=d.latitude,p=d.longitude;a=Math.min(a,h),s=Math.min(s,p),c=Math.max(c,h),l=Math.max(l,p)}const u=scratchBVRectangle;return u.north=c,u.south=a,u.east=l,u.west=s,u}function setMinMaxTerrainHeights(e,t,i){const n=ApproximateTerrainHeights.getMinimumMaximumHeights(t,i);e._minTerrainHeight=n.minimumTerrainHeight,e._maxTerrainHeight=n.maximumTerrainHeight}function createBoundingVolume(e,t,i){const n=t.mapProjection.ellipsoid,r=getRectangle(t,i),o=OrientedBoundingBox.fromRectangle(r,e._minHeight,e._maxHeight,n);if(e._boundingVolumes.push(o),!t.scene3DOnly){const i=t.mapProjection,n=BoundingSphere.fromRectangleWithHeights2D(r,i,e._maxHeight,e._minHeight);Cartesian3.fromElements(n.center.z,n.center.x,n.center.y,n.center),e._boundingVolumes2D.push(n)}}function boundingVolumeIndex(e,t){return Math.floor(e%t/2)}function updateAndQueueRenderCommand(e,t,i,n,r,o,a){const s=e._primitive;i.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===s._spColor&&s._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=n,t.boundingVolume=o,t.cull=r,t.debugShowBoundingVolume=a,i.commandList.push(t)}function updateAndQueuePickCommand(e,t,i,n,r,o){const a=e._primitive;i.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===a._spPick&&a._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=n,t.boundingVolume=o,t.cull=r,i.commandList.push(t)}function updateAndQueueCommands$1(e,t,i,n,r,o,a,s){let c;c=t.mode===SceneMode$1.SCENE3D?e._boundingVolumes:e._boundingVolumes2D;const l=e.classificationType,u=l!==ClassificationType$1.CESIUM_3D_TILE,d=l!==ClassificationType$1.TERRAIN,h=t.passes,p=e._primitive;let f,m,g;if(h.render){const n=i.length;for(f=0;f<n;++f)m=c[boundingVolumeIndex(f,n)],u&&(g=i[f],updateAndQueueRenderCommand(e,g,t,r,o,m,a)),d&&(g=i[f].derivedCommands.tileset,updateAndQueueRenderCommand(e,g,t,r,o,m,a));if(t.invertClassification){const i=p._commandsIgnoreShow,n=i.length;for(f=0;f<n;++f)m=c[f],g=i[f],updateAndQueueRenderCommand(e,g,t,r,o,m,a)}}if(h.pick){const i=n.length;let a;for(e._useFragmentCulling||(a=p._primitive._pickOffsets),f=0;f<i;++f){if(m=c[boundingVolumeIndex(f,i)],!e._useFragmentCulling){m=c[a[boundingVolumeIndex(f,i)].index]}u&&(g=n[f],updateAndQueuePickCommand(e,g,t,r,o,m)),d&&(g=n[f].derivedCommands.tileset,updateAndQueuePickCommand(e,g,t,r,o,m))}}}function MaterialProperty(){DeveloperError.throwInstantiationError()}function DynamicGeometryUpdater$1(e,t,i){this._primitives=t,this._orderedGroundPrimitives=i,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}GroundPrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPrimitive.prototype.update=function(e){if(!defined(this._primitive)&&!defined(this.geometryInstances))return;if(!ApproximateTerrainHeights.initialized)return void GroundPrimitive.initializeTerrainHeights();const t=this,i=this._classificationPrimitiveOptions;if(!defined(this._primitive)){const n=e.mapProjection.ellipsoid;let r,o,a;const s=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=s.length,l=new Array(c);let u,d;for(u=0;u<c;++u){r=s[u],o=r.geometry;const t=getRectangle(e,o);defined(d)?defined(t)&&Rectangle.union(d,t,d):d=Rectangle.clone(t);const i=r.id;if(defined(i)&&defined(t)){const e=ApproximateTerrainHeights.getBoundingSphere(t,n);this._boundingSpheresKeys.push(i),this._boundingSpheres.push(e)}a=o.constructor,!defined(a)||defined(a.createShadowVolume)}defined(d)&&setMinMaxTerrainHeights(this,d,n);const h=e.terrainExaggeration,p=e.terrainExaggerationRelativeHeight;this._minHeight=TerrainExaggeration.getHeight(this._minTerrainHeight,h,p),this._maxHeight=TerrainExaggeration.getHeight(this._maxTerrainHeight,h,p);const f=GroundPrimitive._supportsMaterials(e.context);if(this._useFragmentCulling=f,f){let t,i=!0;for(u=0;u<c;++u)if(r=s[u],o=r.geometry,d=getRectangle(e,o),ShadowVolumeAppearance.shouldUseSphericalCoordinates(d)){i=!1;break}for(u=0;u<c;++u){r=s[u],o=r.geometry,a=o.constructor;const c=getRectangle(e,o),d=o.textureCoordinateRotationPoints;t=i?ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes(c,d,n,e.mapProjection,this._maxHeight):ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes(c,d,n,e.mapProjection);const h=r.attributes;for(const e in h)h.hasOwnProperty(e)&&(t[e]=h[e]);l[u]=new GeometryInstance({geometry:a.createShadowVolume(o,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:t,id:r.id})}}else for(u=0;u<c;++u)r=s[u],o=r.geometry,a=o.constructor,l[u]=new GeometryInstance({geometry:a.createShadowVolume(o,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:r.attributes,id:r.id});i.geometryInstances=l,i.appearance=this.appearance,i._createBoundingVolumeFunction=function(e,i){createBoundingVolume(t,e,i)},i._updateAndQueueCommandsFunction=function(e,i,n,r,o,a,s,c){updateAndQueueCommands$1(t,i,n,r,o,a,s)},this._primitive=new ClassificationPrimitive(i),this._primitive.readyPromise.then((function(e){t._ready=!0,t.releaseGeometryInstances&&(t.geometryInstances=void 0);const i=e._error;defined(i)?t._readyPromise.reject(i):t._readyPromise.resolve(t)}))}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)},GroundPrimitive.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(-1!==t)return this._boundingSpheres[t]},GroundPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPrimitive.prototype.isDestroyed=function(){return!1},GroundPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},GroundPrimitive._supportsMaterials=function(e){return e.depthTexture},GroundPrimitive.supportsMaterials=function(e){return GroundPrimitive._supportsMaterials(e.frameState.context)},Object.defineProperties(MaterialProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),MaterialProperty.prototype.getType=DeveloperError.throwInstantiationError,MaterialProperty.prototype.getValue=DeveloperError.throwInstantiationError,MaterialProperty.prototype.equals=DeveloperError.throwInstantiationError,MaterialProperty.getValue=function(e,t,i){let n;return defined(t)&&(n=t.getType(e),defined(n))?(defined(i)&&i.type===n||(i=Material$4.fromType(n)),t.getValue(e,i.uniforms),i):(defined(i)&&i.type===Material$4.ColorType||(i=Material$4.fromType(Material$4.ColorType)),Color.clone(Color.WHITE,i.uniforms.color),i)},DynamicGeometryUpdater$1.prototype._isHidden=function(e,t,i){return!e.isShowing||!e.isAvailable(i)||!Property.getValueOrDefault(t.show,i,!0)},DynamicGeometryUpdater$1.prototype._setOptions=DeveloperError.throwInstantiationError,DynamicGeometryUpdater$1.prototype.update=function(e){const t=this._geometryUpdater,i=t._onTerrain,n=this._primitives,r=this._orderedGroundPrimitives;i?r.remove(this._primitive):(n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;const o=this._entity,a=o[this._geometryUpdater._geometryPropertyName];if(this._setOptions(o,a,e),this._isHidden(o,a,e))return;const s=this._geometryUpdater.shadowsProperty.getValue(e),c=this._options;if(!defined(a.fill)||a.fill.getValue(e)){const o=t.fillMaterialProperty,a=o instanceof ColorMaterialProperty;let l;const u=t._getIsClosed(c);if(a)l=new PerInstanceColorAppearance({closed:u,flat:i&&!t._supportsMaterialsforEntitiesOnTerrain});else{const t=MaterialProperty.getValue(e,o,this._material);this._material=t,l=new MaterialAppearance({material:t,translucent:t.isTranslucent(),closed:u})}if(i)c.vertexFormat=PerInstanceColorAppearance.VERTEX_FORMAT,this._primitive=r.add(new GroundPrimitive({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:l,asynchronous:!1,shadows:s,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),Property.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{c.vertexFormat=l.vertexFormat;const t=this._geometryUpdater.createFillGeometryInstance(e);a&&(l.translucent=255!==t.attributes.color.value[3]),this._primitive=n.add(new Primitive$3({geometryInstances:t,appearance:l,asynchronous:!1,shadows:s}))}}if(!i&&defined(a.outline)&&a.outline.getValue(e)){const i=this._geometryUpdater.createOutlineGeometryInstance(e),r=Property.getValueOrDefault(a.outlineWidth,e,1);this._outlinePrimitive=n.add(new Primitive$3({geometryInstances:i,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==i.attributes.color.value[3],renderState:{lineWidth:t._scene.clampLineWidth(r)}}),asynchronous:!1,shadows:s}))}},DynamicGeometryUpdater$1.prototype.getBoundingSphere=function(e){const t=this._entity,i=this._primitive,n=this._outlinePrimitive;let r;return defined(i)&&i.show&&i.ready&&(r=i.getGeometryInstanceAttributes(t),defined(r)&&defined(r.boundingSphere))||defined(n)&&n.show&&n.ready&&(r=n.getGeometryInstanceAttributes(t),defined(r)&&defined(r.boundingSphere))?(BoundingSphere.clone(r.boundingSphere,e),BoundingSphereState$1.DONE):defined(i)&&!i.ready||defined(n)&&!n.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.FAILED},DynamicGeometryUpdater$1.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater$1.prototype.destroy=function(){const e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),destroyObject(this)};var PolylineShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main(void)\n{\nfloat logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\nvec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);\nif (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);\nfloat widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);\nfloat distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);\nif (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec3 alignedPlaneNormal;\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);\ns = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;\nfloat t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, t);\nmaterialInput.str = vec3(s, t, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\ngl_FragColor.rgb *= gl_FragColor.a;\nczm_writeDepthClamp();\n}\n",PolylineShadowVolumeMorphFS="varying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nfloat rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {\nreturn (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);\n}\nvoid main(void)\n{\nvec4 eyeCoordinate = gl_FragCoord;\neyeCoordinate /= eyeCoordinate.w;\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);\nfloat distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);\ndistanceFromStart = max(0.0, distanceFromStart);\ndistanceFromEnd = max(0.0, distanceFromEnd);\nfloat s = distanceFromStart / (distanceFromStart + distanceFromEnd);\ns = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, v_texcoordT);\nmaterialInput.str = vec3(s, v_texcoordT, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n}\n",PolylineShadowVolumeMorphVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\nattribute float batchId;\nvarying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nvoid main()\n{\nv_batchId = batchId;\nvec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));\nvec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);\nvec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nvec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nvec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec4 startPlane2D;\nvec4 startPlane3D;\nstartPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlane2D.w = -dot(startPlane2D.xyz, posEc2D);\nstartPlane3D.w = -dot(startPlane3D.xyz, posEc3D);\nvec4 rightPlane2D;\nvec4 rightPlane3D;\nrightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nrightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nrightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);\nrightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);\nposRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);\nposRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);\nposRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nposEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nposEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));\nvec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));\nvec4 endPlane2D;\nvec4 endPlane3D;\nendPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlane2D.w = -dot(endPlane2D.xyz, posEc2D);\nendPlane3D.w = -dot(endPlane3D.xyz, posEc3D);\nv_forwardDirectionEC = normalize(endEC - startEC);\nvec2 cleanTexcoordNormalization2D;\ncleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);\ncleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));\nvec2 cleanTexcoordNormalization3D;\ncleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\ncleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;\ncleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));\nv_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#else // PER_INSTANCE_COLOR\nv_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);\nv_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);\n#endif // PER_INSTANCE_COLOR\n#ifdef WIDTH_VARYING\nfloat width = czm_batchTable_width(batchId);\nfloat halfWidth = width * 0.5;\nv_width = width;\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#else\nfloat halfWidth = 0.5 * czm_batchTable_width(batchId);\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#endif\nvec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow);\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);\nvec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nvec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));\ngeodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc3D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\npositionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC;\nvec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nabsStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));\nabsEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));\nplaneDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);\nupOrDown = normalize(cross(rightPlane2D.xyz, planeDirection));\nnormalEC = normalize(cross(planeDirection, upOrDown));\ngeodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));\ngeodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc2D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(texcoordNormalization2D.x);\n#ifndef PER_INSTANCE_COLOR\nv_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);\n#endif\npositionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC;\ngl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineShadowVolumeVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\n#ifndef COLUMBUS_VIEW_2D\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\n#else\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\n#endif\nattribute float batchId;\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main()\n{\n#ifdef COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;\nvec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);\nvec3 ecEnd = forwardDirectionEC + ecStart;\nforwardDirectionEC = normalize(forwardDirectionEC);\nv_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nvec4 startPlaneEC;\nstartPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);\nv_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;\n#else // COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;\nvec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);\nvec3 ecEnd = ecStart + offset;\nvec3 forwardDirectionEC = normalize(offset);\nvec4 startPlaneEC;\nstartPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nv_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\nv_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;\n#endif // COLUMBUS_VIEW_2D\nv_endEcAndStartEcX.xyz = ecEnd;\nv_endEcAndStartEcX.w = ecStart.x;\nv_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif // PER_INSTANCE_COLOR\nvec4 positionRelativeToEye = czm_computePosition();\nvec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye;\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);\nvec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nupOrDown = cross(forwardDirectionEC, normalEC);\nupOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;\nupOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;\nupOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;\npositionEC.xyz += upOrDown;\nv_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));\nfloat width = czm_batchTable_width(batchId);\n#ifdef WIDTH_VARYING\nv_width = width;\n#endif\nv_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;\nv_startPlaneNormalEcAndHalfWidth.w = width * 0.5;\nv_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;\nv_endPlaneNormalEcAndBatchId.w = batchId;\nwidth = width * max(0.0, czm_metersPerPixel(positionEC));\nwidth = width / dot(normalEC, v_rightPlaneEC.xyz);\n#ifdef COLUMBUS_VIEW_2D\nnormalEC *= sign(texcoordNormalization2D.x);\n#else\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\n#endif\npositionEC.xyz += width * normalEC;\ngl_Position = czm_depthClamp(czm_projection * positionEC);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\nv_color = color;\n}\n",PolylineCommon="void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane,\nout vec4 clippedPositionEC)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p0ToP1 = p1 - p0;\nfloat magnitude = length(p0ToP1);\nvec3 direction = normalize(p0ToP1);\nfloat endPoint0Distance = czm_currentFrustum.x + p0.z;\nfloat denominator = -direction.z;\nif (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance > 0.0)\n{\nfloat t = endPoint0Distance / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\np0.z = min(p0.z, -czm_currentFrustum.x);\nclipped = true;\n}\n}\nclippedPositionEC = vec4(p0, 1.0);\npositionWC = czm_eyeToWindowCoordinates(clippedPositionEC);\n}\nvec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n{\n#ifdef POLYLINE_DASH\nvec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\nvec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\nvec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\nvec2 lineDir;\nif (usePrevious) {\nlineDir = normalize(positionWindow.xy - previousWindow.xy);\n}\nelse {\nlineDir = normalize(nextWindow.xy - positionWindow.xy);\n}\nangle = atan(lineDir.x, lineDir.y) - 1.570796327;\nangle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n#endif\nvec4 clippedPrevWC, clippedPrevEC;\nbool prevSegmentClipped, prevSegmentCulled;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);\nvec4 clippedNextWC, clippedNextEC;\nbool nextSegmentClipped, nextSegmentCulled;\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);\nbool segmentClipped, segmentCulled;\nvec4 clippedPositionWC, clippedPositionEC;\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);\nif (segmentCulled)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);\nvec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);\nif (prevSegmentCulled)\n{\ndirectionToPrevWC = -directionToNextWC;\n}\nelse if (nextSegmentCulled)\n{\ndirectionToNextWC = -directionToPrevWC;\n}\nvec2 thisSegmentForwardWC, otherSegmentForwardWC;\nif (usePrevious)\n{\nthisSegmentForwardWC = -directionToPrevWC;\notherSegmentForwardWC = directionToNextWC;\n}\nelse\n{\nthisSegmentForwardWC = directionToNextWC;\notherSegmentForwardWC = -directionToPrevWC;\n}\nvec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);\nvec2 leftWC = thisSegmentLeftWC;\nfloat expandWidth = width * 0.5;\nif (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))\n{\nvec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);\nvec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;\nfloat leftSumLength = length(leftSumWC);\nleftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);\nvec2 u = -thisSegmentForwardWC;\nvec2 v = leftWC;\nfloat sinAngle = abs(u.x * v.y - u.y * v.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;\nreturn vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n{\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nreturn getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n}\n";let defaultVertexShaderSource$1=`${PolylineCommon}\n${PolylineColorAppearanceVS}`;const defaultFragmentShaderSource$1=PerInstanceFlatColorAppearanceFS;function PolylineColorAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),i=PolylineColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource$1),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource$1),this._renderState=Appearance.getDefaultRenderState(t,false,e.renderState),this._closed=false,this._vertexFormat=i}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource$1=`#define CLIP_POLYLINE \n${defaultVertexShaderSource$1}`),Object.defineProperties(PolylineColorAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),PolylineColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PolylineColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;var PolylineMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nattribute float batchId;\nvarying float v_width;\nvarying vec2 v_st;\nvarying float v_polylineAngle;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\nv_width = width;\nv_st.s = st.s;\nv_st.t = czm_writeNonPerspective(st.t, gl_Position.w);\nv_polylineAngle = angle;\n}\n",PolylineFS$1="#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec2 st = v_st;\nst.t = czm_readNonPerspective(st.t, gl_FragCoord.w);\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = vec3(st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#ifdef VECTOR_TILE\ngl_FragColor *= u_highlightColor;\n#endif\nczm_writeLogDepth();\n}\n";let defaultVertexShaderSource=`${PolylineCommon}\n${PolylineMaterialAppearanceVS}`;const defaultFragmentShaderSource=PolylineFS$1;function PolylineMaterialAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),i=PolylineMaterialAppearance.VERTEX_FORMAT;this.material=defined(e.material)?e.material:Material$4.fromType(Material$4.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,false,e.renderState),this._closed=false,this._vertexFormat=i}function GroundPolylinePrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;defined(t)||(t=new PolylineMaterialAppearance),this.appearance=t,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._readyPromise=defer(),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=getRenderState$1(!1),this._renderState3DTiles=getRenderState$1(!0),this._renderStateMorph=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:!0},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}function createShaderProgram$1(e,t,i){const n=t.context,r=e._primitive,o=r._attributeLocations;let a=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeVS);a=Primitive$3._appendShowToShader(r,a),a=Primitive$3._appendDistanceDisplayConditionToShader(r,a),a=Primitive$3._modifyShaderPosition(e,a,t.scene3DOnly);let s=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphVS);s=Primitive$3._appendShowToShader(r,s),s=Primitive$3._appendDistanceDisplayConditionToShader(r,s),s=Primitive$3._modifyShaderPosition(e,s,t.scene3DOnly);let c=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeFS);const l=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`];let u="",d="";defined(i.material)?(d=defined(i.material)?i.material.shaderSource:"",-1!==d.search(/varying\s+float\s+v_polylineAngle;/g)&&l.push("ANGLE_VARYING"),-1!==d.search(/varying\s+float\s+v_width;/g)&&l.push("WIDTH_VARYING")):u="PER_INSTANCE_COLOR",l.push(u);const h=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",u]:[u],p=new ShaderSource({defines:l,sources:[a]}),f=new ShaderSource({defines:h,sources:[d,c]});e._sp=ShaderProgram.replaceCache({context:n,shaderProgram:r._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:o});let m=n.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!defined(m)){const t=new ShaderSource({defines:l.concat(["COLUMBUS_VIEW_2D"]),sources:[a]});m=n.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:n,shaderProgram:e._sp2D,vertexShaderSource:t,fragmentShaderSource:f,attributeLocations:o})}e._sp2D=m;let g=n.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!defined(g)){const t=new ShaderSource({defines:l.concat([`MAX_TERRAIN_HEIGHT ${ApproximateTerrainHeights._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[s]});c=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphFS);const i=new ShaderSource({defines:h,sources:[d,c]});g=n.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:n,shaderProgram:e._spMorph,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:o})}e._spMorph=g}function getRenderState$1(e){return RenderState.fromCache({cull:{enabled:!0},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})}function createCommands$3(e,t,i,n,r,o){const a=e._primitive,s=a._va.length;r.length=s,o.length=s;const c=t instanceof PolylineColorAppearance?{}:i._uniforms,l=a._batchTable.getUniformMapCallback()(c);for(let t=0;t<s;t++){const i=a._va[t];let n=r[t];defined(n)||(n=r[t]=new DrawCommand({owner:e,primitiveType:a._primitiveType})),n.vertexArray=i,n.renderState=e._renderState,n.shaderProgram=e._sp,n.uniformMap=l,n.pass=Pass$1.TERRAIN_CLASSIFICATION,n.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";const o=DrawCommand.shallowClone(n,n.derivedCommands.tileset);o.renderState=e._renderState3DTiles,o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=o;const s=DrawCommand.shallowClone(n,n.derivedCommands.color2D);s.shaderProgram=e._sp2D,n.derivedCommands.color2D=s;const c=DrawCommand.shallowClone(o,o.derivedCommands.color2D);c.shaderProgram=e._sp2D,o.derivedCommands.color2D=c;const u=DrawCommand.shallowClone(n,n.derivedCommands.colorMorph);u.renderState=e._renderStateMorph,u.shaderProgram=e._spMorph,u.pickId="czm_batchTable_pickColor(v_batchId)",n.derivedCommands.colorMorph=u}}function updateAndQueueCommand(e,t,i,n,r,o,a){i.mode===SceneMode$1.MORPHING?t=t.derivedCommands.colorMorph:i.mode!==SceneMode$1.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=n,t.boundingVolume=o,t.cull=r,t.debugShowBoundingVolume=a,i.commandList.push(t)}function updateAndQueueCommands(e,t,i,n,r,o,a){const s=e._primitive;let c;Primitive$3._updateBoundingVolumes(s,t,r),t.mode===SceneMode$1.SCENE3D?c=s._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?c=s._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(s._boundingSphere2D)?c=s._boundingSphere2D:defined(s._boundingSphereMorph)&&(c=s._boundingSphereMorph);const l=t.mode===SceneMode$1.MORPHING,u=e.classificationType,d=u!==ClassificationType$1.CESIUM_3D_TILE,h=u!==ClassificationType$1.TERRAIN&&!l;let p;const f=t.passes;if(f.render||f.pick&&s.allowPicking){const n=i.length;for(let s=0;s<n;++s){const n=c[s];d&&(p=i[s],updateAndQueueCommand(e,p,t,r,o,n,a)),h&&(p=i[s].derivedCommands.tileset,updateAndQueueCommand(e,p,t,r,o,n,a))}}}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource=`#define CLIP_POLYLINE \n${defaultVertexShaderSource}`),Object.defineProperties(PolylineMaterialAppearance.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&(e=`#define POLYLINE_DASH\n${e}`),e}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),PolylineMaterialAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,PolylineMaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineMaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineMaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,Object.defineProperties(GroundPolylinePrimitive.prototype,{interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}}),GroundPolylinePrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPolylinePrimitive.prototype.update=function(e){if(!defined(this._primitive)&&!defined(this.geometryInstances))return;if(!ApproximateTerrainHeights.initialized)return void GroundPolylinePrimitive.initializeTerrainHeights();let t;const i=this,n=this._primitiveOptions;if(!defined(this._primitive)){const r=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],o=r.length,a=new Array(o);let s;for(t=0;t<o;++t)if(s=r[t].attributes,!defined(s)||!defined(s.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<o;++t){const n=r[t];s={};const o=n.attributes;for(const e in o)o.hasOwnProperty(e)&&(s[e]=o[e]);defined(s.width)||(s.width=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,value:[n.geometry.width]})),n.geometry._scene3DOnly=e.scene3DOnly,GroundPolylineGeometry.setProjectionAndEllipsoid(n.geometry,e.mapProjection),a[t]=new GeometryInstance({geometry:n.geometry,attributes:s,id:n.id,pickPrimitive:i})}n.geometryInstances=a,n.appearance=this.appearance,n._createShaderProgramFunction=function(e,t,n){createShaderProgram$1(i,t,n)},n._createCommandsFunction=function(e,t,n,r,o,a,s){createCommands$3(i,t,n,r,a,s)},n._updateAndQueueCommandsFunction=function(e,t,n,r,o,a,s,c){updateAndQueueCommands(i,t,n,r,o,a,s)},this._primitive=new Primitive$3(n),this._primitive.readyPromise.then((function(e){i._ready=!0,i.releaseGeometryInstances&&(i.geometryInstances=void 0);const t=e._error;defined(t)?i._readyPromise.reject(t):i._readyPromise.resolve(i)}))}if(this.appearance instanceof PolylineColorAppearance&&!this._hasPerInstanceColors)throw new DeveloperError("All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.");this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)},GroundPolylinePrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPolylinePrimitive.isSupported=function(e){return e.frameState.context.depthTexture},GroundPolylinePrimitive.prototype.isDestroyed=function(){return!1},GroundPolylinePrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._sp2D=void 0,this._spMorph=void 0,destroyObject(this)};const defaultRepeat$2=new Cartesian2(1,1),defaultTransparent=!1,defaultColor$7=Color.WHITE;function ImageMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._image=void 0,this._imageSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._transparent=void 0,this._transparentSubscription=void 0,this.image=e.image,this.repeat=e.repeat,this.color=e.color,this.transparent=e.transparent}function createMaterialProperty(e){if(e instanceof Color)return new ColorMaterialProperty(e);if("string"==typeof e||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new ImageMaterialProperty;return t.image=e,t}}function createMaterialPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createMaterialProperty)}function BoxGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PositionProperty(){DeveloperError.throwInstantiationError()}Object.defineProperties(ImageMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._image)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:createPropertyDescriptor("image"),repeat:createPropertyDescriptor("repeat"),color:createPropertyDescriptor("color"),transparent:createPropertyDescriptor("transparent")}),ImageMaterialProperty.prototype.getType=function(e){return"Image"},ImageMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.image=Property.getValueOrUndefined(this._image,e),t.repeat=Property.getValueOrClonedDefault(this._repeat,e,defaultRepeat$2,t.repeat),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$7,t.color),Property.getValueOrDefault(this._transparent,e,defaultTransparent)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t},ImageMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ImageMaterialProperty&&Property.equals(this._image,e._image)&&Property.equals(this._repeat,e._repeat)&&Property.equals(this._color,e._color)&&Property.equals(this._transparent,e._transparent)},Object.defineProperties(BoxGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),dimensions:createPropertyDescriptor("dimensions"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),BoxGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.dimensions=this.dimensions,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new BoxGraphics(this)},BoxGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PositionProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError},referenceFrame:{get:DeveloperError.throwInstantiationError}}),PositionProperty.prototype.getValue=DeveloperError.throwInstantiationError,PositionProperty.prototype.getValueInReferenceFrame=DeveloperError.throwInstantiationError,PositionProperty.prototype.equals=DeveloperError.throwInstantiationError;const scratchMatrix3$1=new Matrix3;function ConstantPositionProperty(e,t){this._definitionChanged=new Event,this._value=Cartesian3.clone(e),this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED)}function CorridorGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createRawProperty(e){return e}function createRawPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createRawProperty)}function CylinderGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._length=void 0,this._lengthSubscription=void 0,this._topRadius=void 0,this._topRadiusSubscription=void 0,this._bottomRadius=void 0,this._bottomRadiusSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._slices=void 0,this._slicesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipseGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._semiMajorAxis=void 0,this._semiMajorAxisSubscription=void 0,this._semiMinorAxis=void 0,this._semiMinorAxisSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipsoidGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._radii=void 0,this._radiiSubscription=void 0,this._innerRadii=void 0,this._innerRadiiSubscription=void 0,this._minimumClock=void 0,this._minimumClockSubscription=void 0,this._maximumClock=void 0,this._maximumClockSubscription=void 0,this._minimumCone=void 0,this._minimumConeSubscription=void 0,this._maximumCone=void 0,this._maximumConeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._stackPartitions=void 0,this._stackPartitionsSubscription=void 0,this._slicePartitions=void 0,this._slicePartitionsSubscription=void 0,this._subdivisions=void 0,this._subdivisionsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function LabelGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._text=void 0,this._textSubscription=void 0,this._font=void 0,this._fontSubscription=void 0,this._style=void 0,this._styleSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._showBackground=void 0,this._showBackgroundSubscription=void 0,this._backgroundColor=void 0,this._backgroundColorSubscription=void 0,this._backgroundPadding=void 0,this._backgroundPaddingSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fillColor=void 0,this._fillColorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}PositionProperty.convertToReferenceFrame=function(e,t,i,n,r){if(!defined(t))return t;if(defined(r)||(r=new Cartesian3),i===n)return Cartesian3.clone(t,r);let o=Transforms.computeIcrfToFixedMatrix(e,scratchMatrix3$1);return defined(o)||(o=Transforms.computeTemeToPseudoFixedMatrix(e,scratchMatrix3$1)),i===ReferenceFrame$1.INERTIAL?Matrix3.multiplyByVector(o,t,r):i===ReferenceFrame$1.FIXED?Matrix3.multiplyByVector(Matrix3.transpose(o,scratchMatrix3$1),t,r):void 0},Object.defineProperties(ConstantPositionProperty.prototype,{isConstant:{get:function(){return!defined(this._value)||this._referenceFrame===ReferenceFrame$1.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),ConstantPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ConstantPositionProperty.prototype.setValue=function(e,t){let i=!1;Cartesian3.equals(this._value,e)||(i=!0,this._value=Cartesian3.clone(e)),defined(t)&&this._referenceFrame!==t&&(i=!0,this._referenceFrame=t),i&&this._definitionChanged.raiseEvent(this)},ConstantPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){return PositionProperty.convertToReferenceFrame(e,this._value,this._referenceFrame,t,i)},ConstantPositionProperty.prototype.equals=function(e){return this===e||e instanceof ConstantPositionProperty&&Cartesian3.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame},Object.defineProperties(CorridorGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),CorridorGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new CorridorGraphics(this)},CorridorGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(CylinderGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),length:createPropertyDescriptor("length"),topRadius:createPropertyDescriptor("topRadius"),bottomRadius:createPropertyDescriptor("bottomRadius"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),slices:createPropertyDescriptor("slices"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),CylinderGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.length=this.length,e.topRadius=this.topRadius,e.bottomRadius=this.bottomRadius,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.slices=this.slices,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new CylinderGraphics(this)},CylinderGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.length=defaultValue(this.length,e.length),this.topRadius=defaultValue(this.topRadius,e.topRadius),this.bottomRadius=defaultValue(this.bottomRadius,e.bottomRadius),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=defaultValue(this.slices,e.slices),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(EllipseGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),semiMajorAxis:createPropertyDescriptor("semiMajorAxis"),semiMinorAxis:createPropertyDescriptor("semiMinorAxis"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),EllipseGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.semiMajorAxis=this.semiMajorAxis,e.semiMinorAxis=this.semiMinorAxis,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new EllipseGraphics(this)},EllipseGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.semiMajorAxis=defaultValue(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=defaultValue(this.semiMinorAxis,e.semiMinorAxis),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(EllipsoidGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),radii:createPropertyDescriptor("radii"),innerRadii:createPropertyDescriptor("innerRadii"),minimumClock:createPropertyDescriptor("minimumClock"),maximumClock:createPropertyDescriptor("maximumClock"),minimumCone:createPropertyDescriptor("minimumCone"),maximumCone:createPropertyDescriptor("maximumCone"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),stackPartitions:createPropertyDescriptor("stackPartitions"),slicePartitions:createPropertyDescriptor("slicePartitions"),subdivisions:createPropertyDescriptor("subdivisions"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),EllipsoidGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.radii=this.radii,e.innerRadii=this.innerRadii,e.minimumClock=this.minimumClock,e.maximumClock=this.maximumClock,e.minimumCone=this.minimumCone,e.maximumCone=this.maximumCone,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.stackPartitions=this.stackPartitions,e.slicePartitions=this.slicePartitions,e.subdivisions=this.subdivisions,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new EllipsoidGraphics(this)},EllipsoidGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.radii=defaultValue(this.radii,e.radii),this.innerRadii=defaultValue(this.innerRadii,e.innerRadii),this.minimumClock=defaultValue(this.minimumClock,e.minimumClock),this.maximumClock=defaultValue(this.maximumClock,e.maximumClock),this.minimumCone=defaultValue(this.minimumCone,e.minimumCone),this.maximumCone=defaultValue(this.maximumCone,e.maximumCone),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.stackPartitions=defaultValue(this.stackPartitions,e.stackPartitions),this.slicePartitions=defaultValue(this.slicePartitions,e.slicePartitions),this.subdivisions=defaultValue(this.subdivisions,e.subdivisions),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(LabelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),text:createPropertyDescriptor("text"),font:createPropertyDescriptor("font"),style:createPropertyDescriptor("style"),scale:createPropertyDescriptor("scale"),showBackground:createPropertyDescriptor("showBackground"),backgroundColor:createPropertyDescriptor("backgroundColor"),backgroundPadding:createPropertyDescriptor("backgroundPadding"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),fillColor:createPropertyDescriptor("fillColor"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),LabelGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.text=this.text,e.font=this.font,e.style=this.style,e.scale=this.scale,e.showBackground=this.showBackground,e.backgroundColor=this.backgroundColor,e.backgroundPadding=this.backgroundPadding,e.pixelOffset=this.pixelOffset,e.eyeOffset=this.eyeOffset,e.horizontalOrigin=this.horizontalOrigin,e.verticalOrigin=this.verticalOrigin,e.heightReference=this.heightReference,e.fillColor=this.fillColor,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.translucencyByDistance=this.translucencyByDistance,e.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance,e.scaleByDistance=this.scaleByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new LabelGraphics(this)},LabelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.text=defaultValue(this.text,e.text),this.font=defaultValue(this.font,e.font),this.style=defaultValue(this.style,e.style),this.scale=defaultValue(this.scale,e.scale),this.showBackground=defaultValue(this.showBackground,e.showBackground),this.backgroundColor=defaultValue(this.backgroundColor,e.backgroundColor),this.backgroundPadding=defaultValue(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=defaultValue(this.pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this.verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fillColor=defaultValue(this.fillColor,e.fillColor),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=defaultValue(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)};const defaultNodeTransformation=new TranslationRotationScale;function NodeTransformationProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._translation=void 0,this._translationSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this.translation=e.translation,this.rotation=e.rotation,this.scale=e.scale}function PropertyBag(e,t){this._propertyNames=[],this._definitionChanged=new Event,defined(e)&&this.merge(e,t)}function createConstantProperty(e){return new ConstantProperty(e)}function propertiesEqual(e,t){const i=e._propertyNames,n=t._propertyNames,r=i.length;if(r!==n.length)return!1;for(let o=0;o<r;++o){const r=i[o];if(-1===n.indexOf(r))return!1;if(!Property.equals(e[r],t[r]))return!1}return!0}function createNodeTransformationProperty(e){return new NodeTransformationProperty(e)}function createNodeTransformationPropertyBag(e){return new PropertyBag(e,createNodeTransformationProperty)}function createArticulationStagePropertyBag(e){return new PropertyBag(e)}function ModelGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._maximumScale=void 0,this._maximumScaleSubscription=void 0,this._incrementallyLoadTextures=void 0,this._incrementallyLoadTexturesSubscription=void 0,this._runAnimations=void 0,this._runAnimationsSubscription=void 0,this._clampAnimations=void 0,this._clampAnimationsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._silhouetteColor=void 0,this._silhouetteColorSubscription=void 0,this._silhouetteSize=void 0,this._silhouetteSizeSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._colorBlendMode=void 0,this._colorBlendModeSubscription=void 0,this._colorBlendAmount=void 0,this._colorBlendAmountSubscription=void 0,this._imageBasedLightingFactor=void 0,this._imageBasedLightingFactorSubscription=void 0,this._lightColor=void 0,this._lightColorSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._nodeTransformations=void 0,this._nodeTransformationsSubscription=void 0,this._articulations=void 0,this._articulationsSubscription=void 0,this._clippingPlanes=void 0,this._clippingPlanesSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function Cesium3DTilesetGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._maximumScreenSpaceError=void 0,this._maximumScreenSpaceErrorSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PathGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._leadTime=void 0,this._leadTimeSubscription=void 0,this._trailTime=void 0,this._trailTimeSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._resolution=void 0,this._resolutionSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PlaneGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PointGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._pixelSize=void 0,this._pixelSizeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createPolygonHierarchyProperty(e){return Array.isArray(e)&&(e=new PolygonHierarchy(e)),new ConstantProperty(e)}function PolygonGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._depthFailMaterial=void 0,this._depthFailMaterialSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._clampToGround=void 0,this._clampToGroundSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineVolumeGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._shape=void 0,this._shapeSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubsription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function RectangleGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._coordinates=void 0,this._coordinatesSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distancedisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function WallGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._minimumHeights=void 0,this._minimumHeightsSubscription=void 0,this._maximumHeights=void 0,this._maximumHeightsSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}Object.defineProperties(NodeTransformationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._translation)&&Property.isConstant(this._rotation)&&Property.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:createPropertyDescriptor("translation"),rotation:createPropertyDescriptor("rotation"),scale:createPropertyDescriptor("scale")}),NodeTransformationProperty.prototype.getValue=function(e,t){return defined(t)||(t=new TranslationRotationScale),t.translation=Property.getValueOrClonedDefault(this._translation,e,defaultNodeTransformation.translation,t.translation),t.rotation=Property.getValueOrClonedDefault(this._rotation,e,defaultNodeTransformation.rotation,t.rotation),t.scale=Property.getValueOrClonedDefault(this._scale,e,defaultNodeTransformation.scale,t.scale),t},NodeTransformationProperty.prototype.equals=function(e){return this===e||e instanceof NodeTransformationProperty&&Property.equals(this._translation,e._translation)&&Property.equals(this._rotation,e._rotation)&&Property.equals(this._scale,e._scale)},Object.defineProperties(PropertyBag.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){const e=this._propertyNames;for(let t=0,i=e.length;t<i;t++)if(!Property.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyBag.prototype.hasProperty=function(e){return-1!==this._propertyNames.indexOf(e)},PropertyBag.prototype.addProperty=function(e,t,i){this._propertyNames.push(e),Object.defineProperty(this,e,createPropertyDescriptor(e,!0,defaultValue(i,createConstantProperty))),defined(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.removeProperty=function(e){const t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e],this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.getValue=function(e,t){defined(t)||(t={});const i=this._propertyNames;for(let n=0,r=i.length;n<r;n++){const r=i[n];t[r]=Property.getValueOrUndefined(this[r],e,t[r])}return t},PropertyBag.prototype.merge=function(e,t){const i=this._propertyNames,n=defined(e._propertyNames)?e._propertyNames:Object.keys(e);for(let r=0,o=n.length;r<o;r++){const o=n[r],a=this[o],s=e[o];void 0===a&&-1===i.indexOf(o)&&this.addProperty(o,void 0,t),void 0!==s&&(void 0!==a?defined(a)&&defined(a.merge)&&a.merge(s):defined(s)&&defined(s.merge)&&defined(s.clone)?this[o]=s.clone():this[o]=s)}},PropertyBag.prototype.equals=function(e){return this===e||e instanceof PropertyBag&&propertiesEqual(this,e)},Object.defineProperties(ModelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),uri:createPropertyDescriptor("uri"),scale:createPropertyDescriptor("scale"),minimumPixelSize:createPropertyDescriptor("minimumPixelSize"),maximumScale:createPropertyDescriptor("maximumScale"),incrementallyLoadTextures:createPropertyDescriptor("incrementallyLoadTextures"),runAnimations:createPropertyDescriptor("runAnimations"),clampAnimations:createPropertyDescriptor("clampAnimations"),shadows:createPropertyDescriptor("shadows"),heightReference:createPropertyDescriptor("heightReference"),silhouetteColor:createPropertyDescriptor("silhouetteColor"),silhouetteSize:createPropertyDescriptor("silhouetteSize"),color:createPropertyDescriptor("color"),colorBlendMode:createPropertyDescriptor("colorBlendMode"),colorBlendAmount:createPropertyDescriptor("colorBlendAmount"),imageBasedLightingFactor:createPropertyDescriptor("imageBasedLightingFactor"),lightColor:createPropertyDescriptor("lightColor"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),nodeTransformations:createPropertyDescriptor("nodeTransformations",void 0,createNodeTransformationPropertyBag),articulations:createPropertyDescriptor("articulations",void 0,createArticulationStagePropertyBag),clippingPlanes:createPropertyDescriptor("clippingPlanes")}),ModelGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,e.minimumPixelSize=this.minimumPixelSize,e.maximumScale=this.maximumScale,e.incrementallyLoadTextures=this.incrementallyLoadTextures,e.runAnimations=this.runAnimations,e.clampAnimations=this.clampAnimations,e.heightReference=this._heightReference,e.silhouetteColor=this.silhouetteColor,e.silhouetteSize=this.silhouetteSize,e.color=this.color,e.colorBlendMode=this.colorBlendMode,e.colorBlendAmount=this.colorBlendAmount,e.imageBasedLightingFactor=this.imageBasedLightingFactor,e.lightColor=this.lightColor,e.distanceDisplayCondition=this.distanceDisplayCondition,e.nodeTransformations=this.nodeTransformations,e.articulations=this.articulations,e.clippingPlanes=this.clippingPlanes,e):new ModelGraphics(this)},ModelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.uri=defaultValue(this.uri,e.uri),this.scale=defaultValue(this.scale,e.scale),this.minimumPixelSize=defaultValue(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=defaultValue(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=defaultValue(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=defaultValue(this.runAnimations,e.runAnimations),this.clampAnimations=defaultValue(this.clampAnimations,e.clampAnimations),this.shadows=defaultValue(this.shadows,e.shadows),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.silhouetteColor=defaultValue(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=defaultValue(this.silhouetteSize,e.silhouetteSize),this.color=defaultValue(this.color,e.color),this.colorBlendMode=defaultValue(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=defaultValue(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=defaultValue(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=defaultValue(this.lightColor,e.lightColor),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=defaultValue(this.clippingPlanes,e.clippingPlanes);const t=e.nodeTransformations;if(defined(t)){const e=this.nodeTransformations;defined(e)?e.merge(t):this.nodeTransformations=new PropertyBag(t,createNodeTransformationProperty)}const i=e.articulations;if(defined(i)){const e=this.articulations;defined(e)?e.merge(i):this.articulations=new PropertyBag(i)}},Object.defineProperties(Cesium3DTilesetGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),uri:createPropertyDescriptor("uri"),maximumScreenSpaceError:createPropertyDescriptor("maximumScreenSpaceError")}),Cesium3DTilesetGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new Cesium3DTilesetGraphics(this)},Cesium3DTilesetGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.uri=defaultValue(this.uri,e.uri),this.maximumScreenSpaceError=defaultValue(this.maximumScreenSpaceError,e.maximumScreenSpaceError)},Object.defineProperties(PathGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),leadTime:createPropertyDescriptor("leadTime"),trailTime:createPropertyDescriptor("trailTime"),width:createPropertyDescriptor("width"),resolution:createPropertyDescriptor("resolution"),material:createMaterialPropertyDescriptor("material"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PathGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.leadTime=this.leadTime,e.trailTime=this.trailTime,e.width=this.width,e.resolution=this.resolution,e.material=this.material,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PathGraphics(this)},PathGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.leadTime=defaultValue(this.leadTime,e.leadTime),this.trailTime=defaultValue(this.trailTime,e.trailTime),this.width=defaultValue(this.width,e.width),this.resolution=defaultValue(this.resolution,e.resolution),this.material=defaultValue(this.material,e.material),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PlaneGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),plane:createPropertyDescriptor("plane"),dimensions:createPropertyDescriptor("dimensions"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PlaneGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.plane=this.plane,e.dimensions=this.dimensions,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PlaneGraphics(this)},PlaneGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.plane=defaultValue(this.plane,e.plane),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PointGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),pixelSize:createPropertyDescriptor("pixelSize"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),PointGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.pixelSize=this.pixelSize,e.heightReference=this.heightReference,e.color=this.color,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.scaleByDistance=this.scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new PointGraphics(this)},PointGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.pixelSize=defaultValue(this.pixelSize,e.pixelSize),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.color=defaultValue(this.color,e.color),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)},Object.defineProperties(PolygonGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),hierarchy:createPropertyDescriptor("hierarchy",void 0,createPolygonHierarchyProperty),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),perPositionHeight:createPropertyDescriptor("perPositionHeight"),closeTop:createPropertyDescriptor("closeTop"),closeBottom:createPropertyDescriptor("closeBottom"),arcType:createPropertyDescriptor("arcType"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolygonGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.hierarchy=this.hierarchy,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e.arcType=this.arcType,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new PolygonGraphics(this)},PolygonGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.hierarchy=defaultValue(this.hierarchy,e.hierarchy),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.perPositionHeight=defaultValue(this.perPositionHeight,e.perPositionHeight),this.closeTop=defaultValue(this.closeTop,e.closeTop),this.closeBottom=defaultValue(this.closeBottom,e.closeBottom),this.arcType=defaultValue(this.arcType,e.arcType),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(PolylineGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),granularity:createPropertyDescriptor("granularity"),material:createMaterialPropertyDescriptor("material"),depthFailMaterial:createMaterialPropertyDescriptor("depthFailMaterial"),arcType:createPropertyDescriptor("arcType"),clampToGround:createPropertyDescriptor("clampToGround"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolylineGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.granularity=this.granularity,e.material=this.material,e.depthFailMaterial=this.depthFailMaterial,e.arcType=this.arcType,e.clampToGround=this.clampToGround,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new PolylineGraphics(this)},PolylineGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.granularity=defaultValue(this.granularity,e.granularity),this.material=defaultValue(this.material,e.material),this.depthFailMaterial=defaultValue(this.depthFailMaterial,e.depthFailMaterial),this.arcType=defaultValue(this.arcType,e.arcType),this.clampToGround=defaultValue(this.clampToGround,e.clampToGround),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(PolylineVolumeGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),shape:createPropertyDescriptor("shape"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PolylineVolumeGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.shape=this.shape,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PolylineVolumeGraphics(this)},PolylineVolumeGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.shape=defaultValue(this.shape,e.shape),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(RectangleGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),coordinates:createPropertyDescriptor("coordinates"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),RectangleGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.coordinates=this.coordinates,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new RectangleGraphics(this)},RectangleGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.coordinates=defaultValue(this.coordinates,e.coordinates),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(WallGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),minimumHeights:createPropertyDescriptor("minimumHeights"),maximumHeights:createPropertyDescriptor("maximumHeights"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),WallGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.minimumHeights=this.minimumHeights,e.maximumHeights=this.maximumHeights,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new WallGraphics(this)},WallGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.minimumHeights=defaultValue(this.minimumHeights,e.minimumHeights),this.maximumHeights=defaultValue(this.maximumHeights,e.maximumHeights),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)};const cartoScratch$1=new Cartographic;function createConstantPositionProperty(e){return new ConstantPositionProperty(e)}function createPositionPropertyDescriptor(e){return createPropertyDescriptor(e,void 0,createConstantPositionProperty)}function createPropertyTypeDescriptor(e,t){return createPropertyDescriptor(e,void 0,(function(e){return e instanceof t?e:new t(e)}))}function Entity(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id;defined(t)||(t=createGuid()),this._availability=void 0,this._id=t,this._definitionChanged=new Event,this._name=e.name,this._show=defaultValue(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","tileset","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall"],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._tileset=void 0,this._tilesetSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._properties=void 0,this._propertiesSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.entityCollection=void 0,this.parent=e.parent,this.merge(e)}function updateShow(e,t,i){const n=t.length;for(let e=0;e<n;e++){const n=t[e],r=n._show;(!i&&r)!==(i&&r)&&updateShow(n,n._children,i)}e._definitionChanged.raiseEvent(e,"isShowing",i,!i)}Object.defineProperties(Entity.prototype,{availability:createRawPropertyDescriptor("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:createRawPropertyDescriptor("name"),show:{get:function(){return this._show},set:function(e){if(e===this._show)return;const t=this.isShowing;this._show=e;const i=this.isShowing;t!==i&&updateShow(this,this._children,i),this._definitionChanged.raiseEvent(this,"show",e,!e)}},isShowing:{get:function(){return this._show&&(!defined(this.entityCollection)||this.entityCollection.show)&&(!defined(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){const t=this._parent;if(t===e)return;const i=this.isShowing;if(defined(t)){const e=t._children.indexOf(this);t._children.splice(e,1)}this._parent=e,defined(e)&&e._children.push(this);const n=this.isShowing;i!==n&&updateShow(this,this._children,n),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:createPropertyTypeDescriptor("billboard",BillboardGraphics),box:createPropertyTypeDescriptor("box",BoxGraphics),corridor:createPropertyTypeDescriptor("corridor",CorridorGraphics),cylinder:createPropertyTypeDescriptor("cylinder",CylinderGraphics),description:createPropertyDescriptor("description"),ellipse:createPropertyTypeDescriptor("ellipse",EllipseGraphics),ellipsoid:createPropertyTypeDescriptor("ellipsoid",EllipsoidGraphics),label:createPropertyTypeDescriptor("label",LabelGraphics),model:createPropertyTypeDescriptor("model",ModelGraphics),tileset:createPropertyTypeDescriptor("tileset",Cesium3DTilesetGraphics),orientation:createPropertyDescriptor("orientation"),path:createPropertyTypeDescriptor("path",PathGraphics),plane:createPropertyTypeDescriptor("plane",PlaneGraphics),point:createPropertyTypeDescriptor("point",PointGraphics),polygon:createPropertyTypeDescriptor("polygon",PolygonGraphics),polyline:createPropertyTypeDescriptor("polyline",PolylineGraphics),polylineVolume:createPropertyTypeDescriptor("polylineVolume",PolylineVolumeGraphics),properties:createPropertyTypeDescriptor("properties",PropertyBag),position:createPositionPropertyDescriptor("position"),rectangle:createPropertyTypeDescriptor("rectangle",RectangleGraphics),viewFrom:createPropertyDescriptor("viewFrom"),wall:createPropertyTypeDescriptor("wall",WallGraphics)}),Entity.prototype.isAvailable=function(e){const t=this._availability;return!defined(t)||t.contains(e)},Entity.prototype.addProperty=function(e){this._propertyNames.push(e),Object.defineProperty(this,e,createRawPropertyDescriptor(e,!0))},Entity.prototype.removeProperty=function(e){const t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e]},Entity.prototype.merge=function(e){this.name=defaultValue(this.name,e.name),this.availability=defaultValue(this.availability,e.availability);const t=this._propertyNames,i=defined(e._propertyNames)?e._propertyNames:Object.keys(e),n=i.length;for(let r=0;r<n;r++){const n=i[r];if("parent"===n||"name"===n||"availability"===n)continue;const o=this[n],a=e[n];defined(o)||-1!==t.indexOf(n)||this.addProperty(n),defined(a)&&(defined(o)?defined(o.merge)&&o.merge(a):defined(a.merge)&&defined(a.clone)?this[n]=a.clone():this[n]=a)}};const matrix3Scratch=new Matrix3,positionScratch$7=new Cartesian3,orientationScratch=new Quaternion;Entity.prototype.computeModelMatrix=function(e,t){const i=Property.getValueOrUndefined(this._position,e,positionScratch$7);if(!defined(i))return;const n=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return t=defined(n)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(n,matrix3Scratch),i,t):Transforms.eastNorthUpToFixedFrame(i,void 0,t)},Entity.prototype.computeModelMatrixForHeightReference=function(e,t,i,n,r){const o=Property.getValueOrDefault(t,e,HeightReference$1.NONE);let a=Property.getValueOrUndefined(this._position,e,positionScratch$7);if(o===HeightReference$1.NONE||!defined(a)||Cartesian3.equalsEpsilon(a,Cartesian3.ZERO,CesiumMath.EPSILON8))return this.computeModelMatrix(e,r);const s=n.cartesianToCartographic(a,cartoScratch$1);o===HeightReference$1.CLAMP_TO_GROUND?s.height=i:s.height+=i,a=n.cartographicToCartesian(s,a);const c=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return r=defined(c)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(c,matrix3Scratch),a,r):Transforms.eastNorthUpToFixedFrame(a,void 0,r)},Entity.supportsMaterialsforEntitiesOnTerrain=function(e){return GroundPrimitive.supportsMaterials(e)},Entity.supportsPolylinesOnTerrain=function(e){return GroundPolylinePrimitive.isSupported(e)};const defaultMaterial$2=new ColorMaterialProperty(Color.WHITE),defaultShow$1=new ConstantProperty(!0),defaultFill$1=new ConstantProperty(!0),defaultOutline=new ConstantProperty(!1),defaultOutlineColor$3=new ConstantProperty(Color.BLACK),defaultShadows$2=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition$7=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType$1=new ConstantProperty(ClassificationType$1.BOTH);function GeometryUpdater(e){const t=e.entity,i=e.geometryPropertyName;this._entity=t,this._scene=e.scene,this._fillEnabled=!1,this._isClosed=!1,this._onTerrain=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new Event,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=i,this._id=`${i}-${t.id}`,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=Entity.supportsMaterialsforEntitiesOnTerrain(e.scene)}function CallbackProperty(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new Event,this.setCallback(e,t)}Object.defineProperties(GeometryUpdater.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},onTerrain:{get:function(){return this._onTerrain}},geometryChanged:{get:function(){return this._geometryChanged}}}),GeometryUpdater.prototype.isOutlineVisible=function(e){const t=this._entity;return defaultValue(this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e),!1)},GeometryUpdater.prototype.isFilled=function(e){const t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e),!1)},GeometryUpdater.prototype.createFillGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.createOutlineGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.isDestroyed=function(){return!1},GeometryUpdater.prototype.destroy=function(){destroyObject(this)},GeometryUpdater.prototype._isHidden=function(e,t){const i=t.show;return defined(i)&&i.isConstant&&!i.getValue(Iso8601.MINIMUM_VALUE)},GeometryUpdater.prototype._isOnTerrain=function(e,t){return!1},GeometryUpdater.prototype._getIsClosed=function(e){return!0},GeometryUpdater.prototype._isDynamic=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._setStaticOptions=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,n){if(-1===this._observedPropertyNames.indexOf(t))return;const r=this._entity[this._geometryPropertyName];if(!defined(r))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));const o=r.fill,a=!defined(o)||!o.isConstant||o.getValue(Iso8601.MINIMUM_VALUE),s=r.outline;let c=defined(s);if(c&&s.isConstant&&(c=s.getValue(Iso8601.MINIMUM_VALUE)),!a&&!c)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));const l=r.show;if(this._isHidden(e,r))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));this._materialProperty=defaultValue(r.material,defaultMaterial$2),this._fillProperty=defaultValue(o,defaultFill$1),this._showProperty=defaultValue(l,defaultShow$1),this._showOutlineProperty=defaultValue(r.outline,defaultOutline),this._outlineColorProperty=c?defaultValue(r.outlineColor,defaultOutlineColor$3):void 0,this._shadowsProperty=defaultValue(r.shadows,defaultShadows$2),this._distanceDisplayConditionProperty=defaultValue(r.distanceDisplayCondition,defaultDistanceDisplayCondition$7),this._classificationTypeProperty=defaultValue(r.classificationType,defaultClassificationType$1),this._fillEnabled=a;const u=this._isOnTerrain(e,r)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof ColorMaterialProperty);if(c&&u&&(oneTimeWarning(oneTimeWarning.geometryOutlines),c=!1),this._onTerrain=u,this._outlineEnabled=c,this._isDynamic(e,r))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,r),this._isClosed=this._getIsClosed(this._options);const t=r.outlineWidth;this._outlineWidth=defined(t)?t.getValue(Iso8601.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}},GeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new this.constructor.DynamicGeometryUpdater(this,e,t)},Object.defineProperties(CallbackProperty.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}}),CallbackProperty.prototype.getValue=function(e,t){return this._callback(e,t)},CallbackProperty.prototype.setCallback=function(e,t){const i=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,i&&this._definitionChanged.raiseEvent(this)},CallbackProperty.prototype.equals=function(e){return this===e||e instanceof CallbackProperty&&this._callback===e._callback&&this._isConstant===e._isConstant};const scratchPosition$a=new Cartesian3,scratchCarto$1=new Cartographic;function TerrainOffsetProperty(e,t,i,n){this._scene=e,this._heightReference=i,this._extrudedHeightReference=n,this._positionProperty=t,this._position=new Cartesian3,this._cartographicPosition=new Cartographic,this._normal=new Cartesian3,this._definitionChanged=new Event,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;const r=this;if(defined(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener((function(){r._updateClamping()})),this._removeModeListener=e.morphComplete.addEventListener((function(){r._updateClamping()}))),t.isConstant){const i=t.getValue(Iso8601.MINIMUM_VALUE,scratchPosition$a);if(!defined(i)||Cartesian3.equals(i,Cartesian3.ZERO)||!defined(e.globe))return;this._position=Cartesian3.clone(i,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(i,this._normal)}}function heightReferenceOnEntityPropertyChanged(e,t,i,n){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,i,n),-1===this._observedPropertyNames.indexOf(t))return;const r=this._entity[this._geometryPropertyName];if(!defined(r))return;defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const o=r.heightReference;if(defined(o)){const e=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,e,o)}}Object.defineProperties(TerrainOffsetProperty.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),TerrainOffsetProperty.prototype._updateClamping=function(){defined(this._removeCallbackFunc)&&this._removeCallbackFunc();const e=this._scene,t=e.globe,i=this._position;if(!defined(t)||Cartesian3.equals(i,Cartesian3.ZERO))return void(this._terrainHeight=0);const n=t.ellipsoid,r=t._surface,o=this,a=n.cartesianToCartographic(i,this._cartographicPosition),s=t.getHeight(a);defined(s)?this._terrainHeight=s:this._terrainHeight=0,this._removeCallbackFunc=r.updateHeight(a,(function(t){if(e.mode===SceneMode$1.SCENE3D){const e=n.cartesianToCartographic(t,scratchCarto$1);o._terrainHeight=e.height}else o._terrainHeight=t.x;o.definitionChanged.raiseEvent()}))},TerrainOffsetProperty.prototype.getValue=function(e,t){const i=Property.getValueOrDefault(this._heightReference,e,HeightReference$1.NONE),n=Property.getValueOrDefault(this._extrudedHeightReference,e,HeightReference$1.NONE);if(i===HeightReference$1.NONE&&n!==HeightReference$1.RELATIVE_TO_GROUND)return this._position=Cartesian3.clone(Cartesian3.ZERO,this._position),Cartesian3.clone(Cartesian3.ZERO,t);if(this._positionProperty.isConstant)return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);const r=this._scene,o=this._positionProperty.getValue(e,scratchPosition$a);if(!defined(o)||Cartesian3.equals(o,Cartesian3.ZERO)||!defined(r.globe))return Cartesian3.clone(Cartesian3.ZERO,t);if(Cartesian3.equalsEpsilon(this._position,o,CesiumMath.EPSILON10))return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=Cartesian3.clone(o,this._position),this._updateClamping();const a=r.globe.ellipsoid.geodeticSurfaceNormal(o,this._normal);return Cartesian3.multiplyByScalar(a,this._terrainHeight,t)},TerrainOffsetProperty.prototype.isDestroyed=function(){return!1},TerrainOffsetProperty.prototype.destroy=function(){return defined(this._removeEventListener)&&this._removeEventListener(),defined(this._removeModeListener)&&this._removeModeListener(),defined(this._removeCallbackFunc)&&this._removeCallbackFunc(),destroyObject(this)};const defaultOffset$a=Cartesian3.ZERO,offsetScratch$9=new Cartesian3,positionScratch$6=new Cartesian3,scratchColor$o=new Color;function BoxGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function BoxGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new BoxGeometryOptions(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}function DynamicBoxGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}function ComputeCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.vertexArray=e.vertexArray,this.fragmentShaderSource=e.fragmentShaderSource,this.shaderProgram=e.shaderProgram,this.uniformMap=e.uniformMap,this.outputTexture=e.outputTexture,this.preExecute=e.preExecute,this.postExecute=e.postExecute,this.canceled=e.canceled,this.persists=defaultValue(e.persists,!1),this.pass=Pass$1.COMPUTE,this.owner=e.owner}defined(Object.create)&&(BoxGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),BoxGeometryUpdater.prototype.constructor=BoxGeometryUpdater),Object.defineProperties(BoxGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),BoxGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),r=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),color:void 0,offset:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$o)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$a,offsetScratch$9))),new GeometryInstance({id:t,geometry:BoxGeometry.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:o})},BoxGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$o),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$a,offsetScratch$9))),new GeometryInstance({id:t,geometry:BoxOutlineGeometry.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:o})},BoxGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},BoxGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},BoxGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},BoxGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),n=this._options;n.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,n.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,n.dimensions),n.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},BoxGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,BoxGeometryUpdater.DynamicGeometryUpdater=DynamicBoxGeometryUpdater,defined(Object.create)&&(DynamicBoxGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicBoxGeometryUpdater.prototype.constructor=DynamicBoxGeometryUpdater),DynamicBoxGeometryUpdater.prototype._isHidden=function(e,t,i){const n=Property.getValueOrUndefined(e.position,i,positionScratch$6),r=this._options.dimensions;return!defined(n)||!defined(r)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicBoxGeometryUpdater.prototype._setOptions=function(e,t,i){const n=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),r=this._options;r.dimensions=Property.getValueOrUndefined(t.dimensions,i,r.dimensions),r.offsetAttribute=n!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},ComputeCommand.prototype.execute=function(e){e.execute(this)};var OctahedralProjectionAtlasFS="varying vec2 v_textureCoordinates;\nuniform float originalSize;\nuniform sampler2D texture0;\nuniform sampler2D texture1;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nconst float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));\nconst float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));\nconst float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));\nconst float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));\nvoid main()\n{\nvec2 uv = v_textureCoordinates;\nvec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);\nvec2 pixel = 1.0 / textureSize;\nfloat mipLevel = 0.0;\nif (uv.x - pixel.x > (textureSize.y / textureSize.x))\n{\nmipLevel = 1.0;\nif (uv.y - pixel.y > yMipLevel1)\n{\nmipLevel = 2.0;\nif (uv.y - pixel.y * 3.0 > yMipLevel2)\n{\nmipLevel = 3.0;\nif (uv.y - pixel.y * 5.0 > yMipLevel3)\n{\nmipLevel = 4.0;\nif (uv.y - pixel.y * 7.0 > yMipLevel4)\n{\nmipLevel = 5.0;\n}\n}\n}\n}\n}\nif (mipLevel > 0.0)\n{\nfloat scale = pow(2.0, mipLevel);\nuv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);\nuv.x *= ((textureSize.x - 2.0) / textureSize.y);\nuv.x -= 1.0 + pixel.x;\nuv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));\nuv *= scale;\n}\nelse\n{\nuv.x *= (textureSize.x / textureSize.y);\n}\nif(mipLevel == 0.0)\n{\ngl_FragColor = texture2D(texture0, uv);\n}\nelse if(mipLevel == 1.0)\n{\ngl_FragColor = texture2D(texture1, uv);\n}\nelse if(mipLevel == 2.0)\n{\ngl_FragColor = texture2D(texture2, uv);\n}\nelse if(mipLevel == 3.0)\n{\ngl_FragColor = texture2D(texture3, uv);\n}\nelse if(mipLevel == 4.0)\n{\ngl_FragColor = texture2D(texture4, uv);\n}\nelse if(mipLevel == 5.0)\n{\ngl_FragColor = texture2D(texture5, uv);\n}\nelse\n{\ngl_FragColor = vec4(0.0);\n}\n}\n",OctahedralProjectionFS="varying vec3 v_cubeMapCoordinates;\nuniform samplerCube cubeMap;\nvoid main()\n{\nvec4 rgba = textureCube(cubeMap, v_cubeMapCoordinates);\n#ifdef RGBA_NORMALIZED\ngl_FragColor = vec4(rgba.rgb, 1.0);\n#else\nfloat m = rgba.a * 16.0;\nvec3 r = rgba.rgb * m;\ngl_FragColor = vec4(r * r, 1.0);\n#endif\n}\n",OctahedralProjectionVS="attribute vec4 position;\nattribute vec3 cubeMapCoordinates;\nvarying vec3 v_cubeMapCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_cubeMapCoordinates = cubeMapCoordinates;\n}\n";function OctahedralProjectedCubeMap(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1,this._readyPromise=defer()}Object.defineProperties(OctahedralProjectedCubeMap.prototype,{url:{get:function(){return this._url}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),OctahedralProjectedCubeMap.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const v1=new Cartesian3(1,0,0),v2=new Cartesian3(0,0,1),v3=new Cartesian3(-1,0,0),v4=new Cartesian3(0,0,-1),v5=new Cartesian3(0,1,0),v6=new Cartesian3(0,-1,0),cubeMapCoordinates=[v5,v3,v2,v6,v1,v5,v4,v5,v5],length$1=cubeMapCoordinates.length,flatCubeMapCoordinates=new Float32Array(3*length$1);let offset=0;for(let e=0;e<length$1;++e,offset+=3)Cartesian3.pack(cubeMapCoordinates[e],flatCubeMapCoordinates,offset);const flatPositions=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),indices=new Uint16Array([0,1,2,2,3,1,7,6,1,3,6,1,2,5,4,3,4,2,4,8,6,3,4,6]);function createVertexArray$5(e){const t=Buffer$1.createVertexBuffer({context:e,typedArray:flatPositions,usage:BufferUsage$1.STATIC_DRAW}),i=Buffer$1.createVertexBuffer({context:e,typedArray:flatCubeMapCoordinates,usage:BufferUsage$1.STATIC_DRAW}),n=Buffer$1.createIndexBuffer({context:e,typedArray:indices,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});return new VertexArray({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT},{index:1,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT}],indexBuffer:n})}function createUniformTexture(e){return function(){return e}}function cleanupResources(e){let t,i;e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();const n=e._cubeMaps;if(defined(n))for(i=n.length,t=0;t<i;++t)n[t].destroy();const r=e._mipTextures;if(defined(r))for(i=r.length,t=0;t<i;++t)r[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}OctahedralProjectedCubeMap.prototype.update=function(e){const t=e.context;if(!OctahedralProjectedCubeMap.isSupported(t))return;if(defined(this._texture)&&defined(this._va)&&cleanupResources(this),defined(this._texture))return;if(!defined(this._texture)&&!this._loading){const e=t.textureCache.getTexture(this._url);if(defined(e))return cleanupResources(this),this._texture=e,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0,void this._readyPromise.resolve()}const i=this._cubeMapBuffers;if(!defined(i)&&!this._loading){const e=this;loadKTX2(this._url).then((function(t){e._cubeMapBuffers=t,e._loading=!1})).catch((function(t){e._readyPromise.reject(t)})),this._loading=!0}if(!defined(this._cubeMapBuffers))return;const n=[];let r=i[0].positiveX.pixelDatatype;defined(r)?n.push("RGBA_NORMALIZED"):r=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT;const o=PixelFormat$1.RGBA,a=new ShaderSource({defines:n,sources:[OctahedralProjectionFS]});this._va=createVertexArray$5(t),this._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:OctahedralProjectionVS,fragmentShaderSource:a,attributeLocations:{position:0,cubeMapCoordinates:1}});const s=Math.min(i.length,6);this._maximumMipmapLevel=s-1;const c=this._cubeMaps=new Array(s),l=this._mipTextures=new Array(s),u=2*i[0].positiveX.width,d={originalSize:function(){return u}};for(let n=0;n<s;++n){const a=i[n].positiveY;i[n].positiveY=i[n].negativeY,i[n].negativeY=a;const s=c[n]=new CubeMap({context:t,source:i[n],pixelDatatype:r}),u=2*c[n].width,h=l[n]=new Texture({context:t,width:u,height:u,pixelDatatype:r,pixelFormat:o}),p=new ComputeCommand({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:createUniformTexture(s)},outputTexture:h,persists:!0,owner:this});e.commandList.push(p),d[`texture${n}`]=createUniformTexture(h)}this._texture=new Texture({context:t,width:1.5*u+2,height:u,pixelDatatype:r,pixelFormat:o}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);const h=new ComputeCommand({fragmentShaderSource:OctahedralProjectionAtlasFS,uniformMap:d,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(h),this._ready=!0,this._readyPromise.resolve()},OctahedralProjectedCubeMap.prototype.isDestroyed=function(){return!1},OctahedralProjectedCubeMap.prototype.destroy=function(){return cleanupResources(this),this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};const scratchIBLReferenceFrameMatrix4=new Matrix4,scratchIBLReferenceFrameMatrix3=new Matrix3;function ImageBasedLighting(e){const t=defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).imageBasedLightingFactor)?Cartesian2.clone(e.imageBasedLightingFactor):new Cartesian2(1,1);this._imageBasedLightingFactor=t;const i=defaultValue(e.luminanceAtZenith,.2);this._luminanceAtZenith=i;const n=e.sphericalHarmonicCoefficients;this._sphericalHarmonicCoefficients=n,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapAtlas=void 0,this._specularEnvironmentMapAtlasDirty=!0,this._specularEnvironmentMapLoaded=!1,this._previousSpecularEnvironmentMapLoaded=!1,this._useDefaultSpecularMaps=!1,this._useDefaultSphericalHarmonics=!1,this._shouldRegenerateShaders=!1,this._referenceMatrix=Matrix3.clone(Matrix3.IDENTITY),this._iblReferenceFrameMatrix=Matrix3.clone(Matrix3.IDENTITY),this._previousFrameNumber=void 0,this._previousImageBasedLightingFactor=Cartesian2.clone(t),this._previousLuminanceAtZenith=i,this._previousSphericalHarmonicCoefficients=n}function createSpecularEnvironmentMapAtlas(e,t){if(OctahedralProjectedCubeMap.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),defined(e._specularEnvironmentMaps)){const t=new OctahedralProjectedCubeMap(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=t,t.readyPromise.then((function(){e._specularEnvironmentMapLoaded=!0})).catch((function(e){console.error(`Error loading specularEnvironmentMaps: ${e}`)}))}e._shouldRegenerateShaders=!0}}function ClearCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner,this.pass=e.pass}Object.defineProperties(ImageBasedLighting.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){this._previousImageBasedLightingFactor=Cartesian2.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor),this._imageBasedLightingFactor=Cartesian2.clone(e,this._imageBasedLightingFactor)}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){this._previousLuminanceAtZenith=this._luminanceAtZenith,this._luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients,this._sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){e!==this._specularEnvironmentMaps&&(this._specularEnvironmentMapAtlasDirty=this._specularEnvironmentMapAtlasDirty||e!==this._specularEnvironmentMaps,this._specularEnvironmentMapLoaded=!1),this._specularEnvironmentMaps=e}},referenceMatrix:{get:function(){return this._referenceMatrix},set:function(e){this._referenceMatrix=e}},iblReferenceFrameMatrix:{get:function(){return this._iblReferenceFrameMatrix}},enabled:{get:function(){return this._imageBasedLightingFactor.x>0||this._imageBasedLightingFactor.y>0}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},useDefaultSphericalHarmonics:{get:function(){return this._useDefaultSphericalHarmonics}},useSphericalHarmonicCoefficients:{get:function(){return defined(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics}},specularEnvironmentMapAtlas:{get:function(){return this._specularEnvironmentMapAtlas}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps}}}),ImageBasedLighting.prototype.update=function(e){if(e.frameNumber===this._previousFrameNumber)return;this._previousFrameNumber=e.frameNumber;const t=e.context;e.brdfLutGenerator.update(e),this._shouldRegenerateShaders=!1;const i=this._imageBasedLightingFactor,n=this._previousImageBasedLightingFactor;Cartesian2.equals(i,n)||(this._shouldRegenerateShaders=i.x>0&&0===n.x||0===i.x&&n.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||i.y>0&&0===n.y||0===i.y&&n.y>0,this._previousImageBasedLightingFactor=Cartesian2.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor)),this._luminanceAtZenith!==this._previousLuminanceAtZenith&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(this._luminanceAtZenith)!==defined(this._previousLuminanceAtZenith),this._previousLuminanceAtZenith=this._luminanceAtZenith),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(this._previousSphericalHarmonicCoefficients)!==defined(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentMapAtlasDirty&&(createSpecularEnvironmentMapAtlas(this,t),this._specularEnvironmentMapAtlasDirty=!1),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e);const r=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,o=!defined(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,a=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,s=!defined(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||r||o||a||s,this._useDefaultSpecularMaps=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients);const c=this.useSphericalHarmonicCoefficients,l=this.useSpecularEnvironmentMaps;if(c||l){let e=scratchIBLReferenceFrameMatrix3,i=scratchIBLReferenceFrameMatrix4;i=Matrix4.multiply(t.uniformState.view3D,this._referenceMatrix,i),e=Matrix4.getMatrix3(i,e),e=Matrix3.getRotation(e,e),this._iblReferenceFrameMatrix=Matrix3.transpose(e,this._iblReferenceFrameMatrix)}},ImageBasedLighting.prototype.isDestroyed=function(){return!1},ImageBasedLighting.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),destroyObject(this)},ClearCommand.ALL=Object.freeze(new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0})),ClearCommand.prototype.execute=function(e,t){e.clear(this,t)};const Axis={X:0,Y:1,Z:2};Axis.Y_UP_TO_Z_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationX(CesiumMath.PI_OVER_TWO)),Axis.Z_UP_TO_Y_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationX(-CesiumMath.PI_OVER_TWO)),Axis.X_UP_TO_Z_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationY(-CesiumMath.PI_OVER_TWO)),Axis.Z_UP_TO_X_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationY(CesiumMath.PI_OVER_TWO)),Axis.X_UP_TO_Y_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(CesiumMath.PI_OVER_TWO)),Axis.Y_UP_TO_X_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(-CesiumMath.PI_OVER_TWO)),Axis.fromName=function(e){return Axis[e]};var Axis$1=Object.freeze(Axis);function Cesium3DContentGroup(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._metadata=e.metadata}Object.defineProperties(Cesium3DContentGroup.prototype,{metadata:{get:function(){return this._metadata}}});const B3dmParser={};B3dmParser._deprecationWarning=deprecationWarning;const sizeOfUint32$6=Uint32Array.BYTES_PER_ELEMENT;function BatchTexture(e){const t=e.featuresLength;let i,n;if(this._showAlphaProperties=void 0,this._batchValues=void 0,this._batchValuesDirty=!1,this._batchTexture=void 0,this._defaultTexture=void 0,this._pickTexture=void 0,this._pickIds=[],t>0){const e=Math.min(t,ContextLimits.maximumTextureSize),r=Math.ceil(t/ContextLimits.maximumTextureSize),o=1/e,a=.5*o,s=1/r,c=.5*s;i=new Cartesian2(e,r),n=new Cartesian4(o,a,s,c)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=i,this._textureStep=n,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}function getByteLength(e){const t=e._textureDimensions;return t.x*t.y*4}function getBatchValues(e){if(!defined(e._batchValues)){const t=getByteLength(e),i=new Uint8Array(t);arrayFill(i,255),e._batchValues=i}return e._batchValues}function getShowAlphaProperties(e){if(!defined(e._showAlphaProperties)){const t=2*e._featuresLength,i=new Uint8Array(t);arrayFill(i,255),e._showAlphaProperties=i}return e._showAlphaProperties}B3dmParser.parse=function(e,t){const i=defaultValue(t,0);t=i;const n=new Uint8Array(e),r=new DataView(e);t+=sizeOfUint32$6;const o=r.getUint32(t,!0);if(1!==o)throw new RuntimeError(`Only Batched 3D Model version 1 is supported. Version ${o} is not.`);t+=sizeOfUint32$6;const a=r.getUint32(t,!0);t+=sizeOfUint32$6;let s=r.getUint32(t,!0);t+=sizeOfUint32$6;let c=r.getUint32(t,!0);t+=sizeOfUint32$6;let l=r.getUint32(t,!0);t+=sizeOfUint32$6;let u,d,h=r.getUint32(t,!0);t+=sizeOfUint32$6,l>=570425344?(t-=2*sizeOfUint32$6,u=s,l=c,h=0,s=0,c=0,B3dmParser._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):h>=570425344&&(t-=sizeOfUint32$6,u=l,l=s,h=c,s=0,c=0,B3dmParser._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")),0===s?d={BATCH_LENGTH:defaultValue(u,0)}:(d=getJsonFromTypedArray(n,t,s),t+=s);const p=new Uint8Array(e,t,c);let f,m;t+=c,l>0&&(f=getJsonFromTypedArray(n,t,l),t+=l,h>0&&(m=new Uint8Array(e,t,h),m=new Uint8Array(m),t+=h));const g=i+a-t;if(0===g)throw new RuntimeError("glTF byte length must be greater than 0.");let _;return t%4==0?_=new Uint8Array(e,t,g):(B3dmParser._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),_=new Uint8Array(n.subarray(t,t+g))),{batchLength:u,featureTableJson:d,featureTableBinary:p,batchTableJson:f,batchTableBinary:m,gltf:_}},Object.defineProperties(BatchTexture.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},memorySizeInBytes:{get:function(){let e=0;return defined(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),defined(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}},textureDimensions:{get:function(){return this._textureDimensions}},textureStep:{get:function(){return this._textureStep}},batchTexture:{get:function(){return this._batchTexture}},defaultTexture:{get:function(){return this._defaultTexture}},pickTexture:{get:function(){return this._pickTexture}}}),BatchTexture.DEFAULT_COLOR_VALUE=Color.WHITE,BatchTexture.DEFAULT_SHOW_VALUE=!0,BatchTexture.prototype.setShow=function(e,t){if(t&&!defined(this._showAlphaProperties))return;const i=getShowAlphaProperties(this),n=2*e,r=t?255:0;if(i[n]!==r){i[n]=r;getBatchValues(this)[4*e+3]=t?i[n+1]:0,this._batchValuesDirty=!0}},BatchTexture.prototype.setAllShow=function(e){const t=this._featuresLength;for(let i=0;i<t;++i)this.setShow(i,e)},BatchTexture.prototype.getShow=function(e){if(!defined(this._showAlphaProperties))return!0;const t=2*e;return 255===this._showAlphaProperties[t]};const scratchColorBytes$1=new Array(4);function createTexture$4(e,t,i){const n=e._textureDimensions;return new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:n.x,height:n.y,arrayBufferView:i},flipY:!1,sampler:Sampler.NEAREST})}function createPickTexture(e,t){const i=e._featuresLength;if(!defined(e._pickTexture)&&i>0){const n=e._pickIds,r=getByteLength(e),o=new Uint8Array(r),a=e._owner,s=e._statistics;for(let e=0;e<i;++e){const i=t.createPickId(a.getFeature(e));n.push(i);const r=i.color,s=4*e;o[s]=Color.floatToByte(r.red),o[s+1]=Color.floatToByte(r.green),o[s+2]=Color.floatToByte(r.blue),o[s+3]=Color.floatToByte(r.alpha)}e._pickTexture=createTexture$4(e,t,o),defined(s)&&(s.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function updateBatchTexture(e){const t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}BatchTexture.prototype.setColor=function(e,t){if(Color.equals(t,BatchTexture.DEFAULT_COLOR_VALUE)&&!defined(this._batchValues))return;const i=t.toBytes(scratchColorBytes$1),n=i[3],r=getBatchValues(this),o=4*e,a=getShowAlphaProperties(this),s=2*e;if(r[o]!==i[0]||r[o+1]!==i[1]||r[o+2]!==i[2]||a[s+1]!==n){r[o]=i[0],r[o+1]=i[1],r[o+2]=i[2];const c=255!==a[s+1],l=0!==a[s];r[o+3]=l?n:0,a[s+1]=n;const u=255!==n;u&&!c?++this._translucentFeaturesLength:!u&&c&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,defined(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}},BatchTexture.prototype.setAllColor=function(e){const t=this._featuresLength;for(let i=0;i<t;++i)this.setColor(i,e)},BatchTexture.prototype.getColor=function(e,t){if(!defined(this._batchValues))return Color.clone(BatchTexture.DEFAULT_COLOR_VALUE,t);const i=this._batchValues,n=4*e,r=this._showAlphaProperties,o=2*e;return Color.fromBytes(i[n],i[n+1],i[n+2],r[o+1],t)},BatchTexture.prototype.getPickColor=function(e){return this._pickIds[e]},BatchTexture.prototype.update=function(e,t){const i=t.context;this._defaultTexture=i.defaultTexture;const n=t.passes;(n.pick||n.postProcess)&&createPickTexture(this,i),this._batchValuesDirty&&(this._batchValuesDirty=!1,defined(this._batchTexture)||(this._batchTexture=createTexture$4(this,i,this._batchValues),defined(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),updateBatchTexture(this))},BatchTexture.prototype.isDestroyed=function(){return!1},BatchTexture.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();const e=this._pickIds,t=e.length;for(let i=0;i<t;++i)e[i].destroy();return destroyObject(this)};const ComponentsPerAttribute={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ClassPerType={SCALAR:void 0,VEC2:Cartesian2,VEC3:Cartesian3,VEC4:Cartesian4,MAT2:Matrix2,MAT3:Matrix3,MAT4:Matrix4};function getBinaryAccessor(e){const t=e.componentType;let i;i="string"==typeof t?ComponentDatatype$1.fromName(t):t;const n=ComponentsPerAttribute[e.type],r=ClassPerType[e.type];return{componentsPerAttribute:n,classType:r,createArrayBufferView:function(e,t,r){return ComponentDatatype$1.createArrayBufferView(i,e,t,n*r)}}}function BatchTableHierarchy(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,initialize$c(this,e.extension,e.binaryBody)}function initialize$c(e,t,i){let n,r,o;const a=t.instancesLength,s=t.classes;let c,l=t.classIds,u=t.parentCounts,d=t.parentIds,h=a;if(defined(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,ComponentDatatype$1.UNSIGNED_SHORT),l.type=AttributeType$1.SCALAR,o=getBinaryAccessor(l),l=o.createArrayBufferView(i.buffer,i.byteOffset+l.byteOffset,a)),defined(u))for(defined(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,ComponentDatatype$1.UNSIGNED_SHORT),u.type=AttributeType$1.SCALAR,o=getBinaryAccessor(u),u=o.createArrayBufferView(i.buffer,i.byteOffset+u.byteOffset,a)),c=new Uint16Array(a),h=0,n=0;n<a;++n)c[n]=h,h+=u[n];defined(d)&&defined(d.byteOffset)&&(d.componentType=defaultValue(d.componentType,ComponentDatatype$1.UNSIGNED_SHORT),d.type=AttributeType$1.SCALAR,o=getBinaryAccessor(d),d=o.createArrayBufferView(i.buffer,i.byteOffset+d.byteOffset,h));const p=s.length;for(n=0;n<p;++n){const e=s[n].length,t=s[n].instances,r=getBinaryProperties$1(e,t,i);s[n].instances=combine$2(r,t)}const f=arrayFill(new Array(p),0),m=new Uint16Array(a);for(n=0;n<a;++n)r=l[n],m[n]=f[r],++f[r];e._classes=s,e._classIds=l,e._classIndexes=m,e._parentCounts=u,e._parentIndexes=c,e._parentIds=d}function getBinaryProperties$1(e,t,i){let n;for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],a=o.byteOffset;if(defined(a)){const t=o.componentType,s=o.type;if(!defined(t))throw new RuntimeError("componentType is required.");if(!defined(s))throw new RuntimeError("type is required.");if(!defined(i))throw new RuntimeError(`Property ${r} requires a batch table binary.`);const c=getBinaryAccessor(o),l=c.componentsPerAttribute,u=c.classType,d=c.createArrayBufferView(i.buffer,i.byteOffset+a,e);defined(n)||(n={}),n[r]={typedArray:d,componentCount:l,type:u}}}return n}const scratchVisited=[],scratchStack$1=[];let marker=0;function traverseHierarchyMultipleParents(e,t,i){const n=e._classIds,r=e._parentCounts,o=e._parentIds,a=e._parentIndexes,s=n.length,c=scratchVisited;c.length=Math.max(c.length,s);const l=++marker,u=scratchStack$1;for(u.length=0,u.push(t);u.length>0;){if(c[t=u.pop()]===l)continue;c[t]=l;const n=i(e,t);if(defined(n))return n;const s=r[t],d=a[t];for(let e=0;e<s;++e){const i=o[d+e];i!==t&&u.push(i)}}}function traverseHierarchySingleParent(e,t,i){let n=!0;for(;n;){const r=i(e,t);if(defined(r))return r;const o=e._parentIds[t];n=o!==t,t=o}}function traverseHierarchy(e,t,i){const n=e._parentCounts;return defined(e._parentIds)?defined(n)?traverseHierarchyMultipleParents(e,t,i):traverseHierarchySingleParent(e,t,i):i(e,t)}function getBinaryProperty$1(e,t){const i=e.typedArray,n=e.componentCount;return 1===n?i[t]:e.type.unpack(i,t*n)}function setBinaryProperty$1(e,t,i){const n=e.typedArray,r=e.componentCount;1===r?n[t]=i:e.type.pack(i,n,t*r)}BatchTableHierarchy.prototype.hasProperty=function(e,t){const i=traverseHierarchy(this,e,(function(e,i){const n=e._classIds[i];if(defined(e._classes[n].instances[t]))return!0}));return defined(i)},BatchTableHierarchy.prototype.propertyExists=function(e){const t=this._classes,i=t.length;for(let n=0;n<i;++n){if(defined(t[n].instances[e]))return!0}return!1},BatchTableHierarchy.prototype.getPropertyIds=function(e,t){return(t=defined(t)?t:[]).length=0,traverseHierarchy(this,e,(function(e,i){const n=e._classIds[i],r=e._classes[n].instances;for(const e in r)r.hasOwnProperty(e)&&-1===t.indexOf(e)&&t.push(e)})),t},BatchTableHierarchy.prototype.getProperty=function(e,t){return traverseHierarchy(this,e,(function(e,i){const n=e._classIds[i],r=e._classes[n],o=e._classIndexes[i],a=r.instances[t];if(defined(a))return defined(a.typedArray)?getBinaryProperty$1(a,o):clone$1(a[o],!0)}))},BatchTableHierarchy.prototype.setProperty=function(e,t,i){const n=traverseHierarchy(this,e,(function(e,n){const r=e._classIds[n],o=e._classes[r],a=e._classIndexes[n],s=o.instances[t];if(defined(s))return defined(s.typedArray)?setBinaryProperty$1(s,a,i):s[a]=clone$1(i,!0),!0}));return defined(n)},BatchTableHierarchy.prototype.isClass=function(e,t){return defined(traverseHierarchy(this,e,(function(e,i){const n=e._classIds[i];if(e._classes[n].name===t)return!0})))},BatchTableHierarchy.prototype.getClassName=function(e){const t=this._classIds[e];return this._classes[t].name};const Cesium3DTileColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2};var Cesium3DTileColorBlendMode$1=Object.freeze(Cesium3DTileColorBlendMode);const DEFAULT_COLOR_VALUE$3=BatchTexture.DEFAULT_COLOR_VALUE,DEFAULT_SHOW_VALUE$3=BatchTexture.DEFAULT_SHOW_VALUE;function Cesium3DTileBatchTable(e,t,i,n,r){let o;this.featuresLength=t,defined(i)&&(o=i.extensions),this._extensions=defaultValue(o,{});const a=initializeProperties(i);this._properties=a,this._batchTableHierarchy=initializeHierarchy$1(this,i,n),this._batchTableBinaryProperties=getBinaryProperties(t,a,n),this._content=e,this._batchTexture=new BatchTexture({featuresLength:t,colorChangedCallback:r,owner:e,statistics:e.tileset.statistics})}function initializeProperties(e){const t={};if(!defined(e))return t;for(const i in e)e.hasOwnProperty(i)&&"HIERARCHY"!==i&&"extensions"!==i&&"extras"!==i&&(t[i]=clone$1(e[i],!0));return t}function initializeHierarchy$1(e,t,i){if(!defined(t))return;let n=e._extensions["3DTILES_batch_table_hierarchy"];const r=t.HIERARCHY;return defined(r)&&(Cesium3DTileBatchTable._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),e._extensions["3DTILES_batch_table_hierarchy"]=r,n=r),defined(n)?new BatchTableHierarchy({extension:n,binaryBody:i}):void 0}function getBinaryProperties(e,t,i){let n;for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],a=o.byteOffset;if(defined(a)){const t=o.componentType,s=o.type;if(!defined(t))throw new RuntimeError("componentType is required.");if(!defined(s))throw new RuntimeError("type is required.");if(!defined(i))throw new RuntimeError(`Property ${r} requires a batch table binary.`);const c=getBinaryAccessor(o),l=c.componentsPerAttribute,u=c.classType,d=c.createArrayBufferView(i.buffer,i.byteOffset+a,e);defined(n)||(n={}),n[r]={typedArray:d,componentCount:l,type:u}}}return n}Cesium3DTileBatchTable._deprecationWarning=deprecationWarning,Object.defineProperties(Cesium3DTileBatchTable.prototype,{memorySizeInBytes:{get:function(){return this._batchTexture.memorySizeInBytes}}}),Cesium3DTileBatchTable.getBinaryProperties=function(e,t,i){return getBinaryProperties(e,t,i)},Cesium3DTileBatchTable.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},Cesium3DTileBatchTable.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},Cesium3DTileBatchTable.prototype.getShow=function(e){return this._batchTexture.getShow(e)},Cesium3DTileBatchTable.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},Cesium3DTileBatchTable.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},Cesium3DTileBatchTable.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},Cesium3DTileBatchTable.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};const scratchColor$n=new Color;function getBinaryProperty(e,t){const i=e.typedArray,n=e.componentCount;return 1===n?i[t]:e.type.unpack(i,t*n)}function setBinaryProperty(e,t,i){const n=e.typedArray,r=e.componentCount;1===r?n[t]=i:e.type.pack(i,n,t*r)}function getGlslComputeSt(e){return 1===e._batchTexture.textureDimensions.y?"uniform vec4 tile_textureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n return vec2(centerX + (batchId * stepX), 0.5); \n} \n":"uniform vec4 tile_textureStep; \nuniform vec2 tile_textureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n float stepY = tile_textureStep.z; \n float centerY = tile_textureStep.w; \n float xId = mod(batchId, tile_textureDimensions.x); \n float yId = floor(batchId / tile_textureDimensions.x); \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n"}function getDefaultShader(e,t){return e=ShaderSource.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend; \nvoid tile_color(vec4 tile_featureColor) \n{ \n tile_main(); \n tile_featureColor = czm_gammaCorrect(tile_featureColor); \n gl_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n} \n`:`${e}void tile_color(vec4 tile_featureColor) \n{ \n tile_main(); \n} \n`}function replaceDiffuseTextureCalls(e,t){const i=`texture2D(${t}`;let n,r=0,o=e.indexOf(i,r);for(;o>-1;){let t=0;for(let i=o;i<e.length;++i){const r=e.charAt(i);if("("===r)++t;else if(")"===r&&(--t,0===t)){n=i+1;break}}const a=`tile_diffuse_final(${e.slice(o,n)}, tile_diffuse)`;e=e.slice(0,o)+a+e.slice(n),r=o+a.length,o=e.indexOf(i,r)}return e}function modifyDiffuse(e,t,i){if(!defined(t))return getDefaultShader(e,i);let n=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`);const r=e.match(n);if(!defined(r))return getDefaultShader(e,i);const o=r[0],a=r[2];e=(e=ShaderSource.replaceMain(e,"tile_main")).replace(o,"");let s;if("vec3"===a||"vec4"===a){const i="vec3"===a?`vec4(${t}, 1.0)`:t,r="vec3"===a?"tile_diffuse.xyz":"tile_diffuse";n=new RegExp(t,"g"),e=e.replace(n,r),s=` vec4 source = ${i}; \n tile_diffuse = tile_diffuse_final(source, tile_featureColor); \n tile_main(); \n`}else"sampler2D"===a&&(e=replaceDiffuseTextureCalls(e,t),s=" tile_diffuse = tile_featureColor; \n tile_main(); \n");return e=`uniform float tile_colorBlend; \nvec4 tile_diffuse = vec4(1.0); \nbool isWhite(vec3 color) \n{ \n return all(greaterThan(color, vec3(1.0 - czm_epsilon3))); \n} \nvec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse) \n{ \n vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend); \n vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse; \n return vec4(diffuse.rgb, sourceDiffuse.a); \n} \n${o}\n${e}\nvoid tile_color(vec4 tile_featureColor) \n{ \n${s}`,i&&(e+=" tile_featureColor = czm_gammaCorrect(tile_featureColor); \n gl_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n"),e+="} \n"}function getColorBlend(e){const t=e._content.tileset,i=t.colorBlendMode,n=t.colorBlendAmount;return i===Cesium3DTileColorBlendMode$1.HIGHLIGHT?0:i===Cesium3DTileColorBlendMode$1.REPLACE?1:i===Cesium3DTileColorBlendMode$1.MIX?CesiumMath.clamp(n,CesiumMath.EPSILON4,1):void 0}Cesium3DTileBatchTable.prototype.applyStyle=function(e){if(!defined(e))return this.setAllColor(DEFAULT_COLOR_VALUE$3),void this.setAllShow(DEFAULT_SHOW_VALUE$3);const t=this._content,i=this.featuresLength;for(let n=0;n<i;++n){const i=t.getFeature(n),r=defined(e.color)?defaultValue(e.color.evaluateColor(i,scratchColor$n),DEFAULT_COLOR_VALUE$3):DEFAULT_COLOR_VALUE$3,o=defined(e.show)?defaultValue(e.show.evaluate(i),DEFAULT_SHOW_VALUE$3):DEFAULT_SHOW_VALUE$3;this.setColor(n,r),this.setShow(n,o)}},Cesium3DTileBatchTable.prototype.isClass=function(e,t){const i=this._batchTableHierarchy;return!!defined(i)&&i.isClass(e,t)},Cesium3DTileBatchTable.prototype.isExactClass=function(e,t){return this.getExactClassName(e)===t},Cesium3DTileBatchTable.prototype.getExactClassName=function(e){const t=this._batchTableHierarchy;if(defined(t))return t.getClassName(e)},Cesium3DTileBatchTable.prototype.hasProperty=function(e,t){return defined(this._properties[t])||defined(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)},Cesium3DTileBatchTable.prototype.hasPropertyBySemantic=function(){return!1},Cesium3DTileBatchTable.prototype.getPropertyNames=function(e,t){(t=defined(t)?t:[]).length=0;const i=Object.keys(this._properties);return t.push.apply(t,i),defined(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,i)),t},Cesium3DTileBatchTable.prototype.getPropertyBySemantic=function(e,t){},Cesium3DTileBatchTable.prototype.getProperty=function(e,t){if(defined(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(defined(i))return getBinaryProperty(i,e)}const i=this._properties[t];if(defined(i))return clone$1(i[e],!0);if(defined(this._batchTableHierarchy)){const i=this._batchTableHierarchy.getProperty(e,t);if(defined(i))return i}},Cesium3DTileBatchTable.prototype.setProperty=function(e,t,i){const n=this.featuresLength;if(defined(this._batchTableBinaryProperties)){const n=this._batchTableBinaryProperties[t];if(defined(n))return void setBinaryProperty(n,e,i)}if(defined(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,i))return;let r=this._properties[t];defined(r)||(this._properties[t]=new Array(n),r=this._properties[t]),r[e]=clone$1(i,!0)},Cesium3DTileBatchTable.prototype.getVertexShaderCallback=function(e,t,i){if(0===this.featuresLength)return;const n=this;return function(r){const o=modifyDiffuse(r,i,!1);let a;return ContextLimits.maximumVertexTextureImageUnits>0?(a="",e&&(a+="uniform bool tile_translucentCommand; \n"),a+=`uniform sampler2D tile_batchTexture; \nvarying vec4 tile_featureColor; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n vec2 st = computeSt(${t}); \n vec4 featureProperties = texture2D(tile_batchTexture, st); \n tile_color(featureProperties); \n float show = ceil(featureProperties.a); \n gl_Position *= show; \n`,e&&(a+=" bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n gl_Position *= 0.0; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n gl_Position *= 0.0; \n } \n } \n"),a+=" tile_featureColor = featureProperties; \n tile_featureSt = st; \n}"):a=`varying vec2 tile_featureSt; \nvoid main() \n{ \n tile_color(vec4(1.0)); \n tile_featureSt = computeSt(${t}); \n}`,`${o}\n${getGlslComputeSt(n)}${a}`}},Cesium3DTileBatchTable.prototype.getFragmentShaderCallback=function(e,t,i){if(0!==this.featuresLength)return function(n){return n=modifyDiffuse(n,t,!0),ContextLimits.maximumVertexTextureImageUnits>0?(n+="uniform sampler2D tile_pickTexture; \nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n tile_color(tile_featureColor); \n",i&&(n+=" gl_FragColor.rgb *= gl_FragColor.a; \n"),n+="}"):(e&&(n+="uniform bool tile_translucentCommand; \n"),n+="uniform sampler2D tile_pickTexture; \nuniform sampler2D tile_batchTexture; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n",e&&(n+=" bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n discard; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n discard; \n } \n } \n"),n+=" tile_color(featureProperties); \n",i&&(n+=" gl_FragColor.rgb *= gl_FragColor.a; \n"),n+="} \n"),n}},Cesium3DTileBatchTable.prototype.getClassificationFragmentShaderCallback=function(){if(0!==this.featuresLength)return function(e){return e=ShaderSource.replaceMain(e,"tile_main"),ContextLimits.maximumVertexTextureImageUnits>0?e+="uniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n tile_main(); \n gl_FragColor = tile_featureColor; \n gl_FragColor.rgb *= gl_FragColor.a; \n}":e+="uniform sampler2D tile_batchTexture; \nuniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvoid main() \n{ \n tile_main(); \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n gl_FragColor = featureProperties; \n gl_FragColor.rgb *= gl_FragColor.a; \n} \n",e}},Cesium3DTileBatchTable.prototype.getUniformMapCallback=function(){if(0===this.featuresLength)return;const e=this;return function(t){return combine$2(t,{tile_batchTexture:function(){return defaultValue(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return getColorBlend(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}},Cesium3DTileBatchTable.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};const StyleCommandsNeeded$2={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};function getStyleCommandsNeeded(e){const t=e._batchTexture.translucentFeaturesLength;return 0===t?StyleCommandsNeeded$2.ALL_OPAQUE:t===e.featuresLength?StyleCommandsNeeded$2.ALL_TRANSLUCENT:StyleCommandsNeeded$2.OPAQUE_AND_TRANSLUCENT}function deriveCommand(e){const t=DrawCommand.shallowClone(e),i=t.pass===Pass$1.TRANSLUCENT;return t.uniformMap=defined(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return i},t}function deriveTranslucentCommand$2(e){const t=DrawCommand.shallowClone(e);return t.pass=Pass$1.TRANSLUCENT,t.renderState=getTranslucentRenderState$2(e.renderState),t}function deriveOpaqueCommand(e){const t=DrawCommand.shallowClone(e);return t.renderState=getOpaqueRenderState(e.renderState),t}function getLogDepthPolygonOffsetFragmentShaderProgram(e,t){let i=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!defined(i)){const n=t.fragmentShaderSource.clone();n.defines=defined(n.defines)?n.defines.slice(0):[],n.defines.push("POLYGON_OFFSET"),n.sources.unshift("#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"),i=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:n,attributeLocations:t._attributeLocations})}return i}function deriveZBackfaceCommand(e,t){const i=DrawCommand.shallowClone(t),n=clone$1(i.renderState,!0);n.cull.enabled=!0,n.cull.face=CullFace$1.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5},n.stencilTest=StencilConstants$1.setCesium3DTileBit(),n.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,i.renderState=RenderState.fromCache(n),i.castShadows=!1,i.receiveShadows=!1,i.uniformMap=clone$1(t.uniformMap);const r=new Cartesian2(5,5);return i.uniformMap.u_polygonOffset=function(){return r},i.shaderProgram=getLogDepthPolygonOffsetFragmentShaderProgram(e,t.shaderProgram),i}function deriveStencilCommand(e,t){const i=DrawCommand.shallowClone(e),n=clone$1(i.renderState,!0);return n.stencilTest.enabled=!0,n.stencilTest.mask=StencilConstants$1.SKIP_LOD_MASK,n.stencilTest.reference=StencilConstants$1.CESIUM_3D_TILE_MASK|t<<StencilConstants$1.SKIP_LOD_BIT_SHIFT,n.stencilTest.frontFunction=StencilFunction$1.GREATER_OR_EQUAL,n.stencilTest.frontOperation.zPass=StencilOperation$1.REPLACE,n.stencilTest.backFunction=StencilFunction$1.GREATER_OR_EQUAL,n.stencilTest.backOperation.zPass=StencilOperation$1.REPLACE,n.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK|StencilConstants$1.SKIP_LOD_MASK,i.renderState=RenderState.fromCache(n),i}function getLastSelectionDepth(e){return(e.renderState.stencilTest.reference&StencilConstants$1.SKIP_LOD_MASK)>>>StencilConstants$1.SKIP_LOD_BIT_SHIFT}function getTranslucentRenderState$2(e){const t=clone$1(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND,t.stencilTest=StencilConstants$1.setCesium3DTileBit(),t.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,RenderState.fromCache(t)}function getOpaqueRenderState(e){const t=clone$1(e,!0);return t.stencilTest=StencilConstants$1.setCesium3DTileBit(),t.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,RenderState.fromCache(t)}function Cesium3DTileFeature(e,t){this._content=e,this._batchId=t,this._color=void 0}function Cesium3DTileFeatureTable(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function getTypedArrayFromBinary(e,t,i,n,r,o){const a=e._cachedTypedArrays;let s=a[t];return defined(s)||(s=ComponentDatatype$1.createArrayBufferView(i,e.buffer.buffer,e.buffer.byteOffset+o,r*n),a[t]=s),s}function getTypedArrayFromArray(e,t,i,n){const r=e._cachedTypedArrays;let o=r[t];return defined(o)||(o=ComponentDatatype$1.createTypedArray(i,n),r[t]=o),o}function addToArray(e,t,i){if(i=defaultValue(i,!1)){const i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}function usesExtension(e,t){return defined(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function ForEach(){}function numberOfComponentsForType(e){switch(e){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}}function getAccessorByteStride(e,t){const i=t.bufferView;if(defined(i)){const t=e.bufferViews[i];if(defined(t.byteStride)&&t.byteStride>0)return t.byteStride}return ComponentDatatype$1.getSizeInBytes(t.componentType)*numberOfComponentsForType(t.type)}function addDefaults(e){ForEach.accessor(e,(function(e){defined(e.bufferView)&&(e.byteOffset=defaultValue(e.byteOffset,0))})),ForEach.bufferView(e,(function(e){defined(e.buffer)&&(e.byteOffset=defaultValue(e.byteOffset,0))})),ForEach.mesh(e,(function(t){ForEach.meshPrimitive(t,(function(t){if(t.mode=defaultValue(t.mode,WebGLConstants$1.TRIANGLES),!defined(t.material)){defined(e.materials)||(e.materials=[]);const i={name:"default"};t.material=addToArray(e.materials,i)}}))})),ForEach.accessorContainingVertexAttributeData(e,(function(t){const i=e.accessors[t],n=i.bufferView;if(i.normalized=defaultValue(i.normalized,!1),defined(n)){const t=e.bufferViews[n];t.byteStride=getAccessorByteStride(e,i),t.target=WebGLConstants$1.ARRAY_BUFFER}})),ForEach.accessorContainingIndexData(e,(function(t){const i=e.accessors[t].bufferView;if(defined(i)){e.bufferViews[i].target=WebGLConstants$1.ELEMENT_ARRAY_BUFFER}})),ForEach.material(e,(function(e){const t=defaultValue(e.extensions,defaultValue.EMPTY_OBJECT),i=t.KHR_materials_common;if(defined(i)){const e=i.technique,t=defined(i.values)?i.values:{};return i.values=t,t.ambient=defined(t.ambient)?t.ambient:[0,0,0,1],t.emission=defined(t.emission)?t.emission:[0,0,0,1],t.transparency=defaultValue(t.transparency,1),t.transparent=defaultValue(t.transparent,!1),t.doubleSided=defaultValue(t.doubleSided,!1),void("CONSTANT"!==e&&(t.diffuse=defined(t.diffuse)?t.diffuse:[0,0,0,1],"LAMBERT"!==e&&(t.specular=defined(t.specular)?t.specular:[0,0,0,1],t.shininess=defaultValue(t.shininess,0))))}e.emissiveFactor=defaultValue(e.emissiveFactor,[0,0,0]),e.alphaMode=defaultValue(e.alphaMode,"OPAQUE"),e.doubleSided=defaultValue(e.doubleSided,!1),"MASK"===e.alphaMode&&(e.alphaCutoff=defaultValue(e.alphaCutoff,.5));defined(t.KHR_techniques_webgl)&&ForEach.materialValue(e,(function(e){defined(e.index)&&addTextureDefaults(e)})),addTextureDefaults(e.emissiveTexture),addTextureDefaults(e.normalTexture),addTextureDefaults(e.occlusionTexture);const n=e.pbrMetallicRoughness;defined(n)&&(n.baseColorFactor=defaultValue(n.baseColorFactor,[1,1,1,1]),n.metallicFactor=defaultValue(n.metallicFactor,1),n.roughnessFactor=defaultValue(n.roughnessFactor,1),addTextureDefaults(n.baseColorTexture),addTextureDefaults(n.metallicRoughnessTexture));const r=t.KHR_materials_pbrSpecularGlossiness;defined(r)&&(r.diffuseFactor=defaultValue(r.diffuseFactor,[1,1,1,1]),r.specularFactor=defaultValue(r.specularFactor,[1,1,1]),r.glossinessFactor=defaultValue(r.glossinessFactor,1),addTextureDefaults(r.specularGlossinessTexture))})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){e.interpolation=defaultValue(e.interpolation,"LINEAR")}))}));const t=getAnimatedNodes(e);return ForEach.node(e,(function(e,i){defined(t[i])||defined(e.translation)||defined(e.rotation)||defined(e.scale)?(e.translation=defaultValue(e.translation,[0,0,0]),e.rotation=defaultValue(e.rotation,[0,0,0,1]),e.scale=defaultValue(e.scale,[1,1,1])):e.matrix=defaultValue(e.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])})),ForEach.sampler(e,(function(e){e.wrapS=defaultValue(e.wrapS,WebGLConstants$1.REPEAT),e.wrapT=defaultValue(e.wrapT,WebGLConstants$1.REPEAT)})),defined(e.scenes)&&!defined(e.scene)&&(e.scene=0),e}function getAnimatedNodes(e){const t={};return ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){const i=e.target,n=i.node,r=i.path;"translation"!==r&&"rotation"!==r&&"scale"!==r||(t[n]=!0)}))})),t}function addTextureDefaults(e){defined(e)&&(e.texCoord=defaultValue(e.texCoord,0))}function addPipelineExtras(e){return ForEach.shader(e,(function(e){addExtras(e)})),ForEach.buffer(e,(function(e){addExtras(e)})),ForEach.image(e,(function(e){addExtras(e)})),addExtras(e),e}function addExtras(e){e.extras=defined(e.extras)?e.extras:{},e.extras._pipeline=defined(e.extras._pipeline)?e.extras._pipeline:{}}function removeExtensionsRequired(e,t){const i=e.extensionsRequired;if(defined(i)){const n=i.indexOf(t);n>=0&&i.splice(n,1),0===i.length&&delete e.extensionsRequired}}function removeExtensionsUsed(e,t){const i=e.extensionsUsed;if(defined(i)){const n=i.indexOf(t);n>=0&&i.splice(n,1),removeExtensionsRequired(e,t),0===i.length&&delete e.extensionsUsed}}Cesium3DTileBatchTable.prototype.addDerivedCommands=function(e,t){const i=e.commandList,n=i.length,r=this._content._tile,o=r._finalResolution,a=r.tileset,s=a._skipLevelOfDetail&&a._hasMixedContent&&e.context.stencilBuffer,c=getStyleCommandsNeeded(this);for(let l=t;l<n;++l){const t=i[l];if(t.pass===Pass$1.COMPUTE)continue;let n=t.derivedCommands.tileset;defined(n)&&!t.dirty||(n={},t.derivedCommands.tileset=n,n.originalCommand=deriveCommand(t),t.dirty=!1);const u=n.originalCommand;c!==StyleCommandsNeeded$2.ALL_OPAQUE&&t.pass!==Pass$1.TRANSLUCENT&&(defined(n.translucent)||(n.translucent=deriveTranslucentCommand$2(u))),c!==StyleCommandsNeeded$2.ALL_TRANSLUCENT&&t.pass!==Pass$1.TRANSLUCENT&&(defined(n.opaque)||(n.opaque=deriveOpaqueCommand(u)),s&&(o||(defined(n.zback)||(n.zback=deriveZBackfaceCommand(e.context,u)),a._backfaceCommands.push(n.zback)),defined(n.stencil)&&r._selectionDepth===getLastSelectionDepth(n.stencil)||(t.renderState.depthMask?n.stencil=deriveStencilCommand(u,r._selectionDepth):n.stencil=n.opaque)));const d=s?n.stencil:n.opaque,h=n.translucent;t.pass!==Pass$1.TRANSLUCENT?(c===StyleCommandsNeeded$2.ALL_OPAQUE&&(i[l]=d),c===StyleCommandsNeeded$2.ALL_TRANSLUCENT&&(i[l]=h),c===StyleCommandsNeeded$2.OPAQUE_AND_TRANSLUCENT&&(i[l]=d,i.push(h))):i[l]=u}},Cesium3DTileBatchTable.prototype.update=function(e,t){this._batchTexture.update(e,t)},Cesium3DTileBatchTable.prototype.isDestroyed=function(){return!1},Cesium3DTileBatchTable.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),destroyObject(this)},Object.defineProperties(Cesium3DTileFeature.prototype,{show:{get:function(){return this._content.batchTable.getShow(this._batchId)},set:function(e){this._content.batchTable.setShow(this._batchId,e)}},color:{get:function(){return defined(this._color)||(this._color=new Color),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(defined(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},featureId:{get:function(){return this._batchId}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}}),Cesium3DTileFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTileFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTileFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTileFeature.getPropertyInherited=function(e,t,i){const n=e.batchTable;if(defined(n)){if(n.hasPropertyBySemantic(t,i))return n.getPropertyBySemantic(t,i);if(n.hasProperty(t,i))return n.getProperty(t,i)}const r=e.metadata;if(defined(r)){if(r.hasPropertyBySemantic(i))return r.getPropertyBySemantic(i);if(r.hasProperty(i))return r.getProperty(i)}const o=e.tile,a=o.metadata;if(defined(a)){if(a.hasPropertyBySemantic(i))return a.getPropertyBySemantic(i);if(a.hasProperty(i))return a.getProperty(i)}let s;if(defined(o.implicitSubtree)&&(s=o.implicitSubtree.metadata),defined(s)){if(s.hasPropertyBySemantic(i))return s.getPropertyBySemantic(i);if(s.hasProperty(i))return s.getProperty(i)}const c=defined(e.group)?e.group.metadata:void 0;if(defined(c)){if(c.hasPropertyBySemantic(i))return c.getPropertyBySemantic(i);if(c.hasProperty(i))return c.getProperty(i)}const l=e.tileset.metadata;if(defined(l)){if(l.hasPropertyBySemantic(i))return l.getPropertyBySemantic(i);if(l.hasProperty(i))return l.getProperty(i)}},Cesium3DTileFeature.prototype.getPropertyInherited=function(e){return Cesium3DTileFeature.getPropertyInherited(this._content,this._batchId,e)},Cesium3DTileFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTileFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTileFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTileFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)},Cesium3DTileFeatureTable.prototype.getGlobalProperty=function(e,t,i){const n=this.json[e];if(defined(n))return defined(n.byteOffset)?getTypedArrayFromBinary(this,e,t=defaultValue(t,ComponentDatatype$1.UNSIGNED_INT),i=defaultValue(i,1),1,n.byteOffset):n},Cesium3DTileFeatureTable.prototype.hasProperty=function(e){return defined(this.json[e])},Cesium3DTileFeatureTable.prototype.getPropertyArray=function(e,t,i){const n=this.json[e];if(defined(n))return defined(n.byteOffset)?(defined(n.componentType)&&(t=ComponentDatatype$1.fromName(n.componentType)),getTypedArrayFromBinary(this,e,t,i,this.featuresLength,n.byteOffset)):getTypedArrayFromArray(this,e,t,n)},Cesium3DTileFeatureTable.prototype.getProperty=function(e,t,i,n,r){if(!defined(this.json[e]))return;const o=this.getPropertyArray(e,t,i);if(1===i)return o[n];for(let e=0;e<i;++e)r[e]=o[i*n+e];return r},ForEach.objectLegacy=function(e,t){if(defined(e))for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=t(e[i],i);if(defined(n))return n}},ForEach.object=function(e,t){if(defined(e)){const i=e.length;for(let n=0;n<i;n++){const i=t(e[n],n);if(defined(i))return i}}},ForEach.topLevel=function(e,t,i){const n=e[t];return defined(n)&&!Array.isArray(n)?ForEach.objectLegacy(n,i):ForEach.object(n,i)},ForEach.accessor=function(e,t){return ForEach.topLevel(e,"accessors",t)},ForEach.accessorWithSemantic=function(e,t,i){const n={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const r=ForEach.meshPrimitiveAttribute(e,(function(e,r){if(0===r.indexOf(t)&&!defined(n[e])){n[e]=!0;const t=i(e);if(defined(t))return t}}));return defined(r)?r:ForEach.meshPrimitiveTarget(e,(function(e){return ForEach.meshPrimitiveTargetAttribute(e,(function(e,r){if(0===r.indexOf(t)&&!defined(n[e])){n[e]=!0;const t=i(e);if(defined(t))return t}}))}))}))}))},ForEach.accessorContainingVertexAttributeData=function(e,t){const i={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const n=ForEach.meshPrimitiveAttribute(e,(function(e){if(!defined(i[e])){i[e]=!0;const n=t(e);if(defined(n))return n}}));return defined(n)?n:ForEach.meshPrimitiveTarget(e,(function(e){return ForEach.meshPrimitiveTargetAttribute(e,(function(e){if(!defined(i[e])){i[e]=!0;const n=t(e);if(defined(n))return n}}))}))}))}))},ForEach.accessorContainingIndexData=function(e,t){const i={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const n=e.indices;if(defined(n)&&!defined(i[n])){i[n]=!0;const e=t(n);if(defined(e))return e}}))}))},ForEach.animation=function(e,t){return ForEach.topLevel(e,"animations",t)},ForEach.animationChannel=function(e,t){const i=e.channels;return ForEach.object(i,t)},ForEach.animationSampler=function(e,t){const i=e.samplers;return ForEach.object(i,t)},ForEach.buffer=function(e,t){return ForEach.topLevel(e,"buffers",t)},ForEach.bufferView=function(e,t){return ForEach.topLevel(e,"bufferViews",t)},ForEach.camera=function(e,t){return ForEach.topLevel(e,"cameras",t)},ForEach.image=function(e,t){return ForEach.topLevel(e,"images",t)},ForEach.material=function(e,t){return ForEach.topLevel(e,"materials",t)},ForEach.materialValue=function(e,t){let i=e.values;defined(e.extensions)&&defined(e.extensions.KHR_techniques_webgl)&&(i=e.extensions.KHR_techniques_webgl.values);for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const n=t(i[e],e);if(defined(n))return n}},ForEach.mesh=function(e,t){return ForEach.topLevel(e,"meshes",t)},ForEach.meshPrimitive=function(e,t){const i=e.primitives;if(defined(i)){const e=i.length;for(let n=0;n<e;n++){const e=t(i[n],n);if(defined(e))return e}}},ForEach.meshPrimitiveAttribute=function(e,t){const i=e.attributes;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const n=t(i[e],e);if(defined(n))return n}},ForEach.meshPrimitiveTarget=function(e,t){const i=e.targets;if(defined(i)){const e=i.length;for(let n=0;n<e;++n){const e=t(i[n],n);if(defined(e))return e}}},ForEach.meshPrimitiveTargetAttribute=function(e,t){for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=t(e[i],i);if(defined(n))return n}},ForEach.node=function(e,t){return ForEach.topLevel(e,"nodes",t)},ForEach.nodeInTree=function(e,t,i){const n=e.nodes;if(defined(n)){const r=t.length;for(let o=0;o<r;o++){const r=t[o],a=n[r];if(defined(a)){let t=i(a,r);if(defined(t))return t;const n=a.children;if(defined(n)&&(t=ForEach.nodeInTree(e,n,i),defined(t)))return t}}}},ForEach.nodeInScene=function(e,t,i){const n=t.nodes;if(defined(n))return ForEach.nodeInTree(e,n,i)},ForEach.program=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.programs,t):ForEach.topLevel(e,"programs",t)},ForEach.sampler=function(e,t){return ForEach.topLevel(e,"samplers",t)},ForEach.scene=function(e,t){return ForEach.topLevel(e,"scenes",t)},ForEach.shader=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.shaders,t):ForEach.topLevel(e,"shaders",t)},ForEach.skin=function(e,t){return ForEach.topLevel(e,"skins",t)},ForEach.skinJoint=function(e,t){const i=e.joints;if(defined(i)){const e=i.length;for(let n=0;n<e;n++){const e=t(i[n]);if(defined(e))return e}}},ForEach.techniqueAttribute=function(e,t){const i=e.attributes;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const n=t(i[e],e);if(defined(n))return n}},ForEach.techniqueUniform=function(e,t){const i=e.uniforms;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const n=t(i[e],e);if(defined(n))return n}},ForEach.techniqueParameter=function(e,t){const i=e.parameters;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const n=t(i[e],e);if(defined(n))return n}},ForEach.technique=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.techniques,t):ForEach.topLevel(e,"techniques",t)},ForEach.texture=function(e,t){return ForEach.topLevel(e,"textures",t)};const sizeOfUint32$5=4;function parseGlb(e){if("glTF"!==getMagic(e))throw new RuntimeError("File is not valid binary glTF");const t=readHeader(e,0,5),i=t[1];if(1!==i&&2!==i)throw new RuntimeError("Binary glTF version is not 1 or 2");return 1===i?parseGlbVersion1(e,t):parseGlbVersion2(e,t)}function readHeader(e,t,i){const n=new DataView(e.buffer),r=new Array(i);for(let o=0;o<i;++o)r[o]=n.getUint32(e.byteOffset+t+o*sizeOfUint32$5,!0);return r}function parseGlbVersion1(e,t){const i=t[2],n=t[3];if(0!==t[4])throw new RuntimeError("Binary glTF scene format is not JSON");const r=20+n,o=getStringFromTypedArray(e,20,n),a=JSON.parse(o);addPipelineExtras(a);const s=e.subarray(r,i),c=a.buffers;if(defined(c)&&Object.keys(c).length>0){const e=defaultValue(c.binary_glTF,c.KHR_binary_glTF);defined(e)&&(e.extras._pipeline.source=s,delete e.uri)}return removeExtensionsUsed(a,"KHR_binary_glTF"),a}function parseGlbVersion2(e,t){const i=t[2];let n,r,o=12;for(;o<i;){const t=readHeader(e,o,2),i=t[0],a=t[1];o+=8;const s=e.subarray(o,o+i);if(o+=i,1313821514===a){const e=getStringFromTypedArray(s);n=JSON.parse(e),addPipelineExtras(n)}else 5130562===a&&(r=s)}if(defined(n)&&defined(r)){const e=n.buffers;if(defined(e)&&e.length>0){e[0].extras._pipeline.source=r}}return n}function addExtensionsUsed(e,t){let i=e.extensionsUsed;defined(i)||(i=[],e.extensionsUsed=i),addToArray(i,t,!0)}function getComponentReader(e){switch(e){case ComponentDatatype$1.BYTE:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getInt8(t+o*n)};case ComponentDatatype$1.UNSIGNED_BYTE:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getUint8(t+o*n)};case ComponentDatatype$1.SHORT:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getInt16(t+o*n,!0)};case ComponentDatatype$1.UNSIGNED_SHORT:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getUint16(t+o*n,!0)};case ComponentDatatype$1.INT:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getInt32(t+o*n,!0)};case ComponentDatatype$1.UNSIGNED_INT:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getUint32(t+o*n,!0)};case ComponentDatatype$1.FLOAT:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getFloat32(t+o*n,!0)};case ComponentDatatype$1.DOUBLE:return function(e,t,i,n,r){for(let o=0;o<i;++o)r[o]=e.getFloat64(t+o*n,!0)}}}function findAccessorMinMax(e,t){const i=e.bufferViews,n=e.buffers,r=t.bufferView,o=numberOfComponentsForType(t.type);if(!defined(t.bufferView))return{min:arrayFill(new Array(o),0),max:arrayFill(new Array(o),0)};const a=arrayFill(new Array(o),Number.POSITIVE_INFINITY),s=arrayFill(new Array(o),Number.NEGATIVE_INFINITY),c=i[r],l=n[c.buffer].extras._pipeline.source,u=t.count,d=getAccessorByteStride(e,t);let h=t.byteOffset+c.byteOffset+l.byteOffset;const p=t.componentType,f=ComponentDatatype$1.getSizeInBytes(p),m=new DataView(l.buffer),g=new Array(o),_=getComponentReader(p);for(let e=0;e<u;e++){_(m,h,o,f,g);for(let e=0;e<o;e++){const t=g[e];a[e]=Math.min(a[e],t),s[e]=Math.max(s[e],t)}h+=d}return{min:a,max:s}}const defaultBlendEquation=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],defaultBlendFactors=[WebGLConstants$1.ONE,WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.ZERO];function isStateEnabled(e,t){const i=e.enable;return!!defined(i)&&i.indexOf(t)>-1}const supportedBlendFactors=[WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.SRC_COLOR,WebGLConstants$1.ONE_MINUS_SRC_COLOR,WebGLConstants$1.SRC_ALPHA,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.DST_ALPHA,WebGLConstants$1.ONE_MINUS_DST_ALPHA,WebGLConstants$1.DST_COLOR,WebGLConstants$1.ONE_MINUS_DST_COLOR];function getSupportedBlendFactors(e,t){if(!defined(e))return t;for(let i=0;i<4;i++)if(-1===supportedBlendFactors.indexOf(e[i]))return t;return e}function moveTechniqueRenderStates(e){const t={},i={};return defined(e.techniques)?(ForEach.technique(e,(function(e,n){const r=e.states;if(defined(r)){const o=i[n]={};if(isStateEnabled(r,WebGLConstants$1.BLEND)){o.alphaMode="BLEND";const e=r.functions;defined(e)&&(defined(e.blendEquationSeparate)||defined(e.blendFuncSeparate))&&(t[n]={blendEquation:defaultValue(e.blendEquationSeparate,defaultBlendEquation),blendFactors:getSupportedBlendFactors(e.blendFuncSeparate,defaultBlendFactors)})}isStateEnabled(r,WebGLConstants$1.CULL_FACE)||(o.doubleSided=!0),delete e.states}})),Object.keys(t).length>0&&(defined(e.extensions)||(e.extensions={}),addExtensionsUsed(e,"KHR_blend")),ForEach.material(e,(function(e){if(defined(e.technique)){const n=i[e.technique];ForEach.objectLegacy(n,(function(t,i){e[i]=t}));const r=t[e.technique];defined(r)&&(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_blend=r)}})),e):e}function addExtensionsRequired(e,t){let i=e.extensionsRequired;defined(i)||(i=[],e.extensionsRequired=i),addToArray(i,t,!0),addExtensionsUsed(e,t)}function moveTechniquesToExtension(e){const t=e.techniques,i={},n={},r={};if(defined(t)){const t={programs:[],shaders:[],techniques:[]},o=e.glExtensionsUsed;delete e.glExtensionsUsed,ForEach.technique(e,(function(a,s){const c={name:a.name,program:void 0,attributes:{},uniforms:{}};let l;if(ForEach.techniqueAttribute(a,(function(e,t){l=a.parameters[e],c.attributes[t]={semantic:l.semantic}})),ForEach.techniqueUniform(a,(function(e,t){l=a.parameters[e],c.uniforms[t]={count:l.count,node:l.node,type:l.type,semantic:l.semantic,value:l.value},defined(i[s])||(i[s]={}),i[s][e]=t})),defined(r[a.program]))c.program=r[a.program];else{const i=e.programs[a.program],n={name:i.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:o},s=e.shaders[i.fragmentShader];n.fragmentShader=addToArray(t.shaders,s,!0);const l=e.shaders[i.vertexShader];n.vertexShader=addToArray(t.shaders,l,!0),c.program=addToArray(t.programs,n),r[a.program]=c.program}n[s]=addToArray(t.techniques,c)})),t.techniques.length>0&&(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t,addExtensionsUsed(e,"KHR_techniques_webgl"),addExtensionsRequired(e,"KHR_techniques_webgl"))}return ForEach.material(e,(function(e){if(defined(e.technique)){const t={technique:n[e.technique]};ForEach.objectLegacy(e.values,(function(n,r){defined(t.values)||(t.values={});const o=i[e.technique][r];t.values[o]=n})),defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t}delete e.technique,delete e.values})),delete e.techniques,delete e.programs,delete e.shaders,e}function forEachTextureInMaterial(e,t){Check.typeOf.object("material",e),Check.defined("handler",t);const i=e.pbrMetallicRoughness;if(defined(i)){if(defined(i.baseColorTexture)){const e=i.baseColorTexture,n=t(e.index,e);if(defined(n))return n}if(defined(i.metallicRoughnessTexture)){const e=i.metallicRoughnessTexture,n=t(e.index,e);if(defined(n))return n}}if(defined(e.extensions)){const i=e.extensions.KHR_materials_pbrSpecularGlossiness;if(defined(i)){if(defined(i.diffuseTexture)){const e=i.diffuseTexture,n=t(e.index,e);if(defined(n))return n}if(defined(i.specularGlossinessTexture)){const e=i.specularGlossinessTexture,n=t(e.index,e);if(defined(n))return n}}const n=e.extensions.KHR_materials_common;if(defined(n)){const e=n.values.diffuse,i=n.values.ambient,r=n.values.emission,o=n.values.specular;if(defined(e)&&defined(e.index)){const i=t(e.index,e);if(defined(i))return i}if(defined(i)&&defined(i.index)){const e=t(i.index,i);if(defined(e))return e}if(defined(r)&&defined(r.index)){const e=t(r.index,r);if(defined(e))return e}if(defined(o)&&defined(o.index)){const e=t(o.index,o);if(defined(e))return e}}}const n=ForEach.materialValue(e,(function(e){if(defined(e.index)){const i=t(e.index,e);if(defined(i))return i}}));if(defined(n))return n;if(defined(e.emissiveTexture)){const i=e.emissiveTexture,n=t(i.index,i);if(defined(n))return n}if(defined(e.normalTexture)){const i=e.normalTexture,n=t(i.index,i);if(defined(n))return n}if(defined(e.occlusionTexture)){const i=e.occlusionTexture,n=t(i.index,i);if(defined(n))return n}}const allElementTypes=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function removeUnusedElements(e,t){return t=defaultValue(t,allElementTypes),allElementTypes.forEach((function(i){t.indexOf(i)>-1&&removeUnusedElementsByType(e,i)})),e}const TypeToGltfElementName={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function removeUnusedElementsByType(e,t){const i=e[TypeToGltfElementName[t]];if(defined(i)){let n=0;const r=getListOfElementsIdsInUse[t](e),o=i.length;for(let i=0;i<o;++i)r[i]||(Remove[t](e,i-n),n++)}}function Remove(){}function getListOfElementsIdsInUse(){}function nodeIsEmpty(e,t,i){const n=e.nodes[t];return!(defined(n.mesh)||defined(n.camera)||defined(n.skin)||defined(n.weights)||defined(n.extras)||defined(n.extensions)&&0!==Object.keys(n.extensions).length||defined(i[t]))&&(!defined(n.children)||0===n.children.filter((function(t){return!nodeIsEmpty(e,t,i)})).length)}function addBuffer(e,t){const i={byteLength:t.length,extras:{_pipeline:{source:t}}},n={buffer:addToArray(e.buffers,i),byteOffset:0,byteLength:t.length};return addToArray(e.bufferViews,n)}function readAccessorPacked(e,t){const i=getAccessorByteStride(e,t),n=ComponentDatatype$1.getSizeInBytes(t.componentType),r=numberOfComponentsForType(t.type),o=t.count,a=new Array(r*o);if(!defined(t.bufferView))return arrayFill(a,0),a;const s=e.bufferViews[t.bufferView],c=e.buffers[s.buffer].extras._pipeline.source;let l=t.byteOffset+s.byteOffset+c.byteOffset;const u=new DataView(c.buffer),d=new Array(r),h=getComponentReader(t.componentType);for(let e=0;e<o;++e){h(u,l,r,n,d);for(let t=0;t<r;++t)a[e*r+t]=d[t];l+=i}return a}function updateAccessorComponentTypes(e){let t;return ForEach.accessorWithSemantic(e,"JOINTS_0",(function(i){const n=e.accessors[i];t=n.componentType,t===WebGLConstants$1.BYTE?convertType(e,n,ComponentDatatype$1.UNSIGNED_BYTE):t!==WebGLConstants$1.UNSIGNED_BYTE&&t!==WebGLConstants$1.UNSIGNED_SHORT&&convertType(e,n,ComponentDatatype$1.UNSIGNED_SHORT)})),ForEach.accessorWithSemantic(e,"WEIGHTS_0",(function(i){const n=e.accessors[i];t=n.componentType,t===WebGLConstants$1.BYTE?convertType(e,n,ComponentDatatype$1.UNSIGNED_BYTE):t===WebGLConstants$1.SHORT&&convertType(e,n,ComponentDatatype$1.UNSIGNED_SHORT)})),e}function convertType(e,t,i){const n=ComponentDatatype$1.createTypedArray(i,readAccessorPacked(e,t)),r=new Uint8Array(n.buffer);t.bufferView=addBuffer(e,r),t.componentType=i,t.byteOffset=0}Remove.accessor=function(e,t){e.accessors.splice(t,1),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(i,n){i>t&&e.attributes[n]--})),ForEach.meshPrimitiveTarget(e,(function(e){ForEach.meshPrimitiveTargetAttribute(e,(function(i,n){i>t&&e[n]--}))}));const i=e.indices;defined(i)&&i>t&&e.indices--}))})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&e.inverseBindMatrices>t&&e.inverseBindMatrices--})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){defined(e.input)&&e.input>t&&e.input--,defined(e.output)&&e.output>t&&e.output--}))}))},Remove.buffer=function(e,t){e.buffers.splice(t,1),ForEach.bufferView(e,(function(e){defined(e.buffer)&&e.buffer>t&&e.buffer--,defined(e.extensions)&&defined(e.extensions.EXT_meshopt_compression)&&e.extensions.EXT_meshopt_compression.buffer--}))},Remove.bufferView=function(e,t){if(e.bufferViews.splice(t,1),ForEach.accessor(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),ForEach.shader(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),ForEach.image(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),usesExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&e.extensions.KHR_draco_mesh_compression.bufferView>t&&e.extensions.KHR_draco_mesh_compression.bufferView--}))})),usesExtension(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].properties;if(defined(n))for(const e in n)if(n.hasOwnProperty(e)){const i=n[e];defined(i.bufferView)&&i.bufferView>t&&i.bufferView--,defined(i.arrayOffsetBufferView)&&i.arrayOffsetBufferView>t&&i.arrayOffsetBufferView--,defined(i.stringOffsetBufferView)&&i.stringOffsetBufferView>t&&i.stringOffsetBufferView--}}}},Remove.image=function(e,t){e.images.splice(t,1),ForEach.texture(e,(function(e){defined(e.source)&&e.source>t&&--e.source;const i=e.extensions;defined(i)&&defined(i.EXT_texture_webp)&&i.EXT_texture_webp.source>t?--e.extensions.EXT_texture_webp.source:defined(i)&&defined(i.KHR_texture_basisu)&&i.KHR_texture_basisu.source>t&&--e.extensions.KHR_texture_basisu.source}))},Remove.mesh=function(e,t){e.meshes.splice(t,1),ForEach.node(e,(function(e){defined(e.mesh)&&(e.mesh>t?e.mesh--:e.mesh===t&&delete e.mesh)}))},Remove.node=function(e,t){e.nodes.splice(t,1),ForEach.skin(e,(function(e){defined(e.skeleton)&&e.skeleton>t&&e.skeleton--,e.joints=e.joints.map((function(e){return e>t?e-1:e}))})),ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){defined(e.target)&&defined(e.target.node)&&e.target.node>t&&e.target.node--}))})),ForEach.technique(e,(function(e){ForEach.techniqueUniform(e,(function(e){defined(e.node)&&e.node>t&&e.node--}))})),ForEach.node(e,(function(e){defined(e.children)&&(e.children=e.children.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e})))})),ForEach.scene(e,(function(e){e.nodes=e.nodes.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e}))}))},Remove.material=function(e,t){e.materials.splice(t,1),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.material)&&e.material>t&&e.material--}))}))},Remove.sampler=function(e,t){e.samplers.splice(t,1),ForEach.texture(e,(function(e){defined(e.sampler)&&e.sampler>t&&--e.sampler}))},Remove.texture=function(e,t){if(e.textures.splice(t,1),ForEach.material(e,(function(e){forEachTextureInMaterial(e,(function(e,i){i.index>t&&--i.index}))})),usesExtension(e,"EXT_feature_metadata")){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){const i=e.extensions;if(defined(i)&&defined(i.EXT_feature_metadata)){const e=i.EXT_feature_metadata.featureIdTextures;if(defined(e)){const i=e.length;for(let n=0;n<i;++n){const i=e[n].featureIds.texture;i.index>t&&--i.index}}}}))}));const i=e.extensions.EXT_feature_metadata.featureTextures;for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].properties;if(defined(n))for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].texture;i.index>t&&--i.index}}}},getListOfElementsIdsInUse.accessor=function(e){const t={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(e){t[e]=!0})),ForEach.meshPrimitiveTarget(e,(function(e){ForEach.meshPrimitiveTargetAttribute(e,(function(e){t[e]=!0}))}));const i=e.indices;defined(i)&&(t[i]=!0)}))})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&(t[e.inverseBindMatrices]=!0)})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){defined(e.input)&&(t[e.input]=!0),defined(e.output)&&(t[e.output]=!0)}))})),usesExtension(e,"EXT_mesh_gpu_instancing")&&ForEach.node(e,(function(e){defined(e.extensions)&&defined(e.extensions.EXT_mesh_gpu_instancing)&&Object.keys(e.extensions.EXT_mesh_gpu_instancing.attributes).forEach((function(i){const n=e.extensions.EXT_mesh_gpu_instancing.attributes[i];t[n]=!0}))})),t},getListOfElementsIdsInUse.buffer=function(e){const t={};return ForEach.bufferView(e,(function(e){defined(e.buffer)&&(t[e.buffer]=!0),defined(e.extensions)&&defined(e.extensions.EXT_meshopt_compression)&&(t[e.extensions.EXT_meshopt_compression.buffer]=!0)})),t},getListOfElementsIdsInUse.bufferView=function(e){const t={};if(ForEach.accessor(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),ForEach.shader(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),ForEach.image(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),usesExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&(t[e.extensions.KHR_draco_mesh_compression.bufferView]=!0)}))})),usesExtension(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].properties;if(defined(n))for(const e in n)if(n.hasOwnProperty(e)){const i=n[e];defined(i.bufferView)&&(t[i.bufferView]=!0),defined(i.arrayOffsetBufferView)&&(t[i.arrayOffsetBufferView]=!0),defined(i.stringOffsetBufferView)&&(t[i.stringOffsetBufferView]=!0)}}}return t},getListOfElementsIdsInUse.image=function(e){const t={};return ForEach.texture(e,(function(e){defined(e.source)&&(t[e.source]=!0),defined(e.extensions)&&defined(e.extensions.EXT_texture_webp)?t[e.extensions.EXT_texture_webp.source]=!0:defined(e.extensions)&&defined(e.extensions.KHR_texture_basisu)&&(t[e.extensions.KHR_texture_basisu.source]=!0)})),t},getListOfElementsIdsInUse.mesh=function(e){const t={};return ForEach.node(e,(function(i){if(defined(i.mesh&&defined(e.meshes))){const n=e.meshes[i.mesh];defined(n)&&defined(n.primitives)&&n.primitives.length>0&&(t[i.mesh]=!0)}})),t},getListOfElementsIdsInUse.node=function(e){const t={};return ForEach.skin(e,(function(e){defined(e.skeleton)&&(t[e.skeleton]=!0),ForEach.skinJoint(e,(function(e){t[e]=!0}))})),ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){defined(e.target)&&defined(e.target.node)&&(t[e.target.node]=!0)}))})),ForEach.technique(e,(function(e){ForEach.techniqueUniform(e,(function(e){defined(e.node)&&(t[e.node]=!0)}))})),ForEach.node(e,(function(i,n){nodeIsEmpty(e,n,t)||(t[n]=!0)})),t},getListOfElementsIdsInUse.material=function(e){const t={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.material)&&(t[e.material]=!0)}))})),t},getListOfElementsIdsInUse.texture=function(e){const t={};if(ForEach.material(e,(function(e){forEachTextureInMaterial(e,(function(e){t[e]=!0}))})),usesExtension(e,"EXT_feature_metadata")){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){const i=e.extensions;if(defined(i)&&defined(i.EXT_feature_metadata)){const e=i.EXT_feature_metadata.featureIdTextures;if(defined(e)){const i=e.length;for(let n=0;n<i;++n){const i=e[n].featureIds.texture;t[i.index]=!0}}}}))}));const i=e.extensions.EXT_feature_metadata.featureTextures;for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].properties;if(defined(n))for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].texture;t[i.index]=!0}}}return t},getListOfElementsIdsInUse.sampler=function(e){const t={};return ForEach.texture(e,(function(e){defined(e.sampler)&&(t[e.sampler]=!0)})),t};const updateFunctions={.8:glTF08to10,"1.0":glTF10to20,"2.0":void 0};function updateVersion(e,t){const i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).targetVersion;let n=e.version;e.asset=defaultValue(e.asset,{version:"1.0"}),e.asset.version=defaultValue(e.asset.version,"1.0"),n=defaultValue(n,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(updateFunctions,n)||(defined(n)&&(n=n.substring(0,3)),Object.prototype.hasOwnProperty.call(updateFunctions,n)||(n="1.0"));let r=updateFunctions[n];for(;defined(r)&&n!==i;)r(e,t),n=e.asset.version,r=updateFunctions[n];return e}function updateInstanceTechniques(e){const t=e.materials;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e],n=i.instanceTechnique;defined(n)&&(i.technique=n.technique,i.values=n.values,delete i.instanceTechnique)}}function setPrimitiveModes(e){const t=e.meshes;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e].primitives;if(defined(i)){const e=i.length;for(let t=0;t<e;++t){const e=i[t],n=defaultValue(e.primitive,WebGLConstants$1.TRIANGLES);e.mode=defaultValue(e.mode,n),delete e.primitive}}}}function updateNodes(e){const t=e.nodes,i=new Cartesian3,n=new Quaternion;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];if(defined(r.rotation)){const e=r.rotation;Cartesian3.fromArray(e,0,i),Quaternion.fromAxisAngle(i,e[3],n),r.rotation=[n.x,n.y,n.z,n.w]}const o=r.instanceSkin;defined(o)&&(r.skeletons=o.skeletons,r.skin=o.skin,r.meshes=o.meshes,delete r.instanceSkin)}}function updateAnimations(e){const t=e.animations,i=e.accessors,n=e.bufferViews,r=e.buffers,o={},a=new Cartesian3,s=new Quaternion;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const c=t[e],l=c.channels,u=c.parameters,d=c.samplers;if(defined(l)){const e=l.length;for(let t=0;t<e;++t){const e=l[t];if("rotation"===e.target.path){const t=u[d[e.sampler].output];if(defined(o[t]))continue;o[t]=!0;const c=i[t],l=n[c.bufferView],h=r[l.buffer].extras._pipeline.source,p=h.byteOffset+l.byteOffset+c.byteOffset,f=c.componentType,m=c.count,g=numberOfComponentsForType(c.type),_=c.count*g,y=ComponentDatatype$1.createArrayBufferView(f,h.buffer,p,_);for(let e=0;e<m;e++){const t=e*g;Cartesian3.unpack(y,t,a);const i=y[t+3];Quaternion.fromAxisAngle(a,i,s),Quaternion.pack(s,y,t)}}}}}}function removeTechniquePasses(e){const t=e.techniques;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e],n=i.passes;if(defined(n)){const e=defaultValue(i.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(n,e)){const t=n[e],r=t.instanceProgram;i.attributes=defaultValue(i.attributes,r.attributes),i.program=defaultValue(i.program,r.program),i.uniforms=defaultValue(i.uniforms,r.uniforms),i.states=defaultValue(i.states,t.states)}delete i.passes,delete i.pass}}}function glTF08to10(e){defined(e.asset)||(e.asset={});const t=e.asset;if(t.version="1.0","string"==typeof t.profile){const e=t.profile.split(" ");t.profile={api:e[0],version:e[1]}}else t.profile={};if(defined(e.version)&&delete e.version,updateInstanceTechniques(e),setPrimitiveModes(e),updateNodes(e),updateAnimations(e),removeTechniquePasses(e),defined(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),defined(e.lights)){const t=defaultValue(e.extensions,{});e.extensions=t;const i=defaultValue(t.KHR_materials_common,{});t.KHR_materials_common=i,i.lights=e.lights,delete e.lights,addExtensionsUsed(e,"KHR_materials_common")}}function removeAnimationSamplersIndirection(e){const t=e.animations;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e],n=i.parameters;if(defined(n)){const e=i.samplers;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];i.input=n[i.input],i.output=n[i.output]}delete i.parameters}}}function objectToArray(e,t){const i=[];for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=e[n];t[n]=i.length,i.push(r),defined(r.name)||(r.name=n)}return i}function objectsToArrays(e){let t;const i={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}};let n;const r={},o=e.nodes;for(const e in o)Object.prototype.hasOwnProperty.call(o,e)&&(n=o[e].jointName,defined(n)&&(r[n]=e));for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&defined(i[t])){const n={},r=e[t];e[t]=objectToArray(r,n),i[t]=n}for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(r[n]=i.nodes[r[n]]);defined(e.scene)&&(e.scene=i.scenes[e.scene]),ForEach.bufferView(e,(function(e){defined(e.buffer)&&(e.buffer=i.buffers[e.buffer])})),ForEach.accessor(e,(function(e){defined(e.bufferView)&&(e.bufferView=i.bufferViews[e.bufferView])})),ForEach.shader(e,(function(e){const t=e.extensions;if(defined(t)){const n=t.KHR_binary_glTF;defined(n)&&(e.bufferView=i.bufferViews[n.bufferView],delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),ForEach.program(e,(function(e){defined(e.vertexShader)&&(e.vertexShader=i.shaders[e.vertexShader]),defined(e.fragmentShader)&&(e.fragmentShader=i.shaders[e.fragmentShader])})),ForEach.technique(e,(function(e){defined(e.program)&&(e.program=i.programs[e.program]),ForEach.techniqueParameter(e,(function(e){defined(e.node)&&(e.node=i.nodes[e.node]);const t=e.value;"string"==typeof t&&(e.value={index:i.textures[t]})}))})),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.indices)&&(e.indices=i.accessors[e.indices]),ForEach.meshPrimitiveAttribute(e,(function(t,n){e.attributes[n]=i.accessors[t]})),defined(e.material)&&(e.material=i.materials[e.material])}))})),ForEach.node(e,(function(n){let r=n.children;if(defined(r)){const e=r.length;for(t=0;t<e;++t)r[t]=i.nodes[r[t]]}if(defined(n.meshes)){const o=n.meshes,a=o.length;if(a>0)for(n.mesh=i.meshes[o[0]],t=1;t<a;++t){const a={mesh:i.meshes[o[t]]},s=addToArray(e.nodes,a);defined(r)||(r=[],n.children=r),r.push(s)}delete n.meshes}if(defined(n.camera)&&(n.camera=i.cameras[n.camera]),defined(n.skin)&&(n.skin=i.skins[n.skin]),defined(n.skeletons)){const t=n.skeletons;if(t.length>0&&defined(n.skin)){e.skins[n.skin].skeleton=i.nodes[t[0]]}delete n.skeletons}defined(n.jointName)&&delete n.jointName})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&(e.inverseBindMatrices=i.accessors[e.inverseBindMatrices]);const n=e.jointNames;if(defined(n)){const i=[],o=n.length;for(t=0;t<o;++t)i[t]=r[n[t]];e.joints=i,delete e.jointNames}})),ForEach.scene(e,(function(e){const n=e.nodes;if(defined(n)){const e=n.length;for(t=0;t<e;++t)n[t]=i.nodes[n[t]]}})),ForEach.animation(e,(function(e){const t={};e.samplers=objectToArray(e.samplers,t),ForEach.animationSampler(e,(function(e){e.input=i.accessors[e.input],e.output=i.accessors[e.output]})),ForEach.animationChannel(e,(function(e){e.sampler=t[e.sampler];const n=e.target;defined(n)&&(n.node=i.nodes[n.id],delete n.id)}))})),ForEach.material(e,(function(e){defined(e.technique)&&(e.technique=i.techniques[e.technique]),ForEach.materialValue(e,(function(t,n){"string"==typeof t&&(e.values[n]={index:i.textures[t]})}));const t=e.extensions;if(defined(t)){const e=t.KHR_materials_common;defined(e)&&ForEach.materialValue(e,(function(t,n){"string"==typeof t&&(e.values[n]={index:i.textures[t]})}))}})),ForEach.image(e,(function(e){const t=e.extensions;if(defined(t)){const n=t.KHR_binary_glTF;defined(n)&&(e.bufferView=i.bufferViews[n.bufferView],e.mimeType=n.mimeType,delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),ForEach.texture(e,(function(e){defined(e.sampler)&&(e.sampler=i.samplers[e.sampler]),defined(e.source)&&(e.source=i.images[e.source])}))}function removeAnimationSamplerNames(e){ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){delete e.name}))}))}function removeEmptyArrays(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];Array.isArray(i)&&0===i.length&&delete e[t]}ForEach.node(e,(function(e){defined(e.children)&&0===e.children.length&&delete e.children}))}function stripAsset(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}const knownExtensions={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function requireKnownExtensions(e){const t=e.extensionsUsed;if(e.extensionsRequired=defaultValue(e.extensionsRequired,[]),defined(t)){const i=t.length;for(let n=0;n<i;++n){const i=t[n];defined(knownExtensions[i])&&e.extensionsRequired.push(i)}}}function removeBufferType(e){ForEach.buffer(e,(function(e){delete e.type}))}function removeTextureProperties(e){ForEach.texture(e,(function(e){delete e.format,delete e.internalFormat,delete e.target,delete e.type}))}function requireAttributeSetIndex(e){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(t,i){"TEXCOORD"===i?e.attributes.TEXCOORD_0=t:"COLOR"===i&&(e.attributes.COLOR_0=t)})),delete e.attributes.TEXCOORD,delete e.attributes.COLOR}))})),ForEach.technique(e,(function(e){ForEach.techniqueParameter(e,(function(e){const t=e.semantic;defined(t)&&("TEXCOORD"===t?e.semantic="TEXCOORD_0":"COLOR"===t&&(e.semantic="COLOR_0"))}))}))}const knownSemantics={POSITION:!0,NORMAL:!0,TANGENT:!0},indexedSemantics={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function underscoreApplicationSpecificSemantics(e){const t={};ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(e,i){if("_"!==i.charAt(0)){const e=i.search(/_[0-9]+/g);let n,r=i,o="_0";e>=0&&(r=i.substring(0,e),o=i.substring(e));const a=indexedSemantics[r];defined(a)?(n=a+o,t[i]=n):defined(knownSemantics[r])||(n="_"+i,t[i]=n)}}));for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i],r=e.attributes[i];defined(r)&&(delete e.attributes[i],e.attributes[n]=r)}}))})),ForEach.technique(e,(function(e){ForEach.techniqueParameter(e,(function(e){const i=t[e.semantic];defined(i)&&(e.semantic=i)}))}))}function clampCameraParameters(e){ForEach.camera(e,(function(e){const t=e.perspective;if(defined(t)){const e=t.aspectRatio;defined(e)&&0===e&&delete t.aspectRatio;const i=t.yfov;defined(i)&&0===i&&(t.yfov=1)}}))}function computeAccessorByteStride(e,t){return defined(t.byteStride)&&0!==t.byteStride?t.byteStride:getAccessorByteStride(e,t)}function requireByteLength(e){ForEach.buffer(e,(function(e){defined(e.byteLength)||(e.byteLength=e.extras._pipeline.source.length)})),ForEach.accessor(e,(function(t){const i=t.bufferView;if(defined(i)){const n=e.bufferViews[i],r=computeAccessorByteStride(e,t),o=t.byteOffset+t.count*r;n.byteLength=Math.max(defaultValue(n.byteLength,0),o)}}))}function moveByteStrideToBufferView(e){let t,i,n;const r=e.bufferViews,o={};ForEach.accessorContainingVertexAttributeData(e,(function(t){const i=e.accessors[t];defined(i.bufferView)&&(o[i.bufferView]=!0)}));const a={};ForEach.accessor(e,(function(e){defined(e.bufferView)&&(a[e.bufferView]=defaultValue(a[e.bufferView],[]),a[e.bufferView].push(e))}));for(const s in a)if(Object.prototype.hasOwnProperty.call(a,s)){n=r[s];const c=a[s];c.sort((function(e,t){return e.byteOffset-t.byteOffset}));let l=0,u=0;const d=c.length;for(t=0;t<d;++t){let a=c[t];const h=computeAccessorByteStride(e,a),p=a.byteOffset,f=a.count*h;delete a.byteStride;const m=t<d-1;if(h!==(m?computeAccessorByteStride(e,c[t+1]):void 0)){const e=clone$1(n,!0);o[s]&&(e.byteStride=h),e.byteOffset+=l,e.byteLength=p+f-l;const d=addToArray(r,e);for(i=u;i<=t;++i)a=c[i],a.bufferView=d,a.byteOffset=a.byteOffset-l;l=m?c[t+1].byteOffset:void 0,u=t+1}}}removeUnusedElements(e,["accessor","bufferView","buffer"])}function requirePositionAccessorMinMax(e){ForEach.accessorWithSemantic(e,"POSITION",(function(t){const i=e.accessors[t];if(!defined(i.min)||!defined(i.max)){const t=findAccessorMinMax(e,i);i.min=t.min,i.max=t.max}}))}function isNodeEmpty(e){return(!defined(e.children)||0===e.children.length)&&(!defined(e.meshes)||0===e.meshes.length)&&!defined(e.camera)&&!defined(e.skin)&&!defined(e.skeletons)&&!defined(e.jointName)&&(!defined(e.translation)||Cartesian3.fromArray(e.translation).equals(Cartesian3.ZERO))&&(!defined(e.scale)||Cartesian3.fromArray(e.scale).equals(new Cartesian3(1,1,1)))&&(!defined(e.rotation)||Cartesian4.fromArray(e.rotation).equals(new Cartesian4(0,0,0,1)))&&(!defined(e.matrix)||Matrix4.fromColumnMajorArray(e.matrix).equals(Matrix4.IDENTITY))&&!defined(e.extensions)&&!defined(e.extras)}function deleteNode(e,t){ForEach.scene(e,(function(e){const i=e.nodes;if(defined(i)){for(let e=i.length;e>=0;--e)if(i[e]===t)return void i.splice(e,1)}})),ForEach.node(e,(function(i,n){if(defined(i.children)){const r=i.children.indexOf(t);r>-1&&(i.children.splice(r,1),isNodeEmpty(i)&&deleteNode(e,n))}})),delete e.nodes[t]}function removeEmptyNodes(e){return ForEach.node(e,(function(t,i){isNodeEmpty(t)&&deleteNode(e,i)})),e}function requireAnimationAccessorMinMax(e){ForEach.animation(e,(function(t){ForEach.animationSampler(t,(function(t){const i=e.accessors[t.input];if(!defined(i.min)||!defined(i.max)){const t=findAccessorMinMax(e,i);i.min=t.min,i.max=t.max}}))}))}function glTF10to20(e){e.asset=defaultValue(e.asset,{}),e.asset.version="2.0",updateInstanceTechniques(e),removeAnimationSamplersIndirection(e),removeEmptyNodes(e),objectsToArrays(e),removeAnimationSamplerNames(e),stripAsset(e),requireKnownExtensions(e),requireByteLength(e),moveByteStrideToBufferView(e),requirePositionAccessorMinMax(e),requireAnimationAccessorMinMax(e),removeBufferType(e),removeTextureProperties(e),requireAttributeSetIndex(e),underscoreApplicationSpecificSemantics(e),updateAccessorComponentTypes(e),clampCameraParameters(e),moveTechniqueRenderStates(e),moveTechniquesToExtension(e),removeEmptyArrays(e)}function ModelLoadResources(){this.initialized=!1,this.resourcesParsed=!1,this.vertexBuffersToCreate=new Queue,this.indexBuffersToCreate=new Queue,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new Queue,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new Queue,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new Queue,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.createdBufferViews={},this.primitivesToDecode=new Queue,this.activeDecodingTasks=0,this.pendingDecodingCache=!1,this.skinnedNodesIds=[]}function getSubarray(e,t,i){return e.subarray(t,t+i)}ModelLoadResources.prototype.getBuffer=function(e){return getSubarray(this.buffers[e.buffer],e.byteOffset,e.byteLength)},ModelLoadResources.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},ModelLoadResources.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length},ModelLoadResources.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},ModelLoadResources.prototype.finishedTextureCreation=function(){const e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},ModelLoadResources.prototype.finishedEverythingButTextureCreation=function(){const e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return this.finishedDecoding()&&e&&t},ModelLoadResources.prototype.finishedDecoding=function(){return 0===this.primitivesToDecode.length&&0===this.activeDecodingTasks&&!this.pendingDecodingCache},ModelLoadResources.prototype.finished=function(){return this.finishedDecoding()&&this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()};const ModelUtility={updateForwardAxis:function(e){const t=e.gltf.extras.sourceVersion;(defined(t)&&"2.0"!==t||"2.0"!==ModelUtility.getAssetVersion(e.gltf))&&(e._gltfForwardAxis=Axis$1.X)},getAssetVersion:function(e){return defined(e.asset)&&defined(e.asset.version)?e.asset.version:"1.0"},splitIncompatibleMaterials:function(e){const t=e.accessors,i=e.materials,n={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){let r=e.material;const o=i[r],a=e.attributes.JOINTS_0;let s,c;if(defined(a)){const e=t[a];s=e.componentType,c=e.type}const l=defined(a)&&"VEC4"===c,u=defined(e.attributes.COLOR_0),d=defined(e.targets),h=defined(e.attributes.NORMAL),p=defined(e.attributes.TANGENT),f=defined(e.attributes.TEXCOORD_0),m=f&&defined(e.attributes.TEXCOORD_1),g=defined(e.extensions)&&defined(e.extensions.CESIUM_primitive_outline),_=n[r];if(defined(_)){if(_.skinning.skinned!==l||_.hasVertexColors!==u||_.hasMorphTargets!==d||_.hasNormals!==h||_.hasTangents!==p||_.hasTexCoords!==f||_.hasTexCoord1!==m||_.hasOutline!==g){const t=clone$1(o,!0);r=addToArray(i,t),e.material=r,n[r]={skinning:{skinned:l,componentType:s},hasVertexColors:u,hasMorphTargets:d,hasNormals:h,hasTangents:p,hasTexCoords:f,hasTexCoord1:m,hasOutline:g}}}else n[r]={skinning:{skinned:l,componentType:s},hasVertexColors:u,hasMorphTargets:d,hasNormals:h,hasTangents:p,hasTexCoords:f,hasTexCoord1:m,hasOutline:g}}))})),n},getShaderVariable:function(e){return"SCALAR"===e?"float":e.toLowerCase()},ModelState:{NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},getFailedLoadFunction:function(e,t,i){return function(n){e._state=ModelUtility.ModelState.FAILED;let r=`Failed to load ${t}: ${i}`;defined(n)&&(r+=`\n${n.message}`),e._readyPromise.reject(new RuntimeError(r))}},parseBuffers:function(e,t){const i=e._loadResources;ForEach.buffer(e.gltf,(function(n,r){if(defined(n.extras._pipeline.source))i.buffers[r]=n.extras._pipeline.source;else if(defined(t)){const o=e._resource.getDerivedResource({url:n.uri});++i.pendingBufferLoads,o.fetchArrayBuffer().then(t(e,r)).catch(ModelUtility.getFailedLoadFunction(e,"buffer",o.url))}}))}},aMinScratch=new Cartesian3,aMaxScratch=new Cartesian3;function techniqueAttributeForSemantic(e,t){return ForEach.techniqueAttribute(e,(function(e,i){if(e.semantic===t)return i}))}function ensureSemanticExistenceForPrimitive(e,t){const i=e.accessors,n=e.materials,r=e.extensions.KHR_techniques_webgl,o=r.techniques,a=r.programs,s=r.shaders,c=t.targets,l=t.attributes;for(const e in c)if(c.hasOwnProperty(e)){const t=c[e];for(const i in t)"extras"!==i&&(l[`${i}_${e}`]=t[i])}const u=o[n[t.material].extensions.KHR_techniques_webgl.technique],d=s[a[u.program].vertexShader];for(const e in l)if(l.hasOwnProperty(e)&&!defined(techniqueAttributeForSemantic(u,e))){const t=i[l[e]];let n=e.toLowerCase();"_"===n.charAt(0)&&(n=n.slice(1));const r=`a_${n}`;u.attributes[r]={semantic:e,type:t.componentType};const o=d.extras._pipeline;let a=o.source;a=`attribute ${ModelUtility.getShaderVariable(t.type)} ${r};\n${a}`,o.source=a}}function getTechniqueAttributeOrUniformFunction(e,t,i,n){return usesExtension(e,"KHR_techniques_webgl")?function(e,t){if(!(e.semantic!==i||n&&defined(e.node)))return t}:function(e,r){const o=t.parameters[e];if(!(o.semantic!==i||n&&defined(o.node)))return r}}ModelUtility.computeBoundingSphere=function(e){const t=e.gltf,i=t.nodes,n=t.meshes,r=t.scenes[t.scene].nodes,o=r.length,a=[],s=new Cartesian3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),c=new Cartesian3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let e=0;e<o;++e){let o=i[r[e]];for(o._transformToRoot=ModelUtility.getTransform(o),a.push(o);a.length>0;){o=a.pop();const e=o._transformToRoot,r=o.mesh;if(defined(r)){const i=n[r].primitives,o=i.length;for(let n=0;n<o;++n){const r=i[n].attributes.POSITION;if(defined(r)){const i=ModelUtility.getAccessorMinMax(t,r);if(defined(i.min)&&defined(i.max)){const t=Cartesian3.fromArray(i.min,0,aMinScratch),n=Cartesian3.fromArray(i.max,0,aMaxScratch);Matrix4.multiplyByPoint(e,t,t),Matrix4.multiplyByPoint(e,n,n),Cartesian3.minimumByComponent(s,t,s),Cartesian3.maximumByComponent(c,n,c)}}}}const l=o.children;if(defined(l)){const t=l.length;for(let n=0;n<t;++n){const t=i[l[n]];t._transformToRoot=ModelUtility.getTransform(t),Matrix4.multiplyTransformation(e,t._transformToRoot,t._transformToRoot),a.push(t)}}delete o._transformToRoot}}const l=BoundingSphere.fromCornerPoints(s,c);return e._forwardAxis===Axis$1.Z&&BoundingSphere.transformWithoutScale(l,Axis$1.Z_UP_TO_X_UP,l),e._upAxis===Axis$1.Y?BoundingSphere.transformWithoutScale(l,Axis$1.Y_UP_TO_Z_UP,l):e._upAxis===Axis$1.X&&BoundingSphere.transformWithoutScale(l,Axis$1.X_UP_TO_Z_UP,l),l},ModelUtility.ensureSemanticExistence=function(e){return ForEach.mesh(e,(function(t){ForEach.meshPrimitive(t,(function(t){ensureSemanticExistenceForPrimitive(e,t)}))})),e},ModelUtility.createAttributeLocations=function(e,t){const i={};let n=!1,r=1;if(ForEach.techniqueAttribute(e,(function(e,t){/pos/i.test(t)&&!n?(i[t]=0,n=!0):i[t]=r++})),defined(t))for(const e in t)t.hasOwnProperty(e)&&(i[e]=r++);return i},ModelUtility.getAccessorMinMax=function(e,t){const i=e.accessors[t],n=i.extensions;let r=i.min,o=i.max;if(defined(n)){const e=n.WEB3D_quantized_attributes;defined(e)&&(r=e.decodedMin,o=e.decodedMax)}return{min:r,max:o}},ModelUtility.getAttributeOrUniformBySemantic=function(e,t,i,n){return ForEach.technique(e,(function(r){if(defined(i)&&r.program!==i)return;const o=ForEach.techniqueAttribute(r,getTechniqueAttributeOrUniformFunction(e,r,t,n));return defined(o)?o:ForEach.techniqueUniform(r,getTechniqueAttributeOrUniformFunction(e,r,t,n))}))},ModelUtility.getDiffuseAttributeOrUniform=function(e,t){let i=ModelUtility.getAttributeOrUniformBySemantic(e,"COLOR_0",t);return defined(i)||(i=ModelUtility.getAttributeOrUniformBySemantic(e,"_3DTILESDIFFUSE",t)),i};const nodeTranslationScratch=new Cartesian3,nodeQuaternionScratch=new Quaternion,nodeScaleScratch=new Cartesian3;function replaceAllButFirstInString(e,t,i){t+="(?!\\w)",t=new RegExp(t,"g");const n=e.search(t);return e.replace(t,(function(e,t){return n===t?e:i}))}function getQuantizedAttributes(e,t){const i=e.accessors[t].extensions;if(defined(i))return i.WEB3D_quantized_attributes}function getAttributeVariableName(e,t,i){const n=t.material,r=e.materials[n];if(!usesExtension(e,"KHR_techniques_webgl")||!defined(r.extensions)||!defined(r.extensions.KHR_techniques_webgl))return;const o=r.extensions.KHR_techniques_webgl.technique,a=e.extensions.KHR_techniques_webgl.techniques[o];return ForEach.techniqueAttribute(a,(function(e,t){if(e.semantic===i)return t}))}function getScalarUniformFunction(e){const t={value:e,clone:function(e,t){return e},func:function(){return t.value}};return t}function getVec2UniformFunction(e){const t={value:Cartesian2.fromArray(e),clone:Cartesian2.clone,func:function(){return t.value}};return t}function getVec3UniformFunction(e){const t={value:Cartesian3.fromArray(e),clone:Cartesian3.clone,func:function(){return t.value}};return t}function getVec4UniformFunction(e){const t={value:Cartesian4.fromArray(e),clone:Cartesian4.clone,func:function(){return t.value}};return t}function getMat2UniformFunction(e){const t={value:Matrix2.fromColumnMajorArray(e),clone:Matrix2.clone,func:function(){return t.value}};return t}function getMat3UniformFunction(e){const t={value:Matrix3.fromColumnMajorArray(e),clone:Matrix3.clone,func:function(){return t.value}};return t}function getMat4UniformFunction(e){const t={value:Matrix4.fromColumnMajorArray(e),clone:Matrix4.clone,func:function(){return t.value}};return t}function DelayLoadedTextureUniform(e,t,i){this._value=void 0,this._textureId=e.index,this._textures=t,this._defaultTexture=i}function getTextureUniformFunction(e,t,i){const n=new DelayLoadedTextureUniform(e,t,i);return n.func=function(){return n.value},n}ModelUtility.getTransform=function(e,t){return defined(e.matrix)?Matrix4.fromColumnMajorArray(e.matrix,t):Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.fromArray(e.translation,0,nodeTranslationScratch),Quaternion.unpack(e.rotation,0,nodeQuaternionScratch),Cartesian3.fromArray(e.scale,0,nodeScaleScratch),t)},ModelUtility.getUsedExtensions=function(e){const t=e.extensionsUsed,i={};if(defined(t)){const e=t.length;for(let n=0;n<e;n++){i[t[n]]=!0}}return i},ModelUtility.getRequiredExtensions=function(e){const t=e.extensionsRequired,i={};if(defined(t)){const e=t.length;for(let n=0;n<e;n++){i[t[n]]=!0}}return i},ModelUtility.supportedExtensions={AGI_articulations:!0,CESIUM_RTC:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_binary_glTF:!0,KHR_texture_basisu:!0,KHR_draco_mesh_compression:!0,KHR_materials_common:!0,KHR_techniques_webgl:!0,KHR_materials_unlit:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0},ModelUtility.checkSupportedExtensions=function(e,t){for(const i in e)if(e.hasOwnProperty(i)){if(!ModelUtility.supportedExtensions[i])throw new RuntimeError(`Unsupported glTF Extension: ${i}`);if("EXT_texture_webp"===i&&!1===t)throw new RuntimeError("Loaded model requires WebP but browser does not support it.")}},ModelUtility.checkSupportedGlExtensions=function(e,t){if(defined(e)){const i=e.length;for(let n=0;n<i;n++){const i=e[n];if("OES_element_index_uint"!==i)throw new RuntimeError(`Unsupported WebGL Extension: ${i}`);if(!t.elementIndexUint)throw new RuntimeError("OES_element_index_uint WebGL extension is not enabled.")}}},ModelUtility.modifyShaderForDracoQuantizedAttributes=function(e,t,i,n){const r={};for(let o in n)if(n.hasOwnProperty(o)){const a=n[o],s=a.quantization;if(!defined(s))continue;const c=getAttributeVariableName(e,t,o);"_"===o.charAt(0)&&(o=o.substring(1));const l=`gltf_u_dec_${o.toLowerCase()}`;if(!defined(r[l])){const e=`gltf_decoded_${o}`,t=c.replace("a_","gltf_a_dec_"),n=a.componentsPerAttribute;let r;i=replaceAllButFirstInString(i,c,t),r=s.octEncoded?"vec3":n>1?`vec${n}`:"float",i=`${r} ${t};\n${i}`;const u=3===n&&"COLOR_0"===o;u&&(i=replaceAllButFirstInString(i,t,`vec4(${t}, 1.0)`));let d="";if(s.octEncoded){const n=`${l}_rangeConstant`;i=`uniform float ${n};\n${i}`,d=`\nvoid main() {\n ${t} = czm_octDecode(${c}.xy, ${n}).zxy;\n ${e}();\n}\n`}else{const n=`${l}_normConstant`,o=`${l}_min`;i=`uniform float ${n};\nuniform ${r} ${o};\n${i}`;d=`\nvoid main() {\n ${t} = ${o} + ${c}${u?".xyz":""} * ${n};\n ${e}();\n}\n`}i=ShaderSource.replaceMain(i,e),i+=d}}return{shader:i}},ModelUtility.modifyShaderForQuantizedAttributes=function(e,t,i){const n={},r=t.attributes;for(let o in r)if(r.hasOwnProperty(o)){const r=getAttributeVariableName(e,t,o),a=t.attributes[o];"_"===o.charAt(0)&&(o=o.substring(1));const s=`gltf_u_dec_${o.toLowerCase()}`,c=`${s}_scale`,l=`${s}_translate`;if(!defined(n[s])&&!defined(n[c])){const t=getQuantizedAttributes(e,a);if(defined(t)){const e=t.decodeMatrix,a=`gltf_decoded_${o}`,u=r.replace("a_","gltf_a_dec_"),d=Math.floor(Math.sqrt(e.length));let h;i=replaceAllButFirstInString(i,r,u),h=d>2?"vec"+(d-1):"float",i=`${h} ${u};\n${i}`;let p="";5===d?(i=`uniform vec4 ${l};\n${i=`uniform mat4 ${c};\n${i}`}`,p=`\nvoid main() {\n ${u} = ${c} * ${r} + ${l};\n ${a}();\n}\n`,n[c]={mat:4},n[l]={vec:4}):(i=`uniform mat${d} ${s};\n${i}`,p=`\nvoid main() {\n ${u} = ${h}(${s} * vec${d}(${r},1.0));\n ${a}();\n}\n`,n[s]={mat:d}),i=ShaderSource.replaceMain(i,a),i+=p}}}return{shader:i,uniforms:n}},Object.defineProperties(DelayLoadedTextureUniform.prototype,{value:{get:function(){if(!defined(this._value)){const e=this._textures[this._textureId];if(!defined(e))return this._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),DelayLoadedTextureUniform.prototype.clone=function(e){return e},DelayLoadedTextureUniform.prototype.func=void 0;const gltfUniformFunctions={};function scaleFromMatrix5Array(e){return[e[0],e[1],e[2],e[3],e[5],e[6],e[7],e[8],e[10],e[11],e[12],e[13],e[15],e[16],e[17],e[18]]}function translateFromMatrix5Array(e){return[e[20],e[21],e[22],e[23]]}gltfUniformFunctions[WebGLConstants$1.FLOAT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT2]=getMat2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT3]=getMat3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT4]=getMat4UniformFunction,gltfUniformFunctions[WebGLConstants$1.SAMPLER_2D]=getTextureUniformFunction,ModelUtility.createUniformFunction=function(e,t,i,n){return gltfUniformFunctions[e](t,i,n)},ModelUtility.createUniformsForDracoQuantizedAttributes=function(e){const t={};for(let i in e)if(e.hasOwnProperty(i)){const n=e[i],r=n.quantization;if(!defined(r))continue;"_"===i.charAt(0)&&(i=i.substring(1));const o=`gltf_u_dec_${i.toLowerCase()}`;if(r.octEncoded){const e=`${o}_rangeConstant`,i=(1<<r.quantizationBits)-1;t[e]=getScalarUniformFunction(i).func;continue}const a=`${o}_normConstant`,s=r.range/(1<<r.quantizationBits);t[a]=getScalarUniformFunction(s).func;const c=`${o}_min`;switch(n.componentsPerAttribute){case 1:t[c]=getScalarUniformFunction(r.minValues).func;break;case 2:t[c]=getVec2UniformFunction(r.minValues).func;break;case 3:t[c]=getVec3UniformFunction(r.minValues).func;break;case 4:t[c]=getVec4UniformFunction(r.minValues).func}}return t},ModelUtility.createUniformsForQuantizedAttributes=function(e,t,i){const n=e.accessors,r={},o={},a=t.attributes;for(let e in a)if(a.hasOwnProperty(e)){const t=n[a[e]],i=t.extensions;if("_"===e.charAt(0)&&(e=e.substring(1)),defined(i)){const n=i.WEB3D_quantized_attributes;if(defined(n)){const i=n.decodeMatrix,a=`gltf_u_dec_${e.toLowerCase()}`;let s,c;switch(t.type){case AttributeType$1.SCALAR:o[a]=getMat2UniformFunction(i).func,r[a]=!0;break;case AttributeType$1.VEC2:o[a]=getMat3UniformFunction(i).func,r[a]=!0;break;case AttributeType$1.VEC3:o[a]=getMat4UniformFunction(i).func,r[a]=!0;break;case AttributeType$1.VEC4:s=`${a}_scale`,c=`${a}_translate`,o[s]=getMat4UniformFunction(scaleFromMatrix5Array(i)).func,o[c]=getVec4UniformFunction(translateFromMatrix5Array(i)).func,r[s]=!0,r[c]=!0}}}}for(const e in i)if(i.hasOwnProperty(e)&&!r[e]){const t=i[e];defined(t.mat)&&(2===t.mat?o[e]=getMat2UniformFunction(Matrix2.IDENTITY).func:3===t.mat?o[e]=getMat3UniformFunction(Matrix3.IDENTITY).func:4===t.mat&&(o[e]=getMat4UniformFunction(Matrix4.IDENTITY).func)),defined(t.vec)&&4===t.vec&&(o[e]=getVec4UniformFunction([0,0,0,0]).func)}return o};const scratchTranslationRtc=new Cartesian3,gltfSemanticUniforms$1={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){const i=new Matrix4;return function(){return defined(t._rtcCenter)?(Matrix4.getTranslation(e.model,scratchTranslationRtc),Cartesian3.add(scratchTranslationRtc,t._rtcCenter,scratchTranslationRtc),Matrix4.multiplyByPoint(e.view,scratchTranslationRtc,scratchTranslationRtc),Matrix4.setTranslation(e.modelView,scratchTranslationRtc,i)):e.modelView}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e,t){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e,t){return function(){return e.inverseTransposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};function processModelMaterialsCommon(e,t){if(t=defaultValue(t,defaultValue.EMPTY_OBJECT),!defined(e))return;if(!usesExtension(e,"KHR_materials_common"))return;usesExtension(e,"KHR_techniques_webgl")||(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},e.extensionsUsed.push("KHR_techniques_webgl"),e.extensionsRequired.push("KHR_techniques_webgl"));const i=e.extensions.KHR_techniques_webgl;lightDefaults(e);const n=generateLightParameters(e),r=ModelUtility.splitIncompatibleMaterials(e),o={};let a=!1;return ForEach.material(e,(function(s,c){if(defined(s.extensions)&&defined(s.extensions.KHR_materials_common)){const l=s.extensions.KHR_materials_common,u=r[c],d=getTechniqueKey(l,u);let h=o[d];defined(h)||(h=generateTechnique$1(e,i,u,l,n,t.addBatchIdToGeneratedShaders),o[d]=h,a=!0);const p={},f=l.values;let m;for(const e in f)f.hasOwnProperty(e)&&"transparent"!==e&&"doubleSided"!==e&&(m=`u_${e.toLowerCase()}`,p[m]=f[e]);s.extensions.KHR_techniques_webgl={technique:h,values:p},s.alphaMode="OPAQUE",l.transparent&&(s.alphaMode="BLEND"),l.doubleSided&&(s.doubleSided=!0)}})),a?(ModelUtility.ensureSemanticExistence(e),e):e}function generateLightParameters(e){const t={};let i;if(defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(i=e.extensions.KHR_materials_common.lights),defined(i)){const n=e.nodes;for(const e in n)if(n.hasOwnProperty(e)){const t=n[e];if(defined(t.extensions)&&defined(t.extensions.KHR_materials_common)){const n=t.extensions.KHR_materials_common.light;defined(n)&&defined(i[n])&&(i[n].node=e),delete t.extensions.KHR_materials_common}}let r=0;for(const e in i)if(i.hasOwnProperty(e)){const n=i[e],o=n.type;if("ambient"!==o&&!defined(n.node)){delete i[e];continue}const a=`light${r.toString()}`;let s,c,l,u;switch(n.baseName=a,o){case"ambient":s=n.ambient,t[`${a}Color`]={type:WebGLConstants$1.FLOAT_VEC3,value:s.color};break;case"directional":c=n.directional,t[`${a}Color`]={type:WebGLConstants$1.FLOAT_VEC3,value:c.color},defined(n.node)&&(t[`${a}Transform`]={node:n.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4});break;case"point":l=n.point,t[`${a}Color`]={type:WebGLConstants$1.FLOAT_VEC3,value:l.color},defined(n.node)&&(t[`${a}Transform`]={node:n.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4}),t[`${a}Attenuation`]={type:WebGLConstants$1.FLOAT_VEC3,value:[l.constantAttenuation,l.linearAttenuation,l.quadraticAttenuation]};break;case"spot":u=n.spot,t[`${a}Color`]={type:WebGLConstants$1.FLOAT_VEC3,value:u.color},defined(n.node)&&(t[`${a}Transform`]={node:n.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},t[`${a}InverseTransform`]={node:n.node,semantic:"MODELVIEWINVERSE",type:WebGLConstants$1.FLOAT_MAT4,useInFragment:!0}),t[`${a}Attenuation`]={type:WebGLConstants$1.FLOAT_VEC3,value:[u.constantAttenuation,u.linearAttenuation,u.quadraticAttenuation]},t[`${a}FallOff`]={type:WebGLConstants$1.FLOAT_VEC2,value:[u.fallOffAngle,u.fallOffExponent]}}++r}}return t}function generateTechnique$1(e,t,i,n,r,o){defined(n)||(n={}),o=defaultValue(o,!1);const a=t.techniques,s=t.shaders,c=t.programs,l=n.technique.toUpperCase();let u;defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(u=e.extensions.KHR_materials_common.lights);const d=n.values,h=defaultValue(n.jointCount,0);let p,f=!1,m=!1;defined(i)&&(p=i.skinning,f=p.skinned,m=i.hasVertexColors);let g="precision highp float;\n",_="precision highp float;\n";const y="CONSTANT"!==l,C={u_modelViewMatrix:{semantic:usesExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};let T;y&&(C.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),f&&(C.u_jointMatrix={count:h,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4});let S=!1;for(const e in d)if(d.hasOwnProperty(e)&&"transparent"!==e&&"doubleSided"!==e){const t=getKHRMaterialsCommonValueType(e,d[e]);T=`u_${e.toLowerCase()}`,S||t!==WebGLConstants$1.SAMPLER_2D||(S=!0),C[T]={type:t}}if(defined(C.u_diffuse)&&(C.u_diffuse.semantic="_3DTILESDIFFUSE"),defined(r))for(const e in r)r.hasOwnProperty(e)&&(T=`u_${e}`,C[T]=r[e]);for(T in C)if(C.hasOwnProperty(T)){const e=C[T],t=defined(e.count)?`[${e.count}]`:"";e.type!==WebGLConstants$1.FLOAT_MAT3&&e.type!==WebGLConstants$1.FLOAT_MAT4||e.useInFragment?(_+=`uniform ${webGLConstantToGlslType(e.type)} ${T}${t};\n`,delete e.useInFragment):g+=`uniform ${webGLConstantToGlslType(e.type)} ${T}${t};\n`}let v="";f&&(v+=" mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n");const A={a_position:{semantic:"POSITION"}};let E;g+="attribute vec3 a_position;\n",g+="varying vec3 v_positionEC;\n",v+=f?" vec4 pos = u_modelViewMatrix * skinMatrix * vec4(a_position,1.0);\n":" vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",v+=" v_positionEC = pos.xyz;\n",v+=" gl_Position = u_projectionMatrix * pos;\n",_+="varying vec3 v_positionEC;\n",y&&(A.a_normal={semantic:"NORMAL"},g+="attribute vec3 a_normal;\n",g+="varying vec3 v_normal;\n",v+=f?" v_normal = u_normalMatrix * mat3(skinMatrix) * a_normal;\n":" v_normal = u_normalMatrix * a_normal;\n",_+="varying vec3 v_normal;\n"),S&&(A.a_texcoord_0={semantic:"TEXCOORD_0"},E="v_texcoord_0",g+="attribute vec2 a_texcoord_0;\n",g+=`varying vec2 ${E};\n`,v+=` ${E} = a_texcoord_0;\n`,_+=`varying vec2 ${E};\n`),f&&(A.a_joint={semantic:"JOINTS_0"},A.a_weight={semantic:"WEIGHTS_0"},g+="attribute vec4 a_joint;\n",g+="attribute vec4 a_weight;\n"),m&&(A.a_vertexColor={semantic:"COLOR_0"},g+="attribute vec4 a_vertexColor;\n",g+="varying vec4 v_vertexColor;\n",v+=" v_vertexColor = a_vertexColor;\n",_+="varying vec4 v_vertexColor;\n"),o&&(A.a_batchId={semantic:"_BATCHID"},g+="attribute float a_batchId;\n");const b=y&&("BLINN"===l||"PHONG"===l)&&defined(C.u_specular)&&defined(C.u_shininess)&&C.u_shininess>0;let x=!1,P=!1,D="";for(const e in u)if(u.hasOwnProperty(e)){const t=u[e],i=t.type.toLowerCase(),n=t.baseName;D+=" {\n";const r=`u_${n}Color`;if("ambient"===i)P=!0,D+=` ambientLight += ${r};\n`;else if(y){x=!0;const e=`v_${n}Direction`,t=`v_${n}Position`;"point"!==i&&(g+=`varying vec3 ${e};\n`,_+=`varying vec3 ${e};\n`,v+=` ${e} = mat3(u_${n}Transform) * vec3(0.,0.,1.);\n`,"directional"===i&&(D+=` vec3 l = normalize(${e});\n`)),"directional"!==i?(g+=`varying vec3 ${t};\n`,_+=`varying vec3 ${t};\n`,v+=` ${t} = u_${n}Transform[3].xyz;\n`,D+=` vec3 VP = ${t} - v_positionEC;\n`,D+=" vec3 l = normalize(VP);\n",D+=" float range = length(VP);\n",D+=` float attenuation = 1.0 / (u_${n}Attenuation.x + `,D+=`(u_${n}Attenuation.y * range) + `,D+=`(u_${n}Attenuation.z * range * range));\n`):D+=" float attenuation = 1.0;\n","spot"===i&&(D+=` float spotDot = dot(l, normalize(${e}));\n`,D+=` if (spotDot < cos(u_${n}FallOff.x * 0.5))\n`,D+=" {\n",D+=" attenuation = 0.0;\n",D+=" }\n",D+=" else\n",D+=" {\n",D+=` attenuation *= max(0.0, pow(spotDot, u_${n}FallOff.y));\n`,D+=" }\n"),D+=` diffuseLight += ${r}* max(dot(normal,l), 0.) * attenuation;\n`,b&&("BLINN"===l?(D+=" vec3 h = normalize(l + viewDir);\n",D+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(D+=" vec3 reflectDir = reflect(-l, normal);\n",D+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),D+=` specularLight += ${r} * specularIntensity;\n`)}D+=" }\n"}if(P||(D+=" ambientLight += vec3(0.2, 0.2, 0.2);\n"),!x&&"CONSTANT"!==l){_+="#ifdef USE_CUSTOM_LIGHT_COLOR \n",_+="uniform vec3 gltf_lightColor; \n",_+="#endif \n",D+="#ifndef USE_CUSTOM_LIGHT_COLOR \n",D+=" vec3 lightColor = czm_lightColor;\n",D+="#else \n",D+=" vec3 lightColor = gltf_lightColor;\n",D+="#endif \n",D+=" vec3 l = normalize(czm_lightDirectionEC);\n";D+=` diffuseLight += lightColor * max(dot(normal,l), ${"0.2"});\n`,b&&("BLINN"===l?(D+=" vec3 h = normalize(l + viewDir);\n",D+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(D+=" vec3 reflectDir = reflect(-l, normal);\n",D+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),D+=" specularLight += lightColor * specularIntensity;\n")}g+="void main(void) {\n",g+=v,g+="}\n",_+="void main(void) {\n";let w,M=" vec3 color = vec3(0.0, 0.0, 0.0);\n";y&&(_+=" vec3 normal = normalize(v_normal);\n",n.doubleSided&&(_+=" if (czm_backFacing())\n",_+=" {\n",_+=" normal = -normal;\n",_+=" }\n")),"CONSTANT"!==l?(defined(C.u_diffuse)&&(C.u_diffuse.type===WebGLConstants$1.SAMPLER_2D?_+=` vec4 diffuse = texture2D(u_diffuse, ${E});\n`:_+=" vec4 diffuse = u_diffuse;\n",_+=" vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",M+=" color += diffuse.rgb * diffuseLight;\n"),b&&(C.u_specular.type===WebGLConstants$1.SAMPLER_2D?_+=` vec3 specular = texture2D(u_specular, ${E}).rgb;\n`:_+=" vec3 specular = u_specular.rgb;\n",_+=" vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",M+=" color += specular * specularLight;\n"),w=defined(C.u_transparency)?" gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);\n":" gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):w=defined(C.u_transparency)?" gl_FragColor = vec4(color * u_transparency, u_transparency);\n":" gl_FragColor = vec4(color, 1.0);\n",m&&(M+=" color *= v_vertexColor.rgb;\n"),defined(C.u_emission)&&(C.u_emission.type===WebGLConstants$1.SAMPLER_2D?_+=` vec3 emission = texture2D(u_emission, ${E}).rgb;\n`:_+=" vec3 emission = u_emission.rgb;\n",M+=" color += emission;\n"),(defined(C.u_ambient)||"CONSTANT"!==l)&&(defined(C.u_ambient)?C.u_ambient.type===WebGLConstants$1.SAMPLER_2D?_+=` vec3 ambient = texture2D(u_ambient, ${E}).rgb;\n`:_+=" vec3 ambient = u_ambient.rgb;\n":_+=" vec3 ambient = diffuse.rgb;\n",M+=" color += ambient * ambientLight;\n"),_+=" vec3 viewDir = -normalize(v_positionEC);\n",_+=" vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",_+=D,_+=M,_+=w,_+="}\n";const I=addToArray(s,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:g,extension:".glsl"}}}),R=addToArray(s,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:_,extension:".glsl"}}}),O=addToArray(c,{fragmentShader:R,vertexShader:I});return addToArray(a,{attributes:A,program:O,uniforms:C})}function getKHRMaterialsCommonValueType(e,t){let i;switch(i=defined(t.value)?t.value:defined(t.index)?[t.index]:t,e){case"ambient":case"diffuse":case"emission":case"specular":return 1===i.length?WebGLConstants$1.SAMPLER_2D:WebGLConstants$1.FLOAT_VEC4;case"shininess":case"transparency":return WebGLConstants$1.FLOAT;case"transparent":case"doubleSided":return WebGLConstants$1.BOOL}}function getTechniqueKey(e,t){let i="";i+=`technique:${e.technique};`;const n=e.values,r=Object.keys(n).sort(),o=r.length;for(let e=0;e<o;++e){const t=r[e];n.hasOwnProperty(t)&&(i+=`${t}:${getKHRMaterialsCommonValueType(t,n[t])}`,i+=";")}const a=defaultValue(e.jointCount,0);if(i+=`${a.toString()};`,defined(t)){const e=t.skinning;a>0&&(i+=`${e.type};`),i+=t.hasVertexColors}return i}function lightDefaults(e){const t=e.extensions.KHR_materials_common;if(!defined(t)||!defined(t.lights))return;const i=t.lights,n=i.length;for(let e=0;e<n;e++){const t=i[e];if("ambient"===t.type){defined(t.ambient)||(t.ambient={});const e=t.ambient;defined(e.color)||(e.color=[1,1,1])}else if("directional"===t.type){defined(t.directional)||(t.directional={});const e=t.directional;defined(e.color)||(e.color=[1,1,1])}else if("point"===t.type){defined(t.point)||(t.point={});const e=t.point;defined(e.color)||(e.color=[1,1,1]),e.constantAttenuation=defaultValue(e.constantAttenuation,1),e.linearAttenuation=defaultValue(e.linearAttenuation,0),e.quadraticAttenuation=defaultValue(e.quadraticAttenuation,0)}else if("spot"===t.type){defined(t.spot)||(t.spot={});const e=t.spot;defined(e.color)||(e.color=[1,1,1]),e.constantAttenuation=defaultValue(e.constantAttenuation,1),e.fallOffAngle=defaultValue(e.fallOffAngle,3.14159265),e.fallOffExponent=defaultValue(e.fallOffExponent,0),e.linearAttenuation=defaultValue(e.linearAttenuation,0),e.quadraticAttenuation=defaultValue(e.quadraticAttenuation,0)}}}function processPbrMaterials(e,t){if(t=defaultValue(t,defaultValue.EMPTY_OBJECT),usesExtension(e,"KHR_techniques_webgl"))return e;if(!defined(e.materials)||0===e.materials.length)return e;defined(e.extensions)||(e.extensions={}),defined(e.extensionsUsed)||(e.extensionsUsed=[]),defined(e.extensionsRequired)||(e.extensionsRequired=[]),e.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},e.extensionsUsed.push("KHR_techniques_webgl"),e.extensionsRequired.push("KHR_techniques_webgl");const i=ModelUtility.splitIncompatibleMaterials(e);return ForEach.material(e,(function(n,r){const o={},a=generateTechnique(e,n,r,o,i,t);defined(n.extensions)||(n.extensions={}),n.extensions.KHR_techniques_webgl={values:o,technique:a}})),ModelUtility.ensureSemanticExistence(e),e}function isSpecularGlossinessMaterial(e){return defined(e.extensions)&&defined(e.extensions.KHR_materials_pbrSpecularGlossiness)}function addTextureCoordinates(e,t,i,n,r){let o;const a=i[t];return defined(a)&&defined(a.texCoord)&&1===a.texCoord&&(n=n.replace("0","1")),defined(i[`${t}Offset`])?(o=`${t}Coord`,r.fragmentShaderMain+=` vec2 ${o} = computeTexCoord(${n}, ${t}Offset, ${t}Rotation, ${t}Scale);\n`):o=n,o}ModelUtility.getGltfSemanticUniforms=function(){return gltfSemanticUniforms$1};const DEFAULT_TEXTURE_OFFSET=[0,0],DEFAULT_TEXTURE_ROTATION=[0],DEFAULT_TEXTURE_SCALE=[1,1];function handleKHRTextureTransform(e,t,i){if(-1===e.indexOf("Texture")||!defined(t.extensions)||!defined(t.extensions.KHR_texture_transform))return;const n=`u_${e}`,r=t.extensions.KHR_texture_transform;i[`${n}Offset`]=defaultValue(r.offset,DEFAULT_TEXTURE_OFFSET),i[`${n}Rotation`]=defaultValue(r.rotation,DEFAULT_TEXTURE_ROTATION),i[`${n}Scale`]=defaultValue(r.scale,DEFAULT_TEXTURE_SCALE),defined(t.texCoord)&&defined(r.texCoord)&&(i[n].texCoord=r.texCoord)}function generateTechnique(e,t,i,n,r,o){const a=defaultValue(o.addBatchIdToGeneratedShaders,!1),s=e.extensions.KHR_techniques_webgl,c=s.techniques,l=s.shaders,u=s.programs,d=isSpecularGlossinessMaterial(t);let h,p,f;const m=t.pbrMetallicRoughness;if(defined(m)&&!d)for(p in m)m.hasOwnProperty(p)&&(f=m[p],h=`u_${p}`,n[h]=f,handleKHRTextureTransform(p,f,n));if(d){const e=t.extensions.KHR_materials_pbrSpecularGlossiness;for(p in e)e.hasOwnProperty(p)&&(f=e[p],h=`u_${p}`,n[h]=f,handleKHRTextureTransform(p,f,n))}for(const e in t)t.hasOwnProperty(e)&&(e.indexOf("Texture")>=0||e.indexOf("Factor")>=0)&&(f=t[e],h=`u_${e}`,n[h]=f,handleKHRTextureTransform(e,f,n));let g,_="precision highp float;\n",y="precision highp float;\n";defined(e.skins)&&(g=e.skins[0]);const C=defined(g)?g.joints:[],T=C.length,S=r[i];let v,A,E=!1,b=!1,x=!1,P=!1,D=!1,w=!1,M=!1,I=!1,R=!1;defined(S)&&(v=S.skinning,E=v.skinned&&C.length>0,b=S.hasVertexColors,x=S.hasMorphTargets,P=S.hasNormals,D=S.hasTangents,w=S.hasTexCoords,M=S.hasTexCoord1,I=S.hasOutline),x&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){if(e.material===i){const t=e.targets;defined(t)&&(A=t)}}))}));const O={u_modelViewMatrix:{semantic:usesExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};defined(t.extensions)&&defined(t.extensions.KHR_materials_unlit)&&(R=!0),P&&(O.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),E&&(O.u_jointMatrix={count:T,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4}),x&&(O.u_morphWeights={count:A.length,semantic:"MORPHWEIGHTS",type:WebGLConstants$1.FLOAT});const B=t.alphaMode;for(h in defined(B)&&"MASK"===B&&(O.u_alphaCutoff={semantic:"ALPHACUTOFF",type:WebGLConstants$1.FLOAT}),n)n.hasOwnProperty(h)&&(O[h]={type:getPBRValueType(h)});const L=defaultValue(O.u_baseColorTexture,O.u_baseColorFactor);for(h in defined(L)&&(L.semantic="_3DTILESDIFFUSE"),O)if(O.hasOwnProperty(h)){const e=O[h],t=defined(e.count)?`[${e.count}]`:"";e.type!==WebGLConstants$1.FLOAT_MAT3&&e.type!==WebGLConstants$1.FLOAT_MAT4&&"u_morphWeights"!==h||e.useInFragment?(y+=`uniform ${webGLConstantToGlslType(e.type)} ${h}${t};\n`,delete e.useInFragment):_+=`uniform ${webGLConstantToGlslType(e.type)} ${h}${t};\n`}I&&(y+="uniform sampler2D u_outlineTexture;\n");let F="";E&&(F+=" mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n");const N={a_position:{semantic:"POSITION"}};if(I&&(N.a_outlineCoordinates={semantic:"_OUTLINE_COORDINATES"}),_+="attribute vec3 a_position;\n",P&&(_+="varying vec3 v_positionEC;\n"),I&&(_+="attribute vec3 a_outlineCoordinates;\n",_+="varying vec3 v_outlineCoordinates;\n"),F+=" vec3 weightedPosition = a_position;\n",P&&(F+=" vec3 weightedNormal = a_normal;\n"),D&&(F+=" vec4 weightedTangent = a_tangent;\n"),x)for(let e=0;e<A.length;e++){const t=A[e];for(const i in t)if(t.hasOwnProperty(i)&&"extras"!==i){const t=`a_${i}_${e}`;N[t]={semantic:`${i}_${e}`},_+=`attribute vec3 ${t};\n`,"POSITION"===i?F+=` weightedPosition += u_morphWeights[${e}] * ${t};\n`:"NORMAL"===i?F+=` weightedNormal += u_morphWeights[${e}] * ${t};\n`:D&&"TANGENT"===i&&(F+=` weightedTangent.xyz += u_morphWeights[${e}] * ${t};\n`)}}F+=E?" vec4 position = skinMatrix * vec4(weightedPosition, 1.0);\n":" vec4 position = vec4(weightedPosition, 1.0);\n",F+=" position = u_modelViewMatrix * position;\n",P&&(F+=" v_positionEC = position.xyz;\n"),F+=" gl_Position = u_projectionMatrix * position;\n",I&&(F+=" v_outlineCoordinates = a_outlineCoordinates;\n"),P&&(N.a_normal={semantic:"NORMAL"},_+="attribute vec3 a_normal;\n",R||(_+="varying vec3 v_normal;\n",F+=E?" v_normal = u_normalMatrix * mat3(skinMatrix) * weightedNormal;\n":" v_normal = u_normalMatrix * weightedNormal;\n",y+="varying vec3 v_normal;\n"),y+="varying vec3 v_positionEC;\n"),D&&(N.a_tangent={semantic:"TANGENT"},_+="attribute vec4 a_tangent;\n",_+="varying vec4 v_tangent;\n",F+=" v_tangent.xyz = u_normalMatrix * weightedTangent.xyz;\n",F+=" v_tangent.w = weightedTangent.w;\n",y+="varying vec4 v_tangent;\n"),I&&(y+="varying vec3 v_outlineCoordinates;\n");let V,$,k,U,G,z,H,W,q="";if(w){if(N.a_texcoord_0={semantic:"TEXCOORD_0"},V="v_texcoord_0",_+="attribute vec2 a_texcoord_0;\n",_+="varying vec2 v_texcoord_0;\n",F+=" v_texcoord_0 = a_texcoord_0;\n",y+="varying vec2 v_texcoord_0;\n",M){N.a_texcoord_1={semantic:"TEXCOORD_1"};const e=V.replace("0","1");_+="attribute vec2 a_texcoord_1;\n",_+=`varying vec2 ${e};\n`,F+=` ${e} = a_texcoord_1;\n`,y+=`varying vec2 ${e};\n`}const t={fragmentShaderMain:q};$=addTextureCoordinates(e,"u_normalTexture",n,V,t),k=addTextureCoordinates(e,"u_baseColorTexture",n,V,t),U=addTextureCoordinates(e,"u_specularGlossinessTexture",n,V,t),G=addTextureCoordinates(e,"u_diffuseTexture",n,V,t),z=addTextureCoordinates(e,"u_metallicRoughnessTexture",n,V,t),H=addTextureCoordinates(e,"u_occlusionTexture",n,V,t),W=addTextureCoordinates(e,"u_emissiveTexture",n,V,t),q=t.fragmentShaderMain}E&&(N.a_joint={semantic:"JOINTS_0"},N.a_weight={semantic:"WEIGHTS_0"},_+="attribute vec4 a_joint;\n",_+="attribute vec4 a_weight;\n"),b&&(N.a_vertexColor={semantic:"COLOR_0"},_+="attribute vec4 a_vertexColor;\n",_+="varying vec4 v_vertexColor;\n",F+=" v_vertexColor = a_vertexColor;\n",y+="varying vec4 v_vertexColor;\n"),a&&(N.a_batchId={semantic:"_BATCHID"},_+="attribute float a_batchId;\n"),_+="void main(void) \n{\n",_+=F,_+="}\n",P&&!R&&(y+="const float M_PI = 3.141592653589793;\n",y+="vec3 lambertianDiffuse(vec3 diffuseColor) \n{\n return diffuseColor / M_PI;\n}\n\n",y+="vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH) \n{\n return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\n\n",y+="vec3 fresnelSchlick(float metalness, float VdotH) \n{\n return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);\n}\n\n",y+="float smithVisibilityG1(float NdotV, float roughness) \n{\n float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\n",y+="float smithVisibilityGGX(float roughness, float NdotL, float NdotV) \n{\n return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);\n}\n\n",y+="float GGX(float roughness, float NdotH) \n{\n float roughnessSquared = roughness * roughness;\n float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n return roughnessSquared / (M_PI * f * f);\n}\n\n"),y+="vec3 SRGBtoLINEAR3(vec3 srgbIn) \n{\n return pow(srgbIn, vec3(2.2));\n}\n\n",y+="vec4 SRGBtoLINEAR4(vec4 srgbIn) \n{\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n return vec4(linearOut, srgbIn.a);\n}\n\n",y+="vec3 applyTonemapping(vec3 linearIn) \n{\n#ifndef HDR \n return czm_acesTonemapping(linearIn);\n#else \n return linearIn;\n#endif \n}\n\n",y+="vec3 LINEARtoSRGB(vec3 linearIn) \n{\n#ifndef HDR \n return pow(linearIn, vec3(1.0/2.2));\n#else \n return linearIn;\n#endif \n}\n\n",y+="vec2 computeTexCoord(vec2 texCoords, vec2 offset, float rotation, vec2 scale) \n{\n rotation = -rotation; \n mat3 transform = mat3(\n cos(rotation) * scale.x, sin(rotation) * scale.x, 0.0, \n -sin(rotation) * scale.y, cos(rotation) * scale.y, 0.0, \n offset.x, offset.y, 1.0); \n vec2 transformedTexCoords = (transform * vec3(fract(texCoords), 1.0)).xy; \n return transformedTexCoords; \n}\n\n",y+="#ifdef USE_IBL_LIGHTING \n",y+="uniform vec2 gltf_iblFactor; \n",y+="#endif \n",y+="#ifdef USE_CUSTOM_LIGHT_COLOR \n",y+="uniform vec3 gltf_lightColor; \n",y+="#endif \n",y+="void main(void) \n{\n",y+=q,P&&!R&&(y+=" vec3 ng = normalize(v_normal);\n",y+=" vec3 positionWC = vec3(czm_inverseView * vec4(v_positionEC, 1.0));\n",defined(n.u_normalTexture)?D?(y+=" vec3 t = normalize(v_tangent.xyz);\n",y+=" vec3 b = normalize(cross(ng, t) * v_tangent.w);\n",y+=" mat3 tbn = mat3(t, b, ng);\n",y+=` vec3 n = texture2D(u_normalTexture, ${$}).rgb;\n`,y+=" n = normalize(tbn * (2.0 * n - 1.0));\n"):(y=`#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n${y}`,y+="#ifdef GL_OES_standard_derivatives\n",y+=" vec3 pos_dx = dFdx(v_positionEC);\n",y+=" vec3 pos_dy = dFdy(v_positionEC);\n",y+=` vec3 tex_dx = dFdx(vec3(${$},0.0));\n`,y+=` vec3 tex_dy = dFdy(vec3(${$},0.0));\n`,y+=" vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n",y+=" t = normalize(t - ng * dot(ng, t));\n",y+=" vec3 b = normalize(cross(ng, t));\n",y+=" mat3 tbn = mat3(t, b, ng);\n",y+=` vec3 n = texture2D(u_normalTexture, ${$}).rgb;\n`,y+=" n = normalize(tbn * (2.0 * n - 1.0));\n",y+="#else\n",y+=" vec3 n = ng;\n",y+="#endif\n"):y+=" vec3 n = ng;\n",t.doubleSided&&(y+=" if (czm_backFacing())\n",y+=" {\n",y+=" n = -n;\n",y+=" }\n")),defined(n.u_baseColorTexture)?(y+=` vec4 baseColorWithAlpha = SRGBtoLINEAR4(texture2D(u_baseColorTexture, ${k}));\n`,defined(n.u_baseColorFactor)&&(y+=" baseColorWithAlpha *= u_baseColorFactor;\n")):defined(n.u_baseColorFactor)?y+=" vec4 baseColorWithAlpha = u_baseColorFactor;\n":y+=" vec4 baseColorWithAlpha = vec4(1.0);\n",b&&(y+=" baseColorWithAlpha *= v_vertexColor;\n"),y+=" vec3 baseColor = baseColorWithAlpha.rgb;\n",P&&!R?(d?(defined(n.u_specularGlossinessTexture)?(y+=` vec4 specularGlossiness = SRGBtoLINEAR4(texture2D(u_specularGlossinessTexture, ${U}));\n`,y+=" vec3 specular = specularGlossiness.rgb;\n",y+=" float glossiness = specularGlossiness.a;\n",defined(n.u_specularFactor)&&(y+=" specular *= u_specularFactor;\n"),defined(n.u_glossinessFactor)&&(y+=" glossiness *= u_glossinessFactor;\n")):(defined(n.u_specularFactor)?y+=" vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n":y+=" vec3 specular = vec3(1.0);\n",defined(n.u_glossinessFactor)?y+=" float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n":y+=" float glossiness = 1.0;\n"),defined(n.u_diffuseTexture)?(y+=` vec4 diffuse = SRGBtoLINEAR4(texture2D(u_diffuseTexture, ${G}));\n`,defined(n.u_diffuseFactor)&&(y+=" diffuse *= u_diffuseFactor;\n")):defined(n.u_diffuseFactor)?y+=" vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n":y+=" vec4 diffuse = vec4(1.0);\n",y+=" baseColorWithAlpha.a = diffuse.a;\n"):defined(n.u_metallicRoughnessTexture)?(y+=` vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, ${z}).rgb;\n`,y+=" float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n",y+=" float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n",defined(n.u_metallicFactor)&&(y+=" metalness *= u_metallicFactor;\n"),defined(n.u_roughnessFactor)&&(y+=" roughness *= u_roughnessFactor;\n")):(defined(n.u_metallicFactor)?y+=" float metalness = clamp(u_metallicFactor, 0.0, 1.0);\n":y+=" float metalness = 1.0;\n",defined(n.u_roughnessFactor)?y+=" float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n":y+=" float roughness = 1.0;\n"),y+=" vec3 v = -normalize(v_positionEC);\n",y+="#ifndef USE_CUSTOM_LIGHT_COLOR \n",y+=" vec3 lightColorHdr = czm_lightColorHdr;\n",y+="#else \n",y+=" vec3 lightColorHdr = gltf_lightColor;\n",y+="#endif \n",y+=" vec3 l = normalize(czm_lightDirectionEC);\n",y+=" vec3 h = normalize(v + l);\n",y+=" float NdotL = clamp(dot(n, l), 0.001, 1.0);\n",y+=" float NdotV = abs(dot(n, v)) + 0.001;\n",y+=" float NdotH = clamp(dot(n, h), 0.0, 1.0);\n",y+=" float LdotH = clamp(dot(l, h), 0.0, 1.0);\n",y+=" float VdotH = clamp(dot(v, h), 0.0, 1.0);\n",y+=" vec3 f0 = vec3(0.04);\n",d?(y+=" float roughness = 1.0 - glossiness;\n",y+=" vec3 diffuseColor = diffuse.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n",y+=" vec3 specularColor = specular;\n"):(y+=" vec3 diffuseColor = baseColor * (1.0 - metalness) * (1.0 - f0);\n",y+=" vec3 specularColor = mix(f0, baseColor, metalness);\n"),y+=" float alpha = roughness * roughness;\n",y+=" float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n",y+=" vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n",y+=" vec3 r0 = specularColor.rgb;\n",y+=" vec3 F = fresnelSchlick2(r0, r90, VdotH);\n",y+=" float G = smithVisibilityGGX(alpha, NdotL, NdotV);\n",y+=" float D = GGX(alpha, NdotH);\n",y+=" vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\n",y+=" vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\n",y+=" vec3 color = NdotL * lightColorHdr * (diffuseContribution + specularContribution);\n",y+="#if defined(USE_IBL_LIGHTING) && !defined(DIFFUSE_IBL) && !defined(SPECULAR_IBL) \n",y+=" vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\n",y+=" float vertexRadius = length(positionWC);\n",y+=" float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\n",y+=" float reflectionDotNadir = dot(r, normalize(positionWC));\n",y+=" r.x = -r.x;\n",y+=" r = -normalize(czm_temeToPseudoFixed * r);\n",y+=" r.x = -r.x;\n",y+=" float inverseRoughness = 1.04 - roughness;\n",y+=" inverseRoughness *= inverseRoughness;\n",y+=" vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;\n",y+=" float atmosphereHeight = 0.05;\n",y+=" float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\n",y+=" float blendRegionOffset = roughness * -1.0;\n",y+=" float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n",y+=" float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n",y+=" float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n",y+=" float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n",y+=" vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n",y+=" vec3 nadirColor = belowHorizonColor * 0.5;\n",y+=" vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n",y+=" vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\n",y+=" vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\n",y+=" vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);\n",y+=" float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;\n",y+=" float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\n",y+=" vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n",y+=" float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\n",y+=" vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\n",y+=" specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\n",y+=" specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n",y+="#ifdef USE_SUN_LUMINANCE \n",y+=" float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), normalize(positionWC * -1.0)), 0.001, 1.0);\n",y+=" float S = acos(LdotZenith);\n",y+=" float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), normalize(positionWC * -1.0)), 0.001, 1.0);\n",y+=" float gamma = acos(NdotL);\n",y+=" float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n",y+=" float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n",y+=" float luminance = gltf_luminanceAtZenith * (numerator / denominator);\n",y+="#endif \n",y+=" vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",y+=" vec3 IBLColor = (diffuseIrradiance * diffuseColor * gltf_iblFactor.x) + (specularIrradiance * SRGBtoLINEAR3(specularColor * brdfLut.x + brdfLut.y) * gltf_iblFactor.y);\n",y+=" float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);\n",y+=" vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);\n",y+=" IBLColor *= lightColor;\n",y+="#ifdef USE_SUN_LUMINANCE \n",y+=" color += IBLColor * luminance;\n",y+="#else \n",y+=" color += IBLColor; \n",y+="#endif \n",y+="#elif defined(DIFFUSE_IBL) || defined(SPECULAR_IBL) \n",y+=" const mat3 yUpToZUp = mat3(-1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0); \n",y+=" vec3 cubeDir = normalize(yUpToZUp * gltf_iblReferenceFrameMatrix * normalize(reflect(-v, n))); \n",y+="#ifdef DIFFUSE_IBL \n",y+="#ifdef CUSTOM_SPHERICAL_HARMONICS \n",y+=" vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, gltf_sphericalHarmonicCoefficients); \n",y+="#else \n",y+=" vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n",y+="#endif \n",y+="#else \n",y+=" vec3 diffuseIrradiance = vec3(0.0); \n",y+="#endif \n",y+="#ifdef SPECULAR_IBL \n",y+=" vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",y+="#ifdef CUSTOM_SPECULAR_IBL \n",y+=" vec3 specularIBL = czm_sampleOctahedralProjection(gltf_specularMap, gltf_specularMapSize, cubeDir, roughness * gltf_maxSpecularLOD, gltf_maxSpecularLOD);\n",y+="#else \n",y+=" vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n",y+="#endif \n",y+=" specularIBL *= F * brdfLut.x + brdfLut.y;\n",y+="#else \n",y+=" vec3 specularIBL = vec3(0.0); \n",y+="#endif \n",y+=" color += diffuseIrradiance * diffuseColor + specularColor * specularIBL;\n",y+="#endif \n"):y+=" vec3 color = baseColor;\n",R||(defined(n.u_occlusionTexture)&&(y+=` color *= texture2D(u_occlusionTexture, ${H}).r;\n`),defined(n.u_emissiveTexture)?(y+=` vec3 emissive = SRGBtoLINEAR3(texture2D(u_emissiveTexture, ${W}).rgb);\n`,defined(n.u_emissiveFactor)&&(y+=" emissive *= u_emissiveFactor;\n"),y+=" color += emissive;\n"):defined(n.u_emissiveFactor)&&(y+=" color += u_emissiveFactor;\n")),R||(y+=" color = applyTonemapping(color);\n"),y+=" color = LINEARtoSRGB(color);\n",I&&(y+=" float outlineness = max(\n",y+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r,\n",y+=" max(\n",y+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r,\n",y+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r));\n",y+=" color = mix(color, vec3(0.0, 0.0, 0.0), outlineness);\n"),defined(B)?"MASK"===B?(y+=" if (baseColorWithAlpha.a < u_alphaCutoff) {\n",y+=" discard;\n",y+=" }\n",y+=" gl_FragColor = vec4(color, 1.0);\n"):y+="BLEND"===B?" gl_FragColor = vec4(color, baseColorWithAlpha.a);\n":" gl_FragColor = vec4(color, 1.0);\n":y+=" gl_FragColor = vec4(color, 1.0);\n",y+="}\n";const j=addToArray(l,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:_,extension:".glsl"}}}),X=addToArray(l,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:y,extension:".glsl"}}}),Y=addToArray(u,{fragmentShader:X,vertexShader:j});return addToArray(c,{attributes:N,program:Y,uniforms:O})}function getPBRValueType(e){if(-1!==e.indexOf("Offset"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Rotation"))return WebGLConstants$1.FLOAT;if(-1!==e.indexOf("Scale"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Texture"))return WebGLConstants$1.SAMPLER_2D;switch(e){case"u_baseColorFactor":case"u_diffuseFactor":return WebGLConstants$1.FLOAT_VEC4;case"u_metallicFactor":case"u_roughnessFactor":case"u_glossinessFactor":return WebGLConstants$1.FLOAT;case"u_emissiveFactor":case"u_specularFactor":return WebGLConstants$1.FLOAT_VEC3}}function Vector3DTileBatch(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var VectorTileVS="attribute vec3 position;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelViewProjection;\nvoid main()\n{\ngl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));\n}\n",jsep=createCommonjsModule((function(e,t){!function(i){var n="Compound",r="MemberExpression",o="Literal",a=function(e,t){var i=new Error(e+" at character "+t);throw i.index=t,i.description=e,i},s=!0,c={"-":s,"!":s,"~":s,"+":s},l={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},u=function(e){var t,i=0;for(var n in e)(t=n.length)>i&&e.hasOwnProperty(n)&&(i=t);return i},d=u(c),h=u(l),p={true:!0,false:!1,null:null},f=function(e){return l[e]||0},m=function(e,t,i){return{type:"||"===e||"&&"===e?"LogicalExpression":"BinaryExpression",operator:e,left:t,right:i}},g=function(e){return e>=48&&e<=57},_=function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=128&&!l[String.fromCharCode(e)]},y=function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e>=128&&!l[String.fromCharCode(e)]},C=function(e){for(var t,i,s=0,u=e.charAt,C=e.charCodeAt,T=function(t){return u.call(e,t)},S=function(t){return C.call(e,t)},v=e.length,A=function(){for(var e=S(s);32===e||9===e||10===e||13===e;)e=S(++s)},E=function(){var e,t,i=x();return A(),63!==S(s)?i:(s++,(e=E())||a("Expected expression",s),A(),58===S(s)?(s++,(t=E())||a("Expected expression",s),{type:"ConditionalExpression",test:i,consequent:e,alternate:t}):void a("Expected :",s))},b=function(){A();for(var t=e.substr(s,h),i=t.length;i>0;){if(l.hasOwnProperty(t)&&(!_(S(s))||s+t.length<e.length&&!y(S(s+t.length))))return s+=i,t;t=t.substr(0,--i)}return!1},x=function(){var e,t,i,n,r,o,c,l,u;if(o=P(),!(t=b()))return o;for(r={value:t,prec:f(t)},(c=P())||a("Expected expression after "+t,s),n=[o,r,c];(t=b())&&0!==(i=f(t));){for(r={value:t,prec:i},u=t;n.length>2&&i<=n[n.length-2].prec;)c=n.pop(),t=n.pop().value,o=n.pop(),e=m(t,o,c),n.push(e);(e=P())||a("Expected expression after "+u,s),n.push(r,e)}for(e=n[l=n.length-1];l>1;)e=m(n[l-1].value,n[l-2],e),l-=2;return e},P=function(){var t,i,n;if(A(),t=S(s),g(t)||46===t)return D();if(39===t||34===t)return w();if(91===t)return B();for(n=(i=e.substr(s,d)).length;n>0;){if(c.hasOwnProperty(i)&&(!_(S(s))||s+i.length<e.length&&!y(S(s+i.length))))return s+=n,{type:"UnaryExpression",operator:i,argument:P(),prefix:!0};i=i.substr(0,--n)}return!(!_(t)&&40!==t)&&R()},D=function(){for(var e,t,i="";g(S(s));)i+=T(s++);if(46===S(s))for(i+=T(s++);g(S(s));)i+=T(s++);if("e"===(e=T(s))||"E"===e){for(i+=T(s++),"+"!==(e=T(s))&&"-"!==e||(i+=T(s++));g(S(s));)i+=T(s++);g(S(s-1))||a("Expected exponent ("+i+T(s)+")",s)}return t=S(s),_(t)?a("Variable names cannot start with a number ("+i+T(s)+")",s):46===t&&a("Unexpected period",s),{type:o,value:parseFloat(i),raw:i}},w=function(){for(var e,t="",i=T(s++),n=!1;s<v;){if((e=T(s++))===i){n=!0;break}if("\\"===e)switch(e=T(s++)){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=e}else t+=e}return n||a('Unclosed quote after "'+t+'"',s),{type:o,value:t,raw:i+t+i}},M=function(){var t,i=S(s),n=s;for(_(i)?s++:a("Unexpected "+T(s),s);s<v&&(i=S(s),y(i));)s++;return t=e.slice(n,s),p.hasOwnProperty(t)?{type:o,value:p[t],raw:t}:"this"===t?{type:"ThisExpression"}:{type:"Identifier",name:t}},I=function(e){for(var t,i,r=[],o=!1,c=0;s<v;){if(A(),(t=S(s))===e){o=!0,s++,41===e&&c&&c>=r.length&&a("Unexpected token "+String.fromCharCode(e),s);break}if(44===t){if(s++,++c!==r.length)if(41===e)a("Unexpected token ,",s);else if(93===e)for(var l=r.length;l<c;l++)r.push(null)}else(i=E())&&i.type!==n||a("Expected comma",s),r.push(i)}return o||a("Expected "+String.fromCharCode(e),s),r},R=function(){var e,t;for(t=40===(e=S(s))?O():M(),A(),e=S(s);46===e||91===e||40===e;)s++,46===e?(A(),t={type:r,computed:!1,object:t,property:M()}):91===e?(t={type:r,computed:!0,object:t,property:E()},A(),93!==(e=S(s))&&a("Unclosed [",s),s++):40===e&&(t={type:"CallExpression",arguments:I(41),callee:t}),A(),e=S(s);return t},O=function(){s++;var e=E();if(A(),41===S(s))return s++,e;a("Unclosed (",s)},B=function(){return s++,{type:"ArrayExpression",elements:I(93)}},L=[];s<v;)59===(t=S(s))||44===t?s++:(i=E())?L.push(i):s<v&&a('Unexpected "'+T(s)+'"',s);return 1===L.length?L[0]:{type:n,body:L}};C.version="0.3.5",C.toString=function(){return"JavaScript Expression Parser (JSEP) v"+C.version},C.addUnaryOp=function(e){return d=Math.max(e.length,d),c[e]=s,this},C.addBinaryOp=function(e,t){return h=Math.max(e.length,h),l[e]=t,this},C.addLiteral=function(e,t){return p[e]=t,this},C.removeUnaryOp=function(e){return delete c[e],e.length===d&&(d=u(c)),this},C.removeAllUnaryOps=function(){return c={},d=0,this},C.removeBinaryOp=function(e){return delete l[e],e.length===h&&(h=u(l)),this},C.removeAllBinaryOps=function(){return l={},h=0,this},C.removeLiteral=function(e){return delete p[e],this},C.removeAllLiterals=function(){return p={},this},e.exports?t=e.exports=C:t.parse=C}()}));const ExpressionNodeType={VARIABLE:0,UNARY:1,BINARY:2,TERNARY:3,CONDITIONAL:4,MEMBER:5,FUNCTION_CALL:6,ARRAY:7,REGEX:8,VARIABLE_IN_STRING:9,LITERAL_NULL:10,LITERAL_BOOLEAN:11,LITERAL_NUMBER:12,LITERAL_STRING:13,LITERAL_COLOR:14,LITERAL_VECTOR:15,LITERAL_REGEX:16,LITERAL_UNDEFINED:17,BUILTIN_VARIABLE:18};var ExpressionNodeType$1=Object.freeze(ExpressionNodeType);function Expression(e,t){let i;this._expression=e,e=replaceVariables(removeBackslashes(e=replaceDefines(e,t))),jsep.addBinaryOp("=~",0),jsep.addBinaryOp("!~",0);try{i=jsep(e)}catch(e){throw new RuntimeError(e)}this._runtimeAst=createRuntimeAst(this,i)}Object.defineProperties(Expression.prototype,{expression:{get:function(){return this._expression}}});const scratchStorage={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new Cartesian2],cartesian3Array:[new Cartesian3],cartesian4Array:[new Cartesian4],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);const e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new Cartesian2),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new Cartesian3),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new Cartesian4),this.cartesian4Array[this.cartesian4Index++]}};Expression.prototype.evaluate=function(e,t){scratchStorage.reset();const i=this._runtimeAst.evaluate(e);return t instanceof Color&&i instanceof Cartesian4?Color.fromCartesian4(i,t):i instanceof Cartesian2||i instanceof Cartesian3||i instanceof Cartesian4?i.clone(t):i},Expression.prototype.evaluateColor=function(e,t){scratchStorage.reset();const i=this._runtimeAst.evaluate(e);return Color.fromCartesian4(i,t)},Expression.prototype.getShaderFunction=function(e,t,i,n){let r=this.getShaderExpression(t,i);return r=`${n} ${e}\n{\n return ${r};\n}\n`,r},Expression.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)},Expression.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter((function(e,t,i){return i.indexOf(e)===t})),e};const unaryOperators=["!","-","+"],binaryOperators=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],variableRegex=/\${(.*?)}/g,backslashRegex=/\\/g,backslashReplacement="@#%",replacementRegex=/@#%/g,scratchColor$m=new Color,unaryFunctions={abs:getEvaluateUnaryComponentwise(Math.abs),sqrt:getEvaluateUnaryComponentwise(Math.sqrt),cos:getEvaluateUnaryComponentwise(Math.cos),sin:getEvaluateUnaryComponentwise(Math.sin),tan:getEvaluateUnaryComponentwise(Math.tan),acos:getEvaluateUnaryComponentwise(Math.acos),asin:getEvaluateUnaryComponentwise(Math.asin),atan:getEvaluateUnaryComponentwise(Math.atan),radians:getEvaluateUnaryComponentwise(CesiumMath.toRadians),degrees:getEvaluateUnaryComponentwise(CesiumMath.toDegrees),sign:getEvaluateUnaryComponentwise(CesiumMath.sign),floor:getEvaluateUnaryComponentwise(Math.floor),ceil:getEvaluateUnaryComponentwise(Math.ceil),round:getEvaluateUnaryComponentwise(Math.round),exp:getEvaluateUnaryComponentwise(Math.exp),exp2:getEvaluateUnaryComponentwise(exp2),log:getEvaluateUnaryComponentwise(Math.log),log2:getEvaluateUnaryComponentwise(log2),fract:getEvaluateUnaryComponentwise(fract),length:length,normalize:normalize},binaryFunctions={atan2:getEvaluateBinaryComponentwise(Math.atan2,!1),pow:getEvaluateBinaryComponentwise(Math.pow,!1),min:getEvaluateBinaryComponentwise(Math.min,!0),max:getEvaluateBinaryComponentwise(Math.max,!0),distance:distance,dot:dot,cross:cross},ternaryFunctions={clamp:getEvaluateTernaryComponentwise(CesiumMath.clamp,!0),mix:getEvaluateTernaryComponentwise(CesiumMath.lerp,!0)};function fract(e){return e-Math.floor(e)}function exp2(e){return Math.pow(2,e)}function log2(e){return CesiumMath.log2(e)}function getEvaluateUnaryComponentwise(e){return function(t,i){if("number"==typeof i)return e(i);if(i instanceof Cartesian2)return Cartesian2.fromElements(e(i.x),e(i.y),scratchStorage.getCartesian2());if(i instanceof Cartesian3)return Cartesian3.fromElements(e(i.x),e(i.y),e(i.z),scratchStorage.getCartesian3());if(i instanceof Cartesian4)return Cartesian4.fromElements(e(i.x),e(i.y),e(i.z),e(i.w),scratchStorage.getCartesian4());throw new RuntimeError(`Function "${t}" requires a vector or number argument. Argument is ${i}.`)}}function getEvaluateBinaryComponentwise(e,t){return function(i,n,r){if(t&&"number"==typeof r){if("number"==typeof n)return e(n,r);if(n instanceof Cartesian2)return Cartesian2.fromElements(e(n.x,r),e(n.y,r),scratchStorage.getCartesian2());if(n instanceof Cartesian3)return Cartesian3.fromElements(e(n.x,r),e(n.y,r),e(n.z,r),scratchStorage.getCartesian3());if(n instanceof Cartesian4)return Cartesian4.fromElements(e(n.x,r),e(n.y,r),e(n.z,r),e(n.w,r),scratchStorage.getCartesian4())}if("number"==typeof n&&"number"==typeof r)return e(n,r);if(n instanceof Cartesian2&&r instanceof Cartesian2)return Cartesian2.fromElements(e(n.x,r.x),e(n.y,r.y),scratchStorage.getCartesian2());if(n instanceof Cartesian3&&r instanceof Cartesian3)return Cartesian3.fromElements(e(n.x,r.x),e(n.y,r.y),e(n.z,r.z),scratchStorage.getCartesian3());if(n instanceof Cartesian4&&r instanceof Cartesian4)return Cartesian4.fromElements(e(n.x,r.x),e(n.y,r.y),e(n.z,r.z),e(n.w,r.w),scratchStorage.getCartesian4());throw new RuntimeError(`Function "${i}" requires vector or number arguments of matching types. Arguments are ${n} and ${r}.`)}}function getEvaluateTernaryComponentwise(e,t){return function(i,n,r,o){if(t&&"number"==typeof o){if("number"==typeof n&&"number"==typeof r)return e(n,r,o);if(n instanceof Cartesian2&&r instanceof Cartesian2)return Cartesian2.fromElements(e(n.x,r.x,o),e(n.y,r.y,o),scratchStorage.getCartesian2());if(n instanceof Cartesian3&&r instanceof Cartesian3)return Cartesian3.fromElements(e(n.x,r.x,o),e(n.y,r.y,o),e(n.z,r.z,o),scratchStorage.getCartesian3());if(n instanceof Cartesian4&&r instanceof Cartesian4)return Cartesian4.fromElements(e(n.x,r.x,o),e(n.y,r.y,o),e(n.z,r.z,o),e(n.w,r.w,o),scratchStorage.getCartesian4())}if("number"==typeof n&&"number"==typeof r&&"number"==typeof o)return e(n,r,o);if(n instanceof Cartesian2&&r instanceof Cartesian2&&o instanceof Cartesian2)return Cartesian2.fromElements(e(n.x,r.x,o.x),e(n.y,r.y,o.y),scratchStorage.getCartesian2());if(n instanceof Cartesian3&&r instanceof Cartesian3&&o instanceof Cartesian3)return Cartesian3.fromElements(e(n.x,r.x,o.x),e(n.y,r.y,o.y),e(n.z,r.z,o.z),scratchStorage.getCartesian3());if(n instanceof Cartesian4&&r instanceof Cartesian4&&o instanceof Cartesian4)return Cartesian4.fromElements(e(n.x,r.x,o.x),e(n.y,r.y,o.y),e(n.z,r.z,o.z),e(n.w,r.w,o.w),scratchStorage.getCartesian4());throw new RuntimeError(`Function "${i}" requires vector or number arguments of matching types. Arguments are ${n}, ${r}, and ${o}.`)}}function length(e,t){if("number"==typeof t)return Math.abs(t);if(t instanceof Cartesian2)return Cartesian2.magnitude(t);if(t instanceof Cartesian3)return Cartesian3.magnitude(t);if(t instanceof Cartesian4)return Cartesian4.magnitude(t);throw new RuntimeError(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function normalize(e,t){if("number"==typeof t)return 1;if(t instanceof Cartesian2)return Cartesian2.normalize(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.normalize(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.normalize(t,scratchStorage.getCartesian4());throw new RuntimeError(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function distance(e,t,i){if("number"==typeof t&&"number"==typeof i)return Math.abs(t-i);if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.distance(t,i);if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.distance(t,i);if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.distance(t,i);throw new RuntimeError(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${i}.`)}function dot(e,t,i){if("number"==typeof t&&"number"==typeof i)return t*i;if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.dot(t,i);if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.dot(t,i);if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.dot(t,i);throw new RuntimeError(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${i}.`)}function cross(e,t,i){if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.cross(t,i,scratchStorage.getCartesian3());throw new RuntimeError(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${i}.`)}function Node$4(e,t,i,n,r){this._type=e,this._value=t,this._left=i,this._right=n,this._test=r,this.evaluate=void 0,setEvaluateFunction(this)}function replaceDefines(e,t){if(!defined(t))return e;for(const i in t)if(t.hasOwnProperty(i)){const n=new RegExp(`\\$\\{${i}\\}`,"g"),r=`(${t[i]})`;defined(r)&&(e=e.replace(n,r))}return e}function removeBackslashes(e){return e.replace(backslashRegex,backslashReplacement)}function replaceBackslashes(e){return e.replace(replacementRegex,"\\")}function replaceVariables(e){let t=e,i="",n=t.indexOf("${");for(;n>=0;){const e=t.indexOf("'"),r=t.indexOf('"');let o;if(e>=0&&e<n)o=t.indexOf("'",e+1),i+=t.substr(0,o+1),t=t.substr(o+1),n=t.indexOf("${");else if(r>=0&&r<n)o=t.indexOf('"',r+1),i+=t.substr(0,o+1),t=t.substr(o+1),n=t.indexOf("${");else{i+=t.substr(0,n);const e=t.indexOf("}");if(e<0)throw new RuntimeError("Unmatched {.");i+=`czm_${t.substr(n+2,e-(n+2))}`,t=t.substr(e+1),n=t.indexOf("${")}}return i+=t,i}function parseLiteral(e){const t=typeof e.value;return null===e.value?new Node$4(ExpressionNodeType$1.LITERAL_NULL,null):"boolean"===t?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,e.value):"number"===t?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,e.value):"string"===t?e.value.indexOf("${")>=0?new Node$4(ExpressionNodeType$1.VARIABLE_IN_STRING,e.value):new Node$4(ExpressionNodeType$1.LITERAL_STRING,replaceBackslashes(e.value)):void 0}function parseCall(e,t){const i=t.arguments,n=i.length;let r,o,a,s;if("MemberExpression"===t.callee.type){r=t.callee.property.name;const c=t.callee.object;if("test"===r||"exec"===r){if("regExp"!==c.callee.name)throw new RuntimeError(`${r} is not a function.`);return 0===n?"test"===r?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):new Node$4(ExpressionNodeType$1.LITERAL_NULL,null):(a=createRuntimeAst(e,c),s=createRuntimeAst(e,i[0]),new Node$4(ExpressionNodeType$1.FUNCTION_CALL,r,a,s))}if("toString"===r)return o=createRuntimeAst(e,c),new Node$4(ExpressionNodeType$1.FUNCTION_CALL,r,o);throw new RuntimeError(`Unexpected function call "${r}".`)}if(r=t.callee.name,"color"===r){if(0===n)return new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r);if(o=createRuntimeAst(e,i[0]),defined(i[1])){const t=createRuntimeAst(e,i[1]);return new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,[o,t])}return new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,[o])}if("rgb"===r||"hsl"===r){if(n<3)throw new RuntimeError(`${r} requires three arguments.`);return o=[createRuntimeAst(e,i[0]),createRuntimeAst(e,i[1]),createRuntimeAst(e,i[2])],new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,o)}if("rgba"===r||"hsla"===r){if(n<4)throw new RuntimeError(`${r} requires four arguments.`);return o=[createRuntimeAst(e,i[0]),createRuntimeAst(e,i[1]),createRuntimeAst(e,i[2]),createRuntimeAst(e,i[3])],new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,o)}if("vec2"===r||"vec3"===r||"vec4"===r){o=new Array(n);for(let t=0;t<n;++t)o[t]=createRuntimeAst(e,i[t]);return new Node$4(ExpressionNodeType$1.LITERAL_VECTOR,r,o)}if("isNaN"===r||"isFinite"===r)return 0===n?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,"isNaN"===r):(o=createRuntimeAst(e,i[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("isExactClass"===r||"isClass"===r){if(n<1||n>1)throw new RuntimeError(`${r} requires exactly one argument.`);return o=createRuntimeAst(e,i[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o)}if("getExactClassName"===r){if(n>0)throw new RuntimeError(`${r} does not take any argument.`);return new Node$4(ExpressionNodeType$1.UNARY,r)}if(defined(unaryFunctions[r])){if(1!==n)throw new RuntimeError(`${r} requires exactly one argument.`);return o=createRuntimeAst(e,i[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o)}if(defined(binaryFunctions[r])){if(2!==n)throw new RuntimeError(`${r} requires exactly two arguments.`);return a=createRuntimeAst(e,i[0]),s=createRuntimeAst(e,i[1]),new Node$4(ExpressionNodeType$1.BINARY,r,a,s)}if(defined(ternaryFunctions[r])){if(3!==n)throw new RuntimeError(`${r} requires exactly three arguments.`);a=createRuntimeAst(e,i[0]),s=createRuntimeAst(e,i[1]);const t=createRuntimeAst(e,i[2]);return new Node$4(ExpressionNodeType$1.TERNARY,r,a,s,t)}if("Boolean"===r)return 0===n?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):(o=createRuntimeAst(e,i[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("Number"===r)return 0===n?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,0):(o=createRuntimeAst(e,i[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("String"===r)return 0===n?new Node$4(ExpressionNodeType$1.LITERAL_STRING,""):(o=createRuntimeAst(e,i[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("regExp"===r)return parseRegex(e,t);throw new RuntimeError(`Unexpected function call "${r}".`)}function parseRegex(e,t){const i=t.arguments;if(0===i.length)return new Node$4(ExpressionNodeType$1.LITERAL_REGEX,new RegExp);const n=createRuntimeAst(e,i[0]);let r;if(i.length>1){const t=createRuntimeAst(e,i[1]);if(isLiteralType(n)&&isLiteralType(t)){try{r=new RegExp(replaceBackslashes(String(n._value)),t._value)}catch(e){throw new RuntimeError(e)}return new Node$4(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$4(ExpressionNodeType$1.REGEX,n,t)}if(isLiteralType(n)){try{r=new RegExp(replaceBackslashes(String(n._value)))}catch(e){throw new RuntimeError(e)}return new Node$4(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$4(ExpressionNodeType$1.REGEX,n)}function parseKeywordsAndVariables(e){if(isVariable(e.name)){const t=getPropertyName(e.name);return"tiles3d_"===t.substr(0,8)?new Node$4(ExpressionNodeType$1.BUILTIN_VARIABLE,t):new Node$4(ExpressionNodeType$1.VARIABLE,t)}if("NaN"===e.name)return new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,NaN);if("Infinity"===e.name)return new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,1/0);if("undefined"===e.name)return new Node$4(ExpressionNodeType$1.LITERAL_UNDEFINED,void 0);throw new RuntimeError(`${e.name} is not defined.`)}function parseMathConstant(e){const t=e.property.name;return"PI"===t?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,Math.PI):"E"===t?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,Math.E):void 0}function parseNumberConstant(e){if("POSITIVE_INFINITY"===e.property.name)return new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function parseMemberExpression(e,t){if("Math"===t.object.name)return parseMathConstant(t);if("Number"===t.object.name)return parseNumberConstant(t);let i;const n=createRuntimeAst(e,t.object);return t.computed?(i=createRuntimeAst(e,t.property),new Node$4(ExpressionNodeType$1.MEMBER,"brackets",n,i)):(i=new Node$4(ExpressionNodeType$1.LITERAL_STRING,t.property.name),new Node$4(ExpressionNodeType$1.MEMBER,"dot",n,i))}function isLiteralType(e){return e._type>=ExpressionNodeType$1.LITERAL_NULL}function isVariable(e){return"czm_"===e.substr(0,4)}function getPropertyName(e){return e.substr(4)}function createRuntimeAst(e,t){let i,n,r,o;if("Literal"===t.type)i=parseLiteral(t);else if("CallExpression"===t.type)i=parseCall(e,t);else if("Identifier"===t.type)i=parseKeywordsAndVariables(t);else if("UnaryExpression"===t.type){n=t.operator;const r=createRuntimeAst(e,t.argument);if(!(unaryOperators.indexOf(n)>-1))throw new RuntimeError(`Unexpected operator "${n}".`);i=new Node$4(ExpressionNodeType$1.UNARY,n,r)}else if("BinaryExpression"===t.type){if(n=t.operator,r=createRuntimeAst(e,t.left),o=createRuntimeAst(e,t.right),!(binaryOperators.indexOf(n)>-1))throw new RuntimeError(`Unexpected operator "${n}".`);i=new Node$4(ExpressionNodeType$1.BINARY,n,r,o)}else if("LogicalExpression"===t.type)n=t.operator,r=createRuntimeAst(e,t.left),o=createRuntimeAst(e,t.right),binaryOperators.indexOf(n)>-1&&(i=new Node$4(ExpressionNodeType$1.BINARY,n,r,o));else if("ConditionalExpression"===t.type){const n=createRuntimeAst(e,t.test);r=createRuntimeAst(e,t.consequent),o=createRuntimeAst(e,t.alternate),i=new Node$4(ExpressionNodeType$1.CONDITIONAL,"?",r,o,n)}else if("MemberExpression"===t.type)i=parseMemberExpression(e,t);else{if("ArrayExpression"!==t.type)throw"Compound"===t.type?new RuntimeError("Provide exactly one expression."):new RuntimeError("Cannot parse expression.");{const n=[];for(let i=0;i<t.elements.length;i++)n[i]=createRuntimeAst(e,t.elements[i]);i=new Node$4(ExpressionNodeType$1.ARRAY,n)}}return i}function setEvaluateFunction(e){e._type===ExpressionNodeType$1.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===ExpressionNodeType$1.FUNCTION_CALL?"test"===e._value?e.evaluate=e._evaluateRegExpTest:"exec"===e._value?e.evaluate=e._evaluateRegExpExec:"toString"===e._value&&(e.evaluate=e._evaluateToString):e._type===ExpressionNodeType$1.UNARY?"!"===e._value?e.evaluate=e._evaluateNot:"-"===e._value?e.evaluate=e._evaluateNegative:"+"===e._value?e.evaluate=e._evaluatePositive:"isNaN"===e._value?e.evaluate=e._evaluateNaN:"isFinite"===e._value?e.evaluate=e._evaluateIsFinite:"isExactClass"===e._value?e.evaluate=e._evaluateIsExactClass:"isClass"===e._value?e.evaluate=e._evaluateIsClass:"getExactClassName"===e._value?e.evaluate=e._evaluateGetExactClassName:"Boolean"===e._value?e.evaluate=e._evaluateBooleanConversion:"Number"===e._value?e.evaluate=e._evaluateNumberConversion:"String"===e._value?e.evaluate=e._evaluateStringConversion:defined(unaryFunctions[e._value])&&(e.evaluate=getEvaluateUnaryFunction(e._value)):e._type===ExpressionNodeType$1.BINARY?"+"===e._value?e.evaluate=e._evaluatePlus:"-"===e._value?e.evaluate=e._evaluateMinus:"*"===e._value?e.evaluate=e._evaluateTimes:"/"===e._value?e.evaluate=e._evaluateDivide:"%"===e._value?e.evaluate=e._evaluateMod:"==="===e._value?e.evaluate=e._evaluateEqualsStrict:"!=="===e._value?e.evaluate=e._evaluateNotEqualsStrict:"<"===e._value?e.evaluate=e._evaluateLessThan:"<="===e._value?e.evaluate=e._evaluateLessThanOrEquals:">"===e._value?e.evaluate=e._evaluateGreaterThan:">="===e._value?e.evaluate=e._evaluateGreaterThanOrEquals:"&&"===e._value?e.evaluate=e._evaluateAnd:"||"===e._value?e.evaluate=e._evaluateOr:"=~"===e._value?e.evaluate=e._evaluateRegExpMatch:"!~"===e._value?e.evaluate=e._evaluateRegExpNotMatch:defined(binaryFunctions[e._value])&&(e.evaluate=getEvaluateBinaryFunction(e._value)):e._type===ExpressionNodeType$1.TERNARY?e.evaluate=getEvaluateTernaryFunction(e._value):e._type===ExpressionNodeType$1.MEMBER?"brackets"===e._value?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===ExpressionNodeType$1.ARRAY?e.evaluate=e._evaluateArray:e._type===ExpressionNodeType$1.VARIABLE?e.evaluate=e._evaluateVariable:e._type===ExpressionNodeType$1.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===ExpressionNodeType$1.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===ExpressionNodeType$1.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===ExpressionNodeType$1.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===ExpressionNodeType$1.REGEX?e.evaluate=e._evaluateRegExp:e._type===ExpressionNodeType$1.BUILTIN_VARIABLE?"tiles3d_tileset_time"===e._value&&(e.evaluate=evaluateTilesetTime):e.evaluate=e._evaluateLiteral}function evaluateTilesetTime(e){return defined(e)?e.content.tileset.timeSinceLoad:0}function getEvaluateUnaryFunction(e){const t=unaryFunctions[e];return function(i){const n=this._left.evaluate(i);return t(e,n)}}function getEvaluateBinaryFunction(e){const t=binaryFunctions[e];return function(i){const n=this._left.evaluate(i),r=this._right.evaluate(i);return t(e,n,r)}}function getEvaluateTernaryFunction(e){const t=ternaryFunctions[e];return function(i){const n=this._left.evaluate(i),r=this._right.evaluate(i),o=this._test.evaluate(i);return t(e,n,r,o)}}function getFeatureProperty(e,t){if(defined(e))return e.getPropertyInherited(t)}function checkFeature(e){return"feature"===e._value}function convertHSLToRGB(e){const t=e._left,i=t.length;for(let e=0;e<i;++e)if(t[e]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;const n=t[0]._value,r=t[1]._value,o=t[2]._value,a=4===i?t[3]._value:1;return Color.fromHsl(n,r,o,a,scratchColor$m)}function convertRGBToColor(e){const t=e._left,i=t.length;for(let e=0;e<i;++e)if(t[e]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;const n=scratchColor$m;return n.red=t[0]._value/255,n.green=t[1]._value/255,n.blue=t[2]._value/255,n.alpha=4===i?t[3]._value:1,n}function numberToString(e){return e%1==0?e.toFixed(1):e.toString()}function colorToVec3(e){return`vec3(${numberToString(e.red)}, ${numberToString(e.green)}, ${numberToString(e.blue)})`}function colorToVec4(e){return`vec4(${numberToString(e.red)}, ${numberToString(e.green)}, ${numberToString(e.blue)}, ${numberToString(e.alpha)})`}function getExpressionArray(e,t,i,n){const r=e.length,o=new Array(r);for(let a=0;a<r;++a)o[a]=e[a].getShaderExpression(t,i,n);return o}function getVariableName(e,t){return defined(t[e])?t[e]:Expression.NULL_SENTINEL}function Vector3DTilePrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._vertexBatchIds=e.vertexBatchIds,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=e.indexOffsets,this._batchedIndices=e.batchedIndices,this._boundingVolume=e.boundingVolume,this._boundingVolumes=e.boundingVolumes,this._center=defaultValue(e.center,Cartesian3.ZERO),this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._batchDirty=!0,this._pickCommandsDirty=!0,this._framesSinceLastRebatch=0,this._updatingAllCommands=!1,this._trianglesLength=this._indices.length/3,this._geometryByteLength=this._indices.byteLength+this._positions.byteLength+this._vertexBatchIds.byteLength,this.debugWireframe=!1,this._debugWireframe=this.debugWireframe,this._wireframeDirty=!1,this.forceRebatch=!1,this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this._vertexShaderSource=e._vertexShaderSource,this._fragmentShaderSource=e._fragmentShaderSource,this._attributeLocations=e._attributeLocations,this._uniformMap=e._uniformMap,this._pickId=e._pickId,this._modelMatrix=e._modelMatrix,this._boundingSphere=e._boundingSphere,this._batchIdLookUp={};const t=this._batchIds.length;for(let e=0;e<t;++e){const t=this._batchIds[e];this._batchIdLookUp[t]=e}}Node$4.prototype._evaluateLiteral=function(){return this._value},Node$4.prototype._evaluateLiteralColor=function(e){const t=scratchColor$m,i=this._left;if("color"===this._value)defined(i)?i.length>1?(Color.fromCssColorString(i[0].evaluate(e),t),t.alpha=i[1].evaluate(e)):Color.fromCssColorString(i[0].evaluate(e),t):Color.fromBytes(255,255,255,255,t);else if("rgb"===this._value)Color.fromBytes(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),255,t);else if("rgba"===this._value){const n=255*i[3].evaluate(e);Color.fromBytes(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),n,t)}else"hsl"===this._value?Color.fromHsl(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),1,t):"hsla"===this._value&&Color.fromHsl(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),i[3].evaluate(e),t);return Cartesian4.fromColor(t,scratchStorage.getCartesian4())},Node$4.prototype._evaluateLiteralVector=function(e){const t=scratchStorage.getArray(),i=this._value,n=this._left,r=n.length;for(let o=0;o<r;++o){const r=n[o].evaluate(e);if("number"==typeof r)t.push(r);else if(r instanceof Cartesian2)t.push(r.x,r.y);else if(r instanceof Cartesian3)t.push(r.x,r.y,r.z);else{if(!(r instanceof Cartesian4))throw new RuntimeError(`${i} argument must be a vector or number. Argument is ${r}.`);t.push(r.x,r.y,r.z,r.w)}}const o=t.length,a=parseInt(i.charAt(3));if(0===o)throw new RuntimeError(`Invalid ${i} constructor. No valid arguments.`);if(o<a&&o>1)throw new RuntimeError(`Invalid ${i} constructor. Not enough arguments.`);if(o>a&&r>1)throw new RuntimeError(`Invalid ${i} constructor. Too many arguments.`);if(1===o){const e=t[0];t.push(e,e,e)}return"vec2"===i?Cartesian2.fromArray(t,0,scratchStorage.getCartesian2()):"vec3"===i?Cartesian3.fromArray(t,0,scratchStorage.getCartesian3()):"vec4"===i?Cartesian4.fromArray(t,0,scratchStorage.getCartesian4()):void 0},Node$4.prototype._evaluateLiteralString=function(){return this._value},Node$4.prototype._evaluateVariableString=function(e){let t=this._value,i=variableRegex.exec(t);for(;null!==i;){const n=i[0];let r=getFeatureProperty(e,i[1]);defined(r)||(r=""),t=t.replace(n,r),i=variableRegex.exec(t)}return t},Node$4.prototype._evaluateVariable=function(e){return getFeatureProperty(e,this._value)},Node$4.prototype._evaluateMemberDot=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!defined(t))return;const i=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if("r"===i)return t.x;if("g"===i)return t.y;if("b"===i)return t.z;if("a"===i)return t.w}return t[i]},Node$4.prototype._evaluateMemberBrackets=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!defined(t))return;const i=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if(0===i||"r"===i)return t.x;if(1===i||"g"===i)return t.y;if(2===i||"b"===i)return t.z;if(3===i||"a"===i)return t.w}return t[i]},Node$4.prototype._evaluateArray=function(e){const t=[];for(let i=0;i<this._value.length;i++)t[i]=this._value[i].evaluate(e);return t},Node$4.prototype._evaluateNot=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t},Node$4.prototype._evaluateNegative=function(e){const t=this._left.evaluate(e);if(t instanceof Cartesian2)return Cartesian2.negate(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.negate(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.negate(t,scratchStorage.getCartesian4());if("number"==typeof t)return-t;throw new RuntimeError(`Operator "-" requires a vector or number argument. Argument is ${t}.`)},Node$4.prototype._evaluatePositive=function(e){const t=this._left.evaluate(e);if(!(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4||"number"==typeof t))throw new RuntimeError(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t},Node$4.prototype._evaluateLessThan=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError(`Operator "<" requires number arguments. Arguments are ${t} and ${i}.`);return t<i},Node$4.prototype._evaluateLessThanOrEquals=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError(`Operator "<=" requires number arguments. Arguments are ${t} and ${i}.`);return t<=i},Node$4.prototype._evaluateGreaterThan=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError(`Operator ">" requires number arguments. Arguments are ${t} and ${i}.`);return t>i},Node$4.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError(`Operator ">=" requires number arguments. Arguments are ${t} and ${i}.`);return t>=i},Node$4.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;const i=this._right.evaluate(e);if("boolean"!=typeof i)throw new RuntimeError(`Operator "||" requires boolean arguments. Second argument is ${i}.`);return t||i},Node$4.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;const i=this._right.evaluate(e);if("boolean"!=typeof i)throw new RuntimeError(`Operator "&&" requires boolean arguments. Second argument is ${i}.`);return t&&i},Node$4.prototype._evaluatePlus=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.add(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.add(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.add(t,i,scratchStorage.getCartesian4());if("string"==typeof t||"string"==typeof i)return t+i;if("number"==typeof t&&"number"==typeof i)return t+i;throw new RuntimeError(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${i}.`)},Node$4.prototype._evaluateMinus=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.subtract(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.subtract(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.subtract(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t-i;throw new RuntimeError(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${i}.`)},Node$4.prototype._evaluateTimes=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.multiplyComponents(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian2&&"number"==typeof t)return Cartesian2.multiplyByScalar(i,t,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof i)return Cartesian2.multiplyByScalar(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.multiplyComponents(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian3&&"number"==typeof t)return Cartesian3.multiplyByScalar(i,t,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof i)return Cartesian3.multiplyByScalar(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.multiplyComponents(t,i,scratchStorage.getCartesian4());if(i instanceof Cartesian4&&"number"==typeof t)return Cartesian4.multiplyByScalar(i,t,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof i)return Cartesian4.multiplyByScalar(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t*i;throw new RuntimeError(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${i}.`)},Node$4.prototype._evaluateDivide=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.divideComponents(t,i,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof i)return Cartesian2.divideByScalar(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.divideComponents(t,i,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof i)return Cartesian3.divideByScalar(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.divideComponents(t,i,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof i)return Cartesian4.divideByScalar(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t/i;throw new RuntimeError(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${i}.`)},Node$4.prototype._evaluateMod=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.fromElements(t.x%i.x,t.y%i.y,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.fromElements(t.x%i.x,t.y%i.y,t.z%i.z,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.fromElements(t.x%i.x,t.y%i.y,t.z%i.z,t.w%i.w,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t%i;throw new RuntimeError(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${i}.`)},Node$4.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);return i instanceof Cartesian2&&t instanceof Cartesian2||i instanceof Cartesian3&&t instanceof Cartesian3||i instanceof Cartesian4&&t instanceof Cartesian4?t.equals(i):t===i},Node$4.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);return i instanceof Cartesian2&&t instanceof Cartesian2||i instanceof Cartesian3&&t instanceof Cartesian3||i instanceof Cartesian4&&t instanceof Cartesian4?!t.equals(i):t!==i},Node$4.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)},Node$4.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))},Node$4.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))},Node$4.prototype._evaluateIsExactClass=function(e){return!!defined(e)&&e.isExactClass(this._left.evaluate(e))},Node$4.prototype._evaluateIsClass=function(e){return!!defined(e)&&e.isClass(this._left.evaluate(e))},Node$4.prototype._evaluateGetExactClassName=function(e){if(defined(e))return e.getExactClassName()},Node$4.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))},Node$4.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))},Node$4.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))},Node$4.prototype._evaluateRegExp=function(e){const t=this._value.evaluate(e);let i,n="";defined(this._left)&&(n=this._left.evaluate(e));try{i=new RegExp(t,n)}catch(e){throw new RuntimeError(e)}return i},Node$4.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof i))throw new RuntimeError(`RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${i}.`);return t.test(i)},Node$4.prototype._evaluateRegExpMatch=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof i)return t.test(i);if(i instanceof RegExp&&"string"==typeof t)return i.test(t);throw new RuntimeError(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${i}.`)},Node$4.prototype._evaluateRegExpNotMatch=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof i)return!t.test(i);if(i instanceof RegExp&&"string"==typeof t)return!i.test(t);throw new RuntimeError(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${i}.`)},Node$4.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),i=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof i))throw new RuntimeError(`RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${i}.`);const n=t.exec(i);return defined(n)?n[1]:null},Node$4.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4)return String(t);throw new RuntimeError(`Unexpected function call "${this._value}".`)},Expression.NULL_SENTINEL="czm_infinity",Node$4.prototype.getShaderExpression=function(e,t,i){let n,r,o,a;const s=this._type;let c,l,u,d=this._value;switch(defined(this._left)&&(r=Array.isArray(this._left)?getExpressionArray(this._left,e,t,this):this._left.getShaderExpression(e,t,this)),defined(this._right)&&(o=this._right.getShaderExpression(e,t,this)),defined(this._test)&&(a=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(d=getExpressionArray(this._value,e,t,this)),s){case ExpressionNodeType$1.VARIABLE:if(checkFeature(this))return;return getVariableName(d,e);case ExpressionNodeType$1.UNARY:if("Boolean"===d)return`bool(${r})`;if("Number"===d)return`float(${r})`;if("round"===d)return`floor(${r} + 0.5)`;if(defined(unaryFunctions[d]))return`${d}(${r})`;if("isNaN"===d)return`(${r} != ${r})`;if("isFinite"===d)return`(abs(${r}) < czm_infinity)`;if("String"===d||"isExactClass"===d||"isClass"===d||"getExactClassName"===d)throw new RuntimeError(`Error generating style shader: "${d}" is not supported.`);return d+r;case ExpressionNodeType$1.BINARY:return"%"===d?`mod(${r}, ${o})`:"==="===d?`(${r} == ${o})`:"!=="===d?`(${r} != ${o})`:"atan2"===d?`atan(${r}, ${o})`:defined(binaryFunctions[d])?`${d}(${r}, ${o})`:`(${r} ${d} ${o})`;case ExpressionNodeType$1.TERNARY:if(defined(ternaryFunctions[d]))return`${d}(${r}, ${o}, ${a})`;break;case ExpressionNodeType$1.CONDITIONAL:return`(${a} ? ${r} : ${o})`;case ExpressionNodeType$1.MEMBER:return checkFeature(this._left)?getVariableName(o,e):"r"===o||"x"===o||"0.0"===o?`${r}[0]`:"g"===o||"y"===o||"1.0"===o?`${r}[1]`:"b"===o||"z"===o||"2.0"===o?`${r}[2]`:"a"===o||"w"===o||"3.0"===o?`${r}[3]`:`${r}[int(${o})]`;case ExpressionNodeType$1.FUNCTION_CALL:throw new RuntimeError(`Error generating style shader: "${d}" is not supported.`);case ExpressionNodeType$1.ARRAY:if(4===d.length)return`vec4(${d[0]}, ${d[1]}, ${d[2]}, ${d[3]})`;if(3===d.length)return`vec3(${d[0]}, ${d[1]}, ${d[2]})`;if(2===d.length)return`vec2(${d[0]}, ${d[1]})`;throw new RuntimeError("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case ExpressionNodeType$1.REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.VARIABLE_IN_STRING:throw new RuntimeError("Error generating style shader: Converting a variable to a string is not supported.");case ExpressionNodeType$1.LITERAL_NULL:return Expression.NULL_SENTINEL;case ExpressionNodeType$1.LITERAL_BOOLEAN:return d?"true":"false";case ExpressionNodeType$1.LITERAL_NUMBER:return numberToString(d);case ExpressionNodeType$1.LITERAL_STRING:if(defined(i)&&i._type===ExpressionNodeType$1.MEMBER&&("r"===d||"g"===d||"b"===d||"a"===d||"x"===d||"y"===d||"z"===d||"w"===d||checkFeature(i._left)))return d;if(n=Color.fromCssColorString(d,scratchColor$m),defined(n))return colorToVec3(n);throw new RuntimeError("Error generating style shader: String literals are not supported.");case ExpressionNodeType$1.LITERAL_COLOR:if(c=r,"color"===d){if(!defined(c))return"vec4(1.0)";if(c.length>1){const e=c[0],i=c[1];return"1.0"!==i&&(t.translucent=!0),`vec4(${e}, ${i})`}return`vec4(${c[0]}, 1.0)`}if("rgb"===d)return n=convertRGBToColor(this),defined(n)?colorToVec4(n):`vec4(${c[0]} / 255.0, ${c[1]} / 255.0, ${c[2]} / 255.0, 1.0)`;if("rgba"===d)return"1.0"!==c[3]&&(t.translucent=!0),n=convertRGBToColor(this),defined(n)?colorToVec4(n):`vec4(${c[0]} / 255.0, ${c[1]} / 255.0, ${c[2]} / 255.0, ${c[3]})`;if("hsl"===d)return n=convertHSLToRGB(this),defined(n)?colorToVec4(n):`vec4(czm_HSLToRGB(vec3(${c[0]}, ${c[1]}, ${c[2]})), 1.0)`;if("hsla"===d)return n=convertHSLToRGB(this),defined(n)?(1!==n.alpha&&(t.translucent=!0),colorToVec4(n)):("1.0"!==c[3]&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${c[0]}, ${c[1]}, ${c[2]})), ${c[3]})`);break;case ExpressionNodeType$1.LITERAL_VECTOR:l=r.length,u=`${d}(`;for(let e=0;e<l;++e)u+=r[e],e<l-1&&(u+=", ");return u+=")",u;case ExpressionNodeType$1.LITERAL_REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.LITERAL_UNDEFINED:return Expression.NULL_SENTINEL;case ExpressionNodeType$1.BUILTIN_VARIABLE:if("tiles3d_tileset_time"===d)return"u_time"}},Node$4.prototype.getVariables=function(e,t){let i,n,r;const o=this._type,a=this._value;if(defined(this._left))if(Array.isArray(this._left))for(i=this._left,n=i.length,r=0;r<n;++r)i[r].getVariables(e,this);else this._left.getVariables(e,this);if(defined(this._right)&&this._right.getVariables(e,this),defined(this._test)&&this._test.getVariables(e,this),Array.isArray(this._value))for(i=this._value,n=i.length,r=0;r<n;++r)i[r].getVariables(e,this);let s;switch(o){case ExpressionNodeType$1.VARIABLE:checkFeature(this)||e.push(a);break;case ExpressionNodeType$1.VARIABLE_IN_STRING:for(s=variableRegex.exec(a);null!==s;)e.push(s[1]),s=variableRegex.exec(a);break;case ExpressionNodeType$1.LITERAL_STRING:defined(t)&&t._type===ExpressionNodeType$1.MEMBER&&checkFeature(t._left)&&e.push(a)}},Object.defineProperties(Vector3DTilePrimitive.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});const defaultAttributeLocations={position:0,a_batchId:1};function createVertexArray$4(e,t){if(defined(e._va))return;const i=Buffer$1.createVertexBuffer({context:t,typedArray:e._positions,usage:BufferUsage$1.STATIC_DRAW}),n=Buffer$1.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:BufferUsage$1.STATIC_DRAW}),r=Buffer$1.createIndexBuffer({context:t,typedArray:e._indices,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:2===e._indices.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),o=[{index:0,vertexBuffer:i,componentDatatype:ComponentDatatype$1.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:n,componentDatatype:ComponentDatatype$1.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:o,indexBuffer:r}),t.webgl2&&(e._vaSwap=new VertexArray({context:t,attributes:o,indexBuffer:Buffer$1.createIndexBuffer({context:t,sizeInBytes:r.sizeInBytes,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:r.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}function createShaders$3(e,t){if(defined(e._sp))return;const i=e._batchTable,n=defaultValue(e._attributeLocations,defaultAttributeLocations);let r=e._pickId;const o=e._vertexShaderSource;let a=e._fragmentShaderSource;if(defined(o))return e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:n}),e._spStencil=e._sp,a=ShaderSource.replaceMain(a,"czm_non_pick_main"),a=`${a}void main() \n{ \n czm_non_pick_main(); \n gl_FragColor = ${r}; \n} \n`,void(e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:n}));const s=i.getVertexShaderCallback(!1,"a_batchId",void 0)(VectorTileVS);let c=i.getFragmentShaderCallback(!1,void 0,!0)(ShadowVolumeFS);r=i.getPickId();let l=new ShaderSource({sources:[s]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[c]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:n}),l=new ShaderSource({sources:[VectorTileVS]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[ShadowVolumeFS]}),e._spStencil=ShaderProgram.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:n}),c=ShaderSource.replaceMain(c,"czm_non_pick_main"),c=`${c}\nvoid main() \n{ \n czm_non_pick_main(); \n gl_FragColor = ${r}; \n} \n`;const d=new ShaderSource({sources:[s]}),h=new ShaderSource({defines:["VECTOR_TILE"],sources:[c]});e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:n})}function getStencilDepthRenderState(e){const t=e?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.KEEP},backFunction:t,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}const colorRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND},pickRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$4(e){defined(e._rsStencilDepthPass)||(e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState(!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState(!0)),e._rsColorPass=RenderState.fromCache(colorRenderState),e._rsPickPass=RenderState.fromCache(pickRenderState))}const modifiedModelViewScratch$3=new Matrix4,rtcScratch$3=new Cartesian3;function createUniformMap$6(e,t){if(defined(e._uniformMap))return;const i={u_modifiedModelViewProjection:function(){const i=t.uniformState.view,n=t.uniformState.projection;return Matrix4.clone(i,modifiedModelViewScratch$3),Matrix4.multiplyByPoint(modifiedModelViewScratch$3,e._center,rtcScratch$3),Matrix4.setTranslation(modifiedModelViewScratch$3,rtcScratch$3,modifiedModelViewScratch$3),Matrix4.multiply(n,modifiedModelViewScratch$3,modifiedModelViewScratch$3),modifiedModelViewScratch$3},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(i)}function copyIndicesCPU(e,t,i,n,r,o,a){const s=e.constructor.BYTES_PER_ELEMENT,c=o.length;for(let l=0;l<c;++l){const c=a[o[l]],u=n[c],d=r[c],h=new e.constructor(e.buffer,s*u,d);t.set(h,i),n[c]=i,i+=d}return i}function rebatchCPU(e,t){const i=e._indices,n=e._indexOffsets,r=e._indexCounts,o=e._batchIdLookUp,a=new i.constructor(i.length);let s=t.pop();const c=[s];let l=copyIndicesCPU(i,a,0,n,r,s.batchIds,o);for(s.offset=0,s.count=l;t.length>0;){const e=t.pop();if(Color.equals(e.color,s.color))l=copyIndicesCPU(i,a,l,n,r,e.batchIds,o),s.batchIds=s.batchIds.concat(e.batchIds),s.count=l-s.offset;else{const t=l;l=copyIndicesCPU(i,a,l,n,r,e.batchIds,o),e.offset=t,e.count=l-t,c.push(e),s=e}}e._va.indexBuffer.copyFromArrayView(a),e._indices=a,e._batchedIndices=c}function copyIndicesGPU(e,t,i,n,r,o,a){const s=e.bytesPerIndex,c=o.length;for(let l=0;l<c;++l){const c=a[o[l]],u=n[c],d=r[c];t.copyFromBuffer(e,u*s,i*s,d*s),n[c]=i,i+=d}return i}function rebatchGPU(e,t){const i=e._indexOffsets,n=e._indexCounts,r=e._batchIdLookUp;let o=t.pop();const a=[o],s=e._va.indexBuffer,c=e._vaSwap.indexBuffer;let l=copyIndicesGPU(s,c,0,i,n,o.batchIds,r);for(o.offset=0,o.count=l;t.length>0;){const e=t.pop();if(Color.equals(e.color,o.color))l=copyIndicesGPU(s,c,l,i,n,e.batchIds,r),o.batchIds=o.batchIds.concat(e.batchIds),o.count=l-o.offset;else{const t=l;l=copyIndicesGPU(s,c,l,i,n,e.batchIds,r),e.offset=t,e.count=l-t,a.push(e),o=e}}const u=e._va;e._va=e._vaSwap,e._vaSwap=u,e._batchedIndices=a}function compareColors(e,t){return t.color.toRgba()-e.color.toRgba()}function rebatchCommands(e,t){if(!e._batchDirty)return!1;const i=e._batchedIndices,n=i.length;let r=!1;const o={};for(let e=0;e<n;++e){const t=i[e].color.toRgba();if(defined(o[t])){r=!0;break}o[t]=!0}return r?r&&!e.forceRebatch&&e._framesSinceLastRebatch<120?void++e._framesSinceLastRebatch:(i.sort(compareColors),t.webgl2?rebatchGPU(e,i):rebatchCPU(e,i),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0):(e._batchDirty=!1,!1)}function createColorCommands(e,t){const i=rebatchCommands(e,t),n=e._commands,r=e._batchedIndices,o=r.length,a=2*o;if(defined(n)&&!i&&n.length===a)return;n.length=a;const s=e._va,c=e._sp,l=defaultValue(e._modelMatrix,Matrix4.IDENTITY),u=e._uniformMap,d=e._boundingVolume;for(let t=0;t<o;++t){const i=r[t].offset,o=r[t].count;let a=n[2*t];defined(a)||(a=n[2*t]=new DrawCommand({owner:e})),a.vertexArray=s,a.modelMatrix=l,a.offset=i,a.count=o,a.renderState=e._rsStencilDepthPass,a.shaderProgram=c,a.uniformMap=u,a.boundingVolume=d,a.cull=!1,a.pass=Pass$1.TERRAIN_CLASSIFICATION;const h=DrawCommand.shallowClone(a,a.derivedCommands.tileset);h.renderState=e._rsStencilDepthPass3DTiles,h.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=h;let p=n[2*t+1];defined(p)||(p=n[2*t+1]=new DrawCommand({owner:e})),p.vertexArray=s,p.modelMatrix=l,p.offset=i,p.count=o,p.renderState=e._rsColorPass,p.shaderProgram=c,p.uniformMap=u,p.boundingVolume=d,p.cull=!1,p.pass=Pass$1.TERRAIN_CLASSIFICATION;const f=DrawCommand.shallowClone(p,p.derivedCommands.tileset);f.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=f}e._commandsDirty=!0}function createColorCommandsIgnoreShow(e,t){if(e.classificationType===ClassificationType$1.TERRAIN||!t.invertClassification||defined(e._commandsIgnoreShow)&&!e._commandsDirty)return;const i=e._commands,n=e._commandsIgnoreShow,r=e._spStencil,o=i.length,a=n.length=o/2;let s=0;for(let e=0;e<a;++e){const t=n[e]=DrawCommand.shallowClone(i[s],n[e]);t.shaderProgram=r,t.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,s+=2}e._commandsDirty=!1}function createPickCommands(e){if(!e._pickCommandsDirty)return;const t=e._indexOffsets.length,i=e._pickCommands;i.length=2*t;const n=e._va,r=e._spStencil,o=e._spPick,a=defaultValue(e._modelMatrix,Matrix4.IDENTITY),s=e._uniformMap;for(let c=0;c<t;++c){const t=e._indexOffsets[c],l=e._indexCounts[c],u=defined(e._boundingVolumes)?e._boundingVolumes[c]:e.boundingVolume;let d=i[2*c];defined(d)||(d=i[2*c]=new DrawCommand({owner:e,pickOnly:!0})),d.vertexArray=n,d.modelMatrix=a,d.offset=t,d.count=l,d.renderState=e._rsStencilDepthPass,d.shaderProgram=r,d.uniformMap=s,d.boundingVolume=u,d.pass=Pass$1.TERRAIN_CLASSIFICATION;const h=DrawCommand.shallowClone(d,d.derivedCommands.tileset);h.renderState=e._rsStencilDepthPass3DTiles,h.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,d.derivedCommands.tileset=h;let p=i[2*c+1];defined(p)||(p=i[2*c+1]=new DrawCommand({owner:e,pickOnly:!0})),p.vertexArray=n,p.modelMatrix=a,p.offset=t,p.count=l,p.renderState=e._rsPickPass,p.shaderProgram=o,p.uniformMap=s,p.boundingVolume=u,p.pass=Pass$1.TERRAIN_CLASSIFICATION;const f=DrawCommand.shallowClone(p,p.derivedCommands.tileset);f.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=f}e._pickCommandsDirty=!1}function clearStyle$3(e,t){e._updatingAllCommands=!0;const i=e._batchIds;let n,r=i.length;for(n=0;n<r;++n){const e=t[i[n]];e.show=!0,e.color=Color.WHITE}const o=e._batchedIndices;for(r=o.length,n=0;n<r;++n)o[n].color=Color.clone(Color.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}Vector3DTilePrimitive.prototype.createFeatures=function(e,t){const i=this._batchIds,n=i.length;for(let r=0;r<n;++r){const n=i[r];t[n]=new Cesium3DTileFeature(e,n)}},Vector3DTilePrimitive.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const scratchColor$l=new Color,DEFAULT_COLOR_VALUE$2=Color.WHITE,DEFAULT_SHOW_VALUE$2=!0,complexExpressionReg=/\$/;function queueCommands$2(e,t,i,n){const r=e.classificationType,o=r!==ClassificationType$1.CESIUM_3D_TILE,a=r!==ClassificationType$1.TERRAIN,s=t.commandList;let c,l,u=i.length;for(l=0;l<u;++l)o&&(c=i[l],c.pass=Pass$1.TERRAIN_CLASSIFICATION,s.push(c)),a&&(c=i[l].derivedCommands.tileset,c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,s.push(c));if(t.invertClassification&&defined(n))for(u=n.length,l=0;l<u;++l)s.push(n[l])}function queueWireframeCommands(e,t){const i=e.commandList,n=t.length;for(let e=0;e<n;e+=2){const n=t[e+1];n.pass=Pass$1.OPAQUE,i.push(n)}}function updateWireframe$2(e){let t,i,n=e.debugWireframe===e._debugWireframe;if(n=n&&!(e.debugWireframe&&e._wireframeDirty),n)return;defined(e._rsWireframe)||(e._rsWireframe=RenderState.fromCache({})),e.debugWireframe?(t=e._rsWireframe,i=PrimitiveType$1.LINES):(t=e._rsColorPass,i=PrimitiveType$1.TRIANGLES);const r=e._commands,o=r.length;for(let e=0;e<o;e+=2){const n=r[e+1];n.renderState=t,n.primitiveType=i}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}Vector3DTilePrimitive.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle$3(this,t);const i=e.color,n=i instanceof Expression&&!complexExpressionReg.test(i.expression);this._updatingAllCommands=n;const r=this._batchIds;let o,a=r.length;for(o=0;o<a;++o){const i=t[r[o]];i.color=defined(e.color)?e.color.evaluateColor(i,scratchColor$l):DEFAULT_COLOR_VALUE$2,i.show=defined(e.show)?e.show.evaluate(i):DEFAULT_SHOW_VALUE$2}if(n){const e=this._batchedIndices;for(a=e.length,o=0;o<a;++o)e[o].color=Color.clone(Color.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}},Vector3DTilePrimitive.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;const i=this._batchIdLookUp,n=i[e];if(!defined(n))return;const r=this._indexOffsets,o=this._indexCounts,a=r[n],s=o[n],c=this._batchedIndices,l=c.length;let u;for(u=0;u<l;++u){const e=c[u].offset,t=c[u].count;if(a>=e&&a<e+t)break}c.push(new Vector3DTileBatch({color:Color.clone(t),offset:a,count:s,batchIds:[e]}));const d=[],h=[],p=c[u].batchIds,f=p.length;for(let t=0;t<f;++t){const n=p[t];if(n===e)continue;r[i[n]]<a?d.push(n):h.push(n)}0!==h.length&&c.push(new Vector3DTileBatch({color:Color.clone(c[u].color),offset:a+s,count:c[u].offset+c[u].count-(a+s),batchIds:h})),0!==d.length?(c[u].count=a-c[u].offset,c[u].batchIds=d):c.splice(u,1),this._batchDirty=!0},Vector3DTilePrimitive.prototype.update=function(e){const t=e.context;createVertexArray$4(this,t),createShaders$3(this,t),createRenderStates$4(this),createUniformMap$6(this,t);const i=e.passes;i.render&&(createColorCommands(this,t),createColorCommandsIgnoreShow(this,e),updateWireframe$2(this),this._debugWireframe?queueWireframeCommands(e,this._commands):queueCommands$2(this,e,this._commands,this._commandsIgnoreShow)),i.pick&&(createPickCommands(this),queueCommands$2(this,e,this._pickCommands))},Vector3DTilePrimitive.prototype.isDestroyed=function(){return!1},Vector3DTilePrimitive.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaSwap=this._vaSwap&&this._vaSwap.destroy(),destroyObject(this)};const boundingSphereCartesian3Scratch$1=new Cartesian3,ModelState$1=ModelUtility.ModelState;function ClassificationModel(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!(t instanceof Uint8Array))throw new RuntimeError("Only binary glTF is supported as a classifier.");t=parseGlb(t),updateVersion(t),addDefaults(t),processModelMaterialsCommon(t),processPbrMaterials(t),ForEach.buffer(t,(function(e){if(!defined(e.extras._pipeline.source))throw new RuntimeError("Buffer data must be embedded in the binary gltf.")}));const i=t.nodes,n=t.meshes,r=i[0].mesh;if(1!==i.length||!defined(r))throw new RuntimeError("Only one node is supported for classification and it must have a mesh.");if(1!==n.length)throw new RuntimeError("Only one mesh is supported when using b3dm for classification.");const o=n[0].primitives;if(1!==o.length)throw new RuntimeError("Only one primitive per mesh is supported when using b3dm for classification.");if(!defined(o[0].attributes.POSITION))throw new RuntimeError("The mesh must have a position attribute.");if(!defined(o[0].attributes._BATCHID))throw new RuntimeError("The mesh must have a batch id attribute.");this._gltf=t,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._ready=!1,this._readyPromise=defer(),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._classificationType=e.classificationType,this._vertexShaderLoaded=e.vertexShaderLoaded,this._classificationShaderLoaded=e.classificationShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._batchTable=e.batchTable,this._computedModelMatrix=new Matrix4,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState$1.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._dirty=!1,this._nodeMatrix=new Matrix4,this._primitive=void 0,this._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms=void 0,this._buffers={},this._vertexArray=void 0,this._shaderProgram=void 0,this._uniformMap=void 0,this._geometryByteLength=0,this._trianglesLength=0,this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0}function addBuffersToLoadResources$1(e){const t=e.gltf,i=e._loadResources;ForEach.buffer(t,(function(e,t){i.buffers[t]=e.extras._pipeline.source}))}function parseBufferViews$1(e){const t=e.gltf.bufferViews,i=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,(function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&i.enqueue(t)}));const n=e._loadResources.indexBuffersToCreate,r={};ForEach.accessor(e.gltf,(function(e){const i=e.bufferView;t[i].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(r[i])||(r[i]=!0,n.enqueue({id:i,componentType:e.componentType}))}))}function createVertexBuffer$3(e,t){const i=t._loadResources,n=t.gltf.bufferViews[e],r=i.getBuffer(n);t._buffers[e]=r,t._geometryByteLength+=r.byteLength}function createIndexBuffer$2(e,t,i){const n=i._loadResources,r=i.gltf.bufferViews[e],o={typedArray:n.getBuffer(r),indexDatatype:t};i._buffers[e]=o,i._geometryByteLength+=o.typedArray.byteLength}function createBuffers$1(e){const t=e._loadResources;if(0!==t.pendingBufferLoads)return;const i=t.vertexBuffersToCreate,n=t.indexBuffersToCreate;for(;i.length>0;)createVertexBuffer$3(i.dequeue(),e);for(;n.length>0;){const t=n.dequeue();createIndexBuffer$2(t.id,t.componentType,e)}}function modifyShaderForQuantizedAttributes$1(e,t){const i=t.gltf.meshes[0].primitives[0],n=ModelUtility.modifyShaderForQuantizedAttributes(t.gltf,i,e);return t._quantizedUniforms=n.uniforms,n.shader}function modifyShader$1(e,t){return defined(t)&&(e=t(e)),e}function createProgram$1(e){const t=e.gltf,i=ModelUtility.getAttributeOrUniformBySemantic(t,"POSITION"),n=ModelUtility.getAttributeOrUniformBySemantic(t,"_BATCHID"),r={};r[i]=0,r[n]=1;const o=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEWPROJECTION");let a,s;if(defined(o))a=`uniform mat4 ${o};\n`,s=`${o} * vec4(${i}, 1.0)`;else{const e=ModelUtility.getAttributeOrUniformBySemantic(t,"PROJECTION");let n=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEW");defined(n)||(n=ModelUtility.getAttributeOrUniformBySemantic(t,"CESIUM_RTC_MODELVIEW")),a=`uniform mat4 ${n};\nuniform mat4 ${e};\n`,s=`${e} * ${n} * vec4(${i}, 1.0)`}let c=`attribute vec3 ${i};\nattribute float ${n};\n${a}void main() {\n${` vec4 positionInClipCoords = ${s};\n`} gl_Position = czm_depthClamp(positionInClipCoords);\n}\n`;e.extensionsUsed.WEB3D_quantized_attributes&&(c=modifyShaderForQuantizedAttributes$1(c,e));const l=modifyShader$1(c,e._vertexShaderLoaded),u=modifyShader$1("#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeDepthClamp();\n}\n",e._classificationShaderLoaded);e._shaderProgram={vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:r}}function getAttributeLocations$2(){return{POSITION:0,_BATCHID:1}}function createVertexArray$3(e){if(!e._loadResources.finishedBuffersCreation()||defined(e._vertexArray))return;const t=e._buffers,i=e.gltf,n=i.accessors,r=i.meshes[0].primitives[0],o=getAttributeLocations$2(),a={};let s;if(ForEach.meshPrimitiveAttribute(r,(function(e,r){const s=o[r];if(defined(s)){const o=n[e];a[r]={index:s,vertexBuffer:t[o.bufferView],componentsPerAttribute:numberOfComponentsForType(o.type),componentDatatype:o.componentType,offsetInBytes:o.byteOffset,strideInBytes:getAccessorByteStride(i,o)}}})),defined(r.indices)){const e=n[r.indices];s=t[e.bufferView]}e._vertexArray={attributes:a,indexBuffer:s}}Object.defineProperties(ClassificationModel.prototype,{gltf:{get:function(){return this._gltf}},boundingSphere:{get:function(){const e=this.modelMatrix,t=Matrix4.getScale(e,boundingSphereCartesian3Scratch$1),i=this._scaledBoundingSphere;return i.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,i.center),i.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,i.center,i.center),i}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},dirty:{get:function(){return this._dirty}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return 0}},classificationType:{get:function(){return this._classificationType}}});const gltfSemanticUniforms={PROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().PROJECTION(e,t)},MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEW(e,t)},CESIUM_RTC_MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().CESIUM_RTC_MODELVIEW(e,t)},MODELVIEWPROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEWPROJECTION(e,t)}};function createUniformMap$5(e,t){if(defined(e._uniformMap))return;const i={};ForEach.technique(e.gltf,(function(n){ForEach.techniqueUniform(n,(function(n,r){defined(n.semantic)&&defined(gltfSemanticUniforms[n.semantic])&&(i[r]=gltfSemanticUniforms[n.semantic](t.uniformState,e))}))})),e._uniformMap=i}function createUniformsForQuantizedAttributes$1(e,t){return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,e._quantizedUniforms)}function triangleCountFromPrimitiveIndices$1(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createPrimitive$2(e){const t=e._batchTable;let i=e._uniformMap;const n=e._vertexArray,r=e.gltf,o=r.accessors,a=r.meshes[0].primitives[0],s=o[a.indices],c=a.attributes.POSITION,l=ModelUtility.getAccessorMinMax(r,c),u=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(l.min),Cartesian3.fromArray(l.max));let d,h;if(defined(s))h=s.count,d=s.byteOffset/IndexDatatype$1.getSizeInBytes(s.componentType);else{h=o[a.attributes.POSITION].count,d=0}if(e._trianglesLength+=triangleCountFromPrimitiveIndices$1(a,h),defined(e._uniformMapLoaded)&&(i=e._uniformMapLoaded(i)),e.extensionsUsed.WEB3D_quantized_attributes){i=combine$2(i,createUniformsForQuantizedAttributes$1(e,a))}let p=n.attributes.POSITION,f=p.componentDatatype,m=p.vertexBuffer,g=m.byteOffset,_=m.byteLength/ComponentDatatype$1.getSizeInBytes(f),y=ComponentDatatype$1.createArrayBufferView(f,m.buffer,g,_);p=n.attributes._BATCHID,f=p.componentDatatype,m=p.vertexBuffer,g=m.byteOffset,_=m.byteLength/ComponentDatatype$1.getSizeInBytes(f);let C=ComponentDatatype$1.createArrayBufferView(f,m.buffer,g,_);const T=n.indexBuffer.typedArray;let S;S=n.indexBuffer.indexDatatype===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(T.buffer,T.byteOffset,T.byteLength/Uint16Array.BYTES_PER_ELEMENT):new Uint32Array(T.buffer,T.byteOffset,T.byteLength/Uint32Array.BYTES_PER_ELEMENT),y=arraySlice(y),C=arraySlice(C),S=arraySlice(S,d,d+h);const v=[],A=[],E=[],b=[];let x,P,D,w=C[S[0]];v.push(w),E.push(0);const M=S.length;for(let e=1;e<M;++e)x=C[S[e]],x!==w&&(P=E[E.length-1],D=e-P,v.push(x),A.push(D),E.push(e),b.push(new Vector3DTileBatch({offset:P,count:D,batchIds:[w],color:Color.WHITE})),w=x);P=E[E.length-1],D=M-P,A.push(D),b.push(new Vector3DTileBatch({offset:P,count:D,batchIds:[w],color:Color.WHITE}));const I=e._shaderProgram,R=I.vertexShaderSource,O=I.fragmentShaderSource,B=I.attributeLocations,L=defined(e._pickIdLoaded)?e._pickIdLoaded():void 0;e._primitive=new Vector3DTilePrimitive({classificationType:e._classificationType,positions:y,indices:S,indexOffsets:E,indexCounts:A,batchIds:v,vertexBatchIds:C,batchedIndices:b,batchTable:t,boundingVolume:new BoundingSphere,_vertexShaderSource:R,_fragmentShaderSource:O,_attributeLocations:B,_uniformMap:i,_pickId:L,_modelMatrix:new Matrix4,_boundingSphere:u}),e._buffers=void 0,e._vertexArray=void 0,e._shaderProgram=void 0,e._uniformMap=void 0}function createRuntimeNodes$1(e){if(!e._loadResources.finished())return;if(defined(e._primitive))return;const t=e.gltf.nodes[0];e._nodeMatrix=ModelUtility.getTransform(t,e._nodeMatrix),createPrimitive$2(e)}function createResources$5(e,t){const i=t.context;ModelUtility.checkSupportedGlExtensions(e.gltf.glExtensionsUsed,i),createBuffers$1(e),createProgram$1(e),createVertexArray$3(e),createUniformMap$5(e,i),createRuntimeNodes$1(e)}const scratchComputedTranslation$2=new Cartesian4,scratchComputedMatrixIn2D$1=new Matrix4;function updateNodeModelMatrix(e,t,i,n){let r=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){const t=Matrix4.getColumn(r,3,scratchComputedTranslation$2);if(Cartesian4.equals(t,Cartesian4.UNIT_W)){const t=e.boundingSphere.center,i=Transforms.wgs84To2DModelMatrix(n,t,scratchComputedMatrixIn2D$1);r=Matrix4.multiply(i,r,scratchComputedMatrixIn2D$1),defined(e._rtcCenter)&&(Matrix4.setTranslation(r,Cartesian4.UNIT_W,r),e._rtcCenter=e._rtcCenter2D)}else r=Transforms.basisTo2D(n,r,scratchComputedMatrixIn2D$1),e._rtcCenter=e._rtcCenter3D}const o=e._primitive;(t||i)&&(Matrix4.multiplyTransformation(r,e._nodeMatrix,o._modelMatrix),BoundingSphere.transform(o._boundingSphere,o._modelMatrix,o._boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,o._boundingVolume.center,o._boundingVolume.center))}function ClippingPlane(e,t){this._distance=t,this._normal=new UpdateChangedCartesian3(e,this),this.onChangeCallback=void 0,this.index=-1}function UpdateChangedCartesian3(e,t){this._clippingPlane=t,this._cartesian3=Cartesian3.clone(e)}function ClippingPlaneCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=defaultValue(e.enabled,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.edgeColor=Color.clone(defaultValue(e.edgeColor,Color.WHITE)),this.edgeWidth=defaultValue(e.edgeWidth,0),this.planeAdded=new Event,this.planeRemoved=new Event,this._owner=void 0;const t=defaultValue(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?unionIntersectFunction:defaultIntersectFunction,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;const i=e.planes;if(defined(i)){const e=i.length;for(let t=0;t<e;++t)this.add(i[t])}}function unionIntersectFunction(e){return e===Intersect$1.OUTSIDE}function defaultIntersectFunction(e){return e===Intersect$1.INSIDE}function setIndexDirty(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||-1!==e._dirtyIndex&&e._dirtyIndex!==t,e._dirtyIndex=t}function indexOf$1(e,t){const i=e.length;for(let n=0;n<i;++n)if(Plane.equals(e[n],t))return n;return-1}ClassificationModel.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},ClassificationModel.prototype.update=function(e){if(e.mode===SceneMode$1.MORPHING)return;if(!FeatureDetection.supportsWebP.initialized)return void FeatureDetection.supportsWebP.initialize();const t=FeatureDetection.supportsWebP();if(this._state===ModelState$1.NEEDS_LOAD&&defined(this.gltf)&&(this._state=ModelState$1.LOADING,this._state!==ModelState$1.FAILED)){const t=this.gltf.extensions;if(defined(t)&&defined(t.CESIUM_RTC)){const i=Cartesian3.fromArray(t.CESIUM_RTC.center);if(!Cartesian3.equals(i,Cartesian3.ZERO)){this._rtcCenter3D=i;const t=e.mapProjection,n=t.ellipsoid.cartesianToCartographic(this._rtcCenter3D),r=t.project(n);Cartesian3.fromElements(r.z,r.x,r.y,r),this._rtcCenter2D=r,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}this._loadResources=new ModelLoadResources,ModelUtility.parseBuffers(this)}const i=this._loadResources;let n=!1;this._state===ModelState$1.LOADING&&(0===i.pendingBufferLoads&&(ModelUtility.checkSupportedExtensions(this.extensionsRequired,t),addBuffersToLoadResources$1(this),parseBufferViews$1(this),this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,createResources$5(this,e)),i.finished()&&(this._state=ModelState$1.LOADED,n=!0)),defined(i)&&this._state===ModelState$1.LOADED&&(n||createResources$5(this,e),i.finished()&&(this._loadResources=void 0));const r=this.show;if(r&&this._state===ModelState$1.LOADED||n){this._dirty=!1;const t=this.modelMatrix,i=e.mode!==this._mode;this._mode=e.mode;const r=!Matrix4.equals(this._modelMatrix,t)||i;if(r||n){Matrix4.clone(t,this._modelMatrix);const e=this._computedModelMatrix;Matrix4.clone(t,e),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(e,Axis$1.Y_UP_TO_Z_UP,e):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(e,Axis$1.X_UP_TO_Z_UP,e)}(r||n)&&(updateNodeModelMatrix(this,r,n,e.mapProjection),this._dirty=!0)}if(n){const t=this;e.afterRender.push((function(){t._ready=!0,t._readyPromise.resolve(t)}))}else r&&!this._ignoreCommands&&(this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.debugWireframe=this.debugWireframe,this._primitive.update(e))},ClassificationModel.prototype.isDestroyed=function(){return!1},ClassificationModel.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},Object.defineProperties(ClippingPlane.prototype,{distance:{get:function(){return this._distance},set:function(e){defined(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){defined(this.onChangeCallback)&&!Cartesian3.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),Cartesian3.clone(e,this._normal._cartesian3)}}}),ClippingPlane.fromPlane=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance):t=new ClippingPlane(e.normal,e.distance),t},ClippingPlane.clone=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance,t):new ClippingPlane(e.normal,e.distance)},Object.defineProperties(UpdateChangedCartesian3.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.x&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.x=e}},y:{get:function(){return this._cartesian3.y},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.y&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.y=e}},z:{get:function(){return this._cartesian3.z},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}}),Object.defineProperties(ClippingPlaneCollection.prototype,{length:{get:function(){return this._planes.length}},unionClippingRegions:{get:function(){return this._unionClippingRegions},set:function(e){this._unionClippingRegions!==e&&(this._unionClippingRegions=e,this._testIntersection=e?unionIntersectFunction:defaultIntersectFunction)}},enabled:{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e)}},texture:{get:function(){return this._clippingPlanesTexture}},owner:{get:function(){return this._owner}},clippingPlanesState:{get:function(){return this._unionClippingRegions?this._planes.length:-this._planes.length}}}),ClippingPlaneCollection.prototype.add=function(e){const t=this._planes.length,i=this;e.onChangeCallback=function(e){setIndexDirty(i,e)},e.index=t,setIndexDirty(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)},ClippingPlaneCollection.prototype.get=function(e){return this._planes[e]},ClippingPlaneCollection.prototype.contains=function(e){return-1!==indexOf$1(this._planes,e)},ClippingPlaneCollection.prototype.remove=function(e){const t=this._planes,i=indexOf$1(t,e);if(-1===i)return!1;e instanceof ClippingPlane&&(e.onChangeCallback=void 0,e.index=-1);const n=t.length-1;for(let e=i;e<n;++e){const i=t[e+1];t[e]=i,i instanceof ClippingPlane&&(i.index=e)}return this._multipleDirtyPlanes=!0,t.length=n,this.planeRemoved.raiseEvent(e,i),!0},ClippingPlaneCollection.prototype.removeAll=function(){const e=this._planes,t=e.length;for(let i=0;i<t;++i){const t=e[i];t instanceof ClippingPlane&&(t.onChangeCallback=void 0,t.index=-1),this.planeRemoved.raiseEvent(t,i)}this._multipleDirtyPlanes=!0,this._planes=[]};const distanceEncodeScratch=new Cartesian4,oct32EncodeScratch=new Cartesian4;function packPlanesAsUint8(e,t,i){const n=e._uint8View,r=e._planes;let o=0;for(let e=t;e<i;++e){const t=r[e],i=AttributeCompression.octEncodeToCartesian4(t.normal,oct32EncodeScratch);n[o]=i.x,n[o+1]=i.y,n[o+2]=i.z,n[o+3]=i.w;const a=Cartesian4.packFloat(t.distance,distanceEncodeScratch);n[o+4]=a.x,n[o+5]=a.y,n[o+6]=a.z,n[o+7]=a.w,o+=8}}function packPlanesAsFloats(e,t,i){const n=e._float32View,r=e._planes;let o=0;for(let e=t;e<i;++e){const t=r[e],i=t.normal;n[o]=i.x,n[o+1]=i.y,n[o+2]=i.z,n[o+3]=t.distance,o+=4}}function computeTextureResolution(e,t){const i=ContextLimits.maximumTextureSize;return t.x=Math.min(e,i),t.y=Math.ceil(e/t.x),t}const textureResolutionScratch$1=new Cartesian2;ClippingPlaneCollection.prototype.update=function(e){let t=this._clippingPlanesTexture;const i=e.context,n=ClippingPlaneCollection.useFloatTexture(i),r=n?this.length:2*this.length;if(defined(t)){const e=t.width*t.height;(e<r||r<.25*e)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(0===this.length)return;if(!defined(t)){const e=computeTextureResolution(r,textureResolutionScratch$1);e.y*=2,n?(t=new Texture({context:i,width:e.x,height:e.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:Sampler.NEAREST,flipY:!1}),this._float32View=new Float32Array(e.x*e.y*4)):(t=new Texture({context:i,width:e.x,height:e.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(e.x*e.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}const o=this._dirtyIndex;if(this._multipleDirtyPlanes||-1!==o){if(this._multipleDirtyPlanes)n?(packPlanesAsFloats(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(packPlanesAsUint8(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._uint8View}}));else{let e=0,i=0;n?(i=Math.floor(o/t.width),e=Math.floor(o-i*t.width),packPlanesAsFloats(this,o,o+1),t.copyFrom({source:{width:1,height:1,arrayBufferView:this._float32View},xOffset:e,yOffset:i})):(i=Math.floor(2*o/t.width),e=Math.floor(2*o-i*t.width),packPlanesAsUint8(this,o,o+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:e,yOffset:i}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}};const scratchMatrix$4=new Matrix4,scratchPlane=new Plane(Cartesian3.UNIT_X,0);ClippingPlaneCollection.prototype.computeIntersectionWithBoundingVolume=function(e,t){const i=this._planes,n=i.length;let r=this.modelMatrix;defined(t)&&(r=Matrix4.multiply(t,r,scratchMatrix$4));let o=Intersect$1.INSIDE;!this.unionClippingRegions&&n>0&&(o=Intersect$1.OUTSIDE);for(let t=0;t<n;++t){const n=i[t];Plane.transform(n,r,scratchPlane);const a=e.intersectPlane(scratchPlane);if(a===Intersect$1.INTERSECTING)o=a;else if(this._testIntersection(a))return a}return o},ClippingPlaneCollection.setOwner=function(e,t,i){e!==t[i]&&(t[i]=t[i]&&t[i].destroy(),defined(e)&&(e._owner=t,t[i]=e))},ClippingPlaneCollection.useFloatTexture=function(e){return e.floatingPointTexture},ClippingPlaneCollection.getTextureResolution=function(e,t,i){const n=e.texture;if(defined(n))return i.x=n.width,i.y=n.height,i;const r=computeTextureResolution(ClippingPlaneCollection.useFloatTexture(t)?e.length:2*e.length,i);return r.y*=2,r},ClippingPlaneCollection.prototype.isDestroyed=function(){return!1},ClippingPlaneCollection.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),destroyObject(this)};const ColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2,getColorBlend:function(e,t){return e===ColorBlendMode.HIGHLIGHT?0:e===ColorBlendMode.REPLACE?1:e===ColorBlendMode.MIX?CesiumMath.clamp(t,CesiumMath.EPSILON4,1):void 0}};var ColorBlendMode$1=Object.freeze(ColorBlendMode);function DracoLoader(){}function addBufferToLoadResources(e,t){const i=`runtime.${Object.keys(e.createdBufferViews).length}`,n=e.buffers,r=Object.keys(n).length;return n[r]=t,e.createdBufferViews[i]={buffer:r,byteOffset:0,byteLength:t.byteLength},i}function addNewVertexBuffer(e,t,i){const n=t._loadResources,r=addBufferToLoadResources(n,e);return n.vertexBuffersToCreate.enqueue(r),r}function addNewIndexBuffer(e,t,i){const n=e.typedArray,r=t._loadResources,o=addBufferToLoadResources(r,n);return r.indexBuffersToCreate.enqueue({id:o,componentType:ComponentDatatype$1.fromTypedArray(n)}),{bufferViewId:o,numberOfIndices:e.numberOfIndices}}function scheduleDecodingTask(e,t,i,n){if(!DracoLoader._taskProcessorReady)return;const r=i.primitivesToDecode.peek();if(!defined(r))return;const o=e.scheduleTask(r,[r.array.buffer]);return defined(o)?(i.activeDecodingTasks++,i.primitivesToDecode.dequeue(),o.then((function(e){i.activeDecodingTasks--;const n=addNewIndexBuffer(e.indexArray,t),o={},a=e.attributeData;for(const e in a)if(a.hasOwnProperty(e)){const i=a[e],n=addNewVertexBuffer(i.array,t),r=i.data;r.bufferView=n,o[e]=r}t._decodedData[`${r.mesh}.primitive.${r.primitive}`]={bufferView:n.bufferViewId,numberOfIndices:n.numberOfIndices,attributes:o}}))):void 0}function getClipAndStyleCode(e,t,i){return` float clipDistance = clip(gl_FragCoord, ${e}, ${t}); \n vec4 clippingPlanesEdgeColor = vec4(1.0); \n clippingPlanesEdgeColor.rgb = ${i}.rgb; \n float clippingPlanesEdgeWidth = ${i}.a; \n if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) \n { \n gl_FragColor = clippingPlanesEdgeColor;\n } \n`}DracoLoader._maxDecodingConcurrency=Math.max(FeatureDetection.hardwareConcurrency-1,1),DracoLoader._decoderTaskProcessor=void 0,DracoLoader._taskProcessorReady=!1,DracoLoader._getDecoderTaskProcessor=function(){if(!defined(DracoLoader._decoderTaskProcessor)){const e=new TaskProcessor("decodeDraco",DracoLoader._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then((function(){DracoLoader._taskProcessorReady=!0})),DracoLoader._decoderTaskProcessor=e}return DracoLoader._decoderTaskProcessor},DracoLoader.hasExtension=function(e){return defined(e.extensionsRequired.KHR_draco_mesh_compression)||defined(e.extensionsUsed.KHR_draco_mesh_compression)},DracoLoader._decodedModelResourceCache=void 0,DracoLoader.parse=function(e,t){if(!DracoLoader.hasExtension(e))return;const i=e._loadResources,n=e.cacheKey;if(defined(n)){defined(DracoLoader._decodedModelResourceCache)||(defined(t.cache.modelDecodingCache)||(t.cache.modelDecodingCache={}),DracoLoader._decodedModelResourceCache=t.cache.modelDecodingCache);const e=DracoLoader._decodedModelResourceCache[n];if(defined(e))return e.count++,void(i.pendingDecodingCache=!0)}const r=e._dequantizeInShader,o=e.gltf;ForEach.mesh(o,(function(e,t){ForEach.meshPrimitive(e,(function(e,n){if(!defined(e.extensions))return;const a=e.extensions.KHR_draco_mesh_compression;if(!defined(a))return;const s=o.bufferViews[a.bufferView],c=arraySlice(o.buffers[s.buffer].extras._pipeline.source,s.byteOffset,s.byteOffset+s.byteLength);i.primitivesToDecode.enqueue({mesh:t,primitive:n,array:c,bufferView:s,compressedAttributes:a.attributes,dequantizeInShader:r})}))}))},DracoLoader.decodeModel=function(e,t){if(!DracoLoader.hasExtension(e))return Promise.resolve();const i=e._loadResources,n=e.cacheKey;if(defined(n)&&defined(DracoLoader._decodedModelResourceCache)){const t=DracoLoader._decodedModelResourceCache[n];if(defined(t)&&i.pendingDecodingCache)return Promise.resolve(t.ready).then((function(){e._decodedData=t.data,i.pendingDecodingCache=!1}));DracoLoader._decodedModelResourceCache[n]={ready:!1,count:1,data:void 0}}if(0===i.primitivesToDecode.length)return Promise.resolve();const r=DracoLoader._getDecoderTaskProcessor(),o=[];let a=scheduleDecodingTask(r,e,i);for(;defined(a);)o.push(a),a=scheduleDecodingTask(r,e,i);return Promise.all(o)},DracoLoader.decodePointCloud=function(e){const t=DracoLoader._getDecoderTaskProcessor();if(DracoLoader._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])},DracoLoader.decodeBufferView=function(e){const t=DracoLoader._getDecoderTaskProcessor();if(DracoLoader._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])},DracoLoader.cacheDataForModel=function(e){const t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){const i=DracoLoader._decodedModelResourceCache[t];defined(i)&&(i.ready=!0,i.data=e._decodedData)}},DracoLoader.destroyCachedDataForModel=function(e){const t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){const e=DracoLoader._decodedModelResourceCache[t];defined(e)&&0==--e.count&&delete DracoLoader._decodedModelResourceCache[t]}};const textureResolutionScratch=new Cartesian2;function getClippingFunction(e,t){const i=e.unionClippingRegions,n=e.length,r=ClippingPlaneCollection.useFloatTexture(t),o=ClippingPlaneCollection.getTextureResolution(e,t,textureResolutionScratch),a=o.x,s=o.y;let c=r?getClippingPlaneFloat$1(a,s):getClippingPlaneUint8$1(a,s);return c+="\n",c+=i?clippingFunctionUnion(n):clippingFunctionIntersect$1(n),c}function clippingFunctionUnion(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount;\n float pixelWidth = czm_metersPerPixel(position);\n bool breakAndDiscard = false;\n for (int i = 0; i < ${e}; ++i)\n {\n vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));\n if (amount <= 0.0)\n {\n breakAndDiscard = true;\n break;\n }\n }\n if (breakAndDiscard) {\n discard;\n }\n return clipAmount;\n}\n`}function clippingFunctionIntersect$1(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n bool clipped = true;\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount = 0.0;\n float pixelWidth = czm_metersPerPixel(position);\n for (int i = 0; i < ${e}; ++i)\n {\n vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n clipAmount = max(amount, clipAmount);\n clipped = clipped && (amount <= 0.0);\n }\n if (clipped)\n {\n discard;\n }\n return clipAmount;\n}\n`}function getClippingPlaneFloat$1(e,t){const i=1/t;let n=`${1/e}`;-1===n.indexOf(".")&&(n+=".0");let r=`${i}`;-1===r.indexOf(".")&&(r+=".0");return`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int pixY = clippingPlaneNumber / ${e};\n int pixX = clippingPlaneNumber - (pixY * ${e});\n float u = (float(pixX) + 0.5) * ${n};\n float v = (float(pixY) + 0.5) * ${r};\n vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n`}function getClippingPlaneUint8$1(e,t){const i=1/t;let n=`${1/e}`;-1===n.indexOf(".")&&(n+=".0");let r=`${i}`;-1===r.indexOf(".")&&(r+=".0");return`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n int pixY = clippingPlaneStartIndex / ${e};\n int pixX = clippingPlaneStartIndex - (pixY * ${e});\n float u = (float(pixX) + 0.5) * ${n};\n float v = (float(pixY) + 0.5) * ${r};\n vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;\n vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);\n vec4 plane;\n plane.xyz = czm_octDecode(oct, 65535.0);\n plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + ${n}, v)));\n return czm_transformPlane(plane, transform);\n}\n`}const JobType={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3};var JobType$1=Object.freeze(JobType);function ModelAnimationCache(){}const dataUriRegex=/^data\:/i;function getAccessorKey(e,t){const i=e.gltf,n=i.buffers,r=i.bufferViews[t.bufferView],o=n[r.buffer],a=r.byteOffset+t.byteOffset,s=t.count*numberOfComponentsForType(t.type),c=dataUriRegex.test(o.uri)?"":o.uri;return`${e.cacheKey}//${c}/${a}/${s}`}const cachedAnimationParameters={};ModelAnimationCache.getAnimationParameterValues=function(e,t){const i=getAccessorKey(e,t);let n=cachedAnimationParameters[i];if(!defined(n)){const r=e.gltf,o=r.buffers,a=r.bufferViews[t.bufferView],s=o[a.buffer].extras._pipeline.source,c=t.componentType,l=t.type,u=numberOfComponentsForType(l),d=t.count,h=getAccessorByteStride(r,t);n=new Array(d);const p=defaultValue(t.byteOffset,0);let f=a.byteOffset+p;for(let e=0;e<d;e++){const t=ComponentDatatype$1.createArrayBufferView(c,s.buffer,s.byteOffset+f,u);"SCALAR"===l?n[e]=t[0]:"VEC3"===l?n[e]=Cartesian3.fromArray(t):"VEC4"===l&&(n[e]=Quaternion.unpack(t)),f+=h}defined(e.cacheKey)&&(cachedAnimationParameters[i]=n)}return n};const cachedAnimationSplines={};function getAnimationSplineKey(e,t,i){return`${e.cacheKey}//${t}/${i}`}function ConstantSpline(e){this._value=e}function SteppedSpline(e){this._spline=e,this._lastTimeIndex=0}ConstantSpline.prototype.evaluate=function(e,t){return this._value},ConstantSpline.prototype.wrapTime=function(e){return 0},ConstantSpline.prototype.clampTime=function(e){return 0},SteppedSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,SteppedSpline.prototype.evaluate=function(e,t){const i=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),n=this._spline.times,r=e>=n[i+1]?n[i+1]:n[i];return this._spline.evaluate(r,t)},Object.defineProperties(SteppedSpline.prototype,{times:{get:function(){return this._spline.times}}}),SteppedSpline.prototype.wrapTime=function(e){return this._spline.wrapTime(e)},SteppedSpline.prototype.clampTime=function(e){return this._spline.clampTime(e)},ModelAnimationCache.getAnimationSpline=function(e,t,i,n,r,o,a,s){const c=getAnimationSplineKey(e,t,n);let l=cachedAnimationSplines[c];if(!defined(l)){const t=o,i=s;1===t.length&&1===i.length?l=new ConstantSpline(i[0]):"LINEAR"!==r.interpolation&&"STEP"!==r.interpolation||("translation"===a||"scale"===a?l=new LinearSpline({times:t,points:i}):"rotation"===a?l=new QuaternionSpline({times:t,points:i}):"weights"===a&&(l=new WeightSpline({times:t,weights:i})),defined(l)&&"STEP"===r.interpolation&&(l=new SteppedSpline(l))),defined(e.cacheKey)&&(cachedAnimationSplines[c]=l)}return l};const cachedSkinInverseBindMatrices={};ModelAnimationCache.getSkinInverseBindMatrices=function(e,t){const i=getAccessorKey(e,t);let n=cachedSkinInverseBindMatrices[i];if(!defined(n)){const r=e.gltf,o=r.buffers,a=r.bufferViews[t.bufferView],s=o[a.buffer].extras._pipeline.source,c=t.componentType,l=t.type,u=t.count,d=getAccessorByteStride(r,t);let h=a.byteOffset+t.byteOffset;const p=numberOfComponentsForType(l);if(n=new Array(u),c===WebGLConstants$1.FLOAT&&l===AttributeType$1.MAT4)for(let e=0;e<u;++e){const t=ComponentDatatype$1.createArrayBufferView(c,s.buffer,s.byteOffset+h,p);n[e]=Matrix4.fromArray(t),h+=d}cachedSkinInverseBindMatrices[i]=n}return n};const ModelAnimationLoop={NONE:0,REPEAT:1,MIRRORED_REPEAT:2};var ModelAnimationLoop$1=Object.freeze(ModelAnimationLoop),ModelAnimationState=Object.freeze({STOPPED:0,ANIMATING:1});function ModelAnimation(e,t,i){this._name=i.name,this._startTime=JulianDate.clone(e.startTime),this._delay=defaultValue(e.delay,0),this._stopTime=e.stopTime,this.removeOnStop=defaultValue(e.removeOnStop,!1),this._multiplier=defaultValue(e.multiplier,1),this._reverse=defaultValue(e.reverse,!1),this._loop=defaultValue(e.loop,ModelAnimationLoop$1.NONE),this.start=new Event,this.update=new Event,this.stop=new Event,this._state=ModelAnimationState.STOPPED,this._runtimeAnimation=i,this._computedStartTime=void 0,this._duration=void 0;const n=this;this._raiseStartEvent=function(){n.start.raiseEvent(t,n)},this._updateEventTime=0,this._raiseUpdateEvent=function(){n.update.raiseEvent(t,n,n._updateEventTime)},this._raiseStopEvent=function(){n.stop.raiseEvent(t,n)}}function ModelAnimationCollection(e){this.animationAdded=new Event,this.animationRemoved=new Event,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}function add(e,t,i){const n=e._model,r=new ModelAnimation(i,n,n._runtime.animations[t]);return e._scheduledAnimations.push(r),e.animationAdded.raiseEvent(n,r),r}function animateChannels(e,t){const i=e.channelEvaluators,n=i.length;for(let e=0;e<n;++e)i[e](t)}Object.defineProperties(ModelAnimation.prototype,{name:{get:function(){return this._name}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}}}),Object.defineProperties(ModelAnimationCollection.prototype,{length:{get:function(){return this._scheduledAnimations.length}}}),ModelAnimationCollection.prototype.add=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=this._model._runtime.animations;if(defined(e.index))return add(this,e.index,e);let i;const n=t.length;for(let r=0;r<n;++r)if(t[r].name===e.name){i=r;break}return add(this,i,e)},ModelAnimationCollection.prototype.addAll=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=[],i=this._model._runtime.animations.length;for(let n=0;n<i;++n)t.push(add(this,n,e));return t},ModelAnimationCollection.prototype.remove=function(e){if(defined(e)){const t=this._scheduledAnimations,i=t.indexOf(e);if(-1!==i)return t.splice(i,1),this.animationRemoved.raiseEvent(this._model,e),!0}return!1},ModelAnimationCollection.prototype.removeAll=function(){const e=this._model,t=this._scheduledAnimations,i=t.length;this._scheduledAnimations=[];for(let n=0;n<i;++n)this.animationRemoved.raiseEvent(e,t[n])},ModelAnimationCollection.prototype.contains=function(e){return!!defined(e)&&-1!==this._scheduledAnimations.indexOf(e)},ModelAnimationCollection.prototype.get=function(e){return this._scheduledAnimations[e]};const animationsToRemove=[];function createAnimationRemovedFunction(e,t,i){return function(){e.animationRemoved.raiseEvent(t,i)}}function ModelMaterial(e,t,i){this._name=t.name,this._id=i,this._uniformMap=e._uniformMaps[i],this._technique=void 0,this._program=void 0,this._values=void 0}function ModelMesh(e,t,i){const n=[],r=e.primitives,o=r.length;for(let e=0;e<o;++e){const i=r[e];n[e]=t[i.material]}this._name=e.name,this._materials=n,this._id=i}function ModelNode(e,t,i,n,r){this._model=e,this._runtimeNode=i,this._name=t.name,this._id=n,this.useMatrix=!1,this._show=!0,this._matrix=Matrix4.clone(r),this._originalMatrix=Matrix4.clone(r)}ModelAnimationCollection.prototype.update=function(e){const t=this._scheduledAnimations;let i=t.length;if(0===i)return this._previousTime=void 0,!1;if(JulianDate.equals(e.time,this._previousTime))return!1;this._previousTime=JulianDate.clone(e.time,this._previousTime);let n=!1;const r=e.time,o=this._model;for(let o=0;o<i;++o){const i=t[o],a=i._runtimeAnimation;defined(i._computedStartTime)||(i._computedStartTime=JulianDate.addSeconds(defaultValue(i.startTime,r),i.delay,new JulianDate)),defined(i._duration)||(i._duration=a.stopTime*(1/i.multiplier));const s=i._computedStartTime,c=i._duration,l=i.stopTime;let u=0!==c?JulianDate.secondsDifference(r,s)/c:0;0!==c&&defined(l)&&JulianDate.greaterThan(r,l)&&(u=JulianDate.secondsDifference(l,s)/c);const d=u>=0,h=i.loop===ModelAnimationLoop$1.REPEAT||i.loop===ModelAnimationLoop$1.MIRRORED_REPEAT,p=(d||h&&!defined(i.startTime))&&(u<=1||h)&&(!defined(l)||JulianDate.lessThanOrEquals(r,l));if(p||i._state===ModelAnimationState.ANIMATING){if(p&&i._state===ModelAnimationState.STOPPED&&(i._state=ModelAnimationState.ANIMATING,i.start.numberOfListeners>0&&e.afterRender.push(i._raiseStartEvent)),i.loop===ModelAnimationLoop$1.REPEAT)u-=Math.floor(u);else if(i.loop===ModelAnimationLoop$1.MIRRORED_REPEAT){const e=Math.floor(u),t=u-e;u=e%2==1?1-t:t}i.reverse&&(u=1-u);let t=u*c*i.multiplier;t=CesiumMath.clamp(t,a.startTime,a.stopTime),animateChannels(a,t),i.update.numberOfListeners>0&&(i._updateEventTime=t,e.afterRender.push(i._raiseUpdateEvent)),n=!0,p||(i._state=ModelAnimationState.STOPPED,i.stop.numberOfListeners>0&&e.afterRender.push(i._raiseStopEvent),i.removeOnStop&&animationsToRemove.push(i))}}i=animationsToRemove.length;for(let n=0;n<i;++n){const i=animationsToRemove[n];t.splice(t.indexOf(i),1),e.afterRender.push(createAnimationRemovedFunction(this,o,i))}return animationsToRemove.length=0,n},Object.defineProperties(ModelMaterial.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}}}),ModelMaterial.prototype.setValue=function(e,t){const i=`u_${e}`,n=this._uniformMap.values[i];n.value=n.clone(t,n.value)},ModelMaterial.prototype.getValue=function(e){const t=`u_${e}`,i=this._uniformMap.values[t];if(defined(i))return i.value},Object.defineProperties(ModelMesh.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),Object.defineProperties(ModelNode.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=Matrix4.clone(e,this._matrix),this.useMatrix=!0;const t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}},originalMatrix:{get:function(){return this._originalMatrix}}}),ModelNode.prototype.setMatrix=function(e){Matrix4.clone(e,this._matrix)};const MAX_GLTF_UINT16_INDEX=65534;function ModelOutlineLoader(){}function addOutline(e,t,i,n,r){const o=r.vertexCopies,a=r.extraVertices,s=r.outlineCoordinates,c=e.gltf,l=c.meshes[t].primitives[i],u=c.accessors,d=c.bufferViews;let h;for(const e in l.attributes)if(l.attributes.hasOwnProperty(e)){const t=u[l.attributes[e]];if(defined(t)){h=t.count;break}}if(!defined(h))return;const p=u[l.indices],f=d[p.bufferView],m=u[n],g=d[m.bufferView],_=e._loadResources,y=_.getBuffer(f),C=_.getBuffer(g);let T=5123===p.componentType?new Uint16Array(y.buffer,y.byteOffset+p.byteOffset,p.count):new Uint32Array(y.buffer,y.byteOffset+p.byteOffset,p.count);const S=5123===m.componentType?new Uint16Array(C.buffer,C.byteOffset+m.byteOffset,m.count):new Uint32Array(C.buffer,C.byteOffset+m.byteOffset,m.count),v=h,A=[v];let E;for(E=0;E<S.length;E+=2){const e=S[E],t=S[E+1];A[Math.min(e,t)*v+Math.max(e,t)]=1}for(E=0;E<T.length;E+=3){let t=T[E],i=T[E+1],n=T[E+2];const r=isHighlighted(A,t,i),l=isHighlighted(A,i,n),u=isHighlighted(A,n,t);let d=matchAndStoreCoordinates(s,t,i,n,r,l,u);for(;d>=0;){let m;if(m=d===t?o[t]:d===i?o[i]:o[n],void 0===m){m=h+a.length;let e=d;for(;e>=h;)e=a[e-h];a.push(e),o[d]=m}m>MAX_GLTF_UINT16_INDEX&&T instanceof Uint16Array&&(T=new Uint32Array(T),p.componentType=5125,f.buffer=c.buffers.push({byteLength:T.byteLength,extras:{_pipeline:{source:T.buffer}}})-1,f.byteLength=T.byteLength,f.byteOffset=0,e._loadResources.buffers[f.buffer]=new Uint8Array(T.buffer,0,T.byteLength),_.indexBuffersToCreate._array.forEach((function(e){e.id===p.bufferView&&(e.componentType=p.componentType)}))),d===t?(t=m,T[E]=m):d===i?(i=m,T[E+1]=m):(n=m,T[E+2]=m),defined(p.max)&&(p.max[0]=Math.max(p.max[0],m)),d=matchAndStoreCoordinates(s,t,i,n,r,l,u)}}}function computeOrderMask(e,t,i,n,r){const o=3*t,a=e[o],s=e[o+1],c=e[o+2];return void 0===a?63:((a===i&&s===n&&c===r)<<0)+((a===i&&s===r&&c===n)<<1)+((a===n&&s===i&&c===r)<<2)+((a===n&&s===r&&c===i)<<3)+((a===r&&s===i&&c===n)<<4)+((a===r&&s===n&&c===i)<<5)}function popcount0to63(e){return(1&e)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}function matchAndStoreCoordinates(e,t,i,n,r,o,a){const s=a?1:0,c=r?1:0,l=computeOrderMask(e,t,s,c,0);if(0===l)return t;const u=r?1:0,d=o?1:0,h=computeOrderMask(e,i,0,u,d);if(0===h)return i;const p=a?1:0,f=o?1:0,m=computeOrderMask(e,n,p,0,f);if(0===m)return n;const g=l&h&m;let _,y,C;if(1&g)_=0,y=1,C=2;else if(2&g)_=0,C=1,y=2;else if(4&g)y=0,_=1,C=2;else if(8&g)y=0,C=1,_=2;else if(16&g)C=0,_=1,y=2;else{if(!(32&g)){const e=popcount0to63(l),r=popcount0to63(h),o=popcount0to63(m);return e<r&&e<o?t:r<o?i:n}C=0,y=1,_=2}const T=3*t;e[T+_]=s,e[T+y]=c,e[T+C]=0;const S=3*i;e[S+_]=0,e[S+y]=u,e[S+C]=d;const v=3*n;return e[v+_]=p,e[v+y]=0,e[v+C]=f,-1}function isHighlighted(e,t,i){const n=e[0];return 1===e[Math.min(t,i)*n+Math.max(t,i)]}function createTexture$3(e){const t=new Uint8Array(e);return t[e-1]=192,8===e?t[e-1]=96:4===e?t[e-1]=48:2===e?t[e-1]=24:1===e&&(t[e-1]=12),t}function updateBufferViewsWithNewVertices(e,t){const i=e.gltf,n=e._loadResources;let r,o;for(r=0;r<t.length;++r){const a=t[r],s=a.extras._pipeline.vertexNumberingScope;a.extras._pipeline.vertexNumberingScope=void 0;const c=s.extraVertices,l=n.getBuffer(a),u=a.byteStride||4,d=c.length,h=new Uint8Array(l.byteLength+d*u);for(h.set(l),o=0;o<d;++o){const e=c[o]*u,t=l.length+o*u;for(let i=0;i<u;++i)h[t+i]=h[e+i]}a.byteOffset=0,a.byteLength=h.byteLength;const p=i.buffers.push({byteLength:h.byteLength,extras:{_pipeline:{source:h.buffer}}})-1;a.buffer=p,n.buffers[p]=h;const f=s.accessors;for(o=0;o<f.length;++o){const e=f[o];i.accessors[e].count+=d}if(!s.createdOutlines){const t=s.outlineCoordinates,i=new Float32Array(t),r=e.gltf.buffers.push({byteLength:i.byteLength,extras:{_pipeline:{source:i.buffer}}})-1;n.buffers[r]=new Uint8Array(i.buffer,0,i.byteLength);const a=e.gltf.bufferViews.push({buffer:r,byteLength:i.byteLength,byteOffset:0,byteStride:3*Float32Array.BYTES_PER_ELEMENT,target:34962})-1,c=e.gltf.accessors.push({bufferView:a,byteOffset:0,componentType:5126,count:i.length/3,type:"VEC3",min:[0,0,0],max:[1,1,1]})-1,l=s.primitives;for(o=0;o<l.length;++o)l[o].attributes._OUTLINE_COORDINATES=c;n.vertexBuffersToCreate.enqueue(a),s.createdOutlines=!0}}}function compactBuffers(e){const t=e.gltf,i=e._loadResources;let n;for(n=0;n<t.buffers.length;++n){const e=t.buffers[n],r=t.bufferViews.filter(usesBuffer.bind(void 0,n)),o=r.reduce((function(e,t){return e+t.byteLength}),0);if(o===e.byteLength)continue;const a=new Uint8Array(o);let s=0;for(let e=0;e<r.length;++e){const t=r[e],n=i.getBuffer(t);a.set(n,s),t.byteOffset=s,s+=n.byteLength}i.buffers[n]=a,e.extras._pipeline.source=a.buffer,e.byteLength=o}}function usesBuffer(e,t){return t.buffer===e}function getVertexNumberingScope(e,t){const i=t.attributes;if(void 0===i)return;const n=e.gltf;let r;for(const e in i){if(!i.hasOwnProperty(e))continue;const t=i[e],o=n.accessors[t].bufferView,a=n.bufferViews[o];if(defined(a.extras)||(a.extras={}),defined(a.extras._pipeline)||(a.extras._pipeline={}),defined(a.extras._pipeline.vertexNumberingScope)){if(void 0!==r&&a.extras._pipeline.vertexNumberingScope!==r)return}else a.extras._pipeline.vertexNumberingScope=r||{vertexCopies:[],extraVertices:[],outlineCoordinates:[],accessors:[],bufferViews:[],primitives:[],createdOutlines:!1};r=a.extras._pipeline.vertexNumberingScope,r.bufferViews.indexOf(a)<0&&r.bufferViews.push(a),r.accessors.indexOf(t)<0&&r.accessors.push(t)}return r.primitives.push(t),r}ModelOutlineLoader.hasExtension=function(e){return defined(e.extensionsRequired.CESIUM_primitive_outline)||defined(e.extensionsUsed.CESIUM_primitive_outline)},ModelOutlineLoader.outlinePrimitives=function(e){if(!ModelOutlineLoader.hasExtension(e))return;const t=e.gltf,i=[];ForEach.mesh(t,(function(t,n){ForEach.meshPrimitive(t,(function(t,r){if(!defined(t.extensions))return;const o=t.extensions.CESIUM_primitive_outline;if(!defined(o))return;const a=getVertexNumberingScope(e,t);void 0!==a&&(i.indexOf(a)<0&&i.push(a),addOutline(e,n,r,o.indices,a))}))}));for(let t=0;t<i.length;++t)updateBufferViewsWithNewVertices(e,i[t].bufferViews);compactBuffers(e)},ModelOutlineLoader.createTexture=function(e,t){let i=t.cache.modelOutliningCache;if(defined(i)||(i=t.cache.modelOutliningCache={}),defined(i.outlineTexture))return i.outlineTexture;const n=Math.min(4096,ContextLimits.maximumTextureSize);let r=n;const o=createTexture$3(r),a=[];for(;r>1;)r>>=1,a.push(createTexture$3(r));const s=new Texture({context:t,source:{arrayBufferView:o,mipLevels:a},width:n,height:1,pixelFormat:PixelFormat$1.LUMINANCE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})});return i.outlineTexture=s,s};const SplitDirection={LEFT:-1,NONE:0,RIGHT:1};var SplitDirection$1=Object.freeze(SplitDirection);const Splitter={modifyFragmentShader:function(e){return e=ShaderSource.replaceMain(e,"czm_splitter_main"),e+="uniform float czm_splitDirection; \nvoid main() \n{ \n#ifndef SHADOW_MAP\n if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard; \n if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard; \n#endif\n czm_splitter_main(); \n} \n"},addUniforms:function(e,t){t.czm_splitDirection=function(){return e.splitDirection}}},boundingSphereCartesian3Scratch=new Cartesian3,ModelState=ModelUtility.ModelState,defaultModelAccept="model/gltf-binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01",articulationEpsilon=CesiumMath.EPSILON16;function setCachedGltf(e,t){e._cachedGltf=t}function CachedGltf(e){this._gltf=e.gltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}Object.defineProperties(CachedGltf.prototype,{gltf:{set:function(e){this._gltf=e},get:function(){return this._gltf}}}),CachedGltf.prototype.makeReady=function(e){this.gltf=e;const t=this.modelsToLoad,i=t.length;for(let e=0;e<i;++e){const i=t[e];i.isDestroyed()||setCachedGltf(i,this)}this.modelsToLoad=void 0,this.ready=!0};const gltfCache={},uriToGuid={};function Model(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).cacheKey;let i;if(this._cacheKey=t,this._cachedGltf=void 0,this._releaseGltfJson=defaultValue(e.releaseGltfJson,!1),defined(t)&&defined(gltfCache[t])&&gltfCache[t].ready)i=gltfCache[t],++i.count;else{let n=e.gltf;if(defined(n)){if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),n instanceof Uint8Array){i=new CachedGltf({gltf:parseGlb(n),ready:!0})}else i=new CachedGltf({gltf:e.gltf,ready:!0});i.count=1,defined(t)&&(gltfCache[t]=i)}}setCachedGltf(this,i);const n=defaultValue(e.basePath,"");this._resource=Resource.createIfNeeded(n);let r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=defaultValue(e.showCreditsOnScreen,!1),this.show=defaultValue(e.show,!0),this.silhouetteColor=defaultValue(e.silhouetteColor,Color.RED),this._silhouetteColor=new Color,this._silhouetteColorPreviousAlpha=1,this._normalAttributeName=void 0,this.silhouetteSize=defaultValue(e.silhouetteSize,0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._clampedModelMatrix=void 0,this.scale=defaultValue(e.scale,1),this._scale=this.scale,this.minimumPixelSize=defaultValue(e.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=e.maximumScale,this._maximumScale=this.maximumScale,this.id=e.id,this._id=e.id,this.heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._heightReference=this.heightReference,this._heightChanged=!1,this._removeUpdateHeightCallback=void 0;const o=e.scene;this._scene=o,defined(o)&&defined(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener((function(){this._heightChanged=!0}),this)),this._pickObject=e.pickObject,this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=defer(),this.activeAnimations=new ModelAnimationCollection(this),this.clampAnimations=defaultValue(e.clampAnimations,!0),this._defaultTexture=void 0,this._incrementallyLoadTextures=defaultValue(e.incrementallyLoadTextures,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this._colorPreviousAlpha=1,this.colorBlendMode=defaultValue(e.colorBlendMode,ColorBlendMode$1.HIGHLIGHT),this.colorBlendAmount=defaultValue(e.colorBlendAmount,.5),this._colorShadingEnabled=!1,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._clippingPlanesState=0,this.referenceMatrix=void 0,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this.showOutline=defaultValue(e.showOutline,!0),this.splitDirection=defaultValue(e.splitDirection,SplitDirection$1.NONE),this._splittingEnabled=!1,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._distanceDisplayCondition=e.distanceDisplayCondition,this._addBatchIdToGeneratedShaders=e.addBatchIdToGeneratedShaders,this._precreatedAttributes=e.precreatedAttributes,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._requestType=e.requestType,this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._gltfForwardAxis=Axis$1.Z,this._forwardAxis=e.forwardAxis,this.cull=defaultValue(e.cull,!0),this.opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._computedModelMatrix=new Matrix4,this._clippingPlanesMatrix=Matrix4.clone(Matrix4.IDENTITY),this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,articulationsByName:void 0,articulationsByStageKey:void 0,stagesByKey:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms={},this._programPrimitives={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},sourceShaders:{},silhouettePrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._dequantizeInShader=defaultValue(e.dequantizeInShader,!0),this._decodedData={},this._cachedGeometryByteLength=0,this._cachedTexturesByteLength=0,this._geometryByteLength=0,this._texturesByteLength=0,this._trianglesLength=0,this._pointsLength=0,this._sourceTechniques={},this._sourcePrograms={},this._quantizedVertexShaders={},this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0,this._sourceVersion=void 0,this._sourceKHRTechniquesWebGL=void 0,this._lightColor=Cartesian3.clone(e.lightColor);const a=defined(e.imageBasedLightingFactor)||defined(e.luminanceAtZenith)||defined(e.sphericalHarmonicCoefficients)||defined(e.specularEnvironmentMaps);defined(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):a?(deprecationWarning("ImageBasedLightingConstructor","Individual image-based lighting parameters were deprecated in Cesium 1.92. They will be removed in version 1.94. Use options.imageBasedLighting instead."),this._imageBasedLighting=new ImageBasedLighting({imageBasedLightingFactor:e.imageBasedLightingFactor,luminanceAtZenith:e.luminanceAtZenith,sphericalHarmonicCoefficients:e.sphericalHarmonicCoefficients,specularEnvironmentMaps:e.specularEnvironmentMaps}),this._shouldDestroyImageBasedLighting=!0):(this._imageBasedLighting=new ImageBasedLighting,this._shouldDestroyImageBasedLighting=!0),this._shouldRegenerateShaders=!1}function silhouetteSupported(e){return e.stencilBuffer}function isColorShadingEnabled(e){return!Color.equals(e.color,Color.WHITE)||e.colorBlendMode!==ColorBlendMode$1.HIGHLIGHT}function isClippingEnabled(e){const t=e._clippingPlanes;return defined(t)&&t.enabled&&0!==t.length}function containsGltfMagic(e){return"glTF"===getMagic(e)}function getRuntime(e,t,i){return e._runtime[t][i]}Object.defineProperties(Model.prototype,{gltf:{get:function(){return defined(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._resource.url}},boundingSphere:{get:function(){let e=this.modelMatrix;this.heightReference!==HeightReference$1.NONE&&this._clampedModelMatrix&&(e=this._clampedModelMatrix);const t=Matrix4.getScale(e,boundingSphereCartesian3Scratch),i=defined(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;Cartesian3.multiplyByScalar(t,i,t);const n=this._scaledBoundingSphere;return n.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,n.center),n.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,n.center,n.center),n}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},pendingTextureLoads:{get:function(){return defined(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition)}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},forwardAxis:{get:function(){return defined(this._forwardAxis)?this._forwardAxis:this._gltfForwardAxis}},trianglesLength:{get:function(){return this._trianglesLength}},pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return this._texturesByteLength}},cachedGeometryByteLength:{get:function(){return this._cachedGeometryByteLength}},cachedTexturesByteLength:{get:function(){return this._cachedTexturesByteLength}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},pickIds:{get:function(){return this._pickIds}},lightColor:{get:function(){return this._lightColor},set:function(e){const t=this._lightColor;e===t||Cartesian3.equals(e,t)||(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(t)&&!defined(e)||defined(e)&&!defined(t),this._lightColor=Cartesian3.clone(e,t))}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,this._shouldRegenerateShaders=!0)}},imageBasedLightingFactor:{get:function(){return this._imageBasedLighting.imageBasedLightingFactor},set:function(e){this._imageBasedLighting.imageBasedLightingFactor=e}},luminanceAtZenith:{get:function(){return this._imageBasedLighting.luminanceAtZenith},set:function(e){this._imageBasedLighting.luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._imageBasedLighting.sphericalHarmonicCoefficients},set:function(e){this._imageBasedLighting.sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._imageBasedLighting.specularEnvironmentMaps},set:function(e){this._imageBasedLighting.specularEnvironmentMaps=e}},credit:{get:function(){return this._credit}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){if(this._showCreditsOnScreen!==e){defined(this._credit)&&(this._credit.showOnScreen=e);const t=this._resourceCredits.length;for(let i=0;i<t;i++)this._resourceCredits[i].showOnScreen=e;const i=this._gltfCredits.length;for(let t=0;t<i;t++)this._gltfCredits[t].showOnScreen=e}this._showCreditsOnScreen=e}}}),Model.silhouetteSupported=function(e){return silhouetteSupported(e.context)},Model.fromGltf=function(e){const t=e.url;e=clone$1(e);const i=Resource.createIfNeeded(t),n=defaultValue(e.basePath,i.clone()),r=Resource.createIfNeeded(n);let o=defaultValue(e.cacheKey,uriToGuid[getAbsoluteUri(i.url)]);defined(o)||(o=createGuid(),uriToGuid[getAbsoluteUri(i.url)]=o),defined(e.basePath)&&!defined(e.cacheKey)&&(o+=r.url),e.cacheKey=o,e.basePath=r;const a=new Model(e);let s=gltfCache[o];return defined(s)?s.ready||(++s.count,s.modelsToLoad.push(a)):(s=new CachedGltf({ready:!1}),s.count=1,s.modelsToLoad.push(a),setCachedGltf(a,s),gltfCache[o]=s,defined(i.headers.Accept)||(i.headers.Accept=defaultModelAccept),i.fetchArrayBuffer().then((function(e){const t=new Uint8Array(e);if(containsGltfMagic(t)){const e=parseGlb(t);s.makeReady(e)}else{const e=getJsonFromTypedArray(t);s.makeReady(e)}const n=a._resourceCredits,r=i.credits;if(defined(r)){const e=r.length;for(let t=0;t<e;t++)n.push(r[t])}})).catch(ModelUtility.getFailedLoadFunction(a,"model",i.url))),a},Model._gltfCache=gltfCache,Model.prototype.getNode=function(e){const t=getRuntime(this,"nodesByName",e);return defined(t)?t.publicNode:void 0},Model.prototype.getMesh=function(e){return getRuntime(this,"meshesByName",e)},Model.prototype.getMaterial=function(e){return getRuntime(this,"materialsByName",e)},Model.prototype.setArticulationStage=function(e,t){const i=getRuntime(this,"stagesByKey",e),n=getRuntime(this,"articulationsByStageKey",e);defined(i)&&defined(n)&&(t=CesiumMath.clamp(t,i.minimumValue,i.maximumValue),CesiumMath.equalsEpsilon(i.currentValue,t,articulationEpsilon)||(i.currentValue=t,n.isDirty=!0))};const scratchArticulationCartesian=new Cartesian3,scratchArticulationRotation=new Matrix3;function applyArticulationStageMatrix(e,t){const i=e.currentValue,n=scratchArticulationCartesian;let r;switch(e.type){case"xRotate":r=Matrix3.fromRotationX(CesiumMath.toRadians(i),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,r,t);break;case"yRotate":r=Matrix3.fromRotationY(CesiumMath.toRadians(i),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,r,t);break;case"zRotate":r=Matrix3.fromRotationZ(CesiumMath.toRadians(i),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,r,t);break;case"xTranslate":n.x=i,n.y=0,n.z=0,Matrix4.multiplyByTranslation(t,n,t);break;case"yTranslate":n.x=0,n.y=i,n.z=0,Matrix4.multiplyByTranslation(t,n,t);break;case"zTranslate":n.x=0,n.y=0,n.z=i,Matrix4.multiplyByTranslation(t,n,t);break;case"xScale":n.x=i,n.y=1,n.z=1,Matrix4.multiplyByScale(t,n,t);break;case"yScale":n.x=1,n.y=i,n.z=1,Matrix4.multiplyByScale(t,n,t);break;case"zScale":n.x=1,n.y=1,n.z=i,Matrix4.multiplyByScale(t,n,t);break;case"uniformScale":Matrix4.multiplyByUniformScale(t,i,t)}return t}const scratchApplyArticulationTransform=new Matrix4;function addBuffersToLoadResources(e){const t=e.gltf,i=e._loadResources;ForEach.buffer(t,(function(e,t){i.buffers[t]=e.extras._pipeline.source}))}function bufferLoad(e,t){return function(i){const n=e._loadResources,r=new Uint8Array(i);--n.pendingBufferLoads,e.gltf.buffers[t].extras._pipeline.source=r}}function parseBufferViews(e){const t=e.gltf.bufferViews,i=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,(function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&i.enqueue(t)}));const n=e._loadResources.indexBuffersToCreate,r={};ForEach.accessor(e.gltf,(function(e){const i=e.bufferView;if(!defined(i))return;t[i].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(r[i])||(r[i]=!0,n.enqueue({id:i,componentType:e.componentType}))}))}function parseTechniques(e){const t=e.gltf;if(!usesExtension(t,"KHR_techniques_webgl"))return;const i=e._sourcePrograms,n=e._sourceTechniques,r=t.extensions.KHR_techniques_webgl.programs;ForEach.technique(t,(function(e,t){n[t]=clone$1(e);const o=e.program;defined(i[o])||(i[o]=clone$1(r[o]))}))}function shaderLoad(e,t,i){return function(n){const r=e._loadResources;r.shaders[i]={source:n,type:t,bufferView:void 0},--r.pendingShaderLoads,e._rendererResources.sourceShaders[i]=n}}function parseShaders(e){const t=e.gltf,i=t.buffers,n=t.bufferViews,r=e._rendererResources.sourceShaders;ForEach.shader(t,(function(t,o){if(defined(t.bufferView)){const e=t.bufferView,a=n[e],s=a.buffer,c=getStringFromTypedArray(i[s].extras._pipeline.source,a.byteOffset,a.byteLength);r[o]=c}else if(defined(t.extras._pipeline.source))r[o]=t.extras._pipeline.source;else{++e._loadResources.pendingShaderLoads;const i=e._resource.getDerivedResource({url:t.uri});i.fetchText().then(shaderLoad(e,t.type,o)).catch(ModelUtility.getFailedLoadFunction(e,"shader",i.url))}}))}function parsePrograms(e){const t=e._sourceTechniques;for(const i in t)if(t.hasOwnProperty(i)){const n=t[i];e._loadResources.programsToCreate.enqueue({programId:n.program,techniqueId:i})}}function parseArticulations(e){const t={},i={},n={};e._runtime.articulationsByName=t,e._runtime.articulationsByStageKey=i,e._runtime.stagesByKey=n;const r=e.gltf;if(!usesExtension(r,"AGI_articulations")||!defined(r.extensions)||!defined(r.extensions.AGI_articulations))return;const o=r.extensions.AGI_articulations.articulations;if(!defined(o))return;const a=o.length;for(let e=0;e<a;++e){const r=clone$1(o[e]);r.nodes=[],r.isDirty=!0,t[r.name]=r;const a=r.stages.length;for(let e=0;e<a;++e){const t=r.stages[e];t.currentValue=t.initialValue;const o=`${r.name} ${t.name}`;i[o]=r,n[o]=t}}}function imageLoad(e,t){return function(i){const n=e._loadResources;let r;--n.pendingTextureLoads,Array.isArray(i)&&(r=i.slice(1,i.length).map((function(e){return e.bufferView})),i=i[0]),n.texturesToCreate.enqueue({id:t,image:i,bufferView:i.bufferView,width:i.width,height:i.height,internalFormat:i.internalFormat,mipLevels:r})}}Model.prototype.applyArticulations=function(){const e=this._runtime.articulationsByName;for(const t in e)if(e.hasOwnProperty(t)){const i=e[t];if(i.isDirty){i.isDirty=!1;const e=i.nodes.length;for(let t=0;t<e;++t){const e=i.nodes[t];let n=Matrix4.clone(e.originalMatrix,scratchApplyArticulationTransform);const r=i.stages.length;for(let e=0;e<r;++e){n=applyArticulationStageMatrix(i.stages[e],n)}e.matrix=n}}}};const ktx2Regex$2=/(^data:image\/ktx2)|(\.ktx2$)/i;function parseTextures(e,t,i){const n=e.gltf,r=n.images;let o;ForEach.texture(n,(function(n,a){let s=n.source;defined(n.extensions)&&defined(n.extensions.EXT_texture_webp)&&i?s=n.extensions.EXT_texture_webp.source:defined(n.extensions)&&defined(n.extensions.KHR_texture_basisu)&&t.supportsBasis&&(s=n.extensions.KHR_texture_basisu.source);const c=r[s],l=c.bufferView,u=c.mimeType;if(o=c.uri,defined(l))e._loadResources.texturesToCreateFromBufferView.enqueue({id:a,image:void 0,bufferView:l,mimeType:u});else{++e._loadResources.pendingTextureLoads;const t=e._resource.getDerivedResource({url:o});let i;i=ktx2Regex$2.test(o)?loadKTX2(t):t.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0}),i.then(imageLoad(e,a)).catch(ModelUtility.getFailedLoadFunction(e,"image",t.url))}}))}const scratchArticulationStageInitialTransform=new Matrix4;function parseNodes(e){const t={},i={},n=[],r=e._loadResources.skinnedNodesIds,o=e._runtime.articulationsByName;ForEach.node(e.gltf,(function(a,s){const c={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new Matrix4,computedMatrix:new Matrix4,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:a.jointName,weights:[],children:[],parents:[],publicNode:void 0};if(c.publicNode=new ModelNode(e,a,c,s,ModelUtility.getTransform(a)),t[s]=c,i[a.name]=c,defined(a.skin)&&(r.push(s),n.push(c)),defined(a.extensions)&&defined(a.extensions.AGI_articulations)){const e=a.extensions.AGI_articulations.articulationName;if(defined(e)){let t=Matrix4.clone(c.publicNode.originalMatrix,scratchArticulationStageInitialTransform);const i=o[e];i.nodes.push(c.publicNode);const n=i.stages.length;for(let e=0;e<n;++e){t=applyArticulationStageMatrix(i.stages[e],t)}c.publicNode.matrix=t}}})),e._runtime.nodes=t,e._runtime.nodesByName=i,e._runtime.skinnedNodes=n}function parseMaterials(e){const t=e.gltf,i=e._sourceTechniques,n={},r={},o=e._uniformMaps;ForEach.material(t,(function(t,a){o[a]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0,morphWeightsUniformName:void 0};const s=new ModelMaterial(e,t,a);if(defined(t.extensions)&&defined(t.extensions.KHR_techniques_webgl)){const e=t.extensions.KHR_techniques_webgl.technique;s._technique=e,s._program=i[e].program,ForEach.materialValue(t,(function(e,t){defined(s._values)||(s._values={}),s._values[t]=clone$1(e)}))}n[t.name]=s,r[a]=s})),e._runtime.materialsByName=n,e._runtime.materialsById=r}function parseMeshes(e){const t={},i=e._runtime.materialsById;ForEach.mesh(e.gltf,(function(n,r){t[n.name]=new ModelMesh(n,i,r),(defined(e.extensionsUsed.WEB3D_quantized_attributes)||e._dequantizeInShader)&&ForEach.meshPrimitive(n,(function(t,i){const n=getProgramForPrimitive(e,t);let o=e._programPrimitives[n];defined(o)||(o={},e._programPrimitives[n]=o),o[`${r}.primitive.${i}`]=t}))})),e._runtime.meshesByName=t}function parseCredits(e){const t=e.gltf.asset.copyright;if(!defined(t))return;const i=e._showCreditsOnScreen,n=t.split(";").map((function(e){return new Credit(e.trim(),i)}));e._gltfCredits=n}const CreateVertexBufferJob$1=function(){this.id=void 0,this.model=void 0,this.context=void 0};function createVertexBuffer$2(e,t,i){const n=t._loadResources;let r=t.gltf.bufferViews[e];defined(r)||(r=n.createdBufferViews[e]);const o=Buffer$1.createVertexBuffer({context:i,typedArray:n.getBuffer(r),usage:BufferUsage$1.STATIC_DRAW});o.vertexArrayDestroyable=!1,t._rendererResources.buffers[e]=o,t._geometryByteLength+=o.sizeInBytes}CreateVertexBufferJob$1.prototype.set=function(e,t,i){this.id=e,this.model=t,this.context=i},CreateVertexBufferJob$1.prototype.execute=function(){createVertexBuffer$2(this.id,this.model,this.context)};const CreateIndexBufferJob$1=function(){this.id=void 0,this.componentType=void 0,this.model=void 0,this.context=void 0};function createIndexBuffer$1(e,t,i,n){const r=i._loadResources;let o=i.gltf.bufferViews[e];defined(o)||(o=r.createdBufferViews[e]);const a=Buffer$1.createIndexBuffer({context:n,typedArray:r.getBuffer(o),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:t});a.vertexArrayDestroyable=!1,i._rendererResources.buffers[e]=a,i._geometryByteLength+=a.sizeInBytes}CreateIndexBufferJob$1.prototype.set=function(e,t,i,n){this.id=e,this.componentType=t,this.model=i,this.context=n},CreateIndexBufferJob$1.prototype.execute=function(){createIndexBuffer$1(this.id,this.componentType,this.model,this.context)};const scratchVertexBufferJob$1=new CreateVertexBufferJob$1,scratchIndexBufferJob$1=new CreateIndexBufferJob$1;function createBuffers(e,t){const i=e._loadResources;if(0!==i.pendingBufferLoads)return;const n=t.context,r=i.vertexBuffersToCreate,o=i.indexBuffersToCreate;let a;if(e.asynchronous){for(;r.length>0&&(scratchVertexBufferJob$1.set(r.peek(),e,n),t.jobScheduler.execute(scratchVertexBufferJob$1,JobType$1.BUFFER));)r.dequeue();for(;o.length>0&&(a=o.peek(),scratchIndexBufferJob$1.set(a.id,a.componentType,e,n),t.jobScheduler.execute(scratchIndexBufferJob$1,JobType$1.BUFFER));)o.dequeue()}else{for(;r.length>0;)createVertexBuffer$2(r.dequeue(),e,n);for(;o.length>0;)a=o.dequeue(),createIndexBuffer$1(a.id,a.componentType,e,n)}}function getProgramForPrimitive(e,t){const i=e._runtime.materialsById[t.material];if(defined(i))return i._program}function modifyShaderForQuantizedAttributes(e,t,i){let n;const r=i._programPrimitives[t];if(!defined(r))return e;let o,a;for(o in r)if(r.hasOwnProperty(o)&&(n=r[o],getProgramForPrimitive(i,n)===t))break;if(i._programPrimitives[t]=void 0,i.extensionsUsed.WEB3D_quantized_attributes)a=ModelUtility.modifyShaderForQuantizedAttributes(i.gltf,n,e),i._quantizedUniforms[t]=a.uniforms;else{const t=i._decodedData[o];if(!defined(t))return e;a=ModelUtility.modifyShaderForDracoQuantizedAttributes(i.gltf,n,e,t.attributes)}return a.shader}function modifyShaderForColor(e){return e=ShaderSource.replaceMain(e,"gltf_blend_main"),e+="uniform vec4 gltf_color; \nuniform float gltf_colorBlend; \nvoid main() \n{ \n gltf_blend_main(); \n gl_FragColor.rgb = mix(gl_FragColor.rgb, gltf_color.rgb, gltf_colorBlend); \n float highlight = ceil(gltf_colorBlend); \n gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight); \n gl_FragColor.a *= gltf_color.a; \n} \n"}function modifyShader(e,t,i){return defined(i)&&(e=i(e,t)),e}const CreateProgramJob=function(){this.programToCreate=void 0,this.model=void 0,this.context=void 0};function createProgram(e,t,i){const n=e.programId,r=e.techniqueId,o=t._sourcePrograms[n],a=t._rendererResources.sourceShaders;let s=a[o.vertexShader];const c=a[o.fragmentShader],l=t._quantizedVertexShaders;if(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader){let e=l[n];defined(e)||(e=modifyShaderForQuantizedAttributes(s,n,t),l[n]=e),s=e}const u=modifyShader(s,n,t._vertexShaderLoaded);let d=modifyShader(c,n,t._fragmentShaderLoaded);defined(t._uniformMapLoaded)||(d=`uniform vec4 czm_pickColor;\n${d}`);const h=t._imageBasedLighting,p=h.enabled;if(p&&(d=`#define USE_IBL_LIGHTING \n\n${d}`),defined(t._lightColor)&&(d=`#define USE_CUSTOM_LIGHT_COLOR \n\n${d}`),("2.0"!==t._sourceVersion||t._sourceKHRTechniquesWebGL)&&(d=ShaderSource.replaceMain(d,"non_gamma_corrected_main"),d=`${d}\nvoid main() { \n non_gamma_corrected_main(); \n gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n`),OctahedralProjectedCubeMap.isSupported(i)){const e=h.useSphericalHarmonicCoefficients,t=h.useSpecularEnvironmentMaps;(e||t||p)&&(d=`uniform mat3 gltf_iblReferenceFrameMatrix; \n${d}`),defined(h.sphericalHarmonicCoefficients)?d=`#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n${d}`:h.useDefaultSphericalHarmonics&&(d=`#define DIFFUSE_IBL \n${d}`),defined(h.specularEnvironmentMapAtlas)&&h.specularEnvironmentMapAtlas.ready?d=`#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n${d}`:h.useDefaultSpecularMaps&&(d=`#define SPECULAR_IBL \n${d}`)}defined(h.luminanceAtZenith)&&(d=`#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n${d}`),createAttributesAndProgram(n,r,d,u,t,i)}function recreateProgram(e,t,i){const n=e.programId,r=e.techniqueId,o=t._sourcePrograms[n],a=t._rendererResources.sourceShaders,s=t._quantizedVertexShaders,c=t.clippingPlanes,l=isClippingEnabled(t);let u=a[o.vertexShader];const d=a[o.fragmentShader];(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader)&&(u=s[n]);let h=d;isColorShadingEnabled(t)&&(h=Model._modifyShaderForColor(h)),l&&(h=modifyShaderForClippingPlanes(h,c,i)),t.splitDirection!==SplitDirection$1.NONE&&(h=Splitter.modifyFragmentShader(h));const p=modifyShader(u,n,t._vertexShaderLoaded);let f=modifyShader(h,n,t._fragmentShaderLoaded);defined(t._uniformMapLoaded)||(f=`uniform vec4 czm_pickColor;\n${f}`);const m=t._imageBasedLighting,g=m.enabled;if(g&&(f=`#define USE_IBL_LIGHTING \n\n${f}`),defined(t._lightColor)&&(f=`#define USE_CUSTOM_LIGHT_COLOR \n\n${f}`),("2.0"!==t._sourceVersion||t._sourceKHRTechniquesWebGL)&&(f=ShaderSource.replaceMain(f,"non_gamma_corrected_main"),f=`${f}\nvoid main() { \n non_gamma_corrected_main(); \n gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n`),OctahedralProjectedCubeMap.isSupported(i)){const e=m.useSphericalHarmonicCoefficients,t=m.useSpecularEnvironmentMaps;(e||t||g)&&(f=`uniform mat3 gltf_iblReferenceFrameMatrix; \n${f}`),defined(m.sphericalHarmonicCoefficients)?f=`#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n${f}`:m.useDefaultSphericalHarmonics&&(f=`#define DIFFUSE_IBL \n${f}`),defined(m.specularEnvironmentMapAtlas)&&m.specularEnvironmentMapAtlas.ready?f=`#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n${f}`:m.useDefaultSpecularMaps&&(f=`#define SPECULAR_IBL \n${f}`)}defined(m.luminanceAtZenith)&&(f=`#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n${f}`),createAttributesAndProgram(n,r,f,p,t,i)}function createAttributesAndProgram(e,t,i,n,r,o){const a=r._sourceTechniques[t],s=ModelUtility.createAttributeLocations(a,r._precreatedAttributes);r._rendererResources.programs[e]=ShaderProgram.fromCache({context:o,vertexShaderSource:n,fragmentShaderSource:i,attributeLocations:s})}CreateProgramJob.prototype.set=function(e,t,i){this.programToCreate=e,this.model=t,this.context=i},CreateProgramJob.prototype.execute=function(){createProgram(this.programToCreate,this.model,this.context)};const scratchCreateProgramJob=new CreateProgramJob;function createPrograms(e,t){const i=e._loadResources,n=i.programsToCreate;if(0!==i.pendingShaderLoads)return;if(0!==i.pendingBufferLoads)return;const r=t.context;if(e.asynchronous)for(;n.length>0&&(scratchCreateProgramJob.set(n.peek(),e,r),t.jobScheduler.execute(scratchCreateProgramJob,JobType$1.PROGRAM));)n.dequeue();else for(;n.length>0;)createProgram(n.dequeue(),e,r)}function getOnImageCreatedFromTypedArray(e,t){return function(i){e.texturesToCreate.enqueue({id:t.id,image:i,bufferView:void 0}),--e.pendingBufferViewToImage}}function loadTexturesFromBufferViews(e){const t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){const i=t.texturesToCreateFromBufferView.dequeue(),n=e.gltf,r=n.bufferViews[i.bufferView];n.textures[i.id].source;const o=ModelUtility.getFailedLoadFunction(e,"image",`id: ${i.id}, bufferView: ${i.bufferView}`);if("image/ktx2"===i.mimeType){loadKTX2(new Uint8Array(t.getBuffer(r))).then(imageLoad(e,i.id)).catch(o),++e._loadResources.pendingTextureLoads}else{const e=getOnImageCreatedFromTypedArray(t,i);loadImageFromTypedArray({uint8Array:t.getBuffer(r),format:i.mimeType,flipY:!1,skipColorSpaceConversion:!0}).then(e).catch(o),++t.pendingBufferViewToImage}}}function createSamplers(e){const t=e._loadResources;if(t.createSamplers){t.createSamplers=!1;const i=e._rendererResources.samplers;ForEach.sampler(e.gltf,(function(e,t){i[t]=new Sampler({wrapS:e.wrapS,wrapT:e.wrapT,minificationFilter:e.minFilter,magnificationFilter:e.magFilter})}))}}const CreateTextureJob$1=function(){this.gltfTexture=void 0,this.model=void 0,this.context=void 0};function createTexture$2(e,t,i){const n=t.gltf.textures[e.id];let r=t._rendererResources.samplers[n.sampler];defined(r)||(r=new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT}));let o=!1;const a=t.gltf.materials,s=a.length;for(let t=0;t<s;++t){const i=a[t];if(defined(i.extensions)&&defined(i.extensions.KHR_techniques_webgl)){const t=i.extensions.KHR_techniques_webgl.values;for(const i in t)if(t.hasOwnProperty(i)&&-1!==i.indexOf("Texture")){const n=t[i];if(n.index===e.id&&defined(n.extensions)&&defined(n.extensions.KHR_texture_transform)){o=!0;break}}}if(o)break}const c=r.wrapS,l=r.wrapT;let u=r.minificationFilter;o&&u!==TextureMinificationFilter$1.LINEAR&&u!==TextureMinificationFilter$1.NEAREST&&(u=u===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||u===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?TextureMinificationFilter$1.NEAREST:TextureMinificationFilter$1.LINEAR,r=new Sampler({wrapS:r.wrapS,wrapT:r.wrapT,minificationFilter:u,magnificationFilter:r.magnificationFilter}));const d=e.internalFormat,h=!(defined(d)&&PixelFormat$1.isCompressedFormat(d)||u!==TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR&&u!==TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR),p=h||c===TextureWrap$1.REPEAT||c===TextureWrap$1.MIRRORED_REPEAT||l===TextureWrap$1.REPEAT||l===TextureWrap$1.MIRRORED_REPEAT;let f,m,g=e.image;if(defined(d)){f=!CesiumMath.isPowerOfTwo(e.width)||!CesiumMath.isPowerOfTwo(e.height),!i.webgl2&&PixelFormat$1.isCompressedFormat(d)&&f&&p&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly. See the Model.js constructor documentation for more information.");let t=r.minificationFilter;defined(e.mipLevels)||u!==TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?defined(e.mipLevels)||u!==TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR||(t=TextureMinificationFilter$1.LINEAR):t=TextureMinificationFilter$1.NEAREST,r=new Sampler({wrapS:r.wrapS,wrapT:r.wrapT,minificationFilter:t,magnificationFilter:r.magnificationFilter}),m=new Texture({context:i,source:{arrayBufferView:e.bufferView,mipLevels:e.mipLevels},width:e.width,height:e.height,pixelFormat:d,sampler:r})}else if(defined(g)){if(f=!CesiumMath.isPowerOfTwo(g.width)||!CesiumMath.isPowerOfTwo(g.height),p&&f){const e=document.createElement("canvas");e.width=CesiumMath.nextPowerOfTwo(g.width),e.height=CesiumMath.nextPowerOfTwo(g.height);e.getContext("2d").drawImage(g,0,0,g.width,g.height,0,0,e.width,e.height),g=e}m=new Texture({context:i,source:g,pixelFormat:n.internalFormat,pixelDatatype:n.type,sampler:r,flipY:!1,skipColorSpaceConversion:!0}),h&&m.generateMipmap()}defined(m)&&(t._rendererResources.textures[e.id]=m,t._texturesByteLength+=m.sizeInBytes)}CreateTextureJob$1.prototype.set=function(e,t,i){this.gltfTexture=e,this.model=t,this.context=i},CreateTextureJob$1.prototype.execute=function(){createTexture$2(this.gltfTexture,this.model,this.context)};const scratchCreateTextureJob=new CreateTextureJob$1;function createTextures(e,t){const i=t.context,n=e._loadResources.texturesToCreate;if(e.asynchronous)for(;n.length>0&&(scratchCreateTextureJob.set(n.peek(),e,i),t.jobScheduler.execute(scratchCreateTextureJob,JobType$1.TEXTURE));)n.dequeue();else for(;n.length>0;)createTexture$2(n.dequeue(),e,i)}function getAttributeLocations$1(e,t){const i=e._sourceTechniques,n={};let r,o;const a=e._runtime.materialsById[t.material];if(!defined(a))return n;const s=i[a._technique];if(!defined(s))return n;const c=s.attributes,l=e._rendererResources.programs[s.program]._attributeLocations;for(r in l)if(l.hasOwnProperty(r)){const e=c[r];defined(e)&&(o=l[r],n[e.semantic]=o)}const u=e._precreatedAttributes;if(defined(u))for(r in u)u.hasOwnProperty(r)&&(o=l[r],n[r]=o);return n}function createJoints(e,t){const i=e.gltf,n=i.skins,r=i.nodes,o=e._runtime.nodes,a=e._loadResources.skinnedNodesIds,s=a.length;for(let e=0;e<s;++e){const i=a[e],s=o[i],c=r[i],l=t[c.skin];s.inverseBindMatrices=l.inverseBindMatrices,s.bindShapeMatrix=l.bindShapeMatrix;const u=n[c.skin].joints,d=u.length;for(let e=0;e<d;++e){const t=o[u[e]];s.joints.push(t)}}}function createSkins(e){const t=e._loadResources;if(0!==t.pendingBufferLoads)return;if(!t.createSkins)return;t.createSkins=!1;const i=e.gltf,n=i.accessors,r={};ForEach.skin(i,(function(t,i){const o=n[t.inverseBindMatrices];let a;Matrix4.equals(t.bindShapeMatrix,Matrix4.IDENTITY)||(a=Matrix4.clone(t.bindShapeMatrix)),r[i]={inverseBindMatrices:ModelAnimationCache.getSkinInverseBindMatrices(e,o),bindShapeMatrix:a}})),createJoints(e,r)}function getChannelEvaluator(e,t,i,n){return function(r){defined(n)&&(r=e.clampAnimations?n.clampTime(r):n.wrapTime(r),t[i]=n.evaluate(r,t[i]),t.dirtyNumber=e._maxDirtyNumber)}}function createRuntimeAnimations(e){const t=e._loadResources;if(!t.finishedPendingBufferLoads())return;if(!t.createRuntimeAnimations)return;t.createRuntimeAnimations=!1,e._runtime.animations=[];const i=e._runtime.nodes,n=e.gltf.accessors;ForEach.animation(e.gltf,(function(t,r){const o=t.channels,a=t.samplers;let s=Number.MAX_VALUE,c=-Number.MAX_VALUE;const l=o.length,u=new Array(l);for(let d=0;d<l;++d){const l=o[d],h=l.target,p=h.path,f=a[l.sampler],m=ModelAnimationCache.getAnimationParameterValues(e,n[f.input]),g=ModelAnimationCache.getAnimationParameterValues(e,n[f.output]);s=Math.min(s,m[0]),c=Math.max(c,m[m.length-1]);const _=ModelAnimationCache.getAnimationSpline(e,r,t,l.sampler,f,m,p,g);u[d]=getChannelEvaluator(e,i[h.node],h.path,_)}e._runtime.animations[r]={name:t.name,startTime:s,stopTime:c,channelEvaluators:u}}))}function createVertexArrays$1(e,t){const i=e._loadResources;if(!i.finishedBuffersCreation()||!i.finishedProgramCreation()||!i.createVertexArrays)return;i.createVertexArrays=!1;const n=e._rendererResources.buffers,r=e._rendererResources.vertexArrays,o=e.gltf,a=o.accessors;ForEach.mesh(o,(function(i,s){ForEach.meshPrimitive(i,(function(i,c){const l=[];let u;const d=getAttributeLocations$1(e,i),h=e._decodedData[`${s}.primitive.${c}`];let p,f;ForEach.meshPrimitiveAttribute(i,(function(e,t){if(u=d[t],defined(u)){if(defined(h)){const e=h.attributes;if(e.hasOwnProperty(t)){const i=e[t];return void l.push({index:u,vertexBuffer:n[i.bufferView],componentsPerAttribute:i.componentsPerAttribute,componentDatatype:i.componentDatatype,normalize:i.normalized,offsetInBytes:i.byteOffset,strideInBytes:i.byteStride})}}const i=a[e],r=defined(i.normalized)&&i.normalized;l.push({index:u,vertexBuffer:n[i.bufferView],componentsPerAttribute:numberOfComponentsForType(i.type),componentDatatype:i.componentType,normalize:r,offsetInBytes:i.byteOffset,strideInBytes:getAccessorByteStride(o,i)})}}));const m=e._precreatedAttributes;if(defined(m))for(f in m)m.hasOwnProperty(f)&&(u=d[f],defined(u)&&(p=m[f],p.index=u,l.push(p)));let g;if(defined(i.indices)){let e=a[i.indices].bufferView;defined(h)&&(e=h.bufferView),g=n[e]}r[`${s}.primitive.${c}`]=new VertexArray({context:t,attributes:l,indexBuffer:g})}))}))}function createRenderStates$3(e){const t=e._loadResources;t.createRenderStates&&(t.createRenderStates=!1,ForEach.material(e.gltf,(function(t,i){createRenderStateForMaterial(e,t,i)})))}function createRenderStateForMaterial(e,t,i){const n=e._rendererResources.renderStates;let r=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],o=[WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA];defined(t.extensions)&&defined(t.extensions.KHR_blend)&&(r=t.extensions.KHR_blend.blendEquation,o=t.extensions.KHR_blend.blendFactors);const a=!t.doubleSided,s="BLEND"===t.alphaMode;n[i]=RenderState.fromCache({cull:{enabled:a},depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!s,blending:{enabled:s,equationRgb:r[0],equationAlpha:r[1],functionSourceRgb:o[0],functionDestinationRgb:o[1],functionSourceAlpha:o[2],functionDestinationAlpha:o[3]}})}const gltfUniformsFromNode={MODEL:function(e,t,i){return function(){return i.computedMatrix}},VIEW:function(e,t,i){return function(){return e.view}},PROJECTION:function(e,t,i){return function(){return e.projection}},MODELVIEW:function(e,t,i){const n=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,n)}},CESIUM_RTC_MODELVIEW:function(e,t,i){const n=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,n),Matrix4.setTranslation(n,t._rtcCenterEye,n)}},MODELVIEWPROJECTION:function(e,t,i){const n=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,n),Matrix4.multiply(e._projection,n,n)}},MODELINVERSE:function(e,t,i){const n=new Matrix4;return function(){return Matrix4.inverse(i.computedMatrix,n)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,i){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,i){const n=new Matrix4,r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,n),Matrix4.inverse(n,r)}},MODELVIEWPROJECTIONINVERSE:function(e,t,i){const n=new Matrix4,r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,n),Matrix4.multiply(e._projection,n,n),Matrix4.inverse(n,r)}},MODELINVERSETRANSPOSE:function(e,t,i){const n=new Matrix4,r=new Matrix3;return function(){return Matrix4.inverse(i.computedMatrix,n),Matrix4.getMatrix3(n,r),Matrix3.transpose(r,r)}},MODELVIEWINVERSETRANSPOSE:function(e,t,i){const n=new Matrix4,r=new Matrix4,o=new Matrix3;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,n),Matrix4.inverse(n,r),Matrix4.getMatrix3(r,o),Matrix3.transpose(o,o)}},VIEWPORT:function(e,t,i){return function(){return e.viewportCartesian4}}};function getUniformFunctionFromSource(e,t,i,n){const r=t._runtime.nodes[e];return gltfUniformsFromNode[i](n,t,r)}function createUniformsForMaterial(e,t,i,n,r,o,a){const s={},c={};let l,u;return ForEach.techniqueUniform(i,(function(i,d){let h;if(defined(n)&&defined(n[d]))h=ModelUtility.createUniformFunction(i.type,n[d],o,a),s[d]=h.func,c[d]=h;else if(defined(i.node))s[d]=getUniformFunctionFromSource(i.node,e,i.semantic,r.uniformState);else if(defined(i.semantic))if("JOINTMATRIX"===i.semantic)l=d;else if("MORPHWEIGHTS"===i.semantic)u=d;else if("ALPHACUTOFF"===i.semantic){const e=t.alphaMode;if(defined(e)&&"MASK"===e){const e=defaultValue(t.alphaCutoff,.5);h=ModelUtility.createUniformFunction(i.type,e,o,a),s[d]=h.func,c[d]=h}}else s[d]=ModelUtility.getGltfSemanticUniforms()[i.semantic](r.uniformState,e);else if(defined(i.value)){const e=ModelUtility.createUniformFunction(i.type,i.value,o,a);s[d]=e.func,c[d]=e}})),{map:s,values:c,jointMatrixUniformName:l,morphWeightsUniformName:u}}function createUniformMaps(e,t){const i=e._loadResources;if(!i.finishedProgramCreation())return;if(!i.createUniformMaps)return;i.createUniformMaps=!1;const n=e.gltf,r=e._sourceTechniques,o=e._uniformMaps,a=e._rendererResources.textures,s=e._defaultTexture;ForEach.material(n,(function(i,n){const c=e._runtime.materialsById[n],l=r[c._technique],u=c._values,d=createUniformsForMaterial(e,i,l,u,t,a,s),h=o[n];if(h.uniformMap=d.map,h.values=d.values,h.jointMatrixUniformName=d.jointMatrixUniformName,h.morphWeightsUniformName=d.morphWeightsUniformName,defined(l.attributes.a_outlineCoordinates)){const i=ModelOutlineLoader.createTexture(e,t);h.uniformMap.u_outlineTexture=function(){return i}}}))}function createUniformsForDracoQuantizedAttributes(e){return ModelUtility.createUniformsForDracoQuantizedAttributes(e.attributes)}function createUniformsForQuantizedAttributes(e,t){const i=getProgramForPrimitive(e,t),n=e._quantizedUniforms[i];return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,n)}function createPickColorFunction$1(e){return function(){return e}}function createJointMatricesFunction(e){return function(){return e.computedJointMatrices}}function createMorphWeightsFunction(e){return function(){return e.weights}}function createSilhouetteColorFunction(e){return function(){return e.silhouetteColor}}function createSilhouetteSizeFunction(e){return function(){return e.silhouetteSize}}function createColorFunction(e){return function(){return e.color}}function createClippingPlanesMatrixFunction(e){return function(){return e._clippingPlanesMatrix}}function createIBLReferenceFrameMatrixFunction(e){return function(){return e._imageBasedLighting.iblReferenceFrameMatrix}}function createClippingPlanesFunction(e){return function(){const t=e.clippingPlanes;return defined(t)&&t.enabled?t.texture:e._defaultTexture}}function createClippingPlanesEdgeStyleFunction(e){return function(){const t=e.clippingPlanes;if(!defined(t))return Color.WHITE.withAlpha(0);const i=Color.clone(t.edgeColor);return i.alpha=t.edgeWidth,i}}function createColorBlendFunction(e){return function(){return ColorBlendMode$1.getColorBlend(e.colorBlendMode,e.colorBlendAmount)}}function createIBLFactorFunction(e){return function(){return e._imageBasedLighting.imageBasedLightingFactor}}function createLightColorFunction(e){return function(){return e._lightColor}}function createLuminanceAtZenithFunction(e){return function(){return e._imageBasedLighting.luminanceAtZenith}}function createSphericalHarmonicCoefficientsFunction(e){return function(){return e._imageBasedLighting.sphericalHarmonicCoefficients}}function createSpecularEnvironmentMapFunction(e){return function(){return e._imageBasedLighting.specularEnvironmentMapAtlas.texture}}function createSpecularEnvironmentMapSizeFunction(e){return function(){return e._imageBasedLighting.specularEnvironmentMapAtlas.texture.dimensions}}function createSpecularEnvironmentMapLOD(e){return function(){return e._imageBasedLighting.specularEnvironmentMapAtlas.maximumMipmapLevel}}function triangleCountFromPrimitiveIndices(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createCommand$2(e,t,i,n,r){const o=e._nodeCommands,a=e._pickIds,s=e.allowPicking,c=e._runtime.meshesByName,l=e._rendererResources,u=l.vertexArrays,d=l.programs,h=l.renderStates,p=e._uniformMaps,f=e.gltf,m=f.accessors,g=f.meshes,_=t.mesh,y=g[_],C=y.primitives,T=C.length;for(let t=0;t<T;++t){const l=C[t],g=m[l.indices],T=e._runtime.materialsById[l.material]._program,S=e._decodedData[`${_}.primitive.${t}`];let v;const A=l.attributes.POSITION;if(defined(A)){const e=ModelUtility.getAccessorMinMax(f,A);v=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(e.min),Cartesian3.fromArray(e.max))}const E=u[`${_}.primitive.${t}`];let b,x;if(defined(S))x=S.numberOfIndices,b=0;else if(defined(g))x=g.count,b=g.byteOffset/IndexDatatype$1.getSizeInBytes(g.componentType);else{x=m[l.attributes.POSITION].count,b=0}e._trianglesLength+=triangleCountFromPrimitiveIndices(l,x),l.mode===PrimitiveType$1.POINTS&&(e._pointsLength+=x);const P=p[l.material];let D=P.uniformMap;if(defined(P.jointMatrixUniformName)){const e={};e[P.jointMatrixUniformName]=createJointMatricesFunction(i),D=combine$2(D,e)}if(defined(P.morphWeightsUniformName)){const e={};e[P.morphWeightsUniformName]=createMorphWeightsFunction(i),D=combine$2(D,e)}D=combine$2(D,{gltf_color:createColorFunction(e),gltf_colorBlend:createColorBlendFunction(e),gltf_clippingPlanes:createClippingPlanesFunction(e),gltf_clippingPlanesEdgeStyle:createClippingPlanesEdgeStyleFunction(e),gltf_clippingPlanesMatrix:createClippingPlanesMatrixFunction(e),gltf_iblReferenceFrameMatrix:createIBLReferenceFrameMatrixFunction(e),gltf_iblFactor:createIBLFactorFunction(e),gltf_lightColor:createLightColorFunction(e),gltf_sphericalHarmonicCoefficients:createSphericalHarmonicCoefficientsFunction(e),gltf_specularMap:createSpecularEnvironmentMapFunction(e),gltf_specularMapSize:createSpecularEnvironmentMapSizeFunction(e),gltf_maxSpecularLOD:createSpecularEnvironmentMapLOD(e),gltf_luminanceAtZenith:createLuminanceAtZenithFunction(e)}),Splitter.addUniforms(e,D),defined(e._uniformMapLoaded)&&(D=e._uniformMapLoaded(D,T,i));let w={};e.extensionsUsed.WEB3D_quantized_attributes?w=createUniformsForQuantizedAttributes(e,l):e._dequantizeInShader&&defined(S)&&(w=createUniformsForDracoQuantizedAttributes(S)),D=combine$2(D,w);const M=h[l.material],I=M.blending.enabled;let R=e._pickObject;defined(R)||(R={primitive:e,id:e.id,node:i.publicNode,mesh:c[y.name]});const O=ShadowMode$1.castShadows(e._shadows),B=ShadowMode$1.receiveShadows(e._shadows);let L;if(s&&!defined(e._uniformMapLoaded)){L=n.createPickId(R),a.push(L);D=combine$2(D,{czm_pickColor:createPickColorFunction$1(L.color)})}s&&(L=defined(e._pickIdLoaded)&&defined(e._uniformMapLoaded)?e._pickIdLoaded():"czm_pickColor");const F=new DrawCommand({boundingVolume:new BoundingSphere,cull:e.cull,modelMatrix:new Matrix4,primitiveType:l.mode,vertexArray:E,count:x,offset:b,shaderProgram:d[T],castShadows:O,receiveShadows:B,uniformMap:D,renderState:M,owner:R,pass:I?Pass$1.TRANSLUCENT:e.opaquePass,pickId:L});let N;r||(N=DrawCommand.shallowClone(F),N.boundingVolume=new BoundingSphere,N.modelMatrix=new Matrix4);const V={show:!0,boundingSphere:v,command:F,command2D:N,silhouetteModelCommand:void 0,silhouetteModelCommand2D:void 0,silhouetteColorCommand:void 0,silhouetteColorCommand2D:void 0,translucentCommand:void 0,translucentCommand2D:void 0,disableCullingCommand:void 0,disableCullingCommand2D:void 0,programId:T};i.commands.push(V),o.push(V)}}function createRuntimeNodes(e,t,i){const n=e._loadResources;if(!n.finishedEverythingButTextureCreation())return;if(!n.createRuntimeNodes)return;n.createRuntimeNodes=!1;const r=[],o=e._runtime.nodes,a=e.gltf,s=a.nodes,c=a.scenes[a.scene].nodes,l=c.length,u=[],d={};for(let n=0;n<l;++n)for(u.push({parentRuntimeNode:void 0,gltfNode:s[c[n]],id:c[n]});u.length>0;){const n=u.pop();d[n.id]=!0;const a=n.parentRuntimeNode,c=n.gltfNode,l=o[n.id];if(0===l.parents.length)if(defined(c.matrix))l.matrix=Matrix4.fromColumnMajorArray(c.matrix);else{const e=c.rotation;l.translation=Cartesian3.fromArray(c.translation),l.rotation=Quaternion.unpack(e),l.scale=Cartesian3.fromArray(c.scale)}defined(a)?(a.children.push(l),l.parents.push(a)):r.push(l),defined(c.mesh)&&createCommand$2(e,c,l,t,i);const h=c.children;if(defined(h)){const e=h.length;for(let t=0;t<e;t++){const e=h[t];d[e]||u.push({parentRuntimeNode:l,gltfNode:s[e],id:h[t]})}}}e._runtime.rootNodes=r,e._runtime.nodes=o}function getGeometryByteLength(e){let t=0;for(const i in e)e.hasOwnProperty(i)&&(t+=e[i].sizeInBytes);return t}function getTexturesByteLength(e){let t=0;for(const i in e)e.hasOwnProperty(i)&&(t+=e[i].sizeInBytes);return t}function createResources$4(e,t){const i=t.context,n=t.scene3DOnly,r=e._quantizedVertexShaders,o=e._sourceTechniques,a=e._sourcePrograms,s=e._rendererResources;let c=s.sourceShaders;e._loadRendererResourcesFromCache&&(c=s.sourceShaders=e._cachedRendererResources.sourceShaders);for(const t in o)if(o.hasOwnProperty(t)){const n=o[t].program,s=a[n];let l=c[s.vertexShader];if(ModelUtility.checkSupportedGlExtensions(s.glExtensions,i),e.extensionsUsed.WEB3D_quantized_attributes||e._dequantizeInShader){let t=r[n];defined(t)||(t=modifyShaderForQuantizedAttributes(l,n,e),r[n]=t),l=t}l=modifyShader(l,n,e._vertexShaderLoaded)}if(e._loadRendererResourcesFromCache){const t=e._cachedRendererResources;s.buffers=t.buffers,s.vertexArrays=t.vertexArrays,s.programs=t.programs,s.silhouettePrograms=t.silhouettePrograms,s.textures=t.textures,s.samplers=t.samplers,s.renderStates=t.renderStates,defined(e._precreatedAttributes)&&createVertexArrays$1(e,i),e._cachedGeometryByteLength+=getGeometryByteLength(t.buffers),e._cachedTexturesByteLength+=getTexturesByteLength(t.textures)}else createBuffers(e,t),createPrograms(e,t),createSamplers(e),loadTexturesFromBufferViews(e),createTextures(e,t);createSkins(e),createRuntimeAnimations(e),e._loadRendererResourcesFromCache||(createVertexArrays$1(e,i),createRenderStates$3(e)),createUniformMaps(e,i),createRuntimeNodes(e,i,n)}function getNodeMatrix(e,t){const i=e.publicNode,n=i.matrix;i.useMatrix&&defined(n)?Matrix4.clone(n,t):defined(e.matrix)?Matrix4.clone(e.matrix,t):(Matrix4.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t),i.setMatrix(t))}const scratchNodeStack=[],scratchComputedTranslation$1=new Cartesian4,scratchComputedMatrixIn2D=new Matrix4;function updateNodeHierarchyModelMatrix(e,t,i,n){const r=e._maxDirtyNumber,o=e._runtime.rootNodes,a=o.length,s=scratchNodeStack;let c=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){const t=Matrix4.getColumn(c,3,scratchComputedTranslation$1);if(Cartesian4.equals(t,Cartesian4.UNIT_W)){const t=e.boundingSphere.center,i=Transforms.wgs84To2DModelMatrix(n,t,scratchComputedMatrixIn2D);c=Matrix4.multiply(i,c,scratchComputedMatrixIn2D),defined(e._rtcCenter)&&(Matrix4.setTranslation(c,Cartesian4.UNIT_W,c),e._rtcCenter=e._rtcCenter2D)}else c=Transforms.basisTo2D(n,c,scratchComputedMatrixIn2D),e._rtcCenter=e._rtcCenter3D}for(let l=0;l<a;++l){let a=o[l];for(getNodeMatrix(a,a.transformToRoot),s.push(a);s.length>0;){a=s.pop();const o=a.transformToRoot,l=a.commands;if(a.dirtyNumber===r||t||i){const t=Matrix4.multiplyTransformation(c,o,a.computedMatrix),i=l.length;if(i>0)for(let r=0;r<i;++r){const i=l[r];let o=i.command;Matrix4.clone(t,o.modelMatrix),BoundingSphere.transform(i.boundingSphere,o.modelMatrix,o.boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,o.boundingVolume.center,o.boundingVolume.center),o=i.command2D,defined(o)&&e._mode===SceneMode$1.SCENE2D&&(Matrix4.clone(t,o.modelMatrix),o.modelMatrix[13]-=2*CesiumMath.sign(o.modelMatrix[13])*CesiumMath.PI*n.ellipsoid.maximumRadius,BoundingSphere.transform(i.boundingSphere,o.modelMatrix,o.boundingVolume))}}const u=a.children;if(defined(u)){const e=u.length;for(let t=0;t<e;++t){const e=u[t];e.dirtyNumber=Math.max(e.dirtyNumber,a.dirtyNumber),(e.dirtyNumber===r||i)&&(getNodeMatrix(e,e.transformToRoot),Matrix4.multiplyTransformation(o,e.transformToRoot,e.transformToRoot)),s.push(e)}}}}++e._maxDirtyNumber}let scratchObjectSpace=new Matrix4;function applySkins(e){const t=e._runtime.skinnedNodes,i=t.length;for(let e=0;e<i;++e){const i=t[e];scratchObjectSpace=Matrix4.inverseTransformation(i.transformToRoot,scratchObjectSpace);const n=i.computedJointMatrices,r=i.joints,o=i.bindShapeMatrix,a=i.inverseBindMatrices,s=a.length;for(let e=0;e<s;++e)defined(n[e])||(n[e]=new Matrix4),n[e]=Matrix4.multiplyTransformation(scratchObjectSpace,r[e].transformToRoot,n[e]),n[e]=Matrix4.multiplyTransformation(n[e],a[e],n[e]),defined(o)&&(n[e]=Matrix4.multiplyTransformation(n[e],o,n[e]))}}function updatePerNodeShow(e){const t=e._runtime.rootNodes,i=t.length,n=scratchNodeStack;for(let e=0;e<i;++e){let i=t[e];for(i.computedShow=i.publicNode.show,n.push(i);n.length>0;){i=n.pop();const e=i.computedShow,t=i.commands,r=t.length;for(let i=0;i<r;++i)t[i].show=e;const o=i.children;if(defined(o)){const t=o.length;for(let i=0;i<t;++i){const t=o[i];t.computedShow=e&&t.publicNode.show,n.push(t)}}}}}function updatePickIds(e,t){const i=e.id;if(e._id!==i){e._id=i;const t=e._pickIds,n=t.length;for(let e=0;e<n;++e)t[e].object.id=i}}function updateWireframe$1(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;const t=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,i=e._nodeCommands,n=i.length;for(let e=0;e<n;++e)i[e].command.primitiveType=t}}function updateShowBoundingVolume$2(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;const t=e.debugShowBoundingVolume,i=e._nodeCommands,n=i.length;for(let e=0;e<n;++e)i[e].command.debugShowBoundingVolume=t}}function updateShadows$1(e){if(e.shadows!==e._shadows){e._shadows=e.shadows;const t=ShadowMode$1.castShadows(e.shadows),i=ShadowMode$1.receiveShadows(e.shadows),n=e._nodeCommands,r=n.length;for(let e=0;e<r;e++){const r=n[e];r.command.castShadows=t,r.command.receiveShadows=i}}}function getTranslucentRenderState$1(e,t){const i=clone$1(t,!0);return i.cull.enabled=!1,i.depthTest.enabled=!0,i.depthMask=!1,i.blending=BlendingState$1.ALPHA_BLEND,e.opaquePass===Pass$1.CESIUM_3D_TILE&&(i.stencilTest=StencilConstants$1.setCesium3DTileBit(),i.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),RenderState.fromCache(i)}function deriveTranslucentCommand$1(e,t){const i=DrawCommand.shallowClone(t);return i.pass=Pass$1.TRANSLUCENT,i.renderState=getTranslucentRenderState$1(e,t.renderState),i}function updateColor(e,t,i){const n=t.scene3DOnly,r=e.color.alpha;if(r>0&&r<1){const t=e._nodeCommands,r=t.length;if(r>0&&(!defined(t[0].translucentCommand)||i))for(let i=0;i<r;++i){const r=t[i],o=r.command;if(r.translucentCommand=deriveTranslucentCommand$1(e,o),!n){const t=r.command2D;r.translucentCommand2D=deriveTranslucentCommand$1(e,t)}}}}function getDisableCullingRenderState$1(e){const t=clone$1(e,!0);return t.cull.enabled=!1,RenderState.fromCache(t)}function deriveDisableCullingCommand(e){const t=DrawCommand.shallowClone(e);return t.renderState=getDisableCullingRenderState$1(e.renderState),t}function updateBackFaceCulling$1(e,t,i){const n=t.scene3DOnly;if(!e.backFaceCulling){const t=e._nodeCommands,r=t.length;if(r>0&&(!defined(t[0].disableCullingCommand)||i))for(let e=0;e<r;++e){const i=t[e],r=i.command;if(i.disableCullingCommand=deriveDisableCullingCommand(r),!n){const e=i.command2D;i.disableCullingCommand2D=deriveDisableCullingCommand(e)}}}}function getProgramId(e,t){const i=e._rendererResources.programs;for(const e in i)if(i.hasOwnProperty(e)&&i[e]===t)return e}function createSilhouetteProgram(e,t,i){let n=t.vertexShaderSource.sources[0];const r=t._attributeLocations,o=e._normalAttributeName;n=ShaderSource.replaceMain(n,"gltf_silhouette_main"),n+=`uniform float gltf_silhouetteSize; \nvoid main() \n{ \n gltf_silhouette_main(); \n vec3 n = normalize(czm_normal3D * ${o}); \n n.x *= czm_projection[0][0]; \n n.y *= czm_projection[1][1]; \n vec4 clip = gl_Position; \n clip.xy += n.xy * clip.w * gltf_silhouetteSize * czm_pixelRatio / czm_viewport.z; \n gl_Position = clip; \n}`;return ShaderProgram.fromCache({context:i.context,vertexShaderSource:n,fragmentShaderSource:"uniform vec4 gltf_silhouetteColor; \nvoid main() \n{ \n gl_FragColor = czm_gammaCorrect(gltf_silhouetteColor); \n}",attributeLocations:r})}function hasSilhouette(e,t){return silhouetteSupported(t.context)&&e.silhouetteSize>0&&e.silhouetteColor.alpha>0&&defined(e._normalAttributeName)}function hasTranslucentCommands(e){const t=e._nodeCommands,i=t.length;for(let e=0;e<i;++e){if(t[e].command.pass===Pass$1.TRANSLUCENT)return!0}return!1}function isTranslucent(e){return e.color.alpha>0&&e.color.alpha<1}function isInvisible(e){return 0===e.color.alpha}function alphaDirty(e,t){return Math.floor(e)!==Math.floor(t)||Math.ceil(e)!==Math.ceil(t)}let silhouettesLength=0;function createSilhouetteCommands(e,t){const i=++silhouettesLength%255,n=hasTranslucentCommands(e)||isTranslucent(e)||e.silhouetteColor.alpha<1,r=e._rendererResources.silhouettePrograms,o=t.scene3DOnly,a=e._nodeCommands,s=a.length;for(let c=0;c<s;++c){const s=a[c],l=s.command,u=isTranslucent(e)?s.translucentCommand:l,d=DrawCommand.shallowClone(u);let h=clone$1(u.renderState);h.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.ALWAYS,backFunction:WebGLConstants$1.ALWAYS,reference:i,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE}},isInvisible(e)&&(h.colorMask={red:!1,green:!1,blue:!1,alpha:!1},h.depthMask=!1),h=RenderState.fromCache(h),d.renderState=h,s.silhouetteModelCommand=d;const p=DrawCommand.shallowClone(l);h=clone$1(l.renderState,!0),h.depthTest.enabled=!0,h.cull.enabled=!1,n&&(p.pass=Pass$1.TRANSLUCENT,h.depthMask=!1,h.blending=BlendingState$1.ALPHA_BLEND),h.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.NOTEQUAL,backFunction:WebGLConstants$1.NOTEQUAL,reference:i,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP}},h=RenderState.fromCache(h);const f=l.shaderProgram,m=getProgramId(e,f);let g=r[m];defined(g)||(g=createSilhouetteProgram(e,f,t),r[m]=g);const _=combine$2(l.uniformMap,{gltf_silhouetteColor:createSilhouetteColorFunction(e),gltf_silhouetteSize:createSilhouetteSizeFunction(e)});if(p.renderState=h,p.shaderProgram=g,p.uniformMap=_,p.castShadows=!1,p.receiveShadows=!1,s.silhouetteColorCommand=p,!o){const e=s.command2D,t=DrawCommand.shallowClone(d);t.boundingVolume=e.boundingVolume,t.modelMatrix=e.modelMatrix,s.silhouetteModelCommand2D=t;const i=DrawCommand.shallowClone(p);t.boundingVolume=e.boundingVolume,t.modelMatrix=e.modelMatrix,s.silhouetteColorCommand2D=i}}}function modifyShaderForClippingPlanes(e,t,i){return e=ShaderSource.replaceMain(e,"gltf_clip_main"),e+=`${Model._getClippingFunction(t,i)}\n`,e+=`uniform highp sampler2D gltf_clippingPlanes; \nuniform mat4 gltf_clippingPlanesMatrix; \nuniform vec4 gltf_clippingPlanesEdgeStyle; \nvoid main() \n{ \n gltf_clip_main(); \n${getClipAndStyleCode("gltf_clippingPlanes","gltf_clippingPlanesMatrix","gltf_clippingPlanesEdgeStyle")}} \n`}function updateSilhouette(e,t,i){if(!hasSilhouette(e,t))return;const n=e._nodeCommands,r=n.length>0&&(alphaDirty(e.color.alpha,e._colorPreviousAlpha)||alphaDirty(e.silhouetteColor.alpha,e._silhouetteColorPreviousAlpha)||!defined(n[0].silhouetteModelCommand));e._colorPreviousAlpha=e.color.alpha,e._silhouetteColorPreviousAlpha=e.silhouetteColor.alpha,(r||i)&&createSilhouetteCommands(e,t)}function updateClippingPlanes$1(e,t){const i=e._clippingPlanes;defined(i)&&i.owner===e&&i.enabled&&i.update(t)}const scratchBoundingSphere$2=new BoundingSphere;function scaleInPixels$1(e,t,i){return scratchBoundingSphere$2.center=e,scratchBoundingSphere$2.radius=t,i.camera.getPixelSize(scratchBoundingSphere$2,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}const scratchPosition$9=new Cartesian3,scratchCartographic$e=new Cartographic;function getScale$1(e,t){let i=e.scale;if(0!==e.minimumPixelSize){const n=t.context,r=Math.max(n.drawingBufferWidth,n.drawingBufferHeight),o=defined(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;if(scratchPosition$9.x=o[12],scratchPosition$9.y=o[13],scratchPosition$9.z=o[14],defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,scratchPosition$9,scratchPosition$9),e._mode!==SceneMode$1.SCENE3D){const e=t.mapProjection,i=e.ellipsoid.cartesianToCartographic(scratchPosition$9,scratchCartographic$e);e.project(i,scratchPosition$9),Cartesian3.fromElements(scratchPosition$9.z,scratchPosition$9.x,scratchPosition$9.y,scratchPosition$9)}const a=e.boundingSphere.radius,s=scaleInPixels$1(scratchPosition$9,a,t),c=1/s;Math.min(c*(2*a),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*s/(2*e._initialRadius))}return defined(e.maximumScale)?Math.min(e.maximumScale,i):i}function releaseCachedGltf(e){defined(e._cacheKey)&&defined(e._cachedGltf)&&0==--e._cachedGltf.count&&delete gltfCache[e._cacheKey],e._cachedGltf=void 0}function CachedRendererResources(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.sourceShaders=void 0,this.silhouettePrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function destroy(e){for(const t in e)e.hasOwnProperty(t)&&e[t].destroy()}function destroyCachedRendererResources(e){destroy(e.buffers),destroy(e.vertexArrays),destroy(e.programs),destroy(e.silhouettePrograms),destroy(e.textures)}function getUpdateHeightCallback(e,t,i){return function(n){if(e.heightReference===HeightReference$1.RELATIVE_TO_GROUND){const e=t.cartesianToCartographic(n,scratchCartographic$e);e.height+=i.height,t.cartographicToCartesian(e,n)}const r=e._clampedModelMatrix;Matrix4.clone(e.modelMatrix,r),r[12]=n.x,r[13]=n.y,r[14]=n.z,e._heightChanged=!0}}function updateClamping(e){defined(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);const t=e._scene;if(!defined(t)||!defined(t.globe)||e.heightReference===HeightReference$1.NONE)return void(e._clampedModelMatrix=void 0);const i=t.globe,n=i.ellipsoid,r=e.modelMatrix;scratchPosition$9.x=r[12],scratchPosition$9.y=r[13],scratchPosition$9.z=r[14];const o=n.cartesianToCartographic(scratchPosition$9);defined(e._clampedModelMatrix)||(e._clampedModelMatrix=Matrix4.clone(r,new Matrix4));const a=i._surface;e._removeUpdateHeightCallback=a.updateHeight(o,getUpdateHeightCallback(e,n,o));const s=i.getHeight(o);if(defined(s)){const t=getUpdateHeightCallback(e,n,o);Cartographic.clone(o,scratchCartographic$e),scratchCartographic$e.height=s,n.cartographicToCartesian(scratchCartographic$e,scratchPosition$9),t(scratchPosition$9)}}CachedRendererResources.prototype.release=function(){if(0==--this.count)return defined(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],destroyCachedRendererResources(this),destroyObject(this)};const scratchDisplayConditionCartesian=new Cartesian3,scratchDistanceDisplayConditionCartographic=new Cartographic;function distanceDisplayConditionVisible(e,t){let i;const n=e.distanceDisplayCondition,r=n.near*n.near,o=n.far*n.far;if(t.mode===SceneMode$1.SCENE2D){i=.5*(t.camera.frustum.right-t.camera.frustum.left),i*=i}else{let n=Matrix4.getTranslation(e.modelMatrix,scratchDisplayConditionCartesian);if(t.mode===SceneMode$1.COLUMBUS_VIEW){const e=t.mapProjection,i=e.ellipsoid.cartesianToCartographic(n,scratchDistanceDisplayConditionCartographic);n=e.project(i,n),Cartesian3.fromElements(n.z,n.x,n.y,n)}i=Cartesian3.distanceSquared(n,t.camera.positionWC)}return i>=r&&i<=o}const scratchClippingPlanesMatrix$2=new Matrix4;function destroyIfNotCached(e,t){e.programs!==t.programs&&destroy(e.programs),e.silhouettePrograms!==t.silhouettePrograms&&destroy(e.silhouettePrograms)}function regenerateShaders(e,t){const i=e._rendererResources,n=e._cachedRendererResources;let r;if(destroyIfNotCached(i,n),isClippingEnabled(e)||isColorShadingEnabled(e)||e.splitDirection!==SplitDirection$1.NONE||e._shouldRegenerateShaders){e._shouldRegenerateShaders=!1,i.programs={},i.silhouettePrograms={};const n={},o=e._sourceTechniques;let a;for(const i in o)o.hasOwnProperty(i)&&(a=o[i],r=a.program,n[r]||(n[r]=!0,recreateProgram({programId:r,techniqueId:i},e,t.context)))}else i.programs=n.programs,i.silhouettePrograms=n.silhouettePrograms;const o=i.programs,a=e._nodeCommands,s=a.length;for(let e=0;e<s;++e){const t=a[e];r=t.programId;const i=o[r];t.command.shaderProgram=i,defined(t.command2D)&&(t.command2D.shaderProgram=i)}updateColor(e,t,!0),updateBackFaceCulling$1(e,t,!0),updateSilhouette(e,t,!0)}function Batched3DModel3DTileContent(e,t,i,n,r){this._tileset=e,this._tile=t,this._resource=i,this._model=void 0,this._batchTable=void 0,this._features=void 0,this._classificationType=e.vectorClassificationOnly?void 0:e.classificationType,this._metadata=void 0,this._batchIdAttributeName=void 0,this._diffuseAttributeOrUniformName={},this._rtcCenterTransform=void 0,this._contentModelMatrix=void 0,this.featurePropertiesDirty=!1,this._group=void 0,initialize$b(this,n,r)}function getBatchIdAttributeName(e){let t=ModelUtility.getAttributeOrUniformBySemantic(e,"_BATCHID");return defined(t)||(t=ModelUtility.getAttributeOrUniformBySemantic(e,"BATCHID"),defined(t)&&Batched3DModel3DTileContent._deprecationWarning("b3dm-legacy-batchid","The glTF in this b3dm uses the semantic `BATCHID`. Application-specific semantics should be prefixed with an underscore: `_BATCHID`.")),t}function getVertexShaderCallback$1(e){return function(t,i){const n=e._batchTable,r=!defined(e._classificationType),o=e._model.gltf;defined(o)&&(e._batchIdAttributeName=getBatchIdAttributeName(o),e._diffuseAttributeOrUniformName[i]=ModelUtility.getDiffuseAttributeOrUniform(o,i));const a=n.getVertexShaderCallback(r,e._batchIdAttributeName,e._diffuseAttributeOrUniformName[i]);return defined(a)?a(t):t}}function getFragmentShaderCallback$1(e){return function(t,i){const n=e._batchTable,r=!defined(e._classificationType),o=e._model.gltf;defined(o)&&(e._diffuseAttributeOrUniformName[i]=ModelUtility.getDiffuseAttributeOrUniform(o,i));const a=n.getFragmentShaderCallback(r,e._diffuseAttributeOrUniformName[i],!1);return defined(a)?a(t):t}}function getPickIdCallback$1(e){return function(){return e._batchTable.getPickId()}}function getClassificationFragmentShaderCallback(e){return function(t){const i=e._batchTable.getClassificationFragmentShaderCallback();return defined(i)?i(t):t}}function createColorChangedCallback$2(e){return function(t,i){e._model.updateCommands(t,i)}}function initialize$b(e,t,i){const n=e._tileset,r=e._tile,o=e._resource,a=B3dmParser.parse(t,i);let s=a.batchLength;const c=new Cesium3DTileFeatureTable(a.featureTableJson,a.featureTableBinary);s=c.getGlobalProperty("BATCH_LENGTH"),c.featuresLength=s;const l=a.batchTableJson,u=a.batchTableBinary;let d;defined(e._classificationType)&&(d=createColorChangedCallback$2(e));const h=new Cesium3DTileBatchTable(e,s,l,u,d);e._batchTable=h;const p=a.gltf,f={content:e,primitive:n};e._rtcCenterTransform=Matrix4.IDENTITY;const m=c.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(m)&&(e._rtcCenterTransform=Matrix4.fromTranslation(Cartesian3.fromArray(m))),e._contentModelMatrix=Matrix4.multiply(r.computedTransform,e._rtcCenterTransform,new Matrix4),defined(e._classificationType)?e._model=new ClassificationModel({gltf:p,cull:!1,basePath:o,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:n._gltfUpAxis,forwardAxis:Axis$1.X,debugWireframe:n.debugWireframe,vertexShaderLoaded:getVertexShaderCallback$1(e),classificationShaderLoaded:getClassificationFragmentShaderCallback(e),uniformMapLoaded:h.getUniformMapCallback(),pickIdLoaded:getPickIdCallback$1(e),classificationType:e._classificationType,batchTable:h}):(e._model=new Model({gltf:p,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:o,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:n._gltfUpAxis,forwardAxis:Axis$1.X,shadows:n.shadows,debugWireframe:n.debugWireframe,incrementallyLoadTextures:!1,vertexShaderLoaded:getVertexShaderCallback$1(e),fragmentShaderLoaded:getFragmentShaderCallback$1(e),uniformMapLoaded:h.getUniformMapCallback(),pickIdLoaded:getPickIdCallback$1(e),addBatchIdToGeneratedShaders:s>0,pickObject:f,lightColor:n.lightColor,imageBasedLighting:n.imageBasedLighting,backFaceCulling:n.backFaceCulling,showOutline:n.showOutline,showCreditsOnScreen:n.showCreditsOnScreen}),e._model.readyPromise.then((function(e){e.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})})))}function createFeatures$4(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const i=new Array(t);for(let n=0;n<t;++n)i[n]=new Cesium3DTileFeature(e,n);e._features=i}}function Composite3DTileContent(e,t,i,n,r,o){this._tileset=e,this._tile=t,this._resource=i,this._contents=[],this._readyPromise=defer(),this._metadata=void 0,this._group=void 0,initialize$a(this,n,r,o)}Model.prototype.update=function(e){if(e.mode===SceneMode$1.MORPHING)return;if(!FeatureDetection.supportsWebP.initialized)return void FeatureDetection.supportsWebP.initialize();const t=e.context;this._defaultTexture=t.defaultTexture;const i=FeatureDetection.supportsWebP();if(this._state===ModelState.NEEDS_LOAD&&defined(this.gltf)){let i;const n=this.cacheKey;if(defined(n)){t.cache.modelRendererResourceCache=defaultValue(t.cache.modelRendererResourceCache,{});const e=t.cache.modelRendererResourceCache;if(i=e[this.cacheKey],defined(i)){if(!i.ready)return;++i.count,this._loadRendererResourcesFromCache=!0}else i=new CachedRendererResources(t,n),i.count=1,e[this.cacheKey]=i;this._cachedRendererResources=i}else i=new CachedRendererResources(t),i.count=1,this._cachedRendererResources=i;if(this._state=ModelState.LOADING,this._state!==ModelState.FAILED){const t=this.gltf.extensions;if(defined(t)&&defined(t.CESIUM_RTC)){const i=Cartesian3.fromArray(t.CESIUM_RTC.center);if(!Cartesian3.equals(i,Cartesian3.ZERO)){this._rtcCenter3D=i;const t=e.mapProjection,n=t.ellipsoid.cartesianToCartographic(this._rtcCenter3D),r=t.project(n);Cartesian3.fromElements(r.z,r.x,r.y,r),this._rtcCenter2D=r,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}addPipelineExtras(this.gltf),this._loadResources=new ModelLoadResources,this._loadRendererResourcesFromCache||ModelUtility.parseBuffers(this,bufferLoad)}}const n=this._loadResources,r=this._incrementallyLoadTextures;let o=!1;if(this._state===ModelState.LOADING){if(0===n.pendingBufferLoads){if(!n.initialized){if(e.brdfLutGenerator.update(e),ModelUtility.checkSupportedExtensions(this.extensionsRequired,i),ModelUtility.updateForwardAxis(this),!defined(this.gltf.extras.sourceVersion)){const e=this.gltf;e.extras.sourceVersion=ModelUtility.getAssetVersion(e),e.extras.sourceKHRTechniquesWebGL=defined(ModelUtility.getUsedExtensions(e).KHR_techniques_webgl),this._sourceVersion=e.extras.sourceVersion,this._sourceKHRTechniquesWebGL=e.extras.sourceKHRTechniquesWebGL,updateVersion(e),addDefaults(e);const t={addBatchIdToGeneratedShaders:this._addBatchIdToGeneratedShaders};processModelMaterialsCommon(e,t),processPbrMaterials(e,t)}this._sourceVersion=this.gltf.extras.sourceVersion,this._sourceKHRTechniquesWebGL=this.gltf.extras.sourceKHRTechniquesWebGL,this._dequantizeInShader=this._dequantizeInShader&&DracoLoader.hasExtension(this),addBuffersToLoadResources(this),parseArticulations(this),parseTechniques(this),this._loadRendererResourcesFromCache||(parseBufferViews(this),parseShaders(this),parsePrograms(this),parseTextures(this,t,i)),parseMaterials(this),parseMeshes(this),parseNodes(this),parseCredits(this),DracoLoader.parse(this,t),n.initialized=!0}n.finishedDecoding()||DracoLoader.decodeModel(this,t).catch(ModelUtility.getFailedLoadFunction(this,"model",this.basePath)),n.finishedDecoding()&&!n.resourcesParsed&&(this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,DracoLoader.cacheDataForModel(this),n.resourcesParsed=!0),n.resourcesParsed&&0===n.pendingShaderLoads&&(this.showOutline&&ModelOutlineLoader.outlinePrimitives(this),createResources$4(this,e))}(n.finished()||r&&n.finishedEverythingButTextureCreation())&&(this._state=ModelState.LOADED,o=!0)}if(defined(n)&&this._state===ModelState.LOADED&&(r&&!o&&createResources$4(this,e),n.finished())){this._loadResources=void 0;const e=this._rendererResources,t=this._cachedRendererResources;t.buffers=e.buffers,t.vertexArrays=e.vertexArrays,t.programs=e.programs,t.sourceShaders=e.sourceShaders,t.silhouettePrograms=e.silhouettePrograms,t.textures=e.textures,t.samplers=e.samplers,t.renderStates=e.renderStates,t.ready=!0,this._normalAttributeName=ModelUtility.getAttributeOrUniformBySemantic(this.gltf,"NORMAL"),defined(this._precreatedAttributes)&&(t.vertexArrays={}),this.releaseGltfJson&&releaseCachedGltf(this)}const a=hasSilhouette(this,e),s=isTranslucent(this),c=isInvisible(this),l=this.backFaceCulling,u=!defined(this.distanceDisplayCondition)||distanceDisplayConditionVisible(this,e),d=this.show&&u&&0!==this.scale&&(!c||a);if(this._imageBasedLighting.update(e),d&&this._state===ModelState.LOADED||o){const i=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;let n=this.modelMatrix;const r=e.mode!==this._mode;this._mode=e.mode;const a=!Matrix4.equals(this._modelMatrix,n)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale||this._heightReference!==this.heightReference||this._heightChanged||r;if(a||o){Matrix4.clone(n,this._modelMatrix),updateClamping(this),defined(this._clampedModelMatrix)&&(n=this._clampedModelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale,this._heightReference=this.heightReference,this._heightChanged=!1;const t=getScale$1(this,e),i=this._computedModelMatrix;Matrix4.multiplyByUniformScale(n,t,i),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(i,Axis$1.Y_UP_TO_Z_UP,i):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(i,Axis$1.X_UP_TO_Z_UP,i),this.forwardAxis===Axis$1.Z&&Matrix4.multiplyTransformation(i,Axis$1.Z_UP_TO_X_UP,i)}(i||a||o)&&(updateNodeHierarchyModelMatrix(this,a,o,e.mapProjection),this._dirty=!0,(i||o)&&applySkins(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,updatePerNodeShow(this)),updatePickIds(this),updateWireframe$1(this),updateShowBoundingVolume$2(this),updateShadows$1(this),updateClippingPlanes$1(this,e);const s=this._clippingPlanes;let c=0;const l=defaultValue(this.referenceMatrix,n);if(this._imageBasedLighting.referenceMatrix=l,this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._imageBasedLighting.shouldRegenerateShaders,isClippingEnabled(this)){let e=scratchClippingPlanesMatrix$2;e=Matrix4.multiply(t.uniformState.view3D,l,e),e=Matrix4.multiply(e,s.modelMatrix,e),this._clippingPlanesMatrix=Matrix4.inverseTranspose(e,this._clippingPlanesMatrix),c=s.clippingPlanesState}this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._clippingPlanesState!==c,this._clippingPlanesState=c;const u=isColorShadingEnabled(this);u!==this._colorShadingEnabled&&(this._colorShadingEnabled=u,this._shouldRegenerateShaders=!0);const d=this.splitDirection!==SplitDirection$1.NONE;this._splittingEnabled!==d&&(this._splittingEnabled=d,this._shouldRegenerateShaders=!0),this._shouldRegenerateShaders?regenerateShaders(this,e):(updateColor(this,e,!1),updateBackFaceCulling$1(this,e,!1),updateSilhouette(this,e,!1))}if(o){const t=this;return void e.afterRender.push((function(){t._ready=!0,t._readyPromise.resolve(t)}))}if(d&&!this._ignoreCommands){const t=e.commandList,i=e.passes,n=this._nodeCommands,r=n.length;let o,c;const u=e.mapProjection.ellipsoid.maximumRadius*CesiumMath.PI;let d;if(i.render||i.pick&&this.allowPicking){for(o=0;o<r;++o)if(c=n[o],c.show){let i=c.command;if(a?i=c.silhouetteModelCommand:s?i=c.translucentCommand:l||(i=c.disableCullingCommand),t.push(i),d=c.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(d.center.y+d.radius>u||d.center.y-d.radius<u)){let e=c.command2D;a?e=c.silhouetteModelCommand2D:s?e=c.translucentCommand2D:l||(e=c.disableCullingCommand2D),t.push(e)}}if(a&&!i.pick)for(o=0;o<r;++o)c=n[o],c.show&&(t.push(c.silhouetteColorCommand),d=c.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(d.center.y+d.radius>u||d.center.y-d.radius<u)&&t.push(c.silhouetteColorCommand2D))}}const h=this._credit;defined(h)&&e.creditDisplay.addCredit(h);const p=this._resourceCredits,f=p.length;for(let t=0;t<f;t++)e.creditDisplay.addCredit(p[t]);const m=this._gltfCredits,g=m.length;for(let t=0;t<g;t++)e.creditDisplay.addCredit(m[t])},Model.prototype.isDestroyed=function(){return!1},Model.prototype.destroy=function(){defined(this._precreatedAttributes)&&destroy(this._rendererResources.vertexArrays),defined(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),defined(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0),defined(this._cachedRendererResources)&&destroyIfNotCached(this._rendererResources,this._cachedRendererResources),this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release(),DracoLoader.destroyCachedDataForModel(this);const e=this._pickIds,t=e.length;for(let i=0;i<t;++i)e[i].destroy();releaseCachedGltf(this),this._quantizedVertexShaders=void 0;const i=this._clippingPlanes;return defined(i)&&!i.isDestroyed()&&i.owner===this&&i.destroy(),this._clippingPlanes=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,destroyObject(this)},Model._getClippingFunction=getClippingFunction,Model._modifyShaderForColor=modifyShaderForColor,Batched3DModel3DTileContent._deprecationWarning=deprecationWarning,Object.defineProperties(Batched3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this.batchTable.featuresLength}},pointsLength:{get:function(){return this._model.pointsLength}},trianglesLength:{get:function(){return this._model.trianglesLength}},geometryByteLength:{get:function(){return this._model.geometryByteLength}},texturesByteLength:{get:function(){return this._model.texturesByteLength}},batchTableByteLength:{get:function(){return this.batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}}),Batched3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Batched3DModel3DTileContent.prototype.getFeature=function(e){return createFeatures$4(this),this._features[e]},Batched3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,0===this.featuresLength?this._model.color=t:this._batchTable.setAllColor(t)},Batched3DModel3DTileContent.prototype.applyStyle=function(e){if(0===this.featuresLength){const t=defined(e)&&defined(e.color),i=defined(e)&&defined(e.show);this._model.color=t?e.color.evaluateColor(void 0,this._model.color):Color.clone(Color.WHITE,this._model.color),this._model.show=!i||e.show.evaluate(void 0)}else this._batchTable.applyStyle(e)},Batched3DModel3DTileContent.prototype.update=function(e,t){const i=t.commandList.length,n=this._model,r=this._tile,o=this._batchTable;o.update(e,t),this._contentModelMatrix=Matrix4.multiply(r.computedTransform,this._rtcCenterTransform,this._contentModelMatrix),n.modelMatrix=this._contentModelMatrix,n.shadows=e.shadows,n.lightColor=e.lightColor,n.imageBasedLighting=e.imageBasedLighting,n.backFaceCulling=e.backFaceCulling,n.debugWireframe=e.debugWireframe,n.showCreditsOnScreen=e.showCreditsOnScreen,n.splitDirection=e.splitDirection;const a=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,defined(a)&&r.clippingPlanesDirty&&(n._clippingPlanes=a.enabled&&r._isClipped?a:void 0),defined(a)&&defined(n._clippingPlanes)&&n._clippingPlanes!==a&&(n._clippingPlanes=a),n.update(t);i<t.commandList.length&&(t.passes.render||t.passes.pick)&&!defined(this._classificationType)&&o.addDerivedCommands(t,i)},Batched3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Batched3DModel3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Composite3DTileContent.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let i=0;i<t;++i)if(e[i].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,i=t.length;for(let n=0;n<i;++n)t[n].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e;const t=this._contents,i=t.length;for(let n=0;n<i;++n)t[n].metadata=e}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e;const t=this._contents,i=t.length;for(let n=0;n<i;++n)t[n].group=e}}});const sizeOfUint32$4=Uint32Array.BYTES_PER_ELEMENT;function initialize$a(e,t,i,n){i=defaultValue(i,0);const r=new Uint8Array(t),o=new DataView(t);i+=sizeOfUint32$4;const a=o.getUint32(i,!0);if(1!==a)throw new RuntimeError(`Only Composite Tile version 1 is supported. Version ${a} is not.`);i+=sizeOfUint32$4,i+=sizeOfUint32$4;const s=o.getUint32(i,!0);i+=sizeOfUint32$4;const c=[];for(let a=0;a<s;++a){const a=getMagic(r,i),s=o.getUint32(i+2*sizeOfUint32$4,!0),l=n[a];if(!defined(l))throw new RuntimeError(`Unknown tile content type, ${a}, inside Composite tile`);{const n=l(e._tileset,e._tile,e._resource,t,i);e._contents.push(n),c.push(n.readyPromise)}i+=s}Promise.all(c).then((function(){e._readyPromise.resolve(e)})).catch((function(t){e._readyPromise.reject(t)}))}function Vector3DTileGeometry(e){this._boxes=e.boxes,this._boxBatchIds=e.boxBatchIds,this._cylinders=e.cylinders,this._cylinderBatchIds=e.cylinderBatchIds,this._ellipsoids=e.ellipsoids,this._ellipsoidBatchIds=e.ellipsoidBatchIds,this._spheres=e.spheres,this._sphereBatchIds=e.sphereBatchIds,this._modelMatrix=e.modelMatrix,this._batchTable=e.batchTable,this._boundingVolume=e.boundingVolume,this._center=e.center,defined(this._center)||(defined(this._boundingVolume)?this._center=Cartesian3.clone(this._boundingVolume.center):this._center=Cartesian3.clone(Cartesian3.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._readyPromise=defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer$4(e){const t=new Float64Array(Matrix4.packedLength+Cartesian3.packedLength);let i=0;return Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Matrix4.pack(e._modelMatrix,t,i),t}function unpackBuffer$1(e,t){let i=0;const n=t[i++],r=t[i++],o=e._boundingVolumes=new Array(r);for(let e=0;e<r;++e)o[e]=BoundingSphere.unpack(t,i),i+=BoundingSphere.packedLength;const a=t[i++],s=e._batchedIndices=new Array(a);for(let e=0;e<a;++e){const n=Color.unpack(t,i);i+=Color.packedLength;const r=t[i++],o=t[i++],a=t[i++],c=new Array(a);for(let e=0;e<a;++e)c[e]=t[i++];s[e]=new Vector3DTileBatch({color:n,offset:r,count:o,batchIds:c})}return n}Composite3DTileContent.prototype.hasProperty=function(e,t){return!1},Composite3DTileContent.prototype.getFeature=function(e){},Composite3DTileContent.prototype.applyDebugSettings=function(e,t){const i=this._contents,n=i.length;for(let r=0;r<n;++r)i[r].applyDebugSettings(e,t)},Composite3DTileContent.prototype.applyStyle=function(e){const t=this._contents,i=t.length;for(let n=0;n<i;++n)t[n].applyStyle(e)},Composite3DTileContent.prototype.update=function(e,t){const i=this._contents,n=i.length;for(let r=0;r<n;++r)i[r].update(e,t)},Composite3DTileContent.prototype.isDestroyed=function(){return!1},Composite3DTileContent.prototype.destroy=function(){const e=this._contents,t=e.length;for(let i=0;i<t;++i)e[i].destroy();return destroyObject(this)},Object.defineProperties(Vector3DTileGeometry.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}}),Vector3DTileGeometry.packedBoxLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedCylinderLength=Matrix4.packedLength+2,Vector3DTileGeometry.packedEllipsoidLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedSphereLength=Cartesian3.packedLength+1;const createVerticesTaskProcessor$4=new TaskProcessor("createVectorTileGeometries",5),scratchColor$k=new Color;function createPrimitive$1(e){if(!defined(e._primitive)){if(!defined(e._verticesPromise)){let t=e._boxes,i=e._boxBatchIds,n=e._cylinders,r=e._cylinderBatchIds,o=e._ellipsoids,a=e._ellipsoidBatchIds,s=e._spheres,c=e._sphereBatchIds,l=e._batchTableColors,u=e._packedBuffer;if(!defined(l)){let d=0;defined(e._boxes)&&(t=e._boxes=arraySlice(t),i=e._boxBatchIds=arraySlice(i),d+=i.length),defined(e._cylinders)&&(n=e._cylinders=arraySlice(n),r=e._cylinderBatchIds=arraySlice(r),d+=r.length),defined(e._ellipsoids)&&(o=e._ellipsoids=arraySlice(o),a=e._ellipsoidBatchIds=arraySlice(a),d+=a.length),defined(e._spheres)&&(s=e._sphere=arraySlice(s),c=e._sphereBatchIds=arraySlice(c),d+=c.length),l=e._batchTableColors=new Uint32Array(d);const h=e._batchTable;for(let e=0;e<d;++e){const t=h.getColor(e,scratchColor$k);l[e]=t.toRgba()}u=e._packedBuffer=packBuffer$4(e)}const d=[];defined(t)&&d.push(t.buffer,i.buffer),defined(n)&&d.push(n.buffer,r.buffer),defined(o)&&d.push(o.buffer,a.buffer),defined(s)&&d.push(s.buffer,c.buffer),d.push(l.buffer,u.buffer);const h={boxes:defined(t)?t.buffer:void 0,boxBatchIds:defined(t)?i.buffer:void 0,cylinders:defined(n)?n.buffer:void 0,cylinderBatchIds:defined(n)?r.buffer:void 0,ellipsoids:defined(o)?o.buffer:void 0,ellipsoidBatchIds:defined(o)?a.buffer:void 0,spheres:defined(s)?s.buffer:void 0,sphereBatchIds:defined(s)?c.buffer:void 0,batchTableColors:l.buffer,packedBuffer:u.buffer},p=e._verticesPromise=createVerticesTaskProcessor$4.scheduleTask(h,d);if(!defined(p))return;p.then((function(t){const i=new Float64Array(t.packedBuffer),n=unpackBuffer$1(e,i);e._indices=2===n?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._positions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.vertexBatchIds),e._batchIds=new Uint16Array(t.batchIds),e._ready=!0}))}e._ready&&!defined(e._primitive)&&(e._primitive=new Vector3DTilePrimitive({batchTable:e._batchTable,positions:e._positions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center,pickObject:defaultValue(e._pickObject,e)}),e._boxes=void 0,e._boxBatchIds=void 0,e._cylinders=void 0,e._cylinderBatchIds=void 0,e._ellipsoids=void 0,e._ellipsoidBatchIds=void 0,e._spheres=void 0,e._sphereBatchIds=void 0,e._center=void 0,e._modelMatrix=void 0,e._batchTable=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._indices=void 0,e._indexOffsets=void 0,e._indexCounts=void 0,e._positions=void 0,e._vertexBatchIds=void 0,e._batchIds=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._verticesPromise=void 0,e._readyPromise.resolve())}}function Geometry3DTileContent(e,t,i,n,r){this._tileset=e,this._tile=t,this._resource=i,this._geometries=void 0,this._contentReadyPromise=void 0,this._readyPromise=defer(),this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,initialize$9(this,n,r)}function createColorChangedCallback$1(e){return function(t,i){defined(e._geometries)&&e._geometries.updateCommands(t,i)}}function getBatchIds$1(e,t){let i,n,r,o,a;const s=defaultValue(e.BOXES_LENGTH,0),c=defaultValue(e.CYLINDERS_LENGTH,0),l=defaultValue(e.ELLIPSOIDS_LENGTH,0),u=defaultValue(e.SPHERES_LENGTH,0);if(s>0&&defined(e.BOX_BATCH_IDS)){const n=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,n,s)}if(c>0&&defined(e.CYLINDER_BATCH_IDS)){const i=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,i,c)}if(l>0&&defined(e.ELLIPSOID_BATCH_IDS)){const i=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,i,l)}if(u>0&&defined(e.SPHERE_BATCH_IDS)){const i=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,i,u)}const d=defined(i)||defined(n)||defined(r)||defined(o),h=s>0&&!defined(i)||c>0&&!defined(n)||l>0&&!defined(r)||u>0&&!defined(o);if(d&&h)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!(defined(i)||defined(n)||defined(r)||defined(o))){let e=0;if(!defined(i)&&s>0)for(i=new Uint16Array(s),a=0;a<s;++a)i[a]=e++;if(!defined(n)&&c>0)for(n=new Uint16Array(c),a=0;a<c;++a)n[a]=e++;if(!defined(r)&&l>0)for(r=new Uint16Array(l),a=0;a<l;++a)r[a]=e++;if(!defined(o)&&u>0)for(o=new Uint16Array(u),a=0;a<u;++a)o[a]=e++}return{boxes:i,cylinders:n,ellipsoids:r,spheres:o}}Vector3DTileGeometry.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTileGeometry.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTileGeometry.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTileGeometry.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTileGeometry.prototype.update=function(e){createPrimitive$1(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTileGeometry.prototype.isDestroyed=function(){return!1},Vector3DTileGeometry.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},Object.defineProperties(Geometry3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return defined(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});const sizeOfUint32$3=Uint32Array.BYTES_PER_ELEMENT;function initialize$9(e,t,i){i=defaultValue(i,0);const n=new Uint8Array(t),r=new DataView(t);i+=sizeOfUint32$3;const o=r.getUint32(i,!0);if(1!==o)throw new RuntimeError(`Only Geometry tile version 1 is supported. Version ${o} is not.`);i+=sizeOfUint32$3;const a=r.getUint32(i,!0);if(i+=sizeOfUint32$3,0===a)return void e._readyPromise.resolve(e);const s=r.getUint32(i,!0);if(i+=sizeOfUint32$3,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");const c=r.getUint32(i,!0);i+=sizeOfUint32$3;const l=r.getUint32(i,!0);i+=sizeOfUint32$3;const u=r.getUint32(i,!0),d=getJsonFromTypedArray(n,i+=sizeOfUint32$3,s);i+=s;const h=new Uint8Array(t,i,c);let p,f;i+=c,l>0&&(p=getJsonFromTypedArray(n,i,l),i+=l,u>0&&(f=new Uint8Array(t,i,u),f=new Uint8Array(f)));const m=defaultValue(d.BOXES_LENGTH,0),g=defaultValue(d.CYLINDERS_LENGTH,0),_=defaultValue(d.ELLIPSOIDS_LENGTH,0),y=defaultValue(d.SPHERES_LENGTH,0),C=m+g+_+y,T=new Cesium3DTileBatchTable(e,C,p,f,createColorChangedCallback$1(e));if(e._batchTable=T,0===C)return;const S=e.tile.computedTransform;let v;defined(d.RTC_CENTER)&&(v=Cartesian3.unpack(d.RTC_CENTER),Matrix4.multiplyByPoint(S,v,v));const A=getBatchIds$1(d,h);if(m>0||g>0||_>0||y>0){let t,i,n,r;if(m>0){const e=h.byteOffset+d.BOXES.byteOffset;t=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedBoxLength*m)}if(g>0){const e=h.byteOffset+d.CYLINDERS.byteOffset;i=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedCylinderLength*g)}if(_>0){const e=h.byteOffset+d.ELLIPSOIDS.byteOffset;n=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedEllipsoidLength*_)}if(y>0){const e=h.byteOffset+d.SPHERES.byteOffset;r=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedSphereLength*y)}e._geometries=new Vector3DTileGeometry({boxes:t,boxBatchIds:A.boxes,cylinders:i,cylinderBatchIds:A.cylinders,ellipsoids:n,ellipsoidBatchIds:A.ellipsoids,spheres:r,sphereBatchIds:A.spheres,center:v,modelMatrix:S,batchTable:T,boundingVolume:e.tile.boundingVolume.boundingVolume})}}function createFeatures$3(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const i=new Array(t);defined(e._geometries)&&e._geometries.createFeatures(e,i),e._features=i}}function hasExtension(e,t){return defined(e)&&defined(e.extensions)&&defined(e.extensions[t])}function ImplicitAvailabilityBitstream(e){const t=e.lengthBits;let i=e.availableCount;const n=e.constant,r=e.bitstream;if(defined(n))i=t;else{const n=Math.ceil(t/8);if(r.length!==n)throw new RuntimeError(`Availability bitstream must be exactly ${n} bytes long to store ${t} bits. Actual bitstream was ${r.length} bytes long.`);const o=defaultValue(e.computeAvailableCountEnabled,!1);!defined(i)&&o&&(i=count1Bits(r,t))}this._lengthBits=t,this._availableCount=i,this._constant=n,this._bitstream=r}function count1Bits(e,t){let i=0;for(let n=0;n<t;n++){const t=n%8;i+=e[n>>3]>>t&1}return i}function ImplicitMetadataView(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).metadataTable,i=e.class,n=e.entityId,r=e.propertyTableJson;this._class=i,this._metadataTable=t,this._entityId=n,this._extensions=r.extensions,this._extras=r.extras}Geometry3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Geometry3DTileContent.prototype.getFeature=function(e){return createFeatures$3(this),this._features[e]},Geometry3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._geometries)&&this._geometries.applyDebugSettings(e,t)},Geometry3DTileContent.prototype.applyStyle=function(e){createFeatures$3(this),defined(this._geometries)&&this._geometries.applyStyle(e,this._features)},Geometry3DTileContent.prototype.update=function(e,t){if(defined(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),defined(this._batchTable)&&this._geometries._ready&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){const e=this;this._contentReadyPromise=this._geometries.readyPromise.then((function(){e._readyPromise.resolve(e)}))}},Geometry3DTileContent.prototype.isDestroyed=function(){return!1},Geometry3DTileContent.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(ImplicitAvailabilityBitstream.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}}),ImplicitAvailabilityBitstream.prototype.getBit=function(e){if(defined(this._constant))return this._constant;const t=e>>3,i=e%8;return 1==(this._bitstream[t]>>i&1)},Object.defineProperties(ImplicitMetadataView.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),ImplicitMetadataView.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)},ImplicitMetadataView.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)},ImplicitMetadataView.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)},ImplicitMetadataView.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)},ImplicitMetadataView.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)},ImplicitMetadataView.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)},ImplicitMetadataView.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const ImplicitSubdivisionScheme={QUADTREE:"QUADTREE",OCTREE:"OCTREE",getBranchingFactor:function(e){switch(e){case ImplicitSubdivisionScheme.OCTREE:return 8;case ImplicitSubdivisionScheme.QUADTREE:return 4}}};var ImplicitSubdivisionScheme$1=Object.freeze(ImplicitSubdivisionScheme);function MetadataEntity(){}function ImplicitSubtreeMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).subtreeMetadata,i=e.class,n=defined(t.properties)?t.properties:{};this._class=i,this._properties=n,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(MetadataEntity.prototype,{class:{get:function(){DeveloperError.throwInstantiationError()}}}),MetadataEntity.prototype.hasProperty=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.hasPropertyBySemantic=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getPropertyIds=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getProperty=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.setProperty=function(e,t){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getPropertyBySemantic=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.setPropertyBySemantic=function(e,t){DeveloperError.throwInstantiationError()},MetadataEntity.hasProperty=function(e,t,i){if(defined(t[e]))return!0;const n=i.properties;if(!defined(n))return!1;const r=n[e];return!(!defined(r)||!defined(r.default))},MetadataEntity.hasPropertyBySemantic=function(e,t,i){const n=i.propertiesBySemantic;if(!defined(n))return!1;return defined(n[e])},MetadataEntity.getPropertyIds=function(e,t,i){(i=defined(i)?i:[]).length=0;for(const t in e)e.hasOwnProperty(t)&&defined(e[t])&&i.push(t);const n=t.properties;if(defined(n))for(const t in n)n.hasOwnProperty(t)&&!defined(e[t])&&defined(n[t].default)&&i.push(t);return i},MetadataEntity.getProperty=function(e,t,i){const n=i.properties[e];let r=t[e];Array.isArray(r)&&(r=r.slice());return r=n.handleNoData(r),!defined(r)&&defined(n.default)?(r=clone$1(n.default,!0),n.unpackVectorAndMatrixTypes(r,true)):defined(r)?(r=n.normalize(r),r=n.applyValueTransform(r),n.unpackVectorAndMatrixTypes(r,true)):void 0},MetadataEntity.setProperty=function(e,t,i,n){if(!defined(i[e]))return!1;let r;Array.isArray(t)&&(t=t.slice());const o=n.properties;defined(o)&&(r=o[e]);return defined(r)&&(t=r.packVectorAndMatrixTypes(t,true),t=r.unapplyValueTransform(t),t=r.unnormalize(t)),i[e]=t,!0},MetadataEntity.getPropertyBySemantic=function(e,t,i){const n=i.propertiesBySemantic;if(!defined(n))return;const r=n[e];return defined(r)?MetadataEntity.getProperty(r.id,t,i):void 0},MetadataEntity.setPropertyBySemantic=function(e,t,i,n){if(!defined(n.propertiesBySemantic))return!1;const r=n.propertiesBySemantic[e];return!!defined(r)&&MetadataEntity.setProperty(r.id,t,i,n)},Object.defineProperties(ImplicitSubtreeMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),ImplicitSubtreeMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},ImplicitSubtreeMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},ImplicitSubtreeMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},ImplicitSubtreeMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},ImplicitSubtreeMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},ImplicitSubtreeMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},ImplicitSubtreeMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)};const MetadataComponentType={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64",getMinimum:function(e){switch(e){case MetadataComponentType.INT8:return-128;case MetadataComponentType.UINT8:return 0;case MetadataComponentType.INT16:return-32768;case MetadataComponentType.UINT16:return 0;case MetadataComponentType.INT32:return-2147483648;case MetadataComponentType.UINT32:return 0;case MetadataComponentType.INT64:return FeatureDetection.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case MetadataComponentType.UINT64:return FeatureDetection.supportsBigInt()?BigInt(0):0;case MetadataComponentType.FLOAT32:return-34028234663852886e22;case MetadataComponentType.FLOAT64:return-Number.MAX_VALUE}},getMaximum:function(e){switch(e){case MetadataComponentType.INT8:return 127;case MetadataComponentType.UINT8:return 255;case MetadataComponentType.INT16:return 32767;case MetadataComponentType.UINT16:return 65535;case MetadataComponentType.INT32:return 2147483647;case MetadataComponentType.UINT32:return 4294967295;case MetadataComponentType.INT64:return FeatureDetection.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case MetadataComponentType.UINT64:return FeatureDetection.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case MetadataComponentType.FLOAT32:return 34028234663852886e22;case MetadataComponentType.FLOAT64:return Number.MAX_VALUE}},isNumericType:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.INT64:case MetadataComponentType.UINT64:case MetadataComponentType.FLOAT32:case MetadataComponentType.FLOAT64:return!0;default:return!1}},isIntegerType:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.INT64:case MetadataComponentType.UINT64:return!0;default:return!1}},isUnsignedIntegerType:function(e){switch(e){case MetadataComponentType.UINT8:case MetadataComponentType.UINT16:case MetadataComponentType.UINT32:case MetadataComponentType.UINT64:return!0;default:return!1}},isVectorCompatible:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.FLOAT32:case MetadataComponentType.FLOAT64:return!0;default:return!1}},normalize:function(e,t){return Math.max(Number(e)/Number(MetadataComponentType.getMaximum(t)),-1)},unnormalize:function(e,t){const i=MetadataComponentType.getMaximum(t),n=MetadataComponentType.isUnsignedIntegerType(t)?0:-i;return e=CesiumMath.sign(e)*Math.round(Math.abs(e)*Number(i)),t!==MetadataComponentType.INT64&&t!==MetadataComponentType.UINT64||!FeatureDetection.supportsBigInt()||(e=BigInt(e)),e>i?i:e<n?n:e},applyValueTransform:function(e,t,i){return i*e+t},unapplyValueTransform:function(e,t,i){return 0===i?0:(e-t)/i},getSizeInBytes:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:return 1;case MetadataComponentType.INT16:case MetadataComponentType.UINT16:return 2;case MetadataComponentType.INT32:case MetadataComponentType.UINT32:return 4;case MetadataComponentType.INT64:case MetadataComponentType.UINT64:return 8;case MetadataComponentType.FLOAT32:return 4;case MetadataComponentType.FLOAT64:return 8}}};var MetadataComponentType$1=Object.freeze(MetadataComponentType);const MetadataType={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM",isVectorType:function(e){switch(e){case MetadataType.VEC2:case MetadataType.VEC3:case MetadataType.VEC4:return!0;default:return!1}},isMatrixType:function(e){switch(e){case MetadataType.MAT2:case MetadataType.MAT3:case MetadataType.MAT4:return!0;default:return!1}},getComponentCount:function(e){switch(e){case MetadataType.SCALAR:case MetadataType.STRING:case MetadataType.ENUM:case MetadataType.BOOLEAN:return 1;case MetadataType.VEC2:return 2;case MetadataType.VEC3:return 3;case MetadataType.VEC4:case MetadataType.MAT2:return 4;case MetadataType.MAT3:return 9;case MetadataType.MAT4:return 16}},getMathType:function(e){switch(e){case MetadataType.VEC2:return Cartesian2;case MetadataType.VEC3:return Cartesian3;case MetadataType.VEC4:return Cartesian4;case MetadataType.MAT2:return Matrix2;case MetadataType.MAT3:return Matrix3;case MetadataType.MAT4:return Matrix4;default:return}}};var MetadataType$1=Object.freeze(MetadataType);function MetadataClassProperty(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,i=e.property,n=isLegacy(i),r=parseType(i,e.enums),o=r.componentType,a=defined(o)&&MetadataComponentType$1.isIntegerType(o)&&defaultValue(i.normalized,!1);this._id=t,this._name=i.name,this._description=i.description,this._semantic=i.semantic,this._isLegacyExtension=n,this._type=r.type,this._componentType=o,this._enumType=r.enumType,this._valueType=r.valueType,this._isArray=r.isArray,this._isVariableLengthArray=r.isVariableLengthArray,this._arrayLength=r.arrayLength,this._min=i.min,this._max=i.max,this._normalized=a;let s=i.offset,c=i.scale;const l=defined(s)||defined(c);let u;defined(s)||(s=this.expandConstant(0,true)),defined(c)||(c=this.expandConstant(1,true)),this._offset=s,this._scale=c,this._hasValueTransform=l,this._noData=i.noData,this._default=i.default,u=!!defined(n)&&(n?!defined(i.optional)||!i.optional:defaultValue(i.required,!1)),this._required=u,this._extras=i.extras,this._extensions=i.extensions}function isLegacy(e){if("ARRAY"===e.type)return!0;const t=e.type;return t!==MetadataType$1.SCALAR&&!MetadataType$1.isMatrixType(t)&&!MetadataType$1.isVectorType(t)&&(!!MetadataComponentType$1.isNumericType(t)||!(defined(e.noData)||defined(e.scale)||defined(e.offset)||defined(e.required)||defined(e.count)||defined(e.array))&&(!defined(e.optional)&&void 0))}function parseType(e,t){const i=e.type,n=e.componentType,r="ARRAY"===i;let o,a,s,c;return r?(o=!0,a=e.componentCount,s=!defined(a)):e.array?(o=!0,a=e.count,s=!defined(e.count)):(o=!1,a=void 0,s=!1),defined(e.enumType)&&(c=t[e.enumType]),i===MetadataType$1.ENUM?{type:i,componentType:void 0,enumType:c,valueType:c.valueType,isArray:o,isVariableLengthArray:s,arrayLength:a}:r&&n===MetadataType$1.ENUM?{type:n,componentType:void 0,enumType:c,valueType:c.valueType,isArray:o,isVariableLengthArray:s,arrayLength:a}:i===MetadataType$1.SCALAR||MetadataType$1.isMatrixType(i)||MetadataType$1.isVectorType(i)?{type:i,componentType:n,enumType:void 0,valueType:n,isArray:o,isVariableLengthArray:s,arrayLength:a}:i===MetadataType$1.BOOLEAN||i===MetadataType$1.STRING?{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:o,isVariableLengthArray:s,arrayLength:a}:!r||n!==MetadataType$1.BOOLEAN&&n!==MetadataType$1.STRING?defined(n)&&MetadataComponentType$1.isNumericType(n)?{type:MetadataType$1.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:o,isVariableLengthArray:s,arrayLength:a}:MetadataComponentType$1.isNumericType(i)?{type:MetadataType$1.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:o,isVariableLengthArray:s,arrayLength:a}:void 0:{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:o,isVariableLengthArray:s,arrayLength:a}}function arrayEquals(e,t){if(!Array.isArray(e))return e===t;if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!arrayEquals(e[i],t[i]))return!1;return!0}function validateArray(e,t){if(!Array.isArray(t))return`value ${t} must be an array`;const i=t.length;if(!e._isVariableLengthArray&&i!==e._arrayLength)return"Array length does not match property.arrayLength";for(let n=0;n<i;n++){const i=validateSingleValue(e,t[n]);if(defined(i))return i}}function validateSingleValue(e,t){const i=e._type,n=e._componentType,r=e._enumType,o=e._normalized;return MetadataType$1.isVectorType(i)?validateVector(t,i,n):MetadataType$1.isMatrixType(i)?validateMatrix(t,i,n):i===MetadataType$1.STRING?validateString(t):i===MetadataType$1.BOOLEAN?validateBoolean(t):i===MetadataType$1.ENUM?validateEnum(t,r):validateScalar(t,n,o)}function validateVector(e,t,i){return MetadataComponentType$1.isVectorCompatible(i)?t!==MetadataType$1.VEC2||e instanceof Cartesian2?t!==MetadataType$1.VEC3||e instanceof Cartesian3?t!==MetadataType$1.VEC4||e instanceof Cartesian4?void 0:`vector value ${e} must be a Cartesian4`:`vector value ${e} must be a Cartesian3`:`vector value ${e} must be a Cartesian2`:`componentType ${i} is incompatible with vector type ${t}`}function validateMatrix(e,t,i){return MetadataComponentType$1.isVectorCompatible(i)?t!==MetadataType$1.MAT2||e instanceof Matrix2?t!==MetadataType$1.MAT3||e instanceof Matrix3?t!==MetadataType$1.MAT4||e instanceof Matrix4?void 0:`matrix value ${e} must be a Matrix4`:`matrix value ${e} must be a Matrix3`:`matrix value ${e} must be a Matrix2`:`componentType ${i} is incompatible with matrix type ${t}`}function validateString(e){if("string"!=typeof e)return getTypeErrorMessage(e,MetadataType$1.STRING)}function validateBoolean(e){if("boolean"!=typeof e)return getTypeErrorMessage(e,MetadataType$1.BOOLEAN)}function validateEnum(e,t){const i=typeof e;if(defined(t))return"string"===i&&defined(t.valuesByName[e])?void 0:`value ${e} is not a valid enum name for ${t.id}`}function validateScalar(e,t,i){const n=typeof e;switch(t){case MetadataComponentType$1.INT8:case MetadataComponentType$1.UINT8:case MetadataComponentType$1.INT16:case MetadataComponentType$1.UINT16:case MetadataComponentType$1.INT32:case MetadataComponentType$1.UINT32:case MetadataComponentType$1.FLOAT32:case MetadataComponentType$1.FLOAT64:return"number"!==n?getTypeErrorMessage(e,t):isFinite(e)?checkInRange(e,t,i):getNonFiniteErrorMessage(e,t);case MetadataComponentType$1.INT64:case MetadataComponentType$1.UINT64:return"number"!==n&&"bigint"!==n?getTypeErrorMessage(e,t):"number"!==n||isFinite(e)?checkInRange(e,t,i):getNonFiniteErrorMessage(e,t)}}function getTypeErrorMessage(e,t){return`value ${e} does not match type ${t}`}function getOutOfRangeErrorMessage(e,t,i){let n=`value ${e} is out of range for type ${t}`;return i&&(n+=" (normalized)"),n}function checkInRange(e,t,i){if(i){const n=1;return e<(MetadataComponentType$1.isUnsignedIntegerType(t)?0:-1)||e>n?getOutOfRangeErrorMessage(e,t,i):void 0}if(e<MetadataComponentType$1.getMinimum(t)||e>MetadataComponentType$1.getMaximum(t))return getOutOfRangeErrorMessage(e,t,i)}function getNonFiniteErrorMessage(e,t){return`value ${e} of type ${t} must be finite`}function normalizeInPlace(e,t,i){if(!Array.isArray(e))return i(e,t);for(let n=0;n<e.length;n++)e[n]=normalizeInPlace(e[n],t,i);return e}function MetadataTableProperty(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).count,i=e.property,n=e.classProperty,r=e.bufferViews,o=n.type,a=n.isArray,s=n.isVariableLengthArray;let c=n.valueType;const l=n.enumType,u=o===MetadataType$1.STRING,d=o===MetadataType$1.BOOLEAN;let h;if(s){let e=defaultValue(i.arrayOffsetType,i.offsetType);e=defaultValue(MetadataComponentType$1[e],MetadataComponentType$1.UINT32);h=new BufferView(r[defaultValue(i.arrayOffsets,i.arrayOffsetBufferView)],e,t+1)}const p=MetadataType$1.getComponentCount(o);let f;f=s?h.get(t)-h.get(0):a?t*n.arrayLength:t;const m=p*f;let g,_;if(u){let e=defaultValue(i.stringOffsetType,i.offsetType);e=defaultValue(MetadataComponentType$1[e],MetadataComponentType$1.UINT32);g=new BufferView(r[defaultValue(i.stringOffsets,i.stringOffsetBufferView)],e,m+1)}(u||d)&&(c=MetadataComponentType$1.UINT8),_=u?g.get(m)-g.get(0):d?Math.ceil(m/8):m;const y=new BufferView(r[defaultValue(i.values,i.bufferView)],c,_);let C=i.offset,T=i.scale;const S=n.hasValueTransform||defined(C)||defined(T);let v,A;C=defaultValue(C,n.offset),T=defaultValue(T,n.scale),C=flatten(C),T=flatten(T);const E=this;u?v=function(e){return getString(e,E._values,E._stringOffsets)}:d?(v=function(e){return getBoolean(e,E._values)},A=function(e,t){setBoolean(e,E._values,t)}):defined(l)?(v=function(e){const t=E._values.get(e);return l.namesByValue[t]},A=function(e,t){const i=l.valuesByName[t];E._values.set(e,i)}):(v=function(e){return E._values.get(e)},A=function(e,t){E._values.set(e,t)}),this._arrayOffsets=h,this._stringOffsets=g,this._values=y,this._classProperty=n,this._count=t,this._vectorComponentCount=p,this._min=i.min,this._max=i.max,this._offset=C,this._scale=T,this._hasValueTransform=S,this._getValue=v,this._setValue=A,this._unpackedValues=void 0,this._extras=i.extras,this._extensions=i.extensions}function flatten(e){if(!Array.isArray(e))return e;const t=[];for(let i=0;i<e.length;i++){const n=e[i];Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}function get(e,t){requiresUnpackForGet(e)&&unpackProperty(e);const i=e._classProperty,n=i.isArray,r=i.type,o=MetadataType$1.getComponentCount(r);if(defined(e._unpackedValues)){const i=e._unpackedValues[t];return n?clone$1(i,!0):i}return n||1!==o?getArrayValues(e,i,t):e._getValue(t)}function getArrayValues(e,t,i){let n,r;if(t.isVariableLengthArray){n=e._arrayOffsets.get(i),r=e._arrayOffsets.get(i+1)-n;const o=MetadataType$1.getComponentCount(t.type);n*=o,r*=o}else{const o=defaultValue(t.arrayLength,1)*e._vectorComponentCount;n=i*o,r=o}const o=new Array(r);for(let t=0;t<r;t++)o[t]=e._getValue(n+t);return o}function set(e,t,i){requiresUnpackForSet(e,t,i)&&unpackProperty(e);const n=e._classProperty,r=n.isArray,o=n.type,a=MetadataType$1.getComponentCount(o);if(defined(e._unpackedValues))return n.isArray&&(i=clone$1(i,!0)),void(e._unpackedValues[t]=i);if(!r&&1===a)return void e._setValue(t,i);let s,c;if(n.isVariableLengthArray)s=e._arrayOffsets.get(t),c=e._arrayOffsets.get(t+1)-s;else{const i=defaultValue(n.arrayLength,1)*e._vectorComponentCount;s=t*i,c=i}for(let t=0;t<c;++t)e._setValue(s+t,i[t])}function getString(e,t,i){const n=i.get(e),r=i.get(e+1)-n;return getStringFromTypedArray(t.typedArray,n,r)}function getBoolean(e,t){const i=e>>3,n=e%8;return 1==(t.typedArray[i]>>n&1)}function setBoolean(e,t,i){const n=e>>3,r=e%8;i?t.typedArray[n]|=1<<r:t.typedArray[n]&=~(1<<r)}function getInt64NumberFallback(e,t){const i=t.dataView,n=8*e;let r=0;const o=(128&i.getUint8(n+7))>0;let a=!0;for(let e=0;e<8;++e){let t=i.getUint8(n+e);o&&(a?0!==t&&(t=255&~(t-1),a=!1):t=255&~t),r+=t*Math.pow(256,e)}return o&&(r=-r),r}function getInt64BigIntFallback(e,t){const i=t.dataView,n=8*e;let r=BigInt(0);const o=(128&i.getUint8(n+7))>0;let a=!0;for(let e=0;e<8;++e){let t=i.getUint8(n+e);o&&(a?0!==t&&(t=255&~(t-1),a=!1):t=255&~t),r+=BigInt(t)*(BigInt(1)<<BigInt(8*e))}return o&&(r=-r),r}function getUint64NumberFallback(e,t){const i=t.dataView,n=8*e;return i.getUint32(n,!0)+4294967296*i.getUint32(n+4,!0)}function getUint64BigIntFallback(e,t){const i=t.dataView,n=8*e,r=BigInt(i.getUint32(n,!0)),o=BigInt(i.getUint32(n+4,!0));return r+BigInt(4294967296)*o}function getComponentDatatype(e){switch(e){case MetadataComponentType$1.INT8:return ComponentDatatype$1.BYTE;case MetadataComponentType$1.UINT8:return ComponentDatatype$1.UNSIGNED_BYTE;case MetadataComponentType$1.INT16:return ComponentDatatype$1.SHORT;case MetadataComponentType$1.UINT16:return ComponentDatatype$1.UNSIGNED_SHORT;case MetadataComponentType$1.INT32:return ComponentDatatype$1.INT;case MetadataComponentType$1.UINT32:return ComponentDatatype$1.UNSIGNED_INT;case MetadataComponentType$1.FLOAT32:return ComponentDatatype$1.FLOAT;case MetadataComponentType$1.FLOAT64:return ComponentDatatype$1.DOUBLE}}function requiresUnpackForGet(e){if(defined(e._unpackedValues))return!1;const t=e._classProperty,i=t.type,n=t.valueType;return i===MetadataType$1.STRING||(n===MetadataComponentType$1.INT64&&!FeatureDetection.supportsBigInt64Array()||n===MetadataComponentType$1.UINT64&&!FeatureDetection.supportsBigUint64Array())}function requiresUnpackForSet(e,t,i){if(requiresUnpackForGet(e))return!0;const n=e._arrayOffsets;if(defined(n)){if(n.get(t+1)-n.get(t)!==i.length)return!0}return!1}function unpackProperty(e){e._unpackedValues=unpackValues(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function unpackValues(e){const t=e._count,i=new Array(t),n=e._classProperty,r=n.isArray,o=n.type,a=MetadataType$1.getComponentCount(o);if(!r&&1===a){for(let n=0;n<t;++n)i[n]=e._getValue(n);return i}for(let r=0;r<t;r++)i[r]=getArrayValues(e,n,r);return i}function applyValueTransform(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:MetadataClassProperty.valueTransformInPlace(t,e._offset,e._scale,MetadataComponentType$1.applyValueTransform)}function unapplyValueTransform(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:MetadataClassProperty.valueTransformInPlace(t,e._offset,e._scale,MetadataComponentType$1.unapplyValueTransform)}function BufferView(e,t,i){const n=this;let r,o,a;if(t===MetadataComponentType$1.INT64)FeatureDetection.supportsBigInt()?FeatureDetection.supportsBigInt64Array()?(r=new BigInt64Array(e.buffer,e.byteOffset,i),a=function(e,t){n.typedArray[e]=BigInt(t)}):(r=new Uint8Array(e.buffer,e.byteOffset,8*i),o=function(e){return getInt64BigIntFallback(e,n)}):(oneTimeWarning("INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."),r=new Uint8Array(e.buffer,e.byteOffset,8*i),o=function(e){return getInt64NumberFallback(e,n)});else if(t===MetadataComponentType$1.UINT64)FeatureDetection.supportsBigInt()?FeatureDetection.supportsBigUint64Array()?(r=new BigUint64Array(e.buffer,e.byteOffset,i),a=function(e,t){n.typedArray[e]=BigInt(t)}):(r=new Uint8Array(e.buffer,e.byteOffset,8*i),o=function(e){return getUint64BigIntFallback(e,n)}):(oneTimeWarning("UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."),r=new Uint8Array(e.buffer,e.byteOffset,8*i),o=function(e){return getUint64NumberFallback(e,n)});else{const o=getComponentDatatype(t);r=ComponentDatatype$1.createArrayBufferView(o,e.buffer,e.byteOffset,i),a=function(e,t){n.typedArray[e]=t}}defined(o)||(o=function(e){return n.typedArray[e]}),this.typedArray=r,this.dataView=new DataView(r.buffer,r.byteOffset),this.get=o,this.set=a,this._componentType=t}function MetadataTable(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).count,i=e.class,n={};if(defined(e.properties))for(const r in e.properties)e.properties.hasOwnProperty(r)&&(n[r]=new MetadataTableProperty({count:t,property:e.properties[r],classProperty:i.properties[r],bufferViews:e.bufferViews}));this._count=t,this._class=i,this._properties=n}function getDefault$1(e,t){const i=e.properties;if(!defined(i))return;const n=i[t];if(defined(n)&&defined(n.default)){let e=n.default;return n.isArray&&(e=clone$1(e,!0)),e=n.normalize(e),n.unpackVectorAndMatrixTypes(e)}}function ResourceLoader(){}Object.defineProperties(MetadataClassProperty.prototype,{id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},type:{get:function(){return this._type}},enumType:{get:function(){return this._enumType}},componentType:{get:function(){return this._componentType}},valueType:{get:function(){return this._valueType}},isArray:{get:function(){return this._isArray}},isVariableLengthArray:{get:function(){return this._isVariableLengthArray}},arrayLength:{get:function(){return this._arrayLength}},normalized:{get:function(){return this._normalized}},max:{get:function(){return this._max}},min:{get:function(){return this._min}},noData:{get:function(){return this._noData}},default:{get:function(){return this._default}},required:{get:function(){return this._required}},semantic:{get:function(){return this._semantic}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataClassProperty.prototype.normalize=function(e){return this._normalized?normalizeInPlace(e,this._valueType,MetadataComponentType$1.normalize):e},MetadataClassProperty.prototype.unnormalize=function(e){return this._normalized?normalizeInPlace(e,this._valueType,MetadataComponentType$1.unnormalize):e},MetadataClassProperty.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:MetadataClassProperty.valueTransformInPlace(e,this._offset,this._scale,MetadataComponentType$1.applyValueTransform)},MetadataClassProperty.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:MetadataClassProperty.valueTransformInPlace(e,this._offset,this._scale,MetadataComponentType$1.unapplyValueTransform)},MetadataClassProperty.prototype.expandConstant=function(e,t){t=defaultValue(t,!1);const i=this._isArray,n=this._arrayLength,r=MetadataType$1.getComponentCount(this._type),o=i&&r>1;if(!i&&1===r)return e;if(!i)return new Array(r).fill(e);if(!o)return new Array(n).fill(e);if(!t)return new Array(this._arrayLength*r).fill(e);const a=new Array(r).fill(e);return new Array(this._arrayLength).fill(a)},MetadataClassProperty.prototype.handleNoData=function(e){const t=this._noData;return defined(t)&&arrayEquals(e,t)?void 0:e},MetadataClassProperty.prototype.unpackVectorAndMatrixTypes=function(e,t){t=defaultValue(t,!1);const i=MetadataType$1.getMathType(this._type),n=this._isArray,r=MetadataType$1.getComponentCount(this._type),o=n&&r>1;return defined(i)?t&&o?e.map((function(e){return i.unpack(e)})):n?i.unpackArray(e):i.unpack(e):e},MetadataClassProperty.prototype.packVectorAndMatrixTypes=function(e,t){t=defaultValue(t,!1);const i=MetadataType$1.getMathType(this._type),n=this._isArray,r=MetadataType$1.getComponentCount(this._type),o=n&&r>1;return defined(i)?t&&o?e.map((function(e){return i.pack(e,[])})):n?i.packArray(e,[]):i.pack(e,[]):e},MetadataClassProperty.prototype.validate=function(e){if(defined(e)||!defined(this._default))return this._required&&!defined(e)?"required property must have a value":this._isArray?validateArray(this,e):validateSingleValue(this,e)},MetadataClassProperty.valueTransformInPlace=function(e,t,i,n){if(!Array.isArray(e))return n(e,t,i);for(let r=0;r<e.length;r++)e[r]=MetadataClassProperty.valueTransformInPlace(e[r],t[r],i[r],n);return e},Object.defineProperties(MetadataTableProperty.prototype,{hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataTableProperty.prototype.get=function(e){let t=get(this,e);return t=this._classProperty.handleNoData(t),defined(t)?(t=this._classProperty.normalize(t),t=applyValueTransform(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))},MetadataTableProperty.prototype.set=function(e,t){const i=this._classProperty;t=unapplyValueTransform(this,t=i.packVectorAndMatrixTypes(t)),set(this,e,t=i.unnormalize(t))},MetadataTableProperty.prototype.getTypedArray=function(){if(defined(this._values))return this._values.typedArray},Object.defineProperties(MetadataTable.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}}}),MetadataTable.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},MetadataTable.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},MetadataTable.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},MetadataTable.prototype.getProperty=function(e,t){const i=this._properties[t];let n;return n=defined(i)?i.get(e):getDefault$1(this._class,t),n},MetadataTable.prototype.setProperty=function(e,t,i){const n=this._properties[t];return!!defined(n)&&(n.set(e,i),!0)},MetadataTable.prototype.getPropertyBySemantic=function(e,t){let i;const n=this._class.propertiesBySemantic;if(defined(n)&&(i=n[t]),defined(i))return this.getProperty(e,i.id)},MetadataTable.prototype.setPropertyBySemantic=function(e,t,i){let n;const r=this._class.propertiesBySemantic;return defined(r)&&(n=r[t]),!!defined(n)&&this.setProperty(e,n.id,i)},MetadataTable.prototype.getPropertyTypedArray=function(e){const t=this._properties[e];if(defined(t))return t.getTypedArray()},MetadataTable.prototype.getPropertyTypedArrayBySemantic=function(e){let t;const i=this._class.propertiesBySemantic;if(defined(i)&&(t=i[e]),defined(t))return this.getPropertyTypedArray(t.id)},Object.defineProperties(ResourceLoader.prototype,{promise:{get:function(){DeveloperError.throwInstantiationError()}},cacheKey:{get:function(){DeveloperError.throwInstantiationError()}}}),ResourceLoader.prototype.load=function(){DeveloperError.throwInstantiationError()},ResourceLoader.prototype.unload=function(){},ResourceLoader.prototype.process=function(e){},ResourceLoader.prototype.getError=function(e,t){return defined(t)&&(e+=`\n${t.message}`),new RuntimeError(e)},ResourceLoader.prototype.isDestroyed=function(){return!1},ResourceLoader.prototype.destroy=function(){return this.unload(),destroyObject(this)};const ResourceLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4};var ResourceLoaderState$1=Object.freeze(ResourceLoaderState);function BufferLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).typedArray,i=e.resource,n=e.cacheKey;this._typedArray=t,this._resource=i,this._cacheKey=n,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function loadExternalBuffer(e){const t=e._resource;e._state=ResourceLoaderState$1.LOADING,BufferLoader._fetchArrayBuffer(t).then((function(t){e.isDestroyed()||(e._typedArray=new Uint8Array(t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).catch((function(i){if(e.isDestroyed())return;e._state=ResourceLoaderState$1.FAILED;const n=`Failed to load external buffer: ${t.url}`;e._promise.reject(e.getError(n,i))}))}defined(Object.create)&&(BufferLoader.prototype=Object.create(ResourceLoader.prototype),BufferLoader.prototype.constructor=BufferLoader),Object.defineProperties(BufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),BufferLoader.prototype.load=function(){defined(this._typedArray)?this._promise.resolve(this):loadExternalBuffer(this)},BufferLoader._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()},BufferLoader.prototype.unload=function(){this._typedArray=void 0},function(){var e,t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i=WebAssembly.instantiate(function(e){for(var i=new Uint8Array(e.length),n=0;n<e.length;++n){var r=e.charCodeAt(n);i[n]=r>96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}var o=0;for(n=0;n<e.length;++n)i[o++]=i[n]<60?t[i[n]]:64*(i[n]-60)+i[++n];return i.buffer.slice(0,o)}("B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gIUUUEU9gVUUUUUB9gLUUUUB9gD99UE99Ie8aDILEVOLEVLRRRRRWWVBOOBEdddLVE9wEIIVIEBEOWEUEC+Q/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBO8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBRe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBWA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBdl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBQk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBKl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBXe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBSA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBZA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBhL79iv9rBodWEBCEKDqxQ+f9Q8aDBK/EpE8jU8jJJJJBCJO9rGV8kJJJJBCBHODNALCEFAE0MBABCBrBJ+KJJBC+gEv86BBAVCJDFCBCJDZnJJJB8aDNAItMBAVCJDFADALZ+TJJJB8aKABAEFHRABCEFHEAVALFCBCBCJDAL9rALCfE0eZnJJJB8aAVAVCJDFALZ+TJJJBHWCJ/ABAL9uHODNAItMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAWCJLFCBCJDZnJJJB8aAdAIAQ9rAQAdFAI6eHKADAQAL2FHXDNALtMBAKCSFGOC9wgHMAOCL4CIFCD4HpCBHSAXHZAEHhINDNAKtMBAWASFrBBHoCBHEAZHOINAWCJLFAEFAOrBBGaAo9rGoCETAoCkTCk91CR4786BBAOALFHOAaHoAECEFGEAK9HMBKKDNARAh9rAp6MBAhCBApZnJJJBGcApFHEDNAMtMBCBHxAWCJLFHqINARAE9rCk6MDAWCJLFAxFGlrBDHoCUHODNAlrBEGaAlrBBGkvCfEgMBCBHaAoCfEgMBCBHoDNAlrBIMBAlrBLMBAlrBVMBAlrBOMBAlrBRMBAlrBWMBAlrBdMBAlrBQMBAlrBKMBAlrBXMBAlrBMMBCBHaAlrBpMECBHoCUCBAlrBSeHOKCBHaKDNDNDNDNCLCDCECWAOCZ6GheAkCfEgGkCD0CLvAaCfEgGaCD0FAoCfEgGoCD0FAlrBIGyCD0FAlrBLG8aCD0FAlrBVGeCD0FAlrBOG3CD0FAlrBRG5CD0FAlrBWG8eCD0FAlrBdG8fCD0FAlrBQGACD0FAlrBKGHCD0FAlrBXGGCD0FAlrBMG8jCD0FAlrBpG8kCD0FAlrBSG8lCD0FG8mAOCZAheG8n6GOeAkCp0CWvAaCp0FAoCp0FAyCp0FA8aCp0FAeCp0FA3Cp0FA5Cp0FA8eCp0FA8fCp0FAACp0FAHCp0FAGCp0FA8jCp0FA8kCp0FA8lCp0FA8mA8nAOe6GoeGyCUFpDIEBKAcAxCO4FGaAarBBCDCIAoeAxCI4COgTv86BBAyCW9HMEAEAl8pBB83BBAECWFAlCWF8pBB83BBAECZFHEXDKAcAxCO4FGaAarBBCEAxCI4COgTv86BBKCDCLCWCEAheAOeAoeH8aCUAyTCU7HaCBH5AqHeINAEH3A8aHoAeHECBHOINAErBBGhAaAhAaCfEgGk6eAOCfEgAyTvHOAECEFHEAoCUFGoMBKA3AO86BBAeA8aFHeA3CEFHEA5A8aFG5CZ6MBKDNAlrBBGOAk6MBA3AO86BEA3CDFHEKDNAlrBEGOAk6MBAEAO86BBAECEFHEKDNAlrBDGOAk6MBAEAO86BBAECEFHEKDNAlrBIGOAk6MBAEAO86BBAECEFHEKDNAlrBLGOAk6MBAEAO86BBAECEFHEKDNAlrBVGOAk6MBAEAO86BBAECEFHEKDNAlrBOGOAk6MBAEAO86BBAECEFHEKDNAlrBRGOAk6MBAEAO86BBAECEFHEKDNAlrBWGOAk6MBAEAO86BBAECEFHEKDNAlrBdGOAk6MBAEAO86BBAECEFHEKDNAlrBQGOAk6MBAEAO86BBAECEFHEKDNAlrBKGOAk6MBAEAO86BBAECEFHEKDNAlrBXGOAk6MBAEAO86BBAECEFHEKDNAlrBMGOAk6MBAEAO86BBAECEFHEKDNAlrBpGOAk6MBAEAO86BBAECEFHEKAlrBSGOAk6MBAEAO86BBAECEFHEKAqCZFHqAxCZFGxAM6MBKKAEtMBAZCEFHZAEHhASCEFGSALsMDXEKKCBHOXIKAWAXAKCUFAL2FALZ+TJJJB8aAKAQFGQAI6MBKKCBHOARAE9rCAALALCA6e6MBDNALC8f0MBAECBCAAL9rGOZnJJJBAOFHEKAEAWCJDFALZ+TJJJBALFAB9rHOKAVCJOF8kJJJJBAOK9HEEUAECAAECA0eABCJ/ABAE9uC/wfBgGDCJDADCJD6eGDFCUFAD9uAE2ADCL4CIFCD4ADv2FCEFKMBCBABbDJ+KJJBK/pSEeU8jJJJJBC/AE9rGL8kJJJJBCBHVDNAICI9uGOChFAE0MBABCBYD+E+KJJBGRC/gEv86BBALC/ABFCfECJEZnJJJB8aALCuFGW9CU83IBALC8wFGd9CU83IBALCYFGQ9CU83IBALCAFGK9CU83IBALCkFGX9CU83IBALCZFGM9CU83IBAL9CU83IWAL9CU83IBABAEFC9wFGpABCEFGSAOFGE6HODNAItMBCMCSARCB9KeHZCBHhCBHoCBHaCBHcCBHxINDNAOCEgtMBCBHVXIKCDHqADAaCDTFGOYDBHlAOCWFYDBHkAOCLFYDBHyCBH8aCBHODNDNDNDNDNDNDNDNDNINALC/ABFAOCU7AxFCSgCITFGVYDLHeDNAVYDBGVAl9HMBAeAy9HMBAqC9+FHqXDKDNAVAy9HMBAeAk9HMBAqCUFHqXDKDNAVAk9HMBAeAlsMDKAqCLFHqA8aCZFH8aAOCEFGOCZ9HMBXDKKAqC870MBADAqCIgCX2GVC+E1JJBFYDBAaFCDTFYDBHqADAVCJ1JJBFYDBAaFCDTFYDBHyALADAVC11JJBFYDBAaFCDTFYDBGVAcZ+FJJJBGeCBCSAVAhsGkeAeCB9KAeAZ9IgGleHeAkAlCE7gHkDNARCE9IMBAeCS9HMBAVAVAoAVCEFAosGeeGoCEFsMDCMCSAeeHeKASAeA8av86BBAeCS9HMDAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoXIKADCEAkAhsCETAyAhseCX2GOC11JJBFYDBAaFCDTFYDBHqADAOC+E1JJBFYDBAaFCDTFYDBHeADAOCJ1JJBFYDBAaFCDTFYDBHVCBHlDNARCE9IMBAhtMBAVMBAeCE9HMBAqCD9HMBAW9CU83IBAd9CU83IBAQ9CU83IBAK9CU83IBAX9CU83IBAM9CU83IBAL9CU83IWAL9CU83IBCBHhCEHlKAhAVAhsGOFH8aALAeAcZ+FJJJBHyALAqAcZ+FJJJBHkAyCM0MLAyCEFHyXVKCpHeASAOCLTCpv86BBAVHoKAetMBAeAZ9IMEKALAcCDTFAVbDBAcCEFCSgHcKAhAkFHhALC/ABFAxCITFGOAqbDLAOAVbDBALC/ABFAxCEFCSgGOCITFGeAVbDLAeAybDBAOCEFHVXDKCBCSAeA8asG3eHyA8aA3FH8aKDNDNAkCM0MBAkCEFHkXEKCBCSAqA8asG3eHkA8aA3FH8aKDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNAkAyCLTvG3CfEgG5C+qUFp9UISSSSSSSSSSSSSSWSLQMSSSSSSSSSSSSESVSSSSSSSSSSSSSRDSdSSSSSSSSSSSSSSKSSSSSSSSSSSSSSSSOBKC/wEH8eA5pDMKpKC/xEH8eXXKC/yEH8eXKKC/zEH8eXQKC/0EH8eXdKC/1EH8eXWKC/2EH8eXRKC/3EH8eXOKC/4EH8eXVKC/5EH8eXLKC/6EH8eXIKC/7EH8eXDKC/8EH8eXEKCPEH8eKAlAVAh9HvMBASA8e86BBXEKASC9+CUAOe86BBAEA386BBAECEFHEKDNAOMBAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoKDNAyCS9HMBAeAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAeHoKDNAkCS9HMBAqAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAqHoKALAcCDTFAVbDBAcCEFCSgHODNDNAypZBEEEEEEEEEEEEEEBEKALAOCDTFAebDBAcCDFCSgHOKDNDNAkpZBEEEEEEEEEEEEEEBEKALAOCDTFAqbDBAOCEFCSgHOKALC/ABFAxCITFGyAVbDLAyAebDBALC/ABFAxCEFCSgCITFGyAebDLAyAqbDBALC/ABFAxCDFCSgCITFGeAqbDLAeAVbDBAxCIFHVAOHcA8aHhKApAE6HOASCEFHSAVCSgHxAaCIFGaAI6MBKKCBHVAOMBAE9C/lm+i/D+Z+g8a83BWAE9CJ/s+d+0/1+M/e/U+GU83BBAEAB9rCZFHVKALC/AEF8kJJJJBAVK+mIEEUCBHIDNABADCUFCSgCDTFYDBAEsMBCEHIABADCpFCSgCDTFYDBAEsMBCDHIABADCMFCSgCDTFYDBAEsMBCIHIABADCXFCSgCDTFYDBAEsMBCLHIABADCKFCSgCDTFYDBAEsMBCVHIABADCQFCSgCDTFYDBAEsMBCOHIABADCdFCSgCDTFYDBAEsMBCRHIABADCWFCSgCDTFYDBAEsMBCWHIABADCRFCSgCDTFYDBAEsMBCdHIABADCOFCSgCDTFYDBAEsMBCQHIABADCVFCSgCDTFYDBAEsMBCKHIABADCLFCSgCDTFYDBAEsMBCXHIABADCIFCSgCDTFYDBAEsMBCMHIABADCDFCSgCDTFYDBAEsMBCpHIABADCEFCSgCDTFYDBAEsMBCSCUABADCSgCDTFYDBAEseSKAIKjEIUCRHDDNINADCEFHIADC96FGLC8f0MEAIHDCEALTAE6MBKKAICR9uCI2CDFABCI9u2ChFKMBCBABbD+E+KJJBK+YDERU8jJJJJBCZ9rHLCBHVDNAICVFAE0MBCBHVABCBrB+E+KJJBC/QEv86BBAL9CB83IWABCEFHOABAEFC98FHRDNAItMBCBHWINDNARAO0MBCBSKAVADAWCDTFYDBGdALCWFAVCDTFYDB9rGEAEC8f91GEFAE7C59K7GVAdALCWFAVCDTFGQYDB9rGEC8f91CETAECDT7vHEINAOAECfB0CRTAECfBgv86BBAOCEFHOAECR4GEMBKAQAdbDBAWCEFGWAI9HMBKKCBHVARAO6MBAOCBbBBAOAB9rCLFHVKAVK86EIUCWHDDNINADCEFHIADC95FGLC8f0MEAIHDCEALTAE6MBKKAICR9uAB2CVFK+yWDEUO99DNAEtMBADCLsHVCUADCETCUFTCU7HDDNDNCUAICUFTCU7+yGOjBBBzmGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKAD+yHWDNAVMBABCOFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADC9+FAI87EBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB87EBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC98FAB87EBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC96FAB87EBALCZFHLADCWFHDAECUFGEMBXDKKABCIFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADCUFAI86BBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB86BBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC9+FAB86BBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC99FAB86BBALCZFHLADCLFHDAECUFGEMBKKK/KLLD99EUE99EUDNAEtMBDNDNCUAICUFTCU7+yGVjBBBzmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKAIC/8fIgHRINABCOFCICDALCLFiDB+LALiDB+L9eGIALCWFiDB+LALAICDTFiDB+L9eeGIALCXFiDB+LALAICDTFiDB+L9eeGIARv87EBDNDNjBBBzjBBB+/ALAICEFCIgCDTFiDBj/zL+1znjBBJ+/jBBJzALAICDTFiDBjBBBB9deGOnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABAd87EBDNDNjBBBzjBBB+/AOALAICDFCIgCDTFiDBj/zL+1znnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABCDFAd87EBDNDNjBBBzjBBB+/AOALAICUFCIgCDTFiDBj/zL+1znnGOjBBBB9geAOjBBJ+/AOjBBJ+/9geGOjBBJzAOjBBJz9feAVnmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKABCLFAI87EBABCWFHBALCZFHLAECUFGEMBKKK+tDDWUE998jJJJJBCZ9rGV8kJJJJBDNAEtMBADCD4GOtMBCEAI9rHRAOCDTHWCBHdINC+cUHDALHIAOHQINAIiDBAVCXFZ+YJJJB8aAVYDXGKADADAK9IeHDAICLFHIAQCUFGQMBKARADFGICkTHKCBHDCBAI9rHXAOHIINDNDNALADFiDBGMAXZ+XJJJBjBBBzjBBB+/AMjBBBB9gemGM+LjBBB9P9dtMBAM+oHQXEKCJJJJ94HQKABADFAQCfffRgAKvbDBADCLFHDAICUFGIMBKABAWFHBALAWFHLAdCEFGdAE9HMBKKAVCZF8kJJJJBK+iMDlUI998jJJJJBC+QD9rGV8kJJJJBAVC+oEFCBC/kBZnJJJB8aCBHODNADtMBCBHOAItMBDNABAE9HMBAVCUADCDTGRADCffffI0eCBYD/4+JJJBhJJJJBBGEbD+oEAVCEbD1DAEABARZ+TJJJB8aKAVC+YEFCWFCBbDBAV9CB83I+YEAVC+YEFAEADAIAVC+oEFZ+OJJJBCUAICDTGWAICffffI0eGdCBYD/4+JJJBhJJJJBBHRAVC+oEFAVYD1DGOCDTFARbDBAVAOCEFGQbD1DARAVYD+YEGKAWZ+TJJJBHXAVC+oEFAQCDTFADCI9uGMCBYD/4+JJJBhJJJJBBGRbDBAVAOCDFGWbD1DARCBAMZnJJJBHpAVC+oEFAWCDTFAdCBYD/4+JJJBhJJJJBBGSbDBAVAOCIFGQbD1DAXHRASHWINAWALiDBALARYDBGdCWAdCW6eCDTFC/EBFiDBmuDBARCLFHRAWCLFHWAICUFGIMBKCBHIAVC+oEFAQCDTFCUAMCDTADCffff970eCBYD/4+JJJBhJJJJBBGQbDBAVAOCLFGObD1DDNADCI6MBAEHRAQHWINAWASARYDBCDTFiDBASARCLFYDBCDTFiDBmASARCWFYDBCDTFiDBmuDBARCXFHRAWCLFHWAICEFGIAM6MBKKAVC/MBFHZAVYD+cEHhAVYD+gEHoAVHRCBHdCBHWCBHaCEHcINARHxAEAWCX2FGqCWFGlYDBHDAqYDBHkABAaCX2FGRCLFAqCLFGyYDBG8abDBARAkbDBARCWFADbDBApAWFCE86BBAZADbDWAZA8abDLAZAkbDBAQAWCDTFCBbDBCIHeDNAdtMBAxHRINDNARYDBGIADsMBAIAksMBAIA8asMBAZAeCDTFAIbDBAeCEFHeKARCLFHRAdCUFGdMBKKAXAkCDTFGRARYDBCUFbDBAXA8aCDTFGRARYDBCUFbDBAXADCDTFGRARYDBCUFbDBAoAhAqYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGItMDXBKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKAoAhAyYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNAKAlYDBCDTGRFGDYDBGdtMBAoAhARFYDBCDTFGkHRAdHIDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNDNAetMBCUHWjBBBBH3CBHRINASAZARCDTFYDBCDTGIFGdiDBH5AdALCBARCEFGkARCS0eCDTFiDBALAXAIFYDBGRCWARCW6eCDTFC/EBFiDBmG8euDBDNAKAIFYDBGdtMBA8eA5+TH8eAoAhAIFYDBCDTFHRAdCDTHIINAQARYDBGdCDTFGDA8eADiDBmG5uDBA5A3A3A59dGDeH3AdAWADeHWARCLFHRAIC98FGIMBKKAkHRAkAe9HMBKAWCU9HMEKAcAM9PMDINDNApAcFrBBMBAcHWXDKAMAcCEFGc9HMBXIKKAaCEFHaAeCZAeCZ6eHdAZHRAxHZAWCU9HMBKKAOCDTAVC+oEFFC98FHRDNINAOtMEARYDBCBYD/0+JJJBh+BJJJBBARC98FHRAOCUFHOXBKKAVC+QDF8kJJJJBK/iLEVUCUAICDTGVAICffffI0eGOCBYD/4+JJJBhJJJJBBHRALALYD9gGWCDTFARbDBALAWCEFbD9gABARbDBAOCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDLCUADCDTADCffffI0eCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDWABYDBCBAVZnJJJB8aADCI9uHdDNADtMBABYDBHOAEHLADHRINAOALYDBCDTFGVAVYDBCEFbDBALCLFHLARCUFGRMBKKDNAItMBABYDBHLABYDLHRCBHVAIHOINARAVbDBARCLFHRALYDBAVFHVALCLFHLAOCUFGOMBKKDNADCI6MBABYDLHRABYDWHVCBHLINAECWFYDBHOAECLFYDBHDARAEYDBCDTFGWAWYDBGWCEFbDBAVAWCDTFALbDBARADCDTFGDADYDBGDCEFbDBAVADCDTFALbDBARAOCDTFGOAOYDBGOCEFbDBAVAOCDTFALbDBAECXFHEALCEFGLAd6MBKKDNAItMBABYDLHEABYDBHLINAEAEYDBALYDB9rbDBALCLFHLAECLFHEAICUFGIMBKKKqBABAEADAIC+k1JJBZ+NJJJBKqBABAEADAIC+M+JJJBZ+NJJJBK9dEEUABCfEAICDTZnJJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/8+JJJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/8+JJJBFGDbD/8+JJJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKKXBABAEZ+ZJJJBK+BEEIUDNAB+8GDCl4GICfEgGLCfEsMBDNALMBDNABjBBBB9cMBAECBbDBABSKABjBBJ9fnAEZ+YJJJBHBAEAEYDBCNFbDBABSKAEAICfEgC+CUFbDBADCfff+D94gCJJJ/4Iv++HBKABK+gEBDNDNAECJE9IMBABjBBBUnHBDNAECfE9OMBAEC+BUFHEXDKABjBBBUnHBAECPDAECPD9IeC+C9+FHEXEKAEC+BU9KMBABjBBJXnHBDNAEC+b9+9MMBAEC/mBFHEXEKABjBBJXnHBAEC+299AEC+2999KeC/MEFHEKABAEClTCJJJ/8IF++nKK+ODDBCJWK/0EBBBBEBBBDBBBEBBBDBBBBBBBDBBBBBBBEBBBBBBB+L29Hz/69+9Kz/n/76z/RG97z/Z/O9Xz8j/b85z/+/U9Yz/B/K9hz+2/z9dz9E+L9Mz59a8kz+R/t3z+a+Zyz79ohz/J4++8++y+d9v8+BBBB9S+49+z8r+Hbz9m9m/m8+l/Z/O8+/8+pg89Q/X+j878r+Hq8++m+b/E87BBBBBBJzBBJzBBJz+e/v/n8++y+dSz9I/h/68+XD/r8+/H0838+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC/0dKXEBBBDBBBZwBB"),{}).then((function(t){(e=t.instance).exports.__wasm_call_ctors(),e.exports.meshopt_encodeVertexVersion(0),e.exports.meshopt_encodeIndexVersion(1)}));function n(e){if(!e)throw new Error("Assertion failed")}function r(t,i,n,r,o){var a=e.exports.sbrk,s=a(i),c=a(r*o),l=new Uint8Array(e.exports.memory.buffer);l.set(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),c);var u=t(s,i,c,r,o),d=new Uint8Array(u);return d.set(l.subarray(s,s+u)),a(s-a(0)),d}function o(e){for(var t=0,i=0;i<e.length;++i){var n=e[i];t=t<n?n:t}return t}function a(e,t){if(n(2==t||4==t),4==t)return new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4);var i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);return new Uint32Array(i)}function s(t,i,n,r,o,a){var s=e.exports.sbrk,c=s(n*r),l=s(n*a),u=new Uint8Array(e.exports.memory.buffer);u.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),l),t(c,n,r,o,l);var d=new Uint8Array(n*r);return d.set(u.subarray(c,c+n*r)),s(c-s(0)),d}}();var MeshoptDecoder=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i,n="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLLVE9wEEEVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBEy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBDe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBIl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBLk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBOL79iv9rBRQ+x8yQDBK/qMEZU8jJJJJBCJ/EB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rADZ1JJJBHWCJ/ABAD9uC/wfBgGOCJDAOCJD6eHdAICEFHLCBHQDNINAQAE9PMEAdAEAQ9rAQAdFAE6eHKDNDNADtMBAKCSFGOC9wgHXAOCL4CIFCD4HMAWCJDFHpCBHSALHZINDNARAZ9rAM9PMBCBHLXIKAZAMFHLDNAXtMBCBHhCBHIINDNARAL9rCk9PMBCBHLXVKAWCJ/CBFAIFHODNDNDNDNDNAZAICO4FrBBAhCOg4CIgpLBEDIBKAO9CB83IBAOCWF9CB83IBXIKAOALrBLALrBBGoCO4GaAaCIsGae86BBAOCEFALCLFAaFGarBBAoCL4CIgGcAcCIsGce86BBAOCDFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCIFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCLFAaAoFGarBBALrBEGoCO4GcAcCIsGce86BBAOCVFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCOFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCRFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCWFAaAoFGarBBALrBDGoCO4GcAcCIsGce86BBAOCdFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCQFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCKFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCXFAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOCMFAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOCpFAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCSFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAOALrBWALrBBGoCL4GaAaCSsGae86BBAOCEFALCWFAaFGarBBAoCSgGoAoCSsGoe86BBAOCDFAaAoFGorBBALrBEGaCL4GcAcCSsGce86BBAOCIFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCLFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOCVFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCOFAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOCRFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCWFAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOCdFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCQFAoAaFGorBBALrBVGaCL4GcAcCSsGce86BBAOCKFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCXFAoAaFGorBBALrBOGaCL4GcAcCSsGce86BBAOCMFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCpFAoAaFGorBBALrBRGLCL4GaAaCSsGae86BBAOCSFAoAaFGOrBBALCSgGLALCSsGLe86BBAOALFHLXEKAOAL8pBB83BBAOCWFALCWF8pBB83BBALCZFHLKAhCDFHhAICZFGIAX6MBKKDNALMBCBHLXIKDNAKtMBAWASFrBBHhCBHOApHIINAIAWCJ/CBFAOFrBBGZCE4CBAZCEg9r7AhFGh86BBAIADFHIAOCEFGOAK9HMBKKApCEFHpALHZASCEFGSAD9HMBKKABAQAD2FAWCJDFAKAD2Z1JJJB8aAWAWCJDFAKCUFAD2FADZ1JJJB8aKAKCBALeAQFHQALMBKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/EBF8kJJJJBAOK+OoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJEZ+JJJJB8aAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK+lVOEUE99DUD99EUD99DNDNADCL9HMBAEtMEINDNDNjBBBzjBBB+/ABCDFGD8sBB+yAB8sBBGI+yGL+L+TABCEFGV8sBBGO+yGR+L+TGWjBBBB9gGdeAWjBB/+9CAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI86BBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD86BBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD86BBABCLFHBAECUFGEMBXDKKAEtMBINDNDNjBBBzjBBB+/ABCLFGD8uEB+yAB8uEBGI+yGL+L+TABCDFGV8uEBGO+yGR+L+TGWjBBBB9gGdeAWjB/+fsAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI87EBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD87EBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD87EBABCWFHBAECUFGEMBKKK/SILIUI99IUE99DNAEtMBCBHIABHLINDNDNj/zL81zALCOF8uEBGVCIv+y+VGOAL8uEB+ynGRjB/+fsnjBBBzjBBB+/ARjBBBB9gemGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKALCLF8uEBHQALCDF8uEBHKABAVCEFCIgAIvCETFAd87EBDNDNAOAK+ynGWjB/+fsnjBBBzjBBB+/AWjBBBB9gemGX+LjBBB9P9dtMBAX+oHKXEKCJJJJ94HKKABAVCDFCIgAIvCETFAK87EBDNDNAOAQ+ynGOjB/+fsnjBBBzjBBB+/AOjBBBB9gemGX+LjBBB9P9dtMBAX+oHQXEKCJJJJ94HQKABAVCUFCIgAIvCETFAQ87EBDNDNjBBJzARARn+TAWAWn+TAOAOn+TGRjBBBBARjBBBB9ge+RjB/+fsnjBBBzmGR+LjBBB9P9dtMBAR+oHQXEKCJJJJ94HQKABAVCIgAIvCETFAQ87EBALCWFHLAICLFHIAECUFGEMBKKK6BDNADCD4AE2GEtMBINABABYDBGDCWTCW91+yADCk91ClTCJJJ/8IF++nuDBABCLFHBAECUFGEMBKKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB";WebAssembly.validate(e)&&(n="B9h79tEBBBE5V9gBB9gVUUUUUEU9gIUUUB9gDUUB9gEUEUIMXBBEBEEDIDIDLLVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBWl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBQL79iv9rBKQ/j6XLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK1HLSUD97EUO978jJJJJBCJ/KB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rAD/8QBBCJ/ABAD9uC/wfBgGOCJDAOCJD6eHWAICEFHOCBHdDNINAdAE9PMEAWAEAd9rAdAWFAE6eHQDNDNADtMBAQCSFGLC9wgGKCI2HXAKCETHMALCL4CIFCD4HpCBHSINAOHZCBHhDNINDNARAZ9rAp9PMBCBHOXVKAVCJ/CBFAhAK2FHoAZApFHOCBHIDNAKC/AB6MBARAO9rC/gB6MBCBHLINAoALFHIDNDNDNDNDNAZALCO4FrBBGaCIgpLBEDIBKAICBPhPKLBXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLBAOCZFHOKDNDNDNDNDNAaCD4CIgpLBEDIBKAICBPhPKLZXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLZAOCZFHOKDNDNDNDNDNAaCL4CIgpLBEDIBKAICBPhPKLAXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLAAOCZFHOKDNDNDNDNDNAaCO4pLBEDIBKAICBPhPKL8wXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCLFAlPqBFAaC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCWFAlPqBFAaC+Q+YJJBFrBBFHOXEKAIAOPBBBPKL8wAOCZFHOKALC/ABFHIALCJEFAK0MEAIHLARAO9rC/fB0MBKKDNAIAK9PMBAICI4HLINDNARAO9rCk9PMBCBHOXRKAoAIFHaDNDNDNDNDNAZAICO4FrBBALCOg4CIgpLBEDIBKAaCBPhPKLBXIKAaAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAaAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAaAOPBBBPKLBAOCZFHOKALCDFHLAICZFGIAK6MBKKDNAOtMBAOHZAhCEFGhCLsMDXEKKCBHOXIKDNAKtMBAVCJDFASFHIAVASFPBDBHlCBHaINAIAVCJ/CBFAaFGLPBLBGxCEP9tAxCEPSGcP9OP9hP9RGxALAKFPBLBGkCEP9tAkAcP9OP9hP9RGkPMBZEhDoIaLcVxOqRlGyALAMFPBLBG8aCEP9tA8aAcP9OP9hP9RG8aALAXFPBLBGeCEP9tAeAcP9OP9hP9RGePMBZEhDoIaLcVxOqRlG3PMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIAlP9uGlPeBbDBAIADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAyA3PMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWkdyQ8aKeX3M5p8eS8fGxA8aAePMWkdyQ8aKeX3M5p8eS8fGkPMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFHIAaCZFGaAK6MBKKASCLFGSAD6MBKKABAdAD2FAVCJDFAQAD2/8QBBAVAVCJDFAQCUFAD2FAD/8QBBKAQCBAOeAdFHdAOMBKC9+HOXEKCBC99ARAO9rADCAADCA0eseHOKAVCJ/KBF8kJJJJBAOKWBZ+BJJJBK+KoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJE/8KBAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK/xVDIUO978jJJJJBCA9rGI8kJJJJBDNDNADCL9HMBDNAEC98gGLtMBABHDCBHVINADADPBBBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKBBADCZFHDAVCLFGVAL6MBKKALAE9PMEAIAECIgGVCDTGDvCBCZAD9r/8KBAIABALCDTFGLAD/8QBBDNAVtMBAIAIPBLBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKLBKALAIAD/8QBBXEKABAEC98gGDZ+HJJJBADAE9PMBAIAECIgGLCITGVFCBCAAV9r/8KBAIABADCITFGDAV/8QBBAIALZ+HJJJBADAIAV/8QBBKAICAF8kJJJJBK+yIDDUR97DNAEtMBCBHDINABCZFGIAIPBBBGLCBPhGVCJJ98P3ECJJ98P3IGOP9OABPBBBGRALPMLVORXMpScxql358e8fCffEPhP9OP/6EARALPMBEDIWdQKZhoaky8aeGLCZP+sEP/6EGWP/gEALCZP+rECZP+sEP/6EGdP/gEP/kEP/lEGLjB/+fsPaAdALAVP+2EGVAdCJJJJ94PhGQP9OP9RP/kEGdAdP/mEALALP/mEAWAVAWAQP9OP9RP/kEGLALP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGVP/kECZP+rEAdAWP/mEAVP/kECffIPhP9OP9QGdALAWP/mEAVP/kECUPSCBPlDCBPlICBPlOCBPlRCBPlQCBPlKCBPlpCBPlSP9OGLPMWdkyQK8aeXM35pS8e8fP9QPKBBABARAOP9OAdALPMBEZhDIoaLVcxORqlP9QPKBBABCAFHBADCLFGDAE6MBKKK94EIU8jJJJJBCA9rGI8kJJJJBABAEC98gGLZ+JJJJBDNALAE9PMBAIAECIgGVCITGEFCBCAAE9r/8KBAIABALCITFGBAE/8QBBAIAVZ+JJJJBABAIAE/8QBBKAICAF8kJJJJBK/hILDUE97EUV978jJJJJBCZ9rHDDNAEtMBCBHIINADABPBBBGLABCZFGVPBBBGOPMLVORXMpScxql358e8fGRCZP+sEGWCLP+rEPKLBABjBBJzPaj/zL81zPaAWCIPhP9QP/6EP/nEGWALAOPMBEDIWdQKZhoaky8aeGLCZP+rECZP+sEP/6EP/mEGOAOP/mEAWALCZP+sEP/6EP/mEGdAdP/mEAWARCZP+rECZP+sEP/6EP/mEGRARP/mEP/kEP/kEP/lECBPhP+4EP/jEjB/+fsPaGWP/mEjBBN0PaGLP/kECffIPhGQP9OAdAWP/mEALP/kECZP+rEP9QGdARAWP/mEALP/kECZP+rEAOAWP/mEALP/kEAQP9OP9QGWPMBEZhDIoaLVcxORqlGLP5BADPBLBPeB+t+J83IBABCWFALP5EADPBLBPeE+t+J83IBAVAdAWPMWdkyQK8aeXM35pS8e8fGWP5BADPBLBPeD+t+J83IBABCkFAWP5EADPBLBPeI+t+J83IBABCAFHBAICLFGIAE6MBKKK/3EDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB");var r=WebAssembly.instantiate(function(e){for(var i=new Uint8Array(e.length),n=0;n<e.length;++n){var r=e.charCodeAt(n);i[n]=r>96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}var o=0;for(n=0;n<e.length;++n)i[o++]=i[n]<60?t[i[n]]:64*(i[n]-60)+i[++n];return i.buffer.slice(0,o)}(n),{}).then((function(e){(i=e.instance).exports.__wasm_call_ctors()}));function o(e,t,n,r,o,a){var s=i.exports.sbrk,c=n+3&-4,l=s(c*r),u=s(o.length),d=new Uint8Array(i.exports.memory.buffer);d.set(o,u);var h=e(l,n,r,u,o.length);if(0==h&&a&&a(l,c,r),t.set(d.subarray(l,l+n*r)),s(l-s(0)),0!=h)throw new Error("Malformed buffer data: "+h)}var a={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeVertexBuffer:function(e,t,n,r,s){o(i.exports.meshopt_decodeVertexBuffer,e,t,n,r,i.exports[a[s]])},decodeIndexBuffer:function(e,t,n,r){o(i.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){o(i.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,c,l){o(i.exports[s[c]],e,t,n,r,i.exports[a[l]])}}}();function GltfBufferViewLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,n=e.bufferViewId,r=e.gltfResource,o=e.baseResource,a=e.cacheKey,s=i.bufferViews[n];let c,l,u,d,h=s.buffer,p=s.byteOffset,f=s.byteLength,m=!1;if(hasExtension(s,"EXT_meshopt_compression")){const e=s.extensions.EXT_meshopt_compression;h=e.buffer,p=defaultValue(e.byteOffset,0),f=e.byteLength,m=!0,c=e.byteStride,l=e.count,u=e.mode,d=defaultValue(e.filter,"NONE")}const g=i.buffers[h];this._hasMeshopt=m,this._meshoptByteStride=c,this._meshoptCount=l,this._meshoptMode=u,this._meshoptFilter=d,this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._buffer=g,this._bufferId=h,this._byteOffset=p,this._byteLength=f,this._cacheKey=a,this._bufferLoader=void 0,this._typedArray=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function getBufferLoader(e){const t=e._resourceCache,i=e._buffer;if(defined(i.uri)){const n=e._baseResource.getDerivedResource({url:i.uri});return t.loadExternalBuffer({resource:n})}return t.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:e._bufferId})}function GltfDracoLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,n=e.draco,r=e.gltfResource,o=e.baseResource,a=e.cacheKey;this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._gltf=i,this._draco=n,this._cacheKey=a,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function handleError$7(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;e._promise.reject(e.getError("Failed to load Draco",t))}function GltfImageLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,n=e.imageId,r=e.gltfResource,o=e.baseResource,a=e.cacheKey,s=i.images[n],c=s.bufferView,l=s.uri;this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._gltf=i,this._bufferViewId=c,this._uri=l,this._cacheKey=a,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function getImageAndMipLevels(e){let t;return Array.isArray(e)&&(t=e.slice(1,e.length).map((function(e){return e.bufferView})),e=e[0]),{image:e,mipLevels:t}}function loadFromBufferView$2(e){const t=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});e._bufferViewLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(e.isDestroyed())return;return loadImageFromBufferTypedArray(t.typedArray).then((function(t){if(e.isDestroyed())return;const i=getImageAndMipLevels(t);e.unload(),e._image=i.image,e._mipLevels=i.mipLevels,e._state=ResourceLoaderState$1.READY,e._promise.resolve(e)}))})).catch((function(t){e.isDestroyed()||handleError$6(e,t,"Failed to load embedded image")}))}function loadFromUri$1(e){const t=e._baseResource,i=e._uri,n=t.getDerivedResource({url:i});e._state=ResourceLoaderState$1.LOADING,loadImageFromUri(n).then((function(t){if(e.isDestroyed())return;const i=getImageAndMipLevels(t);e.unload(),e._image=i.image,e._mipLevels=i.mipLevels,e._state=ResourceLoaderState$1.READY,e._promise.resolve(e)})).catch((function(t){e.isDestroyed()||handleError$6(e,t,`Failed to load image: ${i}`)}))}function handleError$6(e,t,i){e.unload(),e._state=ResourceLoaderState$1.FAILED,e._promise.reject(e.getError(i,t))}function getMimeTypeFromTypedArray(e){const t=e.subarray(0,2),i=e.subarray(0,4),n=e.subarray(8,12);if(255===t[0]&&216===t[1])return"image/jpeg";if(137===t[0]&&80===t[1])return"image/png";if(171===t[0]&&75===t[1])return"image/ktx2";if(82===i[0]&&73===i[1]&&70===i[2]&&70===i[3]&&87===n[0]&&69===n[1]&&66===n[2]&&80===n[3])return"image/webp";throw new RuntimeError("Image format is not recognized")}function loadImageFromBufferTypedArray(e){const t=getMimeTypeFromTypedArray(e);if("image/ktx2"===t){return loadKTX2(new Uint8Array(e))}return GltfImageLoader._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}defined(Object.create)&&(GltfBufferViewLoader.prototype=Object.create(ResourceLoader.prototype),GltfBufferViewLoader.prototype.constructor=GltfBufferViewLoader),Object.defineProperties(GltfBufferViewLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),GltfBufferViewLoader.prototype.load=function(){const e=getBufferLoader(this);this._bufferLoader=e,this._state=ResourceLoaderState$1.LOADING;const t=this;e.promise.then((function(){if(t.isDestroyed())return;const i=e.typedArray,n=new Uint8Array(i.buffer,i.byteOffset+t._byteOffset,t._byteLength);t.unload(),t._typedArray=n,t._hasMeshopt?t._state=ResourceLoaderState$1.PROCESSING:(t._state=ResourceLoaderState$1.READY,t._promise.resolve(t))})).catch((function(e){if(t.isDestroyed())return;t.unload(),t._state=ResourceLoaderState$1.FAILED;t._promise.reject(t.getError("Failed to load buffer view",e))}))},GltfBufferViewLoader.prototype.process=function(e){if(!this._hasMeshopt)return;if(!defined(this._typedArray))return;if(this._state!==ResourceLoaderState$1.PROCESSING)return;const t=this._meshoptCount,i=this._meshoptByteStride,n=new Uint8Array(t*i);MeshoptDecoder.decodeGltfBuffer(n,t,i,this._typedArray,this._meshoptMode,this._meshoptFilter),this._typedArray=n,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfBufferViewLoader.prototype.unload=function(){defined(this._bufferLoader)&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0},defined(Object.create)&&(GltfDracoLoader.prototype=Object.create(ResourceLoader.prototype),GltfDracoLoader.prototype.constructor=GltfDracoLoader),Object.defineProperties(GltfDracoLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}}),GltfDracoLoader.prototype.load=function(){const e=this._resourceCache.loadBufferView({gltf:this._gltf,bufferViewId:this._draco.bufferView,gltfResource:this._gltfResource,baseResource:this._baseResource});this._bufferViewLoader=e,this._state=ResourceLoaderState$1.LOADING;const t=this;e.promise.then((function(){t.isDestroyed()||(t._bufferViewTypedArray=e.typedArray,t._state=ResourceLoaderState$1.PROCESSING)})).catch((function(e){t.isDestroyed()||handleError$7(t,e)}))},GltfDracoLoader.prototype.process=function(e){if(!defined(this._bufferViewTypedArray))return;if(defined(this._decodePromise))return;const t=this._draco,i=this._gltf.bufferViews[t.bufferView],n=t.attributes,r={array:new Uint8Array(this._bufferViewTypedArray),bufferView:i,compressedAttributes:n,dequantizeInShader:!0},o=DracoLoader.decodeBufferView(r);if(!defined(o))return;const a=this;this._decodePromise=o.then((function(e){a.isDestroyed()||(a.unload(),a._decodedData={indices:e.indexArray,vertexAttributes:e.attributeData},a._state=ResourceLoaderState$1.READY,a._promise.resolve(a))})).catch((function(e){a.isDestroyed()||handleError$7(a,e)}))},GltfDracoLoader.prototype.unload=function(){defined(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0},defined(Object.create)&&(GltfImageLoader.prototype=Object.create(ResourceLoader.prototype),GltfImageLoader.prototype.constructor=GltfImageLoader),Object.defineProperties(GltfImageLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}}),GltfImageLoader.prototype.load=function(){defined(this._bufferViewId)?loadFromBufferView$2(this):loadFromUri$1(this)};const ktx2Regex$1=/(^data:image\/ktx2)|(\.ktx2$)/i;function loadImageFromUri(e){const t=e.url;return ktx2Regex$1.test(t)?loadKTX2(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}function GltfIndexBufferLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,n=e.accessorId,r=e.gltfResource,o=e.baseResource,a=e.draco,s=e.cacheKey,c=defaultValue(e.asynchronous,!0),l=defaultValue(e.loadAsTypedArray,!1),u=i.accessors[n].componentType;this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._gltf=i,this._accessorId=n,this._indexDatatype=u,this._draco=a,this._cacheKey=s,this._asynchronous=c,this._loadAsTypedArray=l,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function loadFromDraco$1(e){const t=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});e._dracoLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(e.isDestroyed())return;const i=t.decodedData.indices.typedArray;e._typedArray=i,e._indexDatatype=ComponentDatatype$1.fromTypedArray(i),e._state=ResourceLoaderState$1.PROCESSING})).catch((function(t){e.isDestroyed()||handleError$5(e,t)}))}function loadFromBufferView$1(e){const t=e._gltf,i=e._accessorId,n=t.accessors[i].bufferView,r=e._resourceCache.loadBufferView({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});e._state=ResourceLoaderState$1.LOADING,e._bufferViewLoader=r,r.promise.then((function(){if(e.isDestroyed())return;const t=r.typedArray;e._typedArray=createIndicesTypedArray(e,t),e._state=ResourceLoaderState$1.PROCESSING})).catch((function(t){e.isDestroyed()||handleError$5(e,t)}))}function createIndicesTypedArray(e,t){const i=e._gltf,n=e._accessorId,r=i.accessors[n],o=r.count,a=r.componentType,s=t.buffer,c=t.byteOffset+r.byteOffset;let l;return a===IndexDatatype$1.UNSIGNED_BYTE?l=new Uint8Array(s,c,o):a===IndexDatatype$1.UNSIGNED_SHORT?l=new Uint16Array(s,c,o):a===IndexDatatype$1.UNSIGNED_INT&&(l=new Uint32Array(s,c,o)),l}function handleError$5(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;t=e.getError("Failed to load index buffer",t),e._promise.reject(t)}function CreateIndexBufferJob(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}function createIndexBuffer(e,t,i){const n=Buffer$1.createIndexBuffer({typedArray:e,context:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:t});return n.vertexArrayDestroyable=!1,n}GltfImageLoader.prototype.unload=function(){defined(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._uri=void 0,this._image=void 0,this._mipLevels=void 0,this._gltf=void 0},GltfImageLoader._loadImageFromTypedArray=loadImageFromTypedArray,defined(Object.create)&&(GltfIndexBufferLoader.prototype=Object.create(ResourceLoader.prototype),GltfIndexBufferLoader.prototype.constructor=GltfIndexBufferLoader),Object.defineProperties(GltfIndexBufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}}),GltfIndexBufferLoader.prototype.load=function(){defined(this._draco)?loadFromDraco$1(this):loadFromBufferView$1(this)},CreateIndexBufferJob.prototype.set=function(e,t,i){this.typedArray=e,this.indexDatatype=t,this.context=i},CreateIndexBufferJob.prototype.execute=function(){this.buffer=createIndexBuffer(this.typedArray,this.indexDatatype,this.context)};const scratchIndexBufferJob=new CreateIndexBufferJob;function removePipelineExtras(e){return ForEach.shader(e,(function(e){removeExtras(e)})),ForEach.buffer(e,(function(e){removeExtras(e)})),ForEach.image(e,(function(e){removeExtras(e)})),removeExtras(e),e}function removeExtras(e){defined(e.extras)&&(defined(e.extras._pipeline)&&delete e.extras._pipeline,0===Object.keys(e.extras).length&&delete e.extras)}function GltfJsonLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltfResource,n=e.baseResource,r=e.typedArray,o=e.gltfJson,a=e.cacheKey;this._resourceCache=t,this._gltfResource=i,this._baseResource=n,this._typedArray=r,this._gltfJson=o,this._cacheKey=a,this._gltf=void 0,this._bufferLoaders=[],this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function loadFromUri(e){return e._fetchGltf().then((function(t){if(e.isDestroyed())return;const i=new Uint8Array(t);return processGltfTypedArray(e,i)}))}function handleError$4(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;const i=`Failed to load glTF: ${e._gltfResource.url}`;e._promise.reject(e.getError(i,t))}function upgradeVersion(e,t){if("2.0"===t.asset.version)return Promise.resolve();const i=[];return ForEach.buffer(t,(function(t){if(!defined(t.extras._pipeline.source)&&defined(t.uri)){const n=e._baseResource.getDerivedResource({url:t.uri}),r=e._resourceCache.loadExternalBuffer({resource:n});e._bufferLoaders.push(r),i.push(r.promise.then((function(e){t.extras._pipeline.source=e.typedArray})))}})),Promise.all(i).then((function(){updateVersion(t)}))}function decodeDataUris(e){const t=[];return ForEach.buffer(e,(function(e){const i=e.uri;!defined(e.extras._pipeline.source)&&defined(i)&&isDataUri(i)&&(delete e.uri,t.push(Resource.fetchArrayBuffer(i).then((function(t){e.extras._pipeline.source=new Uint8Array(t)}))))})),Promise.all(t)}function loadEmbeddedBuffers(e,t){const i=[];return ForEach.buffer(t,(function(t,n){const r=t.extras._pipeline.source;if(defined(r)&&!defined(t.uri)){const t=e._resourceCache.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:n,typedArray:r});e._bufferLoaders.push(t),i.push(t.promise)}})),Promise.all(i)}function processGltfJson(e,t){return addPipelineExtras(t),decodeDataUris(t).then((function(){return upgradeVersion(e,t).then((function(){return addDefaults(t),loadEmbeddedBuffers(e,t).then((function(){return removePipelineExtras(t),t}))}))}))}function processGltfTypedArray(e,t){let i;return i="glTF"===getMagic(t)?parseGlb(t):getJsonFromTypedArray(t),processGltfJson(e,i)}GltfIndexBufferLoader.prototype.process=function(e){if(this._state===ResourceLoaderState$1.READY)return;const t=this._typedArray,i=this._indexDatatype;if(defined(this._dracoLoader)&&this._dracoLoader.process(e),defined(this._bufferViewLoader)&&this._bufferViewLoader.process(e),!defined(t))return;if(this._loadAsTypedArray)return this.unload(),this._typedArray=t,this._state=ResourceLoaderState$1.READY,void this._promise.resolve(this);let n;if(this._asynchronous){const r=scratchIndexBufferJob;r.set(t,i,e.context);if(!e.jobScheduler.execute(r,JobType$1.BUFFER))return;n=r.buffer}else n=createIndexBuffer(t,i,e.context);this.unload(),this._buffer=n,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfIndexBufferLoader.prototype.unload=function(){defined(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;defined(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),defined(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},defined(Object.create)&&(GltfJsonLoader.prototype=Object.create(ResourceLoader.prototype),GltfJsonLoader.prototype.constructor=GltfJsonLoader),Object.defineProperties(GltfJsonLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}}),GltfJsonLoader.prototype.load=function(){let e;this._state=ResourceLoaderState$1.LOADING,e=defined(this._gltfJson)?processGltfJson(this,this._gltfJson):defined(this._typedArray)?processGltfTypedArray(this,this._typedArray):loadFromUri(this);const t=this;return e.then((function(e){t.isDestroyed()||(t._gltf=e,t._state=ResourceLoaderState$1.READY,t._promise.resolve(t))})).catch((function(e){t.isDestroyed()||handleError$4(t,e)}))},GltfJsonLoader.prototype.unload=function(){const e=this._bufferLoaders,t=e.length;for(let i=0;i<t;++i)this._resourceCache.unload(e[i]);this._bufferLoaders.length=0,this._gltf=void 0},GltfJsonLoader.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};const AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};var AlphaMode$1=Object.freeze(AlphaMode);const ModelComponents={};function Quantization$1(){this.octEncoded=!1,this.octEncodedZXY=!1,this.normalizationRange=void 0,this.quantizedVolumeOffset=void 0,this.quantizedVolumeDimensions=void 0,this.quantizedVolumeStepSize=void 0,this.componentDatatype=void 0,this.type=void 0}function Attribute$3(){this.name=void 0,this.semantic=void 0,this.setIndex=void 0,this.componentDatatype=void 0,this.type=void 0,this.normalized=!1,this.count=void 0,this.min=void 0,this.max=void 0,this.constant=void 0,this.quantization=void 0,this.packedTypedArray=void 0,this.buffer=void 0,this.typedArray=void 0,this.byteOffset=0,this.byteStride=void 0}function Indices$1(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function FeatureIdAttribute$4(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.setIndex=void 0,this.label=void 0,this.positionalLabel=void 0}function FeatureIdImplicitRange$1(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.offset=0,this.repeat=void 0,this.label=void 0,this.positionalLabel=void 0}function FeatureIdTexture$1(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.textureReader=void 0,this.label=void 0,this.positionalLabel=void 0}function MorphTarget$1(){this.attributes=[]}function Primitive$2(){this.attributes=[],this.morphTargets=[],this.morphWeights=[],this.indices=void 0,this.material=void 0,this.primitiveType=void 0,this.featureIds=[],this.propertyTextureIds=[],this.propertyAttributeIds=[]}function Instances$2(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1}function Skin$1(){this.joints=void 0,this.inverseBindMatrices=void 0}function Node$3(){this.children=[],this.primitives=[],this.instances=void 0,this.skin=void 0,this.matrix=void 0,this.translation=void 0,this.rotation=void 0,this.scale=void 0}function Scene$3(){this.nodes=[]}function Asset$1(){this.credits=[]}function Components$2(){this.asset=new Asset$1,this.scene=void 0,this.nodes=void 0,this.structuralMetadata=void 0,this.upAxis=void 0,this.forwardAxis=void 0,this.transform=Matrix4.clone(Matrix4.IDENTITY)}function TextureReader(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=Matrix3.clone(Matrix3.IDENTITY),this.channels=void 0}function MetallicRoughness$3(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=Cartesian4.clone(MetallicRoughness$3.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=MetallicRoughness$3.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=MetallicRoughness$3.DEFAULT_ROUGHNESS_FACTOR}function SpecularGlossiness$2(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=Cartesian4.clone(SpecularGlossiness$2.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=Cartesian3.clone(SpecularGlossiness$2.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=SpecularGlossiness$2.DEFAULT_GLOSSINESS_FACTOR}function Material$3(){this.metallicRoughness=new MetallicRoughness$3,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=Cartesian3.clone(Material$3.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=AlphaMode$1.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}MetallicRoughness$3.DEFAULT_BASE_COLOR_FACTOR=Cartesian4.ONE,MetallicRoughness$3.DEFAULT_METALLIC_FACTOR=1,MetallicRoughness$3.DEFAULT_ROUGHNESS_FACTOR=1,SpecularGlossiness$2.DEFAULT_DIFFUSE_FACTOR=Cartesian4.ONE,SpecularGlossiness$2.DEFAULT_SPECULAR_FACTOR=Cartesian3.ONE,SpecularGlossiness$2.DEFAULT_GLOSSINESS_FACTOR=1,Material$3.DEFAULT_EMISSIVE_FACTOR=Cartesian3.ZERO,ModelComponents.Quantization=Quantization$1,ModelComponents.Attribute=Attribute$3,ModelComponents.Indices=Indices$1,ModelComponents.FeatureIdAttribute=FeatureIdAttribute$4,ModelComponents.FeatureIdTexture=FeatureIdTexture$1,ModelComponents.FeatureIdImplicitRange=FeatureIdImplicitRange$1,ModelComponents.MorphTarget=MorphTarget$1,ModelComponents.Primitive=Primitive$2,ModelComponents.Instances=Instances$2,ModelComponents.Skin=Skin$1,ModelComponents.Node=Node$3,ModelComponents.Scene=Scene$3,ModelComponents.Asset=Asset$1,ModelComponents.Components=Components$2,ModelComponents.TextureReader=TextureReader,ModelComponents.MetallicRoughness=MetallicRoughness$3,ModelComponents.SpecularGlossiness=SpecularGlossiness$2,ModelComponents.Material=Material$3;const GltfLoaderUtil={getImageIdFromTexture:function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureId,n=e.supportedImageFormats,r=t.textures[i],o=r.extensions;if(defined(o)){if(n.webp&&defined(o.EXT_texture_webp))return o.EXT_texture_webp.source;if(n.basis&&defined(o.KHR_texture_basisu))return o.KHR_texture_basisu.source}return r.source},createSampler:function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureInfo,n=defaultValue(e.compressedTextureNoMipmap,!1);let r=TextureWrap$1.REPEAT,o=TextureWrap$1.REPEAT,a=TextureMinificationFilter$1.LINEAR,s=TextureMagnificationFilter$1.LINEAR;const c=i.index,l=t.textures[c].sampler;if(defined(l)){const e=t.samplers[l];r=defaultValue(e.wrapS,r),o=defaultValue(e.wrapT,o),a=defaultValue(e.minFilter,a),s=defaultValue(e.magFilter,s)}let u=!1;const d=i.extensions;return defined(d)&&defined(d.KHR_texture_transform)&&(u=!0),(n||u)&&a!==TextureMinificationFilter$1.LINEAR&&a!==TextureMinificationFilter$1.NEAREST&&(a=a===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||a===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?TextureMinificationFilter$1.NEAREST:TextureMinificationFilter$1.LINEAR),new Sampler({wrapS:r,wrapT:o,minificationFilter:a,magnificationFilter:s})}},defaultScale$2=new Cartesian2(1,1);function GltfTextureLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,n=e.textureInfo,r=e.gltfResource,o=e.baseResource,a=e.supportedImageFormats,s=e.cacheKey,c=defaultValue(e.asynchronous,!0),l=n.index,u=GltfLoaderUtil.getImageIdFromTexture({gltf:i,textureId:l,supportedImageFormats:a});this._resourceCache=t,this._gltf=i,this._textureInfo=n,this._imageId=u,this._gltfResource=r,this._baseResource=o,this._cacheKey=s,this._asynchronous=c,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function CreateTextureJob(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}function resizeImageToNextPowerOfTwo(e){const t=document.createElement("canvas");t.width=CesiumMath.nextPowerOfTwo(e.width),t.height=CesiumMath.nextPowerOfTwo(e.height);return t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function createTexture$1(e,t,i,n,r){const o=i.internalFormat;let a=!1;PixelFormat$1.isCompressedFormat(o)&&!defined(n)&&(a=!0);const s=GltfLoaderUtil.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:a}),c=s.minificationFilter,l=s.wrapS,u=s.wrapT,d=c===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||c===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||c===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||c===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,h=!defined(o)&&d,p=h||l===TextureWrap$1.REPEAT||l===TextureWrap$1.MIRRORED_REPEAT||u===TextureWrap$1.REPEAT||u===TextureWrap$1.MIRRORED_REPEAT,f=!CesiumMath.isPowerOfTwo(i.width)||!CesiumMath.isPowerOfTwo(i.height),m=p&&f;let g;return defined(o)?(!r.webgl2&&PixelFormat$1.isCompressedFormat(o)&&f&&p&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly."),g=Texture.create({context:r,source:{arrayBufferView:i.bufferView,mipLevels:n},width:i.width,height:i.height,pixelFormat:i.internalFormat,sampler:s})):(m&&(i=resizeImageToNextPowerOfTwo(i)),g=Texture.create({context:r,source:i,sampler:s,flipY:!1,skipColorSpaceConversion:!0})),h&&g.generateMipmap(),g}GltfLoaderUtil.createModelTextureReader=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).textureInfo,i=e.channels,n=e.texture;let r,o=defaultValue(t.texCoord,0);const a=defaultValue(t.extensions,defaultValue.EMPTY_OBJECT).KHR_texture_transform;if(defined(a)){o=defaultValue(a.texCoord,o);const e=defined(a.offset)?Cartesian2.unpack(a.offset):Cartesian2.ZERO;let t=defaultValue(a.rotation,0);const i=defined(a.scale)?Cartesian2.unpack(a.scale):defaultScale$2;t=-t,r=new Matrix3(Math.cos(t)*i.x,-Math.sin(t)*i.y,e.x,Math.sin(t)*i.x,Math.cos(t)*i.y,e.y,0,0,1)}const s=new ModelComponents.TextureReader;return s.index=t.index,s.texture=n,s.texCoord=o,s.transform=r,s.channels=i,s},defined(Object.create)&&(GltfTextureLoader.prototype=Object.create(ResourceLoader.prototype),GltfTextureLoader.prototype.constructor=GltfTextureLoader),Object.defineProperties(GltfTextureLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}}),GltfTextureLoader.prototype.load=function(){const e=this._resourceCache.loadImage({gltf:this._gltf,imageId:this._imageId,gltfResource:this._gltfResource,baseResource:this._baseResource});this._imageLoader=e,this._state=ResourceLoaderState$1.LOADING;const t=this;e.promise.then((function(){t.isDestroyed()||(t._image=e.image,t._mipLevels=e.mipLevels,t._state=ResourceLoaderState$1.PROCESSING)})).catch((function(e){if(t.isDestroyed())return;t.unload(),t._state=ResourceLoaderState$1.FAILED;t._promise.reject(t.getError("Failed to load texture",e))}))},CreateTextureJob.prototype.set=function(e,t,i,n,r){this.gltf=e,this.textureInfo=t,this.image=i,this.mipLevels=n,this.context=r},CreateTextureJob.prototype.execute=function(){this.texture=createTexture$1(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};const scratchTextureJob=new CreateTextureJob;function GltfVertexBufferLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,n=e.gltfResource,r=e.baseResource,o=e.bufferViewId,a=e.draco,s=e.attributeSemantic,c=e.accessorId,l=e.cacheKey,u=defaultValue(e.asynchronous,!0),d=defaultValue(e.dequantize,!1),h=defaultValue(e.loadAsTypedArray,!1);this._resourceCache=t,this._gltfResource=n,this._baseResource=r,this._gltf=i,this._bufferViewId=o,this._draco=a,this._attributeSemantic=s,this._accessorId=c,this._cacheKey=l,this._asynchronous=u,this._dequantize=d,this._loadAsTypedArray=h,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function getQuantizationInformation(e,t,i,n){const r=(1<<e.quantizationBits)-1,o=1/r,a=new ModelComponents.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=n,a.octEncoded)a.type=AttributeType$1.VEC2,a.normalizationRange=r;else{const t=AttributeType$1.getMathType(n);if(t===Number){const t=e.range;a.quantizedVolumeOffset=e.minValues[0],a.quantizedVolumeDimensions=t,a.normalizationRange=r,a.quantizedVolumeStepSize=t*o}else{a.quantizedVolumeOffset=t.unpack(e.minValues),a.normalizationRange=t.unpack(arrayFill(new Array(i),r));const n=arrayFill(new Array(i),e.range);a.quantizedVolumeDimensions=t.unpack(n);const s=n.map((function(e){return e*o}));a.quantizedVolumeStepSize=t.unpack(s)}}return a}function loadFromDraco(e){const t=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});e._dracoLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(e.isDestroyed())return;const i=t.decodedData.vertexAttributes[e._attributeSemantic],n=e._accessorId,r=e._gltf.accessors[n].type,o=i.array,a=i.data.quantization;defined(a)&&(e._quantization=getQuantizationInformation(a,i.data.componentDatatype,i.data.componentsPerAttribute,r)),e._typedArray=o,e._state=ResourceLoaderState$1.PROCESSING})).catch((function(t){e.isDestroyed()||handleError$3(e,t)}))}function loadFromBufferView(e){const t=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});e._state=ResourceLoaderState$1.LOADING,e._bufferViewLoader=t,t.promise.then((function(){e.isDestroyed()||(e._typedArray=t.typedArray,e._state=ResourceLoaderState$1.PROCESSING)})).catch((function(t){e.isDestroyed()||handleError$3(e,t)}))}function handleError$3(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;t=e.getError("Failed to load vertex buffer",t),e._promise.reject(t)}function CreateVertexBufferJob(){this.typedArray=void 0,this.dequantize=void 0,this.componentType=void 0,this.type=void 0,this.count=void 0,this.context=void 0,this.buffer=void 0}function createVertexBuffer$1(e,t,i,n,r,o){t&&i!==ComponentDatatype$1.FLOAT&&(e=AttributeCompression.dequantize(e,i,n,r));const a=Buffer$1.createVertexBuffer({typedArray:e,context:o,usage:BufferUsage$1.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}GltfTextureLoader.prototype.process=function(e){if(defined(this._texture))return;if(!defined(this._image))return;let t;if(this._asynchronous){const i=scratchTextureJob;i.set(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);if(!e.jobScheduler.execute(i,JobType$1.TEXTURE))return;t=i.texture}else t=createTexture$1(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);this.unload(),this._texture=t,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfTextureLoader.prototype.unload=function(){defined(this._texture)&&this._texture.destroy(),defined(this._imageLoader)&&this._resourceCache.unload(this._imageLoader),this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._gltf=void 0},defined(Object.create)&&(GltfVertexBufferLoader.prototype=Object.create(ResourceLoader.prototype),GltfVertexBufferLoader.prototype.constructor=GltfVertexBufferLoader),Object.defineProperties(GltfVertexBufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},quantization:{get:function(){return this._quantization}}}),GltfVertexBufferLoader.prototype.load=function(){defined(this._draco)?loadFromDraco(this):loadFromBufferView(this)},CreateVertexBufferJob.prototype.set=function(e,t,i,n,r,o){this.typedArray=e,this.dequantize=t,this.componentType=i,this.type=n,this.count=r,this.context=o},CreateVertexBufferJob.prototype.execute=function(){this.buffer=createVertexBuffer$1(this.typedArray,this.dequantize,this.componentType,this.type,this.count,this.context)};const scratchVertexBufferJob=new CreateVertexBufferJob;function MetadataClass(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,i=e.class,n={},r={};for(const t in i.properties)if(i.properties.hasOwnProperty(t)){const o=new MetadataClassProperty({id:t,property:i.properties[t],enums:e.enums});n[t]=o,defined(o.semantic)&&(r[o.semantic]=o)}this._properties=n,this._propertiesBySemantic=r,this._id=t,this._name=i.name,this._description=i.description,this._extras=i.extras,this._extensions=i.extensions}function MetadataEnumValue(e){this._value=e.value,this._name=e.name,this._description=e.description,this._extras=e.extras,this._extensions=e.extensions}function MetadataEnum(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,i=e.enum,n={},r={},o=i.values.map((function(e){return n[e.value]=e.name,r[e.name]=e.value,new MetadataEnumValue(e)})),a=defaultValue(MetadataComponentType$1[i.valueType],MetadataComponentType$1.UINT16);this._values=o,this._namesByValue=n,this._valuesByName=r,this._valueType=a,this._id=t,this._name=i.name,this._description=i.description,this._extras=i.extras,this._extensions=i.extensions}function MetadataSchema(e){const t={};if(defined(e.enums))for(const i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=new MetadataEnum({id:i,enum:e.enums[i]}));const i={};if(defined(e.classes))for(const n in e.classes)e.classes.hasOwnProperty(n)&&(i[n]=new MetadataClass({id:n,class:e.classes[n],enums:t}));this._classes=i,this._enums=t,this._id=e.id,this._name=e.name,this._description=e.description,this._version=e.version,this._extras=e.extras,this._extensions=e.extensions}function MetadataSchemaLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).schema,i=e.resource,n=e.cacheKey;this._schema=defined(t)?new MetadataSchema(t):void 0,this._resource=i,this._cacheKey=n,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function loadExternalSchema(e){const t=e._resource;e._state=ResourceLoaderState$1.LOADING,t.fetchJson().then((function(t){e.isDestroyed()||(e._schema=new MetadataSchema(t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).catch((function(i){if(e.isDestroyed())return;e._state=ResourceLoaderState$1.FAILED;const n=`Failed to load schema: ${t.url}`;e._promise.reject(e.getError(n,i))}))}GltfVertexBufferLoader.prototype.process=function(e){if(this._state===ResourceLoaderState$1.READY)return;const t=this._typedArray,i=this._dequantize;if(defined(this._dracoLoader)&&this._dracoLoader.process(e),defined(this._bufferViewLoader)&&this._bufferViewLoader.process(e),!defined(t))return;if(this._loadAsTypedArray)return this.unload(),this._typedArray=t,this._state=ResourceLoaderState$1.READY,void this._promise.resolve(this);const n=this._gltf.accessors[this._accessorId];let r;if(this._asynchronous){const o=scratchVertexBufferJob;o.set(t,i,n.componentType,n.type,n.count,e.context);if(!e.jobScheduler.execute(o,JobType$1.BUFFER))return;r=o.buffer}else r=createVertexBuffer$1(t,i,n.componentType,n.type,n.count,e.context);this.unload(),this._buffer=r,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfVertexBufferLoader.prototype.unload=function(){defined(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;defined(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),defined(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},Object.defineProperties(MetadataClass.prototype,{properties:{get:function(){return this._properties}},propertiesBySemantic:{get:function(){return this._propertiesBySemantic}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataClass.BATCH_TABLE_CLASS_NAME="_batchTable",Object.defineProperties(MetadataEnumValue.prototype,{value:{get:function(){return this._value}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(MetadataEnum.prototype,{values:{get:function(){return this._values}},namesByValue:{get:function(){return this._namesByValue}},valuesByName:{get:function(){return this._valuesByName}},valueType:{get:function(){return this._valueType}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(MetadataSchema.prototype,{classes:{get:function(){return this._classes}},enums:{get:function(){return this._enums}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},version:{get:function(){return this._version}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),defined(Object.create)&&(MetadataSchemaLoader.prototype=Object.create(ResourceLoader.prototype),MetadataSchemaLoader.prototype.constructor=MetadataSchemaLoader),Object.defineProperties(MetadataSchemaLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}}),MetadataSchemaLoader.prototype.load=function(){defined(this._schema)?this._promise.resolve(this):loadExternalSchema(this)},MetadataSchemaLoader.prototype.unload=function(){this._schema=void 0};const ResourceCacheKey={};function getExternalResourceCacheKey(e){return getAbsoluteUri(e.url)}function getBufferViewCacheKey(e){let t=e.byteOffset,i=e.byteLength;if(hasExtension(e,"EXT_meshopt_compression")){const n=e.extensions.EXT_meshopt_compression;t=defaultValue(n.byteOffset,0),i=n.byteLength}return`${t}-${t+i}`}function getAccessorCacheKey(e,t){return`${t.byteOffset+e.byteOffset}-${e.componentType}-${e.type}-${e.count}`}function getExternalBufferCacheKey(e){return getExternalResourceCacheKey(e)}function getEmbeddedBufferCacheKey(e,t){return`${getExternalResourceCacheKey(e)}-buffer-id-${t}`}function getBufferCacheKey(e,t,i,n){if(defined(e.uri)){return getExternalBufferCacheKey(n.getDerivedResource({url:e.uri}))}return getEmbeddedBufferCacheKey(i,t)}function getDracoCacheKey(e,t,i,n){const r=t.bufferView,o=e.bufferViews[r],a=o.buffer;return`${getBufferCacheKey(e.buffers[a],a,i,n)}-range-${getBufferViewCacheKey(o)}`}function getImageCacheKey(e,t,i,n){const r=e.images[t],o=r.bufferView,a=r.uri;if(defined(a)){return getExternalResourceCacheKey(n.getDerivedResource({url:a}))}const s=e.bufferViews[o],c=s.buffer;return`${getBufferCacheKey(e.buffers[c],c,i,n)}-range-${getBufferViewCacheKey(s)}`}function getSamplerCacheKey(e,t){const i=GltfLoaderUtil.createSampler({gltf:e,textureInfo:t});return`${i.wrapS}-${i.wrapT}-${i.minificationFilter}-${i.magnificationFilter}`}function ResourceCache(){}function CacheEntry(e){this.referenceCount=1,this.resourceLoader=e}function ImplicitSubtree(e,t,i,n,r){this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._implicitCoordinates=r,this._subtreeLevels=n.subtreeLevels,this._subdivisionScheme=n.subdivisionScheme,this._branchingFactor=n.branchingFactor,this._readyPromise=defer(),this._metadata=void 0,this._tileMetadataTable=void 0,this._tilePropertyTableJson=void 0,this._contentMetadataTables=[],this._contentPropertyTableJsons=[],this._tileJumpBuffer=void 0,this._contentJumpBuffers=[],initialize$8(this,t,i,n)}function initialize$8(e,t,i,n){let r;r=defined(t)?{json:t,binary:void 0}:parseSubtreeChunks(i);const o=r.json;let a;if(e._subtreeJson=o,hasExtension(o,"3DTILES_metadata"))a=o.extensions["3DTILES_metadata"];else if(defined(o.tileMetadata)){const e=o.tileMetadata;a=o.propertyTables[e]}const s=[];if(defined(o.contentMetadata)){const e=o.contentMetadata.length;for(let t=0;t<e;t++){const e=o.contentMetadata[t];s.push(o.propertyTables[e])}}let c;const l=n.metadataSchema,u=o.subtreeMetadata;if(defined(u)){const e=u.class;c=new ImplicitSubtreeMetadata({subtreeMetadata:u,class:l.classes[e]})}e._metadata=c,e._tilePropertyTableJson=a,e._contentPropertyTableJsons=s;const d={constant:0};o.contentAvailabilityHeaders=[],hasExtension(o,"3DTILES_multiple_contents")?o.contentAvailabilityHeaders=o.extensions["3DTILES_multiple_contents"].contentAvailability:Array.isArray(o.contentAvailability)?o.contentAvailabilityHeaders=o.contentAvailability:o.contentAvailabilityHeaders.push(defaultValue(o.contentAvailability,d));const h=preprocessBuffers(o.buffers),p=preprocessBufferViews(o.bufferViews,h);markActiveBufferViews(o,p),defined(a)&&markActiveMetadataBufferViews(a,p);for(let e=0;e<s.length;e++){markActiveMetadataBufferViews(s[e],p)}requestActiveBuffers(e,h,r.binary).then((function(t){const i=parseActiveBufferViews(p,t);parseAvailability(e,o,n,i),defined(a)&&(parseTileMetadataTable(e,n,i),makeTileJumpBuffer(e)),parseContentMetadataTables(e,n,i),makeContentJumpBuffers(e),e._readyPromise.resolve(e)})).catch((function(t){e._readyPromise.reject(t)}))}function parseSubtreeChunks(e){const t=new DataView(e.buffer,e.byteOffset);let i=8;const n=t.getUint32(i,true);i+=8;const r=t.getUint32(i,true);i+=8;const o=getJsonFromTypedArray(e,i,n);i+=n;return{json:o,binary:e.subarray(i,i+r)}}function preprocessBuffers(e){e=defined(e)?e:[];for(let t=0;t<e.length;t++){const i=e[t];i.isExternal=defined(i.uri),i.isActive=!1}return e}function preprocessBufferViews(e,t){e=defined(e)?e:[];for(let i=0;i<e.length;i++){const n=e[i],r=t[n.buffer];n.bufferHeader=r,n.isActive=!1}return e}function markActiveBufferViews(e,t){let i;const n=e.tileAvailability;defined(n.bitstream)?i=t[n.bitstream]:defined(n.bufferView)&&(i=t[n.bufferView]),defined(i)&&(i.isActive=!0,i.bufferHeader.isActive=!0);const r=e.contentAvailabilityHeaders;for(let e=0;e<r.length;e++)i=void 0,defined(r[e].bitstream)?i=t[r[e].bitstream]:defined(r[e].bufferView)&&(i=t[r[e].bufferView]),defined(i)&&(i.isActive=!0,i.bufferHeader.isActive=!0);i=void 0;const o=e.childSubtreeAvailability;defined(o.bitstream)?i=t[o.bitstream]:defined(o.bufferView)&&(i=t[o.bufferView]),defined(i)&&(i.isActive=!0,i.bufferHeader.isActive=!0)}function markActiveMetadataBufferViews(e,t){const i=e.properties;let n;for(const e in i)if(i.hasOwnProperty(e)){const r=i[e];n=t[defaultValue(r.values,r.bufferView)],n.isActive=!0,n.bufferHeader.isActive=!0;const o=defaultValue(r.stringOffsets,r.stringOffsetBufferView);defined(o)&&(n=t[o],n.isActive=!0,n.bufferHeader.isActive=!0);const a=defaultValue(r.arrayOffsets,r.arrayOffsetBufferView);defined(a)&&(n=t[a],n.isActive=!0,n.bufferHeader.isActive=!0)}}function requestActiveBuffers(e,t,i){const n=[];for(let r=0;r<t.length;r++){const o=t[r];if(o.isActive)if(o.isExternal){const t=requestExternalBuffer(e,o);n.push(t)}else n.push(Promise.resolve(i));else n.push(Promise.resolve(void 0))}return Promise.all(n).then((function(e){const t={};for(let i=0;i<e.length;i++){const n=e[i];defined(n)&&(t[i]=n)}return t}))}function requestExternalBuffer(e,t){const i=e._resource.getDerivedResource({url:t.uri}),n=ResourceCache.loadExternalBuffer({resource:i});return e._bufferLoader=n,n.promise.then((function(e){return e.typedArray}))}function parseActiveBufferViews(e,t){const i={};for(let n=0;n<e.length;n++){const r=e[n];if(!r.isActive)continue;const o=r.byteOffset,a=o+r.byteLength,s=t[r.buffer].subarray(o,a);i[n]=s}return i}function parseAvailability(e,t,i,n){const r=i.branchingFactor,o=i.subtreeLevels,a=(Math.pow(r,o)-1)/(r-1),s=Math.pow(r,o),c=hasExtension(t,"3DTILES_metadata"),l=defined(e._tilePropertyTableJson);let u=c||l;e._tileAvailability=parseAvailabilityBitstream(t.tileAvailability,n,a,u);const d=e._contentPropertyTableJsons.length>0;u=u||d;for(let i=0;i<t.contentAvailabilityHeaders.length;i++){const r=parseAvailabilityBitstream(t.contentAvailabilityHeaders[i],n,a,u);e._contentAvailabilityBitstreams.push(r)}e._childSubtreeAvailability=parseAvailabilityBitstream(t.childSubtreeAvailability,n,s)}function parseAvailabilityBitstream(e,t,i,n){if(defined(e.constant))return new ImplicitAvailabilityBitstream({constant:Boolean(e.constant),lengthBits:i,availableCount:e.availableCount});let r;return defined(e.bitstream)?r=t[e.bitstream]:defined(e.bufferView)&&(r=t[e.bufferView]),new ImplicitAvailabilityBitstream({bitstream:r,lengthBits:i,availableCount:e.availableCount,computeAvailableCountEnabled:n})}function parseTileMetadataTable(e,t,i){const n=e._tilePropertyTableJson,r=e._tileAvailability.availableCount,o=t.metadataSchema,a=n.class,s=o.classes[a];e._tileMetadataTable=new MetadataTable({class:s,count:r,properties:n.properties,bufferViews:i})}function parseContentMetadataTables(e,t,i){const n=e._contentPropertyTableJsons,r=e._contentAvailabilityBitstreams,o=t.metadataSchema,a=e._contentMetadataTables;for(let e=0;e<n.length;e++){const t=n[e],s=r[e].availableCount,c=t.class,l=new MetadataTable({class:o.classes[c],count:s,properties:t.properties,bufferViews:i});a.push(l)}}function makeJumpBuffer(e){let t=0;const i=e.lengthBits,n=e.availableCount;let r;r=n<256?new Uint8Array(i):n<65536?new Uint16Array(i):new Uint32Array(i);for(let i=0;i<e.lengthBits;i++)e.getBit(i)&&(r[i]=t,t++);return r}function makeTileJumpBuffer(e){const t=makeJumpBuffer(e._tileAvailability);e._tileJumpBuffer=t}function makeContentJumpBuffers(e){const t=e._contentJumpBuffers,i=e._contentAvailabilityBitstreams;for(let e=0;e<i.length;e++){const n=makeJumpBuffer(i[e]);t.push(n)}}function getTileEntityId(e,t){if(!defined(e._tileMetadataTable))return;const i=e.getTileIndex(t);return e._tileAvailability.getBit(i)?e._tileJumpBuffer[i]:void 0}function getContentEntityId(e,t,i){const n=e._contentMetadataTables;if(!defined(n))return;if(!defined(n[i]))return;const r=e._contentAvailabilityBitstreams[i],o=e.getTileIndex(t);if(r.getBit(o)){return e._contentJumpBuffers[i][o]}}ResourceCacheKey.getSchemaCacheKey=function(e){const t=e.schema,i=e.resource;return defined(t)?`embedded-schema:${JSON.stringify(t)}`:`external-schema:${getExternalResourceCacheKey(i)}`},ResourceCacheKey.getExternalBufferCacheKey=function(e){return`external-buffer:${getExternalBufferCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resource)}`},ResourceCacheKey.getEmbeddedBufferCacheKey=function(e){return`embedded-buffer:${getEmbeddedBufferCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).parentResource,e.bufferId)}`},ResourceCacheKey.getGltfCacheKey=function(e){return`gltf:${getExternalResourceCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource)}`},ResourceCacheKey.getBufferViewCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.bufferViewId,n=e.gltfResource,r=e.baseResource,o=t.bufferViews[i];let a=o.buffer;const s=t.buffers[a];if(hasExtension(o,"EXT_meshopt_compression")){a=o.extensions.EXT_meshopt_compression.buffer}return`buffer-view:${getBufferCacheKey(s,a,n,r)}-range-${getBufferViewCacheKey(o)}`},ResourceCacheKey.getDracoCacheKey=function(e){return`draco:${getDracoCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,e.draco,e.gltfResource,e.baseResource)}`},ResourceCacheKey.getVertexBufferCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.gltfResource,n=e.baseResource,r=e.bufferViewId,o=e.draco,a=e.attributeSemantic;let s="";if(defaultValue(e.dequantize,!1)&&(s+="-dequantize"),defaultValue(e.loadAsTypedArray,!1)&&(s+="-typed-array"),defined(o)){return`vertex-buffer:${getDracoCacheKey(t,o,i,n)}-draco-${a}${s}`}const c=t.bufferViews[r],l=c.buffer;return`vertex-buffer:${getBufferCacheKey(t.buffers[l],l,i,n)}-range-${getBufferViewCacheKey(c)}${s}`},ResourceCacheKey.getIndexBufferCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.accessorId,n=e.gltfResource,r=e.baseResource,o=e.draco;let a="";if(defaultValue(e.loadAsTypedArray,!1)&&(a+="-typed-array"),defined(o)){return`index-buffer:${getDracoCacheKey(t,o,n,r)}-draco${a}`}const s=t.accessors[i],c=s.bufferView,l=t.bufferViews[c],u=l.buffer;return`index-buffer:${getBufferCacheKey(t.buffers[u],u,n,r)}-accessor-${getAccessorCacheKey(s,l)}${a}`},ResourceCacheKey.getImageCacheKey=function(e){return`image:${getImageCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,e.imageId,e.gltfResource,e.baseResource)}`},ResourceCacheKey.getTextureCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureInfo,n=e.gltfResource,r=e.baseResource,o=e.supportedImageFormats,a=i.index;return`texture:${getImageCacheKey(t,GltfLoaderUtil.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:o}),n,r)}-sampler-${getSamplerCacheKey(t,i)}`},ResourceCache.cacheEntries={},ResourceCache.get=function(e){const t=ResourceCache.cacheEntries[e];if(defined(t))return++t.referenceCount,t.resourceLoader},ResourceCache.load=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceLoader,i=t.cacheKey;ResourceCache.cacheEntries[i]=new CacheEntry(t),t.load()},ResourceCache.unload=function(e){const t=e.cacheKey,i=ResourceCache.cacheEntries[t];--i.referenceCount,0===i.referenceCount&&(e.destroy(),delete ResourceCache.cacheEntries[t])},ResourceCache.loadSchema=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).schema,i=e.resource,n=ResourceCacheKey.getSchemaCacheKey({schema:t,resource:i});let r=ResourceCache.get(n);return defined(r)||(r=new MetadataSchemaLoader({schema:t,resource:i,cacheKey:n}),ResourceCache.load({resourceLoader:r})),r},ResourceCache.loadEmbeddedBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).parentResource,i=e.bufferId,n=e.typedArray,r=ResourceCacheKey.getEmbeddedBufferCacheKey({parentResource:t,bufferId:i});let o=ResourceCache.get(r);return defined(o)||(o=new BufferLoader({typedArray:n,cacheKey:r}),ResourceCache.load({resourceLoader:o})),o},ResourceCache.loadExternalBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resource,i=ResourceCacheKey.getExternalBufferCacheKey({resource:t});let n=ResourceCache.get(i);return defined(n)||(n=new BufferLoader({resource:t,cacheKey:i}),ResourceCache.load({resourceLoader:n})),n},ResourceCache.loadGltfJson=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource,i=e.baseResource,n=e.typedArray,r=e.gltfJson,o=ResourceCacheKey.getGltfCacheKey({gltfResource:t});let a=ResourceCache.get(o);return defined(a)||(a=new GltfJsonLoader({resourceCache:ResourceCache,gltfResource:t,baseResource:i,typedArray:n,gltfJson:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadBufferView=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.bufferViewId,n=e.gltfResource,r=e.baseResource,o=ResourceCacheKey.getBufferViewCacheKey({gltf:t,bufferViewId:i,gltfResource:n,baseResource:r});let a=ResourceCache.get(o);return defined(a)||(a=new GltfBufferViewLoader({resourceCache:ResourceCache,gltf:t,bufferViewId:i,gltfResource:n,baseResource:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadDraco=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.draco,n=e.gltfResource,r=e.baseResource,o=ResourceCacheKey.getDracoCacheKey({gltf:t,draco:i,gltfResource:n,baseResource:r});let a=ResourceCache.get(o);return defined(a)||(a=new GltfDracoLoader({resourceCache:ResourceCache,gltf:t,draco:i,gltfResource:n,baseResource:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadVertexBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.gltfResource,n=e.baseResource,r=e.bufferViewId,o=e.draco,a=e.attributeSemantic,s=e.accessorId,c=defaultValue(e.asynchronous,!0),l=defaultValue(e.dequantize,!1),u=defaultValue(e.loadAsTypedArray,!1),d=ResourceCacheKey.getVertexBufferCacheKey({gltf:t,gltfResource:i,baseResource:n,bufferViewId:r,draco:o,attributeSemantic:a,dequantize:l,loadAsTypedArray:u});let h=ResourceCache.get(d);return defined(h)||(h=new GltfVertexBufferLoader({resourceCache:ResourceCache,gltf:t,gltfResource:i,baseResource:n,bufferViewId:r,draco:o,attributeSemantic:a,accessorId:s,cacheKey:d,asynchronous:c,dequantize:l,loadAsTypedArray:u}),ResourceCache.load({resourceLoader:h})),h},ResourceCache.loadIndexBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.accessorId,n=e.gltfResource,r=e.baseResource,o=e.draco,a=defaultValue(e.asynchronous,!0),s=defaultValue(e.loadAsTypedArray,!1),c=ResourceCacheKey.getIndexBufferCacheKey({gltf:t,accessorId:i,gltfResource:n,baseResource:r,draco:o,loadAsTypedArray:s});let l=ResourceCache.get(c);return defined(l)||(l=new GltfIndexBufferLoader({resourceCache:ResourceCache,gltf:t,accessorId:i,gltfResource:n,baseResource:r,draco:o,cacheKey:c,asynchronous:a,loadAsTypedArray:s}),ResourceCache.load({resourceLoader:l})),l},ResourceCache.loadImage=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.imageId,n=e.gltfResource,r=e.baseResource,o=ResourceCacheKey.getImageCacheKey({gltf:t,imageId:i,gltfResource:n,baseResource:r});let a=ResourceCache.get(o);return defined(a)||(a=new GltfImageLoader({resourceCache:ResourceCache,gltf:t,imageId:i,gltfResource:n,baseResource:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadTexture=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureInfo,n=e.gltfResource,r=e.baseResource,o=e.supportedImageFormats,a=defaultValue(e.asynchronous,!0),s=ResourceCacheKey.getTextureCacheKey({gltf:t,textureInfo:i,gltfResource:n,baseResource:r,supportedImageFormats:o});let c=ResourceCache.get(s);return defined(c)||(c=new GltfTextureLoader({resourceCache:ResourceCache,gltf:t,textureInfo:i,gltfResource:n,baseResource:r,supportedImageFormats:o,cacheKey:s,asynchronous:a}),ResourceCache.load({resourceLoader:c})),c},ResourceCache.clearForSpecs=function(){const e=[GltfVertexBufferLoader,GltfIndexBufferLoader,GltfDracoLoader,GltfTextureLoader,GltfImageLoader,GltfBufferViewLoader,BufferLoader,MetadataSchemaLoader,GltfJsonLoader];let t;const i=ResourceCache.cacheEntries,n=[];for(t in i)i.hasOwnProperty(t)&&n.push(i[t]);n.sort((function(t,i){return e.indexOf(t.resourceLoader.constructor)-e.indexOf(i.resourceLoader.constructor)}));const r=n.length;for(let e=0;e<r;++e){const r=n[e];t=r.resourceLoader.cacheKey,defined(i[t])&&(r.resourceLoader.destroy(),delete i[t])}},Object.defineProperties(ImplicitSubtree.prototype,{readyPromise:{get:function(){return this._readyPromise.promise}},metadata:{get:function(){return this._metadata}},tileMetadataTable:{get:function(){return this._tileMetadataTable}},tilePropertyTableJson:{get:function(){return this._tilePropertyTableJson}},contentMetadataTables:{get:function(){return this._contentMetadataTables}},contentPropertyTableJsons:{get:function(){return this._contentPropertyTableJsons}},implicitCoordinates:{get:function(){return this._implicitCoordinates}}}),ImplicitSubtree.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)},ImplicitSubtree.prototype.tileIsAvailableAtCoordinates=function(e){const t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)},ImplicitSubtree.prototype.contentIsAvailableAtIndex=function(e,t){return t=defaultValue(t,0),this._contentAvailabilityBitstreams[t].getBit(e)},ImplicitSubtree.prototype.contentIsAvailableAtCoordinates=function(e,t){const i=this.getTileIndex(e);return this.contentIsAvailableAtIndex(i,t)},ImplicitSubtree.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)},ImplicitSubtree.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)},ImplicitSubtree.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)},ImplicitSubtree.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(t=3),e>>t},ImplicitSubtree.prototype.getTileIndex=function(e){const t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new RuntimeError("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex},ImplicitSubtree.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new RuntimeError("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex},ImplicitSubtree.prototype.getTileMetadataView=function(e){const t=getTileEntityId(this,e);if(!defined(t))return;const i=this._tileMetadataTable;return new ImplicitMetadataView({class:i.class,metadataTable:i,entityId:t,propertyTableJson:this._tilePropertyTableJson})},ImplicitSubtree.prototype.getContentMetadataView=function(e,t){const i=getContentEntityId(this,e,t);if(!defined(i))return;const n=this._contentMetadataTables[t],r=this._contentPropertyTableJsons[t];return new ImplicitMetadataView({class:n.class,metadataTable:n,entityId:i,contentIndex:t,propertyTableJson:r})},ImplicitSubtree.prototype.isDestroyed=function(){return!1},ImplicitSubtree.prototype.destroy=function(){return defined(this._bufferLoader)&&ResourceCache.unload(this._bufferLoader),destroyObject(this)};const MetadataSemantic={ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",TILE_BOUNDING_BOX:"TILE_BOUNDING_BOX",TILE_BOUNDING_REGION:"TILE_BOUNDING_REGION",TILE_BOUNDING_SPHERE:"TILE_BOUNDING_SPHERE",TILE_MINIMUM_HEIGHT:"TILE_MINIMUM_HEIGHT",TILE_MAXIMUM_HEIGHT:"TILE_MAXIMUM_HEIGHT",TILE_HORIZON_OCCLUSION_POINT:"TILE_HORIZON_OCCLUSION_POINT",TILE_GEOMETRIC_ERROR:"TILE_GEOMETRIC_ERROR",CONTENT_BOUNDING_BOX:"CONTENT_BOUNDING_BOX",CONTENT_BOUNDING_REGION:"CONTENT_BOUNDING_REGION",CONTENT_BOUNDING_SPHERE:"CONTENT_BOUNDING_SPHERE",CONTENT_MINIMUM_HEIGHT:"CONTENT_MINIMUM_HEIGHT",CONTENT_MAXIMUM_HEIGHT:"CONTENT_MAXIMUM_HEIGHT",CONTENT_HORIZON_OCCLUSION_POINT:"CONTENT_HORIZON_OCCLUSION_POINT"};var MetadataSemantic$1=Object.freeze(MetadataSemantic);function parseBoundingVolumeSemantics(e){return{tile:{boundingVolume:parseBoundingVolume("TILE",e),minimumHeight:parseMinimumHeight("TILE",e),maximumHeight:parseMaximumHeight("TILE",e)},content:{boundingVolume:parseBoundingVolume("CONTENT",e),minimumHeight:parseMinimumHeight("CONTENT",e),maximumHeight:parseMaximumHeight("CONTENT",e)}}}function parseBoundingVolume(e,t){const i=`${e}_BOUNDING_BOX`,n=t.getPropertyBySemantic(i);if(defined(n))return{box:n};const r=`${e}_BOUNDING_REGION`,o=t.getPropertyBySemantic(r);if(defined(o))return{region:o};const a=`${e}_BOUNDING_SPHERE`,s=t.getPropertyBySemantic(a);return defined(s)?{sphere:s}:void 0}function parseMinimumHeight(e,t){const i=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(i)}function parseMaximumHeight(e,t){const i=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(i)}function Implicit3DTileContent(e,t,i,n,r,o){const a=t.implicitTileset,s=t.implicitCoordinates;this._implicitTileset=a,this._implicitCoordinates=s,this._implicitSubtree=void 0,this._tileset=e,this._tile=t,this._resource=i,this._readyPromise=defer(),this._metadata=void 0,this.featurePropertiesDirty=!1,this._group=void 0;const c=s.getTemplateValues(),l=a.subtreeUriTemplate.getDerivedResource({templateValues:c});this._url=l.getUrlComponent(!0),initialize$7(this,n,r,o)}function initialize$7(e,t,i,n){let r;n=defaultValue(n,0),defined(i)&&(r=new Uint8Array(i,n));const o=new ImplicitSubtree(e._resource,t,r,e._implicitTileset,e._implicitCoordinates);e._implicitSubtree=o,o.readyPromise.then((function(){expandSubtree(e,o),e._readyPromise.resolve()})).catch((function(t){e._readyPromise.reject(t)}))}function expandSubtree(e,t){const i=e._tile,n=transcodeSubtreeTiles(e,t,i,e._implicitCoordinates.childIndex);i.children.push(n.rootTile);const r=listChildSubtrees(e,t,n.bottomRow);for(let t=0;t<r.length;t++){const i=r[t],n=i.tile,o=makePlaceholderChildSubtree(e,n,i.childIndex);n.children.push(o)}}function listChildSubtrees(e,t,i){const n=[],r=e._implicitTileset.branchingFactor;for(let e=0;e<i.length;e++){const o=i[e];if(defined(o))for(let i=0;i<r;i++){const a=e*r+i;t.childSubtreeIsAvailableAtIndex(a)&&n.push({tile:o,childIndex:i})}}return n}function transcodeSubtreeTiles(e,t,i,n){const r=deriveChildTile(e,t,i,n,0,!0);let o=[r],a=[];const s=e._implicitTileset;for(let i=1;i<s.subtreeLevels;i++){const n=t.getLevelOffset(i),r=s.branchingFactor*o.length;for(let i=0;i<r;i++){const r=n+i;if(!t.tileIsAvailableAtIndex(r)){a.push(void 0);continue}const c=o[t.getParentMortonIndex(i)],l=deriveChildTile(e,t,c,i%s.branchingFactor,r);c.children.push(l),a.push(l)}o=a,a=[]}return{rootTile:r,bottomRow:o}}function getGeometricError$3(e,t,i){const n=MetadataSemantic$1.TILE_GEOMETRIC_ERROR;return defined(e)&&e.hasPropertyBySemantic(n)?e.getPropertyBySemantic(n):t.geometricError/Math.pow(2,i.level)}function deriveChildTile(e,t,i,n,r,o){const a=e._implicitTileset;let s,c,l,u;if(s=defaultValue(o,!1)?i.implicitCoordinates:i.implicitCoordinates.getChildCoordinates(n),defined(t.tilePropertyTableJson)){c=t.getTileMetadataView(s);const e=parseBoundingVolumeSemantics(c);l=e.tile,u=e.content}const d=t.contentPropertyTableJsons.length;let h=!1;for(let e=0;e<d;e++)if(t.contentIsAvailableAtCoordinates(s,e)){h=!0;break}const p=getTileBoundingVolume(a,s,n,o,i,l),f=[];for(let e=0;e<a.contentCount;e++){if(!t.contentIsAvailableAtIndex(r,e))continue;const i={uri:a.contentUriTemplates[e].getDerivedResource({templateValues:s.getTemplateValues()}).url},n=getContentBoundingVolume$1(p,u);defined(n)&&(i.boundingVolume=n),f.push(combine$2(i,a.contentHeaders[e]))}const m={boundingVolume:p,geometricError:getGeometricError$3(c,a,s),refine:a.refine,contents:f},g=clone$1(a.tileHeader,true);delete g.boundingVolume,delete g.transform;const _=combine$2(m,g,true),y=makeTile$1(e,a.baseResource,_,i);return y.implicitCoordinates=s,y.implicitSubtree=t,y.metadata=c,y.hasImplicitContentMetadata=h,y}function canUpdateHeights(e,t){return defined(e)&&defined(t)&&(defined(t.minimumHeight)||defined(t.maximumHeight))&&(hasExtension(e,"3DTILES_bounding_volume_S2")||defined(e.region))}function updateHeights$2(e,t){defined(t)&&(hasExtension(e,"3DTILES_bounding_volume_S2")?updateS2CellHeights(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):defined(e.region)&&updateRegionHeights(e.region,t.minimumHeight,t.maximumHeight))}function updateRegionHeights(e,t,i){defined(t)&&(e[4]=t),defined(i)&&(e[5]=i)}function updateS2CellHeights(e,t,i){defined(t)&&(e.minimumHeight=t),defined(i)&&(e.maximumHeight=i)}function getTileBoundingVolume(e,t,i,n,r,o){let a;return a=!defined(o)||!defined(o.boundingVolume)||!canUpdateHeights(o.boundingVolume,o)&&canUpdateHeights(e.boundingVolume,o)?deriveBoundingVolume(e,t,i,defaultValue(n,!1),r):o.boundingVolume,updateHeights$2(a,o),a}function getContentBoundingVolume$1(e,t){let i;return defined(t)&&(i=t.boundingVolume),canUpdateHeights(i,t)?updateHeights$2(i,t):canUpdateHeights(e,t)&&(i=clone$1(e,!0),updateHeights$2(i,t)),i}function deriveBoundingVolume(e,t,i,n,r){const o=e.boundingVolume;if(hasExtension(o,"3DTILES_bounding_volume_S2"))return deriveBoundingVolumeS2(n,r,i,t.level,t.x,t.y,t.z);if(defined(o.region)){return{region:deriveBoundingRegion(o.region,t.level,t.x,t.y,t.z)}}return{box:deriveBoundingBox(o.box,t.level,t.x,t.y,t.z)}}function deriveBoundingVolumeS2(e,t,i,n,r,o,a){const s=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:S2Cell.getTokenFromId(s.s2Cell._cellId),minimumHeight:s.minimumHeight,maximumHeight:s.maximumHeight}}};const c=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),l=c%2==0?HilbertOrder.encode2D(n,r,o):HilbertOrder.encode2D(n,o,r),u=S2Cell.fromFacePositionLevel(c,BigInt(l),n);let d,h;if(defined(a)){const e=(s.maximumHeight+s.minimumHeight)/2;d=i<4?s.minimumHeight:e,h=i<4?e:s.maximumHeight}else d=s.minimumHeight,h=s.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:S2Cell.getTokenFromId(u._cellId),minimumHeight:d,maximumHeight:h}}}}Object.defineProperties(Implicit3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},metadata:{get:function(){},set:function(){}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e}}});const scratchScaleFactors=new Cartesian3,scratchRootCenter=new Cartesian3,scratchCenter$5=new Cartesian3,scratchHalfAxes$1=new Matrix3;function deriveBoundingBox(e,t,i,n,r){if(0===t)return e;const o=Cartesian3.unpack(e,0,scratchRootCenter),a=Matrix3.unpack(e,3,scratchHalfAxes$1),s=Math.pow(2,-t),c=(2*i+1)*s-1,l=(2*n+1)*s-1;let u=0;const d=Cartesian3.fromElements(s,s,1,scratchScaleFactors);defined(r)&&(u=(2*r+1)*s-1,d.z=s);let h=Cartesian3.fromElements(c,l,u,scratchCenter$5);h=Matrix3.multiplyByVector(a,h,scratchCenter$5),h=Cartesian3.add(h,o,scratchCenter$5);let p=Matrix3.clone(a);p=Matrix3.multiplyByScale(p,d,p);const f=new Array(12);return Cartesian3.pack(h,f),Matrix3.pack(p,f,3),f}const scratchRectangle$6=new Rectangle;function deriveBoundingRegion(e,t,i,n,r){if(0===t)return e.slice();const o=Rectangle.unpack(e,0,scratchRectangle$6),a=e[4],s=e[5],c=Math.pow(2,-t),l=c*o.width,u=CesiumMath.negativePiToPi(o.west+i*l),d=CesiumMath.negativePiToPi(u+l),h=c*o.height,p=CesiumMath.negativePiToPi(o.south+n*h),f=CesiumMath.negativePiToPi(p+h);let m=a,g=s;if(defined(r)){const e=c*(s-a);m+=r*e,g=m+e}return[u,p,d,f,m,g]}function makePlaceholderChildSubtree(e,t,i){const n=e._implicitTileset,r=t.implicitCoordinates.getChildCoordinates(i),o=deriveBoundingVolume(n,r,i,!1,t),a=getGeometricError$3(void 0,n,r),s=n.subtreeUriTemplate.getDerivedResource({templateValues:r.getTemplateValues()}).url,c={boundingVolume:o,geometricError:a,refine:n.refine,contents:[{uri:s}]},l=makeTile$1(e,n.baseResource,c,t);return l.implicitTileset=n,l.implicitCoordinates=r,l}function makeTile$1(e,t,i,n){return new(0,e._tile.constructor)(e._tileset,t,i,n)}Implicit3DTileContent.prototype.hasProperty=function(e,t){return!1},Implicit3DTileContent.prototype.getFeature=function(e){},Implicit3DTileContent.prototype.applyDebugSettings=function(e,t){},Implicit3DTileContent.prototype.applyStyle=function(e){},Implicit3DTileContent.prototype.update=function(e,t){},Implicit3DTileContent.prototype.isDestroyed=function(){return!1},Implicit3DTileContent.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),destroyObject(this)},Implicit3DTileContent._deriveBoundingBox=deriveBoundingBox,Implicit3DTileContent._deriveBoundingRegion=deriveBoundingRegion,Implicit3DTileContent._deriveBoundingVolumeS2=deriveBoundingVolumeS2;const I3dmParser={};I3dmParser._deprecationWarning=deprecationWarning;const sizeOfUint32$2=Uint32Array.BYTES_PER_ELEMENT;function ModelInstance(e,t,i,n){this.primitive=e,this._modelMatrix=Matrix4.clone(t),this._instanceId=i,this._modelId=n}I3dmParser.parse=function(e,t){const i=defaultValue(t,0);t=i;const n=new Uint8Array(e),r=new DataView(e);t+=sizeOfUint32$2;const o=r.getUint32(t,!0);if(1!==o)throw new RuntimeError(`Only Instanced 3D Model version 1 is supported. Version ${o} is not.`);t+=sizeOfUint32$2;const a=r.getUint32(t,!0);t+=sizeOfUint32$2;const s=r.getUint32(t,!0);if(0===s)throw new RuntimeError("featureTableJsonByteLength is zero, the feature table must be defined.");t+=sizeOfUint32$2;const c=r.getUint32(t,!0);t+=sizeOfUint32$2;const l=r.getUint32(t,!0);t+=sizeOfUint32$2;const u=r.getUint32(t,!0);t+=sizeOfUint32$2;const d=r.getUint32(t,!0);if(1!==d&&0!==d)throw new RuntimeError(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${d} is not.`);const h=getJsonFromTypedArray(n,t+=sizeOfUint32$2,s);t+=s;const p=new Uint8Array(e,t,c);let f,m;t+=c,l>0&&(f=getJsonFromTypedArray(n,t,l),t+=l,u>0&&(m=new Uint8Array(e,t,u),m=new Uint8Array(m),t+=u));const g=i+a-t;if(0===g)throw new RuntimeError("glTF byte length must be greater than 0.");let _;return t%4==0?_=new Uint8Array(e,t,g):(I3dmParser._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),_=new Uint8Array(n.subarray(t,t+g))),{gltfFormat:d,featureTableJson:h,featureTableBinary:p,batchTableJson:f,batchTableBinary:m,gltf:_}},Object.defineProperties(ModelInstance.prototype,{instanceId:{get:function(){return this._instanceId}},model:{get:function(){return this.primitive._model}},modelMatrix:{get:function(){return Matrix4.clone(this._modelMatrix)},set:function(e){Matrix4.clone(e,this._modelMatrix),this.primitive.expandBoundingSphere(this._modelMatrix),this.primitive._dirty=!0}}});const LoadState={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3};function ModelInstanceCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this._instancingSupported=!1,this._dynamic=defaultValue(e.dynamic,!1),this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=defer(),this._state=LoadState.NEEDS_LOAD,this._dirty=!1,this._cull=defaultValue(e.cull,!0),this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._instances=createInstances$1(this,e.instances),this._batchTable=e.batchTable,this._model=void 0,this._vertexBufferTypedArray=void 0,this._vertexBuffer=void 0,this._batchIdBuffer=void 0,this._instancedUniformsByProgram=void 0,this._drawCommands=[],this._modelCommands=void 0,this._renderStates=void 0,this._disableCullingRenderStates=void 0,this._boundingSphere=createBoundingSphere(this),this._center=Cartesian3.clone(this._boundingSphere.center),this._rtcTransform=new Matrix4,this._rtcModelView=new Matrix4,this._mode=void 0,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._url=Resource.createIfNeeded(e.url),this._requestType=e.requestType,this._gltf=e.gltf,this._basePath=Resource.createIfNeeded(e.basePath),this._asynchronous=e.asynchronous,this._incrementallyLoadTextures=e.incrementallyLoadTextures,this._upAxis=e.upAxis,this._forwardAxis=e.forwardAxis,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this._pickIdLoaded=e.pickIdLoaded,this.splitDirection=defaultValue(e.splitDirection,SplitDirection$1.NONE),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,defined(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):(this._imageBasedLighting=new ImageBasedLighting({imageBasedLightingFactor:e.imageBasedLightingFactor,luminanceAtZenith:e.luminanceAtZenith,sphericalHarmonicCoefficients:e.sphericalHarmonicCoefficients,specularEnvironmentMaps:e.specularEnvironmentMaps}),this._shouldDestroyImageBasedLighting=!0),this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this._backFaceCulling=this.backFaceCulling,this.showCreditsOnScreen=defaultValue(e.showCreditsOnScreen,!1),this._color=defaultValue(e.color,Cesium.Color.WHITE),this._id=defaultValue(e.id,null)}function createInstances$1(e,t){const i=(t=defaultValue(t,[])).length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],o=i.modelMatrix,a=defaultValue(i.batchId,r),s=defaultValue(i.modelId);n[r]=new ModelInstance(e,o,a,s)}return n}function createBoundingSphere(e){const t=e.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=Matrix4.getTranslation(e._instances[n]._modelMatrix,new Cartesian3);return BoundingSphere.fromPoints(i)}Object.defineProperties(ModelInstanceCollection.prototype,{allowPicking:{get:function(){return this._allowPicking}},length:{get:function(){return this._instances.length}},activeAnimations:{get:function(){return this._model.activeAnimations}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},imageBasedLightingFactor:{get:function(){return this._imageBasedLighting.imageBasedLightingFactor},set:function(e){this._imageBasedLighting.imageBasedLightingFactor=e}},luminanceAtZenith:{get:function(){return this._imageBasedLighting.luminanceAtZenith},set:function(e){this._imageBasedLighting.luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._imageBasedLighting.sphericalHarmonicCoefficients},set:function(e){this._imageBasedLighting.sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._imageBasedLighting.specularEnvironmentMaps},set:function(e){this._imageBasedLighting.specularEnvironmentMaps=e}}});const scratchCartesian$7=new Cartesian3,scratchMatrix$3=new Matrix4;function getCheckUniformSemanticFunction(e,t,i,n){return function(r,o){const a=r.semantic;if(defined(a)&&e.indexOf(a)>-1){if(!(t.indexOf(a)>-1))throw new RuntimeError(`Shader program cannot be optimized for instancing. Uniform "${o}" in program "${i}" uses unsupported semantic "${a}"`);n[o]=a}}}function getInstancedUniforms(e,t){if(defined(e._instancedUniformsByProgram))return e._instancedUniformsByProgram[t];const i={};e._instancedUniformsByProgram=i;const n=["MODEL","MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELINVERSE","MODELVIEWINVERSE","MODELVIEWPROJECTIONINVERSE","MODELINVERSETRANSPOSE","MODELVIEWINVERSETRANSPOSE"],r=["MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELVIEWINVERSETRANSPOSE"],o=e._model._sourceTechniques;for(const e in o)if(o.hasOwnProperty(e)){const a=o[e],s=a.program;if(!defined(i[s])){const e={};i[s]=e,ForEach.techniqueUniform(a,getCheckUniformSemanticFunction(n,r,t,e))}}return i[t]}function getVertexShaderCallback(e){return function(t,i){const n=getInstancedUniforms(e,i),r=defined(e._batchTable);let o=ShaderSource.replaceMain(t,"czm_instancing_main"),a="",s="";for(const e in n)if(n.hasOwnProperty(e)){const t=n[e];let i;"MODELVIEW"===t||"CESIUM_RTC_MODELVIEW"===t?i="czm_instanced_modelView":"MODELVIEWPROJECTION"===t?(i="czm_instanced_modelViewProjection",a+="mat4 czm_instanced_modelViewProjection;\n",s+="czm_instanced_modelViewProjection = czm_projection * czm_instanced_modelView;\n"):"MODELVIEWINVERSETRANSPOSE"===t&&(i="czm_instanced_modelViewInverseTranspose",a+="mat3 czm_instanced_modelViewInverseTranspose;\n",s+="czm_instanced_modelViewInverseTranspose = mat3(czm_instanced_modelView);\n");let r=new RegExp(`uniform.*${e}.*`);o=o.replace(r,""),r=new RegExp(`${e}\\b`,"g"),o=o.replace(r,i)}let c,l,u;r?(c="attribute float a_batchId;\n",l="",u=""):(c="",l="attribute vec4 pickColor;\nvarying vec4 v_pickColor;\n",u=" v_pickColor = pickColor;\n");let d="uniform mat4 czm_instanced_modifiedModelView;\nuniform mat4 czm_instanced_nodeTransform;\n"+a+"mat4 czm_instanced_modelView;\nattribute vec4 czm_modelMatrixRow0;\nattribute vec4 czm_modelMatrixRow1;\n"+`attribute vec4 czm_modelMatrixRow2;\n${c}${l}${o}void main()\n{\n mat4 czm_instanced_model = mat4(czm_modelMatrixRow0.x, czm_modelMatrixRow1.x, czm_modelMatrixRow2.x, 0.0, czm_modelMatrixRow0.y, czm_modelMatrixRow1.y, czm_modelMatrixRow2.y, 0.0, czm_modelMatrixRow0.z, czm_modelMatrixRow1.z, czm_modelMatrixRow2.z, 0.0, czm_modelMatrixRow0.w, czm_modelMatrixRow1.w, czm_modelMatrixRow2.w, 1.0);\n`+` czm_instanced_modelView = czm_instanced_modifiedModelView * czm_instanced_model * czm_instanced_nodeTransform;\n${s} czm_instancing_main();\n${u}}\n`;if(r){const t=e._model.gltf,n=ModelUtility.getDiffuseAttributeOrUniform(t,i);d=e._batchTable.getVertexShaderCallback(!0,"a_batchId",n)(d)}return d}}function getFragmentShaderCallback(e){return function(t,i){const n=e._batchTable;if(defined(n)){const r=e._model.gltf,o=ModelUtility.getDiffuseAttributeOrUniform(r,i);t=n.getFragmentShaderCallback(!0,o,!1)(t)}else t=`varying vec4 v_pickColor;\n${t}`;return t}}function createModifiedModelView(e,t){return function(){return Matrix4.multiply(t.uniformState.view,e._rtcTransform,e._rtcModelView)}}function createNodeTransformFunction(e){return function(){return e.computedMatrix}}function getUniformMapCallback(e,t){return function(i,n,r){(i=clone$1(i)).czm_instanced_modifiedModelView=createModifiedModelView(e,t),i.czm_instanced_nodeTransform=createNodeTransformFunction(r);const o=getInstancedUniforms(e,n);for(const e in o)o.hasOwnProperty(e)&&delete i[e];return defined(e._batchTable)&&(i=e._batchTable.getUniformMapCallback()(i)),i}}function getVertexShaderNonInstancedCallback(e){return function(t,i){if(defined(e._batchTable)){const n=e._model.gltf,r=ModelUtility.getDiffuseAttributeOrUniform(n,i);t=`uniform float a_batchId\n;${t=e._batchTable.getVertexShaderCallback(!0,"a_batchId",r)(t)}`}return t}}function getFragmentShaderNonInstancedCallback(e){return function(t,i){const n=e._batchTable;if(defined(n)){const r=e._model.gltf,o=ModelUtility.getDiffuseAttributeOrUniform(r,i);t=n.getFragmentShaderCallback(!0,o,!1)(t)}else t=`uniform vec4 czm_pickColor;\n${t}`;return t}}function getUniformMapNonInstancedCallback(e){return function(t){return defined(e._batchTable)&&(t=e._batchTable.getUniformMapCallback()(t)),t}}function getVertexBufferTypedArray(e){const t=e._instances,i=e.length,n=e._center;let r=e._vertexBufferTypedArray;defined(r)||(r=new Float32Array(12*i)),e._dynamic&&(e._vertexBufferTypedArray=r);for(let e=0;e<i;++e){const i=t[e]._modelMatrix,o=Matrix4.clone(i,scratchMatrix$3);o[12]-=n.x,o[13]-=n.y,o[14]-=n.z;const a=12*e;r[a+0]=o[0],r[a+1]=o[4],r[a+2]=o[8],r[a+3]=o[12],r[a+4]=o[1],r[a+5]=o[5],r[a+6]=o[9],r[a+7]=o[13],r[a+8]=o[2],r[a+9]=o[6],r[a+10]=o[10],r[a+11]=o[14]}return r}function createVertexBuffer(e,t){let i;const n=e._instances,r=e.length,o=e._dynamic,a=defined(e._batchTable);if(a){const o=new Uint16Array(r);for(i=0;i<r;++i)o[i]=n[i]._instanceId;e._batchIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW})}if(!a){const n=new Uint8Array(4*r);for(i=0;i<r;++i){const t=e._pickIds[i].color,r=4*i;n[r]=Color.floatToByte(t.red),n[r+1]=Color.floatToByte(t.green),n[r+2]=Color.floatToByte(t.blue),n[r+3]=Color.floatToByte(t.alpha)}e._pickIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:n,usage:BufferUsage$1.STATIC_DRAW})}const s=getVertexBufferTypedArray(e);e._vertexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:s,usage:o?BufferUsage$1.STREAM_DRAW:BufferUsage$1.STATIC_DRAW})}function updateVertexBuffer(e){const t=getVertexBufferTypedArray(e);e._vertexBuffer.copyFromArrayView(t)}function createPickIds(e,t){const i=e._instances,n=i.length,r=new Array(n);for(let e=0;e<n;++e)r[e]=t.createPickId(i[e]);return r}function createModel$1(e,t){const i=e._instancingSupported,n=defined(e._batchTable),r=e._allowPicking,o={url:e._url,requestType:e._requestType,gltf:e._gltf,basePath:e._basePath,shadows:e._shadows,cacheKey:void 0,asynchronous:e._asynchronous,allowPicking:r,incrementallyLoadTextures:e._incrementallyLoadTextures,upAxis:e._upAxis,forwardAxis:e._forwardAxis,precreatedAttributes:void 0,vertexShaderLoaded:void 0,fragmentShaderLoaded:void 0,uniformMapLoaded:void 0,pickIdLoaded:e._pickIdLoaded,ignoreCommands:!0,opaquePass:e._opaquePass,imageBasedLighting:e._imageBasedLighting,showOutline:e.showOutline,showCreditsOnScreen:e.showCreditsOnScreen,id:e._id,color:e._color};if(n||(e._pickIds=createPickIds(e,t)),i){createVertexBuffer(e,t);const i=12,r=ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),a={czm_modelMatrixRow0:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:r*i,instanceDivisor:1},czm_modelMatrixRow1:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:4*r,strideInBytes:r*i,instanceDivisor:1},czm_modelMatrixRow2:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:8*r,strideInBytes:r*i,instanceDivisor:1}};n&&(a.a_batchId={index:0,vertexBuffer:e._batchIdBuffer,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),n||(a.pickColor={index:0,vertexBuffer:e._pickIdBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),o.precreatedAttributes=a,o.vertexShaderLoaded=getVertexShaderCallback(e),o.fragmentShaderLoaded=getFragmentShaderCallback(e),o.uniformMapLoaded=getUniformMapCallback(e,t),defined(e._url)&&(o.cacheKey=`${e._url.getUrlComponent()}#instanced`)}else o.vertexShaderLoaded=getVertexShaderNonInstancedCallback(e),o.fragmentShaderLoaded=getFragmentShaderNonInstancedCallback(e),o.uniformMapLoaded=getUniformMapNonInstancedCallback(e);defined(e._url)?e._model=Model.fromGltf(o):e._model=new Model(o)}function updateWireframe(e,t){if(e._debugWireframe!==e.debugWireframe||t){e._debugWireframe=e.debugWireframe;const t=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,i=e._drawCommands,n=i.length;for(let e=0;e<n;++e)i[e].primitiveType=t}}function getDisableCullingRenderState(e){const t=clone$1(e,!0);return t.cull.enabled=!1,RenderState.fromCache(t)}function updateBackFaceCulling(e,t){if(e._backFaceCulling!==e.backFaceCulling||t){e._backFaceCulling=e.backFaceCulling;const t=e._drawCommands,i=t.length;let n;if(!defined(e._disableCullingRenderStates))for(e._disableCullingRenderStates=new Array(i),e._renderStates=new Array(i),n=0;n<i;++n){const i=t[n].renderState,r=getDisableCullingRenderState(i);e._disableCullingRenderStates[n]=r,e._renderStates[n]=i}for(n=0;n<i;++n)t[n].renderState=e._backFaceCulling?e._renderStates[n]:e._disableCullingRenderStates[n]}}function updateShowBoundingVolume$1(e,t){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume||t){e._debugShowBoundingVolume=e.debugShowBoundingVolume;const t=e._drawCommands,i=t.length;for(let n=0;n<i;++n)t[n].debugShowBoundingVolume=e.debugShowBoundingVolume}}function createCommands$2(e,t){const i=t.length,n=e.length,r=e._boundingSphere,o=e._cull;for(let a=0;a<i;++a){const i=DrawCommand.shallowClone(t[a]);i.instanceCount=n,i.boundingVolume=r,i.cull=o,defined(e._batchTable)?i.pickId=e._batchTable.getPickId():i.pickId="v_pickColor",e._drawCommands.push(i)}}function createBatchIdFunction(e){return function(){return e}}function createPickColorFunction(e){return function(){return e}}function createCommandsNonInstanced(e,t){const i=e._instances,n=t.length,r=e.length,o=defined(e._batchTable),a=e._cull;for(let s=0;s<n;++s)for(let n=0;n<r;++n){const r=DrawCommand.shallowClone(t[s]);if(r.modelMatrix=new Matrix4,r.boundingVolume=new BoundingSphere,r.cull=a,r.uniformMap=clone$1(r.uniformMap),o)r.uniformMap.a_batchId=createBatchIdFunction(i[n]._instanceId);else{const t=e._pickIds[n];r.uniformMap.czm_pickColor=createPickColorFunction(t.color)}e._drawCommands.push(r)}}function updateCommandsNonInstanced(e){const t=e._modelCommands,i=t.length,n=e.length,r=e._rtcTransform,o=e._center;for(let a=0;a<i;++a){const i=t[a];for(let t=0;t<n;++t){const s=a*n+t,c=e._drawCommands[s];let l=Matrix4.clone(e._instances[t]._modelMatrix,scratchMatrix$3);l[12]-=o.x,l[13]-=o.y,l[14]-=o.z,l=Matrix4.multiply(r,l,scratchMatrix$3);const u=i.modelMatrix,d=c.modelMatrix;Matrix4.multiply(l,u,d);const h=i.boundingVolume,p=c.boundingVolume;BoundingSphere.transform(h,l,p)}}}function getModelCommands(e){const t=e._nodeCommands,i=t.length,n=[];for(let e=0;e<i;++e){const i=t[e];i.show&&n.push(i.command)}return n}function commandsDirty(e){const t=e._nodeCommands,i=t.length;let n=!1;for(let e=0;e<i;e++){const i=t[e];i.command.dirty&&(i.command.dirty=!1,n=!0)}return n}function generateModelCommands(e,t){e._drawCommands=[];const i=getModelCommands(e._model);t?createCommands$2(e,i):(createCommandsNonInstanced(e,i),updateCommandsNonInstanced(e))}function updateShadows(e,t){if(e.shadows!==e._shadows||t){e._shadows=e.shadows;const t=ShadowMode$1.castShadows(e.shadows),i=ShadowMode$1.receiveShadows(e.shadows),n=e._drawCommands,r=n.length;for(let e=0;e<r;++e){const r=n[e];r.castShadows=t,r.receiveShadows=i}}}function Instanced3DModel3DTileContent(e,t,i,n,r){this._tileset=e,this._tile=t,this._resource=i,this._modelInstanceCollection=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,initialize$6(this,n,r)}function getPickIdCallback(e){return function(){return e._batchTable.getPickId()}}ModelInstanceCollection.prototype.expandBoundingSphere=function(e){const t=Matrix4.getTranslation(e,scratchCartesian$7);BoundingSphere.expand(this._boundingSphere,t,this._boundingSphere)},ModelInstanceCollection.prototype.update=function(e){if(e.mode===SceneMode$1.MORPHING)return;if(!this.show)return;if(0===this.length)return;const t=e.context;if(this._state===LoadState.NEEDS_LOAD){this._state=LoadState.LOADING,this._instancingSupported=t.instancedArrays,createModel$1(this,t);const e=this;this._model.readyPromise.catch((function(t){e._state=LoadState.FAILED,e._readyPromise.reject(t)}))}const i=this._instancingSupported,n=this._model;if(n.imageBasedLighting=this._imageBasedLighting,n.showCreditsOnScreen=this.showCreditsOnScreen,n.splitDirection=this.splitDirection,n.update(e),n.ready&&this._state===LoadState.LOADING){this._state=LoadState.LOADED,this._ready=!0;const e=n.boundingSphere.radius+Cartesian3.magnitude(n.boundingSphere.center);return this._boundingSphere.radius+=e,this._modelCommands=getModelCommands(n),generateModelCommands(this,i),void this._readyPromise.resolve(this)}if(this._state!==LoadState.LOADED)return;const r=e.mode!==this._mode,o=this.modelMatrix,a=!Matrix4.equals(this._modelMatrix,o);if(r||a){this._mode=e.mode,Matrix4.clone(o,this._modelMatrix);let t=Matrix4.multiplyByTranslation(this._modelMatrix,this._center,this._rtcTransform);this._mode!==SceneMode$1.SCENE3D&&(t=Transforms.basisTo2D(e.mapProjection,t,t)),Matrix4.getTranslation(t,this._boundingSphere.center)}i&&this._dirty&&(this._dynamic=!0,this._dirty=!1,updateVertexBuffer(this));const s=commandsDirty(n);s&&generateModelCommands(this,i),!i&&(n.dirty||this._dirty||r||a)&&updateCommandsNonInstanced(this),updateShadows(this,s),updateWireframe(this,s),updateBackFaceCulling(this,s),updateShowBoundingVolume$1(this,s);const c=e.passes;if(!c.render&&!c.pick)return;const l=e.commandList,u=this._drawCommands,d=u.length;for(let e=0;e<d;++e)l.push(u[e])},ModelInstanceCollection.prototype.isDestroyed=function(){return!1},ModelInstanceCollection.prototype.destroy=function(){this._model=this._model&&this._model.destroy();const e=this._pickIds;if(defined(e)){const t=e.length;for(let i=0;i<t;++i)e[i].destroy()}return this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,destroyObject(this)},Instanced3DModel3DTileContent._deprecationWarning=deprecationWarning,Object.defineProperties(Instanced3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this._batchTable.featuresLength}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){const e=this._modelInstanceCollection._model;return defined(e)?e.trianglesLength:0}},geometryByteLength:{get:function(){const e=this._modelInstanceCollection._model;return defined(e)?e.geometryByteLength:0}},texturesByteLength:{get:function(){const e=this._modelInstanceCollection._model;return defined(e)?e.texturesByteLength:0}},batchTableByteLength:{get:function(){return this._batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._modelInstanceCollection.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});const propertyScratch1$1=new Array(4),propertyScratch2$1=new Array(4);function initialize$6(e,t,i){const n=I3dmParser.parse(t,i),r=n.gltfFormat,o=n.gltf,a=n.featureTableJson,s=n.featureTableBinary,c=n.batchTableJson,l=n.batchTableBinary,u=new Cesium3DTileFeatureTable(a,s),d=u.getGlobalProperty("INSTANCES_LENGTH");if(u.featuresLength=d,!defined(d))throw new RuntimeError("Feature table global property: INSTANCES_LENGTH must be defined");e._batchTable=new Cesium3DTileBatchTable(e,d,c,l);const h=e._tileset,p={instances:new Array(d),batchTable:e._batchTable,cull:!1,url:void 0,requestType:RequestType$1.TILES3D,gltf:void 0,basePath:void 0,incrementallyLoadTextures:!1,upAxis:h._gltfUpAxis,forwardAxis:Axis$1.X,opaquePass:Pass$1.CESIUM_3D_TILE,pickIdLoaded:getPickIdCallback(e),imageBasedLighting:h.imageBasedLighting,specularEnvironmentMaps:h.specularEnvironmentMaps,backFaceCulling:h.backFaceCulling,showOutline:h.showOutline,showCreditsOnScreen:h.showCreditsOnScreen};if(0===r){let t=getStringFromTypedArray(o);t=t.replace(/[\s\0]+$/,""),p.url=e._resource.getDerivedResource({url:t})}else p.gltf=o,p.basePath=e._resource.clone();const f=u.getGlobalProperty("EAST_NORTH_UP");let m;const g=u.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(g)&&(m=Cartesian3.unpack(g));const _=p.instances,y=new Cartesian3,C=new Array(3),T=new Cartesian3,S=new Cartesian3,v=new Cartesian3,A=new Matrix3,E=new Quaternion;let b=new Cartesian3;const x=new TranslationRotationScale,P=new Matrix4;for(let e=0;e<d;e++){let t=u.getProperty("POSITION",ComponentDatatype$1.FLOAT,3,e,propertyScratch1$1);if(!defined(t)){t=C;const i=u.getProperty("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3,e,propertyScratch1$1);if(!defined(i))throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined for each instance.");const n=u.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(n))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const r=u.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(r))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(let e=0;e<3;e++)t[e]=i[e]/65535*r[e]+n[e]}Cartesian3.unpack(t,0,y),defined(m)&&Cartesian3.add(y,m,y),x.translation=y;const i=u.getProperty("NORMAL_UP",ComponentDatatype$1.FLOAT,3,e,propertyScratch1$1),n=u.getProperty("NORMAL_RIGHT",ComponentDatatype$1.FLOAT,3,e,propertyScratch2$1);let r=!1;if(defined(i)){if(!defined(n))throw new RuntimeError("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");Cartesian3.unpack(i,0,S),Cartesian3.unpack(n,0,T),r=!0}else{const t=u.getProperty("NORMAL_UP_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,e,propertyScratch1$1),i=u.getProperty("NORMAL_RIGHT_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,e,propertyScratch2$1);if(defined(t)){if(!defined(i))throw new RuntimeError("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");AttributeCompression.octDecodeInRange(t[0],t[1],65535,S),AttributeCompression.octDecodeInRange(i[0],i[1],65535,T),r=!0}else f?(Transforms.eastNorthUpToFixedFrame(y,Ellipsoid.WGS84,P),Matrix4.getMatrix3(P,A)):Matrix3.clone(Matrix3.IDENTITY,A)}r&&(Cartesian3.cross(T,S,v),Cartesian3.normalize(v,v),Matrix3.setColumn(A,0,T,A),Matrix3.setColumn(A,1,S,A),Matrix3.setColumn(A,2,v,A)),Quaternion.fromRotationMatrix(A,E),x.rotation=E,b=Cartesian3.fromElements(1,1,1,b);const o=u.getProperty("SCALE",ComponentDatatype$1.FLOAT,1,e);defined(o)&&Cartesian3.multiplyByScalar(b,o,b);const a=u.getProperty("SCALE_NON_UNIFORM",ComponentDatatype$1.FLOAT,3,e,propertyScratch1$1);defined(a)&&(b.x*=a[0],b.y*=a[1],b.z*=a[2]),x.scale=b;let s=u.getProperty("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1,e);defined(s)||(s=e),Matrix4.fromTranslationRotationScale(x,P);const c=P.clone();_[e]={modelMatrix:c,batchId:s}}e._modelInstanceCollection=new ModelInstanceCollection(p),e._modelInstanceCollection.readyPromise.catch((function(){})).then((function(t){e._modelInstanceCollection.ready&&t.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})}))}function createFeatures$2(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const i=new Array(t);for(let n=0;n<t;++n)i[n]=new Cesium3DTileFeature(e,n);e._features=i}}Instanced3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Instanced3DModel3DTileContent.prototype.getFeature=function(e){return this.featuresLength,createFeatures$2(this),this._features[e]},Instanced3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,this._batchTable.setAllColor(t)},Instanced3DModel3DTileContent.prototype.applyStyle=function(e){this._batchTable.applyStyle(e)},Instanced3DModel3DTileContent.prototype.update=function(e,t){const i=t.commandList.length;this._batchTable.update(e,t),this._modelInstanceCollection.modelMatrix=this._tile.computedTransform,this._modelInstanceCollection.shadows=this._tileset.shadows,this._modelInstanceCollection.lightColor=this._tileset.lightColor,this._modelInstanceCollection.imageBasedLighting=this._tileset.imageBasedLighting,this._modelInstanceCollection.backFaceCulling=this._tileset.backFaceCulling,this._modelInstanceCollection.debugWireframe=this._tileset.debugWireframe,this._modelInstanceCollection.showCreditsOnScreen=this._tileset.showCreditsOnScreen,this._modelInstanceCollection.splitDirection=this._tileset.splitDirection;const n=this._modelInstanceCollection._model;if(defined(n)){const e=this._tileset.clippingPlanes;n.referenceMatrix=this._tileset.clippingPlanesOriginMatrix,defined(e)&&this._tile.clippingPlanesDirty&&(n._clippingPlanes=e.enabled&&this._tile._isClipped?e:void 0),defined(e)&&defined(n._clippingPlanes)&&n._clippingPlanes!==e&&(n._clippingPlanes=e)}this._modelInstanceCollection.update(t);i<t.commandList.length&&(t.passes.render||t.passes.pick)&&this._batchTable.addDerivedCommands(t,i,!1)},Instanced3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Instanced3DModel3DTileContent.prototype.destroy=function(){return this._modelInstanceCollection=this._modelInstanceCollection&&this._modelInstanceCollection.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};const Cesium3DTileRefine={ADD:0,REPLACE:1};var Cesium3DTileRefine$1=Object.freeze(Cesium3DTileRefine);const VertexAttributeSemantic={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function semanticToVariableName(e){switch(e){case VertexAttributeSemantic.POSITION:return"positionMC";case VertexAttributeSemantic.NORMAL:return"normalMC";case VertexAttributeSemantic.TANGENT:return"tangentMC";case VertexAttributeSemantic.TEXCOORD:return"texCoord";case VertexAttributeSemantic.COLOR:return"color";case VertexAttributeSemantic.JOINTS:return"joints";case VertexAttributeSemantic.WEIGHTS:return"weights";case VertexAttributeSemantic.FEATURE_ID:return"featureId"}}VertexAttributeSemantic.hasSetIndex=function(e){switch(e){case VertexAttributeSemantic.POSITION:case VertexAttributeSemantic.NORMAL:case VertexAttributeSemantic.TANGENT:return!1;case VertexAttributeSemantic.TEXCOORD:case VertexAttributeSemantic.COLOR:case VertexAttributeSemantic.JOINTS:case VertexAttributeSemantic.WEIGHTS:case VertexAttributeSemantic.FEATURE_ID:return!0}},VertexAttributeSemantic.fromGltfSemantic=function(e){let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(null!==i&&(t=i[1]),t){case"POSITION":return VertexAttributeSemantic.POSITION;case"NORMAL":return VertexAttributeSemantic.NORMAL;case"TANGENT":return VertexAttributeSemantic.TANGENT;case"TEXCOORD":return VertexAttributeSemantic.TEXCOORD;case"COLOR":return VertexAttributeSemantic.COLOR;case"JOINTS":return VertexAttributeSemantic.JOINTS;case"WEIGHTS":return VertexAttributeSemantic.WEIGHTS;case"_FEATURE_ID":return VertexAttributeSemantic.FEATURE_ID}},VertexAttributeSemantic.fromPntsSemantic=function(e){switch(e){case"POSITION":case"POSITION_QUANTIZED":return VertexAttributeSemantic.POSITION;case"RGBA":case"RGB":case"RGB565":return VertexAttributeSemantic.COLOR;case"NORMAL":case"NORMAL_OCT16P":return VertexAttributeSemantic.NORMAL;case"BATCH_ID":return VertexAttributeSemantic.FEATURE_ID}},VertexAttributeSemantic.getGlslType=function(e){switch(e){case VertexAttributeSemantic.POSITION:case VertexAttributeSemantic.NORMAL:case VertexAttributeSemantic.TANGENT:return"vec3";case VertexAttributeSemantic.TEXCOORD:return"vec2";case VertexAttributeSemantic.COLOR:return"vec4";case VertexAttributeSemantic.JOINTS:return"ivec4";case VertexAttributeSemantic.WEIGHTS:return"vec4";case VertexAttributeSemantic.FEATURE_ID:return"int"}},VertexAttributeSemantic.getVariableName=function(e,t){let i=semanticToVariableName(e);return defined(t)&&(i+=`_${t}`),i};var VertexAttributeSemantic$1=Object.freeze(VertexAttributeSemantic);const PntsParser={},sizeOfUint32$1=Uint32Array.BYTES_PER_ELEMENT;function parseDracoProperties(e,t){const i=e.json;let n,r,o;const a=defined(i.extensions)?i.extensions["3DTILES_draco_point_compression"]:void 0,s=defined(t)&&defined(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;let c,l,u,d,h,p;if(defined(s)&&(o=s.properties),defined(a)){r=a.properties;const t=a.byteOffset,i=a.byteLength;if(!defined(r)||!defined(t)||!defined(i))throw new RuntimeError("Draco properties, byteOffset, and byteLength must be defined");n=arraySlice(e.buffer,t,t+i),c=defined(r.POSITION),l=defined(r.RGB)||defined(r.RGBA),u=defined(r.NORMAL),d=defined(r.BATCH_ID),h=defined(r.RGBA)}return defined(n)&&(p={buffer:n,featureTableProperties:r,batchTableProperties:o,properties:combine$2(r,o),dequantizeInShader:!0}),{draco:p,hasPositions:c,hasColors:l,isTranslucent:h,hasNormals:u,hasBatchIds:d}}function parsePositions(e){const t=e.json;let i;if(defined(t.POSITION))return i=e.getPropertyArray("POSITION",ComponentDatatype$1.FLOAT,3),{name:VertexAttributeSemantic$1.POSITION,semantic:VertexAttributeSemantic$1.POSITION,typedArray:i,isQuantized:!1,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3};if(defined(t.POSITION_QUANTIZED)){i=e.getPropertyArray("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3);const t=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(t))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const n=65535,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(r))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:VertexAttributeSemantic$1.POSITION,semantic:VertexAttributeSemantic$1.POSITION,typedArray:i,isQuantized:!0,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,quantizedRange:n,quantizedVolumeOffset:Cartesian3.unpack(r),quantizedVolumeScale:Cartesian3.unpack(t),quantizedComponentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,quantizedType:AttributeType$1.VEC3}}}function parseColors(e){const t=e.json;let i;if(defined(t.RGBA))return i=e.getPropertyArray("RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4),{name:VertexAttributeSemantic$1.COLOR,semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:i,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(defined(t.RGB))return i=e.getPropertyArray("RGB",ComponentDatatype$1.UNSIGNED_BYTE,3),{name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:i,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(defined(t.RGB565))return i=e.getPropertyArray("RGB565",ComponentDatatype$1.UNSIGNED_SHORT,1),{name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:i,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(defined(t.CONSTANT_RGBA)){const t=e.getGlobalProperty("CONSTANT_RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4),i=t[3],n=Color.fromBytes(t[0],t[1],t[2],i),r=i<255;return{name:VertexAttributeSemantic$1.COLOR,semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,constantColor:n,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC4,isQuantized:!1,isTranslucent:r}}}function parseNormals(e){const t=e.json;let i;if(defined(t.NORMAL))return i=e.getPropertyArray("NORMAL",ComponentDatatype$1.FLOAT,3),{name:VertexAttributeSemantic$1.NORMAL,semantic:VertexAttributeSemantic$1.NORMAL,typedArray:i,octEncoded:!1,octEncodedZXY:!1,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3};if(defined(t.NORMAL_OCT16P)){i=e.getPropertyArray("NORMAL_OCT16P",ComponentDatatype$1.UNSIGNED_BYTE,2);const t=8;return{name:VertexAttributeSemantic$1.NORMAL,semantic:VertexAttributeSemantic$1.NORMAL,typedArray:i,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<t)-1,quantizedType:AttributeType$1.VEC2,quantizedComponentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3}}}function parseBatchIds(e){if(defined(e.json.BATCH_ID)){const t=e.getPropertyArray("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1);return{name:VertexAttributeSemantic$1.FEATURE_ID,semantic:VertexAttributeSemantic$1.FEATURE_ID,setIndex:0,typedArray:t,componentDatatype:ComponentDatatype$1.fromTypedArray(t),type:AttributeType$1.SCALAR}}}PntsParser.parse=function(e,t){t=defaultValue(t,0);const i=new Uint8Array(e),n=new DataView(e);t+=sizeOfUint32$1;const r=n.getUint32(t,!0);if(1!==r)throw new RuntimeError(`Only Point Cloud tile version 1 is supported. Version ${r} is not.`);t+=sizeOfUint32$1,t+=sizeOfUint32$1;const o=n.getUint32(t,!0);if(0===o)throw new RuntimeError("Feature table must have a byte length greater than zero");t+=sizeOfUint32$1;const a=n.getUint32(t,!0);t+=sizeOfUint32$1;const s=n.getUint32(t,!0);t+=sizeOfUint32$1;const c=n.getUint32(t,!0),l=getJsonFromTypedArray(i,t+=sizeOfUint32$1,o);t+=o;const u=new Uint8Array(e,t,a);let d,h;t+=a,s>0&&(d=getJsonFromTypedArray(i,t,s),t+=s,c>0&&(h=new Uint8Array(e,t,c),t+=c));const p=new Cesium3DTileFeatureTable(l,u),f=p.getGlobalProperty("POINTS_LENGTH");if(p.featuresLength=f,!defined(f))throw new RuntimeError("Feature table global property: POINTS_LENGTH must be defined");let m=p.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(m)&&(m=Cartesian3.unpack(m));const g=parseDracoProperties(p,d);if(g.rtcCenter=m,g.pointsLength=f,!g.hasPositions){const e=parsePositions(p);g.positions=e,g.hasPositions=g.hasPositions||defined(e)}if(!g.hasPositions)throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined.");if(!g.hasNormals){const e=parseNormals(p);g.normals=e,g.hasNormals=g.hasNormals||defined(e)}if(!g.hasColors){const e=parseColors(p);g.colors=e,g.hasColors=g.hasColors||defined(e),g.hasConstantColor=defined(g.constantColor),g.isTranslucent=defined(e)&&e.isTranslucent}if(!g.hasBatchIds){const e=parseBatchIds(p);g.batchIds=e,g.hasBatchIds=g.hasBatchIds||defined(e)}if(g.hasBatchIds){const e=p.getGlobalProperty("BATCH_LENGTH");if(!defined(e))throw new RuntimeError("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");g.batchLength=e}return defined(h)&&(h=new Uint8Array(h),g.batchTableJson=d,g.batchTableBinary=h),g};const DecodingState={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function PointCloud(e){this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=Color.clone(Color.DARKGRAY),this._highlightColor=Color.clone(Color.WHITE),this._pointSize=1,this._rtcCenter=void 0,this._quantizedVolumeScale=void 0,this._quantizedVolumeOffset=void 0,this._styleableShaderAttributes=void 0,this._isQuantized=!1,this._isOctEncoded16P=!1,this._isRGB565=!1,this._hasColors=!1,this._hasNormals=!1,this._hasBatchIds=!1,this._decodingState=DecodingState.READY,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._readyPromise=defer(),this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._cull=defaultValue(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.time=0,this.shadows=ShadowMode$1.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,this.splitDirection=defaultValue(e.splitDirection,SplitDirection$1.NONE),this._splittingEnabled=!1,initialize$5(this,e)}function initialize$5(e,t){const i=PntsParser.parse(t.arrayBuffer,t.byteOffset);if(e._parsedContent=i,e._rtcCenter=i.rtcCenter,e._hasNormals=i.hasNormals,e._hasColors=i.hasColors,e._hasBatchIds=i.hasBatchIds,e._isTranslucent=i.isTranslucent,!i.hasBatchIds&&defined(i.batchTableBinary)&&(i.styleableProperties=Cesium3DTileBatchTable.getBinaryProperties(i.pointsLength,i.batchTableJson,i.batchTableBinary)),defined(i.draco)){const t=i.draco;e._decodingState=DecodingState.NEEDS_DECODE,t.dequantizeInShader=e._dequantizeInShader}const n=i.positions;defined(n)&&(e._isQuantized=n.isQuantized,e._quantizedVolumeScale=n.quantizedVolumeScale,e._quantizedVolumeOffset=n.quantizedVolumeOffset,e._quantizedRange=n.quantizedRange);const r=i.normals;defined(r)&&(e._isOctEncoded16P=r.octEncoded);const o=i.colors;defined(o)&&(defined(o.constantColor)&&(e._constantColor=Color.clone(o.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=o.isRGB565);const a=i.batchIds;defined(i.batchIds)&&(a.name="BATCH_ID",a.semantic="BATCH_ID",a.setIndex=void 0),i.hasBatchIds&&e._batchTableLoaded(i.batchLength,i.batchTableJson,i.batchTableBinary),e._pointsLength=i.pointsLength}Object.defineProperties(PointCloud.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},color:{get:function(){return Color.clone(this._highlightColor)},set:function(e){this._highlightColor=Color.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(defined(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=BoundingSphere.clone(e,this._boundingSphere)}}});const scratchMin$2=new Cartesian3,scratchMax$2=new Cartesian3,scratchPosition$8=new Cartesian3;let randomNumberGenerator$1,randomValues$1;function getRandomValues$1(e){if(!defined(randomValues$1)){randomNumberGenerator$1=new mersenneTwister(0),randomValues$1=new Array(e);for(let t=0;t<e;++t)randomValues$1[t]=randomNumberGenerator$1.random()}return randomValues$1}function computeApproximateBoundingSphereFromPositions(e){const t=e.length/3,i=Math.min(t,20),n=getRandomValues$1(20),r=Number.MAX_VALUE,o=-Number.MAX_VALUE,a=Cartesian3.fromElements(r,r,r,scratchMin$2),s=Cartesian3.fromElements(o,o,o,scratchMax$2);for(let r=0;r<i;++r){const i=Math.floor(n[r]*t),o=Cartesian3.unpack(e,3*i,scratchPosition$8);Cartesian3.minimumByComponent(a,o,a),Cartesian3.maximumByComponent(s,o,s)}const c=BoundingSphere.fromCornerPoints(a,s);return c.radius+=CesiumMath.EPSILON2,c}function prepareVertexAttribute(e,t){const i=ComponentDatatype$1.fromTypedArray(e);return i===ComponentDatatype$1.INT||i===ComponentDatatype$1.UNSIGNED_INT||i===ComponentDatatype$1.DOUBLE?(oneTimeWarning("Cast pnts property to floats",`Point cloud property "${t}" will be casted to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),new Float32Array(e)):e}const scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier=new Cartesian4,scratchQuantizedVolumeScaleAndOctEncodedRange=new Cartesian4,scratchColor$j=new Color,positionLocation=0,colorLocation=1,normalLocation=2,batchIdLocation=3,numberOfAttributes=4,scratchClippingPlanesMatrix$1=new Matrix4,scratchInverseTransposeClippingPlanesMatrix$1=new Matrix4;function createResources$3(e,t){const i=t.context,n=e._parsedContent,r=e._pointsLength,o=n.positions,a=n.colors,s=n.normals;let c=n.batchIds;const l=n.styleableProperties,u=defined(l),d=e._isQuantized,h=e._isQuantizedDraco,p=e._isOctEncoded16P,f=e._isOctEncodedDraco,m=e._quantizedRange,g=e._octEncodedRange,_=e._isRGB565,y=e._isTranslucent,C=e._hasColors,T=e._hasNormals,S=e._hasBatchIds;let v,A;const E=[],b={};if(e._styleableShaderAttributes=b,u){let t=numberOfAttributes;for(const n in l)if(l.hasOwnProperty(n)){const r=l[n],o=prepareVertexAttribute(r.typedArray,n);v=r.componentCount,A=ComponentDatatype$1.fromTypedArray(o);const a=Buffer$1.createVertexBuffer({context:i,typedArray:o,usage:BufferUsage$1.STATIC_DRAW});e._geometryByteLength+=a.sizeInBytes;const s={index:t,vertexBuffer:a,componentsPerAttribute:v,componentDatatype:A,normalize:!1,offsetInBytes:0,strideInBytes:0};E.push(s),b[n]={location:t,componentCount:v},++t}}const x=Buffer$1.createVertexBuffer({context:i,typedArray:o.typedArray,usage:BufferUsage$1.STATIC_DRAW});let P,D,w;e._geometryByteLength+=x.sizeInBytes,C&&(P=Buffer$1.createVertexBuffer({context:i,typedArray:a.typedArray,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=P.sizeInBytes),T&&(D=Buffer$1.createVertexBuffer({context:i,typedArray:s.typedArray,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=D.sizeInBytes),S&&(c=prepareVertexAttribute(c,"batchIds"),w=Buffer$1.createVertexBuffer({context:i,typedArray:c.typedArray,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=w.sizeInBytes);let M=[];if(A=d?ComponentDatatype$1.UNSIGNED_SHORT:h?m<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT:ComponentDatatype$1.FLOAT,M.push({index:positionLocation,vertexBuffer:x,componentsPerAttribute:3,componentDatatype:A,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(e._boundingSphere=d||h?BoundingSphere.fromCornerPoints(Cartesian3.ZERO,e._quantizedVolumeScale):computeApproximateBoundingSphereFromPositions(o.typedArray)),C)if(_)M.push({index:colorLocation,vertexBuffer:P,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const e=y?4:3;M.push({index:colorLocation,vertexBuffer:P,componentsPerAttribute:e,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}T&&(p?(v=2,A=ComponentDatatype$1.UNSIGNED_BYTE):f?(v=2,A=g<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT):(v=3,A=ComponentDatatype$1.FLOAT),M.push({index:normalLocation,vertexBuffer:D,componentsPerAttribute:v,componentDatatype:A,normalize:!1,offsetInBytes:0,strideInBytes:0})),S&&M.push({index:batchIdLocation,vertexBuffer:w,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.fromTypedArray(c.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),u&&(M=M.concat(E));const I=new VertexArray({context:i,attributes:M}),R={depthTest:{enabled:!0}},O={depthTest:{enabled:!0},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND};e._opaquePass===Pass$1.CESIUM_3D_TILE&&(R.stencilTest=StencilConstants$1.setCesium3DTileBit(),R.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,O.stencilTest=StencilConstants$1.setCesium3DTileBit(),O.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),e._opaqueRenderState=RenderState.fromCache(R),e._translucentRenderState=RenderState.fromCache(O),e._drawCommand=new DrawCommand({boundingVolume:new BoundingSphere,cull:e._cull,modelMatrix:new Matrix4,primitiveType:PrimitiveType$1.POINTS,vertexArray:I,count:r,shaderProgram:void 0,uniformMap:void 0,renderState:y?e._translucentRenderState:e._opaqueRenderState,pass:y?Pass$1.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function createUniformMap$4(e,t){const i=t.context,n=e._isQuantized,r=e._isQuantizedDraco,o=e._isOctEncodedDraco;let a={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const n=scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier;if(n.x=e._attenuation?e.maximumAttenuation:e._pointSize,n.x*=t.pixelRatio,n.y=e.time,e._attenuation){const r=t.camera.frustum;let o;o=t.mode===SceneMode$1.SCENE2D||r instanceof OrthographicFrustum?Number.POSITIVE_INFINITY:i.drawingBufferHeight/t.camera.frustum.sseDenominator,n.z=e.geometricError*e.geometricErrorScale,n.w=o}return n},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){const t=e.clippingPlanes;return e.isClipped?t.texture:i.defaultTexture},u_clippingPlanesEdgeStyle:function(){const t=e.clippingPlanes;if(!defined(t))return Color.TRANSPARENT;const i=Color.clone(t.edgeColor,scratchColor$j);return i.alpha=t.edgeWidth,i},u_clippingPlanesMatrix:function(){const t=e.clippingPlanes;if(!defined(t))return Matrix4.IDENTITY;const n=defaultValue(e.clippingPlanesOriginMatrix,e._modelMatrix);Matrix4.multiply(i.uniformState.view3D,n,scratchClippingPlanesMatrix$1);const r=Matrix4.multiply(scratchClippingPlanesMatrix$1,t.modelMatrix,scratchClippingPlanesMatrix$1);return Matrix4.inverseTranspose(r,scratchInverseTransposeClippingPlanesMatrix$1)}};Splitter.addUniforms(e,a),(n||r||o)&&(a=combine$2(a,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const t=scratchQuantizedVolumeScaleAndOctEncodedRange;if(defined(e._quantizedVolumeScale)){const i=Cartesian3.clone(e._quantizedVolumeScale,t);Cartesian3.divideByScalar(i,e._quantizedRange,t)}return t.w=e._octEncodedRange,t}})),defined(e._uniformMapLoaded)&&(a=e._uniformMapLoaded(a)),e._drawCommand.uniformMap=a}function getStyleablePropertyIds(e,t){const i=/czm_3dtiles_property_(\d+)/g;let n=i.exec(e);for(;null!==n;){const r=parseInt(n[1]);-1===t.indexOf(r)&&t.push(r),n=i.exec(e)}}function getBuiltinPropertyNames(e,t){e=e.slice(e.indexOf("\n"));const i=/czm_3dtiles_builtin_property_(\w+)/g;let n=i.exec(e);for(;null!==n;){const r=n[1];-1===t.indexOf(r)&&t.push(r),n=i.exec(e)}}function getVertexAttribute(e,t){const i=e.numberOfAttributes;for(let n=0;n<i;++n){const i=e.getAttribute(n);if(i.index===t)return i}}const builtinVariableSubstitutionMap={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function createShaders$2(e,t,i){let n,r,o;const a=t.context,s=defined(i),c=e._isQuantized,l=e._isQuantizedDraco,u=e._isOctEncoded16P,d=e._isOctEncodedDraco,h=e._isRGB565,p=e._isTranslucent,f=e._hasColors,m=e._hasNormals,g=e._hasBatchIds,_=e._backFaceCulling,y=e._normalShading,C=e._drawCommand.vertexArray,T=e.clippingPlanes,S=e._attenuation;let v,A,E,b=p;const x=clone$1(builtinVariableSubstitutionMap),P={},D=e._styleableShaderAttributes;for(r in D)D.hasOwnProperty(r)&&(o=D[r],x[r]=`czm_3dtiles_property_${o.location}`,P[o.location]=o);if(s){const e={translucent:!1},t="(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";v=i.getColorShaderFunction(`getColorFromStyle${t}`,x,e),A=i.getShowShaderFunction(`getShowFromStyle${t}`,x,e),E=i.getPointSizeShaderFunction(`getPointSizeFromStyle${t}`,x,e),defined(v)&&e.translucent&&(b=!0)}e._styleTranslucent=b;const w=defined(v),M=defined(A),I=defined(E),R=e.isClipped,O=[],B=[];w&&(getStyleablePropertyIds(v,O),getBuiltinPropertyNames(v,B)),M&&(getStyleablePropertyIds(A,O),getBuiltinPropertyNames(A,B)),I&&(getStyleablePropertyIds(E,O),getBuiltinPropertyNames(E,B));const L=B.indexOf("COLOR")>=0,F=B.indexOf("NORMAL")>=0;if(F&&!m)throw new RuntimeError("Style references the NORMAL semantic but the point cloud does not have normals");for(r in D)if(D.hasOwnProperty(r)){o=D[r];const e=O.indexOf(o.location)>=0;getVertexAttribute(C,o.location).enabled=e}const N=f&&(!w||L);if(f){getVertexAttribute(C,colorLocation).enabled=N}const V=m&&(y||_||F);if(m){getVertexAttribute(C,normalLocation).enabled=V}const $={a_position:positionLocation};N&&($.a_color=colorLocation),V&&($.a_normal=normalLocation),g&&($.a_batchId=batchIdLocation);let k="";const U=O.length;for(n=0;n<U;++n){const e=O[n];o=P[e];const t=o.componentCount,i=`czm_3dtiles_property_${e}`;let r;r=1===t?"float":`vec${t}`,k+=`attribute ${r} ${i}; \n`,$[i]=o.location}createUniformMap$4(e,t);let G="attribute vec3 a_position; \nvarying vec4 v_color; \nuniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; \nuniform vec4 u_constantColor; \nuniform vec4 u_highlightColor; \n";G+="float u_pointSize; \nfloat u_time; \n",S&&(G+="float u_geometricError; \nfloat u_depthMultiplier; \n"),G+=k,N&&(G+=p?"attribute vec4 a_color; \n":h?"attribute float a_color; \nconst float SHIFT_RIGHT_11 = 1.0 / 2048.0; \nconst float SHIFT_RIGHT_5 = 1.0 / 32.0; \nconst float SHIFT_LEFT_11 = 2048.0; \nconst float SHIFT_LEFT_5 = 32.0; \nconst float NORMALIZE_6 = 1.0 / 64.0; \nconst float NORMALIZE_5 = 1.0 / 32.0; \n":"attribute vec3 a_color; \n"),V&&(G+=u||d?"attribute vec2 a_normal; \n":"attribute vec3 a_normal; \n"),g&&(G+="attribute float a_batchId; \n"),(c||l||d)&&(G+="uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; \n"),w&&(G+=v),M&&(G+=A),I&&(G+=E),G+="void main() \n{ \n u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; \n u_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; \n",S&&(G+=" u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; \n u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; \n"),G+=N?p?" vec4 color = a_color; \n":h?" float compressed = a_color; \n float r = floor(compressed * SHIFT_RIGHT_11); \n compressed -= r * SHIFT_LEFT_11; \n float g = floor(compressed * SHIFT_RIGHT_5); \n compressed -= g * SHIFT_LEFT_5; \n float b = compressed; \n vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5); \n vec4 color = vec4(rgb, 1.0); \n":" vec4 color = vec4(a_color, 1.0); \n":" vec4 color = u_constantColor; \n",G+=c||l?" vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; \n":" vec3 position = a_position; \n",G+=" vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); \n",V?(G+=u?" vec3 normal = czm_octDecode(a_normal); \n":d?" vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; \n":" vec3 normal = a_normal; \n",G+=" vec3 normalEC = czm_normal * normal; \n"):G+=" vec3 normal = vec3(1.0); \n",w&&(G+=" color = getColorFromStyle(position, position_absolute, color, normal); \n"),M&&(G+=" float show = float(getShowFromStyle(position, position_absolute, color, normal)); \n"),G+=I?" gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; \n":S?" vec4 positionEC = czm_modelView * vec4(position, 1.0); \n float depth = -positionEC.z; \n gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); \n":" gl_PointSize = u_pointSize; \n",G+=" color = color * u_highlightColor; \n",V&&y&&(G+=" float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); \n diffuseStrength = max(diffuseStrength, 0.4); \n color.xyz *= diffuseStrength * czm_lightColor; \n"),G+=" v_color = color; \n gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n",V&&_&&(G+=" float visible = step(-normalEC.z, 0.0); \n gl_Position *= visible; \n gl_PointSize *= visible; \n"),M&&(G+=" gl_Position.w *= float(show); \n gl_PointSize *= float(show); \n"),G+="} \n";let z="varying vec4 v_color; \n";R&&(z+="uniform highp sampler2D u_clippingPlanes; \nuniform mat4 u_clippingPlanesMatrix; \nuniform vec4 u_clippingPlanesEdgeStyle; \n",z+="\n",z+=getClippingFunction(T,a),z+="\n"),z+="void main() \n{ \n gl_FragColor = czm_gammaCorrect(v_color); \n",R&&(z+=getClipAndStyleCode("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),z+="} \n",e.splitDirection!==SplitDirection$1.NONE&&(z=Splitter.modifyFragmentShader(z)),defined(e._vertexShaderLoaded)&&(G=e._vertexShaderLoaded(G)),defined(e._fragmentShaderLoaded)&&(z=e._fragmentShaderLoaded(z));const H=e._drawCommand;defined(H.shaderProgram)&&H.shaderProgram.destroy(),H.shaderProgram=ShaderProgram.fromCache({context:a,vertexShaderSource:G,fragmentShaderSource:z,attributeLocations:$});try{H.shaderProgram._bind()}catch(e){throw new RuntimeError("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function decodeDraco$1(e,t){if(e._decodingState===DecodingState.READY)return!1;if(e._decodingState===DecodingState.NEEDS_DECODE){const i=e._parsedContent,n=i.draco,r=DracoLoader.decodePointCloud(n,t);defined(r)&&(e._decodingState=DecodingState.DECODING,r.then((function(t){e._decodingState=DecodingState.READY;const r=defined(t.POSITION)?t.POSITION.array:void 0,o=defined(t.RGB)?t.RGB.array:void 0,a=defined(t.RGBA)?t.RGBA.array:void 0,s=defined(t.NORMAL)?t.NORMAL.array:void 0,c=defined(t.BATCH_ID)?t.BATCH_ID.array:void 0,l=defined(r)&&defined(t.POSITION.data.quantization),u=defined(s)&&defined(t.NORMAL.data.quantization);if(l){const i=t.POSITION.data.quantization,n=i.range;e._quantizedVolumeScale=Cartesian3.fromElements(n,n,n),e._quantizedVolumeOffset=Cartesian3.unpack(i.minValues),e._quantizedRange=(1<<i.quantizationBits)-1,e._isQuantizedDraco=!0}u&&(e._octEncodedRange=(1<<t.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let d=i.styleableProperties;const h=n.batchTableProperties;for(const e in h)if(h.hasOwnProperty(e)){const i=t[e];defined(d)||(d={}),d[e]={typedArray:i.array,componentCount:i.data.componentsPerAttribute}}defined(r)&&(i.positions={typedArray:r});const p=defaultValue(a,o);defined(p)&&(i.colors={typedArray:p}),defined(s)&&(i.normals={typedArray:s}),defined(c)&&(i.batchIds={typedArray:c}),i.styleableProperties=d})).catch((function(t){e._decodingState=DecodingState.FAILED,e._readyPromise.reject(t)})))}return!0}const scratchComputedTranslation=new Cartesian4,scratchScale$3=new Cartesian3;function attachTexture(e,t,i){const n=e._gl;n.framebufferTexture2D(n.FRAMEBUFFER,t,i._target,i._texture,0)}function attachRenderbuffer(e,t,i){const n=e._gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,t,n.RENDERBUFFER,i._getRenderbuffer())}function Framebuffer(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl;let i,n,r,o,a;if(ContextLimits.maximumColorAttachments,this._gl=t,this._framebuffer=t.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=defaultValue(e.destroyAttachments,!0),defined(e.depthTexture)||defined(e.depthRenderbuffer),defined(e.depthStencilTexture)||defined(e.depthStencilRenderbuffer),this._bind(),defined(e.colorTextures)){const t=e.colorTextures;for(o=this._colorTextures.length=this._activeColorAttachments.length=t.length,r=0;r<o;++r)i=t[r],a=this._gl.COLOR_ATTACHMENT0+r,attachTexture(this,a,i),this._activeColorAttachments[r]=a,this._colorTextures[r]=i}if(defined(e.colorRenderbuffers)){const t=e.colorRenderbuffers;for(o=this._colorRenderbuffers.length=this._activeColorAttachments.length=t.length,r=0;r<o;++r)n=t[r],a=this._gl.COLOR_ATTACHMENT0+r,attachRenderbuffer(this,a,n),this._activeColorAttachments[r]=a,this._colorRenderbuffers[r]=n}defined(e.depthTexture)&&(i=e.depthTexture,attachTexture(this,this._gl.DEPTH_ATTACHMENT,i),this._depthTexture=i),defined(e.depthRenderbuffer)&&(n=e.depthRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_ATTACHMENT,n),this._depthRenderbuffer=n),defined(e.stencilRenderbuffer)&&(n=e.stencilRenderbuffer,attachRenderbuffer(this,this._gl.STENCIL_ATTACHMENT,n),this._stencilRenderbuffer=n),defined(e.depthStencilTexture)&&(i=e.depthStencilTexture,attachTexture(this,this._gl.DEPTH_STENCIL_ATTACHMENT,i),this._depthStencilTexture=i),defined(e.depthStencilRenderbuffer)&&(n=e.depthStencilRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_STENCIL_ATTACHMENT,n),this._depthStencilRenderbuffer=n),this._unBind()}function MultisampleFramebuffer(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,i=e.width,n=e.height;this._width=i,this._height=n;const r=e.colorRenderbuffers,o=e.colorTextures;if(defined(r)!==defined(o))throw new DeveloperError("Both color renderbuffer and texture attachments must be provided.");const a=e.depthStencilRenderbuffer,s=e.depthStencilTexture;if(defined(a)!==defined(s))throw new DeveloperError("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new Framebuffer({context:t,colorRenderbuffers:r,depthStencilRenderbuffer:a,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new Framebuffer({context:t,colorTextures:o,depthStencilTexture:s,destroyAttachments:e.destroyAttachments})}PointCloud.prototype.update=function(e){if(decodeDraco$1(this,e.context))return;let t=!1,i=!Matrix4.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,i=!0),defined(this._drawCommand)||(createResources$3(this,e),i=!0,t=!0,this._ready=!0,this._readyPromise.resolve(this),this._parsedContent=void 0),i){Matrix4.clone(this.modelMatrix,this._modelMatrix);const t=this._drawCommand.modelMatrix;if(Matrix4.clone(this._modelMatrix,t),defined(this._rtcCenter)&&Matrix4.multiplyByTranslation(t,this._rtcCenter,t),defined(this._quantizedVolumeOffset)&&Matrix4.multiplyByTranslation(t,this._quantizedVolumeOffset,t),e.mode!==SceneMode$1.SCENE3D){const i=e.mapProjection,n=Matrix4.getColumn(t,3,scratchComputedTranslation);Cartesian4.equals(n,Cartesian4.UNIT_W)||Transforms.basisTo2D(i,t,t)}const i=this._drawCommand.boundingVolume;if(BoundingSphere.clone(this._boundingSphere,i),this._cull){const e=i.center;Matrix4.multiplyByPoint(t,e,e);const n=Matrix4.getScale(t,scratchScale$3);i.radius*=Cartesian3.maximumComponent(n)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,t=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,t=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,t=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,t=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,t=!0);const n=this.splitDirection!==SplitDirection$1.NONE;this._splittingEnabled!==n&&(this._splittingEnabled=n,t=!0),t&&createShaders$2(this,e,this._style),this._drawCommand.castShadows=ShadowMode$1.castShadows(this.shadows),this._drawCommand.receiveShadows=ShadowMode$1.receiveShadows(this.shadows);const r=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=r?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=r?Pass$1.TRANSLUCENT:this._opaquePass;const o=e.commandList,a=e.passes;(a.render||a.pick)&&o.push(this._drawCommand)},PointCloud.prototype.isDestroyed=function(){return!1},PointCloud.prototype.destroy=function(){const e=this._drawCommand;return defined(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(Framebuffer.prototype,{status:{get:function(){this._bind();const e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}}),Framebuffer.prototype._bind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)},Framebuffer.prototype._unBind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},Framebuffer.prototype.bindDraw=function(){const e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)},Framebuffer.prototype.bindRead=function(){const e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)},Framebuffer.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments},Framebuffer.prototype.getColorTexture=function(e){return this._colorTextures[e]},Framebuffer.prototype.getColorRenderbuffer=function(e){return this._colorRenderbuffers[e]},Framebuffer.prototype.isDestroyed=function(){return!1},Framebuffer.prototype.destroy=function(){if(this.destroyAttachments){let e=0;const t=this._colorTextures;let i=t.length;for(;e<i;++e){const i=t[e];defined(i)&&i.destroy()}const n=this._colorRenderbuffers;for(i=n.length,e=0;e<i;++e){const t=n[e];defined(t)&&t.destroy()}this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._stencilRenderbuffer=this._stencilRenderbuffer&&this._stencilRenderbuffer.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()}return this._gl.deleteFramebuffer(this._framebuffer),destroyObject(this)},MultisampleFramebuffer.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer},MultisampleFramebuffer.prototype.getColorFramebuffer=function(){return this._colorFramebuffer},MultisampleFramebuffer.prototype.blitFramebuffers=function(e,t){this._renderFramebuffer.bindRead(),this._colorFramebuffer.bindDraw();const i=e._gl;let n=0;this._colorFramebuffer._colorTextures.length>0&&(n|=i.COLOR_BUFFER_BIT),defined(this._colorFramebuffer.depthStencilTexture)&&(n|=i.DEPTH_BUFFER_BIT|(t?i.STENCIL_BUFFER_BIT:0)),i.blitFramebuffer(0,0,this._width,this._height,0,0,this._width,this._height,n,i.NEAREST),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)},MultisampleFramebuffer.prototype.isDestroyed=function(){return!1},MultisampleFramebuffer.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),destroyObject(this)};const RenderbufferFormat={RGBA4:WebGLConstants$1.RGBA4,RGBA8:WebGLConstants$1.RGBA8,RGBA16F:WebGLConstants$1.RGBA16F,RGBA32F:WebGLConstants$1.RGBA32F,RGB5_A1:WebGLConstants$1.RGB5_A1,RGB565:WebGLConstants$1.RGB565,DEPTH_COMPONENT16:WebGLConstants$1.DEPTH_COMPONENT16,STENCIL_INDEX8:WebGLConstants$1.STENCIL_INDEX8,DEPTH_STENCIL:WebGLConstants$1.DEPTH_STENCIL,DEPTH24_STENCIL8:WebGLConstants$1.DEPTH24_STENCIL8,validate:function(e){return e===RenderbufferFormat.RGBA4||e===RenderbufferFormat.RGBA8||e===RenderbufferFormat.RGBA16F||e===RenderbufferFormat.RGBA32F||e===RenderbufferFormat.RGB5_A1||e===RenderbufferFormat.RGB565||e===RenderbufferFormat.DEPTH_COMPONENT16||e===RenderbufferFormat.STENCIL_INDEX8||e===RenderbufferFormat.DEPTH_STENCIL||e===RenderbufferFormat.DEPTH24_STENCIL8},getColorFormat:function(e){return e===WebGLConstants$1.FLOAT?RenderbufferFormat.RGBA32F:e===WebGLConstants$1.HALF_FLOAT_OES?RenderbufferFormat.RGBA16F:RenderbufferFormat.RGBA8}};var RenderbufferFormat$1=Object.freeze(RenderbufferFormat);function Renderbuffer(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl;ContextLimits.maximumRenderbufferSize;const i=defaultValue(e.format,RenderbufferFormat$1.RGBA4),n=defined(e.width)?e.width:t.drawingBufferWidth,r=defined(e.height)?e.height:t.drawingBufferHeight,o=defaultValue(e.numSamples,1);this._gl=t,this._format=i,this._width=n,this._height=r,this._renderbuffer=this._gl.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,this._renderbuffer),o>1?t.renderbufferStorageMultisample(t.RENDERBUFFER,o,i,n,r):t.renderbufferStorage(t.RENDERBUFFER,i,n,r),t.bindRenderbuffer(t.RENDERBUFFER,null)}function FramebufferManager(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._numSamples=defaultValue(e.numSamples,1),this._colorAttachmentsLength=defaultValue(e.colorAttachmentsLength,1),this._color=defaultValue(e.color,!0),this._depth=defaultValue(e.depth,!1),this._depthStencil=defaultValue(e.depthStencil,!1),this._supportsDepthTexture=defaultValue(e.supportsDepthTexture,!1),this._createColorAttachments=defaultValue(e.createColorAttachments,!0),this._createDepthAttachments=defaultValue(e.createDepthAttachments,!0),this._pixelDatatype=e.pixelDatatype,this._pixelFormat=e.pixelFormat,this._width=void 0,this._height=void 0,this._framebuffer=void 0,this._multisampleFramebuffer=void 0,this._colorTextures=void 0,this._color&&(this._colorTextures=new Array(this._colorAttachmentsLength),this._colorRenderbuffers=new Array(this._colorAttachmentsLength)),this._colorRenderbuffer=void 0,this._depthStencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthRenderbuffer=void 0,this._depthTexture=void 0,this._attachmentsDirty=!1}Object.defineProperties(Renderbuffer.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),Renderbuffer.prototype._getRenderbuffer=function(){return this._renderbuffer},Renderbuffer.prototype.isDestroyed=function(){return!1},Renderbuffer.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),destroyObject(this)},Object.defineProperties(FramebufferManager.prototype,{framebuffer:{get:function(){return this._numSamples>1?this._multisampleFramebuffer.getRenderFramebuffer():this._framebuffer}},numSamples:{get:function(){return this._numSamples}},status:{get:function(){return this.framebuffer.status}}}),FramebufferManager.prototype.isDirty=function(e,t,i,n,r){i=defaultValue(i,1);const o=this._width!==e||this._height!==t,a=this._numSamples!==i,s=defined(n)&&this._pixelDatatype!==n||defined(r)&&this._pixelFormat!==r,c=defined(1===i?this._framebuffer:this._multisampleFramebuffer);return this._attachmentsDirty||o||a||s||!c||this._color&&!defined(this._colorTextures[0])},FramebufferManager.prototype.update=function(e,t,i,n,r,o){if(n=e.msaa?defaultValue(n,1):1,r=defaultValue(r,this._color?defaultValue(this._pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE):void 0),o=defaultValue(o,this._color?defaultValue(this._pixelFormat,PixelFormat$1.RGBA):void 0),this.isDirty(t,i,n,r,o)){if(this.destroy(),this._width=t,this._height=i,this._numSamples=n,this._pixelDatatype=r,this._pixelFormat=o,this._attachmentsDirty=!1,this._color&&this._createColorAttachments)for(let n=0;n<this._colorAttachmentsLength;++n)if(this._colorTextures[n]=new Texture({context:e,width:t,height:i,pixelFormat:o,pixelDatatype:r,sampler:Sampler.NEAREST}),this._numSamples>1){const o=RenderbufferFormat$1.getColorFormat(r);this._colorRenderbuffers[n]=new Renderbuffer({context:e,width:t,height:i,format:o,numSamples:this._numSamples})}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new Texture({context:e,width:t,height:i,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new Renderbuffer({context:e,width:t,height:i,format:RenderbufferFormat$1.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new Renderbuffer({context:e,width:t,height:i,format:RenderbufferFormat$1.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new Texture({context:e,width:t,height:i,pixelFormat:PixelFormat$1.DEPTH_COMPONENT,pixelDatatype:PixelDatatype$1.UNSIGNED_INT,sampler:Sampler.NEAREST}):this._depthRenderbuffer=new Renderbuffer({context:e,width:t,height:i,format:RenderbufferFormat$1.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new MultisampleFramebuffer({context:e,width:this._width,height:this._height,colorTextures:this._colorTextures,colorRenderbuffers:this._colorRenderbuffers,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}):this._framebuffer=new Framebuffer({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}},FramebufferManager.prototype.getColorTexture=function(e){return e=defaultValue(e,0),this._colorTextures[e]},FramebufferManager.prototype.setColorTexture=function(e,t){t=defaultValue(t,0),this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e},FramebufferManager.prototype.getColorRenderbuffer=function(e){return e=defaultValue(e,0),this._colorRenderbuffers[e]},FramebufferManager.prototype.setColorRenderbuffer=function(e,t){t=defaultValue(t,0),this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e},FramebufferManager.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer},FramebufferManager.prototype.setDepthRenderbuffer=function(e){this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e},FramebufferManager.prototype.getDepthTexture=function(){return this._depthTexture},FramebufferManager.prototype.setDepthTexture=function(e){this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e},FramebufferManager.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer},FramebufferManager.prototype.setDepthStencilRenderbuffer=function(e){this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e},FramebufferManager.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture},FramebufferManager.prototype.setDepthStencilTexture=function(e){this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e},FramebufferManager.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)},FramebufferManager.prototype.clear=function(e,t,i){const n=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,i),t.framebuffer=n},FramebufferManager.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()},FramebufferManager.prototype.destroy=function(){if(this._color){let e;const t=this._colorTextures.length;for(e=0;e<t;++e){const t=this._colorTextures[e];this._createColorAttachments&&defined(t)&&!t.isDestroyed()&&(this._colorTextures[e].destroy(),this._colorTextures[e]=void 0),defined(t)&&t.isDestroyed()&&(this._colorTextures[e]=void 0);const i=this._colorRenderbuffers[e];this._createColorAttachments&&defined(i)&&!i.isDestroyed()&&(this._colorRenderbuffers[e].destroy(),this._colorRenderbuffers[e]=void 0),defined(i)&&i.isDestroyed()&&(this._colorRenderbuffers[e]=void 0)}}this._depthStencil&&(this._createDepthAttachments&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()),defined(this._depthStencilTexture)&&this._depthStencilTexture.isDestroyed()&&(this._depthStencilTexture=void 0),defined(this._depthStencilRenderbuffer)&&this._depthStencilRenderbuffer.isDestroyed()&&(this._depthStencilRenderbuffer=void 0)),this._depth&&(this._createDepthAttachments&&(this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy()),defined(this._depthTexture)&&this._depthTexture.isDestroyed()&&(this._depthTexture=void 0),defined(this._depthRenderbuffer)&&this._depthRenderbuffer.isDestroyed()&&(this._depthRenderbuffer=void 0)),this.destroyFramebuffer()};var PointCloudEyeDomeLightingShader="#extension GL_EXT_frag_depth : enable\nuniform sampler2D u_pointCloud_colorGBuffer;\nuniform sampler2D u_pointCloud_depthGBuffer;\nuniform vec2 u_distanceAndEdlStrength;\nvarying vec2 v_textureCoordinates;\nvec2 neighborContribution(float log2Depth, vec2 offset)\n{\nfloat dist = u_distanceAndEdlStrength.x;\nvec2 texCoordOrig = v_textureCoordinates + offset * dist;\nvec2 texCoord0 = v_textureCoordinates + offset * floor(dist);\nvec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);\nfloat depthOrLogDepth0 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord0));\nfloat depthOrLogDepth1 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord1));\nif (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {\nreturn vec2(0.0);\n}\nfloat depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);\nreturn vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);\n}\nvoid main()\n{\nfloat depthOrLogDepth = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, v_textureCoordinates));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat log2Depth = log2(-eyeCoordinate.z);\nif (depthOrLogDepth == 0.0)\n{\ndiscard;\n}\nvec4 color = texture2D(u_pointCloud_colorGBuffer, v_textureCoordinates);\nvec2 texelSize = 1.0 / czm_viewport.zw;\nvec2 responseAndCount = vec2(0.0);\nresponseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));\nfloat response = responseAndCount.x / responseAndCount.y;\nfloat strength = u_distanceAndEdlStrength.y;\nfloat shade = exp(-response * 300.0 * strength);\ncolor.rgb *= shade;\ngl_FragColor = vec4(color);\ngl_FragDepthEXT = depthOrLogDepth;\n}\n";function PointCloudEyeDomeLighting(){this._framebuffer=new FramebufferManager({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}function destroyFramebuffer$1(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}Object.defineProperties(PointCloudEyeDomeLighting.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}},colorGBuffer:{get:function(){return this._framebuffer.getColorTexture(0)}},depthGBuffer:{get:function(){return this._framebuffer.getColorTexture(1)}}});const distanceAndEdlStrengthScratch=new Cartesian2;function createCommands$1(e,t){const i=new ShaderSource({defines:["LOG_DEPTH_WRITE"],sources:[PointCloudEyeDomeLightingShader]}),n={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return distanceAndEdlStrengthScratch.x=e._radius,distanceAndEdlStrengthScratch.y=e._strength,distanceAndEdlStrengthScratch}},r=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(i,{uniformMap:n,renderState:r,pass:Pass$1.CESIUM_3D_TILE,owner:e}),e._clearCommand=new ClearCommand({framebuffer:e.framebuffer,color:new Color(0,0,0,0),depth:1,renderState:RenderState.fromCache(),pass:Pass$1.CESIUM_3D_TILE,owner:e})}function createResources$2(e,t){const i=t.drawingBufferWidth,n=t.drawingBufferHeight;e._framebuffer.update(t,i,n),createCommands$1(e,t)}function isSupported(e){return e.drawBuffers&&e.fragmentDepth}function getECShaderProgram(e,t){let i=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!defined(i)){const n=t._attributeLocations,r=t.fragmentShaderSource.clone();r.sources=r.sources.map((function(e){return e=(e=ShaderSource.replaceMain(e,"czm_point_cloud_post_process_main")).replace(/gl_FragColor/g,"gl_FragData[0]")})),r.sources.unshift("#extension GL_EXT_draw_buffers : enable \n"),r.sources.push("void main() \n{ \n czm_point_cloud_post_process_main(); \n#ifdef LOG_DEPTH\n czm_writeLogDepth();\n gl_FragData[1] = czm_packDepth(gl_FragDepthEXT); \n#else\n gl_FragData[1] = czm_packDepth(gl_FragCoord.z);\n#endif\n}"),i=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:n})}return i}function PointCloudShading(e){const t=defaultValue(e,{});this.attenuation=defaultValue(t.attenuation,!1),this.geometricErrorScale=defaultValue(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=defaultValue(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=defaultValue(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=defaultValue(t.eyeDomeLightingRadius,1),this.backFaceCulling=defaultValue(t.backFaceCulling,!1),this.normalShading=defaultValue(t.normalShading,!0)}function PointCloud3DTileContent(e,t,i,n,r){this._tileset=e,this._tile=t,this._resource=i,this._metadata=void 0,this._pickId=void 0,this._batchTable=void 0,this._styleDirty=!1,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._pointCloud=new PointCloud({arrayBuffer:n,byteOffset:r,cull:!1,opaquePass:Pass$1.CESIUM_3D_TILE,vertexShaderLoaded:getVertexShaderLoaded(this),fragmentShaderLoaded:getFragmentShaderLoaded$1(this),uniformMapLoaded:getUniformMapLoaded$1(this),batchTableLoaded:getBatchTableLoaded(this),pickIdLoaded:getPickIdLoaded$1(this)})}function getVertexShaderLoaded(e){return function(t){return defined(e._batchTable)?e._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(t):t}}function getFragmentShaderLoaded$1(e){return function(t){return defined(e._batchTable)?e._batchTable.getFragmentShaderCallback(!1,void 0,!1)(t):`uniform vec4 czm_pickColor;\n${t}`}}function getUniformMapLoaded$1(e){return function(t){return defined(e._batchTable)?e._batchTable.getUniformMapCallback()(t):combine$2(t,{czm_pickColor:function(){return e._pickId.color}})}}function getBatchTableLoaded(e){return function(t,i,n){e._batchTable=new Cesium3DTileBatchTable(e,t,i,n)}}function getPickIdLoaded$1(e){return function(){return defined(e._batchTable)?e._batchTable.getPickId():"czm_pickColor"}}function getGeometricError$2(e){const t=e._tileset.pointCloudShading,i=e._tile.contentBoundingVolume.boundingSphere.volume(),n=CesiumMath.cbrt(i/e.pointsLength);let r=e._tile.geometricError;return 0===r&&(r=defined(t)&&defined(t.baseResolution)?t.baseResolution:n),r}function createFeatures$1(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const i=new Array(t);for(let n=0;n<t;++n)i[n]=new Cesium3DTileFeature(e,n);e._features=i}}PointCloudEyeDomeLighting.isSupported=isSupported,PointCloudEyeDomeLighting.prototype.update=function(e,t,i,n){if(!isSupported(e.context))return;let r;this._strength=i.eyeDomeLightingStrength,this._radius=i.eyeDomeLightingRadius*e.pixelRatio,createResources$2(this,e.context);const o=e.commandList,a=o.length;for(r=t;r<a;++r){const t=o[r];if(t.primitiveType!==PrimitiveType$1.POINTS||t.pass===Pass$1.TRANSLUCENT)continue;let i,n,a=t.derivedCommands.pointCloudProcessor;defined(a)&&(i=a.command,n=a.originalShaderProgram),defined(i)&&!t.dirty&&n===t.shaderProgram&&i.framebuffer===this.framebuffer||(i=DrawCommand.shallowClone(t,i),i.framebuffer=this.framebuffer,i.shaderProgram=getECShaderProgram(e.context,t.shaderProgram),i.castShadows=!1,i.receiveShadows=!1,defined(a)||(a={command:i,originalShaderProgram:t.shaderProgram},t.derivedCommands.pointCloudProcessor=a),a.originalShaderProgram=t.shaderProgram),o[r]=i}const s=this._clearCommand,c=this._drawCommand;c.boundingVolume=n,o.push(c),o.push(s)},PointCloudEyeDomeLighting.prototype.isDestroyed=function(){return!1},PointCloudEyeDomeLighting.prototype.destroy=function(){return destroyFramebuffer$1(this),destroyObject(this)},PointCloudShading.isSupported=function(e){return PointCloudEyeDomeLighting.isSupported(e.context)},Object.defineProperties(PointCloud3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return this._pointCloud.pointsLength}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return this._pointCloud.geometryByteLength}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._pointCloud.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}}),PointCloud3DTileContent.prototype.hasProperty=function(e,t){return!!defined(this._batchTable)&&this._batchTable.hasProperty(e,t)},PointCloud3DTileContent.prototype.getFeature=function(e){if(defined(this._batchTable))return this.featuresLength,createFeatures$1(this),this._features[e]},PointCloud3DTileContent.prototype.applyDebugSettings=function(e,t){this._pointCloud.color=e?t:Color.WHITE},PointCloud3DTileContent.prototype.applyStyle=function(e){defined(this._batchTable)?this._batchTable.applyStyle(e):this._styleDirty=!0};const defaultShading$1=new PointCloudShading;function Tileset3DTileContent(e,t,i,n){this._tileset=e,this._tile=t,this._resource=i,this._readyPromise=defer(),this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,initialize$4(this,n)}function initialize$4(e,t){e._tileset.loadTileset(e._resource,t,e._tile),e._readyPromise.resolve(e)}function VertexArrayFacade(e,t,i,n){const r=VertexArrayFacade._verifyAttributes(t);i=defaultValue(i,0);const o=[],a={};let s,c;const l=r.length;for(let e=0;e<l;++e){const t=r[e];t.vertexBuffer?o.push(t):(c=t.usage,s=a[c],defined(s)||(s=a[c]=[]),s.push(t))}function u(e,t){return ComponentDatatype$1.getSizeInBytes(t.componentDatatype)-ComponentDatatype$1.getSizeInBytes(e.componentDatatype)}for(c in this._allBuffers=[],a)if(a.hasOwnProperty(c)){s=a[c],s.sort(u);const e=VertexArrayFacade._vertexSizeInBytes(s),t={vertexSizeInBytes:e,vertexBuffer:void 0,usage:s[0].usage,needsCommit:!1,arrayBuffer:void 0,arrayViews:VertexArrayFacade._createArrayViews(s,e)};this._allBuffers.push(t)}this._size=0,this._instanced=defaultValue(n,!1),this._precreated=o,this._context=e,this.writers=void 0,this.va=void 0,this.resize(i)}PointCloud3DTileContent.prototype.update=function(e,t){const i=this._pointCloud,n=defaultValue(e.pointCloudShading,defaultShading$1),r=this._tile,o=this._batchTable,a=t.mode,s=e.clippingPlanes;let c;defined(this._pickId)||defined(o)||(this._pickId=t.context.createPickId({primitive:e,content:this})),defined(o)&&o.update(e,t),c=defined(r._contentBoundingVolume)?a===SceneMode$1.SCENE3D?r._contentBoundingVolume.boundingSphere:r._contentBoundingVolume2D.boundingSphere:a===SceneMode$1.SCENE3D?r._boundingVolume.boundingSphere:r._boundingVolume2D.boundingSphere;const l=this._styleDirty;this._styleDirty=!1,i.clippingPlanesOriginMatrix=e.clippingPlanesOriginMatrix,i.style=defined(o)?void 0:e.style,i.styleDirty=l,i.modelMatrix=r.computedTransform,i.time=e.timeSinceLoad,i.shadows=e.shadows,i.boundingSphere=c,i.clippingPlanes=s,i.isClipped=defined(s)&&s.enabled&&r._isClipped,i.clippingPlanesDirty=r.clippingPlanesDirty,i.attenuation=n.attenuation,i.backFaceCulling=n.backFaceCulling,i.normalShading=n.normalShading,i.geometricError=getGeometricError$2(this),i.geometricErrorScale=n.geometricErrorScale,i.splitDirection=e.splitDirection,defined(n)&&defined(n.maximumAttenuation)?i.maximumAttenuation=n.maximumAttenuation:r.refine===Cesium3DTileRefine$1.ADD?i.maximumAttenuation=5:i.maximumAttenuation=e.maximumScreenSpaceError,i.update(t)},PointCloud3DTileContent.prototype.isDestroyed=function(){return!1},PointCloud3DTileContent.prototype.destroy=function(){return this._pickId=this._pickId&&this._pickId.destroy(),this._pointCloud=this._pointCloud&&this._pointCloud.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Tileset3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}}),Tileset3DTileContent.prototype.hasProperty=function(e,t){return!1},Tileset3DTileContent.prototype.getFeature=function(e){},Tileset3DTileContent.prototype.applyDebugSettings=function(e,t){},Tileset3DTileContent.prototype.applyStyle=function(e){},Tileset3DTileContent.prototype.update=function(e,t){},Tileset3DTileContent.prototype.isDestroyed=function(){return!1},Tileset3DTileContent.prototype.destroy=function(){return destroyObject(this)},VertexArrayFacade._verifyAttributes=function(e){const t=[];for(let i=0;i<e.length;++i){const n=e[i],r={index:defaultValue(n.index,i),enabled:defaultValue(n.enabled,!0),componentsPerAttribute:n.componentsPerAttribute,componentDatatype:defaultValue(n.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(n.normalize,!1),vertexBuffer:n.vertexBuffer,usage:defaultValue(n.usage,BufferUsage$1.STATIC_DRAW)};t.push(r)}const i=new Array(t.length);for(let e=0;e<t.length;++e){i[t[e].index]=!0}return t},VertexArrayFacade._vertexSizeInBytes=function(e){let t=0;const i=e.length;for(let n=0;n<i;++n){const i=e[n];t+=i.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(i.componentDatatype)}const n=i>0?ComponentDatatype$1.getSizeInBytes(e[0].componentDatatype):0,r=n>0?t%n:0;return t+=0===r?0:n-r,t},VertexArrayFacade._createArrayViews=function(e,t){const i=[];let n=0;const r=e.length;for(let o=0;o<r;++o){const r=e[o],a=r.componentDatatype;i.push({index:r.index,enabled:r.enabled,componentsPerAttribute:r.componentsPerAttribute,componentDatatype:a,normalize:r.normalize,offsetInBytes:n,vertexSizeInComponentType:t/ComponentDatatype$1.getSizeInBytes(a),view:void 0}),n+=r.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(a)}return i},VertexArrayFacade.prototype.resize=function(e){this._size=e;const t=this._allBuffers;this.writers=[];for(let e=0,i=t.length;e<i;++e){const i=t[e];VertexArrayFacade._resize(i,this._size),VertexArrayFacade._appendWriters(this.writers,i)}destroyVA(this)},VertexArrayFacade._resize=function(e,t){if(e.vertexSizeInBytes>0){const i=new ArrayBuffer(t*e.vertexSizeInBytes);if(defined(e.arrayBuffer)){const t=new Uint8Array(i),n=new Uint8Array(e.arrayBuffer),r=n.length;for(let e=0;e<r;++e)t[e]=n[e]}const n=e.arrayViews,r=n.length;for(let e=0;e<r;++e){const t=n[e];t.view=ComponentDatatype$1.createArrayBufferView(t.componentDatatype,i,t.offsetInBytes)}e.arrayBuffer=i}};const createWriters=[function(e,t,i){return function(n,r){t[n*i]=r,e.needsCommit=!0}},function(e,t,i){return function(n,r,o){const a=n*i;t[a]=r,t[a+1]=o,e.needsCommit=!0}},function(e,t,i){return function(n,r,o,a){const s=n*i;t[s]=r,t[s+1]=o,t[s+2]=a,e.needsCommit=!0}},function(e,t,i){return function(n,r,o,a,s){const c=n*i;t[c]=r,t[c+1]=o,t[c+2]=a,t[c+3]=s,e.needsCommit=!0}}];function commit(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;const i=t.vertexBuffer,n=e._size*t.vertexSizeInBytes,r=defined(i);if(!r||i.sizeInBytes<n)return r&&i.destroy(),t.vertexBuffer=Buffer$1.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}function subCommit(e,t,i){if(e.needsCommit&&e.vertexSizeInBytes>0){const n=e.vertexSizeInBytes*t,r=e.vertexSizeInBytes*i;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,n,r),n)}}function destroyVA(e){const t=e.va;if(!defined(t))return;const i=t.length;for(let e=0;e<i;++e)t[e].va.destroy();e.va=void 0}VertexArrayFacade._appendWriters=function(e,t){const i=t.arrayViews,n=i.length;for(let r=0;r<n;++r){const n=i[r];e[n.index]=createWriters[n.componentsPerAttribute-1](t,n.view,n.vertexSizeInComponentType)}},VertexArrayFacade.prototype.commit=function(e){let t=!1;const i=this._allBuffers;let n,r,o;for(r=0,o=i.length;r<o;++r)n=i[r],t=commit(this,n)||t;if(t||!defined(this.va)){destroyVA(this);const t=this.va=[],a=CesiumMath.SIXTY_FOUR_KILOBYTES-4,s=defined(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let c=0;c<s;++c){let l=[];for(r=0,o=i.length;r<o;++r){n=i[r];const e=c*(n.vertexSizeInBytes*a);VertexArrayFacade._appendAttributes(l,n,e,this._instanced)}l=l.concat(this._precreated),t.push({va:new VertexArray({context:this._context,attributes:l,indexBuffer:e}),indicesCount:1.5*(c!==s-1?a:this._size%a)})}}},VertexArrayFacade._appendAttributes=function(e,t,i,n){const r=t.arrayViews,o=r.length;for(let a=0;a<o;++a){const o=r[a];e.push({index:o.index,enabled:o.enabled,componentsPerAttribute:o.componentsPerAttribute,componentDatatype:o.componentDatatype,normalize:o.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:i+o.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:n?1:0})}},VertexArrayFacade.prototype.subCommit=function(e,t){const i=this._allBuffers;for(let n=0,r=i.length;n<r;++n)subCommit(i[n],e,t)},VertexArrayFacade.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,i=e.length;t<i;++t)e[t].needsCommit=!1},VertexArrayFacade.prototype.isDestroyed=function(){return!1},VertexArrayFacade.prototype.destroy=function(){const e=this._allBuffers;for(let t=0,i=e.length;t<i;++t){const i=e[t];i.vertexBuffer=i.vertexBuffer&&i.vertexBuffer.destroy()}return destroyVA(this),destroyObject(this)};var BillboardCollectionFS="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform sampler2D u_atlas;\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_textureCoordinates;\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nfloat getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)\n{\nvec2 lookupVector = imageSize * (depthLookupST - adjustedST);\nlookupVector = v_rotationMatrix * lookupVector;\nvec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y));\nvec2 translation = v_originTextureCoordinateAndTranslate.zw;\nif (applyTranslate)\n{\ntranslation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));\n}\nvec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));\nif (logDepthOrDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\n#ifdef SDF\nfloat getDistance(vec2 position)\n{\nreturn texture2D(u_atlas, position).r;\n}\nvec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)\n{\nfloat distance = getDistance(position);\nif (outlineWidth > 0.0)\n{\nfloat outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);\nfloat outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nvec4 sdfColor = mix(outlineColor, v_color, outlineFactor);\nfloat alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);\nreturn vec4(sdfColor.rgb, sdfColor.a * alpha);\n}\nelse\n{\nfloat alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nreturn vec4(v_color.rgb, v_color.a * alpha);\n}\n}\n#endif\nvoid main()\n{\nvec4 color = texture2D(u_atlas, v_textureCoordinates);\n#ifdef SDF\nfloat outlineWidth = v_outlineWidth;\nvec4 outlineColor = v_outlineColor;\nfloat distance = getDistance(v_textureCoordinates);\n#ifdef GL_OES_standard_derivatives\nfloat smoothing = fwidth(distance);\nvec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));\nvec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\nvec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\ncolor = (center + color1 + color2 + color3 + color4)/5.0;\n#else\nfloat smoothing = 1.0/32.0;\ncolor = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n#endif\ncolor = czm_gammaCorrect(color);\n#else\ncolor = czm_gammaCorrect(color);\ncolor *= czm_gammaCorrect(v_color);\n#endif\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\n#ifdef VECTOR_TILE\ncolor *= u_highlightColor;\n#endif\ngl_FragColor = color;\n#ifdef LOG_DEPTH\nczm_writeLogDepth();\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat temp = v_compressed.y;\ntemp = temp * SHIFT_RIGHT1;\nfloat temp2 = (temp - floor(temp)) * SHIFT_LEFT1;\nbool enableDepthTest = temp2 != 0.0;\nbool applyTranslate = floor(temp) != 0.0;\nif (enableDepthTest) {\ntemp = v_compressed.z;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\ntemp = v_compressed.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 imageSize;\nimageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;\nimageSize.x = floor(temp);\nvec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;\nadjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);\nfloat epsilonEyeDepth = v_compressed.x + czm_epsilon1;\nfloat globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);\nif (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)\n{\nfloat globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)\n{\nfloat globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)\n{\ndiscard;\n}\n}\n}\n}\n#endif\n}\n",BillboardCollectionVS="#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScale;\nattribute vec4 positionLowAndRotation;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 compressedAttribute2;\nattribute vec4 eyeOffset;\nattribute vec4 scaleByDistance;\nattribute vec4 pixelOffsetScaleByDistance;\nattribute vec4 compressedAttribute3;\nattribute vec2 sdf;\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\nattribute vec4 textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef VECTOR_TILE\nattribute float a_batchId;\n#endif\nvarying vec2 v_textureCoordinates;\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\n#endif\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\nconst float UPPER_BOUND = 32768.0;\nconst float SHIFT_LEFT16 = 65536.0;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_LEFT7 = 128.0;\nconst float SHIFT_LEFT5 = 32.0;\nconst float SHIFT_LEFT3 = 8.0;\nconst float SHIFT_LEFT2 = 4.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nconst float SHIFT_RIGHT7 = 1.0 / 128.0;\nconst float SHIFT_RIGHT5 = 1.0 / 32.0;\nconst float SHIFT_RIGHT3 = 1.0 / 8.0;\nconst float SHIFT_RIGHT2 = 1.0 / 4.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nvec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)\n{\nvec2 halfSize = imageSize * scale * 0.5;\nhalfSize *= ((direction * 2.0) - 1.0);\nvec2 originTranslate = origin * abs(halfSize);\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nif (validAlignedAxis || rotation != 0.0)\n{\nfloat angle = rotation;\nif (validAlignedAxis)\n{\nvec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);\nangle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /\n(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));\n}\nfloat cosTheta = cos(angle);\nfloat sinTheta = sin(angle);\nrotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\nhalfSize = rotationMatrix * halfSize;\n}\nelse\n{\nrotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n}\n#endif\nmpp = czm_metersPerPixel(positionEC);\npositionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);\npositionEC.xy += (translate + pixelOffset) * mpp;\nreturn positionEC;\n}\n#ifdef VERTEX_DEPTH_CHECK\nfloat getGlobeDepth(vec4 positionEC)\n{\nvec4 posWC = czm_eyeToWindowCoordinates(positionEC);\nfloat globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));\nif (globeDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\nvoid main()\n{\nvec3 positionHigh = positionHighAndScale.xyz;\nvec3 positionLow = positionLowAndRotation.xyz;\nfloat scale = positionHighAndScale.w;\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nfloat rotation = positionLowAndRotation.w;\n#else\nfloat rotation = 0.0;\n#endif\nfloat compressed = compressedAttribute0.x;\nvec2 pixelOffset;\npixelOffset.x = floor(compressed * SHIFT_RIGHT7);\ncompressed -= pixelOffset.x * SHIFT_LEFT7;\npixelOffset.x -= UPPER_BOUND;\nvec2 origin;\norigin.x = floor(compressed * SHIFT_RIGHT5);\ncompressed -= origin.x * SHIFT_LEFT5;\norigin.y = floor(compressed * SHIFT_RIGHT3);\ncompressed -= origin.y * SHIFT_LEFT3;\n#ifdef FRAGMENT_DEPTH_CHECK\nvec2 depthOrigin = origin.xy;\n#endif\norigin -= vec2(1.0);\nfloat show = floor(compressed * SHIFT_RIGHT2);\ncompressed -= show * SHIFT_LEFT2;\n#ifdef INSTANCED\nvec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\nvec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\nvec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n#else\nvec2 direction;\ndirection.x = floor(compressed * SHIFT_RIGHT1);\ndirection.y = compressed - direction.x * SHIFT_LEFT1;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\n#endif\nfloat temp = compressedAttribute0.y * SHIFT_RIGHT8;\npixelOffset.y = -(floor(temp) - UPPER_BOUND);\nvec2 translate;\ntranslate.y = (temp - floor(temp)) * SHIFT_LEFT16;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\ntranslate.x = floor(temp) - UPPER_BOUND;\ntranslate.y += (temp - floor(temp)) * SHIFT_LEFT8;\ntranslate.y -= UPPER_BOUND;\ntemp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);\nvec2 imageSize = vec2(floor(temp), temp2);\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));\nfloat applyTranslate = 0.0;\nif (labelHorizontalOrigin != 0.0)\n{\napplyTranslate = 1.0;\nlabelHorizontalOrigin -= 2.0;\ndepthOrigin.x = labelHorizontalOrigin + 1.0;\n}\ndepthOrigin = vec2(1.0) - (depthOrigin * 0.5);\n#endif\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\ntemp = compressedAttribute3.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\n#endif\n#ifdef ALIGNED_AXIS\nvec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));\ntemp = compressedAttribute2.z * SHIFT_RIGHT5;\nbool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;\n#else\nvec3 alignedAxis = vec3(0.0);\nbool validAlignedAxis = false;\n#endif\nvec4 pickColor;\nvec4 color;\ntemp = compressedAttribute2.y;\ntemp = temp * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\ntemp = compressedAttribute2.x;\ntemp = temp * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute2.z * SHIFT_RIGHT8;\nbool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\n#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)\nfloat eyeDepth = positionEC.z;\n#endif\npositionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\nfloat distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);\nscale *= distanceScale;\ntranslate *= distanceScale;\nif (scale == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef EYE_DISTANCE_PIXEL_OFFSET\nfloat pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);\npixelOffset *= pixelOffsetScale;\n#endif\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = compressedAttribute3.x;\nfloat farSq = compressedAttribute3.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nmat2 rotationMatrix;\nfloat mpp;\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = compressedAttribute3.z;\n#endif\n#ifdef VERTEX_DEPTH_CHECK\nif (lengthSq < disableDepthTestDistance) {\nfloat depthsilon = 10.0;\nvec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;\nvec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth1 = getGlobeDepth(pEC1);\nif (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)\n{\nvec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth2 = getGlobeDepth(pEC2);\nif (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)\n{\nvec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth3 = getGlobeDepth(pEC3);\nif (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)\n{\npositionEC.xyz = vec3(0.0);\n}\n}\n}\n}\n#endif\npositionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\ngl_Position = czm_projection * positionEC;\nv_textureCoordinates = textureCoordinates;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth();\n#endif\n#ifdef DISABLE_DEPTH_DISTANCE\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = 1.0;\n#endif\n}\n}\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nif (sizeInMeters) {\ntranslate /= mpp;\ndimensions /= mpp;\nimageSize /= mpp;\n}\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nv_rotationMatrix = rotationMatrix;\n#else\nv_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n#endif\nfloat enableDepthCheck = 0.0;\nif (lengthSq < disableDepthTestDistance)\n{\nenableDepthCheck = 1.0;\n}\nfloat dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));\nfloat dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));\nfloat iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));\nfloat ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));\nv_compressed.x = eyeDepth;\nv_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;\nv_compressed.z = dw * SHIFT_LEFT12 + dh;\nv_compressed.w = iw * SHIFT_LEFT12 + ih;\nv_originTextureCoordinateAndTranslate.xy = depthOrigin;\nv_originTextureCoordinateAndTranslate.zw = translate;\nv_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef SDF\nvec4 outlineColor;\nfloat outlineWidth;\ntemp = sdf.x;\ntemp = temp * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\ntemp = sdf.y;\ntemp = temp * SHIFT_RIGHT8;\nfloat temp3 = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.a = floor(temp);\noutlineColor /= 255.0;\nv_outlineWidth = outlineWidth / 255.0;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\n#endif\nv_pickColor = pickColor;\nv_color = color;\nv_color.a *= translucency;\n}\n";const SceneTransforms={},actualPositionScratch=new Cartesian4(0,0,0,1);let positionCC=new Cartesian4;const scratchViewport$1=new BoundingRectangle,scratchWindowCoord0=new Cartesian2,scratchWindowCoord1=new Cartesian2;SceneTransforms.wgs84ToWindowCoordinates=function(e,t,i){return SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(e,t,Cartesian3.ZERO,i)};const scratchCartesian4$3=new Cartesian4,scratchEyeOffset=new Cartesian3;function worldToClip(e,t,i,n){const r=i.viewMatrix,o=Matrix4.multiplyByVector(r,Cartesian4.fromElements(e.x,e.y,e.z,1,scratchCartesian4$3),scratchCartesian4$3),a=Cartesian3.multiplyComponents(t,Cartesian3.normalize(o,scratchEyeOffset),scratchEyeOffset);return o.x+=t.x+a.x,o.y+=t.y+a.y,o.z+=a.z,Matrix4.multiplyByVector(i.frustum.projectionMatrix,o,n)}const scratchMaxCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratchProjectedCartesian=new Cartesian3,scratchCameraPosition$1=new Cartesian3;SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,i,n){const r=e.frameState,o=SceneTransforms.computeActualWgs84Position(r,t,actualPositionScratch);if(!defined(o))return;const a=e.canvas,s=scratchViewport$1;s.x=0,s.y=0,s.width=a.clientWidth,s.height=a.clientHeight;const c=e.camera;let l=!1;if(r.mode===SceneMode$1.SCENE2D){const t=e.mapProjection,r=scratchMaxCartographic,u=t.project(r,scratchProjectedCartesian),d=Cartesian3.clone(c.position,scratchCameraPosition$1),h=c.frustum.clone(),p=Matrix4.computeViewportTransformation(s,0,1,new Matrix4),f=c.frustum.projectionMatrix,m=c.positionWC.y,g=Cartesian3.fromElements(CesiumMath.sign(m)*u.x-m,0,-c.positionWC.x),_=Transforms.pointToGLWindowCoordinates(f,p,g);if(0===m||_.x<=0||_.x>=a.clientWidth)l=!0;else{if(_.x>.5*a.clientWidth){s.width=_.x,c.frustum.right=u.x-m,positionCC=worldToClip(o,i,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x+=_.x,c.position.x=-c.position.x;const e=c.frustum.right;c.frustum.right=-c.frustum.left,c.frustum.left=-e,positionCC=worldToClip(o,i,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}else{s.x+=_.x,s.width-=_.x,c.frustum.left=-u.x-m,positionCC=worldToClip(o,i,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x=s.x-s.width,c.position.x=-c.position.x;const e=c.frustum.left;c.frustum.left=-c.frustum.right,c.frustum.right=-e,positionCC=worldToClip(o,i,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}Cartesian3.clone(d,c.position),c.frustum=h.clone(),((n=Cartesian2.clone(scratchWindowCoord0,n)).x<0||n.x>a.clientWidth)&&(n.x=scratchWindowCoord1.x)}}if(r.mode!==SceneMode$1.SCENE2D||l){if(positionCC=worldToClip(o,i,c,positionCC),positionCC.z<0&&!(c.frustum instanceof OrthographicFrustum)&&!(c.frustum instanceof OrthographicOffCenterFrustum))return;n=SceneTransforms.clipToGLWindowCoordinates(s,positionCC,n)}return n.y=a.clientHeight-n.y,n},SceneTransforms.wgs84ToDrawingBufferCoordinates=function(e,t,i){if(defined(i=SceneTransforms.wgs84ToWindowCoordinates(e,t,i)))return SceneTransforms.transformWindowToDrawingBuffer(e,i,i)};const projectedPosition=new Cartesian3,positionInCartographic=new Cartographic;SceneTransforms.computeActualWgs84Position=function(e,t,i){const n=e.mode;if(n===SceneMode$1.SCENE3D)return Cartesian3.clone(t,i);const r=e.mapProjection,o=r.ellipsoid.cartesianToCartographic(t,positionInCartographic);if(!defined(o))return;if(r.project(o,projectedPosition),n===SceneMode$1.COLUMBUS_VIEW)return Cartesian3.fromElements(projectedPosition.z,projectedPosition.x,projectedPosition.y,i);if(n===SceneMode$1.SCENE2D)return Cartesian3.fromElements(0,projectedPosition.x,projectedPosition.y,i);const a=e.morphTime;return Cartesian3.fromElements(CesiumMath.lerp(projectedPosition.z,t.x,a),CesiumMath.lerp(projectedPosition.x,t.y,a),CesiumMath.lerp(projectedPosition.y,t.z,a),i)};const positionNDC=new Cartesian3,positionWC=new Cartesian3,viewportTransform=new Matrix4;SceneTransforms.clipToGLWindowCoordinates=function(e,t,i){return Cartesian3.divideByScalar(t,t.w,positionNDC),Matrix4.computeViewportTransformation(e,0,1,viewportTransform),Matrix4.multiplyByPoint(viewportTransform,positionNDC,positionWC),Cartesian2.fromCartesian3(positionWC,i)},SceneTransforms.transformWindowToDrawingBuffer=function(e,t,i){const n=e.canvas,r=e.drawingBufferWidth/n.clientWidth,o=e.drawingBufferHeight/n.clientHeight;return Cartesian2.fromElements(t.x*r,t.y*o,i)};const scratchNDC=new Cartesian4,scratchWorldCoords=new Cartesian4;function Billboard(e,t){let i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,n=e.pixelOffsetScaleByDistance,r=e.scaleByDistance,o=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(n)&&(n=NearFarScalar.clone(n)),defined(r)&&(r=NearFarScalar.clone(r)),defined(o)&&(o=DistanceDisplayCondition.clone(o)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._translate=new Cartesian2(0,0),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.CENTER),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.CENTER),this._scale=defaultValue(e.scale,1),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._rotation=defaultValue(e.rotation,0),this._alignedAxis=Cartesian3.clone(defaultValue(e.alignedAxis,Cartesian3.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=r,this._translucencyByDistance=i,this._pixelOffsetScaleByDistance=n,this._sizeInMeters=defaultValue(e.sizeInMeters,!1),this._distanceDisplayCondition=o,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=defaultValue(e.collection,t),this._pickId=void 0,this._pickPrimitive=defaultValue(e._pickPrimitive,this),this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,this._imageWidth=void 0,this._imageHeight=void 0,this._labelDimensions=void 0,this._labelHorizontalOrigin=void 0,this._labelTranslate=void 0;const a=e.image;let s=e.imageId;defined(a)&&(defined(s)||(s="string"==typeof a?a:defined(a.src)?a.src:createGuid()),this._imageId=s,this._image=a),defined(e.imageSubRegion)&&(this._imageId=s,this._imageSubRegion=e.imageSubRegion),defined(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=SceneMode$1.SCENE3D,this._clusterShow=!0,this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._updateClamping()}SceneTransforms.drawingBufferToWgs84Coordinates=function(e,t,i,n){const r=e.context.uniformState,o=r.currentFrustum,a=o.x,s=o.y;if(e.frameState.useLogDepth){const e=i*r.log2FarDepthFromNearPlusOne;i=s*(1-a/(Math.pow(2,e)-1+a))/(s-a)}const c=e.view.passState.viewport,l=Cartesian4.clone(Cartesian4.UNIT_W,scratchNDC);let u;l.x=(t.x-c.x)/c.width*2-1,l.y=(t.y-c.y)/c.height*2-1,l.z=2*i-1,l.w=1;let d=e.camera.frustum;if(defined(d.fovy)){u=Matrix4.multiplyByVector(r.inverseViewProjection,l,scratchWorldCoords);const e=1/u.w;Cartesian3.multiplyByScalar(u,e,u)}else defined(d._offCenterFrustum)&&(d=d._offCenterFrustum),u=scratchWorldCoords,u.x=.5*(l.x*(d.right-d.left)+d.left+d.right),u.y=.5*(l.y*(d.top-d.bottom)+d.bottom+d.top),u.z=.5*(l.z*(a-s)-a-s),u.w=1,u=Matrix4.multiplyByVector(r.inverseView,u,u);return Cartesian3.fromCartesian4(u,n)};const SHOW_INDEX$7=Billboard.SHOW_INDEX=0,POSITION_INDEX$7=Billboard.POSITION_INDEX=1,PIXEL_OFFSET_INDEX$1=Billboard.PIXEL_OFFSET_INDEX=2,EYE_OFFSET_INDEX$1=Billboard.EYE_OFFSET_INDEX=3,HORIZONTAL_ORIGIN_INDEX$1=Billboard.HORIZONTAL_ORIGIN_INDEX=4,VERTICAL_ORIGIN_INDEX$1=Billboard.VERTICAL_ORIGIN_INDEX=5,SCALE_INDEX$3=Billboard.SCALE_INDEX=6,IMAGE_INDEX_INDEX$1=Billboard.IMAGE_INDEX_INDEX=7,COLOR_INDEX$5=Billboard.COLOR_INDEX=8,ROTATION_INDEX$1=Billboard.ROTATION_INDEX=9,ALIGNED_AXIS_INDEX$1=Billboard.ALIGNED_AXIS_INDEX=10,SCALE_BY_DISTANCE_INDEX$3=Billboard.SCALE_BY_DISTANCE_INDEX=11,TRANSLUCENCY_BY_DISTANCE_INDEX$3=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX=12,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,DISTANCE_DISPLAY_CONDITION$2=Billboard.DISTANCE_DISPLAY_CONDITION=14,DISABLE_DEPTH_DISTANCE$1=Billboard.DISABLE_DEPTH_DISTANCE=15;Billboard.TEXTURE_COORDINATE_BOUNDS=16;const SDF_INDEX$1=Billboard.SDF_INDEX=17;function makeDirty$3(e,t){const i=e._billboardCollection;defined(i)&&(i._updateBillboard(e,t),e._dirty=!0)}Billboard.NUMBER_OF_PROPERTIES=18,Object.defineProperties(Billboard.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty$3(this,SHOW_INDEX$7))}},position:{get:function(){return this._position},set:function(e){const t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),this._updateClamping(),makeDirty$3(this,POSITION_INDEX$7))}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightReference=e,this._updateClamping(),makeDirty$3(this,POSITION_INDEX$7))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){const t=this._pixelOffset;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_INDEX$1))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){const t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,SCALE_BY_DISTANCE_INDEX$3))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){const t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,TRANSLUCENCY_BY_DISTANCE_INDEX$3))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){const t=this._pixelOffsetScaleByDistance;NearFarScalar.equals(t,e)||(this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){const t=this._eyeOffset;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty$3(this,EYE_OFFSET_INDEX$1))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,makeDirty$3(this,HORIZONTAL_ORIGIN_INDEX$1))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin!==e&&(this._verticalOrigin=e,makeDirty$3(this,VERTICAL_ORIGIN_INDEX$1))}},scale:{get:function(){return this._scale},set:function(e){this._scale!==e&&(this._scale=e,makeDirty$3(this,SCALE_INDEX$3))}},color:{get:function(){return this._color},set:function(e){const t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty$3(this,COLOR_INDEX$5))}},rotation:{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,makeDirty$3(this,ROTATION_INDEX$1))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){const t=this._alignedAxis;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty$3(this,ALIGNED_AXIS_INDEX$1))}},width:{get:function(){return defaultValue(this._width,this._imageWidth)},set:function(e){this._width!==e&&(this._width=e,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},height:{get:function(){return defaultValue(this._height,this._imageHeight)},set:function(e){this._height!==e&&(this._height=e,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters!==e&&(this._sizeInMeters=e,makeDirty$3(this,COLOR_INDEX$5))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$3(this,DISTANCE_DISPLAY_CONDITION$2))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty$3(this,DISABLE_DEPTH_DISTANCE$1))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,defined(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){defined(e)?"string"==typeof e?this.setImage(e,e):e instanceof Resource?this.setImage(e.url,e):defined(e.src)?this.setImage(e.src,e):this.setImage(createGuid(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},ready:{get:function(){return-1!==this._imageIndex}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition),makeDirty$3(this,POSITION_INDEX$7)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,makeDirty$3(this,SHOW_INDEX$7))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){const t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty$3(this,SDF_INDEX$1))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty$3(this,SDF_INDEX$1))}}}),Billboard.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId},Billboard.prototype._updateClamping=function(){Billboard._updateClamping(this._billboardCollection,this)};const scratchCartographic$d=new Cartographic,scratchPosition$7=new Cartesian3;Billboard._updateClamping=function(e,t){const i=e._scene;if(!defined(i)||!defined(i.globe))return;const n=i.globe,r=n.ellipsoid,o=n._surface,a=i.frameState.mode,s=a!==t._mode;if(t._mode=a,(t._heightReference===HeightReference$1.NONE||s)&&defined(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===HeightReference$1.NONE||!defined(t._position))return;const c=r.cartesianToCartographic(t._position);if(!defined(c))return void(t._actualClampedPosition=void 0);function l(e){if(t._heightReference===HeightReference$1.RELATIVE_TO_GROUND)if(t._mode===SceneMode$1.SCENE3D){const t=r.cartesianToCartographic(e,scratchCartographic$d);t.height+=c.height,r.cartographicToCartesian(t,e)}else e.x+=c.height;t._clampedPosition=Cartesian3.clone(e,t._clampedPosition)}defined(t._removeCallbackFunc)&&t._removeCallbackFunc(),t._removeCallbackFunc=o.updateHeight(c,l),Cartographic.clone(c,scratchCartographic$d);const u=n.getHeight(c);defined(u)&&(scratchCartographic$d.height=u),r.cartographicToCartesian(scratchCartographic$d,scratchPosition$7),l(scratchPosition$7)},Billboard.prototype._loadImage=function(){const e=this._billboardCollection._textureAtlas,t=this._imageId,i=this._image,n=this._imageSubRegion;let r;if(defined(i)&&(r=e.addImage(t,i)),defined(n)&&(r=e.addSubRegion(t,n)),this._imageIndexPromise=r,!defined(r))return;const o=this;r.then((function(r){if(o._imageId!==t||o._image!==i||!BoundingRectangle.equals(o._imageSubRegion,n))return;const a=e.textureCoordinates[r];o._imageWidth=e.texture.width*a.width,o._imageHeight=e.texture.height*a.height,o._imageIndex=r,o._ready=!0,o._image=void 0,o._imageIndexPromise=void 0,makeDirty$3(o,IMAGE_INDEX_INDEX$1)})).catch((function(e){console.error(`Error loading image for billboard: ${e}`),o._imageIndexPromise=void 0}))},Billboard.prototype.setImage=function(e,t){this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype.setImageSubRegion=function(e,t){this._imageId===e&&BoundingRectangle.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=BoundingRectangle.clone(t),defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype._setTranslate=function(e){const t=this._translate;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_INDEX$1))},Billboard.prototype._getActualPosition=function(){return defined(this._clampedPosition)?this._clampedPosition:this._actualPosition},Billboard.prototype._setActualPosition=function(e){defined(this._clampedPosition)||Cartesian3.clone(e,this._actualPosition),makeDirty$3(this,POSITION_INDEX$7)};const tempCartesian3$1=new Cartesian4;Billboard._computeActualPosition=function(e,t,i,n){return defined(e._clampedPosition)?(i.mode!==e._mode&&e._updateClamping(),e._clampedPosition):i.mode===SceneMode$1.SCENE3D?t:(Matrix4.multiplyByPoint(n,t,tempCartesian3$1),SceneTransforms.computeActualWgs84Position(i,tempCartesian3$1))};const scratchCartesian3$4=new Cartesian3;Billboard._computeScreenSpacePosition=function(e,t,i,n,r,o){const a=Matrix4.multiplyByPoint(e,t,scratchCartesian3$4),s=SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(r,a,i,o);if(defined(s))return Cartesian2.add(s,n,s),s};const scratchPixelOffset=new Cartesian2(0,0);Billboard.prototype.computeScreenSpacePosition=function(e,t){const i=this._billboardCollection;defined(t)||(t=new Cartesian2),Cartesian2.clone(this._pixelOffset,scratchPixelOffset),Cartesian2.add(scratchPixelOffset,this._translate,scratchPixelOffset);let n=i.modelMatrix,r=this._position;if(defined(this._clampedPosition)&&(r=this._clampedPosition,e.mode!==SceneMode$1.SCENE3D)){const t=e.mapProjection,i=t.ellipsoid,o=t.unproject(r,scratchCartographic$d);r=i.cartographicToCartesian(o,scratchCartesian3$4),n=Matrix4.IDENTITY}return Billboard._computeScreenSpacePosition(n,r,this._eyeOffset,scratchPixelOffset,e,t)},Billboard.getScreenSpaceBoundingBox=function(e,t,i){let n=e.width,r=e.height;const o=e.scale;n*=o,r*=o;let a=t.x;e.horizontalOrigin===HorizontalOrigin$1.RIGHT?a-=n:e.horizontalOrigin===HorizontalOrigin$1.CENTER&&(a-=.5*n);let s=t.y;return e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?s-=r:e.verticalOrigin===VerticalOrigin$1.CENTER&&(s-=.5*r),defined(i)||(i=new BoundingRectangle),i.x=a,i.y=s,i.width=n,i.height=r,i},Billboard.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.equals(this._position,e._position)&&this._imageId===e._imageId&&this._show===e._show&&this._scale===e._scale&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&BoundingRectangle.equals(this._imageSubRegion,e._imageSubRegion)&&Color.equals(this._color,e._color)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian2.equals(this._translate,e._translate)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},Billboard.prototype._destroy=function(){defined(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),defined(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};const BlendOption={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};var BlendOption$1=Object.freeze(BlendOption);const SDFSettings={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25};var SDFSettings$1=Object.freeze(SDFSettings);function TextureAtlasNode(e,t,i,n,r){this.bottomLeft=defaultValue(e,Cartesian2.ZERO),this.topRight=defaultValue(t,Cartesian2.ZERO),this.childNode1=i,this.childNode2=n,this.imageIndex=r}const defaultInitialSize=new Cartesian2(16,16);function TextureAtlas(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.borderWidthInPixels,1),i=defaultValue(e.initialSize,defaultInitialSize);this._context=e.context,this._pixelFormat=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=createGuid(),this._idHash={},this._initialSize=i,this._root=void 0}function resizeAtlas(e,t){const i=e._context,n=e.numberOfImages,r=e._borderWidthInPixels;if(n>0){const n=e._texture.width,o=e._texture.height,a=2*(n+t.width+r),s=2*(o+t.height+r),c=n/a,l=o/s,u=new TextureAtlasNode(new Cartesian2(n+r,r),new Cartesian2(a,o)),d=new TextureAtlasNode(new Cartesian2,new Cartesian2(a,o),e._root,u),h=new TextureAtlasNode(new Cartesian2(r,o+r),new Cartesian2(a,s)),p=new TextureAtlasNode(new Cartesian2,new Cartesian2(a,s),d,h);for(let t=0;t<e._textureCoordinates.length;t++){const i=e._textureCoordinates[t];defined(i)&&(i.x*=c,i.y*=l,i.width*=c,i.height*=l)}const f=new Texture({context:e._context,width:a,height:s,pixelFormat:e._pixelFormat}),m=new Framebuffer({context:i,colorTextures:[e._texture],destroyAttachments:!1});m._bind(),f.copyFromFramebuffer(0,0,0,0,a,s),m._unBind(),m.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=f,e._root=p}else{let i=2*(t.width+2*r),n=2*(t.height+2*r);i<e._initialSize.x&&(i=e._initialSize.x),n<e._initialSize.y&&(n=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new Texture({context:e._context,width:i,height:n,pixelFormat:e._pixelFormat}),e._root=new TextureAtlasNode(new Cartesian2(r,r),new Cartesian2(i,n))}}function findNode(e,t,i){if(defined(t)){if(!defined(t.childNode1)&&!defined(t.childNode2)){if(defined(t.imageIndex))return;const n=t.topRight.x-t.bottomLeft.x,r=t.topRight.y-t.bottomLeft.y,o=n-i.width,a=r-i.height;if(o<0||a<0)return;if(0===o&&0===a)return t;if(o>a){t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.bottomLeft.x+i.width,t.topRight.y));const n=t.bottomLeft.x+i.width+e._borderWidthInPixels;n<t.topRight.x&&(t.childNode2=new TextureAtlasNode(new Cartesian2(n,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.topRight.y)))}else{t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.bottomLeft.y+i.height));const n=t.bottomLeft.y+i.height+e._borderWidthInPixels;n<t.topRight.y&&(t.childNode2=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,n),new Cartesian2(t.topRight.x,t.topRight.y)))}return findNode(e,t.childNode1,i)}return findNode(e,t.childNode1,i)||findNode(e,t.childNode2,i)}}function addImage(e,t,i){const n=findNode(e,e._root,t);if(defined(n)){n.imageIndex=i;const r=e._texture.width,o=e._texture.height,a=n.topRight.x-n.bottomLeft.x,s=n.topRight.y-n.bottomLeft.y,c=n.bottomLeft.x/r,l=n.bottomLeft.y/o,u=a/r,d=s/o;e._textureCoordinates[i]=new BoundingRectangle(c,l,u,d),e._texture.copyFrom({source:t,xOffset:n.bottomLeft.x,yOffset:n.bottomLeft.y})}else resizeAtlas(e,t),addImage(e,t,i);e._guid=createGuid()}function getIndex$1(e,t){if(!defined(e)||e.isDestroyed())return-1;const i=e.numberOfImages;return addImage(e,t,i),i}Object.defineProperties(TextureAtlas.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return defined(this._texture)||(this._texture=new Texture({context:this._context,width:this._initialSize.x,height:this._initialSize.y,pixelFormat:this._pixelFormat})),this._texture}},numberOfImages:{get:function(){return this._textureCoordinates.length}},guid:{get:function(){return this._guid}}}),TextureAtlas.prototype.addImageSync=function(e,t){let i=this._idHash[e];return defined(i)||(i=getIndex$1(this,t),this._idHash[e]=Promise.resolve(i)),i},TextureAtlas.prototype.addImage=function(e,t){let i=this._idHash[e];if(defined(i))return i;if("function"==typeof t)t=t(e);else if("string"==typeof t||t instanceof Resource){t=Resource.createIfNeeded(t).fetchImage()}const n=this;return i=Promise.resolve(t).then((function(e){return getIndex$1(n,e)})),this._idHash[e]=i,i},TextureAtlas.prototype.addSubRegion=function(e,t){const i=this._idHash[e];if(!defined(i))throw new RuntimeError(`image with id "${e}" not found in the atlas.`);const n=this;return Promise.resolve(i).then((function(e){if(-1===e)return-1;const i=n._texture.width,r=n._texture.height,o=n.numberOfImages,a=n._textureCoordinates[e],s=a.x+t.x/i,c=a.y+t.y/r,l=t.width/i,u=t.height/r;return n._textureCoordinates.push(new BoundingRectangle(s,c,l,u)),n._guid=createGuid(),o}))},TextureAtlas.prototype.isDestroyed=function(){return!1},TextureAtlas.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};const SHOW_INDEX$6=Billboard.SHOW_INDEX,POSITION_INDEX$6=Billboard.POSITION_INDEX,PIXEL_OFFSET_INDEX=Billboard.PIXEL_OFFSET_INDEX,EYE_OFFSET_INDEX=Billboard.EYE_OFFSET_INDEX,HORIZONTAL_ORIGIN_INDEX=Billboard.HORIZONTAL_ORIGIN_INDEX,VERTICAL_ORIGIN_INDEX=Billboard.VERTICAL_ORIGIN_INDEX,SCALE_INDEX$2=Billboard.SCALE_INDEX,IMAGE_INDEX_INDEX=Billboard.IMAGE_INDEX_INDEX,COLOR_INDEX$4=Billboard.COLOR_INDEX,ROTATION_INDEX=Billboard.ROTATION_INDEX,ALIGNED_AXIS_INDEX=Billboard.ALIGNED_AXIS_INDEX,SCALE_BY_DISTANCE_INDEX$2=Billboard.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX$2=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX$2=Billboard.DISTANCE_DISPLAY_CONDITION,DISABLE_DEPTH_DISTANCE=Billboard.DISABLE_DEPTH_DISTANCE,TEXTURE_COORDINATE_BOUNDS=Billboard.TEXTURE_COORDINATE_BOUNDS,SDF_INDEX=Billboard.SDF_INDEX,NUMBER_OF_PROPERTIES$4=Billboard.NUMBER_OF_PROPERTIES;let attributeLocations$6;const attributeLocationsBatched$1={positionHighAndScale:0,positionLowAndRotation:1,compressedAttribute0:2,compressedAttribute1:3,compressedAttribute2:4,eyeOffset:5,scaleByDistance:6,pixelOffsetScaleByDistance:7,compressedAttribute3:8,textureCoordinateBoundsOrLabelTranslate:9,a_batchId:10,sdf:11},attributeLocationsInstanced$1={direction:0,positionHighAndScale:1,positionLowAndRotation:2,compressedAttribute0:3,compressedAttribute1:4,compressedAttribute2:5,eyeOffset:6,scaleByDistance:7,pixelOffsetScaleByDistance:8,compressedAttribute3:9,textureCoordinateBoundsOrLabelTranslate:10,a_batchId:11,sdf:12};function BillboardCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._textureAtlasGUID=void 0,this._destroyTextureAtlas=!0,this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!1,this._shaderRotation=!1,this._compiledShaderRotation=!1,this._shaderAlignedAxis=!1,this._compiledShaderAlignedAxis=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._shaderClampToGround=!1,this._compiledShaderClampToGround=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$4),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=defaultValue(e.debugShowTextureAtlas,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW],this._highlightColor=Color.clone(Color.WHITE);const t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};const i=this._scene;defined(i)&&defined(i.terrainProviderChanged)&&(this._removeCallbackFunc=i.terrainProviderChanged.addEventListener((function(){const e=this._billboards,t=e.length;for(let i=0;i<t;++i)defined(e[i])&&e[i]._updateClamping()}),this))}function destroyBillboards(e){const t=e.length;for(let i=0;i<t;++i)e[i]&&e[i]._destroy()}function removeBillboards(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;const t=[],i=e._billboards,n=i.length;for(let e=0,r=0;e<n;++e){const n=i[e];defined(n)&&(n._index=r++,t.push(n))}e._billboards=t}}let getIndexBuffer$1;function getIndexBufferBatched$1(e){let t=e.cache.billboardCollection_indexBufferBatched;if(defined(t))return t;const i=new Uint16Array(98298);for(let e=0,t=0;e<98298;e+=6,t+=4)i[e]=t,i[e+1]=t+1,i[e+2]=t+2,i[e+3]=t+0,i[e+4]=t+2,i[e+5]=t+3;return t=Buffer$1.createIndexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=t,t}function getIndexBufferInstanced$1(e){let t=e.cache.billboardCollection_indexBufferInstanced;return defined(t)||(t=Buffer$1.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function getVertexBufferInstanced$1(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return defined(t)||(t=Buffer$1.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:BufferUsage$1.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}function createVAF$2(e,t,i,n,r,o){const a=[{index:attributeLocations$6.positionHighAndScale,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$6]},{index:attributeLocations$6.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$6]},{index:attributeLocations$6.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[PIXEL_OFFSET_INDEX]},{index:attributeLocations$6.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TRANSLUCENCY_BY_DISTANCE_INDEX$2]},{index:attributeLocations$6.compressedAttribute2,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[COLOR_INDEX$4]},{index:attributeLocations$6.eyeOffset,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[EYE_OFFSET_INDEX]},{index:attributeLocations$6.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SCALE_BY_DISTANCE_INDEX$2]},{index:attributeLocations$6.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX]},{index:attributeLocations$6.compressedAttribute3,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[DISTANCE_DISPLAY_CONDITION_INDEX$2]},{index:attributeLocations$6.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TEXTURE_COORDINATE_BOUNDS]}];n&&a.push({index:attributeLocations$6.direction,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:getVertexBufferInstanced$1(e)}),defined(r)&&a.push({index:attributeLocations$6.a_batchId,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.FLOAT,bufferUsage:BufferUsage$1.STATIC_DRAW}),o&&a.push({index:attributeLocations$6.sdf,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SDF_INDEX]});return new VertexArrayFacade(e,a,n?t:4*t,n)}Object.defineProperties(BillboardCollection.prototype,{length:{get:function(){return removeBillboards(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e,this._createVertexArray=!0)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}}}),BillboardCollection.prototype.add=function(e){const t=new Billboard(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t},BillboardCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},BillboardCollection.prototype.removeAll=function(){destroyBillboards(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0},BillboardCollection.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]},BillboardCollection.prototype.contains=function(e){return defined(e)&&e._billboardCollection===this},BillboardCollection.prototype.get=function(e){return removeBillboards(this),this._billboards[e]},BillboardCollection.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const i=this._propertiesChanged;for(let n=0;n<NUMBER_OF_PROPERTIES$4;++n){const r=0===i[n]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[n]!==r,e[n]=r}return t};const writePositionScratch$2=new EncodedCartesian3;function writePositionScaleAndRotation(e,t,i,n,r){let o;const a=n[attributeLocations$6.positionHighAndScale],s=n[attributeLocations$6.positionLowAndRotation],c=r._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,c,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(c,writePositionScratch$2);const l=r.scale,u=r.rotation;0!==u&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,l);const d=writePositionScratch$2.high,h=writePositionScratch$2.low;e._instanced?(o=r._index,a(o,d.x,d.y,d.z,l),s(o,h.x,h.y,h.z,u)):(o=4*r._index,a(o+0,d.x,d.y,d.z,l),a(o+1,d.x,d.y,d.z,l),a(o+2,d.x,d.y,d.z,l),a(o+3,d.x,d.y,d.z,l),s(o+0,h.x,h.y,h.z,u),s(o+1,h.x,h.y,h.z,u),s(o+2,h.x,h.y,h.z,u),s(o+3,h.x,h.y,h.z,u))}const scratchCartesian2$3=new Cartesian2,UPPER_BOUND=32768,LEFT_SHIFT16$1=65536,LEFT_SHIFT12=4096,LEFT_SHIFT8$1=256,LEFT_SHIFT7=128,LEFT_SHIFT5=32,LEFT_SHIFT3=8,LEFT_SHIFT2=4,RIGHT_SHIFT8=1/256,LOWER_LEFT=0,LOWER_RIGHT=2,UPPER_RIGHT=3,UPPER_LEFT=1;function writeCompressedAttrib0$1(e,t,i,n,r){let o;const a=n[attributeLocations$6.compressedAttribute0],s=r.pixelOffset,c=s.x,l=s.y,u=r._translate,d=u.x,h=u.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(c+d),Math.abs(-l+h));const p=r.horizontalOrigin;let f=r._verticalOrigin,m=r.show&&r.clusterShow;0===r.color.alpha&&(m=!1),f===VerticalOrigin$1.BASELINE&&(f=VerticalOrigin$1.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&p===HorizontalOrigin$1.CENTER,e._allVerticalCenter=e._allVerticalCenter&&f===VerticalOrigin$1.CENTER;let g=0,_=0,y=0,C=0;const T=r._imageIndex;if(-1!==T){const e=i[T];g=e.x,_=e.y,y=e.width,C=e.height}const S=g+y,v=_+C;let A=Math.floor(CesiumMath.clamp(c,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT7;A+=(p+1)*LEFT_SHIFT5,A+=(f+1)*LEFT_SHIFT3,A+=(m?1:0)*LEFT_SHIFT2;let E=Math.floor(CesiumMath.clamp(l,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8$1,b=Math.floor(CesiumMath.clamp(d,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8$1;const x=(CesiumMath.clamp(h,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*RIGHT_SHIFT8,P=Math.floor(x);E+=P,b+=Math.floor((x-P)*LEFT_SHIFT8$1),scratchCartesian2$3.x=g,scratchCartesian2$3.y=_;const D=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.x=S;const w=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.y=v;const M=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.x=g;const I=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);e._instanced?(o=r._index,a(o,A,E,b,D)):(o=4*r._index,a(o+0,A+LOWER_LEFT,E,b,D),a(o+1,A+LOWER_RIGHT,E,b,w),a(o+2,A+UPPER_RIGHT,E,b,M),a(o+3,A+UPPER_LEFT,E,b,I))}function writeCompressedAttrib1$1(e,t,i,n,r){let o;const a=n[attributeLocations$6.compressedAttribute1],s=r.alignedAxis;Cartesian3.equals(s,Cartesian3.ZERO)||(e._shaderAlignedAxis=!0);let c=0,l=1,u=1,d=1;const h=r.translucencyByDistance;defined(h)&&(c=h.near,l=h.nearValue,u=h.far,d=h.farValue,1===l&&1===d||(e._shaderTranslucencyByDistance=!0));let p=0;const f=r._imageIndex;if(-1!==f){p=i[f].width}const m=e._textureAtlas.texture.width,g=Math.round(defaultValue(r.width,m*p));e._maxSize=Math.max(e._maxSize,g);let _=CesiumMath.clamp(g,0,LEFT_SHIFT16$1),y=0;Math.abs(Cartesian3.magnitudeSquared(s)-1)<CesiumMath.EPSILON6&&(y=AttributeCompression.octEncodeFloat(s)),l=CesiumMath.clamp(l,0,1),l=1===l?255:255*l|0,_=_*LEFT_SHIFT8$1+l,d=CesiumMath.clamp(d,0,1),d=1===d?255:255*d|0,y=y*LEFT_SHIFT8$1+d,e._instanced?(o=r._index,a(o,_,y,c,u)):(o=4*r._index,a(o+0,_,y,c,u),a(o+1,_,y,c,u),a(o+2,_,y,c,u),a(o+3,_,y,c,u))}function writeCompressedAttrib2(e,t,i,n,r){let o;const a=n[attributeLocations$6.compressedAttribute2],s=r.color,c=defined(e._batchTable)?Color.WHITE:r.getPickId(t.context).color,l=r.sizeInMeters?1:0,u=Math.abs(Cartesian3.magnitudeSquared(r.alignedAxis)-1)<CesiumMath.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&1===l;let d=0;const h=r._imageIndex;if(-1!==h){d=i[h].height}const p=e._textureAtlas.texture.dimensions,f=Math.round(defaultValue(r.height,p.y*d));e._maxSize=Math.max(e._maxSize,f);let m=defaultValue(r._labelHorizontalOrigin,-2);m+=2;const g=f*LEFT_SHIFT2+m;let _=Color.floatToByte(s.red),y=Color.floatToByte(s.green),C=Color.floatToByte(s.blue);const T=_*LEFT_SHIFT16$1+y*LEFT_SHIFT8$1+C;_=Color.floatToByte(c.red),y=Color.floatToByte(c.green),C=Color.floatToByte(c.blue);const S=_*LEFT_SHIFT16$1+y*LEFT_SHIFT8$1+C;let v=Color.floatToByte(s.alpha)*LEFT_SHIFT16$1+Color.floatToByte(c.alpha)*LEFT_SHIFT8$1;v+=2*l+u,e._instanced?(o=r._index,a(o,T,S,v,g)):(o=4*r._index,a(o+0,T,S,v,g),a(o+1,T,S,v,g),a(o+2,T,S,v,g),a(o+3,T,S,v,g))}function writeEyeOffset(e,t,i,n,r){let o;const a=n[attributeLocations$6.eyeOffset],s=r.eyeOffset;let c=s.z;if(r._heightReference!==HeightReference$1.NONE&&(c*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(s.x),Math.abs(s.y),Math.abs(c)),e._instanced){let e=0,t=0;const n=r._imageIndex;if(-1!==n){const r=i[n];e=r.width,t=r.height}scratchCartesian2$3.x=e,scratchCartesian2$3.y=t;const l=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);o=r._index,a(o,s.x,s.y,c,l)}else o=4*r._index,a(o+0,s.x,s.y,c,0),a(o+1,s.x,s.y,c,0),a(o+2,s.x,s.y,c,0),a(o+3,s.x,s.y,c,0)}function writeScaleByDistance$1(e,t,i,n,r){let o;const a=n[attributeLocations$6.scaleByDistance];let s=0,c=1,l=1,u=1;const d=r.scaleByDistance;defined(d)&&(s=d.near,c=d.nearValue,l=d.far,u=d.farValue,1===c&&1===u||(e._shaderScaleByDistance=!0)),e._instanced?(o=r._index,a(o,s,c,l,u)):(o=4*r._index,a(o+0,s,c,l,u),a(o+1,s,c,l,u),a(o+2,s,c,l,u),a(o+3,s,c,l,u))}function writePixelOffsetScaleByDistance(e,t,i,n,r){let o;const a=n[attributeLocations$6.pixelOffsetScaleByDistance];let s=0,c=1,l=1,u=1;const d=r.pixelOffsetScaleByDistance;defined(d)&&(s=d.near,c=d.nearValue,l=d.far,u=d.farValue,1===c&&1===u||(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(o=r._index,a(o,s,c,l,u)):(o=4*r._index,a(o+0,s,c,l,u),a(o+1,s,c,l,u),a(o+2,s,c,l,u),a(o+3,s,c,l,u))}function writeCompressedAttribute3(e,t,i,n,r){let o;const a=n[attributeLocations$6.compressedAttribute3];let s=0,c=Number.MAX_VALUE;const l=r.distanceDisplayCondition;defined(l)&&(s=l.near,c=l.far,s*=s,c*=c,e._shaderDistanceDisplayCondition=!0);let u=r.disableDepthTestDistance;const d=r.heightReference===HeightReference$1.CLAMP_TO_GROUND&&t.context.depthTexture;let h,p;if(defined(u)||(u=d?5e3:0),u*=u,(d||u>0)&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1)),defined(r._labelDimensions))p=r._labelDimensions.x,h=r._labelDimensions.y;else{let t=0,n=0;const o=r._imageIndex;if(-1!==o){const e=i[o];t=e.height,n=e.width}h=Math.round(defaultValue(r.height,e._textureAtlas.texture.dimensions.y*t));const a=e._textureAtlas.texture.width;p=Math.round(defaultValue(r.width,a*n))}const f=Math.floor(CesiumMath.clamp(p,0,LEFT_SHIFT12)),m=Math.floor(CesiumMath.clamp(h,0,LEFT_SHIFT12)),g=f*LEFT_SHIFT12+m;e._instanced?(o=r._index,a(o,s,c,u,g)):(o=4*r._index,a(o+0,s,c,u,g),a(o+1,s,c,u,g),a(o+2,s,c,u,g),a(o+3,s,c,u,g))}function writeTextureCoordinateBoundsOrLabelTranslate(e,t,i,n,r){if(r.heightReference===HeightReference$1.CLAMP_TO_GROUND){const i=e._scene,n=t.context,r=t.globeTranslucencyState.translucent,o=defined(i.globe)&&i.globe.depthTestAgainstTerrain;e._shaderClampToGround=n.depthTexture&&!r&&o}let o;const a=n[attributeLocations$6.textureCoordinateBoundsOrLabelTranslate];if(ContextLimits.maximumVertexTextureImageUnits>0){let t=0,i=0;return defined(r._labelTranslate)&&(t=r._labelTranslate.x,i=r._labelTranslate.y),void(e._instanced?(o=r._index,a(o,t,i,0,0)):(o=4*r._index,a(o+0,t,i,0,0),a(o+1,t,i,0,0),a(o+2,t,i,0,0),a(o+3,t,i,0,0)))}let s=0,c=0,l=0,u=0;const d=r._imageIndex;if(-1!==d){const e=i[d];s=e.x,c=e.y,l=e.width,u=e.height}const h=s+l,p=c+u;e._instanced?(o=r._index,a(o,s,c,h,p)):(o=4*r._index,a(o+0,s,c,h,p),a(o+1,s,c,h,p),a(o+2,s,c,h,p),a(o+3,s,c,h,p))}function writeBatchId(e,t,i,n,r){if(!defined(e._batchTable))return;const o=n[attributeLocations$6.a_batchId],a=r._batchIndex;let s;e._instanced?(s=r._index,o(s,a)):(s=4*r._index,o(s+0,a),o(s+1,a),o(s+2,a),o(s+3,a))}function writeSDF(e,t,i,n,r){if(!e._sdf)return;let o;const a=n[attributeLocations$6.sdf],s=r.outlineColor,c=r.outlineWidth,l=Color.floatToByte(s.red),u=Color.floatToByte(s.green),d=Color.floatToByte(s.blue),h=l*LEFT_SHIFT16$1+u*LEFT_SHIFT8$1+d,p=c/SDFSettings$1.RADIUS,f=Color.floatToByte(s.alpha)*LEFT_SHIFT16$1+Color.floatToByte(p)*LEFT_SHIFT8$1;e._instanced?(o=r._index,a(o,h,f)):(o=4*r._index,a(o+0,h+LOWER_LEFT,f),a(o+1,h+LOWER_RIGHT,f),a(o+2,h+UPPER_RIGHT,f),a(o+3,h+UPPER_LEFT,f))}function writeBillboard(e,t,i,n,r){writePositionScaleAndRotation(e,t,i,n,r),writeCompressedAttrib0$1(e,t,i,n,r),writeCompressedAttrib1$1(e,t,i,n,r),writeCompressedAttrib2(e,t,i,n,r),writeEyeOffset(e,t,i,n,r),writeScaleByDistance$1(e,t,i,n,r),writePixelOffsetScaleByDistance(e,t,i,n,r),writeCompressedAttribute3(e,t,i,n,r),writeTextureCoordinateBoundsOrLabelTranslate(e,t,i,n,r),writeBatchId(e,t,i,n,r),writeSDF(e,t,i,n,r)}function recomputeActualPositions$1(e,t,i,n,r,o){let a;n.mode===SceneMode$1.SCENE3D?(a=e._baseVolume,e._boundingVolumeDirty=!0):a=e._baseVolume2D;const s=[];for(let e=0;e<i;++e){const i=t[e],c=i.position,l=Billboard._computeActualPosition(i,c,n,r);defined(l)&&(i._setActualPosition(l),o?s.push(l):BoundingSphere.expand(a,l,a))}o&&BoundingSphere.fromPoints(s,a)}function updateMode$2(e,t){const i=t.mode,n=e._billboards,r=e._billboardsToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==SceneMode$1.SCENE3D&&!Matrix4.equals(o,e.modelMatrix)?(e._mode=i,Matrix4.clone(e.modelMatrix,o),e._createVertexArray=!0,i!==SceneMode$1.SCENE3D&&i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,n,n.length,t,o,!0)):i===SceneMode$1.MORPHING?recomputeActualPositions$1(e,n,n.length,t,o,!0):i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,r,e._billboardsToUpdateIndex,t,o,!1)}function updateBoundingVolume$1(e,t,i){let n=1;e._allSizedInMeters&&0===e._maxPixelOffset||(n=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight));let r=n*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(r*=.5);const o=n*e._maxPixelOffset+e._maxEyeOffset;i.radius+=r+o}function createDebugCommand(e,t){const i=t.createViewportQuadCommand("uniform sampler2D billboard_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n gl_FragColor = texture2D(billboard_texture, v_textureCoordinates); \n} \n",{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=Pass$1.OVERLAY,i}const scratchWriterArray$2=[];function createBillboardPointCallback(e,t,i,n,r){return function(){const o=document.createElement("canvas"),a=r+2*n;o.height=o.width=a;const s=o.getContext("2d");return s.clearRect(0,0,a,a),0!==n&&(s.beginPath(),s.arc(a/2,a/2,a/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle=i,s.fill(),e<1&&(s.save(),s.globalCompositeOperation="destination-out",s.beginPath(),s.arc(a/2,a/2,r/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle="black",s.fill(),s.restore())),s.beginPath(),s.arc(a/2,a/2,r/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle=t,s.fill(),o}}function Cesium3DTilePointFeature(e,t,i,n,r){this._content=e,this._billboard=i,this._label=n,this._polyline=r,this._batchId=t,this._billboardImage=void 0,this._billboardColor=void 0,this._billboardOutlineColor=void 0,this._billboardOutlineWidth=void 0,this._billboardSize=void 0,this._pointSize=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._heightOffset=void 0,this._pickIds=new Array(3),setBillboardImage(this)}BillboardCollection.prototype.update=function(e){if(removeBillboards(this),!this.show)return;let t=this._billboards,i=t.length;const n=e.context;this._instanced=n.instancedArrays,attributeLocations$6=this._instanced?attributeLocationsInstanced$1:attributeLocationsBatched$1,getIndexBuffer$1=this._instanced?getIndexBufferInstanced$1:getIndexBufferBatched$1;let r=this._textureAtlas;if(!defined(r)){r=this._textureAtlas=new TextureAtlas({context:n});for(let e=0;e<i;++e)t[e]._loadImage()}const o=r.textureCoordinates;if(0===o.length)return;updateMode$2(this,e),t=this._billboards,i=t.length;const a=this._billboardsToUpdate,s=this._billboardsToUpdateIndex,c=this._propertiesChanged,l=r.guid,u=this._createVertexArray||this._textureAtlasGUID!==l;let d;this._textureAtlasGUID=l;const h=e.passes,p=h.pick;if(u||!p&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let e=0;e<NUMBER_OF_PROPERTIES$4;++e)c[e]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),i>0){this._vaf=createVAF$2(n,i,this._buffersUsage,this._instanced,this._batchTable,this._sdf),d=this._vaf.writers;for(let t=0;t<i;++t){const i=this._billboards[t];i._dirty=!1,writeBillboard(this,e,o,d,i)}this._vaf.commit(getIndexBuffer$1(n))}this._billboardsToUpdateIndex=0}else if(s>0){const t=scratchWriterArray$2;t.length=0,(c[POSITION_INDEX$6]||c[ROTATION_INDEX]||c[SCALE_INDEX$2])&&t.push(writePositionScaleAndRotation),(c[IMAGE_INDEX_INDEX]||c[PIXEL_OFFSET_INDEX]||c[HORIZONTAL_ORIGIN_INDEX]||c[VERTICAL_ORIGIN_INDEX]||c[SHOW_INDEX$6])&&(t.push(writeCompressedAttrib0$1),this._instanced&&t.push(writeEyeOffset)),(c[IMAGE_INDEX_INDEX]||c[ALIGNED_AXIS_INDEX]||c[TRANSLUCENCY_BY_DISTANCE_INDEX$2])&&(t.push(writeCompressedAttrib1$1),t.push(writeCompressedAttrib2)),(c[IMAGE_INDEX_INDEX]||c[COLOR_INDEX$4])&&t.push(writeCompressedAttrib2),c[EYE_OFFSET_INDEX]&&t.push(writeEyeOffset),c[SCALE_BY_DISTANCE_INDEX$2]&&t.push(writeScaleByDistance$1),c[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX]&&t.push(writePixelOffsetScaleByDistance),(c[DISTANCE_DISPLAY_CONDITION_INDEX$2]||c[DISABLE_DEPTH_DISTANCE]||c[IMAGE_INDEX_INDEX]||c[POSITION_INDEX$6])&&t.push(writeCompressedAttribute3),(c[IMAGE_INDEX_INDEX]||c[POSITION_INDEX$6])&&t.push(writeTextureCoordinateBoundsOrLabelTranslate),c[SDF_INDEX]&&t.push(writeSDF);const r=t.length;if(d=this._vaf.writers,s/i>.1){for(let i=0;i<s;++i){const n=a[i];n._dirty=!1;for(let i=0;i<r;++i)t[i](this,e,o,d,n)}this._vaf.commit(getIndexBuffer$1(n))}else{for(let i=0;i<s;++i){const n=a[i];n._dirty=!1;for(let i=0;i<r;++i)t[i](this,e,o,d,n);this._instanced?this._vaf.subCommit(n._index,1):this._vaf.subCommit(4*n._index,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(s>1.5*i&&(a.length=i),!defined(this._vaf)||!defined(this._vaf.va))return;let f;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D?(m=this.modelMatrix,f=BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):f=BoundingSphere.clone(this._baseVolume2D,this._boundingVolume),updateBoundingVolume$1(this,e,f);const g=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,g){this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LESS},depthMask:!0}):this._rsOpaque=void 0;const e=this._blendOption===BlendOption$1.TRANSLUCENT;this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:e?WebGLConstants$1.LEQUAL:WebGLConstants$1.LESS},depthMask:e,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0}let _,y,C,T,S;this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance;const v=ContextLimits.maximumVertexTextureImageUnits>0;if(g||this._shaderRotation!==this._compiledShaderRotation||this._shaderAlignedAxis!==this._compiledShaderAlignedAxis||this._shaderScaleByDistance!==this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance!==this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance!==this._compiledShaderPixelOffsetScaleByDistance||this._shaderDistanceDisplayCondition!==this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance||this._shaderClampToGround!==this._compiledShaderClampToGround||this._sdf!==this._compiledSDF){_=BillboardCollectionVS,y=BillboardCollectionFS,S=[],defined(this._batchTable)&&(S.push("VECTOR_TILE"),_=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(_),y=this._batchTable.getFragmentShaderCallback(!1,void 0)(y)),C=new ShaderSource({defines:S,sources:[_]}),this._instanced&&C.defines.push("INSTANCED"),this._shaderRotation&&C.defines.push("ROTATION"),this._shaderAlignedAxis&&C.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&C.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&C.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&C.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&C.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&C.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(v?C.defines.push("VERTEX_DEPTH_CHECK"):C.defines.push("FRAGMENT_DEPTH_CHECK"));const e=1-SDFSettings$1.CUTOFF;this._sdf&&C.defines.push("SDF");const t=defined(this._batchTable)?"VECTOR_TILE":"";this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(T=new ShaderSource({defines:["OPAQUE",t],sources:[y]}),this._shaderClampToGround&&(v?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push(`SDF_EDGE ${e}`)),this._sp=ShaderProgram.replaceCache({context:n,shaderProgram:this._sp,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6}),T=new ShaderSource({defines:["TRANSLUCENT",t],sources:[y]}),this._shaderClampToGround&&(v?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push(`SDF_EDGE ${e}`)),this._spTranslucent=ShaderProgram.replaceCache({context:n,shaderProgram:this._spTranslucent,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6})),this._blendOption===BlendOption$1.OPAQUE&&(T=new ShaderSource({defines:[t],sources:[y]}),this._shaderClampToGround&&(v?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push(`SDF_EDGE ${e}`)),this._sp=ShaderProgram.replaceCache({context:n,shaderProgram:this._sp,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6})),this._blendOption===BlendOption$1.TRANSLUCENT&&(T=new ShaderSource({defines:[t],sources:[y]}),this._shaderClampToGround&&(v?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push(`SDF_EDGE ${e}`)),this._spTranslucent=ShaderProgram.replaceCache({context:n,shaderProgram:this._spTranslucent,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6})),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance,this._compiledShaderClampToGround=this._shaderClampToGround,this._compiledSDF=this._sdf}const A=e.commandList;if(h.render||h.pick){const t=this._colorCommands,n=this._blendOption===BlendOption$1.OPAQUE,r=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT,o=this._vaf.va,a=o.length;let s,c=this._uniforms;defined(this._batchTable)?(c=this._batchTable.getUniformMapCallback()(c),s=this._batchTable.getPickId()):s="v_pickColor",t.length=a;const l=r?2*a:a;for(let e=0;e<l;++e){let a=t[e];defined(a)||(a=t[e]=new DrawCommand);const l=n||r&&e%2==0;a.pass=l||!r?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,a.owner=this;const u=r?Math.floor(e/2):e;a.boundingVolume=f,a.modelMatrix=m,a.count=o[u].indicesCount,a.shaderProgram=l?this._sp:this._spTranslucent,a.uniformMap=c,a.vertexArray=o[u].va,a.renderState=l?this._rsOpaque:this._rsTranslucent,a.debugShowBoundingVolume=this.debugShowBoundingVolume,a.pickId=s,this._instanced&&(a.count=6,a.instanceCount=i),A.push(a)}this.debugShowTextureAtlas&&(defined(this.debugCommand)||(this.debugCommand=createDebugCommand(this,e.context)),A.push(this.debugCommand))}},BillboardCollection.prototype.isDestroyed=function(){return!1},BillboardCollection.prototype.destroy=function(){return defined(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyBillboards(this._billboards),destroyObject(this)};const scratchCartographic$c=new Cartographic;function setBillboardImage(e){const t=e._billboard;if(defined(e._billboardImage)&&e._billboardImage!==t.image)return void(t.image=e._billboardImage);if(defined(e._billboardImage))return;const i=defaultValue(e._color,Cesium3DTilePointFeature.defaultColor),n=defaultValue(e._pointOutlineColor,Cesium3DTilePointFeature.defaultPointOutlineColor),r=defaultValue(e._pointOutlineWidth,Cesium3DTilePointFeature.defaultPointOutlineWidth),o=defaultValue(e._pointSize,Cesium3DTilePointFeature.defaultPointSize),a=e._billboardColor,s=e._billboardOutlineColor,c=e._billboardOutlineWidth,l=e._billboardSize;if(Color.equals(i,a)&&Color.equals(n,s)&&r===c&&o===l)return;e._billboardColor=Color.clone(i,e._billboardColor),e._billboardOutlineColor=Color.clone(n,e._billboardOutlineColor),e._billboardOutlineWidth=r,e._billboardSize=o;const u=i.alpha,d=i.toCssColorString(),h=n.toCssColorString(),p=JSON.stringify([d,o,h,r]);t.setImage(p,createBillboardPointCallback(u,d,h,r,o))}Object.defineProperties(Cesium3DTilePointFeature.prototype,{show:{get:function(){return this._label.show},set:function(e){this._label.show=e,this._billboard.show=e,this._polyline.show=e}},color:{get:function(){return this._color},set:function(e){this._color=Color.clone(e,this._color),setBillboardImage(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,setBillboardImage(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=Color.clone(e,this._pointOutlineColor),setBillboardImage(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,setBillboardImage(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&e.alpha>0}},labelOutlineColor:{get:function(){return this._label.outlineColor},set:function(e){this._label.outlineColor=e}},labelOutlineWidth:{get:function(){return this._label.outlineWidth},set:function(e){this._label.outlineWidth=e}},font:{get:function(){return this._label.font},set:function(e){this._label.font=e}},labelStyle:{get:function(){return this._label.style},set:function(e){this._label.style=e}},labelText:{get:function(){return this._label.text},set:function(e){defined(e)||(e=""),this._label.text=e}},backgroundColor:{get:function(){return this._label.backgroundColor},set:function(e){this._label.backgroundColor=e}},backgroundPadding:{get:function(){return this._label.backgroundPadding},set:function(e){this._label.backgroundPadding=e}},backgroundEnabled:{get:function(){return this._label.showBackground},set:function(e){this._label.showBackground=e}},scaleByDistance:{get:function(){return this._label.scaleByDistance},set:function(e){this._label.scaleByDistance=e,this._billboard.scaleByDistance=e}},translucencyByDistance:{get:function(){return this._label.translucencyByDistance},set:function(e){this._label.translucencyByDistance=e,this._billboard.translucencyByDistance=e}},distanceDisplayCondition:{get:function(){return this._label.distanceDisplayCondition},set:function(e){this._label.distanceDisplayCondition=e,this._polyline.distanceDisplayCondition=e,this._billboard.distanceDisplayCondition=e}},heightOffset:{get:function(){return this._heightOffset},set:function(e){const t=defaultValue(this._heightOffset,0),i=this._content.tileset.ellipsoid,n=i.cartesianToCartographic(this._billboard.position,scratchCartographic$c);n.height=n.height-t+e;const r=i.cartographicToCartesian(n);this._billboard.position=r,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],r],this._heightOffset=e}},anchorLineEnabled:{get:function(){return this._polyline.show},set:function(e){this._polyline.show=e}},anchorLineColor:{get:function(){return this._polyline.material.uniforms.color},set:function(e){this._polyline.material.uniforms.color=Color.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){const t=this._billboardImage!==e;this._billboardImage=e,t&&setBillboardImage(this)}},disableDepthTestDistance:{get:function(){return this._label.disableDepthTestDistance},set:function(e){this._label.disableDepthTestDistance=e,this._billboard.disableDepthTestDistance=e}},horizontalOrigin:{get:function(){return this._billboard.horizontalOrigin},set:function(e){this._billboard.horizontalOrigin=e}},verticalOrigin:{get:function(){return this._billboard.verticalOrigin},set:function(e){this._billboard.verticalOrigin=e}},labelHorizontalOrigin:{get:function(){return this._label.horizontalOrigin},set:function(e){this._label.horizontalOrigin=e}},labelVerticalOrigin:{get:function(){return this._label.verticalOrigin},set:function(e){this._label.verticalOrigin=e}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickIds:{get:function(){const e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}}),Cesium3DTilePointFeature.defaultColor=Color.WHITE,Cesium3DTilePointFeature.defaultPointOutlineColor=Color.BLACK,Cesium3DTilePointFeature.defaultPointOutlineWidth=0,Cesium3DTilePointFeature.defaultPointSize=8,Cesium3DTilePointFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTilePointFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.getPropertyInherited=function(e){return Cesium3DTileFeature.getPropertyInherited(this._content,this._batchId,e)},Cesium3DTilePointFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTilePointFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var clamp_1=clamp;function clamp(e,t,i){return t<i?e<t?t:e>i?i:e:e<i?i:e>t?t:e}var bitmapSdf=calcSDF,INF=1e20;function calcSDF(e,t){t||(t={});var i,n,r,o,a,s,c,l,u,d,h,p=null==t.cutoff?.25:t.cutoff,f=null==t.radius?8:t.radius,m=t.channel||0;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");i=t.width,n=t.height,o=e,s=t.stride?t.stride:Math.floor(e.length/i/n)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(c=(l=e).getContext("2d"),i=l.width,n=l.height,o=(u=c.getImageData(0,0,i,n)).data,s=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(c=e,i=(l=e.canvas).width,n=l.height,o=(u=c.getImageData(0,0,i,n)).data,s=4):window.ImageData&&e instanceof window.ImageData&&(u=e,i=e.width,n=e.height,o=u.data,s=4);if(r=Math.max(i,n),window.Uint8ClampedArray&&o instanceof window.Uint8ClampedArray||window.Uint8Array&&o instanceof window.Uint8Array)for(a=o,o=Array(i*n),d=0,h=a.length;d<h;d++)o[d]=a[d*s+m]/255;else if(1!==s)throw Error("Raw data can have only 1 value per pixel");var g=Array(i*n),_=Array(i*n),y=Array(r),C=Array(r),T=Array(r+1),S=Array(r);for(d=0,h=i*n;d<h;d++){var v=o[d];g[d]=1===v?0:0===v?INF:Math.pow(Math.max(0,.5-v),2),_[d]=1===v?INF:0===v?0:Math.pow(Math.max(0,v-.5),2)}edt(g,i,n,y,C,S,T),edt(_,i,n,y,C,S,T);var A=window.Float32Array?new Float32Array(i*n):new Array(i*n);for(d=0,h=i*n;d<h;d++)A[d]=clamp_1(1-((g[d]-_[d])/f+p),0,1);return A}function edt(e,t,i,n,r,o,a){for(var s=0;s<t;s++){for(var c=0;c<i;c++)n[c]=e[c*t+s];for(edt1d(n,r,o,a,i),c=0;c<i;c++)e[c*t+s]=r[c]}for(c=0;c<i;c++){for(s=0;s<t;s++)n[s]=e[c*t+s];for(edt1d(n,r,o,a,t),s=0;s<t;s++)e[c*t+s]=Math.sqrt(r[s])}}function edt1d(e,t,i,n,r){i[0]=0,n[0]=-INF,n[1]=+INF;for(var o=1,a=0;o<r;o++){for(var s=(e[o]+o*o-(e[i[a]]+i[a]*i[a]))/(2*o-2*i[a]);s<=n[a];)a--,s=(e[o]+o*o-(e[i[a]]+i[a]*i[a]))/(2*o-2*i[a]);i[++a]=o,n[a]=s,n[a+1]=+INF}for(o=0,a=0;o<r;o++){for(;n[a+1]<o;)a++;t[o]=(o-i[a])*(o-i[a])+e[i[a]]}}const LabelStyle={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2};var LabelStyle$1=Object.freeze(LabelStyle);const fontInfoCache={};let fontInfoCacheLength=0;const fontInfoCacheMaxSize=256,defaultBackgroundColor$2=new Color(.165,.165,.165,.8),defaultBackgroundPadding$1=new Cartesian2(7,5),textTypes=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function rebindAllGlyphs$1(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function repositionAllGlyphs$1(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function getCSSValue(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function parseFont(e){let t=fontInfoCache[e._font];if(!defined(t)){const i=document.createElement("div");i.style.position="absolute",i.style.opacity=0,i.style.font=e._font,document.body.appendChild(i);let n=parseFloat(getCSSValue(i,"line-height"));isNaN(n)&&(n=void 0),t={family:getCSSValue(i,"font-family"),size:getCSSValue(i,"font-size").replace("px",""),style:getCSSValue(i,"font-style"),weight:getCSSValue(i,"font-weight"),lineHeight:n},document.body.removeChild(i),fontInfoCacheLength<fontInfoCacheMaxSize&&(fontInfoCache[e._font]=t,fontInfoCacheLength++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function Label(e,t){let i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,n=e.pixelOffsetScaleByDistance,r=e.scaleByDistance,o=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(n)&&(n=NearFarScalar.clone(n)),defined(r)&&(r=NearFarScalar.clone(r)),defined(o)&&(o=DistanceDisplayCondition.clone(o)),this._renderedText=void 0,this._text=void 0,this._show=defaultValue(e.show,!0),this._font=defaultValue(e.font,"30px sans-serif"),this._fillColor=Color.clone(defaultValue(e.fillColor,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,1),this._showBackground=defaultValue(e.showBackground,!1),this._backgroundColor=Color.clone(defaultValue(e.backgroundColor,defaultBackgroundColor$2)),this._backgroundPadding=Cartesian2.clone(defaultValue(e.backgroundPadding,defaultBackgroundPadding$1)),this._style=defaultValue(e.style,LabelStyle$1.FILL),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.BASELINE),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.LEFT),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._scale=defaultValue(e.scale,1),this._id=e.id,this._translucencyByDistance=i,this._pixelOffsetScaleByDistance=n,this._scaleByDistance=r,this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._distanceDisplayCondition=o,this._disableDepthTestDistance=e.disableDepthTestDistance,this._labelCollection=t,this._glyphs=[],this._backgroundBillboard=void 0,this._batchIndex=void 0,this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._clusterShow=!0,this.text=defaultValue(e.text,""),this._relativeSize=1,parseFont(this),this._updateClamping()}function convertTextToTypes(e,t){const i=/[a-zA-Z0-9]/,n=/[()[\]{}<>]/,r=[];let o="",a=textTypes.LTR,s="";const c=e.length;for(let l=0;l<c;++l){const c=e.charAt(l);s=t.test(c)?textTypes.RTL:i.test(c)?textTypes.LTR:n.test(c)?textTypes.BRACKETS:textTypes.WEAK,0===l&&(a=s),a===s&&s!==textTypes.BRACKETS?o+=c:(""!==o&&r.push({Type:a,Word:o}),a=s,o=c)}return r.push({Type:s,Word:o}),r}function reverseWord(e){return e.split("").reverse().join("")}function spliceWord(e,t,i){return e.slice(0,t)+i+e.slice(t)}function reverseBrackets(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}Object.defineProperties(Label.prototype,{show:{get:function(){return this._show},set:function(e){if(this._show!==e){this._show=e;const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i].billboard;defined(n)&&(n.show=e)}const i=this._backgroundBillboard;defined(i)&&(i.show=e)}}},position:{get:function(){return this._position},set:function(e){const t=this._position;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);const i=this._glyphs;for(let t=0,n=i.length;t<n;t++){const n=i[t].billboard;defined(n)&&(n.position=e)}const n=this._backgroundBillboard;defined(n)&&(n.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(e!==this._heightReference){this._heightReference=e;const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i].billboard;defined(n)&&(n.heightReference=e)}const i=this._backgroundBillboard;defined(i)&&(i.heightReference=e),repositionAllGlyphs$1(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(this._text!==e){this._text=e;const t=e.replace(/\u00ad/g,"");this._renderedText=Label.enableRightToLeftDetection?reverseRtl(t):t,rebindAllGlyphs$1(this)}}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,rebindAllGlyphs$1(this),parseFont(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){const t=this._fillColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs$1(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){const t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs$1(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,rebindAllGlyphs$1(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){this._showBackground!==e&&(this._showBackground=e,rebindAllGlyphs$1(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){const t=this._backgroundColor;if(!Color.equals(t,e)){Color.clone(e,t);const i=this._backgroundBillboard;defined(i)&&(i.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){const t=this._backgroundPadding;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),repositionAllGlyphs$1(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,rebindAllGlyphs$1(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){const t=this._pixelOffset;if(!Cartesian2.equals(t,e)){Cartesian2.clone(e,t);const i=this._glyphs;for(let t=0,n=i.length;t<n;t++){const n=i[t];defined(n.billboard)&&(n.billboard.pixelOffset=e)}const n=this._backgroundBillboard;defined(n)&&(n.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){const t=this._translucencyByDistance;if(!NearFarScalar.equals(t,e)){this._translucencyByDistance=NearFarScalar.clone(e,t);const i=this._glyphs;for(let t=0,n=i.length;t<n;t++){const n=i[t];defined(n.billboard)&&(n.billboard.translucencyByDistance=e)}const n=this._backgroundBillboard;defined(n)&&(n.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){const t=this._pixelOffsetScaleByDistance;if(!NearFarScalar.equals(t,e)){this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t);const i=this._glyphs;for(let t=0,n=i.length;t<n;t++){const n=i[t];defined(n.billboard)&&(n.billboard.pixelOffsetScaleByDistance=e)}const n=this._backgroundBillboard;defined(n)&&(n.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){const t=this._scaleByDistance;if(!NearFarScalar.equals(t,e)){this._scaleByDistance=NearFarScalar.clone(e,t);const i=this._glyphs;for(let t=0,n=i.length;t<n;t++){const n=i[t];defined(n.billboard)&&(n.billboard.scaleByDistance=e)}const n=this._backgroundBillboard;defined(n)&&(n.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){const t=this._eyeOffset;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);const i=this._glyphs;for(let t=0,n=i.length;t<n;t++){const n=i[t];defined(n.billboard)&&(n.billboard.eyeOffset=e)}const n=this._backgroundBillboard;defined(n)&&(n.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,repositionAllGlyphs$1(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(this._verticalOrigin!==e){this._verticalOrigin=e;const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i];defined(n.billboard)&&(n.billboard.verticalOrigin=e)}const i=this._backgroundBillboard;defined(i)&&(i.verticalOrigin=e),repositionAllGlyphs$1(this)}}},scale:{get:function(){return this._scale},set:function(e){if(this._scale!==e){this._scale=e;const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i];defined(n.billboard)&&(n.billboard.scale=e*this._relativeSize)}const i=this._backgroundBillboard;defined(i)&&(i.scale=e*this._relativeSize),repositionAllGlyphs$1(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition);const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i];defined(n.billboard)&&(n.billboard.distanceDisplayCondition=e)}const i=this._backgroundBillboard;defined(i)&&(i.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){this._disableDepthTestDistance=e;const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i];defined(n.billboard)&&(n.billboard.disableDepthTestDistance=e)}const i=this._backgroundBillboard;defined(i)&&(i.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i];defined(n.billboard)&&(n.billboard.id=e)}const i=this._backgroundBillboard;defined(i)&&(i.id=e)}}},pickId:{get:function(){if(0!==this._glyphs.length&&defined(this._glyphs[0].billboard))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition);const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i];defined(n.billboard)&&(n.billboard._clampedPosition=e)}const i=this._backgroundBillboard;defined(i)&&(i._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;const t=this._glyphs;for(let i=0,n=t.length;i<n;i++){const n=t[i];defined(n.billboard)&&(n.billboard.clusterShow=e)}const i=this._backgroundBillboard;defined(i)&&(i.clusterShow=e)}}}}),Label.prototype._updateClamping=function(){Billboard._updateClamping(this._labelCollection,this)},Label.prototype.computeScreenSpacePosition=function(e,t){defined(t)||(t=new Cartesian2);const i=this._labelCollection.modelMatrix,n=defined(this._actualClampedPosition)?this._actualClampedPosition:this._position;return Billboard._computeScreenSpacePosition(i,n,this._eyeOffset,this._pixelOffset,e,t)},Label.getScreenSpaceBoundingBox=function(e,t,i){let n=0,r=0,o=0,a=0;const s=e.totalScale,c=e._backgroundBillboard;if(defined(c))n=t.x+c._translate.x,r=t.y-c._translate.y,o=c.width*s,a=c.height*s,e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?r-=a:e.verticalOrigin===VerticalOrigin$1.CENTER&&(r-=.5*a);else{n=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;let i=0,c=0;const l=e._glyphs,u=l.length;for(let o=0;o<u;++o){const a=l[o],u=a.billboard;if(!defined(u))continue;const d=t.x+u._translate.x;let h=t.y-u._translate.y;const p=a.dimensions.width*s,f=a.dimensions.height*s;e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?h-=f:e.verticalOrigin===VerticalOrigin$1.CENTER&&(h-=.5*f),e._verticalOrigin===VerticalOrigin$1.TOP?h+=SDFSettings$1.PADDING*s:e._verticalOrigin!==VerticalOrigin$1.BOTTOM&&e._verticalOrigin!==VerticalOrigin$1.BASELINE||(h-=SDFSettings$1.PADDING*s),n=Math.min(n,d),r=Math.min(r,h),i=Math.max(i,d+p),c=Math.max(c,h+f)}o=i-n,a=c-r}return defined(i)||(i=new BoundingRectangle),i.x=n,i.y=r,i.width=o,i.height=a,i},Label.prototype.equals=function(e){return this===e||defined(e)&&this._show===e._show&&this._scale===e._scale&&this._outlineWidth===e._outlineWidth&&this._showBackground===e._showBackground&&this._style===e._style&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&this._renderedText===e._renderedText&&this._font===e._font&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._fillColor,e._fillColor)&&Color.equals(this._outlineColor,e._outlineColor)&&Color.equals(this._backgroundColor,e._backgroundColor)&&Cartesian2.equals(this._backgroundPadding,e._backgroundPadding)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id},Label.prototype.isDestroyed=function(){return!1},Label.enableRightToLeftDetection=!1;const hebrew="א-ת",arabic="-ۿݐ-ݿࢠ-ࣿ",rtlChars=new RegExp(`[${hebrew}${arabic}]`);function reverseRtl(e){const t=e.split("\n");let i="";for(let e=0;e<t.length;e++){const n=t[e],r=rtlChars.test(n.charAt(0)),o=convertTextToTypes(n,rtlChars);let a=0,s="";for(let e=0;e<o.length;++e){const t=o[e],i=t.Type===textTypes.BRACKETS?reverseBrackets(t.Word):reverseWord(t.Word);r?t.Type===textTypes.RTL?(s=i+s,a=0):t.Type===textTypes.LTR?(s=spliceWord(s,a,t.Word),a+=t.Word.length):t.Type!==textTypes.WEAK&&t.Type!==textTypes.BRACKETS||(t.Type===textTypes.WEAK&&o[e-1].Type===textTypes.BRACKETS?s=i+s:o[e-1].Type===textTypes.RTL?(s=i+s,a=0):o.length>e+1?o[e+1].Type===textTypes.RTL?(s=i+s,a=0):(s=spliceWord(s,a,t.Word),a+=t.Word.length):s=spliceWord(s,0,i)):t.Type===textTypes.RTL?s=spliceWord(s,a,i):t.Type===textTypes.LTR?(s+=t.Word,a=s.length):t.Type!==textTypes.WEAK&&t.Type!==textTypes.BRACKETS||(e>0&&o[e-1].Type===textTypes.RTL?o.length>e+1?o[e+1].Type===textTypes.RTL?s=spliceWord(s,a,i):(s+=t.Word,a=s.length):s+=t.Word:(s+=t.Word,a=s.length))}i+=s,e<t.length-1&&(i+="\n")}return i}var graphemeSplitter=createCommonjsModule((function(e){e.exports&&(e.exports=function(){var e=3,t=4,i=12,n=13,r=16,o=17;function a(e,t){void 0===t&&(t=0);var i=e.charCodeAt(t);if(55296<=i&&i<=56319&&t<e.length-1){var n=i;return 56320<=(r=e.charCodeAt(t+1))&&r<=57343?1024*(n-55296)+(r-56320)+65536:n}if(56320<=i&&i<=57343&&t>=1){var r=i;return 55296<=(n=e.charCodeAt(t-1))&&n<=56319?1024*(n-55296)+(r-56320)+65536:r}return i}function s(a,s,c){var l=[a].concat(s).concat([c]),u=l[l.length-2],d=c,h=l.lastIndexOf(14);if(h>1&&l.slice(1,h).every((function(t){return t==e}))&&-1==[e,n,o].indexOf(a))return 2;var p=l.lastIndexOf(t);if(p>0&&l.slice(1,p).every((function(e){return e==t}))&&-1==[i,t].indexOf(u))return l.filter((function(e){return e==t})).length%2==1?3:4;if(0==u&&1==d)return 0;if(2==u||0==u||1==u)return 14==d&&s.every((function(t){return t==e}))?2:1;if(2==d||0==d||1==d)return 1;if(6==u&&(6==d||7==d||9==d||10==d))return 0;if(!(9!=u&&7!=u||7!=d&&8!=d))return 0;if((10==u||8==u)&&8==d)return 0;if(d==e||15==d)return 0;if(5==d)return 0;if(u==i)return 0;var f=-1!=l.indexOf(e)?l.lastIndexOf(e)-1:l.length-2;return-1!=[n,o].indexOf(l[f])&&l.slice(f+1,-1).every((function(t){return t==e}))&&14==d||15==u&&-1!=[r,o].indexOf(d)?0:-1!=s.indexOf(t)?2:u==t&&d==t?0:1}function c(a){return 1536<=a&&a<=1541||1757==a||1807==a||2274==a||3406==a||69821==a||70082<=a&&a<=70083||72250==a||72326<=a&&a<=72329||73030==a?i:13==a?0:10==a?1:0<=a&&a<=9||11<=a&&a<=12||14<=a&&a<=31||127<=a&&a<=159||173==a||1564==a||6158==a||8203==a||8206<=a&&a<=8207||8232==a||8233==a||8234<=a&&a<=8238||8288<=a&&a<=8292||8293==a||8294<=a&&a<=8303||55296<=a&&a<=57343||65279==a||65520<=a&&a<=65528||65529<=a&&a<=65531||113824<=a&&a<=113827||119155<=a&&a<=119162||917504==a||917505==a||917506<=a&&a<=917535||917632<=a&&a<=917759||918e3<=a&&a<=921599?2:768<=a&&a<=879||1155<=a&&a<=1159||1160<=a&&a<=1161||1425<=a&&a<=1469||1471==a||1473<=a&&a<=1474||1476<=a&&a<=1477||1479==a||1552<=a&&a<=1562||1611<=a&&a<=1631||1648==a||1750<=a&&a<=1756||1759<=a&&a<=1764||1767<=a&&a<=1768||1770<=a&&a<=1773||1809==a||1840<=a&&a<=1866||1958<=a&&a<=1968||2027<=a&&a<=2035||2070<=a&&a<=2073||2075<=a&&a<=2083||2085<=a&&a<=2087||2089<=a&&a<=2093||2137<=a&&a<=2139||2260<=a&&a<=2273||2275<=a&&a<=2306||2362==a||2364==a||2369<=a&&a<=2376||2381==a||2385<=a&&a<=2391||2402<=a&&a<=2403||2433==a||2492==a||2494==a||2497<=a&&a<=2500||2509==a||2519==a||2530<=a&&a<=2531||2561<=a&&a<=2562||2620==a||2625<=a&&a<=2626||2631<=a&&a<=2632||2635<=a&&a<=2637||2641==a||2672<=a&&a<=2673||2677==a||2689<=a&&a<=2690||2748==a||2753<=a&&a<=2757||2759<=a&&a<=2760||2765==a||2786<=a&&a<=2787||2810<=a&&a<=2815||2817==a||2876==a||2878==a||2879==a||2881<=a&&a<=2884||2893==a||2902==a||2903==a||2914<=a&&a<=2915||2946==a||3006==a||3008==a||3021==a||3031==a||3072==a||3134<=a&&a<=3136||3142<=a&&a<=3144||3146<=a&&a<=3149||3157<=a&&a<=3158||3170<=a&&a<=3171||3201==a||3260==a||3263==a||3266==a||3270==a||3276<=a&&a<=3277||3285<=a&&a<=3286||3298<=a&&a<=3299||3328<=a&&a<=3329||3387<=a&&a<=3388||3390==a||3393<=a&&a<=3396||3405==a||3415==a||3426<=a&&a<=3427||3530==a||3535==a||3538<=a&&a<=3540||3542==a||3551==a||3633==a||3636<=a&&a<=3642||3655<=a&&a<=3662||3761==a||3764<=a&&a<=3769||3771<=a&&a<=3772||3784<=a&&a<=3789||3864<=a&&a<=3865||3893==a||3895==a||3897==a||3953<=a&&a<=3966||3968<=a&&a<=3972||3974<=a&&a<=3975||3981<=a&&a<=3991||3993<=a&&a<=4028||4038==a||4141<=a&&a<=4144||4146<=a&&a<=4151||4153<=a&&a<=4154||4157<=a&&a<=4158||4184<=a&&a<=4185||4190<=a&&a<=4192||4209<=a&&a<=4212||4226==a||4229<=a&&a<=4230||4237==a||4253==a||4957<=a&&a<=4959||5906<=a&&a<=5908||5938<=a&&a<=5940||5970<=a&&a<=5971||6002<=a&&a<=6003||6068<=a&&a<=6069||6071<=a&&a<=6077||6086==a||6089<=a&&a<=6099||6109==a||6155<=a&&a<=6157||6277<=a&&a<=6278||6313==a||6432<=a&&a<=6434||6439<=a&&a<=6440||6450==a||6457<=a&&a<=6459||6679<=a&&a<=6680||6683==a||6742==a||6744<=a&&a<=6750||6752==a||6754==a||6757<=a&&a<=6764||6771<=a&&a<=6780||6783==a||6832<=a&&a<=6845||6846==a||6912<=a&&a<=6915||6964==a||6966<=a&&a<=6970||6972==a||6978==a||7019<=a&&a<=7027||7040<=a&&a<=7041||7074<=a&&a<=7077||7080<=a&&a<=7081||7083<=a&&a<=7085||7142==a||7144<=a&&a<=7145||7149==a||7151<=a&&a<=7153||7212<=a&&a<=7219||7222<=a&&a<=7223||7376<=a&&a<=7378||7380<=a&&a<=7392||7394<=a&&a<=7400||7405==a||7412==a||7416<=a&&a<=7417||7616<=a&&a<=7673||7675<=a&&a<=7679||8204==a||8400<=a&&a<=8412||8413<=a&&a<=8416||8417==a||8418<=a&&a<=8420||8421<=a&&a<=8432||11503<=a&&a<=11505||11647==a||11744<=a&&a<=11775||12330<=a&&a<=12333||12334<=a&&a<=12335||12441<=a&&a<=12442||42607==a||42608<=a&&a<=42610||42612<=a&&a<=42621||42654<=a&&a<=42655||42736<=a&&a<=42737||43010==a||43014==a||43019==a||43045<=a&&a<=43046||43204<=a&&a<=43205||43232<=a&&a<=43249||43302<=a&&a<=43309||43335<=a&&a<=43345||43392<=a&&a<=43394||43443==a||43446<=a&&a<=43449||43452==a||43493==a||43561<=a&&a<=43566||43569<=a&&a<=43570||43573<=a&&a<=43574||43587==a||43596==a||43644==a||43696==a||43698<=a&&a<=43700||43703<=a&&a<=43704||43710<=a&&a<=43711||43713==a||43756<=a&&a<=43757||43766==a||44005==a||44008==a||44013==a||64286==a||65024<=a&&a<=65039||65056<=a&&a<=65071||65438<=a&&a<=65439||66045==a||66272==a||66422<=a&&a<=66426||68097<=a&&a<=68099||68101<=a&&a<=68102||68108<=a&&a<=68111||68152<=a&&a<=68154||68159==a||68325<=a&&a<=68326||69633==a||69688<=a&&a<=69702||69759<=a&&a<=69761||69811<=a&&a<=69814||69817<=a&&a<=69818||69888<=a&&a<=69890||69927<=a&&a<=69931||69933<=a&&a<=69940||70003==a||70016<=a&&a<=70017||70070<=a&&a<=70078||70090<=a&&a<=70092||70191<=a&&a<=70193||70196==a||70198<=a&&a<=70199||70206==a||70367==a||70371<=a&&a<=70378||70400<=a&&a<=70401||70460==a||70462==a||70464==a||70487==a||70502<=a&&a<=70508||70512<=a&&a<=70516||70712<=a&&a<=70719||70722<=a&&a<=70724||70726==a||70832==a||70835<=a&&a<=70840||70842==a||70845==a||70847<=a&&a<=70848||70850<=a&&a<=70851||71087==a||71090<=a&&a<=71093||71100<=a&&a<=71101||71103<=a&&a<=71104||71132<=a&&a<=71133||71219<=a&&a<=71226||71229==a||71231<=a&&a<=71232||71339==a||71341==a||71344<=a&&a<=71349||71351==a||71453<=a&&a<=71455||71458<=a&&a<=71461||71463<=a&&a<=71467||72193<=a&&a<=72198||72201<=a&&a<=72202||72243<=a&&a<=72248||72251<=a&&a<=72254||72263==a||72273<=a&&a<=72278||72281<=a&&a<=72283||72330<=a&&a<=72342||72344<=a&&a<=72345||72752<=a&&a<=72758||72760<=a&&a<=72765||72767==a||72850<=a&&a<=72871||72874<=a&&a<=72880||72882<=a&&a<=72883||72885<=a&&a<=72886||73009<=a&&a<=73014||73018==a||73020<=a&&a<=73021||73023<=a&&a<=73029||73031==a||92912<=a&&a<=92916||92976<=a&&a<=92982||94095<=a&&a<=94098||113821<=a&&a<=113822||119141==a||119143<=a&&a<=119145||119150<=a&&a<=119154||119163<=a&&a<=119170||119173<=a&&a<=119179||119210<=a&&a<=119213||119362<=a&&a<=119364||121344<=a&&a<=121398||121403<=a&&a<=121452||121461==a||121476==a||121499<=a&&a<=121503||121505<=a&&a<=121519||122880<=a&&a<=122886||122888<=a&&a<=122904||122907<=a&&a<=122913||122915<=a&&a<=122916||122918<=a&&a<=122922||125136<=a&&a<=125142||125252<=a&&a<=125258||917536<=a&&a<=917631||917760<=a&&a<=917999?e:127462<=a&&a<=127487?t:2307==a||2363==a||2366<=a&&a<=2368||2377<=a&&a<=2380||2382<=a&&a<=2383||2434<=a&&a<=2435||2495<=a&&a<=2496||2503<=a&&a<=2504||2507<=a&&a<=2508||2563==a||2622<=a&&a<=2624||2691==a||2750<=a&&a<=2752||2761==a||2763<=a&&a<=2764||2818<=a&&a<=2819||2880==a||2887<=a&&a<=2888||2891<=a&&a<=2892||3007==a||3009<=a&&a<=3010||3014<=a&&a<=3016||3018<=a&&a<=3020||3073<=a&&a<=3075||3137<=a&&a<=3140||3202<=a&&a<=3203||3262==a||3264<=a&&a<=3265||3267<=a&&a<=3268||3271<=a&&a<=3272||3274<=a&&a<=3275||3330<=a&&a<=3331||3391<=a&&a<=3392||3398<=a&&a<=3400||3402<=a&&a<=3404||3458<=a&&a<=3459||3536<=a&&a<=3537||3544<=a&&a<=3550||3570<=a&&a<=3571||3635==a||3763==a||3902<=a&&a<=3903||3967==a||4145==a||4155<=a&&a<=4156||4182<=a&&a<=4183||4228==a||6070==a||6078<=a&&a<=6085||6087<=a&&a<=6088||6435<=a&&a<=6438||6441<=a&&a<=6443||6448<=a&&a<=6449||6451<=a&&a<=6456||6681<=a&&a<=6682||6741==a||6743==a||6765<=a&&a<=6770||6916==a||6965==a||6971==a||6973<=a&&a<=6977||6979<=a&&a<=6980||7042==a||7073==a||7078<=a&&a<=7079||7082==a||7143==a||7146<=a&&a<=7148||7150==a||7154<=a&&a<=7155||7204<=a&&a<=7211||7220<=a&&a<=7221||7393==a||7410<=a&&a<=7411||7415==a||43043<=a&&a<=43044||43047==a||43136<=a&&a<=43137||43188<=a&&a<=43203||43346<=a&&a<=43347||43395==a||43444<=a&&a<=43445||43450<=a&&a<=43451||43453<=a&&a<=43456||43567<=a&&a<=43568||43571<=a&&a<=43572||43597==a||43755==a||43758<=a&&a<=43759||43765==a||44003<=a&&a<=44004||44006<=a&&a<=44007||44009<=a&&a<=44010||44012==a||69632==a||69634==a||69762==a||69808<=a&&a<=69810||69815<=a&&a<=69816||69932==a||70018==a||70067<=a&&a<=70069||70079<=a&&a<=70080||70188<=a&&a<=70190||70194<=a&&a<=70195||70197==a||70368<=a&&a<=70370||70402<=a&&a<=70403||70463==a||70465<=a&&a<=70468||70471<=a&&a<=70472||70475<=a&&a<=70477||70498<=a&&a<=70499||70709<=a&&a<=70711||70720<=a&&a<=70721||70725==a||70833<=a&&a<=70834||70841==a||70843<=a&&a<=70844||70846==a||70849==a||71088<=a&&a<=71089||71096<=a&&a<=71099||71102==a||71216<=a&&a<=71218||71227<=a&&a<=71228||71230==a||71340==a||71342<=a&&a<=71343||71350==a||71456<=a&&a<=71457||71462==a||72199<=a&&a<=72200||72249==a||72279<=a&&a<=72280||72343==a||72751==a||72766==a||72873==a||72881==a||72884==a||94033<=a&&a<=94078||119142==a||119149==a?5:4352<=a&&a<=4447||43360<=a&&a<=43388?6:4448<=a&&a<=4519||55216<=a&&a<=55238?7:4520<=a&&a<=4607||55243<=a&&a<=55291?8:44032==a||44060==a||44088==a||44116==a||44144==a||44172==a||44200==a||44228==a||44256==a||44284==a||44312==a||44340==a||44368==a||44396==a||44424==a||44452==a||44480==a||44508==a||44536==a||44564==a||44592==a||44620==a||44648==a||44676==a||44704==a||44732==a||44760==a||44788==a||44816==a||44844==a||44872==a||44900==a||44928==a||44956==a||44984==a||45012==a||45040==a||45068==a||45096==a||45124==a||45152==a||45180==a||45208==a||45236==a||45264==a||45292==a||45320==a||45348==a||45376==a||45404==a||45432==a||45460==a||45488==a||45516==a||45544==a||45572==a||45600==a||45628==a||45656==a||45684==a||45712==a||45740==a||45768==a||45796==a||45824==a||45852==a||45880==a||45908==a||45936==a||45964==a||45992==a||46020==a||46048==a||46076==a||46104==a||46132==a||46160==a||46188==a||46216==a||46244==a||46272==a||46300==a||46328==a||46356==a||46384==a||46412==a||46440==a||46468==a||46496==a||46524==a||46552==a||46580==a||46608==a||46636==a||46664==a||46692==a||46720==a||46748==a||46776==a||46804==a||46832==a||46860==a||46888==a||46916==a||46944==a||46972==a||47e3==a||47028==a||47056==a||47084==a||47112==a||47140==a||47168==a||47196==a||47224==a||47252==a||47280==a||47308==a||47336==a||47364==a||47392==a||47420==a||47448==a||47476==a||47504==a||47532==a||47560==a||47588==a||47616==a||47644==a||47672==a||47700==a||47728==a||47756==a||47784==a||47812==a||47840==a||47868==a||47896==a||47924==a||47952==a||47980==a||48008==a||48036==a||48064==a||48092==a||48120==a||48148==a||48176==a||48204==a||48232==a||48260==a||48288==a||48316==a||48344==a||48372==a||48400==a||48428==a||48456==a||48484==a||48512==a||48540==a||48568==a||48596==a||48624==a||48652==a||48680==a||48708==a||48736==a||48764==a||48792==a||48820==a||48848==a||48876==a||48904==a||48932==a||48960==a||48988==a||49016==a||49044==a||49072==a||49100==a||49128==a||49156==a||49184==a||49212==a||49240==a||49268==a||49296==a||49324==a||49352==a||49380==a||49408==a||49436==a||49464==a||49492==a||49520==a||49548==a||49576==a||49604==a||49632==a||49660==a||49688==a||49716==a||49744==a||49772==a||49800==a||49828==a||49856==a||49884==a||49912==a||49940==a||49968==a||49996==a||50024==a||50052==a||50080==a||50108==a||50136==a||50164==a||50192==a||50220==a||50248==a||50276==a||50304==a||50332==a||50360==a||50388==a||50416==a||50444==a||50472==a||50500==a||50528==a||50556==a||50584==a||50612==a||50640==a||50668==a||50696==a||50724==a||50752==a||50780==a||50808==a||50836==a||50864==a||50892==a||50920==a||50948==a||50976==a||51004==a||51032==a||51060==a||51088==a||51116==a||51144==a||51172==a||51200==a||51228==a||51256==a||51284==a||51312==a||51340==a||51368==a||51396==a||51424==a||51452==a||51480==a||51508==a||51536==a||51564==a||51592==a||51620==a||51648==a||51676==a||51704==a||51732==a||51760==a||51788==a||51816==a||51844==a||51872==a||51900==a||51928==a||51956==a||51984==a||52012==a||52040==a||52068==a||52096==a||52124==a||52152==a||52180==a||52208==a||52236==a||52264==a||52292==a||52320==a||52348==a||52376==a||52404==a||52432==a||52460==a||52488==a||52516==a||52544==a||52572==a||52600==a||52628==a||52656==a||52684==a||52712==a||52740==a||52768==a||52796==a||52824==a||52852==a||52880==a||52908==a||52936==a||52964==a||52992==a||53020==a||53048==a||53076==a||53104==a||53132==a||53160==a||53188==a||53216==a||53244==a||53272==a||53300==a||53328==a||53356==a||53384==a||53412==a||53440==a||53468==a||53496==a||53524==a||53552==a||53580==a||53608==a||53636==a||53664==a||53692==a||53720==a||53748==a||53776==a||53804==a||53832==a||53860==a||53888==a||53916==a||53944==a||53972==a||54e3==a||54028==a||54056==a||54084==a||54112==a||54140==a||54168==a||54196==a||54224==a||54252==a||54280==a||54308==a||54336==a||54364==a||54392==a||54420==a||54448==a||54476==a||54504==a||54532==a||54560==a||54588==a||54616==a||54644==a||54672==a||54700==a||54728==a||54756==a||54784==a||54812==a||54840==a||54868==a||54896==a||54924==a||54952==a||54980==a||55008==a||55036==a||55064==a||55092==a||55120==a||55148==a||55176==a?9:44033<=a&&a<=44059||44061<=a&&a<=44087||44089<=a&&a<=44115||44117<=a&&a<=44143||44145<=a&&a<=44171||44173<=a&&a<=44199||44201<=a&&a<=44227||44229<=a&&a<=44255||44257<=a&&a<=44283||44285<=a&&a<=44311||44313<=a&&a<=44339||44341<=a&&a<=44367||44369<=a&&a<=44395||44397<=a&&a<=44423||44425<=a&&a<=44451||44453<=a&&a<=44479||44481<=a&&a<=44507||44509<=a&&a<=44535||44537<=a&&a<=44563||44565<=a&&a<=44591||44593<=a&&a<=44619||44621<=a&&a<=44647||44649<=a&&a<=44675||44677<=a&&a<=44703||44705<=a&&a<=44731||44733<=a&&a<=44759||44761<=a&&a<=44787||44789<=a&&a<=44815||44817<=a&&a<=44843||44845<=a&&a<=44871||44873<=a&&a<=44899||44901<=a&&a<=44927||44929<=a&&a<=44955||44957<=a&&a<=44983||44985<=a&&a<=45011||45013<=a&&a<=45039||45041<=a&&a<=45067||45069<=a&&a<=45095||45097<=a&&a<=45123||45125<=a&&a<=45151||45153<=a&&a<=45179||45181<=a&&a<=45207||45209<=a&&a<=45235||45237<=a&&a<=45263||45265<=a&&a<=45291||45293<=a&&a<=45319||45321<=a&&a<=45347||45349<=a&&a<=45375||45377<=a&&a<=45403||45405<=a&&a<=45431||45433<=a&&a<=45459||45461<=a&&a<=45487||45489<=a&&a<=45515||45517<=a&&a<=45543||45545<=a&&a<=45571||45573<=a&&a<=45599||45601<=a&&a<=45627||45629<=a&&a<=45655||45657<=a&&a<=45683||45685<=a&&a<=45711||45713<=a&&a<=45739||45741<=a&&a<=45767||45769<=a&&a<=45795||45797<=a&&a<=45823||45825<=a&&a<=45851||45853<=a&&a<=45879||45881<=a&&a<=45907||45909<=a&&a<=45935||45937<=a&&a<=45963||45965<=a&&a<=45991||45993<=a&&a<=46019||46021<=a&&a<=46047||46049<=a&&a<=46075||46077<=a&&a<=46103||46105<=a&&a<=46131||46133<=a&&a<=46159||46161<=a&&a<=46187||46189<=a&&a<=46215||46217<=a&&a<=46243||46245<=a&&a<=46271||46273<=a&&a<=46299||46301<=a&&a<=46327||46329<=a&&a<=46355||46357<=a&&a<=46383||46385<=a&&a<=46411||46413<=a&&a<=46439||46441<=a&&a<=46467||46469<=a&&a<=46495||46497<=a&&a<=46523||46525<=a&&a<=46551||46553<=a&&a<=46579||46581<=a&&a<=46607||46609<=a&&a<=46635||46637<=a&&a<=46663||46665<=a&&a<=46691||46693<=a&&a<=46719||46721<=a&&a<=46747||46749<=a&&a<=46775||46777<=a&&a<=46803||46805<=a&&a<=46831||46833<=a&&a<=46859||46861<=a&&a<=46887||46889<=a&&a<=46915||46917<=a&&a<=46943||46945<=a&&a<=46971||46973<=a&&a<=46999||47001<=a&&a<=47027||47029<=a&&a<=47055||47057<=a&&a<=47083||47085<=a&&a<=47111||47113<=a&&a<=47139||47141<=a&&a<=47167||47169<=a&&a<=47195||47197<=a&&a<=47223||47225<=a&&a<=47251||47253<=a&&a<=47279||47281<=a&&a<=47307||47309<=a&&a<=47335||47337<=a&&a<=47363||47365<=a&&a<=47391||47393<=a&&a<=47419||47421<=a&&a<=47447||47449<=a&&a<=47475||47477<=a&&a<=47503||47505<=a&&a<=47531||47533<=a&&a<=47559||47561<=a&&a<=47587||47589<=a&&a<=47615||47617<=a&&a<=47643||47645<=a&&a<=47671||47673<=a&&a<=47699||47701<=a&&a<=47727||47729<=a&&a<=47755||47757<=a&&a<=47783||47785<=a&&a<=47811||47813<=a&&a<=47839||47841<=a&&a<=47867||47869<=a&&a<=47895||47897<=a&&a<=47923||47925<=a&&a<=47951||47953<=a&&a<=47979||47981<=a&&a<=48007||48009<=a&&a<=48035||48037<=a&&a<=48063||48065<=a&&a<=48091||48093<=a&&a<=48119||48121<=a&&a<=48147||48149<=a&&a<=48175||48177<=a&&a<=48203||48205<=a&&a<=48231||48233<=a&&a<=48259||48261<=a&&a<=48287||48289<=a&&a<=48315||48317<=a&&a<=48343||48345<=a&&a<=48371||48373<=a&&a<=48399||48401<=a&&a<=48427||48429<=a&&a<=48455||48457<=a&&a<=48483||48485<=a&&a<=48511||48513<=a&&a<=48539||48541<=a&&a<=48567||48569<=a&&a<=48595||48597<=a&&a<=48623||48625<=a&&a<=48651||48653<=a&&a<=48679||48681<=a&&a<=48707||48709<=a&&a<=48735||48737<=a&&a<=48763||48765<=a&&a<=48791||48793<=a&&a<=48819||48821<=a&&a<=48847||48849<=a&&a<=48875||48877<=a&&a<=48903||48905<=a&&a<=48931||48933<=a&&a<=48959||48961<=a&&a<=48987||48989<=a&&a<=49015||49017<=a&&a<=49043||49045<=a&&a<=49071||49073<=a&&a<=49099||49101<=a&&a<=49127||49129<=a&&a<=49155||49157<=a&&a<=49183||49185<=a&&a<=49211||49213<=a&&a<=49239||49241<=a&&a<=49267||49269<=a&&a<=49295||49297<=a&&a<=49323||49325<=a&&a<=49351||49353<=a&&a<=49379||49381<=a&&a<=49407||49409<=a&&a<=49435||49437<=a&&a<=49463||49465<=a&&a<=49491||49493<=a&&a<=49519||49521<=a&&a<=49547||49549<=a&&a<=49575||49577<=a&&a<=49603||49605<=a&&a<=49631||49633<=a&&a<=49659||49661<=a&&a<=49687||49689<=a&&a<=49715||49717<=a&&a<=49743||49745<=a&&a<=49771||49773<=a&&a<=49799||49801<=a&&a<=49827||49829<=a&&a<=49855||49857<=a&&a<=49883||49885<=a&&a<=49911||49913<=a&&a<=49939||49941<=a&&a<=49967||49969<=a&&a<=49995||49997<=a&&a<=50023||50025<=a&&a<=50051||50053<=a&&a<=50079||50081<=a&&a<=50107||50109<=a&&a<=50135||50137<=a&&a<=50163||50165<=a&&a<=50191||50193<=a&&a<=50219||50221<=a&&a<=50247||50249<=a&&a<=50275||50277<=a&&a<=50303||50305<=a&&a<=50331||50333<=a&&a<=50359||50361<=a&&a<=50387||50389<=a&&a<=50415||50417<=a&&a<=50443||50445<=a&&a<=50471||50473<=a&&a<=50499||50501<=a&&a<=50527||50529<=a&&a<=50555||50557<=a&&a<=50583||50585<=a&&a<=50611||50613<=a&&a<=50639||50641<=a&&a<=50667||50669<=a&&a<=50695||50697<=a&&a<=50723||50725<=a&&a<=50751||50753<=a&&a<=50779||50781<=a&&a<=50807||50809<=a&&a<=50835||50837<=a&&a<=50863||50865<=a&&a<=50891||50893<=a&&a<=50919||50921<=a&&a<=50947||50949<=a&&a<=50975||50977<=a&&a<=51003||51005<=a&&a<=51031||51033<=a&&a<=51059||51061<=a&&a<=51087||51089<=a&&a<=51115||51117<=a&&a<=51143||51145<=a&&a<=51171||51173<=a&&a<=51199||51201<=a&&a<=51227||51229<=a&&a<=51255||51257<=a&&a<=51283||51285<=a&&a<=51311||51313<=a&&a<=51339||51341<=a&&a<=51367||51369<=a&&a<=51395||51397<=a&&a<=51423||51425<=a&&a<=51451||51453<=a&&a<=51479||51481<=a&&a<=51507||51509<=a&&a<=51535||51537<=a&&a<=51563||51565<=a&&a<=51591||51593<=a&&a<=51619||51621<=a&&a<=51647||51649<=a&&a<=51675||51677<=a&&a<=51703||51705<=a&&a<=51731||51733<=a&&a<=51759||51761<=a&&a<=51787||51789<=a&&a<=51815||51817<=a&&a<=51843||51845<=a&&a<=51871||51873<=a&&a<=51899||51901<=a&&a<=51927||51929<=a&&a<=51955||51957<=a&&a<=51983||51985<=a&&a<=52011||52013<=a&&a<=52039||52041<=a&&a<=52067||52069<=a&&a<=52095||52097<=a&&a<=52123||52125<=a&&a<=52151||52153<=a&&a<=52179||52181<=a&&a<=52207||52209<=a&&a<=52235||52237<=a&&a<=52263||52265<=a&&a<=52291||52293<=a&&a<=52319||52321<=a&&a<=52347||52349<=a&&a<=52375||52377<=a&&a<=52403||52405<=a&&a<=52431||52433<=a&&a<=52459||52461<=a&&a<=52487||52489<=a&&a<=52515||52517<=a&&a<=52543||52545<=a&&a<=52571||52573<=a&&a<=52599||52601<=a&&a<=52627||52629<=a&&a<=52655||52657<=a&&a<=52683||52685<=a&&a<=52711||52713<=a&&a<=52739||52741<=a&&a<=52767||52769<=a&&a<=52795||52797<=a&&a<=52823||52825<=a&&a<=52851||52853<=a&&a<=52879||52881<=a&&a<=52907||52909<=a&&a<=52935||52937<=a&&a<=52963||52965<=a&&a<=52991||52993<=a&&a<=53019||53021<=a&&a<=53047||53049<=a&&a<=53075||53077<=a&&a<=53103||53105<=a&&a<=53131||53133<=a&&a<=53159||53161<=a&&a<=53187||53189<=a&&a<=53215||53217<=a&&a<=53243||53245<=a&&a<=53271||53273<=a&&a<=53299||53301<=a&&a<=53327||53329<=a&&a<=53355||53357<=a&&a<=53383||53385<=a&&a<=53411||53413<=a&&a<=53439||53441<=a&&a<=53467||53469<=a&&a<=53495||53497<=a&&a<=53523||53525<=a&&a<=53551||53553<=a&&a<=53579||53581<=a&&a<=53607||53609<=a&&a<=53635||53637<=a&&a<=53663||53665<=a&&a<=53691||53693<=a&&a<=53719||53721<=a&&a<=53747||53749<=a&&a<=53775||53777<=a&&a<=53803||53805<=a&&a<=53831||53833<=a&&a<=53859||53861<=a&&a<=53887||53889<=a&&a<=53915||53917<=a&&a<=53943||53945<=a&&a<=53971||53973<=a&&a<=53999||54001<=a&&a<=54027||54029<=a&&a<=54055||54057<=a&&a<=54083||54085<=a&&a<=54111||54113<=a&&a<=54139||54141<=a&&a<=54167||54169<=a&&a<=54195||54197<=a&&a<=54223||54225<=a&&a<=54251||54253<=a&&a<=54279||54281<=a&&a<=54307||54309<=a&&a<=54335||54337<=a&&a<=54363||54365<=a&&a<=54391||54393<=a&&a<=54419||54421<=a&&a<=54447||54449<=a&&a<=54475||54477<=a&&a<=54503||54505<=a&&a<=54531||54533<=a&&a<=54559||54561<=a&&a<=54587||54589<=a&&a<=54615||54617<=a&&a<=54643||54645<=a&&a<=54671||54673<=a&&a<=54699||54701<=a&&a<=54727||54729<=a&&a<=54755||54757<=a&&a<=54783||54785<=a&&a<=54811||54813<=a&&a<=54839||54841<=a&&a<=54867||54869<=a&&a<=54895||54897<=a&&a<=54923||54925<=a&&a<=54951||54953<=a&&a<=54979||54981<=a&&a<=55007||55009<=a&&a<=55035||55037<=a&&a<=55063||55065<=a&&a<=55091||55093<=a&&a<=55119||55121<=a&&a<=55147||55149<=a&&a<=55175||55177<=a&&a<=55203?10:9757==a||9977==a||9994<=a&&a<=9997||127877==a||127938<=a&&a<=127940||127943==a||127946<=a&&a<=127948||128066<=a&&a<=128067||128070<=a&&a<=128080||128110==a||128112<=a&&a<=128120||128124==a||128129<=a&&a<=128131||128133<=a&&a<=128135||128170==a||128372<=a&&a<=128373||128378==a||128400==a||128405<=a&&a<=128406||128581<=a&&a<=128583||128587<=a&&a<=128591||128675==a||128692<=a&&a<=128694||128704==a||128716==a||129304<=a&&a<=129308||129310<=a&&a<=129311||129318==a||129328<=a&&a<=129337||129341<=a&&a<=129342||129489<=a&&a<=129501?n:127995<=a&&a<=127999?14:8205==a?15:9792==a||9794==a||9877<=a&&a<=9878||9992==a||10084==a||127752==a||127806==a||127859==a||127891==a||127908==a||127912==a||127979==a||127981==a||128139==a||128187<=a&&a<=128188||128295==a||128300==a||128488==a||128640==a||128658==a?r:128102<=a&&a<=128105?o:11}return this.nextBreak=function(e,t){if(void 0===t&&(t=0),t<0)return 0;if(t>=e.length-1)return e.length;for(var i,n,r=c(a(e,t)),o=[],l=t+1;l<e.length;l++)if(n=l-1,!(55296<=(i=e).charCodeAt(n)&&i.charCodeAt(n)<=56319&&56320<=i.charCodeAt(n+1)&&i.charCodeAt(n+1)<=57343)){var u=c(a(e,l));if(s(r,o,u))return l;o.push(u)}return e.length},this.splitGraphemes=function(e){for(var t,i=[],n=0;(t=this.nextBreak(e,n))<e.length;)i.push(e.slice(n,t)),n=t;return n<e.length&&i.push(e.slice(n)),i},this.iterateGraphemes=function(e){var t=0,i={next:function(){var i,n;return(n=this.nextBreak(e,t))<e.length?(i=e.slice(t,n),t=n,{value:i,done:!1}):t<e.length?(i=e.slice(t),t=e.length,{value:i,done:!1}):{value:void 0,done:!0}}.bind(this)};return"undefined"!=typeof Symbol&&Symbol.iterator&&(i[Symbol.iterator]=function(){return i}),i},this.countGraphemes=function(e){for(var t,i=0,n=0;(t=this.nextBreak(e,n))<e.length;)n=t,i++;return n<e.length&&i++,i},this})}));function Glyph(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function GlyphTextureInfo(e,t,i){this.labelCollection=e,this.index=t,this.dimensions=i}const defaultLineSpacingPercent=1.2,whitePixelCanvasId="ID_WHITE_PIXEL",whitePixelSize=new Cartesian2(4,4),whitePixelBoundingRegion=new BoundingRectangle(1,1,1,1);function addWhitePixelCanvas(e,t){const i=document.createElement("canvas");i.width=whitePixelSize.x,i.height=whitePixelSize.y;const n=i.getContext("2d");return n.fillStyle="#fff",n.fillRect(0,0,i.width,i.height),e.addImage(whitePixelCanvasId,i).then((function(e){t._whitePixelIndex=e}))}const writeTextToCanvasParameters={};function createGlyphCanvas(e,t,i,n,r,o,a){return writeTextToCanvasParameters.font=t,writeTextToCanvasParameters.fillColor=i,writeTextToCanvasParameters.strokeColor=n,writeTextToCanvasParameters.strokeWidth=r,writeTextToCanvasParameters.padding=SDFSettings$1.PADDING,a===VerticalOrigin$1.CENTER?writeTextToCanvasParameters.textBaseline="middle":a===VerticalOrigin$1.TOP?writeTextToCanvasParameters.textBaseline="top":writeTextToCanvasParameters.textBaseline="bottom",writeTextToCanvasParameters.fill=o===LabelStyle$1.FILL||o===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.stroke=o===LabelStyle$1.OUTLINE||o===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.backgroundColor=Color.BLACK,writeTextToCanvas(e,writeTextToCanvasParameters)}function unbindGlyph(e,t){t.textureInfo=void 0,t.dimensions=void 0;const i=t.billboard;defined(i)&&(i.show=!1,i.image=void 0,defined(i._removeCallbackFunc)&&(i._removeCallbackFunc(),i._removeCallbackFunc=void 0),e._spareBillboards.push(i),t.billboard=void 0)}function addGlyphToTextureAtlas(e,t,i,n){n.index=e.addImageSync(t,i)}const splitter=new graphemeSplitter;function rebindAllGlyphs(e,t){const i=t._renderedText,n=splitter.splitGraphemes(i),r=n.length,o=t._glyphs,a=o.length;let s,c,l;if(t._relativeSize=t._fontSize/SDFSettings$1.FONT_SIZE,r<a)for(c=r;c<a;++c)unbindGlyph(e,o[c]);o.length=r;const u=t._showBackground&&i.split("\n").join("").length>0;let d=t._backgroundBillboard;const h=e._backgroundBillboardCollection;u?(defined(d)||(d=h.add({collection:e,image:whitePixelCanvasId,imageSubRegion:whitePixelBoundingRegion}),t._backgroundBillboard=d),d.color=t._backgroundColor,d.show=t._show,d.position=t._position,d.eyeOffset=t._eyeOffset,d.pixelOffset=t._pixelOffset,d.horizontalOrigin=HorizontalOrigin$1.LEFT,d.verticalOrigin=t._verticalOrigin,d.heightReference=t._heightReference,d.scale=t.totalScale,d.pickPrimitive=t,d.id=t._id,d.translucencyByDistance=t._translucencyByDistance,d.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,d.scaleByDistance=t._scaleByDistance,d.distanceDisplayCondition=t._distanceDisplayCondition,d.disableDepthTestDistance=t._disableDepthTestDistance):defined(d)&&(h.remove(d),t._backgroundBillboard=d=void 0);const p=e._glyphTextureCache;for(l=0;l<r;++l){const i=n[l],r=t._verticalOrigin,a=JSON.stringify([i,t._fontFamily,t._fontStyle,t._fontWeight,+r]);let c=p[a];if(!defined(c)){const n=createGlyphCanvas(i,`${t._fontStyle} ${t._fontWeight} ${SDFSettings$1.FONT_SIZE}px ${t._fontFamily}`,Color.WHITE,Color.WHITE,0,LabelStyle$1.FILL,r);if(c=new GlyphTextureInfo(e,-1,n.dimensions),p[a]=c,n.width>0&&n.height>0){const t=bitmapSdf(n,{cutoff:SDFSettings$1.CUTOFF,radius:SDFSettings$1.RADIUS}),r=n.getContext("2d"),o=n.width,s=n.height,l=r.getImageData(0,0,o,s);for(let e=0;e<o;e++)for(let i=0;i<s;i++){const n=i*o+e,r=255*t[n],a=4*n;l.data[a+0]=r,l.data[a+1]=r,l.data[a+2]=r,l.data[a+3]=r}r.putImageData(l,0,0)," "!==i&&addGlyphToTextureAtlas(e._textureAtlas,a,n,c)}}if(s=o[l],defined(s)?-1===c.index?unbindGlyph(e,s):defined(s.textureInfo)&&(s.textureInfo=void 0):(s=new Glyph,o[l]=s),s.textureInfo=c,s.dimensions=c.dimensions,-1!==c.index){let i=s.billboard;const n=e._spareBillboards;defined(i)||(n.length>0?i=n.pop():(i=e._billboardCollection.add({collection:e}),i._labelDimensions=new Cartesian2,i._labelTranslate=new Cartesian2),s.billboard=i),i.show=t._show,i.position=t._position,i.eyeOffset=t._eyeOffset,i.pixelOffset=t._pixelOffset,i.horizontalOrigin=HorizontalOrigin$1.LEFT,i.verticalOrigin=t._verticalOrigin,i.heightReference=t._heightReference,i.scale=t.totalScale,i.pickPrimitive=t,i.id=t._id,i.image=a,i.translucencyByDistance=t._translucencyByDistance,i.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,i.scaleByDistance=t._scaleByDistance,i.distanceDisplayCondition=t._distanceDisplayCondition,i.disableDepthTestDistance=t._disableDepthTestDistance,i._batchIndex=t._batchIndex,i.outlineColor=t.outlineColor,t.style===LabelStyle$1.FILL_AND_OUTLINE?(i.color=t._fillColor,i.outlineWidth=t.outlineWidth):t.style===LabelStyle$1.FILL?(i.color=t._fillColor,i.outlineWidth=0):t.style===LabelStyle$1.OUTLINE&&(i.color=Color.TRANSPARENT,i.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function calculateWidthOffset(e,t,i){return t===HorizontalOrigin$1.CENTER?-e/2:t===HorizontalOrigin$1.RIGHT?-(e+i.x):i.x}const glyphPixelOffset=new Cartesian2,scratchBackgroundPadding=new Cartesian2;function repositionAllGlyphs(e){const t=e._glyphs,i=e._renderedText;let n,r,o=0,a=0;const s=[];let c,l=Number.NEGATIVE_INFINITY,u=0,d=1;const h=t.length,p=e._backgroundBillboard,f=Cartesian2.clone(defined(p)?e._backgroundPadding:Cartesian2.ZERO,scratchBackgroundPadding);for(f.x/=e._relativeSize,f.y/=e._relativeSize,c=0;c<h;++c)"\n"===i.charAt(c)?(s.push(o),++d,o=0):(n=t[c],r=n.dimensions,u=Math.max(u,r.height-r.descent),l=Math.max(l,r.descent),o+=r.width-r.minx,c<h-1&&(o+=t[c+1].dimensions.minx),a=Math.max(a,o));s.push(o);const m=u+l,g=e.totalScale,_=e._horizontalOrigin,y=e._verticalOrigin;let C=0,T=s[C],S=calculateWidthOffset(T,_,f);const v=(defined(e._lineHeight)?e._lineHeight:defaultLineSpacingPercent*e._fontSize)/e._relativeSize,A=v*(d-1);let E=a,b=m+A;defined(p)&&(E+=2*f.x,b+=2*f.y,p._labelHorizontalOrigin=_),glyphPixelOffset.x=S*g,glyphPixelOffset.y=0;let x=!0,P=0;for(c=0;c<h;++c)if("\n"===i.charAt(c))++C,P+=v,T=s[C],S=calculateWidthOffset(T,_,f),glyphPixelOffset.x=S*g,x=!0;else if(n=t[c],r=n.dimensions,y===VerticalOrigin$1.TOP?(glyphPixelOffset.y=r.height-u-f.y,glyphPixelOffset.y+=SDFSettings$1.PADDING):y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(A+r.height-u)/2:y===VerticalOrigin$1.BASELINE?(glyphPixelOffset.y=A,glyphPixelOffset.y-=SDFSettings$1.PADDING):(glyphPixelOffset.y=A+l+f.y,glyphPixelOffset.y-=SDFSettings$1.PADDING),glyphPixelOffset.y=(glyphPixelOffset.y-r.descent-P)*g,x&&(glyphPixelOffset.x-=SDFSettings$1.PADDING*g,x=!1),defined(n.billboard)&&(n.billboard._setTranslate(glyphPixelOffset),n.billboard._labelDimensions.x=E,n.billboard._labelDimensions.y=b,n.billboard._labelHorizontalOrigin=_),c<h-1){const e=t[c+1];glyphPixelOffset.x+=(r.width-r.minx+e.dimensions.minx)*g}if(defined(p)&&i.split("\n").join("").length>0&&(S=_===HorizontalOrigin$1.CENTER?-a/2-f.x:_===HorizontalOrigin$1.RIGHT?-(a+2*f.x):0,glyphPixelOffset.x=S*g,y===VerticalOrigin$1.TOP?glyphPixelOffset.y=m-u-l:y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(m-u)/2-l:y===VerticalOrigin$1.BASELINE?glyphPixelOffset.y=-f.y-l:glyphPixelOffset.y=0,glyphPixelOffset.y=glyphPixelOffset.y*g,p.width=E,p.height=b,p._setTranslate(glyphPixelOffset),p._labelTranslate=Cartesian2.clone(glyphPixelOffset,p._labelTranslate)),e.heightReference===HeightReference$1.CLAMP_TO_GROUND)for(c=0;c<h;++c){n=t[c];const e=n.billboard;defined(e)&&(e._labelTranslate=Cartesian2.clone(glyphPixelOffset,e._labelTranslate))}}function destroyLabel(e,t){const i=t._glyphs;for(let t=0,n=i.length;t<n;++t)unbindGlyph(e,i[t]);defined(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,defined(t._removeCallbackFunc)&&t._removeCallbackFunc(),destroyObject(t)}function LabelCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._whitePixelIndex=void 0,this._backgroundBillboardCollection=new BillboardCollection({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._backgroundImageReady=!0,this._billboardCollection=new BillboardCollection({scene:this._scene,batchTable:this._batchTable}),this._billboardCollection.destroyTextureAtlas=!1,this._billboardCollection._sdf=!0,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=Color.clone(Color.WHITE),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(LabelCollection.prototype,{length:{get:function(){return this._labels.length}}}),LabelCollection.prototype.add=function(e){const t=new Label(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},LabelCollection.prototype.remove=function(e){if(defined(e)&&e._labelCollection===this){const t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),destroyLabel(this,e),!0}return!1},LabelCollection.prototype.removeAll=function(){const e=this._labels;for(let t=0,i=e.length;t<i;++t)destroyLabel(this,e[t]);e.length=0},LabelCollection.prototype.contains=function(e){return defined(e)&&e._labelCollection===this},LabelCollection.prototype.get=function(e){return this._labels[e]},LabelCollection.prototype.update=function(e){if(!this.show)return;const t=this._billboardCollection,i=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,i.modelMatrix=this.modelMatrix,i.debugShowBoundingVolume=this.debugShowBoundingVolume;const n=e.context;defined(this._textureAtlas)||(this._textureAtlas=new TextureAtlas({context:n}),t.textureAtlas=this._textureAtlas);const r=this;if(defined(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new TextureAtlas({context:n,initialSize:whitePixelSize}),i.textureAtlas=this._backgroundTextureAtlas,r._backgroundImageReady=!1,addWhitePixelCanvas(this._backgroundTextureAtlas,this).then((function(){r._backgroundImageReady=!0}))),!this._backgroundImageReady)return;const o=this._labelsToUpdate.length;for(let e=0;e<o;++e){const t=this._labelsToUpdate[e];if(t.isDestroyed())continue;const i=t._glyphs.length;t._rebindAllGlyphs&&(rebindAllGlyphs(this,t),t._rebindAllGlyphs=!1),t._repositionAllGlyphs&&(repositionAllGlyphs(t),t._repositionAllGlyphs=!1);const n=t._glyphs.length-i;this._totalGlyphCount+=n}const a=i.length>0?BlendOption$1.TRANSLUCENT:this.blendOption;t.blendOption=a,i.blendOption=a,t._highlightColor=this._highlightColor,i._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,i.update(e),t.update(e)},LabelCollection.prototype.isDestroyed=function(){return!1},LabelCollection.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),this._backgroundTextureAtlas=this._backgroundTextureAtlas&&this._backgroundTextureAtlas.destroy(),destroyObject(this)};var PolylineVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandAndBatchIndex;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 v_pickColor;\nvarying float v_polylineAngle;\nvoid main()\n{\nfloat texCoord = texCoordExpandAndBatchIndex.x;\nfloat expandDir = texCoordExpandAndBatchIndex.y;\nbool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\nfloat batchTableIndex = texCoordExpandAndBatchIndex.w;\nvec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\nfloat width = widthAndShow.x + 0.5;\nfloat show = widthAndShow.y;\nif (width < 1.0)\n{\nshow = 0.0;\n}\nvec4 pickColor = batchTable_getPickColor(batchTableIndex);\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\n#ifdef DISTANCE_DISPLAY_CONDITION\nvec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\nvec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\nvec3 centerLow = centerLowAndRadius.xyz;\nfloat radius = centerLowAndRadius.w;\nvec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nvec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\nlengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n}\nfloat nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\nfloat farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\nshow = 0.0;\n}\n#endif\nfloat polylineAngle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st.s = texCoord;\nv_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);\nv_width = width;\nv_pickColor = pickColor;\nv_polylineAngle = polylineAngle;\n}\n";function Polyline(e,t){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._show=defaultValue(e.show,!0),this._width=defaultValue(e.width,1),this._loop=defaultValue(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,defined(this._material)||(this._material=Material$4.fromType(Material$4.ColorType,{color:new Color(1,1,1,1)}));let i,n=e.positions;defined(n)||(n=[]),this._positions=n,this._actualPositions=arrayRemoveDuplicates(n,Cartesian3.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(Cartesian3.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id,defined(t)&&(i=Matrix4.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$3),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new BoundingSphere}const POSITION_INDEX$5=Polyline.POSITION_INDEX=0,SHOW_INDEX$5=Polyline.SHOW_INDEX=1,WIDTH_INDEX$1=Polyline.WIDTH_INDEX=2,MATERIAL_INDEX$1=Polyline.MATERIAL_INDEX=3,POSITION_SIZE_INDEX$1=Polyline.POSITION_SIZE_INDEX=4,DISTANCE_DISPLAY_CONDITION$1=Polyline.DISTANCE_DISPLAY_CONDITION=5,NUMBER_OF_PROPERTIES$3=Polyline.NUMBER_OF_PROPERTIES=6;function makeDirty$2(e,t){++e._propertiesChanged[t];const i=e._polylineCollection;defined(i)&&(i._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(Polyline.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,makeDirty$2(this,SHOW_INDEX$5))}},positions:{get:function(){return this._positions},set:function(e){let t=arrayRemoveDuplicates(e,Cartesian3.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(Cartesian3.clone(t[0]))),this._actualPositions.length===t.length&&this._actualPositions.length===this._length||makeDirty$2(this,POSITION_SIZE_INDEX$1),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),makeDirty$2(this,POSITION_INDEX$5),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,makeDirty$2(this,MATERIAL_INDEX$1))}},width:{get:function(){return this._width},set:function(e){e!==this._width&&(this._width=e,makeDirty$2(this,WIDTH_INDEX$1))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!Cartesian3.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(Cartesian3.clone(t[0]))):t.length>2&&Cartesian3.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,makeDirty$2(this,POSITION_SIZE_INDEX$1)}}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!defined(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$2(this,DISTANCE_DISPLAY_CONDITION$1))}}}),Polyline.prototype.update=function(){let e=Matrix4.IDENTITY;defined(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);const t=this._segments.positions.length,i=this._segments.lengths,n=this._propertiesChanged[POSITION_INDEX$5]>0||this._propertiesChanged[POSITION_SIZE_INDEX$1]>0;if(Matrix4.equals(e,this._modelMatrix)&&!n||(this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=Matrix4.clone(e,this._modelMatrix),this._segments.positions.length!==t)makeDirty$2(this,POSITION_SIZE_INDEX$1);else{const e=i.length;for(let t=0;t<e;++t)if(i[t]!==this._segments.lengths[t]){makeDirty$2(this,POSITION_SIZE_INDEX$1);break}}},Polyline.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},Polyline.prototype._clean=function(){this._dirty=!1;const e=this._propertiesChanged;for(let t=0;t<NUMBER_OF_PROPERTIES$3-1;++t)e[t]=0},Polyline.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};const SHOW_INDEX$4=Polyline.SHOW_INDEX,WIDTH_INDEX=Polyline.WIDTH_INDEX,POSITION_INDEX$4=Polyline.POSITION_INDEX,MATERIAL_INDEX=Polyline.MATERIAL_INDEX,POSITION_SIZE_INDEX=Polyline.POSITION_SIZE_INDEX,DISTANCE_DISPLAY_CONDITION=Polyline.DISTANCE_DISPLAY_CONDITION,NUMBER_OF_PROPERTIES$2=Polyline.NUMBER_OF_PROPERTIES,attributeLocations$5={texCoordExpandAndBatchIndex:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12};function PolylineCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$2),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:BufferUsage$1.STATIC_DRAW,frameCount:0},this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._texCoordExpandAndBatchIndexBuffer=void 0,this._batchTable=void 0,this._createBatchTable=!1,this._useHighlightColor=!1,this._highlightColor=Color.clone(Color.WHITE);const t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}function createBatchTable(e,t){defined(e._batchTable)&&e._batchTable.destroy();const i=[{functionName:"batchTable_getWidthAndShow",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2}];e._batchTable=new BatchTable(t,i,e._polylines.length)}Object.defineProperties(PolylineCollection.prototype,{length:{get:function(){return removePolylines(this),this._polylines.length}}}),PolylineCollection.prototype.add=function(e){const t=new Polyline(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t},PolylineCollection.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,defined(e._bucket)){const t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1},PolylineCollection.prototype.removeAll=function(){releaseShaders(this),destroyPolylines(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},PolylineCollection.prototype.contains=function(e){return defined(e)&&e._polylineCollection===this},PolylineCollection.prototype.get=function(e){return removePolylines(this),this._polylines[e]};const scratchUpdatePolylineEncodedCartesian=new EncodedCartesian3,scratchUpdatePolylineCartesian4=new Cartesian4,scratchNearFarCartesian2=new Cartesian2;PolylineCollection.prototype.update=function(e){if(removePolylines(this),0===this._polylines.length||!this.show)return;updateMode$1(this,e);const t=e.context,i=e.mapProjection;let n,r=this._propertiesChanged;if(this._createBatchTable){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");createBatchTable(this,t),this._createBatchTable=!1}if(this._createVertexArray||computeNewBuffersUsage(this))createVertexArrays(this,t,i);else if(this._polylinesUpdated){const o=this._polylinesToUpdate;if(this._mode!==SceneMode$1.SCENE3D){const e=o.length;for(let t=0;t<e;++t)n=o[t],n.update()}if(r[POSITION_SIZE_INDEX]||r[MATERIAL_INDEX])createVertexArrays(this,t,i);else{const t=o.length,a=this._polylineBuckets;for(let s=0;s<t;++s){n=o[s],r=n._propertiesChanged;const t=n._bucket;let c=0;for(const e in a)if(a.hasOwnProperty(e)){if(a[e]===t){r[POSITION_INDEX$4]&&t.writeUpdate(c,n,this._positionBuffer,i);break}c+=a[e].lengthOfPositions}if((r[SHOW_INDEX$4]||r[WIDTH_INDEX])&&this._batchTable.setBatchedAttribute(n._index,0,new Cartesian2(n._width,n._show)),this._batchTable.attributes.length>2){if(r[POSITION_INDEX$4]||r[POSITION_SIZE_INDEX]){const t=e.mode===SceneMode$1.SCENE2D?n._boundingVolume2D:n._boundingVolumeWC,i=EncodedCartesian3.fromCartesian(t.center,scratchUpdatePolylineEncodedCartesian),r=Cartesian4.fromElements(i.low.x,i.low.y,i.low.z,t.radius,scratchUpdatePolylineCartesian4);this._batchTable.setBatchedAttribute(n._index,2,i.high),this._batchTable.setBatchedAttribute(n._index,3,r)}if(r[DISTANCE_DISPLAY_CONDITION]){const e=scratchNearFarCartesian2;e.x=0,e.y=Number.MAX_VALUE;const t=n.distanceDisplayCondition;defined(t)&&(e.x=t.near,e.y=t.far),this._batchTable.setBatchedAttribute(n._index,4,e)}}n._clean()}}o.length=0,this._polylinesUpdated=!1}r=this._propertiesChanged;for(let e=0;e<NUMBER_OF_PROPERTIES$2;++e)r[e]=0;let o=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D&&(o=this.modelMatrix);const a=e.passes,s=0!==e.morphTime;if(defined(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===s||(this._opaqueRS=RenderState.fromCache({depthMask:s,depthTest:{enabled:s}})),defined(this._translucentRS)&&this._translucentRS.depthTest.enabled===s||(this._translucentRS=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!s,depthTest:{enabled:s}})),this._batchTable.update(e),a.render||a.pick){createCommandLists(this,e,this._colorCommands,o)}};const boundingSphereScratch$2=new BoundingSphere,boundingSphereScratch2=new BoundingSphere;function createCommandLists(e,t,i,n){const r=t.context,o=t.commandList,a=i.length;let s=0,c=!0;const l=e._vertexArrays,u=e.debugShowBoundingVolume,d=e._batchTable.getUniformMapCallback(),h=l.length;for(let p=0;p<h;++p){const h=l[p],f=h.buckets,m=f.length;for(let l=0;l<m;++l){const p=f[l];let m=p.offset;const g=p.bucket.shaderProgram,_=p.bucket.polylines,y=_.length;let C,T,S,v,A=0;for(let l=0;l<y;++l){const f=_[l],y=createMaterialId(f._material);if(y!==C){if(defined(C)&&A>0){const t=T.isTranslucent();s>=a?(S=new DrawCommand({owner:e}),i.push(S)):S=i[s],++s,v=combine$2(d(T._uniforms),e._uniformMap),S.boundingVolume=BoundingSphere.clone(boundingSphereScratch$2,S.boundingVolume),S.modelMatrix=n,S.shaderProgram=g,S.vertexArray=h.va,S.renderState=t?e._translucentRS:e._opaqueRS,S.pass=t?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,S.debugShowBoundingVolume=u,S.pickId="v_pickColor",S.uniformMap=v,S.count=A,S.offset=m,m+=A,A=0,c=!0,o.push(S)}T=f._material,T.update(r),C=y}const E=f._locatorBuckets,b=E.length;for(let e=0;e<b;++e){const t=E[e];t.locator===p&&(A+=t.count)}let x;t.mode===SceneMode$1.SCENE3D?x=f._boundingVolumeWC:t.mode===SceneMode$1.COLUMBUS_VIEW?x=f._boundingVolume2D:t.mode===SceneMode$1.SCENE2D?defined(f._boundingVolume2D)&&(x=BoundingSphere.clone(f._boundingVolume2D,boundingSphereScratch2),x.center.x=0):defined(f._boundingVolumeWC)&&defined(f._boundingVolume2D)&&(x=BoundingSphere.union(f._boundingVolumeWC,f._boundingVolume2D,boundingSphereScratch2)),c?(c=!1,BoundingSphere.clone(x,boundingSphereScratch$2)):BoundingSphere.union(x,boundingSphereScratch$2,boundingSphereScratch$2)}defined(C)&&A>0&&(s>=a?(S=new DrawCommand({owner:e}),i.push(S)):S=i[s],++s,v=combine$2(d(T._uniforms),e._uniformMap),S.boundingVolume=BoundingSphere.clone(boundingSphereScratch$2,S.boundingVolume),S.modelMatrix=n,S.shaderProgram=g,S.vertexArray=h.va,S.renderState=T.isTranslucent()?e._translucentRS:e._opaqueRS,S.pass=T.isTranslucent()?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,S.debugShowBoundingVolume=u,S.pickId="v_pickColor",S.uniformMap=v,S.count=A,S.offset=m,c=!0,o.push(S)),C=void 0}}i.length=s}function computeNewBuffersUsage(e){let t=!1;const i=e._propertiesChanged,n=e._positionBufferUsage;return i[POSITION_INDEX$4]?n.bufferUsage!==BufferUsage$1.STREAM_DRAW?(t=!0,n.bufferUsage=BufferUsage$1.STREAM_DRAW,n.frameCount=100):n.frameCount=100:n.bufferUsage!==BufferUsage$1.STATIC_DRAW&&(0===n.frameCount?(t=!0,n.bufferUsage=BufferUsage$1.STATIC_DRAW):n.frameCount--),t}PolylineCollection.prototype.isDestroyed=function(){return!1},PolylineCollection.prototype.destroy=function(){return destroyVertexArrays(this),releaseShaders(this),destroyPolylines(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};const emptyVertexBuffer=[0,0,0];function createVertexArrays(e,t,i){e._createVertexArray=!1,releaseShaders(e),destroyVertexArrays(e),sortPolylinesIntoBuckets(e);const n=[[]];let r=n[0];const o=e._batchTable,a=e._useHighlightColor,s=[0];let c=0;const l=[[]];let u=0;const d=e._polylineBuckets;let h,p;for(h in d)d.hasOwnProperty(h)&&(p=d[h],p.updateShader(t,o,a),u+=p.lengthOfPositions);if(u>0){const a=e._mode,f=new Float32Array(6*u*3),m=new Float32Array(4*u);let g,_=0,y=0,C=0;for(h in d)if(d.hasOwnProperty(h)){p=d[h],p.write(f,m,_,y,C,o,t,i),a===SceneMode$1.MORPHING&&(defined(g)||(g=new Float32Array(6*u*3)),p.writeForMorph(g,_));const e=p.lengthOfPositions;_+=6*e*3,y+=4*e,C+=4*e,c=p.updateIndices(n,s,l,c)}const T=e._positionBufferUsage.bufferUsage,S=BufferUsage$1.STATIC_DRAW;let v;e._positionBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:f,usage:T}),defined(g)&&(v=Buffer$1.createVertexBuffer({context:t,typedArray:g,usage:T})),e._texCoordExpandAndBatchIndexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:m,usage:S});const A=3*Float32Array.BYTES_PER_ELEMENT,E=4*Float32Array.BYTES_PER_ELEMENT;let b=0;const x=n.length;for(let i=0;i<x;++i)if(r=n[i],r.length>0){const n=new Uint16Array(r),o=Buffer$1.createIndexBuffer({context:t,typedArray:n,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});b+=s[i];const c=6*(i*(A*CesiumMath.SIXTY_FOUR_KILOBYTES)-b*A),u=A+c,d=A+u,h=A+d,p=A+h,f=A+p,m=i*(E*CesiumMath.SIXTY_FOUR_KILOBYTES)-b*E,g=[{index:attributeLocations$5.position3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:c,strideInBytes:6*A},{index:attributeLocations$5.position3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:u,strideInBytes:6*A},{index:attributeLocations$5.position2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:c,strideInBytes:6*A},{index:attributeLocations$5.position2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:u,strideInBytes:6*A},{index:attributeLocations$5.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:d,strideInBytes:6*A},{index:attributeLocations$5.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:h,strideInBytes:6*A},{index:attributeLocations$5.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:d,strideInBytes:6*A},{index:attributeLocations$5.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:h,strideInBytes:6*A},{index:attributeLocations$5.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:p,strideInBytes:6*A},{index:attributeLocations$5.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:f,strideInBytes:6*A},{index:attributeLocations$5.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:p,strideInBytes:6*A},{index:attributeLocations$5.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:f,strideInBytes:6*A},{index:attributeLocations$5.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:m}];let _,y,C,T;a===SceneMode$1.SCENE3D?(y=e._positionBuffer,_="vertexBuffer",C=emptyVertexBuffer,T="value"):a===SceneMode$1.SCENE2D||a===SceneMode$1.COLUMBUS_VIEW?(y=emptyVertexBuffer,_="value",C=e._positionBuffer,T="vertexBuffer"):(y=v,_="vertexBuffer",C=e._positionBuffer,T="vertexBuffer"),g[0][_]=y,g[1][_]=y,g[2][T]=C,g[3][T]=C,g[4][_]=y,g[5][_]=y,g[6][T]=C,g[7][T]=C,g[8][_]=y,g[9][_]=y,g[10][T]=C,g[11][T]=C;const S=new VertexArray({context:t,attributes:g,indexBuffer:o});e._vertexArrays.push({va:S,buckets:l[i]})}}}function replacer(e,t){return t instanceof Texture?t.id:t}const scratchUniformArray=[];function createMaterialId(e){const t=Material$4._uniformList[e.type],i=t.length;scratchUniformArray.length=2*i;let n=0;for(let r=0;r<i;++r){const i=t[r];scratchUniformArray[n]=i,scratchUniformArray[n+1]=e._uniforms[i](),n+=2}return`${e.type}:${JSON.stringify(scratchUniformArray,replacer)}`}function sortPolylinesIntoBuckets(e){const t=e._mode,i=e._modelMatrix,n=e._polylineBuckets={},r=e._polylines,o=r.length;for(let e=0;e<o;++e){const o=r[e];if(o._actualPositions.length>1){o.update();const e=o.material;let r=n[e.type];defined(r)||(r=n[e.type]=new PolylineBucket(e,t,i)),r.addPolyline(o)}}}function updateMode$1(e,t){const i=t.mode;e._mode===i&&Matrix4.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=Matrix4.clone(e.modelMatrix),e._createVertexArray=!0)}function removePolylines(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;const t=[],i=[];let n,r=0;const o=e._polylines.length;for(let a=0;a<o;++a)n=e._polylines[a],n.isDestroyed||(n._index=r++,i.push(n),t.push(n));e._polylines=t,e._polylinesToUpdate=i}}function releaseShaders(e){const t=e._polylines,i=t.length;for(let e=0;e<i;++e)if(!t[e].isDestroyed){const i=t[e]._bucket;defined(i)&&(i.shaderProgram=i.shaderProgram&&i.shaderProgram.destroy())}}function destroyVertexArrays(e){const t=e._vertexArrays.length;for(let i=0;i<t;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function destroyPolylines(e){const t=e._polylines,i=t.length;for(let e=0;e<i;++e)t[e].isDestroyed||t[e]._destroy()}function VertexArrayBucketLocator(e,t,i){this.count=e,this.offset=t,this.bucket=i}function PolylineBucket(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=i}function intersectsIDL(e){return Cartesian3.dot(Cartesian3.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Plane.ORIGIN_ZX_PLANE)===Intersect$1.INTERSECTING}PolylineCollection.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},PolylineBucket.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},PolylineBucket.prototype.updateShader=function(e,t,i){if(defined(this.shaderProgram))return;const n=["DISTANCE_DISPLAY_CONDITION"];i&&n.push("VECTOR_TILE"),-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&n.push("POLYLINE_DASH"),FeatureDetection.isInternetExplorer()||n.push("CLIP_POLYLINE");const r=new ShaderSource({defines:n,sources:["varying vec4 v_pickColor;\n",this.material.shaderSource,PolylineFS$1]}),o=t.getVertexShaderCallback()(PolylineVS),a=new ShaderSource({defines:n,sources:[PolylineCommon,o]});this.shaderProgram=ShaderProgram.fromCache({context:e,vertexShaderSource:a,fragmentShaderSource:r,attributeLocations:attributeLocations$5})},PolylineBucket.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===SceneMode$1.SCENE3D||!intersectsIDL(e))return t=e._actualPositions.length,4*t-4;let i=0;const n=e._segments.lengths;t=n.length;for(let e=0;e<t;++e)i+=4*n[e]-4;return i};const scratchWritePosition=new Cartesian3,scratchWritePrevPosition=new Cartesian3,scratchWriteNextPosition=new Cartesian3,scratchWriteVector=new Cartesian3,scratchPickColorCartesian=new Cartesian4,scratchWidthShowCartesian=new Cartesian2;PolylineBucket.prototype.write=function(e,t,i,n,r,o,a,s){const c=this.mode,l=s.ellipsoid.maximumRadius*CesiumMath.PI,u=this.polylines,d=u.length;for(let n=0;n<d;++n){const d=u[n],h=d.width,p=d.show&&h>0,f=d._index,m=this.getSegments(d,s),g=m.positions,_=m.lengths,y=g.length,C=d.getPickId(a).color;let T,S=0,v=0;for(let n=0;n<y;++n){0===n?d._loop?T=g[y-2]:(T=scratchWriteVector,Cartesian3.subtract(g[0],g[1],T),Cartesian3.add(g[0],T,T)):T=g[n-1],Cartesian3.clone(T,scratchWritePrevPosition),Cartesian3.clone(g[n],scratchWritePosition),n===y-1?d._loop?T=g[1]:(T=scratchWriteVector,Cartesian3.subtract(g[y-1],g[y-2],T),Cartesian3.add(g[y-1],T,T)):T=g[n+1],Cartesian3.clone(T,scratchWriteNextPosition);const o=_[S];n===v+o&&(v+=o,++S);const a=n-v==0,s=n===v+_[S]-1;c===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),c!==SceneMode$1.SCENE2D&&c!==SceneMode$1.MORPHING||(a||s)&&l-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&scratchWritePrevPosition.x>0||scratchWritePosition.x>0&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&scratchWriteNextPosition.x>0||scratchWritePosition.x>0&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));const u=s?2:4;for(let o=a?2:0;o<u;++o){EncodedCartesian3.writeElements(scratchWritePosition,e,i),EncodedCartesian3.writeElements(scratchWritePrevPosition,e,i+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,e,i+12);const a=o-2<0?-1:1;t[r]=n/(y-1),t[r+1]=o%2*2-1,t[r+2]=a,t[r+3]=f,i+=18,r+=4}}const A=scratchPickColorCartesian;A.x=Color.floatToByte(C.red),A.y=Color.floatToByte(C.green),A.z=Color.floatToByte(C.blue),A.w=Color.floatToByte(C.alpha);const E=scratchWidthShowCartesian;E.x=h,E.y=p?1:0;const b=c===SceneMode$1.SCENE2D?d._boundingVolume2D:d._boundingVolumeWC,x=EncodedCartesian3.fromCartesian(b.center,scratchUpdatePolylineEncodedCartesian),P=x.high,D=Cartesian4.fromElements(x.low.x,x.low.y,x.low.z,b.radius,scratchUpdatePolylineCartesian4),w=scratchNearFarCartesian2;w.x=0,w.y=Number.MAX_VALUE;const M=d.distanceDisplayCondition;defined(M)&&(w.x=M.near,w.y=M.far),o.setBatchedAttribute(f,0,E),o.setBatchedAttribute(f,1,A),o.attributes.length>2&&(o.setBatchedAttribute(f,2,P),o.setBatchedAttribute(f,3,D),o.setBatchedAttribute(f,4,w))}};const morphPositionScratch=new Cartesian3,morphPrevPositionScratch=new Cartesian3,morphNextPositionScratch=new Cartesian3,morphVectorScratch=new Cartesian3;PolylineBucket.prototype.writeForMorph=function(e,t){const i=this.modelMatrix,n=this.polylines,r=n.length;for(let o=0;o<r;++o){const r=n[o],a=r._segments.positions,s=r._segments.lengths,c=a.length;let l=0,u=0;for(let n=0;n<c;++n){let o;0===n?r._loop?o=a[c-2]:(o=morphVectorScratch,Cartesian3.subtract(a[0],a[1],o),Cartesian3.add(a[0],o,o)):o=a[n-1],o=Matrix4.multiplyByPoint(i,o,morphPrevPositionScratch);const d=Matrix4.multiplyByPoint(i,a[n],morphPositionScratch);let h;n===c-1?r._loop?h=a[1]:(h=morphVectorScratch,Cartesian3.subtract(a[c-1],a[c-2],h),Cartesian3.add(a[c-1],h,h)):h=a[n+1],h=Matrix4.multiplyByPoint(i,h,morphNextPositionScratch);const p=s[l];n===u+p&&(u+=p,++l);const f=n-u==0,m=n===u+s[l]-1?2:4;for(let i=f?2:0;i<m;++i)EncodedCartesian3.writeElements(d,e,t),EncodedCartesian3.writeElements(o,e,t+6),EncodedCartesian3.writeElements(h,e,t+12),t+=18}}};const scratchSegmentLengths=new Array(1);PolylineBucket.prototype.updateIndices=function(e,t,i,n){let r=i.length-1,o=new VertexArrayBucketLocator(0,n,this);i[r].push(o);let a=0,s=e[e.length-1],c=0;s.length>0&&(c=s[s.length-1]+1);const l=this.polylines,u=l.length;for(let d=0;d<u;++d){const u=l[d];let h;if(u._locatorBuckets=[],this.mode===SceneMode$1.SCENE3D){h=scratchSegmentLengths;const e=u._actualPositions.length;if(!(e>0))continue;h[0]=e}else h=u._segments.lengths;const p=h.length;if(p>0){let l=0;for(let d=0;d<p;++d){const p=h[d]-1;for(let d=0;d<p;++d)c+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(u._locatorBuckets.push({locator:o,count:l}),l=0,t.push(4),s=[],e.push(s),c=0,o.count=a,a=0,n=0,o=new VertexArrayBucketLocator(0,0,this),i[++r]=[o]),s.push(c,c+2,c+1),s.push(c+1,c+2,c+3),l+=6,a+=6,n+=6,c+=4}u._locatorBuckets.push({locator:o,count:l}),c+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(0),s=[],e.push(s),c=0,o.count=a,n=0,a=0,o=new VertexArrayBucketLocator(0,0,this),i[++r]=[o])}u._clean()}return o.count=a,n},PolylineBucket.prototype.getPolylineStartIndex=function(e){const t=this.polylines;let i=0;const n=t.length;for(let r=0;r<n;++r){const n=t[r];if(n===e)break;i+=n._actualLength}return i};const scratchSegments={positions:void 0,lengths:void 0},scratchLengths=new Array(1),pscratch=new Cartesian3,scratchCartographic$b=new Cartographic;let scratchPositionsArray;function Vector3DTilePoints(e){this._positions=e.positions,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._rectangle=e.rectangle,this._minHeight=e.minimumHeight,this._maxHeight=e.maximumHeight,this._billboardCollection=void 0,this._labelCollection=void 0,this._polylineCollection=void 0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._readyPromise=defer(),this._resolvedPromise=!1}function packBuffer$3(e,t){const i=e._rectangle,n=e._minHeight,r=e._maxHeight,o=2+Rectangle.packedLength+Ellipsoid.packedLength,a=new Float64Array(o);let s=0;return a[s++]=n,a[s++]=r,Rectangle.pack(i,a,s),s+=Rectangle.packedLength,Ellipsoid.pack(t,a,s),a}PolylineBucket.prototype.getSegments=function(e,t){let i=e._actualPositions;if(this.mode===SceneMode$1.SCENE3D)return scratchLengths[0]=i.length,scratchSegments.positions=i,scratchSegments.lengths=scratchLengths,scratchSegments;intersectsIDL(e)&&(i=e._segments.positions);const n=t.ellipsoid,r=[],o=this.modelMatrix,a=i.length;let s,c=pscratch;for(let e=0;e<a;++e)s=i[e],c=Matrix4.multiplyByPoint(o,s,c),r.push(t.project(n.cartesianToCartographic(c,scratchCartographic$b)));if(r.length>0){e._boundingVolume2D=BoundingSphere.fromPoints(r,e._boundingVolume2D);const t=e._boundingVolume2D.center;e._boundingVolume2D.center=new Cartesian3(t.z,t.x,t.y)}return scratchSegments.positions=r,scratchSegments.lengths=e._segments.lengths,scratchSegments},PolylineBucket.prototype.writeUpdate=function(e,t,i,n){const r=this.mode,o=n.ellipsoid.maximumRadius*CesiumMath.PI;let a=t._actualLength;if(a){e+=this.getPolylineStartIndex(t);let s=scratchPositionsArray;const c=6*a*3;!defined(s)||s.length<c?s=scratchPositionsArray=new Float32Array(c):s.length>c&&(s=new Float32Array(s.buffer,0,c));const l=this.getSegments(t,n),u=l.positions,d=l.lengths;let h,p=0,f=0,m=0;a=u.length;for(let e=0;e<a;++e){0===e?t._loop?h=u[a-2]:(h=scratchWriteVector,Cartesian3.subtract(u[0],u[1],h),Cartesian3.add(u[0],h,h)):h=u[e-1],Cartesian3.clone(h,scratchWritePrevPosition),Cartesian3.clone(u[e],scratchWritePosition),e===a-1?t._loop?h=u[1]:(h=scratchWriteVector,Cartesian3.subtract(u[a-1],u[a-2],h),Cartesian3.add(u[a-1],h,h)):h=u[e+1],Cartesian3.clone(h,scratchWriteNextPosition);const i=d[f];e===m+i&&(m+=i,++f);const n=e-m==0,c=e===m+d[f]-1;r===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),r!==SceneMode$1.SCENE2D&&r!==SceneMode$1.MORPHING||(n||c)&&o-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&scratchWritePrevPosition.x>0||scratchWritePosition.x>0&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&scratchWriteNextPosition.x>0||scratchWritePosition.x>0&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));const l=c?2:4;for(let e=n?2:0;e<l;++e)EncodedCartesian3.writeElements(scratchWritePosition,s,p),EncodedCartesian3.writeElements(scratchWritePrevPosition,s,p+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,s,p+12),p+=18}i.copyFromArrayView(s,18*Float32Array.BYTES_PER_ELEMENT*e)}},Object.defineProperties(Vector3DTilePoints.prototype,{pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){return this._billboardCollection.textureAtlas.texture.sizeInBytes+this._labelCollection._textureAtlas.texture.sizeInBytes}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor$3=new TaskProcessor("createVectorTilePoints",5),scratchPosition$6=new Cartesian3;function createPoints(e,t){if(defined(e._billboardCollection))return;let i;if(!defined(e._verticesPromise)){i=e._positions;let n=e._packedBuffer;defined(n)||(i=e._positions=arraySlice(i),e._batchIds=arraySlice(e._batchIds),n=e._packedBuffer=packBuffer$3(e,t));const r=[i.buffer,n.buffer],o={positions:i.buffer,packedBuffer:n.buffer},a=e._verticesPromise=createVerticesTaskProcessor$3.scheduleTask(o,r);if(!defined(a))return;a.then((function(t){e._positions=new Float64Array(t.positions),e._ready=!0}))}if(e._ready&&!defined(e._billboardCollection)){i=e._positions;const t=e._batchTable,n=e._batchIds,r=e._billboardCollection=new BillboardCollection({batchTable:t}),o=e._labelCollection=new LabelCollection({batchTable:t}),a=e._polylineCollection=new PolylineCollection;a._useHighlightColor=!0;const s=i.length/3;for(let e=0;e<s;++e){const t=n[e],s=Cartesian3.unpack(i,3*e,scratchPosition$6),c=r.add();c.position=s,c._batchIndex=t;const l=o.add();l.text=" ",l.position=s,l._batchIndex=t;a.add().positions=[Cartesian3.clone(s),Cartesian3.clone(s)]}e._positions=void 0,e._packedBuffer=void 0}}function clearStyle$2(e,t){const i=e._batchIds,n=i.length;for(let e=0;e<n;++e){const n=t[i[e]];n.show=!0,n.pointSize=Cesium3DTilePointFeature.defaultPointSize,n.color=Cesium3DTilePointFeature.defaultColor,n.pointOutlineColor=Cesium3DTilePointFeature.defaultPointOutlineColor,n.pointOutlineWidth=Cesium3DTilePointFeature.defaultPointOutlineWidth,n.labelColor=Color.WHITE,n.labelOutlineColor=Color.WHITE,n.labelOutlineWidth=1,n.font="30px sans-serif",n.labelStyle=LabelStyle$1.FILL,n.labelText=void 0,n.backgroundColor=new Color(.165,.165,.165,.8),n.backgroundPadding=new Cartesian2(7,5),n.backgroundEnabled=!1,n.scaleByDistance=void 0,n.translucencyByDistance=void 0,n.distanceDisplayCondition=void 0,n.heightOffset=0,n.anchorLineEnabled=!1,n.anchorLineColor=Color.WHITE,n.image=void 0,n.disableDepthTestDistance=0,n.horizontalOrigin=HorizontalOrigin$1.CENTER,n.verticalOrigin=VerticalOrigin$1.CENTER,n.labelHorizontalOrigin=HorizontalOrigin$1.RIGHT,n.labelVerticalOrigin=VerticalOrigin$1.BASELINE}}Vector3DTilePoints.prototype.createFeatures=function(e,t){const i=this._billboardCollection,n=this._labelCollection,r=this._polylineCollection,o=this._batchIds,a=o.length;for(let s=0;s<a;++s){const a=o[s],c=i.get(s),l=n.get(s),u=r.get(s);t[a]=new Cesium3DTilePointFeature(e,a,c,l,u)}},Vector3DTilePoints.prototype.applyDebugSettings=function(e,t){e?(Color.clone(t,this._billboardCollection._highlightColor),Color.clone(t,this._labelCollection._highlightColor),Color.clone(t,this._polylineCollection._highlightColor)):(Color.clone(Color.WHITE,this._billboardCollection._highlightColor),Color.clone(Color.WHITE,this._labelCollection._highlightColor),Color.clone(Color.WHITE,this._polylineCollection._highlightColor))};const scratchColor$i=new Color,scratchColor2=new Color,scratchColor3=new Color,scratchColor4=new Color,scratchColor5=new Color,scratchColor6=new Color,scratchScaleByDistance=new NearFarScalar,scratchTranslucencyByDistance=new NearFarScalar,scratchDistanceDisplayCondition=new DistanceDisplayCondition;function Vector3DTilePolygons(e){this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._counts=e.counts,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._batchedPositions=void 0,this._transferrableBatchIds=void 0,this._vertexBatchIds=void 0,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=defaultValue(e.center,Cartesian3.ZERO),this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._readyPromise=defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer$2(e){const t=new Float64Array(3+Cartesian3.packedLength+Ellipsoid.packedLength+Rectangle.packedLength);let i=0;return t[i++]=e._indices.BYTES_PER_ELEMENT,t[i++]=e._minimumHeight,t[i++]=e._maximumHeight,Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,Rectangle.pack(e._rectangle,t,i),t}function unpackBuffer(e,t){let i=1;const n=t[i++],r=e._boundingVolumes=new Array(n);for(let e=0;e<n;++e)r[e]=OrientedBoundingBox.unpack(t,i),i+=OrientedBoundingBox.packedLength;const o=t[i++],a=e._batchedIndices=new Array(o);for(let e=0;e<o;++e){const n=Color.unpack(t,i);i+=Color.packedLength;const r=t[i++],o=t[i++],s=t[i++],c=new Array(s);for(let e=0;e<s;++e)c[e]=t[i++];a[e]=new Vector3DTileBatch({color:n,offset:r,count:o,batchIds:c})}}Vector3DTilePoints.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle$2(this,t);const i=this._batchIds,n=i.length;for(let r=0;r<n;++r){const n=t[i[r]];if(defined(e.show)&&(n.show=e.show.evaluate(n)),defined(e.pointSize)&&(n.pointSize=e.pointSize.evaluate(n)),defined(e.color)&&(n.color=e.color.evaluateColor(n,scratchColor$i)),defined(e.pointOutlineColor)&&(n.pointOutlineColor=e.pointOutlineColor.evaluateColor(n,scratchColor2)),defined(e.pointOutlineWidth)&&(n.pointOutlineWidth=e.pointOutlineWidth.evaluate(n)),defined(e.labelColor)&&(n.labelColor=e.labelColor.evaluateColor(n,scratchColor3)),defined(e.labelOutlineColor)&&(n.labelOutlineColor=e.labelOutlineColor.evaluateColor(n,scratchColor4)),defined(e.labelOutlineWidth)&&(n.labelOutlineWidth=e.labelOutlineWidth.evaluate(n)),defined(e.font)&&(n.font=e.font.evaluate(n)),defined(e.labelStyle)&&(n.labelStyle=e.labelStyle.evaluate(n)),defined(e.labelText)?n.labelText=e.labelText.evaluate(n):n.labelText=void 0,defined(e.backgroundColor)&&(n.backgroundColor=e.backgroundColor.evaluateColor(n,scratchColor5)),defined(e.backgroundPadding)&&(n.backgroundPadding=e.backgroundPadding.evaluate(n)),defined(e.backgroundEnabled)&&(n.backgroundEnabled=e.backgroundEnabled.evaluate(n)),defined(e.scaleByDistance)){const t=e.scaleByDistance.evaluate(n);scratchScaleByDistance.near=t.x,scratchScaleByDistance.nearValue=t.y,scratchScaleByDistance.far=t.z,scratchScaleByDistance.farValue=t.w,n.scaleByDistance=scratchScaleByDistance}else n.scaleByDistance=void 0;if(defined(e.translucencyByDistance)){const t=e.translucencyByDistance.evaluate(n);scratchTranslucencyByDistance.near=t.x,scratchTranslucencyByDistance.nearValue=t.y,scratchTranslucencyByDistance.far=t.z,scratchTranslucencyByDistance.farValue=t.w,n.translucencyByDistance=scratchTranslucencyByDistance}else n.translucencyByDistance=void 0;if(defined(e.distanceDisplayCondition)){const t=e.distanceDisplayCondition.evaluate(n);scratchDistanceDisplayCondition.near=t.x,scratchDistanceDisplayCondition.far=t.y,n.distanceDisplayCondition=scratchDistanceDisplayCondition}else n.distanceDisplayCondition=void 0;defined(e.heightOffset)&&(n.heightOffset=e.heightOffset.evaluate(n)),defined(e.anchorLineEnabled)&&(n.anchorLineEnabled=e.anchorLineEnabled.evaluate(n)),defined(e.anchorLineColor)&&(n.anchorLineColor=e.anchorLineColor.evaluateColor(n,scratchColor6)),defined(e.image)?n.image=e.image.evaluate(n):n.image=void 0,defined(e.disableDepthTestDistance)&&(n.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(n)),defined(e.horizontalOrigin)&&(n.horizontalOrigin=e.horizontalOrigin.evaluate(n)),defined(e.verticalOrigin)&&(n.verticalOrigin=e.verticalOrigin.evaluate(n)),defined(e.labelHorizontalOrigin)&&(n.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(n)),defined(e.labelVerticalOrigin)&&(n.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(n))}},Vector3DTilePoints.prototype.update=function(e){createPoints(this,e.mapProjection.ellipsoid),this._ready&&(this._polylineCollection.update(e),this._billboardCollection.update(e),this._labelCollection.update(e),this._resolvedPromise||(this._readyPromise.resolve(),this._resolvedPromise=!0))},Vector3DTilePoints.prototype.isDestroyed=function(){return!1},Vector3DTilePoints.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._polylineCollection=this._polylineCollection&&this._polylineCollection.destroy(),destroyObject(this)},Object.defineProperties(Vector3DTilePolygons.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor$2=new TaskProcessor("createVectorTilePolygons",5),scratchColor$h=new Color;function createPrimitive(e){if(!defined(e._primitive)){if(!defined(e._verticesPromise)){let t=e._positions,i=e._counts,n=e._indexCounts,r=e._indices,o=e._transferrableBatchIds,a=e._batchTableColors,s=e._packedBuffer;if(!defined(a)){t=e._positions=arraySlice(e._positions),i=e._counts=arraySlice(e._counts),n=e._indexCounts=arraySlice(e._indexCounts),r=e._indices=arraySlice(e._indices),e._center=e._ellipsoid.cartographicToCartesian(Rectangle.center(e._rectangle)),o=e._transferrableBatchIds=new Uint32Array(e._batchIds),a=e._batchTableColors=new Uint32Array(o.length);const c=e._batchTable,l=a.length;for(let e=0;e<l;++e){const t=c.getColor(e,scratchColor$h);a[e]=t.toRgba()}s=e._packedBuffer=packBuffer$2(e)}const c=[t.buffer,i.buffer,n.buffer,r.buffer,o.buffer,a.buffer,s.buffer],l={packedBuffer:s.buffer,positions:t.buffer,counts:i.buffer,indexCounts:n.buffer,indices:r.buffer,batchIds:o.buffer,batchTableColors:a.buffer};let u=e._polygonMinimumHeights,d=e._polygonMaximumHeights;defined(u)&&defined(d)&&(u=arraySlice(u),d=arraySlice(d),c.push(u.buffer,d.buffer),l.minimumHeights=u,l.maximumHeights=d);const h=e._verticesPromise=createVerticesTaskProcessor$2.scheduleTask(l,c);if(!defined(h))return;h.then((function(t){e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;const i=new Float64Array(t.packedBuffer),n=i[0];unpackBuffer(e,i),e._indices=2===IndexDatatype$1.getSizeInBytes(n)?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._batchedPositions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.batchIds),e._ready=!0}))}e._ready&&!defined(e._primitive)&&(e._primitive=new Vector3DTilePrimitive({batchTable:e._batchTable,positions:e._batchedPositions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center}),e._batchTable=void 0,e._batchIds=void 0,e._positions=void 0,e._counts=void 0,e._indices=void 0,e._indexCounts=void 0,e._indexOffsets=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0,e._center=void 0,e._rectangle=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._verticesPromise=void 0,e._readyPromise.resolve())}}Vector3DTilePolygons.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTilePolygons.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTilePolygons.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTilePolygons.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTilePolygons.prototype.update=function(e){createPrimitive(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTilePolygons.prototype.isDestroyed=function(){return!1},Vector3DTilePolygons.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var Vector3DTilePolylinesVS="attribute vec4 currentPosition;\nattribute vec4 previousPosition;\nattribute vec4 nextPosition;\nattribute vec2 expandAndWidth;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelView;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = u_modifiedModelView * currentPosition;\nvec4 prev = u_modifiedModelView * previousPosition;\nvec4 next = u_modifiedModelView * nextPosition;\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n";function Vector3DTilePolylines(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._readyPromise=defer(),this._verticesPromise=void 0}function packBuffer$1(e){const t=e._rectangle,i=e._minimumHeight,n=e._maximumHeight,r=e._ellipsoid,o=e._center,a=2+Rectangle.packedLength+Ellipsoid.packedLength+Cartesian3.packedLength,s=new Float64Array(a);let c=0;return s[c++]=i,s[c++]=n,Rectangle.pack(t,s,c),c+=Rectangle.packedLength,Ellipsoid.pack(r,s,c),c+=Ellipsoid.packedLength,Cartesian3.pack(o,s,c),s}Object.defineProperties(Vector3DTilePolylines.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor$1=new TaskProcessor("createVectorTilePolylines",5),attributeLocations$4={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function createVertexArray$2(e,t){if(!defined(e._va)){if(!defined(e._verticesPromise)){let t=e._positions,i=e._widths,n=e._counts,r=e._transferrableBatchIds,o=e._packedBuffer;defined(o)||(t=e._positions=arraySlice(t),i=e._widths=arraySlice(i),n=e._counts=arraySlice(n),r=e._transferrableBatchIds=arraySlice(e._batchIds),o=e._packedBuffer=packBuffer$1(e));const a=[t.buffer,i.buffer,n.buffer,r.buffer,o.buffer],s={positions:t.buffer,widths:i.buffer,counts:n.buffer,batchIds:r.buffer,packedBuffer:o.buffer,keepDecodedPositions:e._keepDecodedPositions},c=e._verticesPromise=createVerticesTaskProcessor$1.scheduleTask(s,a);if(!defined(c))return;c.then((function(t){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(t.decodedPositions),e._decodedPositionOffsets=new Uint32Array(t.decodedPositionOffsets)),e._currentPositions=new Float32Array(t.currentPositions),e._previousPositions=new Float32Array(t.previousPositions),e._nextPositions=new Float32Array(t.nextPositions),e._expandAndWidth=new Float32Array(t.expandAndWidth),e._vertexBatchIds=new Uint16Array(t.batchIds);const i=t.indexDatatype;e._indices=i===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(t.indices):new Uint32Array(t.indices),e._ready=!0})).catch((function(t){e._readyPromise.reject(t)}))}if(e._ready&&!defined(e._va)){const i=e._currentPositions,n=e._previousPositions,r=e._nextPositions,o=e._expandAndWidth,a=e._vertexBatchIds,s=e._indices;let c=n.byteLength+i.byteLength+r.byteLength;c+=o.byteLength+a.byteLength+s.byteLength,e._trianglesLength=s.length/3,e._geometryByteLength=c;const l=Buffer$1.createVertexBuffer({context:t,typedArray:n,usage:BufferUsage$1.STATIC_DRAW}),u=Buffer$1.createVertexBuffer({context:t,typedArray:i,usage:BufferUsage$1.STATIC_DRAW}),d=Buffer$1.createVertexBuffer({context:t,typedArray:r,usage:BufferUsage$1.STATIC_DRAW}),h=Buffer$1.createVertexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW}),p=Buffer$1.createVertexBuffer({context:t,typedArray:a,usage:BufferUsage$1.STATIC_DRAW}),f=Buffer$1.createIndexBuffer({context:t,typedArray:s,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:2===s.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),m=[{index:attributeLocations$4.previousPosition,vertexBuffer:l,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.currentPosition,vertexBuffer:u,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.nextPosition,vertexBuffer:d,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.expandAndWidth,vertexBuffer:h,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2},{index:attributeLocations$4.a_batchId,vertexBuffer:p,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:m,indexBuffer:f}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._currentPositions=void 0,e._previousPositions=void 0,e._nextPositions=void 0,e._expandAndWidth=void 0,e._vertexBatchIds=void 0,e._indices=void 0,e._readyPromise.resolve()}}}const modifiedModelViewScratch$2=new Matrix4,rtcScratch$2=new Cartesian3;function createUniformMap$3(e,t){defined(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const i=t.uniformState.view;return Matrix4.clone(i,modifiedModelViewScratch$2),Matrix4.multiplyByPoint(modifiedModelViewScratch$2,e._center,rtcScratch$2),Matrix4.setTranslation(modifiedModelViewScratch$2,rtcScratch$2,modifiedModelViewScratch$2),modifiedModelViewScratch$2},u_highlightColor:function(){return e._highlightColor}})}function createRenderStates$2(e){if(defined(e._rs))return;e._rs=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:{enabled:!0,factor:-5,units:-5}})}const PolylineFS="uniform vec4 u_highlightColor; \nvoid main()\n{\n gl_FragColor = u_highlightColor;\n}\n";function createShaders$1(e,t){if(defined(e._sp))return;const i=e._batchTable,n=i.getVertexShaderCallback(!1,"a_batchId",void 0)(Vector3DTilePolylinesVS),r=i.getFragmentShaderCallback(!1,void 0,!1)(PolylineFS),o=new ShaderSource({defines:["VECTOR_TILE",FeatureDetection.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[PolylineCommon,n]}),a=new ShaderSource({defines:["VECTOR_TILE"],sources:[r]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:attributeLocations$4})}function queueCommands$1(e,t){if(!defined(e._command)){const t=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new DrawCommand({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:t,boundingVolume:e._boundingVolume,pass:Pass$1.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}function clearStyle$1(e,t){const i=e._batchIds,n=i.length;for(let e=0;e<n;++e){const n=t[i[e]];n.show=!0,n.color=Color.WHITE}}Vector3DTilePolylines.getPolylinePositions=function(e,t){const i=e._batchIds,n=e._decodedPositions,r=e._decodedPositionOffsets;if(!defined(i)||!defined(n))return;let o,a;const s=i.length;let c=0,l=0;for(o=0;o<s;++o)i[o]===t&&(c+=r[o+1]-r[o]);if(0===c)return;const u=new Float64Array(3*c);for(o=0;o<s;++o)if(i[o]===t){const e=r[o],t=r[o+1]-e;for(a=0;a<t;++a){const t=3*(e+a);u[l++]=n[t],u[l++]=n[t+1],u[l++]=n[t+2]}}return u},Vector3DTilePolylines.prototype.getPositions=function(e){return Vector3DTilePolylines.getPolylinePositions(this,e)},Vector3DTilePolylines.prototype.createFeatures=function(e,t){const i=this._batchIds,n=i.length;for(let r=0;r<n;++r){const n=i[r];t[n]=new Cesium3DTileFeature(e,n)}},Vector3DTilePolylines.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const scratchColor$g=new Color,DEFAULT_COLOR_VALUE$1=Color.WHITE,DEFAULT_SHOW_VALUE$1=!0;Vector3DTilePolylines.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle$1(this,t);const i=this._batchIds,n=i.length;for(let r=0;r<n;++r){const n=t[i[r]];n.color=defined(e.color)?e.color.evaluateColor(n,scratchColor$g):DEFAULT_COLOR_VALUE$1,n.show=defined(e.show)?e.show.evaluate(n):DEFAULT_SHOW_VALUE$1}},Vector3DTilePolylines.prototype.update=function(e){const t=e.context;if(createVertexArray$2(this,t),createUniformMap$3(this,t),createShaders$1(this,t),createRenderStates$2(this),!this._ready)return;const i=e.passes;(i.render||i.pick)&&queueCommands$1(this,e)},Vector3DTilePolylines.prototype.isDestroyed=function(){return!1},Vector3DTilePolylines.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),destroyObject(this)};var Vector3DTileClampedPolylinesVS="attribute vec3 startEllipsoidNormal;\nattribute vec3 endEllipsoidNormal;\nattribute vec4 startPositionAndHeight;\nattribute vec4 endPositionAndHeight;\nattribute vec4 startFaceNormalAndVertexCorner;\nattribute vec4 endFaceNormalAndHalfWidth;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelView;\nuniform vec2 u_minimumMaximumVectorHeights;\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\nvoid main()\n{\nfloat isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251);\nfloat isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd));\nvec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;\nvec3 right = normalize(cross(forward, startEllipsoidNormal));\nvec4 position = vec4(startPositionAndHeight.xyz, 1.0);\nposition.xyz += forward * isEnd;\nv_volumeUpEC = czm_normal * normalize(cross(right, forward));\nfloat offset;\nvec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);\noffset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);\noffset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;\nposition.xyz += offset * ellipsoidNormal;\nposition = u_modifiedModelView * position;\nright = czm_normal * right;\nvec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);\nscratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));\nvec3 miterPushNormal = czm_normal * normalize(scratchNormal);\noffset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position));\noffset = offset / dot(miterPushNormal, right);\nposition.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));\ngl_Position = czm_depthClamp(czm_projection * position);\nposition = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);\nvec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;\nv_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));\nv_rightPlaneEC = vec4(right, -dot(right, position.xyz));\nposition = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);\nvec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;\nv_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));\nv_halfWidth = endFaceNormalAndHalfWidth.w;\n}\n",Vector3DTileClampedPolylinesFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\nuniform vec4 u_highlightColor;\nvoid main()\n{\nfloat logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\nif (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(0.0, 0.0, 1.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);\nhalfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));\nfloat widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);\nif (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\ngl_FragColor = u_highlightColor;\nczm_writeDepthClamp();\n}\n";function Vector3DTileClampedPolylines(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new Cartesian2(ApproximateTerrainHeights._defaultMinTerrainHeight,ApproximateTerrainHeights._defaultMaxTerrainHeight),this._boundingVolume=OrientedBoundingBox.fromRectangle(e.rectangle,ApproximateTerrainHeights._defaultMinTerrainHeight,ApproximateTerrainHeights._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._readyPromise=defer(),this._verticesPromise=void 0;const t=this;ApproximateTerrainHeights.initialize().then((function(){updateMinimumMaximumHeights(t,t._rectangle,t._ellipsoid)})).catch((function(e){this._readyPromise.reject(e)}))}function updateMinimumMaximumHeights(e,t,i){const n=ApproximateTerrainHeights.getMinimumMaximumHeights(t,i),r=n.minimumTerrainHeight,o=n.maximumTerrainHeight,a=e._minimumMaximumVectorHeights;a.x=r,a.y=o;const s=e._boundingVolume,c=e._rectangle;OrientedBoundingBox.fromRectangle(c,r,o,i,s)}function packBuffer(e){const t=e._rectangle,i=e._minimumHeight,n=e._maximumHeight,r=e._ellipsoid,o=e._center,a=2+Rectangle.packedLength+Ellipsoid.packedLength+Cartesian3.packedLength,s=new Float64Array(a);let c=0;return s[c++]=i,s[c++]=n,Rectangle.pack(t,s,c),c+=Rectangle.packedLength,Ellipsoid.pack(r,s,c),c+=Ellipsoid.packedLength,Cartesian3.pack(o,s,c),s}Object.defineProperties(Vector3DTileClampedPolylines.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor=new TaskProcessor("createVectorTileClampedPolylines"),attributeLocations$3={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function createVertexArray$1(e,t){if(!defined(e._va)){if(!defined(e._verticesPromise)){let t=e._positions,i=e._widths,n=e._counts,r=e._transferrableBatchIds,o=e._packedBuffer;defined(o)||(t=e._positions=arraySlice(t),i=e._widths=arraySlice(i),n=e._counts=arraySlice(n),r=e._transferrableBatchIds=arraySlice(e._batchIds),o=e._packedBuffer=packBuffer(e));const a=[t.buffer,i.buffer,n.buffer,r.buffer,o.buffer],s={positions:t.buffer,widths:i.buffer,counts:n.buffer,batchIds:r.buffer,packedBuffer:o.buffer,keepDecodedPositions:e._keepDecodedPositions},c=e._verticesPromise=createVerticesTaskProcessor.scheduleTask(s,a);if(!defined(c))return;Promise.resolve(c).then((function(t){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(t.decodedPositions),e._decodedPositionOffsets=new Uint32Array(t.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(t.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(t.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(t.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(t.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(t.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(t.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(t.vertexBatchIds);const i=t.indexDatatype;e._indices=i===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(t.indices):new Uint32Array(t.indices),e._ready=!0})).catch((function(t){e._readyPromise.reject(t)}))}if(e._ready&&!defined(e._va)){const i=e._startEllipsoidNormals,n=e._endEllipsoidNormals,r=e._startPositionAndHeights,o=e._endPositionAndHeights,a=e._startFaceNormalAndVertexCornerIds,s=e._endFaceNormalAndHalfWidths,c=e._vertexBatchIds,l=e._indices;let u=i.byteLength+n.byteLength;u+=r.byteLength+o.byteLength,u+=a.byteLength+s.byteLength,u+=c.byteLength+l.byteLength,e._trianglesLength=l.length/3,e._geometryByteLength=u;const d=Buffer$1.createVertexBuffer({context:t,typedArray:i,usage:BufferUsage$1.STATIC_DRAW}),h=Buffer$1.createVertexBuffer({context:t,typedArray:n,usage:BufferUsage$1.STATIC_DRAW}),p=Buffer$1.createVertexBuffer({context:t,typedArray:r,usage:BufferUsage$1.STATIC_DRAW}),f=Buffer$1.createVertexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW}),m=Buffer$1.createVertexBuffer({context:t,typedArray:a,usage:BufferUsage$1.STATIC_DRAW}),g=Buffer$1.createVertexBuffer({context:t,typedArray:s,usage:BufferUsage$1.STATIC_DRAW}),_=Buffer$1.createVertexBuffer({context:t,typedArray:c,usage:BufferUsage$1.STATIC_DRAW}),y=Buffer$1.createIndexBuffer({context:t,typedArray:l,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:2===l.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),C=[{index:attributeLocations$3.startEllipsoidNormal,vertexBuffer:d,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.endEllipsoidNormal,vertexBuffer:h,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.startPositionAndHeight,vertexBuffer:p,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.endPositionAndHeight,vertexBuffer:f,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.startFaceNormalAndVertexCorner,vertexBuffer:m,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.endFaceNormalAndHalfWidth,vertexBuffer:g,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.a_batchId,vertexBuffer:_,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:C,indexBuffer:y}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._startEllipsoidNormals=void 0,e._endEllipsoidNormals=void 0,e._startPositionAndHeights=void 0,e._startFaceNormalAndVertexCornerIds=void 0,e._endPositionAndHeights=void 0,e._endFaceNormalAndHalfWidths=void 0,e._vertexBatchIds=void 0,e._indices=void 0,e._readyPromise.resolve()}}}const modifiedModelViewScratch$1=new Matrix4,rtcScratch$1=new Cartesian3;function createUniformMap$2(e,t){defined(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const i=t.uniformState.view;return Matrix4.clone(i,modifiedModelViewScratch$1),Matrix4.multiplyByPoint(modifiedModelViewScratch$1,e._center,rtcScratch$1),Matrix4.setTranslation(modifiedModelViewScratch$1,rtcScratch$1,modifiedModelViewScratch$1),modifiedModelViewScratch$1},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function getRenderState(e){return RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})}function createRenderStates$1(e){defined(e._rs)||(e._rs=getRenderState(!1),e._rs3DTiles=getRenderState(!0))}function createShaders(e,t){if(defined(e._sp))return;const i=e._batchTable,n=i.getVertexShaderCallback(!1,"a_batchId",void 0)(Vector3DTileClampedPolylinesVS),r=i.getFragmentShaderCallback(!1,void 0,!0)(Vector3DTileClampedPolylinesFS),o=new ShaderSource({defines:["VECTOR_TILE",FeatureDetection.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[PolylineCommon,n]}),a=new ShaderSource({defines:["VECTOR_TILE"],sources:[r]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:attributeLocations$3})}function queueCommands(e,t){let i=e._command;if(!defined(e._command)){const t=e._batchTable.getUniformMapCallback()(e._uniformMap);i=e._command=new DrawCommand({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:t,boundingVolume:e._boundingVolume,pass:Pass$1.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const n=DrawCommand.shallowClone(i,i.derivedCommands.tileset);n.renderState=e._rs3DTiles,n.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,i.derivedCommands.tileset=n}const n=e._classificationType;n!==ClassificationType$1.TERRAIN&&n!==ClassificationType$1.BOTH||t.commandList.push(i),n!==ClassificationType$1.CESIUM_3D_TILE&&n!==ClassificationType$1.BOTH||t.commandList.push(i.derivedCommands.tileset)}function clearStyle(e,t){const i=e._batchIds,n=i.length;for(let e=0;e<n;++e){const n=t[i[e]];n.show=!0,n.color=Color.WHITE}}Vector3DTileClampedPolylines.prototype.getPositions=function(e){return Vector3DTilePolylines.getPolylinePositions(this,e)},Vector3DTileClampedPolylines.prototype.createFeatures=function(e,t){const i=this._batchIds,n=i.length;for(let r=0;r<n;++r){const n=i[r];t[n]=new Cesium3DTileFeature(e,n)}},Vector3DTileClampedPolylines.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const scratchColor$f=new Color,DEFAULT_COLOR_VALUE=Color.WHITE,DEFAULT_SHOW_VALUE=!0;function Vector3DTileContent(e,t,i,n,r){this._tileset=e,this._tile=t,this._resource=i,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._contentReadyPromise=void 0,this._readyPromise=defer(),this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,initialize$3(this,n,r)}function createColorChangedCallback(e){return function(t,i){defined(e._polygons)&&e._polygons.updateCommands(t,i)}}function getBatchIds(e,t){let i,n,r,o;const a=defaultValue(e.POLYGONS_LENGTH,0),s=defaultValue(e.POLYLINES_LENGTH,0),c=defaultValue(e.POINTS_LENGTH,0);if(a>0&&defined(e.POLYGON_BATCH_IDS)){const n=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,n,a)}if(s>0&&defined(e.POLYLINE_BATCH_IDS)){const i=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,i,s)}if(c>0&&defined(e.POINT_BATCH_IDS)){const i=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,i,c)}const l=defined(i)||defined(n)||defined(r),u=a>0&&!defined(i)||s>0&&!defined(n)||c>0&&!defined(r);if(l&&u)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!defined(i)&&!defined(n)&&!defined(r)){let e=0;if(!defined(i)&&a>0)for(i=new Uint16Array(a),o=0;o<a;++o)i[o]=e++;if(!defined(n)&&s>0)for(n=new Uint16Array(s),o=0;o<s;++o)n[o]=e++;if(!defined(r)&&c>0)for(r=new Uint16Array(c),o=0;o<c;++o)r[o]=e++}return{polygons:i,polylines:n,points:r}}Vector3DTileClampedPolylines.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle(this,t);const i=this._batchIds,n=i.length;for(let r=0;r<n;++r){const n=t[i[r]];n.color=defined(e.color)?e.color.evaluateColor(n,scratchColor$f):DEFAULT_COLOR_VALUE,n.show=defined(e.show)?e.show.evaluate(n):DEFAULT_SHOW_VALUE}},Vector3DTileClampedPolylines.prototype.update=function(e){const t=e.context;if(createVertexArray$1(this,t),createUniformMap$2(this,t),createShaders(this,t),createRenderStates$1(this),!this._ready)return;const i=e.passes;(i.render||i.pick)&&queueCommands(this,e)},Vector3DTileClampedPolylines.prototype.isDestroyed=function(){return!1},Vector3DTileClampedPolylines.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),destroyObject(this)},Object.defineProperties(Vector3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return defined(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return defined(this._polygons)&&(e+=this._polygons.trianglesLength),defined(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return defined(this._polygons)&&(e+=this._polygons.geometryByteLength),defined(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return defined(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});const sizeOfUint32=Uint32Array.BYTES_PER_ELEMENT;function createFloatingPolylines(e){return new Vector3DTilePolylines(e)}function createClampedPolylines(e){return new Vector3DTileClampedPolylines(e)}function initialize$3(e,t,i){i=defaultValue(i,0);const n=new Uint8Array(t),r=new DataView(t);i+=sizeOfUint32;const o=r.getUint32(i,!0);if(1!==o)throw new RuntimeError(`Only Vector tile version 1 is supported. Version ${o} is not.`);i+=sizeOfUint32;const a=r.getUint32(i,!0);if(i+=sizeOfUint32,0===a)return void e._readyPromise.resolve(e);const s=r.getUint32(i,!0);if(i+=sizeOfUint32,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");const c=r.getUint32(i,!0);i+=sizeOfUint32;const l=r.getUint32(i,!0);i+=sizeOfUint32;const u=r.getUint32(i,!0);i+=sizeOfUint32;const d=r.getUint32(i,!0);i+=sizeOfUint32;const h=r.getUint32(i,!0);i+=sizeOfUint32;const p=r.getUint32(i,!0);i+=sizeOfUint32;const f=r.getUint32(i,!0),m=getJsonFromTypedArray(n,i+=sizeOfUint32,s);i+=s;const g=new Uint8Array(t,i,c);let _,y;i+=c,l>0&&(_=getJsonFromTypedArray(n,i,l),i+=l,u>0&&(y=new Uint8Array(t,i,u),y=new Uint8Array(y),i+=u));const C=defaultValue(m.POLYGONS_LENGTH,0),T=defaultValue(m.POLYLINES_LENGTH,0),S=defaultValue(m.POINTS_LENGTH,0),v=C+T+S,A=new Cesium3DTileBatchTable(e,v,_,y,createColorChangedCallback(e));if(e._batchTable=A,0===v)return;const E=new Cesium3DTileFeatureTable(m,g),b=E.getGlobalProperty("REGION");if(!defined(b))throw new RuntimeError("Feature table global property: REGION must be defined");const x=Rectangle.unpack(b),P=b[4],D=b[5],w=e._tile.computedTransform;let M=E.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(M)?(M=Cartesian3.unpack(M),Matrix4.multiplyByPoint(w,M,M)):(M=Rectangle.center(x),M.height=CesiumMath.lerp(P,D,.5),M=Ellipsoid.WGS84.cartographicToCartesian(M));const I=getBatchIds(m,g);if(i+=(4-i%4)%4,C>0){E.featuresLength=C;const n=defaultValue(E.getPropertyArray("POLYGON_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),E.getPropertyArray("POLYGON_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(n))throw new RuntimeError("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const r=defaultValue(E.getPropertyArray("POLYGON_INDEX_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),E.getPropertyArray("POLYGON_INDEX_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(r))throw new RuntimeError("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const o=n.reduce((function(e,t){return e+2*t}),0),a=r.reduce((function(e,t){return e+t}),0),s=new Uint32Array(t,i,a);i+=d;const c=new Uint16Array(t,i,o);let l,u;i+=h,defined(m.POLYGON_MINIMUM_HEIGHTS)&&defined(m.POLYGON_MAXIMUM_HEIGHTS)&&(l=E.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",ComponentDatatype$1.FLOAT,1),u=E.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",ComponentDatatype$1.FLOAT,1)),e._polygons=new Vector3DTilePolygons({positions:c,counts:n,indexCounts:r,indices:s,minimumHeight:P,maximumHeight:D,polygonMinimumHeights:l,polygonMaximumHeights:u,center:M,rectangle:x,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:A,batchIds:I.polygons,modelMatrix:w})}if(T>0){E.featuresLength=T;const n=defaultValue(E.getPropertyArray("POLYLINE_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),E.getPropertyArray("POLYLINE_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(n))throw new RuntimeError("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let r=E.getPropertyArray("POLYLINE_WIDTHS",ComponentDatatype$1.UNSIGNED_SHORT,1);if(!defined(r)){r=new Uint16Array(T);for(let e=0;e<T;++e)r[e]=2}const o=n.reduce((function(e,t){return e+3*t}),0),a=new Uint16Array(t,i,o);i+=p;const s=e._tileset,c=s.examineVectorLinesFunction;if(defined(c)){examineVectorLines(decodeVectorPolylinePositions(new Uint16Array(a),x,P,D,Ellipsoid.WGS84),n,I.polylines,A,e.url,c)}let l=createFloatingPolylines;defined(s.classificationType)&&(l=createClampedPolylines),e._polylines=l({positions:a,widths:r,counts:n,batchIds:I.polylines,minimumHeight:P,maximumHeight:D,center:M,rectangle:x,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:A,classificationType:s.classificationType,keepDecodedPositions:s.vectorKeepDecodedPositions})}if(S>0){const n=new Uint16Array(t,i,3*S);i+=f,e._points=new Vector3DTilePoints({positions:n,batchIds:I.points,minimumHeight:P,maximumHeight:D,rectangle:x,batchTable:A})}}function createFeatures(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const i=new Array(t);defined(e._polygons)&&e._polygons.createFeatures(e,i),defined(e._polylines)&&e._polylines.createFeatures(e,i),defined(e._points)&&e._points.createFeatures(e,i),e._features=i}}function examineVectorLines(e,t,i,n,r,o){const a=t.length;let s=0;for(let c=0;c<a;c++){const a=3*t[c],l=e.slice(s,s+a);s+=a,o(l,i[c],r,n)}}function PropertyTable(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}Vector3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Vector3DTileContent.prototype.getFeature=function(e){return createFeatures(this),this._features[e]},Vector3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._polygons)&&this._polygons.applyDebugSettings(e,t),defined(this._polylines)&&this._polylines.applyDebugSettings(e,t),defined(this._points)&&this._points.applyDebugSettings(e,t)},Vector3DTileContent.prototype.applyStyle=function(e){createFeatures(this),defined(this._polygons)&&this._polygons.applyStyle(e,this._features),defined(this._polylines)&&this._polylines.applyStyle(e,this._features),defined(this._points)&&this._points.applyStyle(e,this._features)},Vector3DTileContent.prototype.update=function(e,t){let i=!0;if(defined(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),i=i&&this._polygons._ready),defined(this._polylines)&&(this._polylines.update(t),i=i&&this._polylines._ready),defined(this._points)&&(this._points.update(t),i=i&&this._points._ready),defined(this._batchTable)&&i&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){const e=defined(this._points)?this._points.readyPromise:void 0,t=defined(this._polygons)?this._polygons.readyPromise:void 0,i=defined(this._polylines)?this._polylines.readyPromise:void 0,n=this;this._contentReadyPromise=Promise.all([e,t,i]).then((function(){n._readyPromise.resolve(n)})).catch((function(e){n._readyPromise.reject(e)}))}},Vector3DTileContent.prototype.getPolylinePositions=function(e){const t=this._polylines;if(defined(t))return t.getPositions(e)},Vector3DTileContent.prototype.isDestroyed=function(){return!1},Vector3DTileContent.prototype.destroy=function(){return this._polygons=this._polygons&&this._polygons.destroy(),this._polylines=this._polylines&&this._polylines.destroy(),this._points=this._points&&this._points.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(PropertyTable.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(defined(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),PropertyTable.prototype.hasProperty=function(e,t){return!(!defined(this._metadataTable)||!this._metadataTable.hasProperty(t))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(t))||!(!defined(this._batchTableHierarchy)||!this._batchTableHierarchy.hasProperty(e,t)))},PropertyTable.prototype.hasPropertyBySemantic=function(e,t){return!!defined(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(t)},PropertyTable.prototype.propertyExists=function(e){return!(!defined(this._metadataTable)||!this._metadataTable.hasProperty(e))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(e))||!(!defined(this._batchTableHierarchy)||!this._batchTableHierarchy.propertyExists(e)))},PropertyTable.prototype.propertyExistsBySemantic=function(e){return!!defined(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(e)};const scratchResults=[];function PropertyTextureProperty(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).property,i=e.classProperty,n=e.textures,r=t,o=GltfLoaderUtil.createModelTextureReader({textureInfo:r,channels:reformatChannels$1(t.channels),texture:n[r.index]});this._offset=t.offset,this._scale=t.scale,this._min=t.min,this._max=t.max,this._textureReader=o,this._classProperty=i,this._extras=t.extras,this._extensions=t.extensions}function reformatChannels$1(e){return e.map((function(e){return"rgba".charAt(e)})).join("")}function PropertyTexture(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).propertyTexture,i=e.class,n=e.textures,r=t.extensions,o=t.extras,a={};if(defined(t.properties))for(const e in t.properties)t.properties.hasOwnProperty(e)&&(a[e]=new PropertyTextureProperty({property:t.properties[e],classProperty:i.properties[e],textures:n}));this._name=e.name,this._id=e.id,this._class=i,this._properties=a,this._extras=o,this._extensions=r}function PropertyAttributeProperty(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).property;e.classProperty,this._attribute=t.attribute,this._offset=t.offset,this._scale=t.scale,this._min=t.min,this._max=t.max,this._extras=t.extras,this._extensions=t.extensions}function PropertyAttribute(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).propertyAttribute,i=e.class,n={};if(defined(t.properties))for(const e in t.properties)t.properties.hasOwnProperty(e)&&(n[e]=new PropertyAttributeProperty({property:t.properties[e],classProperty:i.properties[e]}));this._name=e.name,this._id=e.id,this._class=i,this._properties=n,this._extras=t.extras,this._extensions=t.extensions}function StructuralMetadata(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._schema=e.schema;const t=e.propertyTables;this._propertyTableCount=defined(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._propertyAttributes=e.propertyAttributes,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}function parseStructuralMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,i=e.schema,n=[];if(defined(t.propertyTables))for(let r=0;r<t.propertyTables.length;r++){const o=t.propertyTables[r],a=i.classes[o.class],s=new MetadataTable({count:o.count,properties:o.properties,class:a,bufferViews:e.bufferViews});n.push(new PropertyTable({id:r,name:o.name,count:o.count,metadataTable:s,extras:o.extras,extensions:o.extensions}))}const r=[];if(defined(t.propertyTextures))for(let n=0;n<t.propertyTextures.length;n++){const o=t.propertyTextures[n];r.push(new PropertyTexture({id:n,name:o.name,propertyTexture:o,class:i.classes[o.class],textures:e.textures}))}const o=[];if(defined(t.propertyAttributes))for(let e=0;e<t.propertyAttributes.length;e++){const n=t.propertyAttributes[e];o.push(new PropertyAttribute({id:e,name:n.name,class:i.classes[n.class],propertyAttribute:n}))}return new StructuralMetadata({schema:i,propertyTables:n,propertyTextures:r,propertyAttributes:o,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function parseFeatureMetadataLegacy(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,i=e.schema;let n;const r=[];let o;if(defined(t.featureTables))for(o=Object.keys(t.featureTables).sort(),n=0;n<o.length;n++){const a=o[n],s=t.featureTables[a],c=i.classes[s.class],l=new MetadataTable({count:s.count,properties:s.properties,class:c,bufferViews:e.bufferViews});r.push(new PropertyTable({id:a,count:s.count,metadataTable:l,extras:s.extras,extensions:s.extensions}))}const a=[];if(defined(t.featureTextures))for(o=Object.keys(t.featureTextures).sort(),n=0;n<o.length;n++){const r=o[n],s=t.featureTextures[r];a.push(new PropertyTexture({id:r,propertyTexture:transcodeToPropertyTexture(s),class:i.classes[s.class],textures:e.textures}))}return new StructuralMetadata({schema:i,propertyTables:r,propertyTextures:a,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function transcodeToPropertyTexture(e){const t={class:e.class,properties:{}},i=e.properties;for(const e in i)if(i.hasOwnProperty(e)){const n=i[e],r={channels:reformatChannels(n.channels),extras:n.extras,extensions:n.extensions};t.properties[e]=combine$2(n.texture,r,!0)}return t}function reformatChannels(e){const t=e.length,i=new Array(t);for(let n=0;n<t;n++)i[n]="rgba".indexOf(e[n]);return i}function GltfStructuralMetadataLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.extension,n=e.extensionLegacy,r=e.gltfResource,o=e.baseResource,a=e.supportedImageFormats,s=e.cacheKey,c=defaultValue(e.asynchronous,!0);this._gltfResource=r,this._baseResource=o,this._gltf=t,this._extension=i,this._extensionLegacy=n,this._supportedImageFormats=a,this._cacheKey=s,this._asynchronous=c,this._bufferViewLoaders=[],this._textureLoaders=[],this._schemaLoader=void 0,this._structuralMetadata=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=defer()}function gatherBufferViewIdsFromProperties(e,t){for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],r=n.values,o=n.arrayOffsets,a=n.stringOffsets;defined(r)&&(t[r]=!0),defined(o)&&(t[o]=!0),defined(a)&&(t[a]=!0)}}function gatherBufferViewIdsFromPropertiesLegacy(e,t){for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],r=n.bufferView,o=n.arrayOffsetBufferView,a=n.stringOffsetBufferView;defined(r)&&(t[r]=!0),defined(o)&&(t[o]=!0),defined(a)&&(t[a]=!0)}}function gatherUsedBufferViewIds(e){const t=e.propertyTables,i={};if(defined(t))for(let e=0;e<t.length;e++){gatherBufferViewIdsFromProperties(t[e].properties,i)}return i}function gatherUsedBufferViewIdsLegacy(e){const t=e.featureTables,i={};if(defined(t))for(const e in t)if(t.hasOwnProperty(e)){const n=t[e].properties;defined(n)&&gatherBufferViewIdsFromPropertiesLegacy(n,i)}return i}function loadBufferViews(e){let t;t=defined(e._extension)?gatherUsedBufferViewIds(e._extension):gatherUsedBufferViewIdsLegacy(e._extensionLegacy);const i=[],n={};for(const r in t)if(t.hasOwnProperty(r)){const t=ResourceCache.loadBufferView({gltf:e._gltf,bufferViewId:parseInt(r),gltfResource:e._gltfResource,baseResource:e._baseResource});i.push(t.promise),e._bufferViewLoaders.push(t),n[r]=t}return Promise.all(i).then((function(){const t={};for(const e in n)if(n.hasOwnProperty(e)){const i=n[e],r=new Uint8Array(i.typedArray);t[e]=r}return unloadBufferViews$1(e),t}))}function gatherUsedTextureIds(e){const t={},i=e.propertyTextures;if(defined(i))for(let e=0;e<i.length;e++){const n=i[e].properties;defined(n)&&gatherTextureIdsFromProperties(n,t)}return t}function gatherTextureIdsFromProperties(e,t){for(const i in e)if(e.hasOwnProperty(i)){const n=e[i];t[n.index]=n}}function gatherUsedTextureIdsLegacy(e){const t={},i=e.featureTextures;if(defined(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].properties;defined(n)&&gatherTextureIdsFromPropertiesLegacy(n,t)}return t}function gatherTextureIdsFromPropertiesLegacy(e,t){for(const i in e)if(e.hasOwnProperty(i)){const n=e[i].texture;t[n.index]=n}}function loadTextures(e){let t;t=defined(e._extension)?gatherUsedTextureIds(e._extension):gatherUsedTextureIdsLegacy(e._extensionLegacy);const i=e._gltf,n=e._gltfResource,r=e._baseResource,o=e._supportedImageFormats,a=e._asynchronous,s=[],c={};for(const l in t)if(t.hasOwnProperty(l)){const u=ResourceCache.loadTexture({gltf:i,textureInfo:t[l],gltfResource:n,baseResource:r,supportedImageFormats:o,asynchronous:a});s.push(u.promise),e._textureLoaders.push(u),c[l]=u}return Promise.all(s).then((function(){const e={};for(const t in c)if(c.hasOwnProperty(t)){const i=c[t];e[t]=i.texture}return e}))}function loadSchema(e){const t=defaultValue(e._extension,e._extensionLegacy);let i;if(defined(t.schemaUri)){const n=e._baseResource.getDerivedResource({url:t.schemaUri});i=ResourceCache.loadSchema({resource:n})}else i=ResourceCache.loadSchema({schema:t.schema});return e._schemaLoader=i,i.promise.then((function(e){return e.schema}))}function unloadBufferViews$1(e){const t=e._bufferViewLoaders,i=t.length;for(let e=0;e<i;++e)ResourceCache.unload(t[e]);e._bufferViewLoaders.length=0}function unloadTextures$1(e){const t=e._textureLoaders,i=t.length;for(let e=0;e<i;++e)ResourceCache.unload(t[e]);e._textureLoaders.length=0}PropertyTable.prototype.getPropertyIds=function(e,t){return(t=defined(t)?t:[]).length=0,defined(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(scratchResults)),defined(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(scratchResults)),defined(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,scratchResults)),t},PropertyTable.prototype.getProperty=function(e,t){let i;return defined(this._metadataTable)&&(i=this._metadataTable.getProperty(e,t),defined(i))||defined(this._jsonMetadataTable)&&(i=this._jsonMetadataTable.getProperty(e,t),defined(i))||defined(this._batchTableHierarchy)&&(i=this._batchTableHierarchy.getProperty(e,t),defined(i))?i:void 0},PropertyTable.prototype.setProperty=function(e,t,i){return!(!defined(this._metadataTable)||!this._metadataTable.setProperty(e,t,i))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.setProperty(e,t,i))||defined(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,i))},PropertyTable.prototype.getPropertyBySemantic=function(e,t){if(defined(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)},PropertyTable.prototype.setPropertyBySemantic=function(e,t,i){return!!defined(this._metadataTable)&&this._metadataTable.setPropertyBySemantic(e,t,i)},PropertyTable.prototype.getPropertyTypedArray=function(e){if(defined(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)},PropertyTable.prototype.getPropertyTypedArrayBySemantic=function(e){if(defined(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)},Object.defineProperties(PropertyTextureProperty.prototype,{textureReader:{get:function(){return this._textureReader}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(PropertyTexture.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),PropertyTexture.prototype.getProperty=function(e){return this._properties[e]},Object.defineProperties(PropertyAttributeProperty.prototype,{attribute:{get:function(){return this._attribute}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(PropertyAttribute.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),PropertyAttribute.prototype.getProperty=function(e){return this._properties[e]},Object.defineProperties(StructuralMetadata.prototype,{schema:{get:function(){return this._schema}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},propertyTableCount:{get:function(){return this._propertyTableCount}},propertyTables:{get:function(){return this._propertyTables}},propertyTextures:{get:function(){return this._propertyTextures}},propertyAttributes:{get:function(){return this._propertyAttributes}}}),StructuralMetadata.prototype.getPropertyTable=function(e){return this._propertyTables[e]},StructuralMetadata.prototype.getPropertyTexture=function(e){return this._propertyTextures[e]},StructuralMetadata.prototype.getPropertyAttribute=function(e){return this._propertyAttributes[e]},defined(Object.create)&&(GltfStructuralMetadataLoader.prototype=Object.create(ResourceLoader.prototype),GltfStructuralMetadataLoader.prototype.constructor=GltfStructuralMetadataLoader),Object.defineProperties(GltfStructuralMetadataLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}}),GltfStructuralMetadataLoader.prototype.load=function(){const e=loadBufferViews(this),t=loadTextures(this),i=loadSchema(this);this._gltf=void 0,this._state=ResourceLoaderState$1.LOADING;const n=this;Promise.all([e,t,i]).then((function(e){if(n.isDestroyed())return;const t=e[0],i=e[1],r=e[2];defined(n._extension)?n._structuralMetadata=parseStructuralMetadata({extension:n._extension,schema:r,bufferViews:t,textures:i}):n._structuralMetadata=parseFeatureMetadataLegacy({extension:n._extensionLegacy,schema:r,bufferViews:t,textures:i}),n._state=ResourceLoaderState$1.READY,n._promise.resolve(n)})).catch((function(e){if(n.isDestroyed())return;n.unload(),n._state=ResourceLoaderState$1.FAILED;n._promise.reject(n.getError("Failed to load structural metadata",e))}))},GltfStructuralMetadataLoader.prototype.process=function(e){if(this._state!==ResourceLoaderState$1.LOADING)return;const t=this._textureLoaders,i=t.length;for(let n=0;n<i;++n){t[n].process(e)}},GltfStructuralMetadataLoader.prototype.unload=function(){unloadBufferViews$1(this),unloadTextures$1(this),defined(this._schemaLoader)&&ResourceCache.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};const InstanceAttributeSemantic={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID",fromGltfSemantic:function(e){let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(null!==i&&(t=i[1]),t){case"TRANSLATION":return InstanceAttributeSemantic.TRANSLATION;case"ROTATION":return InstanceAttributeSemantic.ROTATION;case"SCALE":return InstanceAttributeSemantic.SCALE;case"_FEATURE_ID":return InstanceAttributeSemantic.FEATURE_ID}}};var InstanceAttributeSemantic$1=Object.freeze(InstanceAttributeSemantic);function SupportedImageFormats(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.webp=defaultValue(e.webp,!1),this.basis=defaultValue(e.basis,!1)}const Attribute$2=ModelComponents.Attribute,Indices=ModelComponents.Indices,FeatureIdAttribute$3=ModelComponents.FeatureIdAttribute,FeatureIdTexture=ModelComponents.FeatureIdTexture,FeatureIdImplicitRange=ModelComponents.FeatureIdImplicitRange,MorphTarget=ModelComponents.MorphTarget,Primitive$1=ModelComponents.Primitive,Instances$1=ModelComponents.Instances,Skin=ModelComponents.Skin,Node$2=ModelComponents.Node,Asset=ModelComponents.Asset,Scene$2=ModelComponents.Scene,Components$1=ModelComponents.Components,MetallicRoughness$2=ModelComponents.MetallicRoughness,SpecularGlossiness$1=ModelComponents.SpecularGlossiness,Material$2=ModelComponents.Material,GltfLoaderState={UNLOADED:0,LOADING:1,LOADED:2,PROCESSING:3,PROCESSED:4,READY:4,FAILED:5};function GltfLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource;let i=e.baseResource;const n=e.typedArray,r=defaultValue(e.releaseGltfJson,!1),o=defaultValue(e.asynchronous,!0),a=defaultValue(e.incrementallyLoadTextures,!0),s=defaultValue(e.upAxis,Axis$1.Y),c=defaultValue(e.forwardAxis,Axis$1.Z),l=defaultValue(e.loadAsTypedArray,!1),u=defaultValue(e.renameBatchIdSemantic,!1);i=defined(i)?i:t.clone(),this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=i,this._typedArray=n,this._releaseGltfJson=r,this._asynchronous=o,this._incrementallyLoadTextures=a,this._upAxis=s,this._forwardAxis=c,this._loadAsTypedArray=l,this._renameBatchIdSemantic=u,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=GltfLoaderState.UNLOADED,this._textureState=GltfLoaderState.UNLOADED,this._promise=defer(),this._texturesLoadedPromise=defer(),this._textureLoaders=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._structuralMetadataLoader=void 0,this._components=void 0}function handleError$2(e,t){e.unload(),e._state=GltfLoaderState.FAILED,e._textureState=GltfLoaderState.FAILED;t=e.getError("Failed to load glTF",t),e._promise.reject(t),e._texturesLoadedPromise.reject(t)}function process$1(e,t){let i;const n=e._textureLoaders,r=n.length;for(i=0;i<r;++i)n[i].process(t);const o=e._bufferViewLoaders,a=o.length;for(i=0;i<a;++i)o[i].process(t);const s=e._geometryLoaders,c=s.length;for(i=0;i<c;++i)s[i].process(t);defined(e._structuralMetadataLoader)&&e._structuralMetadataLoader.process(t)}function loadVertexBuffer(e,t,i,n,r,o,a){const s=t.accessors[i].bufferView,c=ResourceCache.loadVertexBuffer({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,bufferViewId:s,draco:r,attributeSemantic:n,accessorId:i,asynchronous:e._asynchronous,dequantize:o,loadAsTypedArray:a});return e._geometryLoaders.push(c),c}function loadIndexBuffer(e,t,i,n,r){const o=ResourceCache.loadIndexBuffer({gltf:t,accessorId:i,gltfResource:e._gltfResource,baseResource:e._baseResource,draco:n,asynchronous:e._asynchronous,loadAsTypedArray:r});return e._geometryLoaders.push(o),o}function loadBufferView(e,t,i){const n=ResourceCache.loadBufferView({gltf:t,bufferViewId:i,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(n),n}function getPackedTypedArray(e,t,i){let n=t.byteOffset;const r=getAccessorByteStride(e,t),o=t.count,a=numberOfComponentsForType(t.type),s=t.componentType,c=ComponentDatatype$1.getSizeInBytes(s),l=o*a;if(r===c*a)return i=new Uint8Array(i),ComponentDatatype$1.createArrayBufferView(s,i.buffer,i.byteOffset+n,l);const u=ComponentDatatype$1.createTypedArray(s,l),d=new DataView(i.buffer),h=new Array(a),p=getComponentReader(t.componentType);n=i.byteOffset+n;for(let e=0;e<o;++e){p(d,n,a,c,h);for(let t=0;t<a;++t)u[e*a+t]=h[t];n+=r}return u}function fromArray(e,t){if(defined(t))return e===Number?t[0]:e.unpack(t)}function getDefault(e){return e===Number?0:new e}function createAttribute(e,t,i,n,r){const o=e.accessors[t],a=AttributeType$1.getMathType(o.type),s=new Attribute$2;return s.name=i,s.semantic=n,s.setIndex=r,s.constant=getDefault(a),s.componentDatatype=o.componentType,s.normalized=defaultValue(o.normalized,!1),s.count=o.count,s.type=o.type,s.min=fromArray(a,o.min),s.max=fromArray(a,o.max),s.byteOffset=o.byteOffset,s.byteStride=getAccessorByteStride(e,o),s}function getSetIndex(e){const t=/^\w+_(\d+)$/.exec(e);if(null!==t)return parseInt(t[1])}function loadAttribute(e,t,i,n,r,o,a,s,c){const l=t.accessors[i],u=l.bufferView;let d=r;!e._renameBatchIdSemantic||"_BATCHID"!==r&&"BATCHID"!==r||(d="_FEATURE_ID_0");const h=r,p=n.fromGltfSemantic(d),f=defined(p)?getSetIndex(d):void 0,m=createAttribute(t,i,h,p,f);if(!defined(o)&&!defined(u))return m;return loadVertexBuffer(e,t,i,r,o,a,s).promise.then((function(i){if(!e.isDestroyed()){if(c){const e=i.typedArray;m.packedTypedArray=getPackedTypedArray(t,l,e),m.byteOffset=0,m.byteStride=void 0}else s?m.typedArray=i.typedArray:m.buffer=i.buffer;defined(o)&&defined(o.attributes)&&defined(o.attributes[r])&&(m.byteOffset=0,m.byteStride=void 0,m.quantization=i.quantization)}})),m}function loadVertexAttribute(e,t,i,n,r){return loadAttribute(e,t,i,VertexAttributeSemantic$1,n,r,!1,e._loadAsTypedArray,!1)}function loadInstancedAttribute(e,t,i,n,r){return loadAttribute(e,t,i,InstanceAttributeSemantic$1,n,void 0,!0,r,r)}function loadIndices(e,t,i,n){const r=t.accessors[i],o=r.bufferView;if(!defined(n)&&!defined(o))return;const a=new Indices;a.count=r.count;const s=e._loadAsTypedArray;return loadIndexBuffer(e,t,i,n,s).promise.then((function(t){e.isDestroyed()||(a.indexDatatype=t.indexDatatype,s?a.typedArray=t.typedArray:a.buffer=t.buffer)})),a}function loadTexture(e,t,i,n,r){if(!defined(GltfLoaderUtil.getImageIdFromTexture({gltf:t,textureId:i.index,supportedImageFormats:n})))return;const o=ResourceCache.loadTexture({gltf:t,textureInfo:i,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:n,asynchronous:e._asynchronous});e._textureLoaders.push(o);const a=GltfLoaderUtil.createModelTextureReader({textureInfo:i});return o.promise.then((function(t){e.isDestroyed()||(a.texture=t.texture,defined(r)&&(a.texture.sampler=r))})),a}function loadMaterial(e,t,i,n){const r=new Material$2,o=defaultValue(i.extensions,defaultValue.EMPTY_OBJECT),a=o.KHR_materials_pbrSpecularGlossiness,s=i.pbrMetallicRoughness;if(r.unlit=defined(o.KHR_materials_unlit),defined(a)){const i=new SpecularGlossiness$1;r.specularGlossiness=i,defined(a.diffuseTexture)&&(i.diffuseTexture=loadTexture(e,t,a.diffuseTexture,n)),defined(a.specularGlossinessTexture)&&defined(a.specularGlossinessTexture)&&(i.specularGlossinessTexture=loadTexture(e,t,a.specularGlossinessTexture,n)),i.diffuseFactor=fromArray(Cartesian4,a.diffuseFactor),i.specularFactor=fromArray(Cartesian3,a.specularFactor),i.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(defined(s)){const i=new MetallicRoughness$2;r.metallicRoughness=i,defined(s.baseColorTexture)&&(i.baseColorTexture=loadTexture(e,t,s.baseColorTexture,n)),defined(s.metallicRoughnessTexture)&&(i.metallicRoughnessTexture=loadTexture(e,t,s.metallicRoughnessTexture,n)),i.baseColorFactor=fromArray(Cartesian4,s.baseColorFactor),i.metallicFactor=s.metallicFactor,i.roughnessFactor=s.roughnessFactor,r.pbrMetallicRoughness=s}return defined(i.emissiveTexture)&&(r.emissiveTexture=loadTexture(e,t,i.emissiveTexture,n)),defined(i.normalTexture)&&(r.normalTexture=loadTexture(e,t,i.normalTexture,n)),defined(i.occlusionTexture)&&(r.occlusionTexture=loadTexture(e,t,i.occlusionTexture,n)),r.emissiveFactor=fromArray(Cartesian3,i.emissiveFactor),r.alphaMode=i.alphaMode,r.alphaCutoff=i.alphaCutoff,r.doubleSided=i.doubleSided,r}function loadFeatureIdAttribute(e,t){const i=new FeatureIdAttribute$3;return i.featureCount=e.featureCount,i.nullFeatureId=e.nullFeatureId,i.propertyTableId=e.propertyTable,i.setIndex=e.attribute,i.label=e.label,i.positionalLabel=t,i}function loadFeatureIdAttributeLegacy(e,t,i,n){const r=new FeatureIdAttribute$3,o=e.featureIds;return r.featureCount=i,r.propertyTableId=t,r.setIndex=getSetIndex(o.attribute),r.positionalLabel=n,r}function loadDefaultFeatureIds(e,t){const i=new FeatureIdImplicitRange;return i.propertyTableId=e.propertyTable,i.featureCount=e.featureCount,i.nullFeatureId=e.nullFeatureId,i.label=e.label,i.positionalLabel=t,i.offset=0,i.repeat=1,i}function loadFeatureIdImplicitRangeLegacy(e,t,i,n){const r=new FeatureIdImplicitRange,o=e.featureIds;r.propertyTableId=t,r.featureCount=i,r.offset=defaultValue(o.constant,0);const a=defaultValue(o.divisor,0);return r.repeat=0===a?void 0:a,r.positionalLabel=n,r}function loadFeatureIdTexture(e,t,i,n,r){const o=new FeatureIdTexture;o.featureCount=i.featureCount,o.nullFeatureId=i.nullFeatureId,o.propertyTableId=i.propertyTable,o.label=i.label,o.positionalLabel=r;const a=i.texture;o.textureReader=loadTexture(e,t,a,n,Sampler.NEAREST);const s=a.channels.map((function(e){return"rgba".charAt(e)})).join("");return o.textureReader.channels=s,o}function loadFeatureIdTextureLegacy(e,t,i,n,r,o,a){const s=new FeatureIdTexture,c=i.featureIds,l=c.texture;return s.featureCount=o,s.propertyTableId=n,s.textureReader=loadTexture(e,t,l,r,Sampler.NEAREST),s.textureReader.channels=c.channels,s.positionalLabel=a,s}function loadMorphTarget(e,t,i){const n=new MorphTarget;for(const r in i)if(i.hasOwnProperty(r)){const o=i[r];n.attributes.push(loadVertexAttribute(e,t,o,r,void 0))}return n}function loadPrimitive(e,t,i,n,r){const o=new Primitive$1,a=i.material;defined(a)&&(o.material=loadMaterial(e,t,t.materials[a],r));const s=defaultValue(i.extensions,defaultValue.EMPTY_OBJECT),c=s.KHR_draco_mesh_compression,l=i.attributes;if(defined(l))for(const i in l)if(l.hasOwnProperty(i)){const n=l[i];o.attributes.push(loadVertexAttribute(e,t,n,i,c))}const u=i.targets;if(defined(u)){const i=u.length;for(let n=0;n<i;++n)o.morphTargets.push(loadMorphTarget(e,t,u[n]));o.morphWeights=defined(n)?n.slice():arrayFill(new Array(i),0)}const d=i.indices;defined(d)&&(o.indices=loadIndices(e,t,d,c));const h=s.EXT_structural_metadata,p=s.EXT_mesh_features,f=s.EXT_feature_metadata,m=defined(f);return defined(p)?loadPrimitiveFeatures(e,t,o,p,r):m&&loadPrimitiveFeaturesLegacy(e,t,o,f,r),defined(h)?loadPrimitiveMetadata(o,h):m&&loadPrimitiveMetadataLegacy(e,o,f),o.primitiveType=i.mode,o}function loadPrimitiveFeatures(e,t,i,n,r){let o;o=defined(n)&&defined(n.featureIds)?n.featureIds:[];for(let n=0;n<o.length;n++){const a=o[n],s=`featureId_${n}`;let c;c=defined(a.texture)?loadFeatureIdTexture(e,t,a,r,s):defined(a.attribute)?loadFeatureIdAttribute(a,s):loadDefaultFeatureIds(a,s),i.featureIds.push(c)}}function loadPrimitiveFeaturesLegacy(e,t,i,n,r){const o=t.extensions.EXT_feature_metadata.featureTables;let a=0;const s=n.featureIdAttributes;if(defined(s)){const t=s.length;for(let n=0;n<t;++n){const t=s[n],r=t.featureTable,c=e._sortedPropertyTableIds.indexOf(r),l=o[r].count,u=`featureId_${a}`;let d;a++,d=defined(t.featureIds.attribute)?loadFeatureIdAttributeLegacy(t,c,l,u):loadFeatureIdImplicitRangeLegacy(t,c,l,u),i.featureIds.push(d)}}const c=n.featureIdTextures;if(defined(c)){const n=c.length;for(let s=0;s<n;++s){const n=c[s],l=n.featureTable,u=e._sortedPropertyTableIds.indexOf(l),d=`featureId_${a}`;a++;const h=loadFeatureIdTextureLegacy(e,t,n,u,r,o[l].count,d);i.featureIds.push(h)}}}function loadPrimitiveMetadata(e,t){defined(t)&&(defined(t.propertyTextures)&&(e.propertyTextureIds=t.propertyTextures),defined(t.propertyAttributes)&&(e.propertyAttributeIds=t.propertyAttributes))}function loadPrimitiveMetadataLegacy(e,t,i){defined(i.featureTextures)&&(t.propertyTextureIds=i.featureTextures.map((function(t){return e._sortedFeatureTextureIds.indexOf(t)})))}function loadInstances(e,t,i,n){const r=i.EXT_mesh_gpu_instancing,o=new Instances$1,a=r.attributes;if(defined(a)){const i=defined(a.ROTATION),r=defined(a.TRANSLATION)&&defined(t.accessors[a.TRANSLATION].min)&&defined(t.accessors[a.TRANSLATION].max);for(const s in a)if(a.hasOwnProperty(s)){const c=e._loadAsTypedArray||!n.context.instancedArrays||(i||!r)&&(s===InstanceAttributeSemantic$1.TRANSLATION||s===InstanceAttributeSemantic$1.ROTATION||s===InstanceAttributeSemantic$1.SCALE)||s.indexOf(InstanceAttributeSemantic$1.FEATURE_ID)>=0,l=a[s];o.attributes.push(loadInstancedAttribute(e,t,l,s,c))}}const s=defaultValue(r.extensions,defaultValue.EMPTY_OBJECT),c=i.EXT_instance_features,l=s.EXT_feature_metadata;return defined(c)?loadInstanceFeatures(o,c):defined(l)&&loadInstanceFeaturesLegacy(t,o,l,e._sortedPropertyTableIds),o}function loadInstanceFeatures(e,t){const i=t.featureIds;for(let t=0;t<i.length;t++){const n=i[t],r=`instanceFeatureId_${t}`;let o;o=defined(n.attribute)?loadFeatureIdAttribute(n,r):loadDefaultFeatureIds(n,r),e.featureIds.push(o)}}function loadInstanceFeaturesLegacy(e,t,i,n){const r=e.extensions.EXT_feature_metadata.featureTables,o=i.featureIdAttributes;if(defined(o)){const e=o.length;for(let i=0;i<e;++i){const e=o[i],a=e.featureTable,s=n.indexOf(a),c=r[a].count,l=`instanceFeatureId_${i}`;let u;u=defined(e.featureIds.attribute)?loadFeatureIdAttributeLegacy(e,s,c,l):loadFeatureIdImplicitRangeLegacy(e,s,c,l),t.featureIds.push(u)}}}function loadSkin(e,t,i,n){const r=new Skin,o=i.joints,a=o.length,s=new Array(a);for(let e=0;e<a;++e)s[e]=n[o[e]];r.joints=s;const c=i.inverseBindMatrices;if(defined(c)){const i=t.accessors[c],n=i.bufferView;if(defined(n)){loadBufferView(e,t,n).promise.then((function(n){if(e.isDestroyed())return;const o=n.typedArray,s=getPackedTypedArray(t,i,o),c=new Array(a);for(let e=0;e<a;++e)c[e]=Matrix4.unpack(s,16*e);r.inverseBindMatrices=c}))}}else r.inverseBindMatrices=arrayFill(new Array(a),Matrix4.IDENTITY);return r}function loadNode(e,t,i,n,r){const o=new Node$2;o.matrix=fromArray(Matrix4,i.matrix),o.translation=fromArray(Cartesian3,i.translation),o.rotation=fromArray(Quaternion,i.rotation),o.scale=fromArray(Cartesian3,i.scale);const a=i.mesh;if(defined(a)){const r=t.meshes[a],s=defaultValue(i.weights,r.weights),c=r.primitives,l=c.length;for(let i=0;i<l;++i)o.primitives.push(loadPrimitive(e,t,c[i],s,n))}const s=defaultValue(i.extensions,defaultValue.EMPTY_OBJECT);return defined(s.EXT_mesh_gpu_instancing)&&(o.instances=loadInstances(e,t,s,r)),o}function loadNodes(e,t,i,n){let r,o;const a=t.nodes.length,s=new Array(a);for(r=0;r<a;++r)s[r]=loadNode(e,t,t.nodes[r],i,n);for(r=0;r<a;++r){const e=t.nodes[r].children;if(defined(e)){const t=e.length;for(o=0;o<t;++o)s[r].children.push(s[e[o]])}}for(r=0;r<a;++r){const i=t.nodes[r].skin;defined(i)&&(s[r].skin=loadSkin(e,t,t.skins[i],s))}return s}function loadStructuralMetadata(e,t,i,n,r){const o=new GltfStructuralMetadataLoader({gltf:t,extension:i,extensionLegacy:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:r,asynchronous:e._asynchronous});return o.load(),e._structuralMetadataLoader=o,o}function getSceneNodeIds(e){let t;return defined(e.scenes)&&defined(e.scene)&&(t=e.scenes[e.scene].nodes),t=defaultValue(t,e.nodes),t=defined(t)?t:[],t}function loadScene(e,t){const i=new Scene$2,n=getSceneNodeIds(e);return i.nodes=n.map((function(e){return t[e]})),i}function parse(e,t,i,n){const r=defaultValue(t.extensions,defaultValue.EMPTY_OBJECT),o=r.EXT_structural_metadata,a=r.EXT_feature_metadata;if(defined(a)){const t=a.featureTables,i=a.featureTextures,n=defined(t)?t:[],r=defined(i)?i:[];e._sortedPropertyTableIds=Object.keys(n).sort(),e._sortedFeatureTextureIds=Object.keys(r).sort()}const s=loadNodes(e,t,i,n),c=loadScene(t,s),l=new Components$1,u=new Asset,d=t.asset.copyright;if(defined(d)){const e=d.split(";").map((function(e){return new Credit(e.trim())}));u.credits=e}if(l.asset=u,l.scene=c,l.nodes=s,l.upAxis=e._upAxis,l.forwardAxis=e._forwardAxis,e._components=l,defined(o)||defined(a)){loadStructuralMetadata(e,t,o,a,i).promise.then((function(t){e.isDestroyed()||(l.structuralMetadata=t.structuralMetadata)}))}const h=[];h.push.apply(h,e._bufferViewLoaders),h.push.apply(h,e._geometryLoaders),defined(e._structuralMetadataLoader)&&h.push(e._structuralMetadataLoader),e._incrementallyLoadTextures||h.push.apply(h,e._textureLoaders);const p=h.map((function(e){return e.promise})),f=e._textureLoaders.map((function(e){return e.promise}));Promise.all(p).then((function(){e.isDestroyed()||(e._state=GltfLoaderState.PROCESSED)})).catch((function(t){e.isDestroyed()||handleError$2(e,t)})),Promise.all(f).then((function(){e.isDestroyed()||(e._textureState=GltfLoaderState.PROCESSED)}))}function unloadTextures(e){const t=e._textureLoaders,i=t.length;for(let e=0;e<i;++e)ResourceCache.unload(t[e]);e._textureLoaders.length=0}function unloadBufferViews(e){const t=e._bufferViewLoaders,i=t.length;for(let e=0;e<i;++e)ResourceCache.unload(t[e]);e._bufferViewLoaders.length=0}function unloadGeometry(e){const t=e._geometryLoaders,i=t.length;for(let e=0;e<i;++e)ResourceCache.unload(t[e]);e._geometryLoaders.length=0}function unloadStructuralMetadata(e){defined(e._structuralMetadataLoader)&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0)}defined(Object.create)&&(GltfLoader.prototype=Object.create(ResourceLoader.prototype),GltfLoader.prototype.constructor=GltfLoader),Object.defineProperties(GltfLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise.promise}}}),GltfLoader.prototype.load=function(){const e=ResourceCache.loadGltfJson({gltfResource:this._gltfResource,baseResource:this._baseResource,typedArray:this._typedArray,gltfJson:this._gltfJson});this._gltfJsonLoader=e,this._state=GltfLoaderState.LOADING,this._textureState=GltfLoaderState.LOADING;const t=this;e.promise.then((function(){t.isDestroyed()||(t._state=GltfLoaderState.LOADED,t._textureState=GltfLoaderState.LOADED)})).catch((function(e){t.isDestroyed()||handleError$2(t,e)}))},GltfLoader.prototype.process=function(e){if(FeatureDetection.supportsWebP.initialized){if(this._state===GltfLoaderState.LOADED){this._state=GltfLoaderState.PROCESSING;const t=new SupportedImageFormats({webp:FeatureDetection.supportsWebP(),basis:e.context.supportsBasis});let i;i=defined(this._gltfJsonLoader)?this._gltfJsonLoader.gltf:this._gltfJson,parse(this,i,t,e),defined(this._gltfJsonLoader)&&this._releaseGltfJson&&(ResourceCache.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0)}this._textureState===GltfLoaderState.LOADED&&(this._textureState=GltfLoaderState.PROCESSING),this._state!==GltfLoaderState.PROCESSING&&this._textureState!==GltfLoaderState.PROCESSING||process$1(this,e),this._state===GltfLoaderState.PROCESSED&&(unloadBufferViews(this),this._state=GltfLoaderState.READY,this._promise.resolve(this)),this._textureState===GltfLoaderState.PROCESSED&&(this._textureState=GltfLoaderState.READY,this._texturesLoadedPromise.resolve(this))}else FeatureDetection.supportsWebP.initialize()},GltfLoader.prototype.unload=function(){defined(this._gltfJsonLoader)&&ResourceCache.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,unloadTextures(this),unloadBufferViews(this),unloadGeometry(this),unloadStructuralMetadata(this),this._components=void 0};var ModelExperimentalFS="#if defined(HAS_NORMALS) && !defined(HAS_TANGENTS) && !defined(LIGHTING_UNLIT)\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n#endif\nczm_modelMaterial defaultModelMaterial()\n{\nczm_modelMaterial material;\nmaterial.diffuse = vec3(1.0);\nmaterial.specular = vec3(0.04);\nmaterial.roughness = 0.0;\nmaterial.occlusion = 1.0;\nmaterial.normalEC = vec3(0.0, 0.0, 1.0);\nmaterial.emissive = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\nvec4 handleAlpha(vec3 color, float alpha)\n{\n#ifdef ALPHA_MODE_MASK\nif (alpha < u_alphaCutoff) {\ndiscard;\n}\nreturn vec4(color, 1.0);\n#elif defined(ALPHA_MODE_BLEND)\nreturn vec4(color, alpha);\n#else // OPAQUE\nreturn vec4(color, 1.0);\n#endif\n}\nSelectedFeature selectedFeature;\nvoid main()\n{\n#ifdef HAS_MODEL_SPLITTER\nmodelSplitterStage();\n#endif\nczm_modelMaterial material = defaultModelMaterial();\nProcessedAttributes attributes;\ngeometryStage(attributes);\nFeatureIds featureIds;\nfeatureIdStage(featureIds, attributes);\n#ifdef HAS_SELECTED_FEATURE_ID\nselectedFeatureIdStage(selectedFeature, featureIds);\n#endif\n#ifndef CUSTOM_SHADER_REPLACE_MATERIAL\nmaterialStage(material, attributes, selectedFeature);\n#endif\n#ifdef HAS_CUSTOM_FRAGMENT_SHADER\ncustomShaderStage(material, attributes, featureIds);\n#endif\nlightingStage(material, attributes);\n#ifdef HAS_SELECTED_FEATURE_ID\ncpuStylingStage(material, selectedFeature);\n#endif\n#ifdef HAS_MODEL_COLOR\nmodelColorStage(material);\n#endif\nvec4 color = handleAlpha(material.diffuse, material.alpha);\ngl_FragColor = color;\n}\n",ModelExperimentalVS="precision highp float;\nczm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {\nczm_modelVertexOutput vsOutput;\nvsOutput.positionMC = positionMC;\nvsOutput.pointSize = 1.0;\nreturn vsOutput;\n}\nvoid main()\n{\nProcessedAttributes attributes;\ninitializeAttributes(attributes);\n#ifdef USE_DEQUANTIZATION\ndequantizationStage(attributes);\n#endif\nFeatureIds featureIds;\nfeatureIdStage(featureIds, attributes);\n#ifdef HAS_SELECTED_FEATURE_ID\nSelectedFeature feature;\nselectedFeatureIdStage(feature, featureIds);\ncpuStylingStage(attributes.positionMC, feature);\n#endif\nmat4 modelView = czm_modelView;\nmat3 normal = czm_normal;\n#ifdef HAS_INSTANCING\n#ifdef USE_LEGACY_INSTANCING\nmat4 instanceModelView;\nmat3 instanceModelViewInverseTranspose;\nlegacyInstancingStage(attributes.positionMC, instanceModelView, instanceModelViewInverseTranspose);\nmodelView = instanceModelView;\nnormal = instanceModelViewInverseTranspose;\n#else\ninstancingStage(attributes.positionMC);\n#endif\n#ifdef USE_PICKING\nv_pickColor = a_pickColor;\n#endif\n#endif\n#ifdef HAS_CUSTOM_VERTEX_SHADER\nczm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);\ncustomShaderStage(vsOutput, attributes, featureIds);\n#endif\ngeometryStage(attributes, modelView, normal);\n#ifdef PRIMITIVE_TYPE_POINTS\n#ifdef HAS_CUSTOM_VERTEX_SHADER\ngl_PointSize = vsOutput.pointSize;\n#elif defined(USE_POINT_CLOUD_ATTENUATION)\ngl_PointSize = pointCloudAttenuationStage(v_positionEC);\n#else\ngl_PointSize = 1.0;\n#endif\n#endif\n}\n";const StyleCommandsNeeded={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2,getStyleCommandsNeeded:function(e,t){return 0===t?StyleCommandsNeeded.ALL_OPAQUE:t===e?StyleCommandsNeeded.ALL_TRANSLUCENT:StyleCommandsNeeded.OPAQUE_AND_TRANSLUCENT}};var StyleCommandsNeeded$1=Object.freeze(StyleCommandsNeeded);function buildDrawCommands(e,t){const i=e.shaderBuilder;i.addVertexLines([ModelExperimentalVS]),i.addFragmentLines([ModelExperimentalFS]);const n=defined(e.indices)?e.indices.buffer:void 0,r=new VertexArray({context:t.context,indexBuffer:n,attributes:e.attributes}),o=e.model;o._resources.push(r);let a=e.renderStateOptions;o.opaquePass===Pass$1.CESIUM_3D_TILE&&(a=clone$1(a,!0),a.stencilTest=StencilConstants$1.setCesium3DTileBit(),a.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),a=RenderState.fromCache(a);const s=i.buildShaderProgram(t.context);o._resources.push(s);const c=e.alphaOptions.pass,l=o.sceneGraph,u=Matrix4.multiply(l.computedModelMatrix,e.transform,new Matrix4);e.boundingSphere=BoundingSphere.transform(e.boundingSphere,u,e.boundingSphere);const d=new DrawCommand({boundingVolume:e.boundingSphere,modelMatrix:u,uniformMap:e.uniformMap,renderState:a,vertexArray:r,shaderProgram:s,cull:o.cull,pass:c,count:e.count,pickId:e.pickId,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:o.debugShowBoundingVolume,castShadows:ShadowMode$1.castShadows(o.shadows),receiveShadows:ShadowMode$1.receiveShadows(o.shadows)}),h=e.styleCommandsNeeded,p=[];if(defined(h)){const e=createDerivedCommands(d);if(c!==Pass$1.TRANSLUCENT)switch(h){case StyleCommandsNeeded$1.ALL_OPAQUE:p.push(d);break;case StyleCommandsNeeded$1.ALL_TRANSLUCENT:p.push(e.translucent);break;case StyleCommandsNeeded$1.OPAQUE_AND_TRANSLUCENT:p.push(d,e.translucent)}else p.push(d)}else p.push(d);return p}function createDerivedCommands(e){const t={};return t.translucent=deriveTranslucentCommand(e),t}function deriveTranslucentCommand(e){const t=DrawCommand.shallowClone(e);t.pass=Pass$1.TRANSLUCENT;const i=clone$1(e.renderState,!0);return i.cull.enabled=!1,i.depthTest.enabled=!0,i.depthMask=!1,i.blending=BlendingState$1.ALPHA_BLEND,t.renderState=RenderState.fromCache(i),t}var ImageBasedLightingStageFS="vec3 proceduralIBL(\nvec3 positionEC,\nvec3 normalEC,\nvec3 lightDirectionEC,\nvec3 lightColorHdr,\nczm_pbrParameters pbrParameters\n) {\nvec3 v = -positionEC;\nvec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));\nvec3 vWC = -normalize(positionWC);\nvec3 l = normalize(lightDirectionEC);\nvec3 n = normalEC;\nvec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\nfloat NdotL = clamp(dot(n, l), 0.001, 1.0);\nfloat NdotV = abs(dot(n, v)) + 0.001;\nfloat vertexRadius = length(positionWC);\nfloat horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\nfloat reflectionDotNadir = dot(r, normalize(positionWC));\nr.x = -r.x;\nr = -normalize(czm_temeToPseudoFixed * r);\nr.x = -r.x;\nvec3 diffuseColor = pbrParameters.diffuseColor;\nfloat roughness = pbrParameters.roughness;\nvec3 specularColor = pbrParameters.f0;\nfloat inverseRoughness = 1.04 - roughness;\ninverseRoughness *= inverseRoughness;\nvec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;\nfloat atmosphereHeight = 0.05;\nfloat blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\nfloat blendRegionOffset = roughness * -1.0;\nfloat farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\nfloat aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\nfloat farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\nfloat smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\nvec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\nvec3 nadirColor = belowHorizonColor * 0.5;\nvec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\nvec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\nvec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\nvec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);\nfloat diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;\nfloat diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\nvec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\nfloat notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\nvec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\nspecularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\nspecularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n#ifdef USE_SUN_LUMINANCE\nfloat LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0);\nfloat S = acos(LdotZenith);\nfloat NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0);\nfloat gamma = acos(NdotL);\nfloat numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\nfloat denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\nfloat luminance = model_luminanceAtZenith * (numerator / denominator);\n#endif\nvec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\nvec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y);\nfloat maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);\nvec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);\niblColor *= lightColor;\n#ifdef USE_SUN_LUMINANCE\niblColor *= luminance;\n#endif\nreturn iblColor;\n}\nvec3 textureIBL(\nvec3 positionEC,\nvec3 normalEC,\nvec3 lightDirectionEC,\nczm_pbrParameters pbrParameters\n) {\nvec3 diffuseColor = pbrParameters.diffuseColor;\nfloat roughness = pbrParameters.roughness;\nvec3 specularColor = pbrParameters.f0;\nvec3 v = -positionEC;\nvec3 n = normalEC;\nvec3 l = normalize(lightDirectionEC);\nvec3 h = normalize(v + l);\nfloat NdotV = abs(dot(n, v)) + 0.001;\nfloat VdotH = clamp(dot(v, h), 0.0, 1.0);\nconst mat3 yUpToZUp = mat3(\n-1.0, 0.0, 0.0,\n0.0, 0.0, -1.0,\n0.0, 1.0, 0.0\n);\nvec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n)));\n#ifdef DIFFUSE_IBL\n#ifdef CUSTOM_SPHERICAL_HARMONICS\nvec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients);\n#else\nvec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients);\n#endif\n#else\nvec3 diffuseIrradiance = vec3(0.0);\n#endif\n#ifdef SPECULAR_IBL\nvec3 r0 = specularColor.rgb;\nfloat reflectance = max(max(r0.r, r0.g), r0.b);\nvec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\nvec3 F = fresnelSchlick2(r0, r90, VdotH);\nvec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n#ifdef CUSTOM_SPECULAR_IBL\nvec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD);\n#else\nvec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n#endif\nspecularIBL *= F * brdfLut.x + brdfLut.y;\n#else\nvec3 specularIBL = vec3(0.0);\n#endif\nreturn diffuseColor * diffuseIrradiance + specularColor * specularIBL;\n}\nvec3 imageBasedLightingStage(\nvec3 positionEC,\nvec3 normalEC,\nvec3 lightDirectionEC,\nvec3 lightColorHdr,\nczm_pbrParameters pbrParameters\n) {\n#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)\nreturn textureIBL(\npositionEC,\nnormalEC,\nlightDirectionEC,\npbrParameters\n);\n#else\nreturn proceduralIBL(\npositionEC,\nnormalEC,\nlightDirectionEC,\nlightColorHdr,\npbrParameters\n);\n#endif\n}\n";const ShaderDestination={VERTEX:0,FRAGMENT:1,BOTH:2,includesVertexShader:function(e){return e===ShaderDestination.VERTEX||e===ShaderDestination.BOTH},includesFragmentShader:function(e){return e===ShaderDestination.FRAGMENT||e===ShaderDestination.BOTH}};var ShaderDestination$1=Object.freeze(ShaderDestination);const ImageBasedLightingPipelineStage={name:"ImageBasedLightingPipelineStage",process:function(e,t,i){const n=t.imageBasedLighting,r=e.shaderBuilder;if(r.addDefine("USE_IBL_LIGHTING",void 0,ShaderDestination$1.FRAGMENT),r.addUniform("vec2","model_iblFactor",ShaderDestination$1.FRAGMENT),OctahedralProjectedCubeMap.isSupported(i.context)){(n.useSphericalHarmonics||n.useSpecularEnvironmentMaps||n.enabled)&&r.addUniform("mat3","model_iblReferenceFrameMatrix",ShaderDestination$1.FRAGMENT),defined(n.sphericalHarmonicCoefficients)?(r.addDefine("DIFFUSE_IBL",void 0,ShaderDestination$1.FRAGMENT),r.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,ShaderDestination$1.FRAGMENT),r.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",ShaderDestination$1.FRAGMENT)):n.useDefaultSphericalHarmonics&&r.addDefine("DIFFUSE_IBL",void 0,ShaderDestination$1.FRAGMENT),defined(n.specularEnvironmentMapAtlas)&&n.specularEnvironmentMapAtlas.ready?(r.addDefine("SPECULAR_IBL",void 0,ShaderDestination$1.FRAGMENT),r.addDefine("CUSTOM_SPECULAR_IBL",void 0,ShaderDestination$1.FRAGMENT),r.addUniform("sampler2D","model_specularEnvironmentMaps",ShaderDestination$1.FRAGMENT),r.addUniform("vec2","model_specularEnvironmentMapsSize",ShaderDestination$1.FRAGMENT),r.addUniform("float","model_specularEnvironmentMapsMaximumLOD",ShaderDestination$1.FRAGMENT)):t.useDefaultSpecularMaps&&r.addDefine("SPECULAR_IBL",void 0,ShaderDestination$1.FRAGMENT)}defined(n.luminanceAtZenith)&&(r.addDefine("USE_SUN_LUMINANCE",void 0,ShaderDestination$1.FRAGMENT),r.addUniform("float","model_luminanceAtZenith",ShaderDestination$1.FRAGMENT)),r.addFragmentLines([ImageBasedLightingStageFS]);const o={model_iblFactor:function(){return n.imageBasedLightingFactor},model_iblReferenceFrameMatrix:function(){return n.iblReferenceFrameMatrix},model_luminanceAtZenith:function(){return n.luminanceAtZenith},model_sphericalHarmonicCoefficients:function(){return n.sphericalHarmonicCoefficients},model_specularEnvironmentMaps:function(){return n.specularEnvironmentMapAtlas.texture},model_specularEnvironmentMapsSize:function(){return n.specularEnvironmentMapAtlas.texture.dimensions},model_specularEnvironmentMapsMaximumLOD:function(){return n.specularEnvironmentMapAtlas.maximumMipmapLevel}};e.uniformMap=combine$2(o,e.uniformMap)}};var ModelColorStageFS="void modelColorStage(inout czm_modelMaterial material)\n{\nmaterial.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);\nfloat highlight = ceil(model_colorBlend);\nmaterial.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);\nmaterial.alpha *= model_color.a;\n}\n";const ModelColorPipelineStage={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend",process:function(e,t,i){const n=e.shaderBuilder;n.addDefine("HAS_MODEL_COLOR",void 0,ShaderDestination$1.FRAGMENT),n.addFragmentLines([ModelColorStageFS]);const r={},o=t.color,a=e.renderStateOptions;0===o.alpha?(a.colorMask={red:!1,green:!1,blue:!1,alpha:!1},a.depthMask=!1):o.alpha<1&&(e.alphaOptions.pass=Pass$1.TRANSLUCENT,e.alphaOptions.alphaMode=AlphaMode$1.BLEND),n.addUniform("vec4",ModelColorPipelineStage.COLOR_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),r[ModelColorPipelineStage.COLOR_UNIFORM_NAME]=function(){return t.color},n.addUniform("float",ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),r[ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME]=function(){return ColorBlendMode$1.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=combine$2(r,e.uniformMap)}},AlphaPipelineStage={name:"AlphaPipelineStage",process:function(e,t,i){const n=e.alphaOptions,r=e.model;n.pass=defaultValue(n.pass,r.opaquePass);const o=e.renderStateOptions;n.pass===Pass$1.TRANSLUCENT?o.blending=BlendingState$1.ALPHA_BLEND:o.blending=BlendingState$1.DISABLED;const a=e.shaderBuilder,s=e.uniformMap,c=n.alphaMode;c===AlphaMode$1.MASK?(a.addDefine("ALPHA_MODE_MASK",void 0,ShaderDestination$1.FRAGMENT),a.addUniform("float","u_alphaCutoff",ShaderDestination$1.FRAGMENT),s.u_alphaCutoff=function(){return n.alphaCutoff}):c===AlphaMode$1.BLEND?a.addDefine("ALPHA_MODE_BLEND",void 0,ShaderDestination$1.FRAGMENT):a.addDefine("ALPHA_MODE_OPAQUE",void 0,ShaderDestination$1.FRAGMENT)}},BatchTexturePipelineStage={name:"BatchTexturePipelineStage",process:function(e,t,i){const n=e.shaderBuilder,r={},o=e.model,a=o.featureTables[o.featureTableId],s=a.featuresLength;n.addUniform("int","model_featuresLength"),r.model_featuresLength=function(){return s};const c=a.batchTexture;n.addUniform("sampler2D","model_batchTexture"),r.model_batchTexture=function(){return defaultValue(c.batchTexture,c.defaultTexture)},n.addUniform("vec4","model_textureStep"),r.model_textureStep=function(){return c.textureStep},c.textureDimensions.y>1&&(n.addDefine("MULTILINE_BATCH_TEXTURE"),n.addUniform("vec2","model_textureDimensions"),r.model_textureDimensions=function(){return c.textureDimensions}),e.uniformMap=combine$2(r,e.uniformMap)}},CustomShaderMode={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL",getDefineName:function(e){return`CUSTOM_SHADER_${e}`}};var CustomShaderMode$1=Object.freeze(CustomShaderMode),CustomShaderStageVS="void customShaderStage(\ninout czm_modelVertexOutput vsOutput,\ninout ProcessedAttributes attributes,\nFeatureIds featureIds\n) {\nVertexInput vsInput;\ninitializeInputStruct(vsInput, attributes);\nvsInput.featureIds = featureIds;\nvertexMain(vsInput, vsOutput);\nattributes.positionMC = vsOutput.positionMC;\n}\n",CustomShaderStageFS="void customShaderStage(\ninout czm_modelMaterial material,\nProcessedAttributes attributes,\nFeatureIds featureIds\n) {\nFragmentInput fsInput;\ninitializeInputStruct(fsInput, attributes);\nfsInput.featureIds = featureIds;\nfragmentMain(fsInput, material);\n}\n";function ModelExperimentalUtility(){}ModelExperimentalUtility.getFailedLoadFunction=function(e,t,i){return function(n){let r=`Failed to load ${t}: ${i}`;defined(n)&&(r+=`\n${n.message}`),e._readyPromise.reject(new RuntimeError(r))}},ModelExperimentalUtility.getNodeTransform=function(e){return defined(e.matrix)?e.matrix:Matrix4.fromTranslationQuaternionRotationScale(defined(e.translation)?e.translation:Cartesian3.ZERO,defined(e.rotation)?e.rotation:Quaternion.IDENTITY,defined(e.scale)?e.scale:Cartesian3.ONE)},ModelExperimentalUtility.getAttributeBySemantic=function(e,t,i){const n=e.attributes,r=n.length;for(let e=0;e<r;++e){const r=n[e],o=!defined(i)||r.setIndex===i;if(r.semantic===t&&o)return r}},ModelExperimentalUtility.getFeatureIdsByLabel=function(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.positionalLabel===t||n.label===t)return n}},ModelExperimentalUtility.hasQuantizedAttributes=function(e){if(!defined(e))return!1;for(let t=0;t<e.length;t++){if(defined(e[t].quantization))return!0}return!1},ModelExperimentalUtility.getAttributeInfo=function(e){const t=e.semantic,i=e.setIndex;let n,r=!1;defined(t)?(n=VertexAttributeSemantic$1.getVariableName(t,i),r=!0):(n=e.name,n=n.replace(/^_/,""),n=n.toLowerCase());const o=/^color_\d+$/.test(n),a=e.type;let s=AttributeType$1.getGlslType(a);o&&(s="vec4");const c=defined(e.quantization);let l;return c&&(l=o?"vec4":AttributeType$1.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:n,hasSemantic:r,glslType:s,quantizedGlslType:l}};const cartesianMaxScratch=new Cartesian3,cartesianMinScratch=new Cartesian3;ModelExperimentalUtility.createBoundingSphere=function(e,t,i,n){const r=ModelExperimentalUtility.getAttributeBySemantic(e,"POSITION"),o=r.max,a=r.min;let s;if(defined(i)&&defined(n)){const e=Cartesian3.add(a,n,cartesianMinScratch),t=Cartesian3.add(o,i,cartesianMaxScratch);s=BoundingSphere.fromCornerPoints(e,t)}else s=BoundingSphere.fromCornerPoints(a,o);return BoundingSphere.transform(s,t,s),s},ModelExperimentalUtility.correctModelMatrix=function(e,t,i,n){return n=Matrix4.clone(e,n),t===Axis$1.Y?n=Matrix4.multiplyTransformation(e,Axis$1.Y_UP_TO_Z_UP,n):t===Axis$1.X&&(n=Matrix4.multiplyTransformation(e,Axis$1.X_UP_TO_Z_UP,n)),i===Axis$1.Z&&(n=Matrix4.multiplyTransformation(n,Axis$1.Z_UP_TO_X_UP,n)),n};var FeatureIdStageFS="void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {\ninitializeFeatureIds(featureIds, attributes);\ninitializeFeatureIdAliases(featureIds);\n}\n",FeatureIdStageVS="void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)\n{\ninitializeFeatureIds(featureIds, attributes);\ninitializeFeatureIdAliases(featureIds);\nsetFeatureIdVaryings();\n}\n";const FeatureIdPipelineStage={};function declareStructsAndFunctions(e){e.addStruct(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS,ShaderDestination$1.VERTEX),e.addStruct(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS,ShaderDestination$1.FRAGMENT),e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,ShaderDestination$1.VERTEX),e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,ShaderDestination$1.FRAGMENT),e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,ShaderDestination$1.VERTEX),e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,ShaderDestination$1.FRAGMENT),e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,ShaderDestination$1.VERTEX)}function processInstanceFeatureIds(e,t,i){const n=t.featureIds,r=t.attributes[0].count;for(let t=0;t<n.length;t++){const o=n[t],a=o.positionalLabel;if(o instanceof ModelComponents.FeatureIdAttribute)processInstanceAttribute(e,o,a);else{processImplicitRange(e,o,a,r,1,i)}const s=o.label;defined(s)&&addAlias(e,a,s,ShaderDestination$1.BOTH)}}function processPrimitiveFeatureIds(e,t,i){const n=t.featureIds,r=ModelExperimentalUtility.getAttributeBySemantic(t,VertexAttributeSemantic$1.POSITION).count;for(let t=0;t<n.length;t++){const o=n[t],a=o.positionalLabel;let s=ShaderDestination$1.BOTH;o instanceof ModelComponents.FeatureIdAttribute?processAttribute$1(e,o,a):o instanceof ModelComponents.FeatureIdImplicitRange?processImplicitRange(e,o,a,r,void 0,i):(processTexture$1(e,o,a,t,i),s=ShaderDestination$1.FRAGMENT);const c=o.label;defined(c)&&addAlias(e,a,c,s)}}function processInstanceAttribute(e,t,i){const n=e.shaderBuilder;n.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,"int",i),n.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,"int",i);const r=t.setIndex,o=i.replace(/_\d+$/,"_"),a=`a_${o}${r}`,s=`v_${o}${r}`,c=`featureIds.${i} = int(czm_round(${a}));`,l=`featureIds.${i} = int(czm_round(${s}));`;n.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),n.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[l]),n.addVarying("float",s),n.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${s} = ${a};`])}function processAttribute$1(e,t,i){const n=e.shaderBuilder;n.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,"int",i),n.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,"int",i);const r=t.setIndex,o=i.replace(/_\d+$/,"_"),a=[`featureIds.${i} = int(czm_round(attributes.${o}${r}));`];n.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,a),n.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,a)}function processImplicitRange(e,t,i,n,r,o){generateImplicitFeatureIdAttribute(e,t,n,r,o);const a=e.shaderBuilder,s=`a_implicit_${i}`;a.addAttribute("float",s);const c=`v_implicit_${i}`;a.addVarying("float",c),a.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,"int",i),a.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,"int",i),a.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${s};`]),a.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${i} = int(czm_round(${s}));`]),a.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${i} = int(czm_round(${c}));`])}function processTexture$1(e,t,i,n,r){const o=`u_featureIdTexture_${n}`,a=e.uniformMap,s=t.textureReader;a[o]=function(){return defaultValue(s.texture,r.context.defaultTexture)};const c=s.channels,l=e.shaderBuilder;l.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,"int",i),l.addUniform("sampler2D",o,ShaderDestination$1.FRAGMENT);const u=`featureIds.${i} = czm_unpackUint(${`texture2D(${o}, ${`v_texCoord_${s.texCoord}`}).${c}`});`;l.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u])}function addAlias(e,t,i,n){const r=e.shaderBuilder,o=ShaderDestination$1.includesVertexShader(n);o&&r.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,"int",i),r.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,"int",i);const a=[`featureIds.${i} = featureIds.${t};`];o&&r.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,a),r.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,a)}function generateImplicitFeatureIdAttribute(e,t,i,n,r){const o=e.model;let a,s;if(defined(t.repeat)){const e=generateImplicitFeatureIdTypedArray(t,i);a=Buffer$1.createVertexBuffer({context:r.context,typedArray:e,usage:BufferUsage$1.STATIC_DRAW}),a.vertexArrayDestroyable=!1,o._resources.push(a)}else s=[t.offset];const c={index:e.attributeIndex++,instanceDivisor:n,value:s,vertexBuffer:a,normalize:!1,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.FLOAT,strideInBytes:ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),offsetInBytes:0};e.attributes.push(c)}function generateImplicitFeatureIdTypedArray(e,t){const i=e.offset,n=e.repeat,r=new Float32Array(t);for(let e=0;e<t;e++)r[e]=i+Math.floor(e/n);return r}FeatureIdPipelineStage.name="FeatureIdPipelineStage",FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS="FeatureIdsVS",FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS="FeatureIdsFS",FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS="FeatureIds",FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS="initializeFeatureIdsVS",FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS="initializeFeatureIdsFS",FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS="initializeFeatureIdAliasesVS",FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS="initializeFeatureIdAliasesFS",FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS="void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)",FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES="void initializeFeatureIdAliases(inout FeatureIds featureIds)",FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS="setFeatureIdVaryings",FeatureIdPipelineStage.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS="void setFeatureIdVaryings()",FeatureIdPipelineStage.process=function(e,t,i){const n=e.shaderBuilder;declareStructsAndFunctions(n);const r=e.runtimeNode.node.instances;defined(r)&&processInstanceFeatureIds(e,r,i),processPrimitiveFeatureIds(e,t,i),n.addVertexLines([FeatureIdStageVS]),n.addFragmentLines([FeatureIdStageFS])};const CustomShaderPipelineStage={};function getAttributesByName(e){const t={};for(let i=0;i<e.length;i++){const n=e[i],r=ModelExperimentalUtility.getAttributeInfo(n);t[r.variableName]=r}return t}CustomShaderPipelineStage.name="CustomShaderPipelineStage",CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS="AttributesVS",CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS="AttributesFS",CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES="Attributes",CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT="VertexInput",CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT="VertexInput",CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT="FragmentInput",CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT="FragmentInput",CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS="initializeInputStructVS",CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS="void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS="initializeInputStructFS",CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS="void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",CustomShaderPipelineStage.process=function(e,t,i){const n=e.shaderBuilder,r=e.model.customShader;defined(r.lightingModel)&&(e.lightingOptions.lightingModel=r.lightingModel);const o=e.alphaOptions;r.isTranslucent?(o.pass=Pass$1.TRANSLUCENT,o.alphaMode=AlphaMode$1.BLEND):(o.pass=void 0,o.alphaMode=AlphaMode$1.OPAQUE);const a=generateShaderLines(r,t);if(!a.customShaderEnabled)return;if(addLinesToShader(n,r,a),a.shouldComputePositionWC&&n.addDefine("COMPUTE_POSITION_WC",void 0,ShaderDestination$1.BOTH),defined(r.vertexShaderText)&&n.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,ShaderDestination$1.VERTEX),defined(r.fragmentShaderText)){n.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,ShaderDestination$1.FRAGMENT);const e=CustomShaderMode$1.getDefineName(r.mode);n.addDefine(e,void 0,ShaderDestination$1.FRAGMENT)}const s=r.uniforms;for(const e in s)if(s.hasOwnProperty(e)){const t=s[e];n.addUniform(t.type,e)}const c=r.varyings;for(const e in c)if(c.hasOwnProperty(e)){const t=c[e];n.addVarying(t,e)}e.uniformMap=combine$2(e.uniformMap,r.uniformMap)};const attributeTypeLUT={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},attributeDefaultValueLUT={position:"vec3(0.0)",normal:"vec3(0.0, 0.0, 1.0)",tangent:"vec3(1.0, 0.0, 0.0)",bitangent:"vec3(0.0, 1.0, 0.0)",texCoord:"vec2(0.0)",color:"vec4(1.0)",joints:"ivec4(0)",weights:"vec4(0.0)"};function inferAttributeDefaults(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");const i=attributeTypeLUT[t],n=attributeDefaultValueLUT[t];if(defined(i))return{attributeField:[i,e],value:n}}function generateVertexShaderLines(e,t,i){const n=partitionAttributes(t,e.usedVariablesVertex.attributeSet,!1),r=n.addToShader,o=n.missingAttributes;let a,s;const c=[],l=[];for(a in r)if(r.hasOwnProperty(a)){const e=[r[a].glslType,a];c.push(e),s=`vsInput.attributes.${a} = attributes.${a};`,l.push(s)}for(let e=0;e<o.length;e++){a=o[e];const t=inferAttributeDefaults(a);if(!defined(t))return void CustomShaderPipelineStage._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS",`Primitive is missing attribute ${a}, disabling custom vertex shader`);c.push(t.attributeField),s=`vsInput.attributes.${a} = ${t.value};`,l.push(s)}i.enabled=!0,i.attributeFields=c,i.initializationLines=l}function generatePositionBuiltins(e){const t=[],i=[],n=e.usedVariablesFragment.attributeSet;return n.hasOwnProperty("positionWC")&&(t.push(["vec3","positionWC"]),i.push("fsInput.attributes.positionWC = attributes.positionWC;")),n.hasOwnProperty("positionEC")&&(t.push(["vec3","positionEC"]),i.push("fsInput.attributes.positionEC = attributes.positionEC;")),{attributeFields:t,initializationLines:i}}function generateFragmentShaderLines(e,t,i){const n=partitionAttributes(t,e.usedVariablesFragment.attributeSet,!0),r=n.addToShader,o=n.missingAttributes;let a,s;const c=[],l=[];for(a in r)if(r.hasOwnProperty(a)){const e=[r[a].glslType,a];c.push(e),s=`fsInput.attributes.${a} = attributes.${a};`,l.push(s)}for(let e=0;e<o.length;e++){a=o[e];const t=inferAttributeDefaults(a);if(!defined(t))return void CustomShaderPipelineStage._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${a}, disabling custom fragment shader.`);c.push(t.attributeField),s=`fsInput.attributes.${a} = ${t.value};`,l.push(s)}const u=generatePositionBuiltins(e);i.enabled=!0,i.attributeFields=c.concat(u.attributeFields),i.initializationLines=u.initializationLines.concat(l)}const builtinAttributes={positionWC:!0,positionEC:!0};function partitionAttributes(e,t,i){let n,r;const o={};for(r in e)if(e.hasOwnProperty(r)){const a=e[r];n=r,i&&"normalMC"===r?n="normalEC":i&&"tangentMC"===r&&(n="tangentEC"),t.hasOwnProperty(n)&&(o[n]=a)}const a=[];for(r in t)if(t.hasOwnProperty(r)){if(builtinAttributes.hasOwnProperty(r))continue;n=r,i&&"normalEC"===r?n="normalMC":i&&"tangentEC"===r&&(n="tangentMC"),e.hasOwnProperty(n)||a.push(r)}return{addToShader:o,missingAttributes:a}}function generateShaderLines(e,t){const i={enabled:!1},n={enabled:!1},r=getAttributesByName(t.attributes);defined(e.vertexShaderText)&&generateVertexShaderLines(e,r,i),defined(e.fragmentShaderText)&&generateFragmentShaderLines(e,r,n);const o=e.usedVariablesFragment.attributeSet.hasOwnProperty("positionWC")&&n.enabled;return{vertexLines:i,fragmentLines:n,vertexLinesEnabled:i.enabled,fragmentLinesEnabled:n.enabled,customShaderEnabled:i.enabled||n.enabled,shouldComputePositionWC:o}}function addVertexLinesToShader(e,t){let i,n=CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(n,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,ShaderDestination$1.VERTEX);const r=t.attributeFields;for(i=0;i<r.length;i++){const t=r[i],o=t[0],a=t[1];e.addStructField(n,o,a)}n=CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT,e.addStruct(n,CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT,ShaderDestination$1.VERTEX),e.addStructField(n,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(n,FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS,"featureIds");const o=CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(o,CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,ShaderDestination$1.VERTEX);const a=t.initializationLines;e.addFunctionLines(o,a)}function addFragmentLinesToShader(e,t){let i,n,r,o,a=CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(a,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,ShaderDestination$1.FRAGMENT);const s=t.attributeFields;for(i=0;i<s.length;i++)n=s[i],r=n[0],o=n[1],e.addStructField(a,r,o);a=CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(a,CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT,ShaderDestination$1.FRAGMENT),e.addStructField(a,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(a,FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS,"featureIds");const c=CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(c,CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,ShaderDestination$1.FRAGMENT);const l=t.initializationLines;e.addFunctionLines(c,l)}function addLinesToShader(e,t,i){const n=i.vertexLines;n.enabled&&(addVertexLinesToShader(e,n),e.addVertexLines(["#line 0",t.vertexShaderText,CustomShaderStageVS]));const r=i.fragmentLines;r.enabled&&(addFragmentLinesToShader(e,r),e.addFragmentLines(["#line 0",t.fragmentShaderText,CustomShaderStageFS]))}CustomShaderPipelineStage._oneTimeWarning=oneTimeWarning;var CPUStylingStageVS="void filterByPassType(inout vec3 positionMC, vec4 featureColor)\n{\nbool styleTranslucent = (featureColor.a != 1.0);\nif (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n{\npositionMC *= 0.0;\n}\nelse if (czm_pass != czm_passTranslucent && styleTranslucent)\n{\npositionMC *= 0.0;\n}\n}\nvoid cpuStylingStage(inout vec3 positionMC, inout SelectedFeature feature)\n{\nfloat show = ceil(feature.color.a);\npositionMC *= show;\n#ifdef HAS_SELECTED_FEATURE_ID_ATTRIBUTE\nfilterByPassType(positionMC, feature.color);\n#endif\n}\n",CPUStylingStageFS="void filterByPassType(vec4 featureColor)\n{\nbool styleTranslucent = (featureColor.a != 1.0);\nif (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n{\ndiscard;\n}\nelse if (czm_pass != czm_passTranslucent && styleTranslucent)\n{\ndiscard;\n}\n}\nvoid cpuStylingStage(inout czm_modelMaterial material, SelectedFeature feature)\n{\nvec4 featureColor = feature.color;\nif (featureColor.a == 0.0)\n{\ndiscard;\n}\n#ifdef HAS_SELECTED_FEATURE_ID_TEXTURE\nfilterByPassType(featureColor);\n#endif\nfeatureColor = czm_gammaCorrect(featureColor);\nfloat highlight = ceil(model_colorBlend);\nmaterial.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);\nmaterial.alpha *= featureColor.a;\n}\n";const CPUStylingPipelineStage={name:"CPUStylingPipelineStage",process:function(e,t,i){const n=e.model,r=e.shaderBuilder;r.addVertexLines([CPUStylingStageVS]),r.addFragmentLines([CPUStylingStageFS]),r.addDefine("USE_CPU_STYLING",void 0,ShaderDestination$1.BOTH),defined(n.color)||(r.addUniform("float",ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),e.uniformMap[ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME]=function(){return ColorBlendMode$1.getColorBlend(n.colorBlendMode,n.colorBlendAmount)}),r.addUniform("bool","model_commandTranslucent",ShaderDestination$1.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===Pass$1.TRANSLUCENT};const o=n.featureTables[n.featureTableId],a=StyleCommandsNeeded$1.getStyleCommandsNeeded(o.featuresLength,o.batchTexture.translucentFeaturesLength);a!==StyleCommandsNeeded$1.ALL_OPAQUE&&(e.alphaOptions.alphaMode=AlphaMode$1.BLEND),e.styleCommandsNeeded=a}},DequantizationPipelineStage={};function addDequantizationUniforms(e,t){const i=e.shaderBuilder,n=e.uniformMap,r=t.variableName,o=t.attribute.quantization;if(o.octEncoded){const e=`model_normalizationRange_${r}`;i.addUniform("float",e,ShaderDestination$1.VERTEX),n[e]=function(){return o.normalizationRange}}else{const e=`model_quantizedVolumeOffset_${r}`,a=`model_quantizedVolumeStepSize_${r}`,s=t.glslType;i.addUniform(s,e,ShaderDestination$1.VERTEX),i.addUniform(s,a,ShaderDestination$1.VERTEX);let c=o.quantizedVolumeOffset,l=o.quantizedVolumeStepSize;/^color_\d+$/.test(r)&&(c=promoteToVec4(c,0),l=promoteToVec4(l,1)),n[e]=function(){return c},n[a]=function(){return l}}}function promoteToVec4(e,t){return e instanceof Cartesian4?e:new Cartesian4(e.x,e.y,e.z,t)}function updateDequantizationFunction(e,t){const i=t.variableName,n=t.attribute.quantization;let r;r=n.octEncoded?generateOctDecodeLine(i,n):generateDequantizeLine(i),e.addFunctionLines(DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[r])}function generateOctDecodeLine(e,t){return`${`attributes.${e}`} = czm_octDecode(${`a_quantized_${e}`}, ${`model_normalizationRange_${e}`})${t.octEncodedZXY?".zxy":".xyz"};`}function generateDequantizeLine(e){return`${`attributes.${e}`} = ${`model_quantizedVolumeOffset_${e}`} + ${`a_quantized_${e}`} * ${`model_quantizedVolumeStepSize_${e}`};`}DequantizationPipelineStage.name="DequantizationPipelineStage",DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS="dequantizationStage",DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS="void dequantizationStage(inout ProcessedAttributes attributes)",DequantizationPipelineStage.process=function(e,t){const i=e.shaderBuilder;i.addFunction(DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,ShaderDestination$1.VERTEX),i.addDefine("USE_DEQUANTIZATION",void 0,ShaderDestination$1.VERTEX);const n=t.attributes;for(let t=0;t<n.length;t++){const r=n[t];if(!defined(r.quantization))continue;const o=ModelExperimentalUtility.getAttributeInfo(r);updateDequantizationFunction(i,o),addDequantizationUniforms(e,o)}};var GeometryStageFS="void geometryStage(out ProcessedAttributes attributes)\n{\nattributes.positionMC = v_positionMC;\nattributes.positionEC = v_positionEC;\n#ifdef COMPUTE_POSITION_WC\nattributes.positionWC = v_positionWC;\n#endif\n#ifdef HAS_NORMALS\nattributes.normalEC = normalize(v_normalEC);\n#endif\n#ifdef HAS_TANGENTS\nattributes.tangentEC = normalize(v_tangentEC);\n#endif\n#ifdef HAS_BITANGENTS\nattributes.bitangentEC = normalize(v_bitangentEC);\n#endif\nsetDynamicVaryings(attributes);\n}\n",GeometryStageVS="void geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal)\n{\nvec3 positionMC = attributes.positionMC;\nv_positionMC = positionMC;\nv_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;\ngl_Position = czm_projection * vec4(v_positionEC, 1.0);\n#ifdef COMPUTE_POSITION_WC\nv_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;\n#endif\n#ifdef HAS_NORMALS\nv_normalEC = normal * attributes.normalMC;\n#endif\n#ifdef HAS_TANGENTS\nv_tangentEC = normalize(normal * attributes.tangentMC);\n#endif\n#ifdef HAS_BITANGENTS\nv_bitangentEC = normalize(normal * attributes.bitangentMC);\n#endif\nsetDynamicVaryings(attributes);\n}\n",SelectedFeatureIdStageCommon="vec2 computeSt(float featureId)\n{\nfloat stepX = model_textureStep.x;\nfloat centerX = model_textureStep.y;\n#ifdef MULTILINE_BATCH_TEXTURE\nfloat stepY = model_textureStep.z;\nfloat centerY = model_textureStep.w;\nfloat xId = mod(featureId, model_textureDimensions.x);\nfloat yId = floor(featureId / model_textureDimensions.x);\nreturn vec2(centerX + (xId * stepX), centerY + (yId * stepY));\n#else\nreturn vec2(centerX + (featureId * stepX), 0.5);\n#endif\n}\nvoid selectedFeatureIdStage(out SelectedFeature feature, FeatureIds featureIds)\n{\nint featureId = featureIds.SELECTED_FEATURE_ID;\nif (featureId < model_featuresLength)\n{\nvec2 featureSt = computeSt(float(featureId));\nfeature.id = featureId;\nfeature.st = featureSt;\nfeature.color = texture2D(model_batchTexture, featureSt);\n}\nelse\n{\nfeature.id = model_featuresLength + 1;\nfeature.st = vec2(0.0);\nfeature.color = vec4(1.0);\n}\n#ifdef HAS_NULL_FEATURE_ID\nif (featureId == model_nullFeatureId) {\nfeature.id = featureId;\nfeature.st = vec2(0.0);\nfeature.color = vec4(1.0);\n}\n#endif\n}\n";const SelectedFeatureIdPipelineStage={};function getFeatureIdDefine(e){return e instanceof ModelComponents.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function getShaderDestination(e){return e instanceof ModelComponents.FeatureIdTexture?ShaderDestination$1.FRAGMENT:ShaderDestination$1.BOTH}function getSelectedFeatureIds(e,t,i){let n,r;return defined(t.instances)&&(r=ModelExperimentalUtility.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),defined(r))?(n=defaultValue(r.label,r.positionalLabel),{featureIds:r,variableName:n,shaderDestination:getShaderDestination(r),featureIdDefine:getFeatureIdDefine(r)}):(r=ModelExperimentalUtility.getFeatureIdsByLabel(i.featureIds,e.featureIdLabel),n=defaultValue(r.label,r.positionalLabel),{featureIds:r,variableName:n,shaderDestination:getShaderDestination(r),featureIdDefine:getFeatureIdDefine(r)})}function updateFeatureStruct(e){e.addStructField(SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}SelectedFeatureIdPipelineStage.name="SelectedFeatureIdPipelineStage",SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE="SelectedFeature",SelectedFeatureIdPipelineStage.STRUCT_NAME_SELECTED_FEATURE="SelectedFeature",SelectedFeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS="updateFeatureStructVS",SelectedFeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS="updateFeatureStructFS",SelectedFeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE="void updateFeatureStruct(inout SelectedFeature feature)",SelectedFeatureIdPipelineStage.process=function(e,t,i){const n=e.shaderBuilder;e.hasPropertyTable=!0;const r=getSelectedFeatureIds(e.model,e.runtimeNode.node,t),o=r.shaderDestination;n.addDefine("HAS_SELECTED_FEATURE_ID",void 0,o),n.addDefine("SELECTED_FEATURE_ID",r.variableName,o),n.addDefine(r.featureIdDefine,void 0,o),updateFeatureStruct(n);const a=r.featureIds.nullFeatureId,s=e.uniformMap;defined(a)&&(n.addDefine("HAS_NULL_FEATURE_ID",void 0,o),n.addUniform("int","model_nullFeatureId",o),s.model_nullFeatureId=function(){return a}),r.shaderDestination===ShaderDestination$1.BOTH&&n.addVertexLines([SelectedFeatureIdStageCommon]),n.addFragmentLines([SelectedFeatureIdStageCommon])};const ModelExperimentalType={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",is3DTiles:function(e){switch(e){case ModelExperimentalType.TILE_GLTF:case ModelExperimentalType.TILE_B3DM:case ModelExperimentalType.TILE_I3DM:case ModelExperimentalType.TILE_PNTS:return!0;case ModelExperimentalType.GLTF:return!1}}};var ModelExperimentalType$1=Object.freeze(ModelExperimentalType);const GeometryPipelineStage={};function processAttribute(e,t,i){const n=e.shaderBuilder,r=ModelExperimentalUtility.getAttributeInfo(t);addAttributeToRenderResources(e,t,i),addAttributeDeclaration(n,r),addVaryingDeclaration(n,r),defined(t.semantic)&&addSemanticDefine(n,t);e.model.type===ModelExperimentalType$1.TILE_PNTS&&n.addDefine("HAS_SRGB_COLOR",void 0,ShaderDestination$1.FRAGMENT),updateAttributesStruct(n,r),updateInitialzeAttributesFunction(n,r),updateSetDynamicVaryingsFunction(n,r)}function addSemanticDefine(e,t){const i=t.semantic,n=t.setIndex;switch(i){case VertexAttributeSemantic$1.NORMAL:e.addDefine("HAS_NORMALS");break;case VertexAttributeSemantic$1.TANGENT:e.addDefine("HAS_TANGENTS");break;case VertexAttributeSemantic$1.FEATURE_ID:e.addDefine(`HAS${i}_${n}`);break;case VertexAttributeSemantic$1.TEXCOORD:case VertexAttributeSemantic$1.COLOR:e.addDefine(`HAS_${i}_${n}`)}}function addAttributeToRenderResources(e,t,i){const n=t.quantization;let r,o;defined(n)?(r=n.type,o=n.componentDatatype):(r=t.type,o=t.componentDatatype);const a=t.semantic,s=t.setIndex;a===VertexAttributeSemantic$1.FEATURE_ID&&s>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=s+1);const c={index:i,value:defined(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(r),componentDatatype:o,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(c)}function addVaryingDeclaration(e,t){const i=t.variableName;let n,r=`v_${i}`;"normalMC"===i?(r="v_normalEC",n=t.glslType):"tangentMC"===i?(n="vec3",r="v_tangentEC"):n=t.glslType,e.addVarying(n,r)}function addAttributeDeclaration(e,t){const i=t.attribute.semantic,n=t.variableName;let r,o;t.isQuantized?(r=`a_quantized_${n}`,o=t.quantizedGlslType):(r=`a_${n}`,o=t.glslType),i===VertexAttributeSemantic$1.POSITION?e.setPositionAttribute(o,r):e.addAttribute(o,r)}function updateAttributesStruct(e,t){const i=GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,n=GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,r=t.variableName;"tangentMC"===r?(e.addStructField(i,"vec3","tangentMC"),e.addStructField(n,"vec3","tangentEC")):"normalMC"===r?(e.addStructField(i,"vec3","normalMC"),e.addStructField(n,"vec3","normalEC")):(e.addStructField(i,t.glslType,r),e.addStructField(n,t.glslType,r))}function updateInitialzeAttributesFunction(e,t){if(t.isQuantized)return;const i=GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,n=t.variableName;let r;r="tangentMC"===n?"attributes.tangentMC = a_tangentMC.xyz;":`attributes.${n} = a_${n};`,e.addFunctionLines(i,[r])}function updateSetDynamicVaryingsFunction(e,t){const i=t.attribute.semantic,n=t.attribute.setIndex;if(defined(i)&&!defined(n))return;let r=GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;const o=t.variableName;let a=`v_${o} = attributes.${o};`;e.addFunctionLines(r,[a]),r=GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,a=`attributes.${o} = v_${o};`,e.addFunctionLines(r,[a])}function handleBitangents(e,t){let i=!1,n=!1;for(let e=0;e<t.length;e++){const r=t[e];r.semantic===VertexAttributeSemantic$1.NORMAL?i=!0:r.semantic===VertexAttributeSemantic$1.TANGENT&&(n=!0)}i&&n&&(e.addDefine("HAS_BITANGENTS"),e.addFunctionLines(GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,["attributes.bitangentMC = normalize(cross(a_normalMC, a_tangentMC.xyz) * a_tangentMC.w);"]),e.addVarying("vec3","v_bitangentEC"),e.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}GeometryPipelineStage.name="GeometryPipelineStage",GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS="ProcessedAttributesVS",GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS="ProcessedAttributesFS",GeometryPipelineStage.STRUCT_NAME_PROCESSED_ATTRIBUTES="ProcessedAttributes",GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES="initializeAttributes",GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES="void initializeAttributes(out ProcessedAttributes attributes)",GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS="setDynamicVaryingsVS",GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS="setDynamicVaryingsFS",GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS="void setDynamicVaryings(inout ProcessedAttributes attributes)",GeometryPipelineStage.process=function(e,t){const i=e.shaderBuilder;let n;i.addStruct(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",ShaderDestination$1.VERTEX),i.addStruct(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",ShaderDestination$1.FRAGMENT),i.addStruct(SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,SelectedFeatureIdPipelineStage.STRUCT_NAME_SELECTED_FEATURE,ShaderDestination$1.BOTH),i.addFunction(GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,ShaderDestination$1.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ShaderDestination$1.VERTEX),i.addFunction(GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ShaderDestination$1.FRAGMENT);for(let i=0;i<t.attributes.length;i++){const r=t.attributes[i];n=r.semantic===VertexAttributeSemantic$1.POSITION?0:e.attributeIndex++,processAttribute(e,r,n)}handleBitangents(i,t.attributes),t.primitiveType===PrimitiveType$1.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines([GeometryStageVS]),i.addFragmentLines([GeometryStageFS])};var LightingStageFS="#ifdef LIGHTING_PBR\nvec3 computePbrLighting(czm_modelMaterial inputMaterial, ProcessedAttributes attributes)\n{\nczm_pbrParameters pbrParameters;\npbrParameters.diffuseColor = inputMaterial.diffuse;\npbrParameters.f0 = inputMaterial.specular;\npbrParameters.roughness = inputMaterial.roughness;\n#ifdef USE_CUSTOM_LIGHT_COLOR\nvec3 lightColorHdr = model_lightColorHdr;\n#else\nvec3 lightColorHdr = czm_lightColorHdr;\n#endif\nvec3 color = inputMaterial.diffuse;\n#ifdef HAS_NORMALS\ncolor = czm_pbrLighting(\nattributes.positionEC,\ninputMaterial.normalEC,\nczm_lightDirectionEC,\nlightColorHdr,\npbrParameters\n);\n#ifdef USE_IBL_LIGHTING\ncolor += imageBasedLightingStage(\nattributes.positionEC,\ninputMaterial.normalEC,\nczm_lightDirectionEC,\nlightColorHdr,\npbrParameters\n);\n#endif\n#endif\ncolor *= inputMaterial.occlusion;\ncolor += inputMaterial.emissive;\n#ifndef HDR\ncolor = czm_acesTonemapping(color);\n#endif\nreturn color;\n}\n#endif\nvoid lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)\n{\nvec3 color = vec3(0.0);\n#ifdef LIGHTING_PBR\ncolor = computePbrLighting(material, attributes);\n#else // unlit\ncolor = material.diffuse;\n#endif\n#ifndef HDR\ncolor = czm_linearToSrgb(color);\n#endif\nmaterial.diffuse = color;\n}\n";const LightingModel={UNLIT:0,PBR:1};var LightingModel$1=Object.freeze(LightingModel);const LightingPipelineStage={name:"LightingPipelineStage",process:function(e,t){const i=e.model,n=e.lightingOptions,r=e.shaderBuilder;if(defined(i.lightColor)){r.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,ShaderDestination$1.FRAGMENT),r.addUniform("vec3","model_lightColorHdr",ShaderDestination$1.FRAGMENT);e.uniformMap.model_lightColorHdr=function(){return i.lightColor}}n.lightingModel===LightingModel$1.PBR?r.addDefine("LIGHTING_PBR",void 0,ShaderDestination$1.FRAGMENT):r.addDefine("LIGHTING_UNLIT",void 0,ShaderDestination$1.FRAGMENT),r.addFragmentLines([LightingStageFS])}};var MaterialStageFS="bool isDefaultStyleColor(vec3 color)\n{\nreturn all(greaterThan(color, vec3(1.0 - czm_epsilon3)));\n}\nvec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)\n{\nvec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);\nvec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;\nreturn color;\n}\nvec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)\n{\nreturn vec2(textureTransform * vec3(texCoord, 1.0));\n}\n#ifdef HAS_NORMALS\nvec3 computeNormal(ProcessedAttributes attributes)\n{\nvec3 ng = attributes.normalEC;\nvec3 normal = ng;\n#ifdef HAS_NORMAL_TEXTURE\nvec2 normalTexCoords = TEXCOORD_NORMAL;\n#ifdef HAS_NORMAL_TEXTURE_TRANSFORM\nnormalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);\n#endif\n#ifdef HAS_BITANGENTS\nvec3 t = attributes.tangentEC;\nvec3 b = attributes.bitangentEC;\nmat3 tbn = mat3(t, b, ng);\nvec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\nnormal = normalize(tbn * (2.0 * n - 1.0));\n#elif defined(GL_OES_standard_derivatives)\nvec3 positionEC = attributes.positionEC;\nvec3 pos_dx = dFdx(positionEC);\nvec3 pos_dy = dFdy(positionEC);\nvec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));\nvec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));\nvec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\nt = normalize(t - ng * dot(ng, t));\nvec3 b = normalize(cross(ng, t));\nmat3 tbn = mat3(t, b, ng);\nvec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\nnormal = normalize(tbn * (2.0 * n - 1.0));\n#endif\n#endif\nreturn normal;\n}\n#endif\nvoid materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)\n{\n#ifdef HAS_NORMALS\nmaterial.normalEC = computeNormal(attributes);\n#endif\nvec4 baseColorWithAlpha = vec4(1.0);\n#ifdef HAS_BASE_COLOR_TEXTURE\nvec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;\n#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM\nbaseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);\n#endif\nbaseColorWithAlpha = czm_srgbToLinear(texture2D(u_baseColorTexture, baseColorTexCoords));\n#ifdef HAS_BASE_COLOR_FACTOR\nbaseColorWithAlpha *= u_baseColorFactor;\n#endif\n#elif defined(HAS_BASE_COLOR_FACTOR)\nbaseColorWithAlpha = u_baseColorFactor;\n#endif\n#ifdef HAS_COLOR_0\nvec4 color = attributes.color_0;\n#ifdef HAS_SRGB_COLOR\ncolor = czm_srgbToLinear(color);\n#endif\nbaseColorWithAlpha *= color;\n#endif\nmaterial.diffuse = baseColorWithAlpha.rgb;\nmaterial.alpha = baseColorWithAlpha.a;\n#ifdef USE_CPU_STYLING\nmaterial.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);\n#endif\n#ifdef HAS_OCCLUSION_TEXTURE\nvec2 occlusionTexCoords = TEXCOORD_OCCLUSION;\n#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM\nocclusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);\n#endif\nmaterial.occlusion = texture2D(u_occlusionTexture, occlusionTexCoords).r;\n#endif\n#ifdef HAS_EMISSIVE_TEXTURE\nvec2 emissiveTexCoords = TEXCOORD_EMISSIVE;\n#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM\nemissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);\n#endif\nvec3 emissive = czm_srgbToLinear(texture2D(u_emissiveTexture, emissiveTexCoords).rgb);\n#ifdef HAS_EMISSIVE_FACTOR\nemissive *= u_emissiveFactor;\n#endif\nmaterial.emissive = emissive;\n#elif defined(HAS_EMISSIVE_FACTOR)\nmaterial.emissive = u_emissiveFactor;\n#endif\n#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)\n#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;\n#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM\nspecularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);\n#endif\nvec4 specularGlossiness = czm_srgbToLinear(texture2D(u_specularGlossinessTexture, specularGlossinessTexCoords));\nvec3 specular = specularGlossiness.rgb;\nfloat glossiness = specularGlossiness.a;\n#ifdef HAS_SPECULAR_FACTOR\nspecular *= u_specularFactor;\n#endif\n#ifdef HAS_GLOSSINESS_FACTOR\nglossiness *= u_glossinessFactor;\n#endif\n#else\n#ifdef HAS_SPECULAR_FACTOR\nvec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n#else\nvec3 specular = vec3(1.0);\n#endif\n#ifdef HAS_GLOSSINESS_FACTOR\nfloat glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n#else\nfloat glossiness = 1.0;\n#endif\n#endif\n#ifdef HAS_DIFFUSE_TEXTURE\nvec2 diffuseTexCoords = TEXCOORD_DIFFUSE;\n#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM\ndiffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);\n#endif\nvec4 diffuse = czm_srgbToLinear(texture2D(u_diffuseTexture, diffuseTexCoords));\n#ifdef HAS_DIFFUSE_FACTOR\ndiffuse *= u_diffuseFactor;\n#endif\n#elif defined(HAS_DIFFUSE_FACTOR)\nvec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n#else\nvec4 diffuse = vec4(1.0);\n#endif\nczm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(\ndiffuse.rgb,\nspecular,\nglossiness\n);\nmaterial.diffuse = parameters.diffuseColor;\nmaterial.alpha = diffuse.a;\nmaterial.specular = parameters.f0;\nmaterial.roughness = parameters.roughness;\n#elif defined(LIGHTING_PBR)\n#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE\nvec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;\n#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM\nmetallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);\n#endif\nvec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;\nfloat metalness = clamp(metallicRoughness.b, 0.0, 1.0);\nfloat roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n#ifdef HAS_METALLIC_FACTOR\nmetalness *= u_metallicFactor;\n#endif\n#ifdef HAS_ROUGHNESS_FACTOR\nroughness *= u_roughnessFactor;\n#endif\n#else\n#ifdef HAS_METALLIC_FACTOR\nfloat metalness = clamp(u_metallicFactor, 0.0, 1.0);\n#else\nfloat metalness = 1.0;\n#endif\n#ifdef HAS_ROUGHNESS_FACTOR\nfloat roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n#else\nfloat roughness = 1.0;\n#endif\n#endif\nczm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(\nmaterial.diffuse,\nmetalness,\nroughness\n);\nmaterial.diffuse = parameters.diffuseColor;\nmaterial.specular = parameters.f0;\nmaterial.roughness = parameters.roughness;\n#endif\n}\n";const Material$1=ModelComponents.Material,MetallicRoughness$1=ModelComponents.MetallicRoughness,SpecularGlossiness=ModelComponents.SpecularGlossiness,MaterialPipelineStage={};function processTextureTransform(e,t,i,n,r){const o=`HAS_${r}_TEXTURE_TRANSFORM`;e.addDefine(o,void 0,ShaderDestination$1.FRAGMENT);const a=`${n}Transform`;e.addUniform("mat3",a,ShaderDestination$1.FRAGMENT),t[a]=function(){return i.transform}}function processTexture(e,t,i,n,r,o){e.addUniform("sampler2D",n,ShaderDestination$1.FRAGMENT),t[n]=function(){return defaultValue(i.texture,o)};const a=`HAS_${r}_TEXTURE`;e.addDefine(a,void 0,ShaderDestination$1.FRAGMENT);const s=`v_texCoord_${i.texCoord}`,c=`TEXCOORD_${r}`;e.addDefine(c,s,ShaderDestination$1.FRAGMENT);const l=i.transform;defined(l)&&!Matrix3.equals(l,Matrix3.IDENTITY)&&processTextureTransform(e,t,i,n,r)}function processMaterialUniforms(e,t,i,n,r,o){const a=e.emissiveTexture;defined(a)&&processTexture(i,t,a,"u_emissiveTexture","EMISSIVE",o);const s=e.emissiveFactor;defined(s)&&!Cartesian3.equals(s,Material$1.DEFAULT_EMISSIVE_FACTOR)&&(i.addUniform("vec3","u_emissiveFactor",ShaderDestination$1.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},i.addDefine("HAS_EMISSIVE_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const c=e.normalTexture;defined(c)&&processTexture(i,t,c,"u_normalTexture","NORMAL",r);const l=e.occlusionTexture;defined(l)&&processTexture(i,t,l,"u_occlusionTexture","OCCLUSION",n)}function processSpecularGlossinessUniforms(e,t,i,n){const r=e.specularGlossiness;i.addDefine("USE_SPECULAR_GLOSSINESS",void 0,ShaderDestination$1.FRAGMENT);const o=r.diffuseTexture;defined(o)&&processTexture(i,t,o,"u_diffuseTexture","DIFFUSE",n);const a=r.diffuseFactor;defined(a)&&!Cartesian4.equals(a,SpecularGlossiness.DEFAULT_DIFFUSE_FACTOR)&&(i.addUniform("vec4","u_diffuseFactor",ShaderDestination$1.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},i.addDefine("HAS_DIFFUSE_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const s=r.specularGlossinessTexture;defined(s)&&processTexture(i,t,s,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",n);const c=r.specularFactor;defined(c)&&!Cartesian3.equals(c,SpecularGlossiness.DEFAULT_SPECULAR_FACTOR)&&(i.addUniform("vec3","u_specularFactor",ShaderDestination$1.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},i.addDefine("HAS_SPECULAR_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const l=r.glossinessFactor;defined(l)&&l!==SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR&&(i.addUniform("float","u_glossinessFactor",ShaderDestination$1.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},i.addDefine("HAS_GLOSSINESS_FACTOR",void 0,ShaderDestination$1.FRAGMENT))}function processMetallicRoughnessUniforms(e,t,i,n){const r=e.metallicRoughness;i.addDefine("USE_METALLIC_ROUGHNESS",void 0,ShaderDestination$1.FRAGMENT);const o=r.baseColorTexture;defined(o)&&processTexture(i,t,o,"u_baseColorTexture","BASE_COLOR",n);const a=r.baseColorFactor;defined(a)&&!Cartesian4.equals(a,MetallicRoughness$1.DEFAULT_BASE_COLOR_FACTOR)&&(i.addUniform("vec4","u_baseColorFactor",ShaderDestination$1.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},i.addDefine("HAS_BASE_COLOR_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const s=r.metallicRoughnessTexture;defined(s)&&processTexture(i,t,s,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",n);const c=r.metallicFactor;defined(c)&&c!==MetallicRoughness$1.DEFAULT_METALLIC_FACTOR&&(i.addUniform("float","u_metallicFactor",ShaderDestination$1.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},i.addDefine("HAS_METALLIC_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const l=r.roughnessFactor;defined(l)&&l!==MetallicRoughness$1.DEFAULT_ROUGHNESS_FACTOR&&(i.addUniform("float","u_roughnessFactor",ShaderDestination$1.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},i.addDefine("HAS_ROUGHNESS_FACTOR",void 0,ShaderDestination$1.FRAGMENT))}MaterialPipelineStage.name="MaterialPipelineStage",MaterialPipelineStage.process=function(e,t,i){const n=t.material,r=e.uniformMap,o=e.shaderBuilder,a=i.context.defaultTexture;processMaterialUniforms(n,r,o,a,i.context.defaultNormalTexture,i.context.defaultEmissiveTexture),defined(n.specularGlossiness)?processSpecularGlossinessUniforms(n,r,o,a):processMetallicRoughnessUniforms(n,r,o,a);const s=ModelExperimentalUtility.getAttributeBySemantic(t,VertexAttributeSemantic$1.NORMAL),c=e.lightingOptions;n.unlit||!s?c.lightingModel=LightingModel$1.UNLIT:c.lightingModel=LightingModel$1.PBR;const l=e.model,u=l.backFaceCulling&&!n.doubleSided,d=defined(l.color)&&l.color.alpha<1;e.renderStateOptions.cull={enabled:u&&!d};const h=e.alphaOptions;defined(h.alphaMode)||(h.alphaMode=n.alphaMode,n.alphaMode===AlphaMode$1.BLEND?h.pass=Pass$1.TRANSLUCENT:n.alphaMode===AlphaMode$1.MASK&&(h.alphaCutoff=n.alphaCutoff)),o.addFragmentLines([MaterialStageFS])},MaterialPipelineStage._processTexture=processTexture,MaterialPipelineStage._processTextureTransform=processTextureTransform;const PickingPipelineStage={};function buildPickObject(e,t){const i=e.model,n={model:i,node:e.runtimeNode,primitive:e.runtimePrimitive};let r;if(ModelExperimentalType$1.is3DTiles(i.type)){const e=i.content;r={content:e,primitive:e.tileset,detail:n}}else r={primitive:i,detail:n};return defined(t)&&(r.instanceId=t),r}function processPickTexture(e,t,i){const n=e.model;let r,o;const a=n.featureIdLabel,s=n.instanceFeatureIdLabel;defined(n.featureTableId)?r=n.featureTableId:defined(i)?(o=ModelExperimentalUtility.getFeatureIdsByLabel(i.featureIds,s),r=o.propertyTableId):(o=ModelExperimentalUtility.getFeatureIdsByLabel(t.featureIds,a),r=o.propertyTableId);const c=n.featureTables[r];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",ShaderDestination$1.FRAGMENT);const l=c.batchTexture;e.uniformMap.model_pickTexture=function(){return defaultValue(l.pickTexture,l.defaultTexture)},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture2D(model_pickTexture, selectedFeature.st) : vec4(0.0))"}function processInstancedPickIds(e,t,i){const n=e.instanceCount,r=new Array(n),o=new Uint8Array(4*n),a=e.model._resources;for(let t=0;t<n;t++){const n=buildPickObject(e,t),s=i.createPickId(n);a.push(s),r[t]=s;const c=s.color;o[4*t+0]=Color.floatToByte(c.red),o[4*t+1]=Color.floatToByte(c.green),o[4*t+2]=Color.floatToByte(c.blue),o[4*t+3]=Color.floatToByte(c.alpha)}const s=Buffer$1.createVertexBuffer({context:i,typedArray:o,usage:BufferUsage$1.STATIC_DRAW});s.vertexArrayDestroyable=!1,a.push(s);const c={index:e.attributeIndex++,vertexBuffer:s,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(c);const l=e.shaderBuilder;l.addDefine("USE_PICKING",void 0,ShaderDestination$1.BOTH),l.addAttribute("vec4","a_pickColor"),l.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}PickingPipelineStage.name="PickingPipelineStage",PickingPipelineStage.process=function(e,t,i){const n=i.context,r=e.runtimeNode,o=e.shaderBuilder,a=e.model,s=r.node.instances;if(e.hasPropertyTable)processPickTexture(e,t,s);else if(defined(s))processInstancedPickIds(e,s,n);else{const t=buildPickObject(e),i=n.createPickId(t);a._resources.push(i),o.addUniform("vec4","czm_pickColor",ShaderDestination$1.FRAGMENT);e.uniformMap.czm_pickColor=function(){return i.color},e.pickId="czm_pickColor"}};var PointCloudAttenuationStageVS="float pointCloudAttenuationStage(vec3 positionEC) {\nfloat pointSize = model_pointCloudAttenuation.x;\nfloat geometricError = model_pointCloudAttenuation.y;\nfloat depthMultiplier = model_pointCloudAttenuation.z;\nfloat depth = -positionEC.z;\nreturn min((geometricError / depth) * depthMultiplier, pointSize);\n}\n";const PointCloudAttenuationPipelineStage={name:"PointCloudAttenuationPipelineStage"},scratchAttenuationUniform=new Cartesian3;PointCloudAttenuationPipelineStage.process=function(e,t,i){const n=e.shaderBuilder;n.addVertexLines([PointCloudAttenuationStageVS]),n.addDefine("USE_POINT_CLOUD_ATTENUATION",void 0,ShaderDestination$1.VERTEX);const r=e.model,o=r.pointCloudShading;let a,s,c;ModelExperimentalType$1.is3DTiles(r.type)&&(s=!0,a=r.content,c=a.tile.refine===Cesium3DTileRefine$1.ADD),n.addUniform("vec3","model_pointCloudAttenuation",ShaderDestination$1.VERTEX),e.uniformMap.model_pointCloudAttenuation=function(){const n=scratchAttenuationUniform;let r=1;s&&(r=c?5:a.tileset.maximumScreenSpaceError),n.x=defaultValue(o.maximumAttenuation,r),n.x*=i.pixelRatio;const l=getGeometricError$1(e,t,o,a);n.y=l*o.geometricErrorScale;const u=i.context,d=i.camera.frustum;let h;return h=i.mode===SceneMode$1.SCENE2D||d instanceof OrthographicFrustum?Number.POSITIVE_INFINITY:u.drawingBufferHeight/i.camera.frustum.sseDenominator,n.z=h,n}};const scratchDimensions=new Cartesian3;function getGeometricError$1(e,t,i,n){if(defined(n)){const e=n.tile.geometricError;if(e>0)return e}if(defined(i.baseResolution))return i.baseResolution;const r=ModelExperimentalUtility.getAttributeBySemantic(t,VertexAttributeSemantic$1.POSITION),o=r.count,a=e.runtimeNode.transform;let s=Cartesian3.subtract(r.max,r.min,scratchDimensions);s=Matrix4.multiplyByPointAsVector(a,s,scratchDimensions);const c=s.x*s.y*s.z;return CesiumMath.cbrt(c/o)}function ModelExperimentalPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.primitive=e.primitive,this.node=e.node,this.model=e.model,this.pipelineStages=[],this.drawCommands=[],this.boundingSphere=void 0,this.updateStages=[],this.configurePipeline()}function inspectFeatureIds(e,t,i){let n;return defined(t.instances)&&(n=ModelExperimentalUtility.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),defined(n))?{hasFeatureIds:!0,hasPropertyTable:defined(n.propertyTableId)}:(n=ModelExperimentalUtility.getFeatureIdsByLabel(i.featureIds,e.featureIdLabel),defined(n)?{hasFeatureIds:!0,hasPropertyTable:defined(n.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}ModelExperimentalPrimitive.prototype.configurePipeline=function(){const e=this.pipelineStages;e.length=0;const t=this.primitive,i=this.node,n=this.model,r=n.customShader,o=defined(r),a=!(o&&defined(r.fragmentShaderText))||r.mode!==CustomShaderMode$1.REPLACE_MATERIAL,s=ModelExperimentalUtility.hasQuantizedAttributes(t.attributes),c=n.pointCloudShading,l=defined(c)&&c.attenuation,u=inspectFeatureIds(n,i,t);e.push(GeometryPipelineStage),l&&t.primitiveType===PrimitiveType$1.POINTS&&e.push(PointCloudAttenuationPipelineStage),s&&e.push(DequantizationPipelineStage),a&&e.push(MaterialPipelineStage),e.push(FeatureIdPipelineStage),u.hasPropertyTable&&(e.push(SelectedFeatureIdPipelineStage),e.push(BatchTexturePipelineStage),e.push(CPUStylingPipelineStage)),o&&e.push(CustomShaderPipelineStage),e.push(LightingPipelineStage),n.allowPicking&&e.push(PickingPipelineStage),e.push(AlphaPipelineStage)};var InstancingStageCommon="mat4 getInstancingTransform()\n{\nmat4 instancingTransform;\n#ifdef HAS_INSTANCE_MATRICES\ninstancingTransform = mat4(\na_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0,\na_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0,\na_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0,\na_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0\n);\n#else\nvec3 translation = vec3(0.0, 0.0, 0.0);\nvec3 scale = vec3(1.0, 1.0, 1.0);\n#ifdef HAS_INSTANCE_TRANSLATION\ntranslation = a_instanceTranslation;\n#endif\n#ifdef HAS_INSTANCE_SCALE\nscale = a_instanceScale;\n#endif\ninstancingTransform = mat4(\nscale.x, 0.0, 0.0, 0.0,\n0.0, scale.y, 0.0, 0.0,\n0.0, 0.0, scale.z, 0.0,\ntranslation.x, translation.y, translation.z, 1.0\n);\n#endif\nreturn instancingTransform;\n}\n",InstancingStageVS="void instancingStage(inout vec3 positionMC)\n{\nmat4 instancingTransform = getInstancingTransform();\npositionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;\n}\n",LegacyInstancingStageVS="void legacyInstancingStage(inout vec3 positionMC, out mat4 instanceModelView, out mat3 instanceModelViewInverseTranspose)\n{\nmat4 instancingTransform = getInstancingTransform();\nmat4 instanceModel = instancingTransform * u_instance_nodeTransform;\ninstanceModelView = u_instance_modifiedModelView;\ninstanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);\npositionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;\n}\n";const matrixScratch$1=new Matrix4,InstancingPipelineStage={name:"InstancingPipelineStage",process:function(e,t,i){const n=t.instances,r=n.attributes[0].count;let o=[];const a=e.model.sceneGraph,s=e.shaderBuilder;s.addDefine("HAS_INSTANCING"),s.addVertexLines([InstancingStageCommon]);const c=ModelExperimentalUtility.getAttributeBySemantic(n,InstanceAttributeSemantic$1.TRANSLATION);let l,u;defined(c)&&(l=c.max,u=c.min);if(!defined(ModelExperimentalUtility.getAttributeBySemantic(n,InstanceAttributeSemantic$1.ROTATION))&&defined(l)&&defined(u)){defined(c)&&(o.push({index:e.attributeIndex++,vertexBuffer:c.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(c.type),componentDatatype:c.componentDatatype,normalize:!1,offsetInBytes:c.byteOffset,strideInBytes:c.byteStride,instanceDivisor:1}),e.instancingTranslationMax=l,e.instancingTranslationMin=u,s.addDefine("HAS_INSTANCE_TRANSLATION"),s.addAttribute("vec3","a_instanceTranslation"));const t=ModelExperimentalUtility.getAttributeBySemantic(n,InstanceAttributeSemantic$1.SCALE);defined(t)&&(o.push({index:e.attributeIndex++,vertexBuffer:t.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,normalize:!1,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,instanceDivisor:1}),s.addDefine("HAS_INSTANCE_SCALE"),s.addAttribute("vec3","a_instanceScale"))}else o=processMatrixAttributes(t,r,e,i);if(processFeatureIdAttributes(e,i,n,o),n.transformInWorldSpace){const t=e.uniformMap;s.addDefine("USE_LEGACY_INSTANCING",void 0,ShaderDestination$1.VERTEX),s.addUniform("mat4","u_instance_modifiedModelView",ShaderDestination$1.VERTEX),s.addUniform("mat4","u_instance_nodeTransform",ShaderDestination$1.VERTEX),t.u_instance_modifiedModelView=function(){return Matrix4.multiply(i.context.uniformState.view,a.components.transform,matrixScratch$1)},t.u_instance_nodeTransform=function(){return e.runtimeNode.axisCorrectedTransform},s.addVertexLines([LegacyInstancingStageVS])}else s.addVertexLines([InstancingStageVS]);e.instanceCount=r,e.attributes.push.apply(e.attributes,o)}},translationScratch$1=new Cartesian3,rotationScratch$2=new Quaternion,scaleScratch=new Cartesian3,transformScratch=new Matrix4;function getInstanceTransformsTypedArray(e,t,i){const n=new Float32Array(12*t),r=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.TRANSLATION),o=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.ROTATION),a=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.SCALE),s=new Cartesian3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new Cartesian3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),l=defined(r),u=defined(o),d=defined(a),h=l?r.packedTypedArray:new Float32Array(3*t),p=u?o.packedTypedArray:new Float32Array(4*t);let f;d?f=a.packedTypedArray:(f=new Float32Array(3*t),f.fill(1));for(let e=0;e<t;e++){const t=new Cartesian3(h[3*e],h[3*e+1],h[3*e+2],translationScratch$1);Cartesian3.maximumByComponent(s,t,s),Cartesian3.minimumByComponent(c,t,c);const r=new Quaternion(p[4*e],p[4*e+1],p[4*e+2],u?p[4*e+3]:1,rotationScratch$2),o=new Cartesian3(f[3*e],f[3*e+1],f[3*e+2],scaleScratch),a=Matrix4.fromTranslationQuaternionRotationScale(t,r,o,transformScratch),l=12*e;n[l+0]=a[0],n[l+1]=a[4],n[l+2]=a[8],n[l+3]=a[12],n[l+4]=a[1],n[l+5]=a[5],n[l+6]=a[9],n[l+7]=a[13],n[l+8]=a[2],n[l+9]=a[6],n[l+10]=a[10],n[l+11]=a[14],i.instancingTranslationMax=s,i.instancingTranslationMin=c}return n}function processFeatureIdAttributes(e,t,i,n){const r=i.attributes,o=e.model,a=e.shaderBuilder;for(let i=0;i<r.length;i++){const s=r[i];if(s.semantic!==InstanceAttributeSemantic$1.FEATURE_ID)continue;s.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=s.setIndex+1);const c=Buffer$1.createVertexBuffer({context:t.context,typedArray:s.packedTypedArray,usage:BufferUsage$1.STATIC_DRAW});c.vertexArrayDestroyable=!1,o._resources.push(c),n.push({index:e.attributeIndex++,vertexBuffer:c,componentsPerAttribute:AttributeType$1.getNumberOfComponents(s.type),componentDatatype:s.componentDatatype,normalize:!1,offsetInBytes:s.byteOffset,strideInBytes:s.byteStride,instanceDivisor:1}),a.addAttribute("float",`a_instanceFeatureId_${s.setIndex}`)}}function processMatrixAttributes(e,t,i,n){const r=getInstanceTransformsTypedArray(e.instances,t,i),o=Buffer$1.createVertexBuffer({context:n.context,typedArray:r,usage:BufferUsage$1.STATIC_DRAW});o.vertexArrayDestroyable=!1,i.model._resources.push(o);const a=ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),s=[{index:i.attributeIndex++,vertexBuffer:o,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:12*a,instanceDivisor:1},{index:i.attributeIndex++,vertexBuffer:o,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:4*a,strideInBytes:12*a,instanceDivisor:1},{index:i.attributeIndex++,vertexBuffer:o,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:8*a,strideInBytes:12*a,instanceDivisor:1}],c=i.shaderBuilder;return c.addDefine("HAS_INSTANCE_MATRICES"),c.addAttribute("vec4","a_instancingTransformRow0"),c.addAttribute("vec4","a_instancingTransformRow1"),c.addAttribute("vec4","a_instancingTransformRow2"),s}InstancingPipelineStage._getInstanceTransformsTypedArray=getInstanceTransformsTypedArray;const ModelMatrixUpdateStage={};function updateRuntimeNode(e,t,i){let n,r;const o=Matrix4.multiplyTransformation(i,e.transform,new Matrix4);for(n=0;n<e.runtimePrimitives.length;n++){const i=e.runtimePrimitives[n];for(r=0;r<i.drawCommands.length;r++){const e=i.drawCommands[r];e.modelMatrix=Matrix4.multiplyTransformation(t._computedModelMatrix,o,e.modelMatrix),e.boundingVolume=BoundingSphere.transform(i.boundingSphere,e.modelMatrix,e.boundingVolume)}}if(defined(e.children))for(n=0;n<e.children.length;n++){const i=t._runtimeNodes[e.children[n]];i._transformToRoot=Matrix4.clone(o,i._transformToRoot),updateRuntimeNode(i,t,o),i._transformDirty=!1}}function ModelExperimentalNode(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).sceneGraph,i=e.transform,n=e.transformToRoot;this._sceneGraph=t,this._children=e.children,this._node=e.node;const r=t.components;this._transform=Matrix4.clone(i,this._transform),this._transformToRoot=Matrix4.clone(n,this._transformToRoot),this._originalTransform=Matrix4.clone(i,this._originalTransform),this._axisCorrectedTransform=ModelExperimentalUtility.correctModelMatrix(i,r.upAxis,r.forwardAxis,this._axisCorrectedTransform),this._transformDirty=!1,this.pipelineStages=[],this.runtimePrimitives=[],this.updateStages=[],this.configurePipeline()}function ModelAlphaOptions(){this.pass=void 0,this.alphaMode=void 0,this.alphaCutoff=void 0}function ShaderStruct(e){this.name=e,this.fields=[]}function ShaderFunction(e){this.signature=e,this.body=[]}function ShaderBuilder(){this._positionAttributeLine=void 0,this._nextAttributeLocation=1,this._attributeLocations={},this._attributeLines=[],this._structs={},this._functions={},this._vertexShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]},this._fragmentShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]}}function generateStructLines(e){const t=[],i=[];let n,r,o,a,s=e._vertexShaderParts.structIds;for(n=0;n<s.length;n++)r=s[n],o=e._structs[r],a=o.generateGlslLines(),t.push.apply(t,a);for(s=e._fragmentShaderParts.structIds,n=0;n<s.length;n++)r=s[n],o=e._structs[r],a=o.generateGlslLines(),i.push.apply(i,a);return{vertexLines:t,fragmentLines:i}}function generateFunctionLines(e){const t=[],i=[];let n,r,o,a,s=e._vertexShaderParts.functionIds;for(n=0;n<s.length;n++)r=s[n],o=e._functions[r],a=o.generateGlslLines(),t.push.apply(t,a);for(s=e._fragmentShaderParts.functionIds,n=0;n<s.length;n++)r=s[n],o=e._functions[r],a=o.generateGlslLines(),i.push.apply(i,a);return{vertexLines:t,fragmentLines:i}}function ModelRenderResources(e){this.shaderBuilder=new ShaderBuilder,this.model=e,this.uniformMap={},this.alphaOptions=new ModelAlphaOptions,this.renderStateOptions={}}ModelMatrixUpdateStage.name="ModelMatrixUpdateStage",ModelMatrixUpdateStage.update=function(e,t,i){e._transformDirty&&(updateRuntimeNode(e,t,e.transformToRoot),e._transformDirty=!1)},Object.defineProperties(ModelExperimentalNode.prototype,{node:{get:function(){return this._node}},sceneGraph:{get:function(){return this._sceneGraph}},children:{get:function(){return this._children}},transform:{get:function(){return this._transform},set:function(e){Matrix4.equals(this._transform,e)||(this._transformDirty=!0,this._transform=Matrix4.clone(e,this._transform),this._axisCorrectedTransform=ModelExperimentalUtility.correctModelMatrix(e,this._sceneGraph.components.upAxis,this._sceneGraph.components.forwardAxis,this._axisCorrectedTransform))}},transformToRoot:{get:function(){return this._transformToRoot}},axisCorrectedTransform:{get:function(){return this._axisCorrectedTransform}},originalTransform:{get:function(){return this._originalTransform}}}),ModelExperimentalNode.prototype.getChild=function(e){return this.sceneGraph.runtimeNodes[this.children[e]]},ModelExperimentalNode.prototype.configurePipeline=function(){const e=this.node,t=this.pipelineStages;t.length=0;const i=this.updateStages;i.length=0,defined(e.instances)&&t.push(InstancingPipelineStage),i.push(ModelMatrixUpdateStage)},ShaderStruct.prototype.addField=function(e,t){const i=` ${e} ${t};`;this.fields.push(i)},ShaderStruct.prototype.generateGlslLines=function(){let e=this.fields;return 0===e.length&&(e=[" float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")},ShaderFunction.prototype.addLines=function(e){const t=e.map((function(e){return` ${e}`}));Array.prototype.push.apply(this.body,t)},ShaderFunction.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")},Object.defineProperties(ShaderBuilder.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}}),ShaderBuilder.prototype.addDefine=function(e,t,i){i=defaultValue(i,ShaderDestination$1.BOTH);let n=e;defined(t)&&(n+=` ${t.toString()}`),ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.defineLines.push(n),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.defineLines.push(n)},ShaderBuilder.prototype.addStruct=function(e,t,i){this._structs[e]=new ShaderStruct(t),ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.structIds.push(e),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.structIds.push(e)},ShaderBuilder.prototype.addStructField=function(e,t,i){this._structs[e].addField(t,i)},ShaderBuilder.prototype.addFunction=function(e,t,i){this._functions[e]=new ShaderFunction(t),ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.functionIds.push(e),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.functionIds.push(e)},ShaderBuilder.prototype.addFunctionLines=function(e,t){this._functions[e].addLines(t)},ShaderBuilder.prototype.addUniform=function(e,t,i){i=defaultValue(i,ShaderDestination$1.BOTH);const n=`uniform ${e} ${t};`;ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.uniformLines.push(n),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.uniformLines.push(n)},ShaderBuilder.prototype.setPositionAttribute=function(e,t){return this._positionAttributeLine=`attribute ${e} ${t};`,this._attributeLocations[t]=0,0},ShaderBuilder.prototype.addAttribute=function(e,t){const i=`attribute ${e} ${t};`;this._attributeLines.push(i);const n=this._nextAttributeLocation;return this._attributeLocations[t]=n,this._nextAttributeLocation++,n},ShaderBuilder.prototype.addVarying=function(e,t){const i=`varying ${e} ${t};`;this._vertexShaderParts.varyingLines.push(i),this._fragmentShaderParts.varyingLines.push(i)},ShaderBuilder.prototype.addVertexLines=function(e){Array.prototype.push.apply(this._vertexShaderParts.shaderLines,e)},ShaderBuilder.prototype.addFragmentLines=function(e){Array.prototype.push.apply(this._fragmentShaderParts.shaderLines,e)},ShaderBuilder.prototype.buildShaderProgram=function(e){const t=defined(this._positionAttributeLine)?[this._positionAttributeLine]:[],i=generateStructLines(this),n=generateFunctionLines(this),r=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,i.vertexLines,n.vertexLines,this._vertexShaderParts.shaderLines).join("\n"),o=new ShaderSource({defines:this._vertexShaderParts.defineLines,sources:[r]}),a=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,i.fragmentLines,n.fragmentLines,this._fragmentShaderParts.shaderLines).join("\n"),s=new ShaderSource({defines:this._fragmentShaderParts.defineLines,sources:[a]});return ShaderProgram.fromCache({context:e,vertexShaderSource:o,fragmentShaderSource:s,attributeLocations:this._attributeLocations})},ShaderBuilder.prototype.clone=function(){return clone$1(this,!0)};var ModelSplitterStageFS="void modelSplitterStage()\n{\n#ifndef SHADOW_MAP\nif (model_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;\nif (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;\n#endif\n}\n";const ModelSplitterPipelineStage={};function NodeRenderResources(e,t){this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=clone$1(e.uniformMap),this.alphaOptions=clone$1(e.alphaOptions),this.renderStateOptions=clone$1(e.renderStateOptions),this.runtimeNode=t,this.transform=Matrix4.multiplyTransformation(t.transformToRoot,t.transform,new Matrix4),this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0,this.instancingTranslationMax=void 0,this.instancingTranslationMin=void 0}function ModelLightingOptions(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.lightingModel=defaultValue(e.lightingModel,LightingModel$1.UNLIT)}function PrimitiveRenderResources(e,t){this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.hasPropertyTable=!1,this.uniformMap=clone$1(e.uniformMap),this.alphaOptions=clone$1(e.alphaOptions),this.transform=e.transform,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;const i=t.primitive;this.count=defined(i.indices)?i.indices.count:ModelExperimentalUtility.getAttributeBySemantic(i,"POSITION").count,this.indices=i.indices,this.primitiveType=i.primitiveType,this.boundingSphere=ModelExperimentalUtility.createBoundingSphere(i,Matrix4.IDENTITY,e.instancingTranslationMax,e.instancingTranslationMin),this.lightingOptions=new ModelLightingOptions,this.pickId=void 0,this.renderStateOptions=combine$2(e.renderStateOptions,{depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},blending:BlendingState$1.DISABLED}),this.styleCommandsNeeded=void 0}function ModelExperimentalSceneGraph(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._model=e.model,this._modelComponents=e.modelComponents,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._drawCommands=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._computedModelMatrix=Matrix4.clone(Matrix4.IDENTITY),initialize$2(this)}function initialize$2(e){const t=e._modelComponents,i=t.scene,n=e._model;e._computedModelMatrix=Matrix4.multiplyTransformation(n.modelMatrix,t.transform,e._computedModelMatrix),e._computedModelMatrix=ModelExperimentalUtility.correctModelMatrix(e._computedModelMatrix,t.upAxis,t.forwardAxis,e._computedModelMatrix),e._computedModelMatrix=Matrix4.multiplyByUniformScale(e._computedModelMatrix,n.computedScale,e._computedModelMatrix);const r=i.nodes,o=Matrix4.IDENTITY;for(let t=0;t<r.length;t++){const n=traverseSceneGraph(e,i.nodes[t],o);e._rootNodes.push(n)}}function traverseSceneGraph(e,t,i){const n=[],r=ModelExperimentalUtility.getNodeTransform(t);let o;if(defined(t.children))for(o=0;o<t.children.length;o++){const a=traverseSceneGraph(e,t.children[o],Matrix4.multiplyTransformation(i,r,new Matrix4));n.push(a)}const a=new ModelExperimentalNode({node:t,transform:r,transformToRoot:i,children:n,sceneGraph:e});if(defined(t.primitives))for(o=0;o<t.primitives.length;o++)a.runtimePrimitives.push(new ModelExperimentalPrimitive({primitive:t.primitives[o],node:t,model:e._model}));return e._runtimeNodes.push(a),e._runtimeNodes.length-1}function forEachRuntimePrimitive(e,t){for(let i=0;i<e._runtimeNodes.length;i++){const n=e._runtimeNodes[i];for(let e=0;e<n.runtimePrimitives.length;e++){t(n.runtimePrimitives[e])}}}function ModelFeature(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}function ModelFeatureTable(e){const t=e.model,i=e.propertyTable;this._propertyTable=i,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=StyleCommandsNeeded$1.ALL_OPAQUE,initialize$1(this)}function initialize$1(e){const t=e._model,i=ModelExperimentalType$1.is3DTiles(t.type),n=e._propertyTable.count;if(0===n)return;let r;const o=new Array(n);if(i){const e=t.content;for(r=0;r<n;r++)o[r]=new Cesium3DTileFeature(e,r)}else for(r=0;r<n;r++)o[r]=new ModelFeature({model:t,featureId:r,featureTable:e});e._features=o,e._featuresLength=n,e._batchTexture=new BatchTexture({featuresLength:n,owner:e,statistics:i?t.content.tileset.statistics:e._statistics})}ModelSplitterPipelineStage.name="ModelSplitterPipelineStage",ModelSplitterPipelineStage.SPLIT_DIRECTION_UNIFORM_NAME="model_splitDirection",ModelSplitterPipelineStage.process=function(e,t,i){const n=e.shaderBuilder;n.addDefine("HAS_MODEL_SPLITTER",void 0,ShaderDestination$1.FRAGMENT),n.addFragmentLines([ModelSplitterStageFS]);const r={};n.addUniform("float",ModelSplitterPipelineStage.SPLIT_DIRECTION_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),r[ModelSplitterPipelineStage.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=combine$2(r,e.uniformMap)},Object.defineProperties(ModelExperimentalSceneGraph.prototype,{components:{get:function(){return this._modelComponents}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}}),ModelExperimentalSceneGraph.prototype.buildDrawCommands=function(e){const t=this._model,i=new ModelRenderResources(t);this.configurePipeline();const n=this.modelPipelineStages;let r,o,a;for(r=0;r<n.length;r++){n[r].process(i,t,e)}const s=[];for(r=0;r<this._runtimeNodes.length;r++){const t=this._runtimeNodes[r];t.configurePipeline();const n=t.pipelineStages,c=new NodeRenderResources(i,t);for(o=0;o<n.length;o++){n[o].process(c,t.node,e)}for(o=0;o<t.runtimePrimitives.length;o++){const i=t.runtimePrimitives[o];i.configurePipeline();const n=i.pipelineStages,r=new PrimitiveRenderResources(c,i);for(a=0;a<n.length;a++){n[a].process(r,i.primitive,e)}i.boundingSphere=BoundingSphere.clone(r.boundingSphere),s.push(i.boundingSphere);const l=buildDrawCommands(r,e);i.drawCommands=l}}this._boundingSphere=BoundingSphere.fromBoundingSpheres(s),t._boundingSphere=BoundingSphere.transform(this._boundingSphere,t.modelMatrix,t._boundingSphere),t._initialRadius=t._boundingSphere.radius,t._boundingSphere.radius*=t._clampedScale},ModelExperimentalSceneGraph.prototype.configurePipeline=function(){const e=this.modelPipelineStages;e.length=0;const t=this._model;defined(t.color)&&e.push(ModelColorPipelineStage),t.imageBasedLighting.enabled&&e.push(ImageBasedLightingPipelineStage),defined(t.splitDirection)&&t.splitDirection!==SplitDirection$1.NONE&&e.push(ModelSplitterPipelineStage)},ModelExperimentalSceneGraph.prototype.update=function(e){let t,i,n;for(t=0;t<this._runtimeNodes.length;t++){const r=this._runtimeNodes[t];for(i=0;i<r.updateStages.length;i++){r.updateStages[i].update(r,this,e)}for(i=0;i<r.runtimePrimitives.length;i++){const e=r.runtimePrimitives[i];for(n=0;n<e.updateStages.length;n++){e.updateStages[n].update(e)}}}},ModelExperimentalSceneGraph.prototype.updateModelMatrix=function(){const e=this._model;this._computedModelMatrix=Matrix4.multiplyTransformation(e.modelMatrix,this._modelComponents.transform,this._computedModelMatrix),this._computedModelMatrix=ModelExperimentalUtility.correctModelMatrix(this._computedModelMatrix,this._modelComponents.upAxis,this._modelComponents.forwardAxis,this._computedModelMatrix),this._computedModelMatrix=Matrix4.multiplyByUniformScale(this._computedModelMatrix,e.computedScale,this._computedModelMatrix);const t=this._rootNodes;for(let e=0;e<t.length;e++){this._runtimeNodes[t[e]]._transformDirty=!0}},ModelExperimentalSceneGraph.prototype.updateBackFaceCulling=function(e){const t=this._model;forEachRuntimePrimitive(this,(function(i){for(let n=0;n<i.drawCommands.length;n++){const r=i.drawCommands[n],o=clone$1(r.renderState,!0),a=i.primitive.material.doubleSided,s=defined(t.color)&&t.color.alpha<1;o.cull.enabled=e&&!a&&!s,r.renderState=RenderState.fromCache(o)}}))},ModelExperimentalSceneGraph.prototype.updateShadows=function(e){const t=this._model,i=ShadowMode$1.castShadows(t.shadows),n=ShadowMode$1.receiveShadows(t.shadows);forEachRuntimePrimitive(this,(function(e){for(let t=0;t<e.drawCommands.length;t++){const r=e.drawCommands[t];r.castShadows=i,r.receiveShadows=n}}))},ModelExperimentalSceneGraph.prototype.getDrawCommands=function(){const e=[];return forEachRuntimePrimitive(this,(function(t){e.push.apply(e,t.drawCommands)})),e},Object.defineProperties(ModelFeature.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return defined(this._color)||(this._color=new Color),this._featureTable.getColor(this._featureId,this._color)},set:function(e){this._featureTable.setColor(this._featureId,e)}},primitive:{get:function(){return this._model}},featureTable:{get:function(){return this._featureTable}},featureId:{get:function(){return this._featureId}}}),ModelFeature.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)},ModelFeature.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)},ModelFeature.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)},ModelFeature.prototype.getPropertyNames=function(e){return this._featureTable.getPropertyNames(e)},ModelFeature.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)},Object.defineProperties(ModelFeatureTable.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}}),ModelFeatureTable.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);const t=StyleCommandsNeeded$1.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)},ModelFeatureTable.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},ModelFeatureTable.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},ModelFeatureTable.prototype.getShow=function(e){return this._batchTexture.getShow(e)},ModelFeatureTable.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},ModelFeatureTable.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},ModelFeatureTable.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},ModelFeatureTable.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)},ModelFeatureTable.prototype.getFeature=function(e){return this._features[e]},ModelFeatureTable.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)},ModelFeatureTable.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)},ModelFeatureTable.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)},ModelFeatureTable.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)},ModelFeatureTable.prototype.getPropertyNames=function(e){return this._propertyTable.getPropertyIds(e)},ModelFeatureTable.prototype.setProperty=function(e,t,i){return this._propertyTable.setProperty(e,t,i)};const scratchColor$e=new Color;ModelFeatureTable.prototype.applyStyle=function(e){if(!defined(e))return this.setAllColor(BatchTexture.DEFAULT_COLOR_VALUE),void this.setAllShow(BatchTexture.DEFAULT_SHOW_VALUE);for(let t=0;t<this._featuresLength;t++){const i=this.getFeature(t),n=defined(e.color)?defaultValue(e.color.evaluateColor(i,scratchColor$e),BatchTexture.DEFAULT_COLOR_VALUE):BatchTexture.DEFAULT_COLOR_VALUE,r=defined(e.show)?defaultValue(e.show.evaluate(i),BatchTexture.DEFAULT_SHOW_VALUE):BatchTexture.DEFAULT_SHOW_VALUE;this.setColor(t,n),this.setShow(t,r)}},ModelFeatureTable.prototype.isDestroyed=function(){return!1},ModelFeatureTable.prototype.destroy=function(e){this._batchTexture.destroy(),destroyObject(this)};const emptyClass={};function JsonMetadataTable(e){this._count=e.count,this._properties=clone$1(e.properties,!0)}function parseBatchTable(e){const t=e.count,i=e.batchTable,n=e.binaryBody,r=partitionProperties(i),o=new JsonMetadataTable({count:t,properties:r.jsonProperties}),a=initializeHierarchy(r.hierarchy,n),s=transcodeBinaryProperties(t,MetadataClass.BATCH_TABLE_CLASS_NAME,r.binaryProperties,n),c=s.featureTableJson,l=new MetadataTable({count:c.count,properties:c.properties,class:s.transcodedClass,bufferViews:s.bufferViewsU8}),u=new PropertyTable({id:0,name:"Batch Table",count:c.count,metadataTable:l,jsonMetadataTable:o,batchTableHierarchy:a});return new StructuralMetadata({schema:s.transcodedSchema,propertyTables:[u],extensions:r.extensions,extras:r.extras})}function partitionProperties(e){const t=e.HIERARCHY,i=e.extras,n=e.extensions;let r;defined(t)?(parseBatchTable._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),r=t):defined(n)&&(r=n["3DTILES_batch_table_hierarchy"]);const o={},a={};for(const t in e){if(!e.hasOwnProperty(t)||"HIERARCHY"===t||"extensions"===t||"extras"===t)continue;const i=e[t];Array.isArray(i)?o[t]=i:a[t]=i}return{binaryProperties:a,jsonProperties:o,hierarchy:r,extras:i,extensions:n}}function transcodeBinaryProperties(e,t,i,n){const r={},o={},a={};let s=0;for(const t in i){if(!i.hasOwnProperty(t))continue;if(!defined(n))throw new RuntimeError(`Property ${t} requires a batch table binary.`);const c=i[t],l=getBinaryAccessor(c);o[t]={bufferView:s},r[t]=transcodePropertyType(c),a[s]=l.createArrayBufferView(n.buffer,n.byteOffset+c.byteOffset,e),s++}const c={classes:{}};c.classes[t]={properties:r};const l=new MetadataSchema(c);return{featureTableJson:{class:t,count:e,properties:o},bufferViewsU8:a,transcodedSchema:l,transcodedClass:l.classes[t]}}function transcodePropertyType(e){const t=transcodeComponentType(e.componentType);return{type:e.type,componentType:t}}function transcodeComponentType(e){switch(e){case"BYTE":return"INT8";case"UNSIGNED_BYTE":return"UINT8";case"SHORT":return"INT16";case"UNSIGNED_SHORT":return"UINT16";case"INT":return"INT32";case"UNSIGNED_INT":return"UINT32";case"FLOAT":return"FLOAT32";case"DOUBLE":return"FLOAT64"}}function initializeHierarchy(e,t){if(defined(e))return new BatchTableHierarchy({extension:e,binaryBody:t})}JsonMetadataTable.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,emptyClass)},JsonMetadataTable.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,emptyClass,e)},JsonMetadataTable.prototype.getProperty=function(e,t){const i=this._properties[t];if(defined(i))return clone$1(i[e],!0)},JsonMetadataTable.prototype.setProperty=function(e,t,i){const n=this._properties[t];return!!defined(n)&&(n[e]=clone$1(i,!0),!0)},parseBatchTable._deprecationWarning=deprecationWarning;const B3dmLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},FeatureIdAttribute$2=ModelComponents.FeatureIdAttribute;function B3dmLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).b3dmResource;let i=e.baseResource;const n=e.arrayBuffer,r=defaultValue(e.byteOffset,0),o=defaultValue(e.releaseGltfJson,!1),a=defaultValue(e.asynchronous,!0),s=defaultValue(e.incrementallyLoadTextures,!0),c=defaultValue(e.upAxis,Axis$1.Y),l=defaultValue(e.forwardAxis,Axis$1.X),u=defaultValue(e.loadAsTypedArray,!1);i=defined(i)?i:t.clone(),this._b3dmResource=t,this._baseResource=i,this._arrayBuffer=n,this._byteOffset=r,this._releaseGltfJson=o,this._asynchronous=a,this._incrementallyLoadTextures=s,this._upAxis=c,this._forwardAxis=l,this._loadAsTypedArray=u,this._state=B3dmLoaderState.UNLOADED,this._promise=defer(),this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=Matrix4.IDENTITY}function handleError$1(e,t){e.unload(),e._state=B3dmLoaderState.FAILED;t=e.getError("Failed to load b3dm",t),e._promise.reject(t)}function createStructuralMetadata$1(e,t){const i=e._batchTable,n=e._batchLength;if(0===n)return;let r;if(defined(i.json))r=parseBatchTable({count:n,batchTable:i.json,binaryBody:i.binary});else{r=new StructuralMetadata({schema:{},propertyTables:[new PropertyTable({name:MetadataClass.BATCH_TABLE_CLASS_NAME,count:n})]})}const o=t.scene.nodes;for(let e=0;e<o.length;e++)processNode(o[e]);t.structuralMetadata=r}function processNode(e){if(!defined(e.children)&&!defined(e.primitives))return;let t;if(defined(e.children))for(t=0;t<e.children.length;t++)processNode(e.children[t]);if(defined(e.primitives))for(t=0;t<e.primitives.length;t++){const i=e.primitives[t],n=ModelExperimentalUtility.getAttributeBySemantic(i,VertexAttributeSemantic$1.FEATURE_ID);if(defined(n)){n.setIndex=0;const e=new FeatureIdAttribute$2;e.propertyTableId=0,e.setIndex=0,e.positionalLabel="featureId_0",i.featureIds.push(e)}}}defined(Object.create)&&(B3dmLoader.prototype=Object.create(ResourceLoader.prototype),B3dmLoader.prototype.constructor=B3dmLoader),Object.defineProperties(B3dmLoader.prototype,{promise:{get:function(){return this._promise.promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}}),B3dmLoader.prototype.load=function(){const e=B3dmParser.parse(this._arrayBuffer,this._byteOffset);let t=e.batchLength;const i=e.featureTableJson,n=e.featureTableBinary,r=e.batchTableJson,o=e.batchTableBinary,a=new Cesium3DTileFeatureTable(i,n);t=a.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;const s=a.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(s)&&(this._transform=Matrix4.fromTranslation(Cartesian3.fromArray(s))),this._batchTable={json:r,binary:o};const c=new GltfLoader({typedArray:e.gltf,upAxis:this._upAxis,forwardAxis:this._forwardAxis,gltfResource:this._b3dmResource,baseResource:this._baseResource,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAsTypedArray:this._loadAsTypedArray,renameBatchIdSemantic:!0});this._gltfLoader=c,this._state=B3dmLoaderState.LOADING;const l=this;c.load(),c.promise.then((function(){if(l.isDestroyed())return;const e=c.components;e.transform=l._transform,createStructuralMetadata$1(l,e),l._components=e,l._state=B3dmLoaderState.READY,l._promise.resolve(l)})).catch((function(e){l.isDestroyed()||handleError$1(l,e)}))},B3dmLoader.prototype.process=function(e){this._state===B3dmLoaderState.LOADING&&(this._state=B3dmLoaderState.PROCESSING),this._state===B3dmLoaderState.PROCESSING&&this._gltfLoader.process(e)},B3dmLoader.prototype.unload=function(){defined(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0};const Components=ModelComponents.Components,Scene$1=ModelComponents.Scene,Node$1=ModelComponents.Node,Primitive=ModelComponents.Primitive,Attribute$1=ModelComponents.Attribute,Quantization=ModelComponents.Quantization,FeatureIdAttribute$1=ModelComponents.FeatureIdAttribute,Material=ModelComponents.Material,MetallicRoughness=ModelComponents.MetallicRoughness;function PntsLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).arrayBuffer,i=defaultValue(e.byteOffset,0);this._arrayBuffer=t,this._byteOffset=i,this._parsedContent=void 0,this._decodePromise=void 0,this._decodedAttributes=void 0,this._promise=defer(),this._state=ResourceLoaderState$1.UNLOADED,this._buffers=[],this._components=void 0,this._transform=Matrix4.IDENTITY}function decodeDraco(e,t){const i=e._parsedContent.draco;let n;n=defined(i)?DracoLoader.decodePointCloud(i,t):Promise.resolve(),defined(n)&&(e._decodePromise=n,n.then((function(n){e.isDestroyed()||(defined(n)&&processDracoAttributes(e,i,n),makeComponents(e,t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).catch((function(t){e.unload(),e._state=ResourceLoaderState$1.FAILED;e._promise.reject(e.getError("Failed to load Draco",t))})))}function processDracoAttributes(e,t,i){e._state=ResourceLoaderState$1.READY;const n=e._parsedContent;let r;if(defined(i.POSITION)){if(r={name:"POSITION",semantic:VertexAttributeSemantic$1.POSITION,typedArray:i.POSITION.array,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,isQuantized:!1},defined(i.POSITION.data.quantization)){const e=i.POSITION.data.quantization,t=e.range,n=Cartesian3.fromElements(t,t,t),o=Cartesian3.unpack(e.minValues),a=(1<<e.quantizationBits)-1;r.isQuantized=!0,r.quantizedRange=a,r.quantizedVolumeOffset=o,r.quantizedVolumeScale=n,r.quantizedComponentDatatype=ComponentDatatype$1.UNSIGNED_SHORT,r.quantizedType=AttributeType$1.VEC3}n.positions=r}if(defined(i.NORMAL)){if(r={name:"NORMAL",semantic:VertexAttributeSemantic$1.NORMAL,typedArray:i.NORMAL.array,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},defined(i.NORMAL.data.quantization)){const e=(1<<i.NORMAL.data.quantization.quantizationBits)-1;r.quantizedRange=e,r.octEncoded=!0,r.octEncodedZXY=!0,r.quantizedComponentDatatype=ComponentDatatype$1.UNSIGNED_BYTE,r.quantizedType=AttributeType$1.VEC2}n.normals=r}if(defined(i.RGBA)?n.colors={name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:i.RGBA.array,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC4,normalized:!0,isTranslucent:!0}:defined(i.RGB)&&(n.colors={name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:i.RGB.array,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC3,normalized:!0,isTranslucent:!1}),defined(i.BATCH_ID)){const e=i.BATCH_ID.array;n.batchIds={name:"_FEATURE_ID",semantic:VertexAttributeSemantic$1.FEATURE_ID,setIndex:0,typedArray:e,componentDatatype:ComponentDatatype$1.fromTypedArray(e),type:AttributeType$1.SCALAR}}let o=n.styleableProperties;const a=t.batchTableProperties;for(const e in a)if(a.hasOwnProperty(e)){const t=i[e];defined(o)||(o={}),o[e]={typedArray:t.array,componentCount:t.data.componentsPerAttribute}}n.styleableProperties=o}function makeAttribute(e,t,i){let n,r=t.typedArray;if(t.octEncoded&&(n=new Quantization,n.octEncoded=t.octEncoded,n.octEncodedZXY=t.octEncodedZXY,n.normalizationRange=t.quantizedRange,n.type=t.quantizedType,n.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){n=new Quantization;const e=t.quantizedRange;n.normalizationRange=e,n.quantizedVolumeOffset=Cartesian3.ZERO;const i=t.quantizedVolumeScale;n.quantizedVolumeDimensions=i,n.quantizedVolumeStepSize=Cartesian3.divideByScalar(i,e,new Cartesian3),n.componentDatatype=t.quantizedComponentDatatype,n.type=t.quantizedType}const o=new Attribute$1;if(o.name=t.name,o.semantic=t.semantic,o.setIndex=t.setIndex,o.componentDatatype=t.componentDatatype,o.type=t.type,o.normalized=defaultValue(t.normalized,!1),o.min=t.min,o.max=t.max,o.quantization=n,t.isRGB565&&(r=AttributeCompression.decodeRGB565(r)),defined(t.constantColor)){const e=new Array(4);o.constant=Color.pack(t.constantColor,e)}else{const t=Buffer$1.createVertexBuffer({typedArray:r,context:i,usage:BufferUsage$1.STATIC_DRAW});t.vertexArrayDestroyable=!1,e._buffers.push(t),o.buffer=t}return o}let randomNumberGenerator,randomValues;function getRandomValues(e){if(!defined(randomValues)){randomNumberGenerator=new mersenneTwister(0),randomValues=new Array(e);for(let t=0;t<e;++t)randomValues[t]=randomNumberGenerator.random()}return randomValues}defined(Object.create)&&(PntsLoader.prototype=Object.create(ResourceLoader.prototype),PntsLoader.prototype.constructor=PntsLoader),Object.defineProperties(PntsLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}}),PntsLoader.prototype.load=function(){this._parsedContent=PntsParser.parse(this._arrayBuffer,this._byteOffset),this._state=ResourceLoaderState$1.PROCESSING},PntsLoader.prototype.process=function(e){this._state===ResourceLoaderState$1.PROCESSING&&(defined(this._decodePromise)||decodeDraco(this,e.context))};const scratchMin$1=new Cartesian3,scratchMax$1=new Cartesian3,scratchPosition$5=new Cartesian3;function computeApproximateExtrema(e){const t=e.typedArray,i=t.length/3,n=Math.min(i,20),r=getRandomValues(20),o=Number.MAX_VALUE,a=-Number.MAX_VALUE;let s,c,l,u=Cartesian3.fromElements(o,o,o,scratchMin$1),d=Cartesian3.fromElements(a,a,a,scratchMax$1);if(e.isQuantized)u=Cartesian3.ZERO,d=e.quantizedVolumeScale;else for(s=0;s<n;++s)c=Math.floor(r[s]*i),l=Cartesian3.unpack(t,3*c,scratchPosition$5),Cartesian3.minimumByComponent(u,l,u),Cartesian3.maximumByComponent(d,l,d);e.min=Cartesian3.clone(u),e.max=Cartesian3.clone(d)}const defaultColorAttribute={name:VertexAttributeSemantic$1.COLOR,semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,constantColor:Color.DARKGRAY,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC4,isQuantized:!1,isTranslucent:!1};function makeAttributes(e,t,i){const n=[];let r;const o=t.positions;return defined(o)&&(computeApproximateExtrema(o),r=makeAttribute(e,o,i),r.count=t.pointsLength,n.push(r)),defined(t.normals)&&(r=makeAttribute(e,t.normals,i),n.push(r)),defined(t.colors)?(r=makeAttribute(e,t.colors,i),n.push(r)):(r=makeAttribute(e,defaultColorAttribute,i),n.push(r)),defined(t.batchIds)&&(r=makeAttribute(e,t.batchIds,i),n.push(r)),n}function makeStructuralMetadata(e){const t=e.batchLength,i=e.pointsLength,n=e.batchTableBinary;if(defined(n)){return parseBatchTable({count:defaultValue(t,i),batchTable:e.batchTableJson,binaryBody:n})}return new StructuralMetadata({schema:{},propertyTables:[new PropertyTable({name:MetadataClass.BATCH_TABLE_CLASS_NAME,count:i})]})}function makeComponents(e,t){const i=e._parsedContent,n=new MetallicRoughness;n.metallicFactor=0,n.roughnessFactor=.9;const r=new Material;r.metallicRoughness=n;const o=i.colors;defined(o)&&o.isTranslucent&&(r.alphaMode=AlphaMode$1.BLEND);const a=!defined(i.normals);r.unlit=a;const s=new Primitive;if(s.attributes=makeAttributes(e,i,t),s.primitiveType=PrimitiveType$1.POINTS,s.material=r,defined(i.batchIds)){const e=new FeatureIdAttribute$1;e.propertyTableId=0,e.setIndex=0,e.positionalLabel="featureId_0",s.featureIds.push(e)}const c=new Node$1;c.primitives=[s];const l=new Scene$1;l.nodes=[c],l.upAxis=Axis$1.Z,l.forwardAxis=Axis$1.X;const u=new Components;u.scene=l,u.nodes=[c],u.structuralMetadata=makeStructuralMetadata(i),defined(i.rtcCenter)&&(u.transform=Matrix4.multiplyByTranslation(u.transform,i.rtcCenter,u.transform));const d=i.positions;defined(d)&&d.isQuantized&&(u.transform=Matrix4.multiplyByTranslation(u.transform,d.quantizedVolumeOffset,u.transform)),e._components=u,e._parsedContent=void 0}PntsLoader.prototype.unload=function(){const e=this._buffers;for(let t=0;t<e.length;t++)e[t].destroy();e.length=0,this._components=void 0,this._parsedContent=void 0};const I3dmLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},Attribute=ModelComponents.Attribute,FeatureIdAttribute=ModelComponents.FeatureIdAttribute,Instances=ModelComponents.Instances;function I3dmLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).i3dmResource,i=e.arrayBuffer;let n=e.baseResource;const r=defaultValue(e.byteOffset,0),o=defaultValue(e.releaseGltfJson,!1),a=defaultValue(e.asynchronous,!0),s=defaultValue(e.incrementallyLoadTextures,!0),c=defaultValue(e.upAxis,Axis$1.Y),l=defaultValue(e.forwardAxis,Axis$1.X),u=defaultValue(e.loadAsTypedArray,!1);n=defined(n)?n:t.clone(),this._i3dmResource=t,this._baseResource=n,this._arrayBuffer=i,this._byteOffset=r,this._releaseGltfJson=o,this._asynchronous=a,this._incrementallyLoadTextures=s,this._upAxis=c,this._forwardAxis=l,this._loadAsTypedArray=u,this._state=I3dmLoaderState.UNLOADED,this._promise=defer(),this._gltfLoader=void 0,this._transform=Matrix4.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}function handleError(e,t){e.unload(),e._state=I3dmLoaderState.FAILED;t=e.getError("Failed to load I3DM",t),e._promise.reject(t)}function createStructuralMetadata(e,t){const i=e._batchTable,n=e._instancesLength;if(0===n)return;let r;if(defined(i.json))r=parseBatchTable({count:n,batchTable:i.json,binaryBody:i.binary});else{r=new StructuralMetadata({schema:{},propertyTables:[new PropertyTable({name:MetadataClass.BATCH_TABLE_CLASS_NAME,count:n})]})}t.structuralMetadata=r}defined(Object.create)&&(I3dmLoader.prototype=Object.create(ResourceLoader.prototype),I3dmLoader.prototype.constructor=I3dmLoader),Object.defineProperties(I3dmLoader.prototype,{promise:{get:function(){return this._promise.promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}}),I3dmLoader.prototype.load=function(){const e=I3dmParser.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,i=e.featureTableBinary,n=e.batchTableJson,r=e.batchTableBinary,o=e.gltfFormat,a=new Cesium3DTileFeatureTable(t,i);this._featureTable=a;const s=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=s,!defined(s))throw new RuntimeError("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=s;const c=a.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(c)&&(this._transform=Matrix4.fromTranslation(Cartesian3.fromArray(c))),this._batchTable={json:n,binary:r};const l={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAsTypedArray:this._loadAsTypedArray};if(0===o){let t=getStringFromTypedArray(e.gltf);t=t.replace(/[\s\0]+$/,"");const i=this._baseResource.getDerivedResource({url:t});l.gltfResource=i,l.baseResource=i}else l.gltfResource=this._i3dmResource,l.typedArray=e.gltf;const u=new GltfLoader(l);this._gltfLoader=u,this._state=I3dmLoaderState.LOADING;const d=this;u.load(),u.promise.then((function(){if(d.isDestroyed())return;const e=u.components;e.transform=d._transform,createInstances(d,e),createStructuralMetadata(d,e),d._components=e,d._state=I3dmLoaderState.READY,d._promise.resolve(d)})).catch((function(e){d.isDestroyed()||handleError(d,e)}))},I3dmLoader.prototype.process=function(e){this._state===I3dmLoaderState.LOADING&&(this._state=I3dmLoaderState.PROCESSING),this._state===I3dmLoaderState.PROCESSING&&this._gltfLoader.process(e)};const positionScratch$5=new Cartesian3,propertyScratch1=new Array(4);function createInstances(e,t){let i;const n=e._featureTable,r=e._instancesLength;if(0===r)return;const o=n.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3),a=n.getGlobalProperty("EAST_NORTH_UP"),s=n.hasProperty("NORMAL_UP")||n.hasProperty("NORMAL_UP_OCT32P")||a,c=n.hasProperty("SCALE")||n.hasProperty("SCALE_NON_UNIFORM"),l=getPositions(n);let u,d;s&&(u=new Float32Array(4*r)),c&&(d=new Float32Array(3*r));const h=new Float32Array(r),p=Cartesian3.unpackArray(l);let f=new Cartesian3;const m=new Cartesian3,g=new Cartesian3,_=new Cartesian3,y=new Matrix3,C=new Quaternion,T=new Array(4),S=new Cartesian3,v=new Array(3),A=new Matrix4;if(!defined(o)){const e=BoundingSphere.fromPoints(p);for(i=0;i<p.length;i++)Cartesian3.subtract(p[i],e.center,positionScratch$5),l[3*i+0]=positionScratch$5.x,l[3*i+1]=positionScratch$5.y,l[3*i+2]=positionScratch$5.z;t.transform=Matrix4.fromTranslation(e.center)}for(i=0;i<r;i++){f=Cartesian3.clone(p[i]),defined(o)&&Cartesian3.add(f,Cartesian3.unpack(o),f),s&&(processRotation(n,a,i,C,f,g,m,_,y,A),Quaternion.pack(C,T,0),u[4*i+0]=T[0],u[4*i+1]=T[1],u[4*i+2]=T[2],u[4*i+3]=T[3]),c&&(processScale(n,i,S),Cartesian3.pack(S,v,0),d[3*i+0]=v[0],d[3*i+1]=v[1],d[3*i+2]=v[2]);let e=n.getProperty("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1,i);defined(e)||(e=i),h[i]=e}const E=new Instances;E.transformInWorldSpace=!0;const b=new Attribute;if(b.name="Instance Translation",b.semantic=InstanceAttributeSemantic$1.TRANSLATION,b.componentDatatype=ComponentDatatype$1.FLOAT,b.type=AttributeType$1.VEC3,b.count=r,b.packedTypedArray=l,E.attributes.push(b),s){const e=new Attribute;e.name="Instance Rotation",e.semantic=InstanceAttributeSemantic$1.ROTATION,e.componentDatatype=ComponentDatatype$1.FLOAT,e.type=AttributeType$1.VEC4,e.count=r,e.packedTypedArray=u,E.attributes.push(e)}if(c){const e=new Attribute;e.name="Instance Scale",e.semantic=InstanceAttributeSemantic$1.SCALE,e.componentDatatype=ComponentDatatype$1.FLOAT,e.type=AttributeType$1.VEC3,e.count=r,e.packedTypedArray=d,E.attributes.push(e)}const x=new Attribute;x.name="Instance Feature ID",x.setIndex=0,x.semantic=InstanceAttributeSemantic$1.FEATURE_ID,x.componentDatatype=ComponentDatatype$1.FLOAT,x.type=AttributeType$1.SCALAR,x.count=r,x.packedTypedArray=h,E.attributes.push(x);const P=new FeatureIdAttribute;for(P.propertyTableId=0,P.setIndex=0,P.positionalLabel="instanceFeatureId_0",E.featureIds.push(P),i=0;i<t.nodes.length;i++){const e=t.nodes[i];e.primitives.length>0&&(e.instances=E)}}function getPositions(e,t){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",ComponentDatatype$1.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){const t=e.getPropertyArray("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3),i=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(i))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const n=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(n))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(let e=0;e<t.length/3;e++){const r=t[e];for(let o=0;o<3;o++)t[3*e+o]=r[o]/65535*n[o]+i[o]}return t}throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}const propertyScratch2=new Array(4);function processRotation(e,t,i,n,r,o,a,s,c,l){const u=e.getProperty("NORMAL_UP",ComponentDatatype$1.FLOAT,3,i,propertyScratch1),d=e.getProperty("NORMAL_RIGHT",ComponentDatatype$1.FLOAT,3,i,propertyScratch2);let h=!1;if(defined(u)){if(!defined(d))throw new RuntimeError("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");Cartesian3.unpack(u,0,o),Cartesian3.unpack(d,0,a),h=!0}else{const n=e.getProperty("NORMAL_UP_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,i,propertyScratch1),s=e.getProperty("NORMAL_RIGHT_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,i,propertyScratch2);if(defined(n)){if(!defined(s))throw new RuntimeError("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");AttributeCompression.octDecodeInRange(n[0],n[1],65535,o),AttributeCompression.octDecodeInRange(s[0],s[1],65535,a),h=!0}else t?(Transforms.eastNorthUpToFixedFrame(r,Ellipsoid.WGS84,l),Matrix4.getMatrix3(l,c)):Matrix3.clone(Matrix3.IDENTITY,c)}h&&(Cartesian3.cross(a,o,s),Cartesian3.normalize(s,s),Matrix3.setColumn(c,0,a,c),Matrix3.setColumn(c,1,o,c),Matrix3.setColumn(c,2,s,c)),Quaternion.fromRotationMatrix(c,n)}function processScale(e,t,i){i=Cartesian3.fromElements(1,1,1,i);const n=e.getProperty("SCALE",ComponentDatatype$1.FLOAT,1,t);defined(n)&&Cartesian3.multiplyByScalar(i,n,i);const r=e.getProperty("SCALE_NON_UNIFORM",ComponentDatatype$1.FLOAT,3,t,propertyScratch1);defined(r)&&(i.x*=r[0],i.y*=r[1],i.z*=r[2])}function ModelExperimental(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._loader=e.loader,this._resource=e.resource,this.type=defaultValue(e.type,ModelExperimentalType$1.GLTF),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._scale=defaultValue(e.scale,1),this._minimumPixelSize=defaultValue(e.minimumPixelSize,0),this._maximumScale=e.maximumScale,this._clampedScale=defined(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._readyPromise=defer(),this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1;const t=e.color;this._color=defaultValue(t)?Color.clone(t):void 0,this._colorBlendMode=defaultValue(e.colorBlendMode,ColorBlendMode$1.HIGHLIGHT),this._colorBlendAmount=defaultValue(e.colorBlendAmount,.5),this._cull=defaultValue(e.cull,!0),this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._allowPicking=defaultValue(e.allowPicking,!0),this._show=defaultValue(e.show,!0),this._style=void 0;let i=defaultValue(e.featureIdLabel,"featureId_0");"number"==typeof i&&(i=`featureId_${i}`),this._featureIdLabel=i;let n=defaultValue(e.instanceFeatureIdLabel,"instanceFeatureId_0");"number"==typeof n&&(n=`instanceFeatureId_${n}`),this._instanceFeatureIdLabel=n,this._featureTables=[],this._featureTableId=void 0,this._featureTableIdDirty=!0,this._resources=[],this._boundingSphere=new BoundingSphere,this._initialRadius=void 0;const r=new PointCloudShading(e.pointCloudShading);this._attenuation=r.attenuation,this._pointCloudShading=r,this._lightColor=Cartesian3.clone(e.lightColor),this._imageBasedLighting=defined(e.imageBasedLighting)?e.imageBasedLighting:new ImageBasedLighting,this._shouldDestroyImageBasedLighting=!defined(e.imageBasedLighting),this._backFaceCulling=defaultValue(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._showCreditsOnScreen=defaultValue(e.showCreditsOnScreen,!1),this._splitDirection=defaultValue(e.splitDirection,SplitDirection$1.NONE),initialize(this)}function createModelFeatureTables(e,t){const i=e._featureTables,n=t.propertyTables;for(let t=0;t<n.length;t++){const r=new ModelFeatureTable({model:e,propertyTable:n[t]});i.push(r)}return i}function selectFeatureTableId(e,t){const i=t._featureIdLabel,n=t._instanceFeatureIdLabel;let r,o,a,s;for(r=0;r<e.nodes.length;r++)if(s=e.nodes[r],defined(s.instances)&&(a=ModelExperimentalUtility.getFeatureIdsByLabel(s.instances.featureIds,n),defined(a)&&defined(a.propertyTableId)))return a.propertyTableId;for(r=0;r<e.nodes.length;r++)for(s=e.nodes[r],o=0;o<s.primitives.length;o++){const e=s.primitives[o],t=ModelExperimentalUtility.getFeatureIdsByLabel(e.featureIds,i);if(defined(t))return t.propertyTableId}}function initialize(e){const t=e._loader,i=e._resource;t.load(),t.promise.then((function(t){const i=t.components,n=i.structuralMetadata;defined(n)&&n.propertyTableCount>0&&createModelFeatureTables(e,n),e._sceneGraph=new ModelExperimentalSceneGraph({model:e,modelComponents:i}),e._resourcesLoaded=!0})).catch(ModelExperimentalUtility.getFailedLoadFunction(e,"model",i));defaultValue(t.texturesLoadedPromise,Promise.resolve()).then((function(){e._texturesLoaded=!0})).catch(ModelExperimentalUtility.getFailedLoadFunction(e,"model",i))}function updateFeatureTableId(e){const t=e._sceneGraph.components,i=t.structuralMetadata;defined(i)&&i.propertyTableCount>0&&(e.featureTableId=selectFeatureTableId(t,e),e.applyStyle(e._style))}I3dmLoader.prototype.unload=function(){defined(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0},Object.defineProperties(ModelExperimental.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},loader:{get:function(){return this._loader}},cull:{get:function(){return this._cull}},opaquePass:{get:function(){return this._opaquePass}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){e!==this._pointCloudShading&&this.resetDrawCommands(),this._pointCloudShading=e}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},sceneGraph:{get:function(){return this._sceneGraph}},content:{get:function(){return this._content}},featureTableId:{get:function(){return this._featureTableId},set:function(e){this._featureTableId=e}},featureTables:{get:function(){return this._featureTables},set:function(e){this._featureTables=e}},allowPicking:{get:function(){return this._allowPicking}},style:{get:function(){return this._style},set:function(e){e!==this._style&&this.applyStyle(e),this._style=e}},color:{get:function(){return this._color},set:function(e){Color.equals(this._color,e)||this.resetDrawCommands(),this._color=Color.clone(e,this._color)}},colorBlendMode:{get:function(){return this._colorBlendMode},set:function(e){this._colorBlendMode=e}},colorBlendAmount:{get:function(){return this._colorBlendAmount},set:function(e){this._colorBlendAmount=e}},boundingSphere:{get:function(){return this._boundingSphere}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){"number"==typeof e&&(e=`featureId_${e}`),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){"number"==typeof e&&(e=`instanceFeatureId_${e}`),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},lightColor:{get:function(){return this._lightColor},set:function(e){defined(e)!==defined(this._lightColor)&&this.resetDrawCommands(),this._lightColor=Cartesian3.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,this.resetDrawCommands())}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){e!==this._backFaceCulling&&(this._backFaceCullingDirty=!0),this._backFaceCulling=e}},scale:{get:function(){return this._scale},set:function(e){e!==this._scale&&(this._updateModelMatrix=!0),this._scale=e}},computedScale:{get:function(){return this._computedScale}},minimumPixelSize:{get:function(){return this._minimumPixelSize},set:function(e){e!==this._minimumPixelSize&&(this._updateModelMatrix=!0),this._minimumPixelSize=e}},maximumScale:{get:function(){return this._maximumScale},set:function(e){e!==this._maximumScale&&(this._updateModelMatrix=!0),this._maximumScale=e}},shadows:{get:function(){return this._shadows},set:function(e){e!==this._shadows&&(this._shadowsDirty=!0),this._shadows=e}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen=e}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&this.resetDrawCommands(),this._splitDirection=e}}}),ModelExperimental.prototype.resetDrawCommands=function(){this._drawCommandsBuilt&&(this.destroyResources(),this._drawCommandsBuilt=!1)},ModelExperimental.prototype.update=function(e){this._resourcesLoaded&&this._texturesLoaded||this._loader.process(e),defined(this._customShader)&&this._customShader.update(e),this.pointCloudShading.attenuation!==this._attenuation&&(this.resetDrawCommands(),this._attenuation=this.pointCloudShading.attenuation);const t=defaultValue(this.referenceMatrix,this.modelMatrix);if(this._imageBasedLighting.referenceMatrix=t,this._imageBasedLighting.update(e),this._imageBasedLighting.shouldRegenerateShaders&&this.resetDrawCommands(),!this._resourcesLoaded)return;this._featureTableIdDirty&&(updateFeatureTableId(this),this._featureTableIdDirty=!1);const i=this._featureTables;for(let t=0;t<i.length;t++)i[t].update(e),i[t].styleCommandsNeededDirty&&this.resetDrawCommands();if(!this._drawCommandsBuilt){this._sceneGraph.buildDrawCommands(e),this._drawCommandsBuilt=!0;const t=this;if(!t._ready)return void e.afterRender.push((function(){t._ready=!0,t._readyPromise.resolve(t)}))}if(this._debugShowBoundingVolumeDirty&&(updateShowBoundingVolume(this._sceneGraph,this._debugShowBoundingVolume),this._debugShowBoundingVolumeDirty=!1),Matrix4.equals(this.modelMatrix,this._modelMatrix)||(this._updateModelMatrix=!0,this._modelMatrix=Matrix4.clone(this.modelMatrix,this._modelMatrix),this._boundingSphere=BoundingSphere.transform(this._sceneGraph.boundingSphere,this.modelMatrix,this._boundingSphere)),(this._updateModelMatrix||0!==this._minimumPixelSize)&&(this._clampedScale=defined(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._boundingSphere.radius=this._initialRadius*this._clampedScale,this._computedScale=getScale(this,e),this._sceneGraph.updateModelMatrix(),this._updateModelMatrix=!1),this._backFaceCullingDirty&&(this.sceneGraph.updateBackFaceCulling(this._backFaceCulling),this._backFaceCullingDirty=!1),this._shadowsDirty&&(this.sceneGraph.updateShadows(this._shadows),this._shadowsDirty=!1),this._sceneGraph.update(e),this._show&&0!==this._computedScale){const t=this._sceneGraph.components.asset.credits,i=t.length;for(let n=0;n<i;n++){const i=t[n];i.showOnScreen=this._showCreditsOnScreen,e.creditDisplay.addCredit(i)}const n=this._sceneGraph.getDrawCommands();e.commandList.push.apply(e.commandList,n)}};const scratchBoundingSphere$1=new BoundingSphere;function scaleInPixels(e,t,i){return scratchBoundingSphere$1.center=e,scratchBoundingSphere$1.radius=t,i.camera.getPixelSize(scratchBoundingSphere$1,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}const scratchPosition$4=new Cartesian3;function getScale(e,t){let i=e.scale;if(0!==e.minimumPixelSize){const n=t.context,r=Math.max(n.drawingBufferWidth,n.drawingBufferHeight),o=e.modelMatrix;scratchPosition$4.x=o[12],scratchPosition$4.y=o[13],scratchPosition$4.z=o[14];const a=e.boundingSphere.radius,s=scaleInPixels(scratchPosition$4,a,t),c=1/s;Math.min(c*(2*a),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*s/(2*e._initialRadius))}return defined(e.maximumScale)?Math.min(e.maximumScale,i):i}function updateShowBoundingVolume(e,t){const i=e._drawCommands;for(let e=0;e<i.length;e++)i[e].debugShowBoundingVolume=t}function makeModelOptions$1(e,t,i){return{loader:e,type:t,resource:i.resource,modelMatrix:i.modelMatrix,scale:i.scale,minimumPixelSize:i.minimumPixelSize,maximumScale:i.maximumScale,debugShowBoundingVolume:i.debugShowBoundingVolume,cull:i.cull,opaquePass:i.opaquePass,allowPicking:i.allowPicking,customShader:i.customShader,content:i.content,show:i.show,color:i.color,colorBlendAmount:i.colorBlendAmount,colorBlendMode:i.colorBlendMode,featureIdLabel:i.featureIdLabel,instanceFeatureIdLabel:i.instanceFeatureIdLabel,pointCloudShading:i.pointCloudShading,lightColor:i.lightColor,imageBasedLighting:i.imageBasedLighting,backFaceCulling:i.backFaceCulling,shadows:i.shadows,showCreditsOnScreen:i.showCreditsOnScreen,splitDirection:i.splitDirection}}function ModelExperimental3DTileContent(e,t,i){this._tileset=e,this._tile=t,this._resource=i,this._model=void 0,this._metadata=void 0,this._group=void 0}function makeModelOptions(e,t,i,n){return combine$2(n,{cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._gltfUpAxis,forwardAxis:Axis$1.X,incrementallyLoadTextures:!1,customShader:e.customShader,content:i,show:e.show,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount,lightColor:e.lightColor,imageBasedLighting:e.imageBasedLighting,featureIdLabel:e.featureIdLabel,instanceFeatureIdLabel:e.instanceFeatureIdLabel,pointCloudShading:e.pointCloudShading,backFaceCulling:e.backFaceCulling,shadows:e.shadows,showCreditsOnScreen:e.showCreditsOnScreen,splitDirection:e.splitDirection})}ModelExperimental.prototype.isDestroyed=function(){return!1},ModelExperimental.prototype.destroy=function(){const e=this._loader;defined(e)&&e.destroy();const t=this._featureTables;if(defined(t))for(let e=0;e<t.length;e++)t[e].destroy();this.destroyResources(),this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,destroyObject(this)},ModelExperimental.prototype.destroyResources=function(){const e=this._resources;for(let t=0;t<e.length;t++)e[t].destroy();this._resources=[]},ModelExperimental.fromGltf=function(e){const t={releaseGltfJson:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis},i=e.gltf,n=defaultValue(e.basePath,""),r=Resource.createIfNeeded(n);defined(i.asset)?(t.gltfJson=i,t.baseResource=r,t.gltfResource=r):i instanceof Uint8Array?(t.typedArray=i,t.baseResource=r,t.gltfResource=r):t.gltfResource=Resource.createIfNeeded(e.gltf);const o=makeModelOptions$1(new GltfLoader(t),defined(e.content)?ModelExperimentalType$1.TILE_GLTF:ModelExperimentalType$1.GLTF,e);o.resource=t.gltfResource;return new ModelExperimental(o)},ModelExperimental.fromB3dm=function(e){return new ModelExperimental(makeModelOptions$1(new B3dmLoader({b3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis}),ModelExperimentalType$1.TILE_B3DM,e))},ModelExperimental.fromPnts=function(e){return new ModelExperimental(makeModelOptions$1(new PntsLoader({arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset}),ModelExperimentalType$1.TILE_PNTS,e))},ModelExperimental.fromI3dm=function(e){return new ModelExperimental(makeModelOptions$1(new I3dmLoader({i3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis}),ModelExperimentalType$1.TILE_I3DM,e))},ModelExperimental.prototype.applyColorAndShow=function(e){const t=defined(e)&&defined(e.color),i=defined(e)&&defined(e.show);this._color=t?e.color.evaluateColor(void 0,this._color):Color.clone(Color.WHITE,this._color),this._show=!i||e.show.evaluate(void 0)},ModelExperimental.prototype.applyStyle=function(e){if(defined(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0){this.featureTables[this.featureTableId].applyStyle(e)}else this.applyColorAndShow(e);this.resetDrawCommands()},Object.defineProperties(ModelExperimental3DTileContent.prototype,{featuresLength:{get:function(){const e=this._model,t=e.featureTables,i=e.featureTableId;return defined(t)&&defined(t[i])?t[i].featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){const e=this._model,t=e.featureTables,i=e.featureTableId;if(defined(t)&&defined(t[i]))return t[i]}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}}),ModelExperimental3DTileContent.prototype.getFeature=function(e){const t=this._model,i=t.featureTableId;if(!defined(i))return;return t.featureTables[i].getFeature(e)},ModelExperimental3DTileContent.prototype.hasProperty=function(e,t){const i=this._model,n=i.featureTableId;if(!defined(n))return!1;return i.featureTables[n].hasProperty(e,t)},ModelExperimental3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,0===this.featuresLength?this._model.color=t:defined(this.batchTable)&&this.batchTable.setAllColor(t)},ModelExperimental3DTileContent.prototype.applyStyle=function(e){this._model.style=e},ModelExperimental3DTileContent.prototype.update=function(e,t){const i=this._model,n=this._tile;i.colorBlendAmount=e.colorBlendAmount,i.colorBlendMode=e.colorBlendMode,i.modelMatrix=n.computedTransform,i.customShader=e.customShader,i.pointCloudShading=e.pointCloudShading,i.featureIdLabel=e.featureIdLabel,i.instanceFeatureIdLabel=e.instanceFeatureIdLabel,i.lightColor=e.lightColor,i.imageBasedLighting=e.imageBasedLighting,i.backFaceCulling=e.backFaceCulling,i.shadows=e.shadows,i.showCreditsOnScreen=e.showCreditsOnScreen,i.splitDirection=e.splitDirection,i.update(t)},ModelExperimental3DTileContent.prototype.isDestroyed=function(){return!1},ModelExperimental3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),destroyObject(this)},ModelExperimental3DTileContent.fromGltf=function(e,t,i,n){const r=new ModelExperimental3DTileContent(e,t,i),o=makeModelOptions(e,t,r,{gltf:n,basePath:i});return r._model=ModelExperimental.fromGltf(o),r},ModelExperimental3DTileContent.fromB3dm=function(e,t,i,n,r){const o=new ModelExperimental3DTileContent(e,t,i),a=makeModelOptions(e,t,o,{arrayBuffer:n,byteOffset:r,resource:i});return o._model=ModelExperimental.fromB3dm(a),o},ModelExperimental3DTileContent.fromI3dm=function(e,t,i,n,r){const o=new ModelExperimental3DTileContent(e,t,i),a=makeModelOptions(e,t,o,{arrayBuffer:n,byteOffset:r,resource:i});return o._model=ModelExperimental.fromI3dm(a),o},ModelExperimental3DTileContent.fromPnts=function(e,t,i,n,r){const o=new ModelExperimental3DTileContent(e,t,i),a=makeModelOptions(e,t,o,{arrayBuffer:n,byteOffset:r,resource:i});return o._model=ModelExperimental.fromPnts(a),o};const Cesium3DTileContentFactory={b3dm:function(e,t,i,n,r){return e.enableModelExperimental?ModelExperimental3DTileContent.fromB3dm(e,t,i,n,r):new Batched3DModel3DTileContent(e,t,i,n,r)},pnts:function(e,t,i,n,r){return e.enableModelExperimental?ModelExperimental3DTileContent.fromPnts(e,t,i,n,r):new PointCloud3DTileContent(e,t,i,n,r)},i3dm:function(e,t,i,n,r){return e.enableModelExperimental?ModelExperimental3DTileContent.fromI3dm(e,t,i,n,r):new Instanced3DModel3DTileContent(e,t,i,n,r)},cmpt:function(e,t,i,n,r){return new Composite3DTileContent(e,t,i,n,r,Cesium3DTileContentFactory)},externalTileset:function(e,t,i,n){return new Tileset3DTileContent(e,t,i,n)},geom:function(e,t,i,n,r){return new Geometry3DTileContent(e,t,i,n,r)},vctr:function(e,t,i,n,r){return new Vector3DTileContent(e,t,i,n,r)},subt:function(e,t,i,n,r){return new Implicit3DTileContent(e,t,i,void 0,n,r)},subtreeJson:function(e,t,i,n){return new Implicit3DTileContent(e,t,i,n)},glb:function(e,t,i,n,r){if(n.byteLength<12)throw new RuntimeError("Invalid glb content");const o=new DataView(n,r).getUint32(8,!0),a=new Uint8Array(n,r,o);return ModelExperimental3DTileContent.fromGltf(e,t,i,a)},gltf:function(e,t,i,n){return ModelExperimental3DTileContent.fromGltf(e,t,i,n)}},Cesium3DTileContentState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5};var Cesium3DTileContentState$1=Object.freeze(Cesium3DTileContentState);const Cesium3DTileContentType={BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",COMPOSITE:"cmpt",POINT_CLOUD:"pnts",VECTOR:"vctr",GEOMETRY:"geom",GLTF:"gltf",GLTF_BINARY:"glb",IMPLICIT_SUBTREE:"subt",IMPLICIT_SUBTREE_JSON:"subtreeJson",EXTERNAL_TILESET:"externalTileset",MULTIPLE_CONTENT:"multipleContent",isBinaryFormat:function(e){switch(e){case Cesium3DTileContentType.BATCHED_3D_MODEL:case Cesium3DTileContentType.INSTANCED_3D_MODEL:case Cesium3DTileContentType.COMPOSITE:case Cesium3DTileContentType.POINT_CLOUD:case Cesium3DTileContentType.VECTOR:case Cesium3DTileContentType.GEOMETRY:case Cesium3DTileContentType.IMPLICIT_SUBTREE:case Cesium3DTileContentType.GLTF_BINARY:return!0;default:return!1}}};var Cesium3DTileContentType$1=Object.freeze(Cesium3DTileContentType);const Cesium3DTileOptimizationHint={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var Cesium3DTileOptimizationHint$1=Object.freeze(Cesium3DTileOptimizationHint);function Cesium3DTilesetMostDetailedTraversal(){}const traversal$1={stack:new ManagedArray,stackMaximumLength:0};function isVisible$1(e){return e._visible&&e._inRequestVolume}function hasEmptyContent$1(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function hasUnloadedContent$1(e){return!hasEmptyContent$1(e)&&e.contentUnloaded}function canTraverse$1(e,t){return 0!==t.children.length&&(t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:(t.hasEmptyContent,!0))}function updateAndPushChildren$1(e,t,i,n){const r=t.children,o=r.length;for(let e=0;e<o;++e){const t=r[e];t.updateVisibility(n),isVisible$1(t)&&i.push(t)}}function loadTile$1(e,t){(hasUnloadedContent$1(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function touchTile$1(e,t,i){t._touchedFrame!==i.frameNumber&&(e._cache.touch(t),t._touchedFrame=i.frameNumber)}function visitTile$4(e){++e.statistics.visited}function selectDesiredTile$1(e,t,i){t.contentAvailable&&t.contentVisibility(i)!==Intersect$1.OUTSIDE&&e._selectedTiles.push(t)}function Cesium3DTilesetTraversal(){}function isVisible(e){return e._visible&&e._inRequestVolume}Cesium3DTilesetMostDetailedTraversal.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e._hasMixedContent=!1;let i=!0;const n=e.root;if(n.updateVisibility(t),!isVisible$1(n))return i;const r=traversal$1.stack;for(r.push(e.root);r.length>0;){traversal$1.stackMaximumLength=Math.max(traversal$1.stackMaximumLength,r.length);const n=r.pop(),o=n.refine===Cesium3DTileRefine$1.ADD,a=n.refine===Cesium3DTileRefine$1.REPLACE,s=canTraverse$1(e,n);s&&updateAndPushChildren$1(e,n,r,t),(o||a&&!s)&&(loadTile$1(e,n),touchTile$1(e,n,t),selectDesiredTile$1(e,n,t),hasEmptyContent$1(n)||n.contentAvailable||(i=!1)),visitTile$4(e)}return traversal$1.stack.trim(traversal$1.stackMaximumLength),i};const traversal={stack:new ManagedArray,stackMaximumLength:0},emptyTraversal={stack:new ManagedArray,stackMaximumLength:0},descendantTraversal={stack:new ManagedArray,stackMaximumLength:0},selectionTraversal={stack:new ManagedArray,stackMaximumLength:0,ancestorStack:new ManagedArray,ancestorStackMaximumLength:0},descendantSelectionDepth=2;function executeBaseTraversal(e,t,i){executeTraversal(e,t,e._maximumScreenSpaceError,e._maximumScreenSpaceError,i)}function executeSkipTraversal(e,t,i){executeTraversal(e,t,Number.MAX_VALUE,e._maximumScreenSpaceError,i),traverseAndSelect(e,t,i)}function executeBaseAndSkipTraversal(e,t,i){executeTraversal(e,t,Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),e.maximumScreenSpaceError,i),traverseAndSelect(e,t,i)}function skipLevelOfDetail(e){return e._skipLevelOfDetail}function addEmptyTile(e,t){e._emptyTiles.push(t)}function selectTile(e,t,i){if(t.contentVisibility(i)!==Intersect$1.OUTSIDE){const n=t.content;n.featurePropertiesDirty?(n.featurePropertiesDirty=!1,t.lastStyleTime=0,e._selectedTilesToStyle.push(t)):t._selectedFrame<i.frameNumber-1&&e._selectedTilesToStyle.push(t),t._selectedFrame=i.frameNumber,e._selectedTiles.push(t)}}function selectDescendants(e,t,i){const n=descendantTraversal.stack;for(n.push(t);n.length>0;){descendantTraversal.stackMaximumLength=Math.max(descendantTraversal.stackMaximumLength,n.length);const r=n.pop().children,o=r.length;for(let a=0;a<o;++a){const o=r[a];isVisible(o)&&(o.contentAvailable?(updateTile(e,o,i),touchTile(e,o,i),selectTile(e,o,i)):o._depth-t._depth<descendantSelectionDepth&&n.push(o))}}}function selectDesiredTile(e,t,i){if(!skipLevelOfDetail(e))return void(t.contentAvailable&&selectTile(e,t,i));const n=t.contentAvailable?t:t._ancestorWithContentAvailable;defined(n)?n._shouldSelect=!0:selectDescendants(e,t,i)}function visitTile$3(e,t,i){++e._statistics.visited,t._visitedFrame=i.frameNumber}function touchTile(e,t,i){t._touchedFrame!==i.frameNumber&&(e._cache.touch(t),t._touchedFrame=i.frameNumber)}function updateMinimumMaximumPriority(e,t){e._maximumPriority.distance=Math.max(t._priorityHolder._distanceToCamera,e._maximumPriority.distance),e._minimumPriority.distance=Math.min(t._priorityHolder._distanceToCamera,e._minimumPriority.distance),e._maximumPriority.depth=Math.max(t._depth,e._maximumPriority.depth),e._minimumPriority.depth=Math.min(t._depth,e._minimumPriority.depth),e._maximumPriority.foveatedFactor=Math.max(t._priorityHolder._foveatedFactor,e._maximumPriority.foveatedFactor),e._minimumPriority.foveatedFactor=Math.min(t._priorityHolder._foveatedFactor,e._minimumPriority.foveatedFactor),e._maximumPriority.reverseScreenSpaceError=Math.max(t._priorityReverseScreenSpaceError,e._maximumPriority.reverseScreenSpaceError),e._minimumPriority.reverseScreenSpaceError=Math.min(t._priorityReverseScreenSpaceError,e._minimumPriority.reverseScreenSpaceError)}function isOnScreenLongEnough(e,t,i){if(!e._cullRequestsWhileMoving)return!0;const n=t.boundingSphere,r=Math.max(2*n.radius,1),o=i.camera,a=0!==o.positionWCDeltaMagnitude?o.positionWCDeltaMagnitude:o.positionWCDeltaMagnitudeLastFrame;return e.cullRequestsWhileMovingMultiplier*a/r<1}function loadTile(e,t,i){if(t._requestedFrame===i.frameNumber||!hasUnloadedContent(t)&&!t.contentExpired)return;if(!isOnScreenLongEnough(e,t,i))return;const n=i.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&n||(t._requestedFrame=i.frameNumber,e._requestedTiles.push(t))}function updateVisibility(e,t,i){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(i),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function anyChildrenVisible(e,t,i){let n=!1;const r=t.children,o=r.length;for(let t=0;t<o;++t){const o=r[t];updateVisibility(e,o,i),n=n||isVisible(o)}return n}function meetsScreenSpaceErrorEarly(e,t,i){const n=t.parent;return!(!defined(n)||n.hasTilesetContent||n.hasImplicitContent||n.refine!==Cesium3DTileRefine$1.ADD)&&t.getScreenSpaceError(i,!0)<=e._maximumScreenSpaceError}function updateTileVisibility(e,t,i){if(updateVisibility(e,t,i),!isVisible(t))return;const n=t.children.length>0;if((t.hasTilesetContent||t.hasImplicitContent)&&n){const n=t.children[0];return updateTileVisibility(e,n,i),void(t._visible=n._visible)}if(meetsScreenSpaceErrorEarly(e,t,i))return void(t._visible=!1);const r=t.refine===Cesium3DTileRefine$1.REPLACE,o=t._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;return r&&o&&n&&!anyChildrenVisible(e,t,i)?(++e._statistics.numberOfTilesCulledWithChildrenUnion,void(t._visible=!1)):void 0}function updateTile(e,t,i){updateTileVisibility(e,t,i),t.updateExpiration(),t._wasMinPriorityChild=!1,t._priorityHolder=t,updateMinimumMaximumPriority(e,t),t._shouldSelect=!1,t._finalResolution=!0}function updateTileAncestorContentLinks(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;const i=e.parent;if(defined(i)){const n=!hasUnloadedContent(i)||i._requestedFrame===t.frameNumber;e._ancestorWithContent=n?i:i._ancestorWithContent,e._ancestorWithContentAvailable=i.contentAvailable?i:i._ancestorWithContentAvailable}}function hasEmptyContent(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function hasUnloadedContent(e){return!hasEmptyContent(e)&&e.contentUnloaded}function reachedSkippingThreshold(e,t){const i=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||defined(i)&&t._screenSpaceError<i._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>i._depth+e.skipLevels)}function sortChildrenByDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function updateAndPushChildren(e,t,i,n){let r;const o=t.refine===Cesium3DTileRefine$1.REPLACE,a=t.children,s=a.length;for(r=0;r<s;++r)updateTile(e,a[r],n);a.sort(sortChildrenByDistanceToCamera);const c=!skipLevelOfDetail(e)&&o&&!hasEmptyContent(t);let l,u=!0,d=!1,h=-1,p=Number.MAX_VALUE;for(r=0;r<s;++r)if(l=a[r],isVisible(l)?(i.push(l),l._foveatedFactor<p&&(h=r,p=l._foveatedFactor),d=!0):(c||e.loadSiblings)&&(l._foveatedFactor<p&&(h=r,p=l._foveatedFactor),loadTile(e,l,n),touchTile(e,l,n)),c){let t;t=!!l._inRequestVolume&&(hasEmptyContent(l)?executeEmptyTraversal(e,l,n):l.contentAvailable),u=u&&t}if(d||(u=!1),-1!==h&&!skipLevelOfDetail(e)&&o){const i=a[h];i._wasMinPriorityChild=!0;const n=(t._wasMinPriorityChild||t===e.root)&&p<=t._priorityHolder._foveatedFactor?t._priorityHolder:t;for(n._foveatedFactor=Math.min(i._foveatedFactor,n._foveatedFactor),n._distanceToCamera=Math.min(i._distanceToCamera,n._distanceToCamera),r=0;r<s;++r)l=a[r],l._priorityHolder=n}return u}function inBaseTraversal(e,t,i){return!skipLevelOfDetail(e)||!e.immediatelyLoadDesiredLevelOfDetail&&(!defined(t._ancestorWithContent)||(0===t._screenSpaceError?t.parent._screenSpaceError>i:t._screenSpaceError>i))}function canTraverse(e,t){return 0!==t.children.length&&(t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError)}function executeTraversal(e,t,i,n,r){const o=traversal.stack;for(o.push(t);o.length>0;){traversal.stackMaximumLength=Math.max(traversal.stackMaximumLength,o.length);const t=o.pop();updateTileAncestorContentLinks(t,r);const n=inBaseTraversal(e,t,i),a=t.refine===Cesium3DTileRefine$1.ADD,s=t.refine===Cesium3DTileRefine$1.REPLACE,c=t.parent,l=!defined(c)||c._refines;let u=!1;canTraverse(e,t)&&(u=updateAndPushChildren(e,t,o,r)&&l);const d=!u&&l;hasEmptyContent(t)?(addEmptyTile(e,t),loadTile(e,t,r),d&&selectDesiredTile(e,t,r)):a?(selectDesiredTile(e,t,r),loadTile(e,t,r)):s&&(n?(loadTile(e,t,r),d&&selectDesiredTile(e,t,r)):d?(selectDesiredTile(e,t,r),loadTile(e,t,r)):reachedSkippingThreshold(e,t)&&loadTile(e,t,r)),visitTile$3(e,t,r),touchTile(e,t,r),t._refines=u}}function executeEmptyTraversal(e,t,i){let n=!0;const r=emptyTraversal.stack;for(r.push(t);r.length>0;){emptyTraversal.stackMaximumLength=Math.max(emptyTraversal.stackMaximumLength,r.length);const t=r.pop(),o=t.children,a=o.length,s=hasEmptyContent(t),c=s&&canTraverse(e,t),l=s&&0===t.children.length;if(c||t.contentAvailable||l||(n=!1),updateTile(e,t,i),isVisible(t)||(loadTile(e,t,i),touchTile(e,t,i)),c)for(let e=0;e<a;++e){const t=o[e];r.push(t)}}return n}function traverseAndSelect(e,t,i){const n=selectionTraversal.stack,r=selectionTraversal.ancestorStack;let o;for(n.push(t);n.length>0||r.length>0;){if(selectionTraversal.stackMaximumLength=Math.max(selectionTraversal.stackMaximumLength,n.length),selectionTraversal.ancestorStackMaximumLength=Math.max(selectionTraversal.ancestorStackMaximumLength,r.length),r.length>0){const t=r.peek();if(t._stackLength===n.length){r.pop(),t!==o&&(t._finalResolution=!1),selectTile(e,t,i);continue}}const t=n.pop();if(!defined(t))continue;const a=t.refine===Cesium3DTileRefine$1.ADD,s=t._shouldSelect,c=t.children,l=c.length,u=canTraverse(e,t);if(s)if(a)selectTile(e,t,i);else{if(t._selectionDepth=r.length,t._selectionDepth>0&&(e._hasMixedContent=!0),o=t,!u){selectTile(e,t,i);continue}r.push(t),t._stackLength=n.length}if(u)for(let e=0;e<l;++e){const t=c[e];isVisible(t)&&n.push(t)}}}Cesium3DTilesetTraversal.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e._hasMixedContent=!1;const i=e.root;if(updateTile(e,i,t),!isVisible(i))return;if(i.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)return;skipLevelOfDetail(e)?e.immediatelyLoadDesiredLevelOfDetail?executeSkipTraversal(e,i,t):executeBaseAndSkipTraversal(e,i,t):executeBaseTraversal(e,i,t),traversal.stack.trim(traversal.stackMaximumLength),emptyTraversal.stack.trim(emptyTraversal.stackMaximumLength),descendantTraversal.stack.trim(descendantTraversal.stackMaximumLength),selectionTraversal.stack.trim(selectionTraversal.stackMaximumLength),selectionTraversal.ancestorStack.trim(selectionTraversal.ancestorStackMaximumLength);const n=e._requestedTiles,r=n.length;for(let e=0;e<r;++e)n[e].updatePriority()};const Cesium3DTilePass={RENDER:0,PICK:1,SHADOW:2,PRELOAD:3,PRELOAD_FLIGHT:4,REQUEST_RENDER_MODE_DEFER_CHECK:5,MOST_DETAILED_PRELOAD:6,MOST_DETAILED_PICK:7,NUMBER_OF_PASSES:8},passOptions=new Array(Cesium3DTilePass.NUMBER_OF_PASSES);passOptions[Cesium3DTilePass.RENDER]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!0,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PICK]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),passOptions[Cesium3DTilePass.SHADOW]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PRELOAD]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.PRELOAD_FLIGHT]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PRELOAD]=Object.freeze({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PICK]=Object.freeze({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),Cesium3DTilePass.getPassOptions=function(e){return passOptions[e]};var Cesium3DTilePass$1=Object.freeze(Cesium3DTilePass);function Empty3DTileContent(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}function ContentMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).content,i=e.class;this._class=i,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}function findContentMetadata(e,t){const i=hasExtension(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!defined(i))return;const n=e.schema.classes;if(defined(i.class)){return new ContentMetadata({content:i,class:n[i.class]})}}function findGroupMetadata(e,t){const i=e.metadataExtension;if(!defined(i))return;const n=i.groups,r=hasExtension(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"].group:t.group;if("number"==typeof r)return n[r];const o=i.groupIds.findIndex((function(e){return e===r}));return o>=0?n[o]:void 0}function TileMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tile,i=e.class;this._class=i,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}function findTileMetadata(e,t){const i=hasExtension(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!defined(i))return;const n=e.schema.classes;if(defined(i.class)){return new TileMetadata({tile:i,class:n[i.class]})}}function preprocess3DTileContent(e){const t=new Uint8Array(e);let i=getMagic(t);if("glTF"===i&&(i="glb"),Cesium3DTileContentType$1.isBinaryFormat(i))return{contentType:i,binaryPayload:t};const n=getJsonContent(t);if(defined(n.root))return{contentType:Cesium3DTileContentType$1.EXTERNAL_TILESET,jsonPayload:n};if(defined(n.asset))return{contentType:Cesium3DTileContentType$1.GLTF,jsonPayload:n};if(defined(n.tileAvailability))return{contentType:Cesium3DTileContentType$1.IMPLICIT_SUBTREE_JSON,jsonPayload:n};throw new RuntimeError("Invalid tile content.")}function getJsonContent(e){let t;try{t=getJsonFromTypedArray(e)}catch(e){throw new RuntimeError("Invalid tile content.")}return t}function Multiple3DTileContent(e,t,i,n){this._tileset=e,this._tile=t,this._tilesetResource=i,this._contents=[];const r=defined(n.contents)?n.contents:n.content;this._innerContentHeaders=r,this._requestsInFlight=0,this._cancelCount=0;const o=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(o),this._requests=new Array(o),this._innerContentResources=new Array(o),this._serverKeys=new Array(o);for(let e=0;e<o;e++){const t=i.getDerivedResource({url:r[e].uri}),n=RequestScheduler.getServerKey(t.getUrlComponent());this._innerContentResources[e]=t,this._serverKeys[e]=n}this._contentsFetchedPromise=void 0,this._readyPromise=defer()}function updatePendingRequests(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function cancelPendingRequests(e,t){e._cancelCount++,e._tile._contentState=t,e.tileset.statistics.numberOfPendingRequests-=e._requestsInFlight,e._requestsInFlight=0;const i=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(i)}function canScheduleAllRequests(e){const t={};for(let i=0;i<e.length;i++){const n=e[i];defined(t[n])?t[n]++:t[n]=1}for(const e in t)if(t.hasOwnProperty(e)&&!RequestScheduler.serverHasOpenSlots(e,t[e]))return!1;return RequestScheduler.heapHasOpenSlots(e.length)}function requestInnerContent(e,t,i,n){const r=e._innerContentResources[t].clone(),o=e.tile,a=e._serverKeys[t],s=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TILES3D,priorityFunction:function(){return o._priority},serverKey:a});return r.request=s,e._requests[t]=s,r.fetchArrayBuffer().then((function(t){if(!(i<e._cancelCount))return updatePendingRequests(e,-1),t})).catch((function(o){i<e._cancelCount||(r.request.state!==RequestState$1.CANCELLED?(updatePendingRequests(e,-1),handleInnerContentFailed(e,t,o)):cancelPendingRequests(e,n))}))}function createInnerContents(e){const t=e._cancelCount;Promise.all(e._arrayFetchPromises).then((function(i){if(!(t<e._cancelCount))return i.map((function(t,i){if(defined(t))try{return createInnerContent(e,t,i)}catch(t){return void handleInnerContentFailed(e,i,t)}}))})).then((function(t){defined(t)?(e._contents=t.filter(defined),awaitReadyPromises(e),defined(e._contentsFetchedPromise)&&e._contentsFetchedPromise.resolve()):defined(e._contentsFetchedPromise)&&(e._contentsFetchedPromise.resolve(),e._contentsFetchedPromise=void 0)})).catch((function(t){defined(e._contentsFetchedPromise)&&e._contentsFetchedPromise.reject(t)}))}function createInnerContent(e,t,i){const n=preprocess3DTileContent(t);if(n.contentType===Cesium3DTileContentType$1.EXTERNAL_TILESET)throw new RuntimeError("External tilesets are disallowed inside multiple contents");e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||n.contentType===Cesium3DTileContentType$1.GEOMETRY||n.contentType===Cesium3DTileContentType$1.VECTOR;const r=e._tileset,o=e._innerContentResources[i],a=e._tile;let s;const c=Cesium3DTileContentFactory[n.contentType];s=defined(n.binaryPayload)?c(r,a,o,n.binaryPayload.buffer,0):c(r,a,o,n.jsonPayload);const l=e._innerContentHeaders[i];if(a.hasImplicitContentMetadata){const e=a.implicitSubtree,t=a.implicitCoordinates;s.metadata=e.getContentMetadataView(t,i)}else a.hasImplicitContent||(s.metadata=findContentMetadata(r,l));const u=findGroupMetadata(r,l);return defined(u)&&(s.group=new Cesium3DContentGroup({metadata:u})),s}function awaitReadyPromises(e){const t=e._contents.map((function(e){return e.readyPromise}));Promise.all(t).then((function(){e._readyPromise.resolve(e)})).catch((function(t){e._readyPromise.reject(t)}))}function handleInnerContentFailed(e,t,i){const n=e._tileset,r=e._innerContentResources[t].url,o=defined(i.message)?i.message:i.toString();n.tileFailed.numberOfListeners>0?n.tileFailed.raiseEvent({url:r,message:o}):(console.log(`A content failed to load: ${r}`),console.log(`Error: ${o}`))}function TileBoundingRegion(e){this.rectangle=Rectangle.clone(e.rectangle),this.minimumHeight=defaultValue(e.minimumHeight,0),this.maximumHeight=defaultValue(e.maximumHeight,0),this.southwestCornerCartesian=new Cartesian3,this.northeastCornerCartesian=new Cartesian3,this.westNormal=new Cartesian3,this.southNormal=new Cartesian3,this.eastNormal=new Cartesian3,this.northNormal=new Cartesian3;const t=defaultValue(e.ellipsoid,Ellipsoid.WGS84);computeBox(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,defaultValue(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(Empty3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(e){}},batchTable:{get:function(){}},group:{get:function(){},set:function(e){}}}),Empty3DTileContent.prototype.hasProperty=function(e,t){return!1},Empty3DTileContent.prototype.getFeature=function(e){},Empty3DTileContent.prototype.applyDebugSettings=function(e,t){},Empty3DTileContent.prototype.applyStyle=function(e){},Empty3DTileContent.prototype.update=function(e,t){},Empty3DTileContent.prototype.isDestroyed=function(){return!1},Empty3DTileContent.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(ContentMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),ContentMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},ContentMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},ContentMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},ContentMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},ContentMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},ContentMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},ContentMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(TileMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),TileMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},TileMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},TileMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},TileMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},TileMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},TileMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},TileMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(Multiple3DTileContent.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let i=0;i<t;++i)if(e[i].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,i=t.length;for(let n=0;n<i;++n)t[n].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(){}},batchTable:{get:function(){}},group:{get:function(){},set:function(){}},innerContentUrls:{get:function(){return this._innerContentHeaders.map((function(e){return e.uri}))}},contentsFetchedPromise:{get:function(){if(defined(this._contentsFetchedPromise))return this._contentsFetchedPromise.promise}}}),Multiple3DTileContent.prototype.requestInnerContents=function(){if(!canScheduleAllRequests(this._serverKeys))return this._serverKeys.length;const e=this._innerContentHeaders;updatePendingRequests(this,e.length);for(let t=0;t<e.length;t++)this._arrayFetchPromises[t]=requestInnerContent(this,t,this._cancelCount,this._tile._contentState);return defined(this._contentsFetchedPromise)||(this._contentsFetchedPromise=defer()),createInnerContents(this),0},Multiple3DTileContent.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){const t=this._requests[e];defined(t)&&t.cancel()}},Multiple3DTileContent.prototype.hasProperty=function(e,t){return!1},Multiple3DTileContent.prototype.getFeature=function(e){},Multiple3DTileContent.prototype.applyDebugSettings=function(e,t){const i=this._contents,n=i.length;for(let r=0;r<n;++r)i[r].applyDebugSettings(e,t)},Multiple3DTileContent.prototype.applyStyle=function(e){const t=this._contents,i=t.length;for(let n=0;n<i;++n)t[n].applyStyle(e)},Multiple3DTileContent.prototype.update=function(e,t){const i=this._contents,n=i.length;for(let r=0;r<n;++r)i[r].update(e,t)},Multiple3DTileContent.prototype.isDestroyed=function(){return!1},Multiple3DTileContent.prototype.destroy=function(){const e=this._contents,t=e.length;for(let i=0;i<t;++i)e[i].destroy();return destroyObject(this)},Object.defineProperties(TileBoundingRegion.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileBoundingRegion.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=OrientedBoundingBox.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox)};const cartesian3Scratch$1=new Cartesian3,cartesian3Scratch2=new Cartesian3,cartesian3Scratch3=new Cartesian3,eastWestNormalScratch=new Cartesian3,westernMidpointScratch=new Cartesian3,easternMidpointScratch=new Cartesian3,cartographicScratch$3=new Cartographic,planeScratch=new Plane(Cartesian3.UNIT_X,0),rayScratch=new Ray;function computeBox(e,t,i){i.cartographicToCartesian(Rectangle.southwest(t),e.southwestCornerCartesian),i.cartographicToCartesian(Rectangle.northeast(t),e.northeastCornerCartesian),cartographicScratch$3.longitude=t.west,cartographicScratch$3.latitude=.5*(t.south+t.north),cartographicScratch$3.height=0;const n=i.cartographicToCartesian(cartographicScratch$3,westernMidpointScratch),r=Cartesian3.cross(n,Cartesian3.UNIT_Z,cartesian3Scratch$1);Cartesian3.normalize(r,e.westNormal),cartographicScratch$3.longitude=t.east;const o=i.cartographicToCartesian(cartographicScratch$3,easternMidpointScratch),a=Cartesian3.cross(Cartesian3.UNIT_Z,o,cartesian3Scratch$1);Cartesian3.normalize(a,e.eastNormal);const s=Cartesian3.subtract(n,o,cartesian3Scratch$1),c=Cartesian3.normalize(s,eastWestNormalScratch),l=t.south;let u;if(l>0){cartographicScratch$3.longitude=.5*(t.west+t.east),cartographicScratch$3.latitude=l;const n=i.cartographicToCartesian(cartographicScratch$3,rayScratch.origin);Cartesian3.clone(c,rayScratch.direction);const r=Plane.fromPointNormal(e.southwestCornerCartesian,e.westNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,r,e.southwestCornerCartesian),u=i.geodeticSurfaceNormal(n,cartesian3Scratch2)}else u=i.geodeticSurfaceNormalCartographic(Rectangle.southeast(t),cartesian3Scratch2);const d=Cartesian3.cross(u,s,cartesian3Scratch3);Cartesian3.normalize(d,e.southNormal);const h=t.north;let p;if(h<0){cartographicScratch$3.longitude=.5*(t.west+t.east),cartographicScratch$3.latitude=h;const n=i.cartographicToCartesian(cartographicScratch$3,rayScratch.origin);Cartesian3.negate(c,rayScratch.direction);const r=Plane.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,r,e.northeastCornerCartesian),p=i.geodeticSurfaceNormal(n,cartesian3Scratch2)}else p=i.geodeticSurfaceNormalCartographic(Rectangle.northwest(t),cartesian3Scratch2);const f=Cartesian3.cross(s,p,cartesian3Scratch3);Cartesian3.normalize(f,e.northNormal)}const southwestCornerScratch=new Cartesian3,northeastCornerScratch=new Cartesian3,negativeUnitY=new Cartesian3(0,-1,0),negativeUnitZ=new Cartesian3(0,0,-1),vectorScratch=new Cartesian3;function distanceToCameraRegion(e,t){const i=t.camera,n=i.positionWC,r=i.positionCartographic;let o,a,s,c=0;if(!Rectangle.contains(e.rectangle,r)){let i=e.southwestCornerCartesian,r=e.northeastCornerCartesian,o=e.westNormal,a=e.southNormal,s=e.eastNormal,l=e.northNormal;t.mode!==SceneMode$1.SCENE3D&&(i=t.mapProjection.project(Rectangle.southwest(e.rectangle),southwestCornerScratch),i.z=i.y,i.y=i.x,i.x=0,r=t.mapProjection.project(Rectangle.northeast(e.rectangle),northeastCornerScratch),r.z=r.y,r.y=r.x,r.x=0,o=negativeUnitY,s=Cartesian3.UNIT_Y,a=negativeUnitZ,l=Cartesian3.UNIT_Z);const u=Cartesian3.subtract(n,i,vectorScratch),d=Cartesian3.dot(u,o),h=Cartesian3.dot(u,a),p=Cartesian3.subtract(n,r,vectorScratch),f=Cartesian3.dot(p,s),m=Cartesian3.dot(p,l);d>0?c+=d*d:f>0&&(c+=f*f),h>0?c+=h*h:m>0&&(c+=m*m)}if(t.mode===SceneMode$1.SCENE3D?(o=r.height,a=e.minimumHeight,s=e.maximumHeight):(o=n.x,a=0,s=0),o>s){const e=o-s;c+=e*e}else if(o<a){const e=a-o;c+=e*e}return Math.sqrt(c)}TileBoundingRegion.prototype.distanceToCamera=function(e){const t=distanceToCameraRegion(this,e);if(e.mode===SceneMode$1.SCENE3D&&defined(this._orientedBoundingBox)){const i=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,i)}return t},TileBoundingRegion.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileBoundingRegion.prototype.createDebugVolume=function(e){const t=new Matrix4.clone(Matrix4.IDENTITY);return new Primitive$3({geometryInstances:new GeometryInstance({geometry:new RectangleOutlineGeometry({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})};let centerCartographicScratch$1=new Cartographic;function TileBoundingS2Cell(e){const t=S2Cell.fromToken(e.token),i=defaultValue(e.minimumHeight,0),n=defaultValue(e.maximumHeight,0),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this.s2Cell=t,this.minimumHeight=i,this.maximumHeight=n,this.ellipsoid=r;const o=computeBoundingPlanes(t,i,n,r);this._boundingPlanes=o;const a=computeVertices(o);let s;for(this._vertices=a,this._edgeNormals=new Array(6),this._edgeNormals[0]=computeEdgeNormals(o[0],a.slice(0,4)),s=0;s<4;s++)this._edgeNormals[0][s]=Cartesian3.negate(this._edgeNormals[0][s],this._edgeNormals[0][s]);for(this._edgeNormals[1]=computeEdgeNormals(o[1],a.slice(4,8)),s=0;s<4;s++)this._edgeNormals[2+s]=computeEdgeNormals(o[2+s],[a[s%4],a[(s+1)%4],a[4+(s+1)%4],a[4+s]]);for(this._planeVertices=[this._vertices.slice(0,4),this._vertices.slice(4,8)],s=0;s<4;s++)this._planeVertices.push([this._vertices[s%4],this._vertices[(s+1)%4],this._vertices[4+(s+1)%4],this._vertices[4+s]]);const c=t.getCenter();centerCartographicScratch$1=r.cartesianToCartographic(c,centerCartographicScratch$1),centerCartographicScratch$1.height=(n+i)/2,this.center=r.cartographicToCartesian(centerCartographicScratch$1,c),this._boundingSphere=BoundingSphere.fromPoints(a)}const centerGeodeticNormalScratch=new Cartesian3,topCartographicScratch=new Cartographic,topScratch=new Cartesian3,vertexCartographicScratch=new Cartographic,vertexScratch=new Cartesian3,vertexGeodeticNormalScratch=new Cartesian3,sideNormalScratch=new Cartesian3,sideScratch=new Cartesian3;function computeBoundingPlanes(e,t,i,n){const r=new Array(6),o=e.getCenter(),a=n.geodeticSurfaceNormal(o,centerGeodeticNormalScratch),s=n.cartesianToCartographic(o,topCartographicScratch);s.height=i;const c=n.cartographicToCartesian(s,topScratch),l=Plane.fromPointNormal(c,a);r[0]=l;let u,d=0;const h=[];let p,f;for(u=0;u<4;u++){p=e.getVertex(u),h[u]=p,f=n.cartesianToCartographic(p,vertexCartographicScratch),f.height=t;const i=Plane.getPointDistance(l,n.cartographicToCartesian(f,vertexScratch));i<d&&(d=i)}const m=Plane.clone(l);for(m.normal=Cartesian3.negate(m.normal,m.normal),m.distance=-1*m.distance+d,r[1]=m,u=0;u<4;u++){p=h[u];const e=h[(u+1)%4],t=n.geodeticSurfaceNormal(p,vertexGeodeticNormalScratch),i=Cartesian3.subtract(e,p,sideScratch);let o=Cartesian3.cross(i,t,sideNormalScratch);o=Cartesian3.normalize(o,o),r[2+u]=Plane.fromPointNormal(p,o)}return r}let n0Scratch=new Cartesian3,n1Scratch=new Cartesian3,n2Scratch=new Cartesian3,x0Scratch=new Cartesian3,x1Scratch=new Cartesian3,x2Scratch=new Cartesian3;const t0Scratch=new Cartesian3,t1Scratch=new Cartesian3,t2Scratch=new Cartesian3;let f0Scratch=new Cartesian3,f1Scratch=new Cartesian3,f2Scratch=new Cartesian3,sScratch=new Cartesian3;const matrixScratch=new Matrix3;function computeIntersection(e,t,i){n0Scratch=e.normal,n1Scratch=t.normal,n2Scratch=i.normal,x0Scratch=Cartesian3.multiplyByScalar(e.normal,-e.distance,x0Scratch),x1Scratch=Cartesian3.multiplyByScalar(t.normal,-t.distance,x1Scratch),x2Scratch=Cartesian3.multiplyByScalar(i.normal,-i.distance,x2Scratch),f0Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n1Scratch,n2Scratch,t0Scratch),Cartesian3.dot(x0Scratch,n0Scratch),f0Scratch),f1Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n2Scratch,n0Scratch,t1Scratch),Cartesian3.dot(x1Scratch,n1Scratch),f1Scratch),f2Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n0Scratch,n1Scratch,t2Scratch),Cartesian3.dot(x2Scratch,n2Scratch),f2Scratch),matrixScratch[0]=n0Scratch.x,matrixScratch[1]=n1Scratch.x,matrixScratch[2]=n2Scratch.x,matrixScratch[3]=n0Scratch.y,matrixScratch[4]=n1Scratch.y,matrixScratch[5]=n2Scratch.y,matrixScratch[6]=n0Scratch.z,matrixScratch[7]=n1Scratch.z,matrixScratch[8]=n2Scratch.z;const n=Matrix3.determinant(matrixScratch);return sScratch=Cartesian3.add(f0Scratch,f1Scratch,sScratch),sScratch=Cartesian3.add(sScratch,f2Scratch,sScratch),new Cartesian3(sScratch.x/n,sScratch.y/n,sScratch.z/n)}function computeVertices(e){const t=new Array(8);for(let i=0;i<4;i++)t[i]=computeIntersection(e[0],e[2+(i+3)%4],e[2+i%4]),t[i+4]=computeIntersection(e[1],e[2+(i+3)%4],e[2+i%4]);return t}let edgeScratch=new Cartesian3,edgeNormalScratch=new Cartesian3;function computeEdgeNormals(e,t){const i=[];for(let n=0;n<4;n++)edgeScratch=Cartesian3.subtract(t[(n+1)%4],t[n],edgeScratch),edgeNormalScratch=Cartesian3.cross(e.normal,edgeScratch,edgeNormalScratch),edgeNormalScratch=Cartesian3.normalize(edgeNormalScratch,edgeNormalScratch),i[n]=Cartesian3.clone(edgeNormalScratch);return i}Object.defineProperties(TileBoundingS2Cell.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});const facePointScratch=new Cartesian3;TileBoundingS2Cell.prototype.distanceToCamera=function(e){const t=e.camera.positionWC,i=[],n=[];let r,o,a,s,c;for(Plane.getPointDistance(this._boundingPlanes[0],t)>0?(i.push(0),n.push(this._planeVertices[0]),r=this._edgeNormals[0]):Plane.getPointDistance(this._boundingPlanes[1],t)>0&&(i.push(1),n.push(this._planeVertices[1]),r=this._edgeNormals[1]),o=0;o<4;o++)a=2+o,Plane.getPointDistance(this._boundingPlanes[a],t)>0&&(i.push(a),n.push(this._planeVertices[a]),r=this._edgeNormals[a]);if(0===i.length)return 0;if(1===i.length)return c=this._boundingPlanes[i[0]],s=closestPointPolygon(Plane.projectPointOntoPlane(c,t,facePointScratch),n[0],c,r),Cartesian3.distance(s,t);if(2===i.length){if(0===i[0]){const e=[this._vertices[4*i[0]+(i[1]-2)],this._vertices[4*i[0]+(i[1]-2+1)%4]];return s=closestPointLineSegment(t,e[0],e[1]),Cartesian3.distance(s,t)}let e,r=Number.MAX_VALUE;for(o=0;o<2;o++)c=this._boundingPlanes[i[o]],s=closestPointPolygon(Plane.projectPointOntoPlane(c,t,facePointScratch),n[o],c,this._edgeNormals[i[o]]),e=Cartesian3.distanceSquared(s,t),e<r&&(r=e);return Math.sqrt(r)}if(i.length>3)return s=closestPointPolygon(Plane.projectPointOntoPlane(this._boundingPlanes[1],t,facePointScratch),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),Cartesian3.distance(s,t);const l=2===i[1]&&5===i[2]?0:1;return 0===i[0]?Cartesian3.distance(t,this._vertices[(i[1]-2+l)%4]):Cartesian3.distance(t,this._vertices[4+(i[1]-2+l)%4])};const dScratch=new Cartesian3,pL0Scratch=new Cartesian3;function closestPointLineSegment(e,t,i){const n=Cartesian3.subtract(i,t,dScratch),r=Cartesian3.subtract(e,t,pL0Scratch);let o=Cartesian3.dot(n,r);if(o<=0)return t;const a=Cartesian3.dot(n,n);return o>=a?i:(o/=a,new Cartesian3((1-o)*t.x+o*i.x,(1-o)*t.y+o*i.y,(1-o)*t.z+o*i.z))}const edgePlaneScratch=new Plane(Cartesian3.UNIT_X,0);function closestPointPolygon(e,t,i,n){let r,o,a,s=Number.MAX_VALUE;for(let i=0;i<t.length;i++){const c=Plane.fromPointNormal(t[i],n[i],edgePlaneScratch);Plane.getPointDistance(c,e)<0||(a=closestPointLineSegment(e,t[i],t[(i+1)%4]),r=Cartesian3.distance(e,a),r<s&&(s=r,o=a))}return defined(o)?o:e}function TileBoundingSphere(e,t){0===t&&(t=CesiumMath.EPSILON7),this._boundingSphere=new BoundingSphere(e,t)}TileBoundingS2Cell.prototype.intersectPlane=function(e){let t=0,i=0;for(let n=0;n<this._vertices.length;n++){Cartesian3.dot(e.normal,this._vertices[n])+e.distance<0?i++:t++}return t===this._vertices.length?Intersect$1.INSIDE:i===this._vertices.length?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},TileBoundingS2Cell.prototype.createDebugVolume=function(e){const t=new Matrix4.clone(Matrix4.IDENTITY),i=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[0]}}),n=new GeometryInstance({geometry:CoplanarPolygonOutlineGeometry.createGeometry(i),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),r=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[1]}}),o=new GeometryInstance({geometry:CoplanarPolygonOutlineGeometry.createGeometry(r),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),a=[];for(let i=0;i<4;i++){const n=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[2+i]}}),r=CoplanarPolygonOutlineGeometry.createGeometry(n);a[i]=new GeometryInstance({geometry:r,id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}})}return new Primitive$3({geometryInstances:[a[0],a[1],a[2],a[3],o,n],appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Object.defineProperties(TileBoundingSphere.prototype,{center:{get:function(){return this._boundingSphere.center}},radius:{get:function(){return this._boundingSphere.radius}},boundingVolume:{get:function(){return this._boundingSphere}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileBoundingSphere.prototype.distanceToCamera=function(e){const t=this._boundingSphere;return Math.max(0,Cartesian3.distance(t.center,e.camera.positionWC)-t.radius)},TileBoundingSphere.prototype.intersectPlane=function(e){return BoundingSphere.intersectPlane(this._boundingSphere,e)},TileBoundingSphere.prototype.update=function(e,t){Cartesian3.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t},TileBoundingSphere.prototype.createDebugVolume=function(e){return new Primitive$3({geometryInstances:new GeometryInstance({geometry:new SphereOutlineGeometry({radius:this.radius}),id:"outline",modelMatrix:Matrix4.fromTranslation(this.center,new Matrix4.clone(Matrix4.IDENTITY)),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})};const scratchU=new Cartesian3,scratchV=new Cartesian3,scratchW=new Cartesian3,scratchCartesian$6=new Cartesian3;function computeMissingVector(e,t,i){i=Cartesian3.cross(e,t,i);const n=Cartesian3.magnitude(i);return Cartesian3.multiplyByScalar(i,CesiumMath.EPSILON7/n,i)}function findOrthogonalVector(e,t){const i=Cartesian3.normalize(e,scratchCartesian$6);return computeMissingVector(e,Cartesian3.equalsEpsilon(i,Cartesian3.UNIT_X,CesiumMath.EPSILON6)?Cartesian3.UNIT_Y:Cartesian3.UNIT_X,t)}function checkHalfAxes(e){let t=Matrix3.getColumn(e,0,scratchU),i=Matrix3.getColumn(e,1,scratchV),n=Matrix3.getColumn(e,2,scratchW);const r=Cartesian3.equals(t,Cartesian3.ZERO),o=Cartesian3.equals(i,Cartesian3.ZERO),a=Cartesian3.equals(n,Cartesian3.ZERO);return r||o||a?r&&o&&a?(e[0]=CesiumMath.EPSILON7,e[4]=CesiumMath.EPSILON7,e[8]=CesiumMath.EPSILON7,e):(!r||o||a?r||!o||a?r||o||!a?r?o?a||(t=findOrthogonalVector(n,t),i=computeMissingVector(n,t,i)):(t=findOrthogonalVector(i,t),n=computeMissingVector(i,t,n)):(i=findOrthogonalVector(t,i),n=computeMissingVector(i,t,n)):n=computeMissingVector(i,t,n):i=computeMissingVector(t,n,i):t=computeMissingVector(i,n,t),Matrix3.setColumn(e,0,t,e),Matrix3.setColumn(e,1,i,e),Matrix3.setColumn(e,2,n,e),e):e}function TileOrientedBoundingBox(e,t){t=checkHalfAxes(t),this._orientedBoundingBox=new OrientedBoundingBox(e,t),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox)}function Cesium3DTile(e,t,i,n){this._tileset=e,this._header=i;const r=defined(i.contents),o=r&&i.contents.length>1||hasExtension(i,"3DTILES_multiple_contents"),a=r&&!o?i.contents[0]:i.content;this.transform=defined(i.transform)?Matrix4.unpack(i.transform):Matrix4.clone(Matrix4.IDENTITY);const s=defined(n)?n.computedTransform:e.modelMatrix,c=Matrix4.multiply(s,this.transform,new Matrix4),l=defined(n)?n._initialTransform:Matrix4.IDENTITY;let u,d,h,p;this._initialTransform=Matrix4.multiply(l,this.transform,new Matrix4),this.computedTransform=c,this._boundingVolume=this.createBoundingVolume(i.boundingVolume,c),this._boundingVolume2D=void 0,defined(a)&&defined(a.boundingVolume)&&(u=this.createBoundingVolume(a.boundingVolume,c)),this._contentBoundingVolume=u,this._contentBoundingVolume2D=void 0,defined(i.viewerRequestVolume)&&(d=this.createBoundingVolume(i.viewerRequestVolume,c)),this._viewerRequestVolume=d,this.geometricError=i.geometricError,this._geometricError=i.geometricError,defined(this._geometricError)||(this._geometricError=defined(n)?n.geometricError:e._geometricError,Cesium3DTile._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale(),defined(i.refine)?("replace"!==i.refine&&"add"!==i.refine||Cesium3DTile._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${i.refine}". Instead use "${i.refine.toUpperCase()}".`),h="REPLACE"===i.refine.toUpperCase()?Cesium3DTileRefine$1.REPLACE:Cesium3DTileRefine$1.ADD):h=defined(n)?n.refine:Cesium3DTileRefine$1.REPLACE,this.refine=h,this.children=[],this.parent=n;let f,m,g,_=!1;if(t=Resource.createIfNeeded(t),o)f=Cesium3DTileContentState$1.UNLOADED,m=t.clone();else if(defined(a)){let e=a.uri;defined(a.url)&&(Cesium3DTile._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),e=a.url),f=Cesium3DTileContentState$1.UNLOADED,m=t.getDerivedResource({url:e}),g=RequestScheduler.getServerKey(m.getUrlComponent())}else p=new Empty3DTileContent(e,this),_=!0,f=Cesium3DTileContentState$1.READY;this._content=p,this._contentResource=m,this._contentState=f,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=g,this.hasEmptyContent=_,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=o,this.metadata=findTileMetadata(e,i),this.cacheNode=void 0;const y=i.expire;let C,T;defined(y)&&(C=y.duration,defined(y.date)&&(T=JulianDate.fromIso8601(y.date))),this.expireDuration=C,this.expireDate=T,this.lastStyleTime=0,this._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.priorityDeferred=!1,this.implicitTileset=void 0,this.implicitCoordinates=void 0,this.implicitSubtree=void 0,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._visibilityPlaneMask=0,this._visible=!1,this._inRequestVolume=!1,this._finalResolution=!0,this._depth=0,this._stackLength=0,this._selectionDepth=0,this._updatedVisibilityFrame=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._clippingPlanesState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=Color.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,this._priorityHolder=this,this._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new JulianDate,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Object.defineProperties(TileOrientedBoundingBox.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileOrientedBoundingBox.prototype.distanceToCamera=function(e){return Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))},TileOrientedBoundingBox.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileOrientedBoundingBox.prototype.update=function(e,t){Cartesian3.clone(e,this._orientedBoundingBox.center),t=checkHalfAxes(t),Matrix3.clone(t,this._orientedBoundingBox.halfAxes),BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)},TileOrientedBoundingBox.prototype.createDebugVolume=function(e){return new Primitive$3({geometryInstances:new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-1,-1,-1),maximum:new Cartesian3(1,1,1)}),id:"outline",modelMatrix:Matrix4.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Cesium3DTile._deprecationWarning=deprecationWarning,Object.defineProperties(Cesium3DTile.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return defaultValue(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},extras:{get:function(){return this._header.extras}},color:{get:function(){return defined(this._color)||(this._color=new Color),Color.clone(this._color)},set:function(e){this._color=Color.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent||defined(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Cesium3DTileContentState$1.READY}},contentUnloaded:{get:function(){return this._contentState===Cesium3DTileContentState$1.UNLOADED}},contentExpired:{get:function(){return this._contentState===Cesium3DTileContentState$1.EXPIRED}},contentFailed:{get:function(){return this._contentState===Cesium3DTileContentState$1.FAILED}},contentReadyToProcessPromise:{get:function(){if(defined(this._contentReadyToProcessPromise))return this._contentReadyToProcessPromise.promise}},contentReadyPromise:{get:function(){if(defined(this._contentReadyPromise))return this._contentReadyPromise.promise}},commandsLength:{get:function(){return this._commandsLength}}});const scratchCartesian$5=new Cartesian3;function isPriorityDeferred(e,t){const i=e._tileset,n=t.camera,r=e.boundingSphere,o=r.radius,a=Cartesian3.multiplyByScalar(n.directionWC,e._centerZDepth,scratchCartesian$5),s=Cartesian3.add(n.positionWC,a,scratchCartesian$5),c=Cartesian3.subtract(s,r.center,scratchCartesian$5);if(Cartesian3.magnitude(c)>o){const t=Cartesian3.normalize(c,scratchCartesian$5),i=Cartesian3.multiplyByScalar(t,o,scratchCartesian$5),a=Cartesian3.add(r.center,i,scratchCartesian$5),s=Cartesian3.subtract(a,n.positionWC,scratchCartesian$5),l=Cartesian3.normalize(s,scratchCartesian$5);e._foveatedFactor=1-Math.abs(Cartesian3.dot(n.directionWC,l))}else e._foveatedFactor=0;const l=e.refine===Cesium3DTileRefine$1.REPLACE,u=i._skipLevelOfDetail;if(l&&!u||!i.foveatedScreenSpaceError||1===i.foveatedConeSize||e._priorityProgressiveResolution&&l&&u||i._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT||i._pass===Cesium3DTilePass$1.PRELOAD)return!1;const d=1-Math.cos(.5*n.frustum.fov),h=i.foveatedConeSize*d;if(e._foveatedFactor<=h)return!1;const p=d-h,f=CesiumMath.clamp((e._foveatedFactor-h)/p,0,1),m=i.foveatedInterpolationCallback(i.foveatedMinimumScreenSpaceErrorRelaxation,i.maximumScreenSpaceError,f),g=0===e._screenSpaceError&&defined(e.parent)?.5*e.parent._screenSpaceError:e._screenSpaceError;return i.maximumScreenSpaceError-m<=g}const scratchJulianDate$1=new JulianDate;function isPriorityProgressiveResolution(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;let i=t._screenSpaceErrorProgressiveResolution>e._maximumScreenSpaceError;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;const n=t.parent,r=e._maximumScreenSpaceError,o=t._screenSpaceErrorProgressiveResolution<=r,a=defined(n)&&n._screenSpaceErrorProgressiveResolution>r;return o&&a&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,i=!0),i}function getPriorityReverseScreenSpaceError(e,t){const i=t.parent,n=defined(i)&&(!e._skipLevelOfDetail||0===t._screenSpaceError||i.hasTilesetContent||i.hasImplicitContent)?i._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-n}function updateExpireDate(e){if(defined(e.expireDuration)){const t=JulianDate.now(scratchJulianDate$1);JulianDate.addSeconds(t,e.expireDuration,t),defined(e.expireDate)?JulianDate.lessThan(e.expireDate,t)&&JulianDate.clone(t,e.expireDate):e.expireDate=JulianDate.clone(t)}}function createPriorityFunction(e){return function(){return e._priority}}function requestMultipleContents(e){let t=e._content;const i=e._tileset;if(!defined(t)){const n=hasExtension(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new Multiple3DTileContent(i,e,e._contentResource.clone(),n),e._content=t}const n=t.requestInnerContents();return n>0?n:(e._contentState=Cesium3DTileContentState$1.LOADING,e._contentReadyToProcessPromise=defer(),e._contentReadyPromise=defer(),t.contentsFetchedPromise.then((function(){if(e._contentState===Cesium3DTileContentState$1.LOADING){if(!e.isDestroyed())return e._contentState=Cesium3DTileContentState$1.PROCESSING,e._contentReadyToProcessPromise.resolve(t),t.readyPromise.then((function(t){e.isDestroyed()?multipleContentFailed(e,i,"Tile was unloaded while content was processing"):(e._selectedFrame=0,e.lastStyleTime=0,JulianDate.now(e._loadTimestamp),e._contentState=Cesium3DTileContentState$1.READY,e._contentReadyPromise.resolve(t))}));multipleContentFailed(e,i,"Tile was unloaded while content was loading")}})).catch((function(t){multipleContentFailed(e,i,t)})),0)}function multipleContentFailed(e,t,i){e._contentState===Cesium3DTileContentState$1.PROCESSING&&--t.statistics.numberOfTilesProcessing,e._contentState=Cesium3DTileContentState$1.FAILED,e._contentReadyPromise.reject(i),e._contentReadyToProcessPromise.reject(i)}function requestSingleContent(e){const t=e._contentResource.clone(),i=e.contentExpired;i&&t.setQueryParameters({expired:e.expireDate.toString()});const n=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TILES3D,priorityFunction:createPriorityFunction(e),serverKey:e._serverKey});e._request=n,t.request=n;const r=t.fetchArrayBuffer();if(!defined(r))return 1;const o=e._contentState,a=e._tileset;return e._contentState=Cesium3DTileContentState$1.LOADING,e._contentReadyToProcessPromise=defer(),e._contentReadyPromise=defer(),++a.statistics.numberOfPendingRequests,r.then((function(t){if(e.isDestroyed())return void singleContentFailed(e,a);const n=makeContent(e,t);return i&&(e.expireDate=void 0),e._content=n,e._contentState=Cesium3DTileContentState$1.PROCESSING,e._contentReadyToProcessPromise.resolve(n),--a.statistics.numberOfPendingRequests,n.readyPromise.then((function(t){e.isDestroyed()?singleContentFailed(e,a):(updateExpireDate(e),e._selectedFrame=0,e.lastStyleTime=0,JulianDate.now(e._loadTimestamp),e._contentState=Cesium3DTileContentState$1.READY,e._contentReadyPromise.resolve(t))}))})).catch((function(t){if(n.state===RequestState$1.CANCELLED)return e._contentState=o,--a.statistics.numberOfPendingRequests,void++a.statistics.numberOfAttemptedRequests;singleContentFailed(e,a,t)})),0}function singleContentFailed(e,t,i){e._contentState===Cesium3DTileContentState$1.PROCESSING?--t.statistics.numberOfTilesProcessing:--t.statistics.numberOfPendingRequests,e._contentState=Cesium3DTileContentState$1.FAILED,e._contentReadyPromise.reject(i),e._contentReadyToProcessPromise.reject(i)}function makeContent(e,t){const i=preprocess3DTileContent(t),n=e._tileset;let r;n._disableSkipLevelOfDetail=n._disableSkipLevelOfDetail||i.contentType===Cesium3DTileContentType$1.GEOMETRY||i.contentType===Cesium3DTileContentType$1.VECTOR,i.contentType!==Cesium3DTileContentType$1.IMPLICIT_SUBTREE&&i.contentType!==Cesium3DTileContentType$1.IMPLICIT_SUBTREE_JSON||(e.hasImplicitContent=!0),i.contentType===Cesium3DTileContentType$1.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);const o=Cesium3DTileContentFactory[i.contentType];r=defined(i.binaryPayload)?o(n,e,e._contentResource,i.binaryPayload.buffer,0):o(n,e,e._contentResource,i.jsonPayload);const a=defined(e._header.contents)?e._header.contents[0]:e._header.content;if(e.hasImplicitContentMetadata){const t=e.implicitSubtree,i=e.implicitCoordinates;r.metadata=t.getContentMetadataView(i,0)}else e.hasImplicitContent||(r.metadata=findContentMetadata(n,a));const s=findGroupMetadata(n,a);return defined(s)&&(r.group=new Cesium3DContentGroup({metadata:s})),r}Cesium3DTile.prototype.getScreenSpaceError=function(e,t,i){const n=this._tileset,r=defaultValue(i,1),o=defined(this.parent)?this.parent.geometricError:n._geometricError,a=t?o:this.geometricError;if(0===a)return 0;const s=e.camera;let c=s.frustum;const l=e.context,u=l.drawingBufferWidth,d=l.drawingBufferHeight*r;let h;if(e.mode===SceneMode$1.SCENE2D||c instanceof OrthographicFrustum){defined(c._offCenterFrustum)&&(c=c._offCenterFrustum);h=a/(Math.max(c.top-c.bottom,c.right-c.left)/Math.max(u,d))}else{const e=Math.max(this._distanceToCamera,CesiumMath.EPSILON7);if(h=a*d/(e*s.frustum.sseDenominator),n.dynamicScreenSpaceError){const t=n._dynamicScreenSpaceErrorComputedDensity,i=n.dynamicScreenSpaceErrorFactor;h-=CesiumMath.fog(e,t)*i}}return h/=e.pixelRatio,h},Cesium3DTile.prototype.updateVisibility=function(e){const t=this.parent,i=this._tileset,n=defined(t)?t.computedTransform:i.modelMatrix,r=defined(t)?t._visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.updateTransform(n),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,i.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,r),this._visible=this._visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=getPriorityReverseScreenSpaceError(i,this),this._priorityProgressiveResolution=isPriorityProgressiveResolution(i,this),this.priorityDeferred=isPriorityDeferred(this,e)},Cesium3DTile.prototype.updateExpiration=function(){if(defined(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=JulianDate.now(scratchJulianDate$1);JulianDate.lessThan(this.expireDate,e)&&(this._contentState=Cesium3DTileContentState$1.EXPIRED,this._expiredContent=this._content)}},Cesium3DTile.prototype.requestContent=function(){return this.hasEmptyContent?0:this.hasMultipleContents?requestMultipleContents(this):requestSingleContent(this)},Cesium3DTile.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()},Cesium3DTile.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||this.hasImplicitContent||(this._content=this._content&&this._content.destroy(),this._contentState=Cesium3DTileContentState$1.UNLOADED,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this.lastStyleTime=0,this.clippingPlanesDirty=0===this._clippingPlanesState,this._clippingPlanesState=0,this._debugColorizeTiles=!1,this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy())};const scratchProjectedBoundingSphere=new BoundingSphere;function getBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._boundingVolume2D)){const i=e._boundingVolume.boundingSphere,n=BoundingSphere.projectTo2D(i,t.mapProjection,scratchProjectedBoundingSphere);e._boundingVolume2D=new TileBoundingSphere(n.center,n.radius)}return t.mode!==SceneMode$1.SCENE3D?e._boundingVolume2D:e._boundingVolume}function getContentBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._contentBoundingVolume2D)){const i=e._contentBoundingVolume.boundingSphere,n=BoundingSphere.projectTo2D(i,t.mapProjection,scratchProjectedBoundingSphere);e._contentBoundingVolume2D=new TileBoundingSphere(n.center,n.radius)}return t.mode!==SceneMode$1.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Cesium3DTile.prototype.visibility=function(e,t){const i=e.cullingVolume,n=getBoundingVolume(this,e),r=this._tileset,o=r.clippingPlanes;if(defined(o)&&o.enabled){const e=o.computeIntersectionWithBoundingVolume(n,r.clippingPlanesOriginMatrix);if(this._isClipped=e!==Intersect$1.INSIDE,e===Intersect$1.OUTSIDE)return CullingVolume.MASK_OUTSIDE}return i.computeVisibilityWithPlaneMask(n,t)},Cesium3DTile.prototype.contentVisibility=function(e){if(!defined(this._contentBoundingVolume))return Intersect$1.INSIDE;if(this._visibilityPlaneMask===CullingVolume.MASK_INSIDE)return Intersect$1.INSIDE;const t=e.cullingVolume,i=getContentBoundingVolume(this,e),n=this._tileset,r=n.clippingPlanes;if(defined(r)&&r.enabled){const e=r.computeIntersectionWithBoundingVolume(i,n.clippingPlanesOriginMatrix);if(this._isClipped=e!==Intersect$1.INSIDE,e===Intersect$1.OUTSIDE)return Intersect$1.OUTSIDE}return t.computeVisibility(i)},Cesium3DTile.prototype.distanceToTile=function(e){return getBoundingVolume(this,e).distanceToCamera(e)};const scratchToTileCenter=new Cartesian3;Cesium3DTile.prototype.distanceToTileCenter=function(e){const t=getBoundingVolume(this,e).boundingVolume,i=Cartesian3.subtract(t.center,e.camera.positionWC,scratchToTileCenter);return Cartesian3.dot(e.camera.directionWC,i)},Cesium3DTile.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!defined(t)||0===t.distanceToCamera(e)};const scratchMatrix$2=new Matrix3,scratchScale$2=new Cartesian3,scratchHalfAxes=new Matrix3,scratchCenter$4=new Cartesian3,scratchRectangle$5=new Rectangle,scratchOrientedBoundingBox=new OrientedBoundingBox,scratchTransform=new Matrix4;function createBox(e,t,i){let n=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$4),r=Matrix3.fromArray(e,3,scratchHalfAxes);n=Matrix4.multiplyByPoint(t,n,n);const o=Matrix4.getMatrix3(t,scratchMatrix$2);return r=Matrix3.multiply(o,r,r),defined(i)?(i.update(n,r),i):new TileOrientedBoundingBox(n,r)}function createBoxFromTransformedRegion(e,t,i,n){const r=Rectangle.unpack(e,0,scratchRectangle$5),o=e[4],a=e[5],s=OrientedBoundingBox.fromRectangle(r,o,a,Ellipsoid.WGS84,scratchOrientedBoundingBox);let c=s.center,l=s.halfAxes;t=Matrix4.multiplyTransformation(t,Matrix4.inverseTransformation(i,scratchTransform),scratchTransform),c=Matrix4.multiplyByPoint(t,c,c);const u=Matrix4.getMatrix3(t,scratchMatrix$2);return l=Matrix3.multiply(u,l,l),defined(n)&&n instanceof TileOrientedBoundingBox?(n.update(c,l),n):new TileOrientedBoundingBox(c,l)}function createRegion(e,t,i,n){if(!Matrix4.equalsEpsilon(t,i,CesiumMath.EPSILON8))return createBoxFromTransformedRegion(e,t,i,n);if(defined(n))return n;return new TileBoundingRegion({rectangle:Rectangle.unpack(e,0,scratchRectangle$5),minimumHeight:e[4],maximumHeight:e[5]})}function createSphere(e,t,i){let n=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$4),r=e[3];n=Matrix4.multiplyByPoint(t,n,n);const o=Matrix4.getScale(t,scratchScale$2);return r*=Cartesian3.maximumComponent(o),defined(i)?(i.update(n,r),i):new TileBoundingSphere(n,r)}function applyDebugSettings$1(e,t,i,n){if(!n.isRender)return;const r=defined(e._header.content)&&defined(e._header.content.boundingVolume),o=e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent,a=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!r;if(a){let t;t=e._finalResolution?o?Color.DARKGRAY:Color.WHITE:Color.YELLOW,defined(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(t)),e._debugBoundingVolume.update(i);const n=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");n.color=ColorGeometryInstanceAttribute.toValue(t,n.color)}else!a&&defined(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&r?(defined(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(Color.BLUE)),e._debugContentBoundingVolume.update(i)):!t.debugShowContentBoundingVolume&&defined(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&defined(e._viewerRequestVolume)?(defined(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(Color.YELLOW)),e._debugViewerRequestVolume.update(i)):!t.debugShowViewerRequestVolume&&defined(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());const s=t.debugColorizeTiles&&!e._debugColorizeTiles||defined(t._heatmap.tilePropertyName),c=!t.debugColorizeTiles&&e._debugColorizeTiles;s?(t._heatmap.colorize(e,i),e._debugColorizeTiles=!0,e.color=e._debugColor):c&&(e._debugColorizeTiles=!1,e.color=Color.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),c&&t.makeStyleDirty()}function updateContent(e,t,i){const n=e._content,r=e._expiredContent;if(!e.hasMultipleContents&&defined(r)){if(!e.contentReady)return void r.update(t,i);e._expiredContent.destroy(),e._expiredContent=void 0}n.update(t,i)}function updateClippingPlanes(e,t){const i=t.clippingPlanes;let n=0;defined(i)&&e._isClipped&&i.enabled&&(n=i.clippingPlanesState),n!==e._clippingPlanesState&&(e._clippingPlanesState=n,e.clippingPlanesDirty=!0)}Cesium3DTile.prototype.createBoundingVolume=function(e,t,i){if(!defined(e))throw new RuntimeError("boundingVolume must be defined");if(hasExtension(e,"3DTILES_bounding_volume_S2"))return new TileBoundingS2Cell(e.extensions["3DTILES_bounding_volume_S2"]);if(defined(e.box))return createBox(e.box,t,i);if(defined(e.region))return createRegion(e.region,t,this._initialTransform,i);if(defined(e.sphere))return createSphere(e.sphere,t,i);throw new RuntimeError("boundingVolume must contain a sphere, region, or box")},Cesium3DTile.prototype.updateTransform=function(e){e=defaultValue(e,Matrix4.IDENTITY);const t=Matrix4.multiply(e,this.transform,scratchTransform);if(!!Matrix4.equals(t,this.computedTransform))return;Matrix4.clone(t,this.computedTransform);const i=this._header,n=this._header.content;this._boundingVolume=this.createBoundingVolume(i.boundingVolume,this.computedTransform,this._boundingVolume),defined(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),defined(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(i.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)),this.updateGeometricErrorScale(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy()},Cesium3DTile.prototype.updateGeometricErrorScale=function(){const e=Matrix4.getScale(this.computedTransform,scratchScale$2),t=Cartesian3.maximumComponent(e);this.geometricError=this._geometricError*t},Cesium3DTile.prototype.update=function(e,t,i){const n=t.commandList.length;updateClippingPlanes(this,e),applyDebugSettings$1(this,e,t,i),updateContent(this,e,t);const r=t.commandList.length-n;this._commandsLength=r;for(let e=0;e<r;++e){const i=t.commandList[n+e],r=i.pass===Pass$1.TRANSLUCENT;i.depthForTranslucentClassification=r}this.clippingPlanesDirty=!1};const scratchCommandList$1=[];function isolateDigits(e,t,i){const n=e*Math.pow(10,t);return parseInt(n)*Math.pow(10,i)}function priorityNormalizeAndClamp(e,t,i){return Math.max(CesiumMath.normalize(e,t,i)-CesiumMath.EPSILON7,0)}function GroupMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,i=e.group,n=e.class,r=defined(i.properties)?i.properties:{};this._class=n,this._properties=r,this._id=t,this._extras=i.extras,this._extensions=i.extensions}function TilesetMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tileset,i=e.class,n=defined(t.properties)?t.properties:{};this._class=i,this._properties=n,this._extras=t.extras,this._extensions=t.extensions}function Cesium3DTilesetMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).metadataJson,i=e.schema,n=defaultValue(t.metadata,t.tileset);let r;defined(n)&&(r=new TilesetMetadata({tileset:n,class:i.classes[n.class]}));let o=[];const a=[],s=t.groups;if(Array.isArray(s)){const e=s.length;for(let t=0;t<e;t++){const e=s[t];o.push(e.id),a.push(new GroupMetadata({id:e.id,group:e,class:i.classes[e.class]}))}}else if(defined(s)){o=Object.keys(s).sort();const e=o.length;for(let t=0;t<e;t++){const e=o[t];if(s.hasOwnProperty(e)){const t=s[e];a.push(new GroupMetadata({id:e,group:s[e],class:i.classes[t.class]}))}}}this._schema=i,this._groups=a,this._groupIds=o,this._tileset=r,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Cesium3DTile.prototype.process=function(e,t){const i=t.commandList;t.commandList=scratchCommandList$1,this._content.update(e,t),scratchCommandList$1.length=0,t.commandList=i},Cesium3DTile.prototype.updatePriority=function(){const e=this.tileset,t=e.preferLeaves,i=e._minimumPriority,n=e._maximumPriority,r=Math.pow(10,8),o=Math.pow(10,9),a=Math.pow(10,10);let s=priorityNormalizeAndClamp(this._depth,i.depth,n.depth);s=t?1-s:s;const c=isolateDigits(!e._skipLevelOfDetail&&this.refine===Cesium3DTileRefine$1.REPLACE?priorityNormalizeAndClamp(this._priorityHolder._distanceToCamera,i.distance,n.distance):priorityNormalizeAndClamp(this._priorityReverseScreenSpaceError,i.reverseScreenSpaceError,n.reverseScreenSpaceError),4,0),l=this._priorityProgressiveResolution?0:r,u=isolateDigits(priorityNormalizeAndClamp(this._priorityHolder._foveatedFactor,i.foveatedFactor,n.foveatedFactor),4,4),d=this.priorityDeferred?o:0,h=e._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT?0:a;this._priority=s+c+l+u+d+h},Cesium3DTile.prototype.isDestroyed=function(){return!1},Cesium3DTile.prototype.destroy=function(){return this._content=this._content&&this._content.destroy(),this._expiredContent=this._expiredContent&&!this._expiredContent.isDestroyed()&&this._expiredContent.destroy(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy(),destroyObject(this)},Object.defineProperties(GroupMetadata.prototype,{class:{get:function(){return this._class}},id:{get:function(){return this._id}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),GroupMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},GroupMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},GroupMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},GroupMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},GroupMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},GroupMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},GroupMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(TilesetMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),TilesetMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},TilesetMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},TilesetMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},TilesetMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},TilesetMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},TilesetMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},TilesetMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(Cesium3DTilesetMetadata.prototype,{schema:{get:function(){return this._schema}},groups:{get:function(){return this._groups}},groupIds:{get:function(){return this._groupIds}},tileset:{get:function(){return this._tileset}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});const Cesium3DTileOptimizations={},scratchAxis$1=new Cartesian3;function Cesium3DTilesetCache(){this._list=new DoublyLinkedList,this._sentinel=this._list.add(),this._trimTiles=!1}function Cesium3DTilesetHeatmap(e){this.tilePropertyName=e,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE,this._previousMinimum=Number.MAX_VALUE,this._previousMaximum=-Number.MAX_VALUE,this._referenceMinimum={},this._referenceMaximum={}}function getHeatmapValue(e,t){let i;return i="_loadTimestamp"===t?JulianDate.toDate(e).getTime():e,i}function getHeatmapValueAndUpdateMinimumMaximum(e,t){const i=e.tilePropertyName;if(defined(i)){const n=getHeatmapValue(t[i],i);return defined(n)?(e._maximum=Math.max(n,e._maximum),e._minimum=Math.min(n,e._minimum),n):(e.tilePropertyName=void 0,n)}}Cesium3DTileOptimizations.checkChildrenWithinParent=function(e){const t=e.children,i=t.length,n=e.boundingVolume;if(n instanceof TileOrientedBoundingBox||n instanceof TileBoundingRegion){const r=n._orientedBoundingBox;e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;for(let n=0;n<i;++n){const i=t[n].boundingVolume;if(!(i instanceof TileOrientedBoundingBox||i instanceof TileBoundingRegion)){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}const o=i._orientedBoundingBox,a=Cartesian3.subtract(o.center,r.center,scratchAxis$1),s=Cartesian3.magnitude(a);Cartesian3.divideByScalar(a,s,a);if(Math.abs(r.halfAxes[0]*a.x)+Math.abs(r.halfAxes[1]*a.y)+Math.abs(r.halfAxes[2]*a.z)+Math.abs(r.halfAxes[3]*a.x)+Math.abs(r.halfAxes[4]*a.y)+Math.abs(r.halfAxes[5]*a.z)+Math.abs(r.halfAxes[6]*a.x)+Math.abs(r.halfAxes[7]*a.y)+Math.abs(r.halfAxes[8]*a.z)<=Math.abs(o.halfAxes[0]*a.x)+Math.abs(o.halfAxes[1]*a.y)+Math.abs(o.halfAxes[2]*a.z)+Math.abs(o.halfAxes[3]*a.x)+Math.abs(o.halfAxes[4]*a.y)+Math.abs(o.halfAxes[5]*a.z)+Math.abs(o.halfAxes[6]*a.x)+Math.abs(o.halfAxes[7]*a.y)+Math.abs(o.halfAxes[8]*a.z)+s){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION},Cesium3DTilesetCache.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)},Cesium3DTilesetCache.prototype.touch=function(e){const t=e.cacheNode;defined(t)&&this._list.splice(this._sentinel,t)},Cesium3DTilesetCache.prototype.add=function(e){defined(e.cacheNode)||(e.cacheNode=this._list.add(e))},Cesium3DTilesetCache.prototype.unloadTile=function(e,t,i){const n=t.cacheNode;defined(n)&&(this._list.remove(n),t.cacheNode=void 0,i(e,t))},Cesium3DTilesetCache.prototype.unloadTiles=function(e,t){const i=this._trimTiles;this._trimTiles=!1;const n=this._list,r=1024*e.maximumMemoryUsage*1024,o=this._sentinel;let a=n.head;for(;a!==o&&(e.totalMemoryUsageInBytes>r||i);){const i=a.item;a=a.next,this.unloadTile(e,i,t)}},Cesium3DTilesetCache.prototype.trim=function(){this._trimTiles=!0},Cesium3DTilesetHeatmap.prototype.setReferenceMinimumMaximum=function(e,t,i){this._referenceMinimum[i]=getHeatmapValue(e,i),this._referenceMaximum[i]=getHeatmapValue(t,i)};const heatmapColors=[new Color(.1,.1,.1,1),new Color(.153,.278,.878,1),new Color(.827,.231,.49,1),new Color(.827,.188,.22,1),new Color(1,.592,.259,1),new Color(1,.843,0,1)];function Cesium3DTilesetStatistics(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfPendingRequests=0,this.numberOfTilesProcessing=0,this.numberOfTilesWithContentReady=0,this.numberOfTilesTotal=0,this.numberOfLoadedTilesTotal=0,this.numberOfFeaturesSelected=0,this.numberOfFeaturesLoaded=0,this.numberOfPointsSelected=0,this.numberOfPointsLoaded=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0,this.geometryByteLength=0,this.texturesByteLength=0,this.batchTableByteLength=0}function updatePointAndFeatureCounts(e,t,i,n){const r=t.innerContents,o=t.pointsLength,a=t.trianglesLength,s=t.featuresLength,c=t.geometryByteLength,l=t.texturesByteLength,u=t.batchTableByteLength;if(n?(e.numberOfFeaturesLoaded+=i?-s:s,e.numberOfPointsLoaded+=i?-o:o,e.geometryByteLength+=i?-c:c,e.texturesByteLength+=i?-l:l,e.batchTableByteLength+=i?-u:u):(e.numberOfFeaturesSelected+=i?-s:s,e.numberOfPointsSelected+=i?-o:o,e.numberOfTrianglesSelected+=i?-a:a),defined(r)){const t=r.length;for(let o=0;o<t;++o)updatePointAndFeatureCounts(e,r[o],i,n)}}function Cesium3DTileStyleEngine(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}function ImplicitTileset(e,t,i){const n=hasExtension(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=i;const r=t.boundingVolume;if(!defined(r.box)&&!defined(r.region)&&!hasExtension(r,"3DTILES_bounding_volume_S2"))throw new RuntimeError("Only box, region and 3DTILES_bounding_volume_S2 are supported for implicit tiling");this.boundingVolume=r,this.refine=t.refine,this.subtreeUriTemplate=new Resource({url:n.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];const o=gatherContentHeaders(t);for(let e=0;e<o.length;e++){const t=o[e];this.contentHeaders.push(clone$1(t,!0));const i=new Resource({url:t.uri});this.contentUriTemplates.push(i)}this.contentCount=this.contentHeaders.length,this.tileHeader=makeTileHeaderTemplate(t),this.subdivisionScheme=ImplicitSubdivisionScheme$1[n.subdivisionScheme],this.branchingFactor=ImplicitSubdivisionScheme$1.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=n.subtreeLevels,defined(n.availableLevels)?this.availableLevels=n.availableLevels:this.availableLevels=n.maximumLevel+1}function gatherContentHeaders(e){if(hasExtension(e,"3DTILES_multiple_contents")){const t=e.extensions["3DTILES_multiple_contents"];return defined(t.contents)?t.contents:t.content}return defined(e.contents)?e.contents:defined(e.content)?[e.content]:[]}function makeTileHeaderTemplate(e){const t=clone$1(e,!0);return defined(t.extensions)&&(delete t.extensions["3DTILES_implicit_tiling"],delete t.extensions["3DTILES_multiple_contents"],0===Object.keys(t.extensions).length&&delete t.extensions),delete t.implicitTiling,delete t.contents,delete t.content,t}function ImplicitTileCoordinates(e){this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(this.z=e.z)}Cesium3DTilesetHeatmap.prototype.colorize=function(e,t){if(!defined(this.tilePropertyName)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const i=getHeatmapValueAndUpdateMinimumMaximum(this,e),n=this._previousMinimum,r=this._previousMaximum;if(n===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;const o=r-n+CesiumMath.EPSILON7,a=CesiumMath.clamp(i-n,0,o)/o*(heatmapColors.length-1),s=Math.floor(a),c=Math.ceil(a),l=a-s,u=heatmapColors[s],d=heatmapColors[c],h=Color.clone(Color.WHITE);h.red=CesiumMath.lerp(u.red,d.red,l),h.green=CesiumMath.lerp(u.green,d.green,l),h.blue=CesiumMath.lerp(u.blue,d.blue,l),e._debugColor=h},Cesium3DTilesetHeatmap.prototype.resetMinimumMaximum=function(){const e=this.tilePropertyName;if(defined(e)){const t=this._referenceMinimum[e],i=this._referenceMaximum[e],n=defined(t)&&defined(i);this._previousMinimum=n?t:this._minimum,this._previousMaximum=n?i:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}},Cesium3DTilesetStatistics.prototype.clear=function(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfFeaturesSelected=0,this.numberOfPointsSelected=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0},Cesium3DTilesetStatistics.prototype.incrementSelectionCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!1)},Cesium3DTilesetStatistics.prototype.incrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!0)},Cesium3DTilesetStatistics.prototype.decrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!0,!0)},Cesium3DTilesetStatistics.clone=function(e,t){t.selected=e.selected,t.visited=e.visited,t.numberOfCommands=e.numberOfCommands,t.selected=e.selected,t.numberOfAttemptedRequests=e.numberOfAttemptedRequests,t.numberOfPendingRequests=e.numberOfPendingRequests,t.numberOfTilesProcessing=e.numberOfTilesProcessing,t.numberOfTilesWithContentReady=e.numberOfTilesWithContentReady,t.numberOfTilesTotal=e.numberOfTilesTotal,t.numberOfFeaturesSelected=e.numberOfFeaturesSelected,t.numberOfFeaturesLoaded=e.numberOfFeaturesLoaded,t.numberOfPointsSelected=e.numberOfPointsSelected,t.numberOfPointsLoaded=e.numberOfPointsLoaded,t.numberOfTrianglesSelected=e.numberOfTrianglesSelected,t.numberOfTilesStyled=e.numberOfTilesStyled,t.numberOfFeaturesStyled=e.numberOfFeaturesStyled,t.numberOfTilesCulledWithChildrenUnion=e.numberOfTilesCulledWithChildrenUnion,t.geometryByteLength=e.geometryByteLength,t.texturesByteLength=e.texturesByteLength,t.batchTableByteLength=e.batchTableByteLength},Object.defineProperties(Cesium3DTileStyleEngine.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}}),Cesium3DTileStyleEngine.prototype.makeDirty=function(){this._styleDirty=!0},Cesium3DTileStyleEngine.prototype.resetDirty=function(){this._styleDirty=!1},Cesium3DTileStyleEngine.prototype.applyStyle=function(e){if(!e.ready)return;if(defined(this._style)&&!this._style.ready)return;const t=this._styleDirty;t&&++this._lastStyleTime;const i=this._lastStyleTime,n=e._statistics,r=t?e._selectedTiles:e._selectedTilesToStyle,o=r.length;for(let e=0;e<o;++e){const t=r[e];if(t.lastStyleTime!==i){const e=t.content;t.lastStyleTime=i,e.applyStyle(this._style),n.numberOfFeaturesStyled+=e.featuresLength,++n.numberOfTilesStyled}}},Object.defineProperties(ImplicitTileCoordinates.prototype,{childIndex:{get:function(){let e=0;return e|=1&this.x,e|=(1&this.y)<<1,this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(e|=(1&this.z)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE?MortonOrder.encode3D(this.x,this.y,this.z):MortonOrder.encode2D(this.x,this.y)}},tileIndex:{get:function(){return(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3)+this.mortonIndex}}}),ImplicitTileCoordinates.prototype.getDescendantCoordinates=function(e){const t=this.level+e.level,i=(this.x<<e.level)+e.x,n=(this.y<<e.level)+e.y;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const r=(this.z<<e.level)+e.z;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:n,z:r})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:n})},ImplicitTileCoordinates.prototype.getAncestorCoordinates=function(e){const t=1<<e,i=this.level-e,n=Math.floor(this.x/t),r=Math.floor(this.y/t);if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const e=Math.floor(this.z/t);return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:i,x:n,y:r,z:e})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:i,x:n,y:r})},ImplicitTileCoordinates.prototype.getOffsetCoordinates=function(e){const t=e.level-this.level,i=1<<t,n=e.x%i,r=e.y%i;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const o=e.z%i;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:r,z:o})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:r})},ImplicitTileCoordinates.prototype.getChildCoordinates=function(e){const t=this.level+1,i=2*this.x+e%2,n=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const r=2*this.z+Math.floor(e/4)%2;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:n,z:r})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:n})},ImplicitTileCoordinates.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)},ImplicitTileCoordinates.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)},ImplicitTileCoordinates.prototype.isAncestor=function(e){const t=e.level-this.level;if(t<=0)return!1;const i=e.x>>t,n=e.y>>t,r=this.x===i,o=this.y===n;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const i=e.z>>t,n=this.z===i;return r&&o&&n}return r&&o},ImplicitTileCoordinates.prototype.isEqual=function(e){return this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme!==ImplicitSubdivisionScheme$1.OCTREE||this.z===e.z)},ImplicitTileCoordinates.prototype.isImplicitTilesetRoot=function(){return 0===this.level},ImplicitTileCoordinates.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels==0},ImplicitTileCoordinates.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels==this.subtreeLevels-1},ImplicitTileCoordinates.prototype.getTemplateValues=function(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(e.z=this.z),e};const scratchCoordinatesArray=[0,0,0];function Cesium3DTileset(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._url=void 0,this._basePath=void 0,this._root=void 0,this._resource=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._extensionsUsed=void 0,this._extensions=void 0,this._gltfUpAxis=void 0,this._cache=new Cesium3DTilesetCache,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._updatedModelMatrixFrame=0,this._modelMatrixChanged=!1,this._previousModelMatrix=void 0,this._extras=void 0,this._credits=void 0,this._showCreditsOnScreen=defaultValue(e.showCreditsOnScreen,!1),this._cullWithChildrenBounds=defaultValue(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new ManagedArray,this._maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=defaultValue(e.maximumMemoryUsage,512),this._availability=void 0,this._definitionChanged=new Event,this.availability=defaultValue(this.availability,e.availability),this._styleEngine=new Cesium3DTileStyleEngine,this._modelMatrix=defined(e.modelMatrix)?Matrix4.clone(e.modelMatrix):Matrix4.clone(Matrix4.IDENTITY),this._statistics=new Cesium3DTilesetStatistics,this._statisticsLast=new Cesium3DTilesetStatistics,this._statisticsPerPass=new Array(Cesium3DTilePass$1.NUMBER_OF_PASSES);for(let e=0;e<Cesium3DTilePass$1.NUMBER_OF_PASSES;++e)this._statisticsPerPass[e]=new Cesium3DTilesetStatistics;this._requestedTilesInFlight=[],this._maximumPriority={foveatedFactor:-Number.MAX_VALUE,depth:-Number.MAX_VALUE,distance:-Number.MAX_VALUE,reverseScreenSpaceError:-Number.MAX_VALUE},this._minimumPriority={foveatedFactor:Number.MAX_VALUE,depth:Number.MAX_VALUE,distance:Number.MAX_VALUE,reverseScreenSpaceError:Number.MAX_VALUE},this._heatmap=new Cesium3DTilesetHeatmap(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=defaultValue(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=defaultValue(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=CesiumMath.clamp(defaultValue(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=defaultValue(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._readyPromise=defer(),this._classificationType=e.classificationType,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._initialClippingPlanesOriginMatrix=Matrix4.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=defaultValue(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=defaultValue(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=defaultValue(e.preloadWhenHidden,!1),this.preloadFlightDestinations=defaultValue(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=defaultValue(e.dynamicScreenSpaceError,!1),this.foveatedScreenSpaceError=defaultValue(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=defaultValue(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=defaultValue(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=defaultValue(e.foveatedInterpolationCallback,CesiumMath.lerp),this.foveatedTimeDelay=defaultValue(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this.show=defaultValue(e.show,!0),this.colorBlendMode=Cesium3DTileColorBlendMode$1.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new PointCloudShading(e.pointCloudShading),this._pointCloudEyeDomeLighting=new PointCloudEyeDomeLighting,this.loadProgress=new Event,this.allTilesLoaded=new Event,this.initialTilesLoaded=new Event,this.tileLoad=new Event,this.tileUnload=new Event,this.tileFailed=new Event,this.tileVisible=new Event,this.skipLevelOfDetail=defaultValue(e.skipLevelOfDetail,!1),this._skipLevelOfDetail=this.skipLevelOfDetail,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=defaultValue(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=defaultValue(e.skipScreenSpaceErrorFactor,16),this.skipLevels=defaultValue(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=defaultValue(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=defaultValue(e.loadSiblings,!1),this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes;const t=defined(e.imageBasedLightingFactor)||defined(e.luminanceAtZenith)||defined(e.sphericalHarmonicCoefficients)||defined(e.specularEnvironmentMaps);defined(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):t?(deprecationWarning("ImageBasedLightingConstructor","Individual image-based lighting parameters were deprecated in Cesium 1.92. They will be removed in version 1.94. Use options.imageBasedLighting instead."),this._imageBasedLighting=new ImageBasedLighting({imageBasedLightingFactor:e.imageBasedLightingFactor,luminanceAtZenith:e.luminanceAtZenith,sphericalHarmonicCoefficients:e.sphericalHarmonicCoefficients,specularEnvironmentMaps:e.specularEnvironmentMaps}),this._shouldDestroyImageBasedLighting=!0):(this._imageBasedLighting=new ImageBasedLighting,this._shouldDestroyImageBasedLighting=!0),this.lightColor=e.lightColor,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this.showOutline=defaultValue(e.showOutline,!0),this.splitDirection=defaultValue(e.splitDirection,SplitDirection$1.NONE),this.debugFreezeFrame=defaultValue(e.debugFreezeFrame,!1),this.debugColorizeTiles=defaultValue(e.debugColorizeTiles,!1),this.debugWireframe=defaultValue(e.debugWireframe,!1),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=defaultValue(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=defaultValue(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=defaultValue(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=defaultValue(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=defaultValue(e.debugShowMemoryUsage,!1),this.debugShowUrl=defaultValue(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this._metadataExtension=void 0,this._customShader=e.customShader,this.enableModelExperimental=defaultValue(e.enableModelExperimental,ExperimentalFeatures.enableModelExperimental);let i=defaultValue(e.featureIdLabel,"featureId_0");"number"==typeof i&&(i=`featureId_${i}`),this._featureIdLabel=i;let n=defaultValue(e.instanceFeatureIdLabel,"instanceFeatureId_0");"number"==typeof n&&(n=`instanceFeatureId_${n}`),this._instanceFeatureIdLabel=n,this._schemaLoader=void 0;const r=this;let o;Promise.resolve(e.url).then((function(e){let t;return o=Resource.createIfNeeded(e),r._resource=o,r._credits=o.credits,"json"===o.extension?t=o.getBaseUri(!0):o.isDataUri&&(t=""),r._url=o.url,r._basePath=t,Cesium3DTileset.loadJson(o)})).then((function(e){return processMetadataExtension(r,e)})).then((function(e){r._root=r.loadTileset(o,e);const t=defined(e.asset.gltfUpAxis)?Axis$1.fromName(e.asset.gltfUpAxis):Axis$1.Y,i=e.asset;r._asset=i,r._properties=e.properties,r._geometricError=e.geometricError,r._extensionsUsed=e.extensionsUsed,r._extensions=e.extensions,r._gltfUpAxis=t,r._extras=e.extras;const n=i.extras;if(defined(n)&&defined(n.cesium)&&defined(n.cesium.credits)){const e=n.cesium.credits;let t=r._credits;defined(t)||(t=[],r._credits=t);for(let i=0;i<e.length;++i){const n=e[i];t.push(new Credit(n.html,r._showCreditsOnScreen))}}const a=r._root.createBoundingVolume(e.root.boundingVolume,Matrix4.IDENTITY).boundingSphere.center,s=r._ellipsoid.cartesianToCartographic(a);defined(s)&&s.height>ApproximateTerrainHeights._defaultMinTerrainHeight&&(r._initialClippingPlanesOriginMatrix=Transforms.eastNorthUpToFixedFrame(a)),r._clippingPlanesOriginMatrix=Matrix4.clone(r._initialClippingPlanesOriginMatrix),r._readyPromise.resolve(r)})).catch((function(e){r._readyPromise.reject(e)}))}function makeTile(e,t,i,n){if(defined(i.implicitTiling)||hasExtension(i,"3DTILES_implicit_tiling")){const r=new ImplicitTileset(t,i,e.schema),o=new ImplicitTileCoordinates({subdivisionScheme:r.subdivisionScheme,subtreeLevels:r.subtreeLevels,level:0,x:0,y:0,z:0}),a=r.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,s=clone$1(i,!0);s.contents=[{uri:a}],delete s.content,delete s.extensions;const c=new Cesium3DTile(e,t,s,n);return c.implicitTileset=r,c.implicitCoordinates=o,c}return new Cesium3DTile(e,t,i,n)}function processMetadataExtension(e,t){const i=hasExtension(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t;let n;if(defined(i.schemaUri)){const t=e._resource.getDerivedResource({url:i.schemaUri});n=ResourceCache.loadSchema({resource:t})}else{if(!defined(i.schema))return Promise.resolve(t);n=ResourceCache.loadSchema({schema:i.schema})}return e._schemaLoader=n,n.promise.then((function(n){return e._metadataExtension=new Cesium3DTilesetMetadata({schema:n.schema,metadataJson:i}),t}))}ImplicitTileCoordinates.fromMortonIndex=function(e,t,i,n){let r;return e===ImplicitSubdivisionScheme$1.OCTREE?(r=MortonOrder.decode3D(n,scratchCoordinatesArray),new ImplicitTileCoordinates({subdivisionScheme:e,subtreeLevels:t,level:i,x:r[0],y:r[1],z:r[2]})):(r=MortonOrder.decode2D(n,scratchCoordinatesArray),new ImplicitTileCoordinates({subdivisionScheme:e,subtreeLevels:t,level:i,x:r[0],y:r[1]}))},ImplicitTileCoordinates.fromTileIndex=function(e,t,i){let n,r,o;return e===ImplicitSubdivisionScheme$1.OCTREE?(n=Math.floor(CesiumMath.log2(7*i+1)/3),r=((1<<3*n)-1)/7,o=i-r):(n=Math.floor(CesiumMath.log2(3*i+1)/2),r=((1<<2*n)-1)/3,o=i-r),ImplicitTileCoordinates.fromMortonIndex(e,t,n,o)},Cesium3DTileset.prototype.isAvailable=function(e){var t=this._availability;return!defined(t)||t.contains(e)},Object.defineProperties(Cesium3DTileset.prototype,{availability:createRawPropertyDescriptor("availability"),definitionChanged:{get:function(){return this._definitionChanged}},isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){return this._asset}},extensions:{get:function(){return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},properties:{get:function(){return this._properties}},ready:{get:function(){return defined(this._root)}},readyPromise:{get:function(){return this._readyPromise.promise}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return deprecationWarning("Cesium3DTileset.basePath","Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."),this._basePath}},style:{get:function(){return this._styleEngine.style},set:function(e){this._styleEngine.style=e}},customShader:{get:function(){return this._customShader},set:function(e){this._customShader=e}},metadataExtension:{get:function(){return this._metadataExtension}},metadata:{get:function(){if(defined(this._metadataExtension))return this._metadataExtension.tileset}},schema:{get:function(){if(defined(this._metadataExtension))return this._metadataExtension.schema}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){this._maximumMemoryUsage=e}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){this._pointCloudShading=e}},root:{get:function(){return this._root}},boundingSphere:{get:function(){return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=Matrix4.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){const e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return defined(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(Matrix4.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):Matrix4.IDENTITY}},styleEngine:{get:function(){return this._styleEngine}},statistics:{get:function(){return this._statistics}},classificationType:{get:function(){return this._classificationType}},ellipsoid:{get:function(){return this._ellipsoid}},foveatedConeSize:{get:function(){return this._foveatedConeSize},set:function(e){this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},imageBasedLightingFactor:{get:function(){return this._imageBasedLighting.imageBasedLightingFactor},set:function(e){this._imageBasedLighting.imageBasedLightingFactor=e}},luminanceAtZenith:{get:function(){return this._imageBasedLighting.luminanceAtZenith},set:function(e){this._imageBasedLighting.luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._imageBasedLighting.sphericalHarmonicCoefficients},set:function(e){this._imageBasedLighting.sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._imageBasedLighting.specularEnvironmentMaps},set:function(e){this._imageBasedLighting.specularEnvironmentMaps=e}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}},vectorKeepDecodedPositions:{get:function(){return this._vectorKeepDecodedPositions}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){"number"==typeof e&&(e=`featureId_${e}`),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){"number"==typeof e&&(e=`instanceFeatureId_${e}`),this._instanceFeatureIdLabel=e}}}),Cesium3DTileset.loadJson=function(e){return Resource.createIfNeeded(e).fetchJson()},Cesium3DTileset.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()},Cesium3DTileset.prototype.loadTileset=function(e,t,i){const n=t.asset;if(!defined(n))throw new RuntimeError("Tileset must have an asset property.");if("0.0"!==n.version&&"1.0"!==n.version&&"1.1"!==n.version)throw new RuntimeError("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");defined(t.extensionsRequired)&&Cesium3DTileset.checkSupportedExtensions(t.extensionsRequired);const r=this._statistics,o=n.tilesetVersion;defined(o)&&(this._basePath+=`?v=${o}`,(e=e.clone()).setQueryParameters({v:o}));const a=makeTile(this,e,t.root,i);defined(i)&&(i.children.push(a),a._depth=i._depth+1);const s=[];for(s.push(a);s.length>0;){const t=s.pop();++r.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&t.refine===Cesium3DTileRefine$1.ADD;const i=t._header.children;if(defined(i)){const n=i.length;for(let r=0;r<n;++r){const n=makeTile(this,e,i[r],t);t.children.push(n),n._depth=t._depth+1,s.push(n)}}this._cullWithChildrenBounds&&Cesium3DTileOptimizations.checkChildrenWithinParent(t)}return a};const scratchPositionNormal$2=new Cartesian3,scratchCartographic$a=new Cartographic,scratchMatrix$1=new Matrix4,scratchCenter$3=new Cartesian3,scratchPosition$3=new Cartesian3,scratchDirection$1=new Cartesian3;function updateDynamicScreenSpaceError(e,t){let i,n,r,o,a;const s=t.camera,c=e._root,l=c.contentBoundingVolume;if(l instanceof TileBoundingRegion)i=Cartesian3.normalize(s.positionWC,scratchPositionNormal$2),n=s.directionWC,r=s.positionCartographic.height,o=l.minimumHeight,a=l.maximumHeight;else{const e=Matrix4.inverseTransformation(c.computedTransform,scratchMatrix$1),u=t.mapProjection.ellipsoid,d=l.boundingVolume,h=Matrix4.multiplyByPoint(e,d.center,scratchCenter$3);if(Cartesian3.magnitude(h)>u.minimumRadius){const e=Cartographic.fromCartesian(h,u,scratchCartographic$a);i=Cartesian3.normalize(s.positionWC,scratchPositionNormal$2),n=s.directionWC,r=s.positionCartographic.height,o=0,a=2*e.height}else{const t=Matrix4.multiplyByPoint(e,s.positionWC,scratchPosition$3);if(i=Cartesian3.UNIT_Z,n=Matrix4.multiplyByPointAsVector(e,s.directionWC,scratchDirection$1),n=Cartesian3.normalize(n,n),r=t.z,l instanceof TileOrientedBoundingBox){const e=c._header.boundingVolume.box[11];o=h.z-e,a=h.z+e}else if(l instanceof TileBoundingSphere){const e=d.radius;o=h.z-e,a=h.z+e}}}const u=o+(a-o)*e.dynamicScreenSpaceErrorHeightFalloff,d=a,h=CesiumMath.clamp((r-u)/(d-u),0,1);let p=1-Math.abs(Cartesian3.dot(n,i));p*=1-h;let f=e.dynamicScreenSpaceErrorDensity;f*=p,e._dynamicScreenSpaceErrorComputedDensity=f}function requestContent(e,t){if(t.hasEmptyContent)return;const i=e._statistics,n=t.contentExpired,r=t.requestContent();r>0?i.numberOfAttemptedRequests+=r:(n&&(t.hasTilesetContent||t.hasImplicitContent?destroySubtree(e,t):(i.decrementLoadCounts(t.content),--i.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(addToProcessingQueue(e,t)),t.contentReadyPromise.then(handleTileSuccess(e,t)).catch(handleTileFailure(e,t)))}function sortRequestByPriority(e,t){return e._priority-t._priority}function cancelOutOfViewRequests(e,t){const i=e._requestedTilesInFlight;let n=0;const r=i.length;for(let e=0;e<r;++e){const r=i[e],o=t.frameNumber-r._touchedFrame>=1;r._contentState===Cesium3DTileContentState$1.LOADING?o?(r.cancelRequests(),++n):n>0&&(i[e-n]=r):++n}i.length-=n}function requestTiles(e,t){const i=e._requestedTiles,n=i.length;i.sort(sortRequestByPriority);for(let t=0;t<n;++t)requestContent(e,i[t])}function addToProcessingQueue(e,t){return function(){e._processingQueue.push(t),++e._statistics.numberOfTilesProcessing}}function handleTileFailure(e,t){return function(i){const n=t._contentResource.url,r=defined(i.message)?i.message:i.toString();e.tileFailed.numberOfListeners>0?e.tileFailed.raiseEvent({url:n,message:r}):(console.log(`A 3D tile failed to load: ${n}`),console.log(`Error: ${r}`))}}function handleTileSuccess(e,t){return function(){--e._statistics.numberOfTilesProcessing,t.hasTilesetContent||t.hasImplicitContent||(e._statistics.incrementLoadCounts(t.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(t)),e.tileLoad.raiseEvent(t)}}function filterProcessingQueue(e){const t=e._processingQueue,i=t.length;let n=0;for(let e=0;e<i;++e){const i=t[e];i._contentState===Cesium3DTileContentState$1.PROCESSING?n>0&&(t[e-n]=i):++n}t.length-=n}function processTiles(e,t){filterProcessingQueue(e);const i=e._processingQueue,n=i.length;for(let r=0;r<n;++r)i[r].process(e,t)}Cesium3DTileset.prototype.postPassesUpdate=function(e){this.ready&&(cancelOutOfViewRequests(this,e),raiseLoadProgressEvent(this,e),this._cache.unloadTiles(this,unloadTile),this._styleEngine.resetDirty())},Cesium3DTileset.prototype.prePassesUpdate=function(e){if(!this.ready)return;processTiles(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,defined(t)&&t.enabled&&t.update(e),defined(this._loadTimestamp)||(this._loadTimestamp=JulianDate.clone(e.time)),this._timeSinceLoad=Math.max(1e3*JulianDate.secondsDifference(e.time,this._loadTimestamp),0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!defined(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&updateDynamicScreenSpaceError(this,e),e.newFrame&&this._cache.reset()};const scratchCartesian$4=new Cartesian3,stringOptions$1={maximumFractionDigits:3};function formatMemoryString$1(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,stringOptions$1):Math.round(t).toLocaleString()}function computeTileLabelPosition(e){const t=e.boundingVolume.boundingVolume,i=t.halfAxes,n=t.radius;let r=Cartesian3.clone(t.center,scratchCartesian$4);if(defined(i))r.x+=.75*(i[0]+i[3]+i[6]),r.y+=.75*(i[1]+i[4]+i[7]),r.z+=.75*(i[2]+i[5]+i[8]);else if(defined(n)){let e=Cartesian3.normalize(t.center,scratchCartesian$4);e=Cartesian3.multiplyByScalar(e,.75*n,scratchCartesian$4),r=Cartesian3.add(e,t.center,scratchCartesian$4)}return r}function addTileDebugLabel(e,t,i){let n="",r=0;if(t.debugShowGeometricError&&(n+=`\nGeometric error: ${e.geometricError}`,r++),t.debugShowRenderingStatistics){n+=`\nCommands: ${e.commandsLength}`,r++;e.content.pointsLength>0&&(n+=`\nPoints: ${e.content.pointsLength}`,r++);e.content.trianglesLength>0&&(n+=`\nTriangles: ${e.content.trianglesLength}`,r++),n+=`\nFeatures: ${e.content.featuresLength}`,r++}if(t.debugShowMemoryUsage&&(n+=`\nTexture Memory: ${formatMemoryString$1(e.content.texturesByteLength)}`,n+=`\nGeometry Memory: ${formatMemoryString$1(e.content.geometryByteLength)}`,r+=2),t.debugShowUrl)if(e.hasMultipleContents){n+="\nUrls:";const t=e.content.innerContentUrls;for(let e=0;e<t.length;e++)n+=`\n- ${t[e]}`;r+=t.length}else n+=`\nUrl: ${e._header.content.uri}`,r++;const o={text:n.substring(1),position:i,font:19-r+"px sans-serif",showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(o)}function updateTileDebugLabels(e,t){let i,n;const r=e._selectedTiles,o=r.length,a=e._emptyTiles,s=a.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(defined(e.debugPickedTile)){const t=defined(e.debugPickPosition)?e.debugPickPosition:computeTileLabelPosition(e.debugPickedTile);addTileDebugLabel(e.debugPickedTile,e,t).pixelOffset=new Cartesian2(15,-15)}}else{for(i=0;i<o;++i)n=r[i],addTileDebugLabel(n,e,computeTileLabelPosition(n));for(i=0;i<s;++i)n=a[i],(n.hasTilesetContent||n.hasImplicitContent)&&addTileDebugLabel(n,e,computeTileLabelPosition(n))}e._tileDebugLabels.update(t)}function updateTiles(e,t,i){e._styleEngine.applyStyle(e);const n=i.isRender,r=e._statistics,o=t.commandList,a=o.length,s=e._selectedTiles,c=s.length,l=e._emptyTiles,u=l.length,d=e.tileVisible;let h,p;const f=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&c>0;e._backfaceCommands.length=0,f&&(defined(e._stencilClearCommand)||(e._stencilClearCommand=new ClearCommand({stencil:0,pass:Pass$1.CESIUM_3D_TILE,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.SKIP_LOD_MASK})})),o.push(e._stencilClearCommand));const m=o.length;for(h=0;h<c;++h)p=s[h],n&&d.raiseEvent(p),p.update(e,t,i),r.incrementSelectionCounts(p.content),++r.selected;for(h=0;h<u;++h)p=l[h],p.update(e,t,i);let g=o.length-m;if(e._backfaceCommands.trim(),f){const t=e._backfaceCommands.values,i=t.length;for(o.length+=i,h=g-1;h>=0;--h)o[m+i+h]=o[m+h];for(h=0;h<i;++h)o[m+h]=t[h]}g=o.length-a,r.numberOfCommands=g,n&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&g>0&&e._pointCloudEyeDomeLighting.update(t,a,e.pointCloudShading,e.boundingSphere),n&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(defined(e._tileDebugLabels)||(e._tileDebugLabels=new LabelCollection),updateTileDebugLabels(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const scratchStack=[];function destroySubtree(e,t){const i=t,n=scratchStack;for(n.push(t);n.length>0;){const r=(t=n.pop()).children,o=r.length;for(let e=0;e<o;++e)n.push(r[e]);t!==i&&(destroyTile(e,t),--e._statistics.numberOfTilesTotal)}i.children=[]}function unloadTile(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function destroyTile(e,t){e._cache.unloadTile(e,t,unloadTile),t.destroy()}function raiseLoadProgressEvent(e,t){const i=e._statistics,n=e._statisticsLast,r=i.numberOfPendingRequests,o=i.numberOfTilesProcessing,a=n.numberOfPendingRequests,s=n.numberOfTilesProcessing;Cesium3DTilesetStatistics.clone(i,n);const c=r!==a||o!==s;c&&t.afterRender.push((function(){e.loadProgress.raiseEvent(r,o)})),e._tilesLoaded=0===i.numberOfPendingRequests&&0===i.numberOfTilesProcessing&&0===i.numberOfAttemptedRequests,c&&e._tilesLoaded&&(t.afterRender.push((function(){e.allTilesLoaded.raiseEvent()})),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push((function(){e.initialTilesLoaded.raiseEvent()}))))}function resetMinimumMaximum(e){e._heatmap.resetMinimumMaximum(),e._minimumPriority.depth=Number.MAX_VALUE,e._maximumPriority.depth=-Number.MAX_VALUE,e._minimumPriority.foveatedFactor=Number.MAX_VALUE,e._maximumPriority.foveatedFactor=-Number.MAX_VALUE,e._minimumPriority.distance=Number.MAX_VALUE,e._maximumPriority.distance=-Number.MAX_VALUE,e._minimumPriority.reverseScreenSpaceError=Number.MAX_VALUE,e._maximumPriority.reverseScreenSpaceError=-Number.MAX_VALUE}function detectModelMatrixChanged(e,t){t.frameNumber===e._updatedModelMatrixFrame&&defined(e._previousModelMatrix)||(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!Matrix4.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=Matrix4.clone(e.modelMatrix,e._previousModelMatrix)))}function update$1(e,t,i,n){if(t.mode===SceneMode$1.MORPHING)return!1;if(!e.ready)return!1;const r=e._statistics;r.clear();const o=n.isRender;++e._updatedVisibilityFrame,resetMinimumMaximum(e),detectModelMatrixChanged(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;const a=n.traversal.selectTiles(e,t);if(n.requestTiles&&requestTiles(e),updateTiles(e,t,n),Cesium3DTilesetStatistics.clone(r,i),o){const i=e._credits;if(defined(i)&&0!==r.selected){const n=i.length;for(let r=0;r<n;++r){const n=i[r];n.showOnScreen=e._showCreditsOnScreen,t.creditDisplay.addCredit(n)}}}return a}Cesium3DTileset.prototype.trimLoadedTiles=function(){this._cache.trim()},Cesium3DTileset.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)},Cesium3DTileset.prototype.updateForPass=function(e,t){const i=t.pass;if(i===Cesium3DTilePass$1.PRELOAD&&(!this.preloadWhenHidden||this.show)||i===Cesium3DTilePass$1.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||i===Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;const n=e.commandList,r=e.camera,o=e.cullingVolume;t.ready=!1;const a=Cesium3DTilePass$1.getPassOptions(i),s=a.ignoreCommands,c=defaultValue(t.commandList,n),l=c.length;e.commandList=c,e.camera=defaultValue(t.camera,r),e.cullingVolume=defaultValue(t.cullingVolume,o);const u=this._statisticsPerPass[i];(this.show||s)&&(this._pass=i,t.ready=update$1(this,e,u,a)),s&&(c.length=l),e.commandList=n,e.camera=r,e.cullingVolume=o},Cesium3DTileset.prototype.hasExtension=function(e){return!!defined(this._extensionsUsed)&&this._extensionsUsed.indexOf(e)>-1},Cesium3DTileset.prototype.isDestroyed=function(){return!1},Cesium3DTileset.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),defined(this._schemaLoader)&&ResourceCache.unload(this._schemaLoader),defined(this._root)){const e=scratchStack;for(e.push(this._root);e.length>0;){const t=e.pop();t.destroy();const i=t.children,n=i.length;for(let t=0;t<n;++t)e.push(i[t])}}return this._root=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,destroyObject(this)},Cesium3DTileset.supportedExtensions={"3DTILES_metadata":!0,"3DTILES_implicit_tiling":!0,"3DTILES_content_gltf":!0,"3DTILES_multiple_contents":!0,"3DTILES_bounding_volume_S2":!0,"3DTILES_batch_table_hierarchy":!0,"3DTILES_draco_point_compression":!0},Cesium3DTileset.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!Cesium3DTileset.supportedExtensions[e[t]])throw new RuntimeError(`Unsupported 3D Tiles Extension: ${e[t]}`)};const modelMatrixScratch$1=new Matrix4;function Cesium3DTilesetVisualizer(e,t){t.collectionChanged.addEventListener(Cesium3DTilesetVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function removeTileset(e,t,i,n){const r=i[t.id];defined(r)&&(n.removeAndDestroy(r.tilesetPrimitive),delete i[t.id])}function checkLoad(e,t,i){e.readyPromise.catch((function(e){console.error(e),i[t.id].loadFail=!0}))}Cesium3DTilesetVisualizer.prototype.update=function(e){const t=this._entitiesToVisualize.values,i=this._tilesetHash,n=this._primitives;for(let r=0,o=t.length;r<o;r++){const o=t[r],a=o._tileset;let s,c=i[o.id];const l=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);let u;if(l&&(u=o.computeModelMatrix(e,modelMatrixScratch$1),s=Resource.createIfNeeded(Property.getValueOrUndefined(a._uri,e))),!l){defined(c)&&(c.tilesetPrimitive.show=!1);continue}let d=defined(c)?c.tilesetPrimitive:void 0;defined(d)&&s.url===c.url||(defined(d)&&(n.removeAndDestroy(d),delete i[o.id]),d=new Cesium3DTileset({url:s}),d.id=o,n.add(d),c={tilesetPrimitive:d,url:s.url,loadFail:!1},i[o.id]=c,checkLoad(d,o,i)),d.show=!0,defined(u)&&(d.modelMatrix=u),d.maximumScreenSpaceError=Property.getValueOrDefault(a.maximumScreenSpaceError,e,d.maximumScreenSpaceError)}return!0},Cesium3DTilesetVisualizer.prototype.isDestroyed=function(){return!1},Cesium3DTilesetVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Cesium3DTilesetVisualizer.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._tilesetHash,i=this._primitives;for(let n=e.length-1;n>-1;n--)removeTileset(this,e[n],t,i);return destroyObject(this)},Cesium3DTilesetVisualizer.prototype.getBoundingSphere=function(e,t){const i=this._tilesetHash[e.id];if(!defined(i)||i.loadFail)return BoundingSphereState$1.FAILED;const n=i.tilesetPrimitive;return defined(n)&&n.show?n.ready?(BoundingSphere.clone(n.boundingSphere,t),BoundingSphereState$1.DONE):BoundingSphereState$1.PENDING:BoundingSphereState$1.FAILED},Cesium3DTilesetVisualizer.prototype._onCollectionChanged=function(e,t,i,n){let r,o;const a=this._entitiesToVisualize,s=this._tilesetHash,c=this._primitives;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._tileset)&&a.set(o.id,o);for(r=n.length-1;r>-1;r--)o=n[r],defined(o._tileset)?a.set(o.id,o):(removeTileset(this,o,s,c),a.remove(o.id));for(r=i.length-1;r>-1;r--)o=i[r],removeTileset(this,o,s,c),a.remove(o.id)};const defaultEvenColor$1=Color.WHITE,defaultOddColor$1=Color.BLACK,defaultRepeat$1=new Cartesian2(2,2);function CheckerboardMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.repeat=e.repeat}Object.defineProperties(CheckerboardMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),repeat:createPropertyDescriptor("repeat")}),CheckerboardMaterialProperty.prototype.getType=function(e){return"Checkerboard"},CheckerboardMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.lightColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor$1,t.lightColor),t.darkColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor$1,t.darkColor),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat$1),t},CheckerboardMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CheckerboardMaterialProperty&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._repeat,e._repeat)};const entityOptionsScratch$1={id:void 0};function fireChangedEvent(e){if(e._firing)e._refire=!0;else if(0===e._suspendCount){const t=e._addedEntities,i=e._removedEntities,n=e._changedEntities;if(0!==n.length||0!==t.length||0!==i.length){e._firing=!0;do{e._refire=!1;const r=t.values.slice(0),o=i.values.slice(0),a=n.values.slice(0);t.removeAll(),i.removeAll(),n.removeAll(),e._collectionChanged.raiseEvent(e,r,o,a)}while(e._refire);e._firing=!1}}}function EntityCollection(e){this._owner=e,this._entities=new AssociativeArray,this._addedEntities=new AssociativeArray,this._removedEntities=new AssociativeArray,this._changedEntities=new AssociativeArray,this._suspendCount=0,this._collectionChanged=new Event,this._id=createGuid(),this._show=!0,this._firing=!1,this._refire=!1}EntityCollection.prototype.suspendEvents=function(){this._suspendCount++},EntityCollection.prototype.resumeEvents=function(){this._suspendCount--,fireChangedEvent(this)},EntityCollection.collectionChangedEventCallback=void 0,Object.defineProperties(EntityCollection.prototype,{collectionChanged:{get:function(){return this._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._entities.values}},show:{get:function(){return this._show},set:function(e){if(e===this._show)return;let t;this.suspendEvents();const i=[],n=this._entities.values,r=n.length;for(t=0;t<r;t++)i.push(n[t].isShowing);for(this._show=e,t=0;t<r;t++){const e=i[t],r=n[t];e!==r.isShowing&&r.definitionChanged.raiseEvent(r,"isShowing",r.isShowing,e)}this.resumeEvents()}},owner:{get:function(){return this._owner}}}),EntityCollection.prototype.computeAvailability=function(){let e=Iso8601.MAXIMUM_VALUE,t=Iso8601.MINIMUM_VALUE;const i=this._entities.values;for(let n=0,r=i.length;n<r;n++){const r=i[n].availability;if(defined(r)){const i=r.start,n=r.stop;JulianDate.lessThan(i,e)&&!i.equals(Iso8601.MINIMUM_VALUE)&&(e=i),JulianDate.greaterThan(n,t)&&!n.equals(Iso8601.MAXIMUM_VALUE)&&(t=n)}}return Iso8601.MAXIMUM_VALUE.equals(e)&&(e=Iso8601.MINIMUM_VALUE),Iso8601.MINIMUM_VALUE.equals(t)&&(t=Iso8601.MAXIMUM_VALUE),new TimeInterval({start:e,stop:t})},EntityCollection.prototype.add=function(e){e instanceof Entity||(e=new Entity(e));const t=e.id,i=this._entities;if(i.contains(t))throw new RuntimeError(`An entity with id ${t} already exists in this collection.`);return e.entityCollection=this,i.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),e},EntityCollection.prototype.remove=function(e){return!!defined(e)&&this.removeById(e.id)},EntityCollection.prototype.contains=function(e){return this._entities.get(e.id)===e},EntityCollection.prototype.removeById=function(e){if(!defined(e))return!1;const t=this._entities.get(e);return!!this._entities.remove(e)&&(this._addedEntities.remove(e)||(this._removedEntities.set(e,t),this._changedEntities.remove(e)),this._entities.remove(e),t.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),!0)},EntityCollection.prototype.removeAll=function(){const e=this._entities,t=e.length,i=e.values,n=this._addedEntities,r=this._removedEntities;for(let e=0;e<t;e++){const t=i[e],o=t.id;defined(n.get(o))||(t.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),r.set(o,t))}e.removeAll(),n.removeAll(),this._changedEntities.removeAll(),fireChangedEvent(this)},EntityCollection.prototype.getById=function(e){return this._entities.get(e)},EntityCollection.prototype.getOrCreateEntity=function(e){let t=this._entities.get(e);return defined(t)||(entityOptionsScratch$1.id=e,t=new Entity(entityOptionsScratch$1),this.add(t)),t},EntityCollection.prototype._onEntityDefinitionChanged=function(e){const t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),fireChangedEvent(this)};const entityOptionsScratch={id:void 0},entityIdScratch=new Array(2);function clean(e){const t=e.propertyNames,i=t.length;for(let n=0;n<i;n++)e[t[n]]=void 0;e._name=void 0,e._availability=void 0}function subscribeToEntity(e,t,i,n){entityIdScratch[0]=i,entityIdScratch[1]=n.id,t[JSON.stringify(entityIdScratch)]=n.definitionChanged.addEventListener(CompositeEntityCollection.prototype._onDefinitionChanged,e)}function unsubscribeFromEntity(e,t,i,n){entityIdScratch[0]=i,entityIdScratch[1]=n.id;const r=JSON.stringify(entityIdScratch);t[r](),t[r]=void 0}function recomposite(e){if(e._shouldRecomposite=!0,0!==e._suspendCount)return;const t=e._collections,i=t.length,n=e._collectionsCopy,r=n.length;let o,a,s,c,l;const u=e._composite,d=new EntityCollection(e),h=e._eventHash;let p;for(o=0;o<r;o++)for(l=n[o],l.collectionChanged.removeEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),s=l.values,p=l.id,c=s.length-1;c>-1;c--)a=s[c],unsubscribeFromEntity(e,h,p,a);for(o=i-1;o>=0;o--)for(l=t[o],l.collectionChanged.addEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),s=l.values,p=l.id,c=s.length-1;c>-1;c--){a=s[c],subscribeToEntity(e,h,p,a);let t=d.getById(a.id);defined(t)||(t=u.getById(a.id),defined(t)?clean(t):(entityOptionsScratch.id=a.id,t=new Entity(entityOptionsScratch)),d.add(t)),t.merge(a)}e._collectionsCopy=t.slice(0),u.suspendEvents(),u.removeAll();const f=d.values;for(o=0;o<f.length;o++)u.add(f[o]);u.resumeEvents()}function CompositeEntityCollection(e,t){this._owner=t,this._composite=new EntityCollection(this),this._suspendCount=0,this._collections=defined(e)?e.slice():[],this._collectionsCopy=[],this._id=createGuid(),this._eventHash={},recomposite(this),this._shouldRecomposite=!1}function getCollectionIndex(e,t){return e.indexOf(t)}function swapCollections(e,t,i){const n=e._collections;if((t=CesiumMath.clamp(t,0,n.length-1))===(i=CesiumMath.clamp(i,0,n.length-1)))return;const r=n[t];n[t]=n[i],n[i]=r,recomposite(e)}function subscribeAll(e,t,i,n){function r(){i.raiseEvent(e)}const o=[];t.removeAll();const a=n.length;for(let e=0;e<a;e++){const i=n.get(e);defined(i.data)&&-1===o.indexOf(i.data)&&t.add(i.data.definitionChanged,r)}}function CompositeProperty(){this._eventHelper=new EventHelper,this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(CompositeProperty.prototype._intervalsChanged,this)}function CompositeMaterialProperty(){this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositeMaterialProperty.prototype._raiseDefinitionChanged,this)}function CompositePositionProperty(e){this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositePositionProperty.prototype._raiseDefinitionChanged,this)}Object.defineProperties(CompositeEntityCollection.prototype,{collectionChanged:{get:function(){return this._composite._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._composite.values}},owner:{get:function(){return this._owner}}}),CompositeEntityCollection.prototype.addCollection=function(e,t){defined(t)?this._collections.splice(t,0,e):(t=this._collections.length,this._collections.push(e)),recomposite(this)},CompositeEntityCollection.prototype.removeCollection=function(e){const t=this._collections.indexOf(e);return-1!==t&&(this._collections.splice(t,1),recomposite(this),!0)},CompositeEntityCollection.prototype.removeAllCollections=function(){this._collections.length=0,recomposite(this)},CompositeEntityCollection.prototype.containsCollection=function(e){return-1!==this._collections.indexOf(e)},CompositeEntityCollection.prototype.contains=function(e){return this._composite.contains(e)},CompositeEntityCollection.prototype.indexOfCollection=function(e){return this._collections.indexOf(e)},CompositeEntityCollection.prototype.getCollection=function(e){return this._collections[e]},CompositeEntityCollection.prototype.getCollectionsLength=function(){return this._collections.length},CompositeEntityCollection.prototype.raiseCollection=function(e){const t=getCollectionIndex(this._collections,e);swapCollections(this,t,t+1)},CompositeEntityCollection.prototype.lowerCollection=function(e){const t=getCollectionIndex(this._collections,e);swapCollections(this,t,t-1)},CompositeEntityCollection.prototype.raiseCollectionToTop=function(e){const t=getCollectionIndex(this._collections,e);t!==this._collections.length-1&&(this._collections.splice(t,1),this._collections.push(e),recomposite(this))},CompositeEntityCollection.prototype.lowerCollectionToBottom=function(e){const t=getCollectionIndex(this._collections,e);0!==t&&(this._collections.splice(t,1),this._collections.splice(0,0,e),recomposite(this))},CompositeEntityCollection.prototype.suspendEvents=function(){this._suspendCount++,this._composite.suspendEvents()},CompositeEntityCollection.prototype.resumeEvents=function(){this._suspendCount--,this._shouldRecomposite&&0===this._suspendCount&&(recomposite(this),this._shouldRecomposite=!1),this._composite.resumeEvents()},CompositeEntityCollection.prototype.computeAvailability=function(){return this._composite.computeAvailability()},CompositeEntityCollection.prototype.getById=function(e){return this._composite.getById(e)},CompositeEntityCollection.prototype._onCollectionChanged=function(e,t,i){const n=this._collectionsCopy,r=n.length,o=this._composite;let a,s,c,l;o.suspendEvents();const u=i.length,d=this._eventHash,h=e.id;for(a=0;a<u;a++){const e=i[a];unsubscribeFromEntity(this,d,h,e);const t=e.id;for(s=r-1;s>=0;s--)c=n[s].getById(t),defined(c)&&(defined(l)||(l=o.getById(t),clean(l)),l.merge(c));defined(l)||o.removeById(t),l=void 0}const p=t.length;for(a=0;a<p;a++){const e=t[a];subscribeToEntity(this,d,h,e);const i=e.id;for(s=r-1;s>=0;s--)c=n[s].getById(i),defined(c)&&(defined(l)||(l=o.getById(i),defined(l)?clean(l):(entityOptionsScratch.id=i,l=new Entity(entityOptionsScratch),o.add(l))),l.merge(c));l=void 0}o.resumeEvents()},CompositeEntityCollection.prototype._onDefinitionChanged=function(e,t,i,n){const r=this._collections,o=this._composite,a=r.length,s=e.id,c=o.getById(s);let l=c[t];const u=!defined(l);let d=!0;for(let i=a-1;i>=0;i--){const n=r[i].getById(e.id);if(defined(n)){const e=n[t];if(defined(e)){if(d){if(d=!1,!defined(e.merge)||!defined(e.clone)){l=e;break}l=e.clone(l)}l.merge(e)}}}u&&-1===c.propertyNames.indexOf(t)&&c.addProperty(t),c[t]=l},Object.defineProperties(CompositeProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),CompositeProperty.prototype.getValue=function(e,t){const i=this._intervals.findDataForIntervalContainingDate(e);if(defined(i))return i.getValue(e,t)},CompositeProperty.prototype.equals=function(e){return this===e||e instanceof CompositeProperty&&this._intervals.equals(e._intervals,Property.equals)},CompositeProperty.prototype._intervalsChanged=function(){subscribeAll(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)},Object.defineProperties(CompositeMaterialProperty.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite._intervals}}}),CompositeMaterialProperty.prototype.getType=function(e){const t=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(t))return t.getType(e)},CompositeMaterialProperty.prototype.getValue=function(e,t){const i=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(i))return i.getValue(e,t)},CompositeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CompositeMaterialProperty&&this._composite.equals(e._composite,Property.equals)},CompositeMaterialProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(CompositePositionProperty.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite.intervals}},referenceFrame:{get:function(){return this._referenceFrame},set:function(e){this._referenceFrame=e}}}),CompositePositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},CompositePositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){const n=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(n))return n.getValueInReferenceFrame(e,t,i)},CompositePositionProperty.prototype.equals=function(e){return this===e||e instanceof CompositePositionProperty&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Property.equals)},CompositePositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const defaultZIndex$1=new ConstantProperty(0);function GroundGeometryUpdater(e){GeometryUpdater.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}defined(Object.create)&&(GroundGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),GroundGeometryUpdater.prototype.constructor=GroundGeometryUpdater),Object.defineProperties(GroundGeometryUpdater.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),GroundGeometryUpdater.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!defined(t.height)&&!defined(t.extrudedHeight)&&GroundPrimitive.isSupported(this._scene)},GroundGeometryUpdater.prototype._getIsClosed=function(e){const t=e.height,i=e.extrudedHeight;return 0===t||defined(i)&&i!==t},GroundGeometryUpdater.prototype._computeCenter=DeveloperError.throwInstantiationError,GroundGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,n){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,i,n),-1===this._observedPropertyNames.indexOf(t))return;const r=this._entity[this._geometryPropertyName];if(!defined(r))return;defined(r.zIndex)&&(defined(r.height)||defined(r.extrudedHeight))&&oneTimeWarning(oneTimeWarning.geometryZIndex),this._zIndex=defaultValue(r.zIndex,defaultZIndex$1),defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const o=r.heightReference,a=r.extrudedHeightReference;if(defined(o)||defined(a)){const e=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,e,o,a)}},GroundGeometryUpdater.prototype.destroy=function(){defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),GeometryUpdater.prototype.destroy.call(this)},GroundGeometryUpdater.getGeometryHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:0;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryHeightReference)},GroundGeometryUpdater.getGeometryExtrudedHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:GroundGeometryUpdater.CLAMP_TO_GROUND;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryExtrudedHeightReference)},GroundGeometryUpdater.CLAMP_TO_GROUND="clamp",GroundGeometryUpdater.computeGeometryOffsetAttribute=function(e,t,i,n){defined(e)&&defined(t)||(t=HeightReference$1.NONE),defined(i)&&defined(n)||(n=HeightReference$1.NONE);let r=0;return t!==HeightReference$1.NONE&&r++,n===HeightReference$1.RELATIVE_TO_GROUND&&r++,2===r?GeometryOffsetAttribute$1.ALL:1===r?GeometryOffsetAttribute$1.TOP:void 0};const scratchColor$d=new Color,defaultOffset$9=Cartesian3.ZERO,offsetScratch$8=new Cartesian3,scratchRectangle$4=new Rectangle;function CorridorGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.cornerType=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.offsetAttribute=void 0}function CorridorGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CorridorGeometryOptions(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}function DynamicCorridorGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}function DataSource(){DeveloperError.throwInstantiationError()}function PointPrimitive(e,t){let i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,n=e.scaleByDistance,r=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(n)&&(n=NearFarScalar.clone(n)),defined(r)&&(r=DistanceDisplayCondition.clone(r)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.TRANSPARENT)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._pixelSize=defaultValue(e.pixelSize,10),this._scaleByDistance=n,this._translucencyByDistance=i,this._distanceDisplayCondition=r,this._disableDepthTestDistance=defaultValue(e.disableDepthTestDistance,0),this._id=e.id,this._collection=defaultValue(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}defined(Object.create)&&(CorridorGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),CorridorGeometryUpdater.prototype.constructor=CorridorGeometryUpdater),CorridorGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$d)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$9,offsetScratch$8))),new GeometryInstance({id:t,geometry:new CorridorGeometry(this._options),attributes:n})},CorridorGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$d),r={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return defined(this._options.offsetAttribute)&&(r.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$9,offsetScratch$8))),new GeometryInstance({id:t,geometry:new CorridorOutlineGeometry(this._options),attributes:r})},CorridorGeometryUpdater.prototype._computeCenter=function(e,t){const i=Property.getValueOrUndefined(this._entity.corridor.positions,e);if(defined(i)&&0!==i.length)return Cartesian3.clone(i[Math.floor(i.length/2)],t)},CorridorGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.width)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CorridorGeometryUpdater.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.width)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.cornerType)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},CorridorGeometryUpdater.prototype._setStaticOptions=function(e,t){let i=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const n=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let r=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const o=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(r)&&!defined(i)&&(i=0);const a=this._options;a.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,a.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,a.positions),a.width=t.width.getValue(Iso8601.MINIMUM_VALUE),a.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),a.cornerType=Property.getValueOrUndefined(t.cornerType,Iso8601.MINIMUM_VALUE),a.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(i,n,r,o),a.height=GroundGeometryUpdater.getGeometryHeight(i,n),r=GroundGeometryUpdater.getGeometryExtrudedHeight(r,o),r===GroundGeometryUpdater.CLAMP_TO_GROUND&&(r=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(a,scratchRectangle$4)).minimumTerrainHeight),a.extrudedHeight=r},CorridorGeometryUpdater.DynamicGeometryUpdater=DynamicCorridorGeometryUpdater,defined(Object.create)&&(DynamicCorridorGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicCorridorGeometryUpdater.prototype.constructor=DynamicCorridorGeometryUpdater),DynamicCorridorGeometryUpdater.prototype._isHidden=function(e,t,i){const n=this._options;return!defined(n.positions)||!defined(n.width)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicCorridorGeometryUpdater.prototype._setOptions=function(e,t,i){const n=this._options;let r=Property.getValueOrUndefined(t.height,i);const o=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE);let a=Property.getValueOrUndefined(t.extrudedHeight,i);const s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0),n.positions=Property.getValueOrUndefined(t.positions,i),n.width=Property.getValueOrUndefined(t.width,i),n.granularity=Property.getValueOrUndefined(t.granularity,i),n.cornerType=Property.getValueOrUndefined(t.cornerType,i),n.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,a,s),n.height=GroundGeometryUpdater.getGeometryHeight(r,o),a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,s),a===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(n,scratchRectangle$4)).minimumTerrainHeight),n.extrudedHeight=a},Object.defineProperties(DataSource.prototype,{name:{get:DeveloperError.throwInstantiationError},clock:{get:DeveloperError.throwInstantiationError},entities:{get:DeveloperError.throwInstantiationError},isLoading:{get:DeveloperError.throwInstantiationError},changedEvent:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},loadingEvent:{get:DeveloperError.throwInstantiationError},show:{get:DeveloperError.throwInstantiationError},clustering:{get:DeveloperError.throwInstantiationError}}),DataSource.prototype.update=function(e){DeveloperError.throwInstantiationError()},DataSource.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};const SHOW_INDEX$3=PointPrimitive.SHOW_INDEX=0,POSITION_INDEX$3=PointPrimitive.POSITION_INDEX=1,COLOR_INDEX$3=PointPrimitive.COLOR_INDEX=2,OUTLINE_COLOR_INDEX$1=PointPrimitive.OUTLINE_COLOR_INDEX=3,OUTLINE_WIDTH_INDEX$1=PointPrimitive.OUTLINE_WIDTH_INDEX=4,PIXEL_SIZE_INDEX$1=PointPrimitive.PIXEL_SIZE_INDEX=5,SCALE_BY_DISTANCE_INDEX$1=PointPrimitive.SCALE_BY_DISTANCE_INDEX=6,TRANSLUCENCY_BY_DISTANCE_INDEX$1=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX=7,DISTANCE_DISPLAY_CONDITION_INDEX$1=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX=8,DISABLE_DEPTH_DISTANCE_INDEX$1=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX=9;function makeDirty$1(e,t){const i=e._pointPrimitiveCollection;defined(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}PointPrimitive.NUMBER_OF_PROPERTIES=10,Object.defineProperties(PointPrimitive.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty$1(this,SHOW_INDEX$3))}},position:{get:function(){return this._position},set:function(e){const t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$3))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){const t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,SCALE_BY_DISTANCE_INDEX$1))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){const t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,TRANSLUCENCY_BY_DISTANCE_INDEX$1))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,makeDirty$1(this,PIXEL_SIZE_INDEX$1))}},color:{get:function(){return this._color},set:function(e){const t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,COLOR_INDEX$3))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){const t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,OUTLINE_COLOR_INDEX$1))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty$1(this,OUTLINE_WIDTH_INDEX$1))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$1(this,DISTANCE_DISPLAY_CONDITION_INDEX$1))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty$1(this,DISABLE_DEPTH_DISTANCE_INDEX$1))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,makeDirty$1(this,SHOW_INDEX$3))}}}),PointPrimitive.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},PointPrimitive.prototype._getActualPosition=function(){return this._actualPosition},PointPrimitive.prototype._setActualPosition=function(e){Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$3)};const tempCartesian3=new Cartesian4;PointPrimitive._computeActualPosition=function(e,t,i){return t.mode===SceneMode$1.SCENE3D?e:(Matrix4.multiplyByPoint(i,e,tempCartesian3),SceneTransforms.computeActualWgs84Position(t,tempCartesian3))};const scratchCartesian4$2=new Cartesian4;PointPrimitive._computeScreenSpacePosition=function(e,t,i,n){const r=Matrix4.multiplyByVector(e,Cartesian4.fromElements(t.x,t.y,t.z,1,scratchCartesian4$2),scratchCartesian4$2);return SceneTransforms.wgs84ToWindowCoordinates(i,r,n)},PointPrimitive.prototype.computeScreenSpacePosition=function(e,t){const i=this._pointPrimitiveCollection;defined(t)||(t=new Cartesian2);const n=i.modelMatrix,r=PointPrimitive._computeScreenSpacePosition(n,this._actualPosition,e,t);if(defined(r))return r.y=e.canvas.clientHeight-r.y,r},PointPrimitive.getScreenSpaceBoundingBox=function(e,t,i){const n=e.pixelSize,r=.5*n,o=t.x-r,a=t.y-r,s=n,c=n;return defined(i)||(i=new BoundingRectangle),i.x=o,i.y=a,i.width=s,i.height=c,i},PointPrimitive.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&Color.equals(this._outlineColor,e._outlineColor)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},PointPrimitive.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};var PointPrimitiveCollectionFS="varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\ngl_FragColor = czm_gammaCorrect(color);\nczm_writeLogDepth();\n}\n",PointPrimitiveCollectionVS="uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nattribute vec3 distanceDisplayConditionAndDisableDepth;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_pixelRatio;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = distanceDisplayConditionAndDisableDepth.x;\nfloat farSq = distanceDisplayConditionAndDisableDepth.y;\nif (lengthSq < nearSq || lengthSq > farSq) {\npositionEC.xyz = vec3(0.0, 0.0, 1.0);\n}\n#endif\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(vec4(czm_currentFrustum.x));\n#endif\n}\n}\n#endif\nv_color = color;\nv_color.a *= translucency * show;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency * show;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize * show;\ngl_Position *= show;\nv_pickColor = pickColor;\n}\n";const SHOW_INDEX$2=PointPrimitive.SHOW_INDEX,POSITION_INDEX$2=PointPrimitive.POSITION_INDEX,COLOR_INDEX$2=PointPrimitive.COLOR_INDEX,OUTLINE_COLOR_INDEX=PointPrimitive.OUTLINE_COLOR_INDEX,OUTLINE_WIDTH_INDEX=PointPrimitive.OUTLINE_WIDTH_INDEX,PIXEL_SIZE_INDEX=PointPrimitive.PIXEL_SIZE_INDEX,SCALE_BY_DISTANCE_INDEX=PointPrimitive.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX,DISABLE_DEPTH_DISTANCE_INDEX=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX,NUMBER_OF_PROPERTIES$1=PointPrimitive.NUMBER_OF_PROPERTIES,attributeLocations$2={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function PointPrimitiveCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$1),this._maxPixelSize=1,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}function destroyPointPrimitives(e){const t=e.length;for(let i=0;i<t;++i)e[i]&&e[i]._destroy()}function removePointPrimitives(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;const t=[],i=e._pointPrimitives,n=i.length;for(let e=0,r=0;e<n;++e){const n=i[e];n&&(n._index=r++,t.push(n))}e._pointPrimitives=t}}function createVAF$1(e,t,i){return new VertexArrayFacade(e,[{index:attributeLocations$2.positionHighAndSize,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$2]},{index:attributeLocations$2.positionLowAndShow,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$2]},{index:attributeLocations$2.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[COLOR_INDEX$2]},{index:attributeLocations$2.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TRANSLUCENCY_BY_DISTANCE_INDEX]},{index:attributeLocations$2.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SCALE_BY_DISTANCE_INDEX]},{index:attributeLocations$2.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[DISTANCE_DISPLAY_CONDITION_INDEX]}],t)}Object.defineProperties(PointPrimitiveCollection.prototype,{length:{get:function(){return removePointPrimitives(this),this._pointPrimitives.length}}}),PointPrimitiveCollection.prototype.add=function(e){const t=new PointPrimitive(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},PointPrimitiveCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},PointPrimitiveCollection.prototype.removeAll=function(){destroyPointPrimitives(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},PointPrimitiveCollection.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},PointPrimitiveCollection.prototype.contains=function(e){return defined(e)&&e._pointPrimitiveCollection===this},PointPrimitiveCollection.prototype.get=function(e){return removePointPrimitives(this),this._pointPrimitives[e]},PointPrimitiveCollection.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const i=this._propertiesChanged;for(let n=0;n<NUMBER_OF_PROPERTIES$1;++n){const r=0===i[n]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[n]!==r,e[n]=r}return t};const writePositionScratch$1=new EncodedCartesian3;function writePositionSizeAndOutline(e,t,i,n){const r=n._index,o=n._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,o,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(o,writePositionScratch$1);const a=n.pixelSize,s=n.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,a+s);const c=i[attributeLocations$2.positionHighAndSize],l=writePositionScratch$1.high;c(r,l.x,l.y,l.z,a);const u=i[attributeLocations$2.positionLowAndOutline],d=writePositionScratch$1.low;u(r,d.x,d.y,d.z,s)}const LEFT_SHIFT16=65536,LEFT_SHIFT8=256;function writeCompressedAttrib0(e,t,i,n){const r=n._index,o=n.color,a=n.getPickId(t).color,s=n.outlineColor;let c=Color.floatToByte(o.red),l=Color.floatToByte(o.green),u=Color.floatToByte(o.blue);const d=c*LEFT_SHIFT16+l*LEFT_SHIFT8+u;c=Color.floatToByte(s.red),l=Color.floatToByte(s.green),u=Color.floatToByte(s.blue);const h=c*LEFT_SHIFT16+l*LEFT_SHIFT8+u;c=Color.floatToByte(a.red),l=Color.floatToByte(a.green),u=Color.floatToByte(a.blue);const p=c*LEFT_SHIFT16+l*LEFT_SHIFT8+u,f=Color.floatToByte(o.alpha)*LEFT_SHIFT16+Color.floatToByte(s.alpha)*LEFT_SHIFT8+Color.floatToByte(a.alpha);(0,i[attributeLocations$2.compressedAttribute0])(r,d,h,p,f)}function writeCompressedAttrib1(e,t,i,n){const r=n._index;let o=0,a=1,s=1,c=1;const l=n.translucencyByDistance;defined(l)&&(o=l.near,a=l.nearValue,s=l.far,c=l.farValue,1===a&&1===c||(e._shaderTranslucencyByDistance=!0));let u=n.show&&n.clusterShow;0===n.color.alpha&&0===n.outlineColor.alpha&&(u=!1),a=CesiumMath.clamp(a,0,1),a=1===a?255:255*a|0;const d=(u?1:0)*LEFT_SHIFT8+a;c=CesiumMath.clamp(c,0,1),c=1===c?255:255*c|0;const h=c;(0,i[attributeLocations$2.compressedAttribute1])(r,d,h,o,s)}function writeScaleByDistance(e,t,i,n){const r=n._index,o=i[attributeLocations$2.scaleByDistance];let a=0,s=1,c=1,l=1;const u=n.scaleByDistance;defined(u)&&(a=u.near,s=u.nearValue,c=u.far,l=u.farValue,1===s&&1===l||(e._shaderScaleByDistance=!0)),o(r,a,s,c,l)}function writeDistanceDisplayConditionAndDepthDisable(e,t,i,n){const r=n._index,o=i[attributeLocations$2.distanceDisplayConditionAndDisableDepth];let a=0,s=Number.MAX_VALUE;const c=n.distanceDisplayCondition;defined(c)&&(a=c.near,s=c.far,a*=a,s*=s,e._shaderDistanceDisplayCondition=!0);let l=n.disableDepthTestDistance;l*=l,l>0&&(e._shaderDisableDepthDistance=!0,l===Number.POSITIVE_INFINITY&&(l=-1)),o(r,a,s,l)}function writePointPrimitive(e,t,i,n){writePositionSizeAndOutline(e,t,i,n),writeCompressedAttrib0(e,t,i,n),writeCompressedAttrib1(e,t,i,n),writeScaleByDistance(e,t,i,n),writeDistanceDisplayConditionAndDepthDisable(e,t,i,n)}function recomputeActualPositions(e,t,i,n,r,o){let a;n.mode===SceneMode$1.SCENE3D?(a=e._baseVolume,e._boundingVolumeDirty=!0):a=e._baseVolume2D;const s=[];for(let e=0;e<i;++e){const i=t[e],c=i.position,l=PointPrimitive._computeActualPosition(c,n,r);defined(l)&&(i._setActualPosition(l),o?s.push(l):BoundingSphere.expand(a,l,a))}o&&BoundingSphere.fromPoints(s,a)}function updateMode(e,t){const i=t.mode,n=e._pointPrimitives,r=e._pointPrimitivesToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==SceneMode$1.SCENE3D&&!Matrix4.equals(o,e.modelMatrix)?(e._mode=i,Matrix4.clone(e.modelMatrix,o),e._createVertexArray=!0,i!==SceneMode$1.SCENE3D&&i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,n,n.length,t,o,!0)):i===SceneMode$1.MORPHING?recomputeActualPositions(e,n,n.length,t,o,!0):i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,r,e._pointPrimitivesToUpdateIndex,t,o,!1)}function updateBoundingVolume(e,t,i){const n=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;i.radius+=n}const scratchWriterArray$1=[];function sortKD(e,t,i,n,r,o){if(r-n<=i)return;const a=n+r>>1;select(e,t,a,n,r,o%2),sortKD(e,t,i,n,a-1,o+1),sortKD(e,t,i,a+1,r,o+1)}function select(e,t,i,n,r,o){for(;r>n;){if(r-n>600){const a=r-n+1,s=i-n+1,c=Math.log(a),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(a-l)/a)*(s-a/2<0?-1:1);select(e,t,i,Math.max(n,Math.floor(i-s*l/a+u)),Math.min(r,Math.floor(i+(a-s)*l/a+u)),o)}const a=t[2*i+o];let s=n,c=r;for(swapItem(e,t,n,i),t[2*r+o]>a&&swapItem(e,t,n,r);s<c;){for(swapItem(e,t,s,c),s++,c--;t[2*s+o]<a;)s++;for(;t[2*c+o]>a;)c--}t[2*n+o]===a?swapItem(e,t,n,c):(c++,swapItem(e,t,c,r)),c<=i&&(n=c+1),i<=c&&(r=c-1)}}function swapItem(e,t,i,n){swap(e,i,n),swap(t,2*i,2*n),swap(t,2*i+1,2*n+1)}function swap(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function range(e,t,i,n,r,o,a){const s=[0,e.length-1,0],c=[];let l,u;for(;s.length;){const d=s.pop(),h=s.pop(),p=s.pop();if(h-p<=a){for(let a=p;a<=h;a++)l=t[2*a],u=t[2*a+1],l>=i&&l<=r&&u>=n&&u<=o&&c.push(e[a]);continue}const f=Math.floor((p+h)/2);l=t[2*f],u=t[2*f+1],l>=i&&l<=r&&u>=n&&u<=o&&c.push(e[f]);const m=(d+1)%2;(0===d?i<=l:n<=u)&&(s.push(p),s.push(f-1),s.push(m)),(0===d?r>=l:o>=u)&&(s.push(f+1),s.push(h),s.push(m))}return c}function within(e,t,i,n,r,o){const a=[0,e.length-1,0],s=[],c=r*r;for(;a.length;){const l=a.pop(),u=a.pop(),d=a.pop();if(u-d<=o){for(let r=d;r<=u;r++)sqDist(t[2*r],t[2*r+1],i,n)<=c&&s.push(e[r]);continue}const h=Math.floor((d+u)/2),p=t[2*h],f=t[2*h+1];sqDist(p,f,i,n)<=c&&s.push(e[h]);const m=(l+1)%2;(0===l?i-r<=p:n-r<=f)&&(a.push(d),a.push(h-1),a.push(m)),(0===l?i+r>=p:n+r>=f)&&(a.push(h+1),a.push(u),a.push(m))}return s}function sqDist(e,t,i,n){const r=e-i,o=t-n;return r*r+o*o}PointPrimitiveCollection.prototype.update=function(e){if(removePointPrimitives(this),!this.show)return;this._maxTotalPointSize=ContextLimits.maximumAliasedPointSize,updateMode(this,e);const t=this._pointPrimitives.length,i=this._pointPrimitivesToUpdate,n=this._pointPrimitivesToUpdateIndex,r=this._propertiesChanged,o=this._createVertexArray;let a;const s=e.context,c=e.passes,l=c.pick;if(o||!l&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let e=0;e<NUMBER_OF_PROPERTIES$1;++e)r[e]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),t>0){this._vaf=createVAF$1(s,t,this._buffersUsage),a=this._vaf.writers;for(let e=0;e<t;++e){const t=this._pointPrimitives[e];t._dirty=!1,writePointPrimitive(this,s,a,t)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(n>0){const e=scratchWriterArray$1;e.length=0,(r[POSITION_INDEX$2]||r[OUTLINE_WIDTH_INDEX]||r[PIXEL_SIZE_INDEX])&&e.push(writePositionSizeAndOutline),(r[COLOR_INDEX$2]||r[OUTLINE_COLOR_INDEX])&&e.push(writeCompressedAttrib0),(r[SHOW_INDEX$2]||r[TRANSLUCENCY_BY_DISTANCE_INDEX])&&e.push(writeCompressedAttrib1),r[SCALE_BY_DISTANCE_INDEX]&&e.push(writeScaleByDistance),(r[DISTANCE_DISPLAY_CONDITION_INDEX]||r[DISABLE_DEPTH_DISTANCE_INDEX])&&e.push(writeDistanceDisplayConditionAndDepthDisable);const o=e.length;if(a=this._vaf.writers,n/t>.1){for(let t=0;t<n;++t){const n=i[t];n._dirty=!1;for(let t=0;t<o;++t)e[t](this,s,a,n)}this._vaf.commit()}else{for(let t=0;t<n;++t){const n=i[t];n._dirty=!1;for(let t=0;t<o;++t)e[t](this,s,a,n);this._vaf.subCommit(n._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(n>1.5*t&&(i.length=t),!defined(this._vaf)||!defined(this._vaf.va))return;let u;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let d=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D?(d=this.modelMatrix,u=BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):u=BoundingSphere.clone(this._baseVolume2D,this._boundingVolume),updateBoundingVolume(this,e,u);const h=this._blendOption!==this.blendOption;let p,f,m,g,_,y;this._blendOption=this.blendOption,h&&(this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance,(h||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(p=new ShaderSource({sources:[PointPrimitiveCollectionVS]}),this._shaderScaleByDistance&&p.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&p.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&p.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&p.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(f=new ShaderSource({defines:["OPAQUE"],sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2}),f=new ShaderSource({defines:["TRANSLUCENT"],sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2})),this._blendOption===BlendOption$1.OPAQUE&&(f=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2})),this._blendOption===BlendOption$1.TRANSLUCENT&&(f=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);const C=e.commandList;if(c.render||l){const e=this._colorCommands,t=this._blendOption===BlendOption$1.OPAQUE,i=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT;m=this._vaf.va,g=m.length,e.length=g;const n=i?2*g:g;for(y=0;y<n;++y){const n=t||i&&y%2==0;_=e[y],defined(_)||(_=e[y]=new DrawCommand),_.primitiveType=PrimitiveType$1.POINTS,_.pass=n||!i?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,_.owner=this;const r=i?Math.floor(y/2):y;_.boundingVolume=u,_.modelMatrix=d,_.shaderProgram=n?this._sp:this._spTranslucent,_.uniformMap=this._uniforms,_.vertexArray=m[r].va,_.renderState=n?this._rsOpaque:this._rsTranslucent,_.debugShowBoundingVolume=this.debugShowBoundingVolume,_.pickId="v_pickColor",C.push(_)}}},PointPrimitiveCollection.prototype.isDestroyed=function(){return!1},PointPrimitiveCollection.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyPointPrimitives(this._pointPrimitives),destroyObject(this)};const defaultGetX=e=>e[0],defaultGetY=e=>e[1];class KDBush{constructor(e,t=defaultGetX,i=defaultGetY,n=64,r=Float64Array){this.nodeSize=n,this.points=e;const o=e.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(e.length),s=this.coords=new r(2*e.length);for(let n=0;n<e.length;n++)a[n]=n,s[2*n]=t(e[n]),s[2*n+1]=i(e[n]);sortKD(a,s,n,0,a.length-1,0)}range(e,t,i,n){return range(this.ids,this.coords,e,t,i,n,this.nodeSize)}within(e,t,i){return within(this.ids,this.coords,e,t,i,this.nodeSize)}}function EntityCluster(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._enabled=defaultValue(e.enabled,!1),this._pixelRange=defaultValue(e.pixelRange,80),this._minimumClusterSize=defaultValue(e.minimumClusterSize,2),this._clusterBillboards=defaultValue(e.clusterBillboards,!0),this._clusterLabels=defaultValue(e.clusterLabels,!0),this._clusterPoints=defaultValue(e.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Event,this.show=defaultValue(e.show,!0)}function getX(e){return e.coord.x}function getY(e){return e.coord.y}function expandBoundingBox(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}const labelBoundingBoxScratch=new BoundingRectangle;function getBoundingBox(e,t,i,n,r){if(defined(e._labelCollection)&&n._clusterLabels?r=Label.getScreenSpaceBoundingBox(e,t,r):defined(e._billboardCollection)&&n._clusterBillboards?r=Billboard.getScreenSpaceBoundingBox(e,t,r):defined(e._pointPrimitiveCollection)&&n._clusterPoints&&(r=PointPrimitive.getScreenSpaceBoundingBox(e,t,r)),expandBoundingBox(r,i),n._clusterLabels&&!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(n,e.id.id)&&defined(e.id._label)){const o=n._collectionIndicesByEntity[e.id.id].labelIndex,a=n._labelCollection.get(o),s=Label.getScreenSpaceBoundingBox(a,t,labelBoundingBoxScratch);expandBoundingBox(s,i),r=BoundingRectangle.union(r,s,r)}return r}function addNonClusteredItem(e,t){if(e.clusterShow=!0,!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(t,e.id.id)&&defined(e.id._label)){const i=t._collectionIndicesByEntity[e.id.id].labelIndex;t._labelCollection.get(i).clusterShow=!0}}function addCluster(e,t,i,n){const r={billboard:n._clusterBillboardCollection.add(),label:n._clusterLabelCollection.add(),point:n._clusterPointCollection.add()};r.billboard.show=!1,r.point.show=!1,r.label.show=!0,r.label.text=t.toLocaleString(),r.label.id=i,r.billboard.position=r.label.position=r.point.position=e,n._clusterEvent.raiseEvent(i,r)}function hasLabelIndex(e,t){return defined(e)&&defined(e._collectionIndicesByEntity[t])&&defined(e._collectionIndicesByEntity[t].labelIndex)}function getScreenSpacePositions(e,t,i,n,r){if(!defined(e))return;const o=e.length;for(let a=0;a<o;++a){const o=e.get(a);if(o.clusterShow=!1,!o.show||r._scene.mode===SceneMode$1.SCENE3D&&!n.isPointVisible(o.position))continue;const s=r._clusterLabels&&defined(o._labelCollection),c=r._clusterBillboards&&defined(o.id._billboard),l=r._clusterPoints&&defined(o.id._point);if(s&&(l||c))continue;const u=o.computeScreenSpacePosition(i);defined(u)&&t.push({index:a,collection:e,clustered:!1,coord:u})}}const pointBoundinRectangleScratch=new BoundingRectangle,totalBoundingRectangleScratch=new BoundingRectangle,neighborBoundingRectangleScratch=new BoundingRectangle;function createDeclutterCallback(e){return function(t){if(defined(t)&&t<.05||!e.enabled)return;const i=e._scene,n=e._labelCollection,r=e._billboardCollection,o=e._pointCollection;if(!defined(n)&&!defined(r)&&!defined(o)||!e._clusterBillboards&&!e._clusterLabels&&!e._clusterPoints)return;let a=e._clusterLabelCollection,s=e._clusterBillboardCollection,c=e._clusterPointCollection;defined(a)?a.removeAll():a=e._clusterLabelCollection=new LabelCollection({scene:i}),defined(s)?s.removeAll():s=e._clusterBillboardCollection=new BillboardCollection({scene:i}),defined(c)?c.removeAll():c=e._clusterPointCollection=new PointPrimitiveCollection;const l=e._pixelRange,u=e._minimumClusterSize,d=e._previousClusters,h=[],p=e._previousHeight,f=i.camera.positionCartographic.height,m=new EllipsoidalOccluder(i.mapProjection.ellipsoid,i.camera.positionWC),g=[];let _,y,C,T,S,v,A,E,b,x,P,D;e._clusterLabels&&getScreenSpacePositions(n,g,i,m,e),e._clusterBillboards&&getScreenSpacePositions(r,g,i,m,e),e._clusterPoints&&getScreenSpacePositions(o,g,i,m,e);const w=new KDBush(g,getX,getY,64,Int32Array);if(f<p)for(C=d.length,_=0;_<C;++_){const t=d[_];if(!m.isPointVisible(t.position))continue;const n=Billboard._computeScreenSpacePosition(Matrix4.IDENTITY,t.position,Cartesian3.ZERO,Cartesian2.ZERO,i);if(!defined(n))continue;const r=1-f/p;let o=t.width=t.width*r,a=t.height=t.height*r;o=Math.max(o,t.minimumWidth),a=Math.max(a,t.minimumHeight);const s=n.x-.5*o,c=n.y-.5*a,l=n.x+o,C=n.y+a;for(S=w.range(s,c,l,C),v=S.length,x=0,b=[],y=0;y<v;++y)A=S[y],E=g[A],E.clustered||(++x,P=E.collection,D=E.index,b.push(P.get(D).id));if(x>=u)for(addCluster(t.position,x,b,e),h.push(t),y=0;y<v;++y)g[S[y]].clustered=!0}for(C=g.length,_=0;_<C;++_){const t=g[_];if(t.clustered)continue;t.clustered=!0,P=t.collection,D=t.index;const i=P.get(D);T=getBoundingBox(i,t.coord,l,e,pointBoundinRectangleScratch);const n=BoundingRectangle.clone(T,totalBoundingRectangleScratch);S=w.range(T.x,T.y,T.x+T.width,T.y+T.height),v=S.length;const r=Cartesian3.clone(i.position);for(x=1,b=[i.id],y=0;y<v;++y)if(A=S[y],E=g[A],!E.clustered){const t=E.collection.get(E.index),i=getBoundingBox(t,E.coord,l,e,neighborBoundingRectangleScratch);Cartesian3.add(t.position,r,r),BoundingRectangle.union(n,i,n),++x,b.push(t.id)}if(x>=u){const t=Cartesian3.multiplyByScalar(r,1/x,r);for(addCluster(t,x,b,e),h.push({position:t,width:n.width,height:n.height,minimumWidth:T.width,minimumHeight:T.height}),y=0;y<v;++y)g[S[y]].clustered=!0}else addNonClusteredItem(i,e)}0===a.length&&(a.destroy(),e._clusterLabelCollection=void 0),0===s.length&&(s.destroy(),e._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),e._clusterPointCollection=void 0),e._previousClusters=h,e._previousHeight=f}}function createGetEntity(e,t,i,n){return function(r){let o=this[e];defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let a,s,c=this._collectionIndicesByEntity[r.id];if(defined(c)||(c=this._collectionIndicesByEntity[r.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),defined(o)&&defined(c[n]))return o.get(c[n]);defined(o)||(o=this[e]=new t({scene:this._scene}));const l=this[i];l.length>0?(a=l.pop(),s=o.get(a)):(s=o.add(),a=o.length-1),c[n]=a;const u=this;return Promise.resolve().then((function(){u._clusterDirty=!0})),s}}function removeEntityIndicesIfUnused(e,t){const i=e._collectionIndicesByEntity[t];defined(i.billboardIndex)||defined(i.labelIndex)||defined(i.pointIndex)||delete e._collectionIndicesByEntity[t]}function disableCollectionClustering(e){if(!defined(e))return;const t=e.length;for(let i=0;i<t;++i)e.get(i).clusterShow=!0}function updateEnable(e){e.enabled||(defined(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),defined(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),defined(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,disableCollectionClustering(e._labelCollection),disableCollectionClustering(e._billboardCollection),disableCollectionClustering(e._pointCollection))}function CustomDataSource(e){this._name=e,this._clock=void 0,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster}EntityCluster.prototype._initialize=function(e){this._scene=e;const t=createDeclutterCallback(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)},Object.defineProperties(EntityCluster.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get:function(){return this._pixelRange},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get:function(){return this._minimumClusterSize},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get:function(){return this._clusterEvent}},clusterBillboards:{get:function(){return this._clusterBillboards},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get:function(){return this._clusterLabels},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get:function(){return this._clusterPoints},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}}),EntityCluster.prototype.getLabel=createGetEntity("_labelCollection",LabelCollection,"_unusedLabelIndices","labelIndex"),EntityCluster.prototype.removeLabel=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!defined(this._labelCollection)||!defined(t)||!defined(t.labelIndex))return;const i=t.labelIndex;t.labelIndex=void 0,removeEntityIndicesIfUnused(this,e.id);const n=this._labelCollection.get(i);n.show=!1,n.text="",n.id=void 0,this._unusedLabelIndices.push(i),this._clusterDirty=!0},EntityCluster.prototype.getBillboard=createGetEntity("_billboardCollection",BillboardCollection,"_unusedBillboardIndices","billboardIndex"),EntityCluster.prototype.removeBillboard=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!defined(this._billboardCollection)||!defined(t)||!defined(t.billboardIndex))return;const i=t.billboardIndex;t.billboardIndex=void 0,removeEntityIndicesIfUnused(this,e.id);const n=this._billboardCollection.get(i);n.id=void 0,n.show=!1,n.image=void 0,this._unusedBillboardIndices.push(i),this._clusterDirty=!0},EntityCluster.prototype.getPoint=createGetEntity("_pointCollection",PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),EntityCluster.prototype.removePoint=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!defined(this._pointCollection)||!defined(t)||!defined(t.pointIndex))return;const i=t.pointIndex;t.pointIndex=void 0,removeEntityIndicesIfUnused(this,e.id);const n=this._pointCollection.get(i);n.show=!1,n.id=void 0,this._unusedPointIndices.push(i),this._clusterDirty=!0},EntityCluster.prototype.update=function(e){if(!this.show)return;let t;defined(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),defined(this._billboardCollection)&&this._billboardCollection.length>0&&!defined(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,updateEnable(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),defined(this._clusterPointCollection)&&this._clusterPointCollection.update(e),defined(this._labelCollection)&&this._labelCollection.update(e),defined(this._billboardCollection)&&this._billboardCollection.update(e),defined(this._pointCollection)&&this._pointCollection.update(e)},EntityCluster.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),defined(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1},Object.defineProperties(CustomDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._changed.raiseEvent(this))}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading},set:function(e){DataSource.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}}}),CustomDataSource.prototype.update=function(e){return!0};const defaultOffset$8=Cartesian3.ZERO,offsetScratch$7=new Cartesian3,positionScratch$4=new Cartesian3,scratchColor$c=new Color;function CylinderGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.length=void 0,this.topRadius=void 0,this.bottomRadius=void 0,this.slices=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function CylinderGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CylinderGeometryOptions(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}function DynamicCylinderGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}function DataSourceClock(){this._definitionChanged=new Event,this._startTime=void 0,this._stopTime=void 0,this._currentTime=void 0,this._clockRange=void 0,this._clockStep=void 0,this._multiplier=void 0}defined(Object.create)&&(CylinderGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),CylinderGeometryUpdater.prototype.constructor=CylinderGeometryUpdater),Object.defineProperties(CylinderGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),CylinderGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),r=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),color:void 0,offset:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$c)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$8,offsetScratch$7))),new GeometryInstance({id:t,geometry:new CylinderGeometry(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:o})},CylinderGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$c),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$8,offsetScratch$7))),new GeometryInstance({id:t,geometry:new CylinderOutlineGeometry(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:o})},CylinderGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},CylinderGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.length)||!defined(t.topRadius)||!defined(t.bottomRadius)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CylinderGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.length.isConstant&&t.topRadius.isConstant&&t.bottomRadius.isConstant&&Property.isConstant(t.slices)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.numberOfVerticalLines))},CylinderGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),n=this._options;n.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,n.length=t.length.getValue(Iso8601.MINIMUM_VALUE),n.topRadius=t.topRadius.getValue(Iso8601.MINIMUM_VALUE),n.bottomRadius=t.bottomRadius.getValue(Iso8601.MINIMUM_VALUE),n.slices=Property.getValueOrUndefined(t.slices,Iso8601.MINIMUM_VALUE),n.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),n.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},CylinderGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,CylinderGeometryUpdater.DynamicGeometryUpdater=DynamicCylinderGeometryUpdater,defined(Object.create)&&(DynamicCylinderGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicCylinderGeometryUpdater.prototype.constructor=DynamicCylinderGeometryUpdater),DynamicCylinderGeometryUpdater.prototype._isHidden=function(e,t,i){const n=this._options;return!defined(Property.getValueOrUndefined(e.position,i,positionScratch$4))||!defined(n.length)||!defined(n.topRadius)||!defined(n.bottomRadius)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicCylinderGeometryUpdater.prototype._setOptions=function(e,t,i){const n=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),r=this._options;r.length=Property.getValueOrUndefined(t.length,i),r.topRadius=Property.getValueOrUndefined(t.topRadius,i),r.bottomRadius=Property.getValueOrUndefined(t.bottomRadius,i),r.slices=Property.getValueOrUndefined(t.slices,i),r.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,i),r.offsetAttribute=n!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},Object.defineProperties(DataSourceClock.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},startTime:createRawPropertyDescriptor("startTime"),stopTime:createRawPropertyDescriptor("stopTime"),currentTime:createRawPropertyDescriptor("currentTime"),clockRange:createRawPropertyDescriptor("clockRange"),clockStep:createRawPropertyDescriptor("clockStep"),multiplier:createRawPropertyDescriptor("multiplier")}),DataSourceClock.prototype.clone=function(e){return defined(e)||(e=new DataSourceClock),e.startTime=this.startTime,e.stopTime=this.stopTime,e.currentTime=this.currentTime,e.clockRange=this.clockRange,e.clockStep=this.clockStep,e.multiplier=this.multiplier,e},DataSourceClock.prototype.equals=function(e){return this===e||defined(e)&&JulianDate.equals(this.startTime,e.startTime)&&JulianDate.equals(this.stopTime,e.stopTime)&&JulianDate.equals(this.currentTime,e.currentTime)&&this.clockRange===e.clockRange&&this.clockStep===e.clockStep&&this.multiplier===e.multiplier},DataSourceClock.prototype.merge=function(e){this.startTime=defaultValue(this.startTime,e.startTime),this.stopTime=defaultValue(this.stopTime,e.stopTime),this.currentTime=defaultValue(this.currentTime,e.currentTime),this.clockRange=defaultValue(this.clockRange,e.clockRange),this.clockStep=defaultValue(this.clockStep,e.clockStep),this.multiplier=defaultValue(this.multiplier,e.multiplier)},DataSourceClock.prototype.getValue=function(e){return defined(e)||(e=new Clock),e.startTime=defaultValue(this.startTime,e.startTime),e.stopTime=defaultValue(this.stopTime,e.stopTime),e.currentTime=defaultValue(this.currentTime,e.currentTime),e.clockRange=defaultValue(this.clockRange,e.clockRange),e.multiplier=defaultValue(this.multiplier,e.multiplier),e.clockStep=defaultValue(this.clockStep,e.clockStep),e};const defaultColor$6=Color.WHITE,defaultCellAlpha=.1,defaultLineCount=new Cartesian2(8,8),defaultLineOffset=new Cartesian2(0,0),defaultLineThickness=new Cartesian2(1,1);function GridMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._cellAlpha=void 0,this._cellAlphaSubscription=void 0,this._lineCount=void 0,this._lineCountSubscription=void 0,this._lineThickness=void 0,this._lineThicknessSubscription=void 0,this._lineOffset=void 0,this._lineOffsetSubscription=void 0,this.color=e.color,this.cellAlpha=e.cellAlpha,this.lineCount=e.lineCount,this.lineThickness=e.lineThickness,this.lineOffset=e.lineOffset}function PolylineArrowMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(GridMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._cellAlpha)&&Property.isConstant(this._lineCount)&&Property.isConstant(this._lineThickness)&&Property.isConstant(this._lineOffset)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),cellAlpha:createPropertyDescriptor("cellAlpha"),lineCount:createPropertyDescriptor("lineCount"),lineThickness:createPropertyDescriptor("lineThickness"),lineOffset:createPropertyDescriptor("lineOffset")}),GridMaterialProperty.prototype.getType=function(e){return"Grid"},GridMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$6,t.color),t.cellAlpha=Property.getValueOrDefault(this._cellAlpha,e,defaultCellAlpha),t.lineCount=Property.getValueOrClonedDefault(this._lineCount,e,defaultLineCount,t.lineCount),t.lineThickness=Property.getValueOrClonedDefault(this._lineThickness,e,defaultLineThickness,t.lineThickness),t.lineOffset=Property.getValueOrClonedDefault(this._lineOffset,e,defaultLineOffset,t.lineOffset),t},GridMaterialProperty.prototype.equals=function(e){return this===e||e instanceof GridMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._cellAlpha,e._cellAlpha)&&Property.equals(this._lineCount,e._lineCount)&&Property.equals(this._lineThickness,e._lineThickness)&&Property.equals(this._lineOffset,e._lineOffset)},Object.defineProperties(PolylineArrowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),PolylineArrowMaterialProperty.prototype.getType=function(e){return"PolylineArrow"},PolylineArrowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},PolylineArrowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineArrowMaterialProperty&&Property.equals(this._color,e._color)};const defaultColor$5=Color.WHITE,defaultGapColor=Color.TRANSPARENT,defaultDashLength=16,defaultDashPattern=255;function PolylineDashMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._gapColor=void 0,this._gapColorSubscription=void 0,this._dashLength=void 0,this._dashLengthSubscription=void 0,this._dashPattern=void 0,this._dashPatternSubscription=void 0,this.color=e.color,this.gapColor=e.gapColor,this.dashLength=e.dashLength,this.dashPattern=e.dashPattern}Object.defineProperties(PolylineDashMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._gapColor)&&Property.isConstant(this._dashLength)&&Property.isConstant(this._dashPattern)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),gapColor:createPropertyDescriptor("gapColor"),dashLength:createPropertyDescriptor("dashLength"),dashPattern:createPropertyDescriptor("dashPattern")}),PolylineDashMaterialProperty.prototype.getType=function(e){return"PolylineDash"},PolylineDashMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$5,t.color),t.gapColor=Property.getValueOrClonedDefault(this._gapColor,e,defaultGapColor,t.gapColor),t.dashLength=Property.getValueOrDefault(this._dashLength,e,defaultDashLength,t.dashLength),t.dashPattern=Property.getValueOrDefault(this._dashPattern,e,defaultDashPattern,t.dashPattern),t},PolylineDashMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineDashMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._gapColor,e._gapColor)&&Property.equals(this._dashLength,e._dashLength)&&Property.equals(this._dashPattern,e._dashPattern)};const defaultColor$4=Color.WHITE,defaultGlowPower=.25,defaultTaperPower=1;function PolylineGlowMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._glowPower=void 0,this._glowPowerSubscription=void 0,this._taperPower=void 0,this._taperPowerSubscription=void 0,this.color=e.color,this.glowPower=e.glowPower,this.taperPower=e.taperPower}Object.defineProperties(PolylineGlowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._glow)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),glowPower:createPropertyDescriptor("glowPower"),taperPower:createPropertyDescriptor("taperPower")}),PolylineGlowMaterialProperty.prototype.getType=function(e){return"PolylineGlow"},PolylineGlowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$4,t.color),t.glowPower=Property.getValueOrDefault(this._glowPower,e,defaultGlowPower,t.glowPower),t.taperPower=Property.getValueOrDefault(this._taperPower,e,defaultTaperPower,t.taperPower),t},PolylineGlowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineGlowMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._glowPower,e._glowPower)&&Property.equals(this._taperPower,e._taperPower)};const defaultColor$3=Color.WHITE,defaultOutlineColor$2=Color.BLACK,defaultOutlineWidth$2=1;function PolylineOutlineMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this.color=e.color,this.outlineColor=e.outlineColor,this.outlineWidth=e.outlineWidth}function PositionPropertyArray(e,t){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED),this.setValue(e)}function PropertyArray(e){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this.setValue(e)}function resolve(e){let t=e._targetProperty;if(!defined(t)){let i=e._targetEntity;if(!defined(i)){if(i=e._targetCollection.getById(e._targetId),!defined(i))return void(e._targetEntity=e._targetProperty=void 0);i.definitionChanged.addEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=i}const n=e._targetPropertyNames;t=e._targetEntity;for(let e=0,i=n.length;e<i&&defined(t);++e)t=t[n[e]];e._targetProperty=t}return t}function ReferenceProperty(e,t,i){this._targetCollection=e,this._targetId=t,this._targetPropertyNames=i,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new Event,e.collectionChanged.addEventListener(ReferenceProperty.prototype._onCollectionChanged,this)}Object.defineProperties(PolylineOutlineMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._outlineColor)&&Property.isConstant(this._outlineWidth)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth")}),PolylineOutlineMaterialProperty.prototype.getType=function(e){return"PolylineOutline"},PolylineOutlineMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$3,t.color),t.outlineColor=Property.getValueOrClonedDefault(this._outlineColor,e,defaultOutlineColor$2,t.outlineColor),t.outlineWidth=Property.getValueOrDefault(this._outlineWidth,e,defaultOutlineWidth$2),t},PolylineOutlineMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineOutlineMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._outlineColor,e._outlineColor)&&Property.equals(this._outlineWidth,e._outlineWidth)},Object.defineProperties(PositionPropertyArray.prototype,{isConstant:{get:function(){const e=this._value;if(!defined(e))return!0;const t=e.length;for(let i=0;i<t;i++)if(!Property.isConstant(e[i]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),PositionPropertyArray.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},PositionPropertyArray.prototype.getValueInReferenceFrame=function(e,t,i){const n=this._value;if(!defined(n))return;const r=n.length;defined(i)||(i=new Array(r));let o=0,a=0;for(;o<r;){const r=n[o].getValueInReferenceFrame(e,t,i[o]);defined(r)&&(i[a]=r,a++),o++}return i.length=a,i},PositionPropertyArray.prototype.setValue=function(e){const t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();const i=e.length;for(let n=0;n<i;n++){const i=e[n];defined(i)&&t.add(i.definitionChanged,PositionPropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PositionPropertyArray.prototype.equals=function(e){return this===e||e instanceof PositionPropertyArray&&this._referenceFrame===e._referenceFrame&&Property.arrayEquals(this._value,e._value)},PositionPropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(PropertyArray.prototype,{isConstant:{get:function(){const e=this._value;if(!defined(e))return!0;const t=e.length;for(let i=0;i<t;i++)if(!Property.isConstant(e[i]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyArray.prototype.getValue=function(e,t){const i=this._value;if(!defined(i))return;const n=i.length;defined(t)||(t=new Array(n));let r=0,o=0;for(;r<n;){const i=this._value[r].getValue(e,t[r]);defined(i)&&(t[o]=i,o++),r++}return t.length=o,t},PropertyArray.prototype.setValue=function(e){const t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();const i=e.length;for(let n=0;n<i;n++){const i=e[n];defined(i)&&t.add(i.definitionChanged,PropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PropertyArray.prototype.equals=function(e){return this===e||e instanceof PropertyArray&&Property.arrayEquals(this._value,e._value)},PropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(ReferenceProperty.prototype,{isConstant:{get:function(){return Property.isConstant(resolve(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){const e=resolve(this);return defined(e)?e.referenceFrame:void 0}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return resolve(this)}}}),ReferenceProperty.fromString=function(e,t){let i;const n=[];let r=!0,o=!1,a="";for(let e=0;e<t.length;++e){const s=t.charAt(e);o?(a+=s,o=!1):"\\"===s?o=!0:r&&"#"===s?(i=a,r=!1,a=""):r||"."!==s?a+=s:(n.push(a),a="")}return n.push(a),new ReferenceProperty(e,i,n)},ReferenceProperty.prototype.getValue=function(e,t){const i=resolve(this);return defined(i)?i.getValue(e,t):void 0},ReferenceProperty.prototype.getValueInReferenceFrame=function(e,t,i){const n=resolve(this);return defined(n)?n.getValueInReferenceFrame(e,t,i):void 0},ReferenceProperty.prototype.getType=function(e){const t=resolve(this);return defined(t)?t.getType(e):void 0},ReferenceProperty.prototype.equals=function(e){if(this===e)return!0;const t=this._targetPropertyNames,i=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==i.length)return!1;const n=this._targetPropertyNames.length;for(let e=0;e<n;e++)if(t[e]!==i[e])return!1;return!0},ReferenceProperty.prototype._onTargetEntityDefinitionChanged=function(e,t,i,n){defined(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))},ReferenceProperty.prototype._onCollectionChanged=function(e,t,i){let n=this._targetEntity;defined(n)&&-1!==i.indexOf(n)?(n.definitionChanged.removeEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):defined(n)||(n=resolve(this),defined(n)&&this._definitionChanged.raiseEvent(this))};const Rotation={packedLength:1,pack:function(e,t,i){return t[i=defaultValue(i,0)]=e,t},unpack:function(e,t,i){return e[t=defaultValue(t,0)]},convertPackedArrayForInterpolation:function(e,t,i,n){let r;defined(n)||(n=[]),t=defaultValue(t,0);for(let o=0,a=(i=defaultValue(i,e.length))-t+1;o<a;o++){const i=e[t+o];0===o||Math.abs(r-i)<Math.PI?n[o]=i:n[o]=i-CesiumMath.TWO_PI,r=i}},unpackInterpolationResult:function(e,t,i,n,r){return(r=e[0])<0?r+CesiumMath.TWO_PI:r}},PackableNumber={packedLength:1,pack:function(e,t,i){t[i=defaultValue(i,0)]=e},unpack:function(e,t,i){return e[t=defaultValue(t,0)]}};function arrayInsert(e,t,i){let n;const r=e.length,o=i.length,a=r+o;if(e.length=a,r!==t){let i=r-1;for(n=a-1;n>=t;n--)e[n]=e[i--]}for(n=0;n<o;n++)e[t++]=i[n]}function convertDate(e,t){return e instanceof JulianDate?e:"string"==typeof e?JulianDate.fromIso8601(e):JulianDate.addSeconds(t,e,new JulianDate)}const timesSpliceArgs=[],valuesSpliceArgs=[];function mergeNewSamples(e,t,i,n,r){let o,a,s,c,l,u,d=0;for(;d<n.length;){l=convertDate(n[d],e),s=binarySearch(t,l,JulianDate.compare);let h=0,p=0;if(s<0){for(s=~s,c=s*r,a=void 0,u=t[s];d<n.length&&(l=convertDate(n[d],e),!(defined(a)&&JulianDate.compare(a,l)>=0||defined(u)&&JulianDate.compare(l,u)>=0));){for(timesSpliceArgs[h++]=l,d+=1,o=0;o<r;o++)valuesSpliceArgs[p++]=n[d],d+=1;a=l}h>0&&(valuesSpliceArgs.length=p,arrayInsert(i,c,valuesSpliceArgs),timesSpliceArgs.length=h,arrayInsert(t,s,timesSpliceArgs))}else{for(o=0;o<r;o++)d++,i[s*r+o]=n[d];d++}}}function SampledProperty(e,t){let i=e;i===Number&&(i=PackableNumber);let n,r=i.packedLength,o=defaultValue(i.packedInterpolationLength,r),a=0;if(defined(t)){const e=t.length;n=new Array(e);for(let i=0;i<e;i++){let e=t[i];e===Number&&(e=PackableNumber);const a=e.packedLength;r+=a,o+=defaultValue(e.packedInterpolationLength,a),n[i]=e}a=e}this._type=e,this._innerType=i,this._interpolationDegree=1,this._interpolationAlgorithm=LinearApproximation,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=r,this._packedInterpolationLength=o,this._updateTableLength=!0,this._interpolationResult=new Array(o),this._definitionChanged=new Event,this._derivativeTypes=t,this._innerDerivativeTypes=n,this._inputOrder=a,this._forwardExtrapolationType=ExtrapolationType$1.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=ExtrapolationType$1.NONE,this._backwardExtrapolationDuration=0}function removeSamples(e,t,i){const n=e._packedLength;e._times.splice(t,i),e._values.splice(t*n,i*n),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}function SampledPositionProperty(e,t){let i;if((t=defaultValue(t,0))>0){i=new Array(t);for(let e=0;e<t;e++)i[e]=Cartesian3}this._numberOfDerivatives=t,this._property=new SampledProperty(Cartesian3,i),this._definitionChanged=new Event,this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._property._definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this)}),this)}Object.defineProperties(SampledProperty.prototype,{isConstant:{get:function(){return 0===this._values.length}},definitionChanged:{get:function(){return this._definitionChanged}},type:{get:function(){return this._type}},derivativeTypes:{get:function(){return this._derivativeTypes}},interpolationDegree:{get:function(){return this._interpolationDegree}},interpolationAlgorithm:{get:function(){return this._interpolationAlgorithm}},forwardExtrapolationType:{get:function(){return this._forwardExtrapolationType},set:function(e){this._forwardExtrapolationType!==e&&(this._forwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},forwardExtrapolationDuration:{get:function(){return this._forwardExtrapolationDuration},set:function(e){this._forwardExtrapolationDuration!==e&&(this._forwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationType:{get:function(){return this._backwardExtrapolationType},set:function(e){this._backwardExtrapolationType!==e&&(this._backwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationDuration:{get:function(){return this._backwardExtrapolationDuration},set:function(e){this._backwardExtrapolationDuration!==e&&(this._backwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}}}),SampledProperty.prototype.getValue=function(e,t){const i=this._times,n=i.length;if(0===n)return;let r;const o=this._innerType,a=this._values;let s=binarySearch(i,e,JulianDate.compare);if(s<0){if(s=~s,0===s){const n=i[s];if(r=this._backwardExtrapolationDuration,this._backwardExtrapolationType===ExtrapolationType$1.NONE||0!==r&&JulianDate.secondsDifference(n,e)>r)return;if(this._backwardExtrapolationType===ExtrapolationType$1.HOLD)return o.unpack(a,0,t)}if(s>=n){s=n-1;const c=i[s];if(r=this._forwardExtrapolationDuration,this._forwardExtrapolationType===ExtrapolationType$1.NONE||0!==r&&JulianDate.secondsDifference(e,c)>r)return;if(this._forwardExtrapolationType===ExtrapolationType$1.HOLD)return s=n-1,o.unpack(a,s*o.packedLength,t)}const c=this._xTable,l=this._yTable,u=this._interpolationAlgorithm,d=this._packedInterpolationLength,h=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const e=Math.min(u.getRequiredDataPoints(this._interpolationDegree,h),n);e!==this._numberOfPoints&&(this._numberOfPoints=e,c.length=e,l.length=e*d)}const p=this._numberOfPoints-1;if(p<1)return;let f=0,m=n-1;if(m-f+1>=p+1){let e=s-(p/2|0)-1;e<f&&(e=f);let t=e+p;t>m&&(t=m,e=t-p,e<f&&(e=f)),f=e,m=t}const g=m-f+1;for(let e=0;e<g;++e)c[e]=JulianDate.secondsDifference(i[f+e],i[m]);if(defined(o.convertPackedArrayForInterpolation))o.convertPackedArrayForInterpolation(a,f,m,l);else{let e=0;const t=this._packedLength;let i=f*t;const n=(m+1)*t;for(;i<n;)l[e]=a[i],i++,e++}const _=JulianDate.secondsDifference(e,i[m]);let y;if(0!==h&&defined(u.interpolate)){const e=Math.floor(d/(h+1));y=u.interpolate(_,c,l,e,h,h,this._interpolationResult)}else y=u.interpolateOrderZero(_,c,l,d,this._interpolationResult);return defined(o.unpackInterpolationResult)?o.unpackInterpolationResult(y,a,f,m,t):o.unpack(y,0,t)}return o.unpack(a,s*this._packedLength,t)},SampledProperty.prototype.setInterpolationOptions=function(e){if(!defined(e))return;let t=!1;const i=e.interpolationAlgorithm,n=e.interpolationDegree;defined(i)&&this._interpolationAlgorithm!==i&&(this._interpolationAlgorithm=i,t=!0),defined(n)&&this._interpolationDegree!==n&&(this._interpolationDegree=n,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))},SampledProperty.prototype.addSample=function(e,t,i){const n=this._innerDerivativeTypes,r=defined(n),o=this._innerType,a=[];if(a.push(e),o.pack(t,a,a.length),r){const e=n.length;for(let t=0;t<e;t++)n[t].pack(i[t],a,a.length)}mergeNewSamples(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamples=function(e,t,i){const n=this._innerDerivativeTypes,r=defined(n),o=this._innerType,a=e.length,s=[];for(let c=0;c<a;c++)if(s.push(e[c]),o.pack(t[c],s,s.length),r){const e=i[c],t=n.length;for(let i=0;i<t;i++)n[i].pack(e[i],s,s.length)}mergeNewSamples(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamplesPackedArray=function(e,t){mergeNewSamples(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.removeSample=function(e){const t=binarySearch(this._times,e,JulianDate.compare);return!(t<0)&&(removeSamples(this,t,1),!0)},SampledProperty.prototype.removeSamples=function(e){const t=this._times;let i=binarySearch(t,e.start,JulianDate.compare);i<0?i=~i:e.isStartIncluded||++i;let n=binarySearch(t,e.stop,JulianDate.compare);n<0?n=~n:e.isStopIncluded&&++n,removeSamples(this,i,n-i)},SampledProperty.prototype.equals=function(e){if(this===e)return!0;if(!defined(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;const t=this._derivativeTypes,i=defined(t),n=e._derivativeTypes;if(i!==defined(n))return!1;let r,o;if(i){if(o=t.length,o!==n.length)return!1;for(r=0;r<o;r++)if(t[r]!==n[r])return!1}const a=this._times,s=e._times;if(o=a.length,o!==s.length)return!1;for(r=0;r<o;r++)if(!JulianDate.equals(a[r],s[r]))return!1;const c=this._values,l=e._values;for(o=c.length,r=0;r<o;r++)if(c[r]!==l[r])return!1;return!0},SampledProperty._mergeNewSamples=mergeNewSamples,Object.defineProperties(SampledPositionProperty.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}}),SampledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},SampledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){if(defined(i=this._property.getValue(e,i)))return PositionProperty.convertToReferenceFrame(e,i,this._referenceFrame,t,i)},SampledPositionProperty.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},SampledPositionProperty.prototype.addSample=function(e,t,i){this._numberOfDerivatives,this._property.addSample(e,t,i)},SampledPositionProperty.prototype.addSamples=function(e,t,i){this._property.addSamples(e,t,i)},SampledPositionProperty.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},SampledPositionProperty.prototype.removeSample=function(e){return this._property.removeSample(e)},SampledPositionProperty.prototype.removeSamples=function(e){this._property.removeSamples(e)},SampledPositionProperty.prototype.equals=function(e){return this===e||e instanceof SampledPositionProperty&&Property.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};const StripeOrientation={HORIZONTAL:0,VERTICAL:1};var StripeOrientation$1=Object.freeze(StripeOrientation);const defaultOrientation=StripeOrientation$1.HORIZONTAL,defaultEvenColor=Color.WHITE,defaultOddColor=Color.BLACK,defaultOffset$7=0,defaultRepeat=1;function StripeMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._orientation=void 0,this._orientationSubscription=void 0,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._offset=void 0,this._offsetSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.orientation=e.orientation,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.offset=e.offset,this.repeat=e.repeat}function TimeIntervalCollectionPositionProperty(e){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionPositionProperty.prototype._intervalsChanged,this),this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED)}function TimeIntervalCollectionProperty(){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionProperty.prototype._intervalsChanged,this)}function VelocityVectorProperty(e,t){this._position=void 0,this._subscription=void 0,this._definitionChanged=new Event,this._normalize=defaultValue(t,!0),this.position=e}Object.defineProperties(StripeMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._orientation)&&Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._offset)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:createPropertyDescriptor("orientation"),evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),offset:createPropertyDescriptor("offset"),repeat:createPropertyDescriptor("repeat")}),StripeMaterialProperty.prototype.getType=function(e){return"Stripe"},StripeMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.horizontal=Property.getValueOrDefault(this._orientation,e,defaultOrientation)===StripeOrientation$1.HORIZONTAL,t.evenColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor,t.evenColor),t.oddColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor,t.oddColor),t.offset=Property.getValueOrDefault(this._offset,e,defaultOffset$7),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat),t},StripeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof StripeMaterialProperty&&Property.equals(this._orientation,e._orientation)&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._offset,e._offset)&&Property.equals(this._repeat,e._repeat)},Object.defineProperties(TimeIntervalCollectionPositionProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}}),TimeIntervalCollectionPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){const n=this._intervals.findDataForIntervalContainingDate(e);if(defined(n))return PositionProperty.convertToReferenceFrame(e,n,this._referenceFrame,t,i)},TimeIntervalCollectionPositionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionPositionProperty&&this._intervals.equals(e._intervals,Property.equals)&&this._referenceFrame===e._referenceFrame},TimeIntervalCollectionPositionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(TimeIntervalCollectionProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),TimeIntervalCollectionProperty.prototype.getValue=function(e,t){const i=this._intervals.findDataForIntervalContainingDate(e);return defined(i)&&"function"==typeof i.clone?i.clone(t):i},TimeIntervalCollectionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionProperty&&this._intervals.equals(e._intervals,Property.equals)},TimeIntervalCollectionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(VelocityVectorProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){const t=this._position;t!==e&&(defined(t)&&this._subscription(),this._position=e,defined(e)&&(this._subscription=e._definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this)}),this)),this._definitionChanged.raiseEvent(this))}},normalize:{get:function(){return this._normalize},set:function(e){this._normalize!==e&&(this._normalize=e,this._definitionChanged.raiseEvent(this))}}});const position1Scratch=new Cartesian3,position2Scratch=new Cartesian3,timeScratch=new JulianDate,step=1/60;function VelocityOrientationProperty(e,t){this._velocityVectorProperty=new VelocityVectorProperty(e,!0),this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new Event,this.ellipsoid=defaultValue(t,Ellipsoid.WGS84);const i=this;this._velocityVectorProperty.definitionChanged.addEventListener((function(){i._definitionChanged.raiseEvent(i)}))}VelocityVectorProperty.prototype.getValue=function(e,t){return this._getValue(e,t)},VelocityVectorProperty.prototype._getValue=function(e,t,i){defined(t)||(t=new Cartesian3);const n=this._position;if(Property.isConstant(n))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);let r=n.getValue(e,position1Scratch),o=n.getValue(JulianDate.addSeconds(e,step,timeScratch),position2Scratch);if(!defined(r))return;if(!defined(o)&&(o=r,r=n.getValue(JulianDate.addSeconds(e,-step,timeScratch),position2Scratch),!defined(r)))return;if(Cartesian3.equals(r,o))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);defined(i)&&r.clone(i);const a=Cartesian3.subtract(o,r,t);return this._normalize?Cartesian3.normalize(a,t):Cartesian3.divideByScalar(a,step,t)},VelocityVectorProperty.prototype.equals=function(e){return this===e||e instanceof VelocityVectorProperty&&Property.equals(this._position,e._position)},Object.defineProperties(VelocityOrientationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._velocityVectorProperty)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._velocityVectorProperty.position},set:function(e){this._velocityVectorProperty.position=e}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){this._ellipsoid!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});const positionScratch$3=new Cartesian3,velocityScratch=new Cartesian3,rotationScratch$1=new Matrix3;function UnitCartesian3(){}let currentId;function createReferenceProperty(e,t){return"#"===t[0]&&(t=currentId+t),ReferenceProperty.fromString(e,t)}function createSpecializedProperty(e,t,i){if(defined(i.reference))return createReferenceProperty(t,i.reference);if(defined(i.velocityReference)){const n=createReferenceProperty(t,i.velocityReference);switch(e){case Cartesian3:case UnitCartesian3:return new VelocityVectorProperty(n,e===UnitCartesian3);case Quaternion:return new VelocityOrientationProperty(n)}}throw new RuntimeError(`${JSON.stringify(i)} is not valid CZML.`)}function createAdapterProperty(e,t){return new CallbackProperty((function(i,n){return t(e.getValue(i,n))}),e.isConstant)}VelocityOrientationProperty.prototype.getValue=function(e,t){const i=this._velocityVectorProperty._getValue(e,velocityScratch,positionScratch$3);if(defined(i))return Transforms.rotationMatrixFromPositionVelocity(positionScratch$3,i,this._ellipsoid,rotationScratch$1),Quaternion.fromRotationMatrix(rotationScratch$1,t)},VelocityOrientationProperty.prototype.equals=function(e){return this===e||e instanceof VelocityOrientationProperty&&Property.equals(this._velocityVectorProperty,e._velocityVectorProperty)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))},UnitCartesian3.packedLength=Cartesian3.packedLength,UnitCartesian3.unpack=Cartesian3.unpack,UnitCartesian3.pack=Cartesian3.pack;const scratchCartesian$3=new Cartesian3,scratchSpherical=new Spherical,scratchCartographic$9=new Cartographic,scratchTimeInterval$1=new TimeInterval,scratchQuaternion=new Quaternion;function unwrapColorInterval(e){let t=e.rgbaf;if(defined(t))return t;const i=e.rgba;if(!defined(i))return;const n=i.length;if(n===Color.packedLength)return[Color.byteToFloat(i[0]),Color.byteToFloat(i[1]),Color.byteToFloat(i[2]),Color.byteToFloat(i[3])];t=new Array(n);for(let e=0;e<n;e+=5)t[e]=i[e],t[e+1]=Color.byteToFloat(i[e+1]),t[e+2]=Color.byteToFloat(i[e+2]),t[e+3]=Color.byteToFloat(i[e+3]),t[e+4]=Color.byteToFloat(i[e+4]);return t}function unwrapUriInterval(e,t){const i=defaultValue(e.uri,e);return defined(t)?t.getDerivedResource({url:i}):Resource.createIfNeeded(i)}function unwrapRectangleInterval(e){let t=e.wsen;if(defined(t))return t;const i=e.wsenDegrees;if(!defined(i))return;const n=i.length;if(n===Rectangle.packedLength)return[CesiumMath.toRadians(i[0]),CesiumMath.toRadians(i[1]),CesiumMath.toRadians(i[2]),CesiumMath.toRadians(i[3])];t=new Array(n);for(let e=0;e<n;e+=5)t[e]=i[e],t[e+1]=CesiumMath.toRadians(i[e+1]),t[e+2]=CesiumMath.toRadians(i[e+2]),t[e+3]=CesiumMath.toRadians(i[e+3]),t[e+4]=CesiumMath.toRadians(i[e+4]);return t}function convertUnitSphericalToCartesian(e){const t=e.length;if(scratchSpherical.magnitude=1,2===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const i=new Array(t/3*4);for(let n=0,r=0;n<t;n+=3,r+=4)i[r]=e[n],scratchSpherical.clock=e[n+1],scratchSpherical.cone=e[n+2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),i[r+1]=scratchCartesian$3.x,i[r+2]=scratchCartesian$3.y,i[r+3]=scratchCartesian$3.z;return i}function convertSphericalToCartesian(e){const t=e.length;if(3===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],scratchSpherical.magnitude=e[2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const i=new Array(t);for(let n=0;n<t;n+=4)i[n]=e[n],scratchSpherical.clock=e[n+1],scratchSpherical.cone=e[n+2],scratchSpherical.magnitude=e[n+3],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),i[n+1]=scratchCartesian$3.x,i[n+2]=scratchCartesian$3.y,i[n+3]=scratchCartesian$3.z;return i}function convertCartographicRadiansToCartesian(e){const t=e.length;if(3===t)return scratchCartographic$9.longitude=e[0],scratchCartographic$9.latitude=e[1],scratchCartographic$9.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const i=new Array(t);for(let n=0;n<t;n+=4)i[n]=e[n],scratchCartographic$9.longitude=e[n+1],scratchCartographic$9.latitude=e[n+2],scratchCartographic$9.height=e[n+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),i[n+1]=scratchCartesian$3.x,i[n+2]=scratchCartesian$3.y,i[n+3]=scratchCartesian$3.z;return i}function convertCartographicDegreesToCartesian(e){const t=e.length;if(3===t)return scratchCartographic$9.longitude=CesiumMath.toRadians(e[0]),scratchCartographic$9.latitude=CesiumMath.toRadians(e[1]),scratchCartographic$9.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const i=new Array(t);for(let n=0;n<t;n+=4)i[n]=e[n],scratchCartographic$9.longitude=CesiumMath.toRadians(e[n+1]),scratchCartographic$9.latitude=CesiumMath.toRadians(e[n+2]),scratchCartographic$9.height=e[n+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),i[n+1]=scratchCartesian$3.x,i[n+2]=scratchCartesian$3.y,i[n+3]=scratchCartesian$3.z;return i}function unwrapCartesianInterval(e){const t=e.cartesian;if(defined(t))return t;const i=e.cartesianVelocity;if(defined(i))return i;const n=e.unitCartesian;if(defined(n))return n;const r=e.unitSpherical;if(defined(r))return convertUnitSphericalToCartesian(r);const o=e.spherical;if(defined(o))return convertSphericalToCartesian(o);const a=e.cartographicRadians;if(defined(a))return convertCartographicRadiansToCartesian(a);const s=e.cartographicDegrees;if(defined(s))return convertCartographicDegreesToCartesian(s);throw new RuntimeError(`${JSON.stringify(e)} is not a valid CZML interval.`)}function normalizePackedCartesianArray(e,t){Cartesian3.unpack(e,t,scratchCartesian$3),Cartesian3.normalize(scratchCartesian$3,scratchCartesian$3),Cartesian3.pack(scratchCartesian$3,e,t)}function unwrapUnitCartesianInterval(e){const t=unwrapCartesianInterval(e);if(3===t.length)return normalizePackedCartesianArray(t,0),t;for(let e=1;e<t.length;e+=4)normalizePackedCartesianArray(t,e);return t}function normalizePackedQuaternionArray(e,t){Quaternion.unpack(e,t,scratchQuaternion),Quaternion.normalize(scratchQuaternion,scratchQuaternion),Quaternion.pack(scratchQuaternion,e,t)}function unwrapQuaternionInterval(e){const t=e.unitQuaternion;if(defined(t)){if(4===t.length)return normalizePackedQuaternionArray(t,0),t;for(let e=1;e<t.length;e+=5)normalizePackedQuaternionArray(t,e)}return t}function getPropertyType(e){return"boolean"==typeof e?Boolean:"number"==typeof e?Number:"string"==typeof e?String:e.hasOwnProperty("array")?Array:e.hasOwnProperty("boolean")?Boolean:e.hasOwnProperty("boundingRectangle")?BoundingRectangle:e.hasOwnProperty("cartesian2")?Cartesian2:e.hasOwnProperty("cartesian")||e.hasOwnProperty("spherical")||e.hasOwnProperty("cartographicRadians")||e.hasOwnProperty("cartographicDegrees")?Cartesian3:e.hasOwnProperty("unitCartesian")||e.hasOwnProperty("unitSpherical")?UnitCartesian3:e.hasOwnProperty("rgba")||e.hasOwnProperty("rgbaf")?Color:e.hasOwnProperty("arcType")?ArcType$1:e.hasOwnProperty("classificationType")?ClassificationType$1:e.hasOwnProperty("colorBlendMode")?ColorBlendMode$1:e.hasOwnProperty("cornerType")?CornerType$1:e.hasOwnProperty("heightReference")?HeightReference$1:e.hasOwnProperty("horizontalOrigin")?HorizontalOrigin$1:e.hasOwnProperty("date")?JulianDate:e.hasOwnProperty("labelStyle")?LabelStyle$1:e.hasOwnProperty("number")?Number:e.hasOwnProperty("nearFarScalar")?NearFarScalar:e.hasOwnProperty("distanceDisplayCondition")?DistanceDisplayCondition:e.hasOwnProperty("object")||e.hasOwnProperty("value")?Object:e.hasOwnProperty("unitQuaternion")?Quaternion:e.hasOwnProperty("shadowMode")?ShadowMode$1:e.hasOwnProperty("string")?String:e.hasOwnProperty("stripeOrientation")?StripeOrientation$1:e.hasOwnProperty("wsen")||e.hasOwnProperty("wsenDegrees")?Rectangle:e.hasOwnProperty("uri")?URI:e.hasOwnProperty("verticalOrigin")?VerticalOrigin$1:Object}function unwrapInterval(e,t,i){switch(e){case ArcType$1:return ArcType$1[defaultValue(t.arcType,t)];case Array:return t.array;case Boolean:return defaultValue(t.boolean,t);case BoundingRectangle:return t.boundingRectangle;case Cartesian2:return t.cartesian2;case Cartesian3:return unwrapCartesianInterval(t);case UnitCartesian3:return unwrapUnitCartesianInterval(t);case Color:return unwrapColorInterval(t);case ClassificationType$1:return ClassificationType$1[defaultValue(t.classificationType,t)];case ColorBlendMode$1:return ColorBlendMode$1[defaultValue(t.colorBlendMode,t)];case CornerType$1:return CornerType$1[defaultValue(t.cornerType,t)];case HeightReference$1:return HeightReference$1[defaultValue(t.heightReference,t)];case HorizontalOrigin$1:return HorizontalOrigin$1[defaultValue(t.horizontalOrigin,t)];case Image:return unwrapUriInterval(t,i);case JulianDate:return JulianDate.fromIso8601(defaultValue(t.date,t));case LabelStyle$1:return LabelStyle$1[defaultValue(t.labelStyle,t)];case Number:return defaultValue(t.number,t);case NearFarScalar:return t.nearFarScalar;case DistanceDisplayCondition:return t.distanceDisplayCondition;case Object:return defaultValue(defaultValue(t.object,t.value),t);case Quaternion:return unwrapQuaternionInterval(t);case Rotation:return defaultValue(t.number,t);case ShadowMode$1:return ShadowMode$1[defaultValue(defaultValue(t.shadowMode,t.shadows),t)];case String:return defaultValue(t.string,t);case StripeOrientation$1:return StripeOrientation$1[defaultValue(t.stripeOrientation,t)];case Rectangle:return unwrapRectangleInterval(t);case URI:return unwrapUriInterval(t,i);case VerticalOrigin$1:return VerticalOrigin$1[defaultValue(t.verticalOrigin,t)];default:throw new RuntimeError(e)}}const interpolators={HERMITE:HermitePolynomialApproximation,LAGRANGE:LagrangePolynomialApproximation,LINEAR:LinearApproximation};function updateInterpolationSettings(e,t){const i=e.interpolationAlgorithm,n=e.interpolationDegree;(defined(i)||defined(n))&&t.setInterpolationOptions({interpolationAlgorithm:interpolators[i],interpolationDegree:n});const r=e.forwardExtrapolationType;defined(r)&&(t.forwardExtrapolationType=ExtrapolationType$1[r]);const o=e.forwardExtrapolationDuration;defined(o)&&(t.forwardExtrapolationDuration=o);const a=e.backwardExtrapolationType;defined(a)&&(t.backwardExtrapolationType=ExtrapolationType$1[a]);const s=e.backwardExtrapolationDuration;defined(s)&&(t.backwardExtrapolationDuration=s)}const iso8601Scratch={iso8601:void 0};function intervalFromString(e){if(defined(e))return iso8601Scratch.iso8601=e,TimeInterval.fromIso8601(iso8601Scratch)}function wrapPropertyInInfiniteInterval(e){const t=Iso8601.MAXIMUM_INTERVAL.clone();return t.data=e,t}function convertPropertyToComposite(e){const t=new CompositeProperty;return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function convertPositionPropertyToComposite(e){const t=new CompositePositionProperty(e.referenceFrame);return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function processProperty(e,t,i,n,r,o,a){let s,c,l,u=intervalFromString(n.interval);defined(r)&&(u=defined(u)?TimeInterval.intersect(u,r,scratchTimeInterval$1):r);const d=!defined(n.reference)&&!defined(n.velocityReference),h=defined(u)&&!u.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===n.delete)return h?removePropertyData(t[i],u):void(t[i]=void 0);let p=!1;if(d){if(c=unwrapInterval(e,n,o),!defined(c))return;s=defaultValue(e.packedLength,1),l=defaultValue(c.length,1),p=!defined(n.array)&&"string"!=typeof c&&l>s&&e!==Object}const f="function"==typeof e.unpack&&e!==Rotation;if(!p&&!h)return void(t[i]=d?new ConstantProperty(f?e.unpack(c,0):c):createSpecializedProperty(e,a,n));let m,g=t[i];const _=n.epoch;if(defined(_)&&(m=JulianDate.fromIso8601(_)),p&&!h)return g instanceof SampledProperty||(t[i]=g=new SampledProperty(e)),g.addSamplesPackedArray(c,m),void updateInterpolationSettings(n,g);let y;if(!p&&h)return u=u.clone(),u.data=d?f?e.unpack(c,0):c:createSpecializedProperty(e,a,n),defined(g)||(t[i]=g=d?new TimeIntervalCollectionProperty:new CompositeProperty),void(d&&g instanceof TimeIntervalCollectionProperty?g.intervals.addInterval(u):g instanceof CompositeProperty?(d&&(u.data=new ConstantProperty(u.data)),g.intervals.addInterval(u)):(t[i]=g=convertPropertyToComposite(g),d&&(u.data=new ConstantProperty(u.data)),g.intervals.addInterval(u)));defined(g)||(t[i]=g=new CompositeProperty),g instanceof CompositeProperty||(t[i]=g=convertPropertyToComposite(g));const C=g.intervals;y=C.findInterval(u),defined(y)&&y.data instanceof SampledProperty||(y=u.clone(),y.data=new SampledProperty(e),C.addInterval(y)),y.data.addSamplesPackedArray(c,m),updateInterpolationSettings(n,y.data)}function removePropertyData(e,t){if(e instanceof SampledProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositeProperty){const i=e.intervals;for(let e=0;e<i.length;++e){const n=TimeInterval.intersect(i.get(e),t,scratchTimeInterval$1);n.isEmpty||removePropertyData(n.data,t)}i.removeInterval(t)}else;}function processPacketData(e,t,i,n,r,o,a){if(defined(n))if(Array.isArray(n))for(let s=0,c=n.length;s<c;++s)processProperty(e,t,i,n[s],r,o,a);else processProperty(e,t,i,n,r,o,a)}function processPositionProperty(e,t,i,n,r,o){let a=intervalFromString(i.interval);defined(n)&&(a=defined(a)?TimeInterval.intersect(a,n,scratchTimeInterval$1):n);const s=defined(i.cartesianVelocity)?1:0,c=Cartesian3.packedLength*(s+1);let l,u;const d=!defined(i.reference),h=defined(a)&&!a.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===i.delete)return h?removePositionPropertyData(e[t],a):void(e[t]=void 0);let p,f=!1;if(d&&(defined(i.referenceFrame)&&(p=ReferenceFrame$1[i.referenceFrame]),p=defaultValue(p,ReferenceFrame$1.FIXED),l=unwrapCartesianInterval(i),u=defaultValue(l.length,1),f=u>c),!f&&!h)return void(e[t]=d?new ConstantPositionProperty(Cartesian3.unpack(l),p):createReferenceProperty(o,i.reference));let m,g=e[t];const _=i.epoch;if(defined(_)&&(m=JulianDate.fromIso8601(_)),f&&!h)return g instanceof SampledPositionProperty&&(!defined(p)||g.referenceFrame===p)||(e[t]=g=new SampledPositionProperty(p,s)),g.addSamplesPackedArray(l,m),void updateInterpolationSettings(i,g);let y;if(!f&&h)return a=a.clone(),a.data=d?Cartesian3.unpack(l):createReferenceProperty(o,i.reference),defined(g)||(g=d?new TimeIntervalCollectionPositionProperty(p):new CompositePositionProperty(p),e[t]=g),void(d&&g instanceof TimeIntervalCollectionPositionProperty&&defined(p)&&g.referenceFrame===p?g.intervals.addInterval(a):g instanceof CompositePositionProperty?(d&&(a.data=new ConstantPositionProperty(a.data,p)),g.intervals.addInterval(a)):(e[t]=g=convertPositionPropertyToComposite(g),d&&(a.data=new ConstantPositionProperty(a.data,p)),g.intervals.addInterval(a)));defined(g)?g instanceof CompositePositionProperty||(e[t]=g=convertPositionPropertyToComposite(g)):e[t]=g=new CompositePositionProperty(p);const C=g.intervals;y=C.findInterval(a),defined(y)&&y.data instanceof SampledPositionProperty&&(!defined(p)||y.data.referenceFrame===p)||(y=a.clone(),y.data=new SampledPositionProperty(p,s),C.addInterval(y)),y.data.addSamplesPackedArray(l,m),updateInterpolationSettings(i,y.data)}function removePositionPropertyData(e,t){if(e instanceof SampledPositionProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionPositionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositePositionProperty){const i=e.intervals;for(let e=0;e<i.length;++e){const n=TimeInterval.intersect(i.get(e),t,scratchTimeInterval$1);n.isEmpty||removePositionPropertyData(n.data,t)}i.removeInterval(t)}else;}function processPositionPacketData(e,t,i,n,r,o){if(defined(i))if(Array.isArray(i))for(let a=0,s=i.length;a<s;++a)processPositionProperty(e,t,i[a],n,r,o);else processPositionProperty(e,t,i,n,r,o)}function processShapePacketData(e,t,i,n){defined(i.references)?processReferencesArrayPacketData(e,t,i.references,i.interval,n,PropertyArray,CompositeProperty):(defined(i.cartesian2)?i.array=Cartesian2.unpackArray(i.cartesian2):defined(i.cartesian)&&(i.array=Cartesian2.unpackArray(i.cartesian)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,n))}function processMaterialProperty(e,t,i,n,r,o){let a=intervalFromString(i.interval);defined(n)&&(a=defined(a)?TimeInterval.intersect(a,n,scratchTimeInterval$1):n);let s,c,l,u=e[t];if(defined(a)){u instanceof CompositeMaterialProperty||(u=new CompositeMaterialProperty,e[t]=u);const i=u.intervals;c=i.findInterval({start:a.start,stop:a.stop}),defined(c)?s=c.data:(c=a.clone(),i.addInterval(c))}else s=u;defined(i.solidColor)?(s instanceof ColorMaterialProperty||(s=new ColorMaterialProperty),l=i.solidColor,processPacketData(Color,s,"color",l.color,void 0,void 0,o)):defined(i.grid)?(s instanceof GridMaterialProperty||(s=new GridMaterialProperty),l=i.grid,processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Number,s,"cellAlpha",l.cellAlpha,void 0,r,o),processPacketData(Cartesian2,s,"lineCount",l.lineCount,void 0,r,o),processPacketData(Cartesian2,s,"lineThickness",l.lineThickness,void 0,r,o),processPacketData(Cartesian2,s,"lineOffset",l.lineOffset,void 0,r,o)):defined(i.image)?(s instanceof ImageMaterialProperty||(s=new ImageMaterialProperty),l=i.image,processPacketData(Image,s,"image",l.image,void 0,r,o),processPacketData(Cartesian2,s,"repeat",l.repeat,void 0,r,o),processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Boolean,s,"transparent",l.transparent,void 0,r,o)):defined(i.stripe)?(s instanceof StripeMaterialProperty||(s=new StripeMaterialProperty),l=i.stripe,processPacketData(StripeOrientation$1,s,"orientation",l.orientation,void 0,r,o),processPacketData(Color,s,"evenColor",l.evenColor,void 0,r,o),processPacketData(Color,s,"oddColor",l.oddColor,void 0,r,o),processPacketData(Number,s,"offset",l.offset,void 0,r,o),processPacketData(Number,s,"repeat",l.repeat,void 0,r,o)):defined(i.polylineOutline)?(s instanceof PolylineOutlineMaterialProperty||(s=new PolylineOutlineMaterialProperty),l=i.polylineOutline,processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Color,s,"outlineColor",l.outlineColor,void 0,r,o),processPacketData(Number,s,"outlineWidth",l.outlineWidth,void 0,r,o)):defined(i.polylineGlow)?(s instanceof PolylineGlowMaterialProperty||(s=new PolylineGlowMaterialProperty),l=i.polylineGlow,processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Number,s,"glowPower",l.glowPower,void 0,r,o),processPacketData(Number,s,"taperPower",l.taperPower,void 0,r,o)):defined(i.polylineArrow)?(s instanceof PolylineArrowMaterialProperty||(s=new PolylineArrowMaterialProperty),l=i.polylineArrow,processPacketData(Color,s,"color",l.color,void 0,void 0,o)):defined(i.polylineDash)?(s instanceof PolylineDashMaterialProperty||(s=new PolylineDashMaterialProperty),l=i.polylineDash,processPacketData(Color,s,"color",l.color,void 0,void 0,o),processPacketData(Color,s,"gapColor",l.gapColor,void 0,void 0,o),processPacketData(Number,s,"dashLength",l.dashLength,void 0,r,o),processPacketData(Number,s,"dashPattern",l.dashPattern,void 0,r,o)):defined(i.checkerboard)&&(s instanceof CheckerboardMaterialProperty||(s=new CheckerboardMaterialProperty),l=i.checkerboard,processPacketData(Color,s,"evenColor",l.evenColor,void 0,r,o),processPacketData(Color,s,"oddColor",l.oddColor,void 0,r,o),processPacketData(Cartesian2,s,"repeat",l.repeat,void 0,r,o)),defined(c)?c.data=s:e[t]=s}function processMaterialPacketData(e,t,i,n,r,o){if(defined(i))if(Array.isArray(i))for(let a=0,s=i.length;a<s;++a)processMaterialProperty(e,t,i[a],n,r,o);else processMaterialProperty(e,t,i,n,r,o)}function processName(e,t,i,n){defined(t.name)&&(e.name=t.name)}function processDescription$2(e,t,i,n){const r=t.description;defined(r)&&processPacketData(String,e,"description",r,void 0,n,i)}function processPosition(e,t,i,n){const r=t.position;defined(r)&&processPositionPacketData(e,"position",r,void 0,n,i)}function processViewFrom(e,t,i,n){const r=t.viewFrom;defined(r)&&processPacketData(Cartesian3,e,"viewFrom",r,void 0,n,i)}function processOrientation(e,t,i,n){const r=t.orientation;defined(r)&&processPacketData(Quaternion,e,"orientation",r,void 0,n,i)}function processProperties(e,t,i,n){const r=t.properties;if(defined(r)){defined(e.properties)||(e.properties=new PropertyBag);for(const t in r)if(r.hasOwnProperty(t)){e.properties.hasProperty(t)||e.properties.addProperty(t);const o=r[t];if(Array.isArray(o))for(let r=0,a=o.length;r<a;++r)processProperty(getPropertyType(o[r]),e.properties,t,o[r],void 0,n,i);else processProperty(getPropertyType(o),e.properties,t,o,void 0,n,i)}}}function processReferencesArrayPacketData(e,t,i,n,r,o,a){const s=i.map((function(e){return createReferenceProperty(r,e)}));if(defined(n)){n=intervalFromString(n);let i=e[t];if(!(i instanceof a)){const n=new a;n.intervals.addInterval(wrapPropertyInInfiniteInterval(i)),e[t]=i=n}n.data=new o(s),i.intervals.addInterval(n)}else e[t]=new o(s)}function processArrayPacketData(e,t,i,n){const r=i.references;defined(r)?processReferencesArrayPacketData(e,t,r,i.interval,n,PropertyArray,CompositeProperty):processPacketData(Array,e,t,i,void 0,void 0,n)}function processArray(e,t,i,n){if(defined(i))if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r)processArrayPacketData(e,t,i[r],n);else processArrayPacketData(e,t,i,n)}function processPositionArrayPacketData(e,t,i,n){const r=i.references;defined(r)?processReferencesArrayPacketData(e,t,r,i.interval,n,PositionPropertyArray,CompositePositionProperty):(defined(i.cartesian)?i.array=Cartesian3.unpackArray(i.cartesian):defined(i.cartographicRadians)?i.array=Cartesian3.fromRadiansArrayHeights(i.cartographicRadians):defined(i.cartographicDegrees)&&(i.array=Cartesian3.fromDegreesArrayHeights(i.cartographicDegrees)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,n))}function processPositionArray(e,t,i,n){if(defined(i))if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r)processPositionArrayPacketData(e,t,i[r],n);else processPositionArrayPacketData(e,t,i,n)}function unpackCartesianArray(e){return Cartesian3.unpackArray(e)}function unpackCartographicRadiansArray(e){return Cartesian3.fromRadiansArrayHeights(e)}function unpackCartographicDegreesArray(e){return Cartesian3.fromDegreesArrayHeights(e)}function processPositionArrayOfArraysPacketData(e,t,i,n){const r=i.references;if(defined(r)){const o=r.map((function(e){const t={};return processReferencesArrayPacketData(t,"positions",e,i.interval,n,PositionPropertyArray,CompositePositionProperty),t.positions}));e[t]=new PositionPropertyArray(o)}else defined(i.cartesian)?i.array=i.cartesian.map(unpackCartesianArray):defined(i.cartographicRadians)?i.array=i.cartographicRadians.map(unpackCartographicRadiansArray):defined(i.cartographicDegrees)&&(i.array=i.cartographicDegrees.map(unpackCartographicDegreesArray)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,n)}function processPositionArrayOfArrays(e,t,i,n){if(defined(i))if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r)processPositionArrayOfArraysPacketData(e,t,i[r],n);else processPositionArrayOfArraysPacketData(e,t,i,n)}function processShape(e,t,i,n){if(defined(i))if(Array.isArray(i))for(let r=0,o=i.length;r<o;r++)processShapePacketData(e,t,i[r],n);else processShapePacketData(e,t,i,n)}function processAvailability(e,t,i,n){const r=t.availability;if(!defined(r))return;let o;if(Array.isArray(r))for(let e=0,t=r.length;e<t;++e)defined(o)||(o=new TimeIntervalCollection),o.addInterval(intervalFromString(r[e]));else o=new TimeIntervalCollection,o.addInterval(intervalFromString(r));e.availability=o}function processAlignedAxis(e,t,i,n,r){defined(t)&&processPacketData(UnitCartesian3,e,"alignedAxis",t,i,n,r)}function processBillboard(e,t,i,n){const r=t.billboard;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.billboard;defined(a)||(e.billboard=a=new BillboardGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Image,a,"image",r.image,o,n,i),processPacketData(Number,a,"scale",r.scale,o,n,i),processPacketData(Cartesian2,a,"pixelOffset",r.pixelOffset,o,n,i),processPacketData(Cartesian3,a,"eyeOffset",r.eyeOffset,o,n,i),processPacketData(HorizontalOrigin$1,a,"horizontalOrigin",r.horizontalOrigin,o,n,i),processPacketData(VerticalOrigin$1,a,"verticalOrigin",r.verticalOrigin,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Color,a,"color",r.color,o,n,i),processPacketData(Rotation,a,"rotation",r.rotation,o,n,i),processAlignedAxis(a,r.alignedAxis,o,n,i),processPacketData(Boolean,a,"sizeInMeters",r.sizeInMeters,o,n,i),processPacketData(Number,a,"width",r.width,o,n,i),processPacketData(Number,a,"height",r.height,o,n,i),processPacketData(NearFarScalar,a,"scaleByDistance",r.scaleByDistance,o,n,i),processPacketData(NearFarScalar,a,"translucencyByDistance",r.translucencyByDistance,o,n,i),processPacketData(NearFarScalar,a,"pixelOffsetScaleByDistance",r.pixelOffsetScaleByDistance,o,n,i),processPacketData(BoundingRectangle,a,"imageSubRegion",r.imageSubRegion,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(Number,a,"disableDepthTestDistance",r.disableDepthTestDistance,o,n,i)}function processBox(e,t,i,n){const r=t.box;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.box;defined(a)||(e.box=a=new BoxGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Cartesian3,a,"dimensions",r.dimensions,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i)}function processCorridor(e,t,i,n){const r=t.corridor;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.corridor;defined(a)||(e.corridor=a=new CorridorGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPositionArray(a,"positions",r.positions,i),processPacketData(Number,a,"width",r.width,o,n,i),processPacketData(Number,a,"height",r.height,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,n,i),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,n,i),processPacketData(CornerType$1,a,"cornerType",r.cornerType,o,n,i),processPacketData(Number,a,"granularity",r.granularity,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,n,i),processPacketData(Number,a,"zIndex",r.zIndex,o,n,i)}function processCylinder(e,t,i,n){const r=t.cylinder;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.cylinder;defined(a)||(e.cylinder=a=new CylinderGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Number,a,"length",r.length,o,n,i),processPacketData(Number,a,"topRadius",r.topRadius,o,n,i),processPacketData(Number,a,"bottomRadius",r.bottomRadius,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(Number,a,"numberOfVerticalLines",r.numberOfVerticalLines,o,n,i),processPacketData(Number,a,"slices",r.slices,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i)}function processDocument$1(e,t){const i=e.version;if(defined(i)&&"string"==typeof i){const e=i.split(".");if(2===e.length){if("1"!==e[0])throw new RuntimeError("Cesium only supports CZML version 1.");t._version=i}}if(!defined(t._version))throw new RuntimeError("CZML version information invalid. It is expected to be a property on the document object in the <Major>.<Minor> version format.");const n=t._documentPacket;defined(e.name)&&(n.name=e.name);const r=e.clock;if(defined(r)){const e=n.clock;defined(e)?(e.interval=defaultValue(r.interval,e.interval),e.currentTime=defaultValue(r.currentTime,e.currentTime),e.range=defaultValue(r.range,e.range),e.step=defaultValue(r.step,e.step),e.multiplier=defaultValue(r.multiplier,e.multiplier)):n.clock={interval:r.interval,currentTime:r.currentTime,range:r.range,step:r.step,multiplier:r.multiplier}}}function processEllipse(e,t,i,n){const r=t.ellipse;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.ellipse;defined(a)||(e.ellipse=a=new EllipseGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Number,a,"semiMajorAxis",r.semiMajorAxis,o,n,i),processPacketData(Number,a,"semiMinorAxis",r.semiMinorAxis,o,n,i),processPacketData(Number,a,"height",r.height,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,n,i),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,n,i),processPacketData(Rotation,a,"rotation",r.rotation,o,n,i),processPacketData(Rotation,a,"stRotation",r.stRotation,o,n,i),processPacketData(Number,a,"granularity",r.granularity,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(Number,a,"numberOfVerticalLines",r.numberOfVerticalLines,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,n,i),processPacketData(Number,a,"zIndex",r.zIndex,o,n,i)}function processEllipsoid(e,t,i,n){const r=t.ellipsoid;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.ellipsoid;defined(a)||(e.ellipsoid=a=new EllipsoidGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Cartesian3,a,"radii",r.radii,o,n,i),processPacketData(Cartesian3,a,"innerRadii",r.innerRadii,o,n,i),processPacketData(Number,a,"minimumClock",r.minimumClock,o,n,i),processPacketData(Number,a,"maximumClock",r.maximumClock,o,n,i),processPacketData(Number,a,"minimumCone",r.minimumCone,o,n,i),processPacketData(Number,a,"maximumCone",r.maximumCone,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(Number,a,"stackPartitions",r.stackPartitions,o,n,i),processPacketData(Number,a,"slicePartitions",r.slicePartitions,o,n,i),processPacketData(Number,a,"subdivisions",r.subdivisions,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i)}function processLabel(e,t,i,n){const r=t.label;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.label;defined(a)||(e.label=a=new LabelGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(String,a,"text",r.text,o,n,i),processPacketData(String,a,"font",r.font,o,n,i),processPacketData(LabelStyle$1,a,"style",r.style,o,n,i),processPacketData(Number,a,"scale",r.scale,o,n,i),processPacketData(Boolean,a,"showBackground",r.showBackground,o,n,i),processPacketData(Color,a,"backgroundColor",r.backgroundColor,o,n,i),processPacketData(Cartesian2,a,"backgroundPadding",r.backgroundPadding,o,n,i),processPacketData(Cartesian2,a,"pixelOffset",r.pixelOffset,o,n,i),processPacketData(Cartesian3,a,"eyeOffset",r.eyeOffset,o,n,i),processPacketData(HorizontalOrigin$1,a,"horizontalOrigin",r.horizontalOrigin,o,n,i),processPacketData(VerticalOrigin$1,a,"verticalOrigin",r.verticalOrigin,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Color,a,"fillColor",r.fillColor,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(NearFarScalar,a,"translucencyByDistance",r.translucencyByDistance,o,n,i),processPacketData(NearFarScalar,a,"pixelOffsetScaleByDistance",r.pixelOffsetScaleByDistance,o,n,i),processPacketData(NearFarScalar,a,"scaleByDistance",r.scaleByDistance,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(Number,a,"disableDepthTestDistance",r.disableDepthTestDistance,o,n,i)}function processModel(e,t,i,n){const r=t.model;if(!defined(r))return;const o=intervalFromString(r.interval);let a,s,c=e.model;defined(c)||(e.model=c=new ModelGraphics),processPacketData(Boolean,c,"show",r.show,o,n,i),processPacketData(URI,c,"uri",r.gltf,o,n,i),processPacketData(Number,c,"scale",r.scale,o,n,i),processPacketData(Number,c,"minimumPixelSize",r.minimumPixelSize,o,n,i),processPacketData(Number,c,"maximumScale",r.maximumScale,o,n,i),processPacketData(Boolean,c,"incrementallyLoadTextures",r.incrementallyLoadTextures,o,n,i),processPacketData(Boolean,c,"runAnimations",r.runAnimations,o,n,i),processPacketData(Boolean,c,"clampAnimations",r.clampAnimations,o,n,i),processPacketData(ShadowMode$1,c,"shadows",r.shadows,o,n,i),processPacketData(HeightReference$1,c,"heightReference",r.heightReference,o,n,i),processPacketData(Color,c,"silhouetteColor",r.silhouetteColor,o,n,i),processPacketData(Number,c,"silhouetteSize",r.silhouetteSize,o,n,i),processPacketData(Color,c,"color",r.color,o,n,i),processPacketData(ColorBlendMode$1,c,"colorBlendMode",r.colorBlendMode,o,n,i),processPacketData(Number,c,"colorBlendAmount",r.colorBlendAmount,o,n,i),processPacketData(DistanceDisplayCondition,c,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i);const l=r.nodeTransformations;if(defined(l))if(Array.isArray(l))for(a=0,s=l.length;a<s;++a)processNodeTransformations(c,l[a],o,n,i);else processNodeTransformations(c,l,o,n,i);const u=r.articulations;if(defined(u))if(Array.isArray(u))for(a=0,s=u.length;a<s;++a)processArticulations(c,u[a],o,n,i);else processArticulations(c,u,o,n,i)}function processNodeTransformations(e,t,i,n,r){let o=intervalFromString(t.interval);defined(i)&&(o=defined(o)?TimeInterval.intersect(o,i,scratchTimeInterval$1):i);let a=e.nodeTransformations;const s=Object.keys(t);for(let i=0,c=s.length;i<c;++i){const c=s[i];if("interval"===c)continue;const l=t[c];if(!defined(l))continue;defined(a)||(e.nodeTransformations=a=new PropertyBag),a.hasProperty(c)||a.addProperty(c);let u=a[c];defined(u)||(a[c]=u=new NodeTransformationProperty),processPacketData(Cartesian3,u,"translation",l.translation,o,n,r),processPacketData(Quaternion,u,"rotation",l.rotation,o,n,r),processPacketData(Cartesian3,u,"scale",l.scale,o,n,r)}}function processArticulations(e,t,i,n,r){let o=intervalFromString(t.interval);defined(i)&&(o=defined(o)?TimeInterval.intersect(o,i,scratchTimeInterval$1):i);let a=e.articulations;const s=Object.keys(t);for(let i=0,c=s.length;i<c;++i){const c=s[i];if("interval"===c)continue;const l=t[c];defined(l)&&(defined(a)||(e.articulations=a=new PropertyBag),a.hasProperty(c)||a.addProperty(c),processPacketData(Number,a,c,l,o,n,r))}}function processPath(e,t,i,n){const r=t.path;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.path;defined(a)||(e.path=a=new PathGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Number,a,"leadTime",r.leadTime,o,n,i),processPacketData(Number,a,"trailTime",r.trailTime,o,n,i),processPacketData(Number,a,"width",r.width,o,n,i),processPacketData(Number,a,"resolution",r.resolution,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i)}function processPoint$2(e,t,i,n){const r=t.point;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.point;defined(a)||(e.point=a=new PointGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Number,a,"pixelSize",r.pixelSize,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Color,a,"color",r.color,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(NearFarScalar,a,"scaleByDistance",r.scaleByDistance,o,n,i),processPacketData(NearFarScalar,a,"translucencyByDistance",r.translucencyByDistance,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(Number,a,"disableDepthTestDistance",r.disableDepthTestDistance,o,n,i)}function PolygonHierarchyProperty(e){this.polygon=e,this._definitionChanged=new Event}function processPolygon$2(e,t,i,n){const r=t.polygon;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.polygon;defined(a)||(e.polygon=a=new PolygonGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPositionArray(a,"_positions",r.positions,i),processPositionArrayOfArrays(a,"_holes",r.holes,i),(defined(a._positions)||defined(a._holes))&&(a.hierarchy=new PolygonHierarchyProperty(a)),processPacketData(Number,a,"height",r.height,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,n,i),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,n,i),processPacketData(Rotation,a,"stRotation",r.stRotation,o,n,i),processPacketData(Number,a,"granularity",r.granularity,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(Boolean,a,"perPositionHeight",r.perPositionHeight,o,n,i),processPacketData(Boolean,a,"closeTop",r.closeTop,o,n,i),processPacketData(Boolean,a,"closeBottom",r.closeBottom,o,n,i),processPacketData(ArcType$1,a,"arcType",r.arcType,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,n,i),processPacketData(Number,a,"zIndex",r.zIndex,o,n,i)}function adaptFollowSurfaceToArcType(e){return e?ArcType$1.GEODESIC:ArcType$1.NONE}function processPolyline(e,t,i,n){const r=t.polyline;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.polyline;if(defined(a)||(e.polyline=a=new PolylineGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPositionArray(a,"positions",r.positions,i),processPacketData(Number,a,"width",r.width,o,n,i),processPacketData(Number,a,"granularity",r.granularity,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processMaterialPacketData(a,"depthFailMaterial",r.depthFailMaterial,o,n,i),processPacketData(ArcType$1,a,"arcType",r.arcType,o,n,i),processPacketData(Boolean,a,"clampToGround",r.clampToGround,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,n,i),processPacketData(Number,a,"zIndex",r.zIndex,o,n,i),defined(r.followSurface)&&!defined(r.arcType)){const e={};processPacketData(Boolean,e,"followSurface",r.followSurface,o,n,i),a.arcType=createAdapterProperty(e.followSurface,adaptFollowSurfaceToArcType)}}function processPolylineVolume(e,t,i,n){const r=t.polylineVolume;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.polylineVolume;defined(a)||(e.polylineVolume=a=new PolylineVolumeGraphics),processPositionArray(a,"positions",r.positions,i),processShape(a,"shape",r.shape,i),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(CornerType$1,a,"cornerType",r.cornerType,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(Number,a,"granularity",r.granularity,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i)}function processRectangle(e,t,i,n){const r=t.rectangle;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.rectangle;defined(a)||(e.rectangle=a=new RectangleGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(Rectangle,a,"coordinates",r.coordinates,o,n,i),processPacketData(Number,a,"height",r.height,o,n,i),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,n,i),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,n,i),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,n,i),processPacketData(Rotation,a,"rotation",r.rotation,o,n,i),processPacketData(Rotation,a,"stRotation",r.stRotation,o,n,i),processPacketData(Number,a,"granularity",r.granularity,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,n,i),processPacketData(Number,a,"zIndex",r.zIndex,o,n,i)}function processTileset(e,t,i,n){const r=t.tileset;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.tileset;defined(a)||(e.tileset=a=new Cesium3DTilesetGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPacketData(URI,a,"uri",r.uri,o,n,i),processPacketData(Number,a,"maximumScreenSpaceError",r.maximumScreenSpaceError,o,n,i)}function processWall(e,t,i,n){const r=t.wall;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.wall;defined(a)||(e.wall=a=new WallGraphics),processPacketData(Boolean,a,"show",r.show,o,n,i),processPositionArray(a,"positions",r.positions,i),processArray(a,"minimumHeights",r.minimumHeights,i),processArray(a,"maximumHeights",r.maximumHeights,i),processPacketData(Number,a,"granularity",r.granularity,o,n,i),processPacketData(Boolean,a,"fill",r.fill,o,n,i),processMaterialPacketData(a,"material",r.material,o,n,i),processPacketData(Boolean,a,"outline",r.outline,o,n,i),processPacketData(Color,a,"outlineColor",r.outlineColor,o,n,i),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,n,i),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,n,i),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,n,i)}function processCzmlPacket(e,t,i,n,r){let o=e.id;if(defined(o)||(o=createGuid()),currentId=o,!defined(r._version)&&"document"!==o)throw new RuntimeError("The first CZML packet is required to be the document object.");if(!0===e.delete)t.removeById(o);else if("document"===o)processDocument$1(e,r);else{const r=t.getOrCreateEntity(o),a=e.parent;defined(a)&&(r.parent=t.getOrCreateEntity(a));for(let o=i.length-1;o>-1;o--)i[o](r,e,t,n)}currentId=void 0}function updateClock(e){let t;const i=e._documentPacket.clock;if(!defined(i)){if(!defined(e._clock)){const i=e._entityCollection.computeAvailability();if(!i.start.equals(Iso8601.MINIMUM_VALUE)){const n=i.start,r=i.stop,o=JulianDate.secondsDifference(r,n),a=Math.round(o/120);return t=new DataSourceClock,t.startTime=JulianDate.clone(n),t.stopTime=JulianDate.clone(r),t.clockRange=ClockRange$1.LOOP_STOP,t.multiplier=a,t.currentTime=JulianDate.clone(n),t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}defined(e._clock)?t=e._clock.clone():(t=new DataSourceClock,t.startTime=Iso8601.MINIMUM_VALUE.clone(),t.stopTime=Iso8601.MAXIMUM_VALUE.clone(),t.currentTime=Iso8601.MINIMUM_VALUE.clone(),t.clockRange=ClockRange$1.LOOP_STOP,t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1);const n=intervalFromString(i.interval);return defined(n)&&(t.startTime=n.start,t.stopTime=n.stop),defined(i.currentTime)&&(t.currentTime=JulianDate.fromIso8601(i.currentTime)),defined(i.range)&&(t.clockRange=defaultValue(ClockRange$1[i.range],ClockRange$1.LOOP_STOP)),defined(i.step)&&(t.clockStep=defaultValue(ClockStep$1[i.step],ClockStep$1.SYSTEM_CLOCK_MULTIPLIER)),defined(i.multiplier)&&(t.multiplier=i.multiplier),!t.equals(e._clock)&&(e._clock=t.clone(e._clock),!0)}function load$3(e,t,i,n){let r=t,o=(i=defaultValue(i,defaultValue.EMPTY_OBJECT)).sourceUri,a=i.credit;if("string"==typeof a&&(a=new Credit(a)),e._credit=a,"string"==typeof t||t instanceof Resource){r=(t=Resource.createIfNeeded(t)).fetchJson(),o=defaultValue(o,t.clone());const i=e._resourceCredits,n=t.credits;if(defined(n)){const e=n.length;for(let t=0;t<e;t++)i.push(n[t])}}return o=Resource.createIfNeeded(o),DataSource.setLoading(e,!0),Promise.resolve(r).then((function(t){return loadCzml(e,t,o,n)})).catch((function(t){return DataSource.setLoading(e,!1),e._error.raiseEvent(e,t),console.log(t),Promise.reject(t)}))}function loadCzml(e,t,i,n){DataSource.setLoading(e,!0);const r=e._entityCollection;n&&(e._version=void 0,e._documentPacket=new DocumentPacket,r.removeAll()),CzmlDataSource._processCzml(t,r,i,void 0,e);let o=updateClock(e);const a=e._documentPacket;return defined(a.name)&&e._name!==a.name?(e._name=a.name,o=!0):!defined(e._name)&&defined(i)&&(e._name=getFilenameFromUri(i.getUrlComponent()),o=!0),DataSource.setLoading(e,!1),o&&e._changed.raiseEvent(e),e}function DocumentPacket(){this.name=void 0,this.clock=void 0}function CzmlDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._clock=void 0,this._documentPacket=new DocumentPacket,this._version=void 0,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function DataSourceCollection(){this._dataSources=[],this._dataSourceAdded=new Event,this._dataSourceRemoved=new Event,this._dataSourceMoved=new Event}function getIndex(e,t){return e.indexOf(t)}function swapDataSources(e,t,i){const n=e._dataSources,r=n.length-1;if((t=CesiumMath.clamp(t,0,r))===(i=CesiumMath.clamp(i,0,r)))return;const o=n[t];n[t]=n[i],n[i]=o,e.dataSourceMoved.raiseEvent(o,i,t)}function PrimitiveCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._primitives=[],this._guid=createGuid(),this._zIndex=void 0,this.show=defaultValue(e.show,!0),this.destroyPrimitives=defaultValue(e.destroyPrimitives,!0)}function getPrimitiveIndex(e,t){return e._primitives.indexOf(t)}function OrderedGroundPrimitiveCollection(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}function DynamicGeometryBatch(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new AssociativeArray}Object.defineProperties(PolygonHierarchyProperty.prototype,{isConstant:{get:function(){const e=this.polygon._positions,t=this.polygon._holes;return(!defined(e)||e.isConstant)&&(!defined(t)||t.isConstant)}},definitionChanged:{get:function(){return this._definitionChanged}}}),PolygonHierarchyProperty.prototype.getValue=function(e,t){let i,n;return defined(this.polygon._positions)&&(i=this.polygon._positions.getValue(e)),defined(this.polygon._holes)&&(n=this.polygon._holes.getValue(e),defined(n)&&(n=n.map((function(e){return new PolygonHierarchy(e)})))),defined(t)?(t.positions=i,t.holes=n,t):new PolygonHierarchy(i,n)},PolygonHierarchyProperty.prototype.equals=function(e){return this===e||e instanceof PolygonHierarchyProperty&&Property.equals(this.polygon._positions,e.polygon._positions)&&Property.equals(this.polygon._holes,e.polygon._holes)},CzmlDataSource.load=function(e,t){return(new CzmlDataSource).load(e,t)},Object.defineProperties(CzmlDataSource.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),CzmlDataSource.updaters=[processBillboard,processBox,processCorridor,processCylinder,processEllipse,processEllipsoid,processLabel,processModel,processName,processDescription$2,processPath,processPoint$2,processPolygon$2,processPolyline,processPolylineVolume,processProperties,processRectangle,processPosition,processTileset,processViewFrom,processWall,processOrientation,processAvailability],CzmlDataSource.prototype.process=function(e,t){return load$3(this,e,t,!1)},CzmlDataSource.prototype.load=function(e,t){return load$3(this,e,t,!0)},CzmlDataSource.prototype.update=function(e){return!0},CzmlDataSource.processPacketData=processPacketData,CzmlDataSource.processPositionPacketData=processPositionPacketData,CzmlDataSource.processMaterialPacketData=processMaterialPacketData,CzmlDataSource._processCzml=function(e,t,i,n,r){if(n=defaultValue(n,CzmlDataSource.updaters),Array.isArray(e))for(let o=0,a=e.length;o<a;++o)processCzmlPacket(e[o],t,n,i,r);else processCzmlPacket(e,t,n,i,r)},Object.defineProperties(DataSourceCollection.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}},dataSourceMoved:{get:function(){return this._dataSourceMoved}}}),DataSourceCollection.prototype.add=function(e){const t=this,i=this._dataSources;return Promise.resolve(e).then((function(e){return i===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e}))},DataSourceCollection.prototype.remove=function(e,t){t=defaultValue(t,!1);const i=this._dataSources.indexOf(e);return-1!==i&&(this._dataSources.splice(i,1),this._dataSourceRemoved.raiseEvent(this,e),t&&"function"==typeof e.destroy&&e.destroy(),!0)},DataSourceCollection.prototype.removeAll=function(e){e=defaultValue(e,!1);const t=this._dataSources;for(let i=0,n=t.length;i<n;++i){const n=t[i];this._dataSourceRemoved.raiseEvent(this,n),e&&"function"==typeof n.destroy&&n.destroy()}this._dataSources=[]},DataSourceCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},DataSourceCollection.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},DataSourceCollection.prototype.get=function(e){return this._dataSources[e]},DataSourceCollection.prototype.getByName=function(e){return this._dataSources.filter((function(t){return t.name===e}))},DataSourceCollection.prototype.raise=function(e){const t=getIndex(this._dataSources,e);swapDataSources(this,t,t+1)},DataSourceCollection.prototype.lower=function(e){const t=getIndex(this._dataSources,e);swapDataSources(this,t,t-1)},DataSourceCollection.prototype.raiseToTop=function(e){const t=getIndex(this._dataSources,e);t!==this._dataSources.length-1&&(this._dataSources.splice(t,1),this._dataSources.push(e),this.dataSourceMoved.raiseEvent(e,this._dataSources.length-1,t))},DataSourceCollection.prototype.lowerToBottom=function(e){const t=getIndex(this._dataSources,e);0!==t&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))},DataSourceCollection.prototype.isDestroyed=function(){return!1},DataSourceCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},Object.defineProperties(PrimitiveCollection.prototype,{length:{get:function(){return this._primitives.length}}}),PrimitiveCollection.prototype.add=function(e,t,i){t&&t instanceof TimeIntervalCollection?(e._availability=t,e.isAvailable=function(e){const t=this._availability;return!defined(t)||t.contains(e)}):t&&"number"==typeof t&&(i=t);const n=defined(i),r=e._external=e._external||{};return(r._composites=r._composites||{})[this._guid]={collection:this},n?this._primitives.splice(i,0,e):this._primitives.push(e),e},PrimitiveCollection.prototype.remove=function(e){if(this.contains(e)){const t=this._primitives.indexOf(e);if(-1!==t)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),!0}return!1},PrimitiveCollection.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},PrimitiveCollection.prototype.removeAll=function(){const e=this._primitives,t=e.length;for(let i=0;i<t;++i)delete e[i]._external._composites[this._guid],this.destroyPrimitives&&e[i].destroy();this._primitives=[]},PrimitiveCollection.prototype.contains=function(e){return!!(defined(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},PrimitiveCollection.prototype.raise=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),i=this._primitives;if(t!==i.length-1){const e=i[t];i[t]=i[t+1],i[t+1]=e}}},PrimitiveCollection.prototype.raiseToTop=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),i=this._primitives;t!==i.length-1&&(i.splice(t,1),i.push(e))}},PrimitiveCollection.prototype.lower=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),i=this._primitives;if(0!==t){const e=i[t];i[t]=i[t-1],i[t-1]=e}}},PrimitiveCollection.prototype.lowerToBottom=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),i=this._primitives;0!==t&&(i.splice(t,1),i.unshift(e))}},PrimitiveCollection.prototype.get=function(e){return this._primitives[e]},PrimitiveCollection.prototype.update=function(e){if(!this.show)return;const t=this._primitives;for(let i=0;i<t.length;++i)t[i]&&t[i]._availability&&(t[i].show=t[i].isAvailable(e.time)),t[i].update(e)},PrimitiveCollection.prototype.prePassesUpdate=function(e){const t=this._primitives;for(let i=0;i<t.length;++i){const n=t[i];defined(n.prePassesUpdate)&&n.prePassesUpdate(e)}},PrimitiveCollection.prototype.updateForPass=function(e,t){const i=this._primitives;for(let n=0;n<i.length;++n){const r=i[n];defined(r.updateForPass)&&r.updateForPass(e,t)}},PrimitiveCollection.prototype.postPassesUpdate=function(e){const t=this._primitives;for(let i=0;i<t.length;++i){const n=t[i];defined(n.postPassesUpdate)&&n.postPassesUpdate(e)}},PrimitiveCollection.prototype.isDestroyed=function(){return!1},PrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},Object.defineProperties(OrderedGroundPrimitiveCollection.prototype,{length:{get:function(){return this._length}}}),OrderedGroundPrimitiveCollection.prototype.add=function(e,t){t=defaultValue(t,0);let i=this._collections[t];if(!defined(i)){i=new PrimitiveCollection({destroyPrimitives:!1}),i._zIndex=t,this._collections[t]=i;const e=this._collectionsArray;let n=0;for(;n<e.length&&e[n]._zIndex<t;)n++;e.splice(n,0,i)}return i.add(e),this._length++,e._zIndex=t,e},OrderedGroundPrimitiveCollection.prototype.set=function(e,t){return t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e},OrderedGroundPrimitiveCollection.prototype.remove=function(e,t){if(this.contains(e)){const i=e._zIndex,n=this._collections[i];let r;return r=t?n.remove(e):n.removeAndDestroy(e),r&&this._length--,0===n.length&&(this._collectionsArray.splice(this._collectionsArray.indexOf(n),1),this._collections[i]=void 0,n.destroy()),r}return!1},OrderedGroundPrimitiveCollection.prototype.removeAll=function(){const e=this._collectionsArray;for(let t=0;t<e.length;t++){const i=e[t];i.destroyPrimitives=!0,i.destroy()}this._collections={},this._collectionsArray=[],this._length=0},OrderedGroundPrimitiveCollection.prototype.contains=function(e){if(!defined(e))return!1;const t=this._collections[e._zIndex];return defined(t)&&t.contains(e)},OrderedGroundPrimitiveCollection.prototype.update=function(e){if(!this.show)return;const t=this._collectionsArray;for(let i=0;i<t.length;i++)t[i].update(e)},OrderedGroundPrimitiveCollection.prototype.isDestroyed=function(){return!1},OrderedGroundPrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},DynamicGeometryBatch.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))},DynamicGeometryBatch.prototype.remove=function(e){const t=e.id,i=this._dynamicUpdaters.get(t);defined(i)&&(this._dynamicUpdaters.remove(t),i.destroy())},DynamicGeometryBatch.prototype.update=function(e){const t=this._dynamicUpdaters.values;for(let i=0,n=t.length;i<n;i++)t[i].update(e);return!0},DynamicGeometryBatch.prototype.removeAllPrimitives=function(){const e=this._dynamicUpdaters.values;for(let t=0,i=e.length;t<i;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},DynamicGeometryBatch.prototype.getBoundingSphere=function(e,t){return defined(e=this._dynamicUpdaters.get(e.id))&&defined(e.getBoundingSphere)?e.getBoundingSphere(t):BoundingSphereState$1.FAILED};const scratchColor$b=new Color,defaultOffset$6=Cartesian3.ZERO,offsetScratch$6=new Cartesian3,scratchRectangle$3=new Rectangle;function EllipseGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function EllipseGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipseGeometryOptions(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}function DynamicEllipseGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(EllipseGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),EllipseGeometryUpdater.prototype.constructor=EllipseGeometryUpdater),EllipseGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$b)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$6))),new GeometryInstance({id:t,geometry:new EllipseGeometry(this._options),attributes:n})},EllipseGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$b),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$6))),new GeometryInstance({id:t,geometry:new EllipseOutlineGeometry(this._options),attributes:o})},EllipseGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipseGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.semiMajorAxis)||!defined(t.semiMinorAxis)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipseGeometryUpdater.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!Property.isConstant(t.rotation)||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.numberOfVerticalLines)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},EllipseGeometryUpdater.prototype._setStaticOptions=function(e,t){let i=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const n=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let r=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const o=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(r)&&!defined(i)&&(i=0);const a=this._options;a.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,a.center=e.position.getValue(Iso8601.MINIMUM_VALUE,a.center),a.semiMajorAxis=t.semiMajorAxis.getValue(Iso8601.MINIMUM_VALUE,a.semiMajorAxis),a.semiMinorAxis=t.semiMinorAxis.getValue(Iso8601.MINIMUM_VALUE,a.semiMinorAxis),a.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),a.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),a.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),a.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),a.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(i,n,r,o),a.height=GroundGeometryUpdater.getGeometryHeight(i,n),r=GroundGeometryUpdater.getGeometryExtrudedHeight(r,o),r===GroundGeometryUpdater.CLAMP_TO_GROUND&&(r=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(a,scratchRectangle$3)).minimumTerrainHeight),a.extrudedHeight=r},EllipseGeometryUpdater.DynamicGeometryUpdater=DynamicEllipseGeometryUpdater,defined(Object.create)&&(DynamicEllipseGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicEllipseGeometryUpdater.prototype.constructor=DynamicEllipseGeometryUpdater),DynamicEllipseGeometryUpdater.prototype._isHidden=function(e,t,i){const n=this._options;return!defined(n.center)||!defined(n.semiMajorAxis)||!defined(n.semiMinorAxis)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicEllipseGeometryUpdater.prototype._setOptions=function(e,t,i){const n=this._options;let r=Property.getValueOrUndefined(t.height,i);const o=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE);let a=Property.getValueOrUndefined(t.extrudedHeight,i);const s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0),n.center=Property.getValueOrUndefined(e.position,i,n.center),n.semiMajorAxis=Property.getValueOrUndefined(t.semiMajorAxis,i),n.semiMinorAxis=Property.getValueOrUndefined(t.semiMinorAxis,i),n.rotation=Property.getValueOrUndefined(t.rotation,i),n.granularity=Property.getValueOrUndefined(t.granularity,i),n.stRotation=Property.getValueOrUndefined(t.stRotation,i),n.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,i),n.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,a,s),n.height=GroundGeometryUpdater.getGeometryHeight(r,o),a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,s),a===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(n,scratchRectangle$3)).minimumTerrainHeight),n.extrudedHeight=a};const defaultMaterial$1=new ColorMaterialProperty(Color.WHITE),defaultOffset$5=Cartesian3.ZERO,offsetScratch$5=new Cartesian3,radiiScratch=new Cartesian3,innerRadiiScratch=new Cartesian3,scratchColor$a=new Color,unitSphere=new Cartesian3(1,1,1);function EllipsoidGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.innerRadii=void 0,this.minimumClock=void 0,this.maximumClock=void 0,this.minimumCone=void 0,this.maximumCone=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0,this.offsetAttribute=void 0}function EllipsoidGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipsoidGeometryOptions(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}function DynamicEllipsoidGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i),this._scene=e._scene,this._modelMatrix=new Matrix4,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0,this._lastOffset=new Cartesian3,this._material={}}defined(Object.create)&&(EllipsoidGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),EllipsoidGeometryUpdater.prototype.constructor=EllipsoidGeometryUpdater),Object.defineProperties(EllipsoidGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),EllipsoidGeometryUpdater.prototype.createFillGeometryInstance=function(e,t,i){const n=this._entity,r=n.isAvailable(e);let o;const a=new ShowGeometryInstanceAttribute(r&&n.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),c={show:a,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(s),color:void 0,offset:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$a)),defined(t)||(t=Color.WHITE),o=ColorGeometryInstanceAttribute.fromColor(t),c.color=o}return defined(this._options.offsetAttribute)&&(c.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5))),new GeometryInstance({id:n,geometry:new EllipsoidGeometry(this._options),modelMatrix:t?void 0:n.computeModelMatrixForHeightReference(e,n.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,i),attributes:c})},EllipsoidGeometryUpdater.prototype.createOutlineGeometryInstance=function(e,t,i){const n=this._entity,r=n.isAvailable(e),o=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$a),a=this._distanceDisplayConditionProperty.getValue(e),s={show:new ShowGeometryInstanceAttribute(r&&n.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(o),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),offset:void 0};return defined(this._options.offsetAttribute)&&(s.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5))),new GeometryInstance({id:n,geometry:new EllipsoidOutlineGeometry(this._options),modelMatrix:t?void 0:n.computeModelMatrixForHeightReference(e,n.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,i),attributes:s})},EllipsoidGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipsoidGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.radii)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipsoidGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.radii.isConstant&&Property.isConstant(t.innerRadii)&&Property.isConstant(t.stackPartitions)&&Property.isConstant(t.slicePartitions)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.minimumClock)&&Property.isConstant(t.maximumClock)&&Property.isConstant(t.minimumCone)&&Property.isConstant(t.maximumCone)&&Property.isConstant(t.subdivisions))},EllipsoidGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),n=this._options;n.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,n.radii=t.radii.getValue(Iso8601.MINIMUM_VALUE,n.radii),n.innerRadii=Property.getValueOrUndefined(t.innerRadii,n.radii),n.minimumClock=Property.getValueOrUndefined(t.minimumClock,Iso8601.MINIMUM_VALUE),n.maximumClock=Property.getValueOrUndefined(t.maximumClock,Iso8601.MINIMUM_VALUE),n.minimumCone=Property.getValueOrUndefined(t.minimumCone,Iso8601.MINIMUM_VALUE),n.maximumCone=Property.getValueOrUndefined(t.maximumCone,Iso8601.MINIMUM_VALUE),n.stackPartitions=Property.getValueOrUndefined(t.stackPartitions,Iso8601.MINIMUM_VALUE),n.slicePartitions=Property.getValueOrUndefined(t.slicePartitions,Iso8601.MINIMUM_VALUE),n.subdivisions=Property.getValueOrUndefined(t.subdivisions,Iso8601.MINIMUM_VALUE),n.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},EllipsoidGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,EllipsoidGeometryUpdater.DynamicGeometryUpdater=DynamicEllipsoidGeometryUpdater,defined(Object.create)&&(DynamicEllipsoidGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicEllipsoidGeometryUpdater.prototype.constructor=DynamicEllipsoidGeometryUpdater),DynamicEllipsoidGeometryUpdater.prototype.update=function(e){const t=this._entity,i=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!Property.getValueOrDefault(i.show,e,!0))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));const n=Property.getValueOrUndefined(i.radii,e,radiiScratch);let r=defined(n)?t.computeModelMatrixForHeightReference(e,i.heightReference,.5*n.z,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!defined(r)||!defined(n))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));const o=Property.getValueOrDefault(i.fill,e,!0),a=Property.getValueOrDefault(i.outline,e,!1),s=Property.getValueOrClonedDefault(i.outlineColor,e,Color.BLACK,scratchColor$a),c=MaterialProperty.getValue(e,defaultValue(i.material,defaultMaterial$1),this._material),l=Property.getValueOrUndefined(i.innerRadii,e,innerRadiiScratch),u=Property.getValueOrUndefined(i.minimumClock,e),d=Property.getValueOrUndefined(i.maximumClock,e),h=Property.getValueOrUndefined(i.minimumCone,e),p=Property.getValueOrUndefined(i.maximumCone,e),f=Property.getValueOrUndefined(i.stackPartitions,e),m=Property.getValueOrUndefined(i.slicePartitions,e),g=Property.getValueOrUndefined(i.subdivisions,e),_=Property.getValueOrDefault(i.outlineWidth,e,1),y=Property.getValueOrDefault(i.heightReference,e,HeightReference$1.NONE),C=y!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0,T=this._scene.mode,S=T===SceneMode$1.SCENE3D&&y===HeightReference$1.NONE,v=this._options,A=this._geometryUpdater.shadowsProperty.getValue(e),E=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),b=Property.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5);if(!S||this._lastSceneMode!==T||!defined(this._primitive)||v.stackPartitions!==f||v.slicePartitions!==m||defined(l)&&!Cartesian3.equals(v.innerRadii!==l)||v.minimumClock!==u||v.maximumClock!==d||v.minimumCone!==h||v.maximumCone!==p||v.subdivisions!==g||this._lastOutlineWidth!==_||v.offsetAttribute!==C){const t=this._primitives;if(t.removeAndDestroy(this._primitive),t.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=T,this._lastOutlineWidth=_,v.stackPartitions=f,v.slicePartitions=m,v.subdivisions=g,v.offsetAttribute=C,v.radii=Cartesian3.clone(S?unitSphere:n,v.radii),defined(l))if(S){const e=Cartesian3.magnitude(n);v.innerRadii=Cartesian3.fromElements(l.x/e,l.y/e,l.z/e,v.innerRadii)}else v.innerRadii=Cartesian3.clone(l,v.innerRadii);else v.innerRadii=void 0;v.minimumClock=u,v.maximumClock=d,v.minimumCone=h,v.maximumCone=p;const i=new MaterialAppearance({material:c,translucent:c.isTranslucent(),closed:!0});v.vertexFormat=i.vertexFormat;const r=this._geometryUpdater.createFillGeometryInstance(e,S,this._modelMatrix);this._primitive=t.add(new Primitive$3({geometryInstances:r,appearance:i,asynchronous:!1,shadows:A}));const y=this._geometryUpdater.createOutlineGeometryInstance(e,S,this._modelMatrix);this._outlinePrimitive=t.add(new Primitive$3({geometryInstances:y,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==y.attributes.color.value[3],renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(_)}}),asynchronous:!1,shadows:A})),this._lastShow=o,this._lastOutlineShow=a,this._lastOutlineColor=Color.clone(s,this._lastOutlineColor),this._lastDistanceDisplayCondition=E,this._lastOffset=Cartesian3.clone(b,this._lastOffset)}else if(this._primitive.ready){const e=this._primitive,i=this._outlinePrimitive;e.show=!0,i.show=!0,e.appearance.material=c;let n=this._attributes;defined(n)||(n=e.getGeometryInstanceAttributes(t),this._attributes=n),o!==this._lastShow&&(n.show=ShowGeometryInstanceAttribute.toValue(o,n.show),this._lastShow=o);let r=this._outlineAttributes;defined(r)||(r=i.getGeometryInstanceAttributes(t),this._outlineAttributes=r),a!==this._lastOutlineShow&&(r.show=ShowGeometryInstanceAttribute.toValue(a,r.show),this._lastOutlineShow=a),Color.equals(s,this._lastOutlineColor)||(r.color=ColorGeometryInstanceAttribute.toValue(s,r.color),Color.clone(s,this._lastOutlineColor)),DistanceDisplayCondition.equals(E,this._lastDistanceDisplayCondition)||(n.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(E,n.distanceDisplayCondition),r.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(E,r.distanceDisplayCondition),DistanceDisplayCondition.clone(E,this._lastDistanceDisplayCondition)),Cartesian3.equals(b,this._lastOffset)||(n.offset=OffsetGeometryInstanceAttribute.toValue(b,n.offset),r.offset=OffsetGeometryInstanceAttribute.toValue(b,n.offset),Cartesian3.clone(b,this._lastOffset))}S&&(n.x=Math.max(n.x,.001),n.y=Math.max(n.y,.001),n.z=Math.max(n.z,.001),r=Matrix4.multiplyByScale(r,n,r),this._primitive.modelMatrix=r,this._outlinePrimitive.modelMatrix=r)};const positionScratch$2=new Cartesian3,scratchColor$9=new Color;function PlaneGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function PlaneGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PlaneGeometryOptions(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}function DynamicPlaneGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(PlaneGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PlaneGeometryUpdater.prototype.constructor=PlaneGeometryUpdater),PlaneGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e);let n,r;const o=new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a);if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$9)),defined(t)||(t=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(t),n={show:o,distanceDisplayCondition:s,color:r}}else n={show:o,distanceDisplayCondition:s};const c=t.plane,l=this._options;let u=t.computeModelMatrix(e);const d=Property.getValueOrDefault(c.plane,e,l.plane),h=Property.getValueOrUndefined(c.dimensions,e,l.dimensions);return l.plane=d,l.dimensions=h,u=createPrimitiveMatrix(d,h,u,u),new GeometryInstance({id:t,geometry:new PlaneGeometry(this._options),modelMatrix:u,attributes:n})},PlaneGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$9),r=this._distanceDisplayConditionProperty.getValue(e),o=t.plane,a=this._options;let s=t.computeModelMatrix(e);const c=Property.getValueOrDefault(o.plane,e,a.plane),l=Property.getValueOrUndefined(o.dimensions,e,a.dimensions);return a.plane=c,a.dimensions=l,s=createPrimitiveMatrix(c,l,s,s),new GeometryInstance({id:t,geometry:new PlaneOutlineGeometry,modelMatrix:s,attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)}})},PlaneGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.plane)||!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PlaneGeometryUpdater.prototype._getIsClosed=function(e){return!1},PlaneGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.plane.isConstant&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},PlaneGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=this._materialProperty instanceof ColorMaterialProperty,n=this._options;n.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,n.plane=t.plane.getValue(Iso8601.MINIMUM_VALUE,n.plane),n.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,n.dimensions)},PlaneGeometryUpdater.DynamicGeometryUpdater=DynamicPlaneGeometryUpdater,defined(Object.create)&&(DynamicPlaneGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicPlaneGeometryUpdater.prototype.constructor=DynamicPlaneGeometryUpdater),DynamicPlaneGeometryUpdater.prototype._isHidden=function(e,t,i){const n=this._options;return!defined(Property.getValueOrUndefined(e.position,i,positionScratch$2))||!defined(n.plane)||!defined(n.dimensions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicPlaneGeometryUpdater.prototype._setOptions=function(e,t,i){const n=this._options;n.plane=Property.getValueOrDefault(t.plane,i,n.plane),n.dimensions=Property.getValueOrUndefined(t.dimensions,i,n.dimensions)};const scratchAxis=new Cartesian3,scratchUp$2=new Cartesian3,scratchTranslation$1=new Cartesian3,scratchScale$1=new Cartesian3,scratchRotation$1=new Matrix3,scratchRotationScale=new Matrix3,scratchLocalTransform=new Matrix4;function createPrimitiveMatrix(e,t,i,n){const r=e.normal,o=e.distance,a=Cartesian3.multiplyByScalar(r,-o,scratchTranslation$1);let s=Cartesian3.clone(Cartesian3.UNIT_Z,scratchUp$2);CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(s,r)),1,CesiumMath.EPSILON8)&&(s=Cartesian3.clone(Cartesian3.UNIT_Y,s));const c=Cartesian3.cross(s,r,scratchAxis);s=Cartesian3.cross(r,c,s),Cartesian3.normalize(c,c),Cartesian3.normalize(s,s);const l=scratchRotation$1;Matrix3.setColumn(l,0,c,l),Matrix3.setColumn(l,1,s,l),Matrix3.setColumn(l,2,r,l);const u=Cartesian3.fromElements(t.x,t.y,1,scratchScale$1),d=Matrix3.multiplyByScale(l,u,scratchRotationScale),h=Matrix4.fromRotationTranslation(d,a,scratchLocalTransform);return Matrix4.multiplyTransformation(i,h,n)}PlaneGeometryUpdater.createPrimitiveMatrix=createPrimitiveMatrix;const heightAndPerPositionHeightWarning="Entity polygons cannot have both height and perPositionHeight. height will be ignored",heightReferenceAndPerPositionHeightWarning="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",scratchColor$8=new Color,defaultOffset$4=Cartesian3.ZERO,offsetScratch$4=new Cartesian3,scratchRectangle$2=new Rectangle,scratch2DPositions=[],cart2Scratch=new Cartesian2;function PolygonGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.closeTop=void 0,this.closeBottom=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.offsetAttribute=void 0,this.arcType=void 0}function PolygonGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolygonGeometryOptions(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function DyanmicPolygonGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(PolygonGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),PolygonGeometryUpdater.prototype.constructor=PolygonGeometryUpdater),PolygonGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=this._options,r={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$8)),defined(t)||(t=Color.WHITE),r.color=ColorGeometryInstanceAttribute.fromColor(t)}let o;return defined(n.offsetAttribute)&&(r.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$4))),o=n.perPositionHeight&&!defined(n.extrudedHeight)?new CoplanarPolygonGeometry(n):new PolygonGeometry(n),new GeometryInstance({id:t,geometry:o,attributes:r})},PolygonGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=this._options,r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$8),o=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o),offset:void 0};let s;return defined(n.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$4))),s=n.perPositionHeight&&!defined(n.extrudedHeight)?new CoplanarPolygonOutlineGeometry(n):new PolygonOutlineGeometry(n),new GeometryInstance({id:t,geometry:s,attributes:a})},PolygonGeometryUpdater.prototype._computeCenter=function(e,t){const i=Property.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!defined(i))return;const n=i.positions;if(0===n.length)return;const r=this._scene.mapProjection.ellipsoid,o=EllipsoidTangentPlane.fromPoints(n,r),a=o.projectPointsOntoPlane(n,scratch2DPositions),s=a.length;let c=0,l=s-1,u=new Cartesian2;for(let e=0;e<s;l=e++){const t=a[e],i=a[l],n=t.x*i.y-i.x*t.y;let r=Cartesian2.add(t,i,cart2Scratch);r=Cartesian2.multiplyByScalar(r,n,r),u=Cartesian2.add(u,r,u),c+=n}const d=1/(3*c);return u=Cartesian2.multiplyByScalar(u,d,u),o.projectPointOntoEllipsoid(u,t)},PolygonGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.hierarchy)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolygonGeometryUpdater.prototype._isOnTerrain=function(e,t){const i=GroundGeometryUpdater.prototype._isOnTerrain.call(this,e,t),n=t.perPositionHeight,r=defined(n)&&(!n.isConstant||n.getValue(Iso8601.MINIMUM_VALUE));return i&&!r},PolygonGeometryUpdater.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.perPositionHeight)||!Property.isConstant(t.closeTop)||!Property.isConstant(t.closeBottom)||!Property.isConstant(t.zIndex)||!Property.isConstant(t.arcType)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},PolygonGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=this._materialProperty instanceof ColorMaterialProperty,n=this._options;n.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat;const r=t.hierarchy.getValue(Iso8601.MINIMUM_VALUE);let o=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const a=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let s=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const c=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),l=Property.getValueOrDefault(t.perPositionHeight,Iso8601.MINIMUM_VALUE,!1);let u;o=GroundGeometryUpdater.getGeometryHeight(o,a),l?(defined(o)&&(o=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),a!==HeightReference$1.NONE&&l&&(o=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(s)&&!defined(o)&&(o=0),u=GroundGeometryUpdater.computeGeometryOffsetAttribute(o,a,s,c)),n.polygonHierarchy=r,n.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),n.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),n.perPositionHeight=l,n.closeTop=Property.getValueOrDefault(t.closeTop,Iso8601.MINIMUM_VALUE,!0),n.closeBottom=Property.getValueOrDefault(t.closeBottom,Iso8601.MINIMUM_VALUE,!0),n.offsetAttribute=u,n.height=o,n.arcType=Property.getValueOrDefault(t.arcType,Iso8601.MINIMUM_VALUE,ArcType$1.GEODESIC),s=GroundGeometryUpdater.getGeometryExtrudedHeight(s,c),s===GroundGeometryUpdater.CLAMP_TO_GROUND&&(s=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(n,scratchRectangle$2)).minimumTerrainHeight),n.extrudedHeight=s},PolygonGeometryUpdater.prototype._getIsClosed=function(e){const t=e.height,i=e.extrudedHeight,n=defined(i)&&i!==t;return!e.perPositionHeight&&(!n&&0===t||n&&e.closeTop&&e.closeBottom)},PolygonGeometryUpdater.DynamicGeometryUpdater=DyanmicPolygonGeometryUpdater,defined(Object.create)&&(DyanmicPolygonGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DyanmicPolygonGeometryUpdater.prototype.constructor=DyanmicPolygonGeometryUpdater),DyanmicPolygonGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.polygonHierarchy)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DyanmicPolygonGeometryUpdater.prototype._setOptions=function(e,t,i){const n=this._options;n.polygonHierarchy=Property.getValueOrUndefined(t.hierarchy,i);let r=Property.getValueOrUndefined(t.height,i);const o=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),a=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);let s=Property.getValueOrUndefined(t.extrudedHeight,i);const c=Property.getValueOrUndefined(t.perPositionHeight,i);let l;r=GroundGeometryUpdater.getGeometryHeight(r,a),c?(defined(r)&&(r=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),o!==HeightReference$1.NONE&&c&&(r=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(s)&&!defined(r)&&(r=0),l=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,s,a)),n.granularity=Property.getValueOrUndefined(t.granularity,i),n.stRotation=Property.getValueOrUndefined(t.stRotation,i),n.perPositionHeight=Property.getValueOrUndefined(t.perPositionHeight,i),n.closeTop=Property.getValueOrDefault(t.closeTop,i,!0),n.closeBottom=Property.getValueOrDefault(t.closeBottom,i,!0),n.offsetAttribute=l,n.height=r,n.arcType=Property.getValueOrDefault(t.arcType,i,ArcType$1.GEODESIC),s=GroundGeometryUpdater.getGeometryExtrudedHeight(s,a),s===GroundGeometryUpdater.CLAMP_TO_GROUND&&(s=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(n,scratchRectangle$2)).minimumTerrainHeight),n.extrudedHeight=s};const scratchColor$7=new Color;function PolylineVolumeGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function PolylineVolumeGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolylineVolumeGeometryOptions(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function DynamicPolylineVolumeGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(PolylineVolumeGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PolylineVolumeGeometryUpdater.prototype.constructor=PolylineVolumeGeometryUpdater),PolylineVolumeGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e);let n,r;const o=new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a);if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$7)),defined(t)||(t=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(t),n={show:o,distanceDisplayCondition:s,color:r}}else n={show:o,distanceDisplayCondition:s};return new GeometryInstance({id:t,geometry:new PolylineVolumeGeometry(this._options),attributes:n})},PolylineVolumeGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$7),r=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new PolylineVolumeOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)}})},PolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.shape)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolylineVolumeGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&t.shape.isConstant&&Property.isConstant(t.granularity)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.cornerType))},PolylineVolumeGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=t.granularity,n=t.cornerType,r=this._options,o=this._materialProperty instanceof ColorMaterialProperty;r.vertexFormat=o?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.polylinePositions=t.positions.getValue(Iso8601.MINIMUM_VALUE,r.polylinePositions),r.shapePositions=t.shape.getValue(Iso8601.MINIMUM_VALUE,r.shape),r.granularity=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE):void 0,r.cornerType=defined(n)?n.getValue(Iso8601.MINIMUM_VALUE):void 0},PolylineVolumeGeometryUpdater.DynamicGeometryUpdater=DynamicPolylineVolumeGeometryUpdater,defined(Object.create)&&(DynamicPolylineVolumeGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicPolylineVolumeGeometryUpdater.prototype.constructor=DynamicPolylineVolumeGeometryUpdater),DynamicPolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t,i){const n=this._options;return!defined(n.polylinePositions)||!defined(n.shapePositions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicPolylineVolumeGeometryUpdater.prototype._setOptions=function(e,t,i){const n=this._options;n.polylinePositions=Property.getValueOrUndefined(t.positions,i,n.polylinePositions),n.shapePositions=Property.getValueOrUndefined(t.shape,i),n.granularity=Property.getValueOrUndefined(t.granularity,i),n.cornerType=Property.getValueOrUndefined(t.cornerType,i)};const scratchColor$6=new Color,defaultOffset$3=Cartesian3.ZERO,offsetScratch$3=new Cartesian3,scratchRectangle$1=new Rectangle,scratchCenterRect=new Rectangle,scratchCarto=new Cartographic;function RectangleGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0,this.offsetAttribute=void 0}function RectangleGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new RectangleGeometryOptions(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function DynamicRectangleGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(RectangleGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),RectangleGeometryUpdater.prototype.constructor=RectangleGeometryUpdater),RectangleGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$6)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$3,offsetScratch$3))),new GeometryInstance({id:t,geometry:new RectangleGeometry(this._options),attributes:n})},RectangleGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$6),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$3,offsetScratch$3))),new GeometryInstance({id:t,geometry:new RectangleOutlineGeometry(this._options),attributes:o})},RectangleGeometryUpdater.prototype._computeCenter=function(e,t){const i=Property.getValueOrUndefined(this._entity.rectangle.coordinates,e,scratchCenterRect);if(!defined(i))return;const n=Rectangle.center(i,scratchCarto);return Cartographic.toCartesian(n,Ellipsoid.WGS84,t)},RectangleGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.coordinates)||GeometryUpdater.prototype._isHidden.call(this,e,t)},RectangleGeometryUpdater.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.rotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},RectangleGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=this._materialProperty instanceof ColorMaterialProperty;let n=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const r=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let o=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const a=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(o)&&!defined(n)&&(n=0);const s=this._options;s.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,s.rectangle=t.coordinates.getValue(Iso8601.MINIMUM_VALUE,s.rectangle),s.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),s.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),s.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),s.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,r,o,a),s.height=GroundGeometryUpdater.getGeometryHeight(n,r),o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,a),o===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(s,scratchRectangle$1)).minimumTerrainHeight),s.extrudedHeight=o},RectangleGeometryUpdater.DynamicGeometryUpdater=DynamicRectangleGeometryUpdater,defined(Object.create)&&(DynamicRectangleGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicRectangleGeometryUpdater.prototype.constructor=DynamicRectangleGeometryUpdater),DynamicRectangleGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.rectangle)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicRectangleGeometryUpdater.prototype._setOptions=function(e,t,i){const n=this._options;let r=Property.getValueOrUndefined(t.height,i);const o=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE);let a=Property.getValueOrUndefined(t.extrudedHeight,i);const s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0),n.rectangle=Property.getValueOrUndefined(t.coordinates,i,n.rectangle),n.granularity=Property.getValueOrUndefined(t.granularity,i),n.stRotation=Property.getValueOrUndefined(t.stRotation,i),n.rotation=Property.getValueOrUndefined(t.rotation,i),n.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,a,s),n.height=GroundGeometryUpdater.getGeometryHeight(r,o),a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,s),a===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(n,scratchRectangle$1)).minimumTerrainHeight),n.extrudedHeight=a};const colorScratch$5=new Color,distanceDisplayConditionScratch$7=new DistanceDisplayCondition,defaultDistanceDisplayCondition$6=new DistanceDisplayCondition,defaultOffset$2=Cartesian3.ZERO,offsetScratch$2=new Cartesian3;function Batch$5(e,t,i,n,r,o,a){let s;this.translucent=t,this.appearanceType=i,this.depthFailAppearanceType=n,this.depthFailMaterialProperty=r,this.depthFailMaterial=void 0,this.closed=o,this.shadows=a,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.invalidated=!1,defined(r)&&(s=r.definitionChanged.addEventListener(Batch$5.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=s}function StaticGeometryColorBatch(e,t,i,n,r){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=i,this._closed=n,this._shadows=r}function removeItem(e,t){for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.remove(t))return 0===n.updaters.length&&(e.splice(i,1),n.destroy()),!0}return!1}function moveItems(e,t,i){let n=!1;const r=t.length;for(let o=0;o<r;++o){const r=t[o],a=r.itemsToRemove,s=a.length;if(s>0)for(o=0;o<s;o++){const t=a[o];r.remove(t),e.add(i,t),n=!0}}return n}function updateItems(e,t,i,n){let r,o=t.length;for(r=o-1;r>=0;r--){const n=t[r];if(n.invalidated){t.splice(r,1);const o=n.updaters.values,a=o.length;for(let t=0;t<a;t++)e.add(i,o[t]);n.destroy()}}for(o=t.length,r=0;r<o;++r)n=t[r].update(i)&&n;return n}function getBoundingSphere(e,t,i){const n=e.length;for(let r=0;r<n;r++){const n=e[r];if(n.contains(t))return n.getBoundingSphere(t,i)}return BoundingSphereState$1.FAILED}function removeAllPrimitives(e){const t=e.length;for(let i=0;i<t;i++)e[i].destroy();e.length=0}Batch$5.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$5.prototype.isMaterial=function(e){const t=this.depthFailMaterialProperty,i=e.depthFailMaterialProperty;return i===t||!!defined(t)&&t.equals(i)},Batch$5.prototype.add=function(e,t){const i=e.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)&&Property.isConstant(e.terrainOffsetProperty)){const t=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener((function(i,n,r,o){"isShowing"===n&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(i,e)},Batch$5.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$5.prototype.update=function(e){let t=!0,i=0,n=this.primitive;const r=this.primitives;let o;if(this.createPrimitive){const i=this.geometry.values;if(i.length>0){let o;defined(n)&&(defined(this.oldPrimitive)?r.remove(n):this.oldPrimitive=n),defined(this.depthFailAppearanceType)&&(defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),o=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),n=new Primitive$3({show:!1,asynchronous:!0,geometryInstances:i.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:o,shadows:this.shadows}),r.add(n),t=!1}else{defined(n)&&(r.remove(n),n=void 0);const e=this.oldPrimitive;defined(e)&&(r.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(r.remove(this.oldPrimitive),this.oldPrimitive=void 0),!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const t=this.updatersWithAttributes.values,a=t.length,s=this.waitingOnCreate;for(o=0;o<a;o++){const r=t[o],a=this.geometry.get(r.id);let c=this.attributes.get(a.id.id);if(defined(c)||(c=n.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,c)),!r.fillMaterialProperty.isConstant||s){const t=r.fillMaterialProperty.color,n=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$5);Color.equals(c._lastColor,n)||(c._lastColor=Color.clone(n,c._lastColor),c.color=ColorGeometryInstanceAttribute.toValue(n,c.color),(this.translucent&&255===c.color[3]||!this.translucent&&255!==c.color[3])&&(this.itemsToRemove[i++]=r))}if(defined(this.depthFailAppearanceType)&&r.depthFailMaterialProperty instanceof ColorMaterialProperty&&(!r.depthFailMaterialProperty.isConstant||s)){const t=r.depthFailMaterialProperty.color,i=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$5);Color.equals(c._lastDepthFailColor,i)||(c._lastDepthFailColor=Color.clone(i,c._lastDepthFailColor),c.depthFailColor=ColorGeometryInstanceAttribute.toValue(i,c.depthFailColor))}const l=r.entity.isShowing&&(r.hasConstantFill||r.isFilled(e));l!==(1===c.show[0])&&(c.show=ShowGeometryInstanceAttribute.toValue(l,c.show));const u=r.distanceDisplayConditionProperty;if(!Property.isConstant(u)){const t=Property.getValueOrDefault(u,e,defaultDistanceDisplayCondition$6,distanceDisplayConditionScratch$7);DistanceDisplayCondition.equals(t,c._lastDistanceDisplayCondition)||(c._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,c._lastDistanceDisplayCondition),c.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,c.distanceDisplayCondition))}const d=r.terrainOffsetProperty;if(!Property.isConstant(d)){const t=Property.getValueOrDefault(d,e,defaultOffset$2,offsetScratch$2);Cartesian3.equals(t,c._lastOffset)||(c._lastOffset=Cartesian3.clone(t,c._lastOffset),c.offset=OffsetGeometryInstanceAttribute.toValue(t,c.offset))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(t=!1);return this.itemsToRemove.length=i,t},Batch$5.prototype.updateShows=function(e){const t=this.showsUpdated.values,i=t.length;for(let n=0;n<i;n++){const i=t[n],r=this.geometry.get(i.id);let o=this.attributes.get(r.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,o));const a=i.entity.isShowing;a!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(a,o.show),r.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$5.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$5.prototype.getBoundingSphere=function(e,t){const i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;const n=i.getGeometryInstanceAttributes(e.entity);return!defined(n)||!defined(n.boundingSphere)||defined(n.show)&&0===n.show[0]?BoundingSphereState$1.FAILED:(n.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$5.prototype.destroy=function(){const e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);const i=this.oldPrimitive;defined(i)&&t.remove(i),defined(this.removeMaterialSubscription)&&this.removeMaterialSubscription()},StaticGeometryColorBatch.prototype.add=function(e,t){let i,n;const r=t.createFillGeometryInstance(e);255===r.attributes.color.value[3]?(i=this._solidItems,n=!1):(i=this._translucentItems,n=!0);const o=i.length;for(let e=0;e<o;e++){const n=i[e];if(n.isMaterial(t))return void n.add(t,r)}const a=new Batch$5(this._primitives,n,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);a.add(t,r),i.push(a)},StaticGeometryColorBatch.prototype.remove=function(e){removeItem(this._solidItems,e)||removeItem(this._translucentItems,e)},StaticGeometryColorBatch.prototype.update=function(e){let t=updateItems(this,this._solidItems,e,!0);t=updateItems(this,this._translucentItems,e,t)&&t;const i=moveItems(this,this._solidItems,e),n=moveItems(this,this._translucentItems,e);return(i||n)&&(t=updateItems(this,this._solidItems,e,t)&&t,t=updateItems(this,this._translucentItems,e,t)&&t),t},StaticGeometryColorBatch.prototype.getBoundingSphere=function(e,t){const i=getBoundingSphere(this._solidItems,e,t);return i===BoundingSphereState$1.FAILED?getBoundingSphere(this._translucentItems,e,t):i},StaticGeometryColorBatch.prototype.removeAllPrimitives=function(){removeAllPrimitives(this._solidItems),removeAllPrimitives(this._translucentItems)};const distanceDisplayConditionScratch$6=new DistanceDisplayCondition,defaultDistanceDisplayCondition$5=new DistanceDisplayCondition,defaultOffset$1=Cartesian3.ZERO,offsetScratch$1=new Cartesian3;function Batch$4(e,t,i,n,r,o,a){this.primitives=e,this.appearanceType=t,this.materialProperty=i,this.depthFailAppearanceType=n,this.depthFailMaterialProperty=r,this.closed=o,this.shadows=a,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Batch$4.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}Batch$4.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$4.prototype.isMaterial=function(e){const t=this.materialProperty,i=e.fillMaterialProperty,n=this.depthFailMaterialProperty,r=e.depthFailMaterialProperty;if(i===t&&r===n)return!0;let o=defined(t)&&t.equals(i);return o=(!defined(n)&&!defined(r)||defined(n)&&n.equals(r))&&o,o},Batch$4.prototype.add=function(e,t){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,t.createFillGeometryInstance(e)),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)&&Property.isConstant(t.terrainOffsetProperty)){const e=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener((function(i,n,r,o){"isShowing"===n&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},Batch$4.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};const colorScratch$4=new Color;function StaticGeometryPerMaterialBatch(e,t,i,n,r){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=i,this._closed=n,this._shadows=r}Batch$4.prototype.update=function(e){let t=!0,i=this.primitive;const n=this.primitives,r=this.geometry.values;let o;if(this.createPrimitive){if(r.length>0){let o;defined(i)&&(defined(this.oldPrimitive)?n.remove(i):this.oldPrimitive=i),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),o=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),i=new Primitive$3({show:!1,asynchronous:!0,geometryInstances:r.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:o,shadows:this.shadows}),n.add(i),t=!1}else{defined(i)&&(n.remove(i),i=void 0);const e=this.oldPrimitive;defined(e)&&(n.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1}else if(defined(i)&&i.ready){i.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const t=this.updatersWithAttributes.values,r=t.length;for(o=0;o<r;o++){const n=t[o],r=n.entity,a=this.geometry.get(n.id);let s=this.attributes.get(a.id.id);if(defined(s)||(s=i.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,s)),defined(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof ColorMaterialProperty&&!n.depthFailMaterialProperty.isConstant){const t=n.depthFailMaterialProperty.color,i=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$4);Color.equals(s._lastDepthFailColor,i)||(s._lastDepthFailColor=Color.clone(i,s._lastDepthFailColor),s.depthFailColor=ColorGeometryInstanceAttribute.toValue(i,s.depthFailColor))}const c=r.isShowing&&(n.hasConstantFill||n.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=n.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition$5,distanceDisplayConditionScratch$6);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}const u=n.terrainOffsetProperty;if(!Property.isConstant(u)){const t=Property.getValueOrDefault(u,e,defaultOffset$1,offsetScratch$1);Cartesian3.equals(t,s._lastOffset)||(s._lastOffset=Cartesian3.clone(t,s._lastOffset),s.offset=OffsetGeometryInstanceAttribute.toValue(t,s.offset))}}this.updateShows(i)}else defined(i)&&!i.ready&&(t=!1);return t},Batch$4.prototype.updateShows=function(e){const t=this.showsUpdated.values,i=t.length;for(let n=0;n<i;n++){const i=t[n],r=i.entity,o=this.geometry.get(i.id);let a=this.attributes.get(o.id.id);defined(a)||(a=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,a));const s=r.isShowing;s!==(1===a.show[0])&&(a.show=ShowGeometryInstanceAttribute.toValue(s,a.show),o.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()},Batch$4.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$4.prototype.getBoundingSphere=function(e,t){const i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;const n=i.getGeometryInstanceAttributes(e.entity);return!defined(n)||!defined(n.boundingSphere)||defined(n.show)&&0===n.show[0]?BoundingSphereState$1.FAILED:(n.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$4.prototype.destroy=function(){const e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);const i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGeometryPerMaterialBatch.prototype.add=function(e,t){const i=this._items,n=i.length;for(let r=0;r<n;r++){const n=i[r];if(n.isMaterial(t))return void n.add(e,t)}const r=new Batch$4(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);r.add(e,t),i.push(r)},StaticGeometryPerMaterialBatch.prototype.remove=function(e){const t=this._items;for(let i=t.length-1;i>=0;i--){const n=t[i];if(n.remove(e)){0===n.updaters.length&&(t.splice(i,1),n.destroy());break}}},StaticGeometryPerMaterialBatch.prototype.update=function(e){let t;const i=this._items;for(t=i.length-1;t>=0;t--){const n=i[t];if(n.invalidated){i.splice(t,1);const r=n.updaters.values,o=r.length;for(let t=0;t<o;t++)this.add(e,r[t]);n.destroy()}}let n=!0;for(t=0;t<i.length;t++)n=i[t].update(e)&&n;return n},StaticGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){const i=this._items,n=i.length;for(let r=0;r<n;r++){const n=i[r];if(n.contains(e))return n.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let i=0;i<t;i++)e[i].destroy();this._items.length=0};const colorScratch$3=new Color,distanceDisplayConditionScratch$5=new DistanceDisplayCondition,defaultDistanceDisplayCondition$4=new DistanceDisplayCondition;function Batch$3(e,t,i,n){this.primitives=e,this.zIndex=n,this.classificationType=t,this.color=i,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new RectangleCollisionChecker}function StaticGroundGeometryColorBatch(e,t){this._batches=[],this._primitives=e,this._classificationType=t}Batch$3.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},Batch$3.prototype.add=function(e,t){const i=e.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),this.rectangleCollisionCheck.insert(i,t.geometry.rectangle),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)){const t=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener((function(i,n,r,o){"isShowing"===n&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(i,e)},Batch$3.prototype.remove=function(e){const t=e.id,i=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,i.geometry.rectangle),this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$3.prototype.update=function(e){let t=!0;let i=this.primitive;const n=this.primitives;let r;if(this.createPrimitive){const e=this.geometry.values;if(e.length>0)defined(i)&&(defined(this.oldPrimitive)?n.remove(i):this.oldPrimitive=i),i=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:e.slice(),classificationType:this.classificationType}),n.add(i,this.zIndex),t=!1;else{defined(i)&&(n.remove(i),i=void 0);const e=this.oldPrimitive;defined(e)&&(n.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(i)&&i.ready){i.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0);const t=this.updatersWithAttributes.values,o=t.length,a=this.waitingOnCreate;for(r=0;r<o;r++){const n=t[r],o=this.geometry.get(n.id);let s=this.attributes.get(o.id.id);if(defined(s)||(s=i.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s)),!n.fillMaterialProperty.isConstant||a){const t=n.fillMaterialProperty.color,i=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$3);Color.equals(s._lastColor,i)||(s._lastColor=Color.clone(i,s._lastColor),s.color=ColorGeometryInstanceAttribute.toValue(i,s.color))}const c=n.entity.isShowing&&(n.hasConstantFill||n.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=n.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition$4,distanceDisplayConditionScratch$5);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}}this.updateShows(i),this.waitingOnCreate=!1}else defined(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=0,t},Batch$3.prototype.updateShows=function(e){const t=this.showsUpdated.values,i=t.length;for(let n=0;n<i;n++){const i=t[n],r=this.geometry.get(i.id);let o=this.attributes.get(r.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,o));const a=i.entity.isShowing;a!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(a,o.show),r.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$3.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$3.prototype.getBoundingSphere=function(e,t){const i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;const n=i.getBoundingSphere(e.entity);return defined(n)?(n.clone(t),BoundingSphereState$1.DONE):BoundingSphereState$1.FAILED},Batch$3.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const i=this.oldPrimitive;defined(i)&&(e.remove(i),this.oldPrimitive=void 0)},StaticGroundGeometryColorBatch.prototype.add=function(e,t){const i=t.createFillGeometryInstance(e),n=this._batches,r=Property.getValueOrDefault(t.zIndex,0);let o;const a=n.length;for(let e=0;e<a;++e){const t=n[e];if(t.zIndex===r&&!t.overlapping(i.geometry.rectangle)){o=t;break}}return defined(o)||(o=new Batch$3(this._primitives,this._classificationType,i.attributes.color.value,r),n.push(o)),o.add(t,i),o},StaticGroundGeometryColorBatch.prototype.remove=function(e){const t=this._batches,i=t.length;for(let n=0;n<i;++n)if(t[n].remove(e))return},StaticGroundGeometryColorBatch.prototype.update=function(e){let t,i,n=!0;const r=this._batches,o=r.length;for(t=0;t<o;++t)n=r[t].update(e)&&n;for(t=0;t<o;++t){const n=r[t],o=n.itemsToRemove,a=o.length;for(let t=0;t<a;t++){i=o[t],n.remove(i);const r=this.add(e,i);n.isDirty=!0,r.isDirty=!0}}for(t=o-1;t>=0;--t){const i=r[t];i.isDirty&&(n=r[t].update(e)&&n,i.isDirty=!1),0===i.geometry.length&&r.splice(t,1)}return n},StaticGroundGeometryColorBatch.prototype.getBoundingSphere=function(e,t){const i=this._batches,n=i.length;for(let r=0;r<n;++r){const n=i[r];if(n.contains(e))return n.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryColorBatch.prototype.removeAllPrimitives=function(){const e=this._batches,t=e.length;for(let i=0;i<t;++i)e[i].removeAllPrimitives()};const distanceDisplayConditionScratch$4=new DistanceDisplayCondition,defaultDistanceDisplayCondition$3=new DistanceDisplayCondition;function Batch$2(e,t,i,n,r,o){this.primitives=e,this.classificationType=t,this.appearanceType=i,this.materialProperty=n,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Batch$2.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.usingSphericalTextureCoordinates=r,this.zIndex=o,this.rectangleCollisionCheck=new RectangleCollisionChecker}function StaticGroundGeometryPerMaterialBatch(e,t,i){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=i}Batch$2.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$2.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},Batch$2.prototype.isMaterial=function(e){const t=this.materialProperty,i=e.fillMaterialProperty;return i===t||i instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(i)},Batch$2.prototype.add=function(e,t,i){const n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,i),this.rectangleCollisionCheck.insert(n,i.geometry.rectangle),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)){const e=this;this.subscriptions.set(n,t.entity.definitionChanged.addEventListener((function(i,n,r,o){"isShowing"===n&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(n,t);this.createPrimitive=!0},Batch$2.prototype.remove=function(e){const t=e.id,i=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,i.geometry.rectangle),this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t)),!0}return!1},Batch$2.prototype.update=function(e){let t=!0,i=this.primitive;const n=this.primitives,r=this.geometry.values;let o;if(this.createPrimitive){if(r.length>0)defined(i)&&(defined(this.oldPrimitive)?n.remove(i):this.oldPrimitive=i),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),i=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:r.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),n.add(i,this.zIndex),t=!1;else{defined(i)&&(n.remove(i),i=void 0);const e=this.oldPrimitive;defined(e)&&(n.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1}else if(defined(i)&&i.ready){i.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;const t=this.updatersWithAttributes.values,r=t.length;for(o=0;o<r;o++){const n=t[o],r=n.entity,a=this.geometry.get(n.id);let s=this.attributes.get(a.id.id);defined(s)||(s=i.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,s));const c=r.isShowing&&(n.hasConstantFill||n.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=n.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition$3,distanceDisplayConditionScratch$4);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}}this.updateShows(i)}else defined(i)&&!i.ready&&(t=!1);return t},Batch$2.prototype.updateShows=function(e){const t=this.showsUpdated.values,i=t.length;for(let n=0;n<i;n++){const i=t[n],r=i.entity,o=this.geometry.get(i.id);let a=this.attributes.get(o.id.id);defined(a)||(a=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,a));const s=r.isShowing;s!==(1===a.show[0])&&(a.show=ShowGeometryInstanceAttribute.toValue(s,a.show),o.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()},Batch$2.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$2.prototype.getBoundingSphere=function(e,t){const i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;const n=i.getGeometryInstanceAttributes(e.entity);return!defined(n)||!defined(n.boundingSphere)||defined(n.show)&&0===n.show[0]?BoundingSphereState$1.FAILED:(n.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$2.prototype.destroy=function(){const e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);const i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGroundGeometryPerMaterialBatch.prototype.add=function(e,t){const i=this._items,n=i.length,r=t.createFillGeometryInstance(e),o=ShadowVolumeAppearance.shouldUseSphericalCoordinates(r.geometry.rectangle),a=Property.getValueOrDefault(t.zIndex,0);for(let s=0;s<n;++s){const n=i[s];if(n.isMaterial(t)&&n.usingSphericalTextureCoordinates===o&&n.zIndex===a&&!n.overlapping(r.geometry.rectangle))return void n.add(e,t,r)}const s=new Batch$2(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,o,a);s.add(e,t,r),i.push(s)},StaticGroundGeometryPerMaterialBatch.prototype.remove=function(e){const t=this._items;for(let i=t.length-1;i>=0;i--){const n=t[i];if(n.remove(e)){0===n.updaters.length&&(t.splice(i,1),n.destroy());break}}},StaticGroundGeometryPerMaterialBatch.prototype.update=function(e){let t;const i=this._items;for(t=i.length-1;t>=0;t--){const n=i[t];if(n.invalidated){i.splice(t,1);const r=n.updaters.values,o=r.length;for(let t=0;t<o;t++)this.add(e,r[t]);n.destroy()}}let n=!0;for(t=0;t<i.length;t++)n=i[t].update(e)&&n;return n},StaticGroundGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){const i=this._items,n=i.length;for(let r=0;r<n;r++){const n=i[r];if(n.contains(e))return n.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let i=0;i<t;i++)e[i].destroy();this._items.length=0};const colorScratch$2=new Color,distanceDisplayConditionScratch$3=new DistanceDisplayCondition,defaultDistanceDisplayCondition$2=new DistanceDisplayCondition,defaultOffset=Cartesian3.ZERO,offsetScratch=new Cartesian3;function Batch$1(e,t,i,n){this.translucent=t,this.width=i,this.shadows=n,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.itemsToRemove=[],this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}function StaticOutlineGeometryBatch(e,t,i){this._primitives=e,this._scene=t,this._shadows=i,this._solidBatches=new AssociativeArray,this._translucentBatches=new AssociativeArray}Batch$1.prototype.add=function(e,t){const i=e.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantOutline&&e.outlineColorProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)&&Property.isConstant(e.terrainOffsetProperty)){const t=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener((function(i,n,r,o){"isShowing"===n&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(i,e)},Batch$1.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$1.prototype.update=function(e){let t=!0,i=0,n=this.primitive;const r=this.primitives;let o;if(this.createPrimitive){const e=this.geometry.values;if(e.length>0)defined(n)&&(defined(this.oldPrimitive)?r.remove(n):this.oldPrimitive=n),n=new Primitive$3({show:!1,asynchronous:!0,geometryInstances:e.slice(),appearance:new PerInstanceColorAppearance({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),r.add(n),t=!1;else{defined(n)&&(r.remove(n),n=void 0);const e=this.oldPrimitive;defined(e)&&(r.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(r.remove(this.oldPrimitive),this.oldPrimitive=void 0);const t=this.updatersWithAttributes.values,a=t.length,s=this.waitingOnCreate;for(o=0;o<a;o++){const r=t[o],a=this.geometry.get(r.id);let c=this.attributes.get(a.id.id);if(defined(c)||(c=n.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,c)),!r.outlineColorProperty.isConstant||s){const t=r.outlineColorProperty,n=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$2);Color.equals(c._lastColor,n)||(c._lastColor=Color.clone(n,c._lastColor),c.color=ColorGeometryInstanceAttribute.toValue(n,c.color),(this.translucent&&255===c.color[3]||!this.translucent&&255!==c.color[3])&&(this.itemsToRemove[i++]=r))}const l=r.entity.isShowing&&(r.hasConstantOutline||r.isOutlineVisible(e));l!==(1===c.show[0])&&(c.show=ShowGeometryInstanceAttribute.toValue(l,c.show));const u=r.distanceDisplayConditionProperty;if(!Property.isConstant(u)){const t=Property.getValueOrDefault(u,e,defaultDistanceDisplayCondition$2,distanceDisplayConditionScratch$3);DistanceDisplayCondition.equals(t,c._lastDistanceDisplayCondition)||(c._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,c._lastDistanceDisplayCondition),c.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,c.distanceDisplayCondition))}const d=r.terrainOffsetProperty;if(!Property.isConstant(d)){const t=Property.getValueOrDefault(d,e,defaultOffset,offsetScratch);Cartesian3.equals(t,c._lastOffset)||(c._lastOffset=Cartesian3.clone(t,c._lastOffset),c.offset=OffsetGeometryInstanceAttribute.toValue(t,c.offset))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(t=!1);return this.itemsToRemove.length=i,t},Batch$1.prototype.updateShows=function(e){const t=this.showsUpdated.values,i=t.length;for(let n=0;n<i;n++){const i=t[n],r=this.geometry.get(i.id);let o=this.attributes.get(r.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,o));const a=i.entity.isShowing;a!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(a,o.show),r.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$1.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$1.prototype.getBoundingSphere=function(e,t){const i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;const n=i.getGeometryInstanceAttributes(e.entity);return!defined(n)||!defined(n.boundingSphere)||defined(n.show)&&0===n.show[0]?BoundingSphereState$1.FAILED:(n.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$1.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const i=this.oldPrimitive;defined(i)&&(e.remove(i),this.oldPrimitive=void 0)},StaticOutlineGeometryBatch.prototype.add=function(e,t){const i=t.createOutlineGeometryInstance(e),n=this._scene.clampLineWidth(t.outlineWidth);let r,o;255===i.attributes.color.value[3]?(r=this._solidBatches,o=r.get(n),defined(o)||(o=new Batch$1(this._primitives,!1,n,this._shadows),r.set(n,o)),o.add(t,i)):(r=this._translucentBatches,o=r.get(n),defined(o)||(o=new Batch$1(this._primitives,!0,n,this._shadows),r.set(n,o)),o.add(t,i))},StaticOutlineGeometryBatch.prototype.remove=function(e){let t;const i=this._solidBatches.values,n=i.length;for(t=0;t<n;t++)if(i[t].remove(e))return;const r=this._translucentBatches.values,o=r.length;for(t=0;t<o;t++)if(r[t].remove(e))return},StaticOutlineGeometryBatch.prototype.update=function(e){let t,i,n,r;const o=this._solidBatches.values,a=o.length,s=this._translucentBatches.values,c=s.length;let l,u=!0,d=!1;do{for(d=!1,i=0;i<a;i++){r=o[i],u=r.update(e),l=r.itemsToRemove;const a=l.length;if(a>0)for(d=!0,t=0;t<a;t++)n=l[t],r.remove(n),this.add(e,n)}for(i=0;i<c;i++){r=s[i],u=r.update(e),l=r.itemsToRemove;const o=l.length;if(o>0)for(d=!0,t=0;t<o;t++)n=l[t],r.remove(n),this.add(e,n)}}while(d);return u},StaticOutlineGeometryBatch.prototype.getBoundingSphere=function(e,t){let i;const n=this._solidBatches.values,r=n.length;for(i=0;i<r;i++){const r=n[i];if(r.contains(e))return r.getBoundingSphere(e,t)}const o=this._translucentBatches.values,a=o.length;for(i=0;i<a;i++){const n=o[i];if(n.contains(e))return n.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticOutlineGeometryBatch.prototype.removeAllPrimitives=function(){let e;const t=this._solidBatches.values,i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();const n=this._translucentBatches.values,r=n.length;for(e=0;e<r;e++)n[e].removeAllPrimitives()};const scratchColor$5=new Color;function WallGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function WallGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new WallGeometryOptions(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function DynamicWallGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(WallGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),WallGeometryUpdater.prototype.constructor=WallGeometryUpdater),WallGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e);let n,r;const o=new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a);if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(t=this._materialProperty.color.getValue(e,scratchColor$5)),defined(t)||(t=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(t),n={show:o,distanceDisplayCondition:s,color:r}}else n={show:o,distanceDisplayCondition:s};return new GeometryInstance({id:t,geometry:new WallGeometry(this._options),attributes:n})},WallGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$5),r=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new WallOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)}})},WallGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||GeometryUpdater.prototype._isHidden.call(this,e,t)},WallGeometryUpdater.prototype._getIsClosed=function(e){return!1},WallGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&Property.isConstant(t.minimumHeights)&&Property.isConstant(t.maximumHeights)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.granularity))},WallGeometryUpdater.prototype._setStaticOptions=function(e,t){const i=t.minimumHeights,n=t.maximumHeights,r=t.granularity,o=this._materialProperty instanceof ColorMaterialProperty,a=this._options;a.vertexFormat=o?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,a.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,a.positions),a.minimumHeights=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE,a.minimumHeights):void 0,a.maximumHeights=defined(n)?n.getValue(Iso8601.MINIMUM_VALUE,a.maximumHeights):void 0,a.granularity=defined(r)?r.getValue(Iso8601.MINIMUM_VALUE):void 0},WallGeometryUpdater.DynamicGeometryUpdater=DynamicWallGeometryUpdater,defined(Object.create)&&(DynamicWallGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicWallGeometryUpdater.prototype.constructor=DynamicWallGeometryUpdater),DynamicWallGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.positions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicWallGeometryUpdater.prototype._setOptions=function(e,t,i){const n=this._options;n.positions=Property.getValueOrUndefined(t.positions,i,n.positions),n.minimumHeights=Property.getValueOrUndefined(t.minimumHeights,i,n.minimumHeights),n.maximumHeights=Property.getValueOrUndefined(t.maximumHeights,i,n.maximumHeights),n.granularity=Property.getValueOrUndefined(t.granularity,i)};const emptyArray$1=[],geometryUpdaters=[BoxGeometryUpdater,CylinderGeometryUpdater,CorridorGeometryUpdater,EllipseGeometryUpdater,EllipsoidGeometryUpdater,PlaneGeometryUpdater,PolygonGeometryUpdater,PolylineVolumeGeometryUpdater,RectangleGeometryUpdater,WallGeometryUpdater];function GeometryUpdaterSet(e,t){this.entity=e,this.scene=t;const i=new Array(geometryUpdaters.length),n=new Event;function r(e){n.raiseEvent(e)}const o=new EventHelper;for(let n=0;n<i.length;n++){const a=new geometryUpdaters[n](e,t);o.add(a.geometryChanged,r),i[n]=a}this.updaters=i,this.geometryChanged=n,this.eventHelper=o,this._removeEntitySubscription=e.definitionChanged.addEventListener(GeometryUpdaterSet.prototype._onEntityPropertyChanged,this)}function GeometryVisualizer(e,t,i,n){i=defaultValue(i,e.primitives),n=defaultValue(n,e.groundPrimitives),this._scene=e,this._primitives=i,this._groundPrimitives=n,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;const r=ShadowMode$1.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(2*r),this._closedColorBatches=new Array(2*r),this._closedMaterialBatches=new Array(2*r),this._openColorBatches=new Array(2*r),this._openMaterialBatches=new Array(2*r);const o=Entity.supportsMaterialsforEntitiesOnTerrain(e);let a;for(this._supportsMaterialsforEntitiesOnTerrain=o,a=0;a<r;++a)this._outlineBatches[a]=new StaticOutlineGeometryBatch(i,e,a,!1),this._outlineBatches[r+a]=new StaticOutlineGeometryBatch(i,e,a,!0),this._closedColorBatches[a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!0,a,!0),this._closedColorBatches[r+a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!0,a,!1),this._closedMaterialBatches[a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!0,a,!0),this._closedMaterialBatches[r+a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!0,a,!1),this._openColorBatches[a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!1,a,!0),this._openColorBatches[r+a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!1,a,!1),this._openMaterialBatches[a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!1,a,!0),this._openMaterialBatches[r+a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!1,a,!1);const s=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES,c=new Array(s),l=[];if(o)for(a=0;a<s;++a)l.push(new StaticGroundGeometryPerMaterialBatch(n,a,MaterialAppearance)),c[a]=new StaticGroundGeometryColorBatch(n,a);else for(a=0;a<s;++a)c[a]=new StaticGroundGeometryColorBatch(n,a);this._groundColorBatches=c,this._groundMaterialBatches=l,this._dynamicBatch=new DynamicGeometryBatch(i,n),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new AssociativeArray,this._updaterSets=new AssociativeArray,this._entityCollection=t,t.collectionChanged.addEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray$1)}GeometryUpdaterSet.prototype._onEntityPropertyChanged=function(e,t,i,n){const r=this.updaters;for(let o=0;o<r.length;o++)r[o]._onEntityPropertyChanged(e,t,i,n)},GeometryUpdaterSet.prototype.forEach=function(e){const t=this.updaters;for(let i=0;i<t.length;i++)e(t[i])},GeometryUpdaterSet.prototype.destroy=function(){this.eventHelper.removeAll();const e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),destroyObject(this)},GeometryVisualizer.prototype.update=function(e){const t=this._addedObjects,i=t.values,n=this._removedObjects,r=n.values,o=this._changedObjects,a=o.values;let s,c,l,u;const d=this;for(s=a.length-1;s>-1;s--)c=a[s],l=c.id,u=this._updaterSets.get(l),u.entity===c?u.forEach((function(t){d._removeUpdater(t),d._insertUpdaterIntoBatch(e,t)})):(r.push(c),i.push(c));for(s=r.length-1;s>-1;s--)c=r[s],l=c.id,u=this._updaterSets.get(l),u.forEach(this._removeUpdater.bind(this)),u.destroy(),this._updaterSets.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(s=i.length-1;s>-1;s--)c=i[s],l=c.id,u=new GeometryUpdaterSet(c,this._scene),this._updaterSets.set(l,u),u.forEach((function(t){d._insertUpdaterIntoBatch(e,t)})),this._subscriptions.set(l,u.geometryChanged.addEventListener(GeometryVisualizer._onGeometryChanged,this));t.removeAll(),n.removeAll(),o.removeAll();let h=!0;const p=this._batches,f=p.length;for(s=0;s<f;s++)h=p[s].update(e)&&h;return h};const getBoundingSphereArrayScratch$2=[],getBoundingSphereBoundingSphereScratch$2=new BoundingSphere;GeometryVisualizer.prototype.getBoundingSphere=function(e,t){const i=getBoundingSphereArrayScratch$2,n=getBoundingSphereBoundingSphereScratch$2;let r=0,o=BoundingSphereState$1.DONE;const a=this._batches,s=a.length,c=e.id,l=this._updaterSets.get(c).updaters;for(let e=0;e<l.length;e++){const t=l[e];for(let e=0;e<s;e++){if(o=a[e].getBoundingSphere(t,n),o===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;o===BoundingSphereState$1.DONE&&(i[r]=BoundingSphere.clone(n,i[r]),r++)}}return 0===r?BoundingSphereState$1.FAILED:(i.length=r,BoundingSphere.fromBoundingSpheres(i,t),BoundingSphereState$1.DONE)},GeometryVisualizer.prototype.isDestroyed=function(){return!1},GeometryVisualizer.prototype.destroy=function(){let e;this._entityCollection.collectionChanged.removeEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();const t=this._batches;let i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();const n=this._subscriptions.values;for(i=n.length,e=0;e<i;e++)n[e]();this._subscriptions.removeAll();const r=this._updaterSets.values;for(i=r.length,e=0;e<i;e++)r[e].destroy();return this._updaterSets.removeAll(),destroyObject(this)},GeometryVisualizer.prototype._removeUpdater=function(e){const t=this._batches,i=t.length;for(let n=0;n<i;n++)t[n].remove(e)},GeometryVisualizer.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic)return void this._dynamicBatch.add(e,t);let i;(t.outlineEnabled||t.fillEnabled)&&(i=t.shadowsProperty.getValue(e));const n=ShadowMode$1.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(defined(t.terrainOffsetProperty)?this._outlineBatches[n+i].add(e,t):this._outlineBatches[i].add(e,t)),t.fillEnabled)if(t.onTerrain){const i=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof ColorMaterialProperty?this._groundColorBatches[i].add(e,t):this._groundMaterialBatches[i].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._closedColorBatches[n+i].add(e,t):this._closedColorBatches[i].add(e,t):defined(t.terrainOffsetProperty)?this._closedMaterialBatches[n+i].add(e,t):this._closedMaterialBatches[i].add(e,t):t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._openColorBatches[n+i].add(e,t):this._openColorBatches[i].add(e,t):defined(t.terrainOffsetProperty)?this._openMaterialBatches[n+i].add(e,t):this._openMaterialBatches[i].add(e,t)},GeometryVisualizer._onGeometryChanged=function(e){const t=this._removedObjects,i=this._changedObjects,n=e.entity,r=n.id;defined(t.get(r))||defined(i.get(r))||i.set(r,n)},GeometryVisualizer.prototype._onCollectionChanged=function(e,t,i){const n=this._addedObjects,r=this._removedObjects,o=this._changedObjects;let a,s,c;for(a=i.length-1;a>-1;a--)c=i[a],s=c.id,n.remove(s)||(r.set(s,c),o.remove(s));for(a=t.length-1;a>-1;a--)c=t[a],s=c.id,r.remove(s)?o.set(s,c):n.set(s,c)};const defaultScale$1=1,defaultFont="30px sans-serif",defaultStyle=LabelStyle$1.FILL,defaultFillColor=Color.WHITE,defaultOutlineColor$1=Color.BLACK,defaultOutlineWidth$1=1,defaultShowBackground=!1,defaultBackgroundColor$1=new Color(.165,.165,.165,.8),defaultBackgroundPadding=new Cartesian2(7,5),defaultPixelOffset=Cartesian2.ZERO,defaultEyeOffset=Cartesian3.ZERO,defaultHeightReference$1=HeightReference$1.NONE,defaultHorizontalOrigin=HorizontalOrigin$1.CENTER,defaultVerticalOrigin=VerticalOrigin$1.CENTER,positionScratch$1=new Cartesian3,fillColorScratch=new Color,outlineColorScratch$1=new Color,backgroundColorScratch=new Color,backgroundPaddingScratch=new Cartesian2,eyeOffsetScratch=new Cartesian3,pixelOffsetScratch=new Cartesian2,translucencyByDistanceScratch$1=new NearFarScalar,pixelOffsetScaleByDistanceScratch=new NearFarScalar,scaleByDistanceScratch$1=new NearFarScalar,distanceDisplayConditionScratch$2=new DistanceDisplayCondition;function EntityData$2(e){this.entity=e,this.label=void 0,this.index=void 0}function LabelVisualizer(e,t){t.collectionChanged.addEventListener(LabelVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$1(e,t,i){defined(e)&&(e.label=void 0,i.removeLabel(t))}LabelVisualizer.prototype.update=function(e){const t=this._items.values,i=this._cluster;for(let n=0,r=t.length;n<r;n++){const r=t[n],o=r.entity,a=o._label;let s,c,l=r.label,u=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(u&&(c=Property.getValueOrUndefined(o._position,e,positionScratch$1),s=Property.getValueOrUndefined(a._text,e),u=defined(c)&&defined(s)),!u){returnPrimitive$1(r,o,i);continue}Property.isConstant(o._position)||(i._clusterDirty=!0);let d=!1;const h=Property.getValueOrDefault(a._heightReference,e,defaultHeightReference$1);defined(l)||(l=i.getLabel(o),l.id=o,r.label=l,d=Cartesian3.equals(l.position,c)&&l.heightReference===h),l.show=!0,l.position=c,l.text=s,l.scale=Property.getValueOrDefault(a._scale,e,defaultScale$1),l.font=Property.getValueOrDefault(a._font,e,defaultFont),l.style=Property.getValueOrDefault(a._style,e,defaultStyle),l.fillColor=Property.getValueOrDefault(a._fillColor,e,defaultFillColor,fillColorScratch),l.outlineColor=Property.getValueOrDefault(a._outlineColor,e,defaultOutlineColor$1,outlineColorScratch$1),l.outlineWidth=Property.getValueOrDefault(a._outlineWidth,e,defaultOutlineWidth$1),l.showBackground=Property.getValueOrDefault(a._showBackground,e,defaultShowBackground),l.backgroundColor=Property.getValueOrDefault(a._backgroundColor,e,defaultBackgroundColor$1,backgroundColorScratch),l.backgroundPadding=Property.getValueOrDefault(a._backgroundPadding,e,defaultBackgroundPadding,backgroundPaddingScratch),l.pixelOffset=Property.getValueOrDefault(a._pixelOffset,e,defaultPixelOffset,pixelOffsetScratch),l.eyeOffset=Property.getValueOrDefault(a._eyeOffset,e,defaultEyeOffset,eyeOffsetScratch),l.heightReference=h,l.horizontalOrigin=Property.getValueOrDefault(a._horizontalOrigin,e,defaultHorizontalOrigin),l.verticalOrigin=Property.getValueOrDefault(a._verticalOrigin,e,defaultVerticalOrigin),l.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch$1),l.pixelOffsetScaleByDistance=Property.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch),l.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch$1),l.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$2),l.disableDepthTestDistance=Property.getValueOrUndefined(a._disableDepthTestDistance,e),d&&l._updateClamping()}return!0},LabelVisualizer.prototype.getBoundingSphere=function(e,t){const i=this._items.get(e.id);if(!defined(i)||!defined(i.label))return BoundingSphereState$1.FAILED;const n=i.label;return t.center=Cartesian3.clone(defaultValue(n._clampedPosition,n.position),t.center),t.radius=0,BoundingSphereState$1.DONE},LabelVisualizer.prototype.isDestroyed=function(){return!1},LabelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(LabelVisualizer.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return destroyObject(this)},LabelVisualizer.prototype._onCollectionChanged=function(e,t,i,n){let r,o;const a=this._items,s=this._cluster;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._label)&&defined(o._position)&&a.set(o.id,new EntityData$2(o));for(r=n.length-1;r>-1;r--)o=n[r],defined(o._label)&&defined(o._position)?a.contains(o.id)||a.set(o.id,new EntityData$2(o)):(returnPrimitive$1(a.get(o.id),o,s),a.remove(o.id));for(r=i.length-1;r>-1;r--)o=i[r],returnPrimitive$1(a.get(o.id),o,s),a.remove(o.id)};const defaultScale=1,defaultMinimumPixelSize=0,defaultIncrementallyLoadTextures=!0,defaultClampAnimations=!0,defaultShadows$1=ShadowMode$1.ENABLED,defaultHeightReference=HeightReference$1.NONE,defaultSilhouetteColor=Color.RED,defaultSilhouetteSize=0,defaultColor$2=Color.WHITE,defaultColorBlendMode=ColorBlendMode$1.HIGHLIGHT,defaultColorBlendAmount=.5,defaultImageBasedLightingFactor=new Cartesian2(1,1),modelMatrixScratch=new Matrix4,nodeMatrixScratch=new Matrix4;function ModelVisualizer(e,t){t.collectionChanged.addEventListener(ModelVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function removeModel(e,t,i,n){const r=i[t.id];defined(r)&&(n.removeAndDestroy(r.modelPrimitive),delete i[t.id])}function clearNodeTransformationsArticulationsScratch(e,t){const i=t[e.id];defined(i)&&(i.nodeTransformationsScratch={},i.articulationsScratch={})}function checkModelLoad(e,t,i){e.readyPromise.catch((function(e){console.error(e),i[t.id].loadFail=!0}))}function ScaledPositionProperty(e){this._definitionChanged=new Event,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}ModelVisualizer.prototype.update=function(e){const t=this._entitiesToVisualize.values,i=this._modelHash,n=this._primitives;for(let r=0,o=t.length;r<o;r++){const o=t[r],a=o._model;let s,c,l=i[o.id],u=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(u&&(c=o.computeModelMatrix(e,modelMatrixScratch),s=Resource.createIfNeeded(Property.getValueOrUndefined(a._uri,e)),u=defined(c)&&defined(s)),!u){defined(l)&&(l.modelPrimitive.show=!1);continue}let d=defined(l)?l.modelPrimitive:void 0;if(defined(d)&&s.url===l.url||(defined(d)&&(n.removeAndDestroy(d),delete i[o.id]),d=Model.fromGltf({url:s,incrementallyLoadTextures:Property.getValueOrDefault(a._incrementallyLoadTextures,e,defaultIncrementallyLoadTextures),scene:this._scene}),d.id=o,n.add(d),l={modelPrimitive:d,url:s.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1},i[o.id]=l,checkModelLoad(d,o,i)),d.show=!0,d.scale=Property.getValueOrDefault(a._scale,e,defaultScale),d.minimumPixelSize=Property.getValueOrDefault(a._minimumPixelSize,e,defaultMinimumPixelSize),d.maximumScale=Property.getValueOrUndefined(a._maximumScale,e),d.modelMatrix=Matrix4.clone(c,d.modelMatrix),d.shadows=Property.getValueOrDefault(a._shadows,e,defaultShadows$1),d.heightReference=Property.getValueOrDefault(a._heightReference,e,defaultHeightReference),d.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e),d.silhouetteColor=Property.getValueOrDefault(a._silhouetteColor,e,defaultSilhouetteColor,d._silhouetteColor),d.silhouetteSize=Property.getValueOrDefault(a._silhouetteSize,e,defaultSilhouetteSize),d.color=Property.getValueOrDefault(a._color,e,defaultColor$2,d._color),d.colorBlendMode=Property.getValueOrDefault(a._colorBlendMode,e,defaultColorBlendMode),d.colorBlendAmount=Property.getValueOrDefault(a._colorBlendAmount,e,defaultColorBlendAmount),d.clippingPlanes=Property.getValueOrUndefined(a._clippingPlanes,e),d.clampAnimations=Property.getValueOrDefault(a._clampAnimations,e,defaultClampAnimations),d.imageBasedLighting.imageBasedLightingFactor=Property.getValueOrDefault(a._imageBasedLightingFactor,e,defaultImageBasedLightingFactor),d.lightColor=Property.getValueOrUndefined(a._lightColor,e),d.ready){const t=Property.getValueOrDefault(a._runAnimations,e,!0);l.animationsRunning!==t&&(t?d.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT}):d.activeAnimations.removeAll(),l.animationsRunning=t);const i=Property.getValueOrUndefined(a._nodeTransformations,e,l.nodeTransformationsScratch);if(defined(i)){const e=Object.keys(i);for(let t=0,n=e.length;t<n;++t){const n=e[t],r=i[n];if(!defined(r))continue;const o=d.getNode(n);if(!defined(o))continue;const a=Matrix4.fromTranslationRotationScale(r,nodeMatrixScratch);o.matrix=Matrix4.multiply(o.originalMatrix,a,a)}}let n=!1;const r=Property.getValueOrUndefined(a._articulations,e,l.articulationsScratch);if(defined(r)){const e=Object.keys(r);for(let t=0,i=e.length;t<i;++t){const i=e[t],o=r[i];defined(o)&&(n=!0,d.setArticulationStage(i,o))}}n&&d.applyArticulations()}}return!0},ModelVisualizer.prototype.isDestroyed=function(){return!1},ModelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(ModelVisualizer.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives;for(let n=e.length-1;n>-1;n--)removeModel(this,e[n],t,i);return destroyObject(this)},ModelVisualizer.prototype.getBoundingSphere=function(e,t){const i=this._modelHash[e.id];if(!defined(i)||i.loadFail)return BoundingSphereState$1.FAILED;const n=i.modelPrimitive;if(!defined(n)||!n.show)return BoundingSphereState$1.FAILED;if(!n.ready)return BoundingSphereState$1.PENDING;if(n.heightReference===HeightReference$1.NONE)BoundingSphere.transform(n.boundingSphere,n.modelMatrix,t);else{if(!defined(n._clampedModelMatrix))return BoundingSphereState$1.PENDING;BoundingSphere.transform(n.boundingSphere,n._clampedModelMatrix,t)}return BoundingSphereState$1.DONE},ModelVisualizer.prototype._onCollectionChanged=function(e,t,i,n){let r,o;const a=this._entitiesToVisualize,s=this._modelHash,c=this._primitives;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._model)&&defined(o._position)&&a.set(o.id,o);for(r=n.length-1;r>-1;r--)o=n[r],defined(o._model)&&defined(o._position)?(clearNodeTransformationsArticulationsScratch(o,s),a.set(o.id,o)):(removeModel(this,o,s,c),a.remove(o.id));for(r=i.length-1;r>-1;r--)o=i[r],removeModel(this,o,s,c),a.remove(o.id)},Object.defineProperties(ScaledPositionProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return defined(this._value)?this._value.referenceFrame:ReferenceFrame$1.FIXED}}}),ScaledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ScaledPositionProperty.prototype.setValue=function(e){this._value!==e&&(this._value=e,defined(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),defined(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},ScaledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){if(defined(this._value))return defined(i=this._value.getValueInReferenceFrame(e,t,i))?Ellipsoid.WGS84.scaleToGeodeticSurface(i,i):void 0},ScaledPositionProperty.prototype.equals=function(e){return this===e||e instanceof ScaledPositionProperty&&this._value===e._value},ScaledPositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const defaultResolution=60,defaultWidth=1,scratchTimeInterval=new TimeInterval,subSampleCompositePropertyScratch=new TimeInterval,subSampleIntervalPropertyScratch=new TimeInterval;function EntityData$1(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function subSampleSampledProperty(e,t,i,n,r,o,a,s,c){let l,u=s;l=e.getValueInReferenceFrame(t,o,c[u]),defined(l)&&(c[u++]=l);let d=!defined(r)||JulianDate.lessThanOrEquals(r,t)||JulianDate.greaterThanOrEquals(r,i),h=0;const p=n.length;let f=n[h];const m=i;let g,_,y,C=!1;for(;h<p;){if(!d&&JulianDate.greaterThanOrEquals(f,r)&&(l=e.getValueInReferenceFrame(r,o,c[u]),defined(l)&&(c[u++]=l),d=!0),JulianDate.greaterThan(f,t)&&JulianDate.lessThan(f,m)&&!f.equals(r)&&(l=e.getValueInReferenceFrame(f,o,c[u]),defined(l)&&(c[u++]=l)),h<p-1){if(a>0&&!C){const e=n[h+1],t=JulianDate.secondsDifference(e,f);C=t>a,C&&(g=Math.ceil(t/a),_=0,y=t/Math.max(g,2),g=Math.max(g-1,1))}if(C&&_<g){f=JulianDate.addSeconds(f,y,new JulianDate),_++;continue}}C=!1,h++,f=n[h]}return l=e.getValueInReferenceFrame(i,o,c[u]),defined(l)&&(c[u++]=l),u}function subSampleGenericProperty(e,t,i,n,r,o,a,s){let c,l=0,u=a,d=t;const h=Math.max(o,60);let p=!defined(n)||JulianDate.lessThanOrEquals(n,t)||JulianDate.greaterThanOrEquals(n,i);for(;JulianDate.lessThan(d,i);)!p&&JulianDate.greaterThanOrEquals(d,n)&&(p=!0,c=e.getValueInReferenceFrame(n,r,s[u]),defined(c)&&(s[u]=c,u++)),c=e.getValueInReferenceFrame(d,r,s[u]),defined(c)&&(s[u]=c,u++),l++,d=JulianDate.addSeconds(t,h*l,new JulianDate);return c=e.getValueInReferenceFrame(i,r,s[u]),defined(c)&&(s[u]=c,u++),u}function subSampleIntervalProperty(e,t,i,n,r,o,a,s){subSampleIntervalPropertyScratch.start=t,subSampleIntervalPropertyScratch.stop=i;let c=a;const l=e.intervals;for(let t=0;t<l.length;t++){const i=l.get(t);if(!TimeInterval.intersect(i,subSampleIntervalPropertyScratch,scratchTimeInterval).isEmpty){let t=i.start;i.isStartIncluded||(t=i.isStopIncluded?i.stop:JulianDate.addSeconds(i.start,JulianDate.secondsDifference(i.stop,i.start)/2,new JulianDate));const n=e.getValueInReferenceFrame(t,r,s[c]);defined(n)&&(s[c]=n,c++)}}return c}function subSampleConstantProperty(e,t,i,n,r,o,a,s){const c=e.getValueInReferenceFrame(t,r,s[a]);return defined(c)&&(s[a++]=c),a}function subSampleCompositeProperty(e,t,i,n,r,o,a,s){subSampleCompositePropertyScratch.start=t,subSampleCompositePropertyScratch.stop=i;let c=a;const l=e.intervals;for(let e=0;e<l.length;e++){const a=l.get(e);if(!TimeInterval.intersect(a,subSampleCompositePropertyScratch,scratchTimeInterval).isEmpty){const e=a.start,l=a.stop;let u=t;JulianDate.greaterThan(e,u)&&(u=e);let d=i;JulianDate.lessThan(l,d)&&(d=l),c=reallySubSample(a.data,u,d,n,r,o,c,s)}}return c}function reallySubSample(e,t,i,n,r,o,a,s){for(;e instanceof ReferenceProperty;)e=e.resolvedProperty;if(e instanceof SampledPositionProperty){a=subSampleSampledProperty(e,t,i,e._property._times,n,r,o,a,s)}else a=e instanceof CompositePositionProperty?subSampleCompositeProperty(e,t,i,n,r,o,a,s):e instanceof TimeIntervalCollectionPositionProperty?subSampleIntervalProperty(e,t,i,n,r,o,a,s):e instanceof ConstantPositionProperty||e instanceof ScaledPositionProperty&&Property.isConstant(e)?subSampleConstantProperty(e,t,i,n,r,o,a,s):subSampleGenericProperty(e,t,i,n,r,o,a,s);return a}function subSample(e,t,i,n,r,o,a){defined(a)||(a=[]);const s=reallySubSample(e,t,i,n,r,o,0,a);return a.length=s,a}const toFixedScratch=new Matrix3;function PolylineUpdater(e,t){this._unusedIndexes=[],this._polylineCollection=new PolylineCollection,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}function PathVisualizer(e,t){t.collectionChanged.addEventListener(PathVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}PolylineUpdater.prototype.update=function(e){if(this._referenceFrame===ReferenceFrame$1.INERTIAL){let t=Transforms.computeIcrfToFixedMatrix(e,toFixedScratch);defined(t)||(t=Transforms.computeTemeToPseudoFixedMatrix(e,toFixedScratch)),Matrix4.fromRotationTranslation(t,Cartesian3.ZERO,this._polylineCollection.modelMatrix)}},PolylineUpdater.prototype.updateObject=function(e,t){const i=t.entity,n=i._path,r=i._position;let o,a;const s=n._show;let c=t.polyline,l=i.isShowing&&i.isAvailable(e)&&(!defined(s)||s.getValue(e));if(l){const t=Property.getValueOrUndefined(n._leadTime,e),r=Property.getValueOrUndefined(n._trailTime,e),s=i._availability,c=defined(s),u=defined(t),d=defined(r);if(l=c||u&&d,l){if(d&&(o=JulianDate.addSeconds(e,-r,new JulianDate)),u&&(a=JulianDate.addSeconds(e,t,new JulianDate)),c){const e=s.start,t=s.stop;d&&!JulianDate.greaterThan(e,o)||(o=e),u&&!JulianDate.lessThan(t,a)||(a=t)}l=JulianDate.lessThan(o,a)}}if(!l)return void(defined(c)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,c.show=!1,t.index=void 0));if(!defined(c)){const e=this._unusedIndexes;if(e.length>0){const i=e.pop();c=this._polylineCollection.get(i),t.index=i}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=i,t.polyline=c}const u=Property.getValueOrDefault(n._resolution,e,defaultResolution);c.show=!0,c.positions=subSample(r,o,a,e,this._referenceFrame,u,c.positions.slice()),c.material=MaterialProperty.getValue(e,n._material,c.material),c.width=Property.getValueOrDefault(n._width,e,defaultWidth),c.distanceDisplayCondition=Property.getValueOrUndefined(n._distanceDisplayCondition,e,c.distanceDisplayCondition)},PolylineUpdater.prototype.removeObject=function(e){const t=e.polyline;defined(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)},PolylineUpdater.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),destroyObject(this)},PathVisualizer.prototype.update=function(e){const t=this._updaters;for(const i in t)t.hasOwnProperty(i)&&t[i].update(e);const i=this._items.values;if(0===i.length&&defined(this._updaters)&&Object.keys(this._updaters).length>0){for(const e in t)t.hasOwnProperty(e)&&t[e].destroy();this._updaters={}}for(let t=0,n=i.length;t<n;t++){const n=i[t],r=n.entity._position,o=n.updater;let a=ReferenceFrame$1.FIXED;this._scene.mode===SceneMode$1.SCENE3D&&(a=r.referenceFrame);let s=this._updaters[a];o===s&&defined(s)?s.updateObject(e,n):(defined(o)&&o.removeObject(n),defined(s)||(s=new PolylineUpdater(this._scene,a),s.update(e),this._updaters[a]=s),n.updater=s,defined(s)&&s.updateObject(e,n))}return!0},PathVisualizer.prototype.isDestroyed=function(){return!1},PathVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PathVisualizer.prototype._onCollectionChanged,this);const e=this._updaters;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();return destroyObject(this)},PathVisualizer.prototype._onCollectionChanged=function(e,t,i,n){let r,o,a;const s=this._items;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._path)&&defined(o._position)&&s.set(o.id,new EntityData$1(o));for(r=n.length-1;r>-1;r--)o=n[r],defined(o._path)&&defined(o._position)?s.contains(o.id)||s.set(o.id,new EntityData$1(o)):(a=s.get(o.id),defined(a)&&(defined(a.updater)&&a.updater.removeObject(a),s.remove(o.id)));for(r=i.length-1;r>-1;r--)o=i[r],a=s.get(o.id),defined(a)&&(defined(a.updater)&&a.updater.removeObject(a),s.remove(o.id))},PathVisualizer._subSample=subSample;const defaultColor$1=Color.WHITE,defaultOutlineColor=Color.BLACK,defaultOutlineWidth=0,defaultPixelSize=1,defaultDisableDepthTestDistance=0,colorScratch$1=new Color,positionScratch=new Cartesian3,outlineColorScratch=new Color,scaleByDistanceScratch=new NearFarScalar,translucencyByDistanceScratch=new NearFarScalar,distanceDisplayConditionScratch$1=new DistanceDisplayCondition;function EntityData(e){this.entity=e,this.pointPrimitive=void 0,this.billboard=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function PointVisualizer(e,t){t.collectionChanged.addEventListener(PointVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive(e,t,i){if(defined(e)){if(defined(e.pointPrimitive))return e.pointPrimitive=void 0,void i.removePoint(t);defined(e.billboard)&&(e.billboard=void 0,i.removeBillboard(t))}}PointVisualizer.prototype.update=function(e){const t=this._items.values,i=this._cluster;for(let n=0,r=t.length;n<r;n++){const r=t[n],o=r.entity,a=o._point;let s=r.pointPrimitive,c=r.billboard;const l=Property.getValueOrDefault(a._heightReference,e,HeightReference$1.NONE);let u,d=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(d&&(u=Property.getValueOrUndefined(o._position,e,positionScratch),d=defined(u)),!d){returnPrimitive(r,o,i);continue}Property.isConstant(o._position)||(i._clusterDirty=!0);let h=!1,p=!1;if(l===HeightReference$1.NONE||defined(c)?l!==HeightReference$1.NONE||defined(s)||(defined(c)&&(returnPrimitive(r,o,i),c=void 0),s=i.getPoint(o),s.id=o,r.pointPrimitive=s):(defined(s)&&(returnPrimitive(r,o,i),s=void 0),c=i.getBillboard(o),c.id=o,c.image=void 0,r.billboard=c,h=!0,p=Cartesian3.equals(c.position,u)&&c.heightReference===l),defined(s))s.show=!0,s.position=u,s.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch),s.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch),s.color=Property.getValueOrDefault(a._color,e,defaultColor$1,colorScratch$1),s.outlineColor=Property.getValueOrDefault(a._outlineColor,e,defaultOutlineColor,outlineColorScratch),s.outlineWidth=Property.getValueOrDefault(a._outlineWidth,e,defaultOutlineWidth),s.pixelSize=Property.getValueOrDefault(a._pixelSize,e,defaultPixelSize),s.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$1),s.disableDepthTestDistance=Property.getValueOrDefault(a._disableDepthTestDistance,e,defaultDisableDepthTestDistance);else if(defined(c)){c.show=!0,c.position=u,c.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch),c.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch),c.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$1),c.disableDepthTestDistance=Property.getValueOrDefault(a._disableDepthTestDistance,e,defaultDisableDepthTestDistance),c.heightReference=l;const t=Property.getValueOrDefault(a._color,e,defaultColor$1,colorScratch$1),i=Property.getValueOrDefault(a._outlineColor,e,defaultOutlineColor,outlineColorScratch),n=Math.round(Property.getValueOrDefault(a._outlineWidth,e,defaultOutlineWidth));let o=Math.max(1,Math.round(Property.getValueOrDefault(a._pixelSize,e,defaultPixelSize)));if(n>0?(c.scale=1,h=h||n!==r.outlineWidth||o!==r.pixelSize||!Color.equals(t,r.color)||!Color.equals(i,r.outlineColor)):(c.scale=o/50,o=50,h=h||n!==r.outlineWidth||!Color.equals(t,r.color)||!Color.equals(i,r.outlineColor)),h){r.color=Color.clone(t,r.color),r.outlineColor=Color.clone(i,r.outlineColor),r.pixelSize=o,r.outlineWidth=n;const e=t.alpha,a=t.toCssColorString(),s=i.toCssColorString(),l=JSON.stringify([a,o,s,n]);c.setImage(l,createBillboardPointCallback(e,a,s,n,o))}p&&c._updateClamping()}}return!0},PointVisualizer.prototype.getBoundingSphere=function(e,t){const i=this._items.get(e.id);if(!defined(i)||!defined(i.pointPrimitive)&&!defined(i.billboard))return BoundingSphereState$1.FAILED;if(defined(i.pointPrimitive))t.center=Cartesian3.clone(i.pointPrimitive.position,t.center);else{const e=i.billboard;if(!defined(e._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(e._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},PointVisualizer.prototype.isDestroyed=function(){return!1},PointVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PointVisualizer.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return destroyObject(this)},PointVisualizer.prototype._onCollectionChanged=function(e,t,i,n){let r,o;const a=this._items,s=this._cluster;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._point)&&defined(o._position)&&a.set(o.id,new EntityData(o));for(r=n.length-1;r>-1;r--)o=n[r],defined(o._point)&&defined(o._position)?a.contains(o.id)||a.set(o.id,new EntityData(o)):(returnPrimitive(a.get(o.id),o,s),a.remove(o.id));for(r=i.length-1;r>-1;r--)o=i[r],returnPrimitive(a.get(o.id),o,s),a.remove(o.id)};const defaultZIndex=new ConstantProperty(0),polylineCollections={},scratchColor$4=new Color,defaultMaterial=new ColorMaterialProperty(Color.WHITE),defaultShow=new ConstantProperty(!0),defaultShadows=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition$1=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType=new ConstantProperty(ClassificationType$1.BOTH);function GeometryOptions(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function GroundGeometryOptions(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function PolylineGeometryUpdater(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(PolylineGeometryUpdater.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new Event,this._showProperty=void 0,this._materialProperty=void 0,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._depthFailMaterialProperty=void 0,this._geometryOptions=new GeometryOptions,this._groundGeometryOptions=new GroundGeometryOptions,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=Entity.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(PolylineGeometryUpdater.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},depthFailMaterialProperty:{get:function(){return this._depthFailMaterialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}},arcType:{get:function(){return this._arcType}},clampToGround:{get:function(){return this._clampToGround&&this._supportsPolylinesOnTerrain}},zIndex:{get:function(){return this._zIndex}}}),PolylineGeometryUpdater.prototype.isOutlineVisible=function(e){return!1},PolylineGeometryUpdater.prototype.isFilled=function(e){const t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e),!1)},PolylineGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,i=t.isAvailable(e),n=new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)),r=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)};let a;return this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||i)&&(a=this._materialProperty.color.getValue(e,scratchColor$4)),defined(a)||(a=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(a)),this.clampToGround?new GeometryInstance({id:t,geometry:new GroundPolylineGeometry(this._groundGeometryOptions),attributes:o}):(defined(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof ColorMaterialProperty&&(defined(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||i)&&(a=this._depthFailMaterialProperty.color.getValue(e,scratchColor$4)),defined(a)||(a=Color.WHITE),o.depthFailColor=ColorGeometryInstanceAttribute.fromColor(a)),new GeometryInstance({id:t,geometry:new PolylineGeometry(this._geometryOptions),attributes:o}))},PolylineGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){},PolylineGeometryUpdater.prototype.isDestroyed=function(){return!1},PolylineGeometryUpdater.prototype.destroy=function(){this._entitySubscription(),destroyObject(this)},PolylineGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,n){if("availability"!==t&&"polyline"!==t)return;const r=this._entity.polyline;if(!defined(r))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));const o=r.positions,a=r.show;if(defined(a)&&a.isConstant&&!a.getValue(Iso8601.MINIMUM_VALUE)||!defined(o))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));const s=r.zIndex,c=defaultValue(r.material,defaultMaterial),l=c instanceof ColorMaterialProperty;this._materialProperty=c,this._depthFailMaterialProperty=r.depthFailMaterial,this._showProperty=defaultValue(a,defaultShow),this._shadowsProperty=defaultValue(r.shadows,defaultShadows),this._distanceDisplayConditionProperty=defaultValue(r.distanceDisplayCondition,defaultDistanceDisplayCondition$1),this._classificationTypeProperty=defaultValue(r.classificationType,defaultClassificationType),this._fillEnabled=!0,this._zIndex=defaultValue(s,defaultZIndex);const u=r.width,d=r.arcType,h=r.clampToGround,p=r.granularity;if(o.isConstant&&Property.isConstant(u)&&Property.isConstant(d)&&Property.isConstant(p)&&Property.isConstant(h)&&Property.isConstant(s)){const e=this._geometryOptions,t=o.getValue(Iso8601.MINIMUM_VALUE,e.positions);if(!defined(t)||t.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));let i;i=l&&(!defined(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof ColorMaterialProperty)?PolylineColorAppearance.VERTEX_FORMAT:PolylineMaterialAppearance.VERTEX_FORMAT,e.vertexFormat=i,e.positions=t,e.width=defined(u)?u.getValue(Iso8601.MINIMUM_VALUE):void 0,e.arcType=defined(d)?d.getValue(Iso8601.MINIMUM_VALUE):void 0,e.granularity=defined(p)?p.getValue(Iso8601.MINIMUM_VALUE):void 0;const n=this._groundGeometryOptions;n.positions=t,n.width=e.width,n.arcType=e.arcType,n.granularity=e.granularity,this._clampToGround=!!defined(h)&&h.getValue(Iso8601.MINIMUM_VALUE),!this._clampToGround&&defined(s)&&oneTimeWarning("Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))},PolylineGeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new DynamicGeometryUpdater(e,t,this)};const generateCartesianArcOptions={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function DynamicGeometryUpdater(e,t,i){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=i,this._positions=[]}function getLine(e){if(defined(e._line))return e._line;const t=e._geometryUpdater._scene.id;let i=polylineCollections[t];const n=e._primitives;!defined(i)||i.isDestroyed()?(i=new PolylineCollection,polylineCollections[t]=i,n.add(i)):n.contains(i)||n.add(i);const r=i.add();return r.id=e._geometryUpdater._entity,e._line=r,r}DynamicGeometryUpdater.prototype.update=function(e){const t=this._geometryUpdater,i=t._entity,n=i.polyline,r=n.positions;let o=Property.getValueOrUndefined(r,e,this._positions);t._clampToGround=Property.getValueOrDefault(n._clampToGround,e,!1),t._groundGeometryOptions.positions=o,t._groundGeometryOptions.width=Property.getValueOrDefault(n._width,e,1),t._groundGeometryOptions.arcType=Property.getValueOrDefault(n._arcType,e,ArcType$1.GEODESIC),t._groundGeometryOptions.granularity=Property.getValueOrDefault(n._granularity,e,9999);const a=this._groundPrimitives;if(defined(this._groundPolylinePrimitive)&&(a.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!i.isShowing||!i.isAvailable(e)||!Property.getValueOrDefault(n._show,e,!0))return;if(!defined(o)||o.length<2)return;const r=t.fillMaterialProperty;let s;if(r instanceof ColorMaterialProperty)s=new PolylineColorAppearance;else{const t=MaterialProperty.getValue(e,r,this._material);s=new PolylineMaterialAppearance({material:t,translucent:t.isTranslucent()}),this._material=t}return this._groundPolylinePrimitive=a.add(new GroundPolylinePrimitive({geometryInstances:t.createFillGeometryInstance(e),appearance:s,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),Property.getValueOrUndefined(t.zIndex,e)),void(defined(this._line)&&(this._line.show=!1))}const s=getLine(this);if(!i.isShowing||!i.isAvailable(e)||!Property.getValueOrDefault(n._show,e,!0))return void(s.show=!1);if(!defined(o)||o.length<2)return void(s.show=!1);let c=ArcType$1.GEODESIC;c=Property.getValueOrDefault(n._arcType,e,c);const l=t._scene.globe;c!==ArcType$1.NONE&&defined(l)&&(generateCartesianArcOptions.ellipsoid=l.ellipsoid,generateCartesianArcOptions.positions=o,generateCartesianArcOptions.granularity=Property.getValueOrUndefined(n._granularity,e),generateCartesianArcOptions.height=PolylinePipeline.extractHeights(o,l.ellipsoid),o=c===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc(generateCartesianArcOptions):PolylinePipeline.generateCartesianRhumbArc(generateCartesianArcOptions)),s.show=!0,s.positions=o.slice(),s.material=MaterialProperty.getValue(e,t.fillMaterialProperty,s.material),s.width=Property.getValueOrDefault(n._width,e,1),s.distanceDisplayCondition=Property.getValueOrUndefined(n._distanceDisplayCondition,e,s.distanceDisplayCondition)},DynamicGeometryUpdater.prototype.getBoundingSphere=function(e){if(this._geometryUpdater.clampToGround){const t=this._groundPolylinePrimitive;if(defined(t)&&t.show&&t.ready){const i=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(defined(i)&&defined(i.boundingSphere))return BoundingSphere.clone(i.boundingSphere,e),BoundingSphereState$1.DONE}return defined(t)&&!t.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.DONE}{const t=getLine(this);if(t.show&&t.positions.length>0)return BoundingSphere.fromPoints(t.positions,e),BoundingSphereState$1.DONE}return BoundingSphereState$1.FAILED},DynamicGeometryUpdater.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater.prototype.destroy=function(){const e=this._geometryUpdater._scene.id,t=polylineCollections[e];defined(t)&&(t.remove(this._line),0===t.length&&(this._primitives.removeAndDestroy(t),delete polylineCollections[e])),defined(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),destroyObject(this)};const scratchColor$3=new Color,distanceDisplayConditionScratch=new DistanceDisplayCondition,defaultDistanceDisplayCondition=new DistanceDisplayCondition;function Batch(e,t,i,n,r){let o;o=i instanceof ColorMaterialProperty?PolylineColorAppearance:PolylineMaterialAppearance,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=o,this.materialProperty=i,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Batch.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.zIndex=n,this._asynchronous=r}function StaticGroundPolylinePerMaterialBatch(e,t,i){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=defaultValue(i,!0)}Batch.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch.prototype.isMaterial=function(e){const t=this.materialProperty,i=e.fillMaterialProperty;return i===t||i instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(i)},Batch.prototype.add=function(e,t,i){const n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,i),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)){const e=this;this.subscriptions.set(n,t.entity.definitionChanged.addEventListener((function(i,n,r,o){"isShowing"===n&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(n,t);this.createPrimitive=!0},Batch.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t)),!0}return!1},Batch.prototype.update=function(e){let t=!0,i=this.primitive;const n=this.orderedGroundPrimitives,r=this.geometry.values;let o;if(this.createPrimitive){if(r.length>0)defined(i)&&(defined(this.oldPrimitive)?n.remove(i):this.oldPrimitive=i),i=new GroundPolylinePrimitive({show:!1,asynchronous:this._asynchronous,geometryInstances:r.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),i.appearance.material=this.material),n.add(i,this.zIndex),t=!1;else{defined(i)&&(n.remove(i),i=void 0);const e=this.oldPrimitive;defined(e)&&(n.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1}else if(defined(i)&&i.ready){i.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);const t=this.updatersWithAttributes.values,r=t.length;for(o=0;o<r;o++){const n=t[o],r=n.entity,a=this.geometry.get(n.id);let s=this.attributes.get(a.id.id);if(defined(s)||(s=i.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,s)),!n.fillMaterialProperty.isConstant){const t=n.fillMaterialProperty.color,i=Property.getValueOrDefault(t,e,Color.WHITE,scratchColor$3);Color.equals(s._lastColor,i)||(s._lastColor=Color.clone(i,s._lastColor),s.color=ColorGeometryInstanceAttribute.toValue(i,s.color))}const c=r.isShowing&&(n.hasConstantFill||n.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=n.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition,distanceDisplayConditionScratch);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}}this.updateShows(i)}else defined(i)&&!i.ready&&(t=!1);return t},Batch.prototype.updateShows=function(e){const t=this.showsUpdated.values,i=t.length;for(let n=0;n<i;n++){const i=t[n],r=i.entity,o=this.geometry.get(i.id);let a=this.attributes.get(o.id.id);defined(a)||(a=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,a));const s=r.isShowing;s!==(1===a.show[0])&&(a.show=ShowGeometryInstanceAttribute.toValue(s,a.show),o.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()},Batch.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch.prototype.getBoundingSphere=function(e,t){const i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;const n=i.getGeometryInstanceAttributes(e.entity);return!defined(n)||!defined(n.boundingSphere)||defined(n.show)&&0===n.show[0]?BoundingSphereState$1.FAILED:(n.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch.prototype.destroy=function(){const e=this.primitive,t=this.orderedGroundPrimitives;defined(e)&&t.remove(e);const i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGroundPolylinePerMaterialBatch.prototype.add=function(e,t){const i=this._items,n=i.length,r=t.createFillGeometryInstance(e),o=Property.getValueOrDefault(t.zIndex,0);for(let a=0;a<n;++a){const n=i[a];if(n.isMaterial(t)&&n.zIndex===o)return void n.add(e,t,r)}const a=new Batch(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,o,this._asynchronous);a.add(e,t,r),i.push(a)},StaticGroundPolylinePerMaterialBatch.prototype.remove=function(e){const t=this._items;for(let i=t.length-1;i>=0;i--){const n=t[i];if(n.remove(e)){0===n.updaters.length&&(t.splice(i,1),n.destroy());break}}},StaticGroundPolylinePerMaterialBatch.prototype.update=function(e){let t;const i=this._items;for(t=i.length-1;t>=0;t--){const n=i[t];if(n.invalidated){i.splice(t,1);const r=n.updaters.values,o=r.length;for(let t=0;t<o;t++)this.add(e,r[t]);n.destroy()}}let n=!0;for(t=0;t<i.length;t++)n=i[t].update(e)&&n;return n},StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere=function(e,t){const i=this._items,n=i.length;for(let r=0;r<n;r++){const n=i[r];if(n.contains(e))return n.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundPolylinePerMaterialBatch.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let i=0;i<t;i++)e[i].destroy();this._items.length=0};const emptyArray=[];function removeUpdater(e,t){const i=e._batches,n=i.length;for(let e=0;e<n;e++)i[e].remove(t)}function insertUpdaterIntoBatch(e,t,i){if(i.isDynamic)return void e._dynamicBatch.add(t,i);if(i.clampToGround&&i.fillEnabled){const n=i.classificationTypeProperty.getValue(t);return void e._groundBatches[n].add(t,i)}let n;i.fillEnabled&&(n=i.shadowsProperty.getValue(t));let r,o=0;defined(i.depthFailMaterialProperty)&&(o=i.depthFailMaterialProperty instanceof ColorMaterialProperty?1:2),defined(n)&&(r=n+o*ShadowMode$1.NUMBER_OF_SHADOW_MODES),i.fillEnabled&&(i.fillMaterialProperty instanceof ColorMaterialProperty?e._colorBatches[r].add(t,i):e._materialBatches[r].add(t,i))}function PolylineVisualizer(e,t,i,n){let r;n=defaultValue(n,e.groundPrimitives),i=defaultValue(i,e.primitives),this._scene=e,this._primitives=i,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;const o=ShadowMode$1.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(3*o),this._materialBatches=new Array(3*o),r=0;r<o;++r)this._colorBatches[r]=new StaticGeometryColorBatch(i,PolylineColorAppearance,void 0,!1,r),this._materialBatches[r]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,void 0,!1,r),this._colorBatches[r+o]=new StaticGeometryColorBatch(i,PolylineColorAppearance,PolylineColorAppearance,!1,r),this._materialBatches[r+o]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,PolylineColorAppearance,!1,r),this._colorBatches[r+2*o]=new StaticGeometryColorBatch(i,PolylineColorAppearance,PolylineMaterialAppearance,!1,r),this._materialBatches[r+2*o]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,PolylineMaterialAppearance,!1,r);this._dynamicBatch=new DynamicGeometryBatch(i,n);const a=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(a),r=0;r<a;++r)this._groundBatches[r]=new StaticGroundPolylinePerMaterialBatch(n,r);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new AssociativeArray,this._updaters=new AssociativeArray,this._entityCollection=t,t.collectionChanged.addEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray)}PolylineVisualizer.prototype.update=function(e){const t=this._addedObjects,i=t.values,n=this._removedObjects,r=n.values,o=this._changedObjects,a=o.values;let s,c,l,u;for(s=a.length-1;s>-1;s--)c=a[s],l=c.id,u=this._updaters.get(l),u.entity===c?(removeUpdater(this,u),insertUpdaterIntoBatch(this,e,u)):(r.push(c),i.push(c));for(s=r.length-1;s>-1;s--)c=r[s],l=c.id,u=this._updaters.get(l),removeUpdater(this,u),u.destroy(),this._updaters.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(s=i.length-1;s>-1;s--)c=i[s],l=c.id,u=new PolylineGeometryUpdater(c,this._scene),this._updaters.set(l,u),insertUpdaterIntoBatch(this,e,u),this._subscriptions.set(l,u.geometryChanged.addEventListener(PolylineVisualizer._onGeometryChanged,this));t.removeAll(),n.removeAll(),o.removeAll();let d=!0;const h=this._batches,p=h.length;for(s=0;s<p;s++)d=h[s].update(e)&&d;return d};const getBoundingSphereArrayScratch$1=[],getBoundingSphereBoundingSphereScratch$1=new BoundingSphere;function DataSourceDisplay(e){GroundPrimitive.initializeTerrainHeights(),GroundPolylinePrimitive.initializeTerrainHeights();const t=e.scene,i=e.dataSourceCollection;this._eventHelper=new EventHelper,this._eventHelper.add(i.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(i.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(i.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=i,this._scene=t,this._visualizersCallback=defaultValue(e.visualizersCallback,DataSourceDisplay.defaultVisualizersCallback);let n=!1;const r=new PrimitiveCollection,o=new PrimitiveCollection;i.length>0&&(t.primitives.add(r),t.groundPrimitives.add(o),n=!0),this._primitives=r,this._groundPrimitives=o;for(let e=0,t=i.length;e<t;e++)this._onDataSourceAdded(i,i.get(e));const a=new CustomDataSource;let s,c;if(this._onDataSourceAdded(void 0,a),this._defaultDataSource=a,!n){const e=this,n=function(){t.primitives.add(r),t.groundPrimitives.add(o),s(),c(),e._removeDefaultDataSourceListener=void 0,e._removeDataSourceCollectionListener=void 0};s=a.entities.collectionChanged.addEventListener(n),c=i.dataSourceAdded.addEventListener(n)}this._removeDefaultDataSourceListener=s,this._removeDataSourceCollectionListener=c,this._ready=!1}PolylineVisualizer.prototype.getBoundingSphere=function(e,t){const i=getBoundingSphereArrayScratch$1,n=getBoundingSphereBoundingSphereScratch$1;let r=0,o=BoundingSphereState$1.DONE;const a=this._batches,s=a.length,c=this._updaters.get(e.id);for(let e=0;e<s;e++){if(o=a[e].getBoundingSphere(c,n),o===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;o===BoundingSphereState$1.DONE&&(i[r]=BoundingSphere.clone(n,i[r]),r++)}return 0===r?BoundingSphereState$1.FAILED:(i.length=r,BoundingSphere.fromBoundingSpheres(i,t),BoundingSphereState$1.DONE)},PolylineVisualizer.prototype.isDestroyed=function(){return!1},PolylineVisualizer.prototype.destroy=function(){let e;this._entityCollection.collectionChanged.removeEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();const t=this._batches;let i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();const n=this._subscriptions.values;for(i=n.length,e=0;e<i;e++)n[e]();return this._subscriptions.removeAll(),destroyObject(this)},PolylineVisualizer._onGeometryChanged=function(e){const t=this._removedObjects,i=this._changedObjects,n=e.entity,r=n.id;defined(t.get(r))||defined(i.get(r))||i.set(r,n)},PolylineVisualizer.prototype._onCollectionChanged=function(e,t,i){const n=this._addedObjects,r=this._removedObjects,o=this._changedObjects;let a,s,c;for(a=i.length-1;a>-1;a--)c=i[a],s=c.id,n.remove(s)||(r.set(s,c),o.remove(s));for(a=t.length-1;a>-1;a--)c=t[a],s=c.id,r.remove(s)?o.set(s,c):n.set(s,c)},DataSourceDisplay.defaultVisualizersCallback=function(e,t,i){const n=i.entities;return[new BillboardVisualizer(t,n),new GeometryVisualizer(e,n,i._primitives,i._groundPrimitives),new LabelVisualizer(t,n),new ModelVisualizer(e,n),new Cesium3DTilesetVisualizer(e,n),new PointVisualizer(t,n),new PathVisualizer(e,n),new PolylineVisualizer(e,n,i._primitives,i._groundPrimitives)]},Object.defineProperties(DataSourceDisplay.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}},ready:{get:function(){return this._ready}}}),DataSourceDisplay.prototype.isDestroyed=function(){return!1},DataSourceDisplay.prototype.destroy=function(){this._eventHelper.removeAll();const e=this._dataSourceCollection;for(let t=0,i=e.length;t<i;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),defined(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),destroyObject(this)},DataSourceDisplay.prototype.update=function(e){if(!ApproximateTerrainHeights.initialized)return this._ready=!1,!1;let t,i,n,r,o=!0;const a=this._dataSourceCollection,s=a.length;for(t=0;t<s;t++){const s=a.get(t);for(defined(s.update)&&(o=s.update(e)&&o),n=s._visualizers,r=n.length,i=0;i<r;i++)o=n[i].update(e)&&o}for(n=this._defaultDataSource._visualizers,r=n.length,i=0;i<r;i++)o=n[i].update(e)&&o;return this._ready=o,o},DataSourceDisplay.prototype._postRender=function(){const e=this._scene.frameState,t=this._dataSourceCollection,i=t.length;for(let n=0;n<i;n++){const i=t.get(n),r=i.credit;defined(r)&&e.creditDisplay.addCredit(r);const o=i._resourceCredits;if(defined(o)){const t=o.length;for(let i=0;i<t;i++)e.creditDisplay.addCredit(o[i])}}};const getBoundingSphereArrayScratch=[],getBoundingSphereBoundingSphereScratch=new BoundingSphere;DataSourceDisplay.prototype.getBoundingSphere=function(e,t,i){if(!this._ready)return BoundingSphereState$1.PENDING;let n,r,o=this._defaultDataSource;if(!o.entities.contains(e)){o=void 0;const t=this._dataSourceCollection;for(r=t.length,n=0;n<r;n++){const i=t.get(n);if(i.entities.contains(e)){o=i;break}}}if(!defined(o))return BoundingSphereState$1.FAILED;const a=getBoundingSphereArrayScratch,s=getBoundingSphereBoundingSphereScratch;let c=0,l=BoundingSphereState$1.DONE;const u=o._visualizers,d=u.length;for(n=0;n<d;n++){if(defined(u[n].getBoundingSphere)){if(l=u[n].getBoundingSphere(e,s),!t&&l===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;l===BoundingSphereState$1.DONE&&(a[c]=BoundingSphere.clone(s,a[c]),c++)}}return 0===c?BoundingSphereState$1.FAILED:(a.length=c,BoundingSphere.fromBoundingSpheres(a,i),BoundingSphereState$1.DONE)},DataSourceDisplay.prototype._onDataSourceAdded=function(e,t){const i=this._scene,n=this._primitives,r=this._groundPrimitives,o=n.add(new PrimitiveCollection),a=r.add(new OrderedGroundPrimitiveCollection);t._primitives=o,t._groundPrimitives=a;const s=t.clustering;s._initialize(i),o.add(s),t._visualizers=this._visualizersCallback(i,s,t)},DataSourceDisplay.prototype._onDataSourceRemoved=function(e,t){const i=this._primitives,n=this._groundPrimitives,r=t._primitives,o=t._groundPrimitives,a=t.clustering;r.remove(a);const s=t._visualizers,c=s.length;for(let e=0;e<c;e++)s[e].destroy();i.remove(r),n.remove(o),t._visualizers=void 0},DataSourceDisplay.prototype._onDataSourceMoved=function(e,t,i){const n=this._primitives,r=this._groundPrimitives,o=e._primitives,a=e._groundPrimitives;t===i+1?(n.raise(o),r.raise(a)):t===i-1?(n.lower(o),r.lower(a)):0===t?(n.lowerToBottom(o),r.lowerToBottom(a),n.raise(o),r.raise(a)):(n.raiseToTop(o),r.raiseToTop(a))};const updateTransformMatrix3Scratch1=new Matrix3,updateTransformMatrix3Scratch2=new Matrix3,updateTransformMatrix3Scratch3=new Matrix3,updateTransformMatrix4Scratch=new Matrix4,updateTransformCartesian3Scratch1=new Cartesian3,updateTransformCartesian3Scratch2=new Cartesian3,updateTransformCartesian3Scratch3=new Cartesian3,updateTransformCartesian3Scratch4=new Cartesian3,updateTransformCartesian3Scratch5=new Cartesian3,updateTransformCartesian3Scratch6=new Cartesian3,deltaTime=new JulianDate,northUpAxisFactor=1.25;function updateTransform(e,t,i,n,r,o,a){const s=e.scene.mode;let c=r.getValue(o,e._lastCartesian);if(defined(c)){let i,l,u,d,h,p,f=!1,m=!1;if(s===SceneMode$1.SCENE3D){JulianDate.addSeconds(o,.001,deltaTime);let e=r.getValue(deltaTime,updateTransformCartesian3Scratch1);if(defined(e)||(JulianDate.addSeconds(o,-.001,deltaTime),e=r.getValue(deltaTime,updateTransformCartesian3Scratch1),m=!0),defined(e)){let t,n=Transforms.computeFixedToIcrfMatrix(o,updateTransformMatrix3Scratch1),r=Transforms.computeFixedToIcrfMatrix(deltaTime,updateTransformMatrix3Scratch2);defined(n)&&defined(r)?t=Matrix3.transpose(n,updateTransformMatrix3Scratch3):(t=Transforms.computeTemeToPseudoFixedMatrix(o,updateTransformMatrix3Scratch3),n=Matrix3.transpose(t,updateTransformMatrix3Scratch1),r=Transforms.computeTemeToPseudoFixedMatrix(deltaTime,updateTransformMatrix3Scratch2),Matrix3.transpose(r,r));const s=Matrix3.multiplyByVector(n,c,updateTransformCartesian3Scratch5),d=Matrix3.multiplyByVector(r,e,updateTransformCartesian3Scratch6);Cartesian3.subtract(s,d,updateTransformCartesian3Scratch4);const h=1e3*Cartesian3.magnitude(updateTransformCartesian3Scratch4),p=CesiumMath.GRAVITATIONALPARAMETER,g=-p/(h*h-2*p/Cartesian3.magnitude(s));g<0||g>northUpAxisFactor*a.maximumRadius?(i=updateTransformCartesian3Scratch2,Cartesian3.normalize(c,i),Cartesian3.negate(i,i),u=Cartesian3.clone(Cartesian3.UNIT_Z,updateTransformCartesian3Scratch3),l=Cartesian3.cross(u,i,updateTransformCartesian3Scratch1),Cartesian3.magnitude(l)>CesiumMath.EPSILON7&&(Cartesian3.normalize(i,i),Cartesian3.normalize(l,l),u=Cartesian3.cross(i,l,updateTransformCartesian3Scratch3),Cartesian3.normalize(u,u),f=!0)):Cartesian3.equalsEpsilon(c,e,CesiumMath.EPSILON7)||(u=updateTransformCartesian3Scratch2,Cartesian3.normalize(s,u),Cartesian3.normalize(d,d),l=Cartesian3.cross(u,d,updateTransformCartesian3Scratch3),m&&(l=Cartesian3.multiplyByScalar(l,-1,l)),Cartesian3.equalsEpsilon(l,Cartesian3.ZERO,CesiumMath.EPSILON7)||(i=Cartesian3.cross(l,u,updateTransformCartesian3Scratch1),Matrix3.multiplyByVector(t,i,i),Matrix3.multiplyByVector(t,l,l),Matrix3.multiplyByVector(t,u,u),Cartesian3.normalize(i,i),Cartesian3.normalize(l,l),Cartesian3.normalize(u,u),f=!0))}}defined(e.boundingSphere)&&(c=e.boundingSphere.center),n&&(d=Cartesian3.clone(t.position,updateTransformCartesian3Scratch4),h=Cartesian3.clone(t.direction,updateTransformCartesian3Scratch5),p=Cartesian3.clone(t.up,updateTransformCartesian3Scratch6));const g=updateTransformMatrix4Scratch;f?(g[0]=i.x,g[1]=i.y,g[2]=i.z,g[3]=0,g[4]=l.x,g[5]=l.y,g[6]=l.z,g[7]=0,g[8]=u.x,g[9]=u.y,g[10]=u.z,g[11]=0,g[12]=c.x,g[13]=c.y,g[14]=c.z,g[15]=0):Transforms.eastNorthUpToFixedFrame(c,a,g),t._setTransform(g),n&&(Cartesian3.clone(d,t.position),Cartesian3.clone(h,t.direction),Cartesian3.clone(p,t.up),Cartesian3.cross(h,p,t.right))}if(i){const i=s===SceneMode$1.SCENE2D||Cartesian3.equals(e._offset3D,Cartesian3.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,i)}}function EntityView(e,t,i){this.entity=e,this.scene=t,this.ellipsoid=defaultValue(i,Ellipsoid.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new Cartesian3,this._defaultOffset3D=void 0,this._offset3D=new Cartesian3}Object.defineProperties(EntityView,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=Cartesian3.clone(e,new Cartesian3)}}}),EntityView.defaultOffset3D=new Cartesian3(-14e3,3500,3500);const scratchHeadingPitchRange=new HeadingPitchRange,scratchCartesian$2=new Cartesian3;EntityView.prototype.update=function(e,t){const i=this.scene,n=this.ellipsoid,r=i.mode;if(r===SceneMode$1.MORPHING)return;const o=this.entity,a=o.position;if(!defined(a))return;const s=o!==this._lastEntity,c=r!==this._mode,l=i.camera;let u=s||c,d=!0;if(s){const i=o.viewFrom,r=defined(i);if(!r&&defined(t)){scratchHeadingPitchRange.pitch=-CesiumMath.PI_OVER_FOUR,scratchHeadingPitchRange.range=0;const i=a.getValue(e,scratchCartesian$2);if(defined(i)){const e=2-1/Math.max(1,Cartesian3.magnitude(i)/n.maximumRadius);scratchHeadingPitchRange.pitch*=e}l.viewBoundingSphere(t,scratchHeadingPitchRange),this.boundingSphere=t,u=!1,d=!1}else r&&defined(i.getValue(e,this._offset3D))||Cartesian3.clone(EntityView._defaultOffset3D,this._offset3D)}else c||this._mode===SceneMode$1.SCENE2D||Cartesian3.clone(l.position,this._offset3D);this._lastEntity=o,this._mode=r,updateTransform(this,l,u,d,a,e,n)};const MAX_BITS$1=15,D_CODES=30,BL_CODES=19,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,HEAP_SIZE=2*L_CODES+1,END_BLOCK=256,MAX_BL_BITS=7,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,Buf_size=16,Z_DEFAULT_COMPRESSION=-1,Z_FILTERED=1,Z_HUFFMAN_ONLY=2,Z_DEFAULT_STRATEGY=0,Z_NO_FLUSH$1=0,Z_PARTIAL_FLUSH=1,Z_FULL_FLUSH=3,Z_FINISH$1=4,Z_OK$1=0,Z_STREAM_END$1=1,Z_NEED_DICT$1=2,Z_STREAM_ERROR$1=-2,Z_DATA_ERROR$1=-3,Z_BUF_ERROR$1=-5;function extractArray(e){return flatArray(e.map((([e,t])=>new Array(e).fill(t,0,e))))}function flatArray(e){return e.reduce(((e,t)=>e.concat(Array.isArray(t)?flatArray(t):t)),[])}const _dist_code=[0,1,2,3].concat(...extractArray([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function Tree(){const e=this;function t(e,t){let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}e.build_tree=function(i){const n=e.dyn_tree,r=e.stat_desc.static_tree,o=e.stat_desc.elems;let a,s,c,l=-1;for(i.heap_len=0,i.heap_max=HEAP_SIZE,a=0;a<o;a++)0!==n[2*a]?(i.heap[++i.heap_len]=l=a,i.depth[a]=0):n[2*a+1]=0;for(;i.heap_len<2;)c=i.heap[++i.heap_len]=l<2?++l:0,n[2*c]=1,i.depth[c]=0,i.opt_len--,r&&(i.static_len-=r[2*c+1]);for(e.max_code=l,a=Math.floor(i.heap_len/2);a>=1;a--)i.pqdownheap(n,a);c=o;do{a=i.heap[1],i.heap[1]=i.heap[i.heap_len--],i.pqdownheap(n,1),s=i.heap[1],i.heap[--i.heap_max]=a,i.heap[--i.heap_max]=s,n[2*c]=n[2*a]+n[2*s],i.depth[c]=Math.max(i.depth[a],i.depth[s])+1,n[2*a+1]=n[2*s+1]=c,i.heap[1]=c++,i.pqdownheap(n,1)}while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],function(t){const i=e.dyn_tree,n=e.stat_desc.static_tree,r=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,a=e.stat_desc.max_length;let s,c,l,u,d,h,p=0;for(u=0;u<=MAX_BITS$1;u++)t.bl_count[u]=0;for(i[2*t.heap[t.heap_max]+1]=0,s=t.heap_max+1;s<HEAP_SIZE;s++)c=t.heap[s],u=i[2*i[2*c+1]+1]+1,u>a&&(u=a,p++),i[2*c+1]=u,c>e.max_code||(t.bl_count[u]++,d=0,c>=o&&(d=r[c-o]),h=i[2*c],t.opt_len+=h*(u+d),n&&(t.static_len+=h*(n[2*c+1]+d)));if(0!==p){do{for(u=a-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[a]--,p-=2}while(p>0);for(u=a;0!==u;u--)for(c=t.bl_count[u];0!==c;)l=t.heap[--s],l>e.max_code||(i[2*l+1]!=u&&(t.opt_len+=(u-i[2*l+1])*i[2*l],i[2*l+1]=u),c--)}}(i),function(e,i,n){const r=[];let o,a,s,c=0;for(o=1;o<=MAX_BITS$1;o++)r[o]=c=c+n[o-1]<<1;for(a=0;a<=i;a++)s=e[2*a+1],0!==s&&(e[2*a]=t(r[s]++,s))}(n,e.max_code,i.bl_count)}}function StaticTree(e,t,i,n,r){const o=this;o.static_tree=e,o.extra_bits=t,o.extra_base=i,o.elems=n,o.max_length=r}Tree._length_code=[0,1,2,3,4,5,6,7].concat(...extractArray([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),Tree.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],Tree.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],Tree.d_code=function(e){return e<256?_dist_code[e]:_dist_code[256+(e>>>7)]},Tree.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Tree.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Tree.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Tree.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],StaticTree.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],StaticTree.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],StaticTree.static_l_desc=new StaticTree(StaticTree.static_ltree,Tree.extra_lbits,LITERALS+1,L_CODES,MAX_BITS$1),StaticTree.static_d_desc=new StaticTree(StaticTree.static_dtree,Tree.extra_dbits,0,D_CODES,MAX_BITS$1),StaticTree.static_bl_desc=new StaticTree(null,Tree.extra_blbits,0,BL_CODES,MAX_BL_BITS);const MAX_MEM_LEVEL=9,DEF_MEM_LEVEL=8;function Config(e,t,i,n,r){const o=this;o.good_length=e,o.max_lazy=t,o.nice_length=i,o.max_chain=n,o.func=r}const STORED$1=0,FAST=1,SLOW=2,config_table=[new Config(0,0,0,0,STORED$1),new Config(4,4,8,4,FAST),new Config(4,5,16,8,FAST),new Config(4,6,32,32,FAST),new Config(4,4,16,16,SLOW),new Config(8,16,32,32,SLOW),new Config(8,16,128,128,SLOW),new Config(8,32,128,256,SLOW),new Config(32,128,258,1024,SLOW),new Config(32,258,258,4096,SLOW)],z_errmsg=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],NeedMore=0,BlockDone=1,FinishStarted=2,FinishDone=3,PRESET_DICT$1=32,INIT_STATE=42,BUSY_STATE=113,FINISH_STATE=666,Z_DEFLATED$1=8,STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1;function smaller(e,t,i,n){const r=e[2*t],o=e[2*i];return r<o||r==o&&n[t]<=n[i]}function Deflate$1(){const e=this;let t,i,n,r,o,a,s,c,l,u,d,h,p,f,m,g,_,y,C,T,S,v,A,E,b,x,P,D,w,M,I,R,O;const B=new Tree,L=new Tree,F=new Tree;let N,V,$,k,U,G,z,H;function W(){let t;for(t=0;t<L_CODES;t++)I[2*t]=0;for(t=0;t<D_CODES;t++)R[2*t]=0;for(t=0;t<BL_CODES;t++)O[2*t]=0;I[2*END_BLOCK]=1,e.opt_len=e.static_len=0,$=U=0}function q(e,t){let i,n=-1,r=e[1],o=0,a=7,s=4;0===r&&(a=138,s=3),e[2*(t+1)+1]=65535;for(let c=0;c<=t;c++)i=r,r=e[2*(c+1)+1],++o<a&&i==r||(o<s?O[2*i]+=o:0!==i?(i!=n&&O[2*i]++,O[2*REP_3_6]++):o<=10?O[2*REPZ_3_10]++:O[2*REPZ_11_138]++,o=0,n=i,0===r?(a=138,s=3):i==r?(a=6,s=3):(a=7,s=4))}function j(t){e.pending_buf[e.pending++]=t}function X(e){j(255&e),j(e>>>8&255)}function Y(e,t){let i;const n=t;H>Buf_size-n?(i=e,z|=i<<H&65535,X(z),z=i>>>Buf_size-H,H+=n-Buf_size):(z|=e<<H&65535,H+=n)}function K(e,t){const i=2*e;Y(65535&t[i],65535&t[i+1])}function J(e,t){let i,n,r=-1,o=e[1],a=0,s=7,c=4;for(0===o&&(s=138,c=3),i=0;i<=t;i++)if(n=o,o=e[2*(i+1)+1],!(++a<s&&n==o)){if(a<c)do{K(n,O)}while(0!=--a);else 0!==n?(n!=r&&(K(n,O),a--),K(REP_3_6,O),Y(a-3,2)):a<=10?(K(REPZ_3_10,O),Y(a-3,3)):(K(REPZ_11_138,O),Y(a-11,7));a=0,r=n,0===o?(s=138,c=3):n==o?(s=6,c=3):(s=7,c=4)}}function Q(){16==H?(X(z),z=0,H=0):H>=8&&(j(255&z),z>>>=8,H-=8)}function Z(t,i){let n,r,o;if(e.pending_buf[k+2*$]=t>>>8&255,e.pending_buf[k+2*$+1]=255&t,e.pending_buf[N+$]=255&i,$++,0===t?I[2*i]++:(U++,t--,I[2*(Tree._length_code[i]+LITERALS+1)]++,R[2*Tree.d_code(t)]++),0==(8191&$)&&P>2){for(n=8*$,r=S-_,o=0;o<D_CODES;o++)n+=R[2*o]*(5+Tree.extra_dbits[o]);if(n>>>=3,U<Math.floor($/2)&&n<Math.floor(r/2))return!0}return $==V-1}function ee(t,i){let n,r,o,a,s=0;if(0!==$)do{n=e.pending_buf[k+2*s]<<8&65280|255&e.pending_buf[k+2*s+1],r=255&e.pending_buf[N+s],s++,0===n?K(r,t):(o=Tree._length_code[r],K(o+LITERALS+1,t),a=Tree.extra_lbits[o],0!==a&&(r-=Tree.base_length[o],Y(r,a)),n--,o=Tree.d_code(n),K(o,i),a=Tree.extra_dbits[o],0!==a&&(n-=Tree.base_dist[o],Y(n,a)))}while(s<$);K(END_BLOCK,t),G=t[2*END_BLOCK+1]}function te(){H>8?X(z):H>0&&j(255&z),z=0,H=0}function ie(t,i,n){Y((STORED_BLOCK<<1)+(n?1:0),3),function(t,i,n){te(),G=8,n&&(X(i),X(~i)),e.pending_buf.set(c.subarray(t,t+i),e.pending),e.pending+=i}(t,i,!0)}function ne(t,i,n){let r,o,a=0;P>0?(B.build_tree(e),L.build_tree(e),a=function(){let t;for(q(I,B.max_code),q(R,L.max_code),F.build_tree(e),t=BL_CODES-1;t>=3&&0===O[2*Tree.bl_order[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(),r=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=r&&(r=o)):r=o=i+5,i+4<=r&&-1!=t?ie(t,i,n):o==r?(Y((STATIC_TREES<<1)+(n?1:0),3),ee(StaticTree.static_ltree,StaticTree.static_dtree)):(Y((DYN_TREES<<1)+(n?1:0),3),function(e,t,i){let n;for(Y(e-257,5),Y(t-1,5),Y(i-4,4),n=0;n<i;n++)Y(O[2*Tree.bl_order[n]+1],3);J(I,e-1),J(R,t-1)}(B.max_code+1,L.max_code+1,a+1),ee(I,R)),W(),n&&te()}function re(e){ne(_>=0?_:-1,S-_,e),_=S,t.flush_pending()}function oe(){let e,i,n,r;do{if(r=l-A-S,0===r&&0===S&&0===A)r=o;else if(-1==r)r--;else if(S>=o+o-MIN_LOOKAHEAD){c.set(c.subarray(o,o+o),0),v-=o,S-=o,_-=o,e=p,n=e;do{i=65535&d[--n],d[n]=i>=o?i-o:0}while(0!=--e);e=o,n=e;do{i=65535&u[--n],u[n]=i>=o?i-o:0}while(0!=--e);r+=o}if(0===t.avail_in)return;e=t.read_buf(c,S+A,r),A+=e,A>=MIN_MATCH&&(h=255&c[S],h=(h<<g^255&c[S+1])&m)}while(A<MIN_LOOKAHEAD&&0!==t.avail_in)}function ae(e){let t,i,n=b,r=S,a=E;const l=S>o-MIN_LOOKAHEAD?S-(o-MIN_LOOKAHEAD):0;let d=M;const h=s,p=S+MAX_MATCH;let f=c[r+a-1],m=c[r+a];E>=w&&(n>>=2),d>A&&(d=A);do{if(t=e,c[t+a]==m&&c[t+a-1]==f&&c[t]==c[r]&&c[++t]==c[r+1]){r+=2,t++;do{}while(c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&r<p);if(i=MAX_MATCH-(p-r),r=p-MAX_MATCH,i>a){if(v=e,a=i,i>=d)break;f=c[r+a-1],m=c[r+a]}}}while((e=65535&u[e&h])>l&&0!=--n);return a<=A?a:A}function se(t){return t.total_in=t.total_out=0,t.msg=null,e.pending=0,e.pending_out=0,i=BUSY_STATE,r=Z_NO_FLUSH$1,B.dyn_tree=I,B.stat_desc=StaticTree.static_l_desc,L.dyn_tree=R,L.stat_desc=StaticTree.static_d_desc,F.dyn_tree=O,F.stat_desc=StaticTree.static_bl_desc,z=0,H=0,G=8,W(),function(){l=2*o,d[p-1]=0;for(let e=0;e<p-1;e++)d[e]=0;x=config_table[P].max_lazy,w=config_table[P].good_length,M=config_table[P].nice_length,b=config_table[P].max_chain,S=0,_=0,A=0,y=E=MIN_MATCH-1,T=0,h=0}(),Z_OK$1}e.depth=[],e.bl_count=[],e.heap=[],I=[],R=[],O=[],e.pqdownheap=function(t,i){const n=e.heap,r=n[i];let o=i<<1;for(;o<=e.heap_len&&(o<e.heap_len&&smaller(t,n[o+1],n[o],e.depth)&&o++,!smaller(t,r,n[o],e.depth));)n[i]=n[o],i=o,o<<=1;n[i]=r},e.deflateInit=function(t,i,r,l,h,_){return l||(l=Z_DEFLATED$1),h||(h=DEF_MEM_LEVEL),_||(_=Z_DEFAULT_STRATEGY),t.msg=null,i==Z_DEFAULT_COMPRESSION&&(i=6),h<1||h>MAX_MEM_LEVEL||l!=Z_DEFLATED$1||r<9||r>15||i<0||i>9||_<0||_>Z_HUFFMAN_ONLY?Z_STREAM_ERROR$1:(t.dstate=e,a=r,o=1<<a,s=o-1,f=h+7,p=1<<f,m=p-1,g=Math.floor((f+MIN_MATCH-1)/MIN_MATCH),c=new Uint8Array(2*o),u=[],d=[],V=1<<h+6,e.pending_buf=new Uint8Array(4*V),n=4*V,k=Math.floor(V/2),N=3*V,P=i,D=_,se(t))},e.deflateEnd=function(){return i!=INIT_STATE&&i!=BUSY_STATE&&i!=FINISH_STATE?Z_STREAM_ERROR$1:(e.pending_buf=null,d=null,u=null,c=null,e.dstate=null,i==BUSY_STATE?Z_DATA_ERROR$1:Z_OK$1)},e.deflateParams=function(e,t,i){let n=Z_OK$1;return t==Z_DEFAULT_COMPRESSION&&(t=6),t<0||t>9||i<0||i>Z_HUFFMAN_ONLY?Z_STREAM_ERROR$1:(config_table[P].func!=config_table[t].func&&0!==e.total_in&&(n=e.deflate(Z_PARTIAL_FLUSH)),P!=t&&(P=t,x=config_table[P].max_lazy,w=config_table[P].good_length,M=config_table[P].nice_length,b=config_table[P].max_chain),D=i,n)},e.deflateSetDictionary=function(e,t,n){let r,a=n,l=0;if(!t||i!=INIT_STATE)return Z_STREAM_ERROR$1;if(a<MIN_MATCH)return Z_OK$1;for(a>o-MIN_LOOKAHEAD&&(a=o-MIN_LOOKAHEAD,l=n-a),c.set(t.subarray(l,l+a),0),S=a,_=a,h=255&c[0],h=(h<<g^255&c[1])&m,r=0;r<=a-MIN_MATCH;r++)h=(h<<g^255&c[r+(MIN_MATCH-1)])&m,u[r&s]=d[h],d[h]=r;return Z_OK$1},e.deflate=function(l,f){let b,w,M,I,R;if(f>Z_FINISH$1||f<0)return Z_STREAM_ERROR$1;if(!l.next_out||!l.next_in&&0!==l.avail_in||i==FINISH_STATE&&f!=Z_FINISH$1)return l.msg=z_errmsg[Z_NEED_DICT$1-Z_STREAM_ERROR$1],Z_STREAM_ERROR$1;if(0===l.avail_out)return l.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;var O;if(t=l,I=r,r=f,i==INIT_STATE&&(w=Z_DEFLATED$1+(a-8<<4)<<8,M=(P-1&255)>>1,M>3&&(M=3),w|=M<<6,0!==S&&(w|=PRESET_DICT$1),w+=31-w%31,i=BUSY_STATE,j((O=w)>>8&255),j(255&O)),0!==e.pending){if(t.flush_pending(),0===t.avail_out)return r=-1,Z_OK$1}else if(0===t.avail_in&&f<=I&&f!=Z_FINISH$1)return t.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;if(i==FINISH_STATE&&0!==t.avail_in)return l.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;if(0!==t.avail_in||0!==A||f!=Z_NO_FLUSH$1&&i!=FINISH_STATE){switch(R=-1,config_table[P].func){case STORED$1:R=function(e){let i,r=65535;for(r>n-5&&(r=n-5);;){if(A<=1){if(oe(),0===A&&e==Z_NO_FLUSH$1)return NeedMore;if(0===A)break}if(S+=A,A=0,i=_+r,(0===S||S>=i)&&(A=S-i,S=i,re(!1),0===t.avail_out))return NeedMore;if(S-_>=o-MIN_LOOKAHEAD&&(re(!1),0===t.avail_out))return NeedMore}return re(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f);break;case FAST:R=function(e){let i,n=0;for(;;){if(A<MIN_LOOKAHEAD){if(oe(),A<MIN_LOOKAHEAD&&e==Z_NO_FLUSH$1)return NeedMore;if(0===A)break}if(A>=MIN_MATCH&&(h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,n=65535&d[h],u[S&s]=d[h],d[h]=S),0!==n&&(S-n&65535)<=o-MIN_LOOKAHEAD&&D!=Z_HUFFMAN_ONLY&&(y=ae(n)),y>=MIN_MATCH)if(i=Z(S-v,y-MIN_MATCH),A-=y,y<=x&&A>=MIN_MATCH){y--;do{S++,h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,n=65535&d[h],u[S&s]=d[h],d[h]=S}while(0!=--y);S++}else S+=y,y=0,h=255&c[S],h=(h<<g^255&c[S+1])&m;else i=Z(0,255&c[S]),A--,S++;if(i&&(re(!1),0===t.avail_out))return NeedMore}return re(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f);break;case SLOW:R=function(e){let i,n,r=0;for(;;){if(A<MIN_LOOKAHEAD){if(oe(),A<MIN_LOOKAHEAD&&e==Z_NO_FLUSH$1)return NeedMore;if(0===A)break}if(A>=MIN_MATCH&&(h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,r=65535&d[h],u[S&s]=d[h],d[h]=S),E=y,C=v,y=MIN_MATCH-1,0!==r&&E<x&&(S-r&65535)<=o-MIN_LOOKAHEAD&&(D!=Z_HUFFMAN_ONLY&&(y=ae(r)),y<=5&&(D==Z_FILTERED||y==MIN_MATCH&&S-v>4096)&&(y=MIN_MATCH-1)),E>=MIN_MATCH&&y<=E){n=S+A-MIN_MATCH,i=Z(S-1-C,E-MIN_MATCH),A-=E-1,E-=2;do{++S<=n&&(h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,r=65535&d[h],u[S&s]=d[h],d[h]=S)}while(0!=--E);if(T=0,y=MIN_MATCH-1,S++,i&&(re(!1),0===t.avail_out))return NeedMore}else if(0!==T){if(i=Z(0,255&c[S-1]),i&&re(!1),S++,A--,0===t.avail_out)return NeedMore}else T=1,S++,A--}return 0!==T&&(i=Z(0,255&c[S-1]),T=0),re(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f)}if(R!=FinishStarted&&R!=FinishDone||(i=FINISH_STATE),R==NeedMore||R==FinishStarted)return 0===t.avail_out&&(r=-1),Z_OK$1;if(R==BlockDone){if(f==Z_PARTIAL_FLUSH)Y(STATIC_TREES<<1,3),K(END_BLOCK,StaticTree.static_ltree),Q(),1+G+10-H<9&&(Y(STATIC_TREES<<1,3),K(END_BLOCK,StaticTree.static_ltree),Q()),G=7;else if(ie(0,0,!1),f==Z_FULL_FLUSH)for(b=0;b<p;b++)d[b]=0;if(t.flush_pending(),0===t.avail_out)return r=-1,Z_OK$1}}return f!=Z_FINISH$1?Z_OK$1:Z_STREAM_END$1}}function ZStream$1(){const e=this;e.next_in_index=0,e.next_out_index=0,e.avail_in=0,e.total_in=0,e.avail_out=0,e.total_out=0}function ZipDeflate(e){const t=new ZStream$1,i=getMaximumCompressedSize$1(e&&e.chunkSize?e.chunkSize:65536),n=Z_NO_FLUSH$1,r=new Uint8Array(i);let o=e?e.level:Z_DEFAULT_COMPRESSION;void 0===o&&(o=Z_DEFAULT_COMPRESSION),t.deflateInit(o),t.next_out=r,this.append=function(e,o){let a,s,c=0,l=0,u=0;const d=[];if(e.length){t.next_in_index=0,t.next_in=e,t.avail_in=e.length;do{if(t.next_out_index=0,t.avail_out=i,a=t.deflate(n),a!=Z_OK$1)throw new Error("deflating: "+t.msg);t.next_out_index&&(t.next_out_index==i?d.push(new Uint8Array(r)):d.push(r.slice(0,t.next_out_index))),u+=t.next_out_index,o&&t.next_in_index>0&&t.next_in_index!=c&&(o(t.next_in_index),c=t.next_in_index)}while(t.avail_in>0||0===t.avail_out);return d.length>1?(s=new Uint8Array(u),d.forEach((function(e){s.set(e,l),l+=e.length}))):s=d[0]||new Uint8Array(0),s}},this.flush=function(){let e,n,o=0,a=0;const s=[];do{if(t.next_out_index=0,t.avail_out=i,e=t.deflate(Z_FINISH$1),e!=Z_STREAM_END$1&&e!=Z_OK$1)throw new Error("deflating: "+t.msg);i-t.avail_out>0&&s.push(r.slice(0,t.next_out_index)),a+=t.next_out_index}while(t.avail_in>0||0===t.avail_out);return t.deflateEnd(),n=new Uint8Array(a),s.forEach((function(e){n.set(e,o),o+=e.length})),n}}function getMaximumCompressedSize$1(e){return e+5*(Math.floor(e/16383)+1)}ZStream$1.prototype={deflateInit:function(e,t){const i=this;return i.dstate=new Deflate$1,t||(t=MAX_BITS$1),i.dstate.deflateInit(i,e,t)},deflate:function(e){const t=this;return t.dstate?t.dstate.deflate(t,e):Z_STREAM_ERROR$1},deflateEnd:function(){const e=this;if(!e.dstate)return Z_STREAM_ERROR$1;const t=e.dstate.deflateEnd();return e.dstate=null,t},deflateParams:function(e,t){const i=this;return i.dstate?i.dstate.deflateParams(i,e,t):Z_STREAM_ERROR$1},deflateSetDictionary:function(e,t){const i=this;return i.dstate?i.dstate.deflateSetDictionary(i,e,t):Z_STREAM_ERROR$1},read_buf:function(e,t,i){const n=this;let r=n.avail_in;return r>i&&(r=i),0===r?0:(n.avail_in-=r,e.set(n.next_in.subarray(n.next_in_index,n.next_in_index+r),t),n.next_in_index+=r,n.total_in+=r,r)},flush_pending:function(){const e=this;let t=e.dstate.pending;t>e.avail_out&&(t=e.avail_out),0!==t&&(e.next_out.set(e.dstate.pending_buf.subarray(e.dstate.pending_out,e.dstate.pending_out+t),e.next_out_index),e.next_out_index+=t,e.dstate.pending_out+=t,e.total_out+=t,e.avail_out-=t,e.dstate.pending-=t,0===e.dstate.pending&&(e.dstate.pending_out=0))}};const MAX_BITS=15,Z_OK$2=0,Z_STREAM_END$2=1,Z_NEED_DICT$2=2,Z_STREAM_ERROR$2=-2,Z_DATA_ERROR$2=-3,Z_MEM_ERROR$1=-4,Z_BUF_ERROR$2=-5,inflate_mask=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],MANY=1440,Z_NO_FLUSH=0,Z_FINISH$2=4,fixed_bl=9,fixed_bd=5,fixed_tl=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],fixed_td=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],BMAX=15;function InfTree(){let e,t,i,n,r,o;function a(e,t,a,s,c,l,u,d,h,p,f){let m,g,_,y,C,T,S,v,A,E,b,x,P,D,w;E=0,C=a;do{i[e[t+E]]++,E++,C--}while(0!==C);if(i[0]==a)return u[0]=-1,d[0]=0,Z_OK$2;for(v=d[0],T=1;T<=BMAX&&0===i[T];T++);for(S=T,v<T&&(v=T),C=BMAX;0!==C&&0===i[C];C--);for(_=C,v>C&&(v=C),d[0]=v,D=1<<T;T<C;T++,D<<=1)if((D-=i[T])<0)return Z_DATA_ERROR$2;if((D-=i[C])<0)return Z_DATA_ERROR$2;for(i[C]+=D,o[1]=T=0,E=1,P=2;0!=--C;)o[P]=T+=i[E],P++,E++;C=0,E=0;do{0!==(T=e[t+E])&&(f[o[T]++]=C),E++}while(++C<a);for(a=o[_],o[0]=C=0,E=0,y=-1,x=-v,r[0]=0,b=0,w=0;S<=_;S++)for(m=i[S];0!=m--;){for(;S>x+v;){if(y++,x+=v,w=_-x,w=w>v?v:w,(g=1<<(T=S-x))>m+1&&(g-=m+1,P=S,T<w))for(;++T<w&&!((g<<=1)<=i[++P]);)g-=i[P];if(w=1<<T,p[0]+w>MANY)return Z_DATA_ERROR$2;r[y]=b=p[0],p[0]+=w,0!==y?(o[y]=C,n[0]=T,n[1]=v,T=C>>>x-v,n[2]=b-r[y-1]-T,h.set(n,3*(r[y-1]+T))):u[0]=b}for(n[1]=S-x,E>=a?n[0]=192:f[E]<s?(n[0]=f[E]<256?0:96,n[2]=f[E++]):(n[0]=l[f[E]-s]+16+64,n[2]=c[f[E++]-s]),g=1<<S-x,T=C>>>x;T<w;T+=g)h.set(n,3*(b+T));for(T=1<<S-1;0!=(C&T);T>>>=1)C^=T;for(C^=T,A=(1<<x)-1;(C&A)!=o[y];)y--,x-=v,A=(1<<x)-1}return 0!==D&&1!=_?Z_BUF_ERROR$2:Z_OK$2}function s(a){let s;for(e||(e=[],t=[],i=new Int32Array(BMAX+1),n=[],r=new Int32Array(BMAX),o=new Int32Array(BMAX+1)),t.length<a&&(t=[]),s=0;s<a;s++)t[s]=0;for(s=0;s<BMAX+1;s++)i[s]=0;for(s=0;s<3;s++)n[s]=0;r.set(i.subarray(0,BMAX),0),o.set(i.subarray(0,BMAX+1),0)}this.inflate_trees_bits=function(i,n,r,o,c){let l;return s(19),e[0]=0,l=a(i,0,19,19,null,null,r,n,o,e,t),l==Z_DATA_ERROR$2?c.msg="oversubscribed dynamic bit lengths tree":l!=Z_BUF_ERROR$2&&0!==n[0]||(c.msg="incomplete dynamic bit lengths tree",l=Z_DATA_ERROR$2),l},this.inflate_trees_dynamic=function(i,n,r,o,c,l,u,d,h){let p;return s(288),e[0]=0,p=a(r,0,i,257,cplens,cplext,l,o,d,e,t),p!=Z_OK$2||0===o[0]?(p==Z_DATA_ERROR$2?h.msg="oversubscribed literal/length tree":p!=Z_MEM_ERROR$1&&(h.msg="incomplete literal/length tree",p=Z_DATA_ERROR$2),p):(s(288),p=a(r,i,n,0,cpdist,cpdext,u,c,d,e,t),p!=Z_OK$2||0===c[0]&&i>257?(p==Z_DATA_ERROR$2?h.msg="oversubscribed distance tree":p==Z_BUF_ERROR$2?(h.msg="incomplete distance tree",p=Z_DATA_ERROR$2):p!=Z_MEM_ERROR$1&&(h.msg="empty distance tree with lengths",p=Z_DATA_ERROR$2),p):Z_OK$2)}}InfTree.inflate_trees_fixed=function(e,t,i,n){return e[0]=fixed_bl,t[0]=fixed_bd,i[0]=fixed_tl,n[0]=fixed_td,Z_OK$2};const START=0,LEN$1=1,LENEXT$1=2,DIST$1=3,DISTEXT$1=4,COPY$1=5,LIT$1=6,WASH=7,END=8,BADCODE=9;function InfCodes(){const e=this;let t,i,n,r,o=0,a=0,s=0,c=0,l=0,u=0,d=0,h=0,p=0,f=0;function m(e,t,i,n,r,o,a,s){let c,l,u,d,h,p,f,m,g,_,y,C,T,S,v,A;f=s.next_in_index,m=s.avail_in,h=a.bitb,p=a.bitk,g=a.write,_=g<a.read?a.read-g-1:a.end-g,y=inflate_mask[e],C=inflate_mask[t];do{for(;p<20;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;if(c=h&y,l=i,u=n,A=3*(u+c),0!==(d=l[A]))for(;;){if(h>>=l[A+1],p-=l[A+1],0!=(16&d)){for(d&=15,T=l[A+2]+(h&inflate_mask[d]),h>>=d,p-=d;p<15;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;for(c=h&C,l=r,u=o,A=3*(u+c),d=l[A];;){if(h>>=l[A+1],p-=l[A+1],0!=(16&d)){for(d&=15;p<d;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;if(S=l[A+2]+(h&inflate_mask[d]),h>>=d,p-=d,_-=T,g>=S)v=g-S,g-v>0&&2>g-v?(a.window[g++]=a.window[v++],a.window[g++]=a.window[v++],T-=2):(a.window.set(a.window.subarray(v,v+2),g),g+=2,v+=2,T-=2);else{v=g-S;do{v+=a.end}while(v<0);if(d=a.end-v,T>d){if(T-=d,g-v>0&&d>g-v)do{a.window[g++]=a.window[v++]}while(0!=--d);else a.window.set(a.window.subarray(v,v+d),g),g+=d,v+=d,d=0;v=0}}if(g-v>0&&T>g-v)do{a.window[g++]=a.window[v++]}while(0!=--T);else a.window.set(a.window.subarray(v,v+T),g),g+=T,v+=T,T=0;break}if(0!=(64&d))return s.msg="invalid distance code",T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_DATA_ERROR$2;c+=l[A+2],c+=h&inflate_mask[d],A=3*(u+c),d=l[A]}break}if(0!=(64&d))return 0!=(32&d)?(T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_STREAM_END$2):(s.msg="invalid literal/length code",T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_DATA_ERROR$2);if(c+=l[A+2],c+=h&inflate_mask[d],A=3*(u+c),0===(d=l[A])){h>>=l[A+1],p-=l[A+1],a.window[g++]=l[A+2],_--;break}}else h>>=l[A+1],p-=l[A+1],a.window[g++]=l[A+2],_--}while(_>=258&&m>=10);return T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_OK$2}e.init=function(e,o,a,s,c,l){t=START,d=e,h=o,n=a,p=s,r=c,f=l,i=null},e.proc=function(e,g,_){let y,C,T,S,v,A,E,b=0,x=0,P=0;for(P=g.next_in_index,S=g.avail_in,b=e.bitb,x=e.bitk,v=e.write,A=v<e.read?e.read-v-1:e.end-v;;)switch(t){case START:if(A>=258&&S>=10&&(e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,_=m(d,h,n,p,r,f,e,g),P=g.next_in_index,S=g.avail_in,b=e.bitb,x=e.bitk,v=e.write,A=v<e.read?e.read-v-1:e.end-v,_!=Z_OK$2)){t=_==Z_STREAM_END$2?WASH:BADCODE;break}s=d,i=n,a=p,t=LEN$1;case LEN$1:for(y=s;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}if(C=3*(a+(b&inflate_mask[y])),b>>>=i[C+1],x-=i[C+1],T=i[C],0===T){c=i[C+2],t=LIT$1;break}if(0!=(16&T)){l=15&T,o=i[C+2],t=LENEXT$1;break}if(0==(64&T)){s=T,a=C/3+i[C+2];break}if(0!=(32&T)){t=WASH;break}return t=BADCODE,g.msg="invalid literal/length code",_=Z_DATA_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);case LENEXT$1:for(y=l;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}o+=b&inflate_mask[y],b>>=y,x-=y,s=h,i=r,a=f,t=DIST$1;case DIST$1:for(y=s;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}if(C=3*(a+(b&inflate_mask[y])),b>>=i[C+1],x-=i[C+1],T=i[C],0!=(16&T)){l=15&T,u=i[C+2],t=DISTEXT$1;break}if(0==(64&T)){s=T,a=C/3+i[C+2];break}return t=BADCODE,g.msg="invalid distance code",_=Z_DATA_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);case DISTEXT$1:for(y=l;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}u+=b&inflate_mask[y],b>>=y,x-=y,t=COPY$1;case COPY$1:for(E=v-u;E<0;)E+=e.end;for(;0!==o;){if(0===A&&(v==e.end&&0!==e.read&&(v=0,A=v<e.read?e.read-v-1:e.end-v),0===A&&(e.write=v,_=e.inflate_flush(g,_),v=e.write,A=v<e.read?e.read-v-1:e.end-v,v==e.end&&0!==e.read&&(v=0,A=v<e.read?e.read-v-1:e.end-v),0===A)))return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);e.window[v++]=e.window[E++],A--,E==e.end&&(E=0),o--}t=START;break;case LIT$1:if(0===A&&(v==e.end&&0!==e.read&&(v=0,A=v<e.read?e.read-v-1:e.end-v),0===A&&(e.write=v,_=e.inflate_flush(g,_),v=e.write,A=v<e.read?e.read-v-1:e.end-v,v==e.end&&0!==e.read&&(v=0,A=v<e.read?e.read-v-1:e.end-v),0===A)))return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);_=Z_OK$2,e.window[v++]=c,A--,t=START;break;case WASH:if(x>7&&(x-=8,S++,P--),e.write=v,_=e.inflate_flush(g,_),v=e.write,A=v<e.read?e.read-v-1:e.end-v,e.read!=e.write)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);t=END;case END:return _=Z_STREAM_END$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);case BADCODE:return _=Z_DATA_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_);default:return _=Z_STREAM_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=v,e.inflate_flush(g,_)}},e.free=function(){}}const border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],TYPE$2=0,LENS$2=1,STORED$2=2,TABLE$1=3,BTREE=4,DTREE=5,CODES$2=6,DRY=7,DONELOCKS=8,BADBLOCKS=9;function InfBlocks(e,t){const i=this;let n,r=TYPE$2,o=0,a=0,s=0;const c=[0],l=[0],u=new InfCodes;let d=0,h=new Int32Array(3*MANY);const p=new InfTree;i.bitk=0,i.bitb=0,i.window=new Uint8Array(t),i.end=t,i.read=0,i.write=0,i.reset=function(e,t){t&&(t[0]=0),r==CODES$2&&u.free(e),r=TYPE$2,i.bitk=0,i.bitb=0,i.read=i.write=0},i.reset(e,null),i.inflate_flush=function(e,t){let n,r,o;return r=e.next_out_index,o=i.read,n=(o<=i.write?i.write:i.end)-o,n>e.avail_out&&(n=e.avail_out),0!==n&&t==Z_BUF_ERROR$2&&(t=Z_OK$2),e.avail_out-=n,e.total_out+=n,e.next_out.set(i.window.subarray(o,o+n),r),r+=n,o+=n,o==i.end&&(o=0,i.write==i.end&&(i.write=0),n=i.write-o,n>e.avail_out&&(n=e.avail_out),0!==n&&t==Z_BUF_ERROR$2&&(t=Z_OK$2),e.avail_out-=n,e.total_out+=n,e.next_out.set(i.window.subarray(o,o+n),r),r+=n,o+=n),e.next_out_index=r,i.read=o,t},i.proc=function(e,t){let f,m,g,_,y,C,T,S;for(_=e.next_in_index,y=e.avail_in,m=i.bitb,g=i.bitk,C=i.write,T=C<i.read?i.read-C-1:i.end-C;;){let v,A,E,b,x,P,D,w;switch(r){case TYPE$2:for(;g<3;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}switch(f=7&m,d=1&f,f>>>1){case 0:m>>>=3,g-=3,f=7&g,m>>>=f,g-=f,r=LENS$2;break;case 1:v=[],A=[],E=[[]],b=[[]],InfTree.inflate_trees_fixed(v,A,E,b),u.init(v[0],A[0],E[0],0,b[0],0),m>>>=3,g-=3,r=CODES$2;break;case 2:m>>>=3,g-=3,r=TABLE$1;break;case 3:return m>>>=3,g-=3,r=BADBLOCKS,e.msg="invalid block type",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t)}break;case LENS$2:for(;g<32;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if((~m>>>16&65535)!=(65535&m))return r=BADBLOCKS,e.msg="invalid stored block lengths",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);o=65535&m,m=g=0,r=0!==o?STORED$2:0!==d?DRY:TYPE$2;break;case STORED$2:if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);if(0===T&&(C==i.end&&0!==i.read&&(C=0,T=C<i.read?i.read-C-1:i.end-C),0===T&&(i.write=C,t=i.inflate_flush(e,t),C=i.write,T=C<i.read?i.read-C-1:i.end-C,C==i.end&&0!==i.read&&(C=0,T=C<i.read?i.read-C-1:i.end-C),0===T)))return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);if(t=Z_OK$2,f=o,f>y&&(f=y),f>T&&(f=T),i.window.set(e.read_buf(_,f),C),_+=f,y-=f,C+=f,T-=f,0!=(o-=f))break;r=0!==d?DRY:TYPE$2;break;case TABLE$1:for(;g<14;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(a=f=16383&m,(31&f)>29||(f>>5&31)>29)return r=BADBLOCKS,e.msg="too many length or distance symbols",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);if(f=258+(31&f)+(f>>5&31),!n||n.length<f)n=[];else for(S=0;S<f;S++)n[S]=0;m>>>=14,g-=14,s=0,r=BTREE;case BTREE:for(;s<4+(a>>>10);){for(;g<3;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}n[border[s++]]=7&m,m>>>=3,g-=3}for(;s<19;)n[border[s++]]=0;if(c[0]=7,f=p.inflate_trees_bits(n,c,l,h,e),f!=Z_OK$2)return(t=f)==Z_DATA_ERROR$2&&(n=null,r=BADBLOCKS),i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);s=0,r=DTREE;case DTREE:for(;f=a,!(s>=258+(31&f)+(f>>5&31));){let o,u;for(f=c[0];g<f;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(f=h[3*(l[0]+(m&inflate_mask[f]))+1],u=h[3*(l[0]+(m&inflate_mask[f]))+2],u<16)m>>>=f,g-=f,n[s++]=u;else{for(S=18==u?7:u-14,o=18==u?11:3;g<f+S;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(m>>>=f,g-=f,o+=m&inflate_mask[S],m>>>=S,g-=S,S=s,f=a,S+o>258+(31&f)+(f>>5&31)||16==u&&S<1)return n=null,r=BADBLOCKS,e.msg="invalid bit length repeat",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);u=16==u?n[S-1]:0;do{n[S++]=u}while(0!=--o);s=S}}if(l[0]=-1,x=[],P=[],D=[],w=[],x[0]=9,P[0]=6,f=a,f=p.inflate_trees_dynamic(257+(31&f),1+(f>>5&31),n,x,P,D,w,h,e),f!=Z_OK$2)return f==Z_DATA_ERROR$2&&(n=null,r=BADBLOCKS),t=f,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);u.init(x[0],P[0],h,D[0],h,w[0]),r=CODES$2;case CODES$2:if(i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,(t=u.proc(i,e,t))!=Z_STREAM_END$2)return i.inflate_flush(e,t);if(t=Z_OK$2,u.free(e),_=e.next_in_index,y=e.avail_in,m=i.bitb,g=i.bitk,C=i.write,T=C<i.read?i.read-C-1:i.end-C,0===d){r=TYPE$2;break}r=DRY;case DRY:if(i.write=C,t=i.inflate_flush(e,t),C=i.write,T=C<i.read?i.read-C-1:i.end-C,i.read!=i.write)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);r=DONELOCKS;case DONELOCKS:return t=Z_STREAM_END$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);case BADBLOCKS:return t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t);default:return t=Z_STREAM_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=C,i.inflate_flush(e,t)}}},i.free=function(e){i.reset(e,null),i.window=null,h=null},i.set_dictionary=function(e,t,n){i.window.set(e.subarray(t,t+n),0),i.read=i.write=n},i.sync_point=function(){return r==LENS$2?1:0}}const PRESET_DICT=32,Z_DEFLATED$2=8,METHOD=0,FLAG=1,DICT4=2,DICT3=3,DICT2=4,DICT1=5,DICT0=6,BLOCKS=7,DONE$1=12,BAD$2=13,mark=[0,0,255,255];function Inflate$1(){const e=this;function t(e){return e&&e.istate?(e.total_in=e.total_out=0,e.msg=null,e.istate.mode=BLOCKS,e.istate.blocks.reset(e,null),Z_OK$2):Z_STREAM_ERROR$2}e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0,e.inflateEnd=function(t){return e.blocks&&e.blocks.free(t),e.blocks=null,Z_OK$2},e.inflateInit=function(i,n){return i.msg=null,e.blocks=null,n<8||n>15?(e.inflateEnd(i),Z_STREAM_ERROR$2):(e.wbits=n,i.istate.blocks=new InfBlocks(i,1<<n),t(i),Z_OK$2)},e.inflate=function(e,t){let i,n;if(!e||!e.istate||!e.next_in)return Z_STREAM_ERROR$2;const r=e.istate;for(t=t==Z_FINISH$2?Z_BUF_ERROR$2:Z_OK$2,i=Z_BUF_ERROR$2;;)switch(r.mode){case METHOD:if(0===e.avail_in)return i;if(i=t,e.avail_in--,e.total_in++,(15&(r.method=e.read_byte(e.next_in_index++)))!=Z_DEFLATED$2){r.mode=BAD$2,e.msg="unknown compression method",r.marker=5;break}if(8+(r.method>>4)>r.wbits){r.mode=BAD$2,e.msg="invalid window size",r.marker=5;break}r.mode=FLAG;case FLAG:if(0===e.avail_in)return i;if(i=t,e.avail_in--,e.total_in++,n=255&e.read_byte(e.next_in_index++),((r.method<<8)+n)%31!=0){r.mode=BAD$2,e.msg="incorrect header check",r.marker=5;break}if(0==(n&PRESET_DICT)){r.mode=BLOCKS;break}r.mode=DICT4;case DICT4:if(0===e.avail_in)return i;i=t,e.avail_in--,e.total_in++,r.need=(255&e.read_byte(e.next_in_index++))<<24&4278190080,r.mode=DICT3;case DICT3:if(0===e.avail_in)return i;i=t,e.avail_in--,e.total_in++,r.need+=(255&e.read_byte(e.next_in_index++))<<16&16711680,r.mode=DICT2;case DICT2:if(0===e.avail_in)return i;i=t,e.avail_in--,e.total_in++,r.need+=(255&e.read_byte(e.next_in_index++))<<8&65280,r.mode=DICT1;case DICT1:return 0===e.avail_in?i:(i=t,e.avail_in--,e.total_in++,r.need+=255&e.read_byte(e.next_in_index++),r.mode=DICT0,Z_NEED_DICT$2);case DICT0:return r.mode=BAD$2,e.msg="need dictionary",r.marker=0,Z_STREAM_ERROR$2;case BLOCKS:if(i=r.blocks.proc(e,i),i==Z_DATA_ERROR$2){r.mode=BAD$2,r.marker=0;break}if(i==Z_OK$2&&(i=t),i!=Z_STREAM_END$2)return i;i=t,r.blocks.reset(e,r.was),r.mode=DONE$1;case DONE$1:return Z_STREAM_END$2;case BAD$2:return Z_DATA_ERROR$2;default:return Z_STREAM_ERROR$2}},e.inflateSetDictionary=function(e,t,i){let n=0,r=i;if(!e||!e.istate||e.istate.mode!=DICT0)return Z_STREAM_ERROR$2;const o=e.istate;return r>=1<<o.wbits&&(r=(1<<o.wbits)-1,n=i-r),o.blocks.set_dictionary(t,n,r),o.mode=BLOCKS,Z_OK$2},e.inflateSync=function(e){let i,n,r,o,a;if(!e||!e.istate)return Z_STREAM_ERROR$2;const s=e.istate;if(s.mode!=BAD$2&&(s.mode=BAD$2,s.marker=0),0===(i=e.avail_in))return Z_BUF_ERROR$2;for(n=e.next_in_index,r=s.marker;0!==i&&r<4;)e.read_byte(n)==mark[r]?r++:r=0!==e.read_byte(n)?0:4-r,n++,i--;return e.total_in+=n-e.next_in_index,e.next_in_index=n,e.avail_in=i,s.marker=r,4!=r?Z_DATA_ERROR$2:(o=e.total_in,a=e.total_out,t(e),e.total_in=o,e.total_out=a,s.mode=BLOCKS,Z_OK$2)},e.inflateSyncPoint=function(e){return e&&e.istate&&e.istate.blocks?e.istate.blocks.sync_point():Z_STREAM_ERROR$2}}function ZStream$2(){}function ZipInflate(e){const t=new ZStream$2,i=e&&e.chunkSize?Math.floor(2*e.chunkSize):131072,n=Z_NO_FLUSH,r=new Uint8Array(i);let o=!1;t.inflateInit(),t.next_out=r,this.append=function(e,a){const s=[];let c,l,u=0,d=0,h=0;if(0!==e.length){t.next_in_index=0,t.next_in=e,t.avail_in=e.length;do{if(t.next_out_index=0,t.avail_out=i,0!==t.avail_in||o||(t.next_in_index=0,o=!0),c=t.inflate(n),o&&c===Z_BUF_ERROR$2){if(0!==t.avail_in)throw new Error("inflating: bad input")}else if(c!==Z_OK$2&&c!==Z_STREAM_END$2)throw new Error("inflating: "+t.msg);if((o||c===Z_STREAM_END$2)&&t.avail_in===e.length)throw new Error("inflating: bad input");t.next_out_index&&(t.next_out_index===i?s.push(new Uint8Array(r)):s.push(r.slice(0,t.next_out_index))),h+=t.next_out_index,a&&t.next_in_index>0&&t.next_in_index!=u&&(a(t.next_in_index),u=t.next_in_index)}while(t.avail_in>0||0===t.avail_out);return s.length>1?(l=new Uint8Array(h),s.forEach((function(e){l.set(e,d),d+=e.length}))):l=s[0]||new Uint8Array(0),l}},this.flush=function(){t.inflateEnd()}}ZStream$2.prototype={inflateInit:function(e){const t=this;return t.istate=new Inflate$1,e||(e=MAX_BITS),t.istate.inflateInit(t,e)},inflate:function(e){const t=this;return t.istate?t.istate.inflate(t,e):Z_STREAM_ERROR$2},inflateEnd:function(){const e=this;if(!e.istate)return Z_STREAM_ERROR$2;const t=e.istate.inflateEnd(e);return e.istate=null,t},inflateSync:function(){const e=this;return e.istate?e.istate.inflateSync(e):Z_STREAM_ERROR$2},inflateSetDictionary:function(e,t){const i=this;return i.istate?i.istate.inflateSetDictionary(i,e,t):Z_STREAM_ERROR$2},read_byte:function(e){return this.next_in[e]},read_buf:function(e,t){return this.next_in.subarray(e,e+t)}};const DEFAULT_CONFIGURATION={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,terminateWorkerTimeout:5e3,useWebWorkers:!0,workerScripts:void 0},config=Object.assign({},DEFAULT_CONFIGURATION);function getConfiguration(){return config}function configure(e){if(void 0!==e.chunkSize&&(config.chunkSize=e.chunkSize),void 0!==e.maxWorkers&&(config.maxWorkers=e.maxWorkers),void 0!==e.terminateWorkerTimeout&&(config.terminateWorkerTimeout=e.terminateWorkerTimeout),void 0!==e.useWebWorkers&&(config.useWebWorkers=e.useWebWorkers),void 0!==e.Deflate&&(config.Deflate=e.Deflate),void 0!==e.Inflate&&(config.Inflate=e.Inflate),void 0!==e.workerScripts){if(e.workerScripts.deflate){if(!Array.isArray(e.workerScripts.deflate))throw new Error("workerScripts.deflate must be an array");config.workerScripts||(config.workerScripts={}),config.workerScripts.deflate=e.workerScripts.deflate}if(e.workerScripts.inflate){if(!Array.isArray(e.workerScripts.inflate))throw new Error("workerScripts.inflate must be an array");config.workerScripts||(config.workerScripts={}),config.workerScripts.inflate=e.workerScripts.inflate}}}function getMimeType(){return"application/octet-stream"}const MINIMUM_CHUNK_SIZE=64,ERR_ABORT="Abort error";async function processData(e,t,i,n,r,o,a){const s=Math.max(o.chunkSize,MINIMUM_CHUNK_SIZE);return async function o(c=0,l=0){const u=a.signal;if(c<r){testAborted(u,e);const d=await t.readUint8Array(c+n,Math.min(s,r-c)),h=d.length;testAborted(u,e);const p=await e.append(d);if(testAborted(u,e),l+=await writeData(i,p),a.onprogress)try{a.onprogress(c+h,r)}catch(e){}return o(c+s,l)}{const t=await e.flush();return l+=await writeData(i,t.data),{signature:t.signature,length:l}}}()}function testAborted(e,t){if(e&&e.aborted)throw t.flush(),new Error(ERR_ABORT)}async function writeData(e,t){return t.length&&await e.writeUint8Array(t),t.length}const ERR_HTTP_STATUS="HTTP error ",ERR_HTTP_RANGE="HTTP Range not supported",CONTENT_TYPE_TEXT_PLAIN="text/plain",HTTP_HEADER_CONTENT_LENGTH="Content-Length",HTTP_HEADER_CONTENT_RANGE="Content-Range",HTTP_HEADER_ACCEPT_RANGES="Accept-Ranges",HTTP_HEADER_RANGE="Range",HTTP_METHOD_HEAD="HEAD",HTTP_METHOD_GET="GET",HTTP_RANGE_UNIT="bytes";class Stream{constructor(){this.size=0}init(){this.initialized=!0}}class Reader extends Stream{}class Writer extends Stream{writeUint8Array(e){this.size+=e.length}}class TextReader extends Reader{constructor(e){super(),this.blobReader=new BlobReader(new Blob([e],{type:CONTENT_TYPE_TEXT_PLAIN}))}async init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}async readUint8Array(e,t){return this.blobReader.readUint8Array(e,t)}}class TextWriter extends Writer{constructor(e){super(),this.encoding=e,this.blob=new Blob([],{type:CONTENT_TYPE_TEXT_PLAIN})}async writeUint8Array(e){super.writeUint8Array(e),this.blob=new Blob([this.blob,e.buffer],{type:CONTENT_TYPE_TEXT_PLAIN})}getData(){if(this.blob.text)return this.blob.text();{const e=new FileReader;return new Promise(((t,i)=>{e.onload=e=>t(e.target.result),e.onerror=()=>i(e.error),e.readAsText(this.blob,this.encoding)}))}}}class Data64URIReader extends Reader{constructor(e){super(),this.dataURI=e;let t=e.length;for(;"="==e.charAt(t-1);)t--;this.dataStart=e.indexOf(",")+1,this.size=Math.floor(.75*(t-this.dataStart))}async readUint8Array(e,t){const i=new Uint8Array(t),n=4*Math.floor(e/3),r=atob(this.dataURI.substring(n+this.dataStart,4*Math.ceil((e+t)/3)+this.dataStart)),o=e-3*Math.floor(n/4);for(let e=o;e<o+t;e++)i[e-o]=r.charCodeAt(e);return i}}class Data64URIWriter extends Writer{constructor(e){super(),this.data="data:"+(e||"")+";base64,",this.pending=[]}async writeUint8Array(e){super.writeUint8Array(e);let t=0,i=this.pending;const n=this.pending.length;for(this.pending="",t=0;t<3*Math.floor((n+e.length)/3)-n;t++)i+=String.fromCharCode(e[t]);for(;t<e.length;t++)this.pending+=String.fromCharCode(e[t]);i.length>2?this.data+=btoa(i):this.pending=i}getData(){return this.data+btoa(this.pending)}}class BlobReader extends Reader{constructor(e){super(),this.blob=e,this.size=e.size}async readUint8Array(e,t){if(this.blob.arrayBuffer)return new Uint8Array(await this.blob.slice(e,e+t).arrayBuffer());{const i=new FileReader;return new Promise(((n,r)=>{i.onload=e=>n(new Uint8Array(e.target.result)),i.onerror=()=>r(i.error),i.readAsArrayBuffer(this.blob.slice(e,e+t))}))}}}class BlobWriter extends Writer{constructor(e){super(),this.contentType=e,this.arrayBuffers=[]}async writeUint8Array(e){super.writeUint8Array(e),this.arrayBuffers.push(e.buffer)}getData(){return this.blob||(this.blob=new Blob(this.arrayBuffers,{type:this.contentType})),this.blob}}class FetchReader extends Reader{constructor(e,t){super(),this.url=e,this.preventHeadRequest=t.preventHeadRequest,this.useRangeHeader=t.useRangeHeader,this.forceRangeRequests=t.forceRangeRequests,this.options=Object.assign({},t),delete this.options.preventHeadRequest,delete this.options.useRangeHeader,delete this.options.forceRangeRequests,delete this.options.useXHR}async init(){super.init(),await initHttpReader(this,sendFetchRequest,getFetchRequestData)}async readUint8Array(e,t){return readUint8ArrayHttpReader(this,e,t,sendFetchRequest,getFetchRequestData)}}class XHRReader extends Reader{constructor(e,t){super(),this.url=e,this.preventHeadRequest=t.preventHeadRequest,this.useRangeHeader=t.useRangeHeader,this.forceRangeRequests=t.forceRangeRequests,this.options=t}async init(){super.init(),await initHttpReader(this,sendXMLHttpRequest,getXMLHttpRequestData)}async readUint8Array(e,t){return readUint8ArrayHttpReader(this,e,t,sendXMLHttpRequest,getXMLHttpRequestData)}}async function initHttpReader(e,t,i){if(isHttpFamily(e.url)&&(e.useRangeHeader||e.forceRangeRequests)){const n=await t(HTTP_METHOD_GET,e,getRangeHeaders(e));if(!e.forceRangeRequests&&n.headers.get(HTTP_HEADER_ACCEPT_RANGES)!=HTTP_RANGE_UNIT)throw new Error(ERR_HTTP_RANGE);{let r;const o=n.headers.get(HTTP_HEADER_CONTENT_RANGE);if(o){const e=o.trim().split(/\s*\/\s*/);if(e.length){const t=e[1];t&&"*"!=t&&(r=Number(t))}}void 0===r?await getContentLength(e,t,i):e.size=r}}else await getContentLength(e,t,i)}async function readUint8ArrayHttpReader(e,t,i,n,r){if(e.useRangeHeader||e.forceRangeRequests){const r=await n(HTTP_METHOD_GET,e,getRangeHeaders(e,t,i));if(206!=r.status)throw new Error(ERR_HTTP_RANGE);return new Uint8Array(await r.arrayBuffer())}return e.data||await r(e,e.options),new Uint8Array(e.data.subarray(t,t+i))}function getRangeHeaders(e,t=0,i=1){return Object.assign({},getHeaders(e),{[HTTP_HEADER_RANGE]:HTTP_RANGE_UNIT+"="+t+"-"+(t+i-1)})}function getHeaders(e){let t=e.options.headers;if(t)return Symbol.iterator in t?Object.fromEntries(t):t}async function getFetchRequestData(e){await getRequestData(e,sendFetchRequest)}async function getXMLHttpRequestData(e){await getRequestData(e,sendXMLHttpRequest)}async function getRequestData(e,t){const i=await t(HTTP_METHOD_GET,e,getHeaders(e));e.data=new Uint8Array(await i.arrayBuffer()),e.size||(e.size=e.data.length)}async function getContentLength(e,t,i){if(e.preventHeadRequest)await i(e,e.options);else{const n=(await t(HTTP_METHOD_HEAD,e,getHeaders(e))).headers.get(HTTP_HEADER_CONTENT_LENGTH);n?e.size=Number(n):await i(e,e.options)}}async function sendFetchRequest(e,{options:t,url:i},n){const r=await fetch(i,Object.assign({},t,{method:e,headers:n}));if(r.status<400)return r;throw new Error(ERR_HTTP_STATUS+(r.statusText||r.status))}function sendXMLHttpRequest(e,{url:t},i){return new Promise(((n,r)=>{const o=new XMLHttpRequest;if(o.addEventListener("load",(()=>{if(o.status<400){const e=[];o.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{const i=t.trim().split(/\s*:\s*/);i[0]=i[0].trim().replace(/^[a-z]|-[a-z]/g,(e=>e.toUpperCase())),e.push(i)})),n({status:o.status,arrayBuffer:()=>o.response,headers:new Map(e)})}else r(new Error(ERR_HTTP_STATUS+(o.statusText||o.status)))}),!1),o.addEventListener("error",(e=>r(e.detail.error)),!1),o.open(e,t),i)for(const e of Object.entries(i))o.setRequestHeader(e[0],e[1]);o.responseType="arraybuffer",o.send()}))}class HttpReader extends Reader{constructor(e,t={}){super(),this.url=e,t.useXHR?this.reader=new XHRReader(e,t):this.reader=new FetchReader(e,t)}set size(e){}get size(){return this.reader.size}async init(){super.init(),await this.reader.init()}async readUint8Array(e,t){return this.reader.readUint8Array(e,t)}}class HttpRangeReader extends HttpReader{constructor(e,t={}){t.useRangeHeader=!0,super(e,t)}}class Uint8ArrayReader extends Reader{constructor(e){super(),this.array=e,this.size=e.length}async readUint8Array(e,t){return this.array.slice(e,e+t)}}class Uint8ArrayWriter extends Writer{constructor(){super(),this.array=new Uint8Array(0)}async writeUint8Array(e){super.writeUint8Array(e);const t=this.array;this.array=new Uint8Array(t.length+e.length),this.array.set(t),this.array.set(e,t.length)}getData(){return this.array}}function isHttpFamily(e){if("undefined"!=typeof document){const t=document.createElement("a");return t.href=e,"http:"==t.protocol||"https:"==t.protocol}return/^https?:\/\//i.test(e)}const MAX_32_BITS=4294967295,MAX_16_BITS=65535,COMPRESSION_METHOD_DEFLATE=8,COMPRESSION_METHOD_STORE=0,COMPRESSION_METHOD_AES=99,LOCAL_FILE_HEADER_SIGNATURE=67324752,DATA_DESCRIPTOR_RECORD_SIGNATURE=134695760,CENTRAL_FILE_HEADER_SIGNATURE=33639248,END_OF_CENTRAL_DIR_SIGNATURE=101010256,ZIP64_END_OF_CENTRAL_DIR_SIGNATURE=101075792,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE=117853008,END_OF_CENTRAL_DIR_LENGTH=22,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH=20,ZIP64_END_OF_CENTRAL_DIR_LENGTH=56,ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH=END_OF_CENTRAL_DIR_LENGTH+ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH+ZIP64_END_OF_CENTRAL_DIR_LENGTH,ZIP64_TOTAL_NUMBER_OF_DISKS=1,EXTRAFIELD_TYPE_ZIP64=1,EXTRAFIELD_TYPE_AES=39169,EXTRAFIELD_TYPE_NTFS=10,EXTRAFIELD_TYPE_NTFS_TAG1=1,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP=21589,EXTRAFIELD_TYPE_UNICODE_PATH=28789,EXTRAFIELD_TYPE_UNICODE_COMMENT=25461,BITFLAG_ENCRYPTED=1,BITFLAG_LEVEL=6,BITFLAG_DATA_DESCRIPTOR=8,BITFLAG_LANG_ENCODING_FLAG=2048,FILE_ATTR_MSDOS_DIR_MASK=16,VERSION_DEFLATE=20,VERSION_ZIP64=45,VERSION_AES=51,DIRECTORY_SIGNATURE="/",MAX_DATE=new Date(2107,11,31),MIN_DATE=new Date(1980,0,1),CP437="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");var decodeCP437=e=>{let t="";for(let i=0;i<e.length;i++)t+=CP437[e[i]];return t};const table=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;table[e]=t}class Crc32{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let i=0,n=0|e.length;i<n;i++)t=t>>>8^table[255&(t^e[i])];this.crc=t}get(){return~this.crc}}const bitArray={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const i=e[e.length-1],n=bitArray.getPartial(i);return 32===n?e.concat(t):bitArray._shiftRight(t,n,0|i,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const i=e[t-1];return 32*(t-1)+bitArray.getPartial(i)},clamp(e,t){if(32*e.length<t)return e;const i=(e=e.slice(0,Math.ceil(t/32))).length;return t&=31,i>0&&t&&(e[i-1]=bitArray.partial(t,e[i-1]&2147483648>>t-1,1)),e},partial:(e,t,i)=>32===e?t:(i?0|t:t<<32-e)+1099511627776*e,getPartial:e=>Math.round(e/1099511627776)||32,_shiftRight(e,t,i,n){for(void 0===n&&(n=[]);t>=32;t-=32)n.push(i),i=0;if(0===t)return n.concat(e);for(let r=0;r<e.length;r++)n.push(i|e[r]>>>t),i=e[r]<<32-t;const r=e.length?e[e.length-1]:0,o=bitArray.getPartial(r);return n.push(bitArray.partial(t+o&31,t+o>32?i:n.pop(),1)),n}},codec={bytes:{fromBits(e){const t=bitArray.bitLength(e)/8,i=new Uint8Array(t);let n;for(let r=0;r<t;r++)0==(3&r)&&(n=e[r/4]),i[r]=n>>>24,n<<=8;return i},toBits(e){const t=[];let i,n=0;for(i=0;i<e.length;i++)n=n<<8|e[i],3==(3&i)&&(t.push(n),n=0);return 3&i&&t.push(bitArray.partial(8*(3&i),n)),t}}},hash={sha1:function(e){e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()}};hash.sha1.prototype={blockSize:512,reset:function(){const e=this;return e._h=this._init.slice(0),e._buffer=[],e._length=0,e},update:function(e){const t=this;"string"==typeof e&&(e=codec.utf8String.toBits(e));const i=t._buffer=bitArray.concat(t._buffer,e),n=t._length,r=t._length=n+bitArray.bitLength(e);if(r>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const o=new Uint32Array(i);let a=0;for(let e=t.blockSize+n-(t.blockSize+n&t.blockSize-1);e<=r;e+=t.blockSize)t._block(o.subarray(16*a,16*(a+1))),a+=1;return i.splice(0,16*a),t},finalize:function(){const e=this;let t=e._buffer;const i=e._h;t=bitArray.concat(t,[bitArray.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),i},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:function(e,t,i,n){return e<=19?t&i|~t&n:e<=39?t^i^n:e<=59?t&i|t&n|i&n:e<=79?t^i^n:void 0},_S:function(e,t){return t<<e|t>>>32-e},_block:function(e){const t=this,i=t._h,n=Array(80);for(let t=0;t<16;t++)n[t]=e[t];let r=i[0],o=i[1],a=i[2],s=i[3],c=i[4];for(let e=0;e<=79;e++){e>=16&&(n[e]=t._S(1,n[e-3]^n[e-8]^n[e-14]^n[e-16]));const i=t._S(5,r)+t._f(e,o,a,s)+c+n[e]+t._key[Math.floor(e/20)]|0;c=s,s=a,a=t._S(30,o),o=r,r=i}i[0]=i[0]+r|0,i[1]=i[1]+o|0,i[2]=i[2]+a|0,i[3]=i[3]+s|0,i[4]=i[4]+c|0}};const cipher={aes:class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const i=t._tables[0][4],n=t._tables[1],r=e.length;let o,a,s,c=1;if(4!==r&&6!==r&&8!==r)throw new Error("invalid aes key size");for(t._key=[a=e.slice(0),s=[]],o=r;o<4*r+28;o++){let e=a[o-1];(o%r==0||8===r&&o%r==4)&&(e=i[e>>>24]<<24^i[e>>16&255]<<16^i[e>>8&255]<<8^i[255&e],o%r==0&&(e=e<<8^e>>>24^c<<24,c=c<<1^283*(c>>7))),a[o]=a[o-r]^e}for(let e=0;o;e++,o--){const t=a[3&e?o:o-4];s[e]=o<=4||e<4?t:n[0][i[t>>>24]]^n[1][i[t>>16&255]]^n[2][i[t>>8&255]]^n[3][i[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],i=e[4],n=t[4],r=[],o=[];let a,s,c,l;for(let e=0;e<256;e++)o[(r[e]=e<<1^283*(e>>7))^e]=e;for(let u=a=0;!i[u];u^=s||1,a=o[a]||1){let o=a^a<<1^a<<2^a<<3^a<<4;o=o>>8^255&o^99,i[u]=o,n[o]=u,l=r[c=r[s=r[u]]];let d=16843009*l^65537*c^257*s^16843008*u,h=257*r[o]^16843008*o;for(let i=0;i<4;i++)e[i][u]=h=h<<24^h>>>8,t[i][o]=d=d<<24^d>>>8}for(let i=0;i<5;i++)e[i]=e[i].slice(0),t[i]=t[i].slice(0)}_crypt(e,t){if(4!==e.length)throw new Error("invalid aes block size");const i=this._key[t],n=i.length/4-2,r=[0,0,0,0],o=this._tables[t],a=o[0],s=o[1],c=o[2],l=o[3],u=o[4];let d,h,p,f=e[0]^i[0],m=e[t?3:1]^i[1],g=e[2]^i[2],_=e[t?1:3]^i[3],y=4;for(let e=0;e<n;e++)d=a[f>>>24]^s[m>>16&255]^c[g>>8&255]^l[255&_]^i[y],h=a[m>>>24]^s[g>>16&255]^c[_>>8&255]^l[255&f]^i[y+1],p=a[g>>>24]^s[_>>16&255]^c[f>>8&255]^l[255&m]^i[y+2],_=a[_>>>24]^s[f>>16&255]^c[m>>8&255]^l[255&g]^i[y+3],y+=4,f=d,m=h,g=p;for(let e=0;e<4;e++)r[t?3&-e:e]=u[f>>>24]<<24^u[m>>16&255]<<16^u[g>>8&255]<<8^u[255&_]^i[y++],d=f,f=m,m=g,g=_,_=d;return r}}},mode={ctrGladman:class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255==(e>>24&255)){let t=e>>16&255,i=e>>8&255,n=255&e;255===t?(t=0,255===i?(i=0,255===n?n=0:++n):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=n}else e+=1<<24;return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,i){let n;if(!(n=t.length))return[];const r=bitArray.bitLength(t);for(let r=0;r<n;r+=4){this.incCounter(i);const n=e.encrypt(i);t[r]^=n[0],t[r+1]^=n[1],t[r+2]^=n[2],t[r+3]^=n[3]}return bitArray.clamp(t,r)}}},misc={hmacSha1:class{constructor(e){const t=this,i=t._hash=hash.sha1,n=[[],[]],r=i.prototype.blockSize/32;t._baseHash=[new i,new i],e.length>r&&(e=i.hash(e));for(let t=0;t<r;t++)n[0][t]=909522486^e[t],n[1][t]=1549556828^e[t];t._baseHash[0].update(n[0]),t._baseHash[1].update(n[1]),t._resultHash=new i(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),i=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),i}}},ERR_INVALID_PASSWORD="Invalid pasword",BLOCK_LENGTH=16,RAW_FORMAT="raw",PBKDF2_ALGORITHM={name:"PBKDF2"},HASH_ALGORITHM={name:"HMAC"},HASH_FUNCTION="SHA-1",BASE_KEY_ALGORITHM=Object.assign({hash:HASH_ALGORITHM},PBKDF2_ALGORITHM),DERIVED_BITS_ALGORITHM=Object.assign({iterations:1e3,hash:{name:HASH_FUNCTION}},PBKDF2_ALGORITHM),DERIVED_BITS_USAGE=["deriveBits"],SALT_LENGTH=[8,12,16],KEY_LENGTH=[16,24,32],SIGNATURE_LENGTH=10,COUNTER_DEFAULT_VALUE=[0,0,0,0],codecBytes=codec.bytes,Aes=cipher.aes,CtrGladman=mode.ctrGladman,HmacSha1=misc.hmacSha1;class AESDecrypt{constructor(e,t,i){Object.assign(this,{password:e,signed:t,strength:i-1,pendingInput:new Uint8Array(0)})}async append(e){const t=this;if(t.password){const i=subarray(e,0,SALT_LENGTH[t.strength]+2);await createDecryptionKeys(t,i,t.password),t.password=null,t.aesCtrGladman=new CtrGladman(new Aes(t.keys.key),Array.from(COUNTER_DEFAULT_VALUE)),t.hmac=new HmacSha1(t.keys.authentication),e=subarray(e,SALT_LENGTH[t.strength]+2)}return append(t,e,new Uint8Array(e.length-SIGNATURE_LENGTH-(e.length-SIGNATURE_LENGTH)%BLOCK_LENGTH),0,SIGNATURE_LENGTH,!0)}flush(){const e=this,t=e.pendingInput,i=subarray(t,0,t.length-SIGNATURE_LENGTH),n=subarray(t,t.length-SIGNATURE_LENGTH);let r=new Uint8Array(0);if(i.length){const t=codecBytes.toBits(i);e.hmac.update(t);const n=e.aesCtrGladman.update(t);r=codecBytes.fromBits(n)}let o=!0;if(e.signed){const t=subarray(codecBytes.fromBits(e.hmac.digest()),0,SIGNATURE_LENGTH);for(let e=0;e<SIGNATURE_LENGTH;e++)t[e]!=n[e]&&(o=!1)}return{valid:o,data:r}}}class AESEncrypt{constructor(e,t){Object.assign(this,{password:e,strength:t-1,pendingInput:new Uint8Array(0)})}async append(e){const t=this;let i=new Uint8Array(0);t.password&&(i=await createEncryptionKeys(t,t.password),t.password=null,t.aesCtrGladman=new CtrGladman(new Aes(t.keys.key),Array.from(COUNTER_DEFAULT_VALUE)),t.hmac=new HmacSha1(t.keys.authentication));const n=new Uint8Array(i.length+e.length-e.length%BLOCK_LENGTH);return n.set(i,0),append(t,e,n,i.length,0)}flush(){const e=this;let t=new Uint8Array(0);if(e.pendingInput.length){const i=e.aesCtrGladman.update(codecBytes.toBits(e.pendingInput));e.hmac.update(i),t=codecBytes.fromBits(i)}const i=subarray(codecBytes.fromBits(e.hmac.digest()),0,SIGNATURE_LENGTH);return{data:concat(t,i),signature:i}}}function append(e,t,i,n,r,o){const a=t.length-r;let s;for(e.pendingInput.length&&(t=concat(e.pendingInput,t),i=expand(i,a-a%BLOCK_LENGTH)),s=0;s<=a-BLOCK_LENGTH;s+=BLOCK_LENGTH){const r=codecBytes.toBits(subarray(t,s,s+BLOCK_LENGTH));o&&e.hmac.update(r);const a=e.aesCtrGladman.update(r);o||e.hmac.update(a),i.set(codecBytes.fromBits(a),s+n)}return e.pendingInput=subarray(t,s),i}async function createDecryptionKeys(e,t,i){await createKeys$1(e,i,subarray(t,0,SALT_LENGTH[e.strength]));const n=subarray(t,SALT_LENGTH[e.strength]),r=e.keys.passwordVerification;if(r[0]!=n[0]||r[1]!=n[1])throw new Error(ERR_INVALID_PASSWORD)}async function createEncryptionKeys(e,t){const i=crypto.getRandomValues(new Uint8Array(SALT_LENGTH[e.strength]));return await createKeys$1(e,t,i),concat(i,e.keys.passwordVerification)}async function createKeys$1(e,t,i){const n=(new TextEncoder).encode(t),r=await crypto.subtle.importKey(RAW_FORMAT,n,BASE_KEY_ALGORITHM,!1,DERIVED_BITS_USAGE),o=await crypto.subtle.deriveBits(Object.assign({salt:i},DERIVED_BITS_ALGORITHM),r,8*(2*KEY_LENGTH[e.strength]+2)),a=new Uint8Array(o);e.keys={key:codecBytes.toBits(subarray(a,0,KEY_LENGTH[e.strength])),authentication:codecBytes.toBits(subarray(a,KEY_LENGTH[e.strength],2*KEY_LENGTH[e.strength])),passwordVerification:subarray(a,2*KEY_LENGTH[e.strength])}}function concat(e,t){let i=e;return e.length+t.length&&(i=new Uint8Array(e.length+t.length),i.set(e,0),i.set(t,e.length)),i}function expand(e,t){if(t&&t>e.length){const i=e;(e=new Uint8Array(t)).set(i,0)}return e}function subarray(e,t,i){return e.subarray(t,i)}const HEADER_LENGTH=12;class ZipCryptoDecrypt{constructor(e,t){Object.assign(this,{password:e,passwordVerification:t}),createKeys(this,e)}append(e){const t=this;if(t.password){const i=decrypt(t,e.subarray(0,HEADER_LENGTH));if(t.password=null,i[HEADER_LENGTH-1]!=t.passwordVerification)throw new Error(ERR_INVALID_PASSWORD);e=e.subarray(HEADER_LENGTH)}return decrypt(t,e)}flush(){return{valid:!0,data:new Uint8Array(0)}}}class ZipCryptoEncrypt{constructor(e,t){Object.assign(this,{password:e,passwordVerification:t}),createKeys(this,e)}append(e){const t=this;let i,n;if(t.password){t.password=null;const r=crypto.getRandomValues(new Uint8Array(HEADER_LENGTH));r[HEADER_LENGTH-1]=t.passwordVerification,i=new Uint8Array(e.length+r.length),i.set(encrypt(t,r),0),n=HEADER_LENGTH}else i=new Uint8Array(e.length),n=0;return i.set(encrypt(t,e),n),i}flush(){return{data:new Uint8Array(0)}}}function decrypt(e,t){const i=new Uint8Array(t.length);for(let n=0;n<t.length;n++)i[n]=getByte(e)^t[n],updateKeys(e,i[n]);return i}function encrypt(e,t){const i=new Uint8Array(t.length);for(let n=0;n<t.length;n++)i[n]=getByte(e)^t[n],updateKeys(e,t[n]);return i}function createKeys(e,t){e.keys=[305419896,591751049,878082192],e.crcKey0=new Crc32(e.keys[0]),e.crcKey2=new Crc32(e.keys[2]);for(let i=0;i<t.length;i++)updateKeys(e,t.charCodeAt(i))}function updateKeys(e,t){e.crcKey0.append([t]),e.keys[0]=~e.crcKey0.get(),e.keys[1]=getInt32(e.keys[1]+getInt8(e.keys[0])),e.keys[1]=getInt32(Math.imul(e.keys[1],134775813)+1),e.crcKey2.append([e.keys[1]>>>24]),e.keys[2]=~e.crcKey2.get()}function getByte(e){const t=2|e.keys[2];return getInt8(Math.imul(t,1^t)>>>8)}function getInt8(e){return 255&e}function getInt32(e){return 4294967295&e}const CODEC_DEFLATE="deflate",CODEC_INFLATE="inflate",ERR_INVALID_SIGNATURE="Invalid signature";class Inflate$2{constructor(e,{signature:t,password:i,signed:n,compressed:r,zipCrypto:o,passwordVerification:a,encryptionStrength:s},{chunkSize:c}){const l=Boolean(i);Object.assign(this,{signature:t,encrypted:l,signed:n,compressed:r,inflate:r&&new e({chunkSize:c}),crc32:n&&new Crc32,zipCrypto:o,decrypt:l&&o?new ZipCryptoDecrypt(i,a):new AESDecrypt(i,n,s)})}async append(e){const t=this;return t.encrypted&&e.length&&(e=await t.decrypt.append(e)),t.compressed&&e.length&&(e=await t.inflate.append(e)),(!t.encrypted||t.zipCrypto)&&t.signed&&e.length&&t.crc32.append(e),e}async flush(){const e=this;let t,i=new Uint8Array(0);if(e.encrypted){const t=e.decrypt.flush();if(!t.valid)throw new Error(ERR_INVALID_SIGNATURE);i=t.data}if((!e.encrypted||e.zipCrypto)&&e.signed){const i=new DataView(new Uint8Array(4).buffer);if(t=e.crc32.get(),i.setUint32(0,t),e.signature!=i.getUint32(0,!1))throw new Error(ERR_INVALID_SIGNATURE)}return e.compressed&&(i=await e.inflate.append(i)||new Uint8Array(0),await e.inflate.flush()),{data:i,signature:t}}}class Deflate{constructor(e,{encrypted:t,signed:i,compressed:n,level:r,zipCrypto:o,password:a,passwordVerification:s,encryptionStrength:c},{chunkSize:l}){Object.assign(this,{encrypted:t,signed:i,compressed:n,deflate:n&&new e({level:r||5,chunkSize:l}),crc32:i&&new Crc32,zipCrypto:o,encrypt:t&&o?new ZipCryptoEncrypt(a,s):new AESEncrypt(a,c)})}async append(e){const t=this;let i=e;return t.compressed&&e.length&&(i=await t.deflate.append(e)),t.encrypted&&i.length&&(i=await t.encrypt.append(i)),(!t.encrypted||t.zipCrypto)&&t.signed&&e.length&&t.crc32.append(e),i}async flush(){const e=this;let t,i=new Uint8Array(0);if(e.compressed&&(i=await e.deflate.flush()||new Uint8Array(0)),e.encrypted){i=await e.encrypt.append(i);const n=e.encrypt.flush();t=n.signature;const r=new Uint8Array(i.length+n.data.length);r.set(i,0),r.set(n.data,i.length),i=r}return e.encrypted&&!e.zipCrypto||!e.signed||(t=e.crc32.get()),{data:i,signature:t}}}function createCodec$1(e,t,i){return t.codecType.startsWith(CODEC_DEFLATE)?new Deflate(e,t,i):t.codecType.startsWith(CODEC_INFLATE)?new Inflate$2(e,t,i):void 0}const MESSAGE_INIT="init",MESSAGE_APPEND="append",MESSAGE_FLUSH="flush",MESSAGE_EVENT_TYPE="message";let classicWorkersSupported=!0;var getWorker=(e,t,i,n,r,o,a)=>(Object.assign(e,{busy:!0,codecConstructor:t,options:Object.assign({},i),scripts:a,terminate(){e.worker&&!e.busy&&(e.worker.terminate(),e.interface=null)},onTaskFinished(){e.busy=!1,r(e)}}),o?createWebWorkerInterface(e,n):createWorkerInterface(e,n));function createWorkerInterface(e,t){const i=createCodec$1(e.codecConstructor,e.options,t);return{async append(t){try{return await i.append(t)}catch(t){throw e.onTaskFinished(),t}},async flush(){try{return await i.flush()}finally{e.onTaskFinished()}}}}function createWebWorkerInterface(e,t){let i;const n={type:"module"};if(!e.interface){if(classicWorkersSupported)try{e.worker=r()}catch(t){classicWorkersSupported=!1,e.worker=r(n)}else e.worker=r(n);e.worker.addEventListener(MESSAGE_EVENT_TYPE,(function(t){const n=t.data;if(i){const t=n.error,r=n.type;if(t){const n=new Error(t.message);n.stack=t.stack,i.reject(n),i=null,e.onTaskFinished()}else if(r==MESSAGE_INIT||r==MESSAGE_FLUSH||r==MESSAGE_APPEND){const t=n.data;r==MESSAGE_FLUSH?(i.resolve({data:new Uint8Array(t),signature:n.signature}),i=null,e.onTaskFinished()):i.resolve(t&&new Uint8Array(t))}}}),!1),e.interface={append:e=>o({type:MESSAGE_APPEND,data:e}),flush:()=>o({type:MESSAGE_FLUSH})}}return e.interface;function r(t={}){return new Worker(new URL(e.scripts[0],"undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("Cesium.js",document.baseURI).href),t)}async function o(n){if(!i){const i=e.options,n=e.scripts.slice(1);await a({scripts:n,type:MESSAGE_INIT,options:i,config:{chunkSize:t.chunkSize}})}return a(n)}function a(t){const n=e.worker,r=new Promise(((e,t)=>i={resolve:e,reject:t}));try{if(t.data)try{t.data=t.data.buffer,n.postMessage(t,[t.data])}catch(e){n.postMessage(t)}else n.postMessage(t)}catch(t){i.reject(t),i=null,e.onTaskFinished()}return r}}let pool=[],pendingRequests=[];function createCodec(e,t,i){const n=!(!t.compressed&&!t.signed&&!t.encrypted)&&(t.useWebWorkers||void 0===t.useWebWorkers&&i.useWebWorkers),r=n&&i.workerScripts?i.workerScripts[t.codecType]:[];if(pool.length<i.maxWorkers){const a={};return pool.push(a),getWorker(a,e,t,i,o,n,r)}{const a=pool.find((e=>!e.busy));return a?(clearTerminateTimeout(a),getWorker(a,e,t,i,o,n,r)):new Promise((i=>pendingRequests.push({resolve:i,codecConstructor:e,options:t,webWorker:n,scripts:r})))}function o(e){if(pendingRequests.length){const[{resolve:t,codecConstructor:n,options:r,webWorker:a,scripts:s}]=pendingRequests.splice(0,1);t(getWorker(e,n,r,i,o,a,s))}else e.worker?(clearTerminateTimeout(e),Number.isFinite(i.terminateWorkerTimeout)&&i.terminateWorkerTimeout>=0&&(e.terminateTimeout=setTimeout((()=>{pool=pool.filter((t=>t!=e)),e.terminate()}),i.terminateWorkerTimeout))):pool=pool.filter((t=>t!=e))}}function clearTerminateTimeout(e){e.terminateTimeout&&(clearTimeout(e.terminateTimeout),e.terminateTimeout=null)}const PROPERTY_NAMES=["filename","rawFilename","directory","encrypted","compressedSize","uncompressedSize","lastModDate","rawLastModDate","comment","rawComment","signature","extraField","rawExtraField","bitFlag","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","filenameUTF8","commentUTF8","offset","zip64","compressionMethod","extraFieldNTFS","lastAccessDate","creationDate","extraFieldExtendedTimestamp","version","versionMadeBy","msDosCompatible","internalFileAttribute","externalFileAttribute"];class Entry{constructor(e){PROPERTY_NAMES.forEach((t=>this[t]=e[t]))}}const ERR_BAD_FORMAT="File format is not recognized",ERR_EOCDR_NOT_FOUND="End of central directory not found",ERR_EOCDR_ZIP64_NOT_FOUND="End of Zip64 central directory not found",ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND="End of Zip64 central directory locator not found",ERR_CENTRAL_DIRECTORY_NOT_FOUND="Central directory header not found",ERR_LOCAL_FILE_HEADER_NOT_FOUND="Local file header not found",ERR_EXTRAFIELD_ZIP64_NOT_FOUND="Zip64 extra field not found",ERR_ENCRYPTED="File contains encrypted entry",ERR_UNSUPPORTED_ENCRYPTION="Encryption method not supported",ERR_UNSUPPORTED_COMPRESSION="Compression method not supported",CHARSET_UTF8="utf-8",ZIP64_PROPERTIES=["uncompressedSize","compressedSize","offset"];class ZipReader{constructor(e,t={}){Object.assign(this,{reader:e,options:t,config:getConfiguration()})}async getEntries(e={}){const t=this,i=t.reader;if(i.initialized||await i.init(),i.size<END_OF_CENTRAL_DIR_LENGTH)throw new Error(ERR_BAD_FORMAT);const n=await seekSignature(i,END_OF_CENTRAL_DIR_SIGNATURE,i.size,END_OF_CENTRAL_DIR_LENGTH,16*MAX_16_BITS);if(!n)throw new Error(ERR_EOCDR_NOT_FOUND);const r=getDataView$1(n);let o=getUint32(r,12),a=getUint32(r,16),s=getUint16(r,8),c=0;if(a==MAX_32_BITS||o==MAX_32_BITS||s==MAX_16_BITS){const e=getDataView$1(await readUint8Array(i,n.offset-ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH));if(getUint32(e,0)!=ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE)throw new Error(ERR_EOCDR_ZIP64_NOT_FOUND);a=getBigUint64(e,8);let t=await readUint8Array(i,a,ZIP64_END_OF_CENTRAL_DIR_LENGTH),r=getDataView$1(t);const l=n.offset-ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH-ZIP64_END_OF_CENTRAL_DIR_LENGTH;if(getUint32(r,0)!=ZIP64_END_OF_CENTRAL_DIR_SIGNATURE&&a!=l){const e=a;a=l,c=a-e,t=await readUint8Array(i,a,ZIP64_END_OF_CENTRAL_DIR_LENGTH),r=getDataView$1(t)}if(getUint32(r,0)!=ZIP64_END_OF_CENTRAL_DIR_SIGNATURE)throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND);s=getBigUint64(r,32),o=getBigUint64(r,40),a-=o}if(a<0||a>=i.size)throw new Error(ERR_BAD_FORMAT);let l=0,u=await readUint8Array(i,a,o),d=getDataView$1(u);const h=n.offset-o;if(getUint32(d,l)!=CENTRAL_FILE_HEADER_SIGNATURE&&a!=h){const e=a;a=h,c=a-e,u=await readUint8Array(i,a,o),d=getDataView$1(u)}if(a<0||a>=i.size)throw new Error(ERR_BAD_FORMAT);const p=[];for(let n=0;n<s;n++){const r=new ZipEntry(i,t.config,t.options);if(getUint32(d,l)!=CENTRAL_FILE_HEADER_SIGNATURE)throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);readCommonHeader(r,d,l+6);const o=Boolean(r.bitFlag.languageEncodingFlag),a=l+46,h=a+r.filenameLength,f=h+r.extraFieldLength,m=getUint16(d,l+4),g=0==(0&m);Object.assign(r,{versionMadeBy:m,msDosCompatible:g,compressedSize:0,uncompressedSize:0,commentLength:getUint16(d,l+32),directory:g&&(getUint8(d,l+38)&FILE_ATTR_MSDOS_DIR_MASK)==FILE_ATTR_MSDOS_DIR_MASK,offset:getUint32(d,l+42)+c,internalFileAttribute:getUint32(d,l+34),externalFileAttribute:getUint32(d,l+38),rawFilename:u.subarray(a,h),filenameUTF8:o,commentUTF8:o,rawExtraField:u.subarray(h,f)});const _=f+r.commentLength;r.rawComment=u.subarray(f,_),r.filename=decodeString(r.rawFilename,r.filenameUTF8?CHARSET_UTF8:getOptionValue$1(t,e,"filenameEncoding")),r.comment=decodeString(r.rawComment,r.commentUTF8?CHARSET_UTF8:getOptionValue$1(t,e,"commentEncoding")),!r.directory&&r.filename.endsWith(DIRECTORY_SIGNATURE)&&(r.directory=!0),readCommonFooter(r,r,d,l+6);const y=new Entry(r);if(y.getData=(e,t)=>r.getData(e,y,t),p.push(y),l=_,e.onprogress)try{e.onprogress(n+1,s,new Entry(r))}catch(e){}}return p}async close(){}}class ZipEntry{constructor(e,t,i){Object.assign(this,{reader:e,config:t,options:i})}async getData(e,t,i={}){const n=this,{reader:r,offset:o,extraFieldAES:a,compressionMethod:s,config:c,bitFlag:l,signature:u,rawLastModDate:d,compressedSize:h}=n,p=n.localDirectory={};r.initialized||await r.init();let f=await readUint8Array(r,o,30);const m=getDataView$1(f);let g=getOptionValue$1(n,i,"password");if(g=g&&g.length&&g,a&&a.originalCompressionMethod!=COMPRESSION_METHOD_AES)throw new Error(ERR_UNSUPPORTED_COMPRESSION);if(s!=COMPRESSION_METHOD_STORE&&s!=COMPRESSION_METHOD_DEFLATE)throw new Error(ERR_UNSUPPORTED_COMPRESSION);if(getUint32(m,0)!=LOCAL_FILE_HEADER_SIGNATURE)throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND);readCommonHeader(p,m,4),f=await readUint8Array(r,o,30+p.filenameLength+p.extraFieldLength),p.rawExtraField=f.subarray(30+p.filenameLength),readCommonFooter(n,p,m,4),t.lastAccessDate=p.lastAccessDate,t.creationDate=p.creationDate;const _=n.encrypted&&p.encrypted,y=_&&!a;if(_){if(!y&&void 0===a.strength)throw new Error(ERR_UNSUPPORTED_ENCRYPTION);if(!g)throw new Error(ERR_ENCRYPTED)}const C=await createCodec(c.Inflate,{codecType:CODEC_INFLATE,password:g,zipCrypto:y,encryptionStrength:a&&a.strength,signed:getOptionValue$1(n,i,"checkSignature"),passwordVerification:y&&(l.dataDescriptor?d>>>8&255:u>>>24&255),signature:u,compressed:0!=s,encrypted:_,useWebWorkers:getOptionValue$1(n,i,"useWebWorkers")},c);e.initialized||await e.init();const T=getOptionValue$1(n,i,"signal"),S=o+30+p.filenameLength+p.extraFieldLength;return await processData(C,r,e,S,h,c,{onprogress:i.onprogress,signal:T}),e.getData()}}function readCommonHeader(e,t,i){const n=e.rawBitFlag=getUint16(t,i+2),r=(n&BITFLAG_ENCRYPTED)==BITFLAG_ENCRYPTED,o=getUint32(t,i+6);Object.assign(e,{encrypted:r,version:getUint16(t,i),bitFlag:{level:(n&BITFLAG_LEVEL)>>1,dataDescriptor:(n&BITFLAG_DATA_DESCRIPTOR)==BITFLAG_DATA_DESCRIPTOR,languageEncodingFlag:(n&BITFLAG_LANG_ENCODING_FLAG)==BITFLAG_LANG_ENCODING_FLAG},rawLastModDate:o,lastModDate:getDate(o),filenameLength:getUint16(t,i+22),extraFieldLength:getUint16(t,i+24)})}function readCommonFooter(e,t,i,n){const r=t.rawExtraField,o=t.extraField=new Map,a=getDataView$1(new Uint8Array(r));let s=0;try{for(;s<r.length;){const e=getUint16(a,s),t=getUint16(a,s+2);o.set(e,{type:e,data:r.slice(s+4,s+4+t)}),s+=4+t}}catch(e){}const c=getUint16(i,n+4);t.signature=getUint32(i,n+10),t.uncompressedSize=getUint32(i,n+18),t.compressedSize=getUint32(i,n+14);const l=o.get(EXTRAFIELD_TYPE_ZIP64);l&&(readExtraFieldZip64(l,t),t.extraFieldZip64=l);const u=o.get(EXTRAFIELD_TYPE_UNICODE_PATH);u&&(readExtraFieldUnicode(u,"filename","rawFilename",t,e),t.extraFieldUnicodePath=u);const d=o.get(EXTRAFIELD_TYPE_UNICODE_COMMENT);d&&(readExtraFieldUnicode(d,"comment","rawComment",t,e),t.extraFieldUnicodeComment=d);const h=o.get(EXTRAFIELD_TYPE_AES);h?(readExtraFieldAES(h,t,c),t.extraFieldAES=h):t.compressionMethod=c;const p=o.get(EXTRAFIELD_TYPE_NTFS);p&&(readExtraFieldNTFS(p,t),t.extraFieldNTFS=p);const f=o.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);f&&(readExtraFieldExtendedTimestamp(f,t),t.extraFieldExtendedTimestamp=f)}function readExtraFieldZip64(e,t){t.zip64=!0;const i=getDataView$1(e.data);e.values=[];for(let t=0;t<Math.floor(e.data.length/8);t++)e.values.push(getBigUint64(i,0+8*t));const n=ZIP64_PROPERTIES.filter((e=>t[e]==MAX_32_BITS));for(let t=0;t<n.length;t++)e[n[t]]=e.values[t];ZIP64_PROPERTIES.forEach((i=>{if(t[i]==MAX_32_BITS){if(void 0===e[i])throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);t[i]=e[i]}}))}function readExtraFieldUnicode(e,t,i,n,r){const o=getDataView$1(e.data);e.version=getUint8(o,0),e.signature=getUint32(o,1);const a=new Crc32;a.append(r[i]);const s=getDataView$1(new Uint8Array(4));s.setUint32(0,a.get(),!0),e[t]=(new TextDecoder).decode(e.data.subarray(5)),e.valid=!r.bitFlag.languageEncodingFlag&&e.signature==getUint32(s,0),e.valid&&(n[t]=e[t],n[t+"UTF8"]=!0)}function readExtraFieldAES(e,t,i){const n=getDataView$1(e.data);e.vendorVersion=getUint8(n,0),e.vendorId=getUint8(n,2);const r=getUint8(n,4);e.strength=r,e.originalCompressionMethod=i,t.compressionMethod=e.compressionMethod=getUint16(n,5)}function readExtraFieldNTFS(e,t){const i=getDataView$1(e.data);let n,r=4;try{for(;r<e.data.length&&!n;){const t=getUint16(i,r),o=getUint16(i,r+2);t==EXTRAFIELD_TYPE_NTFS_TAG1&&(n=e.data.slice(r+4,r+4+o)),r+=4+o}}catch(e){}try{if(n&&24==n.length){const i=getDataView$1(n),r=i.getBigUint64(0,!0),o=i.getBigUint64(8,!0),a=i.getBigUint64(16,!0);Object.assign(e,{rawLastModDate:r,rawLastAccessDate:o,rawCreationDate:a});const s=getDateNTFS(r),c=getDateNTFS(o),l={lastModDate:s,lastAccessDate:c,creationDate:getDateNTFS(a)};Object.assign(e,l),Object.assign(t,l)}}catch(e){}}function readExtraFieldExtendedTimestamp(e,t){const i=getDataView$1(e.data),n=getUint8(i,0),r=[],o=[];1==(1&n)&&(r.push("lastModDate"),o.push("rawLastModDate")),2==(2&n)&&(r.push("lastAccessDate"),o.push("rawLastAccessDate")),4==(4&n)&&(r.push("creationDate"),o.push("rawCreationDate"));let a=1;r.forEach(((n,r)=>{if(e.data.length>=a+4){const s=getUint32(i,a);t[n]=e[n]=new Date(1e3*s);const c=o[r];e[c]=s}a+=4}))}async function seekSignature(e,t,i,n,r){const o=new Uint8Array(4);setUint32$1(getDataView$1(o),0,t);const a=n+r;return await s(n)||await s(Math.min(a,i));async function s(t){const r=i-t,a=await readUint8Array(e,r,t);for(let e=a.length-n;e>=0;e--)if(a[e]==o[0]&&a[e+1]==o[1]&&a[e+2]==o[2]&&a[e+3]==o[3])return{offset:r+e,buffer:a.slice(e,e+n).buffer}}}function getOptionValue$1(e,t,i){return void 0===t[i]?e.options[i]:t[i]}function decodeString(e,t){return t&&"cp437"!=t.trim().toLowerCase()?new TextDecoder(t).decode(e):decodeCP437(e)}function getDate(e){const t=(4294901760&e)>>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}function getDateNTFS(e){return new Date(Number(e/BigInt(1e4)-BigInt(116444736e5)))}function getUint8(e,t){return e.getUint8(t)}function getUint16(e,t){return e.getUint16(t,!0)}function getUint32(e,t){return e.getUint32(t,!0)}function getBigUint64(e,t){return Number(e.getBigUint64(t,!0))}function setUint32$1(e,t,i){e.setUint32(t,i,!0)}function getDataView$1(e){return new DataView(e.buffer)}function readUint8Array(e,t,i){return e.readUint8Array(t,i)}const ERR_DUPLICATED_NAME="File already exists",ERR_INVALID_COMMENT="Zip file comment exceeds 64KB",ERR_INVALID_ENTRY_COMMENT="File entry comment exceeds 64KB",ERR_INVALID_ENTRY_NAME="File entry name exceeds 64KB",ERR_INVALID_VERSION="Version exceeds 65535",ERR_INVALID_ENCRYPTION_STRENGTH="The strength must equal 1, 2, or 3",ERR_INVALID_EXTRAFIELD_TYPE="Extra field type exceeds 65535",ERR_INVALID_EXTRAFIELD_DATA="Extra field data exceeds 64KB",ERR_UNSUPPORTED_FORMAT="Zip64 is not supported",EXTRAFIELD_DATA_AES=new Uint8Array([7,0,2,0,65,69,3,0,0]),EXTRAFIELD_LENGTH_ZIP64=24;let workers=0;class ZipWriter{constructor(e,t={}){Object.assign(this,{writer:e,options:t,config:getConfiguration(),files:new Map,offset:e.size,pendingCompressedSize:0,pendingEntries:[]})}async add(e="",t,i={}){const n=this;if(!(workers<n.config.maxWorkers))return new Promise(((r,o)=>n.pendingEntries.push({name:e,reader:t,options:i,resolve:r,reject:o})));workers++;try{return await addFile(n,e,t,i)}finally{workers--;const e=n.pendingEntries.shift();e&&n.add(e.name,e.reader,e.options).then(e.resolve).catch(e.reject)}}async close(e=new Uint8Array(0),t={}){return await closeFile(this,e,t),this.writer.getData()}}async function addFile(e,t,i,n){if(t=t.trim(),n.directory&&!t.endsWith(DIRECTORY_SIGNATURE)?t+=DIRECTORY_SIGNATURE:n.directory=t.endsWith(DIRECTORY_SIGNATURE),e.files.has(t))throw new Error(ERR_DUPLICATED_NAME);const r=(new TextEncoder).encode(t);if(r.length>MAX_16_BITS)throw new Error(ERR_INVALID_ENTRY_NAME);const o=n.comment||"",a=(new TextEncoder).encode(o);if(a.length>MAX_16_BITS)throw new Error(ERR_INVALID_ENTRY_COMMENT);const s=e.options.version||n.version||0;if(s>MAX_16_BITS)throw new Error(ERR_INVALID_VERSION);const c=e.options.versionMadeBy||n.versionMadeBy||20;if(c>MAX_16_BITS)throw new Error(ERR_INVALID_VERSION);const l=getOptionValue(e,n,"lastModDate")||new Date,u=getOptionValue(e,n,"lastAccessDate"),d=getOptionValue(e,n,"creationDate"),h=getOptionValue(e,n,"password"),p=getOptionValue(e,n,"encryptionStrength")||3,f=getOptionValue(e,n,"zipCrypto");if(void 0!==h&&void 0!==p&&(p<1||p>3))throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);let m=new Uint8Array(0);const g=n.extraField;if(g){let e=0,t=0;g.forEach((t=>e+=4+t.length)),m=new Uint8Array(e),g.forEach(((e,i)=>{if(i>MAX_16_BITS)throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);if(e.length>MAX_16_BITS)throw new Error(ERR_INVALID_EXTRAFIELD_DATA);arraySet(m,new Uint16Array([i]),t),arraySet(m,new Uint16Array([e.length]),t+2),arraySet(m,e,t+4),t+=4+e.length}))}let _=getOptionValue(e,n,"extendedTimestamp");void 0===_&&(_=!0);let y=0,C=getOptionValue(e,n,"keepOrder");void 0===C&&(C=!0);let T=0,S=getOptionValue(e,n,"msDosCompatible");void 0===S&&(S=!0);const v=getOptionValue(e,n,"internalFileAttribute")||0,A=getOptionValue(e,n,"externalFileAttribute")||0;i&&(i.initialized||await i.init(),T=i.size,y=getMaximumCompressedSize(T));let E=n.zip64||e.options.zip64||!1;if(e.offset+e.pendingCompressedSize>=MAX_32_BITS||T>=MAX_32_BITS||y>=MAX_32_BITS){if(!1===n.zip64||!1===e.options.zip64||!C)throw new Error(ERR_UNSUPPORTED_FORMAT);E=!0}e.pendingCompressedSize+=y,await Promise.resolve();const b=getOptionValue(e,n,"level"),x=getOptionValue(e,n,"useWebWorkers"),P=getOptionValue(e,n,"bufferedWrite");let D=getOptionValue(e,n,"dataDescriptor"),w=getOptionValue(e,n,"dataDescriptorSignature");const M=getOptionValue(e,n,"signal");void 0===D&&(D=!0),D&&void 0===w&&(w=!0);const I=await getFileEntry(e,t,i,Object.assign({},n,{rawFilename:r,rawComment:a,version:s,versionMadeBy:c,lastModDate:l,lastAccessDate:u,creationDate:d,rawExtraField:m,zip64:E,password:h,level:b,useWebWorkers:x,encryptionStrength:p,extendedTimestamp:_,zipCrypto:f,bufferedWrite:P,keepOrder:C,dataDescriptor:D,dataDescriptorSignature:w,signal:M,msDosCompatible:S,internalFileAttribute:v,externalFileAttribute:A}));return y&&(e.pendingCompressedSize-=y),Object.assign(I,{name:t,comment:o,extraField:g}),new Entry(I)}async function getFileEntry(e,t,i,n){const r=e.files,o=e.writer,a=Array.from(r.values()).pop();let s,c,l,u={};r.set(t,u);try{let d,h,p;if(n.keepOrder&&(d=a&&a.lock),u.lock=p=new Promise((e=>l=e)),n.bufferedWrite||e.lockWrite||!n.dataDescriptor?(h=new BlobWriter,h.init(),s=!0):(e.lockWrite=new Promise((e=>c=e)),o.initialized||await o.init(),h=o),u=await createFileEntry(i,h,e.config,n),u.lock=p,r.set(t,u),u.filename=t,s){let t=0;const i=h.getData();let a;await Promise.all([e.lockWrite,d]);do{a=Array.from(r.values()).find((e=>e.writingBufferedData)),a&&await a.lock}while(a&&a.lock);if(u.writingBufferedData=!0,!n.dataDescriptor){const e=26,r=await sliceAsArrayBuffer(i,0,e),a=new DataView(r);u.encrypted&&!n.zipCrypto||setUint32(a,14,u.signature),u.zip64?(setUint32(a,18,MAX_32_BITS),setUint32(a,22,MAX_32_BITS)):(setUint32(a,18,u.compressedSize),setUint32(a,22,u.uncompressedSize)),await o.writeUint8Array(new Uint8Array(r)),t=e}await writeBlob(o,i,t),delete u.writingBufferedData}if(u.offset=e.offset,u.zip64){setBigUint64(getDataView(u.rawExtraFieldZip64),20,BigInt(u.offset))}else if(u.offset>=MAX_32_BITS)throw new Error(ERR_UNSUPPORTED_FORMAT);return e.offset+=u.length,u}catch(i){throw(s&&u.writingBufferedData||!s&&u.dataWritten)&&(i.corruptedEntry=e.hasCorruptedEntries=!0,u.uncompressedSize&&(e.offset+=u.uncompressedSize)),r.delete(t),i}finally{l(),c&&c()}}async function createFileEntry(e,t,i,n){const{rawFilename:r,lastAccessDate:o,creationDate:a,password:s,level:c,zip64:l,zipCrypto:u,dataDescriptor:d,dataDescriptorSignature:h,directory:p,version:f,versionMadeBy:m,rawComment:g,rawExtraField:_,useWebWorkers:y,onprogress:C,signal:T,encryptionStrength:S,extendedTimestamp:v,msDosCompatible:A,internalFileAttribute:E,externalFileAttribute:b}=n,x=Boolean(s&&s.length),P=0!==c&&!p;let D,w,M;if(x&&!u){D=new Uint8Array(EXTRAFIELD_DATA_AES.length+2);const e=getDataView(D);setUint16(e,0,EXTRAFIELD_TYPE_AES),arraySet(D,EXTRAFIELD_DATA_AES,2),setUint8(e,8,S)}else D=new Uint8Array(0);if(v){M=new Uint8Array(9+(o?4:0)+(a?4:0));const e=getDataView(M);setUint16(e,0,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP),setUint16(e,2,M.length-4);setUint8(e,4,1+(o?2:0)+(a?4:0)),setUint32(e,5,Math.floor(n.lastModDate.getTime()/1e3)),o&&setUint32(e,9,Math.floor(o.getTime()/1e3)),a&&setUint32(e,13,Math.floor(a.getTime()/1e3));try{w=new Uint8Array(36);const e=getDataView(w),t=getTimeNTFS(n.lastModDate);setUint16(e,0,EXTRAFIELD_TYPE_NTFS),setUint16(e,2,32),setUint16(e,8,EXTRAFIELD_TYPE_NTFS_TAG1),setUint16(e,10,24),setBigUint64(e,12,t),setBigUint64(e,20,getTimeNTFS(o)||t),setBigUint64(e,28,getTimeNTFS(a)||t)}catch(e){w=new Uint8Array(0)}}else w=M=new Uint8Array(0);const I={version:f||VERSION_DEFLATE,versionMadeBy:m,zip64:l,directory:Boolean(p),filenameUTF8:!0,rawFilename:r,commentUTF8:!0,rawComment:g,rawExtraFieldZip64:l?new Uint8Array(EXTRAFIELD_LENGTH_ZIP64+4):new Uint8Array(0),rawExtraFieldExtendedTimestamp:M,rawExtraFieldNTFS:w,rawExtraFieldAES:D,rawExtraField:_,extendedTimestamp:v,msDosCompatible:A,internalFileAttribute:E,externalFileAttribute:b};let R=I.uncompressedSize=0,O=BITFLAG_LANG_ENCODING_FLAG;d&&(O|=BITFLAG_DATA_DESCRIPTOR);let B=COMPRESSION_METHOD_STORE;P&&(B=COMPRESSION_METHOD_DEFLATE),l&&(I.version=I.version>VERSION_ZIP64?I.version:VERSION_ZIP64),x&&(O|=BITFLAG_ENCRYPTED,u||(I.version=I.version>VERSION_AES?I.version:VERSION_AES,B=COMPRESSION_METHOD_AES,P&&(I.rawExtraFieldAES[9]=COMPRESSION_METHOD_DEFLATE))),I.compressionMethod=B;const L=I.headerArray=new Uint8Array(26),F=getDataView(L);setUint16(F,0,I.version),setUint16(F,2,O),setUint16(F,4,B);const N=new Uint32Array(1),V=getDataView(N);let $;$=n.lastModDate<MIN_DATE?MIN_DATE:n.lastModDate>MAX_DATE?MAX_DATE:n.lastModDate,setUint16(V,0,($.getHours()<<6|$.getMinutes())<<5|$.getSeconds()/2),setUint16(V,2,($.getFullYear()-1980<<4|$.getMonth()+1)<<5|$.getDate());const k=N[0];setUint32(F,6,k),setUint16(F,22,r.length);const U=D.length+M.length+w.length+I.rawExtraField.length;setUint16(F,24,U);const G=new Uint8Array(30+r.length+U);let z;setUint32(getDataView(G),0,LOCAL_FILE_HEADER_SIGNATURE),arraySet(G,L,4),arraySet(G,r,30),arraySet(G,D,30+r.length),arraySet(G,M,30+r.length+D.length),arraySet(G,w,30+r.length+D.length+M.length),arraySet(G,I.rawExtraField,30+r.length+D.length+M.length+w.length);let H=0;if(e){R=I.uncompressedSize=e.size;const n=await createCodec(i.Deflate,{codecType:CODEC_DEFLATE,level:c,password:s,encryptionStrength:S,zipCrypto:x&&u,passwordVerification:x&&u&&k>>8&255,signed:!0,compressed:P,encrypted:x,useWebWorkers:y},i);await t.writeUint8Array(G),I.dataWritten=!0,z=await processData(n,e,t,0,R,i,{onprogress:C,signal:T}),H=z.length}else await t.writeUint8Array(G),I.dataWritten=!0;let W,q=new Uint8Array(0),j=0;if(d&&(q=new Uint8Array(l?h?24:20:h?16:12),W=getDataView(q),h&&(j=4,setUint32(W,0,DATA_DESCRIPTOR_RECORD_SIGNATURE))),e){const e=z.signature;if(x&&!u||void 0===e||(setUint32(F,10,e),I.signature=e,d&&setUint32(W,j,e)),l){const e=getDataView(I.rawExtraFieldZip64);setUint16(e,0,EXTRAFIELD_TYPE_ZIP64),setUint16(e,2,EXTRAFIELD_LENGTH_ZIP64),setUint32(F,14,MAX_32_BITS),setBigUint64(e,12,BigInt(H)),setUint32(F,18,MAX_32_BITS),setBigUint64(e,4,BigInt(R)),d&&(setBigUint64(W,j+4,BigInt(H)),setBigUint64(W,j+12,BigInt(R)))}else setUint32(F,14,H),setUint32(F,18,R),d&&(setUint32(W,j+4,H),setUint32(W,j+8,R))}d&&await t.writeUint8Array(q);const X=G.length+H+q.length;return Object.assign(I,{compressedSize:H,lastModDate:$,rawLastModDate:k,creationDate:a,lastAccessDate:o,encrypted:x,length:X}),I}async function closeFile(e,t,i){const n=e.writer,r=e.files;let o=0,a=0,s=e.offset,c=r.size;for(const[,e]of r)a+=46+e.rawFilename.length+e.rawComment.length+e.rawExtraFieldZip64.length+e.rawExtraFieldAES.length+e.rawExtraFieldExtendedTimestamp.length+e.rawExtraFieldNTFS.length+e.rawExtraField.length;let l=i.zip64||e.options.zip64||!1;if(s>=MAX_32_BITS||a>=MAX_32_BITS||c>=MAX_16_BITS){if(!1===i.zip64||!1===e.options.zip64)throw new Error(ERR_UNSUPPORTED_FORMAT);l=!0}const u=new Uint8Array(a+(l?ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH:END_OF_CENTRAL_DIR_LENGTH)),d=getDataView(u);if(t&&t.length){if(!(t.length<=MAX_16_BITS))throw new Error(ERR_INVALID_COMMENT);setUint16(d,o+20,t.length)}for(const[e,t]of Array.from(r.values()).entries()){const{rawFilename:n,rawExtraFieldZip64:a,rawExtraFieldAES:s,rawExtraField:c,rawComment:l,versionMadeBy:h,headerArray:p,directory:f,zip64:m,msDosCompatible:g,internalFileAttribute:_,externalFileAttribute:y}=t;let C,T;if(t.extendedTimestamp){T=t.rawExtraFieldNTFS,C=new Uint8Array(9);const e=getDataView(C);setUint16(e,0,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP),setUint16(e,2,C.length-4),setUint8(e,4,1),setUint32(e,5,Math.floor(t.lastModDate.getTime()/1e3))}else T=C=new Uint8Array(0);const S=a.length+s.length+C.length+T.length+c.length;if(setUint32(d,o,CENTRAL_FILE_HEADER_SIGNATURE),setUint16(d,o+4,h),arraySet(u,p,o+6),setUint16(d,o+30,S),setUint16(d,o+32,l.length),setUint32(d,o+34,_),y?setUint32(d,o+38,y):f&&g&&setUint8(d,o+38,FILE_ATTR_MSDOS_DIR_MASK),setUint32(d,o+42,m?MAX_32_BITS:t.offset),arraySet(u,n,o+46),arraySet(u,a,o+46+n.length),arraySet(u,s,o+46+n.length+a.length),arraySet(u,C,o+46+n.length+a.length+s.length),arraySet(u,T,o+46+n.length+a.length+s.length+C.length),arraySet(u,c,o+46+n.length+a.length+s.length+C.length+T.length),arraySet(u,l,o+46+n.length+S),o+=46+n.length+S+l.length,i.onprogress)try{i.onprogress(e+1,r.size,new Entry(t))}catch(e){}}l&&(setUint32(d,o,ZIP64_END_OF_CENTRAL_DIR_SIGNATURE),setBigUint64(d,o+4,BigInt(44)),setUint16(d,o+12,45),setUint16(d,o+14,45),setBigUint64(d,o+24,BigInt(c)),setBigUint64(d,o+32,BigInt(c)),setBigUint64(d,o+40,BigInt(a)),setBigUint64(d,o+48,BigInt(s)),setUint32(d,o+56,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE),setBigUint64(d,o+64,BigInt(s)+BigInt(a)),setUint32(d,o+72,ZIP64_TOTAL_NUMBER_OF_DISKS),c=MAX_16_BITS,s=MAX_32_BITS,a=MAX_32_BITS,o+=76),setUint32(d,o,END_OF_CENTRAL_DIR_SIGNATURE),setUint16(d,o+8,c),setUint16(d,o+10,c),setUint32(d,o+12,a),setUint32(d,o+16,s),await n.writeUint8Array(u),t&&t.length&&await n.writeUint8Array(t)}function sliceAsArrayBuffer(e,t,i){if(e.arrayBuffer)return t||i?e.slice(t,i).arrayBuffer():e.arrayBuffer();{const n=new FileReader;return new Promise(((r,o)=>{n.onload=e=>r(e.target.result),n.onerror=()=>o(n.error),n.readAsArrayBuffer(t||i?e.slice(t,i):e)}))}}async function writeBlob(e,t,i=0){const n=536870912;await async function r(){if(i<t.size){const o=await sliceAsArrayBuffer(t,i,i+n);await e.writeUint8Array(new Uint8Array(o)),i+=n,await r()}}()}function getTimeNTFS(e){if(e)return(BigInt(e.getTime())+BigInt(116444736e5))*BigInt(1e4)}function getOptionValue(e,t,i){return void 0===t[i]?e.options[i]:t[i]}function getMaximumCompressedSize(e){return e+5*(Math.floor(e/16383)+1)}function setUint8(e,t,i){e.setUint8(t,i)}function setUint16(e,t,i){e.setUint16(t,i,!0)}function setUint32(e,t,i){e.setUint32(t,i,!0)}function setBigUint64(e,t,i){e.setBigUint64(t,i,!0)}function arraySet(e,t,i){e.set(t,i)}function getDataView(e){return new DataView(e.buffer)}configure({Deflate:ZipDeflate,Inflate:ZipInflate});var zipNoWorker=Object.freeze({__proto__:null,configure:configure,getMimeType:getMimeType,ERR_ABORT:ERR_ABORT,Reader:Reader,Writer:Writer,TextReader:TextReader,TextWriter:TextWriter,Data64URIReader:Data64URIReader,Data64URIWriter:Data64URIWriter,BlobReader:BlobReader,BlobWriter:BlobWriter,Uint8ArrayReader:Uint8ArrayReader,Uint8ArrayWriter:Uint8ArrayWriter,HttpReader:HttpReader,HttpRangeReader:HttpRangeReader,ERR_HTTP_RANGE:ERR_HTTP_RANGE,ZipReader:ZipReader,ERR_BAD_FORMAT:ERR_BAD_FORMAT,ERR_EOCDR_NOT_FOUND:ERR_EOCDR_NOT_FOUND,ERR_EOCDR_ZIP64_NOT_FOUND:ERR_EOCDR_ZIP64_NOT_FOUND,ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND:ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,ERR_CENTRAL_DIRECTORY_NOT_FOUND:ERR_CENTRAL_DIRECTORY_NOT_FOUND,ERR_LOCAL_FILE_HEADER_NOT_FOUND:ERR_LOCAL_FILE_HEADER_NOT_FOUND,ERR_EXTRAFIELD_ZIP64_NOT_FOUND:ERR_EXTRAFIELD_ZIP64_NOT_FOUND,ERR_ENCRYPTED:ERR_ENCRYPTED,ERR_UNSUPPORTED_ENCRYPTION:ERR_UNSUPPORTED_ENCRYPTION,ERR_UNSUPPORTED_COMPRESSION:ERR_UNSUPPORTED_COMPRESSION,ERR_INVALID_SIGNATURE:ERR_INVALID_SIGNATURE,ERR_INVALID_PASSWORD:ERR_INVALID_PASSWORD,ZipWriter:ZipWriter,ERR_DUPLICATED_NAME:ERR_DUPLICATED_NAME,ERR_INVALID_COMMENT:ERR_INVALID_COMMENT,ERR_INVALID_ENTRY_NAME:ERR_INVALID_ENTRY_NAME,ERR_INVALID_ENTRY_COMMENT:ERR_INVALID_ENTRY_COMMENT,ERR_INVALID_VERSION:ERR_INVALID_VERSION,ERR_INVALID_EXTRAFIELD_TYPE:ERR_INVALID_EXTRAFIELD_TYPE,ERR_INVALID_EXTRAFIELD_DATA:ERR_INVALID_EXTRAFIELD_DATA,ERR_INVALID_ENCRYPTION_STRENGTH:ERR_INVALID_ENCRYPTION_STRENGTH,ERR_UNSUPPORTED_FORMAT:ERR_UNSUPPORTED_FORMAT});const BILLBOARD_SIZE$2=32,kmlNamespace="http://www.opengis.net/kml/2.2",gxNamespace="http://www.google.com/kml/ext/2.2",xmlnsNamespace="http://www.w3.org/2000/xmlns/";function ExternalFileHandler(e){this._files={},this._promises=[],this._count=0,this._modelCallback=e}const imageTypeRegex=/^data:image\/([^,;]+)/;function getModelBlobHander(e,t){return function(i){e._files[t]=i}}function ValueGetter(e){this._time=e}function StyleCache(){this._ids={},this._styles={},this._count=0}function IdManager(){this._ids={}}function exportKml(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).entities,i=defaultValue(e.kmz,!1),n=exportKml._createState(e),r=t.values.filter((function(e){return!defined(e.parent)})),o=n.kmlDoc,a=o.documentElement;a.setAttributeNS(xmlnsNamespace,"xmlns:gx",gxNamespace);const s=o.createElement("Document");a.appendChild(s),recurseEntities(n,s,r),n.styleCache.save(s);const c=n.externalFileHandler;return c.promise.then((function(){const e=(new XMLSerializer).serializeToString(n.kmlDoc);return i?createKmz(e,c.files):{kml:e,externalFiles:c.files}}))}function createKmz(e,t){const i=buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");zipNoWorker.configure({workerScripts:{deflate:[i,"./pako_deflate.min.js"],inflate:[i,"./pako_inflate.min.js"]}});const n=new zipNoWorker.BlobWriter,r=new zipNoWorker.ZipWriter(n);return r.add("doc.kml",new zipNoWorker.TextReader(e)).then((function(){const e=Object.keys(t);return addExternalFilesToZip(r,e,t,0)})).then((function(){return r.close()})).then((function(e){return{kmz:e}}))}function addExternalFilesToZip(e,t,i,n){if(t.length===n)return;const r=t[n];return e.add(r,new zipNoWorker.BlobReader(i[r])).then((function(){return addExternalFilesToZip(e,t,i,n+1)}))}function recurseEntities(e,t,i){const n=e.kmlDoc,r=e.styleCache,o=e.valueGetter,a=e.idManager,s=i.length;let c,l,u;for(let d=0;d<s;++d){const s=i[d];let h;c=[],l=[],u=[],createPoint$1(e,s,l,u),createLineString$1(e,s.polyline,l,u),createPolygon$1(e,s.rectangle,l,u,c),createPolygon$1(e,s.polygon,l,u,c),createModel(e,s,s.model,l,u);const p=s.availability;defined(p)&&(h=n.createElement("TimeSpan"),JulianDate.equals(p.start,Iso8601.MINIMUM_VALUE)||h.appendChild(createBasicElementWithText(n,"begin",JulianDate.toIso8601(p.start))),JulianDate.equals(p.stop,Iso8601.MAXIMUM_VALUE)||h.appendChild(createBasicElementWithText(n,"end",JulianDate.toIso8601(p.stop))));for(let e=0;e<c.length;++e){const i=c[e];i.setAttribute("id",a.get(s.id)),i.appendChild(createBasicElementWithText(n,"name",s.name)),i.appendChild(createBasicElementWithText(n,"visibility",s.show)),i.appendChild(createBasicElementWithText(n,"description",s.description)),defined(h)&&i.appendChild(h),t.appendChild(i)}const f=l.length;if(f>0){const e=n.createElement("Placemark");e.setAttribute("id",a.get(s.id));let i=s.name;const c=s.label;if(defined(c)){const e=n.createElement("LabelStyle"),t=o.get(c.text);i=defined(t)&&t.length>0?t:i;const r=o.getColor(c.fillColor);defined(r)&&(e.appendChild(createBasicElementWithText(n,"color",r)),e.appendChild(createBasicElementWithText(n,"colorMode","normal")));const a=o.get(c.scale);defined(a)&&e.appendChild(createBasicElementWithText(n,"scale",a)),u.push(e)}e.appendChild(createBasicElementWithText(n,"name",i)),e.appendChild(createBasicElementWithText(n,"visibility",s.show)),e.appendChild(createBasicElementWithText(n,"description",s.description)),defined(h)&&e.appendChild(h),t.appendChild(e);const d=u.length;if(d>0){const t=n.createElement("Style");for(let e=0;e<d;++e)t.appendChild(u[e]);e.appendChild(createBasicElementWithText(n,"styleUrl",r.get(t)))}if(1===l.length)e.appendChild(l[0]);else if(l.length>1){const t=n.createElement("MultiGeometry");for(let e=0;e<f;++e)t.appendChild(l[e]);e.appendChild(t)}}const m=s._children;if(m.length>0){const i=n.createElement("Folder");i.setAttribute("id",a.get(s.id)),i.appendChild(createBasicElementWithText(n,"name",s.name)),i.appendChild(createBasicElementWithText(n,"visibility",s.show)),i.appendChild(createBasicElementWithText(n,"description",s.description)),t.appendChild(i),recurseEntities(e,i,m)}}}ExternalFileHandler.prototype.texture=function(e){const t=this;let i;if("string"==typeof e||e instanceof Resource){if(!(e=Resource.createIfNeeded(e)).isDataUri)return e.url;const n=e.url.match(imageTypeRegex);i="texture_"+ ++this._count,defined(n)&&(i+=`.${n[1]}`);const r=e.fetchBlob().then((function(e){t._files[i]=e}));return this._promises.push(r),i}if(e instanceof HTMLCanvasElement){const n=defer();return this._promises.push(n.promise),i=`texture_${++this._count}.png`,e.toBlob((function(e){t._files[i]=e,n.resolve()})),i}return""},ExternalFileHandler.prototype.model=function(e,t){const i=this._modelCallback;if(!defined(i))throw new RuntimeError("Encountered a model entity while exporting to KML, but no model callback was supplied.");const n={},r=i(e,t,n);for(const e in n)if(n.hasOwnProperty(e)){const t=Promise.resolve(n[e]);this._promises.push(t),t.then(getModelBlobHander(this,e))}return r},Object.defineProperties(ExternalFileHandler.prototype,{promise:{get:function(){return Promise.all(this._promises)}},files:{get:function(){return this._files}}}),ValueGetter.prototype.get=function(e,t,i){let n;return defined(e)&&(n=defined(e.getValue)?e.getValue(this._time,i):e),defaultValue(n,t)},ValueGetter.prototype.getColor=function(e,t){const i=this.get(e,t);if(defined(i))return colorToString(i)},ValueGetter.prototype.getMaterialType=function(e){if(defined(e))return e.getType(this._time)},StyleCache.prototype.get=function(e){const t=this._ids,i=e.innerHTML;if(defined(t[i]))return t[i];let n="style-"+ ++this._count;return e.setAttribute("id",n),n=`#${n}`,t[i]=n,this._styles[i]=e,n},StyleCache.prototype.save=function(e){const t=this._styles,i=e.childNodes[0];for(const n in t)t.hasOwnProperty(n)&&e.insertBefore(t[n],i)},IdManager.prototype.get=function(e){if(!defined(e))return this.get(createGuid());const t=this._ids;return defined(t[e])?`${e.toString()}-${++t[e]}`:(t[e]=0,e)},exportKml._createState=function(e){const t=e.entities,i=new StyleCache,n=t.computeAvailability(),r=defined(e.time)?e.time:n.start;let o=defaultValue(e.defaultAvailability,n);const a=defaultValue(e.sampleDuration,60);o.start===Iso8601.MINIMUM_VALUE?o.stop===Iso8601.MAXIMUM_VALUE?o=new TimeInterval:JulianDate.addSeconds(o.stop,-10*a,o.start):o.stop===Iso8601.MAXIMUM_VALUE&&JulianDate.addSeconds(o.start,10*a,o.stop);const s=new ExternalFileHandler(e.modelCallback);return{kmlDoc:document.implementation.createDocument(kmlNamespace,"kml"),ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84),idManager:new IdManager,styleCache:i,externalFileHandler:s,time:r,valueGetter:new ValueGetter(r),sampleDuration:a,defaultAvailability:new TimeIntervalCollection([o])}};const scratchCartesian3$3=new Cartesian3,scratchCartographic$8=new Cartographic,scratchJulianDate=new JulianDate;function createPoint$1(e,t,i,n){const r=e.kmlDoc,o=e.ellipsoid,a=e.valueGetter,s=defaultValue(t.billboard,t.point);if(!defined(s)&&!defined(t.path))return;const c=t.position;if(!c.isConstant)return void createTracks(e,t,s,i,n);a.get(c,void 0,scratchCartesian3$3);const l=createBasicElementWithText(r,"coordinates",getCoordinates(scratchCartesian3$3,o)),u=r.createElement("Point"),d=r.createElement("altitudeMode");d.appendChild(getAltitudeMode(e,s.heightReference)),u.appendChild(d),u.appendChild(l),i.push(u);const h=s instanceof BillboardGraphics?createIconStyleFromBillboard(e,s):createIconStyleFromPoint(e,s);n.push(h)}function createTracks(e,t,i,n,r){const o=e.kmlDoc,a=e.ellipsoid,s=e.valueGetter;let c;const l=t.position;let u=!0;l instanceof CompositePositionProperty?(c=l.intervals,u=!1):c=defaultValue(t.availability,e.defaultAvailability);const d=i instanceof ModelGraphics;let h,p,f;const m=[];for(h=0;h<c.length;++h){const t=c.get(h);let n=u?l:t.data;const r=o.createElement("altitudeMode");n instanceof ScaledPositionProperty?(n=n._value,r.appendChild(getAltitudeMode(e,HeightReference$1.CLAMP_TO_GROUND))):defined(i)?r.appendChild(getAltitudeMode(e,i.heightReference)):r.appendChild(getAltitudeMode(e,HeightReference$1.NONE));const g=[],_=[];if(n.isConstant){s.get(n,void 0,scratchCartesian3$3);const e=createBasicElementWithText(o,"coordinates",getCoordinates(scratchCartesian3$3,a));g.push(JulianDate.toIso8601(t.start)),_.push(e),g.push(JulianDate.toIso8601(t.stop)),_.push(e)}else if(n instanceof SampledPositionProperty)for(f=n._property._times,p=0;p<f.length;++p)g.push(JulianDate.toIso8601(f[p])),n.getValueInReferenceFrame(f[p],ReferenceFrame$1.FIXED,scratchCartesian3$3),_.push(getCoordinates(scratchCartesian3$3,a));else if(n instanceof SampledProperty){f=n._times;const e=n._values;for(p=0;p<f.length;++p)g.push(JulianDate.toIso8601(f[p])),Cartesian3.fromArray(e,3*p,scratchCartesian3$3),_.push(getCoordinates(scratchCartesian3$3,a))}else{const i=e.sampleDuration;t.start.clone(scratchJulianDate),t.isStartIncluded||JulianDate.addSeconds(scratchJulianDate,i,scratchJulianDate);const r=t.stop;for(;JulianDate.lessThan(scratchJulianDate,r);)n.getValue(scratchJulianDate,scratchCartesian3$3),g.push(JulianDate.toIso8601(scratchJulianDate)),_.push(getCoordinates(scratchCartesian3$3,a)),JulianDate.addSeconds(scratchJulianDate,i,scratchJulianDate);t.isStopIncluded&&JulianDate.equals(scratchJulianDate,r)&&(n.getValue(scratchJulianDate,scratchCartesian3$3),g.push(JulianDate.toIso8601(scratchJulianDate)),_.push(getCoordinates(scratchCartesian3$3,a)))}const y=o.createElementNS(gxNamespace,"Track");y.appendChild(r);for(let e=0;e<g.length;++e){const t=createBasicElementWithText(o,"when",g[e]),i=createBasicElementWithText(o,"coord",_[e],gxNamespace);y.appendChild(t),y.appendChild(i)}d&&y.appendChild(createModelGeometry(e,i)),m.push(y)}if(1===m.length)n.push(m[0]);else if(m.length>1){const e=o.createElementNS(gxNamespace,"MultiTrack");for(h=0;h<m.length;++h)e.appendChild(m[h]);n.push(e)}if(defined(i)&&!d){const t=i instanceof BillboardGraphics?createIconStyleFromBillboard(e,i):createIconStyleFromPoint(e,i);r.push(t)}const g=t.path;if(defined(g)){const t=s.get(g.width),i=g.material;if(defined(i)||defined(t)){const n=o.createElement("LineStyle");defined(t)&&n.appendChild(createBasicElementWithText(o,"width",t)),processMaterial(e,i,n),r.push(n)}}}function createIconStyleFromPoint(e,t){const i=e.kmlDoc,n=e.valueGetter,r=i.createElement("IconStyle"),o=n.getColor(t.color);defined(o)&&(r.appendChild(createBasicElementWithText(i,"color",o)),r.appendChild(createBasicElementWithText(i,"colorMode","normal")));const a=n.get(t.pixelSize);return defined(a)&&r.appendChild(createBasicElementWithText(i,"scale",a/BILLBOARD_SIZE$2)),r}function createIconStyleFromBillboard(e,t){const i=e.kmlDoc,n=e.valueGetter,r=e.externalFileHandler,o=i.createElement("IconStyle");let a=n.get(t.image);if(defined(a)){a=r.texture(a);const e=i.createElement("Icon");e.appendChild(createBasicElementWithText(i,"href",a));const s=n.get(t.imageSubRegion);defined(s)&&(e.appendChild(createBasicElementWithText(i,"x",s.x,gxNamespace)),e.appendChild(createBasicElementWithText(i,"y",s.y,gxNamespace)),e.appendChild(createBasicElementWithText(i,"w",s.width,gxNamespace)),e.appendChild(createBasicElementWithText(i,"h",s.height,gxNamespace))),o.appendChild(e)}const s=n.getColor(t.color);defined(s)&&(o.appendChild(createBasicElementWithText(i,"color",s)),o.appendChild(createBasicElementWithText(i,"colorMode","normal")));let c=n.get(t.scale);defined(c)&&o.appendChild(createBasicElementWithText(i,"scale",c));const l=n.get(t.pixelOffset);if(defined(l)){c=defaultValue(c,1),Cartesian2.divideByScalar(l,c,l);const e=n.get(t.width,BILLBOARD_SIZE$2),r=n.get(t.height,BILLBOARD_SIZE$2),a=n.get(t.horizontalOrigin,HorizontalOrigin$1.CENTER);a===HorizontalOrigin$1.CENTER?l.x-=.5*e:a===HorizontalOrigin$1.RIGHT&&(l.x-=e);const s=n.get(t.verticalOrigin,VerticalOrigin$1.CENTER);s===VerticalOrigin$1.TOP?l.y+=r:s===VerticalOrigin$1.CENTER&&(l.y+=.5*r);const u=i.createElement("hotSpot");u.setAttribute("x",-l.x),u.setAttribute("y",l.y),u.setAttribute("xunits","pixels"),u.setAttribute("yunits","pixels"),o.appendChild(u)}let u=n.get(t.rotation);const d=n.get(t.alignedAxis);return defined(u)&&Cartesian3.equals(Cartesian3.UNIT_Z,d)&&(u=CesiumMath.toDegrees(-u),0===u&&(u=360),o.appendChild(createBasicElementWithText(i,"heading",u))),o}function createLineString$1(e,t,i,n){const r=e.kmlDoc,o=e.ellipsoid,a=e.valueGetter;if(!defined(t))return;const s=r.createElement("LineString"),c=r.createElement("altitudeMode"),l=a.get(t.clampToGround,!1);let u;l?(s.appendChild(createBasicElementWithText(r,"tessellate",!0)),u=r.createTextNode("clampToGround")):u=r.createTextNode("absolute"),c.appendChild(u),s.appendChild(c);const d=t.positions,h=createBasicElementWithText(r,"coordinates",getCoordinates(a.get(d),o));s.appendChild(h);const p=a.get(t.zIndex);l&&defined(p)&&s.appendChild(createBasicElementWithText(r,"drawOrder",p,gxNamespace)),i.push(s);const f=r.createElement("LineStyle"),m=a.get(t.width);defined(m)&&f.appendChild(createBasicElementWithText(r,"width",m)),processMaterial(e,t.material,f),n.push(f)}function getRectangleBoundaries(e,t,i){const n=e.kmlDoc,r=e.valueGetter;let o=r.get(t.height,0);i>0&&(o=i);const a=t.coordinates,s=r.get(a),c=[],l=[Rectangle.northeast,Rectangle.southeast,Rectangle.southwest,Rectangle.northwest];for(let e=0;e<4;++e)l[e](s,scratchCartographic$8),c.push(`${CesiumMath.toDegrees(scratchCartographic$8.longitude)},${CesiumMath.toDegrees(scratchCartographic$8.latitude)},${o}`);const u=createBasicElementWithText(n,"coordinates",c.join(" ")),d=n.createElement("outerBoundaryIs"),h=n.createElement("LinearRing");return h.appendChild(u),d.appendChild(h),[d]}function getLinearRing(e,t,i,n){const r=e.kmlDoc,o=e.ellipsoid,a=[],s=t.length;for(let e=0;e<s;++e)Cartographic.fromCartesian(t[e],o,scratchCartographic$8),a.push(`${CesiumMath.toDegrees(scratchCartographic$8.longitude)},${CesiumMath.toDegrees(scratchCartographic$8.latitude)},${n?scratchCartographic$8.height:i}`);const c=createBasicElementWithText(r,"coordinates",a.join(" ")),l=r.createElement("LinearRing");return l.appendChild(c),l}function getPolygonBoundaries(e,t,i){const n=e.kmlDoc,r=e.valueGetter;let o=r.get(t.height,0);const a=r.get(t.perPositionHeight,!1);!a&&i>0&&(o=i);const s=[],c=t.hierarchy,l=r.get(c),u=Array.isArray(l)?l:l.positions,d=n.createElement("outerBoundaryIs");d.appendChild(getLinearRing(e,u,o,a)),s.push(d);const h=l.holes;if(defined(h)){const t=h.length;for(let i=0;i<t;++i){const t=n.createElement("innerBoundaryIs");t.appendChild(getLinearRing(e,h[i].positions,o,a)),s.push(t)}}return s}function createPolygon$1(e,t,i,n,r){const o=e.kmlDoc,a=e.valueGetter;if(!defined(t))return;const s=t instanceof RectangleGraphics;if(s&&"Image"===a.getMaterialType(t.material))return void createGroundOverlay(e,t,r);const c=o.createElement("Polygon"),l=a.get(t.extrudedHeight,0);l>0&&c.appendChild(createBasicElementWithText(o,"extrude",!0));const u=s?getRectangleBoundaries(e,t,l):getPolygonBoundaries(e,t,l),d=u.length;for(let e=0;e<d;++e)c.appendChild(u[e]);const h=o.createElement("altitudeMode");h.appendChild(getAltitudeMode(e,t.heightReference)),c.appendChild(h),i.push(c);const p=o.createElement("PolyStyle"),f=a.get(t.fill,!1);f&&p.appendChild(createBasicElementWithText(o,"fill",f)),processMaterial(e,t.material,p);const m=a.get(t.outline,!1);if(m){p.appendChild(createBasicElementWithText(o,"outline",m));const e=o.createElement("LineStyle"),i=a.get(t.outlineWidth,1);e.appendChild(createBasicElementWithText(o,"width",i));const r=a.getColor(t.outlineColor,Color.BLACK);e.appendChild(createBasicElementWithText(o,"color",r)),e.appendChild(createBasicElementWithText(o,"colorMode","normal")),n.push(e)}n.push(p)}function createGroundOverlay(e,t,i){const n=e.kmlDoc,r=e.valueGetter,o=e.externalFileHandler,a=n.createElement("GroundOverlay"),s=n.createElement("altitudeMode");s.appendChild(getAltitudeMode(e,t.heightReference)),a.appendChild(s);const c=r.get(t.height);defined(c)&&a.appendChild(createBasicElementWithText(n,"altitude",c));const l=r.get(t.coordinates),u=n.createElement("LatLonBox");u.appendChild(createBasicElementWithText(n,"north",CesiumMath.toDegrees(l.north))),u.appendChild(createBasicElementWithText(n,"south",CesiumMath.toDegrees(l.south))),u.appendChild(createBasicElementWithText(n,"east",CesiumMath.toDegrees(l.east))),u.appendChild(createBasicElementWithText(n,"west",CesiumMath.toDegrees(l.west))),a.appendChild(u);const d=r.get(t.material),h=o.texture(d.image),p=n.createElement("Icon");p.appendChild(createBasicElementWithText(n,"href",h)),a.appendChild(p);defined(d.color)&&a.appendChild(createBasicElementWithText(n,"color",colorToString(d.color))),i.push(a)}function createModelGeometry(e,t){const i=e.kmlDoc,n=e.valueGetter,r=e.externalFileHandler,o=i.createElement("Model"),a=n.get(t.scale);if(defined(a)){const e=i.createElement("scale");e.appendChild(createBasicElementWithText(i,"x",a)),e.appendChild(createBasicElementWithText(i,"y",a)),e.appendChild(createBasicElementWithText(i,"z",a)),o.appendChild(e)}const s=i.createElement("Link"),c=r.model(t,e.time);return s.appendChild(createBasicElementWithText(i,"href",c)),o.appendChild(s),o}function createModel(e,t,i,n,r){const o=e.kmlDoc,a=e.ellipsoid,s=e.valueGetter;if(!defined(i))return;const c=t.position;if(!c.isConstant)return void createTracks(e,t,i,n,r);const l=createModelGeometry(e,i),u=o.createElement("altitudeMode");u.appendChild(getAltitudeMode(e,i.heightReference)),l.appendChild(u),s.get(c,void 0,scratchCartesian3$3),Cartographic.fromCartesian(scratchCartesian3$3,a,scratchCartographic$8);const d=o.createElement("Location");d.appendChild(createBasicElementWithText(o,"longitude",CesiumMath.toDegrees(scratchCartographic$8.longitude))),d.appendChild(createBasicElementWithText(o,"latitude",CesiumMath.toDegrees(scratchCartographic$8.latitude))),d.appendChild(createBasicElementWithText(o,"altitude",scratchCartographic$8.height)),l.appendChild(d),n.push(l)}function processMaterial(e,t,i){const n=e.kmlDoc,r=e.valueGetter;if(!defined(t))return;const o=r.get(t);if(!defined(o))return;let a;let s,c;switch(r.getMaterialType(t)){case"Image":a=colorToString(Color.WHITE);break;case"Color":case"Grid":case"PolylineGlow":case"PolylineArrow":case"PolylineDash":a=colorToString(o.color);break;case"PolylineOutline":a=colorToString(o.color),s=colorToString(o.outlineColor),c=o.outlineWidth,i.appendChild(createBasicElementWithText(n,"outerColor",s,gxNamespace)),i.appendChild(createBasicElementWithText(n,"outerWidth",c,gxNamespace));break;case"Stripe":a=colorToString(o.oddColor)}defined(a)&&(i.appendChild(createBasicElementWithText(n,"color",a)),i.appendChild(createBasicElementWithText(n,"colorMode","normal")))}function getAltitudeMode(e,t){const i=e.kmlDoc;let n;switch(e.valueGetter.get(t,HeightReference$1.NONE)){case HeightReference$1.NONE:n=i.createTextNode("absolute");break;case HeightReference$1.CLAMP_TO_GROUND:n=i.createTextNode("clampToGround");break;case HeightReference$1.RELATIVE_TO_GROUND:n=i.createTextNode("relativeToGround")}return n}function getCoordinates(e,t){Array.isArray(e)||(e=[e]);const i=e.length,n=[];for(let r=0;r<i;++r)Cartographic.fromCartesian(e[r],t,scratchCartographic$8),n.push(`${CesiumMath.toDegrees(scratchCartographic$8.longitude)},${CesiumMath.toDegrees(scratchCartographic$8.latitude)},${scratchCartographic$8.height}`);return n.join(" ")}function createBasicElementWithText(e,t,i,n){"boolean"==typeof(i=defaultValue(i,""))&&(i=i?"1":"0");const r=defined(n)?e.createElementNS(n,t):e.createElement(t),o="string"===i&&-1!==i.indexOf("<")?e.createCDATASection(i):e.createTextNode(i);return r.appendChild(o),r}function colorToString(e){let t="";const i=e.toBytes();for(let e=3;e>=0;--e)t+=i[e]<16?`0${i[e].toString(16)}`:i[e].toString(16);return t}function identity(e){return e}function transform$1(e){if(null==e)return identity;var t,i,n=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0);var c=2,l=e.length,u=new Array(l);for(u[0]=(t+=e[0])*n+o,u[1]=(i+=e[1])*r+a;c<l;)u[c]=e[c],++c;return u}}function bbox(e){var t,i=transform$1(e.transform),n=1/0,r=n,o=-n,a=-n;function s(e){(e=i(e))[0]<n&&(n=e[0]),e[0]>o&&(o=e[0]),e[1]<r&&(r=e[1]),e[1]>a&&(a=e[1])}function c(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(c);break;case"Point":s(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(s)}}for(t in e.arcs.forEach((function(e){for(var t,s=-1,c=e.length;++s<c;)(t=i(e[s],s))[0]<n&&(n=t[0]),t[0]>o&&(o=t[0]),t[1]<r&&(r=t[1]),t[1]>a&&(a=t[1])})),e.objects)c(e.objects[t]);return[n,r,o,a]}function reverse(e,t){for(var i,n=e.length,r=n-t;r<--n;)i=e[r],e[r++]=e[n],e[n]=i}function feature(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return feature$1(e,t)}))}:feature$1(e,t)}function feature$1(e,t){var i=t.id,n=t.bbox,r=null==t.properties?{}:t.properties,o=object(e,t);return null==i&&null==n?{type:"Feature",properties:r,geometry:o}:null==n?{type:"Feature",id:i,properties:r,geometry:o}:{type:"Feature",id:i,bbox:n,properties:r,geometry:o}}function object(e,t){var i=transform$1(e.transform),n=e.arcs;function r(e,t){t.length&&t.pop();for(var r=n[e<0?~e:e],o=0,a=r.length;o<a;++o)t.push(i(r[o],o));e<0&&reverse(t,a)}function o(e){return i(e)}function a(e){for(var t=[],i=0,n=e.length;i<n;++i)r(e[i],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(s)}return function e(t){var i,n=t.type;switch(n){case"GeometryCollection":return{type:n,geometries:t.geometries.map(e)};case"Point":i=o(t.coordinates);break;case"MultiPoint":i=t.coordinates.map(o);break;case"LineString":i=a(t.arcs);break;case"MultiLineString":i=t.arcs.map(a);break;case"Polygon":i=c(t.arcs);break;case"MultiPolygon":i=t.arcs.map(c);break;default:return null}return{type:n,coordinates:i}}(t)}function stitch(e,t){var i={},n={},r={},o=[],a=-1;function s(e,t){for(var n in e){var r=e[n];delete t[r.start],delete r.start,delete r.end,r.forEach((function(e){i[e<0?~e:e]=1})),o.push(r)}}return t.forEach((function(i,n){var r,o=e.arcs[i<0?~i:i];o.length<3&&!o[1][0]&&!o[1][1]&&(r=t[++a],t[a]=i,t[n]=r)})),t.forEach((function(t){var i,o,a=function(t){var i,n=e.arcs[t<0?~t:t],r=n[0];e.transform?(i=[0,0],n.forEach((function(e){i[0]+=e[0],i[1]+=e[1]}))):i=n[n.length-1];return t<0?[i,r]:[r,i]}(t),s=a[0],c=a[1];if(i=r[s])if(delete r[i.end],i.push(t),i.end=c,o=n[c]){delete n[o.start];var l=o===i?i:i.concat(o);n[l.start=i.start]=r[l.end=o.end]=l}else n[i.start]=r[i.end]=i;else if(i=n[c])if(delete n[i.start],i.unshift(t),i.start=s,o=r[s]){delete r[o.end];var u=o===i?i:o.concat(i);n[u.start=o.start]=r[u.end=i.end]=u}else n[i.start]=r[i.end]=i;else n[(i=[t]).start=s]=r[i.end=c]=i})),s(r,n),s(n,r),t.forEach((function(e){i[e<0?~e:e]||o.push([e])})),o}function mesh(e){return object(e,meshArcs.apply(this,arguments))}function meshArcs(e,t,i){var n,r,o;if(arguments.length>1)n=extractArcs(e,t,i);else for(r=0,n=new Array(o=e.arcs.length);r<o;++r)n[r]=r;return{type:"MultiLineString",arcs:stitch(e,n)}}function extractArcs(e,t,i){var n,r=[],o=[];function a(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:n})}function s(e){e.forEach(a)}function c(e){e.forEach(s)}return function e(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":c(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(c)}(t.arcs)}}(t),o.forEach(null==i?function(e){r.push(e[0].i)}:function(e){i(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}function planarRingArea(e){for(var t,i=-1,n=e.length,r=e[n-1],o=0;++i<n;)t=r,r=e[i],o+=t[0]*r[1]-t[1]*r[0];return Math.abs(o)}function merge(e){return object(e,mergeArcs.apply(this,arguments))}function mergeArcs(e,t){var i={},n=[],r=[];function o(e){e.forEach((function(t){t.forEach((function(t){(i[t=t<0?~t:t]||(i[t]=[])).push(e)}))})),n.push(e)}function a(t){return planarRingArea(object(e,{type:"Polygon",arcs:[t]}).coordinates[0])}return t.forEach((function e(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"Polygon":o(t.arcs);break;case"MultiPolygon":t.arcs.forEach(o)}})),n.forEach((function(e){if(!e._){var t=[],n=[e];for(e._=1,r.push(t);e=n.pop();)t.push(e),e.forEach((function(e){e.forEach((function(e){i[e<0?~e:e].forEach((function(e){e._||(e._=1,n.push(e))}))}))}))}})),n.forEach((function(e){delete e._})),{type:"MultiPolygon",arcs:r.map((function(t){var n,r=[];if(t.forEach((function(e){e.forEach((function(e){e.forEach((function(e){i[e<0?~e:e].length<2&&r.push(e)}))}))})),(n=(r=stitch(e,r)).length)>1)for(var o,s,c=1,l=a(r[0]);c<n;++c)(o=a(r[c]))>l&&(s=r[0],r[0]=r[c],r[c]=s,l=o);return r})).filter((function(e){return e.length>0}))}}function bisect(e,t){for(var i=0,n=e.length;i<n;){var r=i+n>>>1;e[r]<t?i=r+1:n=r}return i}function neighbors(e){var t={},i=e.map((function(){return[]}));function n(e,i){e.forEach((function(e){e<0&&(e=~e);var n=t[e];n?n.push(i):t[e]=[i]}))}function r(e,t){e.forEach((function(e){n(e,t)}))}var o={LineString:n,MultiLineString:r,Polygon:r,MultiPolygon:function(e,t){e.forEach((function(e){r(e,t)}))}};for(var a in e.forEach((function e(t,i){"GeometryCollection"===t.type?t.geometries.forEach((function(t){e(t,i)})):t.type in o&&o[t.type](t.arcs,i)})),t)for(var s=t[a],c=s.length,l=0;l<c;++l)for(var u=l+1;u<c;++u){var d,h=s[l],p=s[u];(d=i[h])[a=bisect(d,p)]!==p&&d.splice(a,0,p),(d=i[p])[a=bisect(d,h)]!==h&&d.splice(a,0,h)}return i}function untransform(e){if(null==e)return identity;var t,i,n=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0);var c=2,l=e.length,u=new Array(l),d=Math.round((e[0]-o)/n),h=Math.round((e[1]-a)/r);for(u[0]=d-t,t=d,u[1]=h-i,i=h;c<l;)u[c]=e[c],++c;return u}}function quantize(e,t){if(e.transform)throw new Error("already quantized");if(t&&t.scale)s=e.bbox;else{if(!((i=Math.floor(t))>=2))throw new Error("n must be ≥2");var i,n=(s=e.bbox||bbox(e))[0],r=s[1],o=s[2],a=s[3];t={scale:[o-n?(o-n)/(i-1):1,a-r?(a-r)/(i-1):1],translate:[n,r]}}var s,c,l=untransform(t),u=e.objects,d={};function h(e){return l(e)}function p(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(p)};break;case"Point":t={type:"Point",coordinates:h(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(h)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(c in u)d[c]=p(u[c]);return{type:"Topology",bbox:s,transform:t,objects:d,arcs:e.arcs.map((function(e){var t,i=0,n=1,r=e.length,o=new Array(r);for(o[0]=l(e[0],0);++i<r;)((t=l(e[i],i))[0]||t[1])&&(o[n++]=t);return 1===n&&(o[n++]=[0,0]),o.length=n,o}))}}var index=Object.freeze({__proto__:null,bbox:bbox,feature:feature,mesh:mesh,meshArcs:meshArcs,merge:merge,mergeArcs:mergeArcs,neighbors:neighbors,quantize:quantize,transform:transform$1,untransform:untransform});function defaultCrsFunction(e){return Cartesian3.fromDegrees(e[0],e[1],e[2])}const crsNames={"urn:ogc:def:crs:OGC:1.3:CRS84":defaultCrsFunction,"EPSG:4326":defaultCrsFunction,"urn:ogc:def:crs:EPSG::4326":defaultCrsFunction,"EPSG:4490":defaultCrsFunction,"urn:ogc:def:crs:EPSG::4490":defaultCrsFunction},crsLinkHrefs={},crsLinkTypes={};let defaultMarkerSize=48,defaultMarkerSymbol,defaultMarkerColor=Color.ROYALBLUE,defaultStroke=Color.YELLOW,defaultStrokeWidth=2,defaultFill=Color.fromBytes(255,255,0,100),defaultClampToGround=!1;const sizes={small:24,medium:48,large:64},simpleStyleIdentifiers=["title","description","marker-size","marker-symbol","marker-color","stroke","stroke-opacity","stroke-width","fill","fill-opacity"];function defaultDescribe(e,t){let i="";for(const n in e)if(e.hasOwnProperty(n)){if(n===t||-1!==simpleStyleIdentifiers.indexOf(n))continue;const r=e[n];defined(r)&&(i+="object"==typeof r?`<tr><th>${n}</th><td>${defaultDescribe(r)}</td></tr>`:`<tr><th>${n}</th><td>${r}</td></tr>`)}return i.length>0&&(i=`<table class="cesium-infoBox-defaultTable"><tbody>${i}</tbody></table>`),i}function createDescriptionCallback(e,t,i){let n;return function(r,o){return defined(n)||(n=e(t,i)),n}}function defaultDescribeProperty(e,t){return new CallbackProperty(createDescriptionCallback(defaultDescribe,e,t),!0)}function createObject(e,t,i){let n=e.id;if(defined(n)&&"Feature"===e.type){let e=2,i=n;for(;defined(t.getById(i));)i=`${n}_${e}`,e++;n=i}else n=createGuid();const r=t.getOrCreateEntity(n),o=e.properties;if(defined(o)){let e;r.properties=o;const t=o.title;if(defined(t))r.name=t,e="title";else{let t=Number.MAX_VALUE;for(const i in o)if(o.hasOwnProperty(i)&&o[i]){const n=i.toLowerCase();if(t>1&&"title"===n){t=1,e=i;break}t>2&&"name"===n?(t=2,e=i):t>3&&/title/i.test(i)?(t=3,e=i):t>4&&/name/i.test(i)&&(t=4,e=i)}defined(e)&&(r.name=o[e])}const n=o.description;null!==n&&(r.description=defined(n)?new ConstantProperty(n):i(o,e))}return r}function coordinatesArrayToCartesianArray(e,t){const i=new Array(e.length);for(let n=0;n<e.length;n++)i[n]=t(e[n]);return i}const geoJsonObjectTypes={Feature:processFeature$1,FeatureCollection:processFeatureCollection,GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology},geometryTypes$1={GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology};function processFeature$1(e,t,i,n,r){if(null===t.geometry)return void createObject(t,e._entityCollection,r.describe);if(!defined(t.geometry))throw new RuntimeError("feature.geometry is required.");const o=t.geometry.type,a=geometryTypes$1[o];if(!defined(a))throw new RuntimeError(`Unknown geometry type: ${o}`);a(e,t,t.geometry,n,r)}function processFeatureCollection(e,t,i,n,r){const o=t.features;for(let t=0,i=o.length;t<i;t++)processFeature$1(e,o[t],void 0,n,r)}function processGeometryCollection(e,t,i,n,r){const o=i.geometries;for(let i=0,a=o.length;i<a;i++){const a=o[i],s=a.type,c=geometryTypes$1[s];if(!defined(c))throw new RuntimeError(`Unknown geometry type: ${s}`);c(e,t,a,n,r)}}function createPoint(e,t,i,n,r){let o=r.markerSymbol,a=r.markerColor,s=r.markerSize;const c=t.properties;if(defined(c)){const e=c["marker-color"];defined(e)&&(a=Color.fromCssColorString(e)),s=defaultValue(sizes[c["marker-size"]],s);const t=c["marker-symbol"];defined(t)&&(o=t)}let l;l=defined(o)?1===o.length?e._pinBuilder.fromText(o.toUpperCase(),a,s):e._pinBuilder.fromMakiIconId(o,a,s):e._pinBuilder.fromColor(a,s);const u=new BillboardGraphics;u.verticalOrigin=new ConstantProperty(VerticalOrigin$1.BOTTOM),2===n.length&&r.clampToGround&&(u.heightReference=HeightReference$1.CLAMP_TO_GROUND);const d=createObject(t,e._entityCollection,r.describe);d.billboard=u,d.position=new ConstantPositionProperty(i(n));const h=Promise.resolve(l).then((function(e){u.image=new ConstantProperty(e)})).catch((function(){u.image=new ConstantProperty(e._pinBuilder.fromColor(a,s))}));e._promises.push(h)}function processPoint$1(e,t,i,n,r){createPoint(e,t,n,i.coordinates,r)}function processMultiPoint(e,t,i,n,r){const o=i.coordinates;for(let i=0;i<o.length;i++)createPoint(e,t,n,o[i],r)}function createLineString(e,t,i,n,r){let o=r.strokeMaterialProperty,a=r.strokeWidthProperty;const s=t.properties;if(defined(s)){const e=s["stroke-width"];let t;defined(e)&&(a=new ConstantProperty(e));const i=s.stroke;defined(i)&&(t=Color.fromCssColorString(i));const n=s["stroke-opacity"];defined(n)&&1!==n&&(defined(t)||(t=o.color.getValue().clone()),t.alpha=n),defined(t)&&(o=new ColorMaterialProperty(t))}const c=createObject(t,e._entityCollection,r.describe),l=new PolylineGraphics;c.polyline=l,l.clampToGround=r.clampToGround,l.material=o,l.width=a,l.positions=new ConstantProperty(coordinatesArrayToCartesianArray(n,i)),l.arcType=ArcType$1.RHUMB}function processLineString(e,t,i,n,r){createLineString(e,t,n,i.coordinates,r)}function processMultiLineString(e,t,i,n,r){const o=i.coordinates;for(let i=0;i<o.length;i++)createLineString(e,t,n,o[i],r)}function createPolygon(e,t,i,n,r){if(0===n.length||0===n[0].length)return;let o=r.strokeMaterialProperty.color,a=r.fillMaterialProperty,s=r.strokeWidthProperty;const c=t.properties;if(defined(c)){const e=c["stroke-width"];let t;defined(e)&&(s=new ConstantProperty(e));const i=c.stroke;defined(i)&&(t=Color.fromCssColorString(i));let n,r=c["stroke-opacity"];defined(r)&&1!==r&&(defined(t)||(t=o.getValue().clone()),t.alpha=r),defined(t)&&(o=new ConstantProperty(t));const l=c.fill,u=a.color.getValue();defined(l)&&(n=Color.fromCssColorString(l),n.alpha=u.alpha),r=c["fill-opacity"],defined(r)&&r!==u.alpha&&(defined(n)||(n=u.clone()),n.alpha=r),defined(n)&&(a=new ColorMaterialProperty(n))}const l=new PolygonGraphics;l.outline=new ConstantProperty(!0),l.outlineColor=o,l.outlineWidth=s,l.material=a,l.arcType=ArcType$1.RHUMB;const u=[];for(let e=1,t=n.length;e<t;e++)u.push(new PolygonHierarchy(coordinatesArrayToCartesianArray(n[e],i)));const d=n[0];l.hierarchy=new ConstantProperty(new PolygonHierarchy(coordinatesArrayToCartesianArray(d,i),u)),d[0].length>2?l.perPositionHeight=new ConstantProperty(!0):r.clampToGround||(l.height=0);createObject(t,e._entityCollection,r.describe).polygon=l}function processPolygon$1(e,t,i,n,r){createPolygon(e,t,n,i.coordinates,r)}function processMultiPolygon(e,t,i,n,r){const o=i.coordinates;for(let i=0;i<o.length;i++)createPolygon(e,t,n,o[i],r)}function processTopology(e,t,i,n,r){for(const t in i.objects)if(i.objects.hasOwnProperty(t)){const o=index.feature(i,i.objects[t]);(0,geoJsonObjectTypes[o.type])(e,o,o,n,r)}}function GeoJsonDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._promises=[],this._pinBuilder=new PinBuilder,this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function load$2(e,t,i,n){let r;defined(n)&&(r=getFilenameFromUri(n)),defined(r)&&e._name!==r&&(e._name=r,e._changed.raiseEvent(e));const o=geoJsonObjectTypes[t.type];if(!defined(o))throw new RuntimeError(`Unsupported GeoJSON object type: ${t.type}`);const a=t.crs;let s=null!==a?defaultCrsFunction:null;if(defined(a)){if(!defined(a.properties))throw new RuntimeError("crs.properties is undefined.");const e=a.properties;if("name"===a.type){if(s=crsNames[e.name],!defined(s))throw new RuntimeError(`Unknown crs name: ${e.name}`)}else if("link"===a.type){let t=crsLinkHrefs[e.href];if(defined(t)||(t=crsLinkTypes[e.type]),!defined(t))throw new RuntimeError(`Unable to resolve crs link: ${JSON.stringify(e)}`);s=t(e)}else{if("EPSG"!==a.type)throw new RuntimeError(`Unknown crs type: ${a.type}`);if(s=crsNames[`EPSG:${e.code}`],!defined(s))throw new RuntimeError(`Unknown crs EPSG code: ${e.code}`)}}return Promise.resolve(s).then((function(n){return e._entityCollection.removeAll(),null!==n&&o(e,t,t,n,i),Promise.all(e._promises).then((function(){return e._promises.length=0,DataSource.setLoading(e,!1),e}))}))}function defaults(e,t){for(var i in t)t.hasOwnProperty(i)&&void 0===e[i]&&(e[i]=t[i]);return e}function ellipsis(e,t,i){var n;return e.length>t&&(null==i?(i="…",n=3):n=i.length,e=e.substring(0,t-n)+i),e}function indexOf(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}function remove$1(e,t){for(var i=e.length-1;i>=0;i--)!0===t(e[i])&&e.splice(i,1)}function splitAndCapture(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var i,n=[],r=0;i=t.exec(e);)n.push(e.substring(r,i.index)),n.push(i[0]),r=i.index+i[0].length;return n.push(e.substring(r)),n}function throwUnhandledCaseError(e){throw new Error("Unhandled case for value: '"+e+"'")}GeoJsonDataSource.load=function(e,t){return(new GeoJsonDataSource).load(e,t)},Object.defineProperties(GeoJsonDataSource,{markerSize:{get:function(){return defaultMarkerSize},set:function(e){defaultMarkerSize=e}},markerSymbol:{get:function(){return defaultMarkerSymbol},set:function(e){defaultMarkerSymbol=e}},markerColor:{get:function(){return defaultMarkerColor},set:function(e){defaultMarkerColor=e}},stroke:{get:function(){return defaultStroke},set:function(e){defaultStroke=e}},strokeWidth:{get:function(){return defaultStrokeWidth},set:function(e){defaultStrokeWidth=e}},fill:{get:function(){return defaultFill},set:function(e){defaultFill=e}},clampToGround:{get:function(){return defaultClampToGround},set:function(e){defaultClampToGround=e}},crsNames:{get:function(){return crsNames}},crsLinkHrefs:{get:function(){return crsLinkHrefs}},crsLinkTypes:{get:function(){return crsLinkTypes}}}),Object.defineProperties(GeoJsonDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{value:void 0,writable:!1},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),GeoJsonDataSource.prototype.load=function(e,t){DataSource.setLoading(this,!0);let i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i;let n=e,r=t.sourceUri;if("string"==typeof e||e instanceof Resource){n=(e=Resource.createIfNeeded(e)).fetchJson(),r=defaultValue(r,e.getUrlComponent());const t=this._resourceCredits,i=e.credits;if(defined(i)){const e=i.length;for(let n=0;n<e;n++)t.push(i[n])}}t={describe:defaultValue(t.describe,defaultDescribeProperty),markerSize:defaultValue(t.markerSize,defaultMarkerSize),markerSymbol:defaultValue(t.markerSymbol,defaultMarkerSymbol),markerColor:defaultValue(t.markerColor,defaultMarkerColor),strokeWidthProperty:new ConstantProperty(defaultValue(t.strokeWidth,defaultStrokeWidth)),strokeMaterialProperty:new ColorMaterialProperty(defaultValue(t.stroke,defaultStroke)),fillMaterialProperty:new ColorMaterialProperty(defaultValue(t.fill,defaultFill)),clampToGround:defaultValue(t.clampToGround,defaultClampToGround)};const o=this;return Promise.resolve(n).then((function(e){return load$2(o,e,t,r)})).catch((function(e){return DataSource.setLoading(o,!1),o._error.raiseEvent(o,e),console.log(e),Promise.reject(e)}))},GeoJsonDataSource.prototype.update=function(e){return!0};var HtmlTag=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,i=this.getClass(),n=this.whitespaceRegex,r=i?i.split(n):[],o=e.split(n);t=o.shift();)-1===indexOf(r,t)&&r.push(t);return this.getAttrs().class=r.join(" "),this},e.prototype.removeClass=function(e){for(var t,i=this.getClass(),n=this.whitespaceRegex,r=i?i.split(n):[],o=e.split(n);r.length&&(t=o.shift());){var a=indexOf(r,t);-1!==a&&r.splice(a,1)}return this.getAttrs().class=r.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i+'="'+e[i]+'"');return t.join(" ")},e}();function truncateSmart(e,t,i){var n,r;null==i?(i="…",r=3,n=8):(r=i.length,n=i.length);var o=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},a=function(e,t){var n=t/2,r=Math.ceil(n),o=-1*Math.floor(n),a="";return o<0&&(a=e.substr(o)),e.substr(0,r)+i+a};if(e.length<=t)return e;var s=t-r,c=function(e){var t={},i=e,n=i.match(/^([a-z]+):\/\//i);return n&&(t.scheme=n[1],i=i.substr(n[0].length)),(n=i.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(t.host=n[1],i=i.substr(n[0].length)),(n=i.match(/^\/(.*?)(?=(\?|#|$))/i))&&(t.path=n[1],i=i.substr(n[0].length)),(n=i.match(/^\?(.*?)(?=(#|$))/i))&&(t.query=n[1],i=i.substr(n[0].length)),(n=i.match(/^#(.*?)$/i))&&(t.fragment=n[1]),t}(e);if(c.query){var l=c.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);l&&(c.query=c.query.substr(0,l[1].length),e=o(c))}if(e.length<=t)return e;if(c.host&&(c.host=c.host.replace(/^www\./,""),e=o(c)),e.length<=t)return e;var u="";if(c.host&&(u+=c.host),u.length>=s)return c.host.length==t?(c.host.substr(0,t-r)+i).substr(0,s+n):a(u,s).substr(0,s+n);var d="";if(c.path&&(d+="/"+c.path),c.query&&(d+="?"+c.query),d){if((u+d).length>=s)return(u+d).length==t?(u+d).substr(0,t):(u+a(d,s-u.length)).substr(0,s+n);u+=d}if(c.fragment){var h="#"+c.fragment;if((u+h).length>=s)return(u+h).length==t?(u+h).substr(0,t):(u+a(h,s-u.length)).substr(0,s+n);u+=h}if(c.scheme&&c.host){var p=c.scheme+"://";if((u+p).length<s)return(p+u).substr(0,t)}if(u.length<=t)return u;var f="";return s>0&&(f=u.substr(-1*Math.floor(s/2))),(u.substr(0,Math.ceil(s/2))+i+f).substr(0,s+n)}function truncateMiddle(e,t,i){if(e.length<=t)return e;var n,r;null==i?(i="…",n=8,r=3):(n=i.length,r=i.length);var o=t-r,a="";return o>0&&(a=e.substr(-1*Math.floor(o/2))),(e.substr(0,Math.ceil(o/2))+i+a).substr(0,o+n)}function truncateEnd(e,t,i){return ellipsis(e,t,i)}var AnchorTagBuilder=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new HtmlTag({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},i=this.createCssClass(e);return i&&(t.class=i),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var i=[t],n=e.getCssClassSuffixes(),r=0,o=n.length;r<o;r++)i.push(t+"-"+n[r]);return i.join(" ")}return""},e.prototype.processAnchorText=function(e){return e=this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var i=t.length,n=t.location;return"smart"===n?truncateSmart(e,i):"middle"===n?truncateMiddle(e,i):truncateEnd(e,i)},e}(),Match=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},extendStatics(e,t)};function __extends(e,t){function i(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},__assign.apply(this,arguments)},EmailMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.email="",i.email=t.email,i}return __extends(t,e),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(Match),HashtagMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="",i.hashtag="",i.serviceName=t.serviceName,i.hashtag=t.hashtag,i}return __extends(t,e),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(Match),MentionMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="twitter",i.mention="",i.mention=t.mention,i.serviceName=t.serviceName,i}return __extends(t,e),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var t=e.prototype.getCssClassSuffixes.call(this),i=this.getServiceName();return i&&t.push(i),t},t}(Match),PhoneMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.number="",i.plusSign=!1,i.number=t.number,i.plusSign=t.plusSign,i}return __extends(t,e),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(Match),UrlMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.url="",i.urlMatchType="scheme",i.protocolUrlMatch=!1,i.protocolRelativeMatch=!1,i.stripPrefix={scheme:!0,www:!0},i.stripTrailingSlash=!0,i.decodePercentEncoding=!0,i.schemePrefixRegex=/^(https?:\/\/)?/i,i.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,i.protocolRelativeRegex=/^\/\//,i.protocolPrepended=!1,i.urlMatchType=t.urlMatchType,i.url=t.url,i.protocolUrlMatch=t.protocolUrlMatch,i.protocolRelativeMatch=t.protocolRelativeMatch,i.stripPrefix=t.stripPrefix,i.stripTrailingSlash=t.stripTrailingSlash,i.decodePercentEncoding=t.decodePercentEncoding,i}return __extends(t,e),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var t=e.replace(/%22/gi,""").replace(/%26/gi,"&").replace(/%27/gi,"'").replace(/%3C/gi,"<").replace(/%3E/gi,">");try{return decodeURIComponent(t)}catch(e){return t}},t}(Match),Matcher=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},letterRe=/[A-Za-z]/,digitRe=/[\d]/,nonDigitRe=/[\D]/,whitespaceRe=/\s/,quoteRe=/['"]/,controlCharsRe=/[\x00-\x1F\x7F]/,alphaCharsStr=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,emojiStr=/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source,marksStr=/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,alphaCharsAndMarksStr=alphaCharsStr+emojiStr+marksStr,decimalNumbersStr=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,alphaNumericCharsStr=alphaCharsAndMarksStr+decimalNumbersStr,alphaNumericAndMarksCharsStr=alphaCharsAndMarksStr+decimalNumbersStr,ipStr="(?:["+decimalNumbersStr+"]{1,3}\\.){3}["+decimalNumbersStr+"]{1,3}",domainLabelStr="["+alphaNumericAndMarksCharsStr+"](?:["+alphaNumericAndMarksCharsStr+"\\-]{0,61}["+alphaNumericAndMarksCharsStr+"])?",getDomainLabelStr=function(e){return"(?=("+domainLabelStr+"))\\"+e},getDomainNameStr=function(e){return"(?:"+getDomainLabelStr(e)+"(?:\\."+getDomainLabelStr(e+1)+"){0,126}|"+ipStr+")"},domainNameCharRegex=new RegExp("["+alphaNumericAndMarksCharsStr+"]"),tldRegex=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,localPartCharRegex=new RegExp("["+alphaNumericAndMarksCharsStr+"!#$%&'*+/=?^_`{|}~-]"),strictTldRegex=new RegExp("^"+tldRegex.source+"$"),EmailMatcher=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=localPartCharRegex,t.strictTldRegex=strictTldRegex,t}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,i=this.localPartCharRegex,n=this.strictTldRegex,r=[],o=e.length,a=new CurrentEmailMatch,s={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},c=0,l=0,u=a;c<o;){var d=e.charAt(c);switch(l){case 0:h(d);break;case 1:p(e.charAt(c-1),d);break;case 2:f(d);break;case 3:m(d);break;case 4:g(d);break;case 5:_(d);break;case 6:y(d);break;case 7:C(d);break;default:throwUnhandledCaseError(l)}c++}return v(),r;function h(e){"m"===e?T(1):i.test(e)&&T()}function p(e,t){":"===e?i.test(t)?(l=2,u=new CurrentEmailMatch(__assign(__assign({},u),{hasMailtoPrefix:!0}))):S():s[e]===t||(i.test(t)?l=2:"."===t?l=3:"@"===t?l=4:S())}function f(e){"."===e?l=3:"@"===e?l=4:i.test(e)||S()}function m(e){"."===e||"@"===e?S():i.test(e)?l=2:S()}function g(e){domainNameCharRegex.test(e)?l=5:S()}function _(e){"."===e?l=7:"-"===e?l=6:domainNameCharRegex.test(e)||v()}function y(e){"-"===e||"."===e?v():domainNameCharRegex.test(e)?l=5:v()}function C(e){"."===e||"-"===e?v():domainNameCharRegex.test(e)?(l=5,u=new CurrentEmailMatch(__assign(__assign({},u),{hasDomainDot:!0}))):v()}function T(e){void 0===e&&(e=2),l=e,u=new CurrentEmailMatch({idx:c})}function S(){l=0,u=a}function v(){if(u.hasDomainDot){var i=e.slice(u.idx,c);/[-.]$/.test(i)&&(i=i.slice(0,-1));var o=u.hasMailtoPrefix?i.slice("mailto:".length):i;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return n.test(t)})(o)&&r.push(new EmailMatch({tagBuilder:t,matchedText:i,offset:u.idx,email:o}))}S()}},t}(Matcher),CurrentEmailMatch=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},UrlMatchValidator=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),i=t&&t[0].toLowerCase();return"javascript:"!==i&&"vbscript:"!==i},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t)&&(!this.hasFullProtocolRegex.test(t)&&!this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+alphaCharsStr+"]"),e.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,e}(),matcherRegex$1=(urlSuffixRegex=new RegExp("[/?#](?:["+alphaNumericAndMarksCharsStr+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+alphaNumericAndMarksCharsStr+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,getDomainNameStr(2),")","|","(","(//)?",/(?:www\.)/.source,getDomainNameStr(6),")","|","(","(//)?",getDomainNameStr(10)+"\\.",tldRegex.source,"(?![-"+alphaNumericCharsStr+"])",")",")","(?::[0-9]+)?","(?:"+urlSuffixRegex.source+")?"].join(""),"gi")),urlSuffixRegex,wordCharRegExp=new RegExp("["+alphaNumericAndMarksCharsStr+"]"),UrlMatcher=function(e){function t(t){var i=e.call(this,t)||this;return i.stripPrefix={scheme:!0,www:!0},i.stripTrailingSlash=!0,i.decodePercentEncoding=!0,i.matcherRegex=matcherRegex$1,i.wordCharRegExp=wordCharRegExp,i.stripPrefix=t.stripPrefix,i.stripTrailingSlash=t.stripTrailingSlash,i.decodePercentEncoding=t.decodePercentEncoding,i}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,i=this.matcherRegex,n=this.stripPrefix,r=this.stripTrailingSlash,o=this.decodePercentEncoding,a=this.tagBuilder,s=[],c=function(){var i=t[0],c=t[1],u=t[4],d=t[5],h=t[9],p=t.index,f=d||h,m=e.charAt(p-1);if(!UrlMatchValidator.isValid(i,c))return"continue";if(p>0&&"@"===m)return"continue";if(p>0&&f&&l.wordCharRegExp.test(m))return"continue";if(/\?$/.test(i)&&(i=i.substr(0,i.length-1)),l.matchHasUnbalancedClosingParen(i))i=i.substr(0,i.length-1);else{var g=l.matchHasInvalidCharAfterTld(i,c);g>-1&&(i=i.substr(0,g))}var _=["http://","https://"].find((function(e){return!!c&&-1!==c.indexOf(e)}));if(_){var y=i.indexOf(_);i=i.substr(y),c=c.substr(y),p+=y}var C=c?"scheme":u?"www":"tld",T=!!c;s.push(new UrlMatch({tagBuilder:a,matchedText:i,offset:p,urlMatchType:C,url:i,protocolUrlMatch:T,protocolRelativeMatch:!!f,stripPrefix:n,stripTrailingSlash:r,decodePercentEncoding:o}))},l=this;null!==(t=i.exec(e));)c();return s},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,i=e.charAt(e.length-1);if(")"===i)t="(";else if("]"===i)t="[";else{if("}"!==i)return!1;t="{"}for(var n=0,r=0,o=e.length-1;r<o;r++){var a=e.charAt(r);a===t?n++:a===i&&(n=Math.max(n-1,0))}return 0===n},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var i=0;t&&(i=e.indexOf(":"),e=e.slice(i));var n=new RegExp("^((.?//)?[-."+alphaNumericAndMarksCharsStr+"]*[-"+alphaNumericAndMarksCharsStr+"]\\.[-"+alphaNumericAndMarksCharsStr+"]+)").exec(e);return null===n?-1:(i+=n[1].length,e=e.slice(n[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?i:-1)},t}(Matcher),matcherRegex=new RegExp("#[_"+alphaNumericAndMarksCharsStr+"]{1,139}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),nonWordCharRegex$1=new RegExp("[^"+alphaNumericAndMarksCharsStr+"]"),HashtagMatcher=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="twitter",i.matcherRegex=matcherRegex,i.nonWordCharRegex=nonWordCharRegex$1,i.serviceName=t.serviceName,i}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,i=this.matcherRegex,n=this.nonWordCharRegex,r=this.serviceName,o=this.tagBuilder,a=[];null!==(t=i.exec(e));){var s=t.index,c=e.charAt(s-1);if(0===s||n.test(c)){var l=t[0],u=t[0].slice(1);a.push(new HashtagMatch({tagBuilder:o,matchedText:l,offset:s,serviceName:r,hashtag:u}))}}return a},t}(Matcher),mostPhoneNumbers=/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/,japanesePhoneRe=/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/,phoneMatcherRegex=new RegExp(mostPhoneNumbers.source+"|"+japanesePhoneRe.source,"g"),PhoneMatcher=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=phoneMatcherRegex,t}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,i=this.matcherRegex,n=this.tagBuilder,r=[];null!==(t=i.exec(e));){var o=t[0],a=o.replace(/[^0-9,;#]/g,""),s=!(!t[1]&&!t[2]),c=0==t.index?"":e.substr(t.index-1,1),l=e.substr(t.index+o.length,1),u=!c.match(/\d/)&&!l.match(/\d/);this.testMatch(t[3])&&this.testMatch(o)&&u&&r.push(new PhoneMatch({tagBuilder:n,matchedText:o,offset:t.index,number:a,plusSign:s}))}return r},t.prototype.testMatch=function(e){return nonDigitRe.test(e)},t}(Matcher),twitterRegex=new RegExp("@[_"+alphaNumericAndMarksCharsStr+"]{1,50}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),instagramRegex=new RegExp("@[_."+alphaNumericAndMarksCharsStr+"]{1,30}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),soundcloudRegex=new RegExp("@[-_."+alphaNumericAndMarksCharsStr+"]{1,50}(?![-_"+alphaNumericAndMarksCharsStr+"])","g"),nonWordCharRegex=new RegExp("[^"+alphaNumericAndMarksCharsStr+"]"),MentionMatcher=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="twitter",i.matcherRegexes={twitter:twitterRegex,instagram:instagramRegex,soundcloud:soundcloudRegex},i.nonWordCharRegex=nonWordCharRegex,i.serviceName=t.serviceName,i}return __extends(t,e),t.prototype.parseMatches=function(e){var t,i=this.serviceName,n=this.matcherRegexes[this.serviceName],r=this.nonWordCharRegex,o=this.tagBuilder,a=[];if(!n)return a;for(;null!==(t=n.exec(e));){var s=t.index,c=e.charAt(s-1);if(0===s||r.test(c)){var l=t[0].replace(/\.+$/g,""),u=l.slice(1);a.push(new MentionMatch({tagBuilder:o,matchedText:l,offset:s,serviceName:i,mention:u}))}}return a},t}(Matcher);function parseHtml(e,t){for(var i=t.onOpenTag,n=t.onCloseTag,r=t.onText,o=t.onComment,a=t.onDoctype,s=new CurrentTag,c=0,l=e.length,u=0,d=0,h=s;c<l;){var p=e.charAt(c);switch(u){case 0:f(p);break;case 1:m(p);break;case 2:_(p);break;case 3:g(p);break;case 4:y(p);break;case 5:C(p);break;case 6:T(p);break;case 7:S(p);break;case 8:v(p);break;case 9:A(p);break;case 10:E(p);break;case 11:b(p);break;case 12:x(p);break;case 13:P();break;case 14:D(p);break;case 15:w(p);break;case 16:M(p);break;case 17:I(p);break;case 18:R(p);break;case 19:O(p);break;case 20:B(p);break;default:throwUnhandledCaseError(u)}c++}function f(e){"<"===e&&F()}function m(e){"!"===e?u=13:"/"===e?(u=2,h=new CurrentTag(__assign(__assign({},h),{isClosing:!0}))):"<"===e?F():letterRe.test(e)?(u=3,h=new CurrentTag(__assign(__assign({},h),{isOpening:!0}))):(u=0,h=s)}function g(e){whitespaceRe.test(e)?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),u=4):"<"===e?F():"/"===e?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),u=12):">"===e?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),N()):letterRe.test(e)||digitRe.test(e)||":"===e||L()}function _(e){">"===e?L():letterRe.test(e)?u=3:L()}function y(e){whitespaceRe.test(e)||("/"===e?u=12:">"===e?N():"<"===e?F():"="===e||quoteRe.test(e)||controlCharsRe.test(e)?L():u=5)}function C(e){whitespaceRe.test(e)?u=6:"/"===e?u=12:"="===e?u=7:">"===e?N():"<"===e?F():quoteRe.test(e)&&L()}function T(e){whitespaceRe.test(e)||("/"===e?u=12:"="===e?u=7:">"===e?N():"<"===e?F():quoteRe.test(e)?L():u=5)}function S(e){whitespaceRe.test(e)||('"'===e?u=8:"'"===e?u=9:/[>=`]/.test(e)?L():"<"===e?F():u=10)}function v(e){'"'===e&&(u=11)}function A(e){"'"===e&&(u=11)}function E(e){whitespaceRe.test(e)?u=4:">"===e?N():"<"===e&&F()}function b(e){whitespaceRe.test(e)?u=4:"/"===e?u=12:">"===e?N():"<"===e?F():(u=4,c--)}function x(e){">"===e?(h=new CurrentTag(__assign(__assign({},h),{isClosing:!0})),N()):u=4}function P(t){"--"===e.substr(c,2)?(c+=2,h=new CurrentTag(__assign(__assign({},h),{type:"comment"})),u=14):"DOCTYPE"===e.substr(c,7).toUpperCase()?(c+=7,h=new CurrentTag(__assign(__assign({},h),{type:"doctype"})),u=20):L()}function D(e){"-"===e?u=15:">"===e?L():u=16}function w(e){"-"===e?u=18:">"===e?L():u=16}function M(e){"-"===e&&(u=17)}function I(e){u="-"===e?18:16}function R(e){">"===e?N():"!"===e?u=19:"-"===e||(u=16)}function O(e){"-"===e?u=17:">"===e?N():u=16}function B(e){">"===e?N():"<"===e&&F()}function L(){u=0,h=s}function F(){u=1,h=new CurrentTag({idx:c})}function N(){var t=e.slice(d,h.idx);t&&r(t,d),"comment"===h.type?o(h.idx):"doctype"===h.type?a(h.idx):(h.isOpening&&i(h.name,h.idx),h.isClosing&&n(h.name,h.idx)),L(),d=c+1}function V(){var t=h.idx+(h.isClosing?2:1);return e.slice(t,c).toLowerCase()}d<c&&function(){var t=e.slice(d,c);r(t,d),d=c+1}()}var CurrentTag=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},Autolinker=function(){function e(t){void 0===t&&(t={}),this.version=e.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var i=this.mention;if(!1!==i&&"twitter"!==i&&"instagram"!==i&&"soundcloud"!==i)throw new Error("invalid `mention` cfg - see docs");var n=this.hashtag;if(!1!==n&&"twitter"!==n&&"facebook"!==n&&"instagram"!==n)throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return e.link=function(t,i){return new e(i).link(t)},e.parse=function(t,i){return new e(i).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:defaults(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,i=["a","style","script"],n=0,r=[];return parseHtml(e,{onOpenTag:function(e){i.indexOf(e)>=0&&n++},onText:function(e,i){if(0===n){var o=splitAndCapture(e,/( | |<|<|>|>|"|"|')/gi),a=i;o.forEach((function(e,i){if(i%2==0){var n=t.parseText(e,a);r.push.apply(r,n)}a+=e.length}))}},onCloseTag:function(e){i.indexOf(e)>=0&&(n=Math.max(n-1,0))},onComment:function(e){},onDoctype:function(e){}}),r=this.compactMatches(r),r=this.removeUnwantedMatches(r)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;t++){var i=e[t],n=i.getOffset(),r=i.getMatchedText().length,o=n+r;if(t+1<e.length){if(e[t+1].getOffset()===n){var a=e[t+1].getMatchedText().length>r?t:t+1;e.splice(a,1);continue}e[t+1].getOffset()<o&&e.splice(t+1,1)}}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||remove$1(e,(function(e){return"hashtag"===e.getType()})),this.email||remove$1(e,(function(e){return"email"===e.getType()})),this.phone||remove$1(e,(function(e){return"phone"===e.getType()})),this.mention||remove$1(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||remove$1(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||remove$1(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||remove$1(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var i=this.getMatchers(),n=[],r=0,o=i.length;r<o;r++){for(var a=i[r].parseMatches(e),s=0,c=a.length;s<c;s++)a[s].setOffset(t+a[s].getOffset());n.push.apply(n,a)}return n},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"<").replace(/>/g,">"));for(var t=this.parse(e),i=[],n=0,r=0,o=t.length;r<o;r++){var a=t[r];i.push(e.substring(n,a.getOffset())),i.push(this.createMatchReturnVal(a)),n=a.getOffset()+a.getMatchedText().length}return i.push(e.substring(n)),i.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof HtmlTag?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new HashtagMatcher({tagBuilder:e,serviceName:this.hashtag}),new EmailMatcher({tagBuilder:e}),new PhoneMatcher({tagBuilder:e}),new MentionMatcher({tagBuilder:e,serviceName:this.mention}),new UrlMatcher({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.14.3",e.AnchorTagBuilder=AnchorTagBuilder,e.HtmlTag=HtmlTag,e.matcher={Email:EmailMatcher,Hashtag:HashtagMatcher,Matcher:Matcher,Mention:MentionMatcher,Phone:PhoneMatcher,Url:UrlMatcher},e.match={Email:EmailMatch,Hashtag:HashtagMatch,Match:Match,Mention:MentionMatch,Phone:PhoneMatch,Url:UrlMatch},e}();let parser$1;"undefined"!=typeof DOMParser&&(parser$1=new DOMParser);const autolinker$1=new Autolinker({stripPrefix:!1,email:!1,replaceFn:function(e,t){if(!t.protocolUrlMatch)return!1}}),BILLBOARD_SIZE$1=32,BILLBOARD_NEAR_DISTANCE$1=2414016,BILLBOARD_NEAR_RATIO$1=1,BILLBOARD_FAR_DISTANCE$1=16093e3,BILLBOARD_FAR_RATIO$1=.1,gpxNamespaces=[null,void 0,"http://www.topografix.com/GPX/1/1"],namespaces$1={gpx:gpxNamespaces};function readBlobAsText$1(e){const t=defer(),i=new FileReader;return i.addEventListener("load",(function(){t.resolve(i.result)})),i.addEventListener("error",(function(){t.reject(i.error)})),i.readAsText(e),t.promise}function getOrCreateEntity(e,t){let i=queryStringAttribute$1(e,"id");i=defined(i)?i:createGuid();return t.getOrCreateEntity(i)}function readCoordinateFromNode(e){const t=queryNumericAttribute$1(e,"lon"),i=queryNumericAttribute$1(e,"lat"),n=queryNumericValue$1(e,"ele",namespaces$1.gpx);return Cartesian3.fromDegrees(t,i,n)}function queryNumericAttribute$1(e,t){if(!defined(e))return;const i=e.getAttribute(t);if(null!==i){const e=parseFloat(i);return isNaN(e)?void 0:e}}function queryStringAttribute$1(e,t){if(!defined(e))return;const i=e.getAttribute(t);return null!==i?i:void 0}function queryFirstNode$1(e,t,i){if(!defined(e))return;const n=e.childNodes,r=n.length;for(let e=0;e<r;e++){const r=n[e];if(r.localName===t&&-1!==i.indexOf(r.namespaceURI))return r}}function queryNodes$1(e,t,i){if(!defined(e))return;const n=[],r=e.getElementsByTagName(t),o=r.length;for(let e=0;e<o;e++){const o=r[e];o.localName===t&&-1!==i.indexOf(o.namespaceURI)&&n.push(o)}return n}function queryNumericValue$1(e,t,i){const n=queryFirstNode$1(e,t,i);if(defined(n)){const e=parseFloat(n.textContent);return isNaN(e)?void 0:e}}function queryStringValue$1(e,t,i){const n=queryFirstNode$1(e,t,i);if(defined(n))return n.textContent.trim()}function createDefaultBillboard$1(e){const t=new BillboardGraphics;return t.width=BILLBOARD_SIZE$1,t.height=BILLBOARD_SIZE$1,t.scaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE$1,BILLBOARD_NEAR_RATIO$1,BILLBOARD_FAR_DISTANCE$1,BILLBOARD_FAR_RATIO$1),t.pixelOffsetScaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE$1,BILLBOARD_NEAR_RATIO$1,BILLBOARD_FAR_DISTANCE$1,BILLBOARD_FAR_RATIO$1),t.verticalOrigin=new ConstantProperty(VerticalOrigin$1.BOTTOM),t.image=e,t}function createDefaultLabel$1(){const e=new LabelGraphics;return e.translucencyByDistance=new NearFarScalar(3e6,1,5e6,0),e.pixelOffset=new Cartesian2(17,0),e.horizontalOrigin=HorizontalOrigin$1.LEFT,e.font="16px sans-serif",e.style=LabelStyle$1.FILL_AND_OUTLINE,e}function createDefaultPolyline(e){const t=new PolylineGraphics;return t.width=4,t.material=new PolylineOutlineMaterialProperty,t.material.color=defined(e)?e:Color.RED,t.material.outlineWidth=2,t.material.outlineColor=Color.BLACK,t}const descriptiveInfoTypes={time:{text:"Time",tag:"time"},comment:{text:"Comment",tag:"cmt"},description:{text:"Description",tag:"desc"},source:{text:"Source",tag:"src"},number:{text:"GPS track/route number",tag:"number"},type:{text:"Type",tag:"type"}};let scratchDiv$1;function processDescription$1(e,t){let i,n="";const r=Object.keys(descriptiveInfoTypes),o=r.length;for(i=0;i<o;i++){const t=r[i],o=descriptiveInfoTypes[t];o.value=defaultValue(queryStringValue$1(e,o.tag,namespaces$1.gpx),""),defined(o.value)&&""!==o.value&&(n=`${n}<p>${o.text}: ${o.value}</p>`)}if(!defined(n)||""===n)return;n=autolinker$1.link(n),scratchDiv$1.innerHTML=n;const a=scratchDiv$1.querySelectorAll("a");for(i=0;i<a.length;i++)a[i].setAttribute("target","_blank");const s=Color.WHITE,c=Color.BLACK;let l='<div class="cesium-infoBox-description-lighter" style="';return l+="overflow:auto;",l+="word-wrap:break-word;",l+=`background-color:${s.toCssColorString()};`,l+=`color:${c.toCssColorString()};`,l+='">',l+=`${scratchDiv$1.innerHTML}</div>`,scratchDiv$1.innerHTML="",l}function processWpt(e,t,i,n){const r=readCoordinateFromNode(t),o=getOrCreateEntity(t,i);o.position=r;const a=defined(n.waypointImage)?n.waypointImage:e._pinBuilder.fromMakiIconId("marker",Color.RED,BILLBOARD_SIZE$1);o.billboard=createDefaultBillboard$1(a);const s=queryStringValue$1(t,"name",namespaces$1.gpx);o.name=s,o.label=createDefaultLabel$1(),o.label.text=s,o.description=processDescription$1(t),n.clampToGround&&(o.billboard.heightReference=HeightReference$1.CLAMP_TO_GROUND,o.label.heightReference=HeightReference$1.CLAMP_TO_GROUND)}function processRte(e,t,i,n){const r=getOrCreateEntity(t,i);r.description=processDescription$1(t);const o=queryNodes$1(t,"rtept",namespaces$1.gpx),a=new Array(o.length);for(let t=0;t<o.length;t++)processWpt(e,o[t],i,n),a[t]=readCoordinateFromNode(o[t]);r.polyline=createDefaultPolyline(n.routeColor),n.clampToGround&&(r.polyline.clampToGround=!0),r.polyline.positions=a}function processTrk(e,t,i,n){const r=getOrCreateEntity(t,i);r.description=processDescription$1(t);const o=queryNodes$1(t,"trkseg",namespaces$1.gpx);let a,s=[],c=[],l=!0;const u=new SampledPositionProperty;for(let e=0;e<o.length;e++)a=processTrkSeg(o[e]),s=s.concat(a.positions),a.times.length>0?(c=c.concat(a.times),u.addSamples(c,s),l=l&&!0):l=!1;if(l){const t=defined(n.waypointImage)?n.waypointImage:e._pinBuilder.fromMakiIconId("marker",Color.RED,BILLBOARD_SIZE$1);r.billboard=createDefaultBillboard$1(t),r.position=u,n.clampToGround&&(r.billboard.heightReference=HeightReference$1.CLAMP_TO_GROUND),r.availability=new TimeIntervalCollection,r.availability.addInterval(new TimeInterval({start:c[0],stop:c[c.length-1]}))}r.polyline=createDefaultPolyline(n.trackColor),r.polyline.positions=s,n.clampToGround&&(r.polyline.clampToGround=!0)}function processTrkSeg(e){const t={positions:[],times:[]},i=queryNodes$1(e,"trkpt",namespaces$1.gpx);let n;for(let e=0;e<i.length;e++){const r=readCoordinateFromNode(i[e]);t.positions.push(r),n=queryStringValue$1(i[e],"time",namespaces$1.gpx),defined(n)&&t.times.push(JulianDate.fromIso8601(n))}return t}function processMetadata(e){const t=queryFirstNode$1(e,"metadata",namespaces$1.gpx);if(defined(t)){const e={name:queryStringValue$1(t,"name",namespaces$1.gpx),desc:queryStringValue$1(t,"desc",namespaces$1.gpx),author:getPerson(t),copyright:getCopyright(t),link:getLink(t),time:queryStringValue$1(t,"time",namespaces$1.gpx),keywords:queryStringValue$1(t,"keywords",namespaces$1.gpx),bounds:getBounds(t)};if(defined(e.name)||defined(e.desc)||defined(e.author)||defined(e.copyright)||defined(e.link)||defined(e.time)||defined(e.keywords)||defined(e.bounds))return e}}function getPerson(e){const t=queryFirstNode$1(e,"author",namespaces$1.gpx);if(defined(t)){const e={name:queryStringValue$1(t,"name",namespaces$1.gpx),email:getEmail(t),link:getLink(t)};if(defined(e.name)||defined(e.email)||defined(e.link))return e}}function getEmail(e){const t=queryFirstNode$1(e,"email",namespaces$1.gpx);if(defined(t)){return`${queryStringValue$1(t,"id",namespaces$1.gpx)}@${queryStringValue$1(t,"domain",namespaces$1.gpx)}`}}function getLink(e){const t=queryFirstNode$1(e,"link",namespaces$1.gpx);if(defined(t)){const e={href:queryStringAttribute$1(t,"href"),text:queryStringValue$1(t,"text",namespaces$1.gpx),mimeType:queryStringValue$1(t,"type",namespaces$1.gpx)};if(defined(e.href)||defined(e.text)||defined(e.mimeType))return e}}function getCopyright(e){const t=queryFirstNode$1(e,"copyright",namespaces$1.gpx);if(defined(t)){const e={author:queryStringAttribute$1(t,"author"),year:queryStringValue$1(t,"year",namespaces$1.gpx),license:queryStringValue$1(t,"license",namespaces$1.gpx)};if(defined(e.author)||defined(e.year)||defined(e.license))return e}}function getBounds(e){const t=queryFirstNode$1(e,"bounds",namespaces$1.gpx);if(defined(t)){const e={minLat:queryNumericValue$1(t,"minlat",namespaces$1.gpx),maxLat:queryNumericValue$1(t,"maxlat",namespaces$1.gpx),minLon:queryNumericValue$1(t,"minlon",namespaces$1.gpx),maxLon:queryNumericValue$1(t,"maxlon",namespaces$1.gpx)};if(defined(e.minLat)||defined(e.maxLat)||defined(e.minLon)||defined(e.maxLon))return e}}"undefined"!=typeof document&&(scratchDiv$1=document.createElement("div"));const complexTypes={wpt:processWpt,rte:processRte,trk:processTrk};function processGpx(e,t,i,n){const r=Object.keys(complexTypes),o=r.length;for(let a=0;a<o;a++){const o=r[a],s=complexTypes[o],c=t.childNodes,l=c.length;for(let t=0;t<l;t++){const r=c[t];r.localName===o&&-1!==namespaces$1.gpx.indexOf(r.namespaceURI)&&s(e,r,i,n)}}}function loadGpx(e,t,i){const n=e._entityCollection;n.removeAll();const r=t.documentElement,o=queryStringAttribute$1(r,"version"),a=queryStringAttribute$1(r,"creator");let s;const c=processMetadata(r);let l;defined(c)&&(s=c.name),"gpx"===r.localName?processGpx(e,r,n,i):console.log(`GPX - Unsupported node: ${r.localName}`);const u=n.computeAvailability();let d=u.start,h=u.stop;const p=JulianDate.equals(d,Iso8601.MINIMUM_VALUE),f=JulianDate.equals(h,Iso8601.MAXIMUM_VALUE);if(!p||!f){let e;p&&(e=new Date,e.setHours(0,0,0,0),d=JulianDate.fromDate(e)),f&&(e=new Date,e.setHours(24,0,0,0),h=JulianDate.fromDate(e)),l=new DataSourceClock,l.startTime=d,l.stopTime=h,l.currentTime=JulianDate.clone(d),l.clockRange=ClockRange$1.LOOP_STOP,l.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,l.multiplier=Math.round(Math.min(Math.max(JulianDate.secondsDifference(h,d)/60,1),31556900))}let m=!1;return e._name!==s&&(e._name=s,m=!0),e._creator!==a&&(e._creator=a,m=!0),metadataChanged(e._metadata,c)&&(e._metadata=c,m=!0),e._version!==o&&(e._version=o,m=!0),l!==e._clock&&(m=!0,e._clock=l),m&&e._changed.raiseEvent(e),DataSource.setLoading(e,!1),e}function metadataChanged(e,t){return!(!defined(e)&&!defined(t))&&(!defined(e)||!defined(t)||(e.name!==t.name||e.dec!==t.desc||e.src!==t.src||e.author!==t.author||e.copyright!==t.copyright||e.link!==t.link||e.time!==t.time||e.bounds!==t.bounds))}function load$1(e,t,i,n){n=defaultValue(n,defaultValue.EMPTY_OBJECT);let r=i;if("string"==typeof i||i instanceof Resource){r=(i=Resource.createIfNeeded(i)).fetchBlob();const t=e._resourceCredits,n=i.credits;if(defined(n)){const e=n.length;for(let i=0;i<e;i++)t.push(n[i])}}return Promise.resolve(r).then((function(t){return t instanceof Blob?readBlobAsText$1(t).then((function(t){let i,r;try{i=parser$1.parseFromString(t,"application/xml")}catch(e){r=e.toString()}if(defined(r)||i.body||"parsererror"===i.documentElement.tagName){let e=defined(r)?r:i.documentElement.firstChild.nodeValue;throw e||(e=i.body.innerText),new RuntimeError(e)}return loadGpx(e,i,n)})):loadGpx(e,t,n)})).catch((function(t){return e._error.raiseEvent(e,t),console.log(t),Promise.reject(t)}))}function GpxDataSource(){this._changed=new Event,this._error=new Event,this._loading=new Event,this._clock=void 0,this._entityCollection=new EntityCollection,this._entityCluster=new EntityCluster,this._name=void 0,this._version=void 0,this._creator=void 0,this._metadata=void 0,this._isLoading=!1,this._pinBuilder=new PinBuilder}function KmlCamera(e,t){this.position=e,this.headingPitchRoll=t}function getElement(e){if("string"==typeof e){e=document.getElementById(e)}return e}function KmlLookAt(e,t){this.position=e,this.headingPitchRange=t}function KmlTour(e,t){this.id=t,this.name=e,this.playlistIndex=0,this.playlist=[],this.tourStart=new Event,this.tourEnd=new Event,this.entryStart=new Event,this.entryEnd=new Event,this._activeEntries=[]}function cancelAllEntries(e){for(let t=e.pop();void 0!==t;t=e.pop())t.stop()}function playEntry(e,t,i){const n=this.playlist[this.playlistIndex];if(n){const r=playNext.bind(this,e,t,i);if(this._activeEntries.push(n),this.entryStart.raiseEvent(n),n.blocking)n.play(r,e.scene.camera,t);else{const o=this;n.play((function(){o.entryEnd.raiseEvent(n);const e=o._activeEntries.indexOf(n);e>=0&&o._activeEntries.splice(e,1)})),r(e,t,i)}}else defined(i)&&i(!1)}function playNext(e,t,i,n){const r=this.playlist[this.playlistIndex];if(this.entryEnd.raiseEvent(r,n),n)i(n);else{const n=this._activeEntries.indexOf(r);n>=0&&this._activeEntries.splice(n,1),this.playlistIndex++,playEntry.call(this,e,t,i)}}function KmlTourFlyTo(e,t,i){this.type="KmlTourFlyTo",this.blocking=!0,this.activeCamera=null,this.activeCallback=null,this.duration=e,this.view=i,this.flyToMode=t}function KmlTourWait(e){this.type="KmlTourWait",this.blocking=!0,this.duration=e,this.timeout=null}GpxDataSource.load=function(e,t){return(new GpxDataSource).load(e,t)},Object.defineProperties(GpxDataSource.prototype,{name:{get:function(){return this._name}},version:{get:function(){return this._version}},creator:{get:function(){return this._creator}},metadata:{get:function(){return this._metadata}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}}}),GpxDataSource.prototype.update=function(e){return!0},GpxDataSource.prototype.load=function(e,t){if(!defined(e))throw new DeveloperError("data is required.");t=defaultValue(t,defaultValue.EMPTY_OBJECT),DataSource.setLoading(this,!0);const i=this._name,n=this;return load$1(this,this._entityCollection,e,t).then((function(){let e;const t=n._entityCollection.computeAvailability();let r=t.start,o=t.stop;const a=JulianDate.equals(r,Iso8601.MINIMUM_VALUE),s=JulianDate.equals(o,Iso8601.MAXIMUM_VALUE);if(!a||!s){let t;a&&(t=new Date,t.setHours(0,0,0,0),r=JulianDate.fromDate(t)),s&&(t=new Date,t.setHours(24,0,0,0),o=JulianDate.fromDate(t)),e=new DataSourceClock,e.startTime=r,e.stopTime=o,e.currentTime=JulianDate.clone(r),e.clockRange=ClockRange$1.LOOP_STOP,e.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e.multiplier=Math.round(Math.min(Math.max(JulianDate.secondsDifference(o,r)/60,1),31556900))}let c=!1;return e!==n._clock&&(n._clock=e,c=!0),i!==n._name&&(c=!0),c&&n._changed.raiseEvent(n),DataSource.setLoading(n,!1),n})).catch((function(e){return DataSource.setLoading(n,!1),n._error.raiseEvent(n,e),console.log(e),Promise.reject(e)}))},KmlTour.prototype.addPlaylistEntry=function(e){this.playlist.push(e)},KmlTour.prototype.play=function(e,t){this.tourStart.raiseEvent();const i=this;playEntry.call(this,e,t,(function(e){i.playlistIndex=0,e||cancelAllEntries(i._activeEntries),i.tourEnd.raiseEvent(e)}))},KmlTour.prototype.stop=function(){cancelAllEntries(this._activeEntries)},KmlTourFlyTo.prototype.play=function(e,t,i){if(this.activeCamera=t,defined(e)&&null!==e){const t=this;this.activeCallback=function(i){delete t.activeCallback,delete t.activeCamera,e(!defined(i)&&i)}}const n=this.getCameraOptions(i);if(this.view.headingPitchRoll)t.flyTo(n);else if(this.view.headingPitchRange){const e=new BoundingSphere(this.view.position);t.flyToBoundingSphere(e,n)}},KmlTourFlyTo.prototype.stop=function(){defined(this.activeCamera)&&this.activeCamera.cancelFlight(),defined(this.activeCallback)&&this.activeCallback(!0)},KmlTourFlyTo.prototype.getCameraOptions=function(e){let t={duration:this.duration};return defined(this.activeCallback)&&(t.complete=this.activeCallback),"smooth"===this.flyToMode&&(t.easingFunction=EasingFunction$1.LINEAR_NONE),this.view.headingPitchRoll?(t.destination=this.view.position,t.orientation=this.view.headingPitchRoll):this.view.headingPitchRange&&(t.offset=this.view.headingPitchRange),defined(e)&&(t=combine$2(t,e)),t},KmlTourWait.prototype.play=function(e){const t=this;this.activeCallback=e,this.timeout=setTimeout((function(){delete t.activeCallback,e(!1)}),1e3*this.duration)},KmlTourWait.prototype.stop=function(){clearTimeout(this.timeout),defined(this.activeCallback)&&this.activeCallback(!0)};const MimeTypes={avi:"video/x-msvideo",bmp:"image/bmp",bz2:"application/x-bzip2",chm:"application/vnd.ms-htmlhelp",css:"text/css",csv:"text/csv",doc:"application/msword",dvi:"application/x-dvi",eps:"application/postscript",flv:"video/x-flv",gif:"image/gif",gz:"application/x-gzip",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",jnlp:"application/x-java-jnlp-file",jpeg:"image/jpeg",jpg:"image/jpeg",m3u:"audio/x-mpegurl",m4v:"video/mp4",mathml:"application/mathml+xml",mid:"audio/midi",midi:"audio/midi",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",mp4v:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",ogg:"application/ogg",pdf:"application/pdf",png:"image/png",pps:"application/vnd.ms-powerpoint",ppt:"application/vnd.ms-powerpoint",ps:"application/postscript",qt:"video/quicktime",rdf:"application/rdf+xml",rss:"application/rss+xml",rtf:"application/rtf",svg:"image/svg+xml",swf:"application/x-shockwave-flash",text:"text/plain",tif:"image/tiff",tiff:"image/tiff",txt:"text/plain",wav:"audio/x-wav",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",xml:"application/xml",zip:"application/zip",detectFromFilename:function(e){let t=e.toLowerCase();return t=getExtensionFromUri(t),MimeTypes[t]}};let parser;"undefined"!=typeof DOMParser&&(parser=new DOMParser);const autolinker=new Autolinker({stripPrefix:!1,email:!1,replaceFn:function(e){if(!e.protocolUrlMatch)return!1}}),BILLBOARD_SIZE=32,BILLBOARD_NEAR_DISTANCE=2414016,BILLBOARD_NEAR_RATIO=1,BILLBOARD_FAR_DISTANCE=16093e3,BILLBOARD_FAR_RATIO=.1,kmlNamespaces=[null,void 0,"http://www.opengis.net/kml/2.2","http://earth.google.com/kml/2.2","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.0"],gxNamespaces=["http://www.google.com/kml/ext/2.2"],atomNamespaces=["http://www.w3.org/2005/Atom"],namespaces={kml:kmlNamespaces,gx:gxNamespaces,atom:atomNamespaces,kmlgx:kmlNamespaces.concat(gxNamespaces)},featureTypes={Document:processDocument,Folder:processFolder,Placemark:processPlacemark,NetworkLink:processNetworkLink,GroundOverlay:processGroundOverlay,PhotoOverlay:processUnsupportedFeature,ScreenOverlay:processScreenOverlay,Tour:processTour};function DeferredLoading(e){this._dataSource=e,this._deferred=defer(),this._stack=[],this._promises=[],this._timeoutSet=!1,this._used=!1,this._started=0,this._timeThreshold=1e3}function isZipFile(e){const t=e.slice(0,Math.min(4,e.size)),i=defer(),n=new FileReader;return n.addEventListener("load",(function(){i.resolve(1347093252===new DataView(n.result).getUint32(0,!1))})),n.addEventListener("error",(function(){i.reject(n.error)})),n.readAsArrayBuffer(t),i.promise}function readBlobAsText(e){const t=defer(),i=new FileReader;return i.addEventListener("load",(function(){t.resolve(i.result)})),i.addEventListener("error",(function(){t.reject(i.error)})),i.readAsText(e),t.promise}function insertNamespaces(e){const t={xsi:"http://www.w3.org/2001/XMLSchema-instance"};let i,n,r,o;for(const a in t)t.hasOwnProperty(a)&&(r=RegExp(`[< ]${a}:`),o=`xmlns:${a}=`,r.test(e)&&-1===e.indexOf(o)&&(defined(i)||(i=e.substr(0,e.indexOf("<kml")+4),n=e.substr(i.length)),i+=` ${o}"${t[a]}"`));return defined(i)&&(e=i+n),e}function removeDuplicateNamespaces(e){let t=e.indexOf("xmlns:");const i=e.indexOf(">",t);let n,r,o;for(;-1!==t&&t<i;)n=e.slice(t,e.indexOf('"',t)),r=t,t=e.indexOf(n,t+1),-1!==t?(o=e.indexOf('"',e.indexOf('"',t)+1),t=(e=e.slice(0,t-1)+e.slice(o+1,e.length)).indexOf("xmlns:",r-1)):t=e.indexOf("xmlns:",r+1);return e}function loadXmlFromZip(e,t){return Promise.resolve(e.getData(new zipNoWorker.TextWriter)).then((function(e){e=removeDuplicateNamespaces(e=insertNamespaces(e)),t.kml=parser.parseFromString(e,"application/xml")}))}function loadDataUriFromZip(e,t){const i=defaultValue(MimeTypes.detectFromFilename(e.filename),"application/octet-stream");return Promise.resolve(e.getData(new zipNoWorker.Data64URIWriter(i))).then((function(i){t[e.filename]=i}))}function embedDataUris(e,t,i,n){const r=n.keys,o=new URI("."),a=e.querySelectorAll(t);for(let e=0;e<a.length;e++){const s=a[e],c=s.getAttribute(i),l=new URI(c).absoluteTo(o).toString(),u=r.indexOf(l);if(-1!==u){const e=r[u];s.setAttribute(i,n[e]),"a"===t&&null===s.getAttribute("download")&&s.setAttribute("download",e)}}}function applyBasePath(e,t,i,n){const r=e.querySelectorAll(t);for(let e=0;e<r.length;e++){const t=r[e],o=resolveHref(t.getAttribute(i),n);t.setAttribute(i,o.url)}}function createEntity(e,t,i){let n=queryStringAttribute(e,"id");n=defined(n)&&0!==n.length?n:createGuid(),defined(i)&&(n=i+n);let r=t.getById(n);return defined(r)&&(n=createGuid(),defined(i)&&(n=i+n)),r=t.add(new Entity({id:n})),defined(r.kml)||(r.addProperty("kml"),r.kml=new KmlFeatureData),r}function isExtrudable(e,t){return"absolute"===e||"relativeToGround"===e||"relativeToSeaFloor"===t}function readCoordinate(e,t){if(!defined(e))return Cartesian3.fromDegrees(0,0,0,t);const i=e.match(/[^\s,\n]+/g);if(!defined(i))return Cartesian3.fromDegrees(0,0,0,t);let n=parseFloat(i[0]),r=parseFloat(i[1]),o=parseFloat(i[2]);return n=isNaN(n)?0:n,r=isNaN(r)?0:r,o=isNaN(o)?0:o,Cartesian3.fromDegrees(n,r,o,t)}function readCoordinates(e,t){if(!defined(e))return;const i=e.textContent.match(/[^\s\n]+/g);if(!defined(i))return;const n=i.length,r=new Array(n);let o=0;for(let e=0;e<n;e++)r[o++]=readCoordinate(i[e],t);return r}function queryNumericAttribute(e,t){if(!defined(e))return;const i=e.getAttribute(t);if(null!==i){const e=parseFloat(i);return isNaN(e)?void 0:e}}function queryStringAttribute(e,t){if(!defined(e))return;const i=e.getAttribute(t);return null!==i?i:void 0}function queryFirstNode(e,t,i){if(!defined(e))return;const n=e.childNodes,r=n.length;for(let e=0;e<r;e++){const r=n[e];if(r.localName===t&&-1!==i.indexOf(r.namespaceURI))return r}}function queryNodes(e,t,i){if(!defined(e))return;const n=[],r=e.getElementsByTagNameNS("*",t),o=r.length;for(let e=0;e<o;e++){const o=r[e];o.localName===t&&-1!==i.indexOf(o.namespaceURI)&&n.push(o)}return n}function queryChildNodes(e,t,i){if(!defined(e))return[];const n=[],r=e.childNodes,o=r.length;for(let e=0;e<o;e++){const o=r[e];o.localName===t&&-1!==i.indexOf(o.namespaceURI)&&n.push(o)}return n}function queryNumericValue(e,t,i){const n=queryFirstNode(e,t,i);if(defined(n)){const e=parseFloat(n.textContent);return isNaN(e)?void 0:e}}function queryStringValue(e,t,i){const n=queryFirstNode(e,t,i);if(defined(n))return n.textContent.trim()}function queryBooleanValue(e,t,i){const n=queryFirstNode(e,t,i);if(defined(n)){const e=n.textContent.trim();return"1"===e||/^true$/i.test(e)}}function resolveHref(e,t,i){if(!defined(e))return;let n;if(defined(i)){let r=i[e=e.replace(/\\/g,"/")];if(defined(r))n=new Resource({url:r});else{const o=new URI(t.getUrlComponent());r=i[new URI(e).absoluteTo(o)],defined(r)&&(n=new Resource({url:r}))}}return defined(n)||(n=t.getDerivedResource({url:e})),n}Object.defineProperties(DeferredLoading.prototype,{dataSource:{get:function(){return this._dataSource}}}),DeferredLoading.prototype.addNodes=function(e,t){this._stack.push({nodes:e,index:0,processingData:t}),this._used=!0},DeferredLoading.prototype.addPromise=function(e){this._promises.push(e)},DeferredLoading.prototype.wait=function(){const e=this._deferred;return this._used||e.resolve(),Promise.all([e.promise,Promise.all(this._promises)])},DeferredLoading.prototype.process=function(){const e=1===this._stack.length;return e&&(this._started=KmlDataSource._getTimestamp()),this._process(e)},DeferredLoading.prototype._giveUpTime=function(){if(this._timeoutSet)return;this._timeoutSet=!0,this._timeThreshold=50;const e=this;setTimeout((function(){e._timeoutSet=!1,e._started=KmlDataSource._getTimestamp(),e._process(!0)}),0)},DeferredLoading.prototype._nextNode=function(){const e=this._stack,t=e[e.length-1],i=t.index,n=t.nodes;if(i!==n.length)return++t.index,n[i]},DeferredLoading.prototype._pop=function(){const e=this._stack;return e.pop(),0!==e.length||(this._deferred.resolve(),!1)},DeferredLoading.prototype._process=function(e){const t=this.dataSource,i=this._stack[this._stack.length-1].processingData;let n=this._nextNode();for(;defined(n);){const e=featureTypes[n.localName];if(defined(e)&&(-1!==namespaces.kml.indexOf(n.namespaceURI)||-1!==namespaces.gx.indexOf(n.namespaceURI))&&(e(t,n,i,this),this._timeoutSet||KmlDataSource._getTimestamp()>this._started+this._timeThreshold))return void this._giveUpTime();n=this._nextNode()}this._pop()&&e&&this._process(!0)};const colorOptions={maximumRed:void 0,red:void 0,maximumGreen:void 0,green:void 0,maximumBlue:void 0,blue:void 0};function parseColorString(e,t){if(!defined(e)||/^\s*$/gm.test(e))return;"#"===e[0]&&(e=e.substring(1));const i=parseInt(e.substring(0,2),16)/255,n=parseInt(e.substring(2,4),16)/255,r=parseInt(e.substring(4,6),16)/255,o=parseInt(e.substring(6,8),16)/255;return t?(o>0?(colorOptions.maximumRed=o,colorOptions.red=void 0):(colorOptions.maximumRed=void 0,colorOptions.red=0),r>0?(colorOptions.maximumGreen=r,colorOptions.green=void 0):(colorOptions.maximumGreen=void 0,colorOptions.green=0),n>0?(colorOptions.maximumBlue=n,colorOptions.blue=void 0):(colorOptions.maximumBlue=void 0,colorOptions.blue=0),colorOptions.alpha=i,Color.fromRandom(colorOptions)):new Color(o,r,n,i)}function queryColorValue(e,t,i){const n=queryStringValue(e,t,i);if(defined(n))return parseColorString(n,"random"===queryStringValue(e,"colorMode",i))}function processTimeStamp(e){const t=queryFirstNode(e,"TimeStamp",namespaces.kmlgx),i=queryStringValue(t,"when",namespaces.kmlgx);if(!defined(t)||!defined(i)||0===i.length)return;const n=JulianDate.fromIso8601(i),r=new TimeIntervalCollection;return r.addInterval(new TimeInterval({start:n,stop:Iso8601.MAXIMUM_VALUE})),r}function processTimeSpan(e){const t=queryFirstNode(e,"TimeSpan",namespaces.kmlgx);if(!defined(t))return;let i;const n=queryFirstNode(t,"begin",namespaces.kmlgx);let r=defined(n)?JulianDate.fromIso8601(n.textContent):void 0;const o=queryFirstNode(t,"end",namespaces.kmlgx);let a=defined(o)?JulianDate.fromIso8601(o.textContent):void 0;if(defined(r)&&defined(a)){if(JulianDate.lessThan(a,r)){const e=r;r=a,a=e}i=new TimeIntervalCollection,i.addInterval(new TimeInterval({start:r,stop:a}))}else defined(r)?(i=new TimeIntervalCollection,i.addInterval(new TimeInterval({start:r,stop:Iso8601.MAXIMUM_VALUE}))):defined(a)&&(i=new TimeIntervalCollection,i.addInterval(new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:a})));return i}function createDefaultBillboard(){const e=new BillboardGraphics;return e.width=BILLBOARD_SIZE,e.height=BILLBOARD_SIZE,e.scaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e.pixelOffsetScaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e}function createDefaultPolygon(){const e=new PolygonGraphics;return e.outline=!0,e.outlineColor=Color.WHITE,e}function createDefaultLabel(){const e=new LabelGraphics;return e.translucencyByDistance=new NearFarScalar(3e6,1,5e6,0),e.pixelOffset=new Cartesian2(17,0),e.horizontalOrigin=HorizontalOrigin$1.LEFT,e.font="16px sans-serif",e.style=LabelStyle$1.FILL_AND_OUTLINE,e}function getIconHref(e,t,i,n,r){let o=queryStringValue(e,"href",namespaces.kml);if(!defined(o)||0===o.length)return;if(0===o.indexOf("root://icons/palette-")){const t=o.charAt(21);let i=defaultValue(queryNumericValue(e,"x",namespaces.gx),0),n=defaultValue(queryNumericValue(e,"y",namespaces.gx),0);i=Math.min(i/32,7),n=7-Math.min(n/32,7);o=`https://maps.google.com/mapfiles/kml/pal${t}/icon${8*n+i}.png`}const a=resolveHref(o,i,n);if(r){const i=queryStringValue(e,"refreshMode",namespaces.kml),n=queryStringValue(e,"viewRefreshMode",namespaces.kml);"onInterval"===i||"onExpire"===i?oneTimeWarning(`kml-refreshMode-${i}`,`KML - Unsupported Icon refreshMode: ${i}`):"onStop"!==n&&"onRegion"!==n||oneTimeWarning(`kml-refreshMode-${n}`,`KML - Unsupported Icon viewRefreshMode: ${n}`);const r=defaultValue(queryStringValue(e,"viewBoundScale",namespaces.kml),1),o="onStop"===n?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",s=defaultValue(queryStringValue(e,"viewFormat",namespaces.kml),o),c=queryStringValue(e,"httpQuery",namespaces.kml);defined(s)&&a.setQueryParameters(queryToObject(cleanupString(s))),defined(c)&&a.setQueryParameters(queryToObject(cleanupString(c)));const l=t._ellipsoid;return processNetworkLinkQueryString(a,t._camera,t._canvas,r,t._lastCameraView.bbox,l),a}return a}function processBillboardIcon(e,t,i,n,r){let o=queryNumericValue(t,"scale",namespaces.kml);const a=queryNumericValue(t,"heading",namespaces.kml),s=queryColorValue(t,"color",namespaces.kml),c=queryFirstNode(t,"Icon",namespaces.kml);let l=getIconHref(c,e,n,r,!1);defined(c)&&!defined(l)&&(l=!1);const u=queryNumericValue(c,"x",namespaces.gx),d=queryNumericValue(c,"y",namespaces.gx),h=queryNumericValue(c,"w",namespaces.gx),p=queryNumericValue(c,"h",namespaces.gx),f=queryFirstNode(t,"hotSpot",namespaces.kml),m=queryNumericAttribute(f,"x"),g=queryNumericAttribute(f,"y"),_=queryStringAttribute(f,"xunits"),y=queryStringAttribute(f,"yunits");let C,T,S=i.billboard;defined(S)||(S=createDefaultBillboard(),i.billboard=S),S.image=l,S.scale=o,S.color=s,(defined(u)||defined(d)||defined(h)||defined(p))&&(S.imageSubRegion=new BoundingRectangle(u,d,h,p)),defined(a)&&0!==a&&(S.rotation=CesiumMath.toRadians(-a),S.alignedAxis=Cartesian3.UNIT_Z),o=defaultValue(o,1),defined(m)&&("pixels"===_?C=-m*o:"insetPixels"===_?C=(m-BILLBOARD_SIZE)*o:"fraction"===_&&(C=-m*BILLBOARD_SIZE*o),C+=.5*BILLBOARD_SIZE*o),defined(g)&&("pixels"===y?T=g*o:"insetPixels"===y?T=(-g+BILLBOARD_SIZE)*o:"fraction"===y&&(T=g*BILLBOARD_SIZE*o),T-=.5*BILLBOARD_SIZE*o),(defined(C)||defined(T))&&(S.pixelOffset=new Cartesian2(C,T))}function applyStyle(e,t,i,n,r){for(let o=0,a=t.childNodes.length;o<a;o++){const a=t.childNodes.item(o);if("IconStyle"===a.localName)processBillboardIcon(e,a,i,n,r);else if("LabelStyle"===a.localName){let e=i.label;defined(e)||(e=createDefaultLabel(),i.label=e),e.scale=defaultValue(queryNumericValue(a,"scale",namespaces.kml),e.scale),e.fillColor=defaultValue(queryColorValue(a,"color",namespaces.kml),e.fillColor),e.text=i.name}else if("LineStyle"===a.localName){let e=i.polyline;defined(e)||(e=new PolylineGraphics,i.polyline=e),e.width=queryNumericValue(a,"width",namespaces.kml),e.material=queryColorValue(a,"color",namespaces.kml),defined(queryColorValue(a,"outerColor",namespaces.gx))&&oneTimeWarning("kml-gx:outerColor","KML - gx:outerColor is not supported in a LineStyle"),defined(queryNumericValue(a,"outerWidth",namespaces.gx))&&oneTimeWarning("kml-gx:outerWidth","KML - gx:outerWidth is not supported in a LineStyle"),defined(queryNumericValue(a,"physicalWidth",namespaces.gx))&&oneTimeWarning("kml-gx:physicalWidth","KML - gx:physicalWidth is not supported in a LineStyle"),defined(queryBooleanValue(a,"labelVisibility",namespaces.gx))&&oneTimeWarning("kml-gx:labelVisibility","KML - gx:labelVisibility is not supported in a LineStyle")}else if("PolyStyle"===a.localName){let e=i.polygon;defined(e)||(e=createDefaultPolygon(),i.polygon=e),e.material=defaultValue(queryColorValue(a,"color",namespaces.kml),e.material),e.fill=defaultValue(queryBooleanValue(a,"fill",namespaces.kml),e.fill),e.outline=defaultValue(queryBooleanValue(a,"outline",namespaces.kml),e.outline)}else if("BalloonStyle"===a.localName){const e=defaultValue(parseColorString(queryStringValue(a,"bgColor",namespaces.kml)),Color.WHITE),t=defaultValue(parseColorString(queryStringValue(a,"textColor",namespaces.kml)),Color.BLACK),n=queryStringValue(a,"text",namespaces.kml);i.addProperty("balloonStyle"),i.balloonStyle={bgColor:e,textColor:t,text:n}}else if("ListStyle"===a.localName){const e=queryStringValue(a,"listItemType",namespaces.kml);"radioFolder"!==e&&"checkOffOnly"!==e||oneTimeWarning(`kml-listStyle-${e}`,`KML - Unsupported ListStyle with listItemType: ${e}`)}}}function computeFinalStyle(e,t,i,n,r){const o=new Entity;let a,s=-1;const c=t.childNodes,l=c.length;for(let e=0;e<l;e++){const t=c[e];"Style"!==t.localName&&"StyleMap"!==t.localName||(s=e)}if(-1!==s){const t=c[s];if("Style"===t.localName)applyStyle(e,t,o,n,r);else{const s=queryChildNodes(t,"Pair",namespaces.kml);for(let t=0;t<s.length;t++){const c=s[t],l=queryStringValue(c,"key",namespaces.kml);if("normal"===l){const t=queryStringValue(c,"styleUrl",namespaces.kml);if(defined(t))a=i.getById(t),defined(a)||(a=i.getById(`#${t}`)),defined(a)&&o.merge(a);else{applyStyle(e,queryFirstNode(c,"Style",namespaces.kml),o,n,r)}}else oneTimeWarning(`kml-styleMap-${l}`,`KML - Unsupported StyleMap key: ${l}`)}}}const u=queryStringValue(t,"styleUrl",namespaces.kml);if(defined(u)){let e=u;if("#"!==u[0]&&-1!==u.indexOf("#")){const t=u.split("#"),i=t[0];e=`${n.getDerivedResource({url:i}).getUrlComponent()}#${t[1]}`}a=i.getById(e),defined(a)||(a=i.getById(`#${e}`)),defined(a)&&o.merge(a)}return o}function processExternalStyles(e,t,i){return t.fetchXML().then((function(n){return processStyles(e,n,i,t,!0)}))}function processStyles(e,t,i,n,r,o){let a,s,c,l;const u=queryNodes(t,"Style",namespaces.kml);if(defined(u)){const t=u.length;for(a=0;a<t;a++)l=u[a],s=queryStringAttribute(l,"id"),defined(s)&&(s=`#${s}`,r&&defined(n)&&(s=n.getUrlComponent()+s),defined(i.getById(s))||(c=new Entity({id:s}),i.add(c),applyStyle(e,l,c,n,o)))}const d=queryNodes(t,"StyleMap",namespaces.kml);if(defined(d)){const t=d.length;for(a=0;a<t;a++){const t=d[a];if(s=queryStringAttribute(t,"id"),defined(s)){const a=queryChildNodes(t,"Pair",namespaces.kml);for(let t=0;t<a.length;t++){const u=a[t],d=queryStringValue(u,"key",namespaces.kml);if("normal"===d){if(s=`#${s}`,r&&defined(n)&&(s=n.getUrlComponent()+s),!defined(i.getById(s))){c=i.getOrCreateEntity(s);let t=queryStringValue(u,"styleUrl",namespaces.kml);if(defined(t)){"#"!==t[0]&&(t=`#${t}`),r&&defined(n)&&(t=n.getUrlComponent()+t);const e=i.getById(t);defined(e)&&c.merge(e)}else l=queryFirstNode(u,"Style",namespaces.kml),applyStyle(e,l,c,n,o)}}else oneTimeWarning(`kml-styleMap-${d}`,`KML - Unsupported StyleMap key: ${d}`)}}}}const h=[],p=t.getElementsByTagName("styleUrl"),f=p.length;for(a=0;a<f;a++){const t=p[a].textContent;if("#"!==t[0]){const r=t.split("#");if(2===r.length){const t=r[0],o=n.getDerivedResource({url:t});h.push(processExternalStyles(e,o,i))}}}return h}function createDropLine(e,t,i){const n=new ReferenceProperty(e,t.id,["position"]),r=new ScaledPositionProperty(t.position);t.polyline=defined(i.polyline)?i.polyline.clone():new PolylineGraphics,t.polyline.positions=new PositionPropertyArray([n,r])}function heightReferenceFromAltitudeMode(e,t){return!defined(e)&&!defined(t)||"clampToGround"===e?HeightReference$1.CLAMP_TO_GROUND:"relativeToGround"===e?HeightReference$1.RELATIVE_TO_GROUND:"absolute"===e?HeightReference$1.NONE:"clampToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-clampToSeaFloor","KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."),HeightReference$1.CLAMP_TO_GROUND):"relativeToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-relativeToSeaFloor","KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."),HeightReference$1.RELATIVE_TO_GROUND):(defined(e)?oneTimeWarning("kml-altitudeMode-unknown",`KML - Unknown <kml:altitudeMode>:${e}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`):oneTimeWarning("kml-gx:altitudeMode-unknown",`KML - Unknown <gx:altitudeMode>:${t}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`),HeightReference$1.CLAMP_TO_GROUND)}function createPositionPropertyFromAltitudeMode(e,t,i){return"relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t?e:((defined(t)&&"clampToGround"!==t||defined(i)&&"clampToSeaFloor"!==i)&&oneTimeWarning("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${defaultValue(t,i)}`),new ScaledPositionProperty(e))}function createPositionPropertyArrayFromAltitudeMode(e,t,i,n){if(!defined(e))return;if("relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t)return e;(defined(t)&&"clampToGround"!==t||defined(i)&&"clampToSeaFloor"!==i)&&oneTimeWarning("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${defaultValue(t,i)}`);const r=e.length;for(let t=0;t<r;t++){const i=e[t];n.scaleToGeodeticSurface(i,i)}return e}function processPositionGraphics(e,t,i,n){let r=t.label;defined(r)||(r=defined(i.label)?i.label.clone():createDefaultLabel(),t.label=r),r.text=t.name;let o=t.billboard;defined(o)||(o=defined(i.billboard)?i.billboard.clone():createDefaultBillboard(),t.billboard=o),defined(o.image)?o.image.getValue()||(o.image=void 0):o.image=e._pinBuilder.fromColor(Color.YELLOW,64);let a=1;defined(o.scale)&&(a=o.scale.getValue(),0!==a?r.pixelOffset=new Cartesian2(16*a+1,0):(r.pixelOffset=void 0,r.horizontalOrigin=void 0)),defined(n)&&e._clampToGround&&(o.heightReference=n,r.heightReference=n)}function processPathGraphics(e,t){let i=e.path;defined(i)||(i=new PathGraphics,i.leadTime=0,e.path=i);const n=t.polyline;defined(n)&&(i.material=n.material,i.width=n.width)}function processPoint(e,t,i,n,r){const o=queryStringValue(i,"coordinates",namespaces.kml),a=queryStringValue(i,"altitudeMode",namespaces.kml),s=queryStringValue(i,"altitudeMode",namespaces.gx),c=queryBooleanValue(i,"extrude",namespaces.kml),l=readCoordinate(o,e._ellipsoid);return n.position=l,processPositionGraphics(e,n,r,heightReferenceFromAltitudeMode(a,s)),c&&isExtrudable(a,s)&&createDropLine(t,n,r),!0}function processLineStringOrLinearRing(e,t,i,n,r){const o=queryFirstNode(i,"coordinates",namespaces.kml),a=queryStringValue(i,"altitudeMode",namespaces.kml),s=queryStringValue(i,"altitudeMode",namespaces.gx),c=queryBooleanValue(i,"extrude",namespaces.kml),l=queryBooleanValue(i,"tessellate",namespaces.kml),u=isExtrudable(a,s),d=queryNumericValue(i,"drawOrder",namespaces.gx),h=e._ellipsoid,p=readCoordinates(o,h);let f=r.polyline;if(u&&c){const e=new WallGraphics;n.wall=e,e.positions=p;const t=r.polygon;defined(t)&&(e.fill=t.fill,e.material=t.material),e.outline=!0,defined(f)?(e.outlineColor=defined(f.material)?f.material.color:Color.WHITE,e.outlineWidth=f.width):defined(t)&&(e.outlineColor=defined(t.material)?t.material.color:Color.WHITE)}else if(e._clampToGround&&!u&&l){const e=new PolylineGraphics;e.clampToGround=!0,n.polyline=e,e.positions=p,defined(f)?(e.material=defined(f.material)?f.material.color.getValue(Iso8601.MINIMUM_VALUE):Color.WHITE,e.width=defaultValue(f.width,1)):(e.material=Color.WHITE,e.width=1),e.zIndex=d}else defined(d)&&oneTimeWarning("kml-gx:drawOrder","KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"),e._clampToGround&&!l&&oneTimeWarning("kml-line-tesselate","Ignoring clampToGround for KML lines without the tessellate flag."),f=defined(f)?f.clone():new PolylineGraphics,n.polyline=f,f.positions=createPositionPropertyArrayFromAltitudeMode(p,a,s,h),l&&!u||(f.arcType=ArcType$1.NONE);return!0}function processPolygon(e,t,i,n,r){const o=queryFirstNode(i,"outerBoundaryIs",namespaces.kml);let a=queryFirstNode(o,"LinearRing",namespaces.kml),s=queryFirstNode(a,"coordinates",namespaces.kml);const c=e._ellipsoid;let l=readCoordinates(s,c);const u=queryBooleanValue(i,"extrude",namespaces.kml),d=isExtrudable(queryStringValue(i,"altitudeMode",namespaces.kml),queryStringValue(i,"altitudeMode",namespaces.gx)),h=defined(r.polygon)?r.polygon.clone():createDefaultPolygon(),p=r.polyline;if(defined(p)&&(h.outlineColor=defined(p.material)?p.material.color:Color.WHITE,h.outlineWidth=p.width),n.polygon=h,d?(h.perPositionHeight=!0,h.extrudedHeight=u?0:void 0):e._clampToGround||(h.height=0),defined(l)){const e=new PolygonHierarchy(l),t=queryChildNodes(i,"innerBoundaryIs",namespaces.kml);for(let i=0;i<t.length;i++){a=queryChildNodes(t[i],"LinearRing",namespaces.kml);for(let t=0;t<a.length;t++)s=queryFirstNode(a[t],"coordinates",namespaces.kml),l=readCoordinates(s,c),defined(l)&&e.holes.push(new PolygonHierarchy(l))}h.hierarchy=e}return!0}function processTrack(e,t,i,n,r){const o=queryStringValue(i,"altitudeMode",namespaces.kml),a=queryStringValue(i,"altitudeMode",namespaces.gx),s=queryChildNodes(i,"coord",namespaces.gx),c=queryChildNodes(i,"angles",namespaces.gx),l=queryChildNodes(i,"when",namespaces.kml),u=queryBooleanValue(i,"extrude",namespaces.kml),d=isExtrudable(o,a),h=e._ellipsoid;c.length>0&&oneTimeWarning("kml-gx:angles","KML - gx:angles are not supported in gx:Tracks");const p=Math.min(s.length,l.length),f=[],m=[];for(let e=0;e<p;e++){const t=readCoordinate(s[e].textContent,h);f.push(t),m.push(JulianDate.fromIso8601(l[e].textContent))}const g=new SampledPositionProperty;return g.addSamples(m,f),n.position=g,processPositionGraphics(e,n,r,heightReferenceFromAltitudeMode(o,a)),processPathGraphics(n,r),n.availability=new TimeIntervalCollection,l.length>0&&n.availability.addInterval(new TimeInterval({start:m[0],stop:m[m.length-1]})),d&&u&&createDropLine(t,n,r),!0}function addToMultiTrack(e,t,i,n,r,o,a,s,c){const l=e[0],u=e[e.length-1],d=new SampledPositionProperty;d.addSamples(e,t),i.intervals.addInterval(new TimeInterval({start:l,stop:u,isStartIncluded:c,isStopIncluded:c,data:createPositionPropertyFromAltitudeMode(d,a,s)})),n.addInterval(new TimeInterval({start:l,stop:u,isStartIncluded:c,isStopIncluded:c})),r.intervals.addInterval(new TimeInterval({start:l,stop:u,isStartIncluded:c,isStopIncluded:c,data:o}))}function processMultiTrack(e,t,i,n,r){const o=queryBooleanValue(i,"interpolate",namespaces.gx),a=queryChildNodes(i,"Track",namespaces.gx);let s,c,l,u=!1;const d=new TimeIntervalCollectionProperty,h=new TimeIntervalCollection,p=new CompositePositionProperty,f=e._ellipsoid;for(let e=0,t=a.length;e<t;e++){const t=a[e],i=queryChildNodes(t,"when",namespaces.kml),n=queryChildNodes(t,"coord",namespaces.gx),r=queryStringValue(t,"altitudeMode",namespaces.kml),m=queryStringValue(t,"altitudeMode",namespaces.gx),g=isExtrudable(r,m),_=queryBooleanValue(t,"extrude",namespaces.kml),y=Math.min(n.length,i.length),C=[];s=[];for(let e=0;e<y;e++){const t=readCoordinate(n[e].textContent,f);C.push(t),s.push(JulianDate.fromIso8601(i[e].textContent))}o&&(defined(c)&&addToMultiTrack([c,s[0]],[l,C[0]],p,h,d,!1,"absolute",void 0,!1),c=s[y-1],l=C[C.length-1]),addToMultiTrack(s,C,p,h,d,g&&_,r,m,!0),u=u||g&&_}return n.availability=h,n.position=p,processPositionGraphics(e,n,r),processPathGraphics(n,r),u&&(createDropLine(t,n,r),n.polyline.show=d),!0}const geometryTypes={Point:processPoint,LineString:processLineStringOrLinearRing,LinearRing:processLineStringOrLinearRing,Polygon:processPolygon,Track:processTrack,MultiTrack:processMultiTrack,MultiGeometry:processMultiGeometry,Model:processUnsupportedGeometry};function processMultiGeometry(e,t,i,n,r,o){const a=i.childNodes;let s=!1;for(let i=0,c=a.length;i<c;i++){const c=a.item(i),l=geometryTypes[c.localName];if(defined(l)){const i=createEntity(c,t,o);i.parent=n,i.name=n.name,i.availability=n.availability,i.description=n.description,i.kml=n.kml,l(e,t,c,i,r)&&(s=!0)}}return s}function processUnsupportedGeometry(e,t,i,n,r){return oneTimeWarning("kml-unsupportedGeometry",`KML - Unsupported geometry: ${i.localName}`),!1}function processExtendedData(e,t){const i=queryFirstNode(e,"ExtendedData",namespaces.kml);if(!defined(i))return;defined(queryFirstNode(i,"SchemaData",namespaces.kml))&&oneTimeWarning("kml-schemaData","KML - SchemaData is unsupported"),defined(queryStringAttribute(i,"xmlns:prefix"))&&oneTimeWarning("kml-extendedData","KML - ExtendedData with xmlns:prefix is unsupported");const n={},r=queryChildNodes(i,"Data",namespaces.kml);if(defined(r)){const e=r.length;for(let t=0;t<e;t++){const e=r[t],i=queryStringAttribute(e,"name");defined(i)&&(n[i]={displayName:queryStringValue(e,"displayName",namespaces.kml),value:queryStringValue(e,"value",namespaces.kml)})}}t.kml.extendedData=n}let scratchDiv;function processDescription(e,t,i,n,r){let o,a,s;const c=t.kml,l=c.extendedData,u=queryStringValue(e,"description",namespaces.kml),d=defaultValue(t.balloonStyle,i.balloonStyle);let h,p=Color.WHITE,f=Color.BLACK,m=u;if(defined(d)&&(p=defaultValue(d.bgColor,Color.WHITE),f=defaultValue(d.textColor,Color.BLACK),m=defaultValue(d.text,u)),defined(m)){if(m=m.replace("$[name]",defaultValue(t.name,"")),m=m.replace("$[description]",defaultValue(u,"")),m=m.replace("$[address]",defaultValue(c.address,"")),m=m.replace("$[Snippet]",defaultValue(c.snippet,"")),m=m.replace("$[id]",t.id),m=m.replace("$[geDirections]",""),defined(l)){const e=m.match(/\$\[.+?\]/g);if(null!==e)for(o=0;o<e.length;o++){const t=e[o];let i=t.substr(2,t.length-3);const n=/\/displayName$/.test(i);i=i.replace(/\/displayName$/,""),h=l[i],defined(h)&&(h=n?h.displayName:h.value),defined(h)&&(m=m.replace(t,defaultValue(h,"")))}}}else if(defined(l)&&(s=Object.keys(l),s.length>0)){for(m='<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>',o=0;o<s.length;o++)a=s[o],h=l[a],m+=`<tr><th>${defaultValue(h.displayName,a)}</th><td>${defaultValue(h.value,"")}</td></tr>`;m+="</tbody></table>"}if(!defined(m))return;m=autolinker.link(m),scratchDiv.innerHTML=m;const g=scratchDiv.querySelectorAll("a");for(o=0;o<g.length;o++)g[o].setAttribute("target","_blank");defined(n)&&n.keys.length>1&&(embedDataUris(scratchDiv,"a","href",n),embedDataUris(scratchDiv,"link","href",n),embedDataUris(scratchDiv,"area","href",n),embedDataUris(scratchDiv,"img","src",n),embedDataUris(scratchDiv,"iframe","src",n),embedDataUris(scratchDiv,"video","src",n),embedDataUris(scratchDiv,"audio","src",n),embedDataUris(scratchDiv,"source","src",n),embedDataUris(scratchDiv,"track","src",n),embedDataUris(scratchDiv,"input","src",n),embedDataUris(scratchDiv,"embed","src",n),embedDataUris(scratchDiv,"script","src",n),embedDataUris(scratchDiv,"video","poster",n)),applyBasePath(scratchDiv,"a","href",r),applyBasePath(scratchDiv,"link","href",r),applyBasePath(scratchDiv,"area","href",r),applyBasePath(scratchDiv,"img","src",r),applyBasePath(scratchDiv,"iframe","src",r),applyBasePath(scratchDiv,"video","src",r),applyBasePath(scratchDiv,"audio","src",r),applyBasePath(scratchDiv,"source","src",r),applyBasePath(scratchDiv,"track","src",r),applyBasePath(scratchDiv,"input","src",r),applyBasePath(scratchDiv,"embed","src",r),applyBasePath(scratchDiv,"script","src",r),applyBasePath(scratchDiv,"video","poster",r);let _='<div class="cesium-infoBox-description-lighter" style="';_+="overflow:auto;",_+="word-wrap:break-word;",_+=`background-color:${p.toCssColorString()};`,_+=`color:${f.toCssColorString()};`,_+='">',_+=`${scratchDiv.innerHTML}</div>`,scratchDiv.innerHTML="",t.description=_}function processFeature(e,t,i){const n=i.entityCollection,r=i.parentEntity,o=i.sourceResource,a=i.uriResolver,s=createEntity(t,n,i.context),c=s.kml,l=computeFinalStyle(e,t,i.styleCollection,o,a),u=queryStringValue(t,"name",namespaces.kml);s.name=u,s.parent=r;let d=processTimeSpan(t);defined(d)||(d=processTimeStamp(t)),s.availability=d,mergeAvailabilityWithParent(s);const h=queryBooleanValue(t,"visibility",namespaces.kml);s.show=function e(t){return!t||t.show&&e(t.parent)}(r)&&defaultValue(h,!0);const p=queryFirstNode(t,"author",namespaces.atom),f=c.author;f.name=queryStringValue(p,"name",namespaces.atom),f.uri=queryStringValue(p,"uri",namespaces.atom),f.email=queryStringValue(p,"email",namespaces.atom);const m=queryFirstNode(t,"link",namespaces.atom),g=c.link;g.href=queryStringAttribute(m,"href"),g.hreflang=queryStringAttribute(m,"hreflang"),g.rel=queryStringAttribute(m,"rel"),g.type=queryStringAttribute(m,"type"),g.title=queryStringAttribute(m,"title"),g.length=queryStringAttribute(m,"length"),c.address=queryStringValue(t,"address",namespaces.kml),c.phoneNumber=queryStringValue(t,"phoneNumber",namespaces.kml),c.snippet=queryStringValue(t,"Snippet",namespaces.kml),processExtendedData(t,s),processDescription(t,s,l,a,o);const _=e._ellipsoid;return processLookAt(t,s,_),processCamera(t,s,_),defined(queryFirstNode(t,"Region",namespaces.kml))&&oneTimeWarning("kml-region","KML - Placemark Regions are unsupported"),{entity:s,styleEntity:l}}function processDocument(e,t,i,n){n.addNodes(t.childNodes,i),n.process()}function processFolder(e,t,i,n){const r=processFeature(e,t,i),o=clone$1(i);o.parentEntity=r.entity,processDocument(e,t,o,n)}function processPlacemark(e,t,i,n){const r=processFeature(e,t,i),o=r.entity,a=r.styleEntity;let s=!1;const c=t.childNodes;for(let t=0,n=c.length;t<n&&!s;t++){const n=c.item(t),r=geometryTypes[n.localName];defined(r)&&(r(e,i.entityCollection,n,o,a,o.id),s=!0)}s||(o.merge(a),processPositionGraphics(e,o,a))}"undefined"!=typeof document&&(scratchDiv=document.createElement("div"));const playlistNodeProcessors={FlyTo:processTourFlyTo,Wait:processTourWait,SoundCue:processTourUnsupportedNode,AnimatedUpdate:processTourUnsupportedNode,TourControl:processTourUnsupportedNode};function processTour(e,t,i,n){const r=new KmlTour(queryStringValue(t,"name",namespaces.kml),queryStringAttribute(t,"id")),o=queryFirstNode(t,"Playlist",namespaces.gx);if(o){const t=e._ellipsoid,i=o.childNodes;for(let e=0;e<i.length;e++){const n=i[e];if(n.localName){const e=playlistNodeProcessors[n.localName];e?e(r,n,t):console.log(`Unknown KML Tour playlist entry type ${n.localName}`)}}}e._kmlTours.push(r)}function processTourUnsupportedNode(e,t){oneTimeWarning(`KML Tour unsupported node ${t.localName}`)}function processTourWait(e,t){const i=queryNumericValue(t,"duration",namespaces.gx);e.addPlaylistEntry(new KmlTourWait(i))}function processTourFlyTo(e,t,i){const n=queryNumericValue(t,"duration",namespaces.gx),r=queryStringValue(t,"flyToMode",namespaces.gx),o={kml:{}};processLookAt(t,o,i),processCamera(t,o,i);const a=new KmlTourFlyTo(n,r,o.kml.lookAt||o.kml.camera);e.addPlaylistEntry(a)}function processCamera(e,t,i){const n=queryFirstNode(e,"Camera",namespaces.kml);if(defined(n)){const e=defaultValue(queryNumericValue(n,"longitude",namespaces.kml),0),r=defaultValue(queryNumericValue(n,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(n,"altitude",namespaces.kml),0),a=defaultValue(queryNumericValue(n,"heading",namespaces.kml),0),s=defaultValue(queryNumericValue(n,"tilt",namespaces.kml),0),c=defaultValue(queryNumericValue(n,"roll",namespaces.kml),0),l=Cartesian3.fromDegrees(e,r,o,i),u=HeadingPitchRoll.fromDegrees(a,s-90,c);t.kml.camera=new KmlCamera(l,u)}}function processLookAt(e,t,i){const n=queryFirstNode(e,"LookAt",namespaces.kml);if(defined(n)){const e=defaultValue(queryNumericValue(n,"longitude",namespaces.kml),0),r=defaultValue(queryNumericValue(n,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(n,"altitude",namespaces.kml),0);let a=queryNumericValue(n,"heading",namespaces.kml),s=queryNumericValue(n,"tilt",namespaces.kml);const c=defaultValue(queryNumericValue(n,"range",namespaces.kml),0);s=CesiumMath.toRadians(defaultValue(s,0)),a=CesiumMath.toRadians(defaultValue(a,0));const l=new HeadingPitchRange(a,s-CesiumMath.PI_OVER_TWO,c),u=Cartesian3.fromDegrees(e,r,o,i);t.kml.lookAt=new KmlLookAt(u,l)}}function processScreenOverlay(e,t,i,n){const r=i.screenOverlayContainer;if(!defined(r))return;const o=i.sourceResource,a=i.uriResolver,s=getIconHref(queryFirstNode(t,"Icon",namespaces.kml),e,o,a,!1);if(!defined(s))return;const c=document.createElement("img");e._screenOverlays.push(c),c.src=s.url,c.onload=function(){const e=["position: absolute"],i=queryFirstNode(t,"screenXY",namespaces.kml),n=queryFirstNode(t,"overlayXY",namespaces.kml),r=queryFirstNode(t,"size",namespaces.kml);let o,a,s,l,u,d;defined(r)&&(o=queryNumericAttribute(r,"x"),a=queryNumericAttribute(r,"y"),s=queryStringAttribute(r,"xunits"),l=queryStringAttribute(r,"yunits"),defined(o)&&-1!==o&&0!==o&&("fraction"===s?u=`width: ${Math.floor(100*o)}%`:"pixels"===s&&(u=`width: ${o}px`),e.push(u)),defined(a)&&-1!==a&&0!==a&&("fraction"===l?d=`height: ${Math.floor(100*a)}%`:"pixels"===l&&(d=`height: ${a}px`),e.push(d))),c.style=e.join(";");let h=0,p=c.height;defined(n)&&(o=queryNumericAttribute(n,"x"),a=queryNumericAttribute(n,"y"),s=queryStringAttribute(n,"xunits"),l=queryStringAttribute(n,"yunits"),defined(o)&&("fraction"===s?h=o*c.width:("pixels"===s||"insetPixels"===s)&&(h=o)),defined(a)&&("fraction"===l?p=a*c.height:("pixels"===l||"insetPixels"===l)&&(p=a))),defined(i)&&(o=queryNumericAttribute(i,"x"),a=queryNumericAttribute(i,"y"),s=queryStringAttribute(i,"xunits"),l=queryStringAttribute(i,"yunits"),defined(o)&&("fraction"===s?u=`left: calc(${Math.floor(100*o)}% - ${h}px)`:"pixels"===s?u=`left: ${o-h}px`:"insetPixels"===s&&(u=`right: ${o-h}px`),e.push(u)),defined(a)&&("fraction"===l?d=`bottom: calc(${Math.floor(100*a)}% - ${p}px)`:"pixels"===l?d=`bottom: ${a-p}px`:"insetPixels"===l&&(d=`top: ${a-p}px`),e.push(d))),c.style=e.join(";")},r.appendChild(c)}function processGroundOverlay(e,t,i,n){const r=processFeature(e,t,i).entity;let o,a=!1;const s=e._ellipsoid,c=readCoordinates(queryFirstNode(t,"LatLonQuad",namespaces.gx),s),l=queryNumericValue(t,"drawOrder",namespaces.kml);if(defined(c))o=createDefaultPolygon(),o.hierarchy=new PolygonHierarchy(c),o.zIndex=l,r.polygon=o,a=!0;else{o=new RectangleGraphics,o.zIndex=l,r.rectangle=o;const e=queryFirstNode(t,"LatLonBox",namespaces.kml);if(defined(e)){let t=queryNumericValue(e,"west",namespaces.kml),i=queryNumericValue(e,"south",namespaces.kml),n=queryNumericValue(e,"east",namespaces.kml),r=queryNumericValue(e,"north",namespaces.kml);defined(t)&&(t=CesiumMath.negativePiToPi(CesiumMath.toRadians(t))),defined(i)&&(i=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(i))),defined(n)&&(n=CesiumMath.negativePiToPi(CesiumMath.toRadians(n))),defined(r)&&(r=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(r))),o.coordinates=new Rectangle(t,i,n,r);const a=queryNumericValue(e,"rotation",namespaces.kml);if(defined(a)){const e=CesiumMath.toRadians(a);o.rotation=e,o.stRotation=e}}}const u=queryFirstNode(t,"Icon",namespaces.kml),d=getIconHref(u,e,i.sourceResource,i.uriResolver,!0);if(defined(d)){a&&oneTimeWarning("kml-gx:LatLonQuad","KML - gx:LatLonQuad Icon does not support texture projection.");const e=queryNumericValue(u,"x",namespaces.gx),i=queryNumericValue(u,"y",namespaces.gx),n=queryNumericValue(u,"w",namespaces.gx),r=queryNumericValue(u,"h",namespaces.gx);(defined(e)||defined(i)||defined(n)||defined(r))&&oneTimeWarning("kml-groundOverlay-xywh","KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"),o.material=d,o.material.color=queryColorValue(t,"color",namespaces.kml),o.material.transparent=!0}else o.material=queryColorValue(t,"color",namespaces.kml);let h=queryStringValue(t,"altitudeMode",namespaces.kml);defined(h)?"absolute"===h?(o.height=queryNumericValue(t,"altitude",namespaces.kml),o.zIndex=void 0):"clampToGround"!==h&&oneTimeWarning("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${h}`):(h=queryStringValue(t,"altitudeMode",namespaces.gx),"relativeToSeaFloor"===h?(oneTimeWarning("kml-altitudeMode-relativeToSeaFloor","KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),o.height=queryNumericValue(t,"altitude",namespaces.kml),o.zIndex=void 0):"clampToSeaFloor"===h?oneTimeWarning("kml-altitudeMode-clampToSeaFloor","KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):defined(h)&&oneTimeWarning("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${h}`))}function processUnsupportedFeature(e,t,i,n){e._unsupportedNode.raiseEvent(e,i.parentEntity,t,i.entityCollection,i.styleCollection,i.sourceResource,i.uriResolver),oneTimeWarning(`kml-unsupportedFeature-${t.nodeName}`,`KML - Unsupported feature: ${t.nodeName}`)}const RefreshMode={INTERVAL:0,EXPIRE:1,STOP:2};function cleanupString(e){if(!defined(e)||0===e.length)return"";const t=e[0];return"&"!==t&&"?"!==t||(e=e.substring(1)),e}const zeroRectangle=new Rectangle,scratchCartographic$7=new Cartographic,scratchCartesian2$2=new Cartesian2,scratchCartesian3$2=new Cartesian3;function processNetworkLinkQueryString(e,t,i,n,r,o){function a(e){return e<-CesiumMath.PI_OVER_TWO?-CesiumMath.PI_OVER_TWO:e>CesiumMath.PI_OVER_TWO?CesiumMath.PI_OVER_TWO:e}function s(e){return e>CesiumMath.PI?e-CesiumMath.TWO_PI:e<-CesiumMath.PI?e+CesiumMath.TWO_PI:e}let c=objectToQuery(e.queryParameters);if(c=c.replace(/%5B/g,"[").replace(/%5D/g,"]"),defined(t)&&t._mode!==SceneMode$1.MORPHING){let e,l;if(r=defaultValue(r,zeroRectangle),defined(i)&&(scratchCartesian2$2.x=.5*i.clientWidth,scratchCartesian2$2.y=.5*i.clientHeight,e=t.pickEllipsoid(scratchCartesian2$2,o,scratchCartesian3$2)),defined(e)?l=o.cartesianToCartographic(e,scratchCartographic$7):(l=Rectangle.center(r,scratchCartographic$7),e=o.cartographicToCartesian(l)),defined(n)&&!CesiumMath.equalsEpsilon(n,1,CesiumMath.EPSILON9)){const e=r.width*n*.5,t=r.height*n*.5;r=new Rectangle(s(l.longitude-e),a(l.latitude-t),s(l.longitude+e),a(l.latitude+t))}c=c.replace("[bboxWest]",CesiumMath.toDegrees(r.west).toString()),c=c.replace("[bboxSouth]",CesiumMath.toDegrees(r.south).toString()),c=c.replace("[bboxEast]",CesiumMath.toDegrees(r.east).toString()),c=c.replace("[bboxNorth]",CesiumMath.toDegrees(r.north).toString());const u=CesiumMath.toDegrees(l.longitude).toString(),d=CesiumMath.toDegrees(l.latitude).toString();c=c.replace("[lookatLon]",u),c=c.replace("[lookatLat]",d),c=c.replace("[lookatTilt]",CesiumMath.toDegrees(t.pitch).toString()),c=c.replace("[lookatHeading]",CesiumMath.toDegrees(t.heading).toString()),c=c.replace("[lookatRange]",Cartesian3.distance(t.positionWC,e)),c=c.replace("[lookatTerrainLon]",u),c=c.replace("[lookatTerrainLat]",d),c=c.replace("[lookatTerrainAlt]",l.height.toString()),o.cartesianToCartographic(t.positionWC,scratchCartographic$7),c=c.replace("[cameraLon]",CesiumMath.toDegrees(scratchCartographic$7.longitude).toString()),c=c.replace("[cameraLat]",CesiumMath.toDegrees(scratchCartographic$7.latitude).toString()),c=c.replace("[cameraAlt]",CesiumMath.toDegrees(scratchCartographic$7.height).toString());const h=t.frustum,p=h.aspectRatio;let f="",m="";if(defined(p)){const e=CesiumMath.toDegrees(h.fov);p>1?(f=e,m=e/p):(m=e,f=e*p)}c=c.replace("[horizFov]",f.toString()),c=c.replace("[vertFov]",m.toString())}else c=c.replace("[bboxWest]","-180"),c=c.replace("[bboxSouth]","-90"),c=c.replace("[bboxEast]","180"),c=c.replace("[bboxNorth]","90"),c=c.replace("[lookatLon]",""),c=c.replace("[lookatLat]",""),c=c.replace("[lookatRange]",""),c=c.replace("[lookatTilt]",""),c=c.replace("[lookatHeading]",""),c=c.replace("[lookatTerrainLon]",""),c=c.replace("[lookatTerrainLat]",""),c=c.replace("[lookatTerrainAlt]",""),c=c.replace("[cameraLon]",""),c=c.replace("[cameraLat]",""),c=c.replace("[cameraAlt]",""),c=c.replace("[horizFov]",""),c=c.replace("[vertFov]","");defined(i)?(c=c.replace("[horizPixels]",i.clientWidth),c=c.replace("[vertPixels]",i.clientHeight)):(c=c.replace("[horizPixels]",""),c=c.replace("[vertPixels]","")),c=c.replace("[terrainEnabled]","1"),c=c.replace("[clientVersion]","1"),c=c.replace("[kmlVersion]","2.2"),c=c.replace("[clientName]","Cesium"),c=c.replace("[language]","English"),e.setQueryParameters(queryToObject(c))}function processNetworkLink(e,t,i,n){const r=processFeature(e,t,i).entity,o=i.sourceResource,a=i.uriResolver;let s=queryFirstNode(t,"Link",namespaces.kml);if(defined(s)||(s=queryFirstNode(t,"Url",namespaces.kml)),defined(s)){let t,c,l=queryStringValue(s,"href",namespaces.kml);if(defined(l)){let u=l;if(l=resolveHref(l,o,i.uriResolver),/^data:/.test(l.getUrlComponent()))/\.kmz/i.test(o.getUrlComponent())||(u=o.getDerivedResource({url:u}));else{u=l.clone(),t=queryStringValue(s,"viewRefreshMode",namespaces.kml),c=defaultValue(queryStringValue(s,"viewBoundScale",namespaces.kml),1);const i="onStop"===t?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",n=defaultValue(queryStringValue(s,"viewFormat",namespaces.kml),i),r=queryStringValue(s,"httpQuery",namespaces.kml);defined(n)&&l.setQueryParameters(queryToObject(cleanupString(n))),defined(r)&&l.setQueryParameters(queryToObject(cleanupString(r)));const o=e._ellipsoid;processNetworkLinkQueryString(l,e._camera,e._canvas,c,e._lastCameraView.bbox,o)}const d={sourceUri:u,uriResolver:a,context:r.id,screenOverlayContainer:i.screenOverlayContainer},h=new EntityCollection,p=load(e,h,l,d).then((function(i){const n=e._entityCollection,o=h.values;n.suspendEvents();for(let e=0;e<o.length;e++){const t=o[e];defined(t.parent)||(t.parent=r,mergeAvailabilityWithParent(t)),n.add(t)}n.resumeEvents();const a=queryStringValue(s,"refreshMode",namespaces.kml);let u=defaultValue(queryNumericValue(s,"refreshInterval",namespaces.kml),0);if("onInterval"===a&&u>0||"onExpire"===a||"onStop"===t){const t=queryFirstNode(i,"NetworkLinkControl",namespaces.kml),n=defined(t),o=JulianDate.now(),d={id:createGuid(),href:l,cookie:{},lastUpdated:o,updating:!1,entity:r,viewBoundScale:c,needsUpdate:!1,cameraUpdateTime:o};let h=0;if(n&&(d.cookie=queryToObject(defaultValue(queryStringValue(t,"cookie",namespaces.kml),"")),h=defaultValue(queryNumericValue(t,"minRefreshPeriod",namespaces.kml),0)),"onInterval"===a)n&&(u=Math.max(h,u)),d.refreshMode=RefreshMode.INTERVAL,d.time=u;else if("onExpire"===a){let e;if(n&&(e=queryStringValue(t,"expires",namespaces.kml)),defined(e))try{const t=JulianDate.fromIso8601(e),i=JulianDate.secondsDifference(t,o);i>0&&i<h&&JulianDate.addSeconds(o,h,t),d.refreshMode=RefreshMode.EXPIRE,d.time=t}catch(e){oneTimeWarning("kml-refreshMode-onInterval-onExpire","KML - NetworkLinkControl expires is not a valid date")}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element")}else e._camera?(d.refreshMode=RefreshMode.STOP,d.time=defaultValue(queryNumericValue(s,"viewRefreshTime",namespaces.kml),0)):oneTimeWarning("kml-refrehMode-onStop-noCamera","A NetworkLink with viewRefreshMode=onStop requires a camera be passed in when creating the KmlDataSource");defined(d.refreshMode)&&e._networkLinks.set(d.id,d)}else"onRegion"===t&&oneTimeWarning("kml-refrehMode-onRegion","KML - Unsupported viewRefreshMode: onRegion")})).catch((function(t){oneTimeWarning(`An error occured during loading ${l.url}`),e._error.raiseEvent(e,t)}));n.addPromise(p)}}}function processFeatureNode(e,t,i,n){const r=featureTypes[t.localName];return defined(r)?r(e,t,i,n):processUnsupportedFeature(e,t,i)}function loadKml(e,t,i,n,r,o,a){t.removeAll();const s=i.documentElement;let c=queryStringValue("Document"===s.localName?s:queryFirstNode(s,"Document",namespaces.kml),"name",namespaces.kml);defined(c)||(c=getFilenameFromUri(n.getUrlComponent())),defined(e._name)||(e._name=c);const l=new KmlDataSource._DeferredLoading(e),u=new EntityCollection(e);return Promise.all(processStyles(e,i,u,n,!1,r)).then((function(){let s=i.documentElement;if("kml"===s.localName){const e=s.childNodes;for(let t=0;t<e.length;t++){const i=e[t];if(defined(featureTypes[i.localName])){s=i;break}}}const c={parentEntity:void 0,entityCollection:t,styleCollection:u,sourceResource:n,uriResolver:r,context:a,screenOverlayContainer:o};return t.suspendEvents(),processFeatureNode(e,s,c,l),t.resumeEvents(),l.wait().then((function(){return i.documentElement}))}))}function loadKmz(e,t,i,n,r){const o=buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");zipNoWorker.configure({workerScripts:{deflate:[o,"./pako_deflate.min.js"],inflate:[o,"./pako_inflate.min.js"]}});const a=new zipNoWorker.ZipReader(new zipNoWorker.BlobReader(i));return Promise.resolve(a.getEntries()).then((function(i){const o=[],s={};let c;for(let e=0;e<i.length;e++){const t=i[e];t.directory||(/\.kml$/i.test(t.filename)?defined(c)&&/\//i.test(t.filename)?o.push(loadDataUriFromZip(t,s)):(defined(c)&&o.push(loadDataUriFromZip(c,s)),c=t):o.push(loadDataUriFromZip(t,s)))}return defined(c)&&o.push(loadXmlFromZip(c,s)),Promise.all(o).then((function(){if(a.close(),!defined(s.kml))throw new RuntimeError("KMZ file does not contain a KML document.");return s.keys=Object.keys(s),loadKml(e,t,s.kml,n,s,r)}))}))}function load(e,t,i,n){let r=(n=defaultValue(n,defaultValue.EMPTY_OBJECT)).sourceUri;const o=n.uriResolver,a=n.context;let s=n.screenOverlayContainer,c=i;if("string"==typeof i||i instanceof Resource){c=(i=Resource.createIfNeeded(i)).fetchBlob(),r=defaultValue(r,i.clone());const t=e._resourceCredits,n=i.credits;if(defined(n)){const e=n.length;for(let i=0;i<e;i++)t.push(n[i])}}else r=defaultValue(r,Resource.DEFAULT.clone());return r=Resource.createIfNeeded(r),defined(s)&&(s=getElement(s)),Promise.resolve(c).then((function(i){return i instanceof Blob?isZipFile(i).then((function(n){return n?loadKmz(e,t,i,r,s):readBlobAsText(i).then((function(i){let n,c;i=removeDuplicateNamespaces(i=insertNamespaces(i));try{n=parser.parseFromString(i,"application/xml")}catch(e){c=e.toString()}if(defined(c)||n.body||"parsererror"===n.documentElement.tagName){let e=defined(c)?c:n.documentElement.firstChild.nodeValue;throw e||(e=n.body.innerText),new RuntimeError(e)}return loadKml(e,t,n,r,o,s,a)}))})):loadKml(e,t,i,r,o,s,a)})).catch((function(t){return e._error.raiseEvent(e,t),console.log(t),Promise.reject(t)}))}function KmlDataSource(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).camera,i=e.canvas;this._changed=new Event,this._error=new Event,this._loading=new Event,this._refresh=new Event,this._unsupportedNode=new Event,this._clock=void 0,this._entityCollection=new EntityCollection(this),this._name=void 0,this._isLoading=!1,this._pinBuilder=new PinBuilder,this._networkLinks=new AssociativeArray,this._entityCluster=new EntityCluster,this._canvas=i,this._camera=t,this._lastCameraView={position:defined(t)?Cartesian3.clone(t.positionWC):void 0,direction:defined(t)?Cartesian3.clone(t.directionWC):void 0,up:defined(t)?Cartesian3.clone(t.upWC):void 0,bbox:defined(t)?t.computeViewRectangle():Rectangle.clone(Rectangle.MAX_VALUE)},this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84);let n=e.credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n,this._resourceCredits=[],this._kmlTours=[],this._screenOverlays=[]}function mergeAvailabilityWithParent(e){const t=e.parent;if(defined(t)){const i=t.availability;if(defined(i)){const t=e.availability;defined(t)?t.intersect(i):e.availability=i}}}function getNetworkLinkUpdateCallback(e,t,i,n,r){return function(o){if(!n.contains(t.id))return;let a=!1;const s=queryFirstNode(o,"NetworkLinkControl",namespaces.kml);let c=0;if(defined(s)){if(defined(queryFirstNode(s,"Update",namespaces.kml)))return oneTimeWarning("kml-networkLinkControl-update","KML - NetworkLinkControl updates aren't supported."),t.updating=!1,void n.remove(t.id);t.cookie=queryToObject(defaultValue(queryStringValue(s,"cookie",namespaces.kml),"")),c=defaultValue(queryNumericValue(s,"minRefreshPeriod",namespaces.kml),0)}const l=JulianDate.now(),u=t.refreshMode;if(u===RefreshMode.INTERVAL)defined(s)&&(t.time=Math.max(c,t.time));else if(u===RefreshMode.EXPIRE){let e;if(defined(s)&&(e=queryStringValue(s,"expires",namespaces.kml)),defined(e))try{const i=JulianDate.fromIso8601(e),n=JulianDate.secondsDifference(i,l);n>0&&n<c&&JulianDate.addSeconds(l,c,i),t.time=i}catch(e){oneTimeWarning("kml-networkLinkControl-expires","KML - NetworkLinkControl expires is not a valid date"),a=!0}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"),a=!0}const d=t.entity,h=e._entityCollection,p=i.values;function f(e){h.remove(e);const t=e._children,i=t.length;for(let e=0;e<i;++e)f(t[e])}h.suspendEvents();const m=h.values.slice();let g;for(g=0;g<m.length;++g){const e=m[g];e.parent===d&&(e.parent=void 0,f(e))}for(h.resumeEvents(),h.suspendEvents(),g=0;g<p.length;g++){const e=p[g];defined(e.parent)||(e.parent=d,mergeAvailabilityWithParent(e)),h.add(e)}h.resumeEvents(),a?n.remove(t.id):t.lastUpdated=l;const _=h.computeAvailability(),y=_.start,C=_.stop,T=JulianDate.equals(y,Iso8601.MINIMUM_VALUE),S=JulianDate.equals(C,Iso8601.MAXIMUM_VALUE);if(!T||!S){const t=e._clock;t.startTime===y&&t.stopTime===C||(t.startTime=y,t.stopTime=C,e._changed.raiseEvent(e))}t.updating=!1,t.needsUpdate=!1,e._refresh.raiseEvent(e,r.getUrlComponent(!0))}}KmlDataSource.load=function(e,t){return new KmlDataSource(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).load(e,t)},Object.defineProperties(KmlDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},refreshEvent:{get:function(){return this._refresh}},unsupportedNodeEvent:{get:function(){return this._unsupportedNode}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}},kmlTours:{get:function(){return this._kmlTours}}}),KmlDataSource.prototype.load=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT),DataSource.setLoading(this,!0);const i=this._name;this._name=void 0,this._clampToGround=defaultValue(t.clampToGround,!1);const n=this;return load(this,this._entityCollection,e,t).then((function(){let e;const t=n._entityCollection.computeAvailability();let r=t.start,o=t.stop;const a=JulianDate.equals(r,Iso8601.MINIMUM_VALUE),s=JulianDate.equals(o,Iso8601.MAXIMUM_VALUE);if(!a||!s){let t;a&&(t=new Date,t.setHours(0,0,0,0),r=JulianDate.fromDate(t)),s&&(t=new Date,t.setHours(24,0,0,0),o=JulianDate.fromDate(t)),e=new DataSourceClock,e.startTime=r,e.stopTime=o,e.currentTime=JulianDate.clone(r),e.clockRange=ClockRange$1.LOOP_STOP,e.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e.multiplier=Math.round(Math.min(Math.max(JulianDate.secondsDifference(o,r)/60,1),31556900))}let c=!1;return e!==n._clock&&(n._clock=e,c=!0),i!==n._name&&(c=!0),c&&n._changed.raiseEvent(n),DataSource.setLoading(n,!1),n})).catch((function(e){return DataSource.setLoading(n,!1),n._error.raiseEvent(n,e),console.log(e),Promise.reject(e)}))},KmlDataSource.prototype.destroy=function(){for(;this._screenOverlays.length>0;){this._screenOverlays.pop().remove()}};const entitiesToIgnore=new AssociativeArray;function KmlFeatureData(){this.author={name:void 0,uri:void 0,email:void 0},this.link={href:void 0,hreflang:void 0,rel:void 0,type:void 0,title:void 0,length:void 0},this.address=void 0,this.phoneNumber=void 0,this.snippet=void 0,this.extendedData=void 0}function Visualizer(){DeveloperError.throwInstantiationError()}KmlDataSource.prototype.update=function(e){const t=this._networkLinks;if(0===t.length)return!0;const i=JulianDate.now(),n=this;function r(e){const t=e._children,i=t.length;for(let e=0;e<i;++e){const i=t[e];entitiesToIgnore.set(i.id,i),r(i)}}entitiesToIgnore.removeAll();let o=!1;const a=this._lastCameraView,s=this._camera;!defined(s)||s.positionWC.equalsEpsilon(a.position,CesiumMath.EPSILON7)&&s.directionWC.equalsEpsilon(a.direction,CesiumMath.EPSILON7)&&s.upWC.equalsEpsilon(a.up,CesiumMath.EPSILON7)||(a.position=Cartesian3.clone(s.positionWC),a.direction=Cartesian3.clone(s.directionWC),a.up=Cartesian3.clone(s.upWC),a.bbox=s.computeViewRectangle(),o=!0);const c=new AssociativeArray;let l=!1;return t.values.forEach((function(e){const t=e.entity;if(!entitiesToIgnore.contains(t.id)){if(!e.updating){let s=!1;if(e.refreshMode===RefreshMode.INTERVAL?JulianDate.secondsDifference(i,e.lastUpdated)>e.time&&(s=!0):e.refreshMode===RefreshMode.EXPIRE?JulianDate.greaterThan(i,e.time)&&(s=!0):e.refreshMode===RefreshMode.STOP&&(o&&(e.needsUpdate=!0,e.cameraUpdateTime=i),e.needsUpdate&&JulianDate.secondsDifference(i,e.cameraUpdateTime)>=e.time&&(s=!0)),s){r(t),e.updating=!0;const i=new EntityCollection,o=e.href.clone();o.setQueryParameters(e.cookie);const s=defaultValue(n._ellipsoid,Ellipsoid.WGS84);processNetworkLinkQueryString(o,n._camera,n._canvas,e.viewBoundScale,a.bbox,s),load(n,i,o,{context:t.id}).then(getNetworkLinkUpdateCallback(n,e,i,c,o)).catch((function(t){const i=`NetworkLink ${e.href} refresh failed: ${t}`;console.log(i),n._error.raiseEvent(n,i)})),l=!0}}c.set(e.id,e)}})),l&&(this._networkLinks=c,this._changed.raiseEvent(this)),!0},KmlDataSource._DeferredLoading=DeferredLoading,KmlDataSource._getTimestamp=getTimestamp$1,Visualizer.prototype.update=DeveloperError.throwInstantiationError,Visualizer.prototype.getBoundingSphere=DeveloperError.throwInstantiationError,Visualizer.prototype.isDestroyed=DeveloperError.throwInstantiationError,Visualizer.prototype.destroy=DeveloperError.throwInstantiationError;var ViewportQuadVS="attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n";function ComputeEngine(e){this._context=e}let renderStateScratch;const drawCommandScratch=new DrawCommand({primitiveType:PrimitiveType$1.TRIANGLES}),clearCommandScratch=new ClearCommand({color:new Color(0,0,0,0)});function createFramebuffer$1(e,t){return new Framebuffer({context:e,colorTextures:[t],destroyAttachments:!1})}function createViewportQuadShader(e,t){return ShaderProgram.fromCache({context:e,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function createRenderState$1(e,t){return defined(renderStateScratch)&&renderStateScratch.viewport.width===e&&renderStateScratch.viewport.height===t||(renderStateScratch=RenderState.fromCache({viewport:new BoundingRectangle(0,0,e,t)})),renderStateScratch}function PassState(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}function ShaderCache(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}function destroyShader(e,t){const i=t.derivedKeywords,n=i.length;for(let r=0;r<n;++r){const n=i[r]+t.keyword;destroyShader(e,e._shaders[n])}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}function TextureCache(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}function SunLight(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this.intensity=defaultValue(e.intensity,2)}function UniformState(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new BoundingRectangle,this._viewportCartesian4=new Cartesian4,this._viewportDirty=!1,this._viewportOrthographicMatrix=Matrix4.clone(Matrix4.IDENTITY),this._viewportTransformation=Matrix4.clone(Matrix4.IDENTITY),this._model=Matrix4.clone(Matrix4.IDENTITY),this._view=Matrix4.clone(Matrix4.IDENTITY),this._inverseView=Matrix4.clone(Matrix4.IDENTITY),this._projection=Matrix4.clone(Matrix4.IDENTITY),this._infiniteProjection=Matrix4.clone(Matrix4.IDENTITY),this._entireFrustum=new Cartesian2,this._currentFrustum=new Cartesian2,this._frustumPlanes=new Cartesian4,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=Matrix3.clone(Matrix4.IDENTITY),this._view3DDirty=!0,this._view3D=new Matrix4,this._inverseView3DDirty=!0,this._inverseView3D=new Matrix4,this._inverseModelDirty=!0,this._inverseModel=new Matrix4,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new Matrix3,this._viewRotation=new Matrix3,this._inverseViewRotation=new Matrix3,this._viewRotation3D=new Matrix3,this._inverseViewRotation3D=new Matrix3,this._inverseProjectionDirty=!0,this._inverseProjection=new Matrix4,this._modelViewDirty=!0,this._modelView=new Matrix4,this._modelView3DDirty=!0,this._modelView3D=new Matrix4,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new Matrix4,this._inverseModelViewDirty=!0,this._inverseModelView=new Matrix4,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new Matrix4,this._viewProjectionDirty=!0,this._viewProjection=new Matrix4,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new Matrix4,this._modelViewProjectionDirty=!0,this._modelViewProjection=new Matrix4,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new Matrix4,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new Matrix4,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new Matrix4,this._normalDirty=!0,this._normal=new Matrix3,this._normal3DDirty=!0,this._normal3D=new Matrix3,this._inverseNormalDirty=!0,this._inverseNormal=new Matrix3,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new Matrix3,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new EncodedCartesian3,this._cameraPosition=new Cartesian3,this._sunPositionWC=new Cartesian3,this._sunPositionColumbusView=new Cartesian3,this._sunDirectionWC=new Cartesian3,this._sunDirectionEC=new Cartesian3,this._moonDirectionEC=new Cartesian3,this._lightDirectionWC=new Cartesian3,this._lightDirectionEC=new Cartesian3,this._lightColor=new Cartesian3,this._lightColorHdr=new Cartesian3,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new Cartesian3,this._cameraRight=new Cartesian3,this._cameraUp=new Cartesian3,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new Cartesian2,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new Color,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new Cartesian2,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._invertClassificationColor=void 0,this._splitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}function setView(e,t){Matrix4.clone(t,e._view),Matrix4.getMatrix3(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function setInverseView(e,t){Matrix4.clone(t,e._inverseView),Matrix4.getMatrix3(t,e._inverseViewRotation)}function setProjection(e,t){Matrix4.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function setInfiniteProjection(e,t){Matrix4.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function setCamera(e,t){Cartesian3.clone(t.positionWC,e._cameraPosition),Cartesian3.clone(t.directionWC,e._cameraDirection),Cartesian3.clone(t.rightWC,e._cameraRight),Cartesian3.clone(t.upWC,e._cameraUp);const i=t.positionCartographic;defined(i)?e._eyeHeight=i.height:e._eyeHeight=-e._ellipsoid.maximumRadius,e._encodedCameraPositionMCDirty=!0}ComputeEngine.prototype.execute=function(e){defined(e.preExecute)&&e.preExecute(e);const t=e.outputTexture,i=t.width,n=t.height,r=this._context,o=defined(e.vertexArray)?e.vertexArray:r.getViewportQuadVertexArray(),a=defined(e.shaderProgram)?e.shaderProgram:createViewportQuadShader(r,e.fragmentShaderSource),s=createFramebuffer$1(r,t),c=createRenderState$1(i,n),l=e.uniformMap,u=clearCommandScratch;u.framebuffer=s,u.renderState=c,u.execute(r);const d=drawCommandScratch;d.vertexArray=o,d.renderState=c,d.shaderProgram=a,d.uniformMap=l,d.framebuffer=s,d.execute(r),s.destroy(),e.persists||(a.destroy(),defined(e.vertexArray)&&o.destroy()),defined(e.postExecute)&&e.postExecute(t)},ComputeEngine.prototype.isDestroyed=function(){return!1},ComputeEngine.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(ShaderCache.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),ShaderCache.prototype.replaceShaderProgram=function(e){return defined(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)},ShaderCache.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,i=e.fragmentShaderSource;const n=e.attributeLocations;"string"==typeof t&&(t=new ShaderSource({sources:[t]})),"string"==typeof i&&(i=new ShaderSource({sources:[i]}));const r=t.createCombinedVertexShader(this._context),o=i.createCombinedFragmentShader(this._context),a=r+o+JSON.stringify(n);let s;if(defined(this._shaders[a]))s=this._shaders[a],delete this._shadersToRelease[a];else{const e=this._context,c=new ShaderProgram({gl:e._gl,logShaderCompilation:e.logShaderCompilation,debugShaders:e.debugShaders,vertexShaderSource:t,vertexShaderText:r,fragmentShaderSource:i,fragmentShaderText:o,attributeLocations:n});s={cache:this,shaderProgram:c,keyword:a,derivedKeywords:[],count:0},c._cachedShader=s,this._shaders[a]=s,++this._numberOfShaders}return++s.count,s.shaderProgram},ShaderCache.prototype.replaceDerivedShaderProgram=function(e,t,i){const n=e._cachedShader,r=t+n.keyword,o=this._shaders[r];if(defined(o)){destroyShader(this,o);const e=n.derivedKeywords.indexOf(t);e>-1&&n.derivedKeywords.splice(e,1)}return this.createDerivedShaderProgram(e,t,i)},ShaderCache.prototype.getDerivedShaderProgram=function(e,t){const i=t+e._cachedShader.keyword,n=this._shaders[i];if(defined(n))return n.shaderProgram},ShaderCache.prototype.createDerivedShaderProgram=function(e,t,i){const n=e._cachedShader,r=t+n.keyword;let o=i.vertexShaderSource,a=i.fragmentShaderSource;const s=i.attributeLocations;"string"==typeof o&&(o=new ShaderSource({sources:[o]})),"string"==typeof a&&(a=new ShaderSource({sources:[a]}));const c=this._context,l=o.createCombinedVertexShader(c),u=a.createCombinedFragmentShader(c),d=new ShaderProgram({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:o,vertexShaderText:l,fragmentShaderSource:a,fragmentShaderText:u,attributeLocations:s}),h={cache:this,shaderProgram:d,keyword:r,derivedKeywords:[],count:0};return n.derivedKeywords.push(t),d._cachedShader=h,this._shaders[r]=h,d},ShaderCache.prototype.destroyReleasedShaderPrograms=function(){const e=this._shadersToRelease;for(const t in e)if(e.hasOwnProperty(t)){destroyShader(this,e[t]),--this._numberOfShaders}this._shadersToRelease={}},ShaderCache.prototype.releaseShaderProgram=function(e){if(defined(e)){const t=e._cachedShader;t&&0==--t.count&&(this._shadersToRelease[t.keyword]=t)}},ShaderCache.prototype.isDestroyed=function(){return!1},ShaderCache.prototype.destroy=function(){const e=this._shaders;for(const t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return destroyObject(this)},Object.defineProperties(TextureCache.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}}),TextureCache.prototype.getTexture=function(e){const t=this._textures[e];if(defined(t))return delete this._texturesToRelease[e],++t.count,t.texture},TextureCache.prototype.addTexture=function(e,t){const i={texture:t,count:1};t.finalDestroy=t.destroy;const n=this;t.destroy=function(){0==--i.count&&(n._texturesToRelease[e]=i)},this._textures[e]=i,++this._numberOfTextures},TextureCache.prototype.destroyReleasedTextures=function(){const e=this._texturesToRelease;for(const t in e)if(e.hasOwnProperty(t)){const i=e[t];delete this._textures[t],i.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}},TextureCache.prototype.isDestroyed=function(){return!1},TextureCache.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return destroyObject(this)},Object.defineProperties(UniformState.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!BoundingRectangle.equals(e,this._viewport)){BoundingRectangle.clone(e,this._viewport);const t=this._viewport,i=this._viewportCartesian4;i.x=t.x,i.y=t.y,i.z=t.width,i.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return cleanViewport(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return cleanViewport(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){Matrix4.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,Matrix4.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){const e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,Matrix4.getMatrix3(this.inverseModel,e),Matrix3.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return updateView3D(this),this._view3D}},viewRotation:{get:function(){return updateView3D(this),this._viewRotation}},viewRotation3D:{get:function(){return updateView3D(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return updateInverseView3D(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return updateInverseView3D(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return cleanInverseProjection(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return cleanModelView(this),this._modelView}},modelView3D:{get:function(){return cleanModelView3D(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return cleanModelViewRelativeToEye(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return cleanInverseModelView(this),this._inverseModelView}},inverseModelView3D:{get:function(){return cleanInverseModelView3D(this),this._inverseModelView3D}},viewProjection:{get:function(){return cleanViewProjection(this),this._viewProjection}},inverseViewProjection:{get:function(){return cleanInverseViewProjection(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return cleanModelViewProjection(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return cleanInverseModelViewProjection(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return cleanModelViewProjectionRelativeToEye(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return cleanModelViewInfiniteProjection(this),this._modelViewInfiniteProjection}},normal:{get:function(){return cleanNormal(this),this._normal}},normal3D:{get:function(){return cleanNormal3D(this),this._normal3D}},inverseNormal:{get:function(){return cleanInverseNormal(this),this._inverseNormal}},inverseNormal3D:{get:function(){return cleanInverseNormal3D(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},farDepthFromNearPlusOne:{get:function(){return this._farDepthFromNearPlusOne}},log2FarDepthFromNearPlusOne:{get:function(){return this._log2FarDepthFromNearPlusOne}},oneOverLog2FarDepthFromNearPlusOne:{get:function(){return this._oneOverLog2FarDepthFromNearPlusOne}},eyeHeight:{get:function(){return this._eyeHeight}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},lightDirectionWC:{get:function(){return this._lightDirectionWC}},lightDirectionEC:{get:function(){return this._lightDirectionEC}},lightColor:{get:function(){return this._lightColor}},lightColorHdr:{get:function(){return this._lightColorHdr}},encodedCameraPositionMCHigh:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},geometricToleranceOverMeter:{get:function(){return this._geometricToleranceOverMeter}},pass:{get:function(){return this._pass}},backgroundColor:{get:function(){return this._backgroundColor}},brdfLut:{get:function(){return this._brdfLut}},environmentMap:{get:function(){return this._environmentMap}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps}},specularEnvironmentMapsDimensions:{get:function(){return this._specularEnvironmentMapsDimensions}},specularEnvironmentMapsMaximumLOD:{get:function(){return this._specularEnvironmentMapsMaximumLOD}},imagerySplitPosition:{get:function(){return deprecationWarning("UniformState.imagerySplitPosition","czm_imagerySplitPosition has been deprecated in Cesium 1.92. It will be removed in Cesium 1.94. Use czm_splitPosition instead."),this._splitPosition}},splitPosition:{get:function(){return this._splitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return defaultValue(this._ellipsoid,Ellipsoid.WGS84)}}});let transformMatrix=new Matrix3;const sunCartographicScratch=new Cartographic;function setSunAndMoonDirections(e,t){defined(Transforms.computeIcrfToFixedMatrix(t.time,transformMatrix))||(transformMatrix=Transforms.computeTemeToPseudoFixedMatrix(t.time,transformMatrix));let i=Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);Matrix3.multiplyByVector(transformMatrix,i,i),Cartesian3.normalize(i,e._sunDirectionWC),i=Matrix3.multiplyByVector(e.viewRotation3D,i,e._sunDirectionEC),Cartesian3.normalize(i,i),i=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),Matrix3.multiplyByVector(transformMatrix,i,i),Matrix3.multiplyByVector(e.viewRotation3D,i,i),Cartesian3.normalize(i,i);const n=t.mapProjection,r=n.ellipsoid.cartesianToCartographic(e._sunPositionWC,sunCartographicScratch);n.project(r,e._sunPositionColumbusView)}UniformState.prototype.updateCamera=function(e){setView(this,e.viewMatrix),setInverseView(this,e.inverseViewMatrix),setCamera(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==SceneMode$1.SCENE2D&&e.frustum instanceof OrthographicFrustum},UniformState.prototype.updateFrustum=function(e){setProjection(this,e.projectionMatrix),defined(e.infiniteProjectionMatrix)&&setInfiniteProjection(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=CesiumMath.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne,defined(e._offCenterFrustum)&&(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right},UniformState.prototype.updatePass=function(e){this._pass=e};const EMPTY_ARRAY=[],defaultLight=new SunLight;function cleanViewport(e){if(e._viewportDirty){const t=e._viewport;Matrix4.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),Matrix4.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function cleanInverseProjection(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode===SceneMode$1.SCENE2D||e._mode===SceneMode$1.MORPHING||e._orthographicIn3D?Matrix4.clone(Matrix4.ZERO,e._inverseProjection):Matrix4.inverse(e._projection,e._inverseProjection))}function cleanModelView(e){e._modelViewDirty&&(e._modelViewDirty=!1,Matrix4.multiplyTransformation(e._view,e._model,e._modelView))}function cleanModelView3D(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,Matrix4.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function cleanInverseModelView(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,Matrix4.inverse(e.modelView,e._inverseModelView))}function cleanInverseModelView3D(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,Matrix4.inverse(e.modelView3D,e._inverseModelView3D))}function cleanViewProjection(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,Matrix4.multiply(e._projection,e._view,e._viewProjection))}function cleanInverseViewProjection(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,Matrix4.inverse(e.viewProjection,e._inverseViewProjection))}function cleanModelViewProjection(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,Matrix4.multiply(e._projection,e.modelView,e._modelViewProjection))}function cleanModelViewRelativeToEye(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;const t=e.modelView,i=e._modelViewRelativeToEye;i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=0,i[13]=0,i[14]=0,i[15]=t[15]}}function cleanInverseModelViewProjection(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,Matrix4.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function cleanModelViewProjectionRelativeToEye(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,Matrix4.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function cleanModelViewInfiniteProjection(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,Matrix4.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function cleanNormal(e){if(e._normalDirty){e._normalDirty=!1;const t=e._normal;Matrix4.getMatrix3(e.inverseModelView,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanNormal3D(e){if(e._normal3DDirty){e._normal3DDirty=!1;const t=e._normal3D;Matrix4.getMatrix3(e.inverseModelView3D,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanInverseNormal(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,Matrix4.getMatrix3(e.inverseModelView,e._inverseNormal),Matrix3.getRotation(e._inverseNormal,e._inverseNormal))}function cleanInverseNormal3D(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,Matrix4.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),Matrix3.getRotation(e._inverseNormal3D,e._inverseNormal3D))}UniformState.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;const t=e.camera;this.updateCamera(t),e.mode===SceneMode$1.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.frustum.left,this._eyeHeight2D.x=.5*this._frustum2DWidth,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),setSunAndMoonDirections(this,e);const i=defaultValue(e.light,defaultLight);i instanceof SunLight?(this._lightDirectionWC=Cartesian3.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=Cartesian3.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=Cartesian3.normalize(Cartesian3.negate(i.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=Matrix3.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const n=i.color;let r=Cartesian3.fromElements(n.red,n.green,n.blue,this._lightColorHdr);r=Cartesian3.multiplyByScalar(r,i.intensity,r);const o=Cartesian3.maximumComponent(r);o>1?Cartesian3.divideByScalar(r,o,this._lightColor):Cartesian3.clone(r,this._lightColor);const a=e.brdfLutGenerator,s=defined(a)?a.colorTexture:void 0;this._brdfLut=s,this._environmentMap=defaultValue(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=defaultValue(e.sphericalHarmonicCoefficients,EMPTY_ARRAY),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,defined(this._specularEnvironmentMaps)&&Cartesian2.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=Transforms.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;const c=t.frustum.fov,l=this._viewport;let u;u=defined(c)?l.height>l.width?2*Math.tan(.5*c)/l.height:2*Math.tan(.5*c)/l.width:1/Math.max(l.width,l.height),this._geometricToleranceOverMeter=u*e.maximumScreenSpaceError,Color.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};const cameraPositionMC=new Cartesian3;function cleanEncodedCameraPositionMC(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,Matrix4.multiplyByPoint(e.inverseModel,e._cameraPosition,cameraPositionMC),EncodedCartesian3.fromCartesian(cameraPositionMC,e._encodedCameraPositionMC))}const view2Dto3DPScratch=new Cartesian3,view2Dto3DRScratch=new Cartesian3,view2Dto3DUScratch=new Cartesian3,view2Dto3DDScratch=new Cartesian3,view2Dto3DCartographicScratch=new Cartographic,view2Dto3DCartesian3Scratch=new Cartesian3,view2Dto3DMatrix4Scratch=new Matrix4;function view2Dto3D(e,t,i,n,r,o,a,s){const c=view2Dto3DPScratch;c.x=e.y,c.y=e.z,c.z=e.x;const l=view2Dto3DRScratch;l.x=i.y,l.y=i.z,l.z=i.x;const u=view2Dto3DUScratch;u.x=n.y,u.y=n.z,u.z=n.x;const d=view2Dto3DDScratch;d.x=t.y,d.y=t.z,d.z=t.x,o===SceneMode$1.SCENE2D&&(c.z=.5*r);const h=a.unproject(c,view2Dto3DCartographicScratch);h.longitude=CesiumMath.clamp(h.longitude,-Math.PI,Math.PI),h.latitude=CesiumMath.clamp(h.latitude,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO);const p=a.ellipsoid,f=p.cartographicToCartesian(h,view2Dto3DCartesian3Scratch),m=Transforms.eastNorthUpToFixedFrame(f,p,view2Dto3DMatrix4Scratch);return Matrix4.multiplyByPointAsVector(m,l,l),Matrix4.multiplyByPointAsVector(m,u,u),Matrix4.multiplyByPointAsVector(m,d,d),defined(s)||(s=new Matrix4),s[0]=l.x,s[1]=u.x,s[2]=-d.x,s[3]=0,s[4]=l.y,s[5]=u.y,s[6]=-d.y,s[7]=0,s[8]=l.z,s[9]=u.z,s[10]=-d.z,s[11]=0,s[12]=-Cartesian3.dot(l,f),s[13]=-Cartesian3.dot(u,f),s[14]=Cartesian3.dot(d,f),s[15]=1,s}function updateView3D(e){e._view3DDirty&&(e._mode===SceneMode$1.SCENE3D?Matrix4.clone(e._view,e._view3D):view2Dto3D(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),Matrix4.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function updateInverseView3D(e){e._inverseView3DDirty&&(Matrix4.inverseTransformation(e.view3D,e._inverseView3D),Matrix4.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function errorToString(e,t){let i="WebGL Error: ";switch(t){case e.INVALID_ENUM:i+="INVALID_ENUM";break;case e.INVALID_VALUE:i+="INVALID_VALUE";break;case e.INVALID_OPERATION:i+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:i+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:i+="CONTEXT_LOST_WEBGL lost";break;default:i+=`Unknown (${t})`}return i}function createErrorMessage(e,t,i,n){let r=`${errorToString(e,n)}: ${t.name}(`;for(let e=0;e<i.length;++e)0!==e&&(r+=", "),r+=i[e];return r+=");",r}function throwOnError(e,t,i){const n=e.getError();if(n!==e.NO_ERROR)throw new RuntimeError(createErrorMessage(e,t,i,n))}function makeGetterSetter(e,t,i){return{get:function(){const n=e[t];return i(e,`get: ${t}`,n),e[t]},set:function(n){e[t]=n,i(e,`set: ${t}`,n)}}}function wrapGL(e,t){if(!defined(t))return e;function i(i){return function(){const n=i.apply(e,arguments);return t(e,i,arguments),n}}const n={};for(const r in e){const o=e[r];o instanceof Function?n[r]=i(o):Object.defineProperty(n,r,makeGetterSetter(e,r,t))}return n}function getExtension(e,t){const i=t.length;for(let n=0;n<i;++n){const i=e.getExtension(t[n]);if(i)return i}}function Context(e,t){if("undefined"==typeof WebGLRenderingContext)throw new RuntimeError("The browser does not support WebGL. Visit http://get.webgl.org.");this._canvas=e,(t=defaultValue(t=clone$1(t,!0),{})).allowTextureFilterAnisotropic=defaultValue(t.allowTextureFilterAnisotropic,!0);const i=defaultValue(t.webgl,{});i.alpha=defaultValue(i.alpha,!1),i.stencil=defaultValue(i.stencil,!0);const n=defaultValue(t.requestWebgl2,!1)&&"undefined"!=typeof WebGL2RenderingContext;let r,o=!1;const a=t.getWebGLStub;if(defined(a))r=a(e,i);else if(n&&(r=e.getContext("webgl2",i)||e.getContext("experimental-webgl2",i)||void 0,defined(r)&&(o=!0)),defined(r)||(r=e.getContext("webgl",i)||e.getContext("experimental-webgl",i)||void 0),!defined(r))throw new RuntimeError("The browser supports WebGL, but initialization failed.");this._originalGLContext=r,this._gl=r,this._webgl2=o,this._id=createGuid(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new ShaderCache(this),this._textureCache=new TextureCache;const s=r;this._stencilBits=s.getParameter(s.STENCIL_BITS),ContextLimits._maximumCombinedTextureImageUnits=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ContextLimits._maximumCubeMapSize=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),ContextLimits._maximumFragmentUniformVectors=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),ContextLimits._maximumTextureImageUnits=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumRenderbufferSize=s.getParameter(s.MAX_RENDERBUFFER_SIZE),ContextLimits._maximumTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),ContextLimits._maximumVaryingVectors=s.getParameter(s.MAX_VARYING_VECTORS),ContextLimits._maximumVertexAttributes=s.getParameter(s.MAX_VERTEX_ATTRIBS),ContextLimits._maximumVertexTextureImageUnits=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumVertexUniformVectors=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),ContextLimits._maximumSamples=this._webgl2?s.getParameter(s.MAX_SAMPLES):0;const c=s.getParameter(s.ALIASED_LINE_WIDTH_RANGE);ContextLimits._minimumAliasedLineWidth=c[0],ContextLimits._maximumAliasedLineWidth=c[1];const l=s.getParameter(s.ALIASED_POINT_SIZE_RANGE);ContextLimits._minimumAliasedPointSize=l[0],ContextLimits._maximumAliasedPointSize=l[1];const u=s.getParameter(s.MAX_VIEWPORT_DIMS);ContextLimits._maximumViewportWidth=u[0],ContextLimits._maximumViewportHeight=u[1];const d=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);ContextLimits._highpFloatSupported=0!==d.precision;const h=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_INT);ContextLimits._highpIntSupported=0!==h.rangeMax,this._antialias=s.getContextAttributes().antialias,this._standardDerivatives=!!getExtension(s,["OES_standard_derivatives"]),this._blendMinmax=!!getExtension(s,["EXT_blend_minmax"]),this._elementIndexUint=!!getExtension(s,["OES_element_index_uint"]),this._depthTexture=!!getExtension(s,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!getExtension(s,["EXT_frag_depth"]),this._debugShaders=getExtension(s,["WEBGL_debug_shaders"]),this._textureFloat=!!getExtension(s,["OES_texture_float"]),this._textureHalfFloat=!!getExtension(s,["OES_texture_half_float"]),this._textureFloatLinear=!!getExtension(s,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!getExtension(s,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!getExtension(s,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!getExtension(s,["EXT_float_blend"]),this._colorBufferHalfFloat=!!getExtension(s,["EXT_color_buffer_half_float"]),this._s3tc=!!getExtension(s,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!getExtension(s,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!getExtension(s,["WEBGL_compressed_texture_astc"]),this._etc=!!getExtension(s,["WEBG_compressed_texture_etc"]),this._etc1=!!getExtension(s,["WEBGL_compressed_texture_etc1"]),this._bc7=!!getExtension(s,["EXT_texture_compression_bptc"]),loadKTX2.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);const p=t.allowTextureFilterAnisotropic?getExtension(s,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;let f,m,g,_,y,C,T,S,v,A;if(this._textureFilterAnisotropic=p,ContextLimits._maximumTextureFilterAnisotropy=defined(p)?s.getParameter(p.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1,o){const e=this;f=function(){return e._gl.createVertexArray()},m=function(t){e._gl.bindVertexArray(t)},g=function(t){e._gl.deleteVertexArray(t)},_=function(e,t,i,n,r){s.drawElementsInstanced(e,t,i,n,r)},y=function(e,t,i,n){s.drawArraysInstanced(e,t,i,n)},C=function(e,t){s.vertexAttribDivisor(e,t)},T=function(e){s.drawBuffers(e)}}else S=getExtension(s,["OES_vertex_array_object"]),defined(S)&&(f=function(){return S.createVertexArrayOES()},m=function(e){S.bindVertexArrayOES(e)},g=function(e){S.deleteVertexArrayOES(e)}),v=getExtension(s,["ANGLE_instanced_arrays"]),defined(v)&&(_=function(e,t,i,n,r){v.drawElementsInstancedANGLE(e,t,i,n,r)},y=function(e,t,i,n){v.drawArraysInstancedANGLE(e,t,i,n)},C=function(e,t){v.vertexAttribDivisorANGLE(e,t)}),A=getExtension(s,["WEBGL_draw_buffers"]),defined(A)&&(T=function(e){A.drawBuffersWEBGL(e)});this.glCreateVertexArray=f,this.glBindVertexArray=m,this.glDeleteVertexArray=g,this.glDrawElementsInstanced=_,this.glDrawArraysInstanced=y,this.glVertexAttribDivisor=C,this.glDrawBuffers=T,this._vertexArrayObject=!!S,this._instancedArrays=!!v,this._drawBuffers=!!A,ContextLimits._maximumDrawBuffers=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_DRAW_BUFFERS):1,ContextLimits._maximumColorAttachments=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new Color(0,0,0,0),this._clearDepth=1,this._clearStencil=0;const E=new UniformState,b=new PassState(this),x=RenderState.fromCache();this._defaultPassState=b,this._defaultRenderState=x,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=E,this._currentRenderState=x,this._currentPassState=b,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let e=0;e<ContextLimits._maximumVertexAttributes;e++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options=t,this.cache={},RenderState.apply(s,x,b)}const defaultFramebufferMarker={};function applyRenderState(e,t,i,n){const r=e._currentRenderState,o=e._currentPassState;e._currentRenderState=t,e._currentPassState=i,RenderState.partialApply(e._gl,r,t,o,i,n)}let scratchBackBufferArray;function bindFramebuffer(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let i=scratchBackBufferArray;if(defined(t))t._bind(),i=t._getActiveColorAttachments();else{const t=e._gl;t.bindFramebuffer(t.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(i)}}Object.defineProperties(Context.prototype,{id:{get:function(){return this._id}},webgl2:{get:function(){return this._webgl2}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},textureCache:{get:function(){return this._textureCache}},uniformState:{get:function(){return this._us}},stencilBits:{get:function(){return this._stencilBits}},stencilBuffer:{get:function(){return this._stencilBits>=8}},antialias:{get:function(){return this._antialias}},msaa:{get:function(){return this._webgl2}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},floatBlend:{get:function(){return this._floatBlend}},blendMinmax:{get:function(){return this._blendMinmax||this._webgl2}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture||this._webgl2}},floatingPointTexture:{get:function(){return this._webgl2||this._textureFloat}},halfFloatingPointTexture:{get:function(){return this._webgl2||this._textureHalfFloat}},textureFloatLinear:{get:function(){return this._textureFloatLinear}},textureHalfFloatLinear:{get:function(){return this._webgl2&&this._textureFloatLinear||!this._webgl2&&this._textureHalfFloatLinear}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},s3tc:{get:function(){return this._s3tc}},pvrtc:{get:function(){return this._pvrtc}},astc:{get:function(){return this._astc}},etc:{get:function(){return this._etc}},etc1:{get:function(){return this._etc1}},bc7:{get:function(){return this._bc7}},supportsBasis:{get:function(){return this._s3tc||this._pvrtc||this._astc||this._etc||this._etc1||this._bc7}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth||this._webgl2}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},colorBufferFloat:{get:function(){return this._colorBufferFloat}},colorBufferHalfFloat:{get:function(){return this._webgl2&&this._colorBufferFloat||!this._webgl2&&this._colorBufferHalfFloat}},drawBuffers:{get:function(){return this._drawBuffers||this._webgl2}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=wrapGL(this._originalGLContext,e?throwOnError:void 0)}},defaultTexture:{get:function(){return void 0===this._defaultTexture&&(this._defaultTexture=new Texture({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return void 0===this._defaultEmissiveTexture&&(this._defaultEmissiveTexture=new Texture({context:this,pixelFormat:PixelFormat$1.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return void 0===this._defaultNormalTexture&&(this._defaultNormalTexture=new Texture({context:this,pixelFormat:PixelFormat$1.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(void 0===this._defaultCubeMap){const e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new CubeMap({context:this,source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e},flipY:!1})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return defaultFramebufferMarker}}}),"undefined"!=typeof WebGLRenderingContext&&(scratchBackBufferArray=[WebGLConstants$1.BACK]);const defaultClearCommand=new ClearCommand;function beginDraw(e,t,i,n,r){bindFramebuffer(e,t),applyRenderState(e,r,i,!1),n._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,n.maximumTextureUnitIndex)}function continueDraw(e,t,i,n){const r=t._primitiveType,o=t._vertexArray;let a=t._offset,s=t._count;const c=t.instanceCount;e._us.model=defaultValue(t._modelMatrix,Matrix4.IDENTITY),i._setUniforms(n,e._us,e.validateShaderProgram),o._bind();const l=o.indexBuffer;defined(l)?(a*=l.bytesPerIndex,s=defaultValue(s,l.numberOfIndices),0===c?e._gl.drawElements(r,s,l.indexDatatype,a):e.glDrawElementsInstanced(r,s,l.indexDatatype,a,c)):(s=defaultValue(s,o.numberOfVertices),0===c?e._gl.drawArrays(r,a,s):e.glDrawArraysInstanced(r,a,s,c)),o._unBind()}Context.prototype.clear=function(e,t){e=defaultValue(e,defaultClearCommand),t=defaultValue(t,this._defaultPassState);const i=this._gl;let n=0;const r=e.color,o=e.depth,a=e.stencil;defined(r)&&(Color.equals(this._clearColor,r)||(Color.clone(r,this._clearColor),i.clearColor(r.red,r.green,r.blue,r.alpha)),n|=i.COLOR_BUFFER_BIT),defined(o)&&(o!==this._clearDepth&&(this._clearDepth=o,i.clearDepth(o)),n|=i.DEPTH_BUFFER_BIT),defined(a)&&(a!==this._clearStencil&&(this._clearStencil=a,i.clearStencil(a)),n|=i.STENCIL_BUFFER_BIT);applyRenderState(this,defaultValue(e.renderState,this._defaultRenderState),t,!0);bindFramebuffer(this,defaultValue(e.framebuffer,t.framebuffer)),i.clear(n)},Context.prototype.draw=function(e,t,i,n){t=defaultValue(t,this._defaultPassState);const r=defaultValue(e._framebuffer,t.framebuffer),o=defaultValue(e._renderState,this._defaultRenderState);i=defaultValue(i,e._shaderProgram),n=defaultValue(n,e._uniformMap),beginDraw(this,r,t,i,o),continueDraw(this,e,i,n)},Context.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=scratchBackBufferArray;this.drawBuffers&&this.glDrawBuffers(t);const i=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(let t=0;t<i;++t)e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},Context.prototype.readPixels=function(e){const t=this._gl;e=defaultValue(e,defaultValue.EMPTY_OBJECT);const i=Math.max(defaultValue(e.x,0),0),n=Math.max(defaultValue(e.y,0),0),r=defaultValue(e.width,t.drawingBufferWidth),o=defaultValue(e.height,t.drawingBufferHeight),a=e.framebuffer;let s=PixelDatatype$1.UNSIGNED_BYTE;defined(a)&&a.numberOfColorAttachments>0&&(s=a.getColorTexture(0).pixelDatatype);const c=PixelFormat$1.createTypedArray(PixelFormat$1.RGBA,s,r,o);return bindFramebuffer(this,a),t.readPixels(i,n,r,o,PixelFormat$1.RGBA,PixelDatatype$1.toWebGLConstant(s,this),c),c};const viewportQuadAttributeLocations={position:0,textureCoordinates:1};function PickId(e,t,i){this._pickObjects=e,this.key=t,this.color=i}function loadCubeMap(e,t,i){const n={flipY:!0,skipColorSpaceConversion:i,preferImageBitmap:!0},r=[Resource.createIfNeeded(t.positiveX).fetchImage(n),Resource.createIfNeeded(t.negativeX).fetchImage(n),Resource.createIfNeeded(t.positiveY).fetchImage(n),Resource.createIfNeeded(t.negativeY).fetchImage(n),Resource.createIfNeeded(t.positiveZ).fetchImage(n),Resource.createIfNeeded(t.negativeZ).fetchImage(n)];return Promise.all(r).then((function(t){return new CubeMap({context:e,source:{positiveX:t[0],negativeX:t[1],positiveY:t[2],negativeY:t[3],positiveZ:t[4],negativeZ:t[5]}})}))}function DiscardMissingTileImagePolicy(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;const t=Resource.createIfNeeded(e.missingImageUrl),i=this;t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then((function(t){defined(t.blob)&&(i._missingImageByteLength=t.blob.size);let n=getImagePixels(t);if(e.disableCheckIfAllPixelsAreTransparent){let i=!0;const r=t.width,o=e.pixelsToCheck;for(let e=0,t=o.length;i&&e<t;++e){const t=o[e];n[4*t.x+t.y*r+3]>0&&(i=!1)}i&&(n=void 0)}i._missingImagePixels=n,i._isReady=!0})).catch((function(){i._missingImagePixels=void 0,i._isReady=!0}))}function ImageryLayerFeatureInfo(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}function ImageryProvider(){this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,DeveloperError.throwInstantiationError()}Context.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!defined(e)){const t=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:PrimitiveType$1.TRIANGLES});e=VertexArray.fromGeometry({context:this,geometry:t,attributeLocations:viewportQuadAttributeLocations,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e},Context.prototype.createViewportQuadCommand=function(e,t){return t=defaultValue(t,defaultValue.EMPTY_OBJECT),new DrawCommand({vertexArray:this.getViewportQuadVertexArray(),primitiveType:PrimitiveType$1.TRIANGLES,renderState:t.renderState,shaderProgram:ShaderProgram.fromCache({context:this,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:e,attributeLocations:viewportQuadAttributeLocations}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})},Context.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]},Object.defineProperties(PickId.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),PickId.prototype.destroy=function(){delete this._pickObjects[this.key]},Context.prototype.createPickId=function(e){++this._nextPickColor[0];const t=this._nextPickColor[0];if(0===t)throw new RuntimeError("Out of unique Pick IDs.");return this._pickObjects[t]=e,new PickId(this._pickObjects,t,Color.fromRgba(t))},Context.prototype.isDestroyed=function(){return!1},Context.prototype.destroy=function(){const e=this.cache;for(const t in e)if(e.hasOwnProperty(t)){const i=e[t];defined(i.destroy)&&i.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultEmissiveTexture=this._defaultEmissiveTexture&&this._defaultEmissiveTexture.destroy(),this._defaultNormalTexture=this._defaultNormalTexture&&this._defaultNormalTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),destroyObject(this)},DiscardMissingTileImagePolicy.prototype.isReady=function(){return this._isReady},DiscardMissingTileImagePolicy.prototype.shouldDiscardImage=function(e){const t=this._pixelsToCheck,i=this._missingImagePixels;if(!defined(i))return!1;if(defined(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;const n=getImagePixels(e),r=e.width;for(let e=0,o=t.length;e<o;++e){const o=t[e],a=4*o.x+o.y*r;for(let e=0;e<4;++e){const t=a+e;if(n[t]!==i[t])return!1}}return!0},ImageryLayerFeatureInfo.prototype.configureNameFromProperties=function(e){let t,i=10;for(const n in e)if(e.hasOwnProperty(n)&&e[n]){const e=n.toLowerCase();i>1&&"name"===e?(i=1,t=n):i>2&&"title"===e?(i=2,t=n):i>3&&/name/i.test(n)?(i=3,t=n):i>4&&/title/i.test(n)&&(i=4,t=n)}defined(t)&&(this.name=e[t])},ImageryLayerFeatureInfo.prototype.configureDescriptionFromProperties=function(e){this.description=function e(t){let i='<table class="cesium-infoBox-defaultTable">';for(const n in t)if(t.hasOwnProperty(n)){const r=t[n];defined(r)&&(i+="object"==typeof r?`<tr><td>${n}</td><td>${e(r)}</td></tr>`:`<tr><td>${n}</td><td>${r}</td></tr>`)}return i+="</table>",i}(e)},Object.defineProperties(ImageryProvider.prototype,{ready:{get:DeveloperError.throwInstantiationError},readyPromise:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},tileWidth:{get:DeveloperError.throwInstantiationError},tileHeight:{get:DeveloperError.throwInstantiationError},maximumLevel:{get:DeveloperError.throwInstantiationError},minimumLevel:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},tileDiscardPolicy:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},credit:{get:DeveloperError.throwInstantiationError},proxy:{get:DeveloperError.throwInstantiationError},hasAlphaChannel:{get:DeveloperError.throwInstantiationError}}),ImageryProvider.prototype.getTileCredits=function(e,t,i){DeveloperError.throwInstantiationError()},ImageryProvider.prototype.requestImage=function(e,t,i,n){DeveloperError.throwInstantiationError()},ImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){DeveloperError.throwInstantiationError()};const ktx2Regex=/\.ktx2$/i;function ArcGisMapServerImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=Resource.createIfNeeded(e.url);t.appendForwardSlash(),defined(e.token)&&t.setQueryParameters({token:e.token}),this._resource=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=defaultValue(e.tilingScheme,new GeographicTilingScheme({ellipsoid:e.ellipsoid})),this._useTiles=defaultValue(e.usePreCachedTilesIfAvailable,!0),this._rectangle=defaultValue(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers;let i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this.enablePickFeatures=defaultValue(e.enablePickFeatures,!0),this._errorEvent=new Event,this._ready=!1,this._readyPromise=defer();const n=this;let r;function o(){n._resource.getDerivedResource({queryParameters:{f:"json"}}).fetchJsonp().then((function(t){!function(t){const i=t.tileInfo;if(defined(i)){if(n._tileWidth=i.rows,n._tileHeight=i.cols,102100===i.spatialReference.wkid||102113===i.spatialReference.wkid)n._tilingScheme=new WebMercatorTilingScheme({ellipsoid:e.ellipsoid});else if(4326===t.tileInfo.spatialReference.wkid)n._tilingScheme=new GeographicTilingScheme({ellipsoid:e.ellipsoid});else{if(4490!==t.fullExtent.spatialReference.wkid){const e=`Tile spatial reference WKID ${t.tileInfo.spatialReference.wkid} is not supported.`;return r=TileProviderError.handleError(r,n,n._errorEvent,e,void 0,void 0,void 0,o),void(r.retry||n._readyPromise.reject(new RuntimeError(e)))}n._tilingScheme=new GeographicTilingScheme({ellipsoid:e.ellipsoid,tileInfo:t.tileInfo})}if(n._maximumLevel=t.tileInfo.lods.length-1,defined(t.fullExtent)){if(defined(t.fullExtent.spatialReference)&&defined(t.fullExtent.spatialReference.wkid))if(102100===t.fullExtent.spatialReference.wkid||102113===t.fullExtent.spatialReference.wkid){const e=new WebMercatorProjection,i=t.fullExtent,r=e.unproject(new Cartesian3(Math.max(i.xmin,-n._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(i.ymin,-n._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),o=e.unproject(new Cartesian3(Math.min(i.xmax,n._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(i.ymax,n._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));n._rectangle=new Rectangle(r.longitude,r.latitude,o.longitude,o.latitude)}else if(4326===t.fullExtent.spatialReference.wkid)n._rectangle=Rectangle.fromDegrees(t.fullExtent.xmin,t.fullExtent.ymin,t.fullExtent.xmax,t.fullExtent.ymax);else{if(4490!==t.fullExtent.spatialReference.wkid){const e=`fullExtent.spatialReference WKID ${t.fullExtent.spatialReference.wkid} is not supported.`;return r=TileProviderError.handleError(r,n,n._errorEvent,e,void 0,void 0,void 0,o),void(r.retry||n._readyPromise.reject(new RuntimeError(e)))}n._rectangle=Rectangle.fromDegrees(t.fullExtent.xmin,t.fullExtent.ymin,t.fullExtent.xmax,t.fullExtent.ymax)}}else n._rectangle=n._tilingScheme.rectangle;defined(n._tileDiscardPolicy)||(n._tileDiscardPolicy=new DiscardMissingTileImagePolicy({missingImageUrl:buildImageResource$4(n,0,0,n._maximumLevel).url,pixelsToCheck:[new Cartesian2(0,0),new Cartesian2(200,20),new Cartesian2(20,200),new Cartesian2(80,110),new Cartesian2(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),n._useTiles=!0}else n._useTiles=!1;defined(t.copyrightText)&&t.copyrightText.length>0&&(n._credit=new Credit(t.copyrightText)),n._ready=!0,n._readyPromise.resolve(!0),TileProviderError.handleSuccess(r)}(t)})).catch((function(e){!function(e){const t=`An error occurred while accessing ${n._resource.url}.`;r=TileProviderError.handleError(r,n,n._errorEvent,t,void 0,void 0,void 0,o),n._readyPromise.reject(new RuntimeError(t))}()}))}this._useTiles?o():(this._ready=!0,this._readyPromise.resolve(!0))}function buildImageResource$4(e,t,i,n,r){let o;if(e._useTiles)o=e._resource.getDerivedResource({url:`tile/${n}/${i}/${t}`,request:r});else{const a=e._tilingScheme.tileXYToNativeRectangle(t,i,n),s={bbox:`${a.west},${a.south},${a.east},${a.north}`,size:`${e._tileWidth},${e._tileHeight}`,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof GeographicProjection?(s.bboxSR=4326,s.imageSR=4326):(s.bboxSR=3857,s.imageSR=3857),e.layers&&(s.layers=`show:${e.layers}`),o=e._resource.getDerivedResource({url:"export",request:r,queryParameters:s})}return o}function AutoExposure(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=new FramebufferManager,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new Cartesian2,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}function destroyFramebuffers$3(e){const t=e._framebuffers;if(!defined(t))return;const i=t.length;for(let e=0;e<i;++e)t[e].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function createFramebuffers$1(e,t){destroyFramebuffers$3(e);let i=e._width,n=e._height;const r=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT,o=Math.ceil(Math.log(Math.max(i,n))/Math.log(3)),a=new Array(o);for(let e=0;e<o;++e)i=Math.max(Math.ceil(i/3),1),n=Math.max(Math.ceil(n/3),1),a[e]=new FramebufferManager,a[e].update(t,i,n,1,r);const s=a[o-1].getColorTexture(0);e._previousLuminance.update(t,s.width,s.height,1,r),e._framebuffers=a}function destroyCommands(e){const t=e._commands;if(!defined(t))return;const i=t.length;for(let e=0;e<i;++e)t[e].shaderProgram.destroy();e._commands=void 0}function createUniformMap$1(e,t){let i;if(0===t)i={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{const n=e._framebuffers[t-1].getColorTexture(0);i={colorTexture:function(){return n},colorTextureDimensions:function(){return n.dimensions}}}return i.minMaxLuminance=function(){return e._minMaxLuminance},i.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},i}function getShaderSource(e,t){let i="uniform sampler2D colorTexture; \nvarying vec2 v_textureCoordinates; \nfloat sampleTexture(vec2 offset) { \n";return i+=0===e?" vec4 color = texture2D(colorTexture, v_textureCoordinates + offset); \n return czm_luminance(color.rgb); \n":" return texture2D(colorTexture, v_textureCoordinates + offset).r; \n",i+="}\n\n",i+="uniform vec2 colorTextureDimensions; \nuniform vec2 minMaxLuminance; \nuniform sampler2D previousLuminance; \nvoid main() { \n float color = 0.0; \n float xStep = 1.0 / colorTextureDimensions.x; \n float yStep = 1.0 / colorTextureDimensions.y; \n int count = 0; \n for (int i = 0; i < 3; ++i) { \n for (int j = 0; j < 3; ++j) { \n vec2 offset; \n offset.x = -xStep + float(i) * xStep; \n offset.y = -yStep + float(j) * yStep; \n if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) { \n continue; \n } \n color += sampleTexture(offset); \n ++count; \n } \n } \n if (count > 0) { \n color /= float(count); \n } \n",e===t-1&&(i+=" float previous = texture2D(previousLuminance, vec2(0.5)).r; \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n color = previous + (color - previous) / (60.0 * 1.5); \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n"),i+=" gl_FragColor = vec4(color); \n} \n",i}function createCommands(e,t){destroyCommands(e);const i=e._framebuffers,n=i.length,r=new Array(n);for(let o=0;o<n;++o)r[o]=t.createViewportQuadCommand(getShaderSource(o,n),{framebuffer:i[o].framebuffer,uniformMap:createUniformMap$1(e,o)});e._commands=r}ImageryProvider.loadImage=function(e,t){if(t._queryParameters&&t._queryParameters.srs&&t._queryParameters.srs.indexOf("EPSG")>=0&&"EPSG:4326"!=t._queryParameters.srs&&t._templateValues&&null!=t._templateValues.eastProjected&&null!=t._templateValues.northProjected&&null!=t._templateValues.southProjected&&null!=t._templateValues.westProjected){let e=[t._templateValues.westProjected+1e-7,t._templateValues.southProjected+1e-7],a=[t._templateValues.eastProjected-1e-7,t._templateValues.northProjected-1e-7];var i=t._queryParameters.srs,n="EPSG:4326",r=proj4(n,i,e),o=proj4(n,i,a);!r||isNaN(r[0])||isNaN(r[1])||(t._templateValues.westProjected=r[0],t._templateValues.southProjected=r[1]),!o||isNaN(o[0])||isNaN(o[1])||(t._templateValues.eastProjected=o[0],t._templateValues.northProjected=o[1])}const a=Resource.createIfNeeded(t);return ktx2Regex.test(a.url)?loadKTX2(a):defined(e)&&defined(e.tileDiscardPolicy)?a.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):a.fetchImage({preferImageBitmap:!0,flipY:!0})},Object.defineProperties(ArcGisMapServerImageryProvider.prototype,{url:{get:function(){return this._resource._url}},token:{get:function(){return this._resource.queryParameters.token}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),ArcGisMapServerImageryProvider.prototype.getTileCredits=function(e,t,i){},ArcGisMapServerImageryProvider.prototype.requestImage=function(e,t,i,n){return ImageryProvider.loadImage(this,buildImageResource$4(this,e,t,i,n))},ArcGisMapServerImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){if(!this.enablePickFeatures)return;const o=this._tilingScheme.tileXYToNativeRectangle(e,t,i);let a,s,c;if(this._tilingScheme.projection instanceof GeographicProjection)a=CesiumMath.toDegrees(n),s=CesiumMath.toDegrees(r),c="4326";else{const e=this._tilingScheme.projection.project(new Cartographic(n,r,0));a=e.x,s=e.y,c="3857"}let l="visible";defined(this._layers)&&(l+=`:${this._layers}`);const u={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:`${a},${s}`,mapExtent:`${o.west},${o.south},${o.east},${o.north}`,imageDisplay:`${this._tileWidth},${this._tileHeight},96`,sr:c,layers:l};return this._resource.getDerivedResource({url:"identify",queryParameters:u}).fetchJson().then((function(e){const t=[],i=e.results;if(!defined(i))return t;for(let e=0;e<i.length;++e){const n=i[e],r=new ImageryLayerFeatureInfo;if(r.data=n,r.name=n.value,r.properties=n.attributes,r.configureDescriptionFromProperties(n.attributes),"esriGeometryPoint"===n.geometryType&&n.geometry){const e=n.geometry.spatialReference&&n.geometry.spatialReference.wkid?n.geometry.spatialReference.wkid:4326;if(4326===e||4283===e)r.position=Cartographic.fromDegrees(n.geometry.x,n.geometry.y,n.geometry.z);else if(102100===e||900913===e||3857===e){const e=new WebMercatorProjection;r.position=e.unproject(new Cartesian3(n.geometry.x,n.geometry.y,n.geometry.z))}}t.push(r)}return t}))},Object.defineProperties(AutoExposure.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){const e=this._framebuffers;if(defined(e))return e[e.length-1].getColorTexture(0)}}}),AutoExposure.prototype.clear=function(e){const t=this._framebuffers;if(!defined(t))return;let i=this._clearCommand;defined(i)||(i=this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),framebuffer:void 0}));const n=t.length;for(let r=0;r<n;++r)t[r].clear(e,i)},AutoExposure.prototype.update=function(e){const t=e.drawingBufferWidth,i=e.drawingBufferHeight;t===this._width&&i===this._height||(this._width=t,this._height=i,createFramebuffers$1(this,e),createCommands(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;const n=this._framebuffers,r=n[n.length-1];n[n.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=r},AutoExposure.prototype.execute=function(e,t){this._colorTexture=t;const i=this._commands;if(!defined(i))return;const n=i.length;for(let t=0;t<n;++t)i[t].execute(e)},AutoExposure.prototype.isDestroyed=function(){return!1},AutoExposure.prototype.destroy=function(){return destroyFramebuffers$3(this),destroyCommands(this),destroyObject(this)};const BingMapsStyle={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",AERIAL_WITH_LABELS_ON_DEMAND:"AerialWithLabelsOnDemand",ROAD:"Road",ROAD_ON_DEMAND:"RoadOnDemand",CANVAS_DARK:"CanvasDark",CANVAS_LIGHT:"CanvasLight",CANVAS_GRAY:"CanvasGray",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"};var BingMapsStyle$1=Object.freeze(BingMapsStyle);function DiscardEmptyTileImagePolicy(e){}let emptyImage;function BingMapsImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).key;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._key=t,this._resource=Resource.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=defaultValue(e.mapStyle,BingMapsStyle$1.AERIAL),this._culture=defaultValue(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new DiscardEmptyTileImagePolicy),this._proxy=e.proxy,this._credit=new Credit(`<a href="http://www.bing.com"><img src="${BingMapsImageryProvider.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new Event,this._ready=!1,this._readyPromise=defer();let i=this._tileProtocol;if(defined(i))i.length>0&&":"===i[i.length-1]&&(i=i.substr(0,i.length-1));else{i="http:"===document.location.protocol?"http":"https"}const n=this._resource.getDerivedResource({url:`REST/v1/Imagery/Metadata/${this._mapStyle}`,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:i}}),r=this;let o;function a(e){if(1!==e.resourceSets.length)return void s();const t=e.resourceSets[0].resources[0];r._tileWidth=t.imageWidth,r._tileHeight=t.imageHeight,r._maximumLevel=t.zoomMax-1,r._imageUrlSubdomains=t.imageUrlSubdomains,r._imageUrlTemplate=t.imageUrl;let i=r._attributionList=t.imageryProviders;i||(i=r._attributionList=[]);for(let e=0,t=i.length;e<t;++e){const t=i[e];if(t.credit instanceof Credit)break;t.credit=new Credit(t.attribution);const n=t.coverageAreas;for(let e=0,i=t.coverageAreas.length;e<i;++e){const t=n[e],i=t.bbox;t.bbox=new Rectangle(CesiumMath.toRadians(i[1]),CesiumMath.toRadians(i[0]),CesiumMath.toRadians(i[3]),CesiumMath.toRadians(i[2]))}}r._ready=!0,r._readyPromise.resolve(!0),TileProviderError.handleSuccess(o)}function s(e){const t=`An error occurred while accessing ${n.url}.`;o=TileProviderError.handleError(o,r,r._errorEvent,t,void 0,void 0,void 0,l),r._readyPromise.reject(new RuntimeError(t))}const c=n.url;function l(){const e=n.fetchJsonp("jsonp");BingMapsImageryProvider._metadataCache[c]=e,e.then(a).catch(s)}const u=BingMapsImageryProvider._metadataCache[c];defined(u)?u.then(a).catch(s):l()}DiscardEmptyTileImagePolicy.prototype.isReady=function(){return!0},DiscardEmptyTileImagePolicy.prototype.shouldDiscardImage=function(e){return DiscardEmptyTileImagePolicy.EMPTY_IMAGE===e},Object.defineProperties(DiscardEmptyTileImagePolicy,{EMPTY_IMAGE:{get:function(){return defined(emptyImage)||(emptyImage=new Image,emptyImage.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),emptyImage}}}),Object.defineProperties(BingMapsImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});const rectangleScratch$2=new Rectangle;function buildImageResource$3(e,t,i,n,r){const o=e._imageUrlTemplate,a=e._imageUrlSubdomains,s=(t+i+n)%a.length;return e._resource.getDerivedResource({url:o,request:r,templateValues:{quadkey:BingMapsImageryProvider.tileXYToQuadKey(t,i,n),subdomain:a[s],culture:e._culture},queryParameters:{n:"z"}})}BingMapsImageryProvider.prototype.getTileCredits=function(e,t,i){const n=this._tilingScheme.tileXYToRectangle(e,t,i,rectangleScratch$2);return getRectangleAttribution(this._attributionList,i,n)},BingMapsImageryProvider.prototype.requestImage=function(e,t,i,n){const r=ImageryProvider.loadImage(this,buildImageResource$3(this,e,t,i,n));if(defined(r))return r.catch((function(e){return defined(e.blob)&&0===e.blob.size?DiscardEmptyTileImagePolicy.EMPTY_IMAGE:Promise.reject(e)}))},BingMapsImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){},BingMapsImageryProvider.tileXYToQuadKey=function(e,t,i){let n="";for(let r=i;r>=0;--r){const i=1<<r;let o=0;0!=(e&i)&&(o|=1),0!=(t&i)&&(o|=2),n+=o}return n},BingMapsImageryProvider.quadKeyToTileXY=function(e){let t=0,i=0;const n=e.length-1;for(let r=n;r>=0;--r){const o=1<<r,a=+e[n-r];0!=(1&a)&&(t|=o),0!=(2&a)&&(i|=o)}return{x:t,y:i,level:n}},BingMapsImageryProvider._logoUrl=void 0,Object.defineProperties(BingMapsImageryProvider,{logoUrl:{get:function(){return defined(BingMapsImageryProvider._logoUrl)||(BingMapsImageryProvider._logoUrl=buildModuleUrl("Assets/Images/bing_maps_credit.png")),BingMapsImageryProvider._logoUrl},set:function(e){BingMapsImageryProvider._logoUrl=e}}});const intersectionScratch=new Rectangle;function getRectangleAttribution(e,t,i){++t;const n=[];for(let r=0,o=e.length;r<o;++r){const o=e[r],a=o.coverageAreas;let s=!1;for(let e=0,n=o.coverageAreas.length;!s&&e<n;++e){const n=a[e];if(t>=n.zoomMin&&t<=n.zoomMax){defined(Rectangle.intersection(i,n.bbox,intersectionScratch))&&(s=!0)}}s&&n.push(o.credit)}return n}BingMapsImageryProvider._metadataCache={};const defaultDimensions=new Cartesian3(1,1,1);function BoxEmitter(e){e=defaultValue(e,defaultDimensions),this._dimensions=Cartesian3.clone(e)}Object.defineProperties(BoxEmitter.prototype,{dimensions:{get:function(){return this._dimensions},set:function(e){Cartesian3.clone(e,this._dimensions)}}});const scratchHalfDim=new Cartesian3;BoxEmitter.prototype.emit=function(e){const t=this._dimensions,i=Cartesian3.multiplyByScalar(t,.5,scratchHalfDim),n=CesiumMath.randomBetween(-i.x,i.x),r=CesiumMath.randomBetween(-i.y,i.y),o=CesiumMath.randomBetween(-i.z,i.z);e.position=Cartesian3.fromElements(n,r,o,e.position),e.velocity=Cartesian3.normalize(e.position,e.velocity)};var BrdfLutGeneratorFS="varying vec2 v_textureCoordinates;\nconst float M_PI = 3.141592653589793;\nfloat vdcRadicalInverse(int i)\n{\nfloat r;\nfloat base = 2.0;\nfloat value = 0.0;\nfloat invBase = 1.0 / base;\nfloat invBi = invBase;\nfor (int x = 0; x < 100; x++)\n{\nif (i <= 0)\n{\nbreak;\n}\nr = mod(float(i), base);\nvalue += r * invBi;\ninvBi *= invBase;\ni = int(float(i) * invBase);\n}\nreturn value;\n}\nvec2 hammersley2D(int i, int N)\n{\nreturn vec2(float(i) / float(N), vdcRadicalInverse(i));\n}\nvec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n{\nfloat a = roughness * roughness;\nfloat phi = 2.0 * M_PI * xi.x;\nfloat cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));\nfloat sinTheta = sqrt(1.0 - cosTheta * cosTheta);\nvec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\nvec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\nvec3 tangentX = normalize(cross(upVector, N));\nvec3 tangentY = cross(N, tangentX);\nreturn tangentX * H.x + tangentY * H.y + N * H.z;\n}\nfloat G1_Smith(float NdotV, float k)\n{\nreturn NdotV / (NdotV * (1.0 - k) + k);\n}\nfloat G_Smith(float roughness, float NdotV, float NdotL)\n{\nfloat k = roughness * roughness / 2.0;\nreturn G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\n}\nvec2 integrateBrdf(float roughness, float NdotV)\n{\nvec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);\nfloat A = 0.0;\nfloat B = 0.0;\nconst int NumSamples = 1024;\nfor (int i = 0; i < NumSamples; i++)\n{\nvec2 xi = hammersley2D(i, NumSamples);\nvec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));\nvec3 L = 2.0 * dot(V, H) * H - V;\nfloat NdotL = clamp(L.z, 0.0, 1.0);\nfloat NdotH = clamp(H.z, 0.0, 1.0);\nfloat VdotH = clamp(dot(V, H), 0.0, 1.0);\nif (NdotL > 0.0)\n{\nfloat G = G_Smith(roughness, NdotV, NdotL);\nfloat G_Vis = G * VdotH / (NdotH * NdotV);\nfloat Fc = pow(1.0 - VdotH, 5.0);\nA += (1.0 - Fc) * G_Vis;\nB += Fc * G_Vis;\n}\n}\nreturn vec2(A, B) / float(NumSamples);\n}\nvoid main()\n{\ngl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n}\n";function BrdfLutGenerator(){this._colorTexture=void 0,this._drawCommand=void 0}function createCommand$1(e,t,i){const n=t.createViewportQuadCommand(BrdfLutGeneratorFS,{framebuffer:i,renderState:RenderState.fromCache({viewport:new BoundingRectangle(0,0,256,256)})});e._drawCommand=n}Object.defineProperties(BrdfLutGenerator.prototype,{colorTexture:{get:function(){return this._colorTexture}}}),BrdfLutGenerator.prototype.update=function(e){if(!defined(this._colorTexture)){const t=e.context,i=new Texture({context:t,width:256,height:256,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST});this._colorTexture=i;const n=new Framebuffer({context:t,colorTextures:[i],destroyAttachments:!1});createCommand$1(this,t,n),this._drawCommand.execute(t),n.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}},BrdfLutGenerator.prototype.isDestroyed=function(){return!1},BrdfLutGenerator.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),destroyObject(this)};const CameraFlightPath={};function getAltitude(e,t,i){let n,r,o;if(e instanceof PerspectiveFrustum){const a=Math.tan(.5*e.fovy);return n=e.near,r=e.near*a,o=e.aspectRatio*r,Math.max(t*n/o,i*n/r)}return e instanceof PerspectiveOffCenterFrustum?(n=e.near,r=e.top,o=e.right,Math.max(t*n/o,i*n/r)):Math.max(t,i)}const scratchCart=new Cartesian3,scratchCart2=new Cartesian3;function createPitchFunction(e,t,i,n){if(defined(n)&&i(.5)>n){const n=i(0),r=i(1),o=i(.5),a=o-n,s=o-r;return function(o){const c=i(o);if(o<=.5){const t=(c-n)/a;return CesiumMath.lerp(e,-CesiumMath.PI_OVER_TWO,t)}const l=(c-r)/s;return CesiumMath.lerp(-CesiumMath.PI_OVER_TWO,t,1-l)}}return function(i){return CesiumMath.lerp(e,t,i)}}function createHeightFunction(e,t,i,n,r){let o=r;const a=Math.max(i,n);if(!defined(o)){const i=e.position,n=t,r=e.up,a=e.right,s=e.frustum,c=Cartesian3.subtract(i,n,scratchCart),l=Cartesian3.magnitude(Cartesian3.multiplyByScalar(r,Cartesian3.dot(c,r),scratchCart2)),u=Cartesian3.magnitude(Cartesian3.multiplyByScalar(a,Cartesian3.dot(c,a),scratchCart2));o=Math.min(.2*getAltitude(s,l,u),1e9)}if(a<o){const e=8,t=1e6,r=-Math.pow((o-i)*t,1/e),a=Math.pow((o-n)*t,1/e);return function(i){const n=i*(a-r)+r;return-Math.pow(n,e)/t+o}}return function(e){return CesiumMath.lerp(i,n,e)}}function adjustAngleForLERP(e,t){return CesiumMath.equalsEpsilon(e,CesiumMath.TWO_PI,CesiumMath.EPSILON11)&&(e=0),t>e+Math.PI?e+=CesiumMath.TWO_PI:t<e-Math.PI&&(e-=CesiumMath.TWO_PI),e}const scratchStart=new Cartesian3;function createUpdateCV(e,t,i,n,r,o,a,s){const c=e.camera,l=Cartesian3.clone(c.position,scratchStart),u=c.pitch,d=adjustAngleForLERP(c.heading,n),h=adjustAngleForLERP(c.roll,o),p=createHeightFunction(c,i,l.z,i.z,a),f=createPitchFunction(u,r,p,s);return function(e){const r=e.time/t;c.setView({orientation:{heading:CesiumMath.lerp(d,n,r),pitch:f(r),roll:CesiumMath.lerp(h,o,r)}}),Cartesian2.lerp(l,i,r,c.position),c.position.z=p(r)}}function useLongestFlight(e,t){e.longitude<t.longitude?e.longitude+=CesiumMath.TWO_PI:t.longitude+=CesiumMath.TWO_PI}function useShortestFlight(e,t){const i=e.longitude-t.longitude;i<-CesiumMath.PI?e.longitude+=CesiumMath.TWO_PI:i>CesiumMath.PI&&(t.longitude+=CesiumMath.TWO_PI)}const scratchStartCart=new Cartographic,scratchEndCart=new Cartographic;function createUpdate3D(e,t,i,n,r,o,a,s,c,l){const u=e.camera,d=e.mapProjection.ellipsoid,h=Cartographic.clone(u.positionCartographic,scratchStartCart),p=u.pitch,f=adjustAngleForLERP(u.heading,n),m=adjustAngleForLERP(u.roll,o),g=d.cartesianToCartographic(i,scratchEndCart);h.longitude=CesiumMath.zeroToTwoPi(h.longitude),g.longitude=CesiumMath.zeroToTwoPi(g.longitude);let _=!1;if(defined(s)){const e=CesiumMath.zeroToTwoPi(s),t=Math.min(h.longitude,g.longitude),i=Math.max(h.longitude,g.longitude),n=e>=t&&e<=i;if(defined(c)){const e=Math.abs(h.longitude-g.longitude),t=CesiumMath.TWO_PI-e;(n?e:t)<(n?t:e)*c&&!n&&(_=!0)}else n||(_=!0)}_?useLongestFlight(h,g):useShortestFlight(h,g);const y=createHeightFunction(u,i,h.height,g.height,a),C=createPitchFunction(p,r,y,l);return function(){const e=h.longitude,i=g.longitude,r=h.latitude,a=g.latitude;return function(s){const c=s.time/t,l=Cartesian3.fromRadians(CesiumMath.lerp(e,i,c),CesiumMath.lerp(r,a,c),y(c),d);u.setView({destination:l,orientation:{heading:CesiumMath.lerp(f,n,c),pitch:C(c),roll:CesiumMath.lerp(m,o,c)}})}}()}function createUpdate2D(e,t,i,n,r,o,a){const s=e.camera,c=Cartesian3.clone(s.position,scratchStart),l=adjustAngleForLERP(s.heading,n),u=s.frustum.right-s.frustum.left,d=createHeightFunction(s,i,u,i.z,a);return function(e){const r=e.time/t;s.setView({orientation:{heading:CesiumMath.lerp(l,n,r)}}),Cartesian2.lerp(c,i,r,s.position);const o=d(r),a=s.frustum,u=a.top/a.right,h=.5*(o-(a.right-a.left));a.right+=h,a.left-=h,a.top=u*a.right,a.bottom=-a.top}}const scratchCartographic$6=new Cartographic,scratchDestination=new Cartesian3;function emptyFlight(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function wrapCallback(e,t){return function(){"function"==typeof t&&t(),e.enableInputs=!0}}CameraFlightPath.createTween=function(e,t){let i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).destination;const n=e.mode;if(n===SceneMode$1.MORPHING)return emptyFlight();const r=defaultValue(t.convert,!0),o=e.mapProjection,a=o.ellipsoid,s=t.maximumHeight,c=t.flyOverLongitude,l=t.flyOverLongitudeWeight,u=t.pitchAdjustHeight;let d=t.easingFunction;r&&n!==SceneMode$1.SCENE3D&&(a.cartesianToCartographic(i,scratchCartographic$6),i=o.project(scratchCartographic$6,scratchDestination));const h=e.camera,p=t.endTransform;defined(p)&&h._setTransform(p);let f=t.duration;defined(f)||(f=Math.ceil(Cartesian3.distance(h.position,i)/1e6)+2,f=Math.min(f,3));const m=defaultValue(t.heading,0),g=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),_=defaultValue(t.roll,0),y=e.screenSpaceCameraController;y.enableInputs=!1;const C=wrapCallback(y,t.complete),T=wrapCallback(y,t.cancel),S=h.frustum;let v=e.mode===SceneMode$1.SCENE2D;if(v=v&&Cartesian2.equalsEpsilon(h.position,i,CesiumMath.EPSILON6),v=v&&CesiumMath.equalsEpsilon(Math.max(S.right-S.left,S.top-S.bottom),i.z,CesiumMath.EPSILON6),v=v||e.mode!==SceneMode$1.SCENE2D&&Cartesian3.equalsEpsilon(i,h.position,CesiumMath.EPSILON10),v=v&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(m),CesiumMath.negativePiToPi(h.heading),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(g),CesiumMath.negativePiToPi(h.pitch),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(_),CesiumMath.negativePiToPi(h.roll),CesiumMath.EPSILON10),v)return emptyFlight(C,T);const A=new Array(4);if(A[SceneMode$1.SCENE2D]=createUpdate2D,A[SceneMode$1.SCENE3D]=createUpdate3D,A[SceneMode$1.COLUMBUS_VIEW]=createUpdateCV,f<=0){return emptyFlight((function(){A[n](e,1,i,m,g,_,s,c,l,u)({time:1}),"function"==typeof C&&C()}),T)}const E=A[n](e,f,i,m,g,_,s,c,l,u);if(!defined(d)){const e=h.positionCartographic.height;d=e>(n===SceneMode$1.SCENE3D?a.cartesianToCartographic(i).height:i.z)&&e>11500?EasingFunction$1.CUBIC_OUT:EasingFunction$1.QUINTIC_IN_OUT}return{duration:f,easingFunction:d,startObject:{time:0},stopObject:{time:f},update:E,complete:C,cancel:T}};const MapMode2D={ROTATE:0,INFINITE_SCROLL:1};var MapMode2D$1=Object.freeze(MapMode2D);function Camera(e){this._scene=e,this._transform=Matrix4.clone(Matrix4.IDENTITY),this._invTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualInvTransform=Matrix4.clone(Matrix4.IDENTITY),this._transformChanged=!1,this.position=new Cartesian3,this._position=new Cartesian3,this._positionWC=new Cartesian3,this._positionCartographic=new Cartographic,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new Cartesian3,this._direction=new Cartesian3,this._directionWC=new Cartesian3,this.up=new Cartesian3,this._up=new Cartesian3,this._upWC=new Cartesian3,this.right=new Cartesian3,this._right=new Cartesian3,this._rightWC=new Cartesian3,this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumZoomFactor=1.5,this._moveStart=new Event,this._moveEnd=new Event,this._changed=new Event,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this.percentageChanged=.5,this._viewMatrix=new Matrix4,this._invViewMatrix=new Matrix4,updateViewMatrix(this),this._mode=SceneMode$1.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO)),this._max2Dfrustum=void 0,rectangleCameraPosition3D(this,Camera.DEFAULT_VIEW_RECTANGLE,this.position,!0);let i=Cartesian3.magnitude(this.position);i+=i*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(this.position,this.position),Cartesian3.multiplyByScalar(this.position,i,this.position)}function updateViewMatrix(e){Matrix4.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),Matrix4.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),Matrix4.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function updateCameraDeltas(e){if(defined(e._oldPositionWC)){e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=Cartesian3.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=Cartesian3.magnitude(t),e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=getTimestamp$1()):e.timeSinceMoved=Math.max(getTimestamp$1()-e._lastMovedTimestamp,0)/1e3}else e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC)}function convertTransformForColumbusView(e){Transforms.basisTo2D(e._projection,e._transform,e._actualTransform)}Camera.TRANSFORM_2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),Camera.TRANSFORM_2D_INVERSE=Matrix4.inverseTransformation(Camera.TRANSFORM_2D,new Matrix4),Camera.DEFAULT_VIEW_RECTANGLE=Rectangle.fromDegrees(-95,-20,-70,90),Camera.DEFAULT_VIEW_FACTOR=.5,Camera.DEFAULT_OFFSET=new HeadingPitchRange(0,-CesiumMath.PI_OVER_FOUR,0),Camera.prototype.canPreloadFlight=function(){return defined(this._currentFlight)&&this._mode!==SceneMode$1.SCENE2D},Camera.prototype._updateCameraChanged=function(){const e=this;if(updateCameraDeltas(e),0===e._changed.numberOfListeners)return;const t=e.percentageChanged,i=e.heading;defined(e._changedHeading)||(e._changedHeading=i);let n=Math.abs(e._changedHeading-i)%CesiumMath.TWO_PI;n=n>CesiumMath.PI?CesiumMath.TWO_PI-n:n;const r=n/Math.PI;if(r>t&&(e._changed.raiseEvent(r),e._changedHeading=i),e._mode===SceneMode$1.SCENE2D){if(!defined(e._changedFrustum))return e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),void(e._changedFrustum=e.frustum.clone());const i=e.position,n=e._changedPosition,r=e.frustum,o=e._changedFrustum,a=i.x+r.left,s=i.x+r.right,c=n.x+o.left,l=n.x+o.right,u=i.y+r.bottom,d=i.y+r.top,h=n.y+o.bottom,p=n.y+o.top,f=Math.max(a,c),m=Math.min(s,l),g=Math.max(u,h),_=Math.min(d,p);let y;if(f>=m||g>=d)y=1;else{let e=o;a<c&&s>l&&u<h&&d>p&&(e=r),y=1-(m-f)*(_-g)/((e.right-e.left)*(e.top-e.bottom))}return void(y>t&&(e._changed.raiseEvent(y),e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum)))}if(!defined(e._changedDirection))return e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),void(e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection));const o=CesiumMath.acosClamped(Cartesian3.dot(e.directionWC,e._changedDirection));let a;a=defined(e.frustum.fovy)?o/(.5*e.frustum.fovy):o;const s=Cartesian3.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(a>t||s>t)&&(e._changed.raiseEvent(Math.max(a,s)),e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection))};const scratchCartographic$5=new Cartographic,scratchCartesian3Projection=new Cartesian3,scratchCartesian3$1=new Cartesian3,scratchCartesian4Origin=new Cartesian4,scratchCartesian4NewOrigin=new Cartesian4,scratchCartesian4NewXAxis=new Cartesian4,scratchCartesian4NewYAxis=new Cartesian4,scratchCartesian4NewZAxis=new Cartesian4;function convertTransformFor2D(e){const t=e._projection,i=t.ellipsoid,n=Matrix4.getColumn(e._transform,3,scratchCartesian4Origin),r=i.cartesianToCartographic(n,scratchCartographic$5),o=t.project(r,scratchCartesian3Projection),a=scratchCartesian4NewOrigin;a.x=o.z,a.y=o.x,a.z=o.y,a.w=1;const s=Cartesian4.clone(Cartesian4.UNIT_X,scratchCartesian4NewZAxis),c=Cartesian4.add(Matrix4.getColumn(e._transform,0,scratchCartesian3$1),n,scratchCartesian3$1);i.cartesianToCartographic(c,r),t.project(r,o);const l=scratchCartesian4NewXAxis;l.x=o.z,l.y=o.x,l.z=o.y,l.w=0,Cartesian3.subtract(l,a,l),l.x=0;const u=scratchCartesian4NewYAxis;if(Cartesian3.magnitudeSquared(l)>CesiumMath.EPSILON10)Cartesian3.cross(s,l,u);else{const s=Cartesian4.add(Matrix4.getColumn(e._transform,1,scratchCartesian3$1),n,scratchCartesian3$1);i.cartesianToCartographic(s,r),t.project(r,o),u.x=o.z,u.y=o.x,u.z=o.y,u.w=0,Cartesian3.subtract(u,a,u),u.x=0,Cartesian3.magnitudeSquared(u)<CesiumMath.EPSILON10&&(Cartesian4.clone(Cartesian4.UNIT_Y,l),Cartesian4.clone(Cartesian4.UNIT_Z,u))}Cartesian3.cross(u,s,l),Cartesian3.normalize(l,l),Cartesian3.cross(s,l,u),Cartesian3.normalize(u,u),Matrix4.setColumn(e._actualTransform,0,l,e._actualTransform),Matrix4.setColumn(e._actualTransform,1,u,e._actualTransform),Matrix4.setColumn(e._actualTransform,2,s,e._actualTransform),Matrix4.setColumn(e._actualTransform,3,a,e._actualTransform)}const scratchCartesian$1=new Cartesian3;function updateMembers(e){const t=e._mode;let i=!1,n=0;t===SceneMode$1.SCENE2D&&(n=e.frustum.right-e.frustum.left,i=n!==e._positionCartographic.height);let r=e._position;const o=!Cartesian3.equals(r,e.position)||i;o&&(r=Cartesian3.clone(e.position,e._position));let a=e._direction;const s=!Cartesian3.equals(a,e.direction);s&&(Cartesian3.normalize(e.direction,e.direction),a=Cartesian3.clone(e.direction,e._direction));let c=e._up;const l=!Cartesian3.equals(c,e.up);l&&(Cartesian3.normalize(e.up,e.up),c=Cartesian3.clone(e.up,e._up));let u=e._right;const d=!Cartesian3.equals(u,e.right);d&&(Cartesian3.normalize(e.right,e.right),u=Cartesian3.clone(e.right,e._right));const h=e._transformChanged||e._modeChanged;e._transformChanged=!1,h&&(Matrix4.inverseTransformation(e._transform,e._invTransform),e._mode===SceneMode$1.COLUMBUS_VIEW||e._mode===SceneMode$1.SCENE2D?Matrix4.equals(Matrix4.IDENTITY,e._transform)?Matrix4.clone(Camera.TRANSFORM_2D,e._actualTransform):e._mode===SceneMode$1.COLUMBUS_VIEW?convertTransformForColumbusView(e):convertTransformFor2D(e):Matrix4.clone(e._transform,e._actualTransform),Matrix4.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const p=e._actualTransform;if(o||h)if(e._positionWC=Matrix4.multiplyByPoint(p,r,e._positionWC),t===SceneMode$1.SCENE3D||t===SceneMode$1.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{const i=scratchCartesian$1;i.x=e._positionWC.y,i.y=e._positionWC.z,i.z=e._positionWC.x,t===SceneMode$1.SCENE2D&&(i.z=n),e._projection.unproject(i,e._positionCartographic)}if(s||l||d){const t=Cartesian3.dot(a,Cartesian3.cross(c,u,scratchCartesian$1));if(Math.abs(1-t)>CesiumMath.EPSILON2){const t=1/Cartesian3.magnitudeSquared(c),i=Cartesian3.dot(c,a)*t,n=Cartesian3.multiplyByScalar(a,i,scratchCartesian$1);c=Cartesian3.normalize(Cartesian3.subtract(c,n,e._up),e._up),Cartesian3.clone(c,e.up),u=Cartesian3.cross(a,c,e._right),Cartesian3.clone(u,e.right)}}(s||h)&&(e._directionWC=Matrix4.multiplyByPointAsVector(p,a,e._directionWC),Cartesian3.normalize(e._directionWC,e._directionWC)),(l||h)&&(e._upWC=Matrix4.multiplyByPointAsVector(p,c,e._upWC),Cartesian3.normalize(e._upWC,e._upWC)),(d||h)&&(e._rightWC=Matrix4.multiplyByPointAsVector(p,u,e._rightWC),Cartesian3.normalize(e._rightWC,e._rightWC)),(o||s||l||d||h)&&updateViewMatrix(e)}function getHeading(e,t){let i;return i=CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)?Math.atan2(t.y,t.x)-CesiumMath.PI_OVER_TWO:Math.atan2(e.y,e.x)-CesiumMath.PI_OVER_TWO,CesiumMath.TWO_PI-CesiumMath.zeroToTwoPi(i)}function getPitch(e){return CesiumMath.PI_OVER_TWO-CesiumMath.acosClamped(e.z)}function getRoll(e,t,i){let n=0;return CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)||(n=Math.atan2(-i.z,t.z),n=CesiumMath.zeroToTwoPi(n+CesiumMath.TWO_PI)),n}const scratchHPRMatrix1=new Matrix4,scratchHPRMatrix2=new Matrix4;Object.defineProperties(Camera.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return updateMembers(this),this._invTransform}},viewMatrix:{get:function(){return updateMembers(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return updateMembers(this),this._invViewMatrix}},positionCartographic:{get:function(){return updateMembers(this),this._positionCartographic}},positionWC:{get:function(){return updateMembers(this),this._positionWC}},directionWC:{get:function(){return updateMembers(this),this._directionWC}},upWC:{get:function(){return updateMembers(this),this._upWC}},rightWC:{get:function(){return updateMembers(this),this._rightWC}},heading:{get:function(){if(this._mode!==SceneMode$1.MORPHING){const e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);const n=getHeading(this.direction,this.up);return this._setTransform(t),n}}},pitch:{get:function(){if(this._mode!==SceneMode$1.MORPHING){const e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);const n=getPitch(this.direction);return this._setTransform(t),n}}},roll:{get:function(){if(this._mode!==SceneMode$1.MORPHING){const e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);const n=getRoll(this.direction,this.up,this.right);return this._setTransform(t),n}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}}),Camera.prototype.update=function(e){let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==SceneMode$1.MORPHING,t=this._mode===SceneMode$1.SCENE2D),t){const e=this._max2Dfrustum=this.frustum.clone(),t=2,i=e.top/e.right;e.right=this._maxCoord.x*t,e.left=-e.right,e.top=i*e.right,e.bottom=-e.top}this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,this.position)};const setTransformPosition=new Cartesian3,setTransformUp=new Cartesian3,setTransformDirection=new Cartesian3;Camera.prototype._setTransform=function(e){const t=Cartesian3.clone(this.positionWC,setTransformPosition),i=Cartesian3.clone(this.upWC,setTransformUp),n=Cartesian3.clone(this.directionWC,setTransformDirection);Matrix4.clone(e,this._transform),this._transformChanged=!0,updateMembers(this);const r=this._actualInvTransform;Matrix4.multiplyByPoint(r,t,this.position),Matrix4.multiplyByPointAsVector(r,n,this.direction),Matrix4.multiplyByPointAsVector(r,i,this.up),Cartesian3.cross(this.direction,this.up,this.right),updateMembers(this)};const scratchAdjustOrthographicFrustumMousePosition=new Cartesian2,scratchPickRay$1=new Ray,scratchRayIntersection$1=new Cartesian3,scratchDepthIntersection$1=new Cartesian3;function calculateOrthographicFrustumWidth(e){if(!Matrix4.equals(Matrix4.IDENTITY,e.transform))return Cartesian3.magnitude(e.position);const t=e._scene,i=t.globe,n=scratchAdjustOrthographicFrustumMousePosition;let r,o,a;if(n.x=t.drawingBufferWidth/2,n.y=t.drawingBufferHeight/2,defined(i)){const o=e.getPickRay(n,scratchPickRay$1);r=i.pickWorldCoordinates(o,t,!0,scratchRayIntersection$1)}if(t.pickPositionSupported&&(o=t.pickPositionWorldCoordinates(n,scratchDepthIntersection$1)),defined(r)||defined(o)){const t=defined(o)?Cartesian3.distance(o,e.positionWC):Number.POSITIVE_INFINITY,i=defined(r)?Cartesian3.distance(r,e.positionWC):Number.POSITIVE_INFINITY;a=Math.min(t,i)}else a=Math.max(e.positionCartographic.height,0);return a}Camera.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof OrthographicFrustum&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=calculateOrthographicFrustumWidth(this)))};const scratchSetViewCartesian=new Cartesian3,scratchSetViewTransform1=new Matrix4,scratchSetViewTransform2=new Matrix4,scratchSetViewQuaternion=new Quaternion,scratchSetViewMatrix3=new Matrix3,scratchSetViewCartographic=new Cartographic;function setView3D(e,t,i){const n=Matrix4.clone(e.transform,scratchSetViewTransform1),r=Transforms.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,scratchSetViewTransform2);e._setTransform(r),Cartesian3.clone(Cartesian3.ZERO,e.position),i.heading=i.heading-CesiumMath.PI_OVER_TWO;const o=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),a=Matrix3.fromQuaternion(o,scratchSetViewMatrix3);Matrix3.getColumn(a,0,e.direction),Matrix3.getColumn(a,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(n),e._adjustOrthographicFrustum(!0)}function setViewCV(e,t,i,n){const r=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(n){const i=e._projection,n=i.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=i.project(n,scratchSetViewCartesian)}Cartesian3.clone(t,e.position)}i.heading=i.heading-CesiumMath.PI_OVER_TWO;const o=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),a=Matrix3.fromQuaternion(o,scratchSetViewMatrix3);Matrix3.getColumn(a,0,e.direction),Matrix3.getColumn(a,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(r),e._adjustOrthographicFrustum(!0)}function setView2D(e,t,i,n){const r=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(n){const i=e._projection,n=i.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=i.project(n,scratchSetViewCartesian)}Cartesian2.clone(t,e.position);const i=.5*-t.z,r=-i,o=e.frustum;if(r>i){const e=o.top/o.right;o.right=r,o.left=i,o.top=o.right*e,o.bottom=-o.top}}if(e._scene.mapMode2D===MapMode2D$1.ROTATE){i.heading=i.heading-CesiumMath.PI_OVER_TWO,i.pitch=-CesiumMath.PI_OVER_TWO,i.roll=0;const t=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),n=Matrix3.fromQuaternion(t,scratchSetViewMatrix3);Matrix3.getColumn(n,2,e.up),Cartesian3.cross(e.direction,e.up,e.right)}e._setTransform(r)}const scratchToHPRDirection=new Cartesian3,scratchToHPRUp=new Cartesian3,scratchToHPRRight=new Cartesian3;function directionUpToHeadingPitchRoll(e,t,i,n){const r=Cartesian3.clone(i.direction,scratchToHPRDirection),o=Cartesian3.clone(i.up,scratchToHPRUp);if(e._scene.mode===SceneMode$1.SCENE3D){const i=e._projection.ellipsoid,n=Transforms.eastNorthUpToFixedFrame(t,i,scratchHPRMatrix1),a=Matrix4.inverseTransformation(n,scratchHPRMatrix2);Matrix4.multiplyByPointAsVector(a,r,r),Matrix4.multiplyByPointAsVector(a,o,o)}const a=Cartesian3.cross(r,o,scratchToHPRRight);return n.heading=getHeading(r,o),n.pitch=getPitch(r),n.roll=getRoll(r,o,a),n}const scratchSetViewOptions={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},convert:void 0,endTransform:void 0},scratchHpr=new HeadingPitchRoll;Camera.prototype.setView=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);let t=defaultValue(e.orientation,defaultValue.EMPTY_OBJECT);const i=this._mode;if(i===SceneMode$1.MORPHING)return;defined(e.endTransform)&&this._setTransform(e.endTransform);let n=defaultValue(e.convert,!0),r=defaultValue(e.destination,Cartesian3.clone(this.positionWC,scratchSetViewCartesian));defined(r)&&defined(r.west)&&(r=this.getRectangleCameraCoordinates(r,scratchSetViewCartesian),n=!1),defined(t.direction)&&(t=directionUpToHeadingPitchRoll(this,r,t,scratchSetViewOptions.orientation)),scratchHpr.heading=defaultValue(t.heading,0),scratchHpr.pitch=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),scratchHpr.roll=defaultValue(t.roll,0),i===SceneMode$1.SCENE3D?setView3D(this,r,scratchHpr):i===SceneMode$1.SCENE2D?setView2D(this,r,scratchHpr,n):setViewCV(this,r,scratchHpr,n)};const pitchScratch=new Cartesian3;function clampMove2D(e,t){const i=e._scene.mapMode2D===MapMode2D$1.ROTATE,n=e._maxCoord.x,r=e._maxCoord.y;let o,a;i?(a=n,o=-a):(a=t.x-2*n,o=t.x+2*n),t.x>n&&(t.x=a),t.x<-n&&(t.x=o),t.y>r&&(t.y=r),t.y<-r&&(t.y=-r)}Camera.prototype.flyHome=function(e){const t=this._mode;if(t===SceneMode$1.MORPHING&&this._scene.completeMorph(),t===SceneMode$1.SCENE2D)this.flyTo({destination:Camera.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:Matrix4.IDENTITY});else if(t===SceneMode$1.SCENE3D){const t=this.getRectangleCameraCoordinates(Camera.DEFAULT_VIEW_RECTANGLE);let i=Cartesian3.magnitude(t);i+=i*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(t,t),Cartesian3.multiplyByScalar(t,i,t),this.flyTo({destination:t,duration:e,endTransform:Matrix4.IDENTITY})}else if(t===SceneMode$1.COLUMBUS_VIEW){const t=this._projection.ellipsoid.maximumRadius;let i=new Cartesian3(0,-1,1);i=Cartesian3.multiplyByScalar(Cartesian3.normalize(i,i),5*t,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(Cartesian3.normalize(i,pitchScratch).z),roll:0},endTransform:Matrix4.IDENTITY,convert:!1})}},Camera.prototype.worldToCameraCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualInvTransform,e,t)},Camera.prototype.cameraToWorldCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualTransform,e,t)};const moveScratch=new Cartesian3;Camera.prototype.move=function(e,t){const i=this.position;Cartesian3.multiplyByScalar(e,t,moveScratch),Cartesian3.add(i,moveScratch,i),this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,i),this._adjustOrthographicFrustum(!0)},Camera.prototype.moveForward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,e):this.move(this.direction,e)},Camera.prototype.moveBackward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,-e):this.move(this.direction,-e)},Camera.prototype.moveUp=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,e)},Camera.prototype.moveDown=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,-e)},Camera.prototype.moveRight=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,e)},Camera.prototype.moveLeft=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,-e)},Camera.prototype.lookLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,-e)},Camera.prototype.lookRight=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,e)},Camera.prototype.lookUp=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,-e)},Camera.prototype.lookDown=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,e)};const lookScratchQuaternion=new Quaternion,lookScratchMatrix=new Matrix3;Camera.prototype.look=function(e,t){const i=defaultValue(t,this.defaultLookAmount),n=Quaternion.fromAxisAngle(e,-i,lookScratchQuaternion),r=Matrix3.fromQuaternion(n,lookScratchMatrix),o=this.direction,a=this.up,s=this.right;Matrix3.multiplyByVector(r,o,o),Matrix3.multiplyByVector(r,a,a),Matrix3.multiplyByVector(r,s,s)},Camera.prototype.twistLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,e)},Camera.prototype.twistRight=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,-e)};const rotateScratchQuaternion=new Quaternion,rotateScratchMatrix=new Matrix3;Camera.prototype.rotate=function(e,t){const i=defaultValue(t,this.defaultRotateAmount),n=Quaternion.fromAxisAngle(e,-i,rotateScratchQuaternion),r=Matrix3.fromQuaternion(n,rotateScratchMatrix);Matrix3.multiplyByVector(r,this.position,this.position),Matrix3.multiplyByVector(r,this.direction,this.direction),Matrix3.multiplyByVector(r,this.up,this.up),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)},Camera.prototype.rotateDown=function(e){rotateVertical(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.rotateUp=function(e){rotateVertical(this,-(e=defaultValue(e,this.defaultRotateAmount)))};const rotateVertScratchP=new Cartesian3,rotateVertScratchA=new Cartesian3,rotateVertScratchTan=new Cartesian3,rotateVertScratchNegate=new Cartesian3;function rotateVertical(e,t){const i=e.position;if(defined(e.constrainedAxis)&&!Cartesian3.equalsEpsilon(e.position,Cartesian3.ZERO,CesiumMath.EPSILON2)){const n=Cartesian3.normalize(i,rotateVertScratchP),r=Cartesian3.equalsEpsilon(n,e.constrainedAxis,CesiumMath.EPSILON2),o=Cartesian3.equalsEpsilon(n,Cartesian3.negate(e.constrainedAxis,rotateVertScratchNegate),CesiumMath.EPSILON2);if(r||o)(r&&t<0||o&&t>0)&&e.rotate(e.right,t);else{const i=Cartesian3.normalize(e.constrainedAxis,rotateVertScratchA);let r=Cartesian3.dot(n,i),o=CesiumMath.acosClamped(r);t>0&&t>o&&(t=o-CesiumMath.EPSILON4),r=Cartesian3.dot(n,Cartesian3.negate(i,rotateVertScratchNegate)),o=CesiumMath.acosClamped(r),t<0&&-t>o&&(t=-o+CesiumMath.EPSILON4);const a=Cartesian3.cross(i,n,rotateVertScratchTan);e.rotate(a,t)}}else e.rotate(e.right,t)}function rotateHorizontal(e,t){defined(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function zoom2D$1(e,t){const i=e.frustum;let n;if(t*=.5,Math.abs(i.top)+Math.abs(i.bottom)>Math.abs(i.left)+Math.abs(i.right)){let r=i.top-t,o=i.bottom+t,a=e._maxCoord.y;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(a*=e.maximumZoomFactor),o>a&&(o=a,r=-a),r<=o&&(r=1,o=-1),n=i.right/i.top,i.top=r,i.bottom=o,i.right=i.top*n,i.left=-i.right}else{let r=i.right-t,o=i.left+t,a=e._maxCoord.x;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(a*=e.maximumZoomFactor),r>a&&(r=a,o=-a),r<=o&&(r=1,o=-1),n=i.top/i.right,i.right=r,i.left=o,i.top=i.right*n,i.bottom=-i.top}}function zoom3D$1(e,t){e.move(e.direction,t)}Camera.prototype.rotateRight=function(e){rotateHorizontal(this,-(e=defaultValue(e,this.defaultRotateAmount)))},Camera.prototype.rotateLeft=function(e){rotateHorizontal(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.zoomIn=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,e):zoom3D$1(this,e)},Camera.prototype.zoomOut=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,-e):zoom3D$1(this,-e)},Camera.prototype.getMagnitude=function(){return this._mode===SceneMode$1.SCENE3D?Cartesian3.magnitude(this.position):this._mode===SceneMode$1.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===SceneMode$1.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};const scratchLookAtMatrix4=new Matrix4;Camera.prototype.lookAt=function(e,t){const i=Transforms.eastNorthUpToFixedFrame(e,Ellipsoid.WGS84,scratchLookAtMatrix4);this.lookAtTransform(i,t)};const scratchLookAtHeadingPitchRangeOffset=new Cartesian3,scratchLookAtHeadingPitchRangeQuaternion1=new Quaternion,scratchLookAtHeadingPitchRangeQuaternion2=new Quaternion,scratchHeadingPitchRangeMatrix3=new Matrix3;function offsetFromHeadingPitchRange(e,t,i){t=CesiumMath.clamp(t,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO),e=CesiumMath.zeroToTwoPi(e)-CesiumMath.PI_OVER_TWO;const n=Quaternion.fromAxisAngle(Cartesian3.UNIT_Y,-t,scratchLookAtHeadingPitchRangeQuaternion1),r=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-e,scratchLookAtHeadingPitchRangeQuaternion2),o=Quaternion.multiply(r,n,r),a=Matrix3.fromQuaternion(o,scratchHeadingPitchRangeMatrix3),s=Cartesian3.clone(Cartesian3.UNIT_X,scratchLookAtHeadingPitchRangeOffset);return Matrix3.multiplyByVector(a,s,s),Cartesian3.negate(s,s),Cartesian3.multiplyByScalar(s,i,s),s}Camera.prototype.lookAtTransform=function(e,t){if(this._setTransform(e),!defined(t))return;let i;if(i=defined(t.heading)?offsetFromHeadingPitchRange(t.heading,t.pitch,t.range):t,this._mode===SceneMode$1.SCENE2D){Cartesian2.clone(Cartesian2.ZERO,this.position),Cartesian3.negate(i,this.up),this.up.z=0,Cartesian3.magnitudeSquared(this.up)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_Y,this.up),Cartesian3.normalize(this.up,this.up),this._setTransform(Matrix4.IDENTITY),Cartesian3.negate(Cartesian3.UNIT_Z,this.direction),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.normalize(this.right,this.right);const t=this.frustum,n=t.top/t.right;return t.right=.5*Cartesian3.magnitude(i),t.left=-t.right,t.top=n*t.right,t.bottom=-t.top,void this._setTransform(e)}Cartesian3.clone(i,this.position),Cartesian3.negate(this.position,this.direction),Cartesian3.normalize(this.direction,this.direction),Cartesian3.cross(this.direction,Cartesian3.UNIT_Z,this.right),Cartesian3.magnitudeSquared(this.right)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_X,this.right),Cartesian3.normalize(this.right,this.right),Cartesian3.cross(this.right,this.direction,this.up),Cartesian3.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const viewRectangle3DCartographic1=new Cartographic,viewRectangle3DCartographic2=new Cartographic,viewRectangle3DNorthEast=new Cartesian3,viewRectangle3DSouthWest=new Cartesian3,viewRectangle3DNorthWest=new Cartesian3,viewRectangle3DSouthEast=new Cartesian3,viewRectangle3DNorthCenter=new Cartesian3,viewRectangle3DSouthCenter=new Cartesian3,viewRectangle3DCenter=new Cartesian3,viewRectangle3DEquator=new Cartesian3,defaultRF={direction:new Cartesian3,right:new Cartesian3,up:new Cartesian3};let viewRectangle3DEllipsoidGeodesic;function computeD(e,t,i,n){return Math.abs(Cartesian3.dot(t,i))/n-Cartesian3.dot(e,i)}function rectangleCameraPosition3D(e,t,i,n){const r=e._projection.ellipsoid,o=n?e:defaultRF,a=t.north,s=t.south;let c=t.east;const l=t.west;l>c&&(c+=CesiumMath.TWO_PI);const u=.5*(l+c);let d;if(s<-CesiumMath.PI_OVER_TWO+CesiumMath.RADIANS_PER_DEGREE&&a>CesiumMath.PI_OVER_TWO-CesiumMath.RADIANS_PER_DEGREE)d=0;else{const e=viewRectangle3DCartographic1;e.longitude=u,e.latitude=a,e.height=0;const t=viewRectangle3DCartographic2;t.longitude=u,t.latitude=s,t.height=0;let i=viewRectangle3DEllipsoidGeodesic;defined(i)&&i.ellipsoid===r||(viewRectangle3DEllipsoidGeodesic=i=new EllipsoidGeodesic(void 0,void 0,r)),i.setEndPoints(e,t),d=i.interpolateUsingFraction(.5,viewRectangle3DCartographic1).latitude}const h=viewRectangle3DCartographic1;h.longitude=u,h.latitude=d,h.height=0;const p=r.cartographicToCartesian(h,viewRectangle3DCenter),f=viewRectangle3DCartographic1;f.longitude=c,f.latitude=a;const m=r.cartographicToCartesian(f,viewRectangle3DNorthEast);f.longitude=l;const g=r.cartographicToCartesian(f,viewRectangle3DNorthWest);f.longitude=u;const _=r.cartographicToCartesian(f,viewRectangle3DNorthCenter);f.latitude=s;const y=r.cartographicToCartesian(f,viewRectangle3DSouthCenter);f.longitude=c;const C=r.cartographicToCartesian(f,viewRectangle3DSouthEast);f.longitude=l;const T=r.cartographicToCartesian(f,viewRectangle3DSouthWest);Cartesian3.subtract(g,p,g),Cartesian3.subtract(C,p,C),Cartesian3.subtract(m,p,m),Cartesian3.subtract(T,p,T),Cartesian3.subtract(_,p,_),Cartesian3.subtract(y,p,y);const S=r.geodeticSurfaceNormal(p,o.direction);Cartesian3.negate(S,S);const v=Cartesian3.cross(S,Cartesian3.UNIT_Z,o.right);Cartesian3.normalize(v,v);const A=Cartesian3.cross(v,S,o.up);let E;if(e.frustum instanceof OrthographicFrustum){const t=Math.max(Cartesian3.distance(m,g),Cartesian3.distance(C,T)),i=Math.max(Cartesian3.distance(m,C),Cartesian3.distance(g,T));let n,r;const o=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,a=i*o;t>a?(n=t,r=n/o):(r=i,n=a),E=Math.max(n,r)}else{const t=Math.tan(.5*e.frustum.fovy),i=e.frustum.aspectRatio*t;if(E=Math.max(computeD(S,A,g,t),computeD(S,A,C,t),computeD(S,A,m,t),computeD(S,A,T,t),computeD(S,A,_,t),computeD(S,A,y,t),computeD(S,v,g,i),computeD(S,v,C,i),computeD(S,v,m,i),computeD(S,v,T,i),computeD(S,v,_,i),computeD(S,v,y,i)),s<0&&a>0){const e=viewRectangle3DCartographic1;e.longitude=l,e.latitude=0,e.height=0;let n=r.cartographicToCartesian(e,viewRectangle3DEquator);Cartesian3.subtract(n,p,n),E=Math.max(E,computeD(S,A,n,t),computeD(S,v,n,i)),e.longitude=c,n=r.cartographicToCartesian(e,viewRectangle3DEquator),Cartesian3.subtract(n,p,n),E=Math.max(E,computeD(S,A,n,t),computeD(S,v,n,i))}}return Cartesian3.add(p,Cartesian3.multiplyByScalar(S,-E,viewRectangle3DEquator),i)}const viewRectangleCVCartographic=new Cartographic,viewRectangleCVNorthEast=new Cartesian3,viewRectangleCVSouthWest=new Cartesian3;function rectangleCameraPositionColumbusView(e,t,i){const n=e._projection;t.west>t.east&&(t=Rectangle.MAX_VALUE);const r=e._actualTransform,o=e._actualInvTransform,a=viewRectangleCVCartographic;a.longitude=t.east,a.latitude=t.north;const s=n.project(a,viewRectangleCVNorthEast);Matrix4.multiplyByPoint(r,s,s),Matrix4.multiplyByPoint(o,s,s),a.longitude=t.west,a.latitude=t.south;const c=n.project(a,viewRectangleCVSouthWest);if(Matrix4.multiplyByPoint(r,c,c),Matrix4.multiplyByPoint(o,c,c),i.x=.5*(s.x-c.x)+c.x,i.y=.5*(s.y-c.y)+c.y,defined(e.frustum.fovy)){const t=Math.tan(.5*e.frustum.fovy),n=e.frustum.aspectRatio*t;i.z=.5*Math.max((s.x-c.x)/n,(s.y-c.y)/t)}else{const e=s.x-c.x,t=s.y-c.y;i.z=Math.max(e,t)}return i}const viewRectangle2DCartographic=new Cartographic,viewRectangle2DNorthEast=new Cartesian3,viewRectangle2DSouthWest=new Cartesian3;function rectangleCameraPosition2D(e,t,i){const n=e._projection;let r=t.east;t.west>t.east&&(e._scene.mapMode2D===MapMode2D$1.INFINITE_SCROLL?r+=CesiumMath.TWO_PI:r=(t=Rectangle.MAX_VALUE).east);let o=viewRectangle2DCartographic;o.longitude=r,o.latitude=t.north;const a=n.project(o,viewRectangle2DNorthEast);o.longitude=t.west,o.latitude=t.south;const s=n.project(o,viewRectangle2DSouthWest),c=.5*Math.abs(a.x-s.x);let l,u,d=.5*Math.abs(a.y-s.y);const h=e.frustum.right/e.frustum.top,p=d*h;return c>p?(l=c,u=l/h):(u=d,l=p),d=Math.max(2*l,2*u),i.x=.5*(a.x-s.x)+s.x,i.y=.5*(a.y-s.y)+s.y,o=n.unproject(i,o),o.height=d,i=n.project(o,i)}Camera.prototype.getRectangleCameraCoordinates=function(e,t){const i=this._mode;return defined(t)||(t=new Cartesian3),i===SceneMode$1.SCENE3D?rectangleCameraPosition3D(this,e,t):i===SceneMode$1.COLUMBUS_VIEW?rectangleCameraPositionColumbusView(this,e,t):i===SceneMode$1.SCENE2D?rectangleCameraPosition2D(this,e,t):void 0};const pickEllipsoid3DRay=new Ray;function pickEllipsoid3D(e,t,i,n){i=defaultValue(i,Ellipsoid.WGS84);const r=e.getPickRay(t,pickEllipsoid3DRay),o=IntersectionTests.rayEllipsoid(r,i);if(!o)return;const a=o.start>0?o.start:o.stop;return Ray.getPoint(r,a,n)}const pickEllipsoid2DRay=new Ray;function pickMap2D(e,t,i,n){let r=e.getPickRay(t,pickEllipsoid2DRay).origin;r=Cartesian3.fromElements(r.y,r.z,0,r);const o=i.unproject(r);if(!(o.latitude<-CesiumMath.PI_OVER_TWO||o.latitude>CesiumMath.PI_OVER_TWO))return i.ellipsoid.cartographicToCartesian(o,n)}const pickEllipsoidCVRay=new Ray;function pickMapColumbusView(e,t,i,n){const r=e.getPickRay(t,pickEllipsoidCVRay),o=-r.origin.x/r.direction.x;Ray.getPoint(r,o,n);const a=i.unproject(new Cartesian3(n.y,n.z,0));if(!(a.latitude<-CesiumMath.PI_OVER_TWO||a.latitude>CesiumMath.PI_OVER_TWO||a.longitude<-Math.PI||a.longitude>Math.PI))return i.ellipsoid.cartographicToCartesian(a,n)}Camera.prototype.pickEllipsoid=function(e,t,i){const n=this._scene.canvas;if(0!==n.clientWidth&&0!==n.clientHeight){if(defined(i)||(i=new Cartesian3),t=defaultValue(t,Ellipsoid.WGS84),this._mode===SceneMode$1.SCENE3D)i=pickEllipsoid3D(this,e,t,i);else if(this._mode===SceneMode$1.SCENE2D)i=pickMap2D(this,e,this._projection,i);else{if(this._mode!==SceneMode$1.COLUMBUS_VIEW)return;i=pickMapColumbusView(this,e,this._projection,i)}return i}};const pickPerspCenter=new Cartesian3,pickPerspXDir=new Cartesian3,pickPerspYDir=new Cartesian3;function getPickRayPerspective(e,t,i){const n=e._scene.canvas,r=n.clientWidth,o=n.clientHeight,a=Math.tan(.5*e.frustum.fovy),s=e.frustum.aspectRatio*a,c=e.frustum.near,l=2/r*t.x-1,u=2/o*(o-t.y)-1,d=e.positionWC;Cartesian3.clone(d,i.origin);const h=Cartesian3.multiplyByScalar(e.directionWC,c,pickPerspCenter);Cartesian3.add(d,h,h);const p=Cartesian3.multiplyByScalar(e.rightWC,l*c*s,pickPerspXDir),f=Cartesian3.multiplyByScalar(e.upWC,u*c*a,pickPerspYDir),m=Cartesian3.add(h,p,i.direction);return Cartesian3.add(m,f,m),Cartesian3.subtract(m,d,m),Cartesian3.normalize(m,m),i}const scratchDirection=new Cartesian3;function getPickRayOrthographic(e,t,i){const n=e._scene.canvas,r=n.clientWidth,o=n.clientHeight;let a=e.frustum;defined(a._offCenterFrustum)&&(a=a._offCenterFrustum);let s=2/r*t.x-1;s*=.5*(a.right-a.left);let c=2/o*(o-t.y)-1;c*=.5*(a.top-a.bottom);const l=i.origin;return Cartesian3.clone(e.position,l),Cartesian3.multiplyByScalar(e.right,s,scratchDirection),Cartesian3.add(scratchDirection,l,l),Cartesian3.multiplyByScalar(e.up,c,scratchDirection),Cartesian3.add(scratchDirection,l,l),Cartesian3.clone(e.directionWC,i.direction),e._mode!==SceneMode$1.COLUMBUS_VIEW&&e._mode!==SceneMode$1.SCENE2D||Cartesian3.fromElements(i.origin.z,i.origin.x,i.origin.y,i.origin),i}Camera.prototype.getPickRay=function(e,t){defined(t)||(t=new Ray);const i=this._scene.canvas;if(i.clientWidth<=0||i.clientHeight<=0)return;const n=this.frustum;return defined(n.aspectRatio)&&defined(n.fov)&&defined(n.near)?getPickRayPerspective(this,e,t):getPickRayOrthographic(this,e,t)};const scratchToCenter=new Cartesian3,scratchProj=new Cartesian3;Camera.prototype.distanceToBoundingSphere=function(e){const t=Cartesian3.subtract(this.positionWC,e.center,scratchToCenter),i=Cartesian3.multiplyByScalar(this.directionWC,Cartesian3.dot(t,this.directionWC),scratchProj);return Math.max(0,Cartesian3.magnitude(i)-e.radius)};const scratchPixelSize=new Cartesian2;function createAnimationTemplateCV(e,t,i,n,r,o){const a=Cartesian3.clone(t);return i.y>n?a.y-=i.y-n:i.y<-n&&(a.y+=-n-i.y),i.z>r?a.z-=i.z-r:i.z<-r&&(a.z+=-r-i.z),{easingFunction:EasingFunction$1.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:o,update:function(i){const n=Cartesian3.lerp(t,a,i.time,new Cartesian3);e.worldToCameraCoordinatesPoint(n,e.position)}}}Camera.prototype.getPixelSize=function(e,t,i){const n=this.distanceToBoundingSphere(e),r=this.frustum.getPixelDimensions(t,i,n,this._scene.pixelRatio,scratchPixelSize);return Math.max(r.x,r.y)};const normalScratch$1=new Cartesian3,centerScratch$2=new Cartesian3,posScratch=new Cartesian3,scratchCartesian3Subtract=new Cartesian3;function createAnimationCV(e,t){let i=e.position;const n=e.direction,r=e.worldToCameraCoordinatesVector(Cartesian3.UNIT_X,normalScratch$1),o=-Cartesian3.dot(r,i)/Cartesian3.dot(r,n),a=Cartesian3.add(i,Cartesian3.multiplyByScalar(n,o,centerScratch$2),centerScratch$2);e.cameraToWorldCoordinatesPoint(a,a),i=e.cameraToWorldCoordinatesPoint(e.position,posScratch);const s=Math.tan(.5*e.frustum.fovy),c=e.frustum.aspectRatio*s,l=Cartesian3.magnitude(Cartesian3.subtract(i,a,scratchCartesian3Subtract)),u=c*l,d=s*l,h=e._maxCoord.x,p=e._maxCoord.y,f=Math.max(u-h,h),m=Math.max(d-p,p);if(i.z<-f||i.z>f||i.y<-m||i.y>m){const n=a.y<-f||a.y>f,r=a.z<-m||a.z>m;if(n||r)return createAnimationTemplateCV(e,i,a,f,m,t)}}Camera.prototype.createCorrectPositionTween=function(e){if(this._mode===SceneMode$1.COLUMBUS_VIEW)return createAnimationCV(this,e)};const scratchFlyToDestination=new Cartesian3,newOptions={destination:void 0,heading:void 0,pitch:void 0,roll:void 0,duration:void 0,complete:void 0,cancel:void 0,endTransform:void 0,maximumHeight:void 0,easingFunction:void 0};function distanceToBoundingSphere3D(e,t){const i=e.frustum,n=Math.tan(.5*i.fovy),r=i.aspectRatio*n;return Math.max(t/r,t/n)}function distanceToBoundingSphere2D(e,t){let i,n,r=e.frustum;defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);const o=r.right/r.top,a=t*o;return t>a?(i=t,n=i/o):(n=t,i=a),1.5*Math.max(i,n)}Camera.prototype.cancelFlight=function(){defined(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)},Camera.prototype.completeFlight=function(){if(defined(this._currentFlight)){this._currentFlight.cancelTween();const e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=newOptions.destination,e.orientation.heading=newOptions.heading,e.orientation.pitch=newOptions.pitch,e.orientation.roll=newOptions.roll,this.setView(e),defined(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}},Camera.prototype.flyTo=function(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).destination;if(this._mode===SceneMode$1.MORPHING)return;this.cancelFlight();let i=defaultValue(e.orientation,defaultValue.EMPTY_OBJECT);if(defined(i.direction)&&(i=directionUpToHeadingPitchRoll(this,t,i,scratchSetViewOptions.orientation)),defined(e.duration)&&e.duration<=0){const t=scratchSetViewOptions;return t.destination=e.destination,t.orientation.heading=i.heading,t.orientation.pitch=i.pitch,t.orientation.roll=i.roll,t.convert=e.convert,t.endTransform=e.endTransform,this.setView(t),void("function"==typeof e.complete&&e.complete())}const n=defined(t.west);n&&(t=this.getRectangleCameraCoordinates(t,scratchFlyToDestination));const r=this;let o;newOptions.destination=t,newOptions.heading=i.heading,newOptions.pitch=i.pitch,newOptions.roll=i.roll,newOptions.duration=e.duration,newOptions.complete=function(){o===r._currentFlight&&(r._currentFlight=void 0),defined(e.complete)&&e.complete()},newOptions.cancel=e.cancel,newOptions.endTransform=e.endTransform,newOptions.convert=!n&&e.convert,newOptions.maximumHeight=e.maximumHeight,newOptions.pitchAdjustHeight=e.pitchAdjustHeight,newOptions.flyOverLongitude=e.flyOverLongitude,newOptions.flyOverLongitudeWeight=e.flyOverLongitudeWeight,newOptions.easingFunction=e.easingFunction;const a=this._scene,s=CameraFlightPath.createTween(a,newOptions);if(0===s.duration)return void("function"==typeof s.complete&&s.complete());o=a.tweens.add(s),this._currentFlight=o;let c=this._scene.preloadFlightCamera;this._mode!==SceneMode$1.SCENE2D&&(defined(c)||(c=Camera.clone(this)),c.setView({destination:t,orientation:i}),this._scene.preloadFlightCullingVolume=c.frustum.computeCullingVolume(c.positionWC,c.directionWC,c.upWC))};const MINIMUM_ZOOM=100;function adjustBoundingSphereOffset(e,t,i){i=HeadingPitchRange.clone(defined(i)?i:Camera.DEFAULT_OFFSET);const n=e._scene.screenSpaceCameraController.minimumZoomDistance,r=e._scene.screenSpaceCameraController.maximumZoomDistance,o=i.range;if(!defined(o)||0===o){const o=t.radius;0===o?i.range=MINIMUM_ZOOM:e.frustum instanceof OrthographicFrustum||e._mode===SceneMode$1.SCENE2D?i.range=distanceToBoundingSphere2D(e,o):i.range=distanceToBoundingSphere3D(e,o),i.range=CesiumMath.clamp(i.range,n,r)}return i}Camera.prototype.viewBoundingSphere=function(e,t){t=adjustBoundingSphereOffset(this,e,t),this.lookAt(e.center,t)};const scratchflyToBoundingSphereTransform=new Matrix4,scratchflyToBoundingSphereDestination=new Cartesian3,scratchflyToBoundingSphereDirection=new Cartesian3,scratchflyToBoundingSphereUp=new Cartesian3,scratchflyToBoundingSphereRight=new Cartesian3,scratchFlyToBoundingSphereCart4=new Cartesian4,scratchFlyToBoundingSphereQuaternion=new Quaternion,scratchFlyToBoundingSphereMatrix3=new Matrix3;Camera.prototype.flyToBoundingSphere=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);const i=this._mode===SceneMode$1.SCENE2D||this._mode===SceneMode$1.COLUMBUS_VIEW;this._setTransform(Matrix4.IDENTITY);const n=adjustBoundingSphereOffset(this,e,t.offset);let r;r=i?Cartesian3.multiplyByScalar(Cartesian3.UNIT_Z,n.range,scratchflyToBoundingSphereDestination):offsetFromHeadingPitchRange(n.heading,n.pitch,n.range);const o=Transforms.eastNorthUpToFixedFrame(e.center,Ellipsoid.WGS84,scratchflyToBoundingSphereTransform);let a,s;if(Matrix4.multiplyByPoint(o,r,r),!i){if(a=Cartesian3.subtract(e.center,r,scratchflyToBoundingSphereDirection),Cartesian3.normalize(a,a),s=Matrix4.multiplyByPointAsVector(o,Cartesian3.UNIT_Z,scratchflyToBoundingSphereUp),1-Math.abs(Cartesian3.dot(a,s))<CesiumMath.EPSILON6){const e=Quaternion.fromAxisAngle(a,n.heading,scratchFlyToBoundingSphereQuaternion),t=Matrix3.fromQuaternion(e,scratchFlyToBoundingSphereMatrix3);Cartesian3.fromCartesian4(Matrix4.getColumn(o,1,scratchFlyToBoundingSphereCart4),s),Matrix3.multiplyByVector(t,s,s)}const t=Cartesian3.cross(a,s,scratchflyToBoundingSphereRight);Cartesian3.cross(t,a,s),Cartesian3.normalize(s,s)}this.flyTo({destination:r,orientation:{direction:a,up:s},duration:t.duration,complete:t.complete,cancel:t.cancel,endTransform:t.endTransform,maximumHeight:t.maximumHeight,easingFunction:t.easingFunction,flyOverLongitude:t.flyOverLongitude,flyOverLongitudeWeight:t.flyOverLongitudeWeight,pitchAdjustHeight:t.pitchAdjustHeight})};const scratchCartesian3_1=new Cartesian3,scratchCartesian3_2=new Cartesian3,scratchCartesian3_3=new Cartesian3,scratchCartesian3_4=new Cartesian3,horizonPoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeHorizonQuad(e,t){const i=t.radii,n=e.positionWC,r=Cartesian3.multiplyComponents(t.oneOverRadii,n,scratchCartesian3_1),o=Cartesian3.magnitude(r),a=Cartesian3.normalize(r,scratchCartesian3_2);let s,c;Cartesian3.equalsEpsilon(a,Cartesian3.UNIT_Z,CesiumMath.EPSILON10)?(s=new Cartesian3(0,1,0),c=new Cartesian3(0,0,1)):(s=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,a,scratchCartesian3_3),scratchCartesian3_3),c=Cartesian3.normalize(Cartesian3.cross(a,s,scratchCartesian3_4),scratchCartesian3_4));const l=Math.sqrt(Cartesian3.magnitudeSquared(r)-1),u=Cartesian3.multiplyByScalar(a,1/o,scratchCartesian3_1),d=l/o,h=Cartesian3.multiplyByScalar(s,d,scratchCartesian3_2),p=Cartesian3.multiplyByScalar(c,d,scratchCartesian3_3),f=Cartesian3.add(u,p,horizonPoints[0]);Cartesian3.subtract(f,h,f),Cartesian3.multiplyComponents(i,f,f);const m=Cartesian3.subtract(u,p,horizonPoints[1]);Cartesian3.subtract(m,h,m),Cartesian3.multiplyComponents(i,m,m);const g=Cartesian3.subtract(u,p,horizonPoints[2]);Cartesian3.add(g,h,g),Cartesian3.multiplyComponents(i,g,g);const _=Cartesian3.add(u,p,horizonPoints[3]);return Cartesian3.add(_,h,_),Cartesian3.multiplyComponents(i,_,_),horizonPoints}const scratchPickCartesian2=new Cartesian2,scratchRectCartesian=new Cartesian3,cartoArray=[new Cartographic,new Cartographic,new Cartographic,new Cartographic];function addToResult(e,t,i,n,r,o){scratchPickCartesian2.x=e,scratchPickCartesian2.y=t;const a=n.pickEllipsoid(scratchPickCartesian2,r,scratchRectCartesian);return defined(a)?(cartoArray[i]=r.cartesianToCartographic(a,cartoArray[i]),1):(cartoArray[i]=r.cartesianToCartographic(o[i],cartoArray[i]),0)}Camera.prototype.computeViewRectangle=function(e,t){e=defaultValue(e,Ellipsoid.WGS84);const i=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),n=new BoundingSphere(Cartesian3.ZERO,e.maximumRadius);if(i.computeVisibility(n)===Intersect$1.OUTSIDE)return;const r=this._scene.canvas,o=r.clientWidth,a=r.clientHeight;let s=0;const c=computeHorizonQuad(this,e);if(s+=addToResult(0,0,0,this,e,c),s+=addToResult(0,a,1,this,e,c),s+=addToResult(o,a,2,this,e,c),s+=addToResult(o,0,3,this,e,c),s<2)return Rectangle.MAX_VALUE;t=Rectangle.fromCartographicArray(cartoArray,t);let l=0,u=cartoArray[3].longitude;for(let e=0;e<4;++e){const t=cartoArray[e].longitude,i=Math.abs(t-u);i>CesiumMath.PI?l+=CesiumMath.TWO_PI-i:l+=i,u=t}return CesiumMath.equalsEpsilon(Math.abs(l),CesiumMath.TWO_PI,CesiumMath.EPSILON9)&&(t.west=-CesiumMath.PI,t.east=CesiumMath.PI,cartoArray[0].latitude>=0?t.north=CesiumMath.PI_OVER_TWO:t.south=-CesiumMath.PI_OVER_TWO),t},Camera.prototype.switchToPerspectiveFrustum=function(){if(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof PerspectiveFrustum)return;const e=this._scene;this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.toRadians(60)},Camera.prototype.switchToOrthographicFrustum=function(){if(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof OrthographicFrustum)return;const e=calculateOrthographicFrustumWidth(this),t=this._scene;this.frustum=new OrthographicFrustum,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e},Camera.clone=function(e,t){return defined(t)||(t=new Camera(e._scene)),Cartesian3.clone(e.position,t.position),Cartesian3.clone(e.direction,t.direction),Cartesian3.clone(e.up,t.up),Cartesian3.clone(e.right,t.right),Matrix4.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};const CameraEventType={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4};var CameraEventType$1=Object.freeze(CameraEventType);function getKey$1(e,t){let i=e;return defined(t)&&(i+=`+${t}`),i}function clonePinchMovement(e,t){Cartesian2.clone(e.distance.startPosition,t.distance.startPosition),Cartesian2.clone(e.distance.endPosition,t.distance.endPosition),Cartesian2.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),Cartesian2.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function listenToPinch(e,t,i){const n=getKey$1(CameraEventType$1.PINCH,t),r=e._update,o=e._isDown,a=e._eventStartPosition,s=e._pressTime,c=e._releaseTime;r[n]=!0,o[n]=!1,a[n]=new Cartesian2;let l=e._movement[n];defined(l)||(l=e._movement[n]={}),l.distance={startPosition:new Cartesian2,endPosition:new Cartesian2},l.angleAndHeight={startPosition:new Cartesian2,endPosition:new Cartesian2},l.prevAngle=0,e._eventHandler.setInputAction((function(t){e._buttonsDown++,o[n]=!0,s[n]=new Date,Cartesian2.lerp(t.position1,t.position2,.5,a[n])}),ScreenSpaceEventType$1.PINCH_START,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[n]=!1,c[n]=new Date}),ScreenSpaceEventType$1.PINCH_END,t),e._eventHandler.setInputAction((function(e){if(o[n]){r[n]?(clonePinchMovement(e,l),r[n]=!1,l.prevAngle=l.angleAndHeight.startPosition.x):(Cartesian2.clone(e.distance.endPosition,l.distance.endPosition),Cartesian2.clone(e.angleAndHeight.endPosition,l.angleAndHeight.endPosition));let t=l.angleAndHeight.endPosition.x;const o=l.prevAngle,a=2*Math.PI;for(;t>=o+Math.PI;)t-=a;for(;t<o-Math.PI;)t+=a;l.angleAndHeight.endPosition.x=-t*i.clientWidth/12,l.angleAndHeight.startPosition.x=-o*i.clientWidth/12}}),ScreenSpaceEventType$1.PINCH_MOVE,t)}function listenToWheel(e,t){const i=getKey$1(CameraEventType$1.WHEEL,t),n=e._update;n[i]=!0;let r=e._movement[i];defined(r)||(r=e._movement[i]={}),r.startPosition=new Cartesian2,r.endPosition=new Cartesian2,e._eventHandler.setInputAction((function(e){const t=15*CesiumMath.toRadians(e);n[i]?(Cartesian2.clone(Cartesian2.ZERO,r.startPosition),r.endPosition.x=0,r.endPosition.y=t,n[i]=!1):r.endPosition.y=r.endPosition.y+t}),ScreenSpaceEventType$1.WHEEL,t)}function listenMouseButtonDownUp(e,t,i){const n=getKey$1(i,t),r=e._isDown,o=e._eventStartPosition,a=e._pressTime,s=e._releaseTime;r[n]=!1,o[n]=new Cartesian2;let c,l,u=e._lastMovement[n];defined(u)||(u=e._lastMovement[n]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),i===CameraEventType$1.LEFT_DRAG?(c=ScreenSpaceEventType$1.LEFT_DOWN,l=ScreenSpaceEventType$1.LEFT_UP):i===CameraEventType$1.RIGHT_DRAG?(c=ScreenSpaceEventType$1.RIGHT_DOWN,l=ScreenSpaceEventType$1.RIGHT_UP):i===CameraEventType$1.MIDDLE_DRAG&&(c=ScreenSpaceEventType$1.MIDDLE_DOWN,l=ScreenSpaceEventType$1.MIDDLE_UP),e._eventHandler.setInputAction((function(t){e._buttonsDown++,u.valid=!1,r[n]=!0,a[n]=new Date,Cartesian2.clone(t.position,o[n])}),c,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[n]=!1,s[n]=new Date}),l,t)}function cloneMouseMovement(e,t){Cartesian2.clone(e.startPosition,t.startPosition),Cartesian2.clone(e.endPosition,t.endPosition)}function listenMouseMove(e,t){const i=e._update,n=e._movement,r=e._lastMovement,o=e._isDown;for(const n in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(n)){const r=CameraEventType$1[n];if(defined(r)){const n=getKey$1(r,t);i[n]=!0,defined(e._lastMovement[n])||(e._lastMovement[n]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),defined(e._movement[n])||(e._movement[n]={startPosition:new Cartesian2,endPosition:new Cartesian2})}}e._eventHandler.setInputAction((function(a){for(const e in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(e)){const s=CameraEventType$1[e];if(defined(s)){const e=getKey$1(s,t);o[e]&&(i[e]?(cloneMouseMovement(n[e],r[e]),r[e].valid=!0,cloneMouseMovement(a,n[e]),i[e]=!1):Cartesian2.clone(a.endPosition,n[e].endPosition))}}Cartesian2.clone(a.endPosition,e._currentMousePosition)}),ScreenSpaceEventType$1.MOUSE_MOVE,t)}function CameraEventAggregator(e){this._eventHandler=new ScreenSpaceEventHandler(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new Cartesian2,listenToWheel(this,void 0),listenToPinch(this,void 0,e),listenMouseButtonDownUp(this,void 0,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,void 0);for(const t in KeyboardEventModifier$1)if(KeyboardEventModifier$1.hasOwnProperty(t)){const i=KeyboardEventModifier$1[t];defined(i)&&(listenToWheel(this,i),listenToPinch(this,i,e),listenMouseButtonDownUp(this,i,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,i,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,i,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,i))}}function Cesium3DTileContent(){this.featurePropertiesDirty=!1}function Cesium3DTilePassState(e){this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}function ConditionsExpression(e,t){this._conditionsExpression=clone$1(e,!0),this._conditions=e.conditions,this._runtimeConditions=void 0,setRuntime(this,t)}function Statement(e,t){this.condition=e,this.expression=t}function setRuntime(e,t){const i=[],n=e._conditions;if(!defined(n))return;const r=n.length;for(let e=0;e<r;++e){const r=n[e],o=String(r[0]),a=String(r[1]);i.push(new Statement(new Expression(o,t),new Expression(a,t)))}e._runtimeConditions=i}function Cesium3DTileStyle(e){let t;if(this._style={},this._ready=!1,this._show=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._labelColor=void 0,this._labelOutlineColor=void 0,this._labelOutlineWidth=void 0,this._font=void 0,this._labelStyle=void 0,this._labelText=void 0,this._backgroundColor=void 0,this._backgroundPadding=void 0,this._backgroundEnabled=void 0,this._scaleByDistance=void 0,this._translucencyByDistance=void 0,this._distanceDisplayCondition=void 0,this._heightOffset=void 0,this._anchorLineEnabled=void 0,this._anchorLineColor=void 0,this._image=void 0,this._disableDepthTestDistance=void 0,this._horizontalOrigin=void 0,this._verticalOrigin=void 0,this._labelHorizontalOrigin=void 0,this._labelVerticalOrigin=void 0,this._meta=void 0,this._colorShaderFunction=void 0,this._showShaderFunction=void 0,this._pointSizeShaderFunction=void 0,this._colorShaderFunctionReady=!1,this._showShaderFunctionReady=!1,this._pointSizeShaderFunctionReady=!1,this._colorShaderTranslucent=!1,"string"==typeof e||e instanceof Resource){t=Resource.createIfNeeded(e).fetchJson(e)}else t=Promise.resolve(e);const i=this;this._readyPromise=t.then((function(e){return setup(i,e),i}))}function setup(e,t){t=defaultValue(clone$1(t,!0),e._style),e._style=t,e.show=t.show,e.color=t.color,e.pointSize=t.pointSize,e.pointOutlineColor=t.pointOutlineColor,e.pointOutlineWidth=t.pointOutlineWidth,e.labelColor=t.labelColor,e.labelOutlineColor=t.labelOutlineColor,e.labelOutlineWidth=t.labelOutlineWidth,e.labelStyle=t.labelStyle,e.font=t.font,e.labelText=t.labelText,e.backgroundColor=t.backgroundColor,e.backgroundPadding=t.backgroundPadding,e.backgroundEnabled=t.backgroundEnabled,e.scaleByDistance=t.scaleByDistance,e.translucencyByDistance=t.translucencyByDistance,e.distanceDisplayCondition=t.distanceDisplayCondition,e.heightOffset=t.heightOffset,e.anchorLineEnabled=t.anchorLineEnabled,e.anchorLineColor=t.anchorLineColor,e.image=t.image,e.disableDepthTestDistance=t.disableDepthTestDistance,e.horizontalOrigin=t.horizontalOrigin,e.verticalOrigin=t.verticalOrigin,e.labelHorizontalOrigin=t.labelHorizontalOrigin,e.labelVerticalOrigin=t.labelVerticalOrigin;const i={};if(defined(t.meta)){const e=t.defines,n=defaultValue(t.meta,defaultValue.EMPTY_OBJECT);for(const t in n)n.hasOwnProperty(t)&&(i[t]=new Expression(n[t],e))}e._meta=i,e._ready=!0}function getExpression(e,t){const i=defaultValue(e._style,defaultValue.EMPTY_OBJECT).defines;if(defined(t))return"boolean"==typeof t||"number"==typeof t?new Expression(String(t)):"string"==typeof t?new Expression(t,i):defined(t.conditions)?new ConditionsExpression(t,i):t}function getJsonFromExpression(e){if(defined(e))return defined(e.expression)?e.expression:defined(e.conditionsExpression)?clone$1(e.conditionsExpression,!0):e}function CircleEmitter(e){e=defaultValue(e,1),this._radius=defaultValue(e,1)}Object.defineProperties(CameraEventAggregator.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!(this._update[getKey$1(CameraEventType$1.WHEEL)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.SHIFT)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.CTRL)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.ALT)]);return this._buttonsDown>0||e}}}),CameraEventAggregator.prototype.isMoving=function(e,t){const i=getKey$1(e,t);return!this._update[i]},CameraEventAggregator.prototype.getMovement=function(e,t){const i=getKey$1(e,t);return this._movement[i]},CameraEventAggregator.prototype.getLastMovement=function(e,t){const i=getKey$1(e,t),n=this._lastMovement[i];if(n.valid)return n},CameraEventAggregator.prototype.isButtonDown=function(e,t){const i=getKey$1(e,t);return this._isDown[i]},CameraEventAggregator.prototype.getStartMousePosition=function(e,t){if(e===CameraEventType$1.WHEEL)return this._currentMousePosition;const i=getKey$1(e,t);return this._eventStartPosition[i]},CameraEventAggregator.prototype.getButtonPressTime=function(e,t){const i=getKey$1(e,t);return this._pressTime[i]},CameraEventAggregator.prototype.getButtonReleaseTime=function(e,t){const i=getKey$1(e,t);return this._releaseTime[i]},CameraEventAggregator.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},CameraEventAggregator.prototype.isDestroyed=function(){return!1},CameraEventAggregator.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),destroyObject(this)},Object.defineProperties(Cesium3DTileContent.prototype,{featuresLength:{get:function(){DeveloperError.throwInstantiationError()}},pointsLength:{get:function(){DeveloperError.throwInstantiationError()}},trianglesLength:{get:function(){DeveloperError.throwInstantiationError()}},geometryByteLength:{get:function(){DeveloperError.throwInstantiationError()}},texturesByteLength:{get:function(){DeveloperError.throwInstantiationError()}},batchTableByteLength:{get:function(){DeveloperError.throwInstantiationError()}},innerContents:{get:function(){DeveloperError.throwInstantiationError()}},readyPromise:{get:function(){DeveloperError.throwInstantiationError()}},tileset:{get:function(){DeveloperError.throwInstantiationError()}},tile:{get:function(){DeveloperError.throwInstantiationError()}},url:{get:function(){DeveloperError.throwInstantiationError()}},batchTable:{get:function(){DeveloperError.throwInstantiationError()}},metadata:{get:function(){DeveloperError.throwInstantiationError()},set:function(e){DeveloperError.throwInstantiationError()}},group:{get:function(){DeveloperError.throwInstantiationError()},set:function(e){DeveloperError.throwInstantiationError()}}}),Cesium3DTileContent.prototype.hasProperty=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.getFeature=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyDebugSettings=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyStyle=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.update=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.isDestroyed=function(){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.destroy=function(){DeveloperError.throwInstantiationError()},Object.defineProperties(ConditionsExpression.prototype,{conditionsExpression:{get:function(){return this._conditionsExpression}}}),ConditionsExpression.prototype.evaluate=function(e,t){const i=this._runtimeConditions;if(!defined(i))return;const n=i.length;for(let r=0;r<n;++r){const n=i[r];if(n.condition.evaluate(e))return n.expression.evaluate(e,t)}},ConditionsExpression.prototype.evaluateColor=function(e,t){const i=this._runtimeConditions;if(!defined(i))return;const n=i.length;for(let r=0;r<n;++r){const n=i[r];if(n.condition.evaluate(e))return n.expression.evaluateColor(e,t)}},ConditionsExpression.prototype.getShaderFunction=function(e,t,i,n){const r=this._runtimeConditions;if(!defined(r)||0===r.length)return;let o="";const a=r.length;for(let e=0;e<a;++e){const n=r[e];o+=` ${0===e?"if":"else if"} (${n.condition.getShaderExpression(t,i)})\n {\n return ${n.expression.getShaderExpression(t,i)};\n }\n`}return o=`${n} ${e}\n{\n${o} return ${n}(1.0);\n}\n`,o},ConditionsExpression.prototype.getVariables=function(){let e=[];const t=this._runtimeConditions;if(!defined(t)||0===t.length)return e;const i=t.length;for(let n=0;n<i;++n){const i=t[n];e.push.apply(e,i.condition.getVariables()),e.push.apply(e,i.expression.getVariables())}return e=e.filter((function(e,t,i){return i.indexOf(e)===t})),e},Object.defineProperties(Cesium3DTileStyle.prototype,{style:{get:function(){return this._style}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},show:{get:function(){return this._show},set:function(e){this._show=getExpression(this,e),this._style.show=getJsonFromExpression(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=getExpression(this,e),this._style.color=getJsonFromExpression(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=getExpression(this,e),this._style.pointSize=getJsonFromExpression(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=getExpression(this,e),this._style.pointOutlineColor=getJsonFromExpression(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=getExpression(this,e),this._style.pointOutlineWidth=getJsonFromExpression(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColor},set:function(e){this._labelColor=getExpression(this,e),this._style.labelColor=getJsonFromExpression(this._labelColor)}},labelOutlineColor:{get:function(){return this._labelOutlineColor},set:function(e){this._labelOutlineColor=getExpression(this,e),this._style.labelOutlineColor=getJsonFromExpression(this._labelOutlineColor)}},labelOutlineWidth:{get:function(){return this._labelOutlineWidth},set:function(e){this._labelOutlineWidth=getExpression(this,e),this._style.labelOutlineWidth=getJsonFromExpression(this._labelOutlineWidth)}},font:{get:function(){return this._font},set:function(e){this._font=getExpression(this,e),this._style.font=getJsonFromExpression(this._font)}},labelStyle:{get:function(){return this._labelStyle},set:function(e){this._labelStyle=getExpression(this,e),this._style.labelStyle=getJsonFromExpression(this._labelStyle)}},labelText:{get:function(){return this._labelText},set:function(e){this._labelText=getExpression(this,e),this._style.labelText=getJsonFromExpression(this._labelText)}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=getExpression(this,e),this._style.backgroundColor=getJsonFromExpression(this._backgroundColor)}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){this._backgroundPadding=getExpression(this,e),this._style.backgroundPadding=getJsonFromExpression(this._backgroundPadding)}},backgroundEnabled:{get:function(){return this._backgroundEnabled},set:function(e){this._backgroundEnabled=getExpression(this,e),this._style.backgroundEnabled=getJsonFromExpression(this._backgroundEnabled)}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){this._scaleByDistance=getExpression(this,e),this._style.scaleByDistance=getJsonFromExpression(this._scaleByDistance)}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){this._translucencyByDistance=getExpression(this,e),this._style.translucencyByDistance=getJsonFromExpression(this._translucencyByDistance)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=getExpression(this,e),this._style.distanceDisplayCondition=getJsonFromExpression(this._distanceDisplayCondition)}},heightOffset:{get:function(){return this._heightOffset},set:function(e){this._heightOffset=getExpression(this,e),this._style.heightOffset=getJsonFromExpression(this._heightOffset)}},anchorLineEnabled:{get:function(){return this._anchorLineEnabled},set:function(e){this._anchorLineEnabled=getExpression(this,e),this._style.anchorLineEnabled=getJsonFromExpression(this._anchorLineEnabled)}},anchorLineColor:{get:function(){return this._anchorLineColor},set:function(e){this._anchorLineColor=getExpression(this,e),this._style.anchorLineColor=getJsonFromExpression(this._anchorLineColor)}},image:{get:function(){return this._image},set:function(e){this._image=getExpression(this,e),this._style.image=getJsonFromExpression(this._image)}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance=getExpression(this,e),this._style.disableDepthTestDistance=getJsonFromExpression(this._disableDepthTestDistance)}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin=getExpression(this,e),this._style.horizontalOrigin=getJsonFromExpression(this._horizontalOrigin)}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin=getExpression(this,e),this._style.verticalOrigin=getJsonFromExpression(this._verticalOrigin)}},labelHorizontalOrigin:{get:function(){return this._labelHorizontalOrigin},set:function(e){this._labelHorizontalOrigin=getExpression(this,e),this._style.labelHorizontalOrigin=getJsonFromExpression(this._labelHorizontalOrigin)}},labelVerticalOrigin:{get:function(){return this._labelVerticalOrigin},set:function(e){this._labelVerticalOrigin=getExpression(this,e),this._style.labelVerticalOrigin=getJsonFromExpression(this._labelVerticalOrigin)}},meta:{get:function(){return this._meta},set:function(e){this._meta=e}}}),Cesium3DTileStyle.prototype.getColorShaderFunction=function(e,t,i){return this._colorShaderFunctionReady?(i.translucent=this._colorShaderTranslucent,this._colorShaderFunction):(this._colorShaderFunctionReady=!0,defined(this.color)&&defined(this.color.getShaderFunction)?this._colorShaderFunction=this.color.getShaderFunction(e,t,i,"vec4"):this._colorShaderFunction=void 0,this._colorShaderTranslucent=i.translucent,this._colorShaderFunction)},Cesium3DTileStyle.prototype.getShowShaderFunction=function(e,t,i){return this._showShaderFunctionReady||(this._showShaderFunctionReady=!0,defined(this.show)&&defined(this.show.getShaderFunction)?this._showShaderFunction=this.show.getShaderFunction(e,t,i,"bool"):this._showShaderFunction=void 0),this._showShaderFunction},Cesium3DTileStyle.prototype.getPointSizeShaderFunction=function(e,t,i){return this._pointSizeShaderFunctionReady||(this._pointSizeShaderFunctionReady=!0,defined(this.pointSize)&&defined(this.pointSize.getShaderFunction)?this._pointSizeShaderFunction=this.pointSize.getShaderFunction(e,t,i,"float"):this._pointSizeShaderFunction=void 0),this._pointSizeShaderFunction},Cesium3DTileStyle.prototype.getVariables=function(){let e=[];return defined(this.color)&&defined(this.color.getVariables)&&e.push.apply(e,this.color.getVariables()),defined(this.show)&&defined(this.show.getVariables)&&e.push.apply(e,this.show.getVariables()),defined(this.pointSize)&&defined(this.pointSize.getVariables)&&e.push.apply(e,this.pointSize.getVariables()),e=e.filter((function(e,t,i){return i.indexOf(e)===t})),e},Object.defineProperties(CircleEmitter.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}}),CircleEmitter.prototype.emit=function(e){const t=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),i=CesiumMath.randomBetween(0,this._radius),n=i*Math.cos(t),r=i*Math.sin(t);e.position=Cartesian3.fromElements(n,r,0,e.position),e.velocity=Cartesian3.clone(Cartesian3.UNIT_Z,e.velocity)};const CloudType={CUMULUS:0,validate:function(e){return e===CloudType.CUMULUS}};var CloudType$1=Object.freeze(CloudType),CloudCollectionFS="uniform sampler2D u_noiseTexture;\nuniform vec3 u_noiseTextureDimensions;\nuniform float u_noiseDetail;\nvarying vec2 v_offset;\nvarying vec3 v_maximumSize;\nvarying vec4 v_color;\nvarying float v_slice;\nvarying float v_brightness;\nfloat wrap(float value, float rangeLength) {\nif(value < 0.0) {\nfloat absValue = abs(value);\nfloat modValue = mod(absValue, rangeLength);\nreturn mod(rangeLength - modValue, rangeLength);\n}\nreturn mod(value, rangeLength);\n}\nvec3 wrapVec(vec3 value, float rangeLength) {\nreturn vec3(wrap(value.x, rangeLength),\nwrap(value.y, rangeLength),\nwrap(value.z, rangeLength));\n}\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat noiseTextureRows = u_noiseTextureDimensions.y;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nfloat textureSliceWidthSquared = textureSliceWidth * textureSliceWidth;\nvec2 inverseNoiseTextureDimensions = vec2(noiseTextureRows / textureSliceWidthSquared,\ninverseNoiseTextureRows / textureSliceWidth);\nvec2 voxelToUV(vec3 voxelIndex) {\nvec3 wrappedIndex = wrapVec(voxelIndex, textureSliceWidth);\nfloat column = mod(wrappedIndex.z, textureSliceWidth * inverseNoiseTextureRows);\nfloat row = floor(wrappedIndex.z / textureSliceWidth * noiseTextureRows);\nfloat xPixelCoord = wrappedIndex.x + column * textureSliceWidth;\nfloat yPixelCoord = wrappedIndex.y + row * textureSliceWidth;\nreturn vec2(xPixelCoord, yPixelCoord) * inverseNoiseTextureDimensions;\n}\nvec4 lerpSamplesX(vec3 voxelIndex, float x) {\nvec2 uv0 = voxelToUV(voxelIndex);\nvec2 uv1 = voxelToUV(voxelIndex + vec3(1.0, 0.0, 0.0));\nvec4 sample0 = texture2D(u_noiseTexture, uv0);\nvec4 sample1 = texture2D(u_noiseTexture, uv1);\nreturn mix(sample0, sample1, x);\n}\nvec4 sampleNoiseTexture(vec3 position) {\nvec3 recenteredPos = position + vec3(textureSliceWidth / 2.0);\nvec3 lerpValue = fract(recenteredPos);\nvec3 voxelIndex = floor(recenteredPos);\nvec4 xLerp00 = lerpSamplesX(voxelIndex, lerpValue.x);\nvec4 xLerp01 = lerpSamplesX(voxelIndex + vec3(0.0, 0.0, 1.0), lerpValue.x);\nvec4 xLerp10 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 0.0), lerpValue.x);\nvec4 xLerp11 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 1.0), lerpValue.x);\nvec4 yLerp0 = mix(xLerp00, xLerp10, lerpValue.y);\nvec4 yLerp1 = mix(xLerp01, xLerp11, lerpValue.y);\nreturn mix(yLerp0, yLerp1, lerpValue.z);\n}\nbool intersectSphere(vec3 origin, vec3 dir, float slice,\nout vec3 point, out vec3 normal) {\nfloat A = dot(dir, dir);\nfloat B = dot(origin, dir);\nfloat C = dot(origin, origin) - 0.25;\nfloat discriminant = (B * B) - (A * C);\nif(discriminant < 0.0) {\nreturn false;\n}\nfloat root = sqrt(discriminant);\nfloat t = (-B - root) / A;\nif(t < 0.0) {\nt = (-B + root) / A;\n}\npoint = origin + t * dir;\nif(slice >= 0.0) {\npoint.z = (slice / 2.0) - 0.5;\nif(length(point) > 0.5) {\nreturn false;\n}\n}\nnormal = normalize(point);\npoint -= czm_epsilon2 * normal;\nreturn true;\n}\nbool intersectEllipsoid(vec3 origin, vec3 dir, vec3 center, vec3 scale, float slice,\nout vec3 point, out vec3 normal) {\nif(scale.x <= 0.01 || scale.y < 0.01 || scale.z < 0.01) {\nreturn false;\n}\nvec3 o = (origin - center) / scale;\nvec3 d = dir / scale;\nvec3 p, n;\nbool intersected = intersectSphere(o, d, slice, p, n);\nif(intersected) {\npoint = (p * scale) + center;\nnormal = n;\n}\nreturn intersected;\n}\nvec2 phaseShift2D(vec2 p, vec2 freq) {\nreturn (czm_pi / 2.0) * sin(freq.yx * p.yx);\n}\nvec2 phaseShift3D(vec3 p, vec2 freq) {\nreturn phaseShift2D(p.xy, freq) + czm_pi * vec2(sin(freq.x * p.z));\n}\nconst float T0 = 0.6;\nconst float k = 0.1;\nconst float C0 = 0.8;\nconst float FX0 = 0.6;\nconst float FY0 = 0.6;\nconst int octaves = 5;\nfloat T(vec3 point) {\nvec2 sum = vec2(0.0);\nfloat Ci = C0;\nvec2 FXY = vec2(FX0, FY0);\nvec2 PXY = vec2(0.0);\nfor(int i = 1; i <= octaves; i++) {\nPXY = phaseShift3D(point, FXY);\nCi *= 0.707;\nFXY *= 2.0;\nvec2 sinTerm = sin(FXY * point.xy + PXY);\nsum += Ci * sinTerm + vec2(T0);\n}\nreturn k * sum.x * sum.y;\n}\nconst float a = 0.5;\nconst float t = 0.4;\nconst float s = 0.25;\nfloat I(float Id, float Is, float It) {\nreturn (1.0 - a) * ((1.0 - t) * ((1.0 - s) * Id + s * Is) + t * It) + a;\n}\nconst vec3 lightDir = normalize(vec3(0.2, -1.0, 0.7));\nvec4 drawCloud(vec3 rayOrigin, vec3 rayDir, vec3 cloudCenter, vec3 cloudScale, float cloudSlice,\nfloat brightness) {\nvec3 cloudPoint, cloudNormal;\nif(!intersectEllipsoid(rayOrigin, rayDir, cloudCenter, cloudScale, cloudSlice,\ncloudPoint, cloudNormal)) {\nreturn vec4(0.0);\n}\nfloat Id = clamp(dot(cloudNormal, -lightDir), 0.0, 1.0);\nfloat Is = max(pow(dot(-lightDir, -rayDir), 2.0), 0.0);\nfloat It = T(cloudPoint);\nfloat intensity = I(Id, Is, It);\nvec3 color = vec3(intensity * clamp(brightness, 0.1, 1.0));\nvec4 noise = sampleNoiseTexture(u_noiseDetail * cloudPoint);\nfloat W = noise.x;\nfloat W2 = noise.y;\nfloat W3 = noise.z;\nfloat ndDot = clamp(dot(cloudNormal, -rayDir), 0.0, 1.0);\nfloat TR = pow(ndDot, 3.0) - W;\nTR *= 1.3;\nfloat minusDot = 0.5 - ndDot;\nTR -= min(minusDot * W2, 0.0);\nTR -= 0.8 * (minusDot + 0.25) * W3;\nfloat shading = mix(1.0 - 0.8 * W * W, 1.0, Id * TR);\nshading = clamp(shading + 0.2, 0.3, 1.0);\nvec3 finalColor = mix(vec3(0.5), shading * color, 1.15);\nreturn vec4(finalColor, clamp(TR, 0.0, 1.0)) * v_color;\n}\nvoid main() {\n#ifdef DEBUG_BILLBOARDS\ngl_FragColor = vec4(0.0, 0.5, 0.5, 1.0);\n#endif\nvec2 coordinate = v_maximumSize.xy * v_offset;\nvec3 ellipsoidScale = 0.82 * v_maximumSize;\nvec3 ellipsoidCenter = vec3(0.0);\nfloat zOffset = max(ellipsoidScale.z - 10.0, 0.0);\nvec3 eye = vec3(0, 0, -10.0 - zOffset);\nvec3 rayDir = normalize(vec3(coordinate, 1.0) - eye);\nvec3 rayOrigin = eye;\n#ifdef DEBUG_ELLIPSOIDS\nvec3 point, normal;\nif(intersectEllipsoid(rayOrigin, rayDir, ellipsoidCenter, ellipsoidScale, v_slice,\npoint, normal)) {\ngl_FragColor = v_brightness * v_color;\n}\n#else\n#ifndef DEBUG_BILLBOARDS\nvec4 cloud = drawCloud(rayOrigin, rayDir,\nellipsoidCenter, ellipsoidScale, v_slice, v_brightness);\nif(cloud.w < 0.01) {\ndiscard;\n}\ngl_FragColor = cloud;\n#endif\n#endif\n}\n",CloudCollectionVS="#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScaleX;\nattribute vec4 positionLowAndScaleY;\nattribute vec4 packedAttribute0;\nattribute vec4 packedAttribute1;\nattribute vec4 color;\nvarying vec2 v_offset;\nvarying vec3 v_maximumSize;\nvarying vec4 v_color;\nvarying float v_slice;\nvarying float v_brightness;\nvoid main() {\nvec3 positionHigh = positionHighAndScaleX.xyz;\nvec3 positionLow = positionLowAndScaleY.xyz;\nvec2 scale = vec2(positionHighAndScaleX.w, positionLowAndScaleY.w);\nfloat show = packedAttribute0.x;\nfloat brightness = packedAttribute0.y;\nvec2 coordinates = packedAttribute0.wz;\nvec3 maximumSize = packedAttribute1.xyz;\nfloat slice = packedAttribute1.w;\n#ifdef INSTANCED\nvec2 dir = direction;\n#else\nvec2 dir = coordinates;\n#endif\nvec2 offset = dir - vec2(0.5, 0.5);\nvec2 scaledOffset = scale * offset;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xy += scaledOffset;\npositionEC.xyz *= show;\ngl_Position = czm_projection * positionEC;\nv_offset = offset;\nv_maximumSize = maximumSize;\nv_color = color;\nv_slice = slice;\nv_brightness = brightness;\n}\n",CloudNoiseFS="uniform vec3 u_noiseTextureDimensions;\nuniform float u_noiseDetail;\nuniform vec3 u_noiseOffset;\nvarying vec2 v_position;\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nfloat wrap(float value, float rangeLength) {\nif(value < 0.0) {\nfloat absValue = abs(value);\nfloat modValue = mod(absValue, rangeLength);\nreturn mod(rangeLength - modValue, rangeLength);\n}\nreturn mod(value, rangeLength);\n}\nvec3 wrapVec(vec3 value, float rangeLength) {\nreturn vec3(wrap(value.x, rangeLength),\nwrap(value.y, rangeLength),\nwrap(value.z, rangeLength));\n}\nvec3 random3(vec3 p) {\nfloat dot1 = dot(p, vec3(127.1, 311.7, 932.8));\nfloat dot2 = dot(p, vec3(269.5, 183.3, 421.4));\nreturn fract(vec3(sin(dot1 - dot2), cos(dot1 * dot2), dot1 * dot2));\n}\nvec3 getWorleyCellPoint(vec3 centerCell, vec3 offset, float freq) {\nvec3 cell = centerCell + offset;\ncell = wrapVec(cell, textureSliceWidth / u_noiseDetail);\ncell += floor(u_noiseOffset / u_noiseDetail);\nvec3 p = offset + random3(cell);\nreturn p;\n}\nfloat worleyNoise(vec3 p, float freq) {\nvec3 centerCell = floor(p * freq);\nvec3 pointInCell = fract(p * freq);\nfloat shortestDistance = 1000.0;\nfor(float z = -1.0; z <= 1.0; z++) {\nfor(float y = -1.0; y <= 1.0; y++) {\nfor(float x = -1.0; x <= 1.0; x++) {\nvec3 offset = vec3(x, y, z);\nvec3 point = getWorleyCellPoint(centerCell, offset, freq);\nfloat distance = length(pointInCell - point);\nif(distance < shortestDistance) {\nshortestDistance = distance;\n}\n}\n}\n}\nreturn shortestDistance;\n}\nconst float MAX_FBM_ITERATIONS = 10.0;\nfloat worleyFBMNoise(vec3 p, float octaves, float scale) {\nfloat noise = 0.0;\nfloat freq = 1.0;\nfloat persistence = 0.625;\nfor(float i = 0.0; i < MAX_FBM_ITERATIONS; i++) {\nif(i >= octaves) {\nbreak;\n}\nnoise += worleyNoise(p * scale, freq * scale) * persistence;\npersistence *= 0.5;\nfreq *= 2.0;\n}\nreturn noise;\n}\nvoid main() {\nfloat x = mod(v_position.x, textureSliceWidth);\nfloat y = mod(v_position.y, textureSliceWidth);\nfloat sliceRow = floor(v_position.y / textureSliceWidth);\nfloat z = floor(v_position.x / textureSliceWidth) + sliceRow * inverseNoiseTextureRows * textureSliceWidth;\nvec3 position = vec3(x, y, z);\nposition /= u_noiseDetail;\nfloat worley0 = clamp(worleyFBMNoise(position, 3.0, 1.0), 0.0, 1.0);\nfloat worley1 = clamp(worleyFBMNoise(position, 3.0, 2.0), 0.0, 1.0);\nfloat worley2 = clamp(worleyFBMNoise(position, 3.0, 3.0), 0.0, 1.0);\ngl_FragColor = vec4(worley0, worley1, worley2, 1.0);\n}\n",CloudNoiseVS="uniform vec3 u_noiseTextureDimensions;\nattribute vec2 position;\nvarying vec2 v_position;\nvoid main()\n{\ngl_Position = vec4(position, 0.1, 1.0);\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat noiseTextureRows = u_noiseTextureDimensions.y;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nvec2 transformedPos = (position * 0.5) + vec2(0.5);\ntransformedPos *= textureSliceWidth;\ntransformedPos.x *= textureSliceWidth * inverseNoiseTextureRows;\ntransformedPos.y *= noiseTextureRows;\nv_position = transformedPos;\n}\n";function CumulusCloud(e,t){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),!defined(e.scale)&&defined(e.maximumSize))this._maximumSize=Cartesian3.clone(e.maximumSize),this._scale=new Cartesian2(this._maximumSize.x,this._maximumSize.y);else{this._scale=Cartesian2.clone(defaultValue(e.scale,new Cartesian2(20,12)));const t=new Cartesian3(this._scale.x,this._scale.y,Math.min(this._scale.x,this._scale.y)/1.5);this._maximumSize=Cartesian3.clone(defaultValue(e.maximumSize,t))}this._slice=defaultValue(e.slice,-1),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._brightness=defaultValue(e.brightness,1),this._cloudCollection=t,this._index=-1}const SHOW_INDEX$1=CumulusCloud.SHOW_INDEX=0,POSITION_INDEX$1=CumulusCloud.POSITION_INDEX=1,SCALE_INDEX$1=CumulusCloud.SCALE_INDEX=2,MAXIMUM_SIZE_INDEX$1=CumulusCloud.MAXIMUM_SIZE_INDEX=3,SLICE_INDEX$1=CumulusCloud.SLICE_INDEX=4,BRIGHTNESS_INDEX$1=CumulusCloud.BRIGHTNESS_INDEX=5,COLOR_INDEX$1=CumulusCloud.COLOR_INDEX=6;function makeDirty(e,t){const i=e._cloudCollection;defined(i)&&(i._updateCloud(e,t),e._dirty=!0)}let attributeLocations$1;CumulusCloud.NUMBER_OF_PROPERTIES=7,Object.defineProperties(CumulusCloud.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty(this,SHOW_INDEX$1))}},position:{get:function(){return this._position},set:function(e){const t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,POSITION_INDEX$1))}},scale:{get:function(){return this._scale},set:function(e){const t=this._scale;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty(this,SCALE_INDEX$1))}},maximumSize:{get:function(){return this._maximumSize},set:function(e){const t=this._maximumSize;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,MAXIMUM_SIZE_INDEX$1))}},color:{get:function(){return this._color},set:function(e){const t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty(this,COLOR_INDEX$1))}},slice:{get:function(){return this._slice},set:function(e){this._slice!==e&&(this._slice=e,makeDirty(this,SLICE_INDEX$1))}},brightness:{get:function(){return this._brightness},set:function(e){this._brightness!==e&&(this._brightness=e,makeDirty(this,BRIGHTNESS_INDEX$1))}}}),CumulusCloud.prototype._destroy=function(){this._cloudCollection=void 0};const scratchTextureDimensions=new Cartesian3,attributeLocationsBatched={positionHighAndScaleX:0,positionLowAndScaleY:1,packedAttribute0:2,packedAttribute1:3,color:4},attributeLocationsInstanced={direction:0,positionHighAndScaleX:1,positionLowAndScaleY:2,packedAttribute0:3,packedAttribute1:4,color:5},SHOW_INDEX=CumulusCloud.SHOW_INDEX,POSITION_INDEX=CumulusCloud.POSITION_INDEX,SCALE_INDEX=CumulusCloud.SCALE_INDEX,MAXIMUM_SIZE_INDEX=CumulusCloud.MAXIMUM_SIZE_INDEX,SLICE_INDEX=CumulusCloud.SLICE_INDEX,BRIGHTNESS_INDEX=CumulusCloud.BRIGHTNESS_INDEX,NUMBER_OF_PROPERTIES=CumulusCloud.NUMBER_OF_PROPERTIES,COLOR_INDEX=CumulusCloud.COLOR_INDEX;function CloudCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES),this._noiseTexture=void 0,this._textureSliceWidth=128,this._noiseTextureRows=4,this.noiseDetail=defaultValue(e.noiseDetail,16),this.noiseOffset=Cartesian3.clone(defaultValue(e.noiseOffset,Cartesian3.ZERO)),this._loading=!1,this._ready=!1;const t=this;this._uniforms={u_noiseTexture:function(){return t._noiseTexture},u_noiseTextureDimensions:getNoiseTextureDimensions(t),u_noiseDetail:function(){return t.noiseDetail}},this._vaNoise=void 0,this._spNoise=void 0,this._spCreated=!1,this._sp=void 0,this._rs=void 0,this.show=defaultValue(e.show,!0),this._colorCommands=[],this.debugBillboards=defaultValue(e.debugBillboards,!1),this._compiledDebugBillboards=!1,this.debugEllipsoids=defaultValue(e.debugEllipsoids,!1),this._compiledDebugEllipsoids=!1}function getNoiseTextureDimensions(e){return function(){return scratchTextureDimensions.x=e._textureSliceWidth,scratchTextureDimensions.y=e._noiseTextureRows,scratchTextureDimensions.z=1/e._noiseTextureRows,scratchTextureDimensions}}function destroyClouds(e){const t=e.length;for(let i=0;i<t;++i)e[i]&&e[i]._destroy()}function removeClouds(e){if(e._cloudsRemoved){e._cloudsRemoved=!1;const t=[],i=e._clouds,n=i.length;for(let e=0,r=0;e<n;++e){const n=i[e];defined(n)&&(i._index=r++,t.push(n))}e._clouds=t}}Object.defineProperties(CloudCollection.prototype,{length:{get:function(){return removeClouds(this),this._clouds.length}}}),CloudCollection.prototype.add=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);let t;return defaultValue(e.cloudType,CloudType$1.CUMULUS)===CloudType$1.CUMULUS&&(t=new CumulusCloud(e,this),t._index=this._clouds.length,this._clouds.push(t),this._createVertexArray=!0),t},CloudCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._clouds[e._index]=void 0,this._cloudsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},CloudCollection.prototype.removeAll=function(){destroyClouds(this._clouds),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!0},CloudCollection.prototype._updateCloud=function(e,t){e._dirty||(this._cloudsToUpdate[this._cloudsToUpdateIndex++]=e),++this._propertiesChanged[t]},CloudCollection.prototype.contains=function(e){return defined(e)&&e._cloudCollection===this},CloudCollection.prototype.get=function(e){return removeClouds(this),this._clouds[e]};const texturePositions=new Float32Array([-1,-1,1,-1,1,1,-1,1]),textureIndices=new Uint16Array([0,1,2,0,2,3]);function createTextureVA(e){const t=Buffer$1.createVertexBuffer({context:e,typedArray:texturePositions,usage:BufferUsage$1.STATIC_DRAW}),i=Buffer$1.createIndexBuffer({context:e,typedArray:textureIndices,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});return new VertexArray({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT}],indexBuffer:i})}let getIndexBuffer;function getIndexBufferBatched(e){let t=e.cache.cloudCollection_indexBufferBatched;if(defined(t))return t;const i=new Uint16Array(98298);for(let e=0,t=0;e<98298;e+=6,t+=4)i[e]=t,i[e+1]=t+1,i[e+2]=t+2,i[e+3]=t,i[e+4]=t+2,i[e+5]=t+3;return t=Buffer$1.createIndexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferBatched=t,t}function getIndexBufferInstanced(e){let t=e.cache.cloudCollection_indexBufferInstanced;return defined(t)||(t=Buffer$1.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferInstanced=t),t}function getVertexBufferInstanced(e){let t=e.cache.cloudCollection_vertexBufferInstanced;return defined(t)||(t=Buffer$1.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:BufferUsage$1.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_vertexBufferInstanced=t),t}function createVAF(e,t,i){const n=[{index:attributeLocations$1.positionHighAndScaleX,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.positionLowAndScaleY,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.packedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.packedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.color,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,usage:BufferUsage$1.STATIC_DRAW}];i&&n.push({index:attributeLocations$1.direction,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:getVertexBufferInstanced(e)});return new VertexArrayFacade(e,n,i?t:4*t,i)}const writePositionScratch=new EncodedCartesian3;function writePositionAndScale(e,t,i,n){let r;const o=i[attributeLocations$1.positionHighAndScaleX],a=i[attributeLocations$1.positionLowAndScaleY],s=n.position;EncodedCartesian3.fromCartesian(s,writePositionScratch);const c=n.scale,l=writePositionScratch.high,u=writePositionScratch.low;e._instanced?(r=n._index,o(r,l.x,l.y,l.z,c.x),a(r,u.x,u.y,u.z,c.y)):(r=4*n._index,o(r+0,l.x,l.y,l.z,c.x),o(r+1,l.x,l.y,l.z,c.x),o(r+2,l.x,l.y,l.z,c.x),o(r+3,l.x,l.y,l.z,c.x),a(r+0,u.x,u.y,u.z,c.y),a(r+1,u.x,u.y,u.z,c.y),a(r+2,u.x,u.y,u.z,c.y),a(r+3,u.x,u.y,u.z,c.y))}function writePackedAttribute0(e,t,i,n){let r;const o=i[attributeLocations$1.packedAttribute0],a=n.show,s=n.brightness;e._instanced?(r=n._index,o(r,a,s,0,0)):(r=4*n._index,o(r+0,a,s,0,0),o(r+1,a,s,1,0),o(r+2,a,s,1,1),o(r+3,a,s,0,1))}function writePackedAttribute1(e,t,i,n){let r;const o=i[attributeLocations$1.packedAttribute1],a=n.maximumSize,s=n.slice;e._instanced?(r=n._index,o(r,a.x,a.y,a.z,s)):(r=4*n._index,o(r+0,a.x,a.y,a.z,s),o(r+1,a.x,a.y,a.z,s),o(r+2,a.x,a.y,a.z,s),o(r+3,a.x,a.y,a.z,s))}function writeColor(e,t,i,n){let r;const o=i[attributeLocations$1.color],a=n.color,s=Color.floatToByte(a.red),c=Color.floatToByte(a.green),l=Color.floatToByte(a.blue),u=Color.floatToByte(a.alpha);e._instanced?(r=n._index,o(r,s,c,l,u)):(r=4*n._index,o(r+0,s,c,l,u),o(r+1,s,c,l,u),o(r+2,s,c,l,u),o(r+3,s,c,l,u))}function writeCloud(e,t,i,n){writePositionAndScale(e,t,i,n),writePackedAttribute0(e,t,i,n),writePackedAttribute1(e,t,i,n),writeColor(e,t,i,n)}function createNoiseTexture(e,t,i,n){const r=e,o=r._textureSliceWidth,a=r._noiseTextureRows,s=t.context;r._vaNoise=createTextureVA(s),r._spNoise=ShaderProgram.fromCache({context:s,vertexShaderSource:i,fragmentShaderSource:n,attributeLocations:{position:0}});const c=r.noiseDetail,l=r.noiseOffset;r._noiseTexture=new Texture({context:s,width:o*o/a,height:o*a,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,pixelFormat:PixelFormat$1.RGBA,sampler:new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})});const u=new ComputeCommand({vertexArray:r._vaNoise,shaderProgram:r._spNoise,outputTexture:r._noiseTexture,uniformMap:{u_noiseTextureDimensions:getNoiseTextureDimensions(r),u_noiseDetail:function(){return c},u_noiseOffset:function(){return l}},persists:!1,owner:e,postExecute:function(e){r._ready=!0,r._loading=!1}});t.commandList.push(u),r._loading=!0}function createVertexArray(e,t){const i=e,n=t.context;i._createVertexArray=!1,i._vaf=i._vaf&&i._vaf.destroy();const r=e._clouds,o=r.length;if(o>0){i._vaf=createVAF(n,o,i._instanced);const a=i._vaf.writers;let s;for(s=0;s<o;++s){writeCloud(e,t,a,r[s])}i._vaf.commit(getIndexBuffer(n))}}const scratchWriterArray=[];function updateClouds(e,t){const i=t.context,n=e,r=n._clouds.length,o=n._cloudsToUpdate,a=n._cloudsToUpdateIndex,s=n._propertiesChanged,c=scratchWriterArray;c.length=0,(s[POSITION_INDEX]||s[SCALE_INDEX])&&c.push(writePositionAndScale),(s[SHOW_INDEX]||s[BRIGHTNESS_INDEX])&&c.push(writePackedAttribute0),(s[MAXIMUM_SIZE_INDEX]||s[SLICE_INDEX])&&c.push(writePackedAttribute1),s[COLOR_INDEX]&&c.push(writeColor);const l=c.length,u=n._vaf.writers;let d,h,p;if(a/r>.1){for(d=0;d<a;++d)for(h=o[d],h._dirty=!1,p=0;p<l;++p)c[p](e,t,u,h);n._vaf.commit(getIndexBuffer(i))}else{for(d=0;d<a;++d){for(h=o[d],h._dirty=!1,p=0;p<l;++p)c[p](e,t,u,h);n._instanced?n._vaf.subCommit(h._index,1):n._vaf.subCommit(4*h._index,4)}n._vaf.endSubCommits()}n._cloudsToUpdateIndex=0}function createShaderProgram(e,t,i,n){const r=t.context,o=e,a=new ShaderSource({defines:[],sources:[i]});o._instanced&&a.defines.push("INSTANCED");const s=new ShaderSource({defines:[],sources:[n]});o.debugBillboards&&s.defines.push("DEBUG_BILLBOARDS"),o.debugEllipsoids&&s.defines.push("DEBUG_ELLIPSOIDS"),o._sp=ShaderProgram.replaceCache({context:r,shaderProgram:o._sp,vertexShaderSource:a,fragmentShaderSource:s,attributeLocations:attributeLocations$1}),o._rs=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LESS},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}),o._spCreated=!0,o._compiledDebugBillboards=o.debugBillboards,o._compiledDebugEllipsoids=o.debugEllipsoids}function createDrawCommands(e,t){const i=e,n=t.passes,r=i._uniforms,o=t.commandList;if(n.render){const t=i._colorCommands,n=i._vaf.va,a=n.length;t.length=a;for(let s=0;s<a;s++){let a=t[s];defined(a)||(a=t[s]=new DrawCommand),a.pass=Pass$1.TRANSLUCENT,a.owner=e,a.uniformMap=r,a.count=n[s].indicesCount,a.vertexArray=n[s].va,a.shaderProgram=i._sp,a.renderState=i._rs,i._instanced&&(a.count=6,a.instanceCount=i._clouds.length),o.push(a)}}}function computeFlyToLocationForRectangle(e,t){const i=t.terrainProvider,n=t.mapProjection,r=n.ellipsoid;let o;const a=t.camera.getRectangleCameraCoordinates(e);return o=t.mode===SceneMode$1.SCENE3D?r.cartesianToCartographic(a):n.unproject(a),defined(i)?i.readyPromise.then((function(){if(!defined(i.availability)||t.mode===SceneMode$1.SCENE2D)return o;const n=[Rectangle.center(e),Rectangle.southeast(e),Rectangle.southwest(e),Rectangle.northeast(e),Rectangle.northwest(e)];return computeFlyToLocationForRectangle._sampleTerrainMostDetailed(i,n).then((function(e){const t=e.reduce((function(e,t){return Math.max(t.height,e)}),-Number.MAX_VALUE),i=o;return i.height+=t,i}))})):Promise.resolve(o)}CloudCollection.prototype.update=function(e){if(removeClouds(this),!this.show)return;const t=this.debugBillboards||this.debugEllipsoids;this._ready=!!t||defined(this._noiseTexture),this._ready||this._loading||t||createNoiseTexture(this,e,CloudNoiseVS,CloudNoiseFS),this._instanced=e.context.instancedArrays,attributeLocations$1=this._instanced?attributeLocationsInstanced:attributeLocationsBatched,getIndexBuffer=this._instanced?getIndexBufferInstanced:getIndexBufferBatched;const i=this._clouds.length,n=this._cloudsToUpdate,r=this._cloudsToUpdateIndex;this._createVertexArray?createVertexArray(this,e):r>0&&updateClouds(this,e),r>1.5*i&&(n.length=i),!defined(this._vaf)||!defined(this._vaf.va)||!this._ready&!t||(this._spCreated&&this.debugBillboards===this._compiledDebugBillboards&&this.debugEllipsoids===this._compiledDebugEllipsoids||createShaderProgram(this,e,CloudCollectionVS,CloudCollectionFS),createDrawCommands(this,e))},CloudCollection.prototype.isDestroyed=function(){return!1},CloudCollection.prototype.destroy=function(){return this._noiseTexture=this._noiseTexture&&this._noiseTexture.destroy(),this._sp=this._sp&&this._sp.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyClouds(this._clouds),destroyObject(this)},computeFlyToLocationForRectangle._sampleTerrainMostDetailed=sampleTerrainMostDetailed;const defaultAngle=CesiumMath.toRadians(30);function ConeEmitter(e){this._angle=defaultValue(e,defaultAngle)}Object.defineProperties(ConeEmitter.prototype,{angle:{get:function(){return this._angle},set:function(e){this._angle=e}}}),ConeEmitter.prototype.emit=function(e){const t=Math.tan(this._angle),i=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),n=CesiumMath.randomBetween(0,t),r=n*Math.cos(i),o=n*Math.sin(i);e.velocity=Cartesian3.fromElements(r,o,1,e.velocity),Cartesian3.normalize(e.velocity,e.velocity),e.position=Cartesian3.clone(Cartesian3.ZERO,e.position)};const scratchColor$2=new Color,scratchColorAbove=new Color,scratchColorBelow=new Color,scratchColorBlend=new Color,scratchPackedFloat=new Cartesian4,scratchColorBytes=new Uint8Array(4);function lerpEntryColor(e,t,i,n){const r=t.height===i.height?0:(e-t.height)/(i.height-t.height);return Color.lerp(t.color,i.color,r,n)}function createNewEntry(e,t){return{height:e,color:Color.clone(t)}}function removeDuplicates(e){return e=e.filter((function(e,t,i){const n=t>0,r=t<i.length-1,o=!n||e.height===i[t-1].height,a=!r||e.height===i[t+1].height;return!o||!a})),e=e.filter((function(e,t,i){const n=t>0,r=t<i.length-1,o=!!n&&Color.equals(e.color,i[t-1].color),a=!!r&&Color.equals(e.color,i[t+1].color);return!o||!a})),e=e.filter((function(e,t,i){const n=t>0,r=!!n&&Color.equals(e.color,i[t-1].color),o=!n||e.height===i[t-1].height;return!r||!o})),e}function preprocess(e){let t,i;const n=[],r=e.length;for(t=0;t<r;t++){const r=e[t],o=r.entries,a=o.length;let s=[];for(i=0;i<a;i++){const e=o[i],t=CesiumMath.clamp(e.height,createElevationBandMaterial._minimumHeight,createElevationBandMaterial._maximumHeight),n=Color.clone(e.color,scratchColor$2);n.red*=n.alpha,n.green*=n.alpha,n.blue*=n.alpha,s.push(createNewEntry(t,n))}let c=!0,l=!0;for(i=0;i<a-1;i++){const e=s[i+0],t=s[i+1];c=c&&e.height<=t.height,l=l&&e.height>=t.height}l?s=s.reverse():c||mergeSort(s,(function(e,t){return CesiumMath.sign(e.height-t.height)}));let u=defaultValue(r.extendDownwards,!1),d=defaultValue(r.extendUpwards,!1);1!==s.length||u||d||(u=!0,d=!0),u&&s.splice(0,0,createNewEntry(createElevationBandMaterial._minimumHeight,s[0].color)),d&&s.splice(s.length,0,createNewEntry(createElevationBandMaterial._maximumHeight,s[s.length-1].color)),s=removeDuplicates(s),n.push(s)}return n}function createLayeredEntries(e){const t=preprocess(e);let i,n=[],r=[];function o(e,t){n.push(createNewEntry(e,t))}function a(e,t,i){let n=Color.multiplyByScalar(i,1-t.alpha,scratchColorBlend);n=Color.add(n,t,n),o(e,n)}const s=t.length;for(i=0;i<s;i++){const e=t[i];let s=0,c=0;r=n,n=[];const l=e.length,u=r.length;for(;s<l||c<u;){const t=s<l?e[s]:void 0,i=s>0?e[s-1]:void 0,n=s<l-1?e[s+1]:void 0,d=c<u?r[c]:void 0,h=c>0?r[c-1]:void 0,p=c<u-1?r[c+1]:void 0;if(defined(t)&&defined(d)&&t.height===d.height){const e=defined(p)&&d.height===p.height,r=!defined(h),l=!defined(p),u=defined(n)&&t.height===n.height,f=!defined(i),m=!defined(n);e?u?(a(t.height,t.color,d.color),a(t.height,n.color,p.color)):f?(o(t.height,d.color),a(t.height,t.color,p.color)):m?(a(t.height,t.color,d.color),o(t.height,p.color)):(a(t.height,t.color,d.color),a(t.height,t.color,p.color)):r?u?(o(t.height,t.color),a(t.height,n.color,d.color)):m?(o(t.height,t.color),o(t.height,d.color)):(f||o(t.height,t.color),a(t.height,t.color,d.color)):l?u?(a(t.height,t.color,d.color),o(t.height,n.color)):f?(o(t.height,d.color),o(t.height,t.color)):m?a(t.height,t.color,d.color):(a(t.height,t.color,d.color),o(t.height,t.color)):u?(a(t.height,t.color,d.color),a(t.height,n.color,d.color)):f?(o(t.height,d.color),a(t.height,t.color,d.color)):m?(a(t.height,t.color,d.color),o(t.height,d.color)):a(t.height,t.color,d.color),s+=u?2:1,c+=e?2:1}else if(defined(t)&&defined(d)&&defined(h)&&t.height<d.height){const e=lerpEntryColor(t.height,h,d,scratchColorBelow);defined(i)?defined(n)?a(t.height,t.color,e):(a(t.height,t.color,e),o(t.height,e)):(o(t.height,e),a(t.height,t.color,e)),s++}else if(defined(d)&&defined(t)&&defined(i)&&d.height<t.height){const e=lerpEntryColor(d.height,i,t,scratchColorAbove);defined(h)?defined(p)?a(d.height,e,d.color):(a(d.height,e,d.color),o(d.height,e)):(o(d.height,e),a(d.height,e,d.color)),c++}else defined(t)&&(!defined(d)||t.height<d.height)?(!defined(d)||defined(h)||defined(n)?(defined(d)||!defined(h)||defined(i)||(o(h.height,createElevationBandMaterial._emptyColor),o(t.height,createElevationBandMaterial._emptyColor)),o(t.height,t.color)):(o(t.height,t.color),o(t.height,createElevationBandMaterial._emptyColor),o(d.height,createElevationBandMaterial._emptyColor)),s++):defined(d)&&(!defined(t)||d.height<t.height)&&(o(d.height,d.color),c++)}}return removeDuplicates(n)}function createElevationBandMaterial(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).scene,i=createLayeredEntries(e.layers),n=i.length;let r,o,a,s;if(!createElevationBandMaterial._useFloatTexture(t.context))for(a=PixelDatatype$1.UNSIGNED_BYTE,s=PixelFormat$1.RGBA,o=new Uint8Array(4*n),r=0;r<n;r++)Cartesian4.packFloat(i[r].height,scratchPackedFloat),Cartesian4.pack(scratchPackedFloat,o,4*r);else for(a=PixelDatatype$1.FLOAT,s=PixelFormat$1.LUMINANCE,o=new Float32Array(n),r=0;r<n;r++)o[r]=i[r].height;const c=Texture.create({context:t.context,pixelFormat:s,pixelDatatype:a,source:{arrayBufferView:o,width:n,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),l=new Uint8Array(4*n);for(r=0;r<n;r++){i[r].color.toBytes(scratchColorBytes),l[4*r+0]=scratchColorBytes[0],l[4*r+1]=scratchColorBytes[1],l[4*r+2]=scratchColorBytes[2],l[4*r+3]=scratchColorBytes[3]}const u=Texture.create({context:t.context,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:l,width:n,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})});return Material$4.fromType("ElevationBand",{heights:c,colors:u})}function createOsmBuildings(e){const t=new Cesium3DTileset(e=combine$2(e,{url:IonResource.fromAssetId(96188)}));let i=e.style;if(!defined(i)){i=new Cesium3DTileStyle({color:`Boolean(\${feature['cesium#color']}) ? color(\${feature['cesium#color']}) : ${defaultValue(e.defaultColor,Color.WHITE).toCssColorString()}`})}return t.style=i,t}function createTangentSpaceDebugPrimitive(e){const t=[];let i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometry;defined(i.attributes)&&defined(i.primitiveType)||(i=i.constructor.createGeometry(i));const n=i.attributes,r=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),o=defaultValue(e.length,1e4);if(defined(n.normal)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"normal",o),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)},modelMatrix:r})),defined(n.tangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"tangent",o),attributes:{color:new ColorGeometryInstanceAttribute(0,1,0,1)},modelMatrix:r})),defined(n.bitangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"bitangent",o),attributes:{color:new ColorGeometryInstanceAttribute(0,0,1,1)},modelMatrix:r})),t.length>0)return new Primitive$3({asynchronous:!1,geometryInstances:t,appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1})})}createElevationBandMaterial._useFloatTexture=function(e){return e.floatingPointTexture},createElevationBandMaterial._maximumHeight=5906376425472,createElevationBandMaterial._minimumHeight=-5906376425472,createElevationBandMaterial._emptyColor=new Color(0,0,0,0);const templateRegex$1=/{[^}]+}/g,tags$1={x:xTag$1,y:yTag$1,z:zTag$1,s:sTag$1,reverseX:reverseXTag$1,reverseY:reverseYTag$1,reverseZ:reverseZTag$1,westDegrees:westDegreesTag$1,southDegrees:southDegreesTag$1,eastDegrees:eastDegreesTag$1,northDegrees:northDegreesTag$1,westProjected:westProjectedTag$1,southProjected:southProjectedTag$1,eastProjected:eastProjectedTag$1,northProjected:northProjectedTag$1,width:widthTag$1,height:heightTag$1},pickFeaturesTags$1=combine$2(tags$1,{i:iTag$1,j:jTag$1,reverseI:reverseITag$1,reverseJ:reverseJTag$1,longitudeDegrees:longitudeDegreesTag$1,latitudeDegrees:latitudeDegreesTag$1,longitudeProjected:longitudeProjectedTag$1,latitudeProjected:latitudeProjectedTag$1,format:formatTag$1});function UrlTemplateImageryProvider(e){this._errorEvent=new Event,this._resource=void 0,this._urlSchemeZeroPadding=void 0,this._pickFeaturesResource=void 0,this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._minimumLevel=void 0,this._tilingScheme=void 0,this._rectangle=void 0,this._tileDiscardPolicy=void 0,this._credit=void 0,this._hasAlphaChannel=void 0,this._readyPromise=void 0,this._tags=void 0,this._pickFeaturesTags=void 0,this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this.enablePickFeatures=!0,this.reinitialize(e)}Object.defineProperties(UrlTemplateImageryProvider.prototype,{url:{get:function(){return this._resource.url}},urlSchemeZeroPadding:{get:function(){return this._urlSchemeZeroPadding}},pickFeaturesUrl:{get:function(){return this._pickFeaturesResource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return defined(this._resource)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}}),UrlTemplateImageryProvider.prototype.reinitialize=function(e){const t=this;t._readyPromise=Promise.resolve(e).then((function(e){const i=e.customTags,n=combine$2(tags$1,i),r=combine$2(pickFeaturesTags$1,i),o=Resource.createIfNeeded(e.url),a=Resource.createIfNeeded(e.pickFeaturesUrl);t.enablePickFeatures=defaultValue(e.enablePickFeatures,t.enablePickFeatures),t._urlSchemeZeroPadding=defaultValue(e.urlSchemeZeroPadding,t.urlSchemeZeroPadding),t._tileDiscardPolicy=e.tileDiscardPolicy,t._getFeatureInfoFormats=e.getFeatureInfoFormats,t._subdomains=e.subdomains,Array.isArray(t._subdomains)?t._subdomains=t._subdomains.slice():defined(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=defaultValue(e.tileWidth,256),t._tileHeight=defaultValue(e.tileHeight,256),t._minimumLevel=defaultValue(e.minimumLevel,0),t._maximumLevel=e.maximumLevel,t._tilingScheme=defaultValue(e.tilingScheme,new WebMercatorTilingScheme({ellipsoid:e.ellipsoid})),t._rectangle=defaultValue(e.rectangle,t._tilingScheme.rectangle),t._rectangle=Rectangle.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=defaultValue(e.hasAlphaChannel,!0);let s=e.credit;return"string"==typeof s&&(s=new Credit(s)),t._credit=s,t._resource=o,t._tags=n,t._pickFeaturesResource=a,t._pickFeaturesTags=r,!0}))},UrlTemplateImageryProvider.prototype.getTileCredits=function(e,t,i){},UrlTemplateImageryProvider.prototype.requestImage=function(e,t,i,n){return ImageryProvider.loadImage(this,buildImageResource$2(this,e,t,i,n))},UrlTemplateImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){if(!this.enablePickFeatures||!defined(this._pickFeaturesResource)||0===this._getFeatureInfoFormats.length)return;let o=0;const a=this;function s(e,t){return e.callback(t)}return function c(){if(o>=a._getFeatureInfoFormats.length)return Promise.resolve([]);const l=a._getFeatureInfoFormats[o],u=buildPickFeaturesResource$1(a,e,t,i,n,r,l.format);return++o,"json"===l.type?u.fetchJson().then(l.callback).catch(c):"xml"===l.type?u.fetchXML().then(l.callback).catch(c):"text"===l.type||"html"===l.type?u.fetchText().then(l.callback).catch(c):u.fetch({responseType:l.format}).then(s.bind(void 0,l)).catch(c)}()};let degreesScratchComputed$1=!1;const degreesScratch$1=new Rectangle;let projectedScratchComputed$1=!1;const projectedScratch$1=new Rectangle;function buildImageResource$2(e,t,i,n,r){degreesScratchComputed$1=!1,projectedScratchComputed$1=!1;const o=e._resource,a=o.getUrlComponent(!0),s=e._tags,c={},l=a.match(templateRegex$1);return defined(l)&&l.forEach((function(r){const o=r.substring(1,r.length-1);defined(s[o])&&(c[o]=s[o](e,t,i,n))})),o.getDerivedResource({request:r,templateValues:c})}let ijScratchComputed$1=!1;const ijScratch$1=new Cartesian2;let longitudeLatitudeProjectedScratchComputed$1=!1;function buildPickFeaturesResource$1(e,t,i,n,r,o,a){degreesScratchComputed$1=!1,projectedScratchComputed$1=!1,ijScratchComputed$1=!1,longitudeLatitudeProjectedScratchComputed$1=!1;const s=e._pickFeaturesResource,c=s.getUrlComponent(!0),l=e._pickFeaturesTags,u={},d=c.match(templateRegex$1);return defined(d)&&d.forEach((function(s){const c=s.substring(1,s.length-1);defined(l[c])&&(u[c]=l[c](e,t,i,n,r,o,a))})),s.getDerivedResource({templateValues:u})}function padWithZerosIfNecessary$1(e,t,i){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){const n=e.urlSchemeZeroPadding[t];if("string"==typeof n){const e=n.length;e>1&&(i=i.length>=e?i:new Array(e-i.toString().length+1).join("0")+i)}}return i}function xTag$1(e,t,i,n){return padWithZerosIfNecessary$1(e,"{x}",t)}function reverseXTag$1(e,t,i,n){const r=e.tilingScheme.getNumberOfXTilesAtLevel(n)-t-1;return padWithZerosIfNecessary$1(e,"{reverseX}",r)}function yTag$1(e,t,i,n){return padWithZerosIfNecessary$1(e,"{y}",i)}function reverseYTag$1(e,t,i,n){const r=e.tilingScheme.getNumberOfYTilesAtLevel(n)-i-1;return padWithZerosIfNecessary$1(e,"{reverseY}",r)}function reverseZTag$1(e,t,i,n){const r=e.maximumLevel;return padWithZerosIfNecessary$1(e,"{reverseZ}",defined(r)&&n<r?r-n-1:n)}function zTag$1(e,t,i,n){return padWithZerosIfNecessary$1(e,"{z}",n)}function sTag$1(e,t,i,n){const r=(t+i+n)%e._subdomains.length;return e._subdomains[r]}function computeDegrees$1(e,t,i,n){degreesScratchComputed$1||(e.tilingScheme.tileXYToRectangle(t,i,n,degreesScratch$1),degreesScratch$1.west=CesiumMath.toDegrees(degreesScratch$1.west),degreesScratch$1.south=CesiumMath.toDegrees(degreesScratch$1.south),degreesScratch$1.east=CesiumMath.toDegrees(degreesScratch$1.east),degreesScratch$1.north=CesiumMath.toDegrees(degreesScratch$1.north),degreesScratchComputed$1=!0)}function westDegreesTag$1(e,t,i,n){return computeDegrees$1(e,t,i,n),degreesScratch$1.west}function southDegreesTag$1(e,t,i,n){return computeDegrees$1(e,t,i,n),degreesScratch$1.south}function eastDegreesTag$1(e,t,i,n){return computeDegrees$1(e,t,i,n),degreesScratch$1.east}function northDegreesTag$1(e,t,i,n){return computeDegrees$1(e,t,i,n),degreesScratch$1.north}function computeProjected$1(e,t,i,n){projectedScratchComputed$1||(e.tilingScheme.tileXYToNativeRectangle(t,i,n,projectedScratch$1),projectedScratchComputed$1=!0)}function westProjectedTag$1(e,t,i,n){return computeProjected$1(e,t,i,n),projectedScratch$1.west}function southProjectedTag$1(e,t,i,n){return computeProjected$1(e,t,i,n),projectedScratch$1.south}function eastProjectedTag$1(e,t,i,n){return computeProjected$1(e,t,i,n),projectedScratch$1.east}function northProjectedTag$1(e,t,i,n){return computeProjected$1(e,t,i,n),projectedScratch$1.north}function widthTag$1(e,t,i,n){return e.tileWidth}function heightTag$1(e,t,i,n){return e.tileHeight}function iTag$1(e,t,i,n,r,o,a){return computeIJ$1(e,t,i,n,r,o),ijScratch$1.x}function jTag$1(e,t,i,n,r,o,a){return computeIJ$1(e,t,i,n,r,o),ijScratch$1.y}function reverseITag$1(e,t,i,n,r,o,a){return computeIJ$1(e,t,i,n,r,o),e.tileWidth-ijScratch$1.x-1}function reverseJTag$1(e,t,i,n,r,o,a){return computeIJ$1(e,t,i,n,r,o),e.tileHeight-ijScratch$1.y-1}const rectangleScratch$1=new Rectangle,longitudeLatitudeProjectedScratch$1=new Cartesian3;function computeIJ$1(e,t,i,n,r,o,a){if(ijScratchComputed$1)return;computeLongitudeLatitudeProjected$1(e,t,i,n,r,o);const s=longitudeLatitudeProjectedScratch$1,c=e.tilingScheme.tileXYToNativeRectangle(t,i,n,rectangleScratch$1);ijScratch$1.x=e.tileWidth*(s.x-c.west)/c.width|0,ijScratch$1.y=e.tileHeight*(c.north-s.y)/c.height|0,ijScratchComputed$1=!0}function longitudeDegreesTag$1(e,t,i,n,r,o,a){return CesiumMath.toDegrees(r)}function latitudeDegreesTag$1(e,t,i,n,r,o,a){return CesiumMath.toDegrees(o)}function longitudeProjectedTag$1(e,t,i,n,r,o,a){return computeLongitudeLatitudeProjected$1(e,t,i,n,r,o),longitudeLatitudeProjectedScratch$1.x}function latitudeProjectedTag$1(e,t,i,n,r,o,a){return computeLongitudeLatitudeProjected$1(e,t,i,n,r,o),longitudeLatitudeProjectedScratch$1.y}const cartographicScratch$2=new Cartographic;function computeLongitudeLatitudeProjected$1(e,t,i,n,r,o,a){if(!longitudeLatitudeProjectedScratchComputed$1){if(e.tilingScheme.projection instanceof GeographicProjection)longitudeLatitudeProjectedScratch$1.x=CesiumMath.toDegrees(r),longitudeLatitudeProjectedScratch$1.y=CesiumMath.toDegrees(o);else{const t=cartographicScratch$2;t.longitude=r,t.latitude=o,e.tilingScheme.projection.project(t,longitudeLatitudeProjectedScratch$1)}longitudeLatitudeProjectedScratchComputed$1=!0}}function formatTag$1(e,t,i,n,r,o,a){return a}function TileMapServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defer();let i;UrlTemplateImageryProvider.call(this,t.promise),this._tmsResource=void 0,this._xmlResource=void 0,this._options=e,this._deferred=t,this._metadataError=void 0,this._metadataSuccess=this._metadataSuccess.bind(this),this._metadataFailure=this._metadataFailure.bind(this),this._requestMetadata=this._requestMetadata.bind(this);const n=this;Promise.resolve(e.url).then((function(e){i=Resource.createIfNeeded(e),i.appendForwardSlash(),n._tmsResource=i,n._xmlResource=i.getDerivedResource({url:"tilemapresource.xml"}),n._requestMetadata()})).catch((function(e){t.reject(e)}))}function confineRectangleToTilingScheme(e,t){return e.west<t.rectangle.west&&(e.west=t.rectangle.west),e.east>t.rectangle.east&&(e.east=t.rectangle.east),e.south<t.rectangle.south&&(e.south=t.rectangle.south),e.north>t.rectangle.north&&(e.north=t.rectangle.north),e}function calculateSafeMinimumDetailLevel(e,t,i){const n=e.positionToTileXY(Rectangle.southwest(t),i),r=e.positionToTileXY(Rectangle.northeast(t),i);return(Math.abs(r.x-n.x)+1)*(Math.abs(r.y-n.y)+1)>4?0:i}function GoogleEarthEnterpriseMapsProvider(e){e=defaultValue(e,{}),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1.9,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=e.url,i=defaultValue(e.path,"/default_map"),n=Resource.createIfNeeded(t).getDerivedResource({url:"/"===i[0]?i.substring(1):i});n.appendForwardSlash(),this._resource=n,this._url=t,this._path=i,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new Credit(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${GoogleEarthEnterpriseMapsProvider.logoUrl}" title="Google Imagery"/></a>`),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new Event,this._ready=!1,this._readyPromise=defer();const r=n.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),o=this;let a;function s(){r.fetchText().then((function(t){!function(t){let i,n,r;try{i=JSON.parse(t)}catch(e){i=JSON.parse(t.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(let e=0;e<i.layers.length;e++)if(i.layers[e].id===o._channel){n=i.layers[e];break}if(!defined(n))throw r=`Could not find layer with channel (id) of ${o._channel}.`,a=TileProviderError.handleError(a,o,o._errorEvent,r,void 0,void 0,void 0,s),new RuntimeError(r);if(!defined(n.version))throw r=`Could not find a version in channel (id) ${o._channel}.`,a=TileProviderError.handleError(a,o,o._errorEvent,r,void 0,void 0,void 0,s),new RuntimeError(r);if(o._version=n.version,defined(i.projection)&&"flat"===i.projection)o._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:e.ellipsoid});else{if(defined(i.projection)&&"mercator"!==i.projection)throw r=`Unsupported projection ${i.projection}.`,a=TileProviderError.handleError(a,o,o._errorEvent,r,void 0,void 0,void 0,s),new RuntimeError(r);o._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid})}o._ready=!0,o._readyPromise.resolve(!0),TileProviderError.handleSuccess(a)}(t)})).catch((function(e){!function(e){const t=defaultValue(e.message,`An error occurred while accessing ${r.url}.`);a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,s),o._readyPromise.reject(new RuntimeError(t))}(e)}))}s()}defined(Object.create)&&(TileMapServiceImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),TileMapServiceImageryProvider.prototype.constructor=TileMapServiceImageryProvider),TileMapServiceImageryProvider.prototype._requestMetadata=function(){this._xmlResource.fetchXML().then(this._metadataSuccess).catch(this._metadataFailure)},TileMapServiceImageryProvider.prototype._metadataSuccess=function(e){const t=/tileformat/i,i=/tileset/i,n=/tilesets/i,r=/boundingbox/i;let o,a,s;const c=[],l=this._xmlResource;let u=this._metadataError;const d=this._deferred,h=this._requestMetadata,p=e.childNodes[0].childNodes;for(let e=0;e<p.length;e++)if(t.test(p.item(e).nodeName))o=p.item(e);else if(n.test(p.item(e).nodeName)){s=p.item(e);const t=p.item(e).childNodes;for(let e=0;e<t.length;e++)i.test(t.item(e).nodeName)&&c.push(t.item(e))}else r.test(p.item(e).nodeName)&&(a=p.item(e));let f;if(!defined(s)||!defined(a))return f=`Unable to find expected tilesets or bbox attributes in ${l.url}.`,u=TileProviderError.handleError(u,this,this.errorEvent,f,void 0,void 0,void 0,h),u.retry||d.reject(new RuntimeError(f)),void(this._metadataError=u);const m=this._options,g=defaultValue(m.fileExtension,o.getAttribute("extension")),_=defaultValue(m.tileWidth,parseInt(o.getAttribute("width"),10)),y=defaultValue(m.tileHeight,parseInt(o.getAttribute("height"),10));let C=defaultValue(m.minimumLevel,parseInt(c[0].getAttribute("order"),10));const T=defaultValue(m.maximumLevel,parseInt(c[c.length-1].getAttribute("order"),10)),S=s.getAttribute("profile");let v=m.tilingScheme;if(!defined(v))if("geodetic"===S||"global-geodetic"===S)v=new GeographicTilingScheme({ellipsoid:m.ellipsoid});else{if("mercator"!==S&&"global-mercator"!==S)return f=`${l.url}specifies an unsupported profile attribute, ${S}.`,u=TileProviderError.handleError(u,this,this.errorEvent,f,void 0,void 0,void 0,h),u.retry||d.reject(new RuntimeError(f)),void(this._metadataError=u);v=new WebMercatorTilingScheme({ellipsoid:m.ellipsoid})}let A=Rectangle.clone(m.rectangle);if(!defined(A)){let e,t,i,n;defaultValue(m.flipXY,!1)?(i=new Cartesian2(parseFloat(a.getAttribute("miny")),parseFloat(a.getAttribute("minx"))),n=new Cartesian2(parseFloat(a.getAttribute("maxy")),parseFloat(a.getAttribute("maxx")))):(i=new Cartesian2(parseFloat(a.getAttribute("minx")),parseFloat(a.getAttribute("miny"))),n=new Cartesian2(parseFloat(a.getAttribute("maxx")),parseFloat(a.getAttribute("maxy"))));const r="geodetic"===S||"mercator"===S;if(v.projection instanceof GeographicProjection||r)e=Cartographic.fromDegrees(i.x,i.y),t=Cartographic.fromDegrees(n.x,n.y);else{const r=v.projection;e=r.unproject(i),t=r.unproject(n)}A=new Rectangle(e.longitude,e.latitude,t.longitude,t.latitude)}A=confineRectangleToTilingScheme(A,v),C=calculateSafeMinimumDetailLevel(v,A,C);const E=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${g}`});d.resolve({url:E,tilingScheme:v,rectangle:A,tileWidth:_,tileHeight:y,minimumLevel:C,maximumLevel:T,tileDiscardPolicy:m.tileDiscardPolicy,credit:m.credit})},TileMapServiceImageryProvider.prototype._metadataFailure=function(e){const t=this._options,i=defaultValue(t.fileExtension,"png"),n=defaultValue(t.tileWidth,256),r=defaultValue(t.tileHeight,256),o=t.maximumLevel,a=defined(t.tilingScheme)?t.tilingScheme:new WebMercatorTilingScheme({ellipsoid:t.ellipsoid});let s=defaultValue(t.rectangle,a.rectangle);s=confineRectangleToTilingScheme(s,a);const c=calculateSafeMinimumDetailLevel(a,s,t.minimumLevel),l=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${i}`});this._deferred.resolve({url:l,tilingScheme:a,rectangle:s,tileWidth:n,tileHeight:r,minimumLevel:c,maximumLevel:o,tileDiscardPolicy:t.tileDiscardPolicy,credit:t.credit})},Object.defineProperties(GoogleEarthEnterpriseMapsProvider.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._resource.proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),GoogleEarthEnterpriseMapsProvider.prototype.getTileCredits=function(e,t,i){},GoogleEarthEnterpriseMapsProvider.prototype.requestImage=function(e,t,i,n){const r=this._resource.getDerivedResource({url:"query",request:n,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:i+1}});return ImageryProvider.loadImage(this,r)},GoogleEarthEnterpriseMapsProvider.prototype.pickFeatures=function(e,t,i,n,r){},GoogleEarthEnterpriseMapsProvider._logoUrl=void 0,Object.defineProperties(GoogleEarthEnterpriseMapsProvider,{logoUrl:{get:function(){return defined(GoogleEarthEnterpriseMapsProvider._logoUrl)||(GoogleEarthEnterpriseMapsProvider._logoUrl=buildModuleUrl("Assets/Images/google_earth_credit.png")),GoogleEarthEnterpriseMapsProvider._logoUrl},set:function(e){GoogleEarthEnterpriseMapsProvider._logoUrl=e}}});const trailingSlashRegex$1=/\/$/,defaultCredit$3=new Credit('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).mapId,i=e.accessToken;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const n=Resource.createIfNeeded(defaultValue(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=i;let r=defaultValue(e.format,"png");/\./.test(r)||(r=`.${r}`),this._format=r;let o,a=n.getUrlComponent();trailingSlashRegex$1.test(a)||(a+="/"),a+=`${t}/{z}/{x}/{y}${this._format}`,n.url=a,n.setQueryParameters({access_token:i}),defined(e.credit)?(o=e.credit,"string"==typeof o&&(o=new Credit(o))):o=defaultCredit$3,this._resource=n,this._imageryProvider=new UrlTemplateImageryProvider({url:n,credit:o,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function SingleTileImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=Resource.createIfNeeded(e.url),i=new GeographicTilingScheme({rectangle:defaultValue(e.rectangle,Rectangle.MAX_VALUE),numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=i,this._resource=t,this._image=void 0,this._texture=void 0,this._tileWidth=0,this._tileHeight=0,this._errorEvent=new Event,this._ready=!1,this._readyPromise=defer();let n=e.credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n;const r=this;let o;function a(e){r._image=e,r._tileWidth=e.width,r._tileHeight=e.height,r._ready=!0,r._readyPromise.resolve(!0),TileProviderError.handleSuccess(r._errorEvent)}function s(e){const i=`Failed to load image ${t.url}.`;o=TileProviderError.handleError(o,r,r._errorEvent,i,0,0,0,c,e),o.retry||r._readyPromise.reject(new RuntimeError(i))}function c(){ImageryProvider.loadImage(null,t).then(a).catch(s)}c()}function GetFeatureInfoFormat(e,t,i){this.type=e,defined(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,defined(i)||("json"===e?i=geoJsonToFeatureInfo:"xml"===e?i=xmlToFeatureInfo:("html"===e||"text"===e)&&(i=textToFeatureInfo)),this.callback=i}function geoJsonToFeatureInfo(e){const t=[],i=e.features;for(let e=0;e<i.length;++e){const n=i[e],r=new ImageryLayerFeatureInfo;if(r.data=n,r.properties=n.properties,r.configureNameFromProperties(n.properties),r.configureDescriptionFromProperties(n.properties),defined(n.geometry)&&"Point"===n.geometry.type){const e=n.geometry.coordinates[0],t=n.geometry.coordinates[1];r.position=Cartographic.fromDegrees(e,t)}t.push(r)}return t}Object.defineProperties(MapboxImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}}),MapboxImageryProvider.prototype.getTileCredits=function(e,t,i){},MapboxImageryProvider.prototype.requestImage=function(e,t,i,n){return this._imageryProvider.requestImage(e,t,i,n)},MapboxImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){return this._imageryProvider.pickFeatures(e,t,i,n,r)},MapboxImageryProvider._defaultCredit=defaultCredit$3,Object.defineProperties(SingleTileImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return 0}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),SingleTileImageryProvider.prototype.getTileCredits=function(e,t,i){},SingleTileImageryProvider.prototype.requestImage=function(e,t,i,n){if(defined(this._image))return Promise.resolve(this._image)},SingleTileImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){};const mapInfoMxpNamespace="http://www.mapinfo.com/mxp",esriWmsNamespace="http://www.esri.com/wms",wfsNamespace="http://www.opengis.net/wfs",gmlNamespace="http://www.opengis.net/gml";function xmlToFeatureInfo(e){const t=e.documentElement;if("MultiFeatureCollection"===t.localName&&t.namespaceURI===mapInfoMxpNamespace)return mapInfoXmlToFeatureInfo(e);if("FeatureInfoResponse"===t.localName&&t.namespaceURI===esriWmsNamespace)return esriXmlToFeatureInfo(e);if("FeatureCollection"===t.localName&&t.namespaceURI===wfsNamespace)return gmlToFeatureInfo(e);if("ServiceExceptionReport"===t.localName)throw new RuntimeError((new XMLSerializer).serializeToString(t));return"msGMLOutput"===t.localName?msGmlToFeatureInfo(e):unknownXmlToFeatureInfo(e)}function mapInfoXmlToFeatureInfo(e){const t=[],i=e.documentElement.getElementsByTagNameNS(mapInfoMxpNamespace,"Feature");for(let e=0;e<i.length;++e){const n=i[e],r={},o=n.getElementsByTagNameNS(mapInfoMxpNamespace,"Val");for(let e=0;e<o.length;++e){const t=o[e];if(t.hasAttribute("ref")){const e=t.getAttribute("ref"),i=t.textContent.trim();r[e]=i}}const a=new ImageryLayerFeatureInfo;a.data=n,a.properties=r,a.configureNameFromProperties(r),a.configureDescriptionFromProperties(r),t.push(a)}return t}function esriXmlToFeatureInfo(e){const t=e.documentElement,i=[];let n;const r=t.getElementsByTagNameNS("*","FIELDS");if(r.length>0)for(let e=0;e<r.length;++e){const t=r[e];n={};const o=t.attributes;for(let e=0;e<o.length;++e){const t=o[e];n[t.name]=t.value}i.push(imageryLayerFeatureInfoFromDataAndProperties(t,n))}else{const e=t.getElementsByTagNameNS("*","FeatureInfo");for(let t=0;t<e.length;++t){const r=e[t];n={};const o=r.childNodes;for(let e=0;e<o.length;++e){const t=o[e];t.nodeType===Node.ELEMENT_NODE&&(n[t.localName]=t.textContent)}i.push(imageryLayerFeatureInfoFromDataAndProperties(r,n))}}return i}function gmlToFeatureInfo(e){const t=[],i=e.documentElement.getElementsByTagNameNS(gmlNamespace,"featureMember");for(let e=0;e<i.length;++e){const n=i[e],r={};getGmlPropertiesRecursively(n,r),t.push(imageryLayerFeatureInfoFromDataAndProperties(n,r))}return t}function msGmlToFeatureInfo(e){const t=[];let i;const n=e.documentElement.childNodes;for(let e=0;e<n.length;e++)if(n[e].nodeType===Node.ELEMENT_NODE){i=n[e];break}if(!defined(i))throw new RuntimeError("Unable to find first child of the feature info xml document");const r=i.childNodes;for(let e=0;e<r.length;++e){const i=r[e];if(i.nodeType===Node.ELEMENT_NODE){const e={};getGmlPropertiesRecursively(i,e),t.push(imageryLayerFeatureInfoFromDataAndProperties(i,e))}}return t}function getGmlPropertiesRecursively(e,t){let i=!0;for(let n=0;n<e.childNodes.length;++n){const r=e.childNodes[n];r.nodeType===Node.ELEMENT_NODE&&(i=!1),"Point"!==r.localName&&"LineString"!==r.localName&&"Polygon"!==r.localName&&"boundedBy"!==r.localName&&(r.hasChildNodes()&&getGmlPropertiesRecursively(r,t)&&(t[r.localName]=r.textContent))}return i}function imageryLayerFeatureInfoFromDataAndProperties(e,t){const i=new ImageryLayerFeatureInfo;return i.data=e,i.properties=t,i.configureNameFromProperties(t),i.configureDescriptionFromProperties(t),i}function unknownXmlToFeatureInfo(e){const t=(new XMLSerializer).serializeToString(e),i=document.createElement("div"),n=document.createElement("pre");n.textContent=t,i.appendChild(n);const r=new ImageryLayerFeatureInfo;return r.data=e,r.description=i.innerHTML,[r]}const emptyBodyRegex=/<body>\s*<\/body>/im,wmsServiceExceptionReportRegex=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,titleRegex=/<title>([\s\S]*)<\/title>/im;function textToFeatureInfo(e){if(emptyBodyRegex.test(e))return;if(wmsServiceExceptionReportRegex.test(e))return;let t;const i=titleRegex.exec(e);i&&i.length>1&&(t=i[1]);const n=new ImageryLayerFeatureInfo;return n.name=t,n.description=e,n.data=e,[n]}function TimeDynamicImagery(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tileCache={},this._tilesRequestedForInterval=[];const t=this._clock=e.clock;this._times=e.times,this._requestImageFunction=e.requestImageFunction,this._reloadFunction=e.reloadFunction,this._currentIntervalIndex=-1,t.onTick.addEventListener(this._clockOnTick,this),this._clockOnTick(t)}function getKey(e,t,i){return`${e}-${t}-${i}`}function getKeyElements(e){const t=e.split("-");if(3===t.length)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function getApproachingInterval(e){const t=e._times;if(!defined(t))return;const i=e._clock,n=i.currentTime,r=i.canAnimate&&i.shouldAnimate,o=i.multiplier;if(!r&&0!==o)return;let a,s=t.indexOf(n);if(s<0)return;const c=t.get(s);return o>0?(a=JulianDate.secondsDifference(c.stop,n),++s):(a=JulianDate.secondsDifference(c.start,n),--s),a/=o,s>=0&&a<=5?t.get(s):void 0}function addToCache(e,t,i){const n=e._times.indexOf(i.start),r=e._tileCache;let o=r[n];defined(o)||(o=r[n]={});const a=t.key;if(defined(o[a]))return!0;const s=getKeyElements(a),c=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.IMAGERY,priorityFunction:t.priorityFunction}),l=e._requestImageFunction(s.x,s.y,s.level,c,i);return!!defined(l)&&(o[a]={promise:l,request:c},!0)}Object.defineProperties(TimeDynamicImagery.prototype,{clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}}),TimeDynamicImagery.prototype.getFromCache=function(e,t,i,n){const r=getKey(e,t,i);let o;const a=this._tileCache[this._currentIntervalIndex];if(defined(a)&&defined(a[r])){const e=a[r];o=e.promise.catch((function(t){throw n.state=e.request.state,t})),delete a[r]}return o},TimeDynamicImagery.prototype.checkApproachingInterval=function(e,t,i,n){const r=getKey(e,t,i),o=this._tilesRequestedForInterval,a=getApproachingInterval(this),s={key:r,priorityFunction:n.priorityFunction};defined(a)&&addToCache(this,s,a)||o.push(s),o.length>=512&&o.splice(0,256)},TimeDynamicImagery.prototype._clockOnTick=function(e){const t=e.currentTime,i=this._times.indexOf(t),n=this._currentIntervalIndex;if(i!==n){const e=this._tileCache[n];for(const t in e)e.hasOwnProperty(t)&&e[t].request.cancel();return delete this._tileCache[n],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,void this._reloadFunction()}const r=getApproachingInterval(this);if(defined(r)){const e=this._tilesRequestedForInterval;let t=!0;for(;t&&0!==e.length;){const i=e.pop();t=addToCache(this,i,r),t||e.push(i)}}};const includesReverseAxis=[3034,3035,3042,3043,3044],excludesReverseAxis=[4471,4559];function WebMapServiceImageryProvider(e){if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times)&&!defined(e.clock))throw new DeveloperError("options.times was specified, so options.clock is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._getFeatureInfoUrl=defaultValue(e.getFeatureInfoUrl,e.url);const t=Resource.createIfNeeded(e.url),i=Resource.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(WebMapServiceImageryProvider.DefaultParameters,!0),i.setQueryParameters(WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters,!0),defined(e.parameters)&&t.setQueryParameters(objectToLowercase(e.parameters)),defined(e.getFeatureInfoParameters)&&i.setQueryParameters(objectToLowercase(e.getFeatureInfoParameters));const n=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,i,r,o){return requestImage$1(n,e,t,i,r,o)},reloadFunction:function(){defined(n._reload)&&n._reload()}}));const r={};if(r.layers=e.layers,r.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",r.width="{width}",r.height="{height}",parseFloat(t.queryParameters.version)>=1.3){r.crs=defaultValue(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"CRS:84");const t=r.crs.split(":");if("EPSG"===t[0]&&2===t.length){const e=Number(t[1]);(e>=4e3&&e<5e3&&!excludesReverseAxis.includes(e)||includesReverseAxis.includes(e))&&(r.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else r.srs=defaultValue(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"EPSG:4326");t.setQueryParameters(r,!0),i.setQueryParameters(r,!0);const o={query_layers:e.layers,info_format:"{format}"};parseFloat(i.queryParameters.version)>=1.3?(o.i="{i}",o.j="{j}"):(o.x="{i}",o.y="{j}"),i.setQueryParameters(o,!0),this._resource=t,this._pickFeaturesResource=i,this._layers=e.layers,this._tileProvider=new UrlTemplateImageryProvider({url:t,pickFeaturesUrl:i,tilingScheme:defaultValue(e.tilingScheme,new GeographicTilingScheme({ellipsoid:e.ellipsoid})),rectangle:e.rectangle,tileWidth:e.tileWidth,tileHeight:e.tileHeight,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,subdomains:e.subdomains,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit,getFeatureInfoFormats:defaultValue(e.getFeatureInfoFormats,WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function requestImage$1(e,t,i,n,r,o){const a=defined(o)?o.data:void 0,s=e._tileProvider;return defined(a)&&s._resource.setQueryParameters(a),s.requestImage(t,i,n,r)}function pickFeatures(e,t,i,n,r,o,a){const s=defined(a)?a.data:void 0,c=e._tileProvider;return defined(s)&&c._pickFeaturesResource.setQueryParameters(s),c.pickFeatures(t,i,n,r,o)}function objectToLowercase(e){const t={};for(const i in e)e.hasOwnProperty(i)&&(t[i.toLowerCase()]=e[i]);return t}Object.defineProperties(WebMapServiceImageryProvider.prototype,{url:{get:function(){return this._resource._url}},proxy:{get:function(){return this._resource.proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileProvider.tileWidth}},tileHeight:{get:function(){return this._tileProvider.tileHeight}},maximumLevel:{get:function(){return this._tileProvider.maximumLevel}},minimumLevel:{get:function(){return this._tileProvider.minimumLevel}},tilingScheme:{get:function(){return this._tileProvider.tilingScheme}},rectangle:{get:function(){return this._tileProvider.rectangle}},tileDiscardPolicy:{get:function(){return this._tileProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._tileProvider.errorEvent}},ready:{get:function(){return this._tileProvider.ready}},readyPromise:{get:function(){return this._tileProvider.readyPromise}},credit:{get:function(){return this._tileProvider.credit}},hasAlphaChannel:{get:function(){return this._tileProvider.hasAlphaChannel}},enablePickFeatures:{get:function(){return this._tileProvider.enablePickFeatures},set:function(e){this._tileProvider.enablePickFeatures=e}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},getFeatureInfoUrl:{get:function(){return this._getFeatureInfoUrl}}}),WebMapServiceImageryProvider.prototype.getTileCredits=function(e,t,i){return this._tileProvider.getTileCredits(e,t,i)},WebMapServiceImageryProvider.prototype.requestImage=function(e,t,i,n){let r;const o=this._timeDynamicImagery;let a;return defined(o)&&(a=o.currentInterval,r=o.getFromCache(e,t,i,n)),defined(r)||(r=requestImage$1(this,e,t,i,n,a)),defined(r)&&defined(o)&&o.checkApproachingInterval(e,t,i,n),r},WebMapServiceImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){const o=this._timeDynamicImagery;return pickFeatures(this,e,t,i,n,r,defined(o)?o.currentInterval:void 0)},WebMapServiceImageryProvider.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"}),WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"}),WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new GetFeatureInfoFormat("json","application/json")),Object.freeze(new GetFeatureInfoFormat("xml","text/xml")),Object.freeze(new GetFeatureInfoFormat("text","text/html"))]);const defaultParameters=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function WebMapTileServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=Resource.createIfNeeded(e.url),i=e.style,n=e.tileMatrixSetID,r=t.url,o=r.match(/{/g);if(!defined(o)||1===o.length&&/{s}/.test(r))t.setQueryParameters(defaultParameters),this._useKvp=!0;else{const e={style:i,Style:i,TileMatrixSet:n};t.setTemplateValues(e),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=i,this._tileMatrixSetID=n,this._tileMatrixLabels=e.tileMatrixLabels,this._format=defaultValue(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._minimumLevel=defaultValue(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=defaultValue(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;const a=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,i,n,r){return requestImage(a,e,t,i,n,r)},reloadFunction:function(){defined(a._reload)&&a._reload()}})),this._readyPromise=Promise.resolve(!0);const s=this._tilingScheme.positionToTileXY(Rectangle.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(Rectangle.northeast(this._rectangle),this._minimumLevel);Math.abs(c.x-s.x),Math.abs(c.y-s.y),this._errorEvent=new Event;const l=e.credit;this._credit="string"==typeof l?new Credit(l):l,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():defined(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function requestImage(e,t,i,n,r,o){const a=e._tileMatrixLabels,s=defined(a)?a[n]:n.toString(),c=e._subdomains,l=e._dimensions,u=defined(o)?o.data:void 0;let d,h;if(e._useKvp){let o={};o.tilematrix=s,o.layer=e._layer,o.style=e._style,o.tilerow=i,o.tilecol=t,o.tilematrixset=e._tileMatrixSetID,o.format=e._format,defined(l)&&(o=combine$2(o,l)),defined(u)&&(o=combine$2(o,u)),h={s:c[(t+i+n)%c.length]},d=e._resource.getDerivedResource({queryParameters:o,request:r}),d.setTemplateValues(h)}else h={TileMatrix:s,TileRow:i.toString(),TileCol:t.toString(),s:c[(t+i+n)%c.length]},d=e._resource.getDerivedResource({request:r}),d.setTemplateValues(h),defined(l)&&d.setTemplateValues(l),defined(u)&&d.setTemplateValues(u);return ImageryProvider.loadImage(e,d)}function createFactory(e){return function(t){return new e(t)}}Object.defineProperties(WebMapTileServiceImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},format:{get:function(){return this._format}},ready:{value:!0},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},dimensions:{get:function(){return this._dimensions},set:function(e){this._dimensions!==e&&(this._dimensions=e,defined(this._reload)&&this._reload())}}}),WebMapTileServiceImageryProvider.prototype.getTileCredits=function(e,t,i){},WebMapTileServiceImageryProvider.prototype.requestImage=function(e,t,i,n){let r;const o=this._timeDynamicImagery;let a;return defined(o)&&(a=o.currentInterval,r=o.getFromCache(e,t,i,n)),defined(r)||(r=requestImage(this,e,t,i,n,a)),defined(r)&&defined(o)&&o.checkApproachingInterval(e,t,i,n),r},WebMapTileServiceImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){};const ImageryProviderMapping={ARCGIS_MAPSERVER:createFactory(ArcGisMapServerImageryProvider),BING:createFactory(BingMapsImageryProvider),GOOGLE_EARTH:createFactory(GoogleEarthEnterpriseMapsProvider),MAPBOX:createFactory(MapboxImageryProvider),SINGLE_TILE:createFactory(SingleTileImageryProvider),TMS:createFactory(TileMapServiceImageryProvider),URL_TEMPLATE:createFactory(UrlTemplateImageryProvider),WMS:createFactory(WebMapServiceImageryProvider),WMTS:createFactory(WebMapTileServiceImageryProvider)};function IonImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).assetId;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._ready=!1,this._tileCredits=void 0,this._errorEvent=new Event;const i=this,n=IonResource._createEndpointResource(t,e),r=e.assetId.toString()+e.accessToken+e.server;let o=IonImageryProvider._endpointCache[r];defined(o)||(o=n.fetchJson(),IonImageryProvider._endpointCache[r]=o),this._readyPromise=o.then((function(e){if("IMAGERY"!==e.type)return Promise.reject(new RuntimeError(`Cesium ion asset ${t} is not an imagery asset.`));let r;const o=e.externalType;if(defined(o)){const t=ImageryProviderMapping[o];if(!defined(t))return Promise.reject(new RuntimeError(`Unrecognized Cesium ion imagery type: ${o}`));r=t(e.options)}else r=new TileMapServiceImageryProvider({url:new IonResource(e,n)});return i._tileCredits=IonResource.getCreditsFromEndpoint(e,n),r.errorEvent.addEventListener((function(e){e.provider=i,i._errorEvent.raiseEvent(e)})),i._imageryProvider=r,r.readyPromise.then((function(){return i._ready=!0,!0}))}))}Object.defineProperties(IonImageryProvider.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel},proxy:{get:function(){}}}}),IonImageryProvider.prototype.getTileCredits=function(e,t,i){const n=this._imageryProvider.getTileCredits(e,t,i);return defined(n)?this._tileCredits.concat(n):this._tileCredits},IonImageryProvider.prototype.requestImage=function(e,t,i,n){return this._imageryProvider.requestImage(e,t,i,n)},IonImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){return this._imageryProvider.pickFeatures(e,t,i,n,r)},IonImageryProvider._endpointCache={};const IonWorldImageryStyle={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4};var IonWorldImageryStyle$1=Object.freeze(IonWorldImageryStyle);function createWorldImagery(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);return new IonImageryProvider({assetId:defaultValue(e.style,IonWorldImageryStyle$1.AERIAL)})}const mobileWidth=576,lightboxHeight=100,textColor="#ffffff",highlightColor$1="#48b";function CreditDisplayElement(e,t){this.credit=e,this.count=defaultValue(t,1)}function contains(e,t){const i=e.length;for(let n=0;n<i;n++){const i=e[n];if(Credit.equals(i,t))return!0}return!1}function swapCesiumCredit(e){const t=e._previousCesiumCredit,i=e._currentCesiumCredit;Credit.equals(i,t)||(defined(t)&&e._cesiumCreditContainer.removeChild(t.element),defined(i)&&e._cesiumCreditContainer.appendChild(i.element),e._previousCesiumCredit=i)}const delimiterClassName="cesium-credit-delimiter";function createDelimiterElement(e){const t=document.createElement("span");return t.textContent=e,t.className=delimiterClassName,t}function createCreditElement(e,t){if(defined(t)){const i=document.createElement(t);i._creditId=e._creditId,i.appendChild(e),e=i}return e}function displayCredits(e,t,i,n){const r=e.childNodes;let o=-1;t.sort((function(e,t){return t.count-e.count}));for(let a=0;a<t.length;++a){const s=t[a].credit;if(defined(s)){if(o=a,defined(i)&&(o*=2,a>0)){const t=o-1;if(r.length<=t)e.appendChild(createDelimiterElement(i));else{const n=r[t];n.className!==delimiterClassName&&e.replaceChild(createDelimiterElement(i),n)}}const t=s.element;if(r.length<=o)e.appendChild(createCreditElement(t,n));else{const i=r[o];i._creditId!==s._id&&e.replaceChild(createCreditElement(t,n),i)}}}for(++o;o<r.length;)e.removeChild(r[o])}function styleLightboxContainer(e){const t=e._lightboxCredits,i=e.viewport.clientWidth,n=e.viewport.clientHeight;i!==e._lastViewportWidth&&(i<mobileWidth?(t.className="cesium-credit-lightbox cesium-credit-lightbox-mobile",t.style.marginTop="0"):(t.className="cesium-credit-lightbox cesium-credit-lightbox-expanded",t.style.marginTop=`${Math.floor(.5*(n-t.clientHeight))}px`),e._lastViewportWidth=i),i>=mobileWidth&&n!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor(.5*(n-t.clientHeight))}px`,e._lastViewportHeight=n)}function addStyle(e,t){let i=`${e} {`;for(const e in t)t.hasOwnProperty(e)&&(i+=`${e}: ${t[e]}; `);return i+=" }\n",i}function appendCss(){let e="";e+=addStyle(".cesium-credit-lightbox-overlay",{display:"none","z-index":"1",position:"absolute",top:"0",left:"0",width:"100%",height:"100%","background-color":"rgba(80, 80, 80, 0.8)"}),e+=addStyle(".cesium-credit-lightbox",{"background-color":"#303336",color:textColor,position:"relative","min-height":`${lightboxHeight}px`,margin:"auto"}),e+=addStyle(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:textColor}),e+=addStyle(".cesium-credit-lightbox > ul > li a:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=addStyle(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=addStyle(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:textColor}),e+=addStyle(".cesium-credit-lightbox-close:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=addStyle(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=addStyle(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=addStyle(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:textColor}),e+=addStyle(".cesium-credit-expand-link:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-text",{color:textColor}),e+=addStyle(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});const t=document.head,i=document.createElement("style");i.innerHTML=e,t.insertBefore(i,t.firstChild)}function CreditDisplay(e,t,i){const n=this;i=defaultValue(i,document.body);const r=document.createElement("div");r.className="cesium-credit-lightbox-overlay",i.appendChild(r);const o=document.createElement("div");function a(e){o.contains(e.target)||n.hideLightbox()}o.className="cesium-credit-lightbox",r.appendChild(o),r.addEventListener("click",a,!1);const s=document.createElement("div");s.className="cesium-credit-lightbox-title",s.textContent="Data provided by:",o.appendChild(s);const c=document.createElement("a");c.onclick=this.hideLightbox.bind(this),c.innerHTML="×",c.className="cesium-credit-lightbox-close",o.appendChild(c);const l=document.createElement("ul");o.appendChild(l);const u=document.createElement("div");u.className="cesium-credit-logoContainer",u.style.display="inline",e.appendChild(u);const d=document.createElement("div");d.className="cesium-credit-textContainer",d.style.display="inline",e.appendChild(d);const h=document.createElement("a");h.className="cesium-credit-expand-link",h.onclick=this.showLightbox.bind(this),h.textContent="Data attribution",e.appendChild(h),appendCss();const p=Credit.clone(CreditDisplay.cesiumCredit);this._delimiter=defaultValue(t," • "),this._screenContainer=d,this._cesiumCreditContainer=u,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=o,this._creditList=l,this._lightbox=r,this._hideLightbox=a,this._expandLink=h,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=p,this._previousCesiumCredit=void 0,this._currentCesiumCredit=p,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new AssociativeArray,lightboxCredits:new AssociativeArray},this._defaultCredit=void 0,this.viewport=i,this.container=e}function setCredit(e,t,i,n){n=defaultValue(n,1);let r=t.get(i.id);if(defined(r))r.count<Number.MAX_VALUE&&(r.count+=n);else{const o=e._creditDisplayElementPool,a=e._creditDisplayElementPoolIndex;a<o.length?(r=o[a],r.credit=i,r.count=n):(r=new CreditDisplayElement(i,n),o.push(r)),++e._creditDisplayElementPoolIndex,t.set(i.id,r)}}let defaultCredit$2;function getDefaultCredit(){if(!defined(defaultCredit$2)){let e=buildModuleUrl("Assets/Images/ion-credit.png");if(0!==e.indexOf("http://")&&0!==e.indexOf("https://")&&0!==e.indexOf("data:")){e=new URI(e).path()}defaultCredit$2=new Credit(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return CreditDisplay._cesiumCreditInitialized||(CreditDisplay._cesiumCredit=defaultCredit$2,CreditDisplay._cesiumCreditInitialized=!0),defaultCredit$2}function DebugAppearance(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).attributeName;let i=e.perInstanceAttribute;defined(i)||(i=!1);let n=defaultValue(e.glslDatatype,"vec3");const r=`v_${t}`;let o;if("normal"===t||"tangent"===t||"bitangent"===t)o=`vec4 getColor() { return vec4((${r} + vec3(1.0)) * 0.5, 1.0); }\n`;else switch("st"===t&&(n="vec2"),n){case"float":o=`vec4 getColor() { return vec4(vec3(${r}), 1.0); }\n`;break;case"vec2":o=`vec4 getColor() { return vec4(${r}, 0.0, 1.0); }\n`;break;case"vec3":o=`vec4 getColor() { return vec4(${r}, 1.0); }\n`;break;case"vec4":o=`vec4 getColor() { return ${r}; }\n`}const a=`attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n${i?"":`attribute ${n} ${t};\n`}varying ${n} ${r};\nvoid main()\n{\nvec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n${i?`${r} = czm_batchTable_${t}(batchId);\n`:`${r} = ${t};\n`}gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}`,s=`varying ${n} ${r};\n${o}\nvoid main()\n{\ngl_FragColor = getColor();\n}`;this.material=void 0,this.translucent=defaultValue(e.translucent,!1),this._vertexShaderSource=defaultValue(e.vertexShaderSource,a),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,s),this._renderState=Appearance.getDefaultRenderState(!1,!1,e.renderState),this._closed=defaultValue(e.closed,!1),this._attributeName=t,this._glslDatatype=n}function DebugCameraPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=defaultValue(e.color,Color.CYAN),this._updateOnChange=defaultValue(e.updateOnChange,!0),this.show=defaultValue(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}CreditDisplay.prototype.addCredit=function(e){if(e._isIon)return defined(this._defaultCredit)||(this._defaultCredit=Credit.clone(getDefaultCredit())),void(this._currentCesiumCredit=this._defaultCredit);let t;t=e.showOnScreen?this._currentFrameCredits.screenCredits:this._currentFrameCredits.lightboxCredits,setCredit(this,t,e)},CreditDisplay.prototype.addDefaultCredit=function(e){const t=this._defaultCredits;contains(t,e)||t.push(e)},CreditDisplay.prototype.removeDefaultCredit=function(e){const t=this._defaultCredits,i=t.indexOf(e);-1!==i&&t.splice(i,1)},CreditDisplay.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0},CreditDisplay.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1},CreditDisplay.prototype.update=function(){this._expanded&&styleLightboxContainer(this)},CreditDisplay.prototype.beginFrame=function(){const e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;const t=e.screenCredits;t.removeAll();const i=this._defaultCredits;for(let e=0;e<i.length;++e){setCredit(this,t,i[e],Number.MAX_VALUE)}e.lightboxCredits.removeAll(),Credit.equals(CreditDisplay.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Credit.clone(CreditDisplay.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit},CreditDisplay.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;displayCredits(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",displayCredits(this._creditList,t,void 0,"li"),swapCesiumCredit(this)},CreditDisplay.prototype.destroy=function(){return this._lightbox.removeEventListener("click",this._hideLightbox,!1),this.container.removeChild(this._cesiumCreditContainer),this.container.removeChild(this._screenContainer),this.container.removeChild(this._expandLink),this.viewport.removeChild(this._lightbox),destroyObject(this)},CreditDisplay.prototype.isDestroyed=function(){return!1},CreditDisplay._cesiumCredit=void 0,CreditDisplay._cesiumCreditInitialized=!1,Object.defineProperties(CreditDisplay,{cesiumCredit:{get:function(){return getDefaultCredit(),CreditDisplay._cesiumCredit},set:function(e){CreditDisplay._cesiumCredit=e,CreditDisplay._cesiumCreditInitialized=!0}}}),CreditDisplay.CreditDisplayElement=CreditDisplayElement,Object.defineProperties(DebugAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},attributeName:{get:function(){return this._attributeName}},glslDatatype:{get:function(){return this._glslDatatype}}}),DebugAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,DebugAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,DebugAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;const scratchRight$2=new Cartesian3,scratchRotation=new Matrix3,scratchOrientation=new Quaternion,scratchPerspective=new PerspectiveFrustum,scratchPerspectiveOffCenter=new PerspectiveOffCenterFrustum,scratchOrthographic=new OrthographicFrustum,scratchOrthographicOffCenter=new OrthographicOffCenterFrustum,scratchColor$1=new Color,scratchSplits$1=[1,1e5];function DebugInspector(){this._cachedShowFrustumsShaders={}}function getAttributeLocations(e){const t={},i=e.vertexAttributes;for(const e in i)i.hasOwnProperty(e)&&(t[e]=i[e].index);return t}function createDebugShowFrustumsShaderProgram(e,t){const i=e.context,n=t,r=n.fragmentShaderSource.clone(),o=[];r.sources=r.sources.map((function(e){e=ShaderSource.replaceMain(e,"czm_Debug_main");const t=/gl_FragData\[(\d+)\]/g;let i;for(;null!==(i=t.exec(e));)-1===o.indexOf(i[1])&&o.push(i[1]);return e}));const a=o.length;let s,c="";if(c+="uniform vec3 debugShowCommandsColor;\n",c+="uniform vec3 debugShowFrustumsColor;\n",c+="void main() \n{ \n czm_Debug_main(); \n",a>0)for(s=0;s<a;++s)c+=` gl_FragData[${o[s]}].rgb *= debugShowCommandsColor;\n`,c+=` gl_FragData[${o[s]}].rgb *= debugShowFrustumsColor;\n`;else c+=" gl_FragColor.rgb *= debugShowCommandsColor;\n",c+=" gl_FragColor.rgb *= debugShowFrustumsColor;\n";c+="}",r.sources.push(c);const l=getAttributeLocations(n);return ShaderProgram.fromCache({context:i,vertexShaderSource:n.vertexShaderSource,fragmentShaderSource:r,attributeLocations:l})}DebugCameraPrimitive.prototype.update=function(e){if(!this.show)return;const t=this._planesPrimitives,i=this._outlinePrimitives;let n,r;if(this._updateOnChange){for(r=t.length,n=0;n<r;++n)i[n]=i[n]&&i[n].destroy(),t[n]=t[n]&&t[n].destroy();t.length=0,i.length=0}if(0===t.length){const e=this._camera,r=e.frustum;let o,a;o=r instanceof PerspectiveFrustum?scratchPerspective:r instanceof PerspectiveOffCenterFrustum?scratchPerspectiveOffCenter:r instanceof OrthographicFrustum?scratchOrthographic:scratchOrthographicOffCenter,o=r.clone(o);let s=this._frustumSplits;!defined(s)||s.length<=1?(s=scratchSplits$1,s[0]=this._camera.frustum.near,s[1]=this._camera.frustum.far,a=1):a=s.length-1;const c=e.positionWC,l=e.directionWC,u=e.upWC;let d=e.rightWC;d=Cartesian3.negate(d,scratchRight$2);const h=scratchRotation;Matrix3.setColumn(h,0,d,h),Matrix3.setColumn(h,1,u,h),Matrix3.setColumn(h,2,l,h);const p=Quaternion.fromRotationMatrix(h,scratchOrientation);for(t.length=i.length=a,n=0;n<a;++n)o.near=s[n],o.far=s[n+1],t[n]=new Primitive$3({geometryInstances:new GeometryInstance({geometry:new FrustumGeometry({origin:c,orientation:p,frustum:o,_drawNearPlane:0===n}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(Color.fromAlpha(this._color,.1,scratchColor$1))},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!0,flat:!0}),asynchronous:!1}),i[n]=new Primitive$3({geometryInstances:new GeometryInstance({geometry:new FrustumOutlineGeometry({origin:c,orientation:p,frustum:o,_drawNearPlane:0===n}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}for(r=t.length,n=0;n<r;++n)i[n].update(e),t[n].update(e)},DebugCameraPrimitive.prototype.isDestroyed=function(){return!1},DebugCameraPrimitive.prototype.destroy=function(){const e=this._planesPrimitives.length;for(let t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return destroyObject(this)};const scratchFrustumColor=new Color;function createDebugShowFrustumsUniformMap(e,t){let i;return i=defined(t.uniformMap)?t.uniformMap:{},defined(i.debugShowCommandsColor)||defined(i.debugShowFrustumsColor)||(i.debugShowCommandsColor=function(){return e.debugShowCommands?(defined(t._debugColor)||(t._debugColor=Color.fromRandom()),t._debugColor):Color.WHITE},i.debugShowFrustumsColor=function(){return e.debugShowFrustums?(scratchFrustumColor.red=1&t.debugOverlappingFrustums?1:0,scratchFrustumColor.green=2&t.debugOverlappingFrustums?1:0,scratchFrustumColor.blue=4&t.debugOverlappingFrustums?1:0,scratchFrustumColor.alpha=1,scratchFrustumColor):Color.WHITE}),i}const scratchShowFrustumCommand=new DrawCommand;function DebugModelMatrixPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.length=defaultValue(e.length,1e7),this._length=void 0,this.width=defaultValue(e.width,2),this._width=void 0,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.id=e.id,this._id=void 0,this._primitive=void 0}DebugInspector.prototype.executeDebugShowFrustumsCommand=function(e,t,i){const n=t.shaderProgram.id;let r=this._cachedShowFrustumsShaders[n];defined(r)||(r=createDebugShowFrustumsShaderProgram(e,t.shaderProgram),this._cachedShowFrustumsShaders[n]=r);const o=DrawCommand.shallowClone(t,scratchShowFrustumCommand);o.shaderProgram=r,o.uniformMap=createDebugShowFrustumsUniformMap(e,t),o.execute(e.context,i)},DebugModelMatrixPrimitive.prototype.update=function(e){if(this.show){if(!defined(this._primitive)||!Matrix4.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=Matrix4.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,defined(this._primitive)&&this._primitive.destroy(),0===this.modelMatrix[12]&&0===this.modelMatrix[13]&&0===this.modelMatrix[14]&&(this.modelMatrix[14]=.01);const e=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_X],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.RED,Color.RED],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),t=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Y],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.GREEN,Color.GREEN],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),i=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Z],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.BLUE,Color.BLUE],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this});this._primitive=new Primitive$3({geometryInstances:[e,t,i],appearance:new PolylineColorAppearance,asynchronous:!1})}this._primitive.update(e)}},DebugModelMatrixPrimitive.prototype.isDestroyed=function(){return!1},DebugModelMatrixPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var DepthPlaneFS="varying vec4 positionEC;\nvoid main()\n{\nvec3 position;\nvec3 direction;\nif (czm_orthographicIn3D == 1.0)\n{\nvec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;\nvec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y);\nvec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x);\nposition = vec3(mix(minPlane, maxPlane, uv), 0.0);\ndirection = vec3(0.0, 0.0, -1.0);\n}\nelse\n{\nposition = vec3(0.0);\ndirection = normalize(positionEC.xyz);\n}\nczm_ray ray = czm_ray(position, direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nif (!czm_isEmpty(intersection))\n{\ngl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\nelse\n{\ndiscard;\n}\nczm_writeLogDepth();\n}\n",DepthPlaneVS="attribute vec4 position;\nvarying vec4 positionEC;\nvoid main()\n{\npositionEC = czm_modelView * position;\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n}\n";function DepthPlane(e){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1,this._ellipsoidOffset=defaultValue(e,0)}const depthQuadScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(12):[],scratchCartesian1$1=new Cartesian3,scratchCartesian2$1=new Cartesian3,scratchCartesian3=new Cartesian3,scratchCartesian4$1=new Cartesian3,scratchCartesian5=new Cartesian3;function computeDepthQuad(e,t){const i=e.radii,n=t.camera;let r,o,a;if(n.frustum instanceof OrthographicFrustum)r=Cartesian3.ZERO,o=n.rightWC,a=n.upWC;else{const t=n.positionWC,i=Cartesian3.multiplyComponents(e.oneOverRadii,t,scratchCartesian1$1),s=Cartesian3.normalize(i,scratchCartesian2$1),c=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,i,scratchCartesian3),scratchCartesian3),l=Cartesian3.normalize(Cartesian3.cross(s,c,scratchCartesian4$1),scratchCartesian4$1),u=Cartesian3.magnitude(i),d=Math.sqrt(u*u-1);r=Cartesian3.multiplyByScalar(s,1/u,scratchCartesian1$1);const h=d/u;o=Cartesian3.multiplyByScalar(c,h,scratchCartesian2$1),a=Cartesian3.multiplyByScalar(l,h,scratchCartesian3)}const s=Cartesian3.add(r,a,scratchCartesian5);Cartesian3.subtract(s,o,s),Cartesian3.multiplyComponents(i,s,s),Cartesian3.pack(s,depthQuadScratch,0);const c=Cartesian3.subtract(r,a,scratchCartesian5);Cartesian3.subtract(c,o,c),Cartesian3.multiplyComponents(i,c,c),Cartesian3.pack(c,depthQuadScratch,3);const l=Cartesian3.add(r,a,scratchCartesian5);Cartesian3.add(l,o,l),Cartesian3.multiplyComponents(i,l,l),Cartesian3.pack(l,depthQuadScratch,6);const u=Cartesian3.subtract(r,a,scratchCartesian5);return Cartesian3.add(u,o,u),Cartesian3.multiplyComponents(i,u,u),Cartesian3.pack(u,depthQuadScratch,9),depthQuadScratch}function DerivedCommand(){}DepthPlane.prototype.update=function(e){if(this._mode=e.mode,e.mode!==SceneMode$1.SCENE3D)return;const t=e.context,i=e.mapProjection.ellipsoid.radii,n=new Ellipsoid(i.x+this._ellipsoidOffset,i.y+this._ellipsoidOffset,i.z+this._ellipsoidOffset),r=e.useLogDepth;if(defined(this._command)||(this._rs=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new DrawCommand({renderState:this._rs,boundingVolume:new BoundingSphere(Cartesian3.ZERO,n.maximumRadius),pass:Pass$1.OPAQUE,owner:this})),!defined(this._sp)||this._useLogDepth!==r){this._useLogDepth=r;const e=new ShaderSource({sources:[DepthPlaneVS]}),i=new ShaderSource({sources:[DepthPlaneFS]});if(r){const t="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";i.sources.push(t),i.defines.push("LOG_DEPTH"),e.defines.push("LOG_DEPTH")}this._sp=ShaderProgram.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:e,fragmentShaderSource:i,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const o=computeDepthQuad(n,e);if(defined(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(o);else{const e=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:o})},indices:[0,1,2,2,1,3],primitiveType:PrimitiveType$1.TRIANGLES});this._va=VertexArray.fromGeometry({context:t,geometry:e,attributeLocations:{position:0},bufferUsage:BufferUsage$1.DYNAMIC_DRAW}),this._command.vertexArray=this._va}},DepthPlane.prototype.execute=function(e,t){this._mode===SceneMode$1.SCENE3D&&this._command.execute(e,t)},DepthPlane.prototype.isDestroyed=function(){return!1},DepthPlane.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};const fragDepthRegex=/\bgl_FragDepthEXT\b/,discardRegex=/\bdiscard\b/;function getDepthOnlyShaderProgram$1(e,t){let i=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!defined(i)){const n=t._attributeLocations;let r,o=t.fragmentShaderSource,a=!1;const s=o.sources;let c=s.length;for(r=0;r<c;++r)if(fragDepthRegex.test(s[r])||discardRegex.test(s[r])){a=!0;break}let l=!1;const u=o.defines;for(c=u.length,r=0;r<c;++r)if("LOG_DEPTH"===u[r]){l=!0;break}let d;a||l?!a&&l&&(d="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeLogDepth(); \n} \n",o=new ShaderSource({defines:["LOG_DEPTH"],sources:[d]})):(d="void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n",o=new ShaderSource({sources:[d]})),i=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:n})}return i}function getDepthOnlyRenderState(e,t){const i=e._depthOnlyRenderStateCache;let n=i[t.id];if(!defined(n)){const e=RenderState.getState(t);e.depthMask=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n=RenderState.fromCache(e),i[t.id]=n}return n}DerivedCommand.createDepthOnlyDerivedCommand=function(e,t,i,n){let r,o;return defined(n)||(n={}),defined(n.depthOnlyCommand)&&(r=n.depthOnlyCommand.shaderProgram,o=n.depthOnlyCommand.renderState),n.depthOnlyCommand=DrawCommand.shallowClone(t,n.depthOnlyCommand),defined(r)&&n.shaderProgramId===t.shaderProgram.id?(n.depthOnlyCommand.shaderProgram=r,n.depthOnlyCommand.renderState=o):(n.depthOnlyCommand.shaderProgram=getDepthOnlyShaderProgram$1(i,t.shaderProgram),n.depthOnlyCommand.renderState=getDepthOnlyRenderState(e,t.renderState),n.shaderProgramId=t.shaderProgram.id),n};const writeLogDepthRegex=/\s+czm_writeLogDepth\(/,vertexlogDepthRegex=/\s+czm_vertexLogDepth\(/,extensionRegex=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function getLogDepthShaderProgram(e,t){let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!defined(i)){const n=t._attributeLocations,r=t.vertexShaderSource.clone(),o=t.fragmentShaderSource.clone();let a,s;r.defines=defined(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),o.defines=defined(o.defines)?o.defines.slice(0):[],o.defines.push("LOG_DEPTH");let c=!1,l=r.sources,u=l.length;for(a=0;a<u;++a)if(vertexlogDepthRegex.test(l[a])){c=!0;break}if(!c){for(a=0;a<u;++a)l[a]=ShaderSource.replaceMain(l[a],"czm_log_depth_main");s="\n\nvoid main() \n{ \n czm_log_depth_main(); \n czm_vertexLogDepth(); \n} \n",l.push(s)}for(l=o.sources,u=l.length,c=!1,a=0;a<u;++a)writeLogDepthRegex.test(l[a])&&(c=!0);-1!==o.defines.indexOf("LOG_DEPTH_WRITE")&&(c=!0);let d=!0;for(a=0;a<u;++a)extensionRegex.test(l[a])&&(d=!1);let h="";if(d&&(h+="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n"),!c){for(a=0;a<u;a++)l[a]=ShaderSource.replaceMain(l[a],"czm_log_depth_main");h+="\nvoid main() \n{ \n czm_log_depth_main(); \n czm_writeLogDepth(); \n} \n"}l.push(h),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:o,attributeLocations:n})}return i}function getPickShaderProgram$1(e,t,i){let n=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!defined(n)){const r=t._attributeLocations;let o=t.fragmentShaderSource;const a=o.sources,s=a.length,c=`void main() \n{ \n czm_non_pick_main(); \n if (gl_FragColor.a == 0.0) { \n discard; \n } \n gl_FragColor = ${i}; \n} \n`,l=new Array(s+1);for(let e=0;e<s;++e)l[e]=ShaderSource.replaceMain(a[e],"czm_non_pick_main");l[s]=c,o=new ShaderSource({sources:l,defines:o.defines}),n=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:r})}return n}function getPickRenderState(e,t){const i=e.picking.pickRenderStateCache;let n=i[t.id];if(!defined(n)){const e=RenderState.getState(t);e.blending.enabled=!1,e.depthMask=!0,n=RenderState.fromCache(e),i[t.id]=n}return n}function getHdrShaderProgram(e,t){let i=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!defined(i)){const n=t._attributeLocations,r=t.vertexShaderSource.clone(),o=t.fragmentShaderSource.clone();r.defines=defined(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),o.defines=defined(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),i=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:r,fragmentShaderSource:o,attributeLocations:n})}return i}function DeviceOrientationCameraController(e){this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;const t=this;function i(e){const i=e.alpha;if(!defined(i))return t._alpha=void 0,t._beta=void 0,void(t._gamma=void 0);t._alpha=CesiumMath.toRadians(i),t._beta=CesiumMath.toRadians(e.beta),t._gamma=CesiumMath.toRadians(e.gamma)}window.addEventListener("deviceorientation",i,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",i,!1)}}DerivedCommand.createLogDepthCommand=function(e,t,i){let n;return defined(i)||(i={}),defined(i.command)&&(n=i.command.shaderProgram),i.command=DrawCommand.shallowClone(e,i.command),defined(n)&&i.shaderProgramId===e.shaderProgram.id?i.command.shaderProgram=n:(i.command.shaderProgram=getLogDepthShaderProgram(t,e.shaderProgram),i.shaderProgramId=e.shaderProgram.id),i},DerivedCommand.createPickDerivedCommand=function(e,t,i,n){let r,o;return defined(n)||(n={}),defined(n.pickCommand)&&(r=n.pickCommand.shaderProgram,o=n.pickCommand.renderState),n.pickCommand=DrawCommand.shallowClone(t,n.pickCommand),defined(r)&&n.shaderProgramId===t.shaderProgram.id?(n.pickCommand.shaderProgram=r,n.pickCommand.renderState=o):(n.pickCommand.shaderProgram=getPickShaderProgram$1(i,t.shaderProgram,t.pickId),n.pickCommand.renderState=getPickRenderState(e,t.renderState),n.shaderProgramId=t.shaderProgram.id),n},DerivedCommand.createHdrCommand=function(e,t,i){let n;return defined(i)||(i={}),defined(i.command)&&(n=i.command.shaderProgram),i.command=DrawCommand.shallowClone(e,i.command),defined(n)&&i.shaderProgramId===e.shaderProgram.id?i.command.shaderProgram=n:(i.command.shaderProgram=getHdrShaderProgram(t,e.shaderProgram),i.shaderProgramId=e.shaderProgram.id),i};const scratchQuaternion1=new Quaternion,scratchQuaternion2=new Quaternion,scratchMatrix3=new Matrix3;function rotate(e,t,i,n){const r=e.direction,o=e.right,a=e.up,s=Quaternion.fromAxisAngle(r,i,scratchQuaternion2),c=Quaternion.fromAxisAngle(o,n,scratchQuaternion1),l=Quaternion.multiply(c,s,c),u=Quaternion.fromAxisAngle(a,t,scratchQuaternion2);Quaternion.multiply(u,l,l);const d=Matrix3.fromQuaternion(l,scratchMatrix3);Matrix3.multiplyByVector(d,o,o),Matrix3.multiplyByVector(d,a,a),Matrix3.multiplyByVector(d,r,r)}function DirectionalLight(e){this.direction=Cartesian3.clone(e.direction),this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this.intensity=defaultValue(e.intensity,1)}DeviceOrientationCameraController.prototype.update=function(){if(!defined(this._alpha))return;defined(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);const e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,i=this._lastGamma-this._gamma;rotate(this._scene.camera,-e,t,i),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma},DeviceOrientationCameraController.prototype.isDestroyed=function(){return!1},DeviceOrientationCameraController.prototype.destroy=function(){return this._removeListener(),destroyObject(this)};var EllipsoidFS="#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#endif\nuniform vec3 u_radii;\nuniform vec3 u_oneOverEllipsoidRadiiSquared;\nvarying vec3 v_positionEC;\nvec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n{\nvec3 positionEC = czm_pointAlongRay(ray, intersection);\nvec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\nvec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\nvec3 sphericalNormal = normalize(positionMC / u_radii);\nvec3 normalMC = geodeticNormal * side;\nvec3 normalEC = normalize(czm_normal * normalMC);\nvec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\nvec3 positionToEyeEC = -positionEC;\nczm_materialInput materialInput;\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = (positionMC + u_radii) / u_radii;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef ONLY_SUN_LIGHTING\nreturn czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);\n#else\nreturn czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\nvoid main()\n{\nfloat maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\nvec3 direction = normalize(v_positionEC);\nvec3 ellipsoidCenter = czm_modelView[3].xyz;\nfloat t1 = -1.0;\nfloat t2 = -1.0;\nfloat b = -2.0 * dot(direction, ellipsoidCenter);\nfloat c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\nfloat discriminant = b * b - 4.0 * c;\nif (discriminant >= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ray ray = czm_ray(t * direction, direction);\nvec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\nt = (intersection.start != 0.0) ? intersection.start : intersection.stop;\nvec3 positionEC = czm_pointAlongRay(ray, t);\nvec4 positionCC = czm_projection * vec4(positionEC, 1.0);\n#ifdef LOG_DEPTH\nczm_writeLogDepth(1.0 + positionCC.w);\n#else\nfloat z = positionCC.z / positionCC.w;\nfloat n = czm_depthRange.near;\nfloat f = czm_depthRange.far;\ngl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n#endif\n}\n",EllipsoidVS="attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\nczm_vertexLogDepth();\n}\n";const attributeLocations={position:0};function EllipsoidPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.center=Cartesian3.clone(defaultValue(e.center,Cartesian3.ZERO)),this._center=new Cartesian3,this.radii=Cartesian3.clone(e.radii),this._radii=new Cartesian3,this._oneOverEllipsoidRadiiSquared=new Cartesian3,this._boundingSphere=new BoundingSphere,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this._computedModelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this.material=defaultValue(e.material,Material$4.fromType(Material$4.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.onlySunLighting=defaultValue(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=defaultValue(e.depthTestEnabled,!0),this._useLogDepth=!1,this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new DrawCommand({owner:defaultValue(e._owner,this)}),this._pickCommand=new DrawCommand({owner:defaultValue(e._owner,this),pickOnly:!0});const t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function getVertexArray(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(defined(t))return t;const i=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:VertexFormat.POSITION_ONLY}));return t=VertexArray.fromGeometry({context:e,geometry:i,attributeLocations:attributeLocations,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}const logDepthExtension="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";EllipsoidPrimitive.prototype.update=function(e){if(!this.show||e.mode!==SceneMode$1.SCENE3D||!defined(this.center)||!defined(this.radii))return;const t=e.context,i=this.material.isTranslucent(),n=this._translucent!==i;defined(this._rs)&&!n||(this._translucent=i,this._rs=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!i&&t.fragmentDepth,blending:i?BlendingState$1.ALPHA_BLEND:void 0})),defined(this._va)||(this._va=getVertexArray(t));let r=!1;const o=this.radii;if(!Cartesian3.equals(this._radii,o)){Cartesian3.clone(o,this._radii);const e=this._oneOverEllipsoidRadiiSquared;e.x=1/(o.x*o.x),e.y=1/(o.y*o.y),e.z=1/(o.z*o.z),r=!0}Matrix4.equals(this.modelMatrix,this._modelMatrix)&&Cartesian3.equals(this.center,this._center)||(Matrix4.clone(this.modelMatrix,this._modelMatrix),Cartesian3.clone(this.center,this._center),Matrix4.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),r=!0),r&&(Cartesian3.clone(Cartesian3.ZERO,this._boundingSphere.center),this._boundingSphere.radius=Cartesian3.maximumComponent(o),BoundingSphere.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));const a=this._material!==this.material;this._material=this.material,this._material.update(t);const s=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;const c=e.useLogDepth,l=this._useLogDepth!==c;this._useLogDepth=c;const u=this._colorCommand;let d,h;(a||s||n||l)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS]}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!i&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._sp=ShaderProgram.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations}),u.vertexArray=this._va,u.renderState=this._rs,u.shaderProgram=this._sp,u.uniformMap=combine$2(this._uniforms,this.material._uniforms),u.executeInClosestFrustum=i);const p=e.commandList,f=e.passes;if(f.render&&(u.boundingVolume=this._boundingSphere,u.debugShowBoundingVolume=this.debugShowBoundingVolume,u.modelMatrix=this._computedModelMatrix,u.pass=i?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,p.push(u)),f.pick){const e=this._pickCommand;defined(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(a||s||!defined(this._pickSP)||l)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS],pickColorQualifier:"uniform"}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!i&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._pickSP=ShaderProgram.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations}),e.vertexArray=this._va,e.renderState=this._rs,e.shaderProgram=this._pickSP,e.uniformMap=combine$2(combine$2(this._uniforms,this._pickUniforms),this.material._uniforms),e.executeInClosestFrustum=i),e.boundingVolume=this._boundingSphere,e.modelMatrix=this._computedModelMatrix,e.pass=i?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,p.push(e)}},EllipsoidPrimitive.prototype.isDestroyed=function(){return!1},EllipsoidPrimitive.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),destroyObject(this)};var EllipsoidSurfaceAppearanceFS="varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",EllipsoidSurfaceAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";function EllipsoidSurfaceAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),i=defaultValue(e.aboveGround,!1);this.material=defined(e.material)?e.material:Material$4.fromType(Material$4.ColorType),this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=defaultValue(e.vertexShaderSource,EllipsoidSurfaceAppearanceVS),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,EllipsoidSurfaceAppearanceFS),this._renderState=Appearance.getDefaultRenderState(t,!i,e.renderState),this._closed=!1,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,i),this._aboveGround=i}function Fog(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}Object.defineProperties(EllipsoidSurfaceAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return EllipsoidSurfaceAppearance.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),EllipsoidSurfaceAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,EllipsoidSurfaceAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,EllipsoidSurfaceAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,EllipsoidSurfaceAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;const heightsTable=[359.393,800.749,1275.6501,2151.1192,3141.7763,4777.5198,6281.2493,12364.307,15900.765,49889.0549,78026.8259,99260.7344,120036.3873,151011.0158,156091.1953,203849.3112,274866.9803,319916.3149,493552.0528,628733.5874],densityTable=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7];for(let e=0;e<densityTable.length;++e)densityTable[e]*=1e6;const tableStartDensity=densityTable[1],tableEndDensity=densityTable[densityTable.length-1];for(let e=0;e<densityTable.length;++e)densityTable[e]=(densityTable[e]-tableEndDensity)/(tableStartDensity-tableEndDensity);let tableLastIndex=0;function findInterval(e){const t=heightsTable,i=t.length;if(e<t[0])return tableLastIndex=0,tableLastIndex;if(e>t[i-1])return tableLastIndex=i-2,tableLastIndex;if(e>=t[tableLastIndex]){if(tableLastIndex+1<i&&e<t[tableLastIndex+1])return tableLastIndex;if(tableLastIndex+2<i&&e<t[tableLastIndex+2])return++tableLastIndex,tableLastIndex}else if(tableLastIndex-1>=0&&e>=t[tableLastIndex-1])return--tableLastIndex,tableLastIndex;let n;for(n=0;n<i-2&&!(e>=t[n]&&e<t[n+1]);++n);return tableLastIndex=n,tableLastIndex}const scratchPositionNormal$1=new Cartesian3;function FrameRateMonitor(e){this._scene=e.scene,this.samplingWindow=defaultValue(e.samplingWindow,FrameRateMonitor.defaultSettings.samplingWindow),this.quietPeriod=defaultValue(e.quietPeriod,FrameRateMonitor.defaultSettings.quietPeriod),this.warmupPeriod=defaultValue(e.warmupPeriod,FrameRateMonitor.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=defaultValue(e.minimumFrameRateDuringWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=defaultValue(e.minimumFrameRateAfterWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new Event,this._nominalFrameRate=new Event,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;const t=this;this._preUpdateRemoveListener=this._scene.preUpdate.addEventListener((function(e,i){update(t)})),this._hiddenPropertyName=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":void 0;const i=void 0!==document.hidden?"visibilitychange":void 0!==document.mozHidden?"mozvisibilitychange":void 0!==document.msHidden?"msvisibilitychange":void 0!==document.webkitHidden?"webkitvisibilitychange":void 0;function n(){visibilityChanged(t)}this._visibilityChangeRemoveListener=void 0,defined(i)&&(document.addEventListener(i,n,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(i,n,!1)})}function update(e,t){if(e._pauseCount>0)return;const i=getTimestamp$1();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=i+e.quietPeriod/TimeConstants$1.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/TimeConstants$1.SECONDS_PER_MILLISECOND;else if(i>=e._quietPeriodEndTime){e._frameTimes.push(i);const t=i-e.samplingWindow/TimeConstants$1.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=t){for(;e._frameTimes.length>=2&&e._frameTimes[1]<t;)e._frameTimes.shift();const n=(i-e._frameTimes[0])/(e._frameTimes.length-1);e._lastFramesPerSecond=1e3/n;n>1e3/(i>e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup)?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}function visibilityChanged(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}function FrameState(e,t,i){this.context=e,this.commandList=[],this.shadowMaps=[],this.brdfLutGenerator=void 0,this.environmentMap=void 0,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this.specularEnvironmentMapsMaximumLOD=void 0,this.mode=SceneMode$1.SCENE3D,this.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=i,this.mapProjection=void 0,this.camera=void 0,this.cameraUnderground=!1,this.globeTranslucencyState=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.splitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.light=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0,this.minimumTerrainHeight=0}function FrustumCommands(e,t){this.near=defaultValue(e,0),this.far=defaultValue(t,0);const i=Pass$1.NUMBER_OF_PASSES,n=new Array(i),r=new Array(i);for(let e=0;e<i;++e)n[e]=[],r[e]=0;this.commands=n,this.indices=r}function getMultiClippingFunction(e,t){var i=e.dataTexture,n=i.width,r=i.height,o=e.maxCollectionLength,a=ClippingPlaneCollection.useFloatTexture(t)?getClippingPlaneFloat(n,r):getClippingPlaneUint8(n,r);return a+="\n",a+=clippingFunctionIntersect(e.length,o)}function clippingFunctionIntersect(e,t){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix, sampler2D multiClippingPlanesLength)\n{\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount = 0.0;\n float pixelWidth = czm_metersPerPixel(position);\n int count = 0;\n for (int i = 0; i < "+e+"; ++i)\n {\n bool thisOneClipped = true;\n float thisCollectionClipAmount = 0.;\n int thisCollectionLength = int(texture2D(multiClippingPlanesLength, vec2((float(i) + 0.5)/float("+e+"), 0.5)).w);\n for (int j = 0; j < "+t+" ; ++j)\n {\n thisCollectionLength--;\n vec4 clippingPlane = getClippingPlane(clippingPlanes, count, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n thisCollectionClipAmount = max(amount, thisCollectionClipAmount);\n thisOneClipped = thisOneClipped && (amount <= 0.0);\n count++;\n if(thisCollectionLength == 0) break;\n }\n if (thisOneClipped)\n {\n discard;\n }\n if(clipAmount == 0.0) clipAmount = thisCollectionClipAmount;\n else if(thisCollectionClipAmount != 0.0) clipAmount = min(clipAmount, thisCollectionClipAmount);\n }\n return clipAmount;\n}\n"}function getClippingPlaneFloat(e,t){var i=1/t,n=1/e+"";-1===n.indexOf(".")&&(n+=".0");var r=i+"";return-1===r.indexOf(".")&&(r+=".0"),"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int pixY = clippingPlaneNumber / "+e+";\n int pixX = clippingPlaneNumber - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+n+";\n float v = (float(pixY) + 0.5) * "+r+";\n vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n"}function getClippingPlaneUint8(e,t){var i=1/t,n=1/e+"";-1===n.indexOf(".")&&(n+=".0");var r=i+"";return-1===r.indexOf(".")&&(r+=".0"),"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n int pixY = clippingPlaneStartIndex / "+e+";\n int pixX = clippingPlaneStartIndex - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+n+";\n float v = (float(pixY) + 0.5) * "+r+";\n vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;\n vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);\n vec4 plane;\n plane.xyz = czm_octDecode(oct, 65535.0);\n plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + "+n+", v)));\n return czm_transformPlane(plane, transform);\n}\n"}Fog.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;const t=e.camera,i=t.positionCartographic;if(!defined(i)||i.height>8e5||e.mode!==SceneMode$1.SCENE3D)return void(e.fog.enabled=!1);const n=i.height,r=findInterval(n),o=CesiumMath.clamp((n-heightsTable[r])/(heightsTable[r+1]-heightsTable[r]),0,1);let a=CesiumMath.lerp(densityTable[r],densityTable[r+1],o);const s=1e6*this.density;a=a*(s-s/tableStartDensity*tableEndDensity)*1e-6;const c=Cartesian3.normalize(t.positionWC,scratchPositionNormal$1);a*=1-Math.abs(Cartesian3.dot(t.directionWC,c)),e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness},FrameRateMonitor.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},FrameRateMonitor.fromScene=function(e){return defined(e._frameRateMonitor)&&!e._frameRateMonitor.isDestroyed()||(e._frameRateMonitor=new FrameRateMonitor({scene:e})),e._frameRateMonitor},Object.defineProperties(FrameRateMonitor.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}}),FrameRateMonitor.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},FrameRateMonitor.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},FrameRateMonitor.prototype.isDestroyed=function(){return!1},FrameRateMonitor.prototype.destroy=function(){return this._preUpdateRemoveListener(),defined(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),destroyObject(this)};var GlobeFS="uniform vec4 u_initialColor;\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\nuniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_DAY_NIGHT_ALPHA\nuniform float u_dayTextureNightAlpha[TEXTURE_UNITS];\nuniform float u_dayTextureDayAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SPLIT\nuniform float u_dayTextureSplit[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_IMAGERY_CUTOUT\nuniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_COLOR_TO_ALPHA\nuniform vec4 u_colorsToAlpha[TEXTURE_UNITS];\n#endif\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nuniform vec2 u_lightingFadeDistance;\n#endif\n#ifdef TILE_LIMIT_RECTANGLE\nuniform vec4 u_cartographicLimitRectangle;\n#endif\n#ifdef GROUND_ATMOSPHERE\nuniform vec2 u_nightFadeDistance;\n#endif\n#if defined(ENABLE_SLOPE_MAP)\nuniform sampler2D u_slopeColorsTexture;\n#endif\n#ifdef ENABLE_MULTI_CLIPPING_PLANES\nuniform mediump sampler2D u_multiClippingPlanesLength;\n#endif\n#if defined(ENABLE_CLIPPING_PLANES) || defined(ENABLE_MULTI_CLIPPING_PLANES) // SmartEarth\nuniform highp sampler2D u_clippingPlanes;\nuniform mat4 u_clippingPlanesMatrix;\nuniform vec4 u_clippingPlanesEdgeStyle;\n#endif\n#if defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\nuniform float u_minimumBrightness;\n#endif\n#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift;\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nuniform vec4 u_fillHighlightColor;\n#endif\n#ifdef TRANSLUCENT\nuniform vec4 u_frontFaceAlphaByDistance;\nuniform vec4 u_backFaceAlphaByDistance;\nuniform vec4 u_translucencyRectangle;\n#endif\n#ifdef UNDERGROUND_COLOR\nuniform vec4 u_undergroundColor;\nuniform vec4 u_undergroundColorAlphaByDistance;\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nuniform float u_lambertDiffuseMultiplier;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nvarying float v_height;\nvarying float v_slope;\nvarying float v_aspect;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nvarying float v_distance;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying vec3 v_fogRayleighColor;\nvarying vec3 v_fogMieColor;\n#endif\n#ifdef GROUND_ATMOSPHERE\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\n#endif\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nfloat interpolateByDistance(vec4 nearFarScalar, float distance)\n{\nfloat startDistance = nearFarScalar.x;\nfloat startValue = nearFarScalar.y;\nfloat endDistance = nearFarScalar.z;\nfloat endValue = nearFarScalar.w;\nfloat t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\nreturn mix(startValue, endValue, t);\n}\n#endif\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)\n{\nreturn sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\n#endif\n#ifdef TRANSLUCENT\nbool inTranslucencyRectangle()\n{\nreturn\nv_textureCoordinates.x > u_translucencyRectangle.x &&\nv_textureCoordinates.x < u_translucencyRectangle.z &&\nv_textureCoordinates.y > u_translucencyRectangle.y &&\nv_textureCoordinates.y < u_translucencyRectangle.w;\n}\n#endif\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D textureToSample,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureNightAlpha,\nfloat textureDayAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma,\nfloat split,\nvec4 colorToAlpha,\nfloat nightBlend)\n{\nvec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\ntextureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);\n#endif\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 value = texture2D(textureToSample, textureCoordinates);\nvec3 color = value.rgb;\nfloat alpha = value.a;\n#ifdef APPLY_COLOR_TO_ALPHA\nvec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);\ncolorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);\nalpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);\n#endif\n#if !defined(APPLY_GAMMA)\nvec4 tempColor = czm_gammaCorrect(vec4(color, alpha));\ncolor = tempColor.rgb;\nalpha = tempColor.a;\n#else\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\n#ifdef APPLY_SPLIT\nfloat splitPosition = czm_splitPosition;\nif (split < 0.0 && gl_FragCoord.x > splitPosition) {\nalpha = 0.0;\n}\nelse if (split > 0.0 && gl_FragCoord.x < splitPosition) {\nalpha = 0.0;\n}\n#endif\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\noutAlpha += sign(outAlpha) - 1.0;\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, max(outAlpha, 0.0));\n}\nvec3 colorCorrect(vec3 rgb) {\n#ifdef COLOR_CORRECT\nvec3 hsb = czm_RGBToHSB(rgb);\nhsb.x += u_hsbShift.x;\nhsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);\nhsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;\nrgb = czm_HSBToRGB(hsb);\n#endif\nreturn rgb;\n}\nvec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);\n#ifdef GROUND_ATMOSPHERE\nvec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist);\n#endif\nconst float fExposure = 2.0;\nvoid main()\n{\n#ifdef TILE_LIMIT_RECTANGLE\nif (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||\nv_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)\n{\ndiscard;\n}\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nfloat clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);\n#endif\n#ifdef ENABLE_MULTI_CLIPPING_PLANES\nfloat clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix, u_multiClippingPlanesLength);\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)\nvec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));\nvec3 normalEC = czm_normal3D * normalMC;\n#endif\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\nfloat nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);\n#else\nfloat nightBlend = 0.0;\n#endif\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\ncolor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n#endif\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nfloat cameraDist;\nif (czm_sceneMode == czm_sceneMode2D)\n{\ncameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;\n}\nelse if (czm_sceneMode == czm_sceneModeColumbusView)\n{\ncameraDist = -czm_view[3].z;\n}\nelse\n{\ncameraDist = length(czm_view[3]);\n}\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nif (czm_sceneMode != czm_sceneMode3D) {\nvec3 radii = czm_ellipsoidRadii;\nfloat maxRadii = max(radii.x, max(radii.y, radii.z));\nfadeOutDist -= maxRadii;\nfadeInDist -= maxRadii;\n}\nfloat fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#else\nfloat fade = 0.0;\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;\nwaterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);\n}\n#endif\n#ifdef APPLY_MATERIAL\nczm_materialInput materialInput;\nmaterialInput.st = v_textureCoordinates.st;\nmaterialInput.normalEC = normalize(v_normalEC);\nmaterialInput.positionToEyeEC = -v_positionEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));\nmaterialInput.slope = v_slope;\nmaterialInput.height = v_height;\nmaterialInput.aspect = v_aspect;\nczm_material material = czm_getMaterial(materialInput);\nvec4 materialColor = vec4(material.diffuse, material.alpha);\ncolor = alphaBlend(materialColor, color);\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + 0.3, 0.0, 1.0);\nvec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, fade);\nvec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#else\nvec4 finalColor = color;\n#endif\n#if defined(ENABLE_SLOPE_MAP)\n#if defined(SMOOTH_SLOPE_AT_HIGHER_ALT)\nfinalColor = vec4(texture2D(u_slopeColorsTexture, vec2(0., 1.)).rgb * 0.5 + color.rgb * 0.5, 1.);\n#else\nvec3 ellipsoidNormal = normalize(v_positionMC.xyz);\nfloat n;\nif (v_normalMC.r >= 123.456 - 1.0 && v_normalMC.r <= 123.456 + 1.0){\ngl_FragColor = vec4(vec3(0.66) * 0.5 + finalColor.rgb * 0.5, 1.0);\nreturn;\n}\nelse{\nn = abs(dot(v_normalMC, ellipsoidNormal));\n}\nvec3 texColor = texture2D(u_slopeColorsTexture, vec2(0., n)).rgb;\nfinalColor = vec4(texColor * 0.5 + color.rgb * 0.5, 1.);\n#endif\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nvec4 clippingPlanesEdgeColor = vec4(1.0);\nclippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;\nfloat clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;\nif (clipDistance < clippingPlanesEdgeWidth)\n{\nfinalColor = clippingPlanesEdgeColor;\n}\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nfinalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvec3 fogColor = colorCorrect(v_fogMieColor) + finalColor.rgb * colorCorrect(v_fogRayleighColor);\n#ifndef HDR\nfogColor = vec3(1.0) - exp(-fExposure * fogColor);\n#endif\n#endif\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)\nvec3 atmosphereLightDirection = czm_sunDirectionWC;\n#else\nvec3 atmosphereLightDirection = czm_lightDirectionWC;\n#endif\n#ifdef FOG\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\nfloat darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);\nfogColor *= darken;\n#endif\n#ifdef HDR\nconst float modifier = 0.15;\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor, modifier), finalColor.a);\n#else\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n#endif\n#endif\n#ifdef GROUND_ATMOSPHERE\nif (!czm_backFacing())\n{\nvec3 groundAtmosphereColor = computeGroundAtmosphereColor(fogColor, finalColor, atmosphereLightDirection, cameraDist);\nfinalColor = vec4(mix(finalColor.rgb, groundAtmosphereColor, fade), finalColor.a);\n}\n#endif\n#ifdef UNDERGROUND_COLOR\nif (czm_backFacing())\n{\nfloat distanceFromEllipsoid = max(czm_eyeHeight, 0.0);\nfloat distance = max(v_distance - distanceFromEllipsoid, 0.0);\nfloat blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);\nvec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);\nfinalColor = alphaBlend(undergroundColor, finalColor);\n}\n#endif\n#ifdef TRANSLUCENT\nif (inTranslucencyRectangle())\n{\nvec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;\nfinalColor.a *= interpolateByDistance(alphaByDistance, v_distance);\n}\n#endif\ngl_FragColor = finalColor;\n}\n#ifdef GROUND_ATMOSPHERE\nvec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist)\n{\n#if defined(PER_FRAGMENT_GROUND_ATMOSPHERE) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\nfloat mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);\nvec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);\nxy *= czm_viewport.zw * mpp * 0.5;\nvec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));\nczm_ray ray = czm_ray(vec3(0.0), direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nvec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);\nellipsoidPosition = (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;\nAtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(ellipsoidPosition, true, atmosphereLightDirection);\nvec3 groundAtmosphereColor = colorCorrect(atmosColor.mie) + finalColor.rgb * colorCorrect(atmosColor.rayleigh);\n#ifndef HDR\ngroundAtmosphereColor = vec3(1.0) - exp(-fExposure * groundAtmosphereColor);\n#endif\nfloat fadeInDist = u_nightFadeDistance.x;\nfloat fadeOutDist = u_nightFadeDistance.y;\nfloat sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#ifdef HDR\nsunlitAtmosphereIntensity = max(sunlitAtmosphereIntensity * sunlitAtmosphereIntensity, 0.03);\n#endif\ngroundAtmosphereColor = mix(groundAtmosphereColor, fogColor, sunlitAtmosphereIntensity);\n#else\nvec3 groundAtmosphereColor = fogColor;\n#endif\n#ifdef HDR\ngroundAtmosphereColor = czm_saturation(groundAtmosphereColor, 1.6);\n#endif\nreturn groundAtmosphereColor;\n}\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nfloat linearFade(float edge0, float edge1, float x)\n{\nreturn clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)\n{\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nfloat time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\nvec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\ntime = czm_frameNumber * oceanAnimationSpeedLowAltitude;\nnoise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\nvec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\nfloat highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\nfloat lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\nvec3 normalTangentSpace =\n(highAltitudeFade * normalTangentSpaceHighAltitude) +\n(lowAltitudeFade * normalTangentSpaceLowAltitude);\nnormalTangentSpace = normalize(normalTangentSpace);\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\n#ifdef HDR\nspecular *= 1.4;\nfloat e = 0.2;\nfloat d = 3.3;\nfloat c = 1.7;\nvec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));\n#else\nvec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;\n#endif\nreturn vec4(color, imageryColor.a);\n}\n#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n",GlobeVS="#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed0;\nattribute float compressed1;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec4 textureCoordAndEncodedNormals;\n#endif\n#ifdef GEODETIC_SURFACE_NORMALS\nattribute vec3 geodeticSurfaceNormal;\n#endif\n#ifdef EXAGGERATION\nuniform vec2 u_terrainExaggerationAndRelativeHeight;\n#endif\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform mat4 u_modifiedModelViewProjection;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nvarying float v_slope;\nvarying float v_aspect;\nvarying float v_height;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nvarying float v_distance;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying vec3 v_fogMieColor;\nvarying vec3 v_fogRayleighColor;\n#endif\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn u_modifiedModelViewProjection * vec4(position, 1.0);\n}\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordinates.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorY = u_southMercatorYAndOneOverHeight.x;\nfloat oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\nreturn textureCoordinates.y;\n}\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nreturn u_modifiedModelViewProjection * rtcPosition2D;\n}\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, height, textureCoordinates);\n}\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\nvec3 position3DWC = position + u_center3D;\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\nvec2 xy = czm_decompressTextureCoordinates(compressed0.x);\nvec2 zh = czm_decompressTextureCoordinates(compressed0.y);\nvec3 position = vec3(xy, zh.x);\nfloat height = zh.y;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\nheight = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\nposition = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n#if defined(ENABLE_SLOPE_MAP) || ((defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y))\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = compressed1;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = 0.0;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = compressed0.w;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#else\nvec3 position = position3DAndHeight.xyz;\nfloat height = position3DAndHeight.w;\nvec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n#if defined(ENABLE_SLOPE_MAP) || ((defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y))\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = textureCoordAndEncodedNormals.w;\n#elif defined(ENABLE_SLOPE_MAP) || defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = 0.0;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#endif\nvec3 position3DWC = position + u_center3D;\n#ifdef GEODETIC_SURFACE_NORMALS\nvec3 ellipsoidNormal = geodeticSurfaceNormal;\n#else\nvec3 ellipsoidNormal = normalize(position3DWC);\n#endif\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\nfloat exaggeration = u_terrainExaggerationAndRelativeHeight.x;\nfloat relativeHeight = u_terrainExaggerationAndRelativeHeight.y;\nfloat newHeight = (height - relativeHeight) * exaggeration + relativeHeight;\nfloat minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);\nnewHeight = max(newHeight, -minRadius);\nvec3 offset = ellipsoidNormal * (newHeight - height);\nposition += offset;\nposition3DWC += offset;\nheight = newHeight;\n#endif\ngl_Position = getPosition(position, height, textureCoordinates);\nv_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n#if defined(ENABLE_SLOPE_MAP) || defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\nvec3 normalMC = czm_octDecode(encodedNormal);\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\nvec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;\nvec3 rejection = normalMC - projection;\nnormalMC = normalize(projection + rejection * exaggeration);\n#endif\nv_normalMC = normalMC;\nif (encodedNormal == 31728.192) {\nv_normalMC = vec3(123.456,123.456,123.456);\n}\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(GENERATE_POSITION) || defined(HDR)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nAtmosphereColor atmosFogColor = computeGroundAtmosphereFromSpace(position3DWC, false, vec3(0.0));\nv_fogMieColor = atmosFogColor.mie;\nv_fogRayleighColor = atmosFogColor.rayleigh;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nv_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n#ifdef APPLY_MATERIAL\nfloat northPoleZ = czm_ellipsoidRadii.z;\nvec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);\nvec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));\nfloat dotProd = abs(dot(ellipsoidNormal, v_normalMC));\nv_slope = acos(dotProd);\nvec3 normalRejected = ellipsoidNormal * dotProd;\nvec3 normalProjected = v_normalMC - normalRejected;\nvec3 aspectVector = normalize(normalProjected);\nv_aspect = acos(dot(aspectVector, vectorEastMC));\nfloat determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);\nv_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);\nv_height = height;\n#endif\n}\n",GroundAtmosphere="const float Kr = 0.0025;\nconst float Km = 0.0015;\nconst float ESun = 15.0;\nconst float fKrESun = Kr * ESun;\nconst float fKmESun = Km * ESun;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst vec3 v3InvWavelength = vec3(5.60204474633241, 9.473284437923038, 19.64380261047721);\nconst float fScaleDepth = 0.25;\nstruct AtmosphereColor\n{\nvec3 mie;\nvec3 rayleigh;\n};\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nAtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos, bool dynamicLighting, vec3 lightDirectionWC)\n{\nfloat fInnerRadius = czm_ellipsoidRadii.x;\nfloat fOuterRadius = czm_ellipsoidRadii.x * 1.025;\nfloat fOuterRadius2 = fOuterRadius * fOuterRadius;\nfloat fScale = 1.0 / (fOuterRadius - fInnerRadius);\nfloat fScaleOverScaleDepth = fScale / fScaleDepth;\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\nfloat fCameraHeight = length(czm_viewerPositionWC);\nfloat fCameraHeight2 = fCameraHeight * fCameraHeight;\nfloat B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\nfloat fLightAngle = czm_branchFreeTernary(dynamicLighting, dot(lightDirectionWC, v3Pos) / length(v3Pos), 1.0);\nfloat fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\nfloat fCameraScale = scale(fCameraAngle);\nfloat fLightScale = scale(fLightAngle);\nfloat fCameraOffset = fDepth*fCameraScale;\nfloat fTemp = (fLightScale + fCameraScale);\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0);\nvec3 v3Attenuate = vec3(0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nfloat fScatter = fDepth*fTemp - fCameraOffset;\nv3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nAtmosphereColor color;\ncolor.mie = v3FrontColor * (v3InvWavelength * fKrESun + fKmESun);\ncolor.rayleigh = v3Attenuate;\nreturn color;\n}\n";function GlobeSurfaceShader(e,t,i,n,r,o){this.numberOfDayTextures=e,this.flags=t,this.material=i,this.shaderProgram=n,this.clippingShaderState=r,this.multiClippingShaderState=o}function GlobeSurfaceShaderSet(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function getPositionMode(e){let t;switch(e){case SceneMode$1.SCENE3D:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }";break;case SceneMode$1.SCENE2D:case SceneMode$1.COLUMBUS_VIEW:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }";break;case SceneMode$1.MORPHING:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }"}return t}function get2DYPositionFraction(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}GlobeSurfaceShaderSet.prototype.getShaderProgram=function(e){const t=e.frameState,i=e.surfaceTile,n=e.numberOfDayTextures,r=e.applyBrightness,o=e.applyContrast,a=e.applyHue,s=e.applySaturation,c=e.applyGamma,l=e.applyAlpha,u=e.applyDayNightAlpha,d=e.applySplit,h=e.showReflectiveOcean,p=e.showOceanWaves,f=e.enableLighting,m=e.dynamicAtmosphereLighting,g=e.dynamicAtmosphereLightingFromSun,_=e.showGroundAtmosphere,y=e.perFragmentGroundAtmosphere,C=e.hasVertexNormals,T=e.useWebMercatorProjection,S=e.enableFog,v=e.enableClippingPlanes,A=e.clippingPlanes,E=e.clippedByBoundaries,b=e.hasImageryLayerCutout,x=e.colorCorrect,P=e.highlightFillTile,D=e.colorToAlpha,w=e.hasGeodeticSurfaceNormals,M=e.hasExaggeration,I=e.showUndergroundColor,R=e.translucent,O=e.multiClippingPlanes,B=O&&O.length>0,L=e.showSlopeMap,F=e.smoothSlopeAtHigherAlt;let N=0,V="";const $=i.renderedMesh.encoding;$.quantization===TerrainQuantization$1.BITS12&&(N=1,V="QUANTIZATION_BITS12");let k=0,U="";E&&(k=1,U="TILE_LIMIT_RECTANGLE");let G=0,z="";b&&(G=1,z="APPLY_IMAGERY_CUTOUT");const H=t.mode,W=H|r<<2|o<<3|a<<4|s<<5|c<<6|l<<7|h<<8|p<<9|f<<10|m<<11|g<<12|_<<13|y<<14|C<<15|T<<16|S<<17|N<<18|d<<19|v<<20|k<<21|G<<22|x<<23|P<<24|D<<25|w<<26|M<<27|I<<28|R<<29|u<<30|L<<31|F<<32|B<<33;let q=0;defined(A)&&A.length>0&&(q=v?A.clippingPlanesState:0);let j=0;B&&(j=O.collectionsState);let X=i.surfaceShader;if(defined(X)&&X.numberOfDayTextures===n&&X.flags===W&&X.material===this.material&&X.clippingShaderState===q&&X.multiClippingShaderState===j)return X.shaderProgram;let Y=this._shadersByTexturesFlags[n];if(defined(Y)||(Y=this._shadersByTexturesFlags[n]=[]),X=Y[W],!defined(X)||X.material!==this.material||X.clippingShaderState!==q||X.multiClippingShaderState!==j){const e=this.baseVertexShaderSource.clone(),i=this.baseFragmentShaderSource.clone();0===q||defined(O)||i.sources.unshift(getClippingFunction(A,t.context)),0!==j&&i.sources.unshift(getMultiClippingFunction(O,t.context)),e.defines.push(V),i.defines.push(`TEXTURE_UNITS ${n}`,U,z),r&&i.defines.push("APPLY_BRIGHTNESS"),o&&i.defines.push("APPLY_CONTRAST"),a&&i.defines.push("APPLY_HUE"),s&&i.defines.push("APPLY_SATURATION"),c&&i.defines.push("APPLY_GAMMA"),l&&i.defines.push("APPLY_ALPHA"),u&&i.defines.push("APPLY_DAY_NIGHT_ALPHA"),h&&(i.defines.push("SHOW_REFLECTIVE_OCEAN"),e.defines.push("SHOW_REFLECTIVE_OCEAN")),p&&i.defines.push("SHOW_OCEAN_WAVES"),L&&(e.defines.push("ENABLE_SLOPE_MAP"),i.defines.push("ENABLE_SLOPE_MAP")),F&&i.defines.push("SMOOTH_SLOPE_AT_HIGHER_ALT"),D&&i.defines.push("APPLY_COLOR_TO_ALPHA"),I&&(e.defines.push("UNDERGROUND_COLOR"),i.defines.push("UNDERGROUND_COLOR")),R&&(e.defines.push("TRANSLUCENT"),i.defines.push("TRANSLUCENT")),f&&(C?(e.defines.push("ENABLE_VERTEX_LIGHTING"),i.defines.push("ENABLE_VERTEX_LIGHTING")):(e.defines.push("ENABLE_DAYNIGHT_SHADING"),i.defines.push("ENABLE_DAYNIGHT_SHADING"))),m&&(i.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),g&&i.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN")),_&&(e.defines.push("GROUND_ATMOSPHERE"),i.defines.push("GROUND_ATMOSPHERE"),y&&i.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE")),e.defines.push("INCLUDE_WEB_MERCATOR_Y"),i.defines.push("INCLUDE_WEB_MERCATOR_Y"),S&&(e.defines.push("FOG"),i.defines.push("FOG")),d&&i.defines.push("APPLY_SPLIT"),v&&i.defines.push("ENABLE_CLIPPING_PLANES"),B&&i.defines.push("ENABLE_MULTI_CLIPPING_PLANES"),x&&i.defines.push("COLOR_CORRECT"),P&&i.defines.push("HIGHLIGHT_FILL_TILE"),w&&e.defines.push("GEODETIC_SURFACE_NORMALS"),M&&e.defines.push("EXAGGERATION");let E=" vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)\n {\n vec4 color = initialColor;\n";b&&(E+=" vec4 cutoutAndColorResult;\n bool texelUnclipped;\n");for(let e=0;e<n;++e)E+=b?` cutoutAndColorResult = u_dayTextureCutoutRectangles[${e}];\n texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;\n cutoutAndColorResult = sampleAndBlend(\n`:" color = sampleAndBlend(\n",E+=` color,\n u_dayTextures[${e}],\n u_dayTextureUseWebMercatorT[${e}] ? textureCoordinates.xz : textureCoordinates.xy,\n u_dayTextureTexCoordsRectangle[${e}],\n u_dayTextureTranslationAndScale[${e}],\n ${l?`u_dayTextureAlpha[${e}]`:"1.0"},\n ${u?`u_dayTextureNightAlpha[${e}]`:"1.0"},\n${u?`u_dayTextureDayAlpha[${e}]`:"1.0"},\n${r?`u_dayTextureBrightness[${e}]`:"0.0"},\n ${o?`u_dayTextureContrast[${e}]`:"0.0"},\n ${a?`u_dayTextureHue[${e}]`:"0.0"},\n ${s?`u_dayTextureSaturation[${e}]`:"0.0"},\n ${c?`u_dayTextureOneOverGamma[${e}]`:"0.0"},\n ${d?`u_dayTextureSplit[${e}]`:"0.0"},\n ${D?`u_colorsToAlpha[${e}]`:"vec4(0.0)"},\n nightBlend );\n`,b&&(E+=" color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);\n");E+=" return color;\n }",i.sources.push(E),e.sources.push(getPositionMode(H)),e.sources.push(get2DYPositionFraction(T));const N=ShaderProgram.fromCache({context:t.context,vertexShaderSource:e,fragmentShaderSource:i,attributeLocations:$.getAttributeLocations()});X=Y[W]=new GlobeSurfaceShader(n,W,this.material,N,q,j)}return i.surfaceShader=X,X.shaderProgram},GlobeSurfaceShaderSet.prototype.destroy=function(){let e,t;const i=this._shadersByTexturesFlags;for(const n in i)if(i.hasOwnProperty(n)){const r=i[n];if(!defined(r))continue;for(e in r)r.hasOwnProperty(e)&&(t=r[e],defined(t)&&t.shaderProgram.destroy())}return destroyObject(this)};const ImageryState={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7};var ImageryState$1=Object.freeze(ImageryState);const QuadtreeTileLoadState={START:0,LOADING:1,DONE:2,FAILED:3};var QuadtreeTileLoadState$1=Object.freeze(QuadtreeTileLoadState);const TerrainState={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6};var TerrainState$1=Object.freeze(TerrainState);function GlobeSurfaceTile(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new Cartesian4(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new Cartesian3,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=TerrainState$1.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new BoundingSphere,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(GlobeSurfaceTile.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let t=!(e===TerrainState$1.RECEIVING||e===TerrainState$1.TRANSFORMING);const i=this.imagery;for(let e=0,n=i.length;t&&e<n;++e){const n=i[e];t=!defined(n.loadingImagery)||n.loadingImagery.state!==ImageryState$1.TRANSITIONING}return t}},renderedMesh:{get:function(){return defined(this.vertexArray)?this.mesh:defined(this.fill)?this.fill.mesh:void 0}}});const scratchCartographic$4=new Cartographic;function getPosition(e,t,i,n,r,o){let a=e.getExaggeratedPosition(n,r,o);if(defined(t)&&t!==SceneMode$1.SCENE3D){const e=i.ellipsoid.cartesianToCartographic(a,scratchCartographic$4);a=i.project(e,o),a=Cartesian3.fromElements(a.z,a.x,a.y,o)}return a}const scratchV0=new Cartesian3,scratchV1=new Cartesian3,scratchV2=new Cartesian3;function toggleGeodeticSurfaceNormals(e,t,i,n){const r=e.renderedMesh,o=r.vertices,a=r.encoding,s=o.length/a.stride;let c=TerrainEncoding.clone(a);c.hasGeodeticSurfaceNormals=t,c=TerrainEncoding.clone(c);const l=c.stride,u=new Float32Array(s*l);t?a.addGeodeticSurfaceNormals(o,u,i):a.removeGeodeticSurfaceNormals(o,u),r.vertices=u,r.stride=l;r!==e.mesh?(GlobeSurfaceTile._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(n.context,r)):(GlobeSurfaceTile._freeVertexArray(e.vertexArray),e.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(n.context,r)),GlobeSurfaceTile._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}function prepareNewTile(e,t,i){let n=t.getTileDataAvailable(e.x,e.y,e.level);if(!defined(n)&&defined(e.parent)){const t=e.parent,i=t.data;defined(i)&&defined(i.terrainData)&&(n=i.terrainData.isChildAvailable(t.x,t.y,e.x,e.y))}!1===n&&(e.data.terrainState=TerrainState$1.FAILED);for(let n=0,r=i.length;n<r;++n){const r=i.get(n);r.show&&r._createTileImagerySkeletons(e,t)}}function processTerrainStateMachine(e,t,i,n,r,o){const a=e.data,s=e.parent;if(a.terrainState===TerrainState$1.FAILED&&void 0!==s){void 0!==s.data&&void 0!==s.data.terrainData&&!1!==s.data.terrainData.canUpsample||GlobeSurfaceTile.processStateMachine(s,t,i,n,r,o,!0)}if(a.terrainState===TerrainState$1.FAILED&&upsample(a,e,t,i,e.x,e.y,e.level),a.terrainState===TerrainState$1.UNLOADED&&requestTileGeometry(a,i,e.x,e.y,e.level),a.terrainState===TerrainState$1.RECEIVED&&transform(a,t,i,e.x,e.y,e.level),a.terrainState===TerrainState$1.TRANSFORMED&&(createResources$1(a,t.context,i,e.x,e.y,e.level,o),a.updateExaggeration(e,t,r)),a.terrainState>=TerrainState$1.RECEIVED&&void 0===a.waterMaskTexture&&i.hasWaterMask){if(void 0!==a.terrainData.waterMask)createWaterMaskTextureIfNeeded(t.context,a);else{const t=a._findAncestorTileWithTerrainData(e);defined(t)&&defined(t.data.waterMaskTexture)&&(a.waterMaskTexture=t.data.waterMaskTexture,++a.waterMaskTexture.referenceCount,a._computeWaterMaskTranslationAndScale(e,t,a.waterMaskTranslationAndScale))}}}function upsample(e,t,i,n,r,o,a){const s=t.parent;if(!s)return void(t.state=QuadtreeTileLoadState$1.FAILED);const c=s.data.terrainData,l=s.x,u=s.y,d=s.level;if(!defined(c))return;const h=c.upsample(n.tilingScheme,l,u,d,r,o,a);defined(h)&&(e.terrainState=TerrainState$1.RECEIVING,Promise.resolve(h).then((function(t){e.terrainData=t,e.terrainState=TerrainState$1.RECEIVED})).catch((function(){e.terrainState=TerrainState$1.FAILED})))}function requestTileGeometry(e,t,i,n,r){function o(){const a=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});e.request=a;const s=t.requestTileGeometry(i,n,r,a);defined(s)?(e.terrainState=TerrainState$1.RECEIVING,Promise.resolve(s).then((function(t){!function(t){e.terrainData=t,e.terrainState=TerrainState$1.RECEIVED,e.request=void 0}(t)})).catch((function(a){!function(a){if(e.request.state===RequestState$1.CANCELLED)return e.terrainData=void 0,e.terrainState=TerrainState$1.UNLOADED,void(e.request=void 0);e.terrainState=TerrainState$1.FAILED,e.request=void 0;const s=`Failed to obtain terrain tile X: ${i} Y: ${n} Level: ${r}. Error message: "${a}"`;t._requestError=TileProviderError.handleError(t._requestError,t,t.errorEvent,s,i,n,r,o)}(a)}))):(e.terrainState=TerrainState$1.UNLOADED,e.request=void 0)}o()}GlobeSurfaceTile.prototype.pick=function(e,t,i,n,r){const o=this.renderedMesh;if(!defined(o))return;const a=o.vertices,s=o.indices,c=o.encoding,l=s.length;let u=Number.MAX_VALUE;for(let r=0;r<l;r+=3){const o=s[r],l=s[r+1],d=s[r+2],h=getPosition(c,t,i,a,o,scratchV0),p=getPosition(c,t,i,a,l,scratchV1),f=getPosition(c,t,i,a,d,scratchV2),m=IntersectionTests.rayTriangleParametric(e,h,p,f,n);defined(m)&&m<u&&m>=0&&(u=m)}return u!==Number.MAX_VALUE?Ray.getPoint(e,u,r):void 0},GlobeSurfaceTile.prototype.freeResources=function(){defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=TerrainState$1.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();const e=this.imagery;for(let t=0,i=e.length;t<i;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()},GlobeSurfaceTile.prototype.freeVertexArray=function(){GlobeSurfaceTile._freeVertexArray(this.vertexArray),this.vertexArray=void 0,GlobeSurfaceTile._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0},GlobeSurfaceTile.initialize=function(e,t,i){let n=e.data;defined(n)||(n=e.data=new GlobeSurfaceTile),e.state===QuadtreeTileLoadState$1.START&&(prepareNewTile(e,t,i),e.state=QuadtreeTileLoadState$1.LOADING)},GlobeSurfaceTile.processStateMachine=function(e,t,i,n,r,o,a){GlobeSurfaceTile.initialize(e,i,n);const s=e.data;if(e.state===QuadtreeTileLoadState$1.LOADING&&processTerrainStateMachine(e,t,i,n,r,o),a)return;const c=e.renderable;e.renderable=defined(s.vertexArray);const l=s.terrainState===TerrainState$1.READY;e.upsampledFromParent=defined(s.terrainData)&&s.terrainData.wasCreatedByUpsampling();const u=s.processImagery(e,i,t);if(l&&u){const t=e._loadedCallbacks,i={};for(const n in t)t.hasOwnProperty(n)&&(t[n](e)||(i[n]=t[n]));e._loadedCallbacks=i,e.state=QuadtreeTileLoadState$1.DONE}c&&(e.renderable=!0)},GlobeSurfaceTile.prototype.processImagery=function(e,t,i,n){const r=e.data;let o=e.upsampledFromParent,a=!1,s=!0;const c=r.imagery;let l,u;for(l=0,u=c.length;l<u;++l){const r=c[l];if(!defined(r.loadingImagery)){o=!1;continue}if(r.loadingImagery.state===ImageryState$1.PLACEHOLDER){const i=r.loadingImagery.imageryLayer;if(i.imageryProvider.ready){r.freeResources(),c.splice(l,1),i._createTileImagerySkeletons(e,t,l),--l,u=c.length;continue}o=!1}const d=r.processStateMachine(e,i,n);s=s&&d,a=a||d||defined(r.readyImagery),o=o&&defined(r.loadingImagery)&&(r.loadingImagery.state===ImageryState$1.FAILED||r.loadingImagery.state===ImageryState$1.INVALID)}return e.upsampledFromParent=o,e.renderable=e.renderable&&(a||s),s},GlobeSurfaceTile.prototype.addGeodeticSurfaceNormals=function(e,t){toggleGeodeticSurfaceNormals(this,!0,e,t)},GlobeSurfaceTile.prototype.removeGeodeticSurfaceNormals=function(e){toggleGeodeticSurfaceNormals(this,!1,void 0,e)},GlobeSurfaceTile.prototype.updateExaggeration=function(e,t,i){const n=this,r=n.renderedMesh;if(void 0===r)return;const o=t.terrainExaggeration,a=t.terrainExaggerationRelativeHeight,s=1!==o,c=r.encoding,l=c.exaggeration!==o,u=c.exaggerationRelativeHeight!==a;if(l||u){if(l)if(s&&!c.hasGeodeticSurfaceNormals){const i=e.tilingScheme.ellipsoid;n.addGeodeticSurfaceNormals(i,t)}else!s&&c.hasGeodeticSurfaceNormals&&n.removeGeodeticSurfaceNormals(t);if(c.exaggeration=o,c.exaggerationRelativeHeight=a,void 0!==i){i._tileToUpdateHeights.push(e);const t=e.customData,n=t.length;for(let e=0;e<n;e++){t[e].level=-1}}}};const scratchCreateMeshOptions={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function transform(e,t,i,n,r,o){const a=i.tilingScheme,s=scratchCreateMeshOptions;s.tilingScheme=a,s.x=n,s.y=r,s.level=o,s.exaggeration=t.terrainExaggeration,s.exaggerationRelativeHeight=t.terrainExaggerationRelativeHeight,s.throttle=!0;const c=e.terrainData.createMesh(s);defined(c)&&(e.terrainState=TerrainState$1.TRANSFORMING,Promise.resolve(c).then((function(t){e.mesh=t,e.terrainState=TerrainState$1.TRANSFORMED})).catch((function(){e.terrainState=TerrainState$1.FAILED})))}function createResources$1(e,t,i,n,r,o,a){e.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(t,e.mesh),e.terrainState=TerrainState$1.READY,e.fill=e.fill&&e.fill.destroy(a)}function getContextWaterMaskData(e){let t=e.cache.tile_waterMaskData;if(!defined(t)){const i=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});i.referenceCount=1;t={allWaterTexture:i,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR}),destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function createWaterMaskTextureIfNeeded(e,t){const i=t.terrainData.waterMask,n=getContextWaterMaskData(e);let r;const o=i.length;if(1===o){if(0===i[0])return;r=n.allWaterTexture}else{const t=Math.sqrt(o);r=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:t,height:t,arrayBufferView:i},sampler:n.sampler,flipY:!1}),r.referenceCount=0}++r.referenceCount,t.waterMaskTexture=r,Cartesian4.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}GlobeSurfaceTile._createVertexArrayForMesh=function(e,t){const i=t.vertices,n=Buffer$1.createVertexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW}),r=t.encoding.getAttributes(n),o=t.indices.indexBuffers||{};let a=o[e.id];if(!defined(a)||a.isDestroyed()){const i=t.indices;a=Buffer$1.createIndexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(i.BYTES_PER_ELEMENT)}),a.vertexArrayDestroyable=!1,a.referenceCount=1,o[e.id]=a,t.indices.indexBuffers=o}else++a.referenceCount;return new VertexArray({context:e,attributes:r,indexBuffer:a})},GlobeSurfaceTile._freeVertexArray=function(e){if(defined(e)){const t=e.indexBuffer;e.isDestroyed()||e.destroy(),defined(t)&&!t.isDestroyed()&&defined(t.referenceCount)&&(--t.referenceCount,0===t.referenceCount&&t.destroy())}},GlobeSurfaceTile.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;defined(t)&&(!defined(t.data)||!defined(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t},GlobeSurfaceTile.prototype._computeWaterMaskTranslationAndScale=function(e,t,i){const n=t.rectangle,r=e.rectangle,o=r.width,a=r.height,s=o/n.width,c=a/n.height;return i.x=s*(r.west-n.west)/o,i.y=c*(r.south-n.south)/a,i.z=s,i.w=c,i};var ReprojectWebMercatorFS="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n",ReprojectWebMercatorVS="attribute vec4 position;\nattribute float webMercatorT;\nuniform vec2 u_textureDimensions;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nv_textureCoordinates = vec2(position.x, webMercatorT);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n";function Imagery(e,t,i,n,r){if(this.imageryLayer=e,this.x=t,this.y=i,this.level=n,this.request=void 0,0!==n){const r=t/2|0,o=i/2|0,a=n-1;this.parent=e.getImageryFromCache(r,o,a)}if(this.state=ImageryState$1.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!defined(r)&&e.imageryProvider.ready){r=e.imageryProvider.tilingScheme.tileXYToRectangle(t,i,n)}this.rectangle=r}function TileImagery(e,t,i){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=i}function ImageryLayer(e,t){this._imageryProvider=e,t=defaultValue(t,defaultValue.EMPTY_OBJECT),this._availability=void 0,this._definitionChanged=new Event,this.availability=defaultValue(this.availability,t.availability),this.alpha=defaultValue(t.alpha,defaultValue(e.defaultAlpha,1)),this.nightAlpha=defaultValue(t.nightAlpha,defaultValue(e.defaultNightAlpha,1)),this.dayAlpha=defaultValue(t.dayAlpha,defaultValue(e.defaultDayAlpha,1)),this.brightness=defaultValue(t.brightness,defaultValue(e.defaultBrightness,ImageryLayer.DEFAULT_BRIGHTNESS)),this.contrast=defaultValue(t.contrast,defaultValue(e.defaultContrast,ImageryLayer.DEFAULT_CONTRAST)),this.hue=defaultValue(t.hue,defaultValue(e.defaultHue,ImageryLayer.DEFAULT_HUE)),this.saturation=defaultValue(t.saturation,defaultValue(e.defaultSaturation,ImageryLayer.DEFAULT_SATURATION)),this.gamma=defaultValue(t.gamma,defaultValue(e.defaultGamma,ImageryLayer.DEFAULT_GAMMA)),this.splitDirection=defaultValue(t.splitDirection,defaultValue(e.defaultSplit,ImageryLayer.DEFAULT_SPLIT)),this.minificationFilter=defaultValue(t.minificationFilter,defaultValue(e.defaultMinificationFilter,ImageryLayer.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=defaultValue(t.magnificationFilter,defaultValue(e.defaultMagnificationFilter,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER)),this.show=defaultValue(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=defaultValue(t.rectangle,Rectangle.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._imageryCacheAdd={},this._skeletonPlaceholder=new TileImagery(Imagery.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0,this._reprojectComputeCommands=[],this.cutoutRectangle=t.cutoutRectangle,this.colorToAlpha=t.colorToAlpha,this.colorToAlphaThreshold=defaultValue(t.colorToAlphaThreshold,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Imagery.createPlaceholder=function(e){const t=new Imagery(e,0,0,0);return t.addReference(),t.state=ImageryState$1.PLACEHOLDER,t},Imagery.prototype.addReference=function(){++this.referenceCount},Imagery.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),defined(this.parent)&&this.parent.releaseReference(),defined(this.image)&&defined(this.image.destroy)&&this.image.destroy(),defined(this.texture)&&this.texture.destroy(),defined(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),destroyObject(this),0):this.referenceCount},Imagery.prototype.processStateMachine=function(e,t,i){this.state!==ImageryState$1.UNLOADED||i||(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===ImageryState$1.RECEIVED&&(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));const n=this.state===ImageryState$1.READY&&t&&!this.texture;(this.state===ImageryState$1.TEXTURE_LOADED||n)&&(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))},TileImagery.prototype.freeResources=function(){defined(this.readyImagery)&&this.readyImagery.releaseReference(),defined(this.loadingImagery)&&this.loadingImagery.releaseReference()},TileImagery.prototype.processStateMachine=function(e,t,i){const n=this.loadingImagery,r=n.imageryLayer;if(n.processStateMachine(t,!this.useWebMercatorT,i),n.state===ImageryState$1.READY)return defined(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=r._calculateTextureTranslationAndScale(e,this),!0;let o,a=n.parent;for(;defined(a)&&(a.state!==ImageryState$1.READY||!this.useWebMercatorT&&!defined(a.texture));)a.state!==ImageryState$1.FAILED&&a.state!==ImageryState$1.INVALID&&(o=o||a),a=a.parent;return this.readyImagery!==a&&(defined(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=a,defined(a)&&(a.addReference(),this.textureTranslationAndScale=r._calculateTextureTranslationAndScale(e,this))),(n.state===ImageryState$1.FAILED||n.state===ImageryState$1.INVALID)&&(!defined(o)||(o.processStateMachine(t,!this.useWebMercatorT,i),!1))},Object.defineProperties(ImageryLayer.prototype,{availability:createRawPropertyDescriptor("availability"),definitionChanged:{get:function(){return this._definitionChanged}},imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),ImageryLayer.DEFAULT_BRIGHTNESS=1,ImageryLayer.DEFAULT_CONTRAST=1,ImageryLayer.DEFAULT_HUE=0,ImageryLayer.DEFAULT_SATURATION=1,ImageryLayer.DEFAULT_GAMMA=1,ImageryLayer.DEFAULT_SPLIT=SplitDirection$1.NONE,ImageryLayer.DEFAULT_MINIFICATION_FILTER=TextureMinificationFilter$1.LINEAR,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER=TextureMagnificationFilter$1.LINEAR,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004,ImageryLayer.prototype.isBaseLayer=function(){return this._isBaseLayer},ImageryLayer.prototype.isDestroyed=function(){return!1},ImageryLayer.prototype.destroy=function(){return destroyObject(this)};const imageryBoundsScratch=new Rectangle,tileImageryBoundsScratch=new Rectangle,clippedRectangleScratch=new Rectangle,terrainRectangleScratch=new Rectangle;function getSamplerKey(e,t,i){return`${e}:${t}:${i}`}function getImageryCacheKey(e,t,i){return JSON.stringify([e,t,i])}ImageryLayer.prototype.getViewableRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then((function(){return Rectangle.intersection(e.rectangle,t)}))},ImageryLayer.prototype._createTileImagerySkeletons=function(e,t,i){const n=e.data;if(defined(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(defined(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;const r=this._imageryProvider;if(defined(i)||(i=n.imagery.length),!r.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),n.imagery.splice(i,0,this._skeletonPlaceholder),!0;const o=r.tilingScheme.projection instanceof WebMercatorProjection&&e.rectangle.north<WebMercatorProjection.MaximumLatitude&&e.rectangle.south>-WebMercatorProjection.MaximumLatitude,a=Rectangle.intersection(r.rectangle,this._rectangle,imageryBoundsScratch);let s=Rectangle.intersection(e.rectangle,a,tileImageryBoundsScratch);if(!defined(s)){if(!this.isBaseLayer())return!1;const t=a,i=e.rectangle;s=tileImageryBoundsScratch,i.south>=t.north?s.north=s.south=t.north:i.north<=t.south?s.north=s.south=t.south:(s.south=Math.max(i.south,t.south),s.north=Math.min(i.north,t.north)),i.west>=t.east?s.west=s.east=t.east:i.east<=t.west?s.west=s.east=t.west:(s.west=Math.max(i.west,t.west),s.east=Math.min(i.east,t.east))}let c=0;s.south>0?c=s.south:s.north<0&&(c=s.north);let l=getLevelWithMaximumTexelSpacing(this,1*t.getLevelMaximumGeometricError(e.level),c);l=Math.max(0,l);const u=r.maximumLevel;if(l>u&&(l=u),defined(r.minimumLevel)){const e=r.minimumLevel;l<e&&(l=e)}const d=r.tilingScheme,h=d.positionToTileXY(Rectangle.northwest(s),l),p=d.positionToTileXY(Rectangle.southeast(s),l);let f=e.rectangle.width/512,m=e.rectangle.height/512;const g=d.tileXYToRectangle(h.x,h.y,l);Math.abs(g.south-e.rectangle.north)<m&&h.y<p.y&&++h.y,Math.abs(g.east-e.rectangle.west)<f&&h.x<p.x&&++h.x;const _=d.tileXYToRectangle(p.x,p.y,l);Math.abs(_.north-e.rectangle.south)<m&&p.y>h.y&&--p.y,Math.abs(_.west-e.rectangle.east)<f&&p.x>h.x&&--p.x;const y=Rectangle.clone(e.rectangle,terrainRectangleScratch);let C,T,S=d.tileXYToRectangle(h.x,h.y,l),v=Rectangle.intersection(S,a,clippedRectangleScratch);o?(d.rectangleToNativeRectangle(y,y),d.rectangleToNativeRectangle(S,S),d.rectangleToNativeRectangle(v,v),d.rectangleToNativeRectangle(a,a),C=d.tileXYToNativeRectangle.bind(d),f=y.width/512,m=y.height/512):C=d.tileXYToRectangle.bind(d);let A,E=0,b=1;!this.isBaseLayer()&&Math.abs(v.west-y.west)>=f&&(E=Math.min(1,(v.west-y.west)/y.width)),!this.isBaseLayer()&&Math.abs(v.north-y.north)>=m&&(b=Math.max(0,(v.north-y.south)/y.height));const x=b;for(let e=h.x;e<=p.x;e++)if(T=E,S=C(e,h.y,l),v=Rectangle.simpleIntersection(S,a,clippedRectangleScratch),defined(v)){E=Math.min(1,(v.east-y.west)/y.width),e===p.x&&(this.isBaseLayer()||Math.abs(v.east-y.east)<f)&&(E=1),b=x;for(let t=h.y;t<=p.y;t++){if(A=b,S=C(e,t,l),v=Rectangle.simpleIntersection(S,a,clippedRectangleScratch),!defined(v))continue;b=Math.max(0,(v.south-y.south)/y.height),t===p.y&&(this.isBaseLayer()||Math.abs(v.south-y.south)<m)&&(b=0);const r=new Cartesian4(T,b,E,A),s=this.getImageryFromCache(e,t,l);n.imagery.splice(i,0,new TileImagery(s,r,o)),++i}}return!0},ImageryLayer.prototype._calculateTextureTranslationAndScale=function(e,t){let i=t.readyImagery.rectangle,n=e.rectangle;if(t.useWebMercatorT){const e=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;i=e.rectangleToNativeRectangle(i,imageryBoundsScratch),n=e.rectangleToNativeRectangle(n,terrainRectangleScratch)}const r=n.width,o=n.height,a=r/i.width,s=o/i.height;return new Cartesian4(a*(n.west-i.west)/r,s*(n.south-i.south)/o,a,s)},ImageryLayer.prototype._requestImagery=function(e){const t=this._imageryProvider,i=this;let n=getImageryCacheKey(e.x,e.y,e.level);function r(t){if(!defined(t))return o();e.image=t,e.state=ImageryState$1.RECEIVED,e.request=void 0,TileProviderError.handleSuccess(i._requestImageError)}function o(n){if(e.request.state===RequestState$1.CANCELLED)return e.state=ImageryState$1.UNLOADED,void(e.request=void 0);e.state=ImageryState$1.FAILED,e.request=void 0;const r=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;i._requestImageError=TileProviderError.handleError(i._requestImageError,t,t.errorEvent,r,e.x,e.y,e.level,a,n)}function a(){const i=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.IMAGERY});e.request=i,e.state=ImageryState$1.TRANSITIONING;const n=t.requestImage(e.x,e.y,e.level,i);if(!defined(n))return e.state=ImageryState$1.UNLOADED,void(e.request=void 0);defined(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),n instanceof Promise?n.then((function(e){r(e)})).catch((function(e){o(e)})):r(n)}t.addLevel&&this._imageryCache[n]&&(delete this._imageryCache[n],e.level+=t.addLevel,n=getImageryCacheKey(e.x,e.y,e.level),this._imageryCacheAdd[n]=e),a()},ImageryLayer.prototype._createTextureWebGL=function(e,t){const i=new Sampler({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),n=t.image;return defined(n.internalFormat)?new Texture({context:e,pixelFormat:n.internalFormat,width:n.width,height:n.height,source:{arrayBufferView:n.bufferView},sampler:i}):new Texture({context:e,source:n,pixelFormat:this._imageryProvider.hasAlphaChannel?PixelFormat$1.RGBA:PixelFormat$1.RGB,sampler:i})},ImageryLayer.prototype._createTexture=function(e,t){const i=this._imageryProvider,n=t.image;if(defined(i.tileDiscardPolicy)){const e=i.tileDiscardPolicy;if(defined(e)){if(!e.isReady())return void(t.state=ImageryState$1.RECEIVED);if(e.shouldDiscardImage(n))return void(t.state=ImageryState$1.INVALID)}}const r=this._createTextureWebGL(e,t);i.tilingScheme.projection instanceof WebMercatorProjection?t.textureWebMercator=r:t.texture=r,t.image=void 0,t.state=ImageryState$1.TEXTURE_LOADED},ImageryLayer.prototype._finalizeReprojectTexture=function(e,t){let i=this.minificationFilter;const n=this.magnificationFilter;if(i===TextureMinificationFilter$1.LINEAR&&n===TextureMagnificationFilter$1.LINEAR&&!PixelFormat$1.isCompressedFormat(t.pixelFormat)&&CesiumMath.isPowerOfTwo(t.width)&&CesiumMath.isPowerOfTwo(t.height)){i=TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR;const r=ContextLimits.maximumTextureFilterAnisotropy,o=Math.min(r,defaultValue(this._maximumAnisotropy,r)),a=getSamplerKey(i,n,o);let s=e.cache.imageryLayerMipmapSamplers;defined(s)||(s={},e.cache.imageryLayerMipmapSamplers=s);let c=s[a];defined(c)||(c=s[a]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:i,magnificationFilter:n,maximumAnisotropy:o})),t.generateMipmap(MipmapHint$1.NICEST),t.sampler=c}else{const r=getSamplerKey(i,n,0);let o=e.cache.imageryLayerNonMipmapSamplers;defined(o)||(o={},e.cache.imageryLayerNonMipmapSamplers=o);let a=o[r];defined(a)||(a=o[r]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:i,magnificationFilter:n})),t.sampler=a}},ImageryLayer.prototype._reprojectTexture=function(e,t,i){const n=t.textureWebMercator||t.texture,r=t.rectangle,o=e.context;if((i=defaultValue(i,!0))&&!(this._imageryProvider.tilingScheme.projection instanceof GeographicProjection)&&r.width/n.width>1e-5){const e=this;t.addReference();const i=new ComputeCommand({persists:!0,owner:this,preExecute:function(e){reprojectToGeographic(e,o,n,t.rectangle)},postExecute:function(i){t.texture=i,e._finalizeReprojectTexture(o,i),t.state=ImageryState$1.READY,t.releaseReference()},canceled:function(){t.state=ImageryState$1.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(i)}else i&&(t.texture=n),this._finalizeReprojectTexture(o,n),t.state=ImageryState$1.READY},ImageryLayer.prototype.queueReprojectionCommands=function(e){const t=this._reprojectComputeCommands,i=t.length;for(let n=0;n<i;++n)e.commandList.push(t[n]);t.length=0},ImageryLayer.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach((function(e){defined(e.canceled)&&e.canceled()})),this._reprojectComputeCommands.length=0},ImageryLayer.prototype.getImageryFromCache=function(e,t,i,n){const r=getImageryCacheKey(e,t,i);let o=this._imageryCache[r];if(this._imageryProvider.addLevel){const n=getImageryCacheKey(e,t,i+this._imageryProvider.addLevel);o||(o=this._imageryCacheAdd[n])}return defined(o)||(o=new Imagery(this,e,t,i,n),this._imageryCache[r]=o),o.addReference(),o},ImageryLayer.prototype.removeImageryFromCache=function(e){const t=getImageryCacheKey(e.x,e.y,e.level);if(this._imageryProvider.addLevel){this._imageryCacheAdd[t]&&delete this._imageryCacheAdd[t],this._imageryCache[t]&&delete this._imageryCache[t];const i=getImageryCacheKey(e.x,e.y,e.level+this._imageryProvider.addLevel);this._imageryCacheAdd[i]&&delete this._imageryCacheAdd[i]}else delete this._imageryCache[t]},ImageryLayer.prototype.isAvailable=function(e){var t=this._availability;return!defined(t)||t.contains(e)};const uniformMap={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new Cartesian2,texture:void 0},float32ArrayScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(128):void 0;function reprojectToGeographic(e,t,i,n){let r=t.cache.imageryLayer_reproject;if(!defined(r)){r=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){defined(this.framebuffer)&&this.framebuffer.destroy(),defined(this.vertexArray)&&this.vertexArray.destroy(),defined(this.shaderProgram)&&this.shaderProgram.destroy()}};const e=new Float32Array(256);let i=0;for(let t=0;t<64;++t){const n=t/63;e[i++]=0,e[i++]=n,e[i++]=1,e[i++]=n}const n={position:0,webMercatorT:1},o=TerrainProvider.getRegularGridIndices(2,64),a=Buffer$1.createIndexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});r.vertexArray=new VertexArray({context:t,attributes:[{index:n.position,vertexBuffer:Buffer$1.createVertexBuffer({context:t,typedArray:e,usage:BufferUsage$1.STATIC_DRAW}),componentsPerAttribute:2},{index:n.webMercatorT,vertexBuffer:Buffer$1.createVertexBuffer({context:t,sizeInBytes:512,usage:BufferUsage$1.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:a});const s=new ShaderSource({sources:[ReprojectWebMercatorVS]});r.shaderProgram=ShaderProgram.fromCache({context:t,vertexShaderSource:s,fragmentShaderSource:ReprojectWebMercatorFS,attributeLocations:n}),r.sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}i.sampler=r.sampler;const o=i.width,a=i.height;uniformMap.textureDimensions.x=o,uniformMap.textureDimensions.y=a,uniformMap.texture=i;let s=Math.sin(n.south);const c=.5*Math.log((1+s)/(1-s));s=Math.sin(n.north);const l=1/(.5*Math.log((1+s)/(1-s))-c),u=new Texture({context:t,width:o,height:a,pixelFormat:i.pixelFormat,pixelDatatype:i.pixelDatatype,preMultiplyAlpha:i.preMultiplyAlpha});CesiumMath.isPowerOfTwo(o)&&CesiumMath.isPowerOfTwo(a)&&u.generateMipmap(MipmapHint$1.NICEST);const d=n.south,h=n.north,p=float32ArrayScratch;let f=0;for(let e=0;e<64;++e){const t=e/63,i=CesiumMath.lerp(d,h,t);s=Math.sin(i);const n=(.5*Math.log((1+s)/(1-s))-c)*l;p[f++]=n,p[f++]=n}r.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(p),e.shaderProgram=r.shaderProgram,e.outputTexture=u,e.uniformMap=uniformMap,e.vertexArray=r.vertexArray}function getLevelWithMaximumTexelSpacing(e,t,i){const n=e._imageryProvider,r=n.tilingScheme,o=r.ellipsoid,a=e._imageryProvider.tilingScheme.projection instanceof GeographicProjection?1:Math.cos(i),s=r.rectangle,c=o.maximumRadius*s.width*a/(n.tileWidth*r.getNumberOfXTilesAtLevel(0))/t,l=Math.log(c)/Math.log(2);return 0|Math.round(l)}const TileSelectionResult={NONE:0,CULLED:1,RENDERED:2,REFINED:3,RENDERED_AND_KICKED:6,REFINED_AND_KICKED:7,CULLED_BUT_NEEDED:9,wasKicked:function(e){return e>=TileSelectionResult.RENDERED_AND_KICKED},originalResult:function(e){return 3&e},kick:function(e){return 4|e}};function TerrainFillMesh(e){this.tile=e,this.frameLastUpdated=void 0,this.westMeshes=[],this.westTiles=[],this.southMeshes=[],this.southTiles=[],this.eastMeshes=[],this.eastTiles=[],this.northMeshes=[],this.northTiles=[],this.southwestMesh=void 0,this.southwestTile=void 0,this.southeastMesh=void 0,this.southeastTile=void 0,this.northwestMesh=void 0,this.northwestTile=void 0,this.northeastMesh=void 0,this.northeastTile=void 0,this.changedThisFrame=!0,this.visitedFrame=void 0,this.enqueuedFrame=void 0,this.mesh=void 0,this.vertexArray=void 0,this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new Cartesian4}TerrainFillMesh.prototype.update=function(e,t,i){this.changedThisFrame&&(createFillMesh(e,t,this.tile,i),this.changedThisFrame=!1)},TerrainFillMesh.prototype.destroy=function(e){this._destroyVertexArray(e),defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)},TerrainFillMesh.prototype._destroyVertexArray=function(e){defined(this.vertexArray)&&(defined(e)?e.push(this.vertexArray):GlobeSurfaceTile._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const traversalQueueScratch=new Queue;function visitRenderedTiles(e,t,i,n,r,o,a,s,c){if(void 0===n)return;let l=n;for(;l&&(l._lastSelectionResultFrame!==r||TileSelectionResult.wasKicked(l._lastSelectionResult)||TileSelectionResult.originalResult(l._lastSelectionResult)===TileSelectionResult.CULLED);){if(a)return;const e=l.parent;if(o>=TileEdge.NORTHWEST&&void 0!==e)switch(o){case TileEdge.NORTHWEST:l=l===e.northwestChild?e:void 0;break;case TileEdge.NORTHEAST:l=l===e.northeastChild?e:void 0;break;case TileEdge.SOUTHWEST:l=l===e.southwestChild?e:void 0;break;case TileEdge.SOUTHEAST:l=l===e.southeastChild?e:void 0}else l=e}if(void 0!==l)if(l._lastSelectionResult!==TileSelectionResult.RENDERED){if(TileSelectionResult.originalResult(n._lastSelectionResult)!==TileSelectionResult.CULLED)switch(o){case TileEdge.WEST:visitRenderedTiles(e,t,i,n.northwestChild,r,o,!0,s,c),visitRenderedTiles(e,t,i,n.southwestChild,r,o,!0,s,c);break;case TileEdge.EAST:visitRenderedTiles(e,t,i,n.southeastChild,r,o,!0,s,c),visitRenderedTiles(e,t,i,n.northeastChild,r,o,!0,s,c);break;case TileEdge.SOUTH:visitRenderedTiles(e,t,i,n.southwestChild,r,o,!0,s,c),visitRenderedTiles(e,t,i,n.southeastChild,r,o,!0,s,c);break;case TileEdge.NORTH:visitRenderedTiles(e,t,i,n.northeastChild,r,o,!0,s,c),visitRenderedTiles(e,t,i,n.northwestChild,r,o,!0,s,c);break;case TileEdge.NORTHWEST:visitRenderedTiles(e,t,i,n.northwestChild,r,o,!0,s,c);break;case TileEdge.NORTHEAST:visitRenderedTiles(e,t,i,n.northeastChild,r,o,!0,s,c);break;case TileEdge.SOUTHWEST:visitRenderedTiles(e,t,i,n.southwestChild,r,o,!0,s,c);break;case TileEdge.SOUTHEAST:visitRenderedTiles(e,t,i,n.southeastChild,r,o,!0,s,c);break;default:throw new DeveloperError("Invalid edge")}}else{if(defined(l.data.vertexArray))return;visitTile$2(e,t,i,l,o,r,s,c)}}function visitTile$2(e,t,i,n,r,o,a,s){const c=n.data;if(void 0===c.fill)c.fill=new TerrainFillMesh(n);else if(c.fill.visitedFrame===o)return;c.fill.enqueuedFrame!==o&&(c.fill.enqueuedFrame=o,c.fill.changedThisFrame=!1,a.enqueue(n)),propagateEdge(e,t,i,n,r,s)}function propagateEdge(e,t,i,n,r,o){const a=n.data.fill;let s;const c=i.data.fill;let l,u,d,h,p,f;switch(defined(c)?(c.visitedFrame=t.frameNumber,c.changedThisFrame&&(createFillMesh(e,t,i,o),c.changedThisFrame=!1),s=i.data.fill.mesh):s=i.data.mesh,r){case TileEdge.WEST:l=a.westMeshes,u=a.westTiles;break;case TileEdge.SOUTH:l=a.southMeshes,u=a.southTiles;break;case TileEdge.EAST:l=a.eastMeshes,u=a.eastTiles;break;case TileEdge.NORTH:l=a.northMeshes,u=a.northTiles;break;case TileEdge.NORTHWEST:return a.changedThisFrame=a.changedThisFrame||a.northwestMesh!==s,a.northwestMesh=s,void(a.northwestTile=i);case TileEdge.NORTHEAST:return a.changedThisFrame=a.changedThisFrame||a.northeastMesh!==s,a.northeastMesh=s,void(a.northeastTile=i);case TileEdge.SOUTHWEST:return a.changedThisFrame=a.changedThisFrame||a.southwestMesh!==s,a.southwestMesh=s,void(a.southwestTile=i);case TileEdge.SOUTHEAST:return a.changedThisFrame=a.changedThisFrame||a.southeastMesh!==s,a.southeastMesh=s,void(a.southeastTile=i)}if(i.level<=n.level)return a.changedThisFrame=a.changedThisFrame||l[0]!==s||1!==l.length,l[0]=s,u[0]=i,l.length=1,void(u.length=1);const m=i.rectangle;let g;const _=n.rectangle;switch(r){case TileEdge.WEST:for(g=(_.north-_.south)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.greaterThan(m.north,f.south,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.greaterThanOrEquals(m.south,f.north,g));++h);break;case TileEdge.SOUTH:for(g=(_.east-_.west)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.lessThan(m.west,f.east,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.lessThanOrEquals(m.east,f.west,g));++h);break;case TileEdge.EAST:for(g=(_.north-_.south)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.lessThan(m.south,f.north,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.lessThanOrEquals(m.north,f.south,g));++h);break;case TileEdge.NORTH:for(g=(_.east-_.west)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.greaterThan(m.east,f.west,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.greaterThanOrEquals(m.west,f.east,g));++h);}h-d==1?(a.changedThisFrame=a.changedThisFrame||l[d]!==s,l[d]=s,u[d]=i):(a.changedThisFrame=!0,l.splice(d,h-d,s),u.splice(d,h-d,i))}TerrainFillMesh.updateFillTiles=function(e,t,i,n){const r=e._quadtree,o=r._levelZeroTiles,a=r._lastSelectionFrameNumber,s=traversalQueueScratch;s.clear();for(let e=0;e<t.length;++e){defined(t[e].data.vertexArray)&&s.enqueue(t[e])}let c=s.dequeue();for(;void 0!==c;){const t=c.findTileToWest(o),r=c.findTileToSouth(o),l=c.findTileToEast(o),u=c.findTileToNorth(o);visitRenderedTiles(e,i,c,t,a,TileEdge.EAST,!1,s,n),visitRenderedTiles(e,i,c,r,a,TileEdge.NORTH,!1,s,n),visitRenderedTiles(e,i,c,l,a,TileEdge.WEST,!1,s,n),visitRenderedTiles(e,i,c,u,a,TileEdge.SOUTH,!1,s,n);const d=t.findTileToNorth(o),h=t.findTileToSouth(o),p=l.findTileToNorth(o),f=l.findTileToSouth(o);visitRenderedTiles(e,i,c,d,a,TileEdge.SOUTHEAST,!1,s,n),visitRenderedTiles(e,i,c,p,a,TileEdge.SOUTHWEST,!1,s,n),visitRenderedTiles(e,i,c,h,a,TileEdge.NORTHEAST,!1,s,n),visitRenderedTiles(e,i,c,f,a,TileEdge.NORTHWEST,!1,s,n),c=s.dequeue()}};const cartographicScratch$1=new Cartographic,centerCartographicScratch=new Cartographic,cartesianScratch=new Cartesian3,normalScratch=new Cartesian3,octEncodedNormalScratch=new Cartesian2,uvScratch2=new Cartesian2,uvScratch=new Cartesian2;function HeightAndNormal(){this.height=0,this.encodedNormal=new Cartesian2}function fillMissingCorner(e,t,i,n,r,o,a,s,c){if(defined(r))return r;let l;if(defined(o)&&defined(a))l=.5*(o.height+a.height);else if(defined(o))l=o.height;else if(defined(a))l=a.height;else if(defined(s))l=s.height;else{const t=e.tile.data.tileBoundingRegion;let i=0,n=0;defined(t)&&(i=t.minimumHeight,n=t.maximumHeight),l=.5*(i+n)}return getVertexWithHeightAtCorner(e,t,i,n,l,c),c}const heightRangeScratch={minimumHeight:0,maximumHeight:0},scratchCenter$2=new Cartesian3,swVertexScratch=new HeightAndNormal,seVertexScratch=new HeightAndNormal,nwVertexScratch=new HeightAndNormal,neVertexScratch=new HeightAndNormal,heightmapBuffer="undefined"!=typeof Uint8Array?new Uint8Array(81):void 0,scratchCreateMeshSyncOptions={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function createFillMesh(e,t,i,n){GlobeSurfaceTile.initialize(i,e.terrainProvider,e._imageryLayers);const r=i.data,o=r.fill,a=i.rectangle,s=t.terrainExaggeration,c=t.terrainExaggerationRelativeHeight,l=1!==s,u=i.tilingScheme.ellipsoid;let d=getCorner(o,u,0,1,o.northwestTile,o.northwestMesh,o.northTiles,o.northMeshes,o.westTiles,o.westMeshes,nwVertexScratch),h=getCorner(o,u,0,0,o.southwestTile,o.southwestMesh,o.westTiles,o.westMeshes,o.southTiles,o.southMeshes,swVertexScratch),p=getCorner(o,u,1,0,o.southeastTile,o.southeastMesh,o.southTiles,o.southMeshes,o.eastTiles,o.eastMeshes,seVertexScratch),f=getCorner(o,u,1,1,o.northeastTile,o.northeastMesh,o.eastTiles,o.eastMeshes,o.northTiles,o.northMeshes,neVertexScratch);d=fillMissingCorner(o,u,0,1,d,h,f,p,nwVertexScratch),h=fillMissingCorner(o,u,0,0,h,d,p,f,swVertexScratch),p=fillMissingCorner(o,u,1,1,p,h,f,d,seVertexScratch),f=fillMissingCorner(o,u,1,1,f,p,d,h,neVertexScratch);const m=h.height,g=p.height,_=d.height,y=f.height;let C=Math.min(m,g,_,y),T=Math.max(m,g,_,y);const S=.5*(C+T);let v,A;const E=e.getLevelMaximumGeometricError(i.level),b=u.maximumRadius-E;let x=4*Math.acos(b/u.maximumRadius);if(x*=1.5,a.width>x&&T-C<=E){const e=new HeightmapTerrainData({width:9,height:9,buffer:heightmapBuffer,structure:{heightOffset:T}}),t=scratchCreateMeshSyncOptions;t.tilingScheme=i.tilingScheme,t.x=i.x,t.y=i.y,t.level=i.level,t.exaggeration=s,t.exaggerationRelativeHeight=c,o.mesh=e._createMeshSync(t)}else{const t=l,n=Rectangle.center(a,centerCartographicScratch);n.height=S;const r=new TerrainEncoding(u.cartographicToCartesian(n,scratchCenter$2),void 0,void 0,void 0,void 0,!0,!0,t,s,c);let m,g=5;for(m=o.westMeshes,v=0,A=m.length;v<A;++v)g+=m[v].eastIndicesNorthToSouth.length;for(m=o.southMeshes,v=0,A=m.length;v<A;++v)g+=m[v].northIndicesWestToEast.length;for(m=o.eastMeshes,v=0,A=m.length;v<A;++v)g+=m[v].westIndicesSouthToNorth.length;for(m=o.northMeshes,v=0,A=m.length;v<A;++v)g+=m[v].southIndicesEastToWest.length;const _=heightRangeScratch;_.minimumHeight=C,_.maximumHeight=T;const y=r.stride;let E=new Float32Array(g*y),b=0;const x=b;b=addVertexWithComputedPosition(u,a,r,E,b,0,1,d.height,d.encodedNormal,1,_),b=addEdge(o,u,r,E,b,o.westTiles,o.westMeshes,TileEdge.EAST,_);const P=b;b=addVertexWithComputedPosition(u,a,r,E,b,0,0,h.height,h.encodedNormal,0,_),b=addEdge(o,u,r,E,b,o.southTiles,o.southMeshes,TileEdge.NORTH,_);const D=b;b=addVertexWithComputedPosition(u,a,r,E,b,1,0,p.height,p.encodedNormal,0,_),b=addEdge(o,u,r,E,b,o.eastTiles,o.eastMeshes,TileEdge.WEST,_);const w=b;b=addVertexWithComputedPosition(u,a,r,E,b,1,1,f.height,f.encodedNormal,1,_),b=addEdge(o,u,r,E,b,o.northTiles,o.northMeshes,TileEdge.SOUTH,_),C=_.minimumHeight,T=_.maximumHeight;const M=OrientedBoundingBox.fromRectangle(a,C,T,i.tilingScheme.ellipsoid),I=WebMercatorProjection.geodeticLatitudeToMercatorAngle(a.south),R=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(a.north)-I),O=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(n.latitude)-I)*R,B=u.geodeticSurfaceNormalCartographic(cartographicScratch$1,normalScratch),L=AttributeCompression.octEncode(B,octEncodedNormalScratch),F=b;r.encode(E,b*y,M.center,Cartesian2.fromElements(.5,.5,uvScratch),S,L,O,B),++b;const N=b,V=3*(N-1),$=V*(N<256?1:2);let k;if((E.length-N*y)*Float32Array.BYTES_PER_ELEMENT>=$){const e=N*y*Float32Array.BYTES_PER_ELEMENT;k=N<256?new Uint8Array(E.buffer,e,V):new Uint16Array(E.buffer,e,V)}else k=N<256?new Uint8Array(V):new Uint16Array(V);E=new Float32Array(E.buffer,0,N*y);let U=0;for(v=0;v<N-2;++v)k[U++]=F,k[U++]=v,k[U++]=v+1;k[U++]=F,k[U++]=v,k[U++]=0;const G=[];for(v=P;v>=x;--v)G.push(v);const z=[];for(v=D;v>=P;--v)z.push(v);const H=[];for(v=w;v>=D;--v)H.push(v);const W=[];for(W.push(0),v=F-1;v>=w;--v)W.push(v);o.mesh=new TerrainMesh(r.center,E,k,V,N,C,T,BoundingSphere.fromOrientedBoundingBox(M),computeOccludeePoint$1(e,M.center,a,C,T),r.stride,M,r,G,z,H,W)}const P=t.context;o._destroyVertexArray(n),o.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(P,o.mesh),r.processImagery(i,e.terrainProvider,t,!0);const D=o.waterMaskTexture;if(o.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const e=r._findAncestorTileWithTerrainData(i);defined(e)&&defined(e.data.waterMaskTexture)&&(o.waterMaskTexture=e.data.waterMaskTexture,++o.waterMaskTexture.referenceCount,r._computeWaterMaskTranslationAndScale(i,e,o.waterMaskTranslationAndScale))}defined(D)&&(--D.referenceCount,0===D.referenceCount&&D.destroy())}function addVertexWithComputedPosition(e,t,i,n,r,o,a,s,c,l,u){const d=cartographicScratch$1;d.longitude=CesiumMath.lerp(t.west,t.east,o),d.latitude=CesiumMath.lerp(t.south,t.north,a),d.height=s;const h=e.cartographicToCartesian(d,cartesianScratch);let p;i.hasGeodeticSurfaceNormals&&(p=e.geodeticSurfaceNormal(h,normalScratch));const f=uvScratch2;return f.x=o,f.y=a,i.encode(n,r*i.stride,h,f,s,c,l,p),u.minimumHeight=Math.min(u.minimumHeight,s),u.maximumHeight=Math.max(u.maximumHeight,s),r+1}const sourceRectangleScratch=new Rectangle;function transformTextureCoordinates(e,t,i,n){let r=e.rectangle;const o=t.rectangle;0===t.x&&1===i.x&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(r=Rectangle.clone(e.rectangle,sourceRectangleScratch),r.west-=CesiumMath.TWO_PI,r.east-=CesiumMath.TWO_PI):0===e.x&&0===i.x&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(r=Rectangle.clone(e.rectangle,sourceRectangleScratch),r.west+=CesiumMath.TWO_PI,r.east+=CesiumMath.TWO_PI);const a=r.east-r.west,s=(o.west-r.west)/a,c=(o.east-r.west)/a,l=r.north-r.south,u=(o.south-r.south)/l,d=(o.north-r.south)/l;let h=(i.x-s)/(c-s),p=(i.y-u)/(d-u);return Math.abs(h)<Math.EPSILON5?h=0:Math.abs(h-1)<Math.EPSILON5&&(h=1),Math.abs(p)<Math.EPSILON5?p=0:Math.abs(p-1)<Math.EPSILON5&&(p=1),n.x=h,n.y=p,n}const encodedNormalScratch=new Cartesian2;function getVertexFromTileAtCorner(e,t,i,n,r){const o=e.encoding,a=e.vertices;if(r.height=o.decodeHeight(a,t),o.hasVertexNormals)o.getOctEncodedNormal(a,t,r.encodedNormal);else{const e=r.encodedNormal;e.x=0,e.y=0}}const encodedNormalScratch2=new Cartesian2,cartesianScratch2=new Cartesian3;function getInterpolatedVertexAtCorner(e,t,i,n,r,o,a,s,c,l){const u=n.encoding,d=n.vertices,h=transformTextureCoordinates(t,i,u.decodeTextureCoordinates(d,r,uvScratch),uvScratch),p=transformTextureCoordinates(t,i,u.decodeTextureCoordinates(d,o,uvScratch2),uvScratch2);let f;f=c?(a-h.x)/(p.x-h.x):(s-h.y)/(p.y-h.y);const m=u.decodeHeight(d,r),g=u.decodeHeight(d,o),_=i.rectangle;let y;if(cartographicScratch$1.longitude=CesiumMath.lerp(_.west,_.east,a),cartographicScratch$1.latitude=CesiumMath.lerp(_.south,_.north,s),l.height=cartographicScratch$1.height=CesiumMath.lerp(m,g,f),u.hasVertexNormals){const e=u.getOctEncodedNormal(d,r,encodedNormalScratch),t=u.getOctEncodedNormal(d,o,encodedNormalScratch2),i=AttributeCompression.octDecode(e.x,e.y,cartesianScratch),n=AttributeCompression.octDecode(t.x,t.y,cartesianScratch2);y=Cartesian3.lerp(i,n,f,cartesianScratch),Cartesian3.normalize(y,y),AttributeCompression.octEncode(y,l.encodedNormal)}else y=e.geodeticSurfaceNormalCartographic(cartographicScratch$1,cartesianScratch),AttributeCompression.octEncode(y,l.encodedNormal)}function getVertexWithHeightAtCorner(e,t,i,n,r,o){o.height=r;const a=t.geodeticSurfaceNormalCartographic(cartographicScratch$1,cartesianScratch);AttributeCompression.octEncode(a,o.encodedNormal)}function getCorner(e,t,i,n,r,o,a,s,c,l,u){if(getCornerFromEdge(e,t,s,a,!1,i,n,u)||getCornerFromEdge(e,t,l,c,!0,i,n,u))return u;let d,h;return meshIsUsable(r,o)?(d=0===i?0===n?o.eastIndicesNorthToSouth[0]:o.southIndicesEastToWest[0]:0===n?o.northIndicesWestToEast[0]:o.westIndicesSouthToNorth[0],getVertexFromTileAtCorner(o,d,i,n,u),u):(h=0===i?0===n?getClosestHeightToCorner(e.westMeshes,e.westTiles,TileEdge.EAST,e.southMeshes,e.southTiles,TileEdge.NORTH):getClosestHeightToCorner(e.northMeshes,e.northTiles,TileEdge.SOUTH,e.westMeshes,e.westTiles,TileEdge.EAST):0===n?getClosestHeightToCorner(e.southMeshes,e.southTiles,TileEdge.NORTH,e.eastMeshes,e.eastTiles,TileEdge.WEST):getClosestHeightToCorner(e.eastMeshes,e.eastTiles,TileEdge.WEST,e.northMeshes,e.northTiles,TileEdge.SOUTH),defined(h)?(getVertexWithHeightAtCorner(e,t,i,n,h,u),u):void 0)}function getClosestHeightToCorner(e,t,i,n,r,o,a,s){const c=getNearestHeightOnEdge(e,t,!1,i),l=getNearestHeightOnEdge(n,r,!0,o);return defined(c)&&defined(l)?.5*(c+l):defined(c)?c:l}function addEdge(e,t,i,n,r,o,a,s,c){for(let l=0;l<o.length;++l)r=addEdgeMesh(e,t,i,n,r,o[l],a[l],s,c);return r}function addEdgeMesh(e,t,i,n,r,o,a,s,c){let l=o.rectangle;s===TileEdge.EAST&&0===e.tile.x?(l=Rectangle.clone(o.rectangle,sourceRectangleScratch),l.west-=CesiumMath.TWO_PI,l.east-=CesiumMath.TWO_PI):s===TileEdge.WEST&&0===o.x&&(l=Rectangle.clone(o.rectangle,sourceRectangleScratch),l.west+=CesiumMath.TWO_PI,l.east+=CesiumMath.TWO_PI);const u=e.tile.rectangle;let d,h,p,f;switch(r>0&&(i.decodeTextureCoordinates(n,r-1,uvScratch),d=uvScratch.x,h=uvScratch.y),s){case TileEdge.WEST:p=a.westIndicesSouthToNorth,f=!1;break;case TileEdge.NORTH:p=a.northIndicesWestToEast,f=!0;break;case TileEdge.EAST:p=a.eastIndicesNorthToSouth,f=!1;break;case TileEdge.SOUTH:p=a.southIndicesEastToWest,f=!0}const m=o,g=e.tile,_=a.encoding,y=a.vertices,C=i.stride;let T,S;_.hasWebMercatorT&&(T=WebMercatorProjection.geodeticLatitudeToMercatorAngle(u.south),S=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(u.north)-T));for(let e=0;e<p.length;++e){const o=p[e],a=_.decodeTextureCoordinates(y,o,uvScratch);transformTextureCoordinates(m,g,a,a);const s=a.x,l=a.y,v=f?s:l;if(v<0||v>1)continue;if(Math.abs(s-d)<CesiumMath.EPSILON5&&Math.abs(l-h)<CesiumMath.EPSILON5)continue;const A=Math.abs(s)<CesiumMath.EPSILON5||Math.abs(s-1)<CesiumMath.EPSILON5,E=Math.abs(l)<CesiumMath.EPSILON5||Math.abs(l-1)<CesiumMath.EPSILON5;if(A&&E)continue;const b=_.decodePosition(y,o,cartesianScratch),x=_.decodeHeight(y,o);let P;_.hasVertexNormals?P=_.getOctEncodedNormal(y,o,octEncodedNormalScratch):(P=octEncodedNormalScratch,P.x=0,P.y=0);let D,w=l;if(_.hasWebMercatorT){const e=CesiumMath.lerp(u.south,u.north,l);w=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(e)-T)*S}i.hasGeodeticSurfaceNormals&&(D=t.geodeticSurfaceNormal(b,normalScratch)),i.encode(n,r*C,b,a,x,P,w,D),c.minimumHeight=Math.min(c.minimumHeight,x),c.maximumHeight=Math.max(c.maximumHeight,x),++r}return r}function getNearestHeightOnEdge(e,t,i,n,r,o){let a,s,c;i?(a=0,s=e.length,c=1):(a=e.length-1,s=-1,c=-1);for(let r=a;r!==s;r+=c){const o=e[r];if(!meshIsUsable(t[r],o))continue;let a;switch(n){case TileEdge.WEST:a=o.westIndicesSouthToNorth;break;case TileEdge.SOUTH:a=o.southIndicesEastToWest;break;case TileEdge.EAST:a=o.eastIndicesNorthToSouth;break;case TileEdge.NORTH:a=o.northIndicesWestToEast}const s=a[i?0:a.length-1];if(defined(s))return o.encoding.decodeHeight(o.vertices,s)}}function meshIsUsable(e,t){return defined(t)&&(!defined(e.data.fill)||!e.data.fill.changedThisFrame)}function getCornerFromEdge(e,t,i,n,r,o,a,s){let c,l,u,d,h;const p=n[r?0:i.length-1],f=i[r?0:i.length-1];if(meshIsUsable(p,f)&&(0===o?0===a?(c=r?f.northIndicesWestToEast:f.eastIndicesNorthToSouth,l=r,u=r):(c=r?f.eastIndicesNorthToSouth:f.southIndicesEastToWest,l=!r,u=!1):0===a?(c=r?f.westIndicesSouthToNorth:f.northIndicesWestToEast,l=!r,u=!0):(c=r?f.southIndicesEastToWest:f.westIndicesSouthToNorth,l=r,u=!r),c.length>0)){d=r?0:c.length-1,h=c[d],f.encoding.decodeTextureCoordinates(f.vertices,h,uvScratch);const i=transformTextureCoordinates(p,e.tile,uvScratch,uvScratch);if(i.x===o&&i.y===a)return getVertexFromTileAtCorner(f,h,o,a,s),!0;if(d=binarySearch(c,l?o:a,(function(t,i){f.encoding.decodeTextureCoordinates(f.vertices,t,uvScratch);const n=transformTextureCoordinates(p,e.tile,uvScratch,uvScratch);return u?l?n.x-o:n.y-a:l?o-n.x:a-n.y})),!(d<0))return getVertexFromTileAtCorner(f,c[d],o,a,s),!0;if(d=~d,d>0&&d<c.length)return getInterpolatedVertexAtCorner(t,p,e.tile,f,c[d-1],c[d],o,a,l,s),!0}return!1}const cornerPositionsScratch$1=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint$1(e,t,i,n,r,o){const a=e.quadtree._occluders.ellipsoid,s=a.ellipsoid,c=cornerPositionsScratch$1;return Cartesian3.fromRadians(i.west,i.south,r,s,c[0]),Cartesian3.fromRadians(i.east,i.south,r,s,c[1]),Cartesian3.fromRadians(i.west,i.north,r,s,c[2]),Cartesian3.fromRadians(i.east,i.north,r,s,c[3]),a.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,n,o)}function GlobeSurfaceTileProvider(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this.undergroundColor=void 0,this.undergroundColorAlphaByDistance=void 0,this.lambertDiffuseMultiplier=0,this.materialUniformMap=void 0,this._materialUniformMap=void 0,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._disableCullingRenderState=void 0,this._disableCullingBlendRenderState=void 0,this._errorEvent=new Event,this._imageryLayers.layerAdded.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Event,this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._usedDrawCommands=0,this._vertexArraysToDestroy=[],this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new Color(0,0,.5,1),this._clippingPlanes=void 0,this._multiClippingPlanes=void 0,this.cartographicLimitRectangle=Rectangle.clone(Rectangle.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldTerrainExaggeration=void 0,this._oldTerrainExaggerationRelativeHeight=void 0}function sortTileImageryByLayerIndex(e,t){let i=e.loadingImagery;defined(i)||(i=e.readyImagery);let n=t.loadingImagery;return defined(n)||(n=t.readyImagery),i.imageryLayer._layerIndex-n.imageryLayer._layerIndex}function updateCredits(e,t){const i=t.creditDisplay;e._terrainProvider.ready&&defined(e._terrainProvider.credit)&&i.addCredit(e._terrainProvider.credit);const n=e._imageryLayers;for(let e=0,t=n.length;e<t;++e){const t=n.get(e).imageryProvider;t.ready&&defined(t.credit)&&i.addCredit(t.credit)}}function pushCommand(e,t){const i=t.globeTranslucencyState;if(i.translucent){const n=e.renderState.blending.enabled;i.pushDerivedCommands(e,n,t)}else t.commandList.push(e)}Object.defineProperties(GlobeSurfaceTileProvider.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=Cartesian4.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},imageryLayersUpdatedEvent:{get:function(){return this._imageryLayersUpdatedEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,defined(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},multiClippingPlanes:{get:function(){return this._multiClippingPlanes},set:function(e){defined(e)?this._multiClippingPlanes=e:this._multiClippingPlanes=void 0}}}),GlobeSurfaceTileProvider.prototype.update=function(e){this._imageryLayers._update()},GlobeSurfaceTileProvider.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile((function(e){e.data.imagery.sort(sortTileImageryByLayerIndex)}))),updateCredits(this,e);const t=this._vertexArraysToDestroy,i=t.length;for(let e=0;e<i;++e)GlobeSurfaceTile._freeVertexArray(t[e]);t.length=0},GlobeSurfaceTileProvider.prototype.beginUpdate=function(e){const t=this._tilesToRenderByTextureCount;for(let e=0,i=t.length;e<i;++e){const i=t[e];defined(i)&&(i.length=0)}const i=this._clippingPlanes;defined(i)&&i.enabled&&i.update(e);const n=this._multiClippingPlanes;defined(n)&&n.update(e),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1},GlobeSurfaceTileProvider.prototype.endUpdate=function(e){if(!defined(this._renderState)){this._renderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS}}),this._blendRenderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},blending:BlendingState$1.ALPHA_BLEND});let e=clone$1(this._renderState,!0);e.cull.enabled=!1,this._disableCullingRenderState=RenderState.fromCache(e),e=clone$1(this._blendRenderState,!0),e.cull.enabled=!1,this._disableCullingBlendRenderState=RenderState.fromCache(e)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&TerrainFillMesh.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);const t=this.quadtree,i=e.terrainExaggeration,n=e.terrainExaggerationRelativeHeight,r=this._oldTerrainExaggeration!==i||this._oldTerrainExaggerationRelativeHeight!==n;this._oldTerrainExaggeration=i,this._oldTerrainExaggerationRelativeHeight=n,r&&t.forEachLoadedTile((function(i){i.data.updateExaggeration(i,e,t)}));const o=this._tilesToRenderByTextureCount;for(let t=0,i=o.length;t<i;++t){const i=o[t];if(defined(i))for(let t=0,n=i.length;t<n;++t){const n=i[t],r=n.data.tileBoundingRegion;addDrawCommandsForTile(this,n,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,r.minimumHeight)}}},GlobeSurfaceTileProvider.prototype.updateForPick=function(e){const t=this._drawCommands;for(let i=0,n=this._usedDrawCommands;i<n;++i)pushCommand(t[i],e)},GlobeSurfaceTileProvider.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()},GlobeSurfaceTileProvider.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},GlobeSurfaceTileProvider.prototype.loadTile=function(e,t){let i,n=t.data,r=!0;defined(n)&&(r=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===TileSelectionResult.CULLED_BUT_NEEDED,i=n.terrainState),GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,r),n=t.data,r&&i!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==Visibility$1.NONE&&n.boundingVolumeSourceTile===t&&(r=!1,GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,r))};const boundingSphereScratch$1=new BoundingSphere,rectangleIntersectionScratch=new Rectangle,splitCartographicLimitRectangleScratch=new Rectangle,rectangleCenterScratch=new Cartographic;function clipRectangleAntimeridian(e,t){if(t.west<t.east)return t;const i=Rectangle.clone(t,splitCartographicLimitRectangleScratch);return Rectangle.center(e,rectangleCenterScratch).longitude>0?i.east=CesiumMath.PI:i.west=-CesiumMath.PI,i}function isUndergroundVisible(e,t){if(t.cameraUnderground)return!0;if(t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const i=e._clippingPlanes;return!(!defined(i)||!i.enabled)||(!!defined(e._multiClippingPlanes)||!Rectangle.equals(e.cartographicLimitRectangle,Rectangle.MAX_VALUE))}GlobeSurfaceTileProvider.prototype.computeTileVisibility=function(e,t,i){const n=this.computeDistanceToTile(e,t);e._distance=n;const r=isUndergroundVisible(this,t);if(t.fog.enabled&&!r&&CesiumMath.fog(n,t.fog.density)>=1)return Visibility$1.NONE;const o=e.data,a=o.tileBoundingRegion;if(void 0===o.boundingVolumeSourceTile)return Visibility$1.PARTIAL;const s=t.cullingVolume;let c=a.boundingVolume;defined(c)||(c=a.boundingSphere),o.clippedByBoundaries=!1;const l=clipRectangleAntimeridian(e.rectangle,this.cartographicLimitRectangle),u=Rectangle.simpleIntersection(l,e.rectangle,rectangleIntersectionScratch);if(!defined(u))return Visibility$1.NONE;if(Rectangle.equals(u,e.rectangle)||(o.clippedByBoundaries=!0),t.mode!==SceneMode$1.SCENE3D&&(c=boundingSphereScratch$1,BoundingSphere.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,a.minimumHeight,a.maximumHeight,c),Cartesian3.fromElements(c.center.z,c.center.x,c.center.y,c.center),t.mode===SceneMode$1.MORPHING&&defined(o.renderedMesh)&&(c=BoundingSphere.union(a.boundingSphere,c,c))),!defined(c))return Visibility$1.PARTIAL;const d=this._clippingPlanes;if(defined(d)&&d.enabled){const t=d.computeIntersectionWithBoundingVolume(c);if(e.isClipped=t!==Intersect$1.INSIDE,t===Intersect$1.OUTSIDE)return Visibility$1.NONE}const h=this._multiClippingPlanes;if(defined(h)&&h.enabled)for(let t=0;h.length;t++){let i=h[t].computeIntersectionWithBoundingVolume(c);if(e.isClipped=i!==Intersect$1.INSIDE,i===Intersect$1.OUTSIDE)return Visibility$1.NONE}let p;const f=s.computeVisibility(c);if(f===Intersect$1.OUTSIDE?p=Visibility$1.NONE:f===Intersect$1.INTERSECTING?p=Visibility$1.PARTIAL:f===Intersect$1.INSIDE&&(p=Visibility$1.FULL),p===Visibility$1.NONE)return p;const m=t.mode===SceneMode$1.SCENE3D&&t.camera.frustum instanceof OrthographicFrustum;if(t.mode===SceneMode$1.SCENE3D&&!m&&defined(i)&&!r){const e=o.occludeePointInScaledSpace;return defined(e)?i.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(e,a.minimumHeight)?p:Visibility$1.NONE:p}return p},GlobeSurfaceTileProvider.prototype.canRefine=function(e){if(defined(e.data.terrainData))return!0;return void 0!==this.terrainProvider.getTileDataAvailable(2*e.x,2*e.y,e.level+1)};const readyImageryScratch=[],canRenderTraversalStack=[];GlobeSurfaceTileProvider.prototype.canRenderWithoutLosingDetail=function(e,t){const i=e.data,n=readyImageryScratch;n.length=this._imageryLayers.length;let r,o,a,s=!1,c=!1;for(defined(i)&&(s=i.terrainState===TerrainState$1.READY,c=!0,r=i.imagery),o=0,a=n.length;o<a;++o)n[o]=c;if(defined(r))for(o=0,a=r.length;o<a;++o){const e=r[o],t=e.loadingImagery,i=!defined(t)||t.state===ImageryState$1.FAILED||t.state===ImageryState$1.INVALID,a=(e.loadingImagery||e.readyImagery).imageryLayer._layerIndex;n[a]=i&&n[a]}const l=this.quadtree._lastSelectionFrameNumber,u=canRenderTraversalStack;for(u.length=0,u.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);u.length>0;){const e=u.pop(),t=e._lastSelectionResultFrame===l?e._lastSelectionResult:TileSelectionResult.NONE;if(t===TileSelectionResult.RENDERED){if(!defined(e.data))continue;if(!s&&e.data.terrainState===TerrainState$1.READY)return!1;const t=e.data.imagery;for(o=0,a=t.length;o<a;++o){const e=t[o],i=e.loadingImagery,r=!defined(i)||i.state===ImageryState$1.FAILED||i.state===ImageryState$1.INVALID,a=(e.loadingImagery||e.readyImagery).imageryLayer._layerIndex;if(r&&!n[a])return!1}}else t===TileSelectionResult.REFINED&&u.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild)}return!0};const tileDirectionScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.computeTileLoadPriority=function(e,t){const i=e.data;if(void 0===i)return 0;const n=i.tileBoundingRegion.boundingVolume;if(void 0===n)return 0;const r=t.camera.positionWC,o=t.camera.directionWC,a=Cartesian3.subtract(n.center,r,tileDirectionScratch),s=Cartesian3.magnitude(a);return s<CesiumMath.EPSILON5?0:(Cartesian3.divideByScalar(a,s,a),(1-Cartesian3.dot(a,o))*e._distance)};const modifiedModelViewScratch=new Matrix4,modifiedModelViewProjectionScratch=new Matrix4,tileRectangleScratch=new Cartesian4,localizedCartographicLimitRectangleScratch=new Cartesian4,localizedTranslucencyRectangleScratch=new Cartesian4,rtcScratch=new Cartesian3,centerEyeScratch=new Cartesian3,southwestScratch=new Cartesian3,northeastScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.showTileThisFrame=function(e,t){let i=0;const n=e.data.imagery;for(let e=0,t=n.length;e<t;++e){const t=n[e];defined(t.readyImagery)&&0!==t.readyImagery.imageryLayer.alpha&&++i}let r=this._tilesToRenderByTextureCount[i];defined(r)||(r=[],this._tilesToRenderByTextureCount[i]=r),r.push(e);defined(e.data.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;const o=this._debug;++o.tilesRendered,o.texturesRendered+=i};const cornerPositionsScratch=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint(e,t,i,n,r,o){const a=e.quadtree._occluders.ellipsoid,s=a.ellipsoid,c=cornerPositionsScratch;return Cartesian3.fromRadians(i.west,i.south,r,s,c[0]),Cartesian3.fromRadians(i.east,i.south,r,s,c[1]),Cartesian3.fromRadians(i.west,i.north,r,s,c[2]),Cartesian3.fromRadians(i.east,i.north,r,s,c[3]),a.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,n,o)}function updateTileBoundingRegion(e,t,i){let n=e.data;void 0===n&&(n=e.data=new GlobeSurfaceTile);const r=e.tilingScheme.ellipsoid;void 0===n.tileBoundingRegion&&(n.tileBoundingRegion=new TileBoundingRegion({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:r,minimumHeight:0,maximumHeight:0}));const o=n.tileBoundingRegion,a=o.minimumHeight,s=o.maximumHeight;let c=!1,l=e;const u=n.mesh,d=n.terrainData;if(void 0!==u&&void 0!==u.minimumHeight&&void 0!==u.maximumHeight)o.minimumHeight=u.minimumHeight,o.maximumHeight=u.maximumHeight,c=!0;else if(void 0!==d&&void 0!==d._minimumHeight&&void 0!==d._maximumHeight)o.minimumHeight=d._minimumHeight,o.maximumHeight=d._maximumHeight;else{o.minimumHeight=Number.NaN,o.maximumHeight=Number.NaN;let t=e.parent;for(;void 0!==t;){const e=t.data;if(void 0!==e){const t=e.mesh,i=e.terrainData;if(void 0!==t&&void 0!==t.minimumHeight&&void 0!==t.maximumHeight){o.minimumHeight=t.minimumHeight,o.maximumHeight=t.maximumHeight;break}if(void 0!==i&&void 0!==i._minimumHeight&&void 0!==i._maximumHeight){o.minimumHeight=i._minimumHeight,o.maximumHeight=i._maximumHeight;break}}t=t.parent}l=t}if(void 0!==l){const d=i.terrainExaggeration,h=i.terrainExaggerationRelativeHeight;if(1!==d&&(c=!1,o.minimumHeight=TerrainExaggeration.getHeight(o.minimumHeight,d,h),o.maximumHeight=TerrainExaggeration.getHeight(o.maximumHeight,d,h)),c)n.boundingVolumeIsFromMesh||(o._orientedBoundingBox=OrientedBoundingBox.clone(u.orientedBoundingBox,o._orientedBoundingBox),o._boundingSphere=BoundingSphere.clone(u.boundingSphere3D,o._boundingSphere),n.occludeePointInScaledSpace=Cartesian3.clone(u.occludeePointInScaledSpace,n.occludeePointInScaledSpace),defined(n.occludeePointInScaledSpace)||(n.occludeePointInScaledSpace=computeOccludeePoint(t,o._orientedBoundingBox.center,e.rectangle,o.minimumHeight,o.maximumHeight,n.occludeePointInScaledSpace)));else{const i=void 0===o._orientedBoundingBox||void 0===o._boundingSphere;(o.minimumHeight!==a||o.maximumHeight!==s||i)&&(o.computeBoundingVolumes(r),n.occludeePointInScaledSpace=computeOccludeePoint(t,o._orientedBoundingBox.center,e.rectangle,o.minimumHeight,o.maximumHeight,n.occludeePointInScaledSpace))}n.boundingVolumeSourceTile=l,n.boundingVolumeIsFromMesh=c}else n.boundingVolumeSourceTile=void 0,n.boundingVolumeIsFromMesh=!1}function getTileReadyCallback(e,t,i){return function(n){let r,o,a=-1;const s=n.data.imagery,c=s.length;let l;for(l=0;l<c;++l)if(r=s[l],o=defaultValue(r.readyImagery,r.loadingImagery),o.imageryLayer===t){a=l;break}if(-1!==a){const c=a+e;if(r=s[c],o=defined(r)?defaultValue(r.readyImagery,r.loadingImagery):void 0,!defined(o)||o.imageryLayer!==t)return!t._createTileImagerySkeletons(n,i,c);for(l=a;l<c;++l)s[l].freeResources();s.splice(a,e)}return!0}}GlobeSurfaceTileProvider.prototype.computeDistanceToTile=function(e,t){updateTileBoundingRegion(e,this,t);const i=e.data;if(void 0===i.boundingVolumeSourceTile)return 9999999999;const n=i.tileBoundingRegion,r=n.minimumHeight,o=n.maximumHeight;if(i.boundingVolumeSourceTile!==e){const e=t.camera.positionCartographic.height;Math.abs(e-r)>Math.abs(e-o)?(n.minimumHeight=r,n.maximumHeight=r):(n.minimumHeight=o,n.maximumHeight=o)}const a=n.distanceToCamera(t);return n.minimumHeight=r,n.maximumHeight=o,a},GlobeSurfaceTileProvider.prototype.isDestroyed=function(){return!1},GlobeSurfaceTileProvider.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),defined(this._multiClippingPlanes)&&(this._multiClippingPlanes.destroy(),this._multiClippingPlanes=void 0),destroyObject(this)},GlobeSurfaceTileProvider.prototype._onLayerAdded=function(e,t){if(e.show){const t=this._terrainProvider,i=this,n=e.imageryProvider,r=this._imageryLayersUpdatedEvent;n._reload=function(){e._imageryCache={},i._quadtree.forEachLoadedTile((function(i){if(defined(i._loadedCallbacks[e._layerIndex]))return;let n;const r=i.data.imagery,o=r.length;let a=-1,s=0;for(n=0;n<o;++n){const t=r[n];if(defaultValue(t.readyImagery,t.loadingImagery).imageryLayer===e)-1===a&&(a=n),++s;else if(-1!==a)break}if(-1===a)return;const c=a+s;e._createTileImagerySkeletons(i,t,c)&&(i._loadedCallbacks[e._layerIndex]=getTileReadyCallback(s,e,t),i.state=QuadtreeTileLoadState$1.LOADING)}))},this._quadtree.forEachLoadedTile((function(n){e._createTileImagerySkeletons(n,t)&&(n.state=QuadtreeTileLoadState$1.LOADING,0===n.level||n._lastSelectionResultFrame===i.quadtree._lastSelectionFrameNumber&&n._lastSelectionResult===TileSelectionResult.RENDERED||(n.renderable=!1))})),this._layerOrderChanged=!0,r.raiseEvent()}},GlobeSurfaceTileProvider.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile((function(t){const i=t.data.imagery;let n=-1,r=0;for(let t=0,o=i.length;t<o;++t){const o=i[t];let a=o.loadingImagery;if(defined(a)||(a=o.readyImagery),a.imageryLayer===e)-1===n&&(n=t),o.freeResources(),++r;else if(-1!==n)break}-1!==n&&i.splice(n,r)})),defined(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerMoved=function(e,t,i){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const scratchClippingPlanesMatrix=new Matrix4,scratchInverseTransposeClippingPlanesMatrix=new Matrix4;function createTileUniformMap(e,t){const i={u_initialColor:function(){return this.properties.initialColor},u_fillHighlightColor:function(){return this.properties.fillHighlightColor},u_zoomedOutOceanSpecularIntensity:function(){return this.properties.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.properties.oceanNormalMap},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_terrainExaggerationAndRelativeHeight:function(){return this.properties.terrainExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){const t=e.context.uniformState.view,i=Matrix4.multiplyByPoint(t,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(t,i,modifiedModelViewScratch),modifiedModelViewScratch},u_modifiedModelViewProjection:function(){const t=e.context.uniformState.view,i=e.context.uniformState.projection,n=Matrix4.multiplyByPoint(t,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(t,n,modifiedModelViewProjectionScratch),Matrix4.multiply(i,modifiedModelViewProjectionScratch,modifiedModelViewProjectionScratch),modifiedModelViewProjectionScratch},u_dayTextures:function(){return this.properties.dayTextures},u_dayTextureTranslationAndScale:function(){return this.properties.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.properties.dayTextureTexCoordsRectangle},u_dayTextureUseWebMercatorT:function(){return this.properties.dayTextureUseWebMercatorT},u_dayTextureAlpha:function(){return this.properties.dayTextureAlpha},u_dayTextureNightAlpha:function(){return this.properties.dayTextureNightAlpha},u_dayTextureDayAlpha:function(){return this.properties.dayTextureDayAlpha},u_dayTextureBrightness:function(){return this.properties.dayTextureBrightness},u_dayTextureContrast:function(){return this.properties.dayTextureContrast},u_dayTextureHue:function(){return this.properties.dayTextureHue},u_dayTextureSaturation:function(){return this.properties.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.properties.dayTextureOneOverGamma},u_dayIntensity:function(){return this.properties.dayIntensity},u_southAndNorthLatitude:function(){return this.properties.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.properties.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.properties.waterMask},u_waterMaskTranslationAndScale:function(){return this.properties.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.properties.minMaxHeight},u_scaleAndBias:function(){return this.properties.scaleAndBias},u_dayTextureSplit:function(){return this.properties.dayTextureSplit},u_dayTextureCutoutRectangles:function(){return this.properties.dayTextureCutoutRectangles},u_slopeColorsTexture:function(){return ExpandBySmartEarth.isSlopeDirty&&(ExpandBySmartEarth._slopeTex=ExpandBySmartEarth.createElevationTextureFromPallete(ExpandBySmartEarth.SlopeMapPallete,e),this.properties.slopeColorsTexture2=ExpandBySmartEarth._slopeTex,ExpandBySmartEarth.isSlopeDirty=!1),ExpandBySmartEarth._slopeTex},u_clippingPlanes:function(){const i=t._multiClippingPlanes;if(defined(i)&&defined(i.dataTexture))return i.dataTexture;const n=t._clippingPlanes;return defined(n)&&defined(n.texture)?n.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){const i=t._multiClippingPlanes;if(defined(i)){const t=Matrix4.multiply(e.context.uniformState.view,i.modelMatrix,scratchClippingPlanesMatrix);return Matrix4.inverseTranspose(t,scratchInverseTransposeClippingPlanesMatrix)}const n=t._clippingPlanes,r=defined(n)?Matrix4.multiply(e.context.uniformState.view,n.modelMatrix,scratchClippingPlanesMatrix):Matrix4.IDENTITY;return Matrix4.inverseTranspose(r,scratchInverseTransposeClippingPlanesMatrix)},u_clippingPlanesEdgeStyle:function(){const e=t._multiClippingPlanes;if(defined(e)){const t=e.edgeColor.clone();return t.alpha=e.edgeWidth,t}const i=this.properties.clippingPlanesEdgeColor;return i.alpha=this.properties.clippingPlanesEdgeWidth,i},u_multiClippingPlanesLength:function(){const i=t._multiClippingPlanes;if(defined(i)){const e=i.lengthTexture;if(defined(e))return e}return defined(i)?i:e.context.defaultTexture},u_minimumBrightness:function(){return e.fog.minimumBrightness},u_hsbShift:function(){return this.properties.hsbShift},u_colorsToAlpha:function(){return this.properties.colorsToAlpha},u_frontFaceAlphaByDistance:function(){return this.properties.frontFaceAlphaByDistance},u_backFaceAlphaByDistance:function(){return this.properties.backFaceAlphaByDistance},u_translucencyRectangle:function(){return this.properties.localizedTranslucencyRectangle},u_undergroundColor:function(){return this.properties.undergroundColor},u_undergroundColorAlphaByDistance:function(){return this.properties.undergroundColorAlphaByDistance},u_lambertDiffuseMultiplier:function(){return this.properties.lambertDiffuseMultiplier},properties:{initialColor:new Cartesian4(0,0,.5,1),fillHighlightColor:new Color(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new Cartesian2(65e5,9e6),nightFadeDistance:new Cartesian2(1e7,4e7),hsbShift:new Cartesian3,center3D:void 0,rtc:new Cartesian3,modifiedModelView:new Matrix4,tileRectangle:new Cartesian4,terrainExaggerationAndRelativeHeight:new Cartesian2(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new Cartesian2,southMercatorYAndOneOverHeight:new Cartesian2,waterMask:void 0,waterMaskTranslationAndScale:new Cartesian4,minMaxHeight:new Cartesian2,scaleAndBias:new Matrix4,clippingPlanesEdgeColor:Color.clone(Color.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new Cartesian4,frontFaceAlphaByDistance:new Cartesian4,backFaceAlphaByDistance:new Cartesian4,localizedTranslucencyRectangle:new Cartesian4,undergroundColor:Color.clone(Color.TRANSPARENT),undergroundColorAlphaByDistance:new Cartesian4,lambertDiffuseMultiplier:0,slopeColorsTexture2:defined(ExpandBySmartEarth._slopeTex)?ExpandBySmartEarth._slopeTex:ExpandBySmartEarth.createElevationTextureFromPallete(ExpandBySmartEarth.SlopeMapPallete,e)}};return defined(t.cutPolygonUniformMap)?combine$2(i,t.cutPolygonUniformMap):defined(t.materialUniformMap)?combine$2(i,t.materialUniformMap):i}function createWireframeVertexArrayIfNecessary(e,t,i){const n=i.data;let r,o;if(defined(n.vertexArray)?(r=n.mesh,o=n.vertexArray):defined(n.fill)&&defined(n.fill.vertexArray)&&(r=n.fill.mesh,o=n.fill.vertexArray),defined(r)&&defined(o)){if(defined(n.wireframeVertexArray)){if(n.wireframeVertexArray.mesh===r)return;n.wireframeVertexArray.destroy(),n.wireframeVertexArray=void 0}n.wireframeVertexArray=createWireframeVertexArray(e,o,r),n.wireframeVertexArray.mesh=r}}function createWireframeVertexArray(e,t,i){const n={indices:i.indices,primitiveType:PrimitiveType$1.TRIANGLES};GeometryPipeline.toWireframe(n);const r=n.indices,o=Buffer$1.createIndexBuffer({context:e,typedArray:r,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new VertexArray({context:e,attributes:t._attributes,indexBuffer:o})}let getDebugOrientedBoundingBox,getDebugBoundingSphere,debugDestroyPrimitive;!function(){const e=new GeometryInstance({geometry:BoxOutlineGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2)})}),t=new GeometryInstance({geometry:new SphereOutlineGeometry({radius:1})});let i,n,r=new Matrix4;function o(e){return new Primitive$3({geometryInstances:e,appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}getDebugOrientedBoundingBox=function(t,a){return t===i||(debugDestroyPrimitive(),i=t,r=Matrix4.fromRotationTranslation(t.halfAxes,t.center,r),e.modelMatrix=r,e.attributes.color=ColorGeometryInstanceAttribute.fromColor(a),n=o(e)),n},getDebugBoundingSphere=function(e,a){return e===i||(debugDestroyPrimitive(),i=e,r=Matrix4.fromTranslation(e.center,r),r=Matrix4.multiplyByUniformScale(r,e.radius,r),t.modelMatrix=r,t.attributes.color=ColorGeometryInstanceAttribute.fromColor(a),n=o(t)),n},debugDestroyPrimitive=function(){defined(n)&&(n.destroy(),n=void 0,i=void 0)}}();const otherPassesInitialColor=new Cartesian4(0,0,0,0),surfaceShaderSetOptionsScratch={frameState:void 0,surfaceTile:void 0,numberOfDayTextures:void 0,applyBrightness:void 0,applyContrast:void 0,applyHue:void 0,applySaturation:void 0,applyGamma:void 0,applyAlpha:void 0,applyDayNightAlpha:void 0,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,dynamicAtmosphereLighting:void 0,dynamicAtmosphereLightingFromSun:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},defaultUndergroundColor=Color.TRANSPARENT,defaultUndergroundColorAlphaByDistance=new NearFarScalar;function addDrawCommandsForTile(e,t,i){const n=t.data;defined(n.vertexArray)||(void 0===n.fill&&(n.fill=new TerrainFillMesh(t)),n.fill.update(e,i));const r=i.creditDisplay,o=n.terrainData;if(defined(o)&&defined(o.credits)){const e=o.credits;for(let t=0,i=e.length;t<i;++t)r.addCredit(e[t])}let a=ContextLimits.maximumTextureImageUnits,s=n.waterMaskTexture,c=n.waterMaskTranslationAndScale;!defined(s)&&defined(n.fill)&&(s=n.fill.waterMaskTexture,c=n.fill.waterMaskTranslationAndScale);const l=i.cameraUnderground,u=i.globeTranslucencyState,d=u.translucent,h=u.frontFaceAlphaByDistance,p=u.backFaceAlphaByDistance,f=u.rectangle,m=defaultValue(e.undergroundColor,defaultUndergroundColor),g=defaultValue(e.undergroundColorAlphaByDistance,defaultUndergroundColorAlphaByDistance),_=isUndergroundVisible(e,i)&&i.mode===SceneMode$1.SCENE3D&&m.alpha>0&&(g.nearValue>0||g.farValue>0),y=e.lambertDiffuseMultiplier,C=e.hasWaterMask&&defined(s),T=e.oceanNormalMap,S=C&&defined(T),v=e.terrainProvider.ready&&e.terrainProvider.hasVertexNormals,A=i.fog.enabled&&i.fog.renderable&&!l,E=e.showGroundAtmosphere&&i.mode===SceneMode$1.SCENE3D,b=ShadowMode$1.castShadows(e.shadows)&&!d,x=ShadowMode$1.receiveShadows(e.shadows)&&!d,P=e.hueShift,D=e.saturationShift,w=e.brightnessShift;let M=!(CesiumMath.equalsEpsilon(P,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(D,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(w,0,CesiumMath.EPSILON7)),I=!1;if(E){I=Cartesian3.magnitude(i.camera.positionWC)>e.nightFadeOutDistance}C&&--a,S&&--a,defined(i.shadowState)&&i.shadowState.shadowsEnabled&&--a,defined(e.clippingPlanes)&&e.clippingPlanes.enabled&&--a,a-=u.numberOfTextureUniforms;const R=n.renderedMesh;let O=R.center;const B=R.encoding,L=n.tileBoundingRegion,F=i.terrainExaggeration,N=i.terrainExaggerationRelativeHeight,V=1!==F,$=B.hasGeodeticSurfaceNormals,k=tileRectangleScratch;let U=0,G=0,z=0,H=0,W=!1;if(i.mode!==SceneMode$1.SCENE3D){const e=i.mapProjection,n=e.project(Rectangle.southwest(t.rectangle),southwestScratch),r=e.project(Rectangle.northeast(t.rectangle),northeastScratch);if(k.x=n.x,k.y=n.y,k.z=r.x,k.w=r.y,i.mode!==SceneMode$1.MORPHING&&(O=rtcScratch,O.x=0,O.y=.5*(k.z+k.x),O.z=.5*(k.w+k.y),k.x-=O.y,k.y-=O.z,k.z-=O.y,k.w-=O.z),i.mode===SceneMode$1.SCENE2D&&B.quantization===TerrainQuantization$1.BITS12){const e=1/(Math.pow(2,12)-1)*.5,t=(k.z-k.x)*e,i=(k.w-k.y)*e;k.x-=t,k.y-=i,k.z+=t,k.w+=i}e instanceof WebMercatorProjection&&(U=t.rectangle.south,G=t.rectangle.north,z=WebMercatorProjection.geodeticLatitudeToMercatorAngle(U),H=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(G)-z),W=!0)}const q=surfaceShaderSetOptionsScratch;q.frameState=i,q.surfaceTile=n,q.showReflectiveOcean=C,q.showOceanWaves=S,q.enableLighting=e.enableLighting,q.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,q.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,q.showGroundAtmosphere=E,q.perFragmentGroundAtmosphere=I,q.hasVertexNormals=v,q.useWebMercatorProjection=W,q.clippedByBoundaries=n.clippedByBoundaries,q.hasGeodeticSurfaceNormals=$,q.hasExaggeration=V;const j=n.imagery;let X=0;const Y=j.length,K=e.showSkirts&&!l&&!d,J=e.backFaceCulling&&!l&&!d,Q=J?e._renderState:e._disableCullingRenderState,Z=J?e._blendRenderState:e._disableCullingBlendRenderState;let ee=Q,te=e._firstPassInitialColor;const ie=i.context;defined(e._debug.boundingSphereTile)||debugDestroyPrimitive();if(e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const t=e._drawCommands.length;for(let n=0;n<t;++n)e._uniformMaps[n]=createTileUniformMap(i,e)}do{let o,C,S=0;if(e._drawCommands.length<=e._usedDrawCommands?(o=new DrawCommand,o.owner=t,o.cull=!1,o.boundingVolume=new BoundingSphere,o.orientedBoundingBox=void 0,C=createTileUniformMap(i,e),e._drawCommands.push(o),e._uniformMaps.push(C)):(o=e._drawCommands[e._usedDrawCommands],C=e._uniformMaps[e._usedDrawCommands]),o.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const e=L.boundingVolume,t=L.boundingSphere;defined(e)?getDebugOrientedBoundingBox(e,Color.RED).update(i):defined(t)&&getDebugBoundingSphere(t,Color.RED).update(i)}const v=C.properties;Cartesian4.clone(te,v.initialColor),v.oceanNormalMap=T,v.lightingFadeDistance.x=e.lightingFadeOutDistance,v.lightingFadeDistance.y=e.lightingFadeInDistance,v.nightFadeDistance.x=e.nightFadeOutDistance,v.nightFadeDistance.y=e.nightFadeInDistance,v.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const I=l?p:h,V=l?h:p;defined(I)&&(Cartesian4.fromElements(I.near,I.nearValue,I.far,I.farValue,v.frontFaceAlphaByDistance),Cartesian4.fromElements(V.near,V.nearValue,V.far,V.farValue,v.backFaceAlphaByDistance)),Cartesian4.fromElements(g.near,g.nearValue,g.far,g.farValue,v.undergroundColorAlphaByDistance),Color.clone(m,v.undergroundColor),v.lambertDiffuseMultiplier=y;const $=!defined(n.vertexArray)&&defined(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;$&&Color.clone(e.fillHighlightColor,v.fillHighlightColor),v.terrainExaggerationAndRelativeHeight.x=F,v.terrainExaggerationAndRelativeHeight.y=N,v.center3D=R.center,Cartesian3.clone(O,v.rtc),Cartesian4.clone(k,v.tileRectangle),v.southAndNorthLatitude.x=U,v.southAndNorthLatitude.y=G,v.southMercatorYAndOneOverHeight.x=z,v.southMercatorYAndOneOverHeight.y=H;const W=localizedCartographicLimitRectangleScratch,J=clipRectangleAntimeridian(t.rectangle,e.cartographicLimitRectangle),Q=localizedTranslucencyRectangleScratch,ne=clipRectangleAntimeridian(t.rectangle,f);Cartesian3.fromElements(P,D,w,v.hsbShift);const re=t.rectangle,oe=1/re.width,ae=1/re.height;W.x=(J.west-re.west)*oe,W.y=(J.south-re.south)*ae,W.z=(J.east-re.west)*oe,W.w=(J.north-re.south)*ae,Cartesian4.clone(W,v.localizedCartographicLimitRectangle),Q.x=(ne.west-re.west)*oe,Q.y=(ne.south-re.south)*ae,Q.z=(ne.east-re.west)*oe,Q.w=(ne.north-re.south)*ae,Cartesian4.clone(Q,v.localizedTranslucencyRectangle);const se=A&&CesiumMath.fog(t._distance,i.fog.density)>CesiumMath.EPSILON3;M=M&&(se||E);let ce=!1,le=!1,ue=!1,de=!1,he=!1,pe=!1,fe=!1,me=!1,ge=!1,_e=!1;for(;S<a&&X<Y;){const e=j[X],i=e.readyImagery;if(++X,!defined(i)||0===i.imageryLayer.alpha)continue;const n=e.useWebMercatorT?i.textureWebMercator:i.texture,o=i.imageryLayer;defined(e.textureTranslationAndScale)||(e.textureTranslationAndScale=o._calculateTextureTranslationAndScale(t,e)),v.dayTextures[S]=n,v.dayTextureTranslationAndScale[S]=e.textureTranslationAndScale,v.dayTextureTexCoordsRectangle[S]=e.textureCoordinateRectangle,v.dayTextureUseWebMercatorT[S]=e.useWebMercatorT,v.dayTextureAlpha[S]=o.alpha,pe=pe||1!==v.dayTextureAlpha[S],v.dayTextureNightAlpha[S]=o.nightAlpha,fe=fe||1!==v.dayTextureNightAlpha[S],v.dayTextureDayAlpha[S]=o.dayAlpha,fe=fe||1!==v.dayTextureDayAlpha[S],v.dayTextureBrightness[S]=o.brightness,ce=ce||v.dayTextureBrightness[S]!==ImageryLayer.DEFAULT_BRIGHTNESS,v.dayTextureContrast[S]=o.contrast,le=le||v.dayTextureContrast[S]!==ImageryLayer.DEFAULT_CONTRAST,v.dayTextureHue[S]=o.hue,ue=ue||v.dayTextureHue[S]!==ImageryLayer.DEFAULT_HUE,v.dayTextureSaturation[S]=o.saturation,de=de||v.dayTextureSaturation[S]!==ImageryLayer.DEFAULT_SATURATION,v.dayTextureOneOverGamma[S]=1/o.gamma,he=he||v.dayTextureOneOverGamma[S]!==1/ImageryLayer.DEFAULT_GAMMA,v.dayTextureSplit[S]=o.splitDirection,me=me||0!==v.dayTextureSplit[S];let a=v.dayTextureCutoutRectangles[S];if(defined(a)||(a=v.dayTextureCutoutRectangles[S]=new Cartesian4),Cartesian4.clone(Cartesian4.ZERO,a),defined(o.cutoutRectangle)){const e=clipRectangleAntimeridian(re,o.cutoutRectangle);ge=defined(Rectangle.simpleIntersection(e,re,rectangleIntersectionScratch))||ge,a.x=(e.west-re.west)*oe,a.y=(e.south-re.south)*ae,a.z=(e.east-re.west)*oe,a.w=(e.north-re.south)*ae}let s=v.colorsToAlpha[S];defined(s)||(s=v.colorsToAlpha[S]=new Cartesian4);const c=defined(o.colorToAlpha)&&o.colorToAlphaThreshold>0;if(_e=_e||c,c){const e=o.colorToAlpha;s.x=e.red,s.y=e.green,s.z=e.blue,s.w=o.colorToAlphaThreshold}else s.w=-1;if(defined(i.credits)){const e=i.credits;for(let t=0,i=e.length;t<i;++t)r.addCredit(e[t])}++S}v.dayTextures.length=S,v.waterMask=s,Cartesian4.clone(c,v.waterMaskTranslationAndScale),v.minMaxHeight.x=B.minimumHeight,v.minMaxHeight.y=B.maximumHeight,Matrix4.clone(B.matrix,v.scaleAndBias);const ye=e._clippingPlanes,Ce=defined(ye)&&ye.enabled&&t.isClipped;Ce&&(v.clippingPlanesEdgeColor=Color.clone(ye.edgeColor,v.clippingPlanesEdgeColor),v.clippingPlanesEdgeWidth=ye.edgeWidth),q.numberOfDayTextures=S,q.applyBrightness=ce,q.applyContrast=le,q.applyHue=ue,q.applySaturation=de,q.applyGamma=he,q.applyAlpha=pe,q.applyDayNightAlpha=fe,q.applySplit=me,q.enableFog=se,q.enableClippingPlanes=Ce,q.clippingPlanes=ye,q.hasImageryLayerCutout=ge,q.colorCorrect=M,q.highlightFillTile=$,q.colorToAlpha=_e,q.showUndergroundColor=_,q.translucent=d,q.showSlopeMap=ExpandBySmartEarth.displaySlopeMap,q.smoothSlopeAtHigherAlt=!1,q.multiClippingPlanes=e._multiClippingPlanes;let Te=n.renderedMesh.indices.length;K||(Te=n.renderedMesh.indexCountWithoutSkirts),o.shaderProgram=e._surfaceShaderSet.getShaderProgram(q),o.castShadows=b,o.receiveShadows=x,o.renderState=ee,o.primitiveType=PrimitiveType$1.TRIANGLES,o.vertexArray=n.vertexArray||n.fill.vertexArray,o.count=Te,o.uniformMap=C,o.pass=Pass$1.GLOBE,e._debug.wireframe&&(createWireframeVertexArrayIfNecessary(ie,e,t),defined(n.wireframeVertexArray)&&(o.vertexArray=n.wireframeVertexArray,o.primitiveType=PrimitiveType$1.LINES,o.count=2*Te));let Se=o.boundingVolume;const ve=o.orientedBoundingBox;i.mode!==SceneMode$1.SCENE3D?(BoundingSphere.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,L.minimumHeight,L.maximumHeight,Se),Cartesian3.fromElements(Se.center.z,Se.center.x,Se.center.y,Se.center),i.mode===SceneMode$1.MORPHING&&(Se=BoundingSphere.union(L.boundingSphere,Se,Se))):(o.boundingVolume=BoundingSphere.clone(L.boundingSphere,Se),o.orientedBoundingBox=OrientedBoundingBox.clone(L.boundingVolume,ve)),o.dirty=!0,d&&u.updateDerivedCommands(o,i),pushCommand(o,i),ee=Z,te=otherPassesInitialColor}while(X<Y)}function GlobeTranslucency(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=Rectangle.clone(Rectangle.MAX_VALUE)}function ImageryLayerCollection(){this._layers=[],this.layerAdded=new Event,this.layerRemoved=new Event,this.layerMoved=new Event,this.layerShownOrHidden=new Event}function getLayerIndex(e,t){return e.indexOf(t)}function swapLayers(e,t,i){const n=e._layers;if((t=CesiumMath.clamp(t,0,n.length-1))===(i=CesiumMath.clamp(i,0,n.length-1)))return;const r=n[t];n[t]=n[i],n[i]=r,e._update(),e.layerMoved.raiseEvent(r,i,t)}Object.defineProperties(GlobeTranslucency.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){this._frontFaceAlphaByDistance=NearFarScalar.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){this._backFaceAlphaByDistance=NearFarScalar.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){defined(e)||(e=Rectangle.clone(Rectangle.MAX_VALUE)),Rectangle.clone(e,this._rectangle)}}}),Object.defineProperties(ImageryLayerCollection.prototype,{length:{get:function(){return this._layers.length}}}),ImageryLayerCollection.prototype.add=function(e,t){defined(t)?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t)},ImageryLayerCollection.prototype.addImageryProvider=function(e,t){const i=new ImageryLayer(e);return this.add(i,t),i},ImageryLayerCollection.prototype.remove=function(e,t){t=defaultValue(t,!0);const i=this._layers.indexOf(e);return-1!==i&&(this._layers.splice(i,1),this._update(),this.layerRemoved.raiseEvent(e,i),t&&e.destroy(),!0)},ImageryLayerCollection.prototype.removeAll=function(e){e=defaultValue(e,!0);const t=this._layers;for(let i=0,n=t.length;i<n;i++){const n=t[i];this.layerRemoved.raiseEvent(n,i),e&&n.destroy()}this._layers=[]},ImageryLayerCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},ImageryLayerCollection.prototype.indexOf=function(e){return this._layers.indexOf(e)},ImageryLayerCollection.prototype.get=function(e){return this._layers[e]},ImageryLayerCollection.prototype.raise=function(e){const t=getLayerIndex(this._layers,e);swapLayers(this,t,t+1)},ImageryLayerCollection.prototype.lower=function(e){const t=getLayerIndex(this._layers,e);swapLayers(this,t,t-1)},ImageryLayerCollection.prototype.raiseToTop=function(e){const t=getLayerIndex(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))},ImageryLayerCollection.prototype.lowerToBottom=function(e){const t=getLayerIndex(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};const applicableRectangleScratch=new Rectangle;function pickImageryHelper(e,t,i,n){const r=e.globe._surface._tilesToRender;let o;for(let e=0;!defined(o)&&e<r.length;++e){const i=r[e];Rectangle.contains(i.rectangle,t)&&(o=i)}if(!defined(o))return;const a=o.data.imagery;for(let e=a.length-1;e>=0;--e){const r=a[e],s=r.readyImagery;if(!defined(s))continue;const c=s.imageryLayer.imageryProvider;if(i&&!defined(c.pickFeatures))continue;if(!Rectangle.contains(s.rectangle,t))continue;const l=applicableRectangleScratch,u=1/1024;l.west=CesiumMath.lerp(o.rectangle.west,o.rectangle.east,r.textureCoordinateRectangle.x-u),l.east=CesiumMath.lerp(o.rectangle.west,o.rectangle.east,r.textureCoordinateRectangle.z+u),l.south=CesiumMath.lerp(o.rectangle.south,o.rectangle.north,r.textureCoordinateRectangle.y-u),l.north=CesiumMath.lerp(o.rectangle.south,o.rectangle.north,r.textureCoordinateRectangle.w+u),Rectangle.contains(l,t)&&n(s)}}function QuadtreeOccluders(e){this._ellipsoid=new EllipsoidalOccluder(e.ellipsoid,Cartesian3.ZERO)}function QuadtreeTile(e){this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=TileSelectionResult.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0,this.datazh=void 0}function freeTile(e){defined(e)&&e.freeResources()}function TileReplacementQueue(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function remove(e,t){const i=t.replacementPrevious,n=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=n),t===e.head?e.head=n:i.replacementNext=n,t===e.tail?e.tail=i:n.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}function QuadtreePrimitive(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};const t=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new TileReplacementQueue,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,2),this.tileCacheSize=defaultValue(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new QuadtreeOccluders({ellipsoid:t}),this._tileLoadProgressEvent=new Event,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}function invalidateAllTiles$1(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,clearTileLoadQueue$1(e);const i=e._levelZeroTiles;if(defined(i))for(let t=0;t<i.length;++t){const n=i[t].customData,r=n.length;for(let t=0;t<r;++t){const i=n[t];i.level=0,e._addHeightCallbacks.push(i)}i[t].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}function clearTileLoadQueue$1(e){const t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}function updateTileLoadProgress$1(e,t){const i=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;(i!==e._lastTileLoadQueueLength||e._tilesInvalidated)&&(t.afterRender.push(Event.prototype.raiseEvent.bind(e._tileLoadProgressEvent,i)),e._lastTileLoadQueueLength=i);const n=e._debug;n.enableDebugOutput&&!n.suspendLodUpdate&&(n.maxDepth=e._tilesToRender.reduce((function(e,t){return Math.max(e,t.level)}),-1),n.tilesRendered=e._tilesToRender.length,n.tilesVisited===n.lastTilesVisited&&n.tilesRendered===n.lastTilesRendered&&n.tilesCulled===n.lastTilesCulled&&n.maxDepth===n.lastMaxDepth&&n.tilesWaitingForChildren===n.lastTilesWaitingForChildren&&n.maxDepthVisited===n.lastMaxDepthVisited||(console.log(`Visited ${n.tilesVisited}, Rendered: ${n.tilesRendered}, Culled: ${n.tilesCulled}, Max Depth Rendered: ${n.maxDepth}, Max Depth Visited: ${n.maxDepthVisited}, Waiting for children: ${n.tilesWaitingForChildren}`),n.lastTilesVisited=n.tilesVisited,n.lastTilesRendered=n.tilesRendered,n.lastTilesCulled=n.tilesCulled,n.lastMaxDepth=n.maxDepth,n.lastTilesWaitingForChildren=n.tilesWaitingForChildren,n.lastMaxDepthVisited=n.maxDepthVisited))}let comparisonPoint$1;ImageryLayerCollection.prototype.pickImageryLayers=function(e,t){const i=t.globe.pick(e,t);if(!defined(i))return;const n=t.globe.ellipsoid.cartesianToCartographic(i),r=[];return pickImageryHelper(t,n,!1,(function(e){r.push(e.imageryLayer)})),0!==r.length?r:void 0},ImageryLayerCollection.prototype.pickImageryLayerFeatures=function(e,t){const i=t.globe.pick(e,t);if(!defined(i))return;const n=t.globe.ellipsoid.cartesianToCartographic(i),r=[],o=[];return pickImageryHelper(t,n,!0,(function(e){const t=e.imageryLayer.imageryProvider.pickFeatures(e.x,e.y,e.level,n.longitude,n.latitude);defined(t)&&(r.push(t),o.push(e.imageryLayer))})),0!==r.length?Promise.all(r).then((function(e){const t=[];for(let i=0;i<e.length;++i){const r=e[i],a=o[i];if(defined(r)&&r.length>0)for(let e=0;e<r.length;++e){const i=r[e];i.imageryLayer=a,defined(i.position)||(i.position=n),t.push(i)}}return t})):void 0},ImageryLayerCollection.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let i=0,n=t.length;i<n;++i)t[i].queueReprojectionCommands(e)},ImageryLayerCollection.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,i=e.length;t<i;++t)e[t].cancelReprojections()},ImageryLayerCollection.prototype.isDestroyed=function(){return!1},ImageryLayerCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},ImageryLayerCollection.prototype._update=function(){let e=!0;const t=this._layers;let i,n,r,o;for(r=0,o=t.length;r<o;++r)n=t[r],n._layerIndex=r,n.show?(n._isBaseLayer=e,e=!1):n._isBaseLayer=!1,n.show!==n._show&&(defined(n._show)&&(defined(i)||(i=[]),i.push(n)),n._show=n.show);if(defined(i))for(r=0,o=i.length;r<o;++r)n=i[r],this.layerShownOrHidden.raiseEvent(n,n._layerIndex,n.show)},Object.defineProperties(QuadtreeOccluders.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),QuadtreeTile.createLevelZeroTiles=function(e){const t=e.getNumberOfXTilesAtLevel(0),i=e.getNumberOfYTilesAtLevel(0),n=new Array(t*i);let r=0;for(let o=0;o<i;++o)for(let i=0;i<t;++i)n[r++]=new QuadtreeTile({tilingScheme:e,x:i,y:o,level:0});return n},QuadtreeTile.prototype._updateCustomData=function(e,t,i){let n,r,o,a=this.customData;if(defined(t)&&defined(i)){for(a=a.filter((function(e){return-1===i.indexOf(e)})),this._customData=a,o=this._rectangle,n=0;n<t.length;++n)r=t[n],Rectangle.contains(o,r.positionCartographic)&&a.push(r);this._frameUpdated=e}else{const e=this._parent;if(defined(e)&&this._frameUpdated!==e._frameUpdated){a.length=0,o=this._rectangle;const t=e.customData;for(n=0;n<t.length;++n)r=t[n],Rectangle.contains(o,r.positionCartographic)&&a.push(r);this._frameUpdated=e._frameUpdated}}},Object.defineProperties(QuadtreeTile.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){return[this.northwestChild,this.northeastChild,this.southwestChild,this.southeastChild]}},southwestChild:{get:function(){return defined(this._southwestChild)||(this._southwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return defined(this._southeastChild)||(this._southeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return defined(this._northwestChild)||(this._northwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return defined(this._northeastChild)||(this._northeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<QuadtreeTileLoadState$1.DONE}},eligibleForUnloading:{get:function(){let e=!0;return defined(this.data)&&(e=this.data.eligibleForUnloading,defined(e)||(e=!0)),e}}}),QuadtreeTile.prototype.findLevelZeroTile=function(e,t,i){const n=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=n:t>=n&&(t-=n),!(i<0||i>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter((function(e){return e.x===t&&e.y===i}))[0]},QuadtreeTile.prototype.findTileToWest=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x-1,this.y);if(t.southeastChild===this)return t.southwestChild;if(t.northeastChild===this)return t.northwestChild;const i=t.findTileToWest(e);return void 0!==i?t.southwestChild===this?i.southeastChild:i.northeastChild:void 0},QuadtreeTile.prototype.findTileToEast=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x+1,this.y);if(t.southwestChild===this)return t.southeastChild;if(t.northwestChild===this)return t.northeastChild;const i=t.findTileToEast(e);return void 0!==i?t.southeastChild===this?i.southwestChild:i.northwestChild:void 0},QuadtreeTile.prototype.findTileToSouth=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y+1);if(t.northwestChild===this)return t.southwestChild;if(t.northeastChild===this)return t.southeastChild;const i=t.findTileToSouth(e);return void 0!==i?t.southwestChild===this?i.northwestChild:i.northeastChild:void 0},QuadtreeTile.prototype.findTileToNorth=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y-1);if(t.southwestChild===this)return t.northwestChild;if(t.southeastChild===this)return t.northeastChild;const i=t.findTileToNorth(e);return void 0!==i?t.northwestChild===this?i.southwestChild:i.southeastChild:void 0},QuadtreeTile.prototype.freeResources=function(){this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,defined(this.data)&&defined(this.data.freeResources)&&this.data.freeResources(),defined(this.data)&&defined(this.data.geometryPrimitive)&&(this.data.geometryPrimitive.destroy(),this.data.geometryPrimitive=void 0),freeTile(this._southwestChild),this._southwestChild=void 0,freeTile(this._southeastChild),this._southeastChild=void 0,freeTile(this._northwestChild),this._northwestChild=void 0,freeTile(this._northeastChild),this._northeastChild=void 0},TileReplacementQueue.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},TileReplacementQueue.prototype.trimTiles=function(e){let t=this.tail,i=!0;for(;i&&defined(this._lastBeforeStartOfFrame)&&this.count>e&&defined(t);){i=t!==this._lastBeforeStartOfFrame;const e=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),remove(this,t)),t=e}},TileReplacementQueue.prototype.markTileRendered=function(e){const t=this.head;if(t!==e){if(++this.count,!defined(t))return e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,void(this.tail=e);(defined(e.replacementPrevious)||defined(e.replacementNext))&&remove(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e}else e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext)},Object.defineProperties(QuadtreePrimitive.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}}),QuadtreePrimitive.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0},QuadtreePrimitive.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;defined(t);)t.state!==QuadtreeTileLoadState$1.START&&e(t),t=t.replacementNext},QuadtreePrimitive.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let i=0,n=t.length;i<n;++i)e(t[i])},QuadtreePrimitive.prototype.updateHeight=function(e,t){const i=this,n={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t,removeFunc:function(){const e=i._addHeightCallbacks,t=e.length;for(let i=0;i<t;++i)if(e[i]===n){e.splice(i,1);break}i._removeHeightCallbacks.push(n)}};return i._addHeightCallbacks.push(n),n.removeFunc},QuadtreePrimitive.prototype.update=function(e){defined(this._tileProvider.update)&&this._tileProvider.update(e)},QuadtreePrimitive.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(invalidateAllTiles$1(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),clearTileLoadQueue$1(this),this._debug.suspendLodUpdate||this._tileReplacementQueue.markStartOfRenderFrame())},QuadtreePrimitive.prototype.render=function(e){const t=e.passes,i=this._tileProvider;t.render&&(i.beginUpdate(e),selectTilesForRendering$1(this,e),createRenderCommandsForSelectedTiles$1(this,e),i.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&i.updateForPick(e)},QuadtreePrimitive.prototype.endFrame=function(e){e.passes.render&&e.mode!==SceneMode$1.MORPHING&&(processTileLoadQueue$1(this,e),updateHeights$1(this,e),updateTileLoadProgress$1(this,e))},QuadtreePrimitive.prototype.isDestroyed=function(){return!1},QuadtreePrimitive.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};const centerScratch$1=new Cartographic;function compareDistanceToPoint$1(e,t){let i=Rectangle.center(e.rectangle,centerScratch$1);const n=i.longitude-comparisonPoint$1.longitude,r=i.latitude-comparisonPoint$1.latitude;i=Rectangle.center(t.rectangle,centerScratch$1);const o=i.longitude-comparisonPoint$1.longitude,a=i.latitude-comparisonPoint$1.latitude;return n*n+r*r-(o*o+a*a)}const cameraOriginScratch$1=new Cartesian3;let rootTraversalDetails$1=[];function selectTilesForRendering$1(e,t){const i=e._debug;if(i.suspendLodUpdate)return;let n;e._tilesToRender.length=0;const r=e._tileProvider;if(!defined(e._levelZeroTiles)){if(!r.ready)return;{const t=r.tilingScheme;e._levelZeroTiles=QuadtreeTile.createLevelZeroTiles(t);const i=e._levelZeroTiles.length;if(rootTraversalDetails$1.length<i)for(rootTraversalDetails$1=new Array(i),n=0;n<i;++n)void 0===rootTraversalDetails$1[n]&&(rootTraversalDetails$1[n]=new TraversalDetails$1)}}let o;e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;const a=e._levelZeroTiles,s=a.length>1?e._occluders:void 0;comparisonPoint$1=t.camera.positionCartographic,a.sort(compareDistanceToPoint$1);const c=e._addHeightCallbacks,l=e._removeHeightCallbacks,u=t.frameNumber;let d;if(c.length>0||l.length>0){for(n=0,d=a.length;n<d;++n)o=a[n],o._updateCustomData(u,c,l);c.length=0,l.length=0}const h=t.camera;e._cameraPositionCartographic=h.positionCartographic;const p=Matrix4.getTranslation(h.transform,cameraOriginScratch$1);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(p,e._cameraReferenceFrameOriginCartographic),n=0,d=a.length;n<d;++n)o=a[n],e._tileReplacementQueue.markTileRendered(o),o.renderable?visitIfVisible$1(e,o,r,t,s,!1,rootTraversalDetails$1[n]):(queueTileLoad$1(e,e._tileLoadQueueHigh,o,t),++i.tilesWaitingForChildren);e._lastSelectionFrameNumber=u}function queueTileLoad$1(e,t,i,n){i.needsLoading&&(void 0!==e.tileProvider.computeTileLoadPriority&&(i._loadPriority=e.tileProvider.computeTileLoadPriority(i,n)),t.push(i))}function TraversalDetails$1(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function TraversalQuadDetails$1(){this.southwest=new TraversalDetails$1,this.southeast=new TraversalDetails$1,this.northwest=new TraversalDetails$1,this.northeast=new TraversalDetails$1}TraversalQuadDetails$1.prototype.combine=function(e){const t=this.southwest,i=this.southeast,n=this.northwest,r=this.northeast;e.allAreRenderable=t.allAreRenderable&&i.allAreRenderable&&n.allAreRenderable&&r.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||r.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+i.notYetRenderableCount+n.notYetRenderableCount+r.notYetRenderableCount};const traversalQuadsByLevel$1=new Array(31);for(let e=0;e<traversalQuadsByLevel$1.length;++e)traversalQuadsByLevel$1[e]=new TraversalQuadDetails$1;function visitTile$1(e,t,i,n,r){const o=e._debug;++o.tilesVisited,e._tileReplacementQueue.markTileRendered(i),i._updateCustomData(t.frameNumber),i.level>o.maxDepthVisited&&(o.maxDepthVisited=i.level);const a=screenSpaceError$1(e,t,i)<e.maximumScreenSpaceError,s=i.southwestChild,c=i.southeastChild,l=i.northwestChild,u=i.northeastChild,d=e._lastSelectionFrameNumber,h=i._lastSelectionResultFrame===d?i._lastSelectionResult:TileSelectionResult.NONE,p=e.tileProvider;if(a||n){const o=TileSelectionResult.originalResult(h)===TileSelectionResult.RENDERED,s=TileSelectionResult.originalResult(h)===TileSelectionResult.CULLED||h===TileSelectionResult.NONE,c=i.state===QuadtreeTileLoadState$1.DONE;let l=o||s||c;if(l||defined(p.canRenderWithoutLosingDetail)&&(l=p.canRenderWithoutLosingDetail(i)),l)return a&&queueTileLoad$1(e,e._tileLoadQueueMedium,i,t),addTileToRenderList$1(e,i),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(r.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));n=!0,a&&queueTileLoad$1(e,e._tileLoadQueueHigh,i,t)}if(p.canRefine(i)){if(s.upsampledFromParent&&c.upsampledFromParent&&l.upsampledFromParent&&u.upsampledFromParent)return addTileToRenderList$1(e,i),queueTileLoad$1(e,e._tileLoadQueueMedium,i,t),e._tileReplacementQueue.markTileRendered(s),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(u),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(r.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.REFINED;const a=e._tilesToRender.length,d=e._tileLoadQueueLow.length,p=e._tileLoadQueueMedium.length,f=e._tileLoadQueueHigh.length,m=e._tileToUpdateHeights.length;if(visitVisibleChildrenNearToFar$1(e,s,c,l,u,t,n,r),a!==e._tilesToRender.length){const n=r.allAreRenderable,s=r.anyWereRenderedLastFrame,c=r.notYetRenderableCount;let l=!1;if(!n&&!s){const n=e._tilesToRender;for(let e=a;e<n.length;++e){let t=n[e];for(;void 0!==t&&t._lastSelectionResult!==TileSelectionResult.KICKED&&t!==i;)t._lastSelectionResult=TileSelectionResult.kick(t._lastSelectionResult),t=t.parent}e._tilesToRender.length=a,e._tileToUpdateHeights.length=m,addTileToRenderList$1(e,i),i._lastSelectionResult=TileSelectionResult.RENDERED;const s=h===TileSelectionResult.RENDERED;!s&&c>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=d,e._tileLoadQueueMedium.length=p,e._tileLoadQueueHigh.length=f,queueTileLoad$1(e,e._tileLoadQueueMedium,i,t),r.notYetRenderableCount=i.renderable?0:1,l=!0),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=s,s||e._tileToUpdateHeights.push(i),++o.tilesWaitingForChildren}e.preloadAncestors&&!l&&queueTileLoad$1(e,e._tileLoadQueueLow,i,t)}}else i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,addTileToRenderList$1(e,i),queueTileLoad$1(e,e._tileLoadQueueHigh,i,t),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=i.renderable?0:1}function visitVisibleChildrenNearToFar$1(e,t,i,n,r,o,a,s){const c=o.camera.positionCartographic,l=e._tileProvider,u=e._occluders,d=traversalQuadsByLevel$1[t.level],h=d.southwest,p=d.southeast,f=d.northwest,m=d.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(visitIfVisible$1(e,t,l,o,u,a,h),visitIfVisible$1(e,i,l,o,u,a,p),visitIfVisible$1(e,n,l,o,u,a,f),visitIfVisible$1(e,r,l,o,u,a,m)):(visitIfVisible$1(e,n,l,o,u,a,f),visitIfVisible$1(e,t,l,o,u,a,h),visitIfVisible$1(e,r,l,o,u,a,m),visitIfVisible$1(e,i,l,o,u,a,p)):c.latitude<t.rectangle.north?(visitIfVisible$1(e,i,l,o,u,a,p),visitIfVisible$1(e,t,l,o,u,a,h),visitIfVisible$1(e,r,l,o,u,a,m),visitIfVisible$1(e,n,l,o,u,a,f)):(visitIfVisible$1(e,r,l,o,u,a,m),visitIfVisible$1(e,n,l,o,u,a,f),visitIfVisible$1(e,i,l,o,u,a,p),visitIfVisible$1(e,t,l,o,u,a,h)),d.combine(s)}function containsNeededPosition$1(e,t){const i=t.rectangle;return defined(e._cameraPositionCartographic)&&Rectangle.contains(i,e._cameraPositionCartographic)||defined(e._cameraReferenceFrameOriginCartographic)&&Rectangle.contains(i,e._cameraReferenceFrameOriginCartographic)}function visitIfVisible$1(e,t,i,n,r,o,a){if(i.computeTileVisibility(t,n,r)!==Visibility$1.NONE)return visitTile$1(e,n,t,o,a);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),a.allAreRenderable=!0,a.anyWereRenderedLastFrame=!1,a.notYetRenderableCount=0,containsNeededPosition$1(e,t)){defined(t.data)&&defined(t.data.vertexArray)||queueTileLoad$1(e,e._tileLoadQueueMedium,t,n);const i=e._lastSelectionFrameNumber,r=t._lastSelectionResultFrame===i?t._lastSelectionResult:TileSelectionResult.NONE;r!==TileSelectionResult.CULLED_BUT_NEEDED&&r!==TileSelectionResult.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=TileSelectionResult.CULLED_BUT_NEEDED}else e.preloadSiblings||0===t.level?(queueTileLoad$1(e,e._tileLoadQueueLow,t,n),t._lastSelectionResult=TileSelectionResult.CULLED):t._lastSelectionResult=TileSelectionResult.CULLED;t._lastSelectionResultFrame=n.frameNumber}function screenSpaceError$1(e,t,i){if(t.mode===SceneMode$1.SCENE2D||t.camera.frustum instanceof OrthographicFrustum||t.camera.frustum instanceof OrthographicOffCenterFrustum)return screenSpaceError2D$1(e,t,i);const n=e._tileProvider.getLevelMaximumGeometricError(i.level),r=i._distance;let o=n*t.context.drawingBufferHeight/(r*t.camera.frustum.sseDenominator);return t.fog.enabled&&(o-=CesiumMath.fog(r,t.fog.density)*t.fog.sse),o/=t.pixelRatio,o}function screenSpaceError2D$1(e,t,i){let n=t.camera.frustum;defined(n._offCenterFrustum)&&(n=n._offCenterFrustum);const r=t.context,o=r.drawingBufferWidth,a=r.drawingBufferHeight;let s=e._tileProvider.getLevelMaximumGeometricError(i.level)/(Math.max(n.top-n.bottom,n.right-n.left)/Math.max(o,a));return t.fog.enabled&&t.mode!==SceneMode$1.SCENE2D&&(s-=CesiumMath.fog(i._distance,t.fog.density)*t.fog.sse),s/=t.pixelRatio,s}function addTileToRenderList$1(e,t){e._tilesToRender.push(t)}function processTileLoadQueue$1(e,t){const i=e._tileLoadQueueHigh,n=e._tileLoadQueueMedium,r=e._tileLoadQueueLow;if(0===i.length&&0===n.length&&0===r.length)return;e._tileReplacementQueue.trimTiles(e.tileCacheSize);const o=getTimestamp$1()+e._loadQueueTimeSlice,a=e._tileProvider;let s=processSinglePriorityLoadQueue$1(e,t,a,o,i,!1);s=processSinglePriorityLoadQueue$1(e,t,a,o,n,s),processSinglePriorityLoadQueue$1(e,t,a,o,r,s)}function sortByLoadPriority$1(e,t){return e._loadPriority-t._loadPriority}function processSinglePriorityLoadQueue$1(e,t,i,n,r,o){void 0!==i.computeTileLoadPriority&&r.sort(sortByLoadPriority$1);for(let a=0,s=r.length;a<s&&(getTimestamp$1()<n||!o);++a){const n=r[a];e._tileReplacementQueue.markTileRendered(n),i.loadTile(t,n),o=!0}return o}const scratchRay$1=new Ray,scratchCartographic$3=new Cartographic,scratchPosition$2=new Cartesian3,scratchArray$2=[];function updateHeights$1(e,t){if(!e.tileProvider.ready)return;const i=scratchArray$2;i.length=0;const n=e._tileToUpdateHeights,r=getTimestamp$1()+e._updateHeightsTimeSlice,o=t.mode,a=t.mapProjection,s=e.tileProvider.tilingScheme.ellipsoid;let c;for(;n.length>0;){const t=n[0];if(!defined(t.data)||!defined(t.data.mesh)){const r=t._lastSelectionResultFrame===e._lastSelectionFrameNumber?t._lastSelectionResult:TileSelectionResult.NONE;r!==TileSelectionResult.RENDERED&&r!==TileSelectionResult.CULLED_BUT_NEEDED||i.push(t),n.shift(),e._lastTileIndex=0;continue}const l=t.customData,u=l.length;let d=!1;for(c=e._lastTileIndex;c<u;++c){const e=l[c],i=t.data.terrainData,n=defined(i)&&i.wasCreatedByUpsampling();if(t.level>e.level&&!n){if(defined(e.positionOnEllipsoidSurface)||(e.positionOnEllipsoidSurface=Cartesian3.fromRadians(e.positionCartographic.longitude,e.positionCartographic.latitude,0,s)),o===SceneMode$1.SCENE3D){const i=s.geodeticSurfaceNormal(e.positionOnEllipsoidSurface,scratchRay$1.direction);if(!defined(s.getSurfaceNormalIntersectionWithZAxis(e.positionOnEllipsoidSurface,11500,scratchRay$1.origin))){let n=0;defined(t.data.tileBoundingRegion)&&(n=t.data.tileBoundingRegion.minimumHeight);const r=Math.min(n,-11500),o=Cartesian3.multiplyByScalar(i,Math.abs(r)+1,scratchPosition$2);Cartesian3.subtract(e.positionOnEllipsoidSurface,o,scratchRay$1.origin)}}else Cartographic.clone(e.positionCartographic,scratchCartographic$3),scratchCartographic$3.height=-11500,a.project(scratchCartographic$3,scratchPosition$2),Cartesian3.fromElements(scratchPosition$2.z,scratchPosition$2.x,scratchPosition$2.y,scratchPosition$2),Cartesian3.clone(scratchPosition$2,scratchRay$1.origin),Cartesian3.clone(Cartesian3.UNIT_X,scratchRay$1.direction);const i=t.data.pick(scratchRay$1,o,a,!1,scratchPosition$2);defined(i)&&(e.callback(i),e.level=t.level)}if(getTimestamp$1()>=r){d=!0;break}}if(d){e._lastTileIndex=c;break}e._lastTileIndex=0,n.shift()}for(c=0;c<i.length;c++)n.push(i[c])}function createRenderCommandsForSelectedTiles$1(e,t){const i=e._tileProvider,n=e._tilesToRender;for(let e=0,r=n.length;e<r;++e){const r=n[e];i.showTileThisFrame(r,t)}}function Globe(e){const t=new EllipsoidTerrainProvider({ellipsoid:e=defaultValue(e,Ellipsoid.WGS84)}),i=new ImageryLayerCollection;this._ellipsoid=e,this._imageryLayerCollection=i,this._surfaceShaderSet=new GlobeSurfaceShaderSet,this._material=void 0,this._surface=new QuadtreePrimitive({tileProvider:new GlobeSurfaceTileProvider({terrainProvider:t,imageryLayers:i,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Event,this._undergroundColor=Color.clone(Color.BLACK),this._undergroundColorAlphaByDistance=new NearFarScalar(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new GlobeTranslucency,makeShadersDirty(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Resource({url:buildModuleUrl("Assets/Textures/waterNormalsSmall.jpg")}),this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this.fillHighlightColor=void 0,this.enableLighting=!1,this.lambertDiffuseMultiplier=.9,this.dynamicAtmosphereLighting=!0,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!0,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0}function makeShadersDirty(e){const t=[],i=defined(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),n=[GroundAtmosphere];!defined(e._material)||i&&!e._terrainProvider.requestVertexNormals?e._surface._tileProvider.materialUniformMap=void 0:(n.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms),n.push(GlobeFS),e._surfaceShaderSet.baseVertexShaderSource=new ShaderSource({sources:[GroundAtmosphere,GlobeVS],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new ShaderSource({sources:n,defines:t}),e._surfaceShaderSet.material=e._material}function createComparePickTileFunction(e){return function(t,i){return BoundingSphere.distanceSquaredTo(t.pickBoundingSphere,e)-BoundingSphere.distanceSquaredTo(i.pickBoundingSphere,e)}}Object.defineProperties(Globe.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},imageryLayersUpdatedEvent:{get:function(){return this._surface.tileProvider.imageryLayersUpdatedEvent}},tilesLoaded:{get:function(){return!defined(this._surface)||this._surface.tileProvider.ready&&0===this._surface._tileLoadQueueHigh.length&&0===this._surface._tileLoadQueueMedium.length&&0===this._surface._tileLoadQueueLow.length}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},clippingPlanes:{get:function(){return this._surface.tileProvider.clippingPlanes},set:function(e){this._surface.tileProvider.clippingPlanes=e}},multiClippingPlanes:{get:function(){return this._surface.tileProvider._multiClippingPlanes},set:function(e){this._surface.tileProvider._multiClippingPlanes=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){defined(e)||(e=Rectangle.clone(Rectangle.MAX_VALUE)),this._surface.tileProvider.cartographicLimitRectangle=e}},oceanNormalMapUrl:{get:function(){return this._oceanNormalMapResource.url},set:function(e){this._oceanNormalMapResource.url=e,this._oceanNormalMapResourceDirty=!0}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){e!==this._terrainProvider&&(this._terrainProvider=e,this._terrainProviderChanged.raiseEvent(e),defined(this._material)&&makeShadersDirty(this))}},terrainProviderChanged:{get:function(){return this._terrainProviderChanged}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,makeShadersDirty(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=Color.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){this._undergroundColorAlphaByDistance=NearFarScalar.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});const scratchArray$1=[],scratchSphereIntersectionResult={start:0,stop:0};Globe.prototype.pickWorldCoordinates=function(e,t,i,n){i=defaultValue(i,!0);const r=t.mode,o=t.mapProjection,a=scratchArray$1;a.length=0;const s=this._surface._tilesToRender;let c,l,u,d=s.length;for(l=0;l<d;++l){c=s[l];const t=c.data;if(!defined(t))continue;let i=t.pickBoundingSphere;if(r!==SceneMode$1.SCENE3D)t.pickBoundingSphere=i=BoundingSphere.fromRectangleWithHeights2D(c.rectangle,o,t.tileBoundingRegion.minimumHeight,t.tileBoundingRegion.maximumHeight,i),Cartesian3.fromElements(i.center.z,i.center.x,i.center.y,i.center);else{if(!defined(t.renderedMesh))continue;BoundingSphere.clone(t.tileBoundingRegion.boundingSphere,i)}defined(IntersectionTests.raySphere(e,i,scratchSphereIntersectionResult))&&a.push(t)}for(a.sort(createComparePickTileFunction(e.origin)),d=a.length,l=0;l<d&&(u=a[l].pick(e,t.mode,t.mapProjection,i,n),!defined(u));++l);return u};const cartoScratch=new Cartographic;Globe.prototype.pick=function(e,t,i){if(defined(i=this.pickWorldCoordinates(e,t,!0,i))&&t.mode!==SceneMode$1.SCENE3D){i=Cartesian3.fromElements(i.y,i.z,i.x,i);const e=t.mapProjection.unproject(i,cartoScratch);i=t.globe.ellipsoid.cartographicToCartesian(e,i)}return i};const scratchGetHeightCartesian=new Cartesian3,scratchGetHeightIntersection=new Cartesian3,scratchGetHeightCartographic=new Cartographic,scratchGetHeightRay=new Ray;function tileIfContainsCartographic(e,t){return defined(e)&&Rectangle.contains(e.rectangle,t)?e:void 0}Globe.prototype.getHeight=function(e){const t=this._surface._levelZeroTiles;if(!defined(t))return;let i,n;const r=t.length;for(n=0;n<r&&(i=t[n],!Rectangle.contains(i.rectangle,e));++n);if(n>=r)return;let o=i;for(;defined(i);)i=tileIfContainsCartographic(i._southwestChild,e)||tileIfContainsCartographic(i._southeastChild,e)||tileIfContainsCartographic(i._northwestChild,e)||i._northeastChild,defined(i)&&defined(i.data)&&defined(i.data.renderedMesh)&&(o=i);if(i=o,!defined(i)||!defined(i.data)||!defined(i.data.renderedMesh))return;const a=this._surface._tileProvider.tilingScheme.projection,s=this._surface._tileProvider.tilingScheme.ellipsoid,c=Cartesian3.fromRadians(e.longitude,e.latitude,0,s,scratchGetHeightCartesian),l=scratchGetHeightRay,u=s.geodeticSurfaceNormal(c,l.direction);if(!defined(s.getSurfaceNormalIntersectionWithZAxis(c,11500,l.origin))){let e;defined(i.data.tileBoundingRegion)&&(e=i.data.tileBoundingRegion.minimumHeight);const t=Math.min(defaultValue(e,0),-11500),n=Cartesian3.multiplyByScalar(u,Math.abs(t)+1,scratchGetHeightIntersection);Cartesian3.subtract(c,n,l.origin)}const d=i.data.pick(l,void 0,a,!1,scratchGetHeightIntersection);return defined(d)?s.cartesianToCartographic(d,scratchGetHeightCartographic).height:void 0},Globe.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)},Globe.prototype.beginFrame=function(e){const t=this._surface,i=t.tileProvider,n=this.terrainProvider,r=this.showWaterEffect&&n.ready&&n.hasWaterMask;if(r&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;const t=this._oceanNormalMapResource,i=t.url;if(defined(i)){const n=this;t.fetchImage().then((function(t){i===n._oceanNormalMapResource.url&&(n._oceanNormalMap=n._oceanNormalMap&&n._oceanNormalMap.destroy(),n._oceanNormalMap=new Texture({context:e.context,source:t}))}))}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}const o=e.passes,a=e.mode;o.render&&(this.showGroundAtmosphere?this._zoomedOutOceanSpecularIntensity=.4:this._zoomedOutOceanSpecularIntensity=.5,t.maximumScreenSpaceError=this.maximumScreenSpaceError,t.tileCacheSize=this.tileCacheSize,t.loadingDescendantLimit=this.loadingDescendantLimit,t.preloadAncestors=this.preloadAncestors,t.preloadSiblings=this.preloadSiblings,i.terrainProvider=this.terrainProvider,i.lightingFadeOutDistance=this.lightingFadeOutDistance,i.lightingFadeInDistance=this.lightingFadeInDistance,i.nightFadeOutDistance=this.nightFadeOutDistance,i.nightFadeInDistance=this.nightFadeInDistance,i.zoomedOutOceanSpecularIntensity=a===SceneMode$1.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,i.hasWaterMask=r,i.oceanNormalMap=this._oceanNormalMap,i.enableLighting=this.enableLighting,i.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,i.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,i.showGroundAtmosphere=this.showGroundAtmosphere,i.shadows=this.shadows,i.hueShift=this.atmosphereHueShift,i.saturationShift=this.atmosphereSaturationShift,i.brightnessShift=this.atmosphereBrightnessShift,i.fillHighlightColor=this.fillHighlightColor,i.showSkirts=this.showSkirts,i.backFaceCulling=this.backFaceCulling,i.undergroundColor=this._undergroundColor,i.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,i.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))},Globe.prototype.render=function(e){this.show&&(defined(this._material)&&this._material.update(e.context),this._surface.render(e))},Globe.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)},Globe.prototype.isDestroyed=function(){return!1},Globe.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),destroyObject(this)};var PassThrough="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(colorTexture, v_textureCoordinates);\n}\n",PassThroughDepth="uniform highp sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);\n}\n";function GlobeDepth(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new FramebufferManager,this._tempCopyDepthFramebuffer=new FramebufferManager,this._updateDepthFramebuffer=new FramebufferManager({createColorAttachments:!1,createDepthAttachments:!1,depthStencil:!0}),this._clearGlobeColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._viewport=new BoundingRectangle,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}function destroyFramebuffers$2(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function updateCopyCommands$1(e,t,i,n,r){e._viewport.width=i,e._viewport.height=n;const o=!BoundingRectangle.equals(e._viewport,r.viewport);let a=o!==e._useScissorTest;e._useScissorTest=o,BoundingRectangle.equals(e._scissorRectangle,r.viewport)||(e._scissorRectangle=BoundingRectangle.clone(r.viewport,e._scissorRectangle),a=!0),defined(e._rs)&&BoundingRectangle.equals(e._viewport,e._rs.viewport)&&!a||(e._rs=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:BlendingState$1.ALPHA_BLEND}),e._rsUpdate=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})),defined(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,defined(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,defined(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,defined(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,defined(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new ClearCommand({color:new Color(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}function GlobeTranslucencyFramebuffer(){this._framebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new FramebufferManager,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new BoundingRectangle,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}function destroyResources$3(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function updateResources$1(e,t,i,n,r){const o=r?t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;e._framebuffer.update(t,i,n,1,o),e._packedDepthFramebuffer.update(t,i,n)}function updateCommands(e,t,i,n,r){e._viewport.width=i,e._viewport.height=n;const o=!BoundingRectangle.equals(e._viewport,r.viewport);let a=o!==e._useScissorTest;e._useScissorTest=o,BoundingRectangle.equals(e._scissorRectangle,r.viewport)||(e._scissorRectangle=BoundingRectangle.clone(r.viewport,e._scissorRectangle),a=!0),defined(e._renderState)&&BoundingRectangle.equals(e._viewport,e._renderState.viewport)&&!a||(e._renderState=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),defined(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),defined(e._clearCommand)||(e._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0,owner:e})),e._packedDepthCommand.framebuffer=e._packedDepthFramebuffer.framebuffer,e._packedDepthCommand.renderState=e._renderState,e._clearCommand.framebuffer=e.classificationFramebuffer,e._clearCommand.renderState=e._renderState}Object.defineProperties(GlobeDepth.prototype,{colorFramebufferManager:{get:function(){return this._picking?this._pickColorFramebuffer:this._outputFramebuffer}},framebuffer:{get:function(){return this.colorFramebufferManager.framebuffer}},depthStencilTexture:{get:function(){return this.colorFramebufferManager.getDepthStencilTexture()}},picking:{get:function(){return this._picking},set:function(e){this._picking=e}}}),GlobeDepth.prototype.update=function(e,t,i,n,r,o){const a=i.width,s=i.height,c=r?e.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._numSamples=n,this.picking?this._pickColorFramebuffer.update(e,a,s):this._outputFramebuffer.update(e,a,s,n,c),this._copyDepthFramebuffer.update(e,a,s),updateCopyCommands$1(this,e,a,s,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=r,this._clearGlobeDepth=o},GlobeDepth.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)},GlobeDepth.prototype.executeCopyDepth=function(e,t){defined(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())},GlobeDepth.prototype.executeUpdateDepth=function(e,t,i,n){const r=defined(n)?n:t.framebuffer.depthStencilTexture;if(i||r!==this.colorFramebufferManager.getDepthStencilTexture()){if(defined(this._updateDepthCommand)){if(!defined(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==r||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){const i=this._copyDepthFramebuffer.getColorTexture().width,n=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,i,n);const o=this._copyDepthFramebuffer.getColorTexture();this._updateDepthFramebuffer.setColorTexture(o,0),this._updateDepthFramebuffer.setDepthStencilTexture(r),this._updateDepthFramebuffer.update(e,i,n),updateCopyCommands$1(this,e,i,n,t)}this._tempCopyDepthTexture=r,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}}else defined(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)},GlobeDepth.prototype.executeCopyColor=function(e,t){defined(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},GlobeDepth.prototype.clear=function(e,t,i){const n=this._clearGlobeColorCommand;defined(n)&&(Color.clone(i,n.color),this.colorFramebufferManager.clear(e,n,t))},GlobeDepth.prototype.isDestroyed=function(){return!1},GlobeDepth.prototype.destroy=function(){return destroyFramebuffers$2(this),defined(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),defined(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),defined(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),defined(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(GlobeTranslucencyFramebuffer.prototype,{classificationTexture:{get:function(){return this._framebuffer.getColorTexture()}},classificationFramebuffer:{get:function(){return this._framebuffer.framebuffer}},packedDepthFramebuffer:{get:function(){return this._packedDepthFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._framebuffer.getDepthStencilTexture()}},depthStencilRenderbuffer:{get:function(){return this._framebuffer.getDepthStencilRenderbuffer()}},packedDepthTexture:{get:function(){return this._packedDepthFramebuffer.getColorTexture()}}}),GlobeTranslucencyFramebuffer.prototype.updateAndClear=function(e,t,i,n){const r=t.width,o=t.height;updateResources$1(this,i,r,o,e),updateCommands(this,i,r,o,n),this._useHdr=e},GlobeTranslucencyFramebuffer.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)},GlobeTranslucencyFramebuffer.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture},GlobeTranslucencyFramebuffer.prototype.isDestroyed=function(){return!1},GlobeTranslucencyFramebuffer.prototype.destroy=function(){return destroyResources$3(this),destroyObject(this)};const DerivedCommandType={OPAQUE_FRONT_FACE:0,OPAQUE_BACK_FACE:1,DEPTH_ONLY_FRONT_FACE:2,DEPTH_ONLY_BACK_FACE:3,DEPTH_ONLY_FRONT_AND_BACK_FACE:4,TRANSLUCENT_FRONT_FACE:5,TRANSLUCENT_BACK_FACE:6,TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:7,TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:8,PICK_FRONT_FACE:9,PICK_BACK_FACE:10,DERIVED_COMMANDS_MAXIMUM_LENGTH:11},derivedCommandsMaximumLength=DerivedCommandType.DERIVED_COMMANDS_MAXIMUM_LENGTH,DerivedCommandNames=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function GlobeTranslucencyState(){this._frontFaceAlphaByDistance=new NearFarScalar(0,1,0,1),this._backFaceAlphaByDistance=new NearFarScalar(0,1,0,1),this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._requiresManualDepthTest=!1,this._sunVisibleThroughGlobe=!1,this._environmentVisible=!1,this._useDepthPlane=!1,this._numberOfTextureUniforms=0,this._globeTranslucencyFramebuffer=void 0,this._rectangle=Rectangle.clone(Rectangle.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedBlendCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedPickCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedCommandTypesToUpdate=new Array(derivedCommandsMaximumLength),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}function updateAlphaByDistance(e,t,i,n){return e?defined(i)?(NearFarScalar.clone(i,n),n.nearValue*=t,n.farValue*=t,n):(n.nearValue=t,n.farValue=t,n):(n.nearValue=1,n.farValue=1,n)}function isFaceTranslucent(e,t,i){return e&&(i.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function isSunVisibleThroughGlobe(e,t){const i=e._frontFaceTranslucent,n=e._backFaceTranslucent;return i&&(t.cameraUnderground||n)}function isEnvironmentVisible(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function useDepthPlane(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function requiresManualDepthTest(e,t,i){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!i.depthTestAgainstTerrain&&t.mode!==SceneMode$1.SCENE2D&&t.context.depthTexture}function getNumberOfTextureUniforms(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function gatherDerivedCommandRequirements(e,t){let i;e._derivedCommandsLength=getDerivedCommandTypes(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=getDerivedCommandTypes(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=getDerivedCommandTypes(e,t,!1,!0,e._derivedPickCommandTypes);let n=0;for(i=0;i<e._derivedCommandsLength;++i)n|=1<<e._derivedCommandTypes[i];for(i=0;i<e._derivedBlendCommandsLength;++i)n|=1<<e._derivedBlendCommandTypes[i];for(i=0;i<e._derivedPickCommandsLength;++i)n|=1<<e._derivedPickCommandTypes[i];let r=0;for(i=0;i<derivedCommandsMaximumLength;++i)(n&1<<i)>0&&(e._derivedCommandTypesToUpdate[r++]=i);e._derivedCommandsToUpdateLength=r;const o=n!==e._derivedCommandKey;e._derivedCommandKey=n,e._derivedCommandsDirty=o,!defined(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=createDerivedCommandPacks())}function getDerivedCommandTypes(e,t,i,n,r){let o=0;const a=e._frontFaceTranslucent,s=e._backFaceTranslucent;if(!a)return o;const c=t.cameraUnderground,l=e._requiresManualDepthTest,u=n?DerivedCommandType.PICK_FRONT_FACE:l?DerivedCommandType.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:DerivedCommandType.TRANSLUCENT_FRONT_FACE,d=n?DerivedCommandType.PICK_BACK_FACE:l?DerivedCommandType.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:DerivedCommandType.TRANSLUCENT_BACK_FACE;return t.mode===SceneMode$1.SCENE2D?(r[o++]=DerivedCommandType.DEPTH_ONLY_FRONT_FACE,r[o++]=u,o):(s?(i||(r[o++]=DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE),c?(r[o++]=u,r[o++]=d):(r[o++]=d,r[o++]=u)):c?(i||(r[o++]=DerivedCommandType.DEPTH_ONLY_BACK_FACE),r[o++]=DerivedCommandType.OPAQUE_FRONT_FACE,r[o++]=d):(i||(r[o++]=DerivedCommandType.DEPTH_ONLY_FRONT_FACE),r[o++]=DerivedCommandType.OPAQUE_BACK_FACE,r[o++]=u),o)}function removeDefine(e,t){const i=e.indexOf(t);i>-1&&e.splice(i,1)}function hasDefine(e,t){return e.indexOf(t)>-1}function getOpaqueFrontFaceShaderProgram(e,t){removeDefine(e.defines,"TRANSLUCENT"),removeDefine(t.defines,"TRANSLUCENT")}function getOpaqueBackFaceShaderProgram(e,t){removeDefine(e.defines,"GROUND_ATMOSPHERE"),removeDefine(t.defines,"GROUND_ATMOSPHERE"),removeDefine(e.defines,"FOG"),removeDefine(t.defines,"FOG"),removeDefine(e.defines,"TRANSLUCENT"),removeDefine(t.defines,"TRANSLUCENT")}function getDepthOnlyShaderProgram(e,t){if(hasDefine(t.defines,"TILE_LIMIT_RECTANGLE")||hasDefine(t.defines,"ENABLE_CLIPPING_PLANES"))return;t.sources=["void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n"]}function getTranslucentShaderProgram$1(e,t){const i=t.sources,n=i.length;for(let e=0;e<n;++e)i[e]=ShaderSource.replaceMain(i[e],"czm_globe_translucency_main");i.push("\n\nuniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n#ifdef MANUAL_DEPTH_TEST \n float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st)); \n if (logDepthOrDepth != 0.0) \n { \n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); \n float depthEC = eyeCoordinate.z / eyeCoordinate.w; \n if (v_positionEC.z < depthEC) \n { \n discard; \n } \n } \n#endif \n czm_globe_translucency_main(); \n vec4 classificationColor = texture2D(u_classificationTexture, st); \n if (classificationColor.a > 0.0) \n { \n // Reverse premultiplication process to get the correct composited result of the classification primitives \n classificationColor.rgb /= classificationColor.a; \n } \n gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a); \n} \n")}function getTranslucentBackFaceShaderProgram(e,t){getTranslucentShaderProgram$1(e,t),removeDefine(e.defines,"GROUND_ATMOSPHERE"),removeDefine(t.defines,"GROUND_ATMOSPHERE"),removeDefine(e.defines,"FOG"),removeDefine(t.defines,"FOG")}function getTranslucentFrontFaceManualDepthTestShaderProgram(e,t){getTranslucentShaderProgram$1(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function getTranslucentBackFaceManualDepthTestShaderProgram(e,t){getTranslucentBackFaceShaderProgram(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function getPickShaderProgram(e,t){t.sources=["uniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n vec4 pickColor = texture2D(u_classificationTexture, st); \n if (pickColor == vec4(0.0)) \n { \n discard; \n } \n gl_FragColor = pickColor; \n} \n"]}function getDerivedShaderProgram(e,t,i,n,r,o){if(!defined(r))return t;if(!n&&defined(i))return i;let a=e.shaderCache.getDerivedShaderProgram(t,o);if(!defined(a)){const i=t._attributeLocations,n=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();n.defines=defined(n.defines)?n.defines.slice(0):[],s.defines=defined(s.defines)?s.defines.slice(0):[],r(n,s),a=e.shaderCache.createDerivedShaderProgram(t,o,{vertexShaderSource:n,fragmentShaderSource:s,attributeLocations:i})}return a}function getOpaqueFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0}function getOpaqueBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0}function getDepthOnlyFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getDepthOnlyBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getDepthOnlyFrontAndBackFaceRenderState(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getTranslucentFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=BlendingState$1.ALPHA_BLEND}function getTranslucentBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=BlendingState$1.ALPHA_BLEND}function getPickFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function getPickBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function getDerivedRenderState(e,t,i,n,r){if(!defined(n))return e;if(!i&&defined(t))return t;let o=r[e.id];if(!defined(o)){const t=RenderState.getState(e);n(t),o=RenderState.fromCache(t),r[e.id]=o}return o}function getTranslucencyUniformMap(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function getDerivedUniformMap(e,t,i,n,r){return defined(r)?!n&&defined(i)?i:combine$2(t,r(e),!1):t}function DerivedCommandPack(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function createDerivedCommandPacks(){return[new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getOpaqueFrontFaceShaderProgram,getRenderStateFunction:getOpaqueFrontFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getOpaqueBackFaceShaderProgram,getRenderStateFunction:getOpaqueBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyFrontFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyFrontAndBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentShaderProgram$1,getRenderStateFunction:getTranslucentFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentBackFaceShaderProgram,getRenderStateFunction:getTranslucentBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentFrontFaceManualDepthTestShaderProgram,getRenderStateFunction:getTranslucentFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentBackFaceManualDepthTestShaderProgram,getRenderStateFunction:getTranslucentBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:getPickShaderProgram,getRenderStateFunction:getPickFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:getPickShaderProgram,getRenderStateFunction:getPickBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap})]}Object.defineProperties(GlobeTranslucencyState.prototype,{frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance}},translucent:{get:function(){return this._frontFaceTranslucent}},sunVisibleThroughGlobe:{get:function(){return this._sunVisibleThroughGlobe}},environmentVisible:{get:function(){return this._environmentVisible}},useDepthPlane:{get:function(){return this._useDepthPlane}},numberOfTextureUniforms:{get:function(){return this._numberOfTextureUniforms}},rectangle:{get:function(){return this._rectangle}}}),GlobeTranslucencyState.prototype.update=function(e){const t=e.globe;if(!defined(t)||!t.show)return this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,void(this._useDepthPlane=!1);this._frontFaceAlphaByDistance=updateAlphaByDistance(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=updateAlphaByDistance(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=isFaceTranslucent(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=isFaceTranslucent(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=requiresManualDepthTest(this,e,t),this._sunVisibleThroughGlobe=isSunVisibleThroughGlobe(this,e),this._environmentVisible=isEnvironmentVisible(this,e),this._useDepthPlane=useDepthPlane(this,e),this._numberOfTextureUniforms=getNumberOfTextureUniforms(this),this._rectangle=Rectangle.clone(t.translucency.rectangle,this._rectangle),gatherDerivedCommandRequirements(this,e)};const derivedCommandNames=new Array(derivedCommandsMaximumLength),derivedCommandPacks=new Array(derivedCommandsMaximumLength);function updateDerivedCommands$1(e,t,i,n,r,o,a){let s=t.derivedCommands.globeTranslucency;const c=e._derivedCommandsDirty;if(t.dirty||!defined(s)||c){t.dirty=!1,defined(s)||(s={},t.derivedCommands.globeTranslucency=s);const c=a.frameNumber,l=defaultValue(s.uniformMapDirtyFrame,0),u=defaultValue(s.shaderProgramDirtyFrame,0),d=defaultValue(s.renderStateDirtyFrame,0),h=s.uniformMap!==t.uniformMap,p=s.shaderProgramId!==t.shaderProgram.id,f=s.renderStateId!==t.renderState.id;h&&(s.uniformMapDirtyFrame=c),p&&(s.shaderProgramDirtyFrame=c),f&&(s.renderStateDirtyFrame=c),s.uniformMap=t.uniformMap,s.shaderProgramId=t.shaderProgram.id,s.renderStateId=t.renderState.id;for(let m=0;m<i;++m){const i=o[m],g=n[m],_=r[m];let y,C,T,S=s[_];defined(S)?(y=S.uniformMap,C=S.shaderProgram,T=S.renderState):(y=void 0,C=void 0,T=void 0),S=DrawCommand.shallowClone(t,S),s[_]=S;const v=defaultValue(S.derivedCommands.uniformMapDirtyFrame,0),A=defaultValue(S.derivedCommands.shaderProgramDirtyFrame,0),E=defaultValue(S.derivedCommands.renderStateDirtyFrame,0),b=h||v<l,x=p||A<u,P=f||E<d;b&&(S.derivedCommands.uniformMapDirtyFrame=c),x&&(S.derivedCommands.shaderProgramDirtyFrame=c),P&&(S.derivedCommands.renderStateDirtyFrame=c),S.derivedCommands.type=g,S.pass=i.pass,S.pickOnly=i.pickOnly,S.uniformMap=getDerivedUniformMap(e,t.uniformMap,y,b,i.getUniformMapFunction),S.shaderProgram=getDerivedShaderProgram(a.context,t.shaderProgram,C,x,i.getShaderProgramFunction,_),S.renderState=getDerivedRenderState(t.renderState,T,P,i.getRenderStateFunction,i.renderStateCache)}}}function executeCommandsMatchingType(e,t,i,n,r,o,a){for(let s=0;s<t;++s){const t=e[s],c=t.derivedCommands.type;(!defined(a)||a.indexOf(c)>-1)&&i(t,n,r,o)}}function executeCommands$1(e,t,i,n,r,o){for(let a=0;a<t;++a)i(e[a],n,r,o)}GlobeTranslucencyState.prototype.updateDerivedCommands=function(e,t){const i=this._derivedCommandTypesToUpdate,n=this._derivedCommandsToUpdateLength;if(0!==n){for(let e=0;e<n;++e)derivedCommandPacks[e]=this._derivedCommandPacks[i[e]],derivedCommandNames[e]=DerivedCommandNames[i[e]];updateDerivedCommands$1(this,e,n,i,derivedCommandNames,derivedCommandPacks,t)}},GlobeTranslucencyState.prototype.pushDerivedCommands=function(e,t,i){const n=i.passes.pick;if(n&&t)return;let r=this._derivedCommandTypes,o=this._derivedCommandsLength;if(n?(r=this._derivedPickCommandTypes,o=this._derivedPickCommandsLength):t&&(r=this._derivedBlendCommandTypes,o=this._derivedBlendCommandsLength),0===o)return void i.commandList.push(e);const a=e.derivedCommands.globeTranslucency;for(let e=0;e<o;++e){const t=DerivedCommandNames[r[e]];i.commandList.push(a[t])}};const opaqueTypes=[DerivedCommandType.OPAQUE_FRONT_FACE,DerivedCommandType.OPAQUE_BACK_FACE],depthOnlyTypes=[DerivedCommandType.DEPTH_ONLY_FRONT_FACE,DerivedCommandType.DEPTH_ONLY_BACK_FACE,DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE];function GoogleEarthEnterpriseDiscardPolicy(){this._image=new Image}function GoogleEarthEnterpriseImageryProvider(e){let t;if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,defined(e.metadata))t=e.metadata;else{const i=Resource.createIfNeeded(e.url);t=new GoogleEarthEnterpriseMetadata(i)}this._metadata=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});let i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=23,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new GoogleEarthEnterpriseDiscardPolicy),this._errorEvent=new Event,this._ready=!1;const n=this;let r;this._readyPromise=t.readyPromise.then((function(e){if(!t.imageryPresent){const e=new RuntimeError(`The server ${t.url} doesn't have imagery`);return r=TileProviderError.handleError(r,n,n._errorEvent,e.message,void 0,void 0,void 0,e),Promise.reject(e)}return TileProviderError.handleSuccess(r),n._ready=e,e})).catch((function(e){return r=TileProviderError.handleError(r,n,n._errorEvent,e.message,void 0,void 0,void 0,e),Promise.reject(e)}))}function buildImageResource$1(e,t,i,n,r,o){const a=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(i,n,r);let s=t.imageryVersion;return s=defined(s)&&s>0?s:1,e._metadata.resource.getDerivedResource({url:`flatfile?f1-0${a}-i.${s.toString()}`,request:o})}function getImageType(e){const t="JFIF";if(e[6]===t.charCodeAt(0)&&e[7]===t.charCodeAt(1)&&e[8]===t.charCodeAt(2)&&e[9]===t.charCodeAt(3))return"image/jpeg";const i="PNG";return e[1]===i.charCodeAt(0)&&e[2]===i.charCodeAt(1)&&e[3]===i.charCodeAt(2)?"image/png":void 0}function decodeEarthImageryPacket(e){const t=protobuf$1.Reader.create(e),i=t.len,n={};for(;t.pos<i;){const e=t.uint32();let i;switch(e>>>3){case 1:n.imageType=t.uint32();break;case 2:n.imageData=t.bytes();break;case 3:n.alphaType=t.uint32();break;case 4:n.imageAlpha=t.bytes();break;case 5:if(i=n.copyrightIds,defined(i)||(i=n.copyrightIds=[]),2==(7&e)){const e=t.uint32()+t.pos;for(;t.pos<e;)i.push(t.uint32())}else i.push(t.uint32());break;default:t.skipType(7&e)}}const r=n.imageType;if(defined(r))switch(r){case 0:n.imageType="image/jpeg";break;case 4:n.imageType="image/png";break;default:throw new RuntimeError("GoogleEarthEnterpriseImageryProvider: Unsupported image type.")}const o=n.alphaType;return defined(o)&&0!==o&&(console.log("GoogleEarthEnterpriseImageryProvider: External alpha not supported."),delete n.alphaType,delete n.imageAlpha),n}GlobeTranslucencyState.prototype.executeGlobeCommands=function(e,t,i,n,r){const o=n.context,a=e.commands[Pass$1.GLOBE],s=e.indices[Pass$1.GLOBE];0!==s&&(this._globeTranslucencyFramebuffer=i,i.clearClassification(o,r),executeCommandsMatchingType(a,s,t,n,o,r,opaqueTypes))},GlobeTranslucencyState.prototype.executeGlobeClassificationCommands=function(e,t,i,n,r){const o=n.context,a=e.commands[Pass$1.GLOBE],s=e.indices[Pass$1.GLOBE],c=e.commands[Pass$1.TERRAIN_CLASSIFICATION],l=e.indices[Pass$1.TERRAIN_CLASSIFICATION];if(0===s||0===l)return;const u=this._frontFaceTranslucent,d=this._backFaceTranslucent;if(u&&d||executeCommands$1(c,l,t,n,o,r),!u&&!d)return;this._globeTranslucencyFramebuffer=i;const h=o.uniformState.globeDepthTexture,p=r.framebuffer;if(r.framebuffer=i.classificationFramebuffer,executeCommandsMatchingType(a,s,t,n,o,r,depthOnlyTypes),o.depthTexture){const e=i.packDepth(o,r);o.uniformState.globeDepthTexture=e}executeCommands$1(c,l,t,n,o,r),o.uniformState.globeDepthTexture=h,r.framebuffer=p},GoogleEarthEnterpriseDiscardPolicy.prototype.isReady=function(){return!0},GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage=function(e){return e===this._image},Object.defineProperties(GoogleEarthEnterpriseImageryProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}}),GoogleEarthEnterpriseImageryProvider.prototype.getTileCredits=function(e,t,i){const n=this._metadata,r=n.getTileInformation(e,t,i);if(defined(r)){const e=n.providers[r.imageryProvider];if(defined(e))return[e]}},GoogleEarthEnterpriseImageryProvider.prototype.requestImage=function(e,t,i,n){const r=this._tileDiscardPolicy._image,o=this._metadata,a=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),s=o.getTileInformation(e,t,i);if(!defined(s)){if(o.isValid(a)){const r=new Request({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction});return void o.populateSubtree(e,t,i,r)}return r}if(!s.hasImagery())return r;const c=buildImageResource$1(this,s,e,t,i,n).fetchArrayBuffer();return defined(c)?c.then((function(e){decodeGoogleEarthEnterpriseData(o.key,e);let t,i=new Uint8Array(e);const n=o.protoImagery;if(defined(n)&&n||(t=getImageType(i)),!defined(t)&&(!defined(n)||n)){const e=decodeEarthImageryPacket(i);t=e.imageType,i=e.imageData}return defined(t)&&defined(i)?loadImageFromTypedArray({uint8Array:i,format:t,flipY:!0}):r})):void 0},GoogleEarthEnterpriseImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){};const defaultColor=new Color(1,1,1,.4),defaultGlowColor=new Color(0,1,0,.05),defaultBackgroundColor=new Color(0,.5,0,.2);function GridImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new GeographicTilingScheme({ellipsoid:e.ellipsoid}),this._cells=defaultValue(e.cells,8),this._color=defaultValue(e.color,defaultColor),this._glowColor=defaultValue(e.glowColor,defaultGlowColor),this._glowWidth=defaultValue(e.glowWidth,6),this._backgroundColor=defaultValue(e.backgroundColor,defaultBackgroundColor),this._errorEvent=new Event,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._canvasSize=defaultValue(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=Promise.resolve(!0)}Object.defineProperties(GridImageryProvider.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}}),GridImageryProvider.prototype._drawGrid=function(e){const t=this._canvasSize;for(let i=0;i<=this._cells;++i){const n=1+i/this._cells*(t-1);e.moveTo(n,0),e.lineTo(n,t),e.moveTo(0,n),e.lineTo(t,n)}e.stroke()},GridImageryProvider.prototype._createGridCanvas=function(){const e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;const t=this._canvasSize,i=e.getContext("2d"),n=this._backgroundColor.toCssColorString();i.fillStyle=n,i.fillRect(0,0,t,t);const r=this._glowColor.toCssColorString();i.strokeStyle=r,i.lineWidth=this._glowWidth,i.strokeRect(0,0,t,t),this._drawGrid(i),i.lineWidth=.5*this._glowWidth,i.strokeRect(0,0,t,t),this._drawGrid(i);const o=this._color.toCssColorString();return i.strokeStyle=o,i.lineWidth=2,i.strokeRect(0,0,t,t),i.lineWidth=1,this._drawGrid(i),e},GridImageryProvider.prototype.getTileCredits=function(e,t,i){},GridImageryProvider.prototype.requestImage=function(e,t,i,n){return this._canvas},GridImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){};const ImagerySplitDirection={};function warnDeprecated(){deprecationWarning("ImagerySplitDirection","ImagerySplitDirection was deprecated in Cesium 1.92. It will be removed in 1.94. Use SplitDirection instead.")}Object.defineProperties(ImagerySplitDirection,{LEFT:{get:function(){return warnDeprecated(),SplitDirection$1.LEFT}},NONE:{get:function(){return warnDeprecated(),SplitDirection$1.NONE}},RIGHT:{get:function(){return warnDeprecated(),SplitDirection$1.RIGHT}}});var ImagerySplitDirection$1=Object.freeze(ImagerySplitDirection);function InvertClassification(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new FramebufferManager({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new FramebufferManager({depthStencil:!0,createDepthAttachments:!1}),this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0});const e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(InvertClassification.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}}),InvertClassification.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const rsUnclassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsClassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsDefault={depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK,blending:BlendingState$1.ALPHA_BLEND},translucentFS="#extension GL_EXT_frag_depth : enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform sampler2D classifiedTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n bool isClassified = all(equal(texture2D(classifiedTexture, v_textureCoordinates), vec4(0.0)));\n#ifdef UNCLASSIFIED\n vec4 highlightColor = czm_invertClassificationColor;\n if (isClassified)\n {\n discard;\n }\n#else\n vec4 highlightColor = vec4(1.0);\n if (!isClassified)\n {\n discard;\n }\n#endif\n gl_FragColor = color * highlightColor;\n gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;\n}\n",opaqueFS="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n#ifdef UNCLASSIFIED\n gl_FragColor = color * czm_invertClassificationColor;\n#else\n gl_FragColor = color;\n#endif\n}\n";function JobTypeBudget(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}function JobScheduler(e){const t=new Array(JobType$1.NUMBER_OF_JOB_TYPES);t[JobType$1.TEXTURE]=new JobTypeBudget(defined(e)?e[JobType$1.TEXTURE]:10),t[JobType$1.PROGRAM]=new JobTypeBudget(defined(e)?e[JobType$1.PROGRAM]:10),t[JobType$1.BUFFER]=new JobTypeBudget(defined(e)?e[JobType$1.BUFFER]:30);const i=t.length;let n,r=0;for(n=0;n<i;++n)r+=t[n].total;const o=new Array(i);for(n=0;n<i;++n)o[n]=!1;this._totalBudget=r,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=o}function Light(){}InvertClassification.prototype.update=function(e,t,i){const n=this._fbo.getColorTexture(),r=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;const o=this._numSamples!==t,a=e.drawingBufferWidth,s=e.drawingBufferHeight,c=!defined(n)||n.width!==a||n.height!==s;if((c||r||o)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),defined(this._previousFramebuffer)||(this._depthStencilTexture=new Texture({context:e,width:a,height:s,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new Renderbuffer({context:e,width:a,height:s,format:RenderbufferFormat$1.DEPTH24_STENCIL8,numSamples:t})))),!defined(this._fbo.framebuffer)||c||r||o){let n,r;this._fbo.destroy(),this._fboClassified.destroy(),defined(this._previousFramebuffer)?(n=i.getDepthStencilTexture(),r=i.getDepthStencilRenderbuffer()):(n=this._depthStencilTexture,r=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(n),defined(r)&&this._fbo.setDepthStencilRenderbuffer(r),this._fbo.update(e,a,s,t),defined(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(n),this._fboClassified.update(e,a,s))}if(defined(this._rsUnclassified)||(this._rsUnclassified=RenderState.fromCache(rsUnclassified),this._rsClassified=RenderState.fromCache(rsClassified),this._rsDefault=RenderState.fromCache(rsDefault)),!defined(this._unclassifiedCommand)||r||o){defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());const t=defined(this._previousFramebuffer)?opaqueFS:translucentFS,i=new ShaderSource({defines:["UNCLASSIFIED"],sources:[t]}),n=new ShaderSource({sources:[t]});this._unclassifiedCommand=e.createViewportQuadCommand(i,{renderState:defined(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(n,{renderState:defined(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),defined(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),defined(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(PassThrough,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}},InvertClassification.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)},InvertClassification.prototype.clear=function(e,t){defined(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))},InvertClassification.prototype.executeClassified=function(e,t){if(!defined(this._previousFramebuffer)){const i=t.framebuffer;this.prepareTextures(e,!0),t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=i}this._classifiedCommand.execute(e,t)},InvertClassification.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)},InvertClassification.prototype.isDestroyed=function(){return!1},InvertClassification.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(JobTypeBudget.prototype,{total:{get:function(){return this._total}}}),JobScheduler.getTimestamp=getTimestamp$1,Object.defineProperties(JobScheduler.prototype,{totalBudget:{get:function(){return this._totalBudget}}}),JobScheduler.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget},JobScheduler.prototype.resetBudgets=function(){const e=this._budgets,t=e.length;for(let i=0;i<t;++i){const t=e[i];t.starvedLastFrame=t.starvedThisFrame,t.starvedThisFrame=!1,t.usedThisFrame=0,t.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0},JobScheduler.prototype.execute=function(e,t){const i=this._budgets,n=i[t],r=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&r)return n.starvedThisFrame=!0,!1;let o;if(n.usedThisFrame+n.stolenFromMeThisFrame>=n.total){const e=i.length;let t;for(t=0;t<e&&(o=i[t],!(o.usedThisFrame+o.stolenFromMeThisFrame<o.total)||o.starvedLastFrame);++t);if(t===e&&r)return!1;r&&(n.starvedThisFrame=!0)}const a=JobScheduler.getTimestamp();e.execute();const s=JobScheduler.getTimestamp()-a;return this._totalUsedThisFrame+=s,o?o.stolenFromMeThisFrame+=s:n.usedThisFrame+=s,this._executedThisFrame[t]=!0,!0},Object.defineProperties(Light.prototype,{color:{get:DeveloperError.throwInstantiationError},intensity:{get:DeveloperError.throwInstantiationError}});const trailingSlashRegex=/\/$/,defaultCredit$1=new Credit('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxStyleImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).styleId,i=e.accessToken;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const n=Resource.createIfNeeded(defaultValue(e.url,"https://api.mapbox.com/styles/v1/"));this._styleId=t,this._accessToken=i;const r=defaultValue(e.tilesize,512);this._tilesize=r;const o=defaultValue(e.username,"mapbox");this._username=o;const a=defined(e.scaleFactor)?"@2x":"";let s,c=n.getUrlComponent();trailingSlashRegex.test(c)||(c+="/"),c+=`${this._username}/${t}/tiles/${this._tilesize}/{z}/{x}/{y}${a}`,n.url=c,n.setQueryParameters({access_token:i}),defined(e.credit)?(s=e.credit,"string"==typeof s&&(s=new Credit(s))):s=defaultCredit$1,this._resource=n,this._imageryProvider=new UrlTemplateImageryProvider({url:n,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function Moon(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).textureUrl;defined(t)||(t=buildModuleUrl("Assets/Textures/moonSmall.jpg")),this.show=defaultValue(e.show,!0),this.textureUrl=t,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.MOON),this.onlySunLighting=defaultValue(e.onlySunLighting,!0),this._ellipsoidPrimitive=new EllipsoidPrimitive({radii:this.ellipsoid.radii,material:Material$4.fromType(Material$4.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new IauOrientationAxes}Object.defineProperties(MapboxStyleImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}}),MapboxStyleImageryProvider.prototype.getTileCredits=function(e,t,i){},MapboxStyleImageryProvider.prototype.requestImage=function(e,t,i,n){return this._imageryProvider.requestImage(e,t,i,n)},MapboxStyleImageryProvider.prototype.pickFeatures=function(e,t,i,n,r){return this._imageryProvider.pickFeatures(e,t,i,n,r)},MapboxStyleImageryProvider._defaultCredit=defaultCredit$1,Object.defineProperties(Moon.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const icrfToFixed=new Matrix3,rotationScratch=new Matrix3,translationScratch=new Cartesian3,scratchCommandList=[];function MultiClippingPlaneCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._multiCollections=[],this._dataArrayBuffer=null,this._lengthArrayBuffer=null,this._dataTexture=null,this._lengthTexture=null,this._dirty=!1,this._maxCollectionLength=0,this._totalPlanesCount=0,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.edgeColor=Color.clone(defaultValue(e.edgeColor,Color.WHITE)),this.edgeWidth=defaultValue(e.edgeWidth,0);var t=e.collections,i=this;defined(t)&&t.forEach((function(e){i.add(e)}))}function NeverTileDiscardPolicy(e){}Moon.prototype.update=function(e){if(!this.show)return;const t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;const i=e.time;defined(Transforms.computeIcrfToFixedMatrix(i,icrfToFixed))||Transforms.computeTemeToPseudoFixedMatrix(i,icrfToFixed);const n=this._axes.evaluate(i,rotationScratch);Matrix3.transpose(n,n),Matrix3.multiply(icrfToFixed,n,n);const r=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(i,translationScratch);Matrix3.multiplyByVector(icrfToFixed,r,r),Matrix4.fromRotationTranslation(n,r,t.modelMatrix);const o=e.commandList;return e.commandList=scratchCommandList,scratchCommandList.length=0,t.update(e),e.commandList=o,1===scratchCommandList.length?scratchCommandList[0]:void 0},Moon.prototype.isDestroyed=function(){return!1},Moon.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),destroyObject(this)},Object.defineProperties(MultiClippingPlaneCollection.prototype,{length:{get:function(){return this._multiCollections.length}},dataTexture:{get:function(){return this._dataTexture}},lengthTexture:{get:function(){return this._lengthTexture}},collectionsState:{get:function(){var e=0;return this._multiCollections.forEach((function(t,i){e+=t.clippingPlanesState})),e}},maxCollectionLength:{get:function(){return this._maxCollectionLength}},totalPlanesCount:{get:function(){return this._totalPlanesCount}}}),MultiClippingPlaneCollection.prototype.add=function(e){this._multiCollections.push(e),this._dirty=!0},MultiClippingPlaneCollection.prototype.get=function(e){return this._multiCollections[e]},MultiClippingPlaneCollection.prototype.contains=function(e){return-1!==this._multiCollections.findIndex((function(t){return t===e}))},MultiClippingPlaneCollection.prototype.remove=function(e,t=!0){var i=this._multiCollections,n=i.findIndex((function(t){return t===e}));return-1!==n&&(i.splice(n,1),e instanceof ClippingPlaneCollection&&t&&e.destroy(),this._dirty=!0,!0)},MultiClippingPlaneCollection.prototype.removeAll=function(){this._multiCollections.forEach((function(e){e instanceof ClippingPlaneCollection&&e.destroy()})),this._multiCollections=[],this._dirty=!0},MultiClippingPlaneCollection.prototype.update=function(e){var t=this._multiCollections;if(t.forEach((function(t){t.enabled&&t.update(e)})),this._dirty){for(var i,n=e.context,r=ClippingPlaneCollection.useFloatTexture(n),o=0,a=!0,s=0,c=0,l=0;l<t.length;l++){var u=t[l];s+=t.length,c=Math.max(c,u.length),i=u.texture.height,o+=u.texture.width,defined(u.texture)||(a=!1)}if(this._totalPlanesCount=s,this._maxCollectionLength=c,a&&t.length>0){this._dataArrayBuffer=r?new Float32Array(o*i*4):new Uint8Array(o*i*4),this._lengthArrayBuffer=new Float32Array(4*t.length);var d=this._dataArrayBuffer,h=this._lengthArrayBuffer,p=0;t.forEach((function(e,t){for(var i=r?e._float32View:e._uint8View,n=0,o=0;o<e.length;++o)d[p]=i[n],d[p+1]=i[n+1],d[p+2]=i[n+2],d[p+3]=i[n+3],n+=4,p+=4;h[4*t+3]=e.length})),this._dataTexture=new Texture(r?{context:n,width:o,height:i,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:Sampler.NEAREST,flipY:!1}:{context:n,width:o,height:i,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST,flipY:!1,source:{width:o,height:i,arrayBufferView:d}}),this._dataTexture.copyFrom({source:{width:o,height:i,arrayBufferView:d}}),this._lengthTexture=new Texture({context:n,width:t.length,height:1,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:Sampler.NEAREST,flipY:!1}),this._lengthTexture.copyFrom({source:{width:t.length,height:1,arrayBufferView:h}})}this._dirty=!1}},MultiClippingPlaneCollection.prototype.destroy=function(){return this._multiCollections.forEach((function(e){e instanceof ClippingPlaneCollection&&e.destroy()})),this._multiCollections=void 0,this._dataTexture=this._dataTexture&&this._dataTexture.destroy(),this._lengthTexture=this._lengthTexture&&this._lengthTexture.destroy(),destroyObject(this)},NeverTileDiscardPolicy.prototype.isReady=function(){return!0},NeverTileDiscardPolicy.prototype.shouldDiscardImage=function(e){return!1};var AdjustTranslucentFS="#ifdef MRT\n#extension GL_EXT_draw_buffers : enable\n#endif\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nif (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n{\n#ifdef MRT\ngl_FragData[0] = u_bgColor;\ngl_FragData[1] = vec4(u_bgColor.a);\n#else\ngl_FragColor = u_bgColor;\n#endif\nreturn;\n}\ndiscard;\n}\n",CompositeOITFS="uniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 opaque = texture2D(u_opaque, v_textureCoordinates);\nvec4 accum = texture2D(u_accumulation, v_textureCoordinates);\nfloat r = texture2D(u_revealage, v_textureCoordinates).r;\n#ifdef MRT\nvec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\nvec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\ngl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\nif (opaque != czm_backgroundColor)\n{\ngl_FragColor.a = 1.0;\n}\n}\n";function OIT(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;const t=e.colorBufferFloat&&e.depthTexture;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=new FramebufferManager({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new FramebufferManager({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new FramebufferManager({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new FramebufferManager({createColorAttachments:!1}),this._opaqueClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new ClearCommand({color:new Color(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._alphaClearCommand=new ClearCommand({color:new Color(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new BoundingRectangle,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function destroyTextures$1(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function destroyFramebuffers$1(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function destroyResources$2(e){destroyTextures$1(e),destroyFramebuffers$1(e)}function updateTextures$1(e,t,i,n){destroyTextures$1(e),e._accumulationTexture=new Texture({context:t,width:i,height:n,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT});const r=new Float32Array(i*n*4);e._revealageTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,source:{arrayBufferView:r,width:i,height:n},flipY:!1})}function updateFramebuffers$3(e,t){destroyFramebuffers$1(e);const i=WebGLConstants$1.FRAMEBUFFER_COMPLETE;let n=!0;const r=e._accumulationTexture.width,o=e._accumulationTexture.height;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,r,o),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,r,o),e._translucentFBO.status===i&&e._adjustTranslucentFBO.status===i||(destroyFramebuffers$1(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,r,o),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,r,o),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,r,o),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,r,o);const a=e._translucentFBO.status===i,s=e._alphaFBO.status===i,c=e._adjustTranslucentFBO.status===i,l=e._adjustAlphaFBO.status===i;a&&s&&c&&l||(destroyResources$2(e),e._translucentMultipassSupport=!1,n=!1)}return n}OIT.prototype.update=function(e,t,i,n,r){if(!this.isSupported())return;this._opaqueFBO=i,this._opaqueTexture=i.getColorTexture(0),this._depthStencilTexture=i.getDepthStencilTexture();const o=this._opaqueTexture.width,a=this._opaqueTexture.height,s=this._accumulationTexture,c=!defined(s)||s.width!==o||s.height!==a||n!==this._useHDR,l=this._numSamples!==r;if((c||l)&&(this._numSamples=r,updateTextures$1(this,e,o,a)),(!defined(this._translucentFBO.framebuffer)||c||l)&&!updateFramebuffers$3(this,e))return;this._useHDR=n;const u=this;let d,h;defined(this._compositeCommand)||(d=new ShaderSource({sources:[CompositeOITFS]}),this._translucentMRTSupport&&d.defines.push("MRT"),h={u_opaque:function(){return u._opaqueTexture},u_accumulation:function(){return u._accumulationTexture},u_revealage:function(){return u._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this})),defined(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(d=new ShaderSource({defines:["MRT"],sources:[AdjustTranslucentFS]}),h={u_bgColor:function(){return u._translucentMRTClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this})):this._translucentMultipassSupport&&(d=new ShaderSource({sources:[AdjustTranslucentFS]}),h={u_bgColor:function(){return u._translucentMultipassClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this}),h={u_bgColor:function(){return u._alphaClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this}))),this._viewport.width=o,this._viewport.height=a;const p=!BoundingRectangle.equals(this._viewport,t.viewport);let f=p!==this._useScissorTest;this._useScissorTest=p,BoundingRectangle.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=BoundingRectangle.clone(t.viewport,this._scissorRectangle),f=!0),defined(this._rs)&&BoundingRectangle.equals(this._viewport,this._rs.viewport)&&!f||(this._rs=RenderState.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),defined(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};const translucentMRTBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA},translucentColorBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE},translucentAlphaBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ZERO,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA};function getTranslucentRenderState(e,t,i,n){let r=i[n.id];if(!defined(r)){const e=RenderState.getState(n);e.depthMask=!1,e.blending=t,r=RenderState.fromCache(e),i[n.id]=r}return r}function getTranslucentMRTRenderState(e,t,i){return getTranslucentRenderState(t,translucentMRTBlend,e._translucentRenderStateCache,i)}function getTranslucentColorRenderState(e,t,i){return getTranslucentRenderState(t,translucentColorBlend,e._translucentRenderStateCache,i)}function getTranslucentAlphaRenderState(e,t,i){return getTranslucentRenderState(t,translucentAlphaBlend,e._alphaRenderStateCache,i)}const mrtShaderSource=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragData[0] = vec4(Ci * wzi, ai);\n gl_FragData[1] = vec4(ai * wzi);\n",colorShaderSource=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragColor = vec4(Ci, ai) * wzi;\n",alphaShaderSource=" float ai = czm_gl_FragColor.a;\n gl_FragColor = vec4(ai);\n";function getTranslucentShaderProgram(e,t,i,n){let r=e.shaderCache.getDerivedShaderProgram(t,i);if(!defined(r)){const o=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map((function(e){return e=(e=(e=(e=ShaderSource.replaceMain(e,"czm_translucent_main")).replace(/gl_FragColor/g,"czm_gl_FragColor")).replace(/\bdiscard\b/g,"czm_discard = true")).replace(/czm_phong/g,"czm_translucentPhong")})),a.sources.splice(0,0,(-1!==n.indexOf("gl_FragData")?"#extension GL_EXT_draw_buffers : enable \n":"")+"vec4 czm_gl_FragColor;\nbool czm_discard = false;\n"),a.sources.push(`void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n${n}}\n`),r=e.shaderCache.createDerivedShaderProgram(t,i,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:o})}return r}function getTranslucentMRTShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMRT",mrtShaderSource)}function getTranslucentColorShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMultipass",colorShaderSource)}function getTranslucentAlphaShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"alphaMultipass",alphaShaderSource)}function executeTranslucentCommandsSortedMultipass(e,t,i,n,r,o){let a,s,c;const l=t.context,u=t.frameState.useLogDepth,d=t._hdr,h=n.framebuffer,p=r.length,f=t.frameState.shadowState.lightShadowsEnabled;n.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(l,n),n.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(l,n);const m=e._opaqueFBO.framebuffer;for(n.framebuffer=e._translucentFBO.framebuffer,c=0;c<p;++c)a=r[c],a=u?a.derivedCommands.logDepth.command:a,a=d?a.derivedCommands.hdr.command:a,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.translucentCommand:a.derivedCommands.oit.translucentCommand,i(s,t,l,n,m);for(defined(o)&&(a=o.unclassifiedCommand,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.translucentCommand:a.derivedCommands.oit.translucentCommand,i(s,t,l,n,m)),n.framebuffer=e._alphaFBO.framebuffer,c=0;c<p;++c)a=r[c],a=u?a.derivedCommands.logDepth.command:a,a=d?a.derivedCommands.hdr.command:a,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.alphaCommand:a.derivedCommands.oit.alphaCommand,i(s,t,l,n,m);defined(o)&&(a=o.unclassifiedCommand,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.alphaCommand:a.derivedCommands.oit.alphaCommand,i(s,t,l,n,m)),n.framebuffer=h}function executeTranslucentCommandsSortedMRT(e,t,i,n,r,o){const a=t.context,s=t.frameState.useLogDepth,c=t._hdr,l=n.framebuffer,u=r.length,d=t.frameState.shadowState.lightShadowsEnabled;n.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(a,n);const h=e._opaqueFBO.framebuffer;let p,f;n.framebuffer=e._translucentFBO.framebuffer;for(let e=0;e<u;++e)p=r[e],p=s?p.derivedCommands.logDepth.command:p,p=c?p.derivedCommands.hdr.command:p,f=d&&p.receiveShadows?p.derivedCommands.oit.shadows.translucentCommand:p.derivedCommands.oit.translucentCommand,i(f,t,a,n,h);defined(o)&&(p=o.unclassifiedCommand,f=d&&p.receiveShadows?p.derivedCommands.oit.shadows.translucentCommand:p.derivedCommands.oit.translucentCommand,i(f,t,a,n,h)),n.framebuffer=l}OIT.prototype.createDerivedCommands=function(e,t,i){if(defined(i)||(i={}),this._translucentMRTSupport){let n,r;defined(i.translucentCommand)&&(n=i.translucentCommand.shaderProgram,r=i.translucentCommand.renderState),i.translucentCommand=DrawCommand.shallowClone(e,i.translucentCommand),defined(n)&&i.shaderProgramId===e.shaderProgram.id?(i.translucentCommand.shaderProgram=n,i.translucentCommand.renderState=r):(i.translucentCommand.shaderProgram=getTranslucentMRTShaderProgram(t,e.shaderProgram),i.translucentCommand.renderState=getTranslucentMRTRenderState(this,t,e.renderState),i.shaderProgramId=e.shaderProgram.id)}else{let n,r,o,a;defined(i.translucentCommand)&&(n=i.translucentCommand.shaderProgram,r=i.translucentCommand.renderState,o=i.alphaCommand.shaderProgram,a=i.alphaCommand.renderState),i.translucentCommand=DrawCommand.shallowClone(e,i.translucentCommand),i.alphaCommand=DrawCommand.shallowClone(e,i.alphaCommand),defined(n)&&i.shaderProgramId===e.shaderProgram.id?(i.translucentCommand.shaderProgram=n,i.translucentCommand.renderState=r,i.alphaCommand.shaderProgram=o,i.alphaCommand.renderState=a):(i.translucentCommand.shaderProgram=getTranslucentColorShaderProgram(t,e.shaderProgram),i.translucentCommand.renderState=getTranslucentColorRenderState(this,t,e.renderState),i.alphaCommand.shaderProgram=getTranslucentAlphaShaderProgram(t,e.shaderProgram),i.alphaCommand.renderState=getTranslucentAlphaRenderState(this,t,e.renderState),i.shaderProgramId=e.shaderProgram.id)}return i},OIT.prototype.executeCommands=function(e,t,i,n,r){this._translucentMRTSupport?executeTranslucentCommandsSortedMRT(this,e,t,i,n,r):executeTranslucentCommandsSortedMultipass(this,e,t,i,n,r)},OIT.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},OIT.prototype.clear=function(e,t,i){const n=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,Color.clone(i,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO.framebuffer;(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO.framebuffer,this._alphaClearCommand.execute(e,t)),t.framebuffer=n},OIT.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},OIT.prototype.isDestroyed=function(){return!1},OIT.prototype.destroy=function(){return destroyResources$2(this),defined(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),defined(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),destroyObject(this)};const defaultCredit=new Credit("MapQuest, Open Street Map and contributors, CC-BY-SA");function OpenStreetMapImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=Resource.createIfNeeded(defaultValue(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}.${defaultValue(e.fileExtension,"png")}`;const i=new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),n=defaultValue(e.minimumLevel,0),r=e.maximumLevel,o=defaultValue(e.rectangle,i.rectangle),a=i.positionToTileXY(Rectangle.southwest(o),n),s=i.positionToTileXY(Rectangle.northeast(o),n);Math.abs(s.x-a.x),Math.abs(s.y-a.y);let c=defaultValue(e.credit,defaultCredit);"string"==typeof c&&(c=new Credit(c)),UrlTemplateImageryProvider.call(this,{url:t,credit:c,tilingScheme:i,tileWidth:256,tileHeight:256,minimumLevel:n,maximumLevel:r,rectangle:o})}defined(Object.create)&&(OpenStreetMapImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),OpenStreetMapImageryProvider.prototype.constructor=OpenStreetMapImageryProvider);const defaultSize=new Cartesian2(1,1);function Particle(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.mass=defaultValue(e.mass,1),this.position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this.velocity=Cartesian3.clone(defaultValue(e.velocity,Cartesian3.ZERO)),this.life=defaultValue(e.life,Number.MAX_VALUE),this.image=e.image,this.startColor=Color.clone(defaultValue(e.startColor,Color.WHITE)),this.endColor=Color.clone(defaultValue(e.endColor,Color.WHITE)),this.startScale=defaultValue(e.startScale,1),this.endScale=defaultValue(e.endScale,1),this.imageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultSize)),this._age=0,this._normalizedAge=0,this._billboard=void 0}Object.defineProperties(Particle.prototype,{age:{get:function(){return this._age}},normalizedAge:{get:function(){return this._normalizedAge}}});const deltaScratch=new Cartesian3;function ParticleBurst(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.time=defaultValue(e.time,0),this.minimum=defaultValue(e.minimum,0),this.maximum=defaultValue(e.maximum,50),this._complete=!1}function ParticleEmitter(e){}Particle.prototype.update=function(e,t){return Cartesian3.multiplyByScalar(this.velocity,e,deltaScratch),Cartesian3.add(this.position,deltaScratch,this.position),defined(t)&&t(this,e),this._age+=e,this.life===Number.MAX_VALUE?this._normalizedAge=0:this._normalizedAge=this._age/this.life,this._age<=this.life},Object.defineProperties(ParticleBurst.prototype,{complete:{get:function(){return this._complete}}}),ParticleEmitter.prototype.emit=function(e){DeveloperError.throwInstantiationError()};const defaultImageSize=new Cartesian2(1,1);function ParticleSystem(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.updateCallback=e.updateCallback,this.loop=defaultValue(e.loop,!0),this.image=defaultValue(e.image,void 0);let t=e.emitter;defined(t)||(t=new CircleEmitter(.5)),this._emitter=t,this._bursts=e.bursts,this._modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._emitterModelMatrix=Matrix4.clone(defaultValue(e.emitterModelMatrix,Matrix4.IDENTITY)),this._matrixDirty=!0,this._combinedMatrix=new Matrix4,this._startColor=Color.clone(defaultValue(e.color,defaultValue(e.startColor,Color.WHITE))),this._endColor=Color.clone(defaultValue(e.color,defaultValue(e.endColor,Color.WHITE))),this._startScale=defaultValue(e.scale,defaultValue(e.startScale,1)),this._endScale=defaultValue(e.scale,defaultValue(e.endScale,1)),this._emissionRate=defaultValue(e.emissionRate,5),this._minimumSpeed=defaultValue(e.speed,defaultValue(e.minimumSpeed,1)),this._maximumSpeed=defaultValue(e.speed,defaultValue(e.maximumSpeed,1)),this._minimumParticleLife=defaultValue(e.particleLife,defaultValue(e.minimumParticleLife,5)),this._maximumParticleLife=defaultValue(e.particleLife,defaultValue(e.maximumParticleLife,5)),this._minimumMass=defaultValue(e.mass,defaultValue(e.minimumMass,1)),this._maximumMass=defaultValue(e.mass,defaultValue(e.maximumMass,1)),this._minimumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.minimumImageSize,defaultImageSize))),this._maximumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.maximumImageSize,defaultImageSize))),this._sizeInMeters=defaultValue(e.sizeInMeters,!1),this._lifetime=defaultValue(e.lifetime,Number.MAX_VALUE),this._billboardCollection=void 0,this._particles=[],this._particlePool=[],this._previousTime=void 0,this._currentTime=0,this._carryOver=0,this._complete=new Event,this._isComplete=!1,this._updateParticlePool=!0,this._particleEstimate=0}function updateParticlePool(e){const t=e._emissionRate,i=e._maximumParticleLife;let n=0;const r=e._bursts;if(defined(r)){const e=r.length;for(let t=0;t<e;++t)n+=r[t].maximum}const o=e._billboardCollection,a=e.image,s=Math.ceil(t*i+n),c=e._particles,l=e._particlePool,u=Math.max(s-c.length-l.length,0);for(let e=0;e<u;++e){const e=new Particle;e._billboard=o.add({image:a}),l.push(e)}e._particleEstimate=s}function getOrCreateParticle(e){let t=e._particlePool.pop();return defined(t)||(t=new Particle),t}function addParticleToPool(e,t){e._particlePool.push(t)}function freeParticlePool(e){const t=e._particles,i=e._particlePool,n=e._billboardCollection,r=t.length,o=i.length,a=e._particleEstimate,s=o-Math.max(a-r-o,0);for(let e=s;e<o;++e){const t=i[e];n.remove(t._billboard)}i.length=s}function removeBillboard(e){defined(e._billboard)&&(e._billboard.show=!1)}function updateBillboard(e,t){let i=t._billboard;defined(i)||(i=t._billboard=e._billboardCollection.add({image:t.image})),i.width=t.imageSize.x,i.height=t.imageSize.y,i.position=t.position,i.sizeInMeters=e.sizeInMeters,i.show=!0;const n=CesiumMath.lerp(t.startColor.red,t.endColor.red,t.normalizedAge),r=CesiumMath.lerp(t.startColor.green,t.endColor.green,t.normalizedAge),o=CesiumMath.lerp(t.startColor.blue,t.endColor.blue,t.normalizedAge),a=CesiumMath.lerp(t.startColor.alpha,t.endColor.alpha,t.normalizedAge);i.color=new Color(n,r,o,a),i.scale=CesiumMath.lerp(t.startScale,t.endScale,t.normalizedAge)}function addParticle(e,t){t.startColor=Color.clone(e._startColor,t.startColor),t.endColor=Color.clone(e._endColor,t.endColor),t.startScale=e._startScale,t.endScale=e._endScale,t.image=e.image,t.life=CesiumMath.randomBetween(e._minimumParticleLife,e._maximumParticleLife),t.mass=CesiumMath.randomBetween(e._minimumMass,e._maximumMass),t.imageSize.x=CesiumMath.randomBetween(e._minimumImageSize.x,e._maximumImageSize.x),t.imageSize.y=CesiumMath.randomBetween(e._minimumImageSize.y,e._maximumImageSize.y),t._normalizedAge=0,t._age=0;const i=CesiumMath.randomBetween(e._minimumSpeed,e._maximumSpeed);Cartesian3.multiplyByScalar(t.velocity,i,t.velocity),e._particles.push(t)}function calculateNumberToEmit(e,t){if(e._isComplete)return 0;const i=(t=CesiumMath.mod(t,e._lifetime))*e._emissionRate;let n=Math.floor(i);if(e._carryOver+=i-n,e._carryOver>1&&(n++,e._carryOver-=1),defined(e.bursts)){const t=e.bursts.length;for(let i=0;i<t;i++){const t=e.bursts[i],r=e._currentTime;defined(t)&&!t._complete&&r>t.time&&(n+=CesiumMath.randomBetween(t.minimum,t.maximum),t._complete=!0)}}return n}Object.defineProperties(ParticleSystem.prototype,{emitter:{get:function(){return this._emitter},set:function(e){this._emitter=e}},bursts:{get:function(){return this._bursts},set:function(e){this._bursts=e,this._updateParticlePool=!0}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._modelMatrix,e),Matrix4.clone(e,this._modelMatrix)}},emitterModelMatrix:{get:function(){return this._emitterModelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._emitterModelMatrix,e),Matrix4.clone(e,this._emitterModelMatrix)}},startColor:{get:function(){return this._startColor},set:function(e){Color.clone(e,this._startColor)}},endColor:{get:function(){return this._endColor},set:function(e){Color.clone(e,this._endColor)}},startScale:{get:function(){return this._startScale},set:function(e){this._startScale=e}},endScale:{get:function(){return this._endScale},set:function(e){this._endScale=e}},emissionRate:{get:function(){return this._emissionRate},set:function(e){this._emissionRate=e,this._updateParticlePool=!0}},minimumSpeed:{get:function(){return this._minimumSpeed},set:function(e){this._minimumSpeed=e}},maximumSpeed:{get:function(){return this._maximumSpeed},set:function(e){this._maximumSpeed=e}},minimumParticleLife:{get:function(){return this._minimumParticleLife},set:function(e){this._minimumParticleLife=e}},maximumParticleLife:{get:function(){return this._maximumParticleLife},set:function(e){this._maximumParticleLife=e,this._updateParticlePool=!0}},minimumMass:{get:function(){return this._minimumMass},set:function(e){this._minimumMass=e}},maximumMass:{get:function(){return this._maximumMass},set:function(e){this._maximumMass=e}},minimumImageSize:{get:function(){return this._minimumImageSize},set:function(e){this._minimumImageSize=e}},maximumImageSize:{get:function(){return this._maximumImageSize},set:function(e){this._maximumImageSize=e}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters=e}},lifetime:{get:function(){return this._lifetime},set:function(e){this._lifetime=e}},complete:{get:function(){return this._complete}},isComplete:{get:function(){return this._isComplete}}});const rotatedVelocityScratch=new Cartesian3;function PerformanceDisplay(e){const t=getElement((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).container);this._container=t;const i=document.createElement("div");i.className="cesium-performanceDisplay";const n=document.createElement("div");n.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),n.appendChild(this._fpsText);const r=document.createElement("div");r.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),r.appendChild(this._msText),i.appendChild(r),i.appendChild(n),this._container.appendChild(i),this._lastFpsSampleTime=getTimestamp$1(),this._lastMsSampleTime=getTimestamp$1(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;const o=document.createElement("div");o.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),o.appendChild(this._throttledText),i.appendChild(o)}function PickDepth(){this._framebuffer=new FramebufferManager,this._textureToCopy=void 0,this._copyDepthCommand=void 0}function updateFramebuffers$2(e,t,i){const n=i.width,r=i.height;e._framebuffer.update(t,n,r)}function updateCopyCommands(e,t,i){if(!defined(e._copyDepthCommand)){const i="uniform highp sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";e._copyDepthCommand=t.createViewportQuadCommand(i,{renderState:RenderState.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=i,e._copyDepthCommand.framebuffer=e.framebuffer}ParticleSystem.prototype.update=function(e){if(!this.show)return;defined(this._billboardCollection)||(this._billboardCollection=new BillboardCollection),this._updateParticlePool&&(updateParticlePool(this),this._updateParticlePool=!1);let t=0;this._previousTime&&(t=JulianDate.secondsDifference(e.time,this._previousTime)),t<0&&(t=0);const i=this._particles,n=this._emitter,r=this.updateCallback;let o,a,s=i.length;for(o=0;o<s;++o)a=i[o],a.update(t,r)?updateBillboard(this,a):(removeBillboard(a),addParticleToPool(this,a),i[o]=i[s-1],--o,--s);i.length=s;const c=calculateNumberToEmit(this,t);if(c>0&&defined(n)){this._matrixDirty&&(this._combinedMatrix=Matrix4.multiply(this.modelMatrix,this.emitterModelMatrix,this._combinedMatrix),this._matrixDirty=!1);const e=this._combinedMatrix;for(o=0;o<c;o++)a=getOrCreateParticle(this),this._emitter.emit(a),Cartesian3.add(a.position,a.velocity,rotatedVelocityScratch),Matrix4.multiplyByPoint(e,rotatedVelocityScratch,rotatedVelocityScratch),a.position=Matrix4.multiplyByPoint(e,a.position,a.position),Cartesian3.subtract(rotatedVelocityScratch,a.position,a.velocity),Cartesian3.normalize(a.velocity,a.velocity),addParticle(this,a),updateBillboard(this,a)}if(this._billboardCollection.update(e),this._previousTime=JulianDate.clone(e.time,this._previousTime),this._currentTime+=t,this._lifetime!==Number.MAX_VALUE&&this._currentTime>this._lifetime)if(this.loop){if(this._currentTime=CesiumMath.mod(this._currentTime,this._lifetime),this.bursts){const e=this.bursts.length;for(o=0;o<e;o++)this.bursts[o]._complete=!1}}else this._isComplete=!0,this._complete.raiseEvent(this);e.frameNumber%120==0&&freeParticlePool(this)},ParticleSystem.prototype.isDestroyed=function(){return!1},ParticleSystem.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),destroyObject(this)},Object.defineProperties(PerformanceDisplay.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(this._throttledText.nodeValue=e?"(throttled)":"",this._throttled=e)}}}),PerformanceDisplay.prototype.update=function(e){const t=getTimestamp$1(),i=defaultValue(e,!0);this._fpsFrameCount++;const n=t-this._lastFpsSampleTime;if(n>1e3){let e="N/A";i&&(e=1e3*this._fpsFrameCount/n|0),this._fpsText.nodeValue=`${e} FPS`,this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;const r=t-this._lastMsSampleTime;if(r>200){let e="N/A";i&&(e=(r/this._msFrameCount).toFixed(2)),this._msText.nodeValue=`${e} MS`,this._lastMsSampleTime=t,this._msFrameCount=0}},PerformanceDisplay.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(PickDepth.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}}),PickDepth.prototype.update=function(e,t){updateFramebuffers$2(this,e,t),updateCopyCommands(this,e,t)};const scratchPackedDepth=new Cartesian4,packedDepthScale=new Cartesian4(1,1/255,1/65025,1/16581375);function PickDepthFramebuffer(){this._framebuffer=new FramebufferManager({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}function destroyResources$1(e){e._framebuffer.destroy()}function createResources(e,t){const i=t.drawingBufferWidth,n=t.drawingBufferHeight;e._framebuffer.update(t,i,n);const r=new PassState(t);r.blendingEnabled=!1,r.scissorTest={enabled:!0,rectangle:new BoundingRectangle},r.viewport=new BoundingRectangle,e._passState=r}function PickFramebuffer(e){const t=new PassState(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new BoundingRectangle},t.viewport=new BoundingRectangle,this._context=e,this._fb=new FramebufferManager({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}PickDepth.prototype.getDepth=function(e,t,i){if(!defined(this.framebuffer))return;const n=e.readPixels({x:t,y:i,width:1,height:1,framebuffer:this.framebuffer}),r=Cartesian4.unpack(n,0,scratchPackedDepth);return Cartesian4.divideByScalar(r,255,r),Cartesian4.dot(r,packedDepthScale)},PickDepth.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},PickDepth.prototype.isDestroyed=function(){return!1},PickDepth.prototype.destroy=function(){return this._framebuffer.destroy(),defined(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=defined(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(PickDepthFramebuffer.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}}),PickDepthFramebuffer.prototype.update=function(e,t,i){const n=i.width,r=i.height;this._framebuffer.isDirty(n,r)&&createResources(this,e);const o=this.framebuffer,a=this._passState;return a.framebuffer=o,a.viewport.width=n,a.viewport.height=r,a.scissorTest.rectangle.x=t.x,a.scissorTest.rectangle.y=r-t.y,a.scissorTest.rectangle.width=1,a.scissorTest.rectangle.height=1,a},PickDepthFramebuffer.prototype.isDestroyed=function(){return!1},PickDepthFramebuffer.prototype.destroy=function(){return destroyResources$1(this),destroyObject(this)},PickFramebuffer.prototype.begin=function(e,t){const i=this._context,n=t.width,r=t.height;return BoundingRectangle.clone(e,this._passState.scissorTest.rectangle),this._width=n,this._height=r,this._fb.update(i,n,r),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=n,this._passState.viewport.height=r,this._passState};const colorScratch=new Color;function SceneFramebuffer(){this._numSamples=1,this._colorFramebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new Color(0,0,0,0),this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,owner:this})}function destroyResources(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}function ShadowMapShader(){}function ShadowMap(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context;this._enabled=defaultValue(e.enabled,!0),this._softShadows=defaultValue(e.softShadows,!1),this._normalOffset=defaultValue(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=defaultValue(e.fromLightSource,!0),this.darkness=defaultValue(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=defaultValue(e.fadingEnabled,!0),this.maximumDistance=defaultValue(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let i,n=!0;(FeatureDetection.isInternetExplorer()||FeatureDetection.isEdge()||(FeatureDetection.isChrome()||FeatureDetection.isFirefox())&&FeatureDetection.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new Matrix4,this._shadowMapTexture=void 0,this._lightDirectionEC=new Cartesian3,this._lightPositionEC=new Cartesian4,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new ShadowMapCamera,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new BoundingSphere,this._isPointLight=defaultValue(e.isPointLight,!1),this._pointLightRadius=defaultValue(e.pointLightRadius,100),this._cascadesEnabled=!this._isPointLight&&defaultValue(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?defaultValue(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new Cartesian2,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new OrthographicOffCenterFrustum:defined(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new Cartesian4,new Cartesian4],this._cascadeMatrices=[new Matrix4,new Matrix4,new Matrix4,new Matrix4],this._cascadeDistances=new Cartesian4,i=this._isPointLight?6:this._cascadesEnabled?this._numberOfCascades:1,this._passes=new Array(i);for(let e=0;e<i;++e)this._passes[e]=new ShadowPass(t);this.debugShow=!1,this.debugFreezeFrame=!1,this._debugFreezeFrame=!1,this._debugCascadeColors=!1,this._debugLightFrustum=void 0,this._debugCameraFrustum=void 0,this._debugCascadeFrustums=new Array(this._numberOfCascades),this._debugShadowViewCommand=void 0,this._usesDepthTexture=t.depthTexture,this._isPointLight&&(this._usesDepthTexture=!1),this._primitiveRenderState=void 0,this._terrainRenderState=void 0,this._pointRenderState=void 0,createRenderStates(this),this._clearCommand=new ClearCommand({depth:1,color:new Color}),this._clearPassState=new PassState(t),this._size=defaultValue(e.size,2048),this.size=this._size}function ShadowPass(e){this.camera=new ShadowMapCamera,this.passState=new PassState(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function createRenderState(e,t){return RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.BACK},depthTest:{enabled:!0},colorMask:{red:e,green:e,blue:e,alpha:e},depthMask:!0,polygonOffset:{enabled:t.polygonOffset,factor:t.polygonOffsetFactor,units:t.polygonOffsetUnits}})}function createRenderStates(e){const t=!e._usesDepthTexture;e._primitiveRenderState=createRenderState(t,e._primitiveBias),e._terrainRenderState=createRenderState(t,e._terrainBias),e._pointRenderState=createRenderState(t,e._pointBias)}function destroyFramebuffer(e){const t=e._passes.length;for(let i=0;i<t;++i){const t=e._passes[i],n=t.framebuffer;defined(n)&&!n.isDestroyed()&&n.destroy(),t.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function createFramebufferColor(e,t){const i=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),n=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),r=new Framebuffer({context:t,depthRenderbuffer:i,colorTextures:[n],destroyAttachments:!1}),o=e._passes.length;for(let t=0;t<o;++t){const i=e._passes[t];i.framebuffer=r,i.passState.framebuffer=r}e._shadowMapTexture=n,e._depthAttachment=i,e._colorAttachment=n}function createFramebufferDepth(e,t){const i=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST}),n=new Framebuffer({context:t,depthStencilTexture:i,destroyAttachments:!1}),r=e._passes.length;for(let t=0;t<r;++t){const i=e._passes[t];i.framebuffer=n,i.passState.framebuffer=n}e._shadowMapTexture=i,e._depthAttachment=i}function createFramebufferCube(e,t){const i=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),n=new CubeMap({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),r=[n.negativeX,n.negativeY,n.negativeZ,n.positiveX,n.positiveY,n.positiveZ];for(let n=0;n<6;++n){const o=new Framebuffer({context:t,depthRenderbuffer:i,colorTextures:[r[n]],destroyAttachments:!1}),a=e._passes[n];a.framebuffer=o,a.passState.framebuffer=o}e._shadowMapTexture=n,e._depthAttachment=i,e._colorAttachment=n}function createFramebuffer(e,t){e._isPointLight?createFramebufferCube(e,t):e._usesDepthTexture?createFramebufferDepth(e,t):createFramebufferColor(e,t)}function checkFramebuffer(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==WebGLConstants$1.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,createRenderStates(e),destroyFramebuffer(e),createFramebuffer(e,t))}function updateFramebuffer(e,t){defined(e._passes[0].framebuffer)&&e._shadowMapTexture.width===e._textureSize.x||(destroyFramebuffer(e),createFramebuffer(e,t),checkFramebuffer(e,t),clearFramebuffer(e,t))}function clearFramebuffer(e,t,i){i=defaultValue(i,0),(e._isPointLight||0===i)&&(e._clearCommand.framebuffer=e._passes[i].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function resize(e,t){e._size=t;const i=e._passes,n=i.length,r=e._textureSize;if(e._isPointLight){t=ContextLimits.maximumCubeMapSize>=t?t:ContextLimits.maximumCubeMapSize,r.x=t,r.y=t;const e=new BoundingRectangle(0,0,t,t);i[0].passState.viewport=e,i[1].passState.viewport=e,i[2].passState.viewport=e,i[3].passState.viewport=e,i[4].passState.viewport=e,i[5].passState.viewport=e}else 1===n?(t=ContextLimits.maximumTextureSize>=t?t:ContextLimits.maximumTextureSize,r.x=t,r.y=t,i[0].passState.viewport=new BoundingRectangle(0,0,t,t)):4===n&&(t=ContextLimits.maximumTextureSize>=2*t?t:ContextLimits.maximumTextureSize/2,r.x=2*t,r.y=2*t,i[0].passState.viewport=new BoundingRectangle(0,0,t,t),i[1].passState.viewport=new BoundingRectangle(t,0,t,t),i[2].passState.viewport=new BoundingRectangle(0,t,t,t),i[3].passState.viewport=new BoundingRectangle(t,t,t,t));e._clearPassState.viewport=new BoundingRectangle(0,0,r.x,r.y);for(let e=0;e<n;++e){const t=i[e],n=t.passState.viewport,o=n.x/r.x,a=n.y/r.y,s=n.width/r.x,c=n.height/r.y;t.textureOffsets=new Matrix4(s,0,0,o,0,c,0,a,0,0,1,0,0,0,0,1)}}PickFramebuffer.prototype.end=function(e){const t=defaultValue(e.width,1),i=defaultValue(e.height,1),n=this._context,r=n.readPixels({x:e.x,y:e.y,width:t,height:i,framebuffer:this._fb.framebuffer}),o=Math.max(t,i),a=o*o,s=Math.floor(.5*t),c=Math.floor(.5*i);let l=0,u=0,d=0,h=-1;for(let e=0;e<a;++e){if(-s<=l&&l<=s&&-c<=u&&u<=c){const e=4*((c-u)*t+l+s);colorScratch.red=Color.byteToFloat(r[e]),colorScratch.green=Color.byteToFloat(r[e+1]),colorScratch.blue=Color.byteToFloat(r[e+2]),colorScratch.alpha=Color.byteToFloat(r[e+3]);const i=n.getObjectByPickColor(colorScratch);if(defined(i))return i}if(l===u||l<0&&-l===u||l>0&&l===1-u){const e=d;d=-h,h=e}l+=d,u+=h}},PickFramebuffer.prototype.isDestroyed=function(){return!1},PickFramebuffer.prototype.destroy=function(){return this._fb.destroy(),destroyObject(this)},Object.defineProperties(SceneFramebuffer.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}}),SceneFramebuffer.prototype.update=function(e,t,i,n){const r=t.width,o=t.height,a=i?e.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._numSamples=n,this._colorFramebuffer.update(e,r,o,n,a),this._idFramebuffer.update(e,r,o)},SceneFramebuffer.prototype.clear=function(e,t,i){Color.clone(i,this._clearCommand.color),Color.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)},SceneFramebuffer.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer},SceneFramebuffer.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer},SceneFramebuffer.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)},SceneFramebuffer.prototype.isDestroyed=function(){return!1},SceneFramebuffer.prototype.destroy=function(){return destroyResources(this),destroyObject(this)},ShadowMapShader.getShadowCastShaderKeyword=function(e,t,i,n){return`castShadow ${e} ${t} ${i} ${n}`},ShadowMapShader.createShadowCastVertexShader=function(e,t,i){const n=e.defines.slice(0),r=e.sources.slice(0);n.push("SHADOW_MAP"),i&&n.push("GENERATE_POSITION");const o=defined(ShaderSource.findPositionVarying(e));if(t&&!o){const e=r.length;for(let t=0;t<e;++t)r[t]=ShaderSource.replaceMain(r[t],"czm_shadow_cast_main");const t="varying vec3 v_positionEC; \nvoid main() \n{ \n czm_shadow_cast_main(); \n v_positionEC = (czm_inverseProjection * gl_Position).xyz; \n}";r.push(t)}return new ShaderSource({defines:n,sources:r})},ShadowMapShader.createShadowCastFragmentShader=function(e,t,i,n){const r=e.defines.slice(0),o=e.sources.slice(0);r.push("SHADOW_MAP");let a=ShaderSource.findPositionVarying(e);const s=defined(a);s||(a="v_positionEC");const c=o.length;for(let e=0;e<c;++e)o[e]=ShaderSource.replaceMain(o[e],"czm_shadow_cast_main");let l="";return t&&(s||(l+="varying vec3 v_positionEC; \n"),l+="uniform vec4 shadowMap_lightPositionEC; \n"),l+=n?"void main() \n{ \n":"void main() \n{ \n czm_shadow_cast_main(); \n if (gl_FragColor.a == 0.0) \n { \n discard; \n } \n",l+=t?` float distance = length(${a}); \n if (distance >= shadowMap_lightPositionEC.w) \n { \n discard; \n } \n distance /= shadowMap_lightPositionEC.w; // radius \n gl_FragColor = czm_packDepth(gl_FragCoord.z); \n`:i?" gl_FragColor = vec4(1.0); \n":" gl_FragColor = czm_packDepth(gl_FragCoord.z); \n",l+="} \n",o.push(l),new ShaderSource({defines:r,sources:o})},ShadowMapShader.getShadowReceiveShaderKeyword=function(e,t,i,n){return`receiveShadow ${e._usesDepthTexture}${e._polygonOffsetSupported}${e._isPointLight}${e._isSpotLight}${e._numberOfCascades>1}${e.debugCascadeColors}${e.softShadows}${t}${i}${n}`},ShadowMapShader.createShadowReceiveVertexShader=function(e,t,i){const n=e.defines.slice(0),r=e.sources.slice(0);return n.push("SHADOW_MAP"),t&&(i?n.push("GENERATE_POSITION_AND_NORMAL"):n.push("GENERATE_POSITION")),new ShaderSource({defines:n,sources:r})},ShadowMapShader.createShadowReceiveFragmentShader=function(e,t,i,n,r){const o=ShaderSource.findNormalVarying(e),a=!n&&defined(o)||n&&r,s=ShaderSource.findPositionVarying(e),c=defined(s),l=t._usesDepthTexture,u=t._polygonOffsetSupported,d=t._isPointLight,h=t._isSpotLight,p=t._numberOfCascades>1,f=t.debugCascadeColors,m=t.softShadows,g=d?t._pointBias:n?t._terrainBias:t._primitiveBias,_=e.defines.slice(0),y=e.sources.slice(0),C=y.length;for(let e=0;e<C;++e)y[e]=ShaderSource.replaceMain(y[e],"czm_shadow_receive_main");d?_.push("USE_CUBE_MAP_SHADOW"):l&&_.push("USE_SHADOW_DEPTH_TEXTURE"),m&&!d&&_.push("USE_SOFT_SHADOWS"),p&&i&&n&&(a?_.push("ENABLE_VERTEX_LIGHTING"):_.push("ENABLE_DAYNIGHT_SHADING")),i&&g.normalShading&&a&&(_.push("USE_NORMAL_SHADING"),g.normalShadingSmooth>0&&_.push("USE_NORMAL_SHADING_SMOOTH"));let T,S="";return S+="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n",S+=d?"uniform samplerCube shadowMap_textureCube; \n":"uniform sampler2D shadowMap_texture; \n",T=c?` return vec4(${s}, 1.0); \n`:"#ifndef LOG_DEPTH \n return czm_windowToEyeCoordinates(gl_FragCoord); \n#else \n return vec4(v_logPositionEC, 1.0); \n#endif \n",S+=`uniform bool u_isSun;\nuniform bool u_isVisible;\nuniform bool u_isB3dm;\nuniform bool u_isPreviewMode;\nuniform bool u_viewshedCalculateNormals;\nuniform float shadowMap_horizonCullingDistance;\nuniform bool u_isBelowGround;\nuniform mat4 shadowMap_matrix; \nuniform vec3 shadowMap_lightDirectionEC; \nuniform vec3 shadowMap_viewshed_Back; \nuniform vec3 shadowMap_viewshed_Fore; \nuniform vec3 shadowMap_color;\nuniform vec4 shadowMap_lightPositionEC; \nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \nbool isTerrain = false;\n#ifdef LOG_DEPTH \nvarying vec3 v_logPositionEC; \n#endif \nvec4 getPositionEC() \n{ \n${T}} \nvec3 getNormalEC() \n{ \n${a?` return normalize(${o}); \n`:" return vec3(1.0); \n"}} \nvoid applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) \n{ \n${g.normalOffset&&a?" float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; \n float normalOffsetScale = 1.0 - nDotL; \n vec3 offset = normalOffset * normalOffsetScale * normalEC; \n positionEC.xyz += offset; \n":""}} \n`,S+="void main() \n{ \n czm_shadow_receive_main(); \n vec4 positionEC = getPositionEC(); \n vec3 normalEC = getNormalEC(); \n float distanceFromLight = 0.; \n float maxDistanceForColoring = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.y;\n float depth = -positionEC.z; \n",S+=" czm_shadowParameters shadowParameters; \n shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \n shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \n shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \n shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \n",n?S+=h?" vec3 ffy = dFdy(positionEC.xyz);\n vec3 ffx = dFdx(positionEC.xyz);\n normalEC = normalize(cross(ffx,ffy));\n distanceFromLight = length(positionEC.xyz - shadowMap_lightPositionEC.xyz);\n shadowParameters.depthBias *= max(distanceFromLight * 0.01, 1.0);\n":" shadowParameters.depthBias *= max(depth * 0.01, 1.0); \n":u||(S+=" shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); \n"),S+=d?" vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; \n float distance = length(directionEC); \n directionEC = normalize(directionEC); \n float radius = shadowMap_lightPositionEC.w; \n // Stop early if the fragment is beyond the point light radius \n if (distance > radius) \n { \n return; \n } \n vec3 directionWC = czm_inverseViewRotation * directionEC; \n shadowParameters.depth = distance / radius; \n shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n shadowParameters.texCoords = directionWC; \n float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters); \n":h?" if (u_isB3dm && u_viewshedCalculateNormals){\n vec3 nffy = dFdy(positionEC.xyz);\n vec3 nffx = dFdx(positionEC.xyz);\n normalEC = normalize(cross(nffx,nffy));\n }\n vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); \n float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Spot light uses a perspective projection, so perform the perspective divide \n shadowPosition /= shadowPosition.w; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n if (distanceFromLight > shadowMap_horizonCullingDistance){visibility = 0.1;}\n if (u_isBelowGround){visibility = 0.1;}\n":p?" float maxDepth = shadowMap_cascadeSplits[1].w; \n // Stop early if the eye depth exceeds the last cascade \n if (depth > maxDepth) \n { \n return; \n } \n // Get the cascade based on the eye-space depth \n vec4 weights = czm_cascadeWeights(depth); \n // Apply normal offset \n float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n // Transform position into the cascade \n vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; \n // Get visibility \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n // Fade out shadows that are far away \n float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; \n float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); \n visibility = mix(visibility, 1.0, fade); \n"+(f?" // Draw cascade colors for debugging \n gl_FragColor *= czm_cascadeColor(weights); \n":""):" float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n",S+=" if (u_isSun){ ;\n gl_FragColor.rgb = mix(shadowMap_color,gl_FragColor.rgb,visibility);\n } else if (!u_isVisible) { gl_FragColor.rgba = vec4(gl_FragColor.rgb,0.); } else if (u_isPreviewMode) {\n gl_FragColor.rgba = vec4(gl_FragColor.rgb * 0.85 + 0.15 * mix(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), 1.-step(visibility,0.5)),1.); \n } else { gl_FragColor.rgba = vec4(gl_FragColor.rgb * 0.6 + 0.4 * mix(shadowMap_viewshed_Back, shadowMap_viewshed_Fore, 1.-step(visibility,0.5)),1.); }\n} \n",y.push(S),new ShaderSource({defines:_,sources:y})},ShadowMap.MAXIMUM_DISTANCE=2e4,ShadowMap.prototype.debugCreateRenderStates=function(){createRenderStates(this)},Object.defineProperties(ShadowMap.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this.dirty=this._enabled!==e,this._enabled=e}},normalOffset:{get:function(){return this._normalOffset},set:function(e){this.dirty=this._normalOffset!==e,this._normalOffset=e,this._terrainBias.normalOffset=e,this._primitiveBias.normalOffset=e,this._pointBias.normalOffset=e}},softShadows:{get:function(){return this._softShadows},set:function(e){this.dirty=this._softShadows!==e,this._softShadows=e}},size:{get:function(){return this._size},set:function(e){resize(this,e)}},outOfView:{get:function(){return this._outOfView}},shadowMapCullingVolume:{get:function(){return this._shadowMapCullingVolume}},passes:{get:function(){return this._passes}},isPointLight:{get:function(){return this._isPointLight}},debugCascadeColors:{get:function(){return this._debugCascadeColors},set:function(e){this.dirty=this._debugCascadeColors!==e,this._debugCascadeColors=e}}});const scratchViewport=new BoundingRectangle;function createDebugShadowViewCommand(e,t){let i;i=e._isPointLight?"uniform samplerCube shadowMap_textureCube; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n vec2 uv = v_textureCoordinates; \n vec3 dir; \n \n if (uv.y < 0.5) \n { \n if (uv.x < 0.333) \n { \n dir.x = -1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = -1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else \n { \n dir.z = -1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 1.0; \n } \n } \n else \n { \n if (uv.x < 0.333) \n { \n dir.x = 1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = 1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else \n { \n dir.z = 1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 3.0; \n } \n } \n \n float shadow = czm_unpackDepth(textureCube(shadowMap_textureCube, dir)); \n gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n":`uniform sampler2D shadowMap_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n${e._usesDepthTexture?" float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r; \n":" float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates)); \n"} gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n`;const n=t.createViewportQuadCommand(i,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return n.pass=Pass$1.OVERLAY,n}function updateDebugShadowViewCommand(e,t){const i=t.context,n=t.context.drawingBufferWidth,r=t.context.drawingBufferHeight,o=.3*Math.min(n,r),a=scratchViewport;a.x=n-o,a.y=0,a.width=o,a.height=o;let s=e._debugShadowViewCommand;defined(s)||(s=createDebugShadowViewCommand(e,i),e._debugShadowViewCommand=s),defined(s.renderState)&&BoundingRectangle.equals(s.renderState.viewport,a)||(s.renderState=RenderState.fromCache({viewport:BoundingRectangle.clone(a)})),t.commandList.push(e._debugShadowViewCommand)}const frustumCornersNDC=new Array(8);frustumCornersNDC[0]=new Cartesian4(-1,-1,-1,1),frustumCornersNDC[1]=new Cartesian4(1,-1,-1,1),frustumCornersNDC[2]=new Cartesian4(1,1,-1,1),frustumCornersNDC[3]=new Cartesian4(-1,1,-1,1),frustumCornersNDC[4]=new Cartesian4(-1,-1,1,1),frustumCornersNDC[5]=new Cartesian4(1,-1,1,1),frustumCornersNDC[6]=new Cartesian4(1,1,1,1),frustumCornersNDC[7]=new Cartesian4(-1,1,1,1);const scratchMatrix=new Matrix4,scratchFrustumCorners=new Array(8);for(let e=0;e<8;++e)scratchFrustumCorners[e]=new Cartesian4;function createDebugPointLight(e,t){return new Primitive$3({geometryInstances:[new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-.5,-.5,-.5),maximum:new Cartesian3(.5,.5,.5)}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}}),new GeometryInstance({geometry:new SphereOutlineGeometry({radius:.5}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}})],appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}const debugOutlineColors=[Color.RED,Color.GREEN,Color.BLUE,Color.MAGENTA],scratchScale=new Cartesian3;function applyDebugSettings(e,t){updateDebugShadowViewCommand(e,t);const i=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(i&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new DebugCameraPrimitive({camera:e._sceneCamera,color:Color.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){i&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(let n=0;n<e._numberOfCascades;++n)i&&(e._debugCascadeFrustums[n]=e._debugCascadeFrustums[n]&&e._debugCascadeFrustums[n].destroy(),e._debugCascadeFrustums[n]=new DebugCameraPrimitive({camera:e._passes[n].camera,color:debugOutlineColors[n],updateOnChange:!1})),e._debugCascadeFrustums[n].update(t)}}else if(e._isPointLight){if(!defined(e._debugLightFrustum)||e._needsUpdate){const t=e._shadowMapCamera.positionWC,i=Quaternion.IDENTITY,n=2*e._pointLightRadius,r=Cartesian3.fromElements(n,n,n,scratchScale),o=Matrix4.fromTranslationQuaternionRotationScale(t,i,r,scratchMatrix);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=createDebugPointLight(o,Color.YELLOW)}e._debugLightFrustum.update(t)}else defined(e._debugLightFrustum)&&!e._needsUpdate||(e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function ShadowMapCamera(){this.viewMatrix=new Matrix4,this.inverseViewMatrix=new Matrix4,this.frustum=void 0,this.positionCartographic=new Cartographic,this.positionWC=new Cartesian3,this.directionWC=Cartesian3.clone(Cartesian3.UNIT_Z),this.upWC=Cartesian3.clone(Cartesian3.UNIT_Y),this.rightWC=Cartesian3.clone(Cartesian3.UNIT_X),this.viewProjectionMatrix=new Matrix4}ShadowMapCamera.prototype.clone=function(e){Matrix4.clone(e.viewMatrix,this.viewMatrix),Matrix4.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),Cartographic.clone(e.positionCartographic,this.positionCartographic),Cartesian3.clone(e.positionWC,this.positionWC),Cartesian3.clone(e.directionWC,this.directionWC),Cartesian3.clone(e.upWC,this.upWC),Cartesian3.clone(e.rightWC,this.rightWC)};const scaleBiasMatrix=new Matrix4(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);ShadowMapCamera.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return Matrix4.multiply(t,e,this.viewProjectionMatrix),Matrix4.multiply(scaleBiasMatrix,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const scratchSplits=new Array(5),scratchFrustum=new PerspectiveFrustum,scratchCascadeDistances=new Array(4),scratchMin=new Cartesian3,scratchMax=new Cartesian3;function computeCascades(e,t){const i=e._shadowMapCamera,n=e._sceneCamera,r=n.frustum.near,o=n.frustum.far,a=e._numberOfCascades;let s;const c=o-r,l=o/r;let u=.9,d=!1;t.shadowState.closestObjectSize<200&&(d=!0,u=.9);const h=scratchCascadeDistances,p=scratchSplits;for(p[0]=r,p[a]=o,s=0;s<a;++s){const e=(s+1)/a,t=r*Math.pow(l,e),i=r+c*e,n=CesiumMath.lerp(i,t,u);p[s+1]=n,h[s]=n-p[s]}if(d){for(s=0;s<a;++s)h[s]=Math.min(h[s],e._maximumCascadeDistances[s]);let t=p[0];for(s=0;s<a-1;++s)t+=h[s],p[s+1]=t}Cartesian4.unpack(p,0,e._cascadeSplits[0]),Cartesian4.unpack(p,1,e._cascadeSplits[1]),Cartesian4.unpack(h,0,e._cascadeDistances);const f=i.frustum,m=f.left,g=f.right,_=f.bottom,y=f.top,C=f.near,T=f.far,S=i.positionWC,v=i.directionWC,A=i.upWC,E=n.frustum.clone(scratchFrustum),b=i.getViewProjection();for(s=0;s<a;++s){E.near=p[s],E.far=p[s+1];const t=Matrix4.multiply(E.projectionMatrix,n.viewMatrix,scratchMatrix),r=Matrix4.inverse(t,scratchMatrix),o=Matrix4.multiply(b,r,scratchMatrix),a=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin),c=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax);for(let e=0;e<8;++e){const t=Cartesian4.clone(frustumCornersNDC[e],scratchFrustumCorners[e]);Matrix4.multiplyByVector(o,t,t),Cartesian3.divideByScalar(t,t.w,t),Cartesian3.minimumByComponent(t,a,a),Cartesian3.maximumByComponent(t,c,c)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0),a.z=0,c.x=Math.min(c.x,1),c.y=Math.min(c.y,1),c.z=Math.min(c.z,1);const l=e._passes[s],u=l.camera;u.clone(i);const d=u.frustum;d.left=m+a.x*(g-m),d.right=m+c.x*(g-m),d.bottom=_+a.y*(y-_),d.top=_+c.y*(y-_),d.near=C+a.z*(T-C),d.far=C+c.z*(T-C),l.cullingVolume=u.frustum.computeCullingVolume(S,v,A);const h=e._cascadeMatrices[s];Matrix4.multiply(u.getViewProjection(),n.inverseViewMatrix,h),Matrix4.multiply(l.textureOffsets,h,h)}}const scratchLightView=new Matrix4,scratchRight$1=new Cartesian3,scratchUp$1=new Cartesian3,scratchTranslation=new Cartesian3;function fitShadowMapToScene(e,t){const i=e._shadowMapCamera,n=e._sceneCamera,r=Matrix4.multiply(n.frustum.projectionMatrix,n.viewMatrix,scratchMatrix),o=Matrix4.inverse(r,scratchMatrix),a=i.directionWC;let s=n.directionWC;Cartesian3.equalsEpsilon(a,s,CesiumMath.EPSILON10)&&(s=n.upWC);const c=Cartesian3.cross(a,s,scratchRight$1);s=Cartesian3.cross(c,a,scratchUp$1),Cartesian3.normalize(s,s),Cartesian3.normalize(c,c);const l=Cartesian3.fromElements(0,0,0,scratchTranslation);let u=Matrix4.computeView(l,a,s,c,scratchLightView);const d=Matrix4.multiply(u,o,scratchMatrix),h=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin),p=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax);for(let e=0;e<8;++e){const t=Cartesian4.clone(frustumCornersNDC[e],scratchFrustumCorners[e]);Matrix4.multiplyByVector(d,t,t),Cartesian3.divideByScalar(t,t.w,t),Cartesian3.minimumByComponent(t,h,h),Cartesian3.maximumByComponent(t,p,p)}p.z+=1e3,h.z-=10;const f=scratchTranslation;f.x=-.5*(h.x+p.x),f.y=-.5*(h.y+p.y),f.z=-p.z;const m=Matrix4.fromTranslation(f,scratchMatrix);u=Matrix4.multiply(m,u,u);const g=.5*(p.x-h.x),_=.5*(p.y-h.y),y=p.z-h.z,C=i.frustum;C.left=-g,C.right=g,C.bottom=-_,C.top=_,C.near=.01,C.far=y,Matrix4.clone(u,i.viewMatrix),Matrix4.inverse(u,i.inverseViewMatrix),Matrix4.getTranslation(i.inverseViewMatrix,i.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(i.positionWC,i.positionCartographic),Cartesian3.clone(a,i.directionWC),Cartesian3.clone(s,i.upWC),Cartesian3.clone(c,i.rightWC)}const directions=[new Cartesian3(-1,0,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(0,1,0),new Cartesian3(0,0,1)],ups=[new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(0,-1,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,1),new Cartesian3(0,-1,0)],rights=[new Cartesian3(0,0,1),new Cartesian3(1,0,0),new Cartesian3(-1,0,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(1,0,0)];function computeOmnidirectional(e,t){const i=new PerspectiveFrustum;i.fov=CesiumMath.PI_OVER_TWO,i.near=1,i.far=e._pointLightRadius,i.aspectRatio=1;for(let n=0;n<6;++n){const r=e._passes[n].camera;r.positionWC=e._shadowMapCamera.positionWC,r.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(r.positionWC,r.positionCartographic),r.directionWC=directions[n],r.upWC=ups[n],r.rightWC=rights[n],Matrix4.computeView(r.positionWC,r.directionWC,r.upWC,r.rightWC,r.viewMatrix),Matrix4.inverse(r.viewMatrix,r.inverseViewMatrix),r.frustum=i}}const scratchCartesian1=new Cartesian3,scratchCartesian2=new Cartesian3,scratchBoundingSphere=new BoundingSphere,scratchCenter$1=scratchBoundingSphere.center;function checkVisibility(e,t){const i=e._sceneCamera,n=e._shadowMapCamera,r=scratchBoundingSphere;if(e._cascadesEnabled){if(i.frustum.near>=e.maximumDistance)return e._outOfView=!0,void(e._needsUpdate=!1);const r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(i.positionWC,scratchCartesian1),o=Cartesian3.negate(n.directionWC,scratchCartesian2),a=Cartesian3.dot(r,o);if(e.fadingEnabled){const t=CesiumMath.clamp(a/.1,0,1);e._darkness=CesiumMath.lerp(1,e.darkness,t)}else e._darkness=e.darkness;if(a<0)return e._outOfView=!0,void(e._needsUpdate=!1);e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)r.center=n.positionWC,r.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(r)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(r),BoundingSphere.clone(r,e._boundingSphere);else{const i=n.frustum.far/2,o=Cartesian3.add(n.positionWC,Cartesian3.multiplyByScalar(n.directionWC,i,scratchCenter$1),scratchCenter$1);r.center=o,r.radius=i,e._outOfView=t.cullingVolume.computeVisibility(r)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(r),BoundingSphere.clone(r,e._boundingSphere)}}function updateCameras(e,t){const i=t.camera,n=e._lightCamera,r=e._sceneCamera,o=e._shadowMapCamera;e._cascadesEnabled?n&&o&&Cartesian3.clone(n.directionWC,o.directionWC):e._isPointLight?n&&o&&Cartesian3.clone(n.positionWC,o.positionWC):o&&n&&o.clone(n);const a=e._lightDirectionEC;let s,c;Matrix4.multiplyByPointAsVector(i.viewMatrix,o.directionWC,a),Cartesian3.normalize(a,a),Cartesian3.negate(a,a),Matrix4.multiplyByPoint(i.viewMatrix,o.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius,e._fitNearFar?(s=Math.min(t.shadowState.nearPlane,e.maximumDistance),c=Math.min(t.shadowState.farPlane,e.maximumDistance),c=Math.max(c,s+1)):(s=i.frustum.near,c=e.maximumDistance),e._sceneCamera=Camera.clone(i,r),i.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=s,e._sceneCamera.frustum.far=c,e._distance=c-s,checkVisibility(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}ShadowMap.prototype.update=function(e){if(updateCameras(this,e),this._needsUpdate)if(updateFramebuffer(this,e.context),this._isPointLight&&computeOmnidirectional(this,e),this._cascadesEnabled&&(fitShadowMapToScene(this,e),this._numberOfCascades>1&&computeCascades(this,e)),this._isPointLight)this._shadowMapCullingVolume=CullingVolume.fromBoundingSphere(this._boundingSphere);else{const e=this._shadowMapCamera,t=e.positionWC,i=e.directionWC,n=e.upWC;this._shadowMapCullingVolume=e.frustum.computeCullingVolume(t,i,n),1===this._passes.length&&this._passes[0].camera.clone(e)}if(1===this._passes.length){const e=this._sceneCamera.inverseViewMatrix;Matrix4.multiply(this._shadowMapCamera.getViewProjection(),e,this._shadowMapMatrix)}this.debugShow&&applyDebugSettings(this,e)},ShadowMap.prototype.updatePass=function(e,t){clearFramebuffer(this,e,t)};const scratchTexelStepSize=new Cartesian2;function combineUniforms(e,t,i){const n=e._isPointLight?e._pointBias:i?e._terrainBias:e._primitiveBias;return combine$2(t,{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture},shadowMap_matrix:function(){return e._shadowMapMatrix},shadowMap_cascadeSplits:function(){return e._cascadeSplits},shadowMap_cascadeMatrices:function(){return e._cascadeMatrices},shadowMap_lightDirectionEC:function(){return e._lightDirectionEC},shadowMap_lightPositionEC:function(){return e._lightPositionEC},shadowMap_cascadeDistances:function(){return e._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){const t=scratchTexelStepSize;return t.x=1/e._textureSize.x,t.y=1/e._textureSize.y,Cartesian4.fromElements(t.x,t.y,n.depthBias,n.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return Cartesian4.fromElements(n.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},shadowMap_horizonCullingDistance:function(){return void 0===e.horizonCullingDistanceFromViewshed?6371010:e.horizonCullingDistanceFromViewshed},u_isSun:function(){return void 0===e.guid},u_isVisible:function(){return!!e.show},u_isPreviewMode:function(){return!!e.isPreviewMode},u_isBelowGround:function(){return!!e.isBelowGround},u_viewshedCalculateNormals:function(){return!1},shadowMap_viewshed_Back:function(){return e._viewshed_Back?e._viewshed_Back:new Cartesian3(1,0,0)},shadowMap_viewshed_Fore:function(){return e._viewshed_Fore?e._viewshed_Fore:new Cartesian3(0,1,0)},shadowMap_color:function(){return e._color?e._color:new Cartesian3(0,0,0)},combinedUniforms1:new Cartesian4,combinedUniforms2:new Cartesian4},!1)}function createCastDerivedCommand(e,t,i,n,r,o){let a,s,c;if(defined(o)&&(a=o.shaderProgram,s=o.renderState,c=o.uniformMap),(o=DrawCommand.shallowClone(i,o)).castShadows=!0,o.receiveShadows=!1,!defined(a)||r!==i.shaderProgram.id||t){const t=i.shaderProgram,r=i.pass===Pass$1.GLOBE,o=i.pass!==Pass$1.TRANSLUCENT,l=e._isPointLight||e._isSpotLight,u=e._usesDepthTexture,d=ShadowMapShader.getShadowCastShaderKeyword(l,r,u,o);if(a=n.shaderCache.getDerivedShaderProgram(t,d),!defined(a)){const e=t.vertexShaderSource,i=t.fragmentShaderSource,s=ShadowMapShader.createShadowCastVertexShader(e,l,r),c=ShadowMapShader.createShadowCastFragmentShader(i,l,u,o);a=n.shaderCache.createDerivedShaderProgram(t,d,{vertexShaderSource:s,fragmentShaderSource:c,attributeLocations:t._attributeLocations})}s=e._primitiveRenderState,l?s=e._pointRenderState:r&&(s=e._terrainRenderState);i.renderState.cull.enabled||(s=clone$1(s,!1),s.cull=clone$1(s.cull,!1),s.cull.enabled=!1,s=RenderState.fromCache(s)),c=combineUniforms(e,i.uniformMap,r)}return o.shaderProgram=a,o.renderState=s,o.uniformMap=c,o.uniformMap.u_isB3dm=function(){return i.pass===Pass$1.CESIUM_3D_TILE},o}ShadowMap.createReceiveDerivedCommand=function(e,t,i,n,r){defined(r)||(r={});const o=e.length>0,a=t.shaderProgram,s=a.vertexShaderSource,c=a.fragmentShaderSource,l=t.pass===Pass$1.GLOBE;let u=!1;if(l&&(u=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&o){let o,d;defined(r.receiveCommand)&&(o=r.receiveCommand.shaderProgram,d=r.receiveCommand.uniformMap),r.receiveCommand=DrawCommand.shallowClone(t,r.receiveCommand),r.castShadows=!1,r.receiveShadows=!0;const h=r.receiveShaderCastShadows!==t.castShadows,p=r.receiveShaderProgramId!==t.shaderProgram.id;if(!defined(o)||p||i||h){const i=ShadowMapShader.getShadowReceiveShaderKeyword(e[0],t.castShadows,l,u);if(o=n.shaderCache.getDerivedShaderProgram(a,i),!defined(o)){const r=ShadowMapShader.createShadowReceiveVertexShader(s,l,u),d=ShadowMapShader.createShadowReceiveFragmentShader(c,e[0],t.castShadows,l,u);o=n.shaderCache.createDerivedShaderProgram(a,i,{vertexShaderSource:r,fragmentShaderSource:d,attributeLocations:a._attributeLocations})}d=combineUniforms(e[0],t.uniformMap,l)}r.receiveCommand.shaderProgram=o,r.receiveCommand.uniformMap=d,r.receiveCommand.uniformMap.u_isB3dm=function(){return t.pass===Pass$1.CESIUM_3D_TILE},r.receiveShaderProgramId=t.shaderProgram.id,r.receiveShaderCastShadows=t.castShadows}return r},ShadowMap.createCastDerivedCommand=function(e,t,i,n,r){if(defined(r)||(r={}),t.castShadows){let o=r.castCommands;defined(o)||(o=r.castCommands=[]);const a=r.castShaderProgramId,s=e.length;o.length=s;for(let r=0;r<s;++r)o[r]=createCastDerivedCommand(e[r],i,t,n,a,o[r]);r.castShaderProgramId=t.shaderProgram.id}return r},ShadowMap.prototype.isDestroyed=function(){return!1},ShadowMap.prototype.destroy=function(){destroyFramebuffer(this),this._debugLightFrustum=this._debugLightFrustum&&this._debugLightFrustum.destroy(),this._debugCameraFrustum=this._debugCameraFrustum&&this._debugCameraFrustum.destroy(),this._debugShadowViewCommand=this._debugShadowViewCommand&&this._debugShadowViewCommand.shaderProgram&&this._debugShadowViewCommand.shaderProgram.destroy();for(let e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return destroyObject(this)};var CompareAndPackTranslucentDepth="uniform sampler2D u_opaqueDepthTexture;\nuniform sampler2D u_translucentDepthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;\nfloat translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;\ntranslucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);\ngl_FragColor = czm_packDepth(translucentDepth);\n}\n",CompositeTranslucentClassification="uniform sampler2D colorTexture;\n#ifdef DEBUG_SHOW_DEPTH\nuniform sampler2D u_packedTranslucentDepth;\n#endif\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n#ifdef DEBUG_SHOW_DEPTH\nif (v_textureCoordinates.x < 0.5)\n{\ngl_FragColor.rgb = vec3(czm_unpackDepth(texture2D(u_packedTranslucentDepth, v_textureCoordinates)));\ngl_FragColor.a = 1.0;\n}\n#else\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\n#ifdef PICK\nif (color == vec4(0.0))\n{\ndiscard;\n}\n#else\ncolor.rgb /= color.a;\n#endif\ngl_FragColor = color;\n#endif\n}\n";function TranslucentTileClassification(e){this._drawClassificationFBO=new FramebufferManager({createDepthAttachments:!1}),this._accumulationFBO=new FramebufferManager({createDepthAttachments:!1}),this._packFBO=new FramebufferManager,this._opaqueDepthStencilTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new ClearCommand({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new BoundingRectangle,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}function destroyTextures(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function destroyFramebuffers(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function updateTextures(e,t,i,n){destroyTextures(e),e._translucentDepthStencilTexture=new Texture({context:t,width:i,height:n,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST})}function updateFramebuffers$1(e,t,i,n){destroyFramebuffers(e),e._drawClassificationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._drawClassificationFBO.update(t,i,n),e._accumulationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._accumulationFBO.update(t,i,n),e._packFBO.update(t,i,n)}function updateResources(e,t,i,n){if(!e.isSupported())return;e._opaqueDepthStencilTexture=n;const r=e._opaqueDepthStencilTexture.width,o=e._opaqueDepthStencilTexture.height;let a,s;if(e._drawClassificationFBO.isDirty(r,o)&&(updateTextures(e,t,r,o),updateFramebuffers$1(e,t,r,o)),defined(e._packDepthCommand)||(a=new ShaderSource({sources:[CompareAndPackTranslucentDepth]}),s={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e})),!defined(e._compositeCommand)){a=new ShaderSource({sources:[CompositeTranslucentClassification]}),s={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e});const i=e._compositeCommand,n=i.shaderProgram,r=t.shaderCache.createDerivedShaderProgram(n,"pick",{vertexShaderSource:n.vertexShaderSource,fragmentShaderSource:new ShaderSource({sources:a.sources,defines:["PICK"]}),attributeLocations:n._attributeLocations}),o=DrawCommand.shallowClone(i);o.shaderProgram=r,i.derivedCommands.pick=o}defined(e._copyCommand)||(a=new ShaderSource({sources:[CompositeTranslucentClassification]}),s={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e})),defined(e._accumulateCommand)||(a=new ShaderSource({sources:[CompositeTranslucentClassification]}),s={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e})),e._viewport.width=r,e._viewport.height=o;const c=!BoundingRectangle.equals(e._viewport,i.viewport);let l=c!==e._useScissorTest;e._useScissorTest=c,BoundingRectangle.equals(e._scissorRectangle,i.viewport)||(e._scissorRectangle=BoundingRectangle.clone(i.viewport,e._scissorRectangle),l=!0),defined(e._rsDepth)&&BoundingRectangle.equals(e._viewport,e._rsDepth.viewport)&&!l||(e._rsDepth=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),defined(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),defined(e._rsAccumulate)&&BoundingRectangle.equals(e._viewport,e._rsAccumulate.viewport)&&!l||(e._rsAccumulate=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,reference:StencilConstants$1.CESIUM_3D_TILE_MASK}})),defined(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),defined(e._rsComp)&&BoundingRectangle.equals(e._viewport,e._rsComp.viewport)&&!l||(e._rsComp=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:BlendingState$1.ALPHA_BLEND})),defined(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}function clear(e,t,i){if(!e._hasTranslucentDepth)return;const n=i.framebuffer;i.framebuffer=e._drawClassificationFBO.framebuffer,e._clearColorCommand.execute(t._context,i),i.framebuffer=n,e._frustumsDrawn>1&&(i.framebuffer=e._accumulationFBO.framebuffer,e._clearColorCommand.execute(t._context,i)),e._hasTranslucentDepth=!1,e._frustumsDrawn=0}function CommandExtent(){this.command=void 0,this.near=void 0,this.far=void 0}function View(e,t,i){const n=e.context;let r,o;n.depthTexture&&(r=new GlobeDepth),e._useOIT&&n.depthTexture&&(o=new OIT(n));const a=new PassState(n);a.viewport=BoundingRectangle.clone(i),this.camera=t,this._cameraClone=Camera.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=i,this.passState=a,this.pickFramebuffer=new PickFramebuffer(n),this.pickDepthFramebuffer=new PickDepthFramebuffer,this.sceneFramebuffer=new SceneFramebuffer,this.globeDepth=r,this.globeTranslucencyFramebuffer=new GlobeTranslucencyFramebuffer,this.oit=o,this.translucentTileClassification=new TranslucentTileClassification(n),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}Object.defineProperties(TranslucentTileClassification.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}}),TranslucentTileClassification.prototype.executeTranslucentCommands=function(e,t,i,n,r){const o=n.length;let a,s;const c=e.frameState.useLogDepth,l=e.context,u=i.framebuffer;for(s=0;s<o;++s)if(a=n[s],a=c?a.derivedCommands.logDepth.command:a,a.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(this._hasTranslucentDepth){for(updateResources(this,l,i,r),i.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(l,i),s=0;s<o;++s){if(a=n[s],a=c?a.derivedCommands.logDepth.command:a,!a.depthForTranslucentClassification)continue;t(a.derivedCommands.depth.depthOnlyCommand,e,l,i)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(i.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(l,i)),i.framebuffer=u}},TranslucentTileClassification.prototype.executeClassificationCommands=function(e,t,i,n){if(!this._hasTranslucentDepth)return;const r=e.context,o=r.uniformState,a=i.framebuffer;2===this._frustumsDrawn&&(i.framebuffer=this._accumulationFBO.framebuffer,this._copyCommand.execute(r,i)),i.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(r,i),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION);const s=o.globeDepthTexture;o.globeDepthTexture=this._packFBO.getColorTexture();const c=n.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],l=n.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION];for(let n=0;n<l;++n)t(c[n],e,r,i);o.globeDepthTexture=s,i.framebuffer=a,1!==this._frustumsDrawn&&(i.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(r,i),i.framebuffer=a)},TranslucentTileClassification.prototype.execute=function(e,t){if(!this._hasTranslucentDepth)return;1===this._frustumsDrawn?this._textureToComposite=this._drawClassificationFBO.getColorTexture():this._textureToComposite=this._accumulationFBO.getColorTexture();(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),clear(this,e,t)},TranslucentTileClassification.prototype.isSupported=function(){return this._supported},TranslucentTileClassification.prototype.isDestroyed=function(){return!1},TranslucentTileClassification.prototype.destroy=function(){return destroyTextures(this),destroyFramebuffers(this),defined(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),defined(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),destroyObject(this)};const scratchPosition0=new Cartesian3,scratchPosition1=new Cartesian3;function maxComponent(e,t){const i=Math.max(Math.abs(e.x),Math.abs(t.x)),n=Math.max(Math.abs(e.y),Math.abs(t.y)),r=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(i,n),r)}function cameraEqual(e,t,i){const n=1/Math.max(1,maxComponent(e.position,t.position));return Cartesian3.multiplyByScalar(e.position,n,scratchPosition0),Cartesian3.multiplyByScalar(t.position,n,scratchPosition1),Cartesian3.equalsEpsilon(scratchPosition0,scratchPosition1,i)&&Cartesian3.equalsEpsilon(e.direction,t.direction,i)&&Cartesian3.equalsEpsilon(e.up,t.up,i)&&Cartesian3.equalsEpsilon(e.right,t.right,i)&&Matrix4.equalsEpsilon(e.transform,t.transform,i)&&e.frustum.equalsEpsilon(t.frustum,i)}function updateFrustums(e,t,i,n){const r=t.frameState,o=r.camera,a=r.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,s=t.mode===SceneMode$1.SCENE2D,c=t.nearToFarDistance2D;let l;n*=1+CesiumMath.EPSILON2,i=Math.min(Math.max(i,o.frustum.near),o.frustum.far),n=Math.max(Math.min(n,o.frustum.far),i),s?(n=Math.min(n,o.position.z+t.nearToFarDistance2D),i=Math.min(i,n),l=Math.ceil(Math.max(1,n-i)/t.nearToFarDistance2D)):l=Math.ceil(Math.log(n/i)/Math.log(a));const u=e.frustumCommandsList;u.length=l;for(let e=0;e<l;++e){let t,r;s?(t=Math.min(n-c,i+e*c),r=Math.min(n,t+c)):(t=Math.max(i,Math.pow(a,e)*i),r=Math.min(n,a*t));let o=u[e];defined(o)?(o.near=t,o.far=r):o=u[e]=new FrustumCommands(t,r)}}function insertIntoBin(e,t,i,n,r){t.debugShowFrustums&&(i.debugOverlappingFrustums=0);const o=e.frustumCommandsList,a=o.length;for(let e=0;e<a;++e){const a=o[e],s=a.near;if(n>a.far)continue;if(r<s)break;const c=i.pass,l=a.indices[c]++;if(a.commands[c][l]=i,t.debugShowFrustums&&(i.debugOverlappingFrustums|=1<<e),i.executeInClosestFrustum)break}if(t.debugShowFrustums){const t=e.debugFrustumStatistics.commandsInFrustums;t[i.debugOverlappingFrustums]=defined(t[i.debugOverlappingFrustums])?t[i.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(i)}View.prototype.checkForCameraUpdates=function(e){const t=this.camera,i=this._cameraClone;return cameraEqual(t,i,CesiumMath.EPSILON15)?(this._cameraStartFired&&getTimestamp$1()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=getTimestamp$1(),Camera.clone(t,i),!0)};const scratchCullingVolume$1=new CullingVolume,scratchNearFarInterval=new Interval;View.prototype.createPotentiallyVisibleSet=function(e){const t=e.frameState,i=t.camera,n=i.directionWC,r=i.positionWC,o=e._computeCommandList,a=e._overlayCommandList,s=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const c=this.frustumCommandsList,l=c.length,u=Pass$1.NUMBER_OF_PASSES;for(let e=0;e<l;++e)for(let t=0;t<u;++t)c[e].indices[t]=0;o.length=0,a.length=0;const d=this._commandExtents,h=d.length;let p=0,f=+Number.MAX_VALUE,m=-Number.MAX_VALUE;const g=t.shadowState.shadowsEnabled;let _=+Number.MAX_VALUE,y=-Number.MAX_VALUE,C=Number.MAX_VALUE;const T=t.mode===SceneMode$1.SCENE3D?t.occluder:void 0;let S=t.cullingVolume;const v=scratchCullingVolume$1.planes;for(let e=0;e<5;++e)v[e]=S.planes[e];S=scratchCullingVolume$1;const A=s.length;for(let t=0;t<A;++t){const c=s[t],l=c.pass;if(l===Pass$1.COMPUTE)o.push(c);else if(l===Pass$1.OVERLAY)a.push(c);else{let t,o;const a=c.boundingVolume;if(defined(a)){if(!e.isVisible(c,S,T))continue;const i=a.computePlaneDistances(r,n,scratchNearFarInterval);if(t=i.start,o=i.stop,f=Math.min(f,t),m=Math.max(m,o),g&&c.receiveShadows&&t<ShadowMap.MAXIMUM_DISTANCE&&!(l===Pass$1.GLOBE&&t<-100&&o>100)){const e=o-t;l!==Pass$1.GLOBE&&t<100&&(C=Math.min(C,e)),_=Math.min(_,t),y=Math.max(y,o)}}else c instanceof ClearCommand?(t=i.frustum.near,o=i.frustum.far):(t=i.frustum.near,o=i.frustum.far,f=Math.min(f,t),m=Math.max(m,o));let s=d[p];defined(s)||(s=d[p]=new CommandExtent),s.command=c,s.near=t,s.far=o,p++}}let E,b;for(g&&(_=Math.min(Math.max(_,i.frustum.near),i.frustum.far),y=Math.max(Math.min(y,i.frustum.far),_)),g&&(t.shadowState.nearPlane=_,t.shadowState.farPlane=y,t.shadowState.closestObjectSize=C),updateFrustums(this,e,f,m),E=0;E<p;E++)b=d[E],insertIntoBin(this,e,b.command,b.near,b.far);if(p<h)for(E=p;E<h&&(b=d[E],defined(b.command));E++)b.command=void 0;const x=c.length,P=t.frustumSplits;P.length=x+1;for(let e=0;e<x;++e)P[e]=c[e].near,e===x-1&&(P[e+1]=c[e].far)},View.prototype.destroy=function(){let e;this.pickFramebuffer=this.pickFramebuffer&&this.pickFramebuffer.destroy(),this.pickDepthFramebuffer=this.pickDepthFramebuffer&&this.pickDepthFramebuffer.destroy(),this.sceneFramebuffer=this.sceneFramebuffer&&this.sceneFramebuffer.destroy(),this.globeDepth=this.globeDepth&&this.globeDepth.destroy(),this.oit=this.oit&&this.oit.destroy(),this.translucentTileClassification=this.translucentTileClassification&&this.translucentTileClassification.destroy(),this.globeTranslucencyFramebuffer=this.globeTranslucencyFramebuffer&&this.globeTranslucencyFramebuffer.destroy();const t=this.pickDepths,i=t.length;for(e=0;e<i;++e)t[e].destroy()};const offscreenDefaultWidth=.1,mostDetailedPreloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PRELOAD}),mostDetailedPickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PICK}),pickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PICK});function Picking(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new BoundingRectangle(0,0,1,1),i=new Camera(e);i.frustum=new OrthographicFrustum({width:offscreenDefaultWidth,aspectRatio:1,near:.1}),this._pickOffscreenView=new View(e,i,t)}Picking.prototype.update=function(){this._pickPositionCacheDirty=!0},Picking.prototype.getPickDepth=function(e,t){const i=e.view.pickDepths;let n=i[t];return defined(n)||(n=new PickDepth,i[t]=n),n};const scratchOrthoPickingFrustum=new OrthographicOffCenterFrustum,scratchOrthoOrigin=new Cartesian3,scratchOrthoDirection=new Cartesian3,scratchOrthoPixelSize=new Cartesian2,scratchOrthoPickVolumeMatrix4=new Matrix4;function getPickOrthographicCullingVolume(e,t,i,n,r){const o=e.camera;let a=o.frustum;defined(a._offCenterFrustum)&&(a=a._offCenterFrustum);let s=2*(t.x-r.x)/r.width-1;s*=.5*(a.right-a.left);let c=2*(r.height-t.y-r.y)/r.height-1;c*=.5*(a.top-a.bottom);const l=Matrix4.clone(o.transform,scratchOrthoPickVolumeMatrix4);o._setTransform(Matrix4.IDENTITY);const u=Cartesian3.clone(o.position,scratchOrthoOrigin);Cartesian3.multiplyByScalar(o.right,s,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),Cartesian3.multiplyByScalar(o.up,c,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),o._setTransform(l),e.mode===SceneMode$1.SCENE2D&&Cartesian3.fromElements(u.z,u.x,u.y,u);const d=a.getPixelDimensions(r.width,r.height,1,1,scratchOrthoPixelSize),h=scratchOrthoPickingFrustum;return h.right=.5*d.x,h.left=-h.right,h.top=.5*d.y,h.bottom=-h.top,h.near=a.near,h.far=a.far,h.computeCullingVolume(u,o.directionWC,o.upWC)}const scratchPerspPickingFrustum=new PerspectiveOffCenterFrustum,scratchPerspPixelSize=new Cartesian2;function getPickPerspectiveCullingVolume(e,t,i,n,r){const o=e.camera,a=o.frustum,s=a.near,c=Math.tan(.5*a.fovy),l=a.aspectRatio*c,u=(2*(t.x-r.x)/r.width-1)*s*l,d=(2*(r.height-t.y-r.y)/r.height-1)*s*c,h=a.getPixelDimensions(r.width,r.height,1,1,scratchPerspPixelSize),p=h.x*i*.5,f=h.y*n*.5,m=scratchPerspPickingFrustum;return m.top=d+f,m.bottom=d-f,m.right=u+p,m.left=u-p,m.near=s,m.far=a.far,m.computeCullingVolume(o.positionWC,o.directionWC,o.upWC)}function getPickCullingVolume(e,t,i,n,r){const o=e.camera.frustum;return o instanceof OrthographicFrustum||o instanceof OrthographicOffCenterFrustum?getPickOrthographicCullingVolume(e,t,i,n,r):getPickPerspectiveCullingVolume(e,t,i,n,r)}let scratchRectangleWidth=3,scratchRectangleHeight=3,scratchRectangle=new BoundingRectangle(0,0,scratchRectangleWidth,scratchRectangleHeight);const scratchPosition$1=new Cartesian2,scratchColorZero=new Color(0,0,0,0);function renderTranslucentDepthForPick(e,t){const i=e.context,n=e.frameState,r=e.environmentState,o=e.defaultView;e.view=o;const a=o.viewport;a.x=0,a.y=0,a.width=i.drawingBufferWidth,a.height=i.drawingBufferHeight;let s=o.passState;s.viewport=BoundingRectangle.clone(a,s.viewport),e.clearPasses(n.passes),n.passes.pick=!0,n.passes.depth=!0,n.cullingVolume=getPickCullingVolume(e,t,1,1,a),n.tilesetPassState=pickTilesetPassState,e.updateEnvironment(),r.renderTranslucentDepthForPick=!0,s=o.pickDepthFramebuffer.update(i,t,a),e.updateAndExecuteCommands(s,scratchColorZero),e.resolveFramebuffers(s),i.endFrame()}Picking.prototype.pick=function(e,t,i,n){scratchRectangleWidth=defaultValue(i,3),scratchRectangleHeight=defaultValue(n,scratchRectangleWidth);const r=e.context,o=r.uniformState,a=e.frameState,s=e.defaultView;e.view=s;const c=s.viewport;c.x=0,c.y=0,c.width=r.drawingBufferWidth,c.height=r.drawingBufferHeight;let l=s.passState;l.viewport=BoundingRectangle.clone(c,l.viewport);const u=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition$1);e.jobScheduler.disableThisFrame(),e.updateFrameState(),a.cullingVolume=getPickCullingVolume(e,u,scratchRectangleWidth,scratchRectangleHeight,c),a.invertClassification=!1,a.passes.pick=!0,a.tilesetPassState=pickTilesetPassState,o.update(a),e.updateEnvironment(),scratchRectangle.x=u.x-.5*(scratchRectangleWidth-1),scratchRectangle.y=e.drawingBufferHeight-u.y-.5*(scratchRectangleHeight-1),scratchRectangle.width=scratchRectangleWidth,scratchRectangle.height=scratchRectangleHeight,l=s.pickFramebuffer.begin(scratchRectangle,s.viewport),e.updateAndExecuteCommands(l,scratchColorZero),e.resolveFramebuffers(l);const d=s.pickFramebuffer.end(scratchRectangle);return r.endFrame(),d};const scratchPerspectiveFrustum$1=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum$1=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum$1=new OrthographicFrustum,scratchOrthographicOffCenterFrustum$1=new OrthographicOffCenterFrustum;Picking.prototype.pickPositionWorldCoordinates=function(e,t,i){if(!e.useDepthPicking)return;const n=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(n))return Cartesian3.clone(this._pickPositionCache[n],i);const r=e.frameState,o=e.context,a=o.uniformState,s=e.defaultView;e.view=s;const c=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition$1);e.pickTranslucentDepth?renderTranslucentDepthForPick(e,c):(e.updateFrameState(),a.update(r),e.updateEnvironment()),c.y=e.drawingBufferHeight-c.y;const l=e.camera;let u;u=defined(l.frustum.fov)?l.frustum.clone(scratchPerspectiveFrustum$1):defined(l.frustum.infiniteProjectionMatrix)?l.frustum.clone(scratchPerspectiveOffCenterFrustum$1):defined(l.frustum.width)?l.frustum.clone(scratchOrthographicFrustum$1):l.frustum.clone(scratchOrthographicOffCenterFrustum$1);const d=s.frustumCommandsList,h=d.length;for(let t=0;t<h;++t){const s=this.getPickDepth(e,t).getDepth(o,c.x,c.y);if(defined(s)&&(s>0&&s<1)){const o=d[t];let h;return e.mode===SceneMode$1.SCENE2D?(h=l.position.z,l.position.z=h-o.near+1,u.far=Math.max(1,o.far-o.near),u.near=1,a.update(r),a.updateFrustum(u)):(u.near=o.near*(0!==t?e.opaqueFrustumNearOffset:1),u.far=o.far,a.updateFrustum(u)),i=SceneTransforms.drawingBufferToWgs84Coordinates(e,c,s,i),e.mode===SceneMode$1.SCENE2D&&(l.position.z=h,a.update(r)),this._pickPositionCache[n]=Cartesian3.clone(i),i}}this._pickPositionCache[n]=void 0};const scratchPickPositionCartographic=new Cartographic;function drillPick(e,t){let i,n;const r=[],o=[],a=[],s=[];defined(e)||(e=Number.MAX_VALUE);let c=t();for(;defined(c);){const i=c.object,l=c.position,u=c.exclude;if(defined(l)&&!defined(i)){r.push(c);break}if(!defined(i)||!defined(i.primitive))break;if(!u&&(r.push(c),0>=--e))break;const d=i.primitive;let h=!1;"function"==typeof d.getGeometryInstanceAttributes&&defined(i.id)&&(n=d.getGeometryInstanceAttributes(i.id),defined(n)&&defined(n.show)&&(h=!0,n.show=ShowGeometryInstanceAttribute.toValue(!1,n.show),a.push(n))),i instanceof Cesium3DTileFeature&&(h=!0,i.show=!1,s.push(i)),h||(d.show=!1,o.push(d)),c=t()}for(i=0;i<o.length;++i)o[i].show=!0;for(i=0;i<a.length;++i)n=a[i],n.show=ShowGeometryInstanceAttribute.toValue(!0,n.show);for(i=0;i<s.length;++i)s[i].show=!0;return r}Picking.prototype.pickPosition=function(e,t,i){if(defined(i=this.pickPositionWorldCoordinates(e,t,i))&&e.mode!==SceneMode$1.SCENE3D){Cartesian3.fromElements(i.y,i.z,i.x,i);const t=e.mapProjection,n=t.ellipsoid,r=t.unproject(i,scratchPickPositionCartographic);n.cartographicToCartesian(r,i)}return i},Picking.prototype.drillPick=function(e,t,i,n,r){const o=this,a=drillPick(i,(function(){const i=o.pick(e,t,n,r);if(defined(i))return{object:i,position:void 0,exclude:!1}}));return a.map((function(e){return e.object}))};const scratchRight=new Cartesian3,scratchUp=new Cartesian3;function MostDetailedRayPick(e,t,i){this.ray=e,this.width=t,this.tilesets=i,this.ready=!1,this.deferred=defer(),this.promise=this.deferred.promise}function updateOffscreenCameraFromRay(e,t,i,n){const r=t.direction,o=Cartesian3.mostOrthogonalAxis(r,scratchRight),a=Cartesian3.cross(r,o,scratchRight),s=Cartesian3.cross(r,a,scratchUp);return n.position=t.origin,n.direction=r,n.up=s,n.right=a,n.frustum.width=defaultValue(i,offscreenDefaultWidth),n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC)}function updateMostDetailedRayPick(e,t,i){const n=t.frameState,r=i.ray,o=i.width,a=i.tilesets,s=e._pickOffscreenView.camera,c=updateOffscreenCameraFromRay(e,r,o,s),l=mostDetailedPreloadTilesetPassState;l.camera=s,l.cullingVolume=c;let u=!0;const d=a.length;for(let e=0;e<d;++e){const i=a[e];i.show&&t.primitives.contains(i)&&(i.updateForPass(n,l),u=u&&l.ready)}return u&&i.deferred.resolve(),u}function getTilesets(e,t,i){const n=e.length;for(let r=0;r<n;++r){const n=e.get(r);n.show&&(defined(n.isCesium3DTileset)?defined(t)&&-1!==t.indexOf(n)||i.push(n):n instanceof PrimitiveCollection&&getTilesets(n,t,i))}}function launchMostDetailedRayPick(e,t,i,n,r,o){const a=[];if(getTilesets(t.primitives,n,a),0===a.length)return Promise.resolve(o());const s=new MostDetailedRayPick(i,r,a);return e._mostDetailedRayPicks.push(s),s.promise.then((function(){return o()}))}function isExcluded(e,t){return!(!defined(e)||!defined(t)||0===t.length)&&(t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1)}function getRayIntersection(e,t,i,n,r,o,a){const s=t.context,c=s.uniformState,l=t.frameState,u=e._pickOffscreenView;t.view=u,updateOffscreenCameraFromRay(e,i,r,u.camera),scratchRectangle=BoundingRectangle.clone(u.viewport,scratchRectangle);const d=u.pickFramebuffer.begin(scratchRectangle,u.viewport);let h;t.jobScheduler.disableThisFrame(),t.updateFrameState(),l.invertClassification=!1,l.passes.pick=!0,l.passes.offscreen=!0,l.tilesetPassState=a?mostDetailedPickTilesetPassState:pickTilesetPassState,c.update(l),t.updateEnvironment(),t.updateAndExecuteCommands(d,scratchColorZero),t.resolveFramebuffers(d);const p=u.pickFramebuffer.end(scratchRectangle);if(t.context.depthTexture){const n=u.frustumCommandsList.length;for(let r=0;r<n;++r){const n=e.getPickDepth(t,r).getDepth(s,0,0);if(defined(n)&&(n>0&&n<1)){const e=u.frustumCommandsList[r],o=e.near*(0!==r?t.opaqueFrustumNearOffset:1),a=o+n*(e.far-o);h=Ray.getPoint(i,a);break}}}if(t.view=t.defaultView,s.endFrame(),defined(p)||defined(h))return{object:p,position:h,exclude:!defined(h)&&o||isExcluded(p,n)}}function getRayIntersections(e,t,i,n,r,o,a,s){return drillPick(n,(function(){return getRayIntersection(e,t,i,r,o,a,s)}))}function pickFromRay(e,t,i,n,r,o,a){const s=getRayIntersections(e,t,i,1,n,r,o,a);if(s.length>0)return s[0]}function drillPickFromRay(e,t,i,n,r,o,a,s){return getRayIntersections(e,t,i,n,r,o,a,s)}function deferPromiseUntilPostRender(e,t){const i=defer();return t.then((function(t){const n=e.postRender.addEventListener((function(){i.resolve(t),n()}));e.requestRender()})).catch((function(e){i.reject(e)})),i.promise}Picking.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let i=0;i<t.length;++i)updateMostDetailedRayPick(this,e,t[i])&&t.splice(i--,1)},Picking.prototype.pickFromRay=function(e,t,i,n){return pickFromRay(this,e,t,i,n,!1,!1)},Picking.prototype.drillPickFromRay=function(e,t,i,n,r){return drillPickFromRay(this,e,t,i,n,r,!1,!1)},Picking.prototype.pickFromRayMostDetailed=function(e,t,i,n){const r=this;return t=Ray.clone(t),i=defined(i)?i.slice():i,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(r,e,t,i,n,(function(){return pickFromRay(r,e,t,i,n,!1,!0)})))},Picking.prototype.drillPickFromRayMostDetailed=function(e,t,i,n,r){const o=this;return t=Ray.clone(t),n=defined(n)?n.slice():n,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(o,e,t,n,r,(function(){return drillPickFromRay(o,e,t,i,n,r,!1,!0)})))};const scratchSurfacePosition=new Cartesian3,scratchSurfaceNormal$1=new Cartesian3,scratchSurfaceRay=new Ray,scratchCartographic$2=new Cartographic;function getRayForSampleHeight(e,t){const i=e.globe,n=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid,r=ApproximateTerrainHeights._defaultMaxTerrainHeight,o=n.geodeticSurfaceNormalCartographic(t,scratchSurfaceNormal$1),a=Cartographic.toCartesian(t,n,scratchSurfacePosition),s=scratchSurfaceRay;s.origin=a,s.direction=o;const c=new Ray;return Ray.getPoint(s,r,c.origin),Cartesian3.negate(o,c.direction),c}function getRayForClampToHeight(e,t){const i=e.globe,n=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid;return getRayForSampleHeight(e,Cartographic.fromCartesian(t,n,scratchCartographic$2))}function getHeightFromCartesian(e,t){const i=e.globe,n=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid;return Cartographic.fromCartesian(t,n,scratchCartographic$2).height}function sampleHeightMostDetailed(e,t,i,n,r){const o=getRayForSampleHeight(t,i);return launchMostDetailedRayPick(e,t,o,n,r,(function(){const i=pickFromRay(e,t,o,n,r,!0,!0);if(defined(i))return getHeightFromCartesian(t,i.position)}))}function clampToHeightMostDetailed(e,t,i,n,r,o){const a=getRayForClampToHeight(t,i);return launchMostDetailedRayPick(e,t,a,n,r,(function(){const i=pickFromRay(e,t,a,n,r,!0,!0);if(defined(i))return Cartesian3.clone(i.position,o)}))}Picking.prototype.sampleHeight=function(e,t,i,n){const r=pickFromRay(this,e,getRayForSampleHeight(e,t),i,n,!0,!1);if(defined(r))return getHeightFromCartesian(e,r.position)},Picking.prototype.clampToHeight=function(e,t,i,n,r){const o=pickFromRay(this,e,getRayForClampToHeight(e,t),i,n,!0,!1);if(defined(o))return Cartesian3.clone(o.position,r)},Picking.prototype.sampleHeightMostDetailed=function(e,t,i,n){i=defined(i)?i.slice():i;const r=t.length,o=new Array(r);for(let a=0;a<r;++a)o[a]=sampleHeightMostDetailed(this,e,t[a],i,n);return deferPromiseUntilPostRender(e,Promise.all(o).then((function(e){const i=e.length;for(let n=0;n<i;++n)t[n].height=e[n];return t})))},Picking.prototype.clampToHeightMostDetailed=function(e,t,i,n){i=defined(i)?i.slice():i;const r=t.length,o=new Array(r);for(let a=0;a<r;++a)o[a]=clampToHeightMostDetailed(this,e,t[a],i,n,t[a]);return deferPromiseUntilPostRender(e,Promise.all(o).then((function(e){const i=e.length;for(let n=0;n<i;++n)t[n]=e[n];return t})))},Picking.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const PostProcessStageSampleMode={NEAREST:0,LINEAR:1};function PostProcessStage(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).fragmentShader,i=defaultValue(e.textureScale,1),n=defaultValue(e.pixelFormat,PixelFormat$1.RGBA);this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=i,this._forcePowerOfTwo=defaultValue(e.forcePowerOfTwo,!1),this._sampleMode=defaultValue(e.sampleMode,PostProcessStageSampleMode.NEAREST),this._pixelFormat=n,this._pixelDatatype=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),this._clearColor=defaultValue(e.clearColor,Color.BLACK),this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;const r=new PassState;r.scissorTest={enabled:!0,rectangle:defined(e.scissorRectangle)?BoundingRectangle.clone(e.scissorRectangle):new BoundingRectangle},this._passState=r,this._ready=!1;let o=e.name;defined(o)||(o=createGuid()),this._name=o,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties(PostProcessStage.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},fragmentShader:{get:function(){return this._fragmentShader}},uniforms:{get:function(){return this._uniforms}},textureScale:{get:function(){return this._textureScale}},forcePowerOfTwo:{get:function(){return this._forcePowerOfTwo}},sampleMode:{get:function(){return this._sampleMode}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},clearColor:{get:function(){return this._clearColor}},scissorRectangle:{get:function(){return this._passState.scissorTest.rectangle}},outputTexture:{get:function(){if(defined(this._textureCache)){const e=this._textureCache.getFramebuffer(this._name);if(defined(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});const depthTextureRegex=/uniform\s+sampler2D\s+depthTexture/g;function getUniformValueGetterAndSetter(e,t,i){const n=t[i];return("string"==typeof n||n instanceof HTMLCanvasElement||n instanceof HTMLImageElement||n instanceof HTMLVideoElement||n instanceof ImageData)&&e._dirtyUniforms.push(i),{get:function(){return t[i]},set:function(n){const r=t[i];t[i]=n;const o=e._actualUniforms,a=o[i];defined(a)&&a!==r&&a instanceof Texture&&!defined(e._textureCache.getStageByName(i))&&(e._texturesToRelease.push(a),delete o[i],delete o[`${i}Dimensions`]),r instanceof Texture&&e._texturesToRelease.push(r),"string"==typeof n||n instanceof HTMLCanvasElement||n instanceof HTMLImageElement||n instanceof HTMLVideoElement||n instanceof ImageData?e._dirtyUniforms.push(i):o[i]=n}}}function getUniformMapFunction(e,t){return function(){const i=e._actualUniforms[t];return"function"==typeof i?i():i}}function getUniformMapDimensionsFunction(e,t){return function(){const i=e[t]();if(defined(i))return i.dimensions}}function createUniformMap(e){if(defined(e._uniformMap))return;const t={},i={},n=e._uniforms,r=e._actualUniforms;for(const o in n)if(n.hasOwnProperty(o)){"function"!=typeof n[o]?(t[o]=getUniformMapFunction(e,o),i[o]=getUniformValueGetterAndSetter(e,n,o)):(t[o]=n[o],i[o]=n[o]),r[o]=n[o];const a=t[o]();("string"==typeof a||a instanceof Texture||a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement)&&(t[`${o}Dimensions`]=getUniformMapDimensionsFunction(t,o))}e._uniforms={},Object.defineProperties(e._uniforms,i),e._uniformMap=combine$2(t,{colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions},depthTexture:function(){return e._depthTexture},depthTextureDimensions:function(){return e._depthTexture.dimensions},czm_idTexture:function(){return e._idTexture},czm_selectedIdTexture:function(){return e._selectedIdTexture},czm_selectedIdTextureStep:function(){return 1/e._selectedIdTexture.width}})}function createDrawCommand(e,t){if(defined(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let i=e._fragmentShader;if(defined(e._selectedIdTexture)){const t=e._selectedIdTexture.width;i=i.replace(/varying\s+vec2\s+v_textureCoordinates;/g,""),i=`#define CZM_SELECTED_FEATURE \nuniform sampler2D czm_idTexture; \nuniform sampler2D czm_selectedIdTexture; \nuniform float czm_selectedIdTextureStep; \nvarying vec2 v_textureCoordinates; \nbool czm_selected(vec2 offset) \n{ \n bool selected = false;\n vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset); \n for (int i = 0; i < ${t}; ++i) \n { \n vec4 selectedId = texture2D(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5)); \n if (all(equal(id, selectedId))) \n { \n return true; \n } \n } \n return false; \n} \n\nbool czm_selected() \n{ \n return czm_selected(vec2(0.0)); \n} \n\n${i}`}const n=new ShaderSource({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[i]});e._command=t.createViewportQuadCommand(n,{uniformMap:e._uniformMap,owner:e})}function createSampler(e){let t,i;e._sampleMode===PostProcessStageSampleMode.LINEAR?(t=TextureMinificationFilter$1.LINEAR,i=TextureMagnificationFilter$1.LINEAR):(t=TextureMinificationFilter$1.NEAREST,i=TextureMagnificationFilter$1.NEAREST);const n=e._sampler;defined(n)&&n.minificationFilter===t&&n.magnificationFilter===i||(e._sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:t,magnificationFilter:i}))}function createLoadImageFunction(e,t){return function(i){e._texturesToCreate.push({name:t,source:i})}}function createStageOutputTextureFunction(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function updateUniformTextures(e,t){let i,n,r;const o=e._texturesToRelease;let a=o.length;for(i=0;i<a;++i)n=o[i],n=n&&n.destroy();o.length=0;const s=e._texturesToCreate;for(a=s.length,i=0;i<a;++i){const n=s[i];r=n.name;const o=n.source;e._actualUniforms[r]=new Texture({context:t,source:o})}s.length=0;const c=e._dirtyUniforms;if(0===c.length&&!defined(e._texturePromise))return void(e._ready=!0);if(0===c.length||defined(e._texturePromise))return;a=c.length;const l=e._uniforms,u=[];for(i=0;i<a;++i){r=c[i];const t=l[r];if(defined(e._textureCache.getStageByName(t)))e._actualUniforms[r]=createStageOutputTextureFunction(e,t);else if("string"==typeof t){const i=new Resource({url:t});u.push(i.fetchImage().then(createLoadImageFunction(e,r)))}else e._texturesToCreate.push({name:r,source:t})}c.length=0,u.length>0?(e._ready=!1,e._texturePromise=Promise.all(u).then((function(){e._ready=!0,e._texturePromise=void 0}))):e._ready=!0}function releaseResources$1(e){defined(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();const t=e._textureCache;if(!defined(t))return;const i=e._uniforms,n=e._actualUniforms;for(const r in n)n.hasOwnProperty(r)&&n[r]instanceof Texture&&(defined(t.getStageByName(i[r]))||n[r].destroy(),e._dirtyUniforms.push(r))}function isSelectedTextureDirty$1(e){let t=defined(e._selected)?e._selected.length:0;const i=defined(e._parentSelected)?e._parentSelected:0;let n=e._selected!==e._selectedShadow||t!==e._selectedLength;if(n=n||e._parentSelected!==e._parentSelectedShadow||i!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!n&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let i=0;i<t;++i)if(e._combinedSelected[i]!==e._combinedSelectedShadow[i])return!0}return n}function createSelectedTexture(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;const i=e._combinedSelected;if(!defined(i))return;let n,r,o=0;const a=i.length;for(n=0;n<a;++n)r=i[n],defined(r.pickIds)?o+=r.pickIds.length:defined(r.pickId)&&++o;if(0===a||0===o){const i=new Uint8Array(4);return i[0]=255,i[1]=255,i[2]=255,i[3]=255,void(e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:i,width:1,height:1},sampler:Sampler.NEAREST}))}let s,c=0;const l=new Uint8Array(4*o);for(n=0;n<a;++n)if(r=i[n],defined(r.pickIds)){const e=r.pickIds,t=e.length;for(let i=0;i<t;++i)s=e[i].color,l[c]=Color.floatToByte(s.red),l[c+1]=Color.floatToByte(s.green),l[c+2]=Color.floatToByte(s.blue),l[c+3]=Color.floatToByte(s.alpha),c+=4}else defined(r.pickId)&&(s=r.pickId.color,l[c]=Color.floatToByte(s.red),l[c+1]=Color.floatToByte(s.green),l[c+2]=Color.floatToByte(s.blue),l[c+3]=Color.floatToByte(s.alpha),c+=4);e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:l,width:o,height:1},sampler:Sampler.NEAREST})}PostProcessStage.prototype._isSupported=function(e){return!depthTextureRegex.test(this._fragmentShader)||e.depthTexture},PostProcessStage.prototype.update=function(e,t){if(this.enabled===this._enabled||this.enabled||releaseResources$1(this),this._enabled=this.enabled,!this._enabled)return;if(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=isSelectedTextureDirty$1(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0,createSelectedTexture(this,e),createUniformMap(this),updateUniformTextures(this,e),createDrawCommand(this,e),createSampler(this),this._selectedDirty=!1,!this._ready)return;const i=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=i,!defined(i))return;const n=i.getColorTexture(0);let r;n.width===e.drawingBufferWidth&&n.height===e.drawingBufferHeight||(r=this._renderState,defined(r)&&n.width===r.viewport.width&&n.height===r.viewport.height||(this._renderState=RenderState.fromCache({viewport:new BoundingRectangle(0,0,n.width,n.height)}))),this._command.renderState=r},PostProcessStage.prototype.execute=function(e,t,i,n){if(!(defined(this._command)&&defined(this._command.framebuffer)&&this._ready&&this._enabled))return;this._colorTexture=t,this._depthTexture=i,this._idTexture=n,Sampler.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);const r=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;defined(r)&&(r.context=e),this._command.execute(e,r)},PostProcessStage.prototype.isDestroyed=function(){return!1},PostProcessStage.prototype.destroy=function(){return releaseResources$1(this),destroyObject(this)};var AcesTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\ncolor /= texture2D(autoExposure, vec2(0.5)).r;\n#endif\ncolor = czm_acesTonemapping(color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",AmbientOcclusionGenerate="uniform sampler2D randomTexture;\nuniform sampler2D depthTexture;\nuniform float intensity;\nuniform float bias;\nuniform float lengthCap;\nuniform float stepSize;\nuniform float frustumLength;\nvarying vec2 v_textureCoordinates;\nvec4 clipToEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);\nposEC = posEC / posEC.w;\nreturn posEC;\n}\nvec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)\n{\nvec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);\nvec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);\nvec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);\nvec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);\nvec3 up = posInCamera.xyz - posInCameraUp.xyz;\nvec3 down = posInCameraDown.xyz - posInCamera.xyz;\nvec3 left = posInCamera.xyz - posInCameraLeft.xyz;\nvec3 right = posInCameraRight.xyz - posInCamera.xyz;\nvec3 DX = length(left) < length(right) ? left : right;\nvec3 DY = length(up) < length(down) ? up : down;\nreturn normalize(cross(DY, DX));\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = clipToEye(v_textureCoordinates, depth);\nif (posInCamera.z > frustumLength)\n{\ngl_FragColor = vec4(1.0);\nreturn;\n}\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nfloat depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));\nfloat depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));\nfloat depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));\nfloat depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));\nvec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);\nfloat ao = 0.0;\nvec2 sampleDirection = vec2(1.0, 0.0);\nfloat gapAngle = 90.0 * czm_radiansPerDegree;\nfloat randomVal = texture2D(randomTexture, v_textureCoordinates).x;\nfor (int i = 0; i < 4; i++)\n{\nfloat newGapAngle = gapAngle * (float(i) + randomVal);\nfloat cosVal = cos(newGapAngle);\nfloat sinVal = sin(newGapAngle);\nvec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);\nfloat localAO = 0.0;\nfloat localStepSize = stepSize;\nfor (int j = 0; j < 6; j++)\n{\nvec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;\nif(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)\n{\nbreak;\n}\nfloat stepDepthInfo = czm_readDepth(depthTexture, newCoords);\nvec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);\nvec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;\nfloat len = length(diffVec);\nif (len > lengthCap)\n{\nbreak;\n}\nfloat dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );\nfloat weight = len / lengthCap;\nweight = 1.0 - weight * weight;\nif (dotVal < bias)\n{\ndotVal = 0.0;\n}\nlocalAO = max(localAO, dotVal * weight);\nlocalStepSize += stepSize;\n}\nao += localAO;\n}\nao /= 4.0;\nao = 1.0 - clamp(ao, 0.0, 1.0);\nao = pow(ao, intensity);\ngl_FragColor = vec4(vec3(ao), 1.0);\n}\n",AmbientOcclusionModulate="uniform sampler2D colorTexture;\nuniform sampler2D ambientOcclusionTexture;\nuniform bool ambientOcclusionOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;\ngl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;\n}\n",BlackAndWhite="uniform sampler2D colorTexture;\nuniform float gradations;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = vec4(rgb, 1.0);\nreturn;\n}\n#endif\nfloat luminance = czm_luminance(rgb);\nfloat darkness = luminance * gradations;\ndarkness = (darkness - fract(darkness)) / gradations;\ngl_FragColor = vec4(vec3(darkness), 1.0);\n}\n",BloomComposite="uniform sampler2D colorTexture;\nuniform sampler2D bloomTexture;\nuniform bool glowOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = color;\nreturn;\n}\n#endif\nvec4 bloom = texture2D(bloomTexture, v_textureCoordinates);\ngl_FragColor = glowOnly ? bloom : bloom + color;\n}\n",Brightness="uniform sampler2D colorTexture;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 target = vec3(0.0);\ngl_FragColor = vec4(mix(target, rgb, brightness), 1.0);\n}\n",ContrastBias="uniform sampler2D colorTexture;\nuniform float contrast;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;\nsceneColor = czm_RGBToHSB(sceneColor);\nsceneColor.z += brightness;\nsceneColor = czm_HSBToRGB(sceneColor);\nfloat factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\nsceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\ngl_FragColor = vec4(sceneColor, 1.0);\n}\n",DepthOfField="uniform sampler2D colorTexture;\nuniform sampler2D blurTexture;\nuniform sampler2D depthTexture;\nuniform float focalDistance;\nvarying vec2 v_textureCoordinates;\nvec4 toEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\nposInCamera = posInCamera / posInCamera.w;\nreturn posInCamera;\n}\nfloat computeDepthBlur(float depth)\n{\nfloat f;\nif (depth < focalDistance)\n{\nf = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);\n}\nelse\n{\nf = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);\nf = pow(f, 0.1);\n}\nf *= f;\nf = clamp(f, 0.0, 1.0);\nreturn pow(f, 0.5);\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = toEye(v_textureCoordinates, depth);\nfloat d = computeDepthBlur(-posInCamera.z);\ngl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);\n}\n",DepthView="uniform sampler2D depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\ngl_FragColor = vec4(vec3(depth), 1.0);\n}\n",EdgeDetection="uniform sampler2D depthTexture;\nuniform float length;\nuniform vec4 color;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat directions[3];\ndirections[0] = -1.0;\ndirections[1] = 0.0;\ndirections[2] = 1.0;\nfloat scalars[3];\nscalars[0] = 3.0;\nscalars[1] = 10.0;\nscalars[2] = 3.0;\nfloat padx = czm_pixelRatio / czm_viewport.z;\nfloat pady = czm_pixelRatio / czm_viewport.w;\n#ifdef CZM_SELECTED_FEATURE\nbool selected = false;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nselected = selected || czm_selected(vec2(-padx, dir * pady));\nselected = selected || czm_selected(vec2(padx, dir * pady));\nselected = selected || czm_selected(vec2(dir * padx, -pady));\nselected = selected || czm_selected(vec2(dir * padx, pady));\nif (selected)\n{\nbreak;\n}\n}\nif (!selected)\n{\ngl_FragColor = vec4(color.rgb, 0.0);\nreturn;\n}\n#endif\nfloat horizEdge = 0.0;\nfloat vertEdge = 0.0;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nfloat scale = scalars[i];\nhorizEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;\nhorizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;\nvertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;\nvertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;\n}\nfloat len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\ngl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);\n}\n",FilmicTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\nconst float A = 0.22;\nconst float B = 0.30;\nconst float C = 0.10;\nconst float D = 0.20;\nconst float E = 0.01;\nconst float F = 0.30;\nconst float white = 11.2;\nvec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;\nfloat w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;\nc = czm_inverseGamma(c / w);\ngl_FragColor = vec4(c, fragmentColor.a);\n}\n",FXAA="varying vec2 v_textureCoordinates;\nuniform sampler2D colorTexture;\nconst float fxaaQualitySubpix = 0.5;\nconst float fxaaQualityEdgeThreshold = 0.125;\nconst float fxaaQualityEdgeThresholdMin = 0.0833;\nvoid main()\n{\nvec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;\nvec4 color = FxaaPixelShader(\nv_textureCoordinates,\ncolorTexture,\nfxaaQualityRcpFrame,\nfxaaQualitySubpix,\nfxaaQualityEdgeThreshold,\nfxaaQualityEdgeThresholdMin);\nfloat alpha = texture2D(colorTexture, v_textureCoordinates).a;\ngl_FragColor = vec4(color.rgb, alpha);\n}\n",GaussianBlur1D="#define SAMPLES 8\nuniform float delta;\nuniform float sigma;\nuniform float direction;\nuniform sampler2D colorTexture;\n#ifdef USE_STEP_SIZE\nuniform float stepSize;\n#else\nuniform vec2 step;\n#endif\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nvec2 dir = vec2(1.0 - direction, direction);\n#ifdef USE_STEP_SIZE\nvec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));\n#else\nvec2 step = step;\n#endif\nvec3 g;\ng.x = 1.0 / (sqrt(czm_twoPi) * sigma);\ng.y = exp((-0.5 * delta * delta) / (sigma * sigma));\ng.z = g.y * g.y;\nvec4 result = texture2D(colorTexture, st) * g.x;\nfor (int i = 1; i < SAMPLES; ++i)\n{\ng.xy *= g.yz;\nvec2 offset = float(i) * dir * step;\nresult += texture2D(colorTexture, st - offset) * g.x;\nresult += texture2D(colorTexture, st + offset) * g.x;\n}\ngl_FragColor = result;\n}\n",LensFlare="uniform sampler2D colorTexture;\nuniform sampler2D dirtTexture;\nuniform sampler2D starTexture;\nuniform vec2 dirtTextureDimensions;\nuniform float distortion;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform float dirtAmount;\nuniform float earthRadius;\nuniform float intensity;\nvarying vec2 v_textureCoordinates;\n#define DISTANCE_TO_SPACE 6500000.0\nvec4 getNDCFromWC(vec3 WC, float earthRadius)\n{\nvec4 positionEC = czm_view * vec4(WC, 1.0);\npositionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nreturn czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n}\nfloat isInEarth(vec2 texcoord, vec2 sceneSize)\n{\nvec2 NDC = texcoord * 2.0 - 1.0;\nvec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);\nvec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);\nNDC.xy -= earthPosSC.xy;\nfloat X = abs(NDC.x) * sceneSize.x;\nfloat Y = abs(NDC.y) * sceneSize.y;\nreturn clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));\n}\nvec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)\n{\nvec2 sceneSize = czm_viewport.zw;\nvec3 color;\nif(isSpace)\n{\ncolor.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;\n}\nelse\n{\ncolor.r = texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = texture2D(tex, texcoord + direction * distortion.b).b;\n}\nreturn vec4(clamp(color, 0.0, 1.0), 0.0);\n}\nvoid main(void)\n{\nvec4 originalColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 rgb = originalColor.rgb;\nbool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;\nvec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);\nvec4 sunPositionEC = czm_view * sunPos;\nvec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);\nsunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);\nif(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))\n{\ngl_FragColor = originalColor;\nreturn;\n}\nvec2 texcoord = vec2(1.0) - v_textureCoordinates;\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nvec2 invPixelSize = 1.0 / pixelSize;\nvec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);\nvec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;\nvec3 direction = normalize(vec3(ghostVec, 0.0));\nvec4 result = vec4(0.0);\nvec4 ghost = vec4(0.0);\nfor (int i = 0; i < 4; ++i)\n{\nvec2 offset = fract(texcoord + ghostVec * float(i));\nghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);\n}\nresult += ghost;\nvec2 haloVec = normalize(ghostVec) * haloWidth;\nfloat weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\nweightForHalo = pow(1.0 - weightForHalo, 5.0);\nresult += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;\nvec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;\nif (dirtTexCoords.x > 1.0)\n{\ndirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);\n}\nif (dirtTexCoords.y > 1.0)\n{\ndirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);\n}\nresult += dirtAmount * texture2D(dirtTexture, dirtTexCoords);\nfloat camrot = czm_view[0].z + czm_view[1].y;\nfloat cosValue = cos(camrot);\nfloat sinValue = sin(camrot);\nmat3 rotation = mat3(\ncosValue, -sinValue, 0.0,\nsinValue, cosValue, 0.0,\n0.0, 0.0, 1.0\n);\nvec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);\nvec3 st2 = vec3((rotation * st1).xy, 1.0);\nvec3 st3 = st2 * 0.5 + vec3(0.5);\nvec2 lensStarTexcoord = st3.xy;\nfloat weightForLensFlare = length(vec3(sunPos.xy, 0.0));\nfloat oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);\nif (!isSpace)\n{\nresult *= oneMinusWeightForLensFlare * intensity * 0.2;\n}\nelse\n{\nresult *= oneMinusWeightForLensFlare * intensity;\nresult *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;\n}\nresult += texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = result;\n}\n",ModifiedReinhardTonemapping="uniform sampler2D colorTexture;\nuniform vec3 white;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = (color * (1.0 + color / white)) / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",NightVision="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nfloat rand(vec2 co)\n{\nreturn fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);\n}\nvoid main(void)\n{\nfloat noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 green = vec3(0.0, 1.0, 0.0);\ngl_FragColor = vec4((noiseValue + rgb) * green, 1.0);\n}\n",ReinhardTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = color / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",Silhouette="uniform sampler2D colorTexture;\nuniform sampler2D silhouetteTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);\n}\n",FXAA3_11="#if (FXAA_QUALITY_PRESET == 10)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 3.0\n#define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 3.0\n#define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 4.0\n#define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 4.0\n#define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 4.0\n#define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 2.0\n#define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 3.0\n#define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n#define FXAA_QUALITY_PS 9\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 4.0\n#define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n#define FXAA_QUALITY_PS 10\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 4.0\n#define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n#define FXAA_QUALITY_PS 11\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 4.0\n#define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.0\n#define FXAA_QUALITY_P2 1.0\n#define FXAA_QUALITY_P3 1.0\n#define FXAA_QUALITY_P4 1.0\n#define FXAA_QUALITY_P5 1.5\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\nFxaaFloat4 FxaaPixelShader(\nFxaaFloat2 pos,\nFxaaTex tex,\nFxaaFloat2 fxaaQualityRcpFrame,\nFxaaFloat fxaaQualitySubpix,\nFxaaFloat fxaaQualityEdgeThreshold,\nFxaaFloat fxaaQualityEdgeThresholdMin\n) {\nFxaaFloat2 posM;\nposM.x = pos.x;\nposM.y = pos.y;\nFxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n#define lumaM rgbyM.y\nFxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat maxSM = max(lumaS, lumaM);\nFxaaFloat minSM = min(lumaS, lumaM);\nFxaaFloat maxESM = max(lumaE, maxSM);\nFxaaFloat minESM = min(lumaE, minSM);\nFxaaFloat maxWN = max(lumaN, lumaW);\nFxaaFloat minWN = min(lumaN, lumaW);\nFxaaFloat rangeMax = max(maxWN, maxESM);\nFxaaFloat rangeMin = min(minWN, minESM);\nFxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\nFxaaFloat range = rangeMax - rangeMin;\nFxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\nFxaaBool earlyExit = range < rangeMaxClamped;\nif(earlyExit)\nreturn rgbyM;\nFxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNS = lumaN + lumaS;\nFxaaFloat lumaWE = lumaW + lumaE;\nFxaaFloat subpixRcpRange = 1.0/range;\nFxaaFloat subpixNSWE = lumaNS + lumaWE;\nFxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\nFxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\nFxaaFloat lumaNESE = lumaNE + lumaSE;\nFxaaFloat lumaNWNE = lumaNW + lumaNE;\nFxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\nFxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\nFxaaFloat lumaNWSW = lumaNW + lumaSW;\nFxaaFloat lumaSWSE = lumaSW + lumaSE;\nFxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\nFxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\nFxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\nFxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\nFxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\nFxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\nFxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\nFxaaFloat lengthSign = fxaaQualityRcpFrame.x;\nFxaaBool horzSpan = edgeHorz >= edgeVert;\nFxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\nif(!horzSpan) lumaN = lumaW;\nif(!horzSpan) lumaS = lumaE;\nif(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\nFxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\nFxaaFloat gradientN = lumaN - lumaM;\nFxaaFloat gradientS = lumaS - lumaM;\nFxaaFloat lumaNN = lumaN + lumaM;\nFxaaFloat lumaSS = lumaS + lumaM;\nFxaaBool pairN = abs(gradientN) >= abs(gradientS);\nFxaaFloat gradient = max(abs(gradientN), abs(gradientS));\nif(pairN) lengthSign = -lengthSign;\nFxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\nFxaaFloat2 posB;\nposB.x = posM.x;\nposB.y = posM.y;\nFxaaFloat2 offNP;\noffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\noffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\nif(!horzSpan) posB.x += lengthSign * 0.5;\nif( horzSpan) posB.y += lengthSign * 0.5;\nFxaaFloat2 posN;\nposN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\nposN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\nFxaaFloat2 posP;\nposP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\nposP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\nFxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\nFxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\nFxaaFloat subpixE = subpixC * subpixC;\nFxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\nif(!pairN) lumaNN = lumaSS;\nFxaaFloat gradientScaled = gradient * 1.0/4.0;\nFxaaFloat lumaMM = lumaM - lumaNN * 0.5;\nFxaaFloat subpixF = subpixD * subpixE;\nFxaaBool lumaMLTZero = lumaMM < 0.0;\nlumaEndN -= lumaNN * 0.5;\nlumaEndP -= lumaNN * 0.5;\nFxaaBool doneN = abs(lumaEndN) >= gradientScaled;\nFxaaBool doneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\nFxaaBool doneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n#if (FXAA_QUALITY_PS > 3)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n#if (FXAA_QUALITY_PS > 4)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n#if (FXAA_QUALITY_PS > 5)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n#if (FXAA_QUALITY_PS > 6)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n#if (FXAA_QUALITY_PS > 7)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n#if (FXAA_QUALITY_PS > 8)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n#if (FXAA_QUALITY_PS > 9)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n#if (FXAA_QUALITY_PS > 10)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n#if (FXAA_QUALITY_PS > 11)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n#if (FXAA_QUALITY_PS > 12)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\nFxaaFloat dstN = posM.x - posN.x;\nFxaaFloat dstP = posP.x - posM.x;\nif(!horzSpan) dstN = posM.y - posN.y;\nif(!horzSpan) dstP = posP.y - posM.y;\nFxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\nFxaaFloat spanLength = (dstP + dstN);\nFxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\nFxaaFloat spanLengthRcp = 1.0/spanLength;\nFxaaBool directionN = dstN < dstP;\nFxaaFloat dst = min(dstN, dstP);\nFxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\nFxaaFloat subpixG = subpixF * subpixF;\nFxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\nFxaaFloat subpixH = subpixG * fxaaQualitySubpix;\nFxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\nFxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\nif(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\nif( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\nreturn FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n}\n";function PostProcessStageComposite(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._stages=e.stages,this._inputPreviousStageTexture=defaultValue(e.inputPreviousStageTexture,!0);let t=e.name;defined(t)||(t=createGuid()),this._name=t,this._uniforms=e.uniforms,this._textureCache=void 0,this._index=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0}function isSelectedTextureDirty(e){let t=defined(e._selected)?e._selected.length:0;const i=defined(e._parentSelected)?e._parentSelected:0;let n=e._selected!==e._selectedShadow||t!==e._selectedLength;if(n=n||e._parentSelected!==e._parentSelectedShadow||i!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!n&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let i=0;i<t;++i)if(e._combinedSelected[i]!==e._combinedSelectedShadow[i])return!0}return n}Object.defineProperties(PostProcessStageComposite.prototype,{ready:{get:function(){const e=this._stages,t=e.length;for(let i=0;i<t;++i)if(!e[i].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){const t=this._stages,i=t.length;for(let n=0;n<i;++n)t[n].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}}),PostProcessStageComposite.prototype._isSupported=function(e){const t=this._stages,i=t.length;for(let n=0;n<i;++n)if(!t[n]._isSupported(e))return!1;return!0},PostProcessStageComposite.prototype.get=function(e){return this._stages[e]},PostProcessStageComposite.prototype.update=function(e,t){this._selectedDirty=isSelectedTextureDirty(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0;const i=this._stages,n=i.length;for(let r=0;r<n;++r){const n=i[r];this._selectedDirty&&(n.parentSelected=this._combinedSelected),n.update(e,t)}},PostProcessStageComposite.prototype.isDestroyed=function(){return!1},PostProcessStageComposite.prototype.destroy=function(){const e=this._stages,t=e.length;for(let i=0;i<t;++i)e[i].destroy();return destroyObject(this)};const PostProcessStageLibrary={};function createBlur(e){const t=`#define USE_STEP_SIZE\n${GaussianBlur1D}`,i=new PostProcessStage({name:`${e}_x_direction`,fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:PostProcessStageSampleMode.LINEAR}),n=new PostProcessStage({name:`${e}_y_direction`,fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:PostProcessStageSampleMode.LINEAR}),r={};return Object.defineProperties(r,{delta:{get:function(){return i.uniforms.delta},set:function(e){const t=i.uniforms,r=n.uniforms;t.delta=r.delta=e}},sigma:{get:function(){return i.uniforms.sigma},set:function(e){const t=i.uniforms,r=n.uniforms;t.sigma=r.sigma=e}},stepSize:{get:function(){return i.uniforms.stepSize},set:function(e){const t=i.uniforms,r=n.uniforms;t.stepSize=r.stepSize=e}}}),new PostProcessStageComposite({name:e,stages:[i,n],uniforms:r})}function getSilhouetteEdgeDetection(e){if(!defined(e))return PostProcessStageLibrary.createEdgeDetectionStage();const t=new PostProcessStageComposite({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),i={};let n="",r="";for(let t=0;t<e.length;++t)n+=`uniform sampler2D edgeTexture${t}; \n`,r+=` vec4 edge${t} = texture2D(edgeTexture${t}, v_textureCoordinates); \n if (edge${t}.a > 0.0) \n { \n color = edge${t}; \n break; \n } \n`,i[`edgeTexture${t}`]=e[t].name;return new PostProcessStageComposite({name:"czm_edge_detection_composite",stages:[t,new PostProcessStage({name:"czm_edge_detection_combine",fragmentShader:`${n}varying vec2 v_textureCoordinates; \nvoid main() { \n vec4 color = vec4(0.0); \n for (int i = 0; i < ${e.length}; i++) \n { \n${r} } \n gl_FragColor = color; \n} \n`,uniforms:i})]})}PostProcessStageLibrary.createBlurStage=function(){return createBlur("czm_blur")},PostProcessStageLibrary.createDepthOfFieldStage=function(){const e=createBlur("czm_depth_of_field_blur"),t=new PostProcessStage({name:"czm_depth_of_field_composite",fragmentShader:DepthOfField,uniforms:{focalDistance:5,blurTexture:e.name}}),i={};return Object.defineProperties(i,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(e){t.uniforms.focalDistance=e}},delta:{get:function(){return e.uniforms.delta},set:function(t){e.uniforms.delta=t}},sigma:{get:function(){return e.uniforms.sigma},set:function(t){e.uniforms.sigma=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}}}),new PostProcessStageComposite({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:i})},PostProcessStageLibrary.isDepthOfFieldSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createEdgeDetectionStage=function(){return new PostProcessStage({name:`czm_edge_detection_${createGuid()}`,fragmentShader:EdgeDetection,uniforms:{length:.25,color:Color.clone(Color.BLACK)}})},PostProcessStageLibrary.isEdgeDetectionSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createSilhouetteStage=function(e){const t=getSilhouetteEdgeDetection(e);return new PostProcessStageComposite({name:"czm_silhouette",stages:[t,new PostProcessStage({name:"czm_silhouette_color_edges",fragmentShader:Silhouette,uniforms:{silhouetteTexture:t.name}})],inputPreviousStageTexture:!1,uniforms:t.uniforms})},PostProcessStageLibrary.isSilhouetteSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createBloomStage=function(){const e=new PostProcessStage({name:"czm_bloom_contrast_bias",fragmentShader:ContrastBias,uniforms:{contrast:128,brightness:-.3}}),t=createBlur("czm_bloom_blur"),i=new PostProcessStageComposite({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),n=new PostProcessStage({name:"czm_bloom_generate_composite",fragmentShader:BloomComposite,uniforms:{glowOnly:!1,bloomTexture:i.name}}),r={};return Object.defineProperties(r,{glowOnly:{get:function(){return n.uniforms.glowOnly},set:function(e){n.uniforms.glowOnly=e}},contrast:{get:function(){return e.uniforms.contrast},set:function(t){e.uniforms.contrast=t}},brightness:{get:function(){return e.uniforms.brightness},set:function(t){e.uniforms.brightness=t}},delta:{get:function(){return t.uniforms.delta},set:function(e){t.uniforms.delta=e}},sigma:{get:function(){return t.uniforms.sigma},set:function(e){t.uniforms.sigma=e}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}}}),new PostProcessStageComposite({name:"czm_bloom",stages:[i,n],inputPreviousStageTexture:!1,uniforms:r})},PostProcessStageLibrary.createAmbientOcclusionStage=function(){const e=new PostProcessStage({name:"czm_ambient_occlusion_generate",fragmentShader:AmbientOcclusionGenerate,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=createBlur("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const i=new PostProcessStageComposite({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),n=new PostProcessStage({name:"czm_ambient_occlusion_composite",fragmentShader:AmbientOcclusionModulate,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:i.name}}),r={};return Object.defineProperties(r,{intensity:{get:function(){return e.uniforms.intensity},set:function(t){e.uniforms.intensity=t}},bias:{get:function(){return e.uniforms.bias},set:function(t){e.uniforms.bias=t}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(t){e.uniforms.lengthCap=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(t){e.uniforms.frustumLength=t}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(t){e.uniforms.randomTexture=t}},delta:{get:function(){return t.uniforms.delta},set:function(e){t.uniforms.delta=e}},sigma:{get:function(){return t.uniforms.sigma},set:function(e){t.uniforms.sigma=e}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}},ambientOcclusionOnly:{get:function(){return n.uniforms.ambientOcclusionOnly},set:function(e){n.uniforms.ambientOcclusionOnly=e}}}),new PostProcessStageComposite({name:"czm_ambient_occlusion",stages:[i,n],inputPreviousStageTexture:!1,uniforms:r})},PostProcessStageLibrary.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};const fxaaFS=`#define FXAA_QUALITY_PRESET 39 \n${FXAA3_11}\n${FXAA}`;function PostProcessStageTextureCache(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function getLastStageName(e){for(;defined(e.length);)e=e.get(e.length-1);return e.name}function getStageDependencies(e,t,i,n,r){if(!n.enabled||!n._isSupported(t))return r;const o=i[n.name]={};if(defined(r)){o[getLastStageName(e.getStageByName(r))]=!0}const a=n.uniforms;if(defined(a)){const t=Object.getOwnPropertyNames(a),i=t.length;for(let n=0;n<i;++n){const i=a[t[n]];if("string"==typeof i){const t=e.getStageByName(i);defined(t)&&(o[getLastStageName(t)]=!0)}}}return n.name}function getCompositeDependencies(e,t,i,n,r){if(defined(n.enabled)&&!n.enabled||defined(n._isSupported)&&!n._isSupported(t))return r;const o=r,a=!defined(n.inputPreviousStageTexture)||n.inputPreviousStageTexture;let s=r;const c=n.length;for(let o=0;o<c;++o){const c=n.get(o);s=defined(c.length)?getCompositeDependencies(e,t,i,c,r):getStageDependencies(e,t,i,c,r),a&&(r=s)}let l,u;if(a)for(l=1;l<c;++l)u=getLastStageName(n.get(l)),defined(i[u])||(i[u]={}),i[u][o]=!0;else for(l=1;l<c;++l){u=getLastStageName(n.get(l));const e=i[u];for(let t=0;t<l;++t)e[getLastStageName(n.get(t))]=!0}return s}function getDependencies(e,t){const i={};if(defined(e.ambientOcclusion)){const n=e.ambientOcclusion,r=e.bloom,o=e._tonemapping,a=e.fxaa;let s=getCompositeDependencies(e,t,i,n,void 0);s=getCompositeDependencies(e,t,i,r,s),s=getStageDependencies(e,t,i,o,s),s=getCompositeDependencies(e,t,i,e,s),getStageDependencies(e,t,i,a,s)}else getCompositeDependencies(e,t,i,e,void 0);return i}function getFramebuffer(e,t,i){const n=e._collection.getStageByName(t),r=n._textureScale,o=n._forcePowerOfTwo,a=n._pixelFormat,s=n._pixelDatatype,c=n._clearColor;let l,u;const d=e._framebuffers,h=d.length;for(l=0;l<h;++l){if(u=d[l],r!==u.textureScale||o!==u.forcePowerOfTwo||a!==u.pixelFormat||s!==u.pixelDatatype||!Color.equals(c,u.clearColor))continue;const e=u.stages,t=e.length;let n=!1;for(let r=0;r<t;++r)if(i[e[r]]){n=!0;break}if(!n)break}return defined(u)&&l<h?(u.stages.push(t),u):(u={textureScale:r,forcePowerOfTwo:o,pixelFormat:a,pixelDatatype:s,clearColor:c,stages:[t],buffer:new FramebufferManager({pixelFormat:a,pixelDatatype:s}),clear:void 0},d.push(u),u)}function createFramebuffers(e,t){const i=getDependencies(e._collection,t);for(const t in i)i.hasOwnProperty(t)&&(e._stageNameToFramebuffer[t]=getFramebuffer(e,t,i[t]))}function releaseResources(e){const t=e._framebuffers,i=t.length;for(let e=0;e<i;++e){t[e].buffer.destroy()}}function updateFramebuffers(e,t){const i=e._width,n=e._height,r=e._framebuffers,o=r.length;for(let e=0;e<o;++e){const o=r[e],a=o.textureScale;let s=Math.ceil(i*a),c=Math.ceil(n*a),l=Math.min(s,c);o.forcePowerOfTwo&&(CesiumMath.isPowerOfTwo(l)||(l=CesiumMath.nextPowerOfTwo(l)),s=l,c=l),o.buffer.update(t,s,c),o.clear=new ClearCommand({color:o.clearColor,framebuffer:o.buffer.framebuffer})}}PostProcessStageLibrary.createFXAAStage=function(){return new PostProcessStage({name:"czm_FXAA",fragmentShader:fxaaFS,sampleMode:PostProcessStageSampleMode.LINEAR})},PostProcessStageLibrary.createAcesTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=AcesTonemapping,new PostProcessStage({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createFilmicTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=FilmicTonemapping,new PostProcessStage({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createReinhardTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=ReinhardTonemapping,new PostProcessStage({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createModifiedReinhardTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=ModifiedReinhardTonemapping,new PostProcessStage({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:Color.WHITE,autoExposure:void 0}})},PostProcessStageLibrary.createAutoExposureStage=function(){return new AutoExposure},PostProcessStageLibrary.createBlackAndWhiteStage=function(){return new PostProcessStage({name:"czm_black_and_white",fragmentShader:BlackAndWhite,uniforms:{gradations:5}})},PostProcessStageLibrary.createBrightnessStage=function(){return new PostProcessStage({name:"czm_brightness",fragmentShader:Brightness,uniforms:{brightness:.5}})},PostProcessStageLibrary.createNightVisionStage=function(){return new PostProcessStage({name:"czm_night_vision",fragmentShader:NightVision})},PostProcessStageLibrary.createDepthViewStage=function(){return new PostProcessStage({name:"czm_depth_view",fragmentShader:DepthView})},PostProcessStageLibrary.createLensFlareStage=function(){return new PostProcessStage({name:"czm_lens_flare",fragmentShader:LensFlare,uniforms:{dirtTexture:buildModuleUrl("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:buildModuleUrl("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:Ellipsoid.WGS84.maximumRadius}})},PostProcessStageTextureCache.prototype.updateDependencies=function(){this._updateDependencies=!0},PostProcessStageTextureCache.prototype.update=function(e){const t=this._collection,i=this._updateDependencies,n=defined(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),r=defined(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),o=defined(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),a=defined(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),s=!defined(t._activeStages)||t._activeStages.length>0||n||r||o||a;if((i||!s&&this._framebuffers.length>0)&&(releaseResources(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!i&&!s)return;0===this._framebuffers.length&&createFramebuffers(this,e);const c=e.drawingBufferWidth,l=e.drawingBufferHeight,u=this._width!==c||this._height!==l;(i||u)&&(this._width=c,this._height=l,this._updateDependencies=!1,releaseResources(this),updateFramebuffers(this,e))},PostProcessStageTextureCache.prototype.clear=function(e){const t=this._framebuffers;for(let i=0;i<t.length;++i)t[i].clear.execute(e)},PostProcessStageTextureCache.prototype.getStageByName=function(e){return this._collection.getStageByName(e)},PostProcessStageTextureCache.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)},PostProcessStageTextureCache.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(defined(t))return t.buffer.framebuffer},PostProcessStageTextureCache.prototype.isDestroyed=function(){return!1},PostProcessStageTextureCache.prototype.destroy=function(){return releaseResources(this),destroyObject(this)};const Tonemapper={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===Tonemapper.REINHARD||e===Tonemapper.MODIFIED_REINHARD||e===Tonemapper.FILMIC||e===Tonemapper.ACES}};var Tonemapper$1=Object.freeze(Tonemapper);const stackScratch=[];function PostProcessStageCollection(){const e=PostProcessStageLibrary.createFXAAStage(),t=PostProcessStageLibrary.createAmbientOcclusionStage(),i=PostProcessStageLibrary.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=PostProcessStageLibrary.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=Tonemapper$1.ACES;const n=this._tonemapping;e.enabled=!1,t.enabled=!1,i.enabled=!1,n.enabled=!1;const r=new PostProcessStageTextureCache(this),o={},a=stackScratch;for(a.push(e,t,i,n);a.length>0;){const e=a.pop();o[e.name]=e,e._textureCache=r;const t=e.length;if(defined(t))for(let i=0;i<t;++i)a.push(e.get(i))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;const s=this;t.uniforms.randomTexture=function(){return s._randomTexture},this._ao=t,this._bloom=i,this._fxaa=e,this._aoEnabled=void 0,this._bloomEnabled=void 0,this._tonemappingEnabled=void 0,this._fxaaEnabled=void 0,this._activeStagesChanged=!1,this._stagesRemoved=!1,this._textureCacheDirty=!1,this._stageNames=o,this._textureCache=r}function removeStages(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;const t=[],i=e._stages,n=i.length;for(let e=0,r=0;e<n;++e){const n=i[e];n&&(n._index=r++,t.push(n))}e._stages=t}function getOutputTexture(e){for(;defined(e.length);)e=e.get(e.length-1);return e.outputTexture}function execute(e,t,i,n,r){if(defined(e.execute))return void e.execute(t,i,n,r);const o=e.length;let a;if(e.inputPreviousStageTexture)for(execute(e.get(0),t,i,n,r),a=1;a<o;++a)execute(e.get(a),t,getOutputTexture(e.get(a-1)),n,r);else for(a=0;a<o;++a)execute(e.get(a),t,i,n,r)}function QuadtreePrimitivezh(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new TileReplacementQueue,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,2),this.tileCacheSize=defaultValue(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new QuadtreeOccluders({ellipsoid:t}),this._tileLoadProgressEvent=new Event,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}function invalidateAllTiles(e){var t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,clearTileLoadQueue(e);var i=e._levelZeroTiles;if(defined(i))for(var n=0;n<i.length;++n){for(var r=i[n].customData,o=r.length,a=0;a<o;++a){var s=r[a];s.level=0,e._addHeightCallbacks.push(s)}i[n].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}function clearTileLoadQueue(e){var t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}function updateTileLoadProgress(e,t){var i=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;(i!==e._lastTileLoadQueueLength||e._tilesInvalidated)&&(t.afterRender.push(Event.prototype.raiseEvent.bind(e._tileLoadProgressEvent,i)),e._lastTileLoadQueueLength=i);var n=e._debug;n.enableDebugOutput&&!n.suspendLodUpdate&&(n.maxDepth=e._tilesToRender.reduce((function(e,t){return Math.max(e,t.level)}),-1),n.tilesRendered=e._tilesToRender.length,n.tilesVisited===n.lastTilesVisited&&n.tilesRendered===n.lastTilesRendered&&n.tilesCulled===n.lastTilesCulled&&n.maxDepth===n.lastMaxDepth&&n.tilesWaitingForChildren===n.lastTilesWaitingForChildren&&n.maxDepthVisited===n.lastMaxDepthVisited||(console.log("Visited "+n.tilesVisited+", Rendered: "+n.tilesRendered+", Culled: "+n.tilesCulled+", Max Depth Rendered: "+n.maxDepth+", Max Depth Visited: "+n.maxDepthVisited+", Waiting for children: "+n.tilesWaitingForChildren),n.lastTilesVisited=n.tilesVisited,n.lastTilesRendered=n.tilesRendered,n.lastTilesCulled=n.tilesCulled,n.lastMaxDepth=n.maxDepth,n.lastTilesWaitingForChildren=n.tilesWaitingForChildren,n.lastMaxDepthVisited=n.maxDepthVisited))}var comparisonPoint;Object.defineProperties(PostProcessStageCollection.prototype,{ready:{get:function(){let e=!1;const t=this._stages;for(let i=t.length-1;i>=0;--i){const n=t[i];e=e||n.ready&&n.enabled}const i=this._fxaa,n=this._ao,r=this._bloom,o=this._tonemapping;return e=e||i.ready&&i.enabled,e=e||n.ready&&n.enabled,e=e||r.ready&&r.enabled,e=e||o.ready&&o.enabled,e}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return removeStages(this),this._stages.length}},outputTexture:{get:function(){const e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);const t=this._stages;for(let e=t.length-1;e>=0;--e){const i=t[e];if(defined(i)&&i.ready&&i.enabled)return this.getOutputTexture(i.name)}const i=this._tonemapping;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);const n=this._bloom;if(n.enabled&&n.ready)return this.getOutputTexture(n.name);const r=this._ao;return r.enabled&&r.ready?this.getOutputTexture(r.name):void 0}},hasSelected:{get:function(){const e=arraySlice(this._stages);for(;e.length>0;){const t=e.pop();if(!defined(t))continue;if(defined(t.selected))return!0;const i=t.length;if(defined(i))for(let n=0;n<i;++n)e.push(t.get(n))}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper===e)return;defined(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());const t=this._autoExposureEnabled;let i;switch(e){case Tonemapper$1.REINHARD:i=PostProcessStageLibrary.createReinhardTonemappingStage(t);break;case Tonemapper$1.MODIFIED_REINHARD:i=PostProcessStageLibrary.createModifiedReinhardTonemappingStage(t);break;case Tonemapper$1.FILMIC:i=PostProcessStageLibrary.createFilmicTonemappingStage(t);break;default:i=PostProcessStageLibrary.createAcesTonemappingStage(t)}if(t){const e=this._autoExposure;i.uniforms.autoExposure=function(){return e.outputTexture}}this._tonemapper=e,this._tonemapping=i,defined(this._stageNames)&&(this._stageNames[i.name]=i,i._textureCache=this._textureCache),this._textureCacheDirty=!0}}}),PostProcessStageCollection.prototype.add=function(e){const t=this._stageNames,i=stackScratch;for(i.push(e);i.length>0;){const e=i.pop();t[e.name]=e,e._textureCache=this._textureCache;const n=e.length;if(defined(n))for(let t=0;t<n;++t)i.push(e.get(t))}const n=this._stages;return e._index=n.length,n.push(e),this._textureCacheDirty=!0,e},PostProcessStageCollection.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,i=stackScratch;for(i.push(e);i.length>0;){const e=i.pop();delete t[e.name];const n=e.length;if(defined(n))for(let t=0;t<n;++t)i.push(e.get(t))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0},PostProcessStageCollection.prototype.contains=function(e){return defined(e)&&defined(e._index)&&e._textureCache===this._textureCache},PostProcessStageCollection.prototype.get=function(e){removeStages(this);return this._stages[e]},PostProcessStageCollection.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let i=0;i<t;++i)this.remove(e[i]);e.length=0},PostProcessStageCollection.prototype.getStageByName=function(e){return this._stageNames[e]},PostProcessStageCollection.prototype.update=function(e,t,i){removeStages(this);const n=this._activeStages,r=this._activeStages=this._previousActiveStages;this._previousActiveStages=n;const o=this._stages;let a,s,c=r.length=o.length,l=0;for(a=0;a<c;++a)s=o[a],s.ready&&s.enabled&&s._isSupported(e)&&(r[l++]=s);r.length=l;let u=l!==n.length;if(!u)for(a=0;a<l;++a)if(r[a]!==n[a]){u=!0;break}const d=this._ao,h=this._bloom,p=this._autoExposure,f=this._tonemapping,m=this._fxaa;f.enabled=i;const g=d.enabled&&d._isSupported(e),_=h.enabled&&h._isSupported(e),y=f.enabled&&f._isSupported(e),C=m.enabled&&m._isSupported(e);if((u||this._textureCacheDirty||g!==this._aoEnabled||_!==this._bloomEnabled||y!==this._tonemappingEnabled||C!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=g,this._bloomEnabled=_,this._tonemappingEnabled=y,this._fxaaEnabled=C,this._textureCacheDirty=!1),defined(this._randomTexture)&&!g&&(this._randomTexture.destroy(),this._randomTexture=void 0),!defined(this._randomTexture)&&g){c=196608;const t=new Uint8Array(c);for(a=0;a<c;a+=3)t[a]=Math.floor(255*Math.random());this._randomTexture=new Texture({context:e,pixelFormat:PixelFormat$1.RGB,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:t,width:256,height:256},sampler:new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})}for(this._textureCache.update(e),m.update(e,t),d.update(e,t),h.update(e,t),f.update(e,t),this._autoExposureEnabled&&p.update(e,t),c=o.length,a=0;a<c;++a)o[a].update(e,t);for(l=0,a=0;a<c;++a)s=o[a],s.ready&&s.enabled&&s._isSupported(e)&&l++;u=l!==r.length,u&&this.update(e,t,i)},PostProcessStageCollection.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)},PostProcessStageCollection.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(defined(t))return getOutputTexture(t)},PostProcessStageCollection.prototype.execute=function(e,t,i,n){const r=this._activeStages,o=r.length,a=this._fxaa,s=this._ao,c=this._bloom,l=this._autoExposure,u=this._tonemapping,d=s.enabled&&s._isSupported(e),h=c.enabled&&c._isSupported(e),p=this._autoExposureEnabled,f=u.enabled&&u._isSupported(e),m=a.enabled&&a._isSupported(e);if(!(m||d||h||f||0!==o))return;let g=t;d&&s.ready&&(execute(s,e,g,i,n),g=getOutputTexture(s)),h&&c.ready&&(execute(c,e,g,i,n),g=getOutputTexture(c)),p&&l.ready&&execute(l,e,g,i,n),f&&u.ready&&(execute(u,e,g,i,n),g=getOutputTexture(u));let _=g;if(o>0){execute(r[0],e,g,i,n);for(let t=1;t<o;++t)execute(r[t],e,getOutputTexture(r[t-1]),i,n);_=getOutputTexture(r[o-1])}m&&a.ready&&execute(a,e,_,i,n)},PostProcessStageCollection.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){const t=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return t.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},PostProcessStageCollection.prototype.isDestroyed=function(){return!1},PostProcessStageCollection.prototype.destroy=function(){return this._fxaa.destroy(),this._ao.destroy(),this._bloom.destroy(),this._autoExposure.destroy(),this._tonemapping.destroy(),this.removeAll(),this._textureCache=this._textureCache&&this._textureCache.destroy(),destroyObject(this)},Object.defineProperties(QuadtreePrimitivezh.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}}),QuadtreePrimitivezh.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0},QuadtreePrimitivezh.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;defined(t);)t.state!==QuadtreeTileLoadState$1.START&&e(t),t=t.replacementNext},QuadtreePrimitivezh.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,n=t.length;i<n;++i)e(t[i])},QuadtreePrimitivezh.prototype.updateHeight=function(e,t){var i=this,n={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t,removeFunc:function(){for(var e=i._addHeightCallbacks,t=e.length,r=0;r<t;++r)if(e[r]===n){e.splice(r,1);break}i._removeHeightCallbacks.push(n)}};return i._addHeightCallbacks.push(n),n.removeFunc},QuadtreePrimitivezh.prototype.update=function(e){defined(this._tileProvider.update)&&this._tileProvider.update(e)},QuadtreePrimitivezh.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(invalidateAllTiles(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),clearTileLoadQueue(this),this._debug.suspendLodUpdate||this._tileReplacementQueue.markStartOfRenderFrame())},QuadtreePrimitivezh.prototype.render=function(e){var t=e.passes,i=this._tileProvider;if(t.render&&(i.beginUpdate(e),selectTilesForRendering(this,e),createRenderCommandsForSelectedTiles(this,e),i.endUpdate(e)),t.pick&&this._tilesToRender.length>0)try{i.updateForPick(e)}catch(e){}},QuadtreePrimitivezh.prototype.endFrame=function(e){e.passes.render&&e.mode!==SceneMode$1.MORPHING&&(processTileLoadQueue(this,e),updateHeights(this,e),updateTileLoadProgress(this,e))},QuadtreePrimitivezh.prototype.isDestroyed=function(){return!1},QuadtreePrimitivezh.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var centerScratch=new Cartographic;function compareDistanceToPoint(e,t){var i=Rectangle.center(e.rectangle,centerScratch),n=i.longitude-comparisonPoint.longitude,r=i.latitude-comparisonPoint.latitude,o=(i=Rectangle.center(t.rectangle,centerScratch)).longitude-comparisonPoint.longitude,a=i.latitude-comparisonPoint.latitude;return n*n+r*r-(o*o+a*a)}var cameraOriginScratch=new Cartesian3,rootTraversalDetails=[];function selectTilesForRendering(e,t){var i=e._debug;if(!i.suspendLodUpdate){var n;e._tilesToRender.length=0;var r,o=e._tileProvider;if(!defined(e._levelZeroTiles)){if(!o.ready)return;var a=o.tilingScheme;e._levelZeroTiles=QuadtreeTile.createLevelZeroTiles(a);var s=e._levelZeroTiles.length;if(rootTraversalDetails.length<s)for(rootTraversalDetails=new Array(s),n=0;n<s;++n)void 0===rootTraversalDetails[n]&&(rootTraversalDetails[n]=new TraversalDetails)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var c=e._levelZeroTiles,l=c.length>1?e._occluders:void 0;comparisonPoint=t.camera.positionCartographic,c.sort(compareDistanceToPoint);var u,d=e._addHeightCallbacks,h=e._removeHeightCallbacks,p=t.frameNumber;if(d.length>0||h.length>0){for(n=0,u=c.length;n<u;++n)(r=c[n])._updateCustomData(p,d,h);d.length=0,h.length=0}var f=t.camera;e._cameraPositionCartographic=f.positionCartographic;var m=Matrix4.getTranslation(f.transform,cameraOriginScratch);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(m,e._cameraReferenceFrameOriginCartographic),n=0,u=c.length;n<u;++n)r=c[n],e._tileReplacementQueue.markTileRendered(r),r.renderable?visitIfVisible(e,r,o,t,l,!1,rootTraversalDetails[n]):(queueTileLoad(e,e._tileLoadQueueHigh,r,t),++i.tilesWaitingForChildren);e._lastSelectionFrameNumber=p}}function queueTileLoad(e,t,i,n){i.needsLoading&&(void 0!==e.tileProvider.computeTileLoadPriority&&(i._loadPriority=e.tileProvider.computeTileLoadPriority(i,n)),t.push(i))}function TraversalDetails(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function TraversalQuadDetails(){this.southwest=new TraversalDetails,this.southeast=new TraversalDetails,this.northwest=new TraversalDetails,this.northeast=new TraversalDetails}TraversalQuadDetails.prototype.combine=function(e){var t=this.southwest,i=this.southeast,n=this.northwest,r=this.northeast;e.allAreRenderable=t.allAreRenderable&&i.allAreRenderable&&n.allAreRenderable&&r.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||r.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+i.notYetRenderableCount+n.notYetRenderableCount+r.notYetRenderableCount};for(var traversalQuadsByLevel=new Array(31),i$1=0;i$1<traversalQuadsByLevel.length;++i$1)traversalQuadsByLevel[i$1]=new TraversalQuadDetails;function visitTile(e,t,i,n,r){var o=e._debug;++o.tilesVisited,e._tileReplacementQueue.markTileRendered(i),i._updateCustomData(t.frameNumber),i.level>o.maxDepthVisited&&(o.maxDepthVisited=i.level);var a=screenSpaceError(e,t,i)<e.maximumScreenSpaceError,s=i.southwestChild,c=i.southeastChild,l=i.northwestChild,u=i.northeastChild,d=e._lastSelectionFrameNumber,h=i._lastSelectionResultFrame===d?i._lastSelectionResult:TileSelectionResult.NONE,p=e.tileProvider;if(a||n){var f=TileSelectionResult.originalResult(h)===TileSelectionResult.RENDERED,m=TileSelectionResult.originalResult(h)===TileSelectionResult.CULLED||h===TileSelectionResult.NONE,g=i.state===QuadtreeTileLoadState$1.DONE,_=f||m||g;if(_||defined(p.canRenderWithoutLosingDetail)&&(_=p.canRenderWithoutLosingDetail(i)),_)return a&&queueTileLoad(e,e._tileLoadQueueMedium,i,t),addTileToRenderList(e,i),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(r.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));n=!0,a&&queueTileLoad(e,e._tileLoadQueueHigh,i,t)}if(p.canRefine(i)){if(s.upsampledFromParent&&c.upsampledFromParent&&l.upsampledFromParent&&u.upsampledFromParent)return addTileToRenderList(e,i),queueTileLoad(e,e._tileLoadQueueMedium,i,t),e._tileReplacementQueue.markTileRendered(s),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(u),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(r.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.REFINED;var y=e._tilesToRender.length,C=e._tileLoadQueueLow.length,T=e._tileLoadQueueMedium.length,S=e._tileLoadQueueHigh.length,v=e._tileToUpdateHeights.length;if(visitVisibleChildrenNearToFar(e,s,c,l,u,t,n,r),y!==e._tilesToRender.length){var A=r.allAreRenderable,E=r.anyWereRenderedLastFrame,b=r.notYetRenderableCount,x=!1;if(!A&&!E){for(var P=e._tilesToRender,D=y;D<P.length;++D)for(var w=P[D];void 0!==w&&w._lastSelectionResult!==TileSelectionResult.KICKED&&w!==i;)w._lastSelectionResult=TileSelectionResult.kick(w._lastSelectionResult),w=w.parent;e._tilesToRender.length=y,e._tileToUpdateHeights.length=v,addTileToRenderList(e,i),i._lastSelectionResult=TileSelectionResult.RENDERED;var M=h===TileSelectionResult.RENDERED;!M&&b>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=C,e._tileLoadQueueMedium.length=T,e._tileLoadQueueHigh.length=S,queueTileLoad(e,e._tileLoadQueueMedium,i,t),r.notYetRenderableCount=i.renderable?0:1,x=!0),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=M,M||e._tileToUpdateHeights.push(i),++o.tilesWaitingForChildren}e.preloadAncestors&&!x&&queueTileLoad(e,e._tileLoadQueueLow,i,t)}}else i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,addTileToRenderList(e,i),queueTileLoad(e,e._tileLoadQueueHigh,i,t),r.allAreRenderable=i.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=i.renderable?0:1}function visitVisibleChildrenNearToFar(e,t,i,n,r,o,a,s){var c=o.camera.positionCartographic,l=e._tileProvider,u=e._occluders,d=traversalQuadsByLevel[t.level],h=d.southwest,p=d.southeast,f=d.northwest,m=d.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(visitIfVisible(e,t,l,o,u,a,h),visitIfVisible(e,i,l,o,u,a,p),visitIfVisible(e,n,l,o,u,a,f),visitIfVisible(e,r,l,o,u,a,m)):(visitIfVisible(e,n,l,o,u,a,f),visitIfVisible(e,t,l,o,u,a,h),visitIfVisible(e,r,l,o,u,a,m),visitIfVisible(e,i,l,o,u,a,p)):c.latitude<t.rectangle.north?(visitIfVisible(e,i,l,o,u,a,p),visitIfVisible(e,t,l,o,u,a,h),visitIfVisible(e,r,l,o,u,a,m),visitIfVisible(e,n,l,o,u,a,f)):(visitIfVisible(e,r,l,o,u,a,m),visitIfVisible(e,n,l,o,u,a,f),visitIfVisible(e,i,l,o,u,a,p),visitIfVisible(e,t,l,o,u,a,h)),d.combine(s)}function containsNeededPosition(e,t){var i=t.rectangle;return defined(e._cameraPositionCartographic)&&Rectangle.contains(i,e._cameraPositionCartographic)||defined(e._cameraReferenceFrameOriginCartographic)&&Rectangle.contains(i,e._cameraReferenceFrameOriginCartographic)}function visitIfVisible(e,t,i,n,r,o,a){if(i.computeTileVisibility(t,n,r)!==Visibility$1.NONE)return visitTile(e,n,t,o,a);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),a.allAreRenderable=!0,a.anyWereRenderedLastFrame=!1,a.notYetRenderableCount=0,containsNeededPosition(e,t)){defined(t.data)&&defined(t.data.vertexArray)||queueTileLoad(e,e._tileLoadQueueMedium,t,n);var s=e._lastSelectionFrameNumber,c=t._lastSelectionResultFrame===s?t._lastSelectionResult:TileSelectionResult.NONE;c!==TileSelectionResult.CULLED_BUT_NEEDED&&c!==TileSelectionResult.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=TileSelectionResult.CULLED_BUT_NEEDED}else e.preloadSiblings||0===t.level?(queueTileLoad(e,e._tileLoadQueueLow,t,n),t._lastSelectionResult=TileSelectionResult.CULLED):t._lastSelectionResult=TileSelectionResult.CULLED;t._lastSelectionResultFrame=n.frameNumber}function screenSpaceError(e,t,i){if(t.mode===SceneMode$1.SCENE2D||t.camera.frustum instanceof OrthographicFrustum||t.camera.frustum instanceof OrthographicOffCenterFrustum)return screenSpaceError2D(e,t,i);var n=e._tileProvider.getLevelMaximumGeometricError(i.level),r=i._distance,o=n*t.context.drawingBufferHeight/(r*t.camera.frustum.sseDenominator);return t.fog.enabled&&(o-=CesiumMath.fog(r,t.fog.density)*t.fog.sse),o/=t.pixelRatio}function screenSpaceError2D(e,t,i){var n=t.camera.frustum;defined(n._offCenterFrustum)&&(n=n._offCenterFrustum);var r=t.context,o=r.drawingBufferWidth,a=r.drawingBufferHeight,s=e._tileProvider.getLevelMaximumGeometricError(i.level)/(Math.max(n.top-n.bottom,n.right-n.left)/Math.max(o,a));return t.fog.enabled&&t.mode!==SceneMode$1.SCENE2D&&(s-=CesiumMath.fog(i._distance,t.fog.density)*t.fog.sse),s/=t.pixelRatio}function addTileToRenderList(e,t){e._tilesToRender.push(t)}function processTileLoadQueue(e,t){var i=e._tileLoadQueueHigh,n=e._tileLoadQueueMedium,r=e._tileLoadQueueLow;if(0!==i.length||0!==n.length||0!==r.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);var o=getTimestamp$1()+e._loadQueueTimeSlice,a=e._tileProvider,s=processSinglePriorityLoadQueue(e,t,a,o,i,!1);s=processSinglePriorityLoadQueue(e,t,a,o,n,s),processSinglePriorityLoadQueue(e,t,a,o,r,s)}}function sortByLoadPriority(e,t){return e._loadPriority-t._loadPriority}function processSinglePriorityLoadQueue(e,t,i,n,r,o){void 0!==i.computeTileLoadPriority&&r.sort(sortByLoadPriority);for(var a=0,s=r.length;a<s&&(getTimestamp$1()<n||!o);++a){var c=r[a];e._tileReplacementQueue.markTileRendered(c),i.loadTile(t,c),o=!0}return o}var scratchRay=new Ray,scratchCartographic$1=new Cartographic,scratchPosition=new Cartesian3,scratchArray=[];function updateHeights(e,t){if(e.tileProvider.ready){var i=scratchArray;i.length=0;for(var n,r=e._tileToUpdateHeights,o=e._tileProvider.terrainProvider,a=getTimestamp$1()+e._updateHeightsTimeSlice,s=t.mode,c=t.mapProjection,l=e.tileProvider.tilingScheme.ellipsoid;r.length>0;){var u=r[0];if(defined(u.data)&&defined(u.data.mesh)){var d=u.customData,h=d.length,p=!1;for(n=e._lastTileIndex;n<h;++n){var f=d[n];if(u.level>f.level){if(defined(f.positionOnEllipsoidSurface)||(f.positionOnEllipsoidSurface=Cartesian3.fromRadians(f.positionCartographic.longitude,f.positionCartographic.latitude,0,l)),s===SceneMode$1.SCENE3D){var m=l.geodeticSurfaceNormal(f.positionOnEllipsoidSurface,scratchRay.direction);if(!defined(l.getSurfaceNormalIntersectionWithZAxis(f.positionOnEllipsoidSurface,11500,scratchRay.origin))){var g;defined(u.data.tileBoundingRegion)&&(g=u.data.tileBoundingRegion.minimumHeight);var _=Math.min(defaultValue(g,0),-11500),y=Cartesian3.multiplyByScalar(m,Math.abs(_)+1,scratchPosition);Cartesian3.subtract(f.positionOnEllipsoidSurface,y,scratchRay.origin)}}else Cartographic.clone(f.positionCartographic,scratchCartographic$1),scratchCartographic$1.height=-11500,c.project(scratchCartographic$1,scratchPosition),Cartesian3.fromElements(scratchPosition.z,scratchPosition.x,scratchPosition.y,scratchPosition),Cartesian3.clone(scratchPosition,scratchRay.origin),Cartesian3.clone(Cartesian3.UNIT_X,scratchRay.direction);var C=u.data.pick(scratchRay,s,c,!1,scratchPosition);defined(C)&&(f.callback(C),f.level=u.level)}else if(u.level===f.level){for(var T,S=u.children,v=S.length,A=0;A<v&&(T=S[A],!Rectangle.contains(T.rectangle,f.positionCartographic));++A);var E=o.getTileDataAvailable(T.x,T.y,T.level),b=u.parent;(defined(E)&&!E||defined(b)&&defined(b.data)&&defined(b.data.terrainData)&&!b.data.terrainData.isChildAvailable(b.x,b.y,T.x,T.y))&&f.removeFunc()}if(getTimestamp$1()>=a){p=!0;break}}if(p){e._lastTileIndex=n;break}e._lastTileIndex=0,r.shift()}else{var x=u._lastSelectionResultFrame===e._lastSelectionFrameNumber?u._lastSelectionResult:TileSelectionResult.NONE;x!==TileSelectionResult.RENDERED&&x!==TileSelectionResult.CULLED_BUT_NEEDED||i.push(u),r.shift(),e._lastTileIndex=0}}for(n=0;n<i.length;n++)r.push(i[n])}}function createRenderCommandsForSelectedTiles(e,t){for(var i=e._tileProvider,n=e._tilesToRender,r=0,o=n.length;r<o;++r){var a=n[r];i.showTileThisFrame(a,t)}}function QuadtreeTileProvider(){DeveloperError.throwInstantiationError()}function SceneTransitioner(e){this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}QuadtreeTileProvider.computeDefaultLevelZeroMaximumGeometricError=function(e){return 2*e.ellipsoid.maximumRadius*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))},Object.defineProperties(QuadtreeTileProvider.prototype,{quadtree:{get:DeveloperError.throwInstantiationError,set:DeveloperError.throwInstantiationError},ready:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError}}),QuadtreeTileProvider.prototype.update=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.beginUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.endUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.getLevelMaximumGeometricError=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.loadTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeTileVisibility=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.showTileThisFrame=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeDistanceToTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.isDestroyed=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.destroy=DeveloperError.throwInstantiationError,SceneTransitioner.prototype.completeMorph=function(){defined(this._completeMorph)&&this._completeMorph()},SceneTransitioner.prototype.morphTo2D=function(e,t){defined(this._completeMorph)&&this._completeMorph();const i=this._scene;this._previousMode=i.mode,this._morphToOrthographic=i.camera.frustum instanceof OrthographicFrustum,this._previousMode!==SceneMode$1.SCENE2D&&this._previousMode!==SceneMode$1.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE2D,!0),i._mode=SceneMode$1.MORPHING,i.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.COLUMBUS_VIEW?morphFromColumbusViewTo2D(this,e):morphFrom3DTo2D(this,e,t),0===e&&defined(this._completeMorph)&&this._completeMorph())};const scratchToCVPosition=new Cartesian3,scratchToCVDirection=new Cartesian3,scratchToCVUp=new Cartesian3,scratchToCVPosition2D=new Cartesian3,scratchToCVDirection2D=new Cartesian3,scratchToCVUp2D=new Cartesian3,scratchToCVSurfacePosition=new Cartesian3,scratchToCVCartographic=new Cartographic,scratchToCVToENU=new Matrix4,scratchToCVFrustumPerspective=new PerspectiveFrustum,scratchToCVFrustumOrthographic=new OrthographicFrustum,scratchToCVCamera={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};SceneTransitioner.prototype.morphToColumbusView=function(e,t){defined(this._completeMorph)&&this._completeMorph();const i=this._scene;if(this._previousMode=i.mode,this._previousMode===SceneMode$1.COLUMBUS_VIEW||this._previousMode===SceneMode$1.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.COLUMBUS_VIEW,!0),i.camera._setTransform(Matrix4.IDENTITY);let n=scratchToCVPosition;const r=scratchToCVDirection,o=scratchToCVUp;if(e>0)n.x=0,n.y=-1,n.z=1,n=Cartesian3.multiplyByScalar(Cartesian3.normalize(n,n),5*t.maximumRadius,n),Cartesian3.negate(Cartesian3.normalize(n,r),r),Cartesian3.cross(Cartesian3.UNIT_X,r,o);else{const e=i.camera;if(this._previousMode===SceneMode$1.SCENE2D)Cartesian3.clone(e.position,n),n.z=e.frustum.right-e.frustum.left,Cartesian3.negate(Cartesian3.UNIT_Z,r),Cartesian3.clone(Cartesian3.UNIT_Y,o);else{Cartesian3.clone(e.positionWC,n),Cartesian3.clone(e.directionWC,r),Cartesian3.clone(e.upWC,o);const a=t.scaleToGeodeticSurface(n,scratchToCVSurfacePosition),s=Transforms.eastNorthUpToFixedFrame(a,t,scratchToCVToENU);Matrix4.inverseTransformation(s,s),i.mapProjection.project(t.cartesianToCartographic(n,scratchToCVCartographic),n),Matrix4.multiplyByPointAsVector(s,r,r),Matrix4.multiplyByPointAsVector(s,o,o)}}let a;this._morphToOrthographic?(a=scratchToCVFrustumOrthographic,a.width=i.camera.frustum.right-i.camera.frustum.left,a.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight):(a=scratchToCVFrustumPerspective,a.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,a.fov=CesiumMath.toRadians(60));const s=scratchToCVCamera;s.position=n,s.direction=r,s.up=o,s.frustum=a;const c=completeColumbusViewCallback(s);createMorphHandler(this,c),this._previousMode===SceneMode$1.SCENE2D?morphFrom2DToColumbusView(this,e,s,c):(s.position2D=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,n,scratchToCVPosition2D),s.direction2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,r,scratchToCVDirection2D),s.up2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o,scratchToCVUp2D),i._mode=SceneMode$1.MORPHING,morphFrom3DToColumbusView(this,e,s,c)),0===e&&defined(this._completeMorph)&&this._completeMorph()};const scratchCVTo3DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch2DTo3DFrustumPersp=new PerspectiveFrustum;function createMorphHandler(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new ScreenSpaceEventHandler(e._scene.canvas);const i=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=i,e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.LEFT_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.MIDDLE_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.RIGHT_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.WHEEL)}}function destroyMorphHandler(e){const t=e._currentTweens;for(let e=0;e<t.length;++e)t[e].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}SceneTransitioner.prototype.morphTo3D=function(e,t){defined(this._completeMorph)&&this._completeMorph();const i=this._scene;if(this._previousMode=i.mode,this._previousMode!==SceneMode$1.SCENE3D&&this._previousMode!==SceneMode$1.MORPHING){if(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE3D,!0),i._mode=SceneMode$1.MORPHING,i.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.SCENE2D)morphFrom2DTo3D(this,e,t);else{let n,r;e>0?(n=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*t.maximumRadius,t,n.position),Cartesian3.negate(n.position,n.direction),Cartesian3.normalize(n.direction,n.direction),Cartesian3.clone(Cartesian3.UNIT_Z,n.up)):n=getColumbusViewTo3DCamera(this,t);const o=i.camera;o.frustum instanceof OrthographicFrustum?r=o.frustum.clone():(r=scratch2DTo3DFrustumPersp,r.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,r.fov=CesiumMath.toRadians(60)),n.frustum=r;const a=complete3DCallback(n);createMorphHandler(this,a),morphFromColumbusViewTo3D(this,e,n,a)}0===e&&defined(this._completeMorph)&&this._completeMorph()}},SceneTransitioner.prototype.isDestroyed=function(){return!1},SceneTransitioner.prototype.destroy=function(){return destroyMorphHandler(this),destroyObject(this)};const scratchCVTo3DCartographic=new Cartographic,scratchCVTo3DSurfacePoint=new Cartesian3,scratchCVTo3DFromENU=new Matrix4;function getColumbusViewTo3DCamera(e,t){const i=e._scene,n=i.camera,r=scratchCVTo3DCamera,o=r.position,a=r.direction,s=r.up,c=i.mapProjection.unproject(n.position,scratchCVTo3DCartographic);t.cartographicToCartesian(c,o);const l=t.scaleToGeodeticSurface(o,scratchCVTo3DSurfacePoint),u=Transforms.eastNorthUpToFixedFrame(l,t,scratchCVTo3DFromENU);return Matrix4.multiplyByPointAsVector(u,n.direction,a),Matrix4.multiplyByPointAsVector(u,n.up,s),r}const scratchCVTo3DStartPos=new Cartesian3,scratchCVTo3DStartDir=new Cartesian3,scratchCVTo3DStartUp=new Cartesian3,scratchCVTo3DEndPos=new Cartesian3,scratchCVTo3DEndDir=new Cartesian3,scratchCVTo3DEndUp=new Cartesian3;function morphFromColumbusViewTo3D(e,t,i,n){t*=.5;const r=e._scene,o=r.camera,a=Cartesian3.clone(o.position,scratchCVTo3DStartPos),s=Cartesian3.clone(o.direction,scratchCVTo3DStartDir),c=Cartesian3.clone(o.up,scratchCVTo3DStartUp),l=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,i.position,scratchCVTo3DEndPos),u=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,i.direction,scratchCVTo3DEndDir),d=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,i.up,scratchCVTo3DEndUp);const h=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(a,l,e.time,o.position),columbusViewMorph(s,u,e.time,o.direction),columbusViewMorph(c,d,e.time,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.right,o.right)},complete:function(){addMorphTimeAnimations(e,r,0,1,t,n)}});e._currentTweens.push(h)}const scratch2DTo3DFrustumOrtho=new OrthographicFrustum,scratch3DToCVStartPos=new Cartesian3,scratch3DToCVStartDir=new Cartesian3,scratch3DToCVStartUp=new Cartesian3,scratch3DToCVEndPos=new Cartesian3,scratch3DToCVEndDir=new Cartesian3,scratch3DToCVEndUp=new Cartesian3;function morphFrom2DTo3D(e,t,i){t/=3;const n=e._scene,r=n.camera;let o,a;t>0?(o=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*i.maximumRadius,i,o.position),Cartesian3.negate(o.position,o.direction),Cartesian3.normalize(o.direction,o.direction),Cartesian3.clone(Cartesian3.UNIT_Z,o.up)):(r.position.z=r.frustum.right-r.frustum.left,o=getColumbusViewTo3DCamera(e,i)),e._morphToOrthographic?(a=scratch2DTo3DFrustumOrtho,a.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,a.width=r.frustum.right-r.frustum.left):(a=scratch2DTo3DFrustumPersp,a.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,a.fov=CesiumMath.toRadians(60)),o.frustum=a;const s=complete3DCallback(o);let c;createMorphHandler(e,s),c=e._morphToOrthographic?function(){morphFromColumbusViewTo3D(e,t,o,s)}:function(){morphOrthographicToPerspective(e,t,o,(function(){morphFromColumbusViewTo3D(e,t,o,s)}))},t>0?(n._mode=SceneMode$1.SCENE2D,r.flyTo({duration:t,destination:Cartesian3.fromDegrees(0,0,5*i.maximumRadius,i,scratch3DToCVEndPos),complete:function(){n._mode=SceneMode$1.MORPHING,c()}})):c()}function columbusViewMorph(e,t,i,n){return Cartesian3.lerp(e,t,i,n)}function morphPerspectiveToOrthographic(e,t,i,n,r){const o=e._scene,a=o.camera;if(a.frustum instanceof OrthographicFrustum)return;const s=a.frustum.fov,c=.5*CesiumMath.RADIANS_PER_DEGREE,l=i.position.z*Math.tan(.5*s);a.frustum.far=l/Math.tan(.5*c)+1e7;const u=o.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){a.frustum.fov=CesiumMath.lerp(s,c,e.time);const t=l/Math.tan(.5*a.frustum.fov);n(a,t)},complete:function(){a.frustum=i.frustum.clone(),r(e)}});e._currentTweens.push(u)}const scratchCVTo2DStartPos=new Cartesian3,scratchCVTo2DStartDir=new Cartesian3,scratchCVTo2DStartUp=new Cartesian3,scratchCVTo2DEndPos=new Cartesian3,scratchCVTo2DEndDir=new Cartesian3,scratchCVTo2DEndUp=new Cartesian3,scratchCVTo2DFrustum=new OrthographicOffCenterFrustum,scratchCVTo2DRay=new Ray,scratchCVTo2DPickPos=new Cartesian3,scratchCVTo2DCamera={position:void 0,direction:void 0,up:void 0,frustum:void 0};function morphFromColumbusViewTo2D(e,t){t*=.5;const i=e._scene,n=i.camera,r=Cartesian3.clone(n.position,scratchCVTo2DStartPos),o=Cartesian3.clone(n.direction,scratchCVTo2DStartDir),a=Cartesian3.clone(n.up,scratchCVTo2DStartUp),s=Cartesian3.negate(Cartesian3.UNIT_Z,scratchCVTo2DEndDir),c=Cartesian3.clone(Cartesian3.UNIT_Y,scratchCVTo2DEndUp),l=scratchCVTo2DEndPos;if(t>0)Cartesian3.clone(Cartesian3.ZERO,scratchCVTo2DEndPos),l.z=5*i.mapProjection.ellipsoid.maximumRadius;else{Cartesian3.clone(r,scratchCVTo2DEndPos);const e=scratchCVTo2DRay;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,r,e.origin),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o,e.direction);const t=i.globe;if(defined(t)){const n=t.pickWorldCoordinates(e,i,!0,scratchCVTo2DPickPos);defined(n)&&(Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,n,l),l.z+=Cartesian3.distance(r,l))}}const u=scratchCVTo2DFrustum;u.right=.5*l.z,u.left=-u.right,u.top=u.right*(i.drawingBufferHeight/i.drawingBufferWidth),u.bottom=-u.top;const d=scratchCVTo2DCamera;d.position=l,d.direction=s,d.up=c,d.frustum=u;const h=complete2DCallback(d);function p(e,t){e.position.z=t}createMorphHandler(e,h);const f=i.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(r,l,e.time,n.position),columbusViewMorph(o,s,e.time,n.direction),columbusViewMorph(a,c,e.time,n.up),Cartesian3.cross(n.direction,n.up,n.right),Cartesian3.normalize(n.right,n.right),n._adjustOrthographicFrustum(!0)},complete:function(){morphPerspectiveToOrthographic(e,t,d,p,h)}});e._currentTweens.push(f)}const scratch3DTo2DCartographic=new Cartographic,scratch3DTo2DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,position2D:new Cartesian3,direction2D:new Cartesian3,up2D:new Cartesian3,frustum:new OrthographicOffCenterFrustum},scratch3DTo2DEndCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch3DTo2DPickPosition=new Cartesian3,scratch3DTo2DRay=new Ray,scratch3DTo2DToENU=new Matrix4,scratch3DTo2DSurfacePoint=new Cartesian3;function morphFrom3DTo2D(e,t,i){t*=.5;const n=e._scene,r=n.camera,o=scratch3DTo2DCamera;if(t>0)Cartesian3.clone(Cartesian3.ZERO,o.position),o.position.z=5*i.maximumRadius,Cartesian3.negate(Cartesian3.UNIT_Z,o.direction),Cartesian3.clone(Cartesian3.UNIT_Y,o.up);else{i.cartesianToCartographic(r.positionWC,scratch3DTo2DCartographic),n.mapProjection.project(scratch3DTo2DCartographic,o.position),Cartesian3.negate(Cartesian3.UNIT_Z,o.direction),Cartesian3.clone(Cartesian3.UNIT_Y,o.up);const e=scratch3DTo2DRay;Cartesian3.clone(o.position2D,e.origin);const t=Cartesian3.clone(r.directionWC,e.direction),a=i.scaleToGeodeticSurface(r.positionWC,scratch3DTo2DSurfacePoint),s=Transforms.eastNorthUpToFixedFrame(a,i,scratch3DTo2DToENU);Matrix4.inverseTransformation(s,s),Matrix4.multiplyByPointAsVector(s,t,t),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,t,t);const c=n.globe;if(defined(c)){const t=c.pickWorldCoordinates(e,n,!0,scratch3DTo2DPickPosition);if(defined(t)){const e=Cartesian3.distance(o.position2D,t);t.x+=e,Cartesian3.clone(t,o.position2D)}}}function a(e,t){e.position.x=t}Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,o.position,o.position2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o.direction,o.direction2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o.up,o.up2D);const s=o.frustum;s.right=.5*o.position.z,s.left=-s.right,s.top=s.right*(n.drawingBufferHeight/n.drawingBufferWidth),s.bottom=-s.top;const c=scratch3DTo2DEndCamera;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,o.position2D,c.position),Cartesian3.clone(o.direction,c.direction),Cartesian3.clone(o.up,c.up),c.frustum=s;const l=complete2DCallback(c);createMorphHandler(e,l),morphFrom3DToColumbusView(e,t,o,(function(){morphPerspectiveToOrthographic(e,t,o,a,l)}))}function morphOrthographicToPerspective(e,t,i,n){const r=e._scene,o=r.camera,a=o.frustum.right-o.frustum.left;o.frustum=i.frustum.clone();const s=o.frustum.fov,c=.5*CesiumMath.RADIANS_PER_DEGREE,l=a*Math.tan(.5*s);o.frustum.far=l/Math.tan(.5*c)+1e7,o.frustum.fov=c;const u=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){o.frustum.fov=CesiumMath.lerp(c,s,e.time),o.position.z=l/Math.tan(.5*o.frustum.fov)},complete:function(){n(e)}});e._currentTweens.push(u)}function morphFrom2DToColumbusView(e,t,i,n){t*=.5;const r=e._scene,o=r.camera,a=Cartesian3.clone(i.position,scratch3DToCVEndPos),s=Cartesian3.clone(i.direction,scratch3DToCVEndDir),c=Cartesian3.clone(i.up,scratch3DToCVEndUp);function l(){o.frustum=i.frustum.clone();const l=Cartesian3.clone(o.position,scratch3DToCVStartPos),u=Cartesian3.clone(o.direction,scratch3DToCVStartDir),d=Cartesian3.clone(o.up,scratch3DToCVStartUp);l.z=a.z;const h=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(l,a,e.time,o.position),columbusViewMorph(u,s,e.time,o.direction),columbusViewMorph(d,c,e.time,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.right,o.right)},complete:function(){n(e)}});e._currentTweens.push(h)}r._mode=SceneMode$1.MORPHING,e._morphToOrthographic?l():morphOrthographicToPerspective(e,0,i,l)}function morphFrom3DToColumbusView(e,t,i,n){const r=e._scene,o=r.camera,a=Cartesian3.clone(o.position,scratch3DToCVStartPos),s=Cartesian3.clone(o.direction,scratch3DToCVStartDir),c=Cartesian3.clone(o.up,scratch3DToCVStartUp),l=Cartesian3.clone(i.position2D,scratch3DToCVEndPos),u=Cartesian3.clone(i.direction2D,scratch3DToCVEndDir),d=Cartesian3.clone(i.up2D,scratch3DToCVEndUp);const h=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(a,l,e.time,o.position),columbusViewMorph(s,u,e.time,o.direction),columbusViewMorph(c,d,e.time,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.right,o.right),o._adjustOrthographicFrustum(!0)},complete:function(){addMorphTimeAnimations(e,r,1,0,t,n)}});e._currentTweens.push(h)}function addMorphTimeAnimations(e,t,i,n,r,o){const a={object:t,property:"morphTime",startValue:i,stopValue:n,duration:r,easingFunction:EasingFunction$1.QUARTIC_OUT};defined(o)&&(a.complete=function(){o(e)});const s=t.tweens.addProperty(a);e._currentTweens.push(s)}function complete3DCallback(e){return function(t){const i=t._scene;i._mode=SceneMode$1.SCENE3D,i.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),destroyMorphHandler(t);const n=i.camera;(t._previousMode!==SceneMode$1.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,Cartesian3.clone(e.position,n.position),Cartesian3.clone(e.direction,n.direction),Cartesian3.clone(e.up,n.up),Cartesian3.cross(n.direction,n.up,n.right),Cartesian3.normalize(n.right,n.right),n.frustum=e.frustum.clone());const r=n.frustum;i.frameState.useLogDepth&&(r.near=.1,r.far=1e10);const o=defined(t._completeMorph);t._completeMorph=void 0,i.camera.update(i.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.SCENE3D,o)}}function complete2DCallback(e){return function(t){const i=t._scene;i._mode=SceneMode$1.SCENE2D,i.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE2D),destroyMorphHandler(t);const n=i.camera;Cartesian3.clone(e.position,n.position),n.position.z=2*i.mapProjection.ellipsoid.maximumRadius,Cartesian3.clone(e.direction,n.direction),Cartesian3.clone(e.up,n.up),Cartesian3.cross(n.direction,n.up,n.right),Cartesian3.normalize(n.right,n.right),n.frustum=e.frustum.clone();const r=defined(t._completeMorph);t._completeMorph=void 0,i.camera.update(i.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.SCENE2D,r)}}function completeColumbusViewCallback(e){return function(t){const i=t._scene;i._mode=SceneMode$1.COLUMBUS_VIEW,i.morphTime=SceneMode$1.getMorphTime(SceneMode$1.COLUMBUS_VIEW),destroyMorphHandler(t);const n=i.camera;(t._previousModeMode!==SceneMode$1.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,Cartesian3.clone(e.position,n.position),Cartesian3.clone(e.direction,n.direction),Cartesian3.clone(e.up,n.up),Cartesian3.cross(n.direction,n.up,n.right),Cartesian3.normalize(n.right,n.right));const r=n.frustum;i.frameState.useLogDepth&&(r.near=.1,r.far=1e10);const o=defined(t._completeMorph);t._completeMorph=void 0,i.camera.update(i.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.COLUMBUS_VIEW,o)}}function Tween(e,t,i,n,r,o,a,s,c,l){this._tweens=e,this._tweenjs=t,this._startObject=clone$1(i),this._stopObject=clone$1(n),this._duration=r,this._delay=o,this._easingFunction=a,this._update=s,this._complete=c,this.cancel=l,this.needsStart=!0}function TweenCollection(){this._tweens=[]}function ScreenSpaceCameraController(e){this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=CameraEventType$1.LEFT_DRAG,this.zoomEventTypes=[CameraEventType$1.RIGHT_DRAG,CameraEventType$1.WHEEL,CameraEventType$1.PINCH],this.rotateEventTypes=CameraEventType$1.LEFT_DRAG,this.tiltEventTypes=[CameraEventType$1.MIDDLE_DRAG,CameraEventType$1.PINCH,{eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.CTRL},{eventType:CameraEventType$1.RIGHT_DRAG,modifier:KeyboardEventModifier$1.CTRL}],this.lookEventTypes={eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=e,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new CameraEventAggregator(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._inertiaDisablers={_lastInertiaZoomMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement","_lastInertiaTiltMovement"],_lastInertiaTiltMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement"]},this._tweens=new TweenCollection,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new Cartesian2(-1,-1),this._tiltCenter=new Cartesian3,this._rotateMousePosition=new Cartesian2(-1,-1),this._rotateStartPosition=new Cartesian3,this._strafeStartPosition=new Cartesian3,this._strafeMousePosition=new Cartesian2,this._strafeEndMousePosition=new Cartesian2,this._zoomMouseStart=new Cartesian2(-1,-1),this._zoomWorldPosition=new Cartesian3,this._useZoomWorldPosition=!1,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._zoomingUnderground=!1,this._rotatingZoom=!1,this._adjustedHeightForTerrain=!1,this._cameraUnderground=!1;const t=e.mapProjection;this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=2e-4,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}function decay(e,t){if(e<0)return 0;const i=25*(1-t);return Math.exp(-i*e)}function sameMousePosition(e){return Cartesian2.equalsEpsilon(e.startPosition,e.endPosition,CesiumMath.EPSILON14)}Object.defineProperties(Tween.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}}),Tween.prototype.cancelTween=function(){this._tweens.remove(this)},Object.defineProperties(TweenCollection.prototype,{length:{get:function(){return this._tweens.length}}}),TweenCollection.prototype.add=function(e){if(0===(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).duration)return defined(e.complete)&&e.complete(),new Tween(this);const t=e.duration/TimeConstants$1.SECONDS_PER_MILLISECOND,i=defaultValue(e.delay,0),n=i/TimeConstants$1.SECONDS_PER_MILLISECOND,r=defaultValue(e.easingFunction,EasingFunction$1.LINEAR_NONE),o=e.startObject,a=new Tween$1.Tween(o);a.to(clone$1(e.stopObject),t),a.delay(n),a.easing(r),defined(e.update)&&a.onUpdate((function(){e.update(o)})),a.onComplete(defaultValue(e.complete,null)),a.repeat(defaultValue(e._repeat,0));const s=new Tween(this,a,e.startObject,e.stopObject,e.duration,i,r,e.update,e.complete,e.cancel);return this._tweens.push(s),s},TweenCollection.prototype.addProperty=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).object,i=e.property,n=e.startValue,r=e.stopValue;return this.add({startObject:{value:n},stopObject:{value:r},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){t[i]=e.value},complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},TweenCollection.prototype.addAlpha=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material,i=[];for(const e in t.uniforms)t.uniforms.hasOwnProperty(e)&&defined(t.uniforms[e])&&defined(t.uniforms[e].alpha)&&i.push(e);return this.add({startObject:{alpha:defaultValue(e.startValue,0)},stopObject:{alpha:defaultValue(e.stopValue,1)},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){const n=i.length;for(let r=0;r<n;++r)t.uniforms[i[r]].alpha=e.alpha},complete:e.complete,cancel:e.cancel})},TweenCollection.prototype.addOffsetIncrement=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material.uniforms;return this.addProperty({object:t,property:"offset",startValue:t.offset,stopValue:t.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},TweenCollection.prototype.remove=function(e){if(!defined(e))return!1;const t=this._tweens.indexOf(e);return-1!==t&&(e.tweenjs.stop(),defined(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0)},TweenCollection.prototype.removeAll=function(){const e=this._tweens;for(let t=0;t<e.length;++t){const i=e[t];i.tweenjs.stop(),defined(i.cancel)&&i.cancel()}e.length=0},TweenCollection.prototype.contains=function(e){return defined(e)&&-1!==this._tweens.indexOf(e)},TweenCollection.prototype.get=function(e){return this._tweens[e]},TweenCollection.prototype.update=function(e){const t=this._tweens;let i=0;for(e=defined(e)?e/TimeConstants$1.SECONDS_PER_MILLISECOND:getTimestamp$1();i<t.length;){const n=t[i],r=n.tweenjs;n.needsStart?(n.needsStart=!1,r.start(e)):r.update(e)?i++:(r.stop(),t.splice(i,1))}};const inertiaMaxClickTimeThreshold=.4;function maintainInertia(e,t,i,n,r,o,a){let s=o[a];defined(s)||(s=o[a]={startPosition:new Cartesian2,endPosition:new Cartesian2,motion:new Cartesian2,inertiaEnabled:!0});const c=e.getButtonPressTime(t,i),l=e.getButtonReleaseTime(t,i),u=c&&l&&(l.getTime()-c.getTime())/1e3,d=new Date,h=l&&(d.getTime()-l.getTime())/1e3;if(c&&l&&u<inertiaMaxClickTimeThreshold){const a=decay(h,n),c=e.getLastMovement(t,i);if(!defined(c)||sameMousePosition(c)||!s.inertiaEnabled)return;if(s.motion.x=.5*(c.endPosition.x-c.startPosition.x),s.motion.y=.5*(c.endPosition.y-c.startPosition.y),s.startPosition=Cartesian2.clone(c.startPosition,s.startPosition),s.endPosition=Cartesian2.multiplyByScalar(s.motion,a,s.endPosition),s.endPosition=Cartesian2.add(s.startPosition,s.endPosition,s.endPosition),isNaN(s.endPosition.x)||isNaN(s.endPosition.y)||Cartesian2.distance(s.startPosition,s.endPosition)<.5)return;if(!e.isButtonDown(t,i)){r(o,e.getStartMousePosition(t,i),s)}}}function activateInertia(e,t){if(defined(t)){let i=e[t];defined(i)&&(i.inertiaEnabled=!0);const n=e._inertiaDisablers[t];if(defined(n)){const t=n.length;for(let r=0;r<t;++r)i=e[n[r]],defined(i)&&(i.inertiaEnabled=!1)}}}const scratchEventTypeArray=[];function reactToInput(e,t,i,n,r,o){if(!defined(i))return;const a=e._aggregator;Array.isArray(i)||(scratchEventTypeArray[0]=i,i=scratchEventTypeArray);const s=i.length;for(let c=0;c<s;++c){const s=i[c],l=defined(s.eventType)?s.eventType:s,u=s.modifier,d=a.isMoving(l,u)&&a.getMovement(l,u),h=a.getStartMousePosition(l,u);e.enableInputs&&t&&(d?(n(e,h,d),activateInertia(e,o)):r<1&&maintainInertia(a,l,u,r,n,e,o))}}const scratchZoomPickRay=new Ray,scratchPickCartesian$1=new Cartesian3,scratchZoomOffset=new Cartesian2,scratchZoomDirection=new Cartesian3,scratchCenterPixel=new Cartesian2,scratchCenterPosition=new Cartesian3,scratchPositionNormal=new Cartesian3,scratchPickNormal=new Cartesian3,scratchZoomAxis=new Cartesian3,scratchCameraPositionNormal=new Cartesian3,scratchTargetNormal=new Cartesian3,scratchCameraPosition=new Cartesian3,scratchCameraUpNormal=new Cartesian3,scratchCameraRightNormal=new Cartesian3,scratchForwardNormal=new Cartesian3,scratchPositionToTarget=new Cartesian3,scratchPositionToTargetNormal=new Cartesian3,scratchPan=new Cartesian3,scratchCenterMovement=new Cartesian3,scratchCenter=new Cartesian3,scratchCartesian=new Cartesian3,scratchCartesianTwo=new Cartesian3,scratchCartesianThree=new Cartesian3,scratchZoomViewOptions={orientation:new HeadingPitchRoll};function handleZoom(e,t,i,n,r,o){let a=1;defined(o)&&(a=CesiumMath.clamp(Math.abs(o),.25,1));const s=i.endPosition.y-i.startPosition.y,c=s>0?e.minimumZoomDistance*a:0,l=e.maximumZoomDistance;let u=n*(r-c);u=CesiumMath.clamp(u,e._minimumZoomRate,e._maximumZoomRate);let d=s/e._scene.canvas.clientHeight;d=Math.min(d,e.maximumMovementRatio);let h=u*d;if(e.enableCollisionDetection||0===e.minimumZoomDistance||!defined(e._globe)){if(h>0&&Math.abs(r-c)<1)return;if(h<0&&Math.abs(r-l)<1)return;r-h<c?h=r-c-1:r-h>l&&(h=r-l)}const p=e._scene,f=p.camera,m=p.mode,g=scratchZoomViewOptions.orientation;if(g.heading=f.heading,g.pitch=f.pitch,g.roll=f.roll,f.frustum instanceof OrthographicFrustum)return void(Math.abs(h)>0&&(f.zoomIn(h),f._adjustOrthographicFrustum()));const _=Cartesian2.equals(t,e._zoomMouseStart);let y,C=e._zoomingOnVector,T=e._rotatingZoom;if(_||(e._zoomMouseStart=Cartesian2.clone(t,e._zoomMouseStart),defined(e._globe)&&(m===SceneMode$1.SCENE2D?(y=f.getPickRay(t,scratchZoomPickRay).origin,y=Cartesian3.fromElements(y.y,y.z,y.x)):y=pickGlobe(e,t,scratchPickCartesian$1)),defined(y)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=Cartesian3.clone(y,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,C=e._zoomingOnVector=!1,T=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition)return void f.zoomIn(h);let S=m===SceneMode$1.COLUMBUS_VIEW;if(f.positionCartographic.height<2e6&&(T=!0),!_||T){if(m===SceneMode$1.SCENE2D){const i=e._zoomWorldPosition,n=f.position;if(!Cartesian3.equals(i,n)&&f.positionCartographic.height<2*e._maxCoord.x){const r=f.position.x,o=Cartesian3.subtract(i,n,scratchZoomDirection);Cartesian3.normalize(o,o);const a=Cartesian3.distance(i,n)*h/(.5*f.getMagnitude());f.move(o,.5*a),(f.position.x<0&&r>0||f.position.x>0&&r<0)&&(y=f.getPickRay(t,scratchZoomPickRay).origin,y=Cartesian3.fromElements(y.y,y.z,y.x),e._zoomWorldPosition=Cartesian3.clone(y,e._zoomWorldPosition))}}else if(m===SceneMode$1.SCENE3D){const t=Cartesian3.normalize(f.position,scratchCameraPositionNormal);if(e._cameraUnderground||e._zoomingUnderground||f.positionCartographic.height<3e3&&Math.abs(Cartesian3.dot(f.direction,t))<.6)S=!0;else{const i=p.canvas,n=scratchCenterPixel;n.x=i.clientWidth/2,n.y=i.clientHeight/2;const r=pickGlobe(e,n,scratchCenterPosition);if(defined(r))if(f.positionCartographic.height<1e6){if(!(Cartesian3.dot(f.direction,t)>=-.5)){const i=scratchCameraPosition;Cartesian3.clone(f.position,i);const n=e._zoomWorldPosition;let r=scratchTargetNormal;if(r=Cartesian3.normalize(n,r),Cartesian3.dot(r,t)<0)return;const o=scratchCenter,a=scratchForwardNormal;Cartesian3.clone(f.direction,a),Cartesian3.add(i,Cartesian3.multiplyByScalar(a,1e3,scratchCartesian),o);const s=scratchPositionToTarget,c=scratchPositionToTargetNormal;Cartesian3.subtract(n,i,s),Cartesian3.normalize(s,c);const l=Cartesian3.dot(t,c);if(l>=0)return void(e._zoomMouseStart.x=-1);const u=Math.acos(-l),d=Cartesian3.magnitude(i),p=Cartesian3.magnitude(n),m=d-h,g=Cartesian3.magnitude(s),_=Math.asin(CesiumMath.clamp(g/p*Math.sin(u),-1,1))-Math.asin(CesiumMath.clamp(m/p*Math.sin(u),-1,1))+u,y=scratchCameraUpNormal;Cartesian3.normalize(i,y);let C=scratchCameraRightNormal;C=Cartesian3.cross(c,y,C),C=Cartesian3.normalize(C,C),Cartesian3.normalize(Cartesian3.cross(y,C,scratchCartesian),a),Cartesian3.multiplyByScalar(Cartesian3.normalize(o,scratchCartesian),Cartesian3.magnitude(o)-h,o),Cartesian3.normalize(i,i),Cartesian3.multiplyByScalar(i,m,i);const T=scratchPan;Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(y,Math.cos(_)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(a,Math.sin(_),scratchCartesianThree),scratchCartesian),m,T),Cartesian3.add(i,T,i),Cartesian3.normalize(o,y),Cartesian3.normalize(Cartesian3.cross(y,C,scratchCartesian),a);const S=scratchCenterMovement;return Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(y,Math.cos(_)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(a,Math.sin(_),scratchCartesianThree),scratchCartesian),Cartesian3.magnitude(o),S),Cartesian3.add(o,S,o),Cartesian3.clone(i,f.position),Cartesian3.normalize(Cartesian3.subtract(o,i,scratchCartesian),f.direction),Cartesian3.clone(f.direction,f.direction),Cartesian3.cross(f.direction,f.up,f.right),Cartesian3.cross(f.right,f.direction,f.up),void f.setView(scratchZoomViewOptions)}S=!0}else{const t=Cartesian3.normalize(r,scratchPositionNormal),i=Cartesian3.normalize(e._zoomWorldPosition,scratchPickNormal),n=Cartesian3.dot(i,t);if(n>0&&n<1){const e=CesiumMath.acosClamped(n),r=Cartesian3.cross(i,t,scratchZoomAxis),o=h/(Math.abs(e)>CesiumMath.toRadians(20)?.75*f.positionCartographic.height:f.positionCartographic.height-h);f.rotate(r,e*o)}}else S=!0}}e._rotatingZoom=!S}if(!_&&S||C){let i;const n=SceneTransforms.wgs84ToWindowCoordinates(p,e._zoomWorldPosition,scratchZoomOffset);i=m!==SceneMode$1.COLUMBUS_VIEW&&Cartesian2.equals(t,e._zoomMouseStart)&&defined(n)?f.getPickRay(n,scratchZoomPickRay):f.getPickRay(t,scratchZoomPickRay);const r=i.direction;m!==SceneMode$1.COLUMBUS_VIEW&&m!==SceneMode$1.SCENE2D||Cartesian3.fromElements(r.y,r.z,r.x,r),f.move(r,h),e._zoomingOnVector=!0}else f.zoomIn(h);e._cameraUnderground||f.setView(scratchZoomViewOptions)}const translate2DStart=new Ray,translate2DEnd=new Ray,scratchTranslateP0=new Cartesian3;function translate2D(e,t,i){const n=e._scene.camera;let r=n.getPickRay(i.startPosition,translate2DStart).origin,o=n.getPickRay(i.endPosition,translate2DEnd).origin;r=Cartesian3.fromElements(r.y,r.z,r.x,r),o=Cartesian3.fromElements(o.y,o.z,o.x,o);const a=Cartesian3.subtract(r,o,scratchTranslateP0),s=Cartesian3.magnitude(a);s>0&&(Cartesian3.normalize(a,a),n.move(a,s))}function zoom2D(e,t,i){defined(i.distance)&&(i=i.distance);const n=e._scene.camera;handleZoom(e,t,i,e._zoomFactor,n.getMagnitude())}const twist2DStart=new Cartesian2,twist2DEnd=new Cartesian2;function twist2D(e,t,i){if(defined(i.angleAndHeight))return void singleAxisTwist2D(e,t,i.angleAndHeight);const n=e._scene,r=n.camera,o=n.canvas,a=o.clientWidth,s=o.clientHeight;let c=twist2DStart;c.x=2/a*i.startPosition.x-1,c.y=2/s*(s-i.startPosition.y)-1,c=Cartesian2.normalize(c,c);let l=twist2DEnd;l.x=2/a*i.endPosition.x-1,l.y=2/s*(s-i.endPosition.y)-1,l=Cartesian2.normalize(l,l);let u=CesiumMath.acosClamped(c.x);c.y<0&&(u=CesiumMath.TWO_PI-u);let d=CesiumMath.acosClamped(l.x);l.y<0&&(d=CesiumMath.TWO_PI-d);const h=d-u;r.twistRight(h)}function singleAxisTwist2D(e,t,i){let n=e._rotateFactor*e._rotateRateRangeAdjustment;n>e._maximumRotateRate&&(n=e._maximumRotateRate),n<e._minimumRotateRate&&(n=e._minimumRotateRate);const r=e._scene,o=r.camera,a=r.canvas;let s=(i.endPosition.x-i.startPosition.x)/a.clientWidth;s=Math.min(s,e.maximumMovementRatio);const c=n*s*Math.PI*4;o.twistRight(c)}function update2D(e){const t=e._scene.mapMode2D===MapMode2D$1.ROTATE;Matrix4.equals(Matrix4.IDENTITY,e._scene.camera.transform)?(reactToInput(e,e.enableTranslate,e.translateEventTypes,translate2D,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.tiltEventTypes,twist2D,e.inertiaSpin,"_lastInertiaTiltMovement")):(reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.translateEventTypes,twist2D,e.inertiaSpin,"_lastInertiaSpinMovement"))}const pickGlobeScratchRay=new Ray,scratchDepthIntersection=new Cartesian3,scratchRayIntersection=new Cartesian3;function pickGlobe(e,t,i){const n=e._scene,r=e._globe,o=n.camera;if(!defined(r))return;const a=!e._cameraUnderground;let s;n.pickPositionSupported&&(s=n.pickPositionWorldCoordinates(t,scratchDepthIntersection));const c=o.getPickRay(t,pickGlobeScratchRay),l=r.pickWorldCoordinates(c,n,a,scratchRayIntersection);return(defined(s)?Cartesian3.distance(s,o.positionWC):Number.POSITIVE_INFINITY)<(defined(l)?Cartesian3.distance(l,o.positionWC):Number.POSITIVE_INFINITY)?Cartesian3.clone(s,i):Cartesian3.clone(l,i)}const scratchDistanceCartographic=new Cartographic;function getDistanceFromSurface(e){const t=e._ellipsoid,i=e._scene,n=i.camera;let r=0;if(i.mode===SceneMode$1.SCENE3D){const e=t.cartesianToCartographic(n.position,scratchDistanceCartographic);defined(e)&&(r=e.height)}else r=n.position.z;const o=defaultValue(e._scene.globeHeight,0);return Math.abs(o-r)}const scratchSurfaceNormal=new Cartesian3;function getZoomDistanceUnderground(e,t){const i=t.origin,n=t.direction,r=getDistanceFromSurface(e),o=Cartesian3.normalize(i,scratchSurfaceNormal);let a=Math.abs(Cartesian3.dot(o,n));return a=2*Math.max(a,.5),r*a}function getTiltCenterUnderground(e,t,i,n){let r=Cartesian3.distance(t.origin,i);const o=getDistanceFromSurface(e);return r>CesiumMath.clamp(5*o,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance)&&(r=Math.min(r,o/5),r=Math.max(r,100)),Ray.getPoint(t,r,n)}function getStrafeStartPositionUnderground(e,t,i,n){let r;return defined(i)?(r=Cartesian3.distance(t.origin,i),r>e._maximumUndergroundPickDistance&&(r=getDistanceFromSurface(e))):r=getDistanceFromSurface(e),Ray.getPoint(t,r,n)}const scratchInertialDelta=new Cartesian2;function continueStrafing(e,t){const i=t.endPosition,n=Cartesian2.subtract(t.endPosition,t.startPosition,scratchInertialDelta),r=e._strafeEndMousePosition;Cartesian2.add(r,n,r),t.endPosition=r,strafe(e,t,e._strafeStartPosition),t.endPosition=i}const translateCVStartRay=new Ray,translateCVEndRay=new Ray,translateCVStartPos=new Cartesian3,translateCVEndPos=new Cartesian3,translateCVDifference=new Cartesian3,translateCVOrigin=new Cartesian3,translateCVPlane=new Plane(Cartesian3.UNIT_X,0),translateCVStartMouse=new Cartesian2,translateCVEndMouse=new Cartesian2;function translateCV(e,t,i){if(Cartesian3.equals(t,e._translateMousePosition)||(e._looking=!1),Cartesian3.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking)return void look3D(e,t,i);if(e._strafing)return void continueStrafing(e,i);const n=e._scene.camera,r=e._cameraUnderground,o=Cartesian2.clone(i.startPosition,translateCVStartMouse),a=Cartesian2.clone(i.endPosition,translateCVEndMouse);let s=n.getPickRay(o,translateCVStartRay);const c=Cartesian3.clone(Cartesian3.ZERO,translateCVOrigin),l=Cartesian3.UNIT_X;let u;if(n.position.z<e._minimumPickingTerrainHeight&&(u=pickGlobe(e,o,translateCVStartPos),defined(u)&&(c.x=u.x)),r||c.x>n.position.z&&defined(u)){let n=u;return r&&(n=getStrafeStartPositionUnderground(e,s,u,translateCVStartPos)),Cartesian2.clone(t,e._strafeMousePosition),Cartesian2.clone(t,e._strafeEndMousePosition),Cartesian3.clone(n,e._strafeStartPosition),e._strafing=!0,void strafe(e,i,e._strafeStartPosition)}const d=Plane.fromPointNormal(c,l,translateCVPlane);s=n.getPickRay(o,translateCVStartRay);const h=IntersectionTests.rayPlane(s,d,translateCVStartPos),p=n.getPickRay(a,translateCVEndRay),f=IntersectionTests.rayPlane(p,d,translateCVEndPos);if(!defined(h)||!defined(f))return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._translateMousePosition);const m=Cartesian3.subtract(h,f,translateCVDifference),g=m.x;m.x=m.y,m.y=m.z,m.z=g;const _=Cartesian3.magnitude(m);_>CesiumMath.EPSILON6&&(Cartesian3.normalize(m,m),n.move(m,_))}const rotateCVWindowPos=new Cartesian2,rotateCVWindowRay=new Ray,rotateCVCenter=new Cartesian3,rotateCVVerticalCenter=new Cartesian3,rotateCVTransform=new Matrix4,rotateCVVerticalTransform=new Matrix4,rotateCVOrigin=new Cartesian3,rotateCVPlane=new Plane(Cartesian3.UNIT_X,0),rotateCVCartesian3=new Cartesian3,rotateCVCart=new Cartographic,rotateCVOldTransform=new Matrix4,rotateCVQuaternion=new Quaternion,rotateCVMatrix=new Matrix3,tilt3DCartesian3=new Cartesian3;function rotateCV(e,t,i){if(defined(i.angleAndHeight)&&(i=i.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking)return void look3D(e,t,i);const n=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(n.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,rotateCVOnPlane(e,t,i)):rotateCVOnTerrain(e,t,i)}function rotateCVOnPlane(e,t,i){const n=e._scene,r=n.camera,o=n.canvas,a=rotateCVWindowPos;a.x=o.clientWidth/2,a.y=o.clientHeight/2;const s=r.getPickRay(a,rotateCVWindowRay),c=Cartesian3.UNIT_X,l=s.origin,u=s.direction;let d;const h=Cartesian3.dot(c,u);if(Math.abs(h)>CesiumMath.EPSILON6&&(d=-Cartesian3.dot(c,l)/h),!defined(d)||d<=0)return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._tiltCenterMousePosition);const p=Cartesian3.multiplyByScalar(u,d,rotateCVCenter);Cartesian3.add(l,p,p);const f=n.mapProjection,m=f.ellipsoid;Cartesian3.fromElements(p.y,p.z,p.x,p);const g=f.unproject(p,rotateCVCart);m.cartographicToCartesian(g,p);const _=Transforms.eastNorthUpToFixedFrame(p,m,rotateCVTransform),y=e._globe,C=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const T=Matrix4.clone(r.transform,rotateCVOldTransform);r._setTransform(_),rotate3D(e,t,i,Cartesian3.UNIT_Z),r._setTransform(T),e._globe=y,e._ellipsoid=C;const S=C.maximumRadius;e._rotateFactor=1/S,e._rotateRateRangeAdjustment=S}function rotateCVOnTerrain(e,t,i){const n=e._scene,r=n.camera,o=e._cameraUnderground;let a,s;const c=Cartesian3.UNIT_X;if(Cartesian2.equals(t,e._tiltCenterMousePosition))a=Cartesian3.clone(e._tiltCenter,rotateCVCenter);else{if(r.position.z<e._minimumPickingTerrainHeight&&(a=pickGlobe(e,t,rotateCVCenter)),!defined(a)){s=r.getPickRay(t,rotateCVWindowRay);const n=s.origin,o=s.direction;let l;const u=Cartesian3.dot(c,o);if(Math.abs(u)>CesiumMath.EPSILON6&&(l=-Cartesian3.dot(c,n)/u),!defined(l)||l<=0)return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._tiltCenterMousePosition);a=Cartesian3.multiplyByScalar(o,l,rotateCVCenter),Cartesian3.add(n,a,a)}o&&(defined(s)||(s=r.getPickRay(t,rotateCVWindowRay)),getTiltCenterUnderground(e,s,a,a)),Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(a,e._tiltCenter)}const l=n.canvas,u=rotateCVWindowPos;u.x=l.clientWidth/2,u.y=e._tiltCenterMousePosition.y,s=r.getPickRay(u,rotateCVWindowRay);const d=Cartesian3.clone(Cartesian3.ZERO,rotateCVOrigin);d.x=a.x;const h=Plane.fromPointNormal(d,c,rotateCVPlane),p=IntersectionTests.rayPlane(s,h,rotateCVVerticalCenter),f=r._projection,m=f.ellipsoid;Cartesian3.fromElements(a.y,a.z,a.x,a);let g=f.unproject(a,rotateCVCart);m.cartographicToCartesian(g,a);const _=Transforms.eastNorthUpToFixedFrame(a,m,rotateCVTransform);let y;defined(p)?(Cartesian3.fromElements(p.y,p.z,p.x,p),g=f.unproject(p,rotateCVCart),m.cartographicToCartesian(g,p),y=Transforms.eastNorthUpToFixedFrame(p,m,rotateCVVerticalTransform)):y=_;const C=e._globe,T=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let S=Cartesian3.UNIT_Z;const v=Matrix4.clone(r.transform,rotateCVOldTransform);r._setTransform(_);const A=Cartesian3.cross(Cartesian3.UNIT_Z,Cartesian3.normalize(r.position,rotateCVCartesian3),rotateCVCartesian3),E=Cartesian3.dot(r.right,A);if(rotate3D(e,t,i,S,!1,!0),r._setTransform(y),E<0){const n=i.startPosition.y-i.endPosition.y;(o&&n<0||!o&&n>0)&&(S=void 0);const a=r.constrainedAxis;r.constrainedAxis=void 0,rotate3D(e,t,i,S,!0,!1),r.constrainedAxis=a}else rotate3D(e,t,i,S,!0,!1);if(defined(r.constrainedAxis)){const e=Cartesian3.cross(r.direction,r.constrainedAxis,tilt3DCartesian3);Cartesian3.equalsEpsilon(e,Cartesian3.ZERO,CesiumMath.EPSILON6)||(Cartesian3.dot(e,r.right)<0&&Cartesian3.negate(e,e),Cartesian3.cross(e,r.direction,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.normalize(r.up,r.up),Cartesian3.normalize(r.right,r.right))}r._setTransform(v),e._globe=C,e._ellipsoid=T;const b=T.maximumRadius;e._rotateFactor=1/b,e._rotateRateRangeAdjustment=b;const x=Cartesian3.clone(r.positionWC,rotateCVCartesian3);if(e.enableCollisionDetection&&adjustHeightForTerrain(e),!Cartesian3.equals(r.positionWC,x)){r._setTransform(y),r.worldToCameraCoordinatesPoint(x,x);const e=Cartesian3.magnitudeSquared(x);Cartesian3.magnitudeSquared(r.position)>e&&(Cartesian3.normalize(r.position,r.position),Cartesian3.multiplyByScalar(r.position,Math.sqrt(e),r.position));const t=Cartesian3.angleBetween(x,r.position),i=Cartesian3.cross(x,r.position,x);Cartesian3.normalize(i,i);const n=Quaternion.fromAxisAngle(i,t,rotateCVQuaternion),o=Matrix3.fromQuaternion(n,rotateCVMatrix);Matrix3.multiplyByVector(o,r.direction,r.direction),Matrix3.multiplyByVector(o,r.up,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.cross(r.right,r.direction,r.up),r._setTransform(v)}}const zoomCVWindowPos=new Cartesian2,zoomCVWindowRay=new Ray,zoomCVIntersection=new Cartesian3;function zoomCV(e,t,i){defined(i.distance)&&(i=i.distance);const n=e._scene,r=n.camera,o=n.canvas,a=e._cameraUnderground;let s;a?s=t:(s=zoomCVWindowPos,s.x=o.clientWidth/2,s.y=o.clientHeight/2);const c=r.getPickRay(s,zoomCVWindowRay),l=c.origin,u=c.direction;let d,h;if(r.position.z<e._minimumPickingTerrainHeight&&(d=pickGlobe(e,s,zoomCVIntersection)),defined(d)&&(h=Cartesian3.distance(l,d)),a){const t=getZoomDistanceUnderground(e,c);h=defined(h)?Math.min(h,t):t}if(!defined(h)){const e=Cartesian3.UNIT_X;h=-Cartesian3.dot(e,l)/Cartesian3.dot(e,u)}handleZoom(e,t,i,e._zoomFactor,h)}function updateCV(e){const t=e._scene.camera;if(Matrix4.equals(Matrix4.IDENTITY,t.transform)){const i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),reactToInput(e,e.enableTilt,e.tiltEventTypes,rotateCV,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableTranslate,e.translateEventTypes,translateCV,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoomCV,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){const n=t.createCorrectPositionTween(e.bounceAnimationTime);defined(n)&&(e._tween=i.add(n))}i.update()}else reactToInput(e,e.enableRotate,e.rotateEventTypes,rotate3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D,e.inertiaZoom,"_lastInertiaZoomMovement")}const scratchStrafeRay=new Ray,scratchStrafePlane=new Plane(Cartesian3.UNIT_X,0),scratchStrafeIntersection=new Cartesian3,scratchStrafeDirection=new Cartesian3,scratchMousePos=new Cartesian3;function strafe(e,t,i){const n=e._scene,r=n.camera,o=r.getPickRay(t.endPosition,scratchStrafeRay);let a=Cartesian3.clone(r.direction,scratchStrafeDirection);n.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(a.z,a.x,a.y,a);const s=Plane.fromPointNormal(i,a,scratchStrafePlane),c=IntersectionTests.rayPlane(o,s,scratchStrafeIntersection);defined(c)&&(a=Cartesian3.subtract(i,c,a),n.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(a.y,a.z,a.x,a),Cartesian3.add(r.position,a,r.position))}const spin3DPick=new Cartesian3,scratchCartographic=new Cartographic,scratchRadii=new Cartesian3,scratchEllipsoid=new Ellipsoid,scratchLookUp=new Cartesian3,scratchNormal=new Cartesian3;function spin3D(e,t,i){const n=e._scene.camera,r=e._cameraUnderground;let o,a,s=e._ellipsoid;if(!Matrix4.equals(n.transform,Matrix4.IDENTITY))return void rotate3D(e,t,i);const c=s.geodeticSurfaceNormal(n.position,scratchLookUp);if(Cartesian2.equals(t,e._rotateMousePosition)){if(e._looking)look3D(e,t,i,c);else if(e._rotating)rotate3D(e,t,i);else if(e._strafing)continueStrafing(e,i);else{if(Cartesian3.magnitude(n.position)<Cartesian3.magnitude(e._rotateStartPosition))return;o=Cartesian3.magnitude(e._rotateStartPosition),a=scratchRadii,a.x=a.y=a.z=o,s=Ellipsoid.fromCartesian3(a,scratchEllipsoid),pan3D(e,t,i,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const l=s.cartesianToCartographic(n.positionWC,scratchCartographic).height;if(defined(e._globe)&&l<e._minimumPickingTerrainHeight){const l=pickGlobe(e,i.startPosition,scratchMousePos);if(defined(l)){let c=!1;const u=n.getPickRay(i.startPosition,pickGlobeScratchRay);if(r)c=!0,getStrafeStartPositionUnderground(e,u,l,l);else{const e=s.geodeticSurfaceNormal(l,scratchNormal);c=!!(Math.abs(Cartesian3.dot(u.direction,e))<.05)||Cartesian3.magnitude(n.position)<Cartesian3.magnitude(l)}c?(Cartesian2.clone(t,e._strafeEndMousePosition),Cartesian3.clone(l,e._strafeStartPosition),e._strafing=!0,strafe(e,i,e._strafeStartPosition)):(o=Cartesian3.magnitude(l),a=scratchRadii,a.x=a.y=a.z=o,s=Ellipsoid.fromCartesian3(a,scratchEllipsoid),pan3D(e,t,i,s),Cartesian3.clone(l,e._rotateStartPosition))}else e._looking=!0,look3D(e,t,i,c)}else defined(n.pickEllipsoid(i.startPosition,e._ellipsoid,spin3DPick))?(pan3D(e,t,i,e._ellipsoid),Cartesian3.clone(spin3DPick,e._rotateStartPosition)):l>e._minimumTrackBallHeight?(e._rotating=!0,rotate3D(e,t,i)):(e._looking=!0,look3D(e,t,i,c));Cartesian2.clone(t,e._rotateMousePosition)}function rotate3D(e,t,i,n,r,o){r=defaultValue(r,!1),o=defaultValue(o,!1);const a=e._scene,s=a.camera,c=a.canvas,l=s.constrainedAxis;defined(n)&&(s.constrainedAxis=n);const u=Cartesian3.magnitude(s.position);let d=e._rotateFactor*(u-e._rotateRateRangeAdjustment);d>e._maximumRotateRate&&(d=e._maximumRotateRate),d<e._minimumRotateRate&&(d=e._minimumRotateRate);let h=(i.startPosition.x-i.endPosition.x)/c.clientWidth,p=(i.startPosition.y-i.endPosition.y)/c.clientHeight;h=Math.min(h,e.maximumMovementRatio),p=Math.min(p,e.maximumMovementRatio);const f=d*h*Math.PI*2,m=d*p*Math.PI;r||s.rotateRight(f),o||s.rotateUp(m),s.constrainedAxis=l}const pan3DP0=Cartesian4.clone(Cartesian4.UNIT_W),pan3DP1=Cartesian4.clone(Cartesian4.UNIT_W),pan3DTemp0=new Cartesian3,pan3DTemp1=new Cartesian3,pan3DTemp2=new Cartesian3,pan3DTemp3=new Cartesian3,pan3DStartMousePosition=new Cartesian2,pan3DEndMousePosition=new Cartesian2;function pan3D(e,t,i,n){const r=e._scene.camera,o=Cartesian2.clone(i.startPosition,pan3DStartMousePosition),a=Cartesian2.clone(i.endPosition,pan3DEndMousePosition);let s=r.pickEllipsoid(o,n,pan3DP0),c=r.pickEllipsoid(a,n,pan3DP1);if(!defined(s)||!defined(c))return e._rotating=!0,void rotate3D(e,t,i);if(s=r.worldToCameraCoordinates(s,s),c=r.worldToCameraCoordinates(c,c),defined(r.constrainedAxis)){const e=r.constrainedAxis,t=Cartesian3.mostOrthogonalAxis(e,pan3DTemp0);Cartesian3.cross(t,e,t),Cartesian3.normalize(t,t);const i=Cartesian3.cross(e,t,pan3DTemp1),n=Cartesian3.magnitude(s),o=Cartesian3.dot(e,s),a=Math.acos(o/n),l=Cartesian3.multiplyByScalar(e,o,pan3DTemp2);Cartesian3.subtract(s,l,l),Cartesian3.normalize(l,l);const u=Cartesian3.magnitude(c),d=Cartesian3.dot(e,c),h=Math.acos(d/u),p=Cartesian3.multiplyByScalar(e,d,pan3DTemp3);Cartesian3.subtract(c,p,p),Cartesian3.normalize(p,p);let f=Math.acos(Cartesian3.dot(l,t));Cartesian3.dot(l,i)<0&&(f=CesiumMath.TWO_PI-f);let m=Math.acos(Cartesian3.dot(p,t));Cartesian3.dot(p,i)<0&&(m=CesiumMath.TWO_PI-m);const g=f-m;let _;_=Cartesian3.equalsEpsilon(e,r.position,CesiumMath.EPSILON2)?r.right:Cartesian3.cross(e,r.position,pan3DTemp0);const y=Cartesian3.cross(e,_,pan3DTemp0),C=Cartesian3.dot(y,Cartesian3.subtract(s,e,pan3DTemp1)),T=Cartesian3.dot(y,Cartesian3.subtract(c,e,pan3DTemp1));let S;S=C>0&&T>0?h-a:C>0&&T<=0?Cartesian3.dot(r.position,e)>0?-a-h:a+h:a-h,r.rotateRight(g),r.rotateUp(S)}else{Cartesian3.normalize(s,s),Cartesian3.normalize(c,c);const e=Cartesian3.dot(s,c),t=Cartesian3.cross(s,c,pan3DTemp0);if(e<1&&!Cartesian3.equalsEpsilon(t,Cartesian3.ZERO,CesiumMath.EPSILON14)){const i=Math.acos(e);r.rotate(t,i)}}}const zoom3DUnitPosition=new Cartesian3,zoom3DCartographic=new Cartographic;function zoom3D(e,t,i){defined(i.distance)&&(i=i.distance);const n=e._ellipsoid,r=e._scene,o=r.camera,a=r.canvas,s=e._cameraUnderground;let c;s?c=t:(c=zoomCVWindowPos,c.x=a.clientWidth/2,c.y=a.clientHeight/2);const l=o.getPickRay(c,zoomCVWindowRay);let u;const d=n.cartesianToCartographic(o.position,zoom3DCartographic).height;let h;if(d<e._minimumPickingTerrainHeight&&(u=pickGlobe(e,c,zoomCVIntersection)),defined(u)&&(h=Cartesian3.distance(l.origin,u)),s){const t=getZoomDistanceUnderground(e,l);h=defined(h)?Math.min(h,t):t}defined(h)||(h=d);const p=Cartesian3.normalize(o.position,zoom3DUnitPosition);handleZoom(e,t,i,e._zoomFactor,h,Cartesian3.dot(p,o.direction))}const tilt3DWindowPos=new Cartesian2,tilt3DRay=new Ray,tilt3DCenter=new Cartesian3,tilt3DVerticalCenter=new Cartesian3,tilt3DTransform=new Matrix4,tilt3DVerticalTransform=new Matrix4,tilt3DOldTransform=new Matrix4,tilt3DQuaternion=new Quaternion,tilt3DMatrix=new Matrix3,tilt3DCart=new Cartographic,tilt3DLookUp=new Cartesian3;function tilt3D(e,t,i){const n=e._scene.camera;if(!Matrix4.equals(n.transform,Matrix4.IDENTITY))return;if(defined(i.angleAndHeight)&&(i=i.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){const r=e._ellipsoid.geodeticSurfaceNormal(n.position,tilt3DLookUp);return void look3D(e,t,i,r)}const r=e._ellipsoid.cartesianToCartographic(n.position,tilt3DCart);e._tiltOnEllipsoid||r.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,tilt3DOnEllipsoid(e,t,i)):tilt3DOnTerrain(e,t,i)}const tilt3DOnEllipsoidCartographic=new Cartographic;function tilt3DOnEllipsoid(e,t,i){const n=e._ellipsoid,r=e._scene,o=r.camera,a=.25*e.minimumZoomDistance,s=n.cartesianToCartographic(o.positionWC,tilt3DOnEllipsoidCartographic).height;if(s-a-1<CesiumMath.EPSILON3&&i.endPosition.y-i.startPosition.y<0)return;const c=r.canvas,l=tilt3DWindowPos;l.x=c.clientWidth/2,l.y=c.clientHeight/2;const u=o.getPickRay(l,tilt3DRay);let d;const h=IntersectionTests.rayEllipsoid(u,n);if(defined(h))d=Ray.getPoint(u,h.start,tilt3DCenter);else{if(!(s>e._minimumTrackBallHeight)){e._looking=!0;const n=e._ellipsoid.geodeticSurfaceNormal(o.position,tilt3DLookUp);return look3D(e,t,i,n),void Cartesian2.clone(t,e._tiltCenterMousePosition)}{const e=IntersectionTests.grazingAltitudeLocation(u,n);if(!defined(e))return;const t=n.cartesianToCartographic(e,tilt3DCart);t.height=0,d=n.cartographicToCartesian(t,tilt3DCenter)}}const p=Transforms.eastNorthUpToFixedFrame(d,n,tilt3DTransform),f=e._globe,m=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const g=Matrix4.clone(o.transform,tilt3DOldTransform);o._setTransform(p),rotate3D(e,t,i,Cartesian3.UNIT_Z),o._setTransform(g),e._globe=f,e._ellipsoid=m;const _=m.maximumRadius;e._rotateFactor=1/_,e._rotateRateRangeAdjustment=_}function tilt3DOnTerrain(e,t,i){const n=e._ellipsoid,r=e._scene,o=r.camera,a=e._cameraUnderground;let s,c,l;if(Cartesian2.equals(t,e._tiltCenterMousePosition))s=Cartesian3.clone(e._tiltCenter,tilt3DCenter);else{if(s=pickGlobe(e,t,tilt3DCenter),!defined(s)){if(c=o.getPickRay(t,tilt3DRay),l=IntersectionTests.rayEllipsoid(c,n),!defined(l)){if(n.cartesianToCartographic(o.position,tilt3DCart).height<=e._minimumTrackBallHeight){e._looking=!0;const n=e._ellipsoid.geodeticSurfaceNormal(o.position,tilt3DLookUp);look3D(e,t,i,n),Cartesian2.clone(t,e._tiltCenterMousePosition)}return}s=Ray.getPoint(c,l.start,tilt3DCenter)}a&&(defined(c)||(c=o.getPickRay(t,tilt3DRay)),getTiltCenterUnderground(e,c,s,s)),Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(s,e._tiltCenter)}const u=r.canvas,d=tilt3DWindowPos;d.x=u.clientWidth/2,d.y=e._tiltCenterMousePosition.y,c=o.getPickRay(d,tilt3DRay);const h=Cartesian3.magnitude(s),p=Cartesian3.fromElements(h,h,h,scratchRadii),f=Ellipsoid.fromCartesian3(p,scratchEllipsoid);if(l=IntersectionTests.rayEllipsoid(c,f),!defined(l))return;const m=Cartesian3.magnitude(c.origin)>h?l.start:l.stop,g=Ray.getPoint(c,m,tilt3DVerticalCenter),_=Transforms.eastNorthUpToFixedFrame(s,n,tilt3DTransform),y=Transforms.eastNorthUpToFixedFrame(g,f,tilt3DVerticalTransform),C=e._globe,T=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let S=Cartesian3.UNIT_Z;const v=Matrix4.clone(o.transform,tilt3DOldTransform);o._setTransform(y);const A=Cartesian3.cross(g,o.positionWC,tilt3DCartesian3);if(Cartesian3.dot(o.rightWC,A)<0){const n=i.startPosition.y-i.endPosition.y;(a&&n<0||!a&&n>0)&&(S=void 0);const r=o.constrainedAxis;o.constrainedAxis=void 0,rotate3D(e,t,i,S,!0,!1),o.constrainedAxis=r}else rotate3D(e,t,i,S,!0,!1);if(o._setTransform(_),rotate3D(e,t,i,S,!1,!0),defined(o.constrainedAxis)){const e=Cartesian3.cross(o.direction,o.constrainedAxis,tilt3DCartesian3);Cartesian3.equalsEpsilon(e,Cartesian3.ZERO,CesiumMath.EPSILON6)||(Cartesian3.dot(e,o.right)<0&&Cartesian3.negate(e,e),Cartesian3.cross(e,o.direction,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.up,o.up),Cartesian3.normalize(o.right,o.right))}o._setTransform(v),e._globe=C,e._ellipsoid=T;const E=T.maximumRadius;e._rotateFactor=1/E,e._rotateRateRangeAdjustment=E;const b=Cartesian3.clone(o.positionWC,tilt3DCartesian3);if(e.enableCollisionDetection&&adjustHeightForTerrain(e),!Cartesian3.equals(o.positionWC,b)){o._setTransform(y),o.worldToCameraCoordinatesPoint(b,b);const e=Cartesian3.magnitudeSquared(b);Cartesian3.magnitudeSquared(o.position)>e&&(Cartesian3.normalize(o.position,o.position),Cartesian3.multiplyByScalar(o.position,Math.sqrt(e),o.position));const t=Cartesian3.angleBetween(b,o.position),i=Cartesian3.cross(b,o.position,b);Cartesian3.normalize(i,i);const n=Quaternion.fromAxisAngle(i,t,tilt3DQuaternion),r=Matrix3.fromQuaternion(n,tilt3DMatrix);Matrix3.multiplyByVector(r,o.direction,o.direction),Matrix3.multiplyByVector(r,o.up,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.cross(o.right,o.direction,o.up),o._setTransform(v)}}const look3DStartPos=new Cartesian2,look3DEndPos=new Cartesian2,look3DStartRay=new Ray,look3DEndRay=new Ray,look3DNegativeRot=new Cartesian3,look3DTan=new Cartesian3;function look3D(e,t,i,n){const r=e._scene.camera,o=look3DStartPos;o.x=i.startPosition.x,o.y=0;const a=look3DEndPos;a.x=i.endPosition.x,a.y=0;let s,c,l=r.getPickRay(o,look3DStartRay),u=r.getPickRay(a,look3DEndRay),d=0;r.frustum instanceof OrthographicFrustum?(s=l.origin,c=u.origin,Cartesian3.add(r.direction,s,s),Cartesian3.add(r.direction,c,c),Cartesian3.subtract(s,r.position,s),Cartesian3.subtract(c,r.position,c),Cartesian3.normalize(s,s),Cartesian3.normalize(c,c)):(s=l.direction,c=u.direction);let h=Cartesian3.dot(s,c);h<1&&(d=Math.acos(h)),d=i.startPosition.x>i.endPosition.x?-d:d;const p=e._horizontalRotationAxis;if(defined(n)?r.look(n,-d):defined(p)?r.look(p,-d):r.lookLeft(d),o.x=0,o.y=i.startPosition.y,a.x=0,a.y=i.endPosition.y,l=r.getPickRay(o,look3DStartRay),u=r.getPickRay(a,look3DEndRay),d=0,r.frustum instanceof OrthographicFrustum?(s=l.origin,c=u.origin,Cartesian3.add(r.direction,s,s),Cartesian3.add(r.direction,c,c),Cartesian3.subtract(s,r.position,s),Cartesian3.subtract(c,r.position,c),Cartesian3.normalize(s,s),Cartesian3.normalize(c,c)):(s=l.direction,c=u.direction),h=Cartesian3.dot(s,c),h<1&&(d=Math.acos(h)),d=i.startPosition.y>i.endPosition.y?-d:d,defined(n=defaultValue(n,p))){const e=r.direction,t=Cartesian3.negate(n,look3DNegativeRot),i=Cartesian3.equalsEpsilon(e,n,CesiumMath.EPSILON2),o=Cartesian3.equalsEpsilon(e,t,CesiumMath.EPSILON2);if(i||o)(i&&d<0||o&&d>0)&&r.look(r.right,-d);else{h=Cartesian3.dot(e,n);let i=CesiumMath.acosClamped(h);d>0&&d>i&&(d=i-CesiumMath.EPSILON4),h=Cartesian3.dot(e,t),i=CesiumMath.acosClamped(h),d<0&&-d>i&&(d=-i+CesiumMath.EPSILON4);const o=Cartesian3.cross(n,e,look3DTan);r.look(o,d)}}else r.lookUp(d)}function update3D(e){reactToInput(e,e.enableRotate,e.rotateEventTypes,spin3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableTilt,e.tiltEventTypes,tilt3D,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D)}const scratchAdjustHeightTransform=new Matrix4,scratchAdjustHeightCartographic=new Cartographic;function adjustHeightForTerrain(e){e._adjustedHeightForTerrain=!0;const t=e._scene,i=t.mode,n=t.globe;if(!defined(n)||i===SceneMode$1.SCENE2D||i===SceneMode$1.MORPHING)return;const r=t.camera,o=n.ellipsoid,a=t.mapProjection;let s,c;Matrix4.equals(r.transform,Matrix4.IDENTITY)||(s=Matrix4.clone(r.transform,scratchAdjustHeightTransform),c=Cartesian3.magnitude(r.position),r._setTransform(Matrix4.IDENTITY));const l=scratchAdjustHeightCartographic;i===SceneMode$1.SCENE3D?o.cartesianToCartographic(r.position,l):a.unproject(r.position,l);let u=!1;if(l.height<e._minimumCollisionTerrainHeight){const t=e._scene.globeHeight;if(defined(t)){const n=t+e.minimumZoomDistance;l.height<n&&(l.height=n,i===SceneMode$1.SCENE3D?o.cartographicToCartesian(l,r.position):a.project(l,r.position),u=!0)}}defined(s)&&(r._setTransform(s),u&&(Cartesian3.normalize(r.position,r.position),Cartesian3.negate(r.position,r.direction),Cartesian3.multiplyByScalar(r.position,Math.max(c,e.minimumZoomDistance),r.position),Cartesian3.normalize(r.direction,r.direction),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.cross(r.right,r.direction,r.up)))}ScreenSpaceCameraController.prototype.onMap=function(){const e=this._scene,t=e.mode,i=e.camera;return t!==SceneMode$1.COLUMBUS_VIEW||Math.abs(i.position.x)-this._maxCoord.x<0&&Math.abs(i.position.y)-this._maxCoord.y<0};const scratchPreviousPosition=new Cartesian3,scratchPreviousDirection=new Cartesian3;ScreenSpaceCameraController.prototype.update=function(){const e=this._scene,t=e.camera,i=e.globe,n=e.mode;Matrix4.equals(t.transform,Matrix4.IDENTITY)?(this._globe=i,this._ellipsoid=defined(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=Ellipsoid.UNIT_SPHERE);const r=defined(this._globe)?this._globe.terrainExaggeration:1,o=defined(this._globe)?this._globe.terrainExaggerationRelativeHeight:0;this._minimumCollisionTerrainHeight=TerrainExaggeration.getHeight(this.minimumCollisionTerrainHeight,r,o),this._minimumPickingTerrainHeight=TerrainExaggeration.getHeight(this.minimumPickingTerrainHeight,r,o),this._minimumTrackBallHeight=TerrainExaggeration.getHeight(this.minimumTrackBallHeight,r,o),this._cameraUnderground=e.cameraUnderground&&defined(this._globe);const a=this._ellipsoid.maximumRadius;this._rotateFactor=1/a,this._rotateRateRangeAdjustment=a,this._adjustedHeightForTerrain=!1;const s=Cartesian3.clone(t.positionWC,scratchPreviousPosition),c=Cartesian3.clone(t.directionWC,scratchPreviousDirection);if(n===SceneMode$1.SCENE2D?update2D(this):n===SceneMode$1.COLUMBUS_VIEW?(this._horizontalRotationAxis=Cartesian3.UNIT_Z,updateCV(this)):n===SceneMode$1.SCENE3D&&(this._horizontalRotationAxis=void 0,update3D(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain){(!Cartesian3.equals(s,t.positionWC)||!Cartesian3.equals(c,t.directionWC))&&adjustHeightForTerrain(this)}this._aggregator.reset()},ScreenSpaceCameraController.prototype.isDestroyed=function(){return!1},ScreenSpaceCameraController.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),destroyObject(this)};var AdditiveBlend="uniform sampler2D colorTexture;\nuniform sampler2D colorTexture2;\nuniform vec2 center;\nuniform float radius;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color0 = texture2D(colorTexture, v_textureCoordinates);\nvec4 color1 = texture2D(colorTexture2, v_textureCoordinates);\nfloat x = length(gl_FragCoord.xy - center) / radius;\nfloat t = smoothstep(0.5, 0.8, x);\ngl_FragColor = mix(color0 + color1, color1, t);\n}\n",BrightPass="uniform sampler2D colorTexture;\nuniform float avgLuminance;\nuniform float threshold;\nuniform float offset;\nvarying vec2 v_textureCoordinates;\nfloat key(float avg)\n{\nfloat guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\nreturn max(0.0, guess) + 0.1;\n}\nvoid main()\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\nvec3 xyz = czm_RGBToXYZ(color.rgb);\nfloat luminance = xyz.r;\nfloat scaledLum = key(avgLuminance) * luminance / avgLuminance;\nfloat brightLum = max(scaledLum - threshold, 0.0);\nfloat brightness = brightLum / (offset + brightLum);\nxyz.r = brightness;\ngl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n";function SunPostProcess(){this._sceneFramebuffer=new SceneFramebuffer;const e=.125,t=new Array(6);t[0]=new PostProcessStage({fragmentShader:PassThrough,textureScale:e,forcePowerOfTwo:!0,sampleMode:PostProcessStageSampleMode.LINEAR});const i=t[1]=new PostProcessStage({fragmentShader:BrightPass,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),n=this;this._delta=1,this._sigma=2,this._blurStep=new Cartesian2,t[2]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return n._blurStep.x=n._blurStep.y=1/i.outputTexture.width,n._blurStep},delta:function(){return n._delta},sigma:function(){return n._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return n._blurStep.x=n._blurStep.y=1/i.outputTexture.width,n._blurStep},delta:function(){return n._delta},sigma:function(){return n._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new PostProcessStage({fragmentShader:PassThrough,sampleMode:PostProcessStageSampleMode.LINEAR}),this._uCenter=new Cartesian2,this._uRadius=void 0,t[5]=new PostProcessStage({fragmentShader:AdditiveBlend,uniforms:{center:function(){return n._uCenter},radius:function(){return n._uRadius},colorTexture2:function(){return n._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new PostProcessStageComposite({stages:t});const r=new PostProcessStageTextureCache(this),o=t.length;for(let e=0;e<o;++e)t[e]._textureCache=r;this._textureCache=r,this.length=t.length}SunPostProcess.prototype.get=function(e){return this._stages.get(e)},SunPostProcess.prototype.getStageByName=function(e){const t=this._stages.length;for(let i=0;i<t;++i){const t=this._stages.get(i);if(t.name===e)return t}};const sunPositionECScratch=new Cartesian4,sunPositionWCScratch=new Cartesian2,sizeScratch=new Cartesian2,postProcessMatrix4Scratch=new Matrix4;function updateSunPosition(e,t,i){const n=t.uniformState,r=n.sunPositionWC,o=n.view,a=n.viewProjection,s=n.projection;let c=Matrix4.computeViewportTransformation(i,0,1,postProcessMatrix4Scratch);const l=Matrix4.multiplyByPoint(o,r,sunPositionECScratch);let u=Transforms.pointToGLWindowCoordinates(a,c,r,sunPositionWCScratch);l.x+=CesiumMath.SOLAR_RADIUS;const d=Transforms.pointToGLWindowCoordinates(s,c,l,l),h=30*Cartesian2.magnitude(Cartesian2.subtract(d,u,d))*2,p=sizeScratch;p.x=h,p.y=h,e._uCenter=Cartesian2.clone(u,e._uCenter),e._uRadius=.15*Math.max(p.x,p.y);const f=t.drawingBufferWidth,m=t.drawingBufferHeight,g=e._stages,_=g.get(0),y=_.outputTexture.width,C=_.outputTexture.height,T=new BoundingRectangle;T.width=y,T.height=C,c=Matrix4.computeViewportTransformation(T,0,1,postProcessMatrix4Scratch),u=Transforms.pointToGLWindowCoordinates(a,c,r,sunPositionWCScratch),p.x*=y/f,p.y*=C/m;const S=_.scissorRectangle;S.x=Math.max(u.x-.5*p.x,0),S.y=Math.max(u.y-.5*p.y,0),S.width=Math.min(p.x,f),S.height=Math.min(p.y,m);for(let e=1;e<4;++e)BoundingRectangle.clone(S,g.get(e).scissorRectangle)}SunPostProcess.prototype.clear=function(e,t,i){this._sceneFramebuffer.clear(e,t,i),this._textureCache.clear(e)},SunPostProcess.prototype.update=function(e){const t=e.context,i=e.viewport,n=this._sceneFramebuffer;n.update(t,i);const r=n.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),updateSunPosition(this,t,i),r},SunPostProcess.prototype.execute=function(e){const t=this._sceneFramebuffer.framebuffer.getColorTexture(0),i=this._stages,n=i.length;i.get(0).execute(e,t);for(let t=1;t<n;++t)i.get(t).execute(e,i.get(t-1).outputTexture)},SunPostProcess.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){const t=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return t._stages.get(t._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},SunPostProcess.prototype.isDestroyed=function(){return!1},SunPostProcess.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),destroyObject(this)};const requestRenderAfterFrame=function(e){return function(){e.frameState.afterRender.push((function(){e.requestRender()}))}};function Scene(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).canvas;let i=e.creditContainer,n=e.creditViewport,r=clone$1(e.contextOptions);defined(r)||(r={}),defined(r.webgl)||(r.webgl={}),r.webgl.powerPreference=defaultValue(r.webgl.powerPreference,"high-performance");const o=defined(i),a=new Context(t,r);o||(i=document.createElement("div"),i.style.position="absolute",i.style.bottom="0",i.style["text-shadow"]="0 0 2px #000000",i.style.color="#ffffff",i.style["font-size"]="10px",i.style["padding-right"]="5px",t.parentNode.appendChild(i)),defined(n)||(n=t.parentNode),this._id=createGuid(),this._jobScheduler=new JobScheduler,this._frameState=new FrameState(a,new CreditDisplay(i," • ",n),this._jobScheduler),this._frameState.scene3DOnly=defaultValue(e.scene3DOnly,!1),this._removeCreditContainer=!o,this._creditContainer=i,this._canvas=t,this._context=a,this._computeEngine=new ComputeEngine(a),this._globe=void 0,this._globeTranslucencyState=new GlobeTranslucencyState,this._primitives=new PrimitiveCollection,this._primitivesQuadTrees=[],this._groundPrimitives=new PrimitiveCollection,this._globeHeight=void 0,this._cameraUnderground=!1,this._logDepthBuffer=a.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new TweenCollection,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=defaultValue(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new DepthPlane(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new ClearCommand({color:new Color,stencil:0,owner:this}),this._depthClearCommand=new ClearCommand({depth:1,owner:this}),this._stencilClearCommand=new ClearCommand({stencil:0}),this._classificationStencilClearCommand=new ClearCommand({stencil:0,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new SceneTransitioner(this),this._preUpdate=new Event,this._postUpdate=new Event,this._renderError=new Event,this._preRender=new Event,this._postRender=new Event,this._minimumDisableDepthTestDistance=0,this._debugInspector=new DebugInspector,this._msaaSamples=defaultValue(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Event,this.morphComplete=new Event,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=Color.clone(Color.BLACK),this._mode=SceneMode$1.SCENE3D,this._mapProjection=defined(e.mapProjection)?e.mapProjection:new GeographicProjection,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.fog=new Fog,this._shadowMapCamera=new Camera(this),this.shadowMap=new ShadowMap({context:a,lightCamera:this._shadowMapCamera,enabled:defaultValue(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=Color.clone(Color.WHITE),this._actualInvertClassificationColor=Color.clone(this._invertClassificationColor),this._invertClassification=new InvertClassification,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new PostProcessStageCollection,this._brdfLutGenerator=new BrdfLutGenerator,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new ScreenSpaceCameraController(this),this._cameraUnderground=!1,this._mapMode2D=defaultValue(e.mapMode2D,MapMode2D$1.INFINITE_SCROLL),this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isReadyForAtmosphere:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,renderTranslucentDepthForPick:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=defaultValue(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=defaultValue(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=RequestScheduler.requestCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeTaskProcessorListenerCallback=TaskProcessor.taskCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeGlobeCallbacks=[];const s=new BoundingRectangle(0,0,a.drawingBufferWidth,a.drawingBufferHeight),c=new Camera(this);this._logDepthBuffer&&(c.frustum.near=.1,c.frustum.far=1e10),this.preloadFlightCamera=new Camera(this),this.preloadFlightCullingVolume=void 0,this._picking=new Picking(this),this._defaultView=new View(this,c,s),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentMapAtlas=void 0,this.light=new SunLight,updateFrameNumber(this,0,JulianDate.now()),this.updateFrameState(),this.initializeFrame()}function updateGlobeListeners(e,t){for(let t=0;t<e._removeGlobeCallbacks.length;++t)e._removeGlobeCallbacks[t]();e._removeGlobeCallbacks.length=0;const i=[];defined(t)&&(i.push(t.imageryLayersUpdatedEvent.addEventListener(requestRenderAfterFrame(e))),i.push(t.terrainProviderChanged.addEventListener(requestRenderAfterFrame(e)))),e._removeGlobeCallbacks=i}function updateDerivedCommands(e,t,i){const n=e._frameState,r=e._context,o=e._view.oit,a=n.shadowState.lightShadowMaps,s=n.shadowState.lightShadowsEnabled;let c=t.derivedCommands;defined(t.pickId)&&(c.picking=DerivedCommand.createPickDerivedCommand(e,t,r,c.picking)),t.pickOnly||(c.depth=DerivedCommand.createDepthOnlyDerivedCommand(e,t,r,c.depth)),c.originalCommand=t,e._hdr&&(c.hdr=DerivedCommand.createHdrCommand(t,r,c.hdr),c=(t=c.hdr.command).derivedCommands),s&&t.receiveShadows&&(c.shadows=ShadowMap.createReceiveDerivedCommand(a,t,i,r,c.shadows)),t.pass===Pass$1.TRANSLUCENT&&defined(o)&&o.isSupported()&&(s&&t.receiveShadows?(c.oit=defined(c.oit)?c.oit:{},c.oit.shadows=o.createDerivedCommands(c.shadows.receiveCommand,r,c.oit.shadows)):c.oit=o.createDerivedCommands(t,r,c.oit))}Object.defineProperties(Scene.prototype,{canvas:{get:function(){return this._canvas}},drawingBufferHeight:{get:function(){return this._context.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._context.drawingBufferWidth}},maximumAliasedLineWidth:{get:function(){return ContextLimits.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return ContextLimits.maximumCubeMapSize}},pickPositionSupported:{get:function(){return this._context.depthTexture}},sampleHeightSupported:{get:function(){return this._context.depthTexture}},clampToHeightSupported:{get:function(){return this._context.depthTexture}},invertClassificationSupported:{get:function(){return this._context.depthTexture}},specularEnvironmentMapsSupported:{get:function(){return OctahedralProjectedCubeMap.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,updateGlobeListeners(this,e)}},primitives:{get:function(){return this._primitives}},primitivesQuadTrees:{get:function(){return this._primitivesQuadTrees}},groundPrimitives:{get:function(){return this._groundPrimitives}},camera:{get:function(){return this._view.camera},set:function(e){this._view.camera=e}},view:{get:function(){return this._view},set:function(e){this._view=e}},defaultView:{get:function(){return this._defaultView}},picking:{get:function(){return this._picking}},screenSpaceCameraController:{get:function(){return this._screenSpaceCameraController}},mapProjection:{get:function(){return this._mapProjection}},jobScheduler:{get:function(){return this._jobScheduler}},frameState:{get:function(){return this._frameState}},environmentState:{get:function(){return this._environmentState}},tweens:{get:function(){return this._tweens}},imageryLayers:{get:function(){if(defined(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(defined(this.globe))return this.globe.terrainProvider},set:function(e){defined(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(defined(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){e===SceneMode$1.SCENE2D?this.morphTo2D(0):e===SceneMode$1.SCENE3D?this.morphTo3D(0):e===SceneMode$1.COLUMBUS_VIEW&&this.morphToColumbusView(0),this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new Camera(this),defined(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new DeviceOrientationCameraController(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},splitPosition:{get:function(){return this._frameState.splitPosition},set:function(e){this._frameState.splitPosition=e}},imagerySplitPosition:{get:function(){return deprecationWarning("Scene.imagerySplitPosition","Scene.imagerySplitPosition has been deprecated in Cesium 1.92. It will be removed in Cesium 1.94. Use splitPosition instead."),this._frameState.splitPosition},set:function(e){deprecationWarning("Scene.imagerySplitPosition","Scene.imagerySplitPosition has been deprecated in Cesium 1.92. It will be removed in Cesium 1.94. Use splitPosition instead."),this._frameState.splitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){const t=this._context,i=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=i!==this._hdr,this._hdr=i}},highDynamicRangeSupported:{get:function(){const e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},cameraUnderground:{get:function(){return this._cameraUnderground}},msaaSamples:{get:function(){return this._msaaSamples},set:function(e){e=Math.min(e,ContextLimits.maximumSamples),this._msaaSamples=e}},msaaSupported:{get:function(){return this._context.msaa}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return.9999}},globeHeight:{get:function(){return this._globeHeight}}}),Scene.prototype.getCompressedTextureFormatSupported=function(e){const t=this.context;return("WEBGL_compressed_texture_s3tc"===e||"s3tc"===e)&&t.s3tc||("WEBGL_compressed_texture_pvrtc"===e||"pvrtc"===e)&&t.pvrtc||("WEBGL_compressed_texture_etc"===e||"etc"===e)&&t.etc||("WEBGL_compressed_texture_etc1"===e||"etc1"===e)&&t.etc1||("WEBGL_compressed_texture_astc"===e||"astc"===e)&&t.astc||("EXT_texture_compression_bptc"===e||"bc7"===e)&&t.bc7},Scene.prototype.updateDerivedCommands=function(e){if(!defined(e.derivedCommands))return;const t=this._frameState,i=this._context;let n=!1;const r=t.shadowState.lastDirtyTime;e.lastDirtyTime!==r&&(e.lastDirtyTime=r,e.dirty=!0,n=!0);const o=t.useLogDepth,a=this._hdr,s=e.derivedCommands,c=defined(s.logDepth),l=defined(s.hdr),u=defined(s.originalCommand),d=o&&!c,h=a&&!l,p=!(o&&a||u);if(e.dirty=e.dirty||d||h||p,e.dirty){e.dirty=!1;const r=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(s.shadows=ShadowMap.createCastDerivedCommand(r,e,n,i,s.shadows)),(c||d)&&(s.logDepth=DerivedCommand.createLogDepthCommand(e,i,s.logDepth),updateDerivedCommands(this,s.logDepth.command,n)),(u||p)&&updateDerivedCommands(this,e,n)}};const renderTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.RENDER}),preloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD}),preloadFlightTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD_FLIGHT}),requestRenderModeDeferCheckPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK}),scratchOccluderBoundingSphere=new BoundingSphere;let scratchOccluder;function getOccluder(e){const t=e.globe;if(e._mode===SceneMode$1.SCENE3D&&defined(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){const i=t.ellipsoid,n=e.frameState.minimumTerrainHeight;return scratchOccluderBoundingSphere.radius=i.minimumRadius+n,scratchOccluder=Occluder.fromBoundingSphere(scratchOccluderBoundingSphere,e.camera.positionWC,scratchOccluder),scratchOccluder}}function updateFrameNumber(e,t,i){const n=e._frameState;n.frameNumber=t,n.time=JulianDate.clone(i,n.time)}Scene.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1},Scene.prototype.updateFrameState=function(){const e=this.camera,t=this._frameState;t.commandList.length=0,t.shadowMaps.length=0,t.brdfLutGenerator=this._brdfLutGenerator,t.environmentMap=this.skyBox&&this.skyBox._cubeMap,t.mode=this._mode,t.morphTime=this.morphTime,t.mapProjection=this.mapProjection,t.camera=e,t.cullingVolume=e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC),t.occluder=getOccluder(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof OrthographicFrustum||this.camera.frustum instanceof OrthographicOffCenterFrustum),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState,defined(this.globe)&&(t.terrainExaggeration=this.globe.terrainExaggeration,t.terrainExaggerationRelativeHeight=this.globe.terrainExaggerationRelativeHeight),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready?(t.specularEnvironmentMaps=this._specularEnvironmentMapAtlas.texture,t.specularEnvironmentMapsMaximumLOD=this._specularEnvironmentMapAtlas.maximumMipmapLevel):(t.specularEnvironmentMaps=void 0,t.specularEnvironmentMapsMaximumLOD=void 0),t.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,this._actualInvertClassificationColor=Color.clone(this.invertClassificationColor,this._actualInvertClassificationColor),InvertClassification.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,defined(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0},Scene.prototype.isVisible=function(e,t,i){return defined(e)&&(!defined(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Intersect$1.OUTSIDE&&(!defined(i)||!e.occlude||!e.boundingVolume.isOccluded(i)))};let transformFrom2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);function debugShowBoundingVolume(e,t,i,n){const r=t._frameState,o=r.context,a=e.boundingVolume;let s;defined(t._debugVolume)&&t._debugVolume.destroy();let c=Cartesian3.clone(a.center);if(r.mode!==SceneMode$1.SCENE3D){c=Matrix4.multiplyByPoint(transformFrom2D,c,c);const e=r.mapProjection,t=e.unproject(c);c=e.ellipsoid.cartographicToCartesian(t)}if(defined(a.radius)){const e=a.radius;s=GeometryPipeline.toWireframe(EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(e,e,e),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive$3({geometryInstances:new GeometryInstance({geometry:s,modelMatrix:Matrix4.fromTranslation(c),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}else{const e=a.halfAxes;s=GeometryPipeline.toWireframe(BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive$3({geometryInstances:new GeometryInstance({geometry:s,modelMatrix:Matrix4.fromRotationTranslation(e,c,new Matrix4),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}const l=r.commandList,u=r.commandList=[];if(t._debugVolume.update(r),e=u[0],r.useLogDepth){e=DerivedCommand.createLogDepthCommand(e,o).command}let d;defined(n)&&(d=i.framebuffer,i.framebuffer=n),e.execute(o,i),defined(d)&&(i.framebuffer=d),r.commandList=l}function executeCommand(e,t,i,n,r){const o=t._frameState;if(defined(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof ClearCommand)return void e.execute(i,n);e.debugShowBoundingVolume&&defined(e.boundingVolume)&&debugShowBoundingVolume(e,t,n,r),o.useLogDepth&&defined(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);const a=o.passes;if(!a.pick&&!a.depth&&t._hdr&&defined(e.derivedCommands)&&defined(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),a.pick||a.depth){if(a.pick&&!a.depth&&defined(e.derivedCommands.picking))return void(e=e.derivedCommands.picking.pickCommand).execute(i,n);if(defined(e.derivedCommands.depth))return void(e=e.derivedCommands.depth.depthOnlyCommand).execute(i,n)}t.debugShowCommands||t.debugShowFrustums?t._debugInspector.executeDebugShowFrustumsCommand(t,e,n):o.shadowState.lightShadowsEnabled&&e.receiveShadows&&defined(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(i,n):e.execute(i,n)}function executeIdCommand(e,t,i,n){const r=t._frameState;let o=e.derivedCommands;defined(o)&&(r.useLogDepth&&defined(o.logDepth)&&(e=o.logDepth.command),o=e.derivedCommands,defined(o.picking)?(e=o.picking.pickCommand).execute(i,n):defined(o.depth)&&(e=o.depth.depthOnlyCommand).execute(i,n))}function backToFront(e,t,i){return t.boundingVolume.distanceSquaredTo(i)-e.boundingVolume.distanceSquaredTo(i)}function frontToBack(e,t,i){return e.boundingVolume.distanceSquaredTo(i)-t.boundingVolume.distanceSquaredTo(i)+CesiumMath.EPSILON12}function executeTranslucentCommandsBackToFront(e,t,i,n,r){const o=e.context;mergeSort(n,backToFront,e.camera.positionWC),defined(r)&&t(r.unclassifiedCommand,e,o,i);const a=n.length;for(let r=0;r<a;++r)t(n[r],e,o,i)}function executeTranslucentCommandsFrontToBack(e,t,i,n,r){const o=e.context;mergeSort(n,frontToBack,e.camera.positionWC),defined(r)&&t(r.unclassifiedCommand,e,o,i);const a=n.length;for(let r=0;r<a;++r)t(n[r],e,o,i)}transformFrom2D=Matrix4.inverseTransformation(transformFrom2D,transformFrom2D);const scratchPerspectiveFrustum=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum=new OrthographicFrustum,scratchOrthographicOffCenterFrustum=new OrthographicOffCenterFrustum;function executeCommands(e,t){const i=e.camera,n=e.context,r=e.frameState,o=n.uniformState;let a;o.updateCamera(i),a=defined(i.frustum.fov)?i.frustum.clone(scratchPerspectiveFrustum):defined(i.frustum.infiniteProjectionMatrix)?i.frustum.clone(scratchPerspectiveOffCenterFrustum):defined(i.frustum.width)?i.frustum.clone(scratchOrthographicFrustum):i.frustum.clone(scratchOrthographicOffCenterFrustum),a.near=i.frustum.near,a.far=i.frustum.far,o.updateFrustum(a),o.updatePass(Pass$1.ENVIRONMENT);const s=r.passes,c=s.pick,l=e._environmentState,u=e._view,d=l.renderTranslucentDepthForPick,h=l.useWebVR;if(!c){const i=l.skyBoxCommand;if(defined(i)&&executeCommand(i,e,n,t),l.isSkyAtmosphereVisible&&executeCommand(l.skyAtmosphereCommand,e,n,t),l.isSunVisible&&(l.sunDrawCommand.execute(n,t),e.sunBloom&&!h)){let i;i=l.useGlobeDepthFramebuffer?u.globeDepth.framebuffer:l.usePostProcess?u.sceneFramebuffer.framebuffer:l.originalFramebuffer,e._sunPostProcess.execute(n),e._sunPostProcess.copy(n,i),t.framebuffer=i}l.isMoonVisible&&l.moonCommand.execute(n,t)}let p;l.useOIT?(defined(e._executeOITFunction)||(e._executeOITFunction=function(e,t,i,r,o){u.globeDepth.prepareColorTextures(n),u.oit.executeCommands(e,t,i,r,o)}),p=e._executeOITFunction):p=s.render?executeTranslucentCommandsBackToFront:executeTranslucentCommandsFrontToBack;const f=u.frustumCommandsList,m=f.length,g=l.clearGlobeDepth,_=l.useDepthPlane,y=e._globeTranslucencyState,C=y.translucent,T=e._view.globeTranslucencyFramebuffer,S=e._depthClearCommand,v=e._stencilClearCommand,A=e._classificationStencilClearCommand,E=e._depthPlane,b=l.usePostProcessSelected,x=i.position.z;let P;for(let s=0;s<m;++s){const h=m-s-1,D=f[h];e.mode===SceneMode$1.SCENE2D?(i.position.z=x-D.near+1,a.far=Math.max(1,D.far-D.near),a.near=1,o.update(r),o.updateFrustum(a)):(a.near=0!==h?D.near*e.opaqueFrustumNearOffset:D.near,a.far=D.far,o.updateFrustum(a)),S.execute(n,t),n.stencilBuffer&&v.execute(n,t),o.updatePass(Pass$1.GLOBE);let w=D.commands[Pass$1.GLOBE],M=D.indices[Pass$1.GLOBE];if(C)y.executeGlobeCommands(D,executeCommand,T,e,t);else for(P=0;P<M;++P)executeCommand(w[P],e,n,t);const I=u.globeDepth;if(defined(I)&&l.useGlobeDepthFramebuffer&&I.executeCopyDepth(n,t),!l.renderTranslucentDepthForPick)if(o.updatePass(Pass$1.TERRAIN_CLASSIFICATION),w=D.commands[Pass$1.TERRAIN_CLASSIFICATION],M=D.indices[Pass$1.TERRAIN_CLASSIFICATION],C)y.executeGlobeClassificationCommands(D,executeCommand,T,e,t);else for(P=0;P<M;++P)executeCommand(w[P],e,n,t);if(g&&(S.execute(n,t),_&&E.execute(n,t)),!l.useInvertClassification||c||l.renderTranslucentDepthForPick){for(o.updatePass(Pass$1.CESIUM_3D_TILE),w=D.commands[Pass$1.CESIUM_3D_TILE],M=D.indices[Pass$1.CESIUM_3D_TILE],P=0;P<M;++P)executeCommand(w[P],e,n,t);if(M>0&&(defined(I)&&l.useGlobeDepthFramebuffer&&(I.prepareColorTextures(n,g),I.executeUpdateDepth(n,t,g,I.depthStencilTexture)),!l.renderTranslucentDepthForPick))for(o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),w=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],M=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],P=0;P<M;++P)executeCommand(w[P],e,n,t)}else{e._invertClassification.clear(n,t);const i=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,o.updatePass(Pass$1.CESIUM_3D_TILE),w=D.commands[Pass$1.CESIUM_3D_TILE],M=D.indices[Pass$1.CESIUM_3D_TILE],P=0;P<M;++P)executeCommand(w[P],e,n,t);for(defined(I)&&l.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(n),I.executeUpdateDepth(n,t,g,e._invertClassification._fbo.getDepthStencilTexture())),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),w=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],M=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],P=0;P<M;++P)executeCommand(w[P],e,n,t);for(t.framebuffer=i,e._invertClassification.executeClassified(n,t),1===r.invertClassificationColor.alpha&&e._invertClassification.executeUnclassified(n,t),M>0&&n.stencilBuffer&&A.execute(n,t),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),w=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],M=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],P=0;P<M;++P)executeCommand(w[P],e,n,t)}for(M>0&&n.stencilBuffer&&v.execute(n,t),o.updatePass(Pass$1.OPAQUE),w=D.commands[Pass$1.OPAQUE],M=D.indices[Pass$1.OPAQUE],P=0;P<M;++P)executeCommand(w[P],e,n,t);let R;0!==h&&e.mode!==SceneMode$1.SCENE2D&&(a.near=D.near,o.updateFrustum(a)),!c&&l.useInvertClassification&&r.invertClassificationColor.alpha<1&&(R=e._invertClassification),o.updatePass(Pass$1.TRANSLUCENT),w=D.commands[Pass$1.TRANSLUCENT],w.length=D.indices[Pass$1.TRANSLUCENT],p(e,executeCommand,t,w,R);if(D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION]>0&&u.translucentTileClassification.isSupported()&&(u.translucentTileClassification.executeTranslucentCommands(e,executeCommand,t,w,I.depthStencilTexture),u.translucentTileClassification.executeClassificationCommands(e,executeCommand,t,D)),n.depthTexture&&e.useDepthPicking&&(l.useGlobeDepthFramebuffer||d)){const i=I.depthStencilTexture,r=e._picking.getPickDepth(e,h);r.update(n,i),r.executeCopyDepth(n,t)}if(c||!b)continue;const O=t.framebuffer;if(t.framebuffer=u.sceneFramebuffer.getIdFramebuffer(),a.near=0!==h?D.near*e.opaqueFrustumNearOffset:D.near,a.far=D.far,o.updateFrustum(a),o.updatePass(Pass$1.GLOBE),w=D.commands[Pass$1.GLOBE],M=D.indices[Pass$1.GLOBE],C)y.executeGlobeCommands(D,executeIdCommand,T,e,t);else for(P=0;P<M;++P)executeIdCommand(w[P],e,n,t);for(g&&(S.framebuffer=t.framebuffer,S.execute(n,t),S.framebuffer=void 0),g&&_&&E.execute(n,t),o.updatePass(Pass$1.CESIUM_3D_TILE),w=D.commands[Pass$1.CESIUM_3D_TILE],M=D.indices[Pass$1.CESIUM_3D_TILE],P=0;P<M;++P)executeIdCommand(w[P],e,n,t);for(o.updatePass(Pass$1.OPAQUE),w=D.commands[Pass$1.OPAQUE],M=D.indices[Pass$1.OPAQUE],P=0;P<M;++P)executeIdCommand(w[P],e,n,t);for(o.updatePass(Pass$1.TRANSLUCENT),w=D.commands[Pass$1.TRANSLUCENT],M=D.indices[Pass$1.TRANSLUCENT],P=0;P<M;++P)executeIdCommand(w[P],e,n,t);t.framebuffer=O}}function executeComputeCommands(e){e.context.uniformState.updatePass(Pass$1.COMPUTE);const t=e._environmentState.sunComputeCommand;defined(t)&&t.execute(e._computeEngine);const i=e._computeCommandList,n=i.length;for(let t=0;t<n;++t)i[t].execute(e._computeEngine)}function executeOverlayCommands(e,t){e.context.uniformState.updatePass(Pass$1.OVERLAY);const i=e.context,n=e._overlayCommandList,r=n.length;for(let e=0;e<r;++e)n[e].execute(i,t)}function insertShadowCastCommands(e,t,i){const n=i.shadowMapCullingVolume,r=i.isPointLight,o=i.passes,a=o.length,s=t.length;for(let i=0;i<s;++i){const s=t[i];if(e.updateDerivedCommands(s),s.castShadows&&(s.pass===Pass$1.GLOBE||s.pass===Pass$1.CESIUM_3D_TILE||s.pass===Pass$1.OPAQUE||s.pass===Pass$1.TRANSLUCENT)&&e.isVisible(s,n))if(r)for(let e=0;e<a;++e)o[e].commandList.push(s);else if(1===a)o[0].commandList.push(s);else{let t=!1;for(let i=a-1;i>=0;--i){const n=o[i].cullingVolume;if(e.isVisible(s,n))o[i].commandList.push(s),t=!0;else if(t)break}}}}function executeShadowMapCastCommands(e){const t=e.frameState,i=t.shadowState.shadowMaps,n=i.length;if(!t.shadowState.shadowsEnabled)return;const r=e.context,o=r.uniformState;for(let t=0;t<n;++t){const n=i[t];if(n.outOfView)continue;const a=n.passes,s=a.length;for(let e=0;e<s;++e)a[e].commandList.length=0;insertShadowCastCommands(e,e.frameState.commandList,n);for(let i=0;i<s;++i){const a=n.passes[i];o.updateCamera(a.camera),n.updatePass(r,i);const s=a.commandList.length;for(let i=0;i<s;++i){const n=a.commandList[i];o.updatePass(n.pass),executeCommand(n.derivedCommands.shadows.castCommands[t],e,r,a.passState)}}}}const scratchEyeTranslation=new Cartesian3;function executeWebVRCommands(e,t,i){const n=e._view,r=n.camera,o=e._environmentState.renderTranslucentDepthForPick;updateAndClearFramebuffers(e,t,i),updateAndRenderPrimitives(e),n.createPotentiallyVisibleSet(e),executeComputeCommands(e),o||executeShadowMapCastCommands(e);const a=t.viewport;a.x=0,a.y=0,a.width=.5*a.width;const s=Camera.clone(r,e._cameraVR);s.frustum=r.frustum;const c=r.frustum.near,l=c*defaultValue(e.focalLength,5),u=defaultValue(e.eyeSeparation,l/30),d=Cartesian3.multiplyByScalar(s.right,.5*u,scratchEyeTranslation);r.frustum.aspectRatio=a.width/a.height;const h=.5*u*c/l;Cartesian3.add(s.position,d,r.position),r.frustum.xOffset=h,executeCommands(e,t),a.x=a.width,Cartesian3.subtract(s.position,d,r.position),r.frustum.xOffset=-h,executeCommands(e,t),Camera.clone(s,r)}Scene.prototype.updateAndExecuteCommands=function(e,t){const i=this._frameState.mode;this._environmentState.useWebVR?executeWebVRCommands(this,e,t):i!==SceneMode$1.SCENE2D||this._mapMode2D===MapMode2D$1.ROTATE?executeCommandsInViewport(!0,this,e,t):(updateAndClearFramebuffers(this,e,t),execute2DViewportCommands(this,e))};const scratch2DViewportCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratch2DViewportMaxCoord=new Cartesian3,scratch2DViewportSavedPosition=new Cartesian3,scratch2DViewportTransform=new Matrix4,scratch2DViewportCameraTransform=new Matrix4,scratch2DViewportEyePoint=new Cartesian3,scratch2DViewportWindowCoords=new Cartesian3,scratch2DViewport=new BoundingRectangle;function execute2DViewportCommands(e,t){const i=e.context,n=e.frameState,r=e.camera,o=t.viewport,a=BoundingRectangle.clone(o,scratch2DViewport);t.viewport=a;const s=scratch2DViewportCartographic,c=scratch2DViewportMaxCoord;e.mapProjection.project(s,c);const l=Cartesian3.clone(r.position,scratch2DViewportSavedPosition),u=Matrix4.clone(r.transform,scratch2DViewportCameraTransform),d=r.frustum.clone();r._setTransform(Matrix4.IDENTITY);const h=Matrix4.computeViewportTransformation(a,0,1,scratch2DViewportTransform),p=r.frustum.projectionMatrix,f=r.positionWC.y,m=Cartesian3.fromElements(CesiumMath.sign(f)*c.x-f,0,-r.positionWC.x,scratch2DViewportEyePoint),g=Transforms.pointToGLWindowCoordinates(p,h,m,scratch2DViewportWindowCoords);g.x=Math.floor(g.x);const _=a.x,y=a.width;if(0===f||g.x<=_||g.x>=_+y)executeCommandsInViewport(!0,e,t);else if(Math.abs(_+.5*y-g.x)<1)a.width=g.x-a.x,r.position.x*=CesiumMath.sign(r.position.x),r.frustum.right=0,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),i.uniformState.update(n),executeCommandsInViewport(!0,e,t),a.x=g.x,r.position.x=-r.position.x,r.frustum.right=-r.frustum.left,r.frustum.left=0,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),i.uniformState.update(n),executeCommandsInViewport(!1,e,t);else if(g.x>_+.5*y){a.width=g.x-_;const o=r.frustum.right;r.frustum.right=c.x-f,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),i.uniformState.update(n),executeCommandsInViewport(!0,e,t),a.x=g.x,a.width=_+y-g.x,r.position.x=-r.position.x,r.frustum.left=-r.frustum.right,r.frustum.right=o-2*r.frustum.right,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),i.uniformState.update(n),executeCommandsInViewport(!1,e,t)}else{a.x=g.x,a.width=_+y-g.x;const o=r.frustum.left;r.frustum.left=-c.x-f,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),i.uniformState.update(n),executeCommandsInViewport(!0,e,t),a.x=_,a.width=g.x-_,r.position.x=-r.position.x,r.frustum.right=-r.frustum.left,r.frustum.left=o-2*r.frustum.left,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),i.uniformState.update(n),executeCommandsInViewport(!1,e,t)}r._setTransform(u),Cartesian3.clone(l,r.position),r.frustum=d.clone(),t.viewport=o}function executeCommandsInViewport(e,t,i,n){const r=t._environmentState,o=t._view,a=r.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),updateAndRenderPrimitives(t),o.createPotentiallyVisibleSet(t),e&&(defined(n)&&updateAndClearFramebuffers(t,i,n),executeComputeCommands(t),a||executeShadowMapCastCommands(t)),executeCommands(t,i)}const scratchCullingVolume=new CullingVolume;function updateDebugFrustumPlanes(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new DebugCameraPrimitive({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),defined(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function updateShadowMaps(e){const t=e._frameState,i=t.shadowMaps,n=i.length,r=n>0&&!t.passes.pick&&e.mode===SceneMode$1.SCENE3D;if(r!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=r),t.shadowState.lightShadowsEnabled=!1,r){for(let e=0;e<n;++e)if(i[e]!==t.shadowState.shadowMaps[e]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(let e=0;e<n;++e){const n=i[e];n.update(t),t.shadowState.shadowMaps.push(n),n.fromLightSource&&(t.shadowState.lightShadowMaps.push(n),t.shadowState.lightShadowsEnabled=!0),n.dirty&&(++t.shadowState.lastDirtyTime,n.dirty=!1)}}}function updateAndRenderPrimitives(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),e.UpdateQuad(t),updateDebugFrustumPlanes(e),updateShadowMaps(e),e._globe&&e._globe.render(t)}function updateAndClearFramebuffers(e,t,i){const n=e._context,r=e._frameState,o=e._environmentState,a=e._view,s=e._frameState.passes.pick;defined(a.globeDepth)&&(a.globeDepth.picking=s);const c=o.useWebVR;o.originalFramebuffer=t.framebuffer,defined(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!c?e._sunPostProcess=new SunPostProcess:defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!defined(e.sun)&&defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);const l=e._clearColorCommand;Color.clone(i,l.color),l.execute(n,t);const u=o.useGlobeDepthFramebuffer=defined(a.globeDepth);u&&(a.globeDepth.update(n,t,a.viewport,e.msaaSamples,e._hdr,o.clearGlobeDepth),a.globeDepth.clear(n,t,i));const d=a.oit,h=o.useOIT=!s&&defined(d)&&d.isSupported();h&&(d.update(n,t,a.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),d.clear(n,t,i),o.useOIT=d.isSupported());const p=e.postProcessStages;let f=o.usePostProcess=!s&&(e._hdr||p.length>0||p.ambientOcclusion.enabled||p.fxaa.enabled||p.bloom.enabled);o.usePostProcessSelected=!1,f&&(a.sceneFramebuffer.update(n,a.viewport,e._hdr,e.msaaSamples),a.sceneFramebuffer.clear(n,t,i),p.update(n,r.useLogDepth,e._hdr),p.clear(n),f=o.usePostProcess=p.ready,o.usePostProcessSelected=f&&p.hasSelected),o.isSunVisible&&e.sunBloom&&!c?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(n,t,i)):u?t.framebuffer=a.globeDepth.framebuffer:f&&(t.framebuffer=a.sceneFramebuffer.framebuffer),defined(t.framebuffer)&&l.execute(n,t);if(o.useInvertClassification=!s&&defined(t.framebuffer)&&e.invertClassification){let i;if(1===e.frameState.invertClassificationColor.alpha&&o.useGlobeDepthFramebuffer&&(i=a.globeDepth.framebuffer),defined(i)||n.depthTexture){if(e._invertClassification.previousFramebuffer=i,e._invertClassification.update(n,e.msaaSamples,a.globeDepth.colorFramebufferManager),e._invertClassification.clear(n,t),e.frameState.invertClassificationColor.alpha<1&&h){const t=e._invertClassification.unclassifiedCommand,i=t.derivedCommands;i.oit=d.createDerivedCommands(t,n,i.oit)}}else o.useInvertClassification=!1}e._globeTranslucencyState.translucent&&a.globeTranslucencyFramebuffer.updateAndClear(e._hdr,a.viewport,n,t)}function callAfterRenderFunctions(e){const t=e._frameState.afterRender;for(let i=0,n=t.length;i<n;++i)t[i](),e.requestRender();t.length=0}function getGlobeHeight(e){const t=e._globe,i=e.camera.positionCartographic;if(defined(t)&&t.show&&defined(i))return t.getHeight(i)}function isCameraUnderground(e){const t=e.camera,i=e._mode,n=e.globe,r=e._screenSpaceCameraController,o=t.positionCartographic;if(!defined(o))return!1;if(!r.onMap()&&o.height<0)return!0;if(!defined(n)||!n.show||i===SceneMode$1.SCENE2D||i===SceneMode$1.MORPHING)return!1;const a=e._globeHeight;return defined(a)&&o.height<a}function updateDebugShowFramesPerSecond(e,t){if(e.debugShowFramesPerSecond){if(!defined(e._performanceDisplay)){const t=document.createElement("div");t.className="cesium-performanceDisplay-defaultContainer";e._canvas.parentNode.appendChild(t);const i=new PerformanceDisplay({container:t});e._performanceDisplay=i,e._performanceContainer=t}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else defined(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function prePassesUpdate(e){e._jobScheduler.resetBudgets();const t=e._frameState;e.primitives.prePassesUpdate(t),defined(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function postPassesUpdate(e){const t=e._frameState;e.primitives.postPassesUpdate(t),RequestScheduler.update()}Scene.prototype.updateEnvironment=function(){const e=this._frameState,t=this._view,i=this._environmentState,n=e.passes.render,r=e.passes.offscreen,o=this.skyAtmosphere,a=this.globe,s=this._globeTranslucencyState;if(!n||this._mode!==SceneMode$1.SCENE2D&&t.camera.frustum instanceof OrthographicFrustum||!s.environmentVisible)i.skyAtmosphereCommand=void 0,i.skyBoxCommand=void 0,i.sunDrawCommand=void 0,i.sunComputeCommand=void 0,i.moonCommand=void 0;else{defined(o)?(defined(a)&&(o.setDynamicAtmosphereColor(a.enableLighting&&a.dynamicAtmosphereLighting,a.dynamicAtmosphereLightingFromSun),i.isReadyForAtmosphere=i.isReadyForAtmosphere||a._surface._tilesToRender.length>0),i.skyAtmosphereCommand=o.update(e,a),defined(i.skyAtmosphereCommand)&&this.updateDerivedCommands(i.skyAtmosphereCommand)):i.skyAtmosphereCommand=void 0,i.skyBoxCommand=defined(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;const n=defined(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;i.sunDrawCommand=defined(n)?n.drawCommand:void 0,i.sunComputeCommand=defined(n)?n.computeCommand:void 0,i.moonCommand=defined(this.moon)?this.moon.update(e):void 0}const c=i.clearGlobeDepth=defined(a)&&a.show&&(!a.depthTestAgainstTerrain||this.mode===SceneMode$1.SCENE2D);(i.useDepthPlane=c&&this.mode===SceneMode$1.SCENE3D&&s.useDepthPlane)&&this._depthPlane.update(e),i.renderTranslucentDepthForPick=!1,i.useWebVR=this._useWebVR&&this.mode!==SceneMode$1.SCENE2D&&!r;const l=e.mode!==SceneMode$1.SCENE3D||s.sunVisibleThroughGlobe?void 0:e.occluder;let u=e.cullingVolume;const d=scratchCullingVolume.planes;for(let e=0;e<5;++e)d[e]=u.planes[e];u=scratchCullingVolume,i.isSkyAtmosphereVisible=defined(i.skyAtmosphereCommand)&&i.isReadyForAtmosphere,i.isSunVisible=this.isVisible(i.sunDrawCommand,u,l),i.isMoonVisible=this.isVisible(i.moonCommand,u,l);const h=this.specularEnvironmentMaps;let p=this._specularEnvironmentMapAtlas;!defined(h)||defined(p)&&p.url===h?!defined(h)&&defined(p)&&(p.destroy(),this._specularEnvironmentMapAtlas=void 0):(p=p&&p.destroy(),this._specularEnvironmentMapAtlas=new OctahedralProjectedCubeMap(h)),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)},Scene.prototype.resolveFramebuffers=function(e){const t=this._context,i=this._environmentState,n=this._view,r=n.globeDepth;defined(r)&&r.prepareColorTextures(t);const o=i.useOIT,a=i.useGlobeDepthFramebuffer,s=i.usePostProcess,c=i.originalFramebuffer,l=a?r.colorFramebufferManager:void 0,u=n.sceneFramebuffer._colorFramebuffer,d=n.sceneFramebuffer.idFramebuffer;o&&(e.framebuffer=s?u.framebuffer:c,n.oit.execute(t,e));const h=n.translucentTileClassification;if(h.hasTranslucentDepth&&h.isSupported()&&h.execute(this,e),s){n.sceneFramebuffer.prepareColorTextures(t);let e=u;a&&!o&&(e=l);const i=this.postProcessStages,r=e.getColorTexture(0),s=d.getColorTexture(0),h=defaultValue(l,u).getDepthStencilTexture();i.execute(t,r,h,s),i.copy(t,c)}o||s||!a||(e.framebuffer=c,r.executeCopyColor(t,e))},Scene.prototype.initializeFrame=function(){120==this._shaderFrameCount++&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeight=getGlobeHeight(this),this._cameraUnderground=isCameraUnderground(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),defined(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};const scratchBackgroundColor=new Color;function render(e){const t=e._frameState,i=e.context,n=i.uniformState,r=e._defaultView;e._view=r,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=renderTilesetPassState;let o=defaultValue(e.backgroundColor,Color.BLACK);e._hdr&&(o=Color.clone(o,scratchBackgroundColor),o.red=Math.pow(o.red,e.gamma),o.green=Math.pow(o.green,e.gamma),o.blue=Math.pow(o.blue,e.gamma)),t.backgroundColor=o,e.fog.update(t),n.update(t);const a=e.shadowMap;defined(a)&&a.enabled&&(!defined(e.light)||e.light instanceof SunLight?Cartesian3.negate(n.sunDirectionWC,e._shadowMapCamera.direction):Cartesian3.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(a)),e._computeCommandList.length=0,e._overlayCommandList.length=0;const s=r.viewport;s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight;const c=r.passState;c.framebuffer=void 0,c.blendingEnabled=void 0,c.scissorTest=void 0,c.viewport=BoundingRectangle.clone(s,c.viewport),defined(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(c,o),e.resolveFramebuffers(c),c.framebuffer=void 0,executeOverlayCommands(e,c),defined(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),i.endFrame()}function tryAndCatchError(e,t){try{t(e)}catch(t){if(e._renderError.raiseEvent(e,t),e.rethrowRenderErrors)throw t}}function updateMostDetailedRayPicks(e){return e._picking.updateMostDetailedRayPicks(e)}function updatePreloadPass(e){const t=e._frameState;preloadTilesetPassState.camera=t.camera,preloadTilesetPassState.cullingVolume=t.cullingVolume;e.primitives.updateForPass(t,preloadTilesetPassState)}function updatePreloadFlightPass(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;preloadFlightTilesetPassState.camera=e.preloadFlightCamera,preloadFlightTilesetPassState.cullingVolume=e.preloadFlightCullingVolume;e.primitives.updateForPass(t,preloadFlightTilesetPassState)}function updateRequestRenderModeDeferCheckPass(e){e.primitives.updateForPass(e._frameState,requestRenderModeDeferCheckPassState)}Scene.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,defined(e)||(e=JulianDate.now());const i=this._view.checkForCameraUpdates(this);let n=!this.requestRenderMode||this._renderRequested||i||this._logDepthBufferDirty||this._hdrDirty||this.mode===SceneMode$1.MORPHING;if(!n&&defined(this.maximumRenderTimeChange)&&defined(this._lastRenderTime)){const t=Math.abs(JulianDate.secondsDifference(this._lastRenderTime,e));n=n||t>this.maximumRenderTimeChange}if(n){this._lastRenderTime=JulianDate.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;updateFrameNumber(this,CesiumMath.incrementWrap(t.frameNumber,15e6,1),e),t.newFrame=!0}tryAndCatchError(this,prePassesUpdate),this.primitives.show&&(tryAndCatchError(this,updateMostDetailedRayPicks),tryAndCatchError(this,updatePreloadPass),tryAndCatchError(this,updatePreloadFlightPass),n||tryAndCatchError(this,updateRequestRenderModeDeferCheckPass)),this._postUpdate.raiseEvent(this,e),n&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),tryAndCatchError(this,render)),updateDebugShowFramesPerSecond(this,n),tryAndCatchError(this,postPassesUpdate),callAfterRenderFunctions(this),n&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())},Scene.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)},Scene.prototype.requestRender=function(){this._renderRequested=!0},Scene.prototype.clampLineWidth=function(e){return Math.max(ContextLimits.minimumAliasedLineWidth,Math.min(e,ContextLimits.maximumAliasedLineWidth))},Scene.prototype.pick=function(e,t,i){return this._picking.pick(this,e,t,i)},Scene.prototype.UpdateQuad=function(e){for(var t=0,i=this._primitivesQuadTrees.length;t<i;t++){var n=this._primitivesQuadTrees[t]._tilesToRender;if(1==this._primitivesQuadTrees[t]._tileProvider._state&&n)for(var r=0,o=n.length;r<o;r++){var a=n[r];a.data&&a.data.geometryPrimitive&&a.data.geometryPrimitive.update(e)}}},Scene.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)},Scene.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)},Scene.prototype.drillPick=function(e,t,i,n){return this._picking.drillPick(this,e,t,i,n)},Scene.prototype.pickFromRay=function(e,t,i){return this._picking.pickFromRay(this,e,t,i)},Scene.prototype.drillPickFromRay=function(e,t,i,n){return this._picking.drillPickFromRay(this,e,t,i,n)},Scene.prototype.pickFromRayMostDetailed=function(e,t,i){return this._picking.pickFromRayMostDetailed(this,e,t,i)},Scene.prototype.drillPickFromRayMostDetailed=function(e,t,i,n){return this._picking.drillPickFromRayMostDetailed(this,e,t,i,n)},Scene.prototype.sampleHeight=function(e,t,i){return this._picking.sampleHeight(this,e,t,i)},Scene.prototype.clampToHeight=function(e,t,i,n){return this._picking.clampToHeight(this,e,t,i,n)},Scene.prototype.sampleHeightMostDetailed=function(e,t,i){return this._picking.sampleHeightMostDetailed(this,e,t,i)},Scene.prototype.clampToHeightMostDetailed=function(e,t,i){return this._picking.clampToHeightMostDetailed(this,e,t,i)},Scene.prototype.cartesianToCanvasCoordinates=function(e,t){return SceneTransforms.wgs84ToWindowCoordinates(this,e,t)},Scene.prototype.completeMorph=function(){this._transitioner.completeMorph()},Scene.prototype.morphTo2D=function(e){let t;const i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo2D(e,t)},Scene.prototype.morphToColumbusView=function(e){let t;const i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphToColumbusView(e,t)},Scene.prototype.morphTo3D=function(e){let t;const i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo3D(e,t)},Scene.prototype.isDestroyed=function(){return!1},Scene.prototype.destroy=function(){this._tweens.removeAll(),this._computeEngine=this._computeEngine&&this._computeEngine.destroy(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._groundPrimitives=this._groundPrimitives&&this._groundPrimitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._depthPlane=this._depthPlane&&this._depthPlane.destroy(),this._transitioner=this._transitioner&&this._transitioner.destroy(),this._debugFrustumPlanes=this._debugFrustumPlanes&&this._debugFrustumPlanes.destroy(),this._brdfLutGenerator=this._brdfLutGenerator&&this._brdfLutGenerator.destroy(),this._picking=this._picking&&this._picking.destroy(),this._defaultView=this._defaultView&&this._defaultView.destroy(),this._view=void 0,this._removeCreditContainer&&this._canvas.parentNode.removeChild(this._creditContainer),this.postProcessStages=this.postProcessStages&&this.postProcessStages.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay=this._frameState.creditDisplay&&this._frameState.creditDisplay.destroy(),defined(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(let e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,destroyObject(this)};
|