@loaders.gl/tile-converter 4.0.0-alpha.16 → 4.0.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -114,13 +114,13 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof Nn))r
114
114
  `));var r=e.pax;if(r)for(var i in r)t+=mL(" "+i+"="+r[i]+`
115
115
  `);return Buffer.from(t)};s0.decodePax=function(e){for(var t={};e.length;){for(var r=0;r<e.length&&e[r]!==32;)r++;var i=parseInt(e.slice(0,r).toString(),10);if(!i)return t;var n=e.slice(r+1,i-1).toString(),a=n.indexOf("=");if(a===-1)return t;t[n.slice(0,a)]=n.slice(a+1),e=e.slice(i)}return t};s0.encode=function(e){var t=Att(512),r=e.name,i="";if(e.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var n=r.indexOf("/");if(n===-1)return null;i+=i?"/"+r.slice(0,n):r.slice(0,n),r=r.slice(n+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(i)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(r),t.write(bh(e.mode&Btt,6),100),t.write(bh(e.uid,6),108),t.write(bh(e.gid,6),116),t.write(bh(e.size,11),124),t.write(bh(e.mtime.getTime()/1e3|0,11),136),t[156]=qle+Dtt(e.type),e.linkname&&t.write(e.linkname,157),Ule.copy(t,x1),Ctt.copy(t,pL),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(bh(e.devmajor||0,6),329),t.write(bh(e.devminor||0,6),337),i&&t.write(i,345),t.write(bh(zle(t),6),148),t)};s0.decode=function(e,t,r){var i=e[156]===0?0:e[156]-qle,n=o0(e,0,100,t),a=_h(e,100,8),o=_h(e,108,8),s=_h(e,116,8),u=_h(e,124,12),l=_h(e,136,12),c=Ftt(i),f=e[157]===0?null:o0(e,157,100,t),h=o0(e,265,32),d=o0(e,297,32),p=_h(e,329,8),y=_h(e,337,8),g=zle(e);if(g===8*32)return null;if(g!==_h(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(Ule.compare(e,x1,x1+6)===0)e[345]&&(n=o0(e,345,155,t)+"/"+n);else if(!(Itt.compare(e,x1,x1+6)===0&&Ptt.compare(e,pL,pL+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return i===0&&n&&n[n.length-1]==="/"&&(i=5),{name:n,mode:a,uid:o,gid:s,size:u,mtime:new Date(1e3*l),type:c,linkname:f,uname:h,gname:d,devmajor:p,devminor:y}}});var vL=T((dPt,Hle)=>{Hle.exports=require("stream")});var $le=T((pPt,Xle)=>{"use strict";function Wle(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function Vle(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wle(Object(r),!0).forEach(function(i){Ltt(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wle(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Ltt(e,t,r){return t=Yle(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jtt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kle(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Yle(i.key),i)}}function Ntt(e,t,r){return t&&Kle(e.prototype,t),r&&Kle(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yle(e){var t=qtt(e,"string");return typeof t=="symbol"?t:String(t)}function qtt(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Utt=require("buffer"),XA=Utt.Buffer,Gtt=require("util"),yL=Gtt.inspect,ztt=yL&&yL.custom||"inspect";function Htt(e,t,r){XA.prototype.copy.call(e,t,r)}Xle.exports=function(){function e(){jtt(this,e),this.head=null,this.tail=null,this.length=0}return Ntt(e,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return XA.alloc(0);for(var i=XA.allocUnsafe(r>>>0),n=this.head,a=0;n;)Htt(n.data,i,a),a+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,a=i.data;for(r-=a.length;i=i.next;){var o=i.data,s=r>o.length?o.length:r;if(s===o.length?a+=o:a+=o.slice(0,r),r-=s,r===0){s===o.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(s));break}++n}return this.length-=n,a}},{key:"_getBuffer",value:function(r){var i=XA.allocUnsafe(r),n=this.head,a=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var o=n.data,s=r>o.length?o.length:r;if(o.copy(i,i.length-r,0,s),r-=s,r===0){s===o.length?(++a,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++a}return this.length-=a,i}},{key:ztt,value:function(r,i){return yL(this,Vle(Vle({},i),{},{depth:0,customInspect:!1}))}}]),e}()});var _L=T((mPt,Qle)=>{"use strict";function Wtt(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(bL,this,e)):process.nextTick(bL,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?r._writableState?r._writableState.errorEmitted?process.nextTick($A,r):(r._writableState.errorEmitted=!0,process.nextTick(Jle,r,a)):process.nextTick(Jle,r,a):t?(process.nextTick($A,r),t(a)):process.nextTick($A,r)}),this)}function Jle(e,t){bL(e,t),$A(e)}function $A(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Vtt(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function bL(e,t){e.emit("error",t)}function Ktt(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}Qle.exports={destroy:Wtt,undestroy:Vtt,errorOrDestroy:Ktt}});var xh=T((gPt,tce)=>{"use strict";var Zle={};function ws(e,t,r){r||(r=Error);function i(a,o,s){return typeof t=="string"?t:t(a,o,s)}class n extends r{constructor(o,s,u){super(i(o,s,u))}}n.prototype.name=r.name,n.prototype.code=e,Zle[e]=n}function ece(e,t){if(Array.isArray(e)){let r=e.length;return e=e.map(i=>String(i)),r>2?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:r===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}function Ytt(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function Xtt(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function $tt(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}ws("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);ws("ERR_INVALID_ARG_TYPE",function(e,t,r){let i;typeof t=="string"&&Ytt(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";let n;if(Xtt(e," argument"))n=`The ${e} ${i} ${ece(t,"type")}`;else{let a=$tt(e,".")?"property":"argument";n=`The "${e}" ${a} ${i} ${ece(t,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);ws("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");ws("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});ws("ERR_STREAM_PREMATURE_CLOSE","Premature close");ws("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});ws("ERR_MULTIPLE_CALLBACK","Callback called multiple times");ws("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");ws("ERR_STREAM_WRITE_AFTER_END","write after end");ws("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ws("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);ws("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");tce.exports.codes=Zle});var xL=T((vPt,rce)=>{"use strict";var Jtt=xh().codes.ERR_INVALID_OPT_VALUE;function Qtt(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function Ztt(e,t,r,i){var n=Qtt(t,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var a=i?r:"highWaterMark";throw new Jtt(a,n)}return Math.floor(n)}return e.objectMode?16:16*1024}rce.exports={getHighWaterMark:Ztt}});var SL=T((yPt,uce)=>{"use strict";uce.exports=Qi;function ice(e){var t=this;this.next=null,this.entry=null,this.finish=function(){Art(t,e)}}var u0;Qi.WritableState=w1;var ert={deprecate:Md()},nce=vL(),JA=require("buffer").Buffer,trt=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function rrt(e){return JA.from(e)}function irt(e){return JA.isBuffer(e)||e instanceof trt}var wL=_L(),nrt=xL(),art=nrt.getHighWaterMark,wh=xh().codes,ort=wh.ERR_INVALID_ARG_TYPE,srt=wh.ERR_METHOD_NOT_IMPLEMENTED,urt=wh.ERR_MULTIPLE_CALLBACK,lrt=wh.ERR_STREAM_CANNOT_PIPE,crt=wh.ERR_STREAM_DESTROYED,frt=wh.ERR_STREAM_NULL_VALUES,hrt=wh.ERR_STREAM_WRITE_AFTER_END,drt=wh.ERR_UNKNOWN_ENCODING,l0=wL.errorOrDestroy;tr()(Qi,nce);function prt(){}function w1(e,t,r){u0=u0||up(),e=e||{},typeof r!="boolean"&&(r=t instanceof u0),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=art(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){xrt(t,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new ice(this)}w1.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(w1.prototype,"buffer",{get:ert.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var QA;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(QA=Function.prototype[Symbol.hasInstance],Object.defineProperty(Qi,Symbol.hasInstance,{value:function(t){return QA.call(this,t)?!0:this!==Qi?!1:t&&t._writableState instanceof w1}})):QA=function(t){return t instanceof this};function Qi(e){u0=u0||up();var t=this instanceof u0;if(!t&&!QA.call(Qi,this))return new Qi(e);this._writableState=new w1(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),nce.call(this)}Qi.prototype.pipe=function(){l0(this,new lrt)};function mrt(e,t){var r=new hrt;l0(e,r),process.nextTick(t,r)}function grt(e,t,r,i){var n;return r===null?n=new frt:typeof r!="string"&&!t.objectMode&&(n=new ort("chunk",["string","Buffer"],r)),n?(l0(e,n),process.nextTick(i,n),!1):!0}Qi.prototype.write=function(e,t,r){var i=this._writableState,n=!1,a=!i.objectMode&&irt(e);return a&&!JA.isBuffer(e)&&(e=rrt(e)),typeof t=="function"&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),typeof r!="function"&&(r=prt),i.ending?mrt(this,r):(a||grt(this,i,e,r))&&(i.pendingcb++,n=yrt(this,i,a,e,t,r)),n};Qi.prototype.cork=function(){this._writableState.corked++};Qi.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&oce(this,e))};Qi.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new drt(t);return this._writableState.defaultEncoding=t,this};Object.defineProperty(Qi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function vrt(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=JA.from(t,r)),t}Object.defineProperty(Qi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function yrt(e,t,r,i,n,a){if(!r){var o=vrt(t,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=t.objectMode?1:i.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else EL(e,t,!1,s,i,n,a);return u}function EL(e,t,r,i,n,a,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new crt("write")):r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function brt(e,t,r,i,n){--t.pendingcb,r?(process.nextTick(n,i),process.nextTick(E1,e,t),e._writableState.errorEmitted=!0,l0(e,i)):(n(i),e._writableState.errorEmitted=!0,l0(e,i),E1(e,t))}function _rt(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function xrt(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new urt;if(_rt(r),t)brt(e,r,i,t,n);else{var a=sce(r)||e.destroyed;!a&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&oce(e,r),i?process.nextTick(ace,e,r,a,n):ace(e,r,a,n)}}function ace(e,t,r,i){r||wrt(e,t),t.pendingcb--,i(),E1(e,t)}function wrt(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function oce(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),a=t.corkedRequestsFree;a.entry=r;for(var o=0,s=!0;r;)n[o]=r,r.isBuf||(s=!1),r=r.next,o+=1;n.allBuffers=s,EL(e,t,!0,t.length,n,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new ice(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,l=r.encoding,c=r.callback,f=t.objectMode?1:u.length;if(EL(e,t,!1,f,u,l,c),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}Qi.prototype._write=function(e,t,r){r(new srt("_write()"))};Qi.prototype._writev=null;Qi.prototype.end=function(e,t,r){var i=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||Trt(this,i,r),this};Object.defineProperty(Qi.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function sce(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function Ert(e,t){e._final(function(r){t.pendingcb--,r&&l0(e,r),t.prefinished=!0,e.emit("prefinish"),E1(e,t)})}function Srt(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(Ert,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function E1(e,t){var r=sce(t);if(r&&(Srt(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}function Trt(e,t,r){t.ending=!0,E1(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function Art(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(Qi.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(t){!this._writableState||(this._writableState.destroyed=t)}});Qi.prototype.destroy=wL.destroy;Qi.prototype._undestroy=wL.undestroy;Qi.prototype._destroy=function(e,t){t(e)}});var up=T((bPt,cce)=>{"use strict";var krt=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};cce.exports=pl;var lce=kL(),TL=SL();tr()(pl,lce);for(AL=krt(TL.prototype),ZA=0;ZA<AL.length;ZA++)e2=AL[ZA],pl.prototype[e2]||(pl.prototype[e2]=TL.prototype[e2]);var AL,e2,ZA;function pl(e){if(!(this instanceof pl))return new pl(e);lce.call(this,e),TL.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Rrt)))}Object.defineProperty(pl.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(pl.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(pl.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Rrt(){this._writableState.ended||process.nextTick(Crt,this)}function Crt(e){e.end()}Object.defineProperty(pl.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)}})});var IL=T(hce=>{"use strict";var RL=Ms().Buffer,fce=RL.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Irt(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function Prt(e){var t=Irt(e);if(typeof t!="string"&&(RL.isEncoding===fce||!fce(e)))throw new Error("Unknown encoding: "+e);return t||e}hce.StringDecoder=S1;function S1(e){this.encoding=Prt(e);var t;switch(this.encoding){case"utf16le":this.text=Lrt,this.end=jrt,t=4;break;case"utf8":this.fillLast=Frt,t=4;break;case"base64":this.text=Nrt,this.end=qrt,t=3;break;default:this.write=Urt,this.end=Grt;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=RL.allocUnsafe(t)}S1.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};S1.prototype.end=Mrt;S1.prototype.text=Drt;S1.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function CL(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function Brt(e,t,r){var i=t.length-1;if(i<r)return 0;var n=CL(t[i]);return n>=0?(n>0&&(e.lastNeed=n-1),n):--i<r||n===-2?0:(n=CL(t[i]),n>=0?(n>0&&(e.lastNeed=n-2),n):--i<r||n===-2?0:(n=CL(t[i]),n>=0?(n>0&&(n===2?n=0:e.lastNeed=n-3),n):0))}function Ort(e,t,r){if((t[0]&192)!=128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,"\uFFFD"}}function Frt(e){var t=this.lastTotal-this.lastNeed,r=Ort(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function Drt(e,t){var r=Brt(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function Mrt(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function Lrt(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function jrt(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function Nrt(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function qrt(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Urt(e){return e.toString(this.encoding)}function Grt(e){return e&&e.length?this.write(e):""}});var t2=T((xPt,mce)=>{"use strict";var dce=xh().codes.ERR_STREAM_PREMATURE_CLOSE;function zrt(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}function Hrt(){}function Wrt(e){return e.setHeader&&typeof e.abort=="function"}function pce(e,t,r){if(typeof t=="function")return pce(e,null,t);t||(t={}),r=zrt(r||Hrt);var i=t.readable||t.readable!==!1&&e.readable,n=t.writable||t.writable!==!1&&e.writable,a=function(){e.writable||s()},o=e._writableState&&e._writableState.finished,s=function(){n=!1,o=!0,i||r.call(e)},u=e._readableState&&e._readableState.endEmitted,l=function(){i=!1,u=!0,n||r.call(e)},c=function(p){r.call(e,p)},f=function(){var p;if(i&&!u)return(!e._readableState||!e._readableState.ended)&&(p=new dce),r.call(e,p);if(n&&!o)return(!e._writableState||!e._writableState.ended)&&(p=new dce),r.call(e,p)},h=function(){e.req.on("finish",s)};return Wrt(e)?(e.on("complete",s),e.on("abort",f),e.req?h():e.on("request",h)):n&&!e._writableState&&(e.on("end",a),e.on("close",a)),e.on("end",l),e.on("finish",s),t.error!==!1&&e.on("error",c),e.on("close",f),function(){e.removeListener("complete",s),e.removeListener("abort",f),e.removeListener("request",h),e.req&&e.req.removeListener("finish",s),e.removeListener("end",a),e.removeListener("close",a),e.removeListener("finish",s),e.removeListener("end",l),e.removeListener("error",c),e.removeListener("close",f)}}mce.exports=pce});var vce=T((wPt,gce)=>{"use strict";var r2;function Eh(e,t,r){return t=Vrt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vrt(e){var t=Krt(e,"string");return typeof t=="symbol"?t:String(t)}function Krt(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yrt=t2(),Sh=Symbol("lastResolve"),lp=Symbol("lastReject"),T1=Symbol("error"),i2=Symbol("ended"),cp=Symbol("lastPromise"),PL=Symbol("handlePromise"),fp=Symbol("stream");function Th(e,t){return{value:e,done:t}}function Xrt(e){var t=e[Sh];if(t!==null){var r=e[fp].read();r!==null&&(e[cp]=null,e[Sh]=null,e[lp]=null,t(Th(r,!1)))}}function $rt(e){process.nextTick(Xrt,e)}function Jrt(e,t){return function(r,i){e.then(function(){if(t[i2]){r(Th(void 0,!0));return}t[PL](r,i)},i)}}var Qrt=Object.getPrototypeOf(function(){}),Zrt=Object.setPrototypeOf((r2={get stream(){return this[fp]},next:function(){var t=this,r=this[T1];if(r!==null)return Promise.reject(r);if(this[i2])return Promise.resolve(Th(void 0,!0));if(this[fp].destroyed)return new Promise(function(o,s){process.nextTick(function(){t[T1]?s(t[T1]):o(Th(void 0,!0))})});var i=this[cp],n;if(i)n=new Promise(Jrt(i,this));else{var a=this[fp].read();if(a!==null)return Promise.resolve(Th(a,!1));n=new Promise(this[PL])}return this[cp]=n,n}},Eh(r2,Symbol.asyncIterator,function(){return this}),Eh(r2,"return",function(){var t=this;return new Promise(function(r,i){t[fp].destroy(null,function(n){if(n){i(n);return}r(Th(void 0,!0))})})}),r2),Qrt),eit=function(t){var r,i=Object.create(Zrt,(r={},Eh(r,fp,{value:t,writable:!0}),Eh(r,Sh,{value:null,writable:!0}),Eh(r,lp,{value:null,writable:!0}),Eh(r,T1,{value:null,writable:!0}),Eh(r,i2,{value:t._readableState.endEmitted,writable:!0}),Eh(r,PL,{value:function(a,o){var s=i[fp].read();s?(i[cp]=null,i[Sh]=null,i[lp]=null,a(Th(s,!1))):(i[Sh]=a,i[lp]=o)},writable:!0}),r));return i[cp]=null,Yrt(t,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var a=i[lp];a!==null&&(i[cp]=null,i[Sh]=null,i[lp]=null,a(n)),i[T1]=n;return}var o=i[Sh];o!==null&&(i[cp]=null,i[Sh]=null,i[lp]=null,o(Th(void 0,!0))),i[i2]=!0}),t.on("readable",$rt.bind(null,i)),i};gce.exports=eit});var xce=T((EPt,_ce)=>{"use strict";function yce(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(l){r(l);return}s.done?t(u):Promise.resolve(u).then(i,n)}function tit(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){yce(a,i,n,o,s,"next",u)}function s(u){yce(a,i,n,o,s,"throw",u)}o(void 0)})}}function bce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function rit(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bce(Object(r),!0).forEach(function(i){iit(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bce(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function iit(e,t,r){return t=nit(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nit(e){var t=ait(e,"string");return typeof t=="symbol"?t:String(t)}function ait(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var oit=xh().codes.ERR_INVALID_ARG_TYPE;function sit(e,t,r){var i;if(t&&typeof t.next=="function")i=t;else if(t&&t[Symbol.asyncIterator])i=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])i=t[Symbol.iterator]();else throw new oit("iterable",["Iterable"],t);var n=new e(rit({objectMode:!0},r)),a=!1;n._read=function(){a||(a=!0,o())};function o(){return s.apply(this,arguments)}function s(){return s=tit(function*(){try{var u=yield i.next(),l=u.value,c=u.done;c?n.push(null):n.push(yield l)?o():a=!1}catch(f){n.destroy(f)}}),s.apply(this,arguments)}return n}_ce.exports=sit});var kL=T((TPt,Pce)=>{"use strict";Pce.exports=Gr;var c0;Gr.ReadableState=Ece;var SPt=require("events").EventEmitter,wce=function(t,r){return t.listeners(r).length},A1=vL(),n2=require("buffer").Buffer,uit=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function lit(e){return n2.from(e)}function cit(e){return n2.isBuffer(e)||e instanceof uit}var BL=require("util"),br;BL&&BL.debuglog?br=BL.debuglog("stream"):br=function(){};var fit=$le(),OL=_L(),hit=xL(),dit=hit.getHighWaterMark,a2=xh().codes,pit=a2.ERR_INVALID_ARG_TYPE,mit=a2.ERR_STREAM_PUSH_AFTER_EOF,git=a2.ERR_METHOD_NOT_IMPLEMENTED,vit=a2.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,f0,FL,DL;tr()(Gr,A1);var k1=OL.errorOrDestroy,ML=["error","close","destroy","pause","resume"];function yit(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function Ece(e,t,r){c0=c0||up(),e=e||{},typeof r!="boolean"&&(r=t instanceof c0),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=dit(this,e,"readableHighWaterMark",r),this.buffer=new fit,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(f0||(f0=IL().StringDecoder),this.decoder=new f0(e.encoding),this.encoding=e.encoding)}function Gr(e){if(c0=c0||up(),!(this instanceof Gr))return new Gr(e);var t=this instanceof c0;this._readableState=new Ece(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),A1.call(this)}Object.defineProperty(Gr.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(t){!this._readableState||(this._readableState.destroyed=t)}});Gr.prototype.destroy=OL.destroy;Gr.prototype._undestroy=OL.undestroy;Gr.prototype._destroy=function(e,t){t(e)};Gr.prototype.push=function(e,t){var r=this._readableState,i;return r.objectMode?i=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=n2.from(e,t),t=""),i=!0),Sce(this,e,t,!1,i)};Gr.prototype.unshift=function(e){return Sce(this,e,null,!0,!1)};function Sce(e,t,r,i,n){br("readableAddChunk",t);var a=e._readableState;if(t===null)a.reading=!1,xit(e,a);else{var o;if(n||(o=bit(a,t)),o)k1(e,o);else if(a.objectMode||t&&t.length>0)if(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==n2.prototype&&(t=lit(t)),i)a.endEmitted?k1(e,new vit):LL(e,a,t,!0);else if(a.ended)k1(e,new mit);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||t.length!==0?LL(e,a,t,!1):jL(e,a)):LL(e,a,t,!1)}else i||(a.reading=!1,jL(e,a))}return!a.ended&&(a.length<a.highWaterMark||a.length===0)}function LL(e,t,r,i){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&o2(e)),jL(e,t)}function bit(e,t){var r;return!cit(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new pit("chunk",["string","Buffer","Uint8Array"],t)),r}Gr.prototype.isPaused=function(){return this._readableState.flowing===!1};Gr.prototype.setEncoding=function(e){f0||(f0=IL().StringDecoder);var t=new f0(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var Tce=1073741824;function _it(e){return e>=Tce?e=Tce:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Ace(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=_it(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}Gr.prototype.read=function(e){br("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return br("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?qL(this):o2(this),null;if(e=Ace(e,t),e===0&&t.ended)return t.length===0&&qL(this),null;var i=t.needReadable;br("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,br("length less than watermark",i)),t.ended||t.reading?(i=!1,br("reading or ended",i)):i&&(br("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Ace(r,t)));var n;return e>0?n=Cce(e,t):n=null,n===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&qL(this)),n!==null&&this.emit("data",n),n};function xit(e,t){if(br("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?o2(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,kce(e)))}}function o2(e){var t=e._readableState;br("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(br("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(kce,e))}function kce(e){var t=e._readableState;br("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,NL(e)}function jL(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(wit,e,t))}function wit(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(br("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}Gr.prototype._read=function(e){k1(this,new git("_read()"))};Gr.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,br("pipe count=%d opts=%j",i.pipesCount,t);var n=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=n?s:y;i.endEmitted?process.nextTick(a):r.once("end",a),e.on("unpipe",o);function o(g,b){br("onunpipe"),g===r&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,c())}function s(){br("onend"),e.end()}var u=Eit(r);e.on("drain",u);var l=!1;function c(){br("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",u),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",y),r.removeListener("data",f),l=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}r.on("data",f);function f(g){br("ondata");var b=e.write(g);br("dest.write",b),b===!1&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&Ice(i.pipes,e)!==-1)&&!l&&(br("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(g){br("onerror",g),y(),e.removeListener("error",h),wce(e,"error")===0&&k1(e,g)}yit(e,"error",h);function d(){e.removeListener("finish",p),y()}e.once("close",d);function p(){br("onfinish"),e.removeListener("close",d),y()}e.once("finish",p);function y(){br("unpipe"),r.unpipe(e)}return e.emit("pipe",r),i.flowing||(br("pipe resume"),r.resume()),e};function Eit(e){return function(){var r=e._readableState;br("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&wce(e,"data")&&(r.flowing=!0,NL(e))}}Gr.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<n;a++)i[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=Ice(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};Gr.prototype.on=function(e,t){var r=A1.prototype.on.call(this,e,t),i=this._readableState;return e==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):e==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,br("on readable",i.length,i.reading),i.length?o2(this):i.reading||process.nextTick(Sit,this)),r};Gr.prototype.addListener=Gr.prototype.on;Gr.prototype.removeListener=function(e,t){var r=A1.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(Rce,this),r};Gr.prototype.removeAllListeners=function(e){var t=A1.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(Rce,this),t};function Rce(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Sit(e){br("readable nexttick read 0"),e.read(0)}Gr.prototype.resume=function(){var e=this._readableState;return e.flowing||(br("resume"),e.flowing=!e.readableListening,Tit(this,e)),e.paused=!1,this};function Tit(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(Ait,e,t))}function Ait(e,t){br("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),NL(e),t.flowing&&!t.reading&&e.read(0)}Gr.prototype.pause=function(){return br("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(br("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function NL(e){var t=e._readableState;for(br("flow",t.flowing);t.flowing&&e.read()!==null;);}Gr.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;e.on("end",function(){if(br("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(br("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var s=t.push(o);s||(i=!0,e.pause())}});for(var n in e)this[n]===void 0&&typeof e[n]=="function"&&(this[n]=function(s){return function(){return e[s].apply(e,arguments)}}(n));for(var a=0;a<ML.length;a++)e.on(ML[a],this.emit.bind(this,ML[a]));return this._read=function(o){br("wrapped _read",o),i&&(i=!1,e.resume())},this};typeof Symbol=="function"&&(Gr.prototype[Symbol.asyncIterator]=function(){return FL===void 0&&(FL=vce()),FL(this)});Object.defineProperty(Gr.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Gr.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Gr.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}});Gr._fromList=Cce;Object.defineProperty(Gr.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Cce(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function qL(e){var t=e._readableState;br("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(kit,t,e))}function kit(e,t){if(br("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}typeof Symbol=="function"&&(Gr.from=function(e,t){return DL===void 0&&(DL=xce()),DL(Gr,e,t)});function Ice(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}});var UL=T((APt,Oce)=>{"use strict";Oce.exports=kc;var s2=xh().codes,Rit=s2.ERR_METHOD_NOT_IMPLEMENTED,Cit=s2.ERR_MULTIPLE_CALLBACK,Iit=s2.ERR_TRANSFORM_ALREADY_TRANSFORMING,Pit=s2.ERR_TRANSFORM_WITH_LENGTH_0,u2=up();tr()(kc,u2);function Bit(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new Cit);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function kc(e){if(!(this instanceof kc))return new kc(e);u2.call(this,e),this._transformState={afterTransform:Bit.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Oit)}function Oit(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){Bce(e,t,r)}):Bce(this,null,null)}kc.prototype.push=function(e,t){return this._transformState.needTransform=!1,u2.prototype.push.call(this,e,t)};kc.prototype._transform=function(e,t,r){r(new Rit("_transform()"))};kc.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};kc.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};kc.prototype._destroy=function(e,t){u2.prototype._destroy.call(this,e,function(r){t(r)})};function Bce(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Pit;if(e._transformState.transforming)throw new Iit;return e.push(null)}});var Mce=T((kPt,Dce)=>{"use strict";Dce.exports=R1;var Fce=UL();tr()(R1,Fce);function R1(e){if(!(this instanceof R1))return new R1(e);Fce.call(this,e)}R1.prototype._transform=function(e,t,r){r(null,e)}});var Uce=T((RPt,qce)=>{"use strict";var zL;function Fit(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var Lce=xh().codes,Dit=Lce.ERR_MISSING_ARGS,Mit=Lce.ERR_STREAM_DESTROYED;function jce(e){if(e)throw e}function Lit(e){return e.setHeader&&typeof e.abort=="function"}function jit(e,t,r,i){i=Fit(i);var n=!1;e.on("close",function(){n=!0}),zL===void 0&&(zL=t2()),zL(e,{readable:t,writable:r},function(o){if(o)return i(o);n=!0,i()});var a=!1;return function(o){if(!n&&!a){if(a=!0,Lit(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();i(o||new Mit("pipe"))}}}function Nce(e){e()}function Nit(e,t){return e.pipe(t)}function qit(e){return!e.length||typeof e[e.length-1]!="function"?jce:e.pop()}function Uit(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=qit(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Dit("streams");var n,a=t.map(function(o,s){var u=s<t.length-1,l=s>0;return jit(o,u,l,function(c){n||(n=c),c&&a.forEach(Nce),!u&&(a.forEach(Nce),i(n))})});return t.reduce(Nit)}qce.exports=Uit});var P1=T((Es,I1)=>{var C1=require("stream");process.env.READABLE_STREAM==="disable"&&C1?(I1.exports=C1.Readable,Object.assign(I1.exports,C1),I1.exports.Stream=C1):(Es=I1.exports=kL(),Es.Stream=C1||Es,Es.Readable=Es,Es.Writable=SL(),Es.Duplex=up(),Es.Transform=UL(),Es.PassThrough=Mce(),Es.finished=t2(),Es.pipeline=Uce())});var Yce=T((CPt,Kce)=>{var Gce=require("util"),Git=Nle(),B1=gL(),zce=P1().Writable,Hce=P1().PassThrough,Wce=function(){},Vce=function(e){return e&=511,e&&512-e},zit=function(e,t){var r=new l2(e,t);return r.end(),r},Hit=function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e},l2=function(e,t){this._parent=e,this.offset=t,Hce.call(this,{autoDestroy:!1})};Gce.inherits(l2,Hce);l2.prototype.destroy=function(e){this._parent.destroy(e)};var Rc=function(e){if(!(this instanceof Rc))return new Rc(e);zce.call(this,e),e=e||{},this._offset=0,this._buffer=Git(),this._missing=0,this._partial=!1,this._onparse=Wce,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,r=t._buffer,i=function(){t._continue()},n=function(h){if(t._locked=!1,h)return t.destroy(h);t._stream||i()},a=function(){t._stream=null;var h=Vce(t._header.size);h?t._parse(h,o):t._parse(512,f),t._locked||i()},o=function(){t._buffer.consume(Vce(t._header.size)),t._parse(512,f),i()},s=function(){var h=t._header.size;t._paxGlobal=B1.decodePax(r.slice(0,h)),r.consume(h),a()},u=function(){var h=t._header.size;t._pax=B1.decodePax(r.slice(0,h)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),r.consume(h),a()},l=function(){var h=t._header.size;this._gnuLongPath=B1.decodeLongPath(r.slice(0,h),e.filenameEncoding),r.consume(h),a()},c=function(){var h=t._header.size;this._gnuLongLinkPath=B1.decodeLongPath(r.slice(0,h),e.filenameEncoding),r.consume(h),a()},f=function(){var h=t._offset,d;try{d=t._header=B1.decode(r.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(p){t.emit("error",p)}if(r.consume(512),!d){t._parse(512,f),i();return}if(d.type==="gnu-long-path"){t._parse(d.size,l),i();return}if(d.type==="gnu-long-link-path"){t._parse(d.size,c),i();return}if(d.type==="pax-global-header"){t._parse(d.size,s),i();return}if(d.type==="pax-header"){t._parse(d.size,u),i();return}if(t._gnuLongPath&&(d.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(d.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=d=Hit(d,t._pax),t._pax=null),t._locked=!0,!d.size||d.type==="directory"){t._parse(512,f),t.emit("entry",d,zit(t,h),n);return}t._stream=new l2(t,h),t.emit("entry",d,t._stream,n),t._parse(d.size,a),i()};this._onheader=f,this._parse(512,f)};Gce.inherits(Rc,zce);Rc.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.emit("close"))};Rc.prototype._parse=function(e,t){this._destroyed||(this._offset+=e,this._missing=e,t===this._onheader&&(this._partial=!1),this._onparse=t)};Rc.prototype._continue=function(){if(!this._destroyed){var e=this._cb;this._cb=Wce,this._overflow?this._write(this._overflow,void 0,e):e()}};Rc.prototype._write=function(e,t,r){if(!this._destroyed){var i=this._stream,n=this._buffer,a=this._missing;if(e.length&&(this._partial=!0),e.length<a)return this._missing-=e.length,this._overflow=null,i?i.write(e,r):(n.append(e),r());this._cb=r,this._missing=0;var o=null;e.length>a&&(o=e.slice(a),e=e.slice(0,a)),i?i.end(e):n.append(e),this._overflow=o,this._onparse()}};Rc.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()};Kce.exports=Rc});var $ce=T((IPt,Xce)=>{Xce.exports=require("fs").constants||require("constants")});var Zce=T((PPt,Qce)=>{var Wit=GT(),Vit=function(){},Kit=function(e){return e.setHeader&&typeof e.abort=="function"},Yit=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},Jce=function(e,t,r){if(typeof t=="function")return Jce(e,null,t);t||(t={}),r=Wit(r||Vit);var i=e._writableState,n=e._readableState,a=t.readable||t.readable!==!1&&e.readable,o=t.writable||t.writable!==!1&&e.writable,s=!1,u=function(){e.writable||l()},l=function(){o=!1,a||r.call(e)},c=function(){a=!1,o||r.call(e)},f=function(g){r.call(e,g?new Error("exited with error code: "+g):null)},h=function(g){r.call(e,g)},d=function(){process.nextTick(p)},p=function(){if(!s){if(a&&!(n&&n.ended&&!n.destroyed))return r.call(e,new Error("premature close"));if(o&&!(i&&i.ended&&!i.destroyed))return r.call(e,new Error("premature close"))}},y=function(){e.req.on("finish",l)};return Kit(e)?(e.on("complete",l),e.on("abort",d),e.req?y():e.on("request",y)):o&&!i&&(e.on("end",u),e.on("close",u)),Yit(e)&&e.on("exit",f),e.on("end",c),e.on("finish",l),t.error!==!1&&e.on("error",h),e.on("close",d),function(){s=!0,e.removeListener("complete",l),e.removeListener("abort",d),e.removeListener("request",y),e.req&&e.req.removeListener("finish",l),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("exit",f),e.removeListener("end",c),e.removeListener("error",h),e.removeListener("close",d)}};Qce.exports=Jce});var nfe=T((BPt,ife)=>{var h0=$ce(),efe=Zce(),c2=tr(),Xit=Buffer.alloc,tfe=P1().Readable,d0=P1().Writable,$it=require("string_decoder").StringDecoder,f2=gL(),Jit=parseInt("755",8),Qit=parseInt("644",8),rfe=Xit(1024),HL=function(){},WL=function(e,t){t&=511,t&&e.push(rfe.slice(0,512-t))};function Zit(e){switch(e&h0.S_IFMT){case h0.S_IFBLK:return"block-device";case h0.S_IFCHR:return"character-device";case h0.S_IFDIR:return"directory";case h0.S_IFIFO:return"fifo";case h0.S_IFLNK:return"symlink"}return"file"}var h2=function(e){d0.call(this),this.written=0,this._to=e,this._destroyed=!1};c2(h2,d0);h2.prototype._write=function(e,t,r){if(this.written+=e.length,this._to.push(e))return r();this._to._drain=r};h2.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var d2=function(){d0.call(this),this.linkname="",this._decoder=new $it("utf-8"),this._destroyed=!1};c2(d2,d0);d2.prototype._write=function(e,t,r){this.linkname+=this._decoder.write(e),r()};d2.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var O1=function(){d0.call(this),this._destroyed=!1};c2(O1,d0);O1.prototype._write=function(e,t,r){r(new Error("No body allowed for this entry"))};O1.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var ml=function(e){if(!(this instanceof ml))return new ml(e);tfe.call(this,e),this._drain=HL,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};c2(ml,tfe);ml.prototype.entry=function(e,t,r){if(this._stream)throw new Error("already piping an entry");if(!(this._finalized||this._destroyed)){typeof t=="function"&&(r=t,t=null),r||(r=HL);var i=this;if((!e.size||e.type==="symlink")&&(e.size=0),e.type||(e.type=Zit(e.mode)),e.mode||(e.mode=e.type==="directory"?Jit:Qit),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),typeof t=="string"&&(t=Buffer.from(t)),Buffer.isBuffer(t)){e.size=t.length,this._encode(e);var n=this.push(t);return WL(i,e.size),n?process.nextTick(r):this._drain=r,new O1}if(e.type==="symlink"&&!e.linkname){var a=new d2;return efe(a,function(s){if(s)return i.destroy(),r(s);e.linkname=a.linkname,i._encode(e),r()}),a}if(this._encode(e),e.type!=="file"&&e.type!=="contiguous-file")return process.nextTick(r),new O1;var o=new h2(this);return this._stream=o,efe(o,function(s){if(i._stream=null,s)return i.destroy(),r(s);if(o.written!==e.size)return i.destroy(),r(new Error("size mismatch"));WL(i,e.size),i._finalizing&&i.finalize(),r()}),o}};ml.prototype.finalize=function(){if(this._stream){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(rfe),this.push(null))};ml.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())};ml.prototype._encode=function(e){if(!e.pax){var t=f2.encode(e);if(t){this.push(t);return}}this._encodePax(e)};ml.prototype._encodePax=function(e){var t=f2.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),r={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(f2.encode(r)),this.push(t),WL(this,t.length),r.size=e.size,r.type=e.type,this.push(f2.encode(r))};ml.prototype._read=function(e){var t=this._drain;this._drain=HL,t()};ife.exports=ml});var afe=T(VL=>{VL.extract=Yce();VL.pack=nfe()});var ufe=T((FPt,sfe)=>{var ent=require("zlib"),tnt=afe(),ofe=Gg(),Cc=function(e){if(!(this instanceof Cc))return new Cc(e);e=this.options=ofe.defaults(e,{gzip:!1}),typeof e.gzipOptions!="object"&&(e.gzipOptions={}),this.supports={directory:!0,symlink:!0},this.engine=tnt.pack(e),this.compressor=!1,e.gzip&&(this.compressor=ent.createGzip(e.gzipOptions),this.compressor.on("error",this._onCompressorError.bind(this)))};Cc.prototype._onCompressorError=function(e){this.engine.emit("error",e)};Cc.prototype.append=function(e,t,r){var i=this;t.mtime=t.date;function n(o,s){if(o){r(o);return}i.engine.entry(t,s,function(u){r(u,t)})}if(t.sourceType==="buffer")n(null,e);else if(t.sourceType==="stream"&&t.stats){t.size=t.stats.size;var a=i.engine.entry(t,function(o){r(o,t)});e.pipe(a)}else t.sourceType==="stream"&&ofe.collectStream(e,n)};Cc.prototype.finalize=function(){this.engine.finalize()};Cc.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};Cc.prototype.pipe=function(e,t){return this.compressor?this.engine.pipe.apply(this.engine,[this.compressor]).pipe(e,t):this.engine.pipe.apply(this.engine,arguments)};Cc.prototype.unpipe=function(){return this.compressor?this.compressor.unpipe.apply(this.compressor,arguments):this.engine.unpipe.apply(this.engine,arguments)};sfe.exports=Cc});var hfe=T((DPt,ffe)=>{var rnt=require("util").inherits,lfe=xD().Transform,int=uM(),cfe=Gg(),Ah=function(e){if(!(this instanceof Ah))return new Ah(e);e=this.options=cfe.defaults(e,{}),lfe.call(this,e),this.supports={directory:!0,symlink:!0},this.files=[]};rnt(Ah,lfe);Ah.prototype._transform=function(e,t,r){r(null,e)};Ah.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)};Ah.prototype.append=function(e,t,r){var i=this;t.crc32=0;function n(a,o){if(a){r(a);return}t.size=o.length||0,t.crc32=int.unsigned(o),i.files.push(t),r(null,t)}t.sourceType==="buffer"?n(null,e):t.sourceType==="stream"&&cfe.collectStream(e,n)};Ah.prototype.finalize=function(){this._writeStringified(),this.end()};ffe.exports=Ah});var pfe=T((MPt,dfe)=>{var nnt=roe(),F1={},kh=function(e,t){return kh.create(e,t)};kh.create=function(e,t){if(F1[e]){var r=new nnt(e,t);return r.setFormat(e),r.setModule(new F1[e](t)),r}else throw new Error("create("+e+"): format not registered")};kh.registerFormat=function(e,t){if(F1[e])throw new Error("register("+e+"): format already registered");if(typeof t!="function")throw new Error("register("+e+"): format module invalid");if(typeof t.prototype.append!="function"||typeof t.prototype.finalize!="function")throw new Error("register("+e+"): format module missing methods");F1[e]=t};kh.isRegisteredFormat=function(e){return!!F1[e]};kh.registerFormat("zip",Mue());kh.registerFormat("tar",ufe());kh.registerFormat("json",hfe());dfe.exports=kh});var Ic=T(Oo=>{"use strict";Oo.base64=!0;Oo.array=!0;Oo.string=!0;Oo.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined";Oo.nodebuffer=typeof Buffer!="undefined";Oo.uint8array=typeof Uint8Array!="undefined";if(typeof ArrayBuffer=="undefined")Oo.blob=!1;else{KL=new ArrayBuffer(0);try{Oo.blob=new Blob([KL],{type:"application/zip"}).size===0}catch{try{mfe=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,YL=new mfe,YL.append(KL),Oo.blob=YL.getBlob("application/zip").size===0}catch{Oo.blob=!1}}}var KL,mfe,YL;try{Oo.nodestream=!!Rb().Readable}catch{Oo.nodestream=!1}});var $L=T(XL=>{"use strict";var ant=Li(),ont=Ic(),gl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";XL.encode=function(e){for(var t=[],r,i,n,a,o,s,u,l=0,c=e.length,f=c,h=ant.getTypeOf(e)!=="string";l<e.length;)f=c-l,h?(r=e[l++],i=l<c?e[l++]:0,n=l<c?e[l++]:0):(r=e.charCodeAt(l++),i=l<c?e.charCodeAt(l++):0,n=l<c?e.charCodeAt(l++):0),a=r>>2,o=(r&3)<<4|i>>4,s=f>1?(i&15)<<2|n>>6:64,u=f>2?n&63:64,t.push(gl.charAt(a)+gl.charAt(o)+gl.charAt(s)+gl.charAt(u));return t.join("")};XL.decode=function(e){var t,r,i,n,a,o,s,u=0,l=0,c="data:";if(e.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var f=e.length*3/4;if(e.charAt(e.length-1)===gl.charAt(64)&&f--,e.charAt(e.length-2)===gl.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");var h;for(ont.uint8array?h=new Uint8Array(f|0):h=new Array(f|0);u<e.length;)n=gl.indexOf(e.charAt(u++)),a=gl.indexOf(e.charAt(u++)),o=gl.indexOf(e.charAt(u++)),s=gl.indexOf(e.charAt(u++)),t=n<<2|a>>4,r=(a&15)<<4|o>>2,i=(o&3)<<6|s,h[l++]=t,o!==64&&(h[l++]=r),s!==64&&(h[l++]=i);return h}});var D1=T((NPt,gfe)=>{"use strict";gfe.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var _fe=T((qPt,bfe)=>{"use strict";var vfe=global.MutationObserver||global.WebKitMutationObserver,p0;process.browser?vfe?(JL=0,yfe=new vfe(L1),QL=global.document.createTextNode(""),yfe.observe(QL,{characterData:!0}),p0=function(){QL.data=JL=++JL%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(ZL=new global.MessageChannel,ZL.port1.onmessage=L1,p0=function(){ZL.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?p0=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){L1(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:p0=function(){setTimeout(L1,0)}:p0=function(){process.nextTick(L1)};var JL,yfe,QL,ZL,ej,M1=[];function L1(){ej=!0;for(var e,t,r=M1.length;r;){for(t=M1,M1=[],e=-1;++e<r;)t[e]();r=M1.length}ej=!1}bfe.exports=snt;function snt(e){M1.push(e)===1&&!ej&&p0()}});var kfe=T((UPt,Afe)=>{"use strict";var xfe=_fe();function m0(){}var Ia={},wfe=["REJECTED"],tj=["FULFILLED"],Efe=["PENDING"];process.browser||(j1=["UNHANDLED"]);var j1;Afe.exports=Rh;function Rh(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=Efe,this.queue=[],this.outcome=void 0,process.browser||(this.handled=j1),e!==m0&&Sfe(this,e)}Rh.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(r,i);function r(n){function a(){return n}return t.resolve(e()).then(a)}function i(n){function a(){throw n}return t.resolve(e()).then(a)}};Rh.prototype.catch=function(e){return this.then(null,e)};Rh.prototype.then=function(e,t){if(typeof e!="function"&&this.state===tj||typeof t!="function"&&this.state===wfe)return this;var r=new this.constructor(m0);if(process.browser||this.handled===j1&&(this.handled=null),this.state!==Efe){var i=this.state===tj?e:t;rj(r,i,this.outcome)}else this.queue.push(new N1(r,e,t));return r};function N1(e,t,r){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof r=="function"&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}N1.prototype.callFulfilled=function(e){Ia.resolve(this.promise,e)};N1.prototype.otherCallFulfilled=function(e){rj(this.promise,this.onFulfilled,e)};N1.prototype.callRejected=function(e){Ia.reject(this.promise,e)};N1.prototype.otherCallRejected=function(e){rj(this.promise,this.onRejected,e)};function rj(e,t,r){xfe(function(){var i;try{i=t(r)}catch(n){return Ia.reject(e,n)}i===e?Ia.reject(e,new TypeError("Cannot resolve promise with itself")):Ia.resolve(e,i)})}Ia.resolve=function(e,t){var r=Tfe(unt,t);if(r.status==="error")return Ia.reject(e,r.value);var i=r.value;if(i)Sfe(e,i);else{e.state=tj,e.outcome=t;for(var n=-1,a=e.queue.length;++n<a;)e.queue[n].callFulfilled(t)}return e};Ia.reject=function(e,t){e.state=wfe,e.outcome=t,process.browser||e.handled===j1&&xfe(function(){e.handled===j1&&process.emit("unhandledRejection",t,e)});for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callRejected(t);return e};function unt(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function Sfe(e,t){var r=!1;function i(s){r||(r=!0,Ia.reject(e,s))}function n(s){r||(r=!0,Ia.resolve(e,s))}function a(){t(n,i)}var o=Tfe(a);o.status==="error"&&i(o.value)}function Tfe(e,t){var r={};try{r.value=e(t),r.status="success"}catch(i){r.status="error",r.value=i}return r}Rh.resolve=lnt;function lnt(e){return e instanceof this?e:Ia.resolve(new this(m0),e)}Rh.reject=cnt;function cnt(e){var t=new this(m0);return Ia.reject(t,e)}Rh.all=fnt;function fnt(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var n=new Array(r),a=0,o=-1,s=new this(m0);++o<r;)u(e[o],o);return s;function u(l,c){t.resolve(l).then(f,function(h){i||(i=!0,Ia.reject(s,h))});function f(h){n[c]=h,++a===r&&!i&&(i=!0,Ia.resolve(s,n))}}}Rh.race=hnt;function hnt(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var n=-1,a=new this(m0);++n<r;)o(e[n]);return a;function o(s){t.resolve(s).then(function(u){i||(i=!0,Ia.resolve(a,u))},function(u){i||(i=!0,Ia.reject(a,u))})}}});var g0=T((GPt,Rfe)=>{"use strict";var ij=null;typeof Promise!="undefined"?ij=Promise:ij=kfe();Rfe.exports={Promise:ij}});var Ife=T(Cfe=>{(function(e,t){"use strict";if(e.setImmediate)return;var r=1,i={},n=!1,a=e.document,o;function s(E){typeof E!="function"&&(E=new Function(""+E));for(var A=new Array(arguments.length-1),k=0;k<A.length;k++)A[k]=arguments[k+1];var R={callback:E,args:A};return i[r]=R,o(r),r++}function u(E){delete i[E]}function l(E){var A=E.callback,k=E.args;switch(k.length){case 0:A();break;case 1:A(k[0]);break;case 2:A(k[0],k[1]);break;case 3:A(k[0],k[1],k[2]);break;default:A.apply(t,k);break}}function c(E){if(n)setTimeout(c,0,E);else{var A=i[E];if(A){n=!0;try{l(A)}finally{u(E),n=!1}}}}function f(){o=function(E){process.nextTick(function(){c(E)})}}function h(){if(e.postMessage&&!e.importScripts){var E=!0,A=e.onmessage;return e.onmessage=function(){E=!1},e.postMessage("","*"),e.onmessage=A,E}}function d(){var E="setImmediate$"+Math.random()+"$",A=function(k){k.source===e&&typeof k.data=="string"&&k.data.indexOf(E)===0&&c(+k.data.slice(E.length))};e.addEventListener?e.addEventListener("message",A,!1):e.attachEvent("onmessage",A),o=function(k){e.postMessage(E+k,"*")}}function p(){var E=new MessageChannel;E.port1.onmessage=function(A){var k=A.data;c(k)},o=function(A){E.port2.postMessage(A)}}function y(){var E=a.documentElement;o=function(A){var k=a.createElement("script");k.onreadystatechange=function(){c(A),k.onreadystatechange=null,E.removeChild(k),k=null},E.appendChild(k)}}function g(){o=function(E){setTimeout(c,0,E)}}var b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,{}.toString.call(e.process)==="[object process]"?f():h()?d():e.MessageChannel?p():a&&"onreadystatechange"in a.createElement("script")?y():g(),b.setImmediate=s,b.clearImmediate=u})(typeof self=="undefined"?typeof global=="undefined"?Cfe:global:self)});var Li=T(Tn=>{"use strict";var Ch=Ic(),dnt=$L(),v0=D1(),nj=g0();Ife();function pnt(e){var t=null;return Ch.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),p2(e,t)}Tn.newBlob=function(e,t){Tn.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,i=new r;return i.append(e),i.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function q1(e){return e}function p2(e,t){for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)&255;return t}var m2={stringifyByChunk:function(e,t,r){var i=[],n=0,a=e.length;if(a<=r)return String.fromCharCode.apply(null,e);for(;n<a;)t==="array"||t==="nodebuffer"?i.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+r,a)))):i.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+r,a)))),n+=r;return i.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return Ch.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return Ch.nodebuffer&&String.fromCharCode.apply(null,v0.allocBuffer(1)).length===1}catch{return!1}}()}};function U1(e){var t=65536,r=Tn.getTypeOf(e),i=!0;if(r==="uint8array"?i=m2.applyCanBeUsed.uint8array:r==="nodebuffer"&&(i=m2.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return m2.stringifyByChunk(e,r,t)}catch{t=Math.floor(t/2)}return m2.stringifyByChar(e)}Tn.applyFromCharCode=U1;function g2(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}var Ih={};Ih.string={string:q1,array:function(e){return p2(e,new Array(e.length))},arraybuffer:function(e){return Ih.string.uint8array(e).buffer},uint8array:function(e){return p2(e,new Uint8Array(e.length))},nodebuffer:function(e){return p2(e,v0.allocBuffer(e.length))}};Ih.array={string:U1,array:q1,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return v0.newBufferFrom(e)}};Ih.arraybuffer={string:function(e){return U1(new Uint8Array(e))},array:function(e){return g2(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:q1,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return v0.newBufferFrom(new Uint8Array(e))}};Ih.uint8array={string:U1,array:function(e){return g2(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:q1,nodebuffer:function(e){return v0.newBufferFrom(e)}};Ih.nodebuffer={string:U1,array:function(e){return g2(e,new Array(e.length))},arraybuffer:function(e){return Ih.nodebuffer.uint8array(e).buffer},uint8array:function(e){return g2(e,new Uint8Array(e.length))},nodebuffer:q1};Tn.transformTo=function(e,t){if(t||(t=""),!e)return t;Tn.checkSupport(e);var r=Tn.getTypeOf(t),i=Ih[r][e](t);return i};Tn.resolve=function(e){for(var t=e.split("/"),r=[],i=0;i<t.length;i++){var n=t[i];n==="."||n===""&&i!==0&&i!==t.length-1||(n===".."?r.pop():r.push(n))}return r.join("/")};Tn.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(Ch.nodebuffer&&v0.isBuffer(e))return"nodebuffer";if(Ch.uint8array&&e instanceof Uint8Array)return"uint8array";if(Ch.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};Tn.checkSupport=function(e){var t=Ch[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};Tn.MAX_VALUE_16BITS=65535;Tn.MAX_VALUE_32BITS=-1;Tn.pretty=function(e){var t="",r,i;for(i=0;i<(e||"").length;i++)r=e.charCodeAt(i),t+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return t};Tn.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})};Tn.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r};Tn.extend=function(){var e={},t,r;for(t=0;t<arguments.length;t++)for(r in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],r)&&typeof e[r]=="undefined"&&(e[r]=arguments[t][r]);return e};Tn.prepareContent=function(e,t,r,i,n){var a=nj.Promise.resolve(t).then(function(o){var s=Ch.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return s&&typeof FileReader!="undefined"?new nj.Promise(function(u,l){var c=new FileReader;c.onload=function(f){u(f.target.result)},c.onerror=function(f){l(f.target.error)},c.readAsArrayBuffer(o)}):o});return a.then(function(o){var s=Tn.getTypeOf(o);return s?(s==="arraybuffer"?o=Tn.transformTo("uint8array",o):s==="string"&&(n?o=dnt.decode(o):r&&i!==!0&&(o=pnt(o))),o):nj.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var Fo=T((WPt,Bfe)=>{"use strict";function Pfe(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Pfe.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.end()}),e.on("error",function(r){t.error(r)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)||(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};Bfe.exports=Pfe});var b0=T(Ph=>{"use strict";var y0=Li(),hp=Ic(),mnt=D1(),v2=Fo(),G1=new Array(256);for(Pc=0;Pc<256;Pc++)G1[Pc]=Pc>=252?6:Pc>=248?5:Pc>=240?4:Pc>=224?3:Pc>=192?2:1;var Pc;G1[254]=G1[254]=1;var gnt=function(e){var t,r,i,n,a,o=e.length,s=0;for(n=0;n<o;n++)r=e.charCodeAt(n),(r&64512)==55296&&n+1<o&&(i=e.charCodeAt(n+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(hp.uint8array?t=new Uint8Array(s):t=new Array(s),a=0,n=0;a<s;n++)r=e.charCodeAt(n),(r&64512)==55296&&n+1<o&&(i=e.charCodeAt(n+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t},vnt=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)==128;)r--;return r<0||r===0?t:r+G1[e[r]]>t?r:t},ynt=function(e){var t,r,i,n,a=e.length,o=new Array(a*2);for(r=0,t=0;t<a;){if(i=e[t++],i<128){o[r++]=i;continue}if(n=G1[i],n>4){o[r++]=65533,t+=n-1;continue}for(i&=n===2?31:n===3?15:7;n>1&&t<a;)i=i<<6|e[t++]&63,n--;if(n>1){o[r++]=65533;continue}i<65536?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|i&1023)}return o.length!==r&&(o.subarray?o=o.subarray(0,r):o.length=r),y0.applyFromCharCode(o)};Ph.utf8encode=function(t){return hp.nodebuffer?mnt.newBufferFrom(t,"utf-8"):gnt(t)};Ph.utf8decode=function(t){return hp.nodebuffer?y0.transformTo("nodebuffer",t).toString("utf-8"):(t=y0.transformTo(hp.uint8array?"uint8array":"array",t),ynt(t))};function y2(){v2.call(this,"utf-8 decode"),this.leftOver=null}y0.inherits(y2,v2);y2.prototype.processChunk=function(e){var t=y0.transformTo(hp.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(hp.uint8array){var r=t;t=new Uint8Array(r.length+this.leftOver.length),t.set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=vnt(t),n=t;i!==t.length&&(hp.uint8array?(n=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(n=t.slice(0,i),this.leftOver=t.slice(i,t.length))),this.push({data:Ph.utf8decode(n),meta:e.meta})};y2.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Ph.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};Ph.Utf8DecodeWorker=y2;function aj(){v2.call(this,"utf-8 encode")}y0.inherits(aj,v2);aj.prototype.processChunk=function(e){this.push({data:Ph.utf8encode(e.data),meta:e.meta})};Ph.Utf8EncodeWorker=aj});var Mfe=T((KPt,Dfe)=>{"use strict";var Ofe=Fo(),Ffe=Li();function oj(e){Ofe.call(this,"ConvertWorker to "+e),this.destType=e}Ffe.inherits(oj,Ofe);oj.prototype.processChunk=function(e){this.push({data:Ffe.transformTo(this.destType,e.data),meta:e.meta})};Dfe.exports=oj});var Nfe=T((YPt,jfe)=>{"use strict";var Lfe=Rb().Readable,bnt=Li();bnt.inherits(sj,Lfe);function sj(e,t,r){Lfe.call(this,t),this._helper=e;var i=this;e.on("data",function(n,a){i.push(n)||i._helper.pause(),r&&r(a)}).on("error",function(n){i.emit("error",n)}).on("end",function(){i.push(null)})}sj.prototype._read=function(){this._helper.resume()};jfe.exports=sj});var uj=T((XPt,Gfe)=>{"use strict";var dp=Li(),_nt=Mfe(),xnt=Fo(),wnt=$L(),Ent=Ic(),Snt=g0(),qfe=null;if(Ent.nodestream)try{qfe=Nfe()}catch{}function Tnt(e,t,r){switch(e){case"blob":return dp.newBlob(dp.transformTo("arraybuffer",t),r);case"base64":return wnt.encode(t);default:return dp.transformTo(e,t)}}function Ant(e,t){var r,i=0,n=null,a=0;for(r=0;r<t.length;r++)a+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(a),r=0;r<t.length;r++)n.set(t[r],i),i+=t[r].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function knt(e,t){return new Snt.Promise(function(r,i){var n=[],a=e._internalType,o=e._outputType,s=e._mimeType;e.on("data",function(u,l){n.push(u),t&&t(l)}).on("error",function(u){n=[],i(u)}).on("end",function(){try{var u=Tnt(o,Ant(a,n),s);r(u)}catch(l){i(l)}n=[]}).resume()})}function Ufe(e,t,r){var i=t;switch(t){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string";break}try{this._internalType=i,this._outputType=t,this._mimeType=r,dp.checkSupport(i),this._worker=e.pipe(new _nt(i)),e.lock()}catch(n){this._worker=new xnt("error"),this._worker.error(n)}}Ufe.prototype={accumulate:function(e){return knt(this,e)},on:function(e,t){var r=this;return e==="data"?this._worker.on(e,function(i){t.call(r,i.data,i.meta)}):this._worker.on(e,function(){dp.delay(t,arguments,r)}),this},resume:function(){return dp.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(dp.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new qfe(this,{objectMode:this._outputType!=="nodebuffer"},e)}};Gfe.exports=Ufe});var lj=T(fu=>{"use strict";fu.base64=!1;fu.binary=!1;fu.dir=!1;fu.createFolders=!0;fu.date=null;fu.compression=null;fu.compressionOptions=null;fu.comment=null;fu.unixPermissions=null;fu.dosPermissions=null});var cj=T((JPt,zfe)=>{"use strict";var b2=Li(),_2=Fo(),Rnt=16*1024;function _0(e){_2.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(r){t.dataIsReady=!0,t.data=r,t.max=r&&r.length||0,t.type=b2.getTypeOf(r),t.isPaused||t._tickAndRepeat()},function(r){t.error(r)})}b2.inherits(_0,_2);_0.prototype.cleanUp=function(){_2.prototype.cleanUp.call(this),this.data=null};_0.prototype.resume=function(){return _2.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,b2.delay(this._tickAndRepeat,[],this)),!0):!1};_0.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(b2.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};_0.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Rnt,t=null,r=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,r);break;case"uint8array":t=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":t=this.data.slice(this.index,r);break}return this.index=r,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};zfe.exports=_0});var x2=T((QPt,Wfe)=>{"use strict";var Cnt=Li();function Int(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var Hfe=Int();function Pnt(e,t,r,i){var n=Hfe,a=i+r;e=e^-1;for(var o=i;o<a;o++)e=e>>>8^n[(e^t[o])&255];return e^-1}function Bnt(e,t,r,i){var n=Hfe,a=i+r;e=e^-1;for(var o=i;o<a;o++)e=e>>>8^n[(e^t.charCodeAt(o))&255];return e^-1}Wfe.exports=function(t,r){if(typeof t=="undefined"||!t.length)return 0;var i=Cnt.getTypeOf(t)!=="string";return i?Pnt(r|0,t,t.length,0):Bnt(r|0,t,t.length,0)}});var hj=T((ZPt,Kfe)=>{"use strict";var Vfe=Fo(),Ont=x2(),Fnt=Li();function fj(){Vfe.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Fnt.inherits(fj,Vfe);fj.prototype.processChunk=function(e){this.streamInfo.crc32=Ont(e.data,this.streamInfo.crc32||0),this.push(e)};Kfe.exports=fj});var Xfe=T((eBt,Yfe)=>{"use strict";var Dnt=Li(),dj=Fo();function pj(e){dj.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Dnt.inherits(pj,dj);pj.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}dj.prototype.processChunk.call(this,e)};Yfe.exports=pj});var w2=T((tBt,Qfe)=>{"use strict";var $fe=g0(),Jfe=cj(),Mnt=hj(),mj=Xfe();function gj(e,t,r,i,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=n}gj.prototype={getContentWorker:function(){var e=new Jfe($fe.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new mj("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new Jfe($fe.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};gj.createWorkerFrom=function(e,t,r){return e.pipe(new Mnt).pipe(new mj("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new mj("compressedSize")).withStreamInfo("compression",t)};Qfe.exports=gj});var rhe=T((rBt,the)=>{"use strict";var Lnt=uj(),jnt=cj(),vj=b0(),yj=w2(),Zfe=Fo(),bj=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};bj.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");r=e.toLowerCase();var i=r==="string"||r==="text";(r==="binarystring"||r==="text")&&(r="string"),t=this._decompressWorker();var n=!this._dataBinary;n&&!i&&(t=t.pipe(new vj.Utf8EncodeWorker)),!n&&i&&(t=t.pipe(new vj.Utf8DecodeWorker))}catch(a){t=new Zfe("error"),t.error(a)}return new Lnt(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof yj&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new vj.Utf8EncodeWorker)),yj.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof yj?this._data.getContentWorker():this._data instanceof Zfe?this._data:new jnt(this._data)}};var ehe=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],Nnt=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(E2=0;E2<ehe.length;E2++)bj.prototype[ehe[E2]]=Nnt;var E2;the.exports=bj});var Bc=T(Ya=>{"use strict";var qnt=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function Unt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Ya.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(!!r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)Unt(r,i)&&(e[i]=r[i])}}return e};Ya.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Gnt={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+i),n);return}for(var a=0;a<i;a++)e[n+a]=t[r+a]},flattenChunks:function(e){var t,r,i,n,a,o;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(o=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)a=e[t],o.set(a,n),n+=a.length;return o}},znt={arraySet:function(e,t,r,i,n){for(var a=0;a<i;a++)e[n+a]=t[r+a]},flattenChunks:function(e){return[].concat.apply([],e)}};Ya.setTyped=function(e){e?(Ya.Buf8=Uint8Array,Ya.Buf16=Uint16Array,Ya.Buf32=Int32Array,Ya.assign(Ya,Gnt)):(Ya.Buf8=Array,Ya.Buf16=Array,Ya.Buf32=Array,Ya.assign(Ya,znt))};Ya.setTyped(qnt)});var The=T(E0=>{"use strict";var Hnt=Bc(),Wnt=4,ihe=0,nhe=1,Vnt=2;function x0(e){for(var t=e.length;--t>=0;)e[t]=0}var Knt=0,ahe=1,Ynt=2,Xnt=3,$nt=258,_j=29,z1=256,H1=z1+1+_j,w0=30,xj=19,ohe=2*H1+1,pp=15,wj=16,Jnt=7,Ej=256,she=16,uhe=17,lhe=18,Sj=[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],S2=[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],Qnt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],che=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Znt=512,Oc=new Array((H1+2)*2);x0(Oc);var W1=new Array(w0*2);x0(W1);var V1=new Array(Znt);x0(V1);var K1=new Array($nt-Xnt+1);x0(K1);var Tj=new Array(_j);x0(Tj);var T2=new Array(w0);x0(T2);function Aj(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}var fhe,hhe,dhe;function kj(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function phe(e){return e<256?V1[e]:V1[256+(e>>>7)]}function Y1(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function lo(e,t,r){e.bi_valid>wj-r?(e.bi_buf|=t<<e.bi_valid&65535,Y1(e,e.bi_buf),e.bi_buf=t>>wj-e.bi_valid,e.bi_valid+=r-wj):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function vl(e,t,r){lo(e,r[t*2],r[t*2+1])}function mhe(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function eat(e){e.bi_valid===16?(Y1(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function tat(e,t){var r=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,u=t.stat_desc.max_length,l,c,f,h,d,p,y=0;for(h=0;h<=pp;h++)e.bl_count[h]=0;for(r[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<ohe;l++)c=e.heap[l],h=r[r[c*2+1]*2+1]+1,h>u&&(h=u,y++),r[c*2+1]=h,!(c>i)&&(e.bl_count[h]++,d=0,c>=s&&(d=o[c-s]),p=r[c*2],e.opt_len+=p*(h+d),a&&(e.static_len+=p*(n[c*2+1]+d)));if(y!==0){do{for(h=u-1;e.bl_count[h]===0;)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[u]--,y-=2}while(y>0);for(h=u;h!==0;h--)for(c=e.bl_count[h];c!==0;)f=e.heap[--l],!(f>i)&&(r[f*2+1]!==h&&(e.opt_len+=(h-r[f*2+1])*r[f*2],r[f*2+1]=h),c--)}}function ghe(e,t,r){var i=new Array(pp+1),n=0,a,o;for(a=1;a<=pp;a++)i[a]=n=n+r[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=mhe(i[s]++,s))}}function rat(){var e,t,r,i,n,a=new Array(pp+1);for(r=0,i=0;i<_j-1;i++)for(Tj[i]=r,e=0;e<1<<Sj[i];e++)K1[r++]=i;for(K1[r-1]=i,n=0,i=0;i<16;i++)for(T2[i]=n,e=0;e<1<<S2[i];e++)V1[n++]=i;for(n>>=7;i<w0;i++)for(T2[i]=n<<7,e=0;e<1<<S2[i]-7;e++)V1[256+n++]=i;for(t=0;t<=pp;t++)a[t]=0;for(e=0;e<=143;)Oc[e*2+1]=8,e++,a[8]++;for(;e<=255;)Oc[e*2+1]=9,e++,a[9]++;for(;e<=279;)Oc[e*2+1]=7,e++,a[7]++;for(;e<=287;)Oc[e*2+1]=8,e++,a[8]++;for(ghe(Oc,H1+1,a),e=0;e<w0;e++)W1[e*2+1]=5,W1[e*2]=mhe(e,5);fhe=new Aj(Oc,Sj,z1+1,H1,pp),hhe=new Aj(W1,S2,0,w0,pp),dhe=new Aj(new Array(0),Qnt,0,xj,Jnt)}function vhe(e){var t;for(t=0;t<H1;t++)e.dyn_ltree[t*2]=0;for(t=0;t<w0;t++)e.dyn_dtree[t*2]=0;for(t=0;t<xj;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Ej*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function yhe(e){e.bi_valid>8?Y1(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function iat(e,t,r,i){yhe(e),i&&(Y1(e,r),Y1(e,~r)),Hnt.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function bhe(e,t,r,i){var n=t*2,a=r*2;return e[n]<e[a]||e[n]===e[a]&&i[t]<=i[r]}function Rj(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&bhe(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!bhe(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function _he(e,t,r){var i,n,a=0,o,s;if(e.last_lit!==0)do i=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],n=e.pending_buf[e.l_buf+a],a++,i===0?vl(e,n,t):(o=K1[n],vl(e,o+z1+1,t),s=Sj[o],s!==0&&(n-=Tj[o],lo(e,n,s)),i--,o=phe(i),vl(e,o,r),s=S2[o],s!==0&&(i-=T2[o],lo(e,i,s)));while(a<e.last_lit);vl(e,Ej,t)}function Cj(e,t){var r=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,u=-1,l;for(e.heap_len=0,e.heap_max=ohe,o=0;o<a;o++)r[o*2]!==0?(e.heap[++e.heap_len]=u=o,e.depth[o]=0):r[o*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=u<2?++u:0,r[l*2]=1,e.depth[l]=0,e.opt_len--,n&&(e.static_len-=i[l*2+1]);for(t.max_code=u,o=e.heap_len>>1;o>=1;o--)Rj(e,r,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Rj(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,r[l*2]=r[o*2]+r[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,r[o*2+1]=r[s*2+1]=l,e.heap[1]=l++,Rj(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],tat(e,t),ghe(r,u,e.bl_count)}function xhe(e,t,r){var i,n=-1,a,o=t[0*2+1],s=0,u=7,l=4;for(o===0&&(u=138,l=3),t[(r+1)*2+1]=65535,i=0;i<=r;i++)a=o,o=t[(i+1)*2+1],!(++s<u&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a!==0?(a!==n&&e.bl_tree[a*2]++,e.bl_tree[she*2]++):s<=10?e.bl_tree[uhe*2]++:e.bl_tree[lhe*2]++,s=0,n=a,o===0?(u=138,l=3):a===o?(u=6,l=3):(u=7,l=4))}function whe(e,t,r){var i,n=-1,a,o=t[0*2+1],s=0,u=7,l=4;for(o===0&&(u=138,l=3),i=0;i<=r;i++)if(a=o,o=t[(i+1)*2+1],!(++s<u&&a===o)){if(s<l)do vl(e,a,e.bl_tree);while(--s!=0);else a!==0?(a!==n&&(vl(e,a,e.bl_tree),s--),vl(e,she,e.bl_tree),lo(e,s-3,2)):s<=10?(vl(e,uhe,e.bl_tree),lo(e,s-3,3)):(vl(e,lhe,e.bl_tree),lo(e,s-11,7));s=0,n=a,o===0?(u=138,l=3):a===o?(u=6,l=3):(u=7,l=4)}}function nat(e){var t;for(xhe(e,e.dyn_ltree,e.l_desc.max_code),xhe(e,e.dyn_dtree,e.d_desc.max_code),Cj(e,e.bl_desc),t=xj-1;t>=3&&e.bl_tree[che[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function aat(e,t,r,i){var n;for(lo(e,t-257,5),lo(e,r-1,5),lo(e,i-4,4),n=0;n<i;n++)lo(e,e.bl_tree[che[n]*2+1],3);whe(e,e.dyn_ltree,t-1),whe(e,e.dyn_dtree,r-1)}function oat(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return ihe;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return nhe;for(r=32;r<z1;r++)if(e.dyn_ltree[r*2]!==0)return nhe;return ihe}var Ehe=!1;function sat(e){Ehe||(rat(),Ehe=!0),e.l_desc=new kj(e.dyn_ltree,fhe),e.d_desc=new kj(e.dyn_dtree,hhe),e.bl_desc=new kj(e.bl_tree,dhe),e.bi_buf=0,e.bi_valid=0,vhe(e)}function She(e,t,r,i){lo(e,(Knt<<1)+(i?1:0),3),iat(e,t,r,!0)}function uat(e){lo(e,ahe<<1,3),vl(e,Ej,Oc),eat(e)}function lat(e,t,r,i){var n,a,o=0;e.level>0?(e.strm.data_type===Vnt&&(e.strm.data_type=oat(e)),Cj(e,e.l_desc),Cj(e,e.d_desc),o=nat(e),n=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=n&&(n=a)):n=a=r+5,r+4<=n&&t!==-1?She(e,t,r,i):e.strategy===Wnt||a===n?(lo(e,(ahe<<1)+(i?1:0),3),_he(e,Oc,W1)):(lo(e,(Ynt<<1)+(i?1:0),3),aat(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),_he(e,e.dyn_ltree,e.dyn_dtree)),vhe(e),i&&yhe(e)}function cat(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(K1[r]+z1+1)*2]++,e.dyn_dtree[phe(t)*2]++),e.last_lit===e.lit_bufsize-1}E0._tr_init=sat;E0._tr_stored_block=She;E0._tr_flush_block=lat;E0._tr_tally=cat;E0._tr_align=uat});var Ij=T((aBt,Ahe)=>{"use strict";function fat(e,t,r,i){for(var n=e&65535|0,a=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do n=n+t[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0}Ahe.exports=fat});var Pj=T((oBt,khe)=>{"use strict";function hat(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var dat=hat();function pat(e,t,r,i){var n=dat,a=i+r;e^=-1;for(var o=i;o<a;o++)e=e>>>8^n[(e^t[o])&255];return e^-1}khe.exports=pat});var A2=T((sBt,Rhe)=>{"use strict";Rhe.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Lhe=T(_l=>{"use strict";var Xa=Bc(),Ss=The(),Che=Ij(),Bh=Pj(),mat=A2(),mp=0,gat=1,vat=3,Oh=4,Ihe=5,yl=0,Phe=1,Ts=-2,yat=-3,Bj=-5,bat=-1,_at=1,k2=2,xat=3,wat=4,Eat=0,Sat=2,R2=8,Tat=9,Aat=15,kat=8,Rat=29,Cat=256,Oj=Cat+1+Rat,Iat=30,Pat=19,Bat=2*Oj+1,Oat=15,Pr=3,Fh=258,hu=Fh+Pr+1,Fat=32,C2=42,Fj=69,I2=73,P2=91,B2=103,gp=113,X1=666,qn=1,$1=2,vp=3,S0=4,Dat=3;function Dh(e,t){return e.msg=mat[t],t}function Bhe(e){return(e<<1)-(e>4?9:0)}function Mh(e){for(var t=e.length;--t>=0;)e[t]=0}function Lh(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(Xa.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function ma(e,t){Ss._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Lh(e.strm)}function Yr(e,t){e.pending_buf[e.pending++]=t}function J1(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Mat(e,t,r,i){var n=e.avail_in;return n>i&&(n=i),n===0?0:(e.avail_in-=n,Xa.arraySet(t,e.input,e.next_in,n,r),e.state.wrap===1?e.adler=Che(e.adler,t,n,r):e.state.wrap===2&&(e.adler=Bh(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)}function Ohe(e,t){var r=e.max_chain_length,i=e.strstart,n,a,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-hu?e.strstart-(e.w_size-hu):0,l=e.window,c=e.w_mask,f=e.prev,h=e.strstart+Fh,d=l[i+o-1],p=l[i+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(n=t,!(l[n+o]!==p||l[n+o-1]!==d||l[n]!==l[i]||l[++n]!==l[i+1])){i+=2,n++;do;while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&i<h);if(a=Fh-(h-i),i=h-Fh,a>o){if(e.match_start=t,o=a,a>=s)break;d=l[i+o-1],p=l[i+o]}}while((t=f[t&c])>u&&--r!=0);return o<=e.lookahead?o:e.lookahead}function yp(e){var t=e.w_size,r,i,n,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-hu)){Xa.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,i=e.hash_size,r=i;do n=e.head[--r],e.head[r]=n>=t?n-t:0;while(--i);i=t,r=i;do n=e.prev[--r],e.prev[r]=n>=t?n-t:0;while(--i);a+=t}if(e.strm.avail_in===0)break;if(i=Mat(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=i,e.lookahead+e.insert>=Pr)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+Pr-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<Pr)););}while(e.lookahead<hu&&e.strm.avail_in!==0)}function Lat(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(yp(e),e.lookahead===0&&t===mp)return qn;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((e.strstart===0||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,ma(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-hu&&(ma(e,!1),e.strm.avail_out===0))return qn}return e.insert=0,t===Oh?(ma(e,!0),e.strm.avail_out===0?vp:S0):(e.strstart>e.block_start&&(ma(e,!1),e.strm.avail_out===0),qn)}function Dj(e,t){for(var r,i;;){if(e.lookahead<hu){if(yp(e),e.lookahead<hu&&t===mp)return qn;if(e.lookahead===0)break}if(r=0,e.lookahead>=Pr&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Pr-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-hu&&(e.match_length=Ohe(e,r)),e.match_length>=Pr)if(i=Ss._tr_tally(e,e.strstart-e.match_start,e.match_length-Pr),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Pr){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Pr-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=Ss._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(ma(e,!1),e.strm.avail_out===0))return qn}return e.insert=e.strstart<Pr-1?e.strstart:Pr-1,t===Oh?(ma(e,!0),e.strm.avail_out===0?vp:S0):e.last_lit&&(ma(e,!1),e.strm.avail_out===0)?qn:$1}function T0(e,t){for(var r,i,n;;){if(e.lookahead<hu){if(yp(e),e.lookahead<hu&&t===mp)return qn;if(e.lookahead===0)break}if(r=0,e.lookahead>=Pr&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Pr-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Pr-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-hu&&(e.match_length=Ohe(e,r),e.match_length<=5&&(e.strategy===_at||e.match_length===Pr&&e.strstart-e.match_start>4096)&&(e.match_length=Pr-1)),e.prev_length>=Pr&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-Pr,i=Ss._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-Pr),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Pr-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=Pr-1,e.strstart++,i&&(ma(e,!1),e.strm.avail_out===0))return qn}else if(e.match_available){if(i=Ss._tr_tally(e,0,e.window[e.strstart-1]),i&&ma(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return qn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Ss._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Pr-1?e.strstart:Pr-1,t===Oh?(ma(e,!0),e.strm.avail_out===0?vp:S0):e.last_lit&&(ma(e,!1),e.strm.avail_out===0)?qn:$1}function jat(e,t){for(var r,i,n,a,o=e.window;;){if(e.lookahead<=Fh){if(yp(e),e.lookahead<=Fh&&t===mp)return qn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Pr&&e.strstart>0&&(n=e.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=e.strstart+Fh;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);e.match_length=Fh-(a-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Pr?(r=Ss._tr_tally(e,1,e.match_length-Pr),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Ss._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(ma(e,!1),e.strm.avail_out===0))return qn}return e.insert=0,t===Oh?(ma(e,!0),e.strm.avail_out===0?vp:S0):e.last_lit&&(ma(e,!1),e.strm.avail_out===0)?qn:$1}function Nat(e,t){for(var r;;){if(e.lookahead===0&&(yp(e),e.lookahead===0)){if(t===mp)return qn;break}if(e.match_length=0,r=Ss._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(ma(e,!1),e.strm.avail_out===0))return qn}return e.insert=0,t===Oh?(ma(e,!0),e.strm.avail_out===0?vp:S0):e.last_lit&&(ma(e,!1),e.strm.avail_out===0)?qn:$1}function bl(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}var A0;A0=[new bl(0,0,0,0,Lat),new bl(4,4,8,4,Dj),new bl(4,5,16,8,Dj),new bl(4,6,32,32,Dj),new bl(4,4,16,16,T0),new bl(8,16,32,32,T0),new bl(8,16,128,128,T0),new bl(8,32,128,256,T0),new bl(32,128,258,1024,T0),new bl(32,258,258,4096,T0)];function qat(e){e.window_size=2*e.w_size,Mh(e.head),e.max_lazy_match=A0[e.level].max_lazy,e.good_match=A0[e.level].good_length,e.nice_match=A0[e.level].nice_length,e.max_chain_length=A0[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Pr-1,e.match_available=0,e.ins_h=0}function Uat(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=R2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Xa.Buf16(Bat*2),this.dyn_dtree=new Xa.Buf16((2*Iat+1)*2),this.bl_tree=new Xa.Buf16((2*Pat+1)*2),Mh(this.dyn_ltree),Mh(this.dyn_dtree),Mh(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Xa.Buf16(Oat+1),this.heap=new Xa.Buf16(2*Oj+1),Mh(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xa.Buf16(2*Oj+1),Mh(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Fhe(e){var t;return!e||!e.state?Dh(e,Ts):(e.total_in=e.total_out=0,e.data_type=Sat,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?C2:gp,e.adler=t.wrap===2?0:1,t.last_flush=mp,Ss._tr_init(t),yl)}function Dhe(e){var t=Fhe(e);return t===yl&&qat(e.state),t}function Gat(e,t){return!e||!e.state||e.state.wrap!==2?Ts:(e.state.gzhead=t,yl)}function Mhe(e,t,r,i,n,a){if(!e)return Ts;var o=1;if(t===bat&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>Tat||r!==R2||i<8||i>15||t<0||t>9||a<0||a>wat)return Dh(e,Ts);i===8&&(i=9);var s=new Uat;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+Pr-1)/Pr),s.window=new Xa.Buf8(s.w_size*2),s.head=new Xa.Buf16(s.hash_size),s.prev=new Xa.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Xa.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=(1+2)*s.lit_bufsize,s.level=t,s.strategy=a,s.method=r,Dhe(e)}function zat(e,t){return Mhe(e,t,R2,Aat,kat,Eat)}function Hat(e,t){var r,i,n,a;if(!e||!e.state||t>Ihe||t<0)return e?Dh(e,Ts):Ts;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===X1&&t!==Oh)return Dh(e,e.avail_out===0?Bj:Ts);if(i.strm=e,r=i.last_flush,i.last_flush=t,i.status===C2)if(i.wrap===2)e.adler=0,Yr(i,31),Yr(i,139),Yr(i,8),i.gzhead?(Yr(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Yr(i,i.gzhead.time&255),Yr(i,i.gzhead.time>>8&255),Yr(i,i.gzhead.time>>16&255),Yr(i,i.gzhead.time>>24&255),Yr(i,i.level===9?2:i.strategy>=k2||i.level<2?4:0),Yr(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Yr(i,i.gzhead.extra.length&255),Yr(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Bh(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Fj):(Yr(i,0),Yr(i,0),Yr(i,0),Yr(i,0),Yr(i,0),Yr(i,i.level===9?2:i.strategy>=k2||i.level<2?4:0),Yr(i,Dat),i.status=gp);else{var o=R2+(i.w_bits-8<<4)<<8,s=-1;i.strategy>=k2||i.level<2?s=0:i.level<6?s=1:i.level===6?s=2:s=3,o|=s<<6,i.strstart!==0&&(o|=Fat),o+=31-o%31,i.status=gp,J1(i,o),i.strstart!==0&&(J1(i,e.adler>>>16),J1(i,e.adler&65535)),e.adler=1}if(i.status===Fj)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=Bh(e.adler,i.pending_buf,i.pending-n,n)),Lh(e),n=i.pending,i.pending===i.pending_buf_size));)Yr(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(e.adler=Bh(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=I2)}else i.status=I2;if(i.status===I2)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=Bh(e.adler,i.pending_buf,i.pending-n,n)),Lh(e),n=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.name.length?a=i.gzhead.name.charCodeAt(i.gzindex++)&255:a=0,Yr(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>n&&(e.adler=Bh(e.adler,i.pending_buf,i.pending-n,n)),a===0&&(i.gzindex=0,i.status=P2)}else i.status=P2;if(i.status===P2)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=Bh(e.adler,i.pending_buf,i.pending-n,n)),Lh(e),n=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.comment.length?a=i.gzhead.comment.charCodeAt(i.gzindex++)&255:a=0,Yr(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>n&&(e.adler=Bh(e.adler,i.pending_buf,i.pending-n,n)),a===0&&(i.status=B2)}else i.status=B2;if(i.status===B2&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&Lh(e),i.pending+2<=i.pending_buf_size&&(Yr(i,e.adler&255),Yr(i,e.adler>>8&255),e.adler=0,i.status=gp)):i.status=gp),i.pending!==0){if(Lh(e),e.avail_out===0)return i.last_flush=-1,yl}else if(e.avail_in===0&&Bhe(t)<=Bhe(r)&&t!==Oh)return Dh(e,Bj);if(i.status===X1&&e.avail_in!==0)return Dh(e,Bj);if(e.avail_in!==0||i.lookahead!==0||t!==mp&&i.status!==X1){var u=i.strategy===k2?Nat(i,t):i.strategy===xat?jat(i,t):A0[i.level].func(i,t);if((u===vp||u===S0)&&(i.status=X1),u===qn||u===vp)return e.avail_out===0&&(i.last_flush=-1),yl;if(u===$1&&(t===gat?Ss._tr_align(i):t!==Ihe&&(Ss._tr_stored_block(i,0,0,!1),t===vat&&(Mh(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),Lh(e),e.avail_out===0))return i.last_flush=-1,yl}return t!==Oh?yl:i.wrap<=0?Phe:(i.wrap===2?(Yr(i,e.adler&255),Yr(i,e.adler>>8&255),Yr(i,e.adler>>16&255),Yr(i,e.adler>>24&255),Yr(i,e.total_in&255),Yr(i,e.total_in>>8&255),Yr(i,e.total_in>>16&255),Yr(i,e.total_in>>24&255)):(J1(i,e.adler>>>16),J1(i,e.adler&65535)),Lh(e),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?yl:Phe)}function Wat(e){var t;return!e||!e.state?Ts:(t=e.state.status,t!==C2&&t!==Fj&&t!==I2&&t!==P2&&t!==B2&&t!==gp&&t!==X1?Dh(e,Ts):(e.state=null,t===gp?Dh(e,yat):yl))}function Vat(e,t){var r=t.length,i,n,a,o,s,u,l,c;if(!e||!e.state||(i=e.state,o=i.wrap,o===2||o===1&&i.status!==C2||i.lookahead))return Ts;for(o===1&&(e.adler=Che(e.adler,t,r,0)),i.wrap=0,r>=i.w_size&&(o===0&&(Mh(i.head),i.strstart=0,i.block_start=0,i.insert=0),c=new Xa.Buf8(i.w_size),Xa.arraySet(c,t,r-i.w_size,i.w_size,0),t=c,r=i.w_size),s=e.avail_in,u=e.next_in,l=e.input,e.avail_in=r,e.next_in=0,e.input=t,yp(i);i.lookahead>=Pr;){n=i.strstart,a=i.lookahead-(Pr-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+Pr-1])&i.hash_mask,i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++;while(--a);i.strstart=n,i.lookahead=Pr-1,yp(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Pr-1,i.match_available=0,e.next_in=u,e.input=l,e.avail_in=s,i.wrap=o,yl}_l.deflateInit=zat;_l.deflateInit2=Mhe;_l.deflateReset=Dhe;_l.deflateResetKeep=Fhe;_l.deflateSetHeader=Gat;_l.deflate=Hat;_l.deflateEnd=Wat;_l.deflateSetDictionary=Vat;_l.deflateInfo="pako deflate (from Nodeca project)"});var Mj=T(k0=>{"use strict";var O2=Bc(),jhe=!0,Nhe=!0;try{String.fromCharCode.apply(null,[0])}catch{jhe=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Nhe=!1}var Q1=new O2.Buf8(256);for(Fc=0;Fc<256;Fc++)Q1[Fc]=Fc>=252?6:Fc>=248?5:Fc>=240?4:Fc>=224?3:Fc>=192?2:1;var Fc;Q1[254]=Q1[254]=1;k0.string2buf=function(e){var t,r,i,n,a,o=e.length,s=0;for(n=0;n<o;n++)r=e.charCodeAt(n),(r&64512)==55296&&n+1<o&&(i=e.charCodeAt(n+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new O2.Buf8(s),a=0,n=0;a<s;n++)r=e.charCodeAt(n),(r&64512)==55296&&n+1<o&&(i=e.charCodeAt(n+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};function qhe(e,t){if(t<65534&&(e.subarray&&Nhe||!e.subarray&&jhe))return String.fromCharCode.apply(null,O2.shrinkBuf(e,t));for(var r="",i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r}k0.buf2binstring=function(e){return qhe(e,e.length)};k0.binstring2buf=function(e){for(var t=new O2.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t};k0.buf2string=function(e,t){var r,i,n,a,o=t||e.length,s=new Array(o*2);for(i=0,r=0;r<o;){if(n=e[r++],n<128){s[i++]=n;continue}if(a=Q1[n],a>4){s[i++]=65533,r+=a-1;continue}for(n&=a===2?31:a===3?15:7;a>1&&r<o;)n=n<<6|e[r++]&63,a--;if(a>1){s[i++]=65533;continue}n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|n&1023)}return qhe(s,i)};k0.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)==128;)r--;return r<0||r===0?t:r+Q1[e[r]]>t?r:t}});var Lj=T((cBt,Uhe)=>{"use strict";function Kat(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Uhe.exports=Kat});var Whe=T(t_=>{"use strict";var Z1=Lhe(),e_=Bc(),jj=Mj(),Nj=A2(),Yat=Lj(),Ghe=Object.prototype.toString,Xat=0,qj=4,R0=0,zhe=1,Hhe=2,$at=-1,Jat=0,Qat=8;function bp(e){if(!(this instanceof bp))return new bp(e);this.options=e_.assign({level:$at,method:Qat,chunkSize:16384,windowBits:15,memLevel:8,strategy:Jat,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Yat,this.strm.avail_out=0;var r=Z1.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==R0)throw new Error(Nj[r]);if(t.header&&Z1.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(typeof t.dictionary=="string"?i=jj.string2buf(t.dictionary):Ghe.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,r=Z1.deflateSetDictionary(this.strm,i),r!==R0)throw new Error(Nj[r]);this._dict_set=!0}}bp.prototype.push=function(e,t){var r=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;a=t===~~t?t:t===!0?qj:Xat,typeof e=="string"?r.input=jj.string2buf(e):Ghe.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new e_.Buf8(i),r.next_out=0,r.avail_out=i),n=Z1.deflate(r,a),n!==zhe&&n!==R0)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===qj||a===Hhe))&&(this.options.to==="string"?this.onData(jj.buf2binstring(e_.shrinkBuf(r.output,r.next_out))):this.onData(e_.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==zhe);return a===qj?(n=Z1.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===R0):(a===Hhe&&(this.onEnd(R0),r.avail_out=0),!0)};bp.prototype.onData=function(e){this.chunks.push(e)};bp.prototype.onEnd=function(e){e===R0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e_.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Uj(e,t){var r=new bp(t);if(r.push(e,!0),r.err)throw r.msg||Nj[r.err];return r.result}function Zat(e,t){return t=t||{},t.raw=!0,Uj(e,t)}function eot(e,t){return t=t||{},t.gzip=!0,Uj(e,t)}t_.Deflate=bp;t_.deflate=Uj;t_.deflateRaw=Zat;t_.gzip=eot});var Khe=T((hBt,Vhe)=>{"use strict";var F2=30,tot=12;Vhe.exports=function(t,r){var i,n,a,o,s,u,l,c,f,h,d,p,y,g,b,E,A,k,R,F,C,j,O,W,N;i=t.state,n=t.next_in,W=t.input,a=n+(t.avail_in-5),o=t.next_out,N=t.output,s=o-(r-t.avail_out),u=o+(t.avail_out-257),l=i.dmax,c=i.wsize,f=i.whave,h=i.wnext,d=i.window,p=i.hold,y=i.bits,g=i.lencode,b=i.distcode,E=(1<<i.lenbits)-1,A=(1<<i.distbits)-1;e:do{y<15&&(p+=W[n++]<<y,y+=8,p+=W[n++]<<y,y+=8),k=g[p&E];t:for(;;){if(R=k>>>24,p>>>=R,y-=R,R=k>>>16&255,R===0)N[o++]=k&65535;else if(R&16){F=k&65535,R&=15,R&&(y<R&&(p+=W[n++]<<y,y+=8),F+=p&(1<<R)-1,p>>>=R,y-=R),y<15&&(p+=W[n++]<<y,y+=8,p+=W[n++]<<y,y+=8),k=b[p&A];r:for(;;){if(R=k>>>24,p>>>=R,y-=R,R=k>>>16&255,R&16){if(C=k&65535,R&=15,y<R&&(p+=W[n++]<<y,y+=8,y<R&&(p+=W[n++]<<y,y+=8)),C+=p&(1<<R)-1,C>l){t.msg="invalid distance too far back",i.mode=F2;break e}if(p>>>=R,y-=R,R=o-s,C>R){if(R=C-R,R>f&&i.sane){t.msg="invalid distance too far back",i.mode=F2;break e}if(j=0,O=d,h===0){if(j+=c-R,R<F){F-=R;do N[o++]=d[j++];while(--R);j=o-C,O=N}}else if(h<R){if(j+=c+h-R,R-=h,R<F){F-=R;do N[o++]=d[j++];while(--R);if(j=0,h<F){R=h,F-=R;do N[o++]=d[j++];while(--R);j=o-C,O=N}}}else if(j+=h-R,R<F){F-=R;do N[o++]=d[j++];while(--R);j=o-C,O=N}for(;F>2;)N[o++]=O[j++],N[o++]=O[j++],N[o++]=O[j++],F-=3;F&&(N[o++]=O[j++],F>1&&(N[o++]=O[j++]))}else{j=o-C;do N[o++]=N[j++],N[o++]=N[j++],N[o++]=N[j++],F-=3;while(F>2);F&&(N[o++]=N[j++],F>1&&(N[o++]=N[j++]))}}else if((R&64)==0){k=b[(k&65535)+(p&(1<<R)-1)];continue r}else{t.msg="invalid distance code",i.mode=F2;break e}break}}else if((R&64)==0){k=g[(k&65535)+(p&(1<<R)-1)];continue t}else if(R&32){i.mode=tot;break e}else{t.msg="invalid literal/length code",i.mode=F2;break e}break}}while(n<a&&o<u);F=y>>3,n-=F,y-=F<<3,p&=(1<<y)-1,t.next_in=n,t.next_out=o,t.avail_in=n<a?5+(a-n):5-(n-a),t.avail_out=o<u?257+(u-o):257-(o-u),i.hold=p,i.bits=y}});var ede=T((dBt,Zhe)=>{"use strict";var Yhe=Bc(),C0=15,Xhe=852,$he=592,Jhe=0,Gj=1,Qhe=2,rot=[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],iot=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],not=[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,0,0],aot=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Zhe.exports=function(t,r,i,n,a,o,s,u){var l=u.bits,c=0,f=0,h=0,d=0,p=0,y=0,g=0,b=0,E=0,A=0,k,R,F,C,j,O=null,W=0,N,H=new Yhe.Buf16(C0+1),L=new Yhe.Buf16(C0+1),z=null,X=0,te,ie,ae;for(c=0;c<=C0;c++)H[c]=0;for(f=0;f<n;f++)H[r[i+f]]++;for(p=l,d=C0;d>=1&&H[d]===0;d--);if(p>d&&(p=d),d===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,u.bits=1,0;for(h=1;h<d&&H[h]===0;h++);for(p<h&&(p=h),b=1,c=1;c<=C0;c++)if(b<<=1,b-=H[c],b<0)return-1;if(b>0&&(t===Jhe||d!==1))return-1;for(L[1]=0,c=1;c<C0;c++)L[c+1]=L[c]+H[c];for(f=0;f<n;f++)r[i+f]!==0&&(s[L[r[i+f]]++]=f);if(t===Jhe?(O=z=s,N=19):t===Gj?(O=rot,W-=257,z=iot,X-=257,N=256):(O=not,z=aot,N=-1),A=0,f=0,c=h,j=o,y=p,g=0,F=-1,E=1<<p,C=E-1,t===Gj&&E>Xhe||t===Qhe&&E>$he)return 1;for(;;){te=c-g,s[f]<N?(ie=0,ae=s[f]):s[f]>N?(ie=z[X+s[f]],ae=O[W+s[f]]):(ie=32+64,ae=0),k=1<<c-g,R=1<<y,h=R;do R-=k,a[j+(A>>g)+R]=te<<24|ie<<16|ae|0;while(R!==0);for(k=1<<c-1;A&k;)k>>=1;if(k!==0?(A&=k-1,A+=k):A=0,f++,--H[c]==0){if(c===d)break;c=r[i+s[f]]}if(c>p&&(A&C)!==F){for(g===0&&(g=p),j+=h,y=c-g,b=1<<y;y+g<d&&(b-=H[y+g],!(b<=0));)y++,b<<=1;if(E+=1<<y,t===Gj&&E>Xhe||t===Qhe&&E>$he)return 1;F=A&C,a[F]=p<<24|y<<16|j-o|0}}return A!==0&&(a[j+A]=c-g<<24|64<<16|0),u.bits=p,0}});var Dde=T(du=>{"use strict";var Do=Bc(),zj=Ij(),xl=Pj(),oot=Khe(),r_=ede(),sot=0,tde=1,rde=2,ide=4,uot=5,D2=6,_p=0,lot=1,cot=2,As=-2,nde=-3,Hj=-4,fot=-5,ade=8,ode=1,sde=2,ude=3,lde=4,cde=5,fde=6,hde=7,dde=8,pde=9,mde=10,M2=11,Dc=12,Wj=13,gde=14,Vj=15,vde=16,yde=17,bde=18,_de=19,L2=20,j2=21,xde=22,wde=23,Ede=24,Sde=25,Tde=26,Kj=27,Ade=28,kde=29,Ai=30,Yj=31,hot=32,dot=852,pot=592,mot=15,got=mot;function Rde(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function vot(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Do.Buf16(320),this.work=new Do.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Cde(e){var t;return!e||!e.state?As:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=ode,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Do.Buf32(dot),t.distcode=t.distdyn=new Do.Buf32(pot),t.sane=1,t.back=-1,_p)}function Ide(e){var t;return!e||!e.state?As:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Cde(e))}function Pde(e,t){var r,i;return!e||!e.state||(i=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?As:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,Ide(e))}function Bde(e,t){var r,i;return e?(i=new vot,e.state=i,i.window=null,r=Pde(e,t),r!==_p&&(e.state=null),r):As}function yot(e){return Bde(e,got)}var Ode=!0,Xj,$j;function bot(e){if(Ode){var t;for(Xj=new Do.Buf32(512),$j=new Do.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(r_(tde,e.lens,0,288,Xj,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;r_(rde,e.lens,0,32,$j,0,e.work,{bits:5}),Ode=!1}e.lencode=Xj,e.lenbits=9,e.distcode=$j,e.distbits=5}function Fde(e,t,r,i){var n,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Do.Buf8(a.wsize)),i>=a.wsize?(Do.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),Do.arraySet(a.window,t,r-i,n,a.wnext),i-=n,i?(Do.arraySet(a.window,t,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0}function _ot(e,t){var r,i,n,a,o,s,u,l,c,f,h,d,p,y,g=0,b,E,A,k,R,F,C,j,O=new Do.Buf8(4),W,N,H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return As;r=e.state,r.mode===Dc&&(r.mode=Wj),o=e.next_out,n=e.output,u=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=r.hold,c=r.bits,f=s,h=u,j=_p;e:for(;;)switch(r.mode){case ode:if(r.wrap===0){r.mode=Wj;break}for(;c<16;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(r.wrap&2&&l===35615){r.check=0,O[0]=l&255,O[1]=l>>>8&255,r.check=xl(r.check,O,2,0),l=0,c=0,r.mode=sde;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=Ai;break}if((l&15)!==ade){e.msg="unknown compression method",r.mode=Ai;break}if(l>>>=4,c-=4,C=(l&15)+8,r.wbits===0)r.wbits=C;else if(C>r.wbits){e.msg="invalid window size",r.mode=Ai;break}r.dmax=1<<C,e.adler=r.check=1,r.mode=l&512?mde:Dc,l=0,c=0;break;case sde:for(;c<16;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(r.flags=l,(r.flags&255)!==ade){e.msg="unknown compression method",r.mode=Ai;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=Ai;break}r.head&&(r.head.text=l>>8&1),r.flags&512&&(O[0]=l&255,O[1]=l>>>8&255,r.check=xl(r.check,O,2,0)),l=0,c=0,r.mode=ude;case ude:for(;c<32;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}r.head&&(r.head.time=l),r.flags&512&&(O[0]=l&255,O[1]=l>>>8&255,O[2]=l>>>16&255,O[3]=l>>>24&255,r.check=xl(r.check,O,4,0)),l=0,c=0,r.mode=lde;case lde:for(;c<16;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}r.head&&(r.head.xflags=l&255,r.head.os=l>>8),r.flags&512&&(O[0]=l&255,O[1]=l>>>8&255,r.check=xl(r.check,O,2,0)),l=0,c=0,r.mode=cde;case cde:if(r.flags&1024){for(;c<16;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}r.length=l,r.head&&(r.head.extra_len=l),r.flags&512&&(O[0]=l&255,O[1]=l>>>8&255,r.check=xl(r.check,O,2,0)),l=0,c=0}else r.head&&(r.head.extra=null);r.mode=fde;case fde:if(r.flags&1024&&(d=r.length,d>s&&(d=s),d&&(r.head&&(C=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Do.arraySet(r.head.extra,i,a,d,C)),r.flags&512&&(r.check=xl(r.check,i,d,a)),s-=d,a+=d,r.length-=d),r.length))break e;r.length=0,r.mode=hde;case hde:if(r.flags&2048){if(s===0)break e;d=0;do C=i[a+d++],r.head&&C&&r.length<65536&&(r.head.name+=String.fromCharCode(C));while(C&&d<s);if(r.flags&512&&(r.check=xl(r.check,i,d,a)),s-=d,a+=d,C)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=dde;case dde:if(r.flags&4096){if(s===0)break e;d=0;do C=i[a+d++],r.head&&C&&r.length<65536&&(r.head.comment+=String.fromCharCode(C));while(C&&d<s);if(r.flags&512&&(r.check=xl(r.check,i,d,a)),s-=d,a+=d,C)break e}else r.head&&(r.head.comment=null);r.mode=pde;case pde:if(r.flags&512){for(;c<16;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(l!==(r.check&65535)){e.msg="header crc mismatch",r.mode=Ai;break}l=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Dc;break;case mde:for(;c<32;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}e.adler=r.check=Rde(l),l=0,c=0,r.mode=M2;case M2:if(r.havedict===0)return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=c,cot;e.adler=r.check=1,r.mode=Dc;case Dc:if(t===uot||t===D2)break e;case Wj:if(r.last){l>>>=c&7,c-=c&7,r.mode=Kj;break}for(;c<3;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}switch(r.last=l&1,l>>>=1,c-=1,l&3){case 0:r.mode=gde;break;case 1:if(bot(r),r.mode=L2,t===D2){l>>>=2,c-=2;break e}break;case 2:r.mode=yde;break;case 3:e.msg="invalid block type",r.mode=Ai}l>>>=2,c-=2;break;case gde:for(l>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if((l&65535)!=(l>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Ai;break}if(r.length=l&65535,l=0,c=0,r.mode=Vj,t===D2)break e;case Vj:r.mode=vde;case vde:if(d=r.length,d){if(d>s&&(d=s),d>u&&(d=u),d===0)break e;Do.arraySet(n,i,a,d,o),s-=d,a+=d,u-=d,o+=d,r.length-=d;break}r.mode=Dc;break;case yde:for(;c<14;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(r.nlen=(l&31)+257,l>>>=5,c-=5,r.ndist=(l&31)+1,l>>>=5,c-=5,r.ncode=(l&15)+4,l>>>=4,c-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Ai;break}r.have=0,r.mode=bde;case bde:for(;r.have<r.ncode;){for(;c<3;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}r.lens[H[r.have++]]=l&7,l>>>=3,c-=3}for(;r.have<19;)r.lens[H[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,W={bits:r.lenbits},j=r_(sot,r.lens,0,19,r.lencode,0,r.work,W),r.lenbits=W.bits,j){e.msg="invalid code lengths set",r.mode=Ai;break}r.have=0,r.mode=_de;case _de:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[l&(1<<r.lenbits)-1],b=g>>>24,E=g>>>16&255,A=g&65535,!(b<=c);){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(A<16)l>>>=b,c-=b,r.lens[r.have++]=A;else{if(A===16){for(N=b+2;c<N;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(l>>>=b,c-=b,r.have===0){e.msg="invalid bit length repeat",r.mode=Ai;break}C=r.lens[r.have-1],d=3+(l&3),l>>>=2,c-=2}else if(A===17){for(N=b+3;c<N;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}l>>>=b,c-=b,C=0,d=3+(l&7),l>>>=3,c-=3}else{for(N=b+7;c<N;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}l>>>=b,c-=b,C=0,d=11+(l&127),l>>>=7,c-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Ai;break}for(;d--;)r.lens[r.have++]=C}}if(r.mode===Ai)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Ai;break}if(r.lenbits=9,W={bits:r.lenbits},j=r_(tde,r.lens,0,r.nlen,r.lencode,0,r.work,W),r.lenbits=W.bits,j){e.msg="invalid literal/lengths set",r.mode=Ai;break}if(r.distbits=6,r.distcode=r.distdyn,W={bits:r.distbits},j=r_(rde,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,W),r.distbits=W.bits,j){e.msg="invalid distances set",r.mode=Ai;break}if(r.mode=L2,t===D2)break e;case L2:r.mode=j2;case j2:if(s>=6&&u>=258){e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=c,oot(e,h),o=e.next_out,n=e.output,u=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=r.hold,c=r.bits,r.mode===Dc&&(r.back=-1);break}for(r.back=0;g=r.lencode[l&(1<<r.lenbits)-1],b=g>>>24,E=g>>>16&255,A=g&65535,!(b<=c);){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(E&&(E&240)==0){for(k=b,R=E,F=A;g=r.lencode[F+((l&(1<<k+R)-1)>>k)],b=g>>>24,E=g>>>16&255,A=g&65535,!(k+b<=c);){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}l>>>=k,c-=k,r.back+=k}if(l>>>=b,c-=b,r.back+=b,r.length=A,E===0){r.mode=Tde;break}if(E&32){r.back=-1,r.mode=Dc;break}if(E&64){e.msg="invalid literal/length code",r.mode=Ai;break}r.extra=E&15,r.mode=xde;case xde:if(r.extra){for(N=r.extra;c<N;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=wde;case wde:for(;g=r.distcode[l&(1<<r.distbits)-1],b=g>>>24,E=g>>>16&255,A=g&65535,!(b<=c);){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if((E&240)==0){for(k=b,R=E,F=A;g=r.distcode[F+((l&(1<<k+R)-1)>>k)],b=g>>>24,E=g>>>16&255,A=g&65535,!(k+b<=c);){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}l>>>=k,c-=k,r.back+=k}if(l>>>=b,c-=b,r.back+=b,E&64){e.msg="invalid distance code",r.mode=Ai;break}r.offset=A,r.extra=E&15,r.mode=Ede;case Ede:if(r.extra){for(N=r.extra;c<N;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Ai;break}r.mode=Sde;case Sde:if(u===0)break e;if(d=h-u,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Ai;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),y=r.window}else y=n,p=o-r.offset,d=r.length;d>u&&(d=u),u-=d,r.length-=d;do n[o++]=y[p++];while(--d);r.length===0&&(r.mode=j2);break;case Tde:if(u===0)break e;n[o++]=r.length,u--,r.mode=j2;break;case Kj:if(r.wrap){for(;c<32;){if(s===0)break e;s--,l|=i[a++]<<c,c+=8}if(h-=u,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?xl(r.check,n,h,o-h):zj(r.check,n,h,o-h)),h=u,(r.flags?l:Rde(l))!==r.check){e.msg="incorrect data check",r.mode=Ai;break}l=0,c=0}r.mode=Ade;case Ade:if(r.wrap&&r.flags){for(;c<32;){if(s===0)break e;s--,l+=i[a++]<<c,c+=8}if(l!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=Ai;break}l=0,c=0}r.mode=kde;case kde:j=lot;break e;case Ai:j=nde;break e;case Yj:return Hj;case hot:default:return As}return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=c,(r.wsize||h!==e.avail_out&&r.mode<Ai&&(r.mode<Kj||t!==ide))&&Fde(e,e.output,e.next_out,h-e.avail_out)?(r.mode=Yj,Hj):(f-=e.avail_in,h-=e.avail_out,e.total_in+=f,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?xl(r.check,n,h,e.next_out-h):zj(r.check,n,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Dc?128:0)+(r.mode===L2||r.mode===Vj?256:0),(f===0&&h===0||t===ide)&&j===_p&&(j=fot),j)}function xot(e){if(!e||!e.state)return As;var t=e.state;return t.window&&(t.window=null),e.state=null,_p}function wot(e,t){var r;return!e||!e.state||(r=e.state,(r.wrap&2)==0)?As:(r.head=t,t.done=!1,_p)}function Eot(e,t){var r=t.length,i,n,a;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==M2)?As:i.mode===M2&&(n=1,n=zj(n,t,r,0),n!==i.check)?nde:(a=Fde(e,t,r,r),a?(i.mode=Yj,Hj):(i.havedict=1,_p))}du.inflateReset=Ide;du.inflateReset2=Pde;du.inflateResetKeep=Cde;du.inflateInit=yot;du.inflateInit2=Bde;du.inflate=_ot;du.inflateEnd=xot;du.inflateGetHeader=wot;du.inflateSetDictionary=Eot;du.inflateInfo="pako inflate (from Nodeca project)"});var Jj=T((mBt,Mde)=>{"use strict";Mde.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var jde=T((gBt,Lde)=>{"use strict";function Sot(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Lde.exports=Sot});var qde=T(n_=>{"use strict";var I0=Dde(),i_=Bc(),N2=Mj(),cn=Jj(),Qj=A2(),Tot=Lj(),Aot=jde(),Nde=Object.prototype.toString;function xp(e){if(!(this instanceof xp))return new xp(e);this.options=i_.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)==0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Tot,this.strm.avail_out=0;var r=I0.inflateInit2(this.strm,t.windowBits);if(r!==cn.Z_OK)throw new Error(Qj[r]);if(this.header=new Aot,I0.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=N2.string2buf(t.dictionary):Nde.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=I0.inflateSetDictionary(this.strm,t.dictionary),r!==cn.Z_OK)))throw new Error(Qj[r])}xp.prototype.push=function(e,t){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s,u,l,c=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?cn.Z_FINISH:cn.Z_NO_FLUSH,typeof e=="string"?r.input=N2.binstring2buf(e):Nde.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new i_.Buf8(i),r.next_out=0,r.avail_out=i),a=I0.inflate(r,cn.Z_NO_FLUSH),a===cn.Z_NEED_DICT&&n&&(a=I0.inflateSetDictionary(this.strm,n)),a===cn.Z_BUF_ERROR&&c===!0&&(a=cn.Z_OK,c=!1),a!==cn.Z_STREAM_END&&a!==cn.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===cn.Z_STREAM_END||r.avail_in===0&&(o===cn.Z_FINISH||o===cn.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=N2.utf8border(r.output,r.next_out),u=r.next_out-s,l=N2.buf2string(r.output,s),r.next_out=u,r.avail_out=i-u,u&&i_.arraySet(r.output,r.output,s,u,0),this.onData(l)):this.onData(i_.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(c=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==cn.Z_STREAM_END);return a===cn.Z_STREAM_END&&(o=cn.Z_FINISH),o===cn.Z_FINISH?(a=I0.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===cn.Z_OK):(o===cn.Z_SYNC_FLUSH&&(this.onEnd(cn.Z_OK),r.avail_out=0),!0)};xp.prototype.onData=function(e){this.chunks.push(e)};xp.prototype.onEnd=function(e){e===cn.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i_.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Zj(e,t){var r=new xp(t);if(r.push(e,!0),r.err)throw r.msg||Qj[r.err];return r.result}function kot(e,t){return t=t||{},t.raw=!0,Zj(e,t)}n_.Inflate=xp;n_.inflate=Zj;n_.inflateRaw=kot;n_.ungzip=Zj});var zde=T((yBt,Gde)=>{"use strict";var Rot=Bc().assign,Cot=Whe(),Iot=qde(),Pot=Jj(),Ude={};Rot(Ude,Cot,Iot,Pot);Gde.exports=Ude});var Wde=T(U2=>{"use strict";var Bot=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",Oot=zde(),Hde=Li(),q2=Fo(),Fot=Bot?"uint8array":"array";U2.magic="\b\0";function wp(e,t){q2.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Hde.inherits(wp,q2);wp.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Hde.transformTo(Fot,e.data),!1)};wp.prototype.flush=function(){q2.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};wp.prototype.cleanUp=function(){q2.prototype.cleanUp.call(this),this._pako=null};wp.prototype._createPako=function(){this._pako=new Oot[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};U2.compressWorker=function(e){return new wp("Deflate",e)};U2.uncompressWorker=function(){return new wp("Inflate",{})}});var t6=T(e6=>{"use strict";var Vde=Fo();e6.STORE={magic:"\0\0",compressWorker:function(){return new Vde("STORE compression")},uncompressWorker:function(){return new Vde("STORE decompression")}};e6.DEFLATE=Wde()});var r6=T(Ep=>{"use strict";Ep.LOCAL_FILE_HEADER="PK";Ep.CENTRAL_FILE_HEADER="PK";Ep.CENTRAL_DIRECTORY_END="PK";Ep.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";Ep.ZIP64_CENTRAL_DIRECTORY_END="PK";Ep.DATA_DESCRIPTOR="PK\x07\b"});var $de=T((wBt,Xde)=>{"use strict";var P0=Li(),B0=Fo(),i6=b0(),Kde=x2(),G2=r6(),Ei=function(e,t){var r="",i;for(i=0;i<t;i++)r+=String.fromCharCode(e&255),e=e>>>8;return r},Dot=function(e,t){var r=e;return e||(r=t?16893:33204),(r&65535)<<16},Mot=function(e){return(e||0)&63},Yde=function(e,t,r,i,n,a){var o=e.file,s=e.compression,u=a!==i6.utf8encode,l=P0.transformTo("string",a(o.name)),c=P0.transformTo("string",i6.utf8encode(o.name)),f=o.comment,h=P0.transformTo("string",a(f)),d=P0.transformTo("string",i6.utf8encode(f)),p=c.length!==o.name.length,y=d.length!==f.length,g,b,E="",A="",k="",R=o.dir,F=o.date,C={crc32:0,compressedSize:0,uncompressedSize:0};(!t||r)&&(C.crc32=e.crc32,C.compressedSize=e.compressedSize,C.uncompressedSize=e.uncompressedSize);var j=0;t&&(j|=8),!u&&(p||y)&&(j|=2048);var O=0,W=0;R&&(O|=16),n==="UNIX"?(W=798,O|=Dot(o.unixPermissions,R)):(W=20,O|=Mot(o.dosPermissions,R)),g=F.getUTCHours(),g=g<<6,g=g|F.getUTCMinutes(),g=g<<5,g=g|F.getUTCSeconds()/2,b=F.getUTCFullYear()-1980,b=b<<4,b=b|F.getUTCMonth()+1,b=b<<5,b=b|F.getUTCDate(),p&&(A=Ei(1,1)+Ei(Kde(l),4)+c,E+="up"+Ei(A.length,2)+A),y&&(k=Ei(1,1)+Ei(Kde(h),4)+d,E+="uc"+Ei(k.length,2)+k);var N="";N+=`
116
116
  \0`,N+=Ei(j,2),N+=s.magic,N+=Ei(g,2),N+=Ei(b,2),N+=Ei(C.crc32,4),N+=Ei(C.compressedSize,4),N+=Ei(C.uncompressedSize,4),N+=Ei(l.length,2),N+=Ei(E.length,2);var H=G2.LOCAL_FILE_HEADER+N+l+E,L=G2.CENTRAL_FILE_HEADER+Ei(W,2)+N+Ei(h.length,2)+"\0\0\0\0"+Ei(O,4)+Ei(i,4)+l+E+h;return{fileRecord:H,dirRecord:L}},Lot=function(e,t,r,i,n){var a="",o=P0.transformTo("string",n(i));return a=G2.CENTRAL_DIRECTORY_END+"\0\0\0\0"+Ei(e,2)+Ei(e,2)+Ei(t,4)+Ei(r,4)+Ei(o.length,2)+o,a},jot=function(e){var t="";return t=G2.DATA_DESCRIPTOR+Ei(e.crc32,4)+Ei(e.compressedSize,4)+Ei(e.uncompressedSize,4),t};function pu(e,t,r,i){B0.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}P0.inherits(pu,B0);pu.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,B0.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}}))};pu.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=Yde(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0};pu.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=Yde(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:jot(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};pu.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,i=Lot(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})};pu.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};pu.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(r){t.error(r)}),this};pu.prototype.resume=function(){if(!B0.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};pu.prototype.error=function(e){var t=this._sources;if(!B0.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch{}return!0};pu.prototype.lock=function(){B0.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Xde.exports=pu});var Qde=T(Jde=>{"use strict";var Not=t6(),qot=$de(),Uot=function(e,t){var r=e||t,i=Not[r];if(!i)throw new Error(r+" is not a valid compression method !");return i};Jde.generateWorker=function(e,t,r){var i=new qot(t.streamFiles,r,t.platform,t.encodeFileName),n=0;try{e.forEach(function(a,o){n++;var s=Uot(o.options.compression,t.compression),u=o.options.compressionOptions||t.compressionOptions||{},l=o.dir,c=o.date;o._compressWorker(s,u).withStreamInfo("file",{name:a,dir:l,date:c,comment:o.comment||"",unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions}).pipe(i)}),i.entriesCount=n}catch(a){i.error(a)}return i}});var epe=T((SBt,Zde)=>{"use strict";var Got=Li(),z2=Fo();function a_(e,t){z2.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Got.inherits(a_,z2);a_.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(r){t.push({data:r,meta:{percent:0}})}).on("error",function(r){t.isPaused?this.generatedError=r:t.error(r)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};a_.prototype.pause=function(){return z2.prototype.pause.call(this)?(this._stream.pause(),!0):!1};a_.prototype.resume=function(){return z2.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Zde.exports=a_});var cpe=T((TBt,lpe)=>{"use strict";var zot=b0(),o_=Li(),tpe=Fo(),Hot=uj(),rpe=lj(),ipe=w2(),Wot=rhe(),Vot=Qde(),npe=D1(),Kot=epe(),ape=function(e,t,r){var i=o_.getTypeOf(t),n,a=o_.extend(r||{},rpe);a.date=a.date||new Date,a.compression!==null&&(a.compression=a.compression.toUpperCase()),typeof a.unixPermissions=="string"&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&a.unixPermissions&16384&&(a.dir=!0),a.dosPermissions&&a.dosPermissions&16&&(a.dir=!0),a.dir&&(e=ope(e)),a.createFolders&&(n=Yot(e))&&spe.call(this,n,!0);var o=i==="string"&&a.binary===!1&&a.base64===!1;(!r||typeof r.binary=="undefined")&&(a.binary=!o);var s=t instanceof ipe&&t.uncompressedSize===0;(s||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var u=null;t instanceof ipe||t instanceof tpe?u=t:npe.isNode&&npe.isStream(t)?u=new Kot(e,t):u=o_.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var l=new Wot(e,u,a);this.files[e]=l},Yot=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},ope=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},spe=function(e,t){return t=typeof t!="undefined"?t:rpe.createFolders,e=ope(e),this.files[e]||ape.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function upe(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var Xot={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,i;for(t in this.files)i=this.files[t],r=t.slice(this.root.length,t.length),r&&t.slice(0,this.root.length)===this.root&&e(r,i)},filter:function(e){var t=[];return this.forEach(function(r,i){e(r,i)&&t.push(i)}),t},file:function(e,t,r){if(arguments.length===1)if(upe(e)){var i=e;return this.filter(function(a,o){return!o.dir&&i.test(a)})}else{var n=this.files[this.root+e];return n&&!n.dir?n:null}else e=this.root+e,ape.call(this,e,t,r);return this},folder:function(e){if(!e)return this;if(upe(e))return this.filter(function(n,a){return a.dir&&e.test(n)});var t=this.root+e,r=spe.call(this,t),i=this.clone();return i.root=r.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(n,a){return a.name.slice(0,e.length)===e}),i=0;i<r.length;i++)delete this.files[r[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if(r=o_.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:zot.utf8encode}),r.type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),r.type==="binarystring"&&(r.type="string"),!r.type)throw new Error("No output type specified.");o_.checkSupport(r.type),(r.platform==="darwin"||r.platform==="freebsd"||r.platform==="linux"||r.platform==="sunos")&&(r.platform="UNIX"),r.platform==="win32"&&(r.platform="DOS");var i=r.comment||this.comment||"";t=Vot.generateWorker(this,r,i)}catch(n){t=new tpe("error"),t.error(n)}return new Hot(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};lpe.exports=Xot});var n6=T((ABt,hpe)=>{"use strict";var $ot=Li();function fpe(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}fpe.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,r;for(this.checkOffset(e),r=this.index+e-1;r>=this.index;r--)t=(t<<8)+this.byteAt(r);return this.index+=e,t},readString:function(e){return $ot.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};hpe.exports=fpe});var a6=T((kBt,ppe)=>{"use strict";var dpe=n6(),Jot=Li();function O0(e){dpe.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}Jot.inherits(O0,dpe);O0.prototype.byteAt=function(e){return this.data[this.zero+e]};O0.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===r&&this.data[a+2]===i&&this.data[a+3]===n)return a-this.zero;return-1};O0.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&r===a[1]&&i===a[2]&&n===a[3]};O0.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};ppe.exports=O0});var vpe=T((RBt,gpe)=>{"use strict";var mpe=n6(),Qot=Li();function F0(e){mpe.call(this,e)}Qot.inherits(F0,mpe);F0.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};F0.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};F0.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};F0.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};gpe.exports=F0});var s6=T((CBt,bpe)=>{"use strict";var ype=a6(),Zot=Li();function o6(e){ype.call(this,e)}Zot.inherits(o6,ype);o6.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};bpe.exports=o6});var wpe=T((IBt,xpe)=>{"use strict";var _pe=s6(),est=Li();function u6(e){_pe.call(this,e)}est.inherits(u6,_pe);u6.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};xpe.exports=u6});var l6=T((PBt,Spe)=>{"use strict";var H2=Li(),Epe=Ic(),tst=a6(),rst=vpe(),ist=wpe(),nst=s6();Spe.exports=function(e){var t=H2.getTypeOf(e);return H2.checkSupport(t),t==="string"&&!Epe.uint8array?new rst(e):t==="nodebuffer"?new ist(e):Epe.uint8array?new nst(H2.transformTo("uint8array",e)):new tst(H2.transformTo("array",e))}});var Rpe=T((BBt,kpe)=>{"use strict";var c6=l6(),jh=Li(),ast=w2(),Tpe=x2(),W2=b0(),V2=t6(),ost=Ic(),sst=0,ust=3,lst=function(e){for(var t in V2)if(!!Object.prototype.hasOwnProperty.call(V2,t)&&V2[t].magic===e)return V2[t];return null};function Ape(e,t){this.options=e,this.loadOptions=t}Ape.prototype={isEncrypted:function(){return(this.bitFlag&1)==1},useUTF8:function(){return(this.bitFlag&2048)==2048},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=lst(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+jh.pretty(this.compressionMethod)+" unknown (inner file : "+jh.transformTo("string",this.fileName)+")");this.decompressed=new ast(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===sst&&(this.dosPermissions=this.externalFileAttributes&63),e===ust&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(!!this.extraFields[1]){var e=c6(this.extraFields[1].value);this.uncompressedSize===jh.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===jh.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===jh.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===jh.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,r,i,n;for(this.extraFields||(this.extraFields={});e.index+4<t;)r=e.readInt(2),i=e.readInt(2),n=e.readData(i),this.extraFields[r]={id:r,length:i,value:n};e.setIndex(t)},handleUTF8:function(){var e=ost.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=W2.utf8decode(this.fileName),this.fileCommentStr=W2.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var r=jh.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(i!==null)this.fileCommentStr=i;else{var n=jh.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=c6(e.value);return t.readInt(1)!==1||Tpe(this.fileName)!==t.readInt(4)?null:W2.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=c6(e.value);return t.readInt(1)!==1||Tpe(this.fileComment)!==t.readInt(4)?null:W2.utf8decode(t.readData(e.length-5))}return null}};kpe.exports=Ape});var Ppe=T((OBt,Ipe)=>{"use strict";var cst=l6(),Mc=Li(),mu=r6(),fst=Rpe(),hst=Ic();function Cpe(e){this.files=[],this.loadOptions=e}Cpe.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+Mc.pretty(t)+", expected "+Mc.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4),n=i===t;return this.reader.setIndex(r),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=hst.uint8array?"uint8array":"array",r=Mc.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,r,i,n;t<e;)r=this.reader.readInt(2),i=this.reader.readInt(4),n=this.reader.readData(i),this.zip64ExtensibleData[r]={id:r,length:i,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(mu.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(mu.CENTRAL_FILE_HEADER);)e=new fst({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(mu.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,mu.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var r=e;if(this.checkSignature(mu.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Mc.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Mc.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Mc.MAX_VALUE_16BITS||this.centralDirRecords===Mc.MAX_VALUE_16BITS||this.centralDirSize===Mc.MAX_VALUE_32BITS||this.centralDirOffset===Mc.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(mu.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(mu.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,mu.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(mu.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(mu.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var n=r-i;if(n>0)this.isSignature(r,mu.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=cst(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};Ipe.exports=Cpe});var Fpe=T((FBt,Ope)=>{"use strict";var f6=Li(),K2=g0(),dst=b0(),pst=Ppe(),mst=hj(),Bpe=D1();function gst(e){return new K2.Promise(function(t,r){var i=e.decompressed.getContentWorker().pipe(new mst);i.on("error",function(n){r(n)}).on("end",function(){i.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}Ope.exports=function(e,t){var r=this;return t=f6.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:dst.utf8decode}),Bpe.isNode&&Bpe.isStream(e)?K2.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):f6.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(i){var n=new pst(t);return n.load(i),n}).then(function(n){var a=[K2.Promise.resolve(n)],o=n.files;if(t.checkCRC32)for(var s=0;s<o.length;s++)a.push(gst(o[s]));return K2.Promise.all(a)}).then(function(n){for(var a=n.shift(),o=a.files,s=0;s<o.length;s++){var u=o[s],l=u.fileNameStr,c=f6.resolve(u.fileNameStr);r.file(c,u.decompressed,{binary:!0,optimizedBinaryString:!0,date:u.date,dir:u.dir,comment:u.fileCommentStr.length?u.fileCommentStr:null,unixPermissions:u.unixPermissions,dosPermissions:u.dosPermissions,createFolders:t.createFolders}),u.dir||(r.file(c).unsafeOriginalName=l)}return a.zipComment.length&&(r.comment=a.zipComment),r})}});var h6=T((DBt,Dpe)=>{"use strict";function ks(){if(!(this instanceof ks))return new ks;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new ks;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}ks.prototype=cpe();ks.prototype.loadAsync=Fpe();ks.support=Ic();ks.defaults=lj();ks.version="3.10.1";ks.loadAsync=function(e,t){return new ks().loadAsync(e,t)};ks.external=g0();Dpe.exports=ks});var _me=T((_Ot,jc)=>{var Cut=Ga().default;function bme(){"use strict";jc.exports=bme=function(){return e},jc.exports.__esModule=!0,jc.exports.default=jc.exports;var e={},t=Object.prototype,r=t.hasOwnProperty,i=Object.defineProperty||function(H,L,z){H[L]=z.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function u(H,L,z){return Object.defineProperty(H,L,{value:z,enumerable:!0,configurable:!0,writable:!0}),H[L]}try{u({},"")}catch{u=function(z,X,te){return z[X]=te}}function l(H,L,z,X){var te=L&&L.prototype instanceof h?L:h,ie=Object.create(te.prototype),ae=new O(X||[]);return i(ie,"_invoke",{value:R(H,z,ae)}),ie}function c(H,L,z){try{return{type:"normal",arg:H.call(L,z)}}catch(X){return{type:"throw",arg:X}}}e.wrap=l;var f={};function h(){}function d(){}function p(){}var y={};u(y,a,function(){return this});var g=Object.getPrototypeOf,b=g&&g(g(W([])));b&&b!==t&&r.call(b,a)&&(y=b);var E=p.prototype=h.prototype=Object.create(y);function A(H){["next","throw","return"].forEach(function(L){u(H,L,function(z){return this._invoke(L,z)})})}function k(H,L){function z(te,ie,ae,ue){var de=c(H[te],H,ie);if(de.type!=="throw"){var Me=de.arg,Pe=Me.value;return Pe&&Cut(Pe)=="object"&&r.call(Pe,"__await")?L.resolve(Pe.__await).then(function(qe){z("next",qe,ae,ue)},function(qe){z("throw",qe,ae,ue)}):L.resolve(Pe).then(function(qe){Me.value=qe,ae(Me)},function(qe){return z("throw",qe,ae,ue)})}ue(de.arg)}var X;i(this,"_invoke",{value:function(ie,ae){function ue(){return new L(function(de,Me){z(ie,ae,de,Me)})}return X=X?X.then(ue,ue):ue()}})}function R(H,L,z){var X="suspendedStart";return function(te,ie){if(X==="executing")throw new Error("Generator is already running");if(X==="completed"){if(te==="throw")throw ie;return N()}for(z.method=te,z.arg=ie;;){var ae=z.delegate;if(ae){var ue=F(ae,z);if(ue){if(ue===f)continue;return ue}}if(z.method==="next")z.sent=z._sent=z.arg;else if(z.method==="throw"){if(X==="suspendedStart")throw X="completed",z.arg;z.dispatchException(z.arg)}else z.method==="return"&&z.abrupt("return",z.arg);X="executing";var de=c(H,L,z);if(de.type==="normal"){if(X=z.done?"completed":"suspendedYield",de.arg===f)continue;return{value:de.arg,done:z.done}}de.type==="throw"&&(X="completed",z.method="throw",z.arg=de.arg)}}}function F(H,L){var z=L.method,X=H.iterator[z];if(X===void 0)return L.delegate=null,z==="throw"&&H.iterator.return&&(L.method="return",L.arg=void 0,F(H,L),L.method==="throw")||z!=="return"&&(L.method="throw",L.arg=new TypeError("The iterator does not provide a '"+z+"' method")),f;var te=c(X,H.iterator,L.arg);if(te.type==="throw")return L.method="throw",L.arg=te.arg,L.delegate=null,f;var ie=te.arg;return ie?ie.done?(L[H.resultName]=ie.value,L.next=H.nextLoc,L.method!=="return"&&(L.method="next",L.arg=void 0),L.delegate=null,f):ie:(L.method="throw",L.arg=new TypeError("iterator result is not an object"),L.delegate=null,f)}function C(H){var L={tryLoc:H[0]};1 in H&&(L.catchLoc=H[1]),2 in H&&(L.finallyLoc=H[2],L.afterLoc=H[3]),this.tryEntries.push(L)}function j(H){var L=H.completion||{};L.type="normal",delete L.arg,H.completion=L}function O(H){this.tryEntries=[{tryLoc:"root"}],H.forEach(C,this),this.reset(!0)}function W(H){if(H){var L=H[a];if(L)return L.call(H);if(typeof H.next=="function")return H;if(!isNaN(H.length)){var z=-1,X=function te(){for(;++z<H.length;)if(r.call(H,z))return te.value=H[z],te.done=!1,te;return te.value=void 0,te.done=!0,te};return X.next=X}}return{next:N}}function N(){return{value:void 0,done:!0}}return d.prototype=p,i(E,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(H){var L=typeof H=="function"&&H.constructor;return!!L&&(L===d||(L.displayName||L.name)==="GeneratorFunction")},e.mark=function(H){return Object.setPrototypeOf?Object.setPrototypeOf(H,p):(H.__proto__=p,u(H,s,"GeneratorFunction")),H.prototype=Object.create(E),H},e.awrap=function(H){return{__await:H}},A(k.prototype),u(k.prototype,o,function(){return this}),e.AsyncIterator=k,e.async=function(H,L,z,X,te){te===void 0&&(te=Promise);var ie=new k(l(H,L,z,X),te);return e.isGeneratorFunction(L)?ie:ie.next().then(function(ae){return ae.done?ae.value:ie.next()})},A(E),u(E,s,"Generator"),u(E,a,function(){return this}),u(E,"toString",function(){return"[object Generator]"}),e.keys=function(H){var L=Object(H),z=[];for(var X in L)z.push(X);return z.reverse(),function te(){for(;z.length;){var ie=z.pop();if(ie in L)return te.value=ie,te.done=!1,te}return te.done=!0,te}},e.values=W,O.prototype={constructor:O,reset:function(L){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!L)for(var z in this)z.charAt(0)==="t"&&r.call(this,z)&&!isNaN(+z.slice(1))&&(this[z]=void 0)},stop:function(){this.done=!0;var L=this.tryEntries[0].completion;if(L.type==="throw")throw L.arg;return this.rval},dispatchException:function(L){if(this.done)throw L;var z=this;function X(Me,Pe){return ae.type="throw",ae.arg=L,z.next=Me,Pe&&(z.method="next",z.arg=void 0),!!Pe}for(var te=this.tryEntries.length-1;te>=0;--te){var ie=this.tryEntries[te],ae=ie.completion;if(ie.tryLoc==="root")return X("end");if(ie.tryLoc<=this.prev){var ue=r.call(ie,"catchLoc"),de=r.call(ie,"finallyLoc");if(ue&&de){if(this.prev<ie.catchLoc)return X(ie.catchLoc,!0);if(this.prev<ie.finallyLoc)return X(ie.finallyLoc)}else if(ue){if(this.prev<ie.catchLoc)return X(ie.catchLoc,!0)}else{if(!de)throw new Error("try statement without catch or finally");if(this.prev<ie.finallyLoc)return X(ie.finallyLoc)}}}},abrupt:function(L,z){for(var X=this.tryEntries.length-1;X>=0;--X){var te=this.tryEntries[X];if(te.tryLoc<=this.prev&&r.call(te,"finallyLoc")&&this.prev<te.finallyLoc){var ie=te;break}}ie&&(L==="break"||L==="continue")&&ie.tryLoc<=z&&z<=ie.finallyLoc&&(ie=null);var ae=ie?ie.completion:{};return ae.type=L,ae.arg=z,ie?(this.method="next",this.next=ie.finallyLoc,f):this.complete(ae)},complete:function(L,z){if(L.type==="throw")throw L.arg;return L.type==="break"||L.type==="continue"?this.next=L.arg:L.type==="return"?(this.rval=this.arg=L.arg,this.method="return",this.next="end"):L.type==="normal"&&z&&(this.next=z),f},finish:function(L){for(var z=this.tryEntries.length-1;z>=0;--z){var X=this.tryEntries[z];if(X.finallyLoc===L)return this.complete(X.completion,X.afterLoc),j(X),f}},catch:function(L){for(var z=this.tryEntries.length-1;z>=0;--z){var X=this.tryEntries[z];if(X.tryLoc===L){var te=X.completion;if(te.type==="throw"){var ie=te.arg;j(X)}return ie}}throw new Error("illegal catch attempt")},delegateYield:function(L,z,X){return this.delegate={iterator:W(L),resultName:z,nextLoc:X},this.method==="next"&&(this.arg=void 0),f}},e}jc.exports=bme,jc.exports.__esModule=!0,jc.exports.default=jc.exports});var wme=T((xOt,xme)=>{var tk=_me()();xme.exports=tk;try{regeneratorRuntime=tk}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=tk:Function("r","regeneratorRuntime = r")(tk)}});var S6=T(rk=>{"use strict";var w6=ti();Object.defineProperty(rk,"__esModule",{value:!0});rk.default=void 0;var Iut=w6(Wi()),Put=w6(Vi()),qh=w6(is()),But=240,Out=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],Fut=372,Dut=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],Mut=372,Lut=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],jut=12,E6=(3+1)*(3+2)/2,Nut=2,qut=function(){function e(t){(0,Iut.default)(this,e),(0,qh.default)(this,"_v00",0),(0,qh.default)(this,"_v01",0),(0,qh.default)(this,"_v10",0),(0,qh.default)(this,"_v11",0),(0,qh.default)(this,"_t",[]),(0,qh.default)(this,"_ix",void 0),(0,qh.default)(this,"_iy",void 0),(0,qh.default)(this,"options",void 0),this.options=t,this._ix=this.options._width,this._iy=this.options._height}return(0,Put.default)(e,[{key:"getHeight",value:function(r,i){if(r=Math.abs(r)>90?NaN:r,isNaN(r)||isNaN(i))return NaN;var n=Uut(i,360);i=n!==-180?n:180;var a=i*this.options._rlonres,o=-r*this.options._rlatres,s=Math.floor(a),u=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(o));a-=s,o-=u,u+=(this.options._height-1)/2,s+=s<0?this.options._width:s>=this.options._width?-this.options._width:0;var l=0,c=0,f=0,h=0,d=new Array(E6);if(s===this._ix&&u===this._iy)this.options.cubic?d=this._t:(l=this._v00,c=this._v01,f=this._v10,h=this._v11);else if(!this.options.cubic)l=this._rawval(s,u),c=this._rawval(s+1,u),f=this._rawval(s,u+1),h=this._rawval(s+1,u+1);else{var p=[this._rawval(s,u-1),this._rawval(s+1,u-1),this._rawval(s-1,u),this._rawval(s,u),this._rawval(s+1,u),this._rawval(s+2,u),this._rawval(s-1,u+1),this._rawval(s,u+1),this._rawval(s+1,u+1),this._rawval(s+2,u+1),this._rawval(s,u+2),this._rawval(s+1,u+2)],y=Dut;u!==0&&(y=u===this.options._height-2?Lut:Out);var g=Fut;u!==0&&(g=u===this.options._height-2?Mut:But);for(var b=0;b<E6;++b){d[b]=0;for(var E=0;E<jut;++E)d[b]+=p[E]*y[E6*E+b];d[b]/=g}}if(!this.options.cubic){var A=(1-a)*l+a*c,k=(1-a)*f+a*h,R=(1-o)*A+o*k,F=this.options._offset+this.options._scale*R;return this._ix=s,this._iy=u,this._v00=l,this._v01=c,this._v10=f,this._v11=h,F}var C=d[0]+a*(d[1]+a*(d[3]+a*d[6]))+o*(d[2]+a*(d[4]+a*d[7])+o*(d[5]+a*d[8]+o*d[9]));return C=this.options._offset+this.options._scale*C,this._ix=s,this._iy=u,this._t=d,C}},{key:"_rawval",value:function(r,i){r<0?r+=this.options._width:r>=this.options._width&&(r-=this.options._width),(i<0||i>=this.options._height)&&(i=i<0?-i:2*(this.options._height-1)-i,r+=(r<this.options._width/2?1:-1)*this.options._width/2);var n=this.options._datastart+Nut*(i*this.options._swidth+r),a=this.options.data[n],o=this.options.data[n+1],s=a<<8|o;return s}}]),e}();rk.default=qut;function Uut(e,t){t=Math.abs(t);var r=Eme(e,t);return 2*Math.abs(r)===t?r-=Eme(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function Eme(e,t){return e-Math.floor(e/t)*t}});var Cme=T(T6=>{"use strict";var Sme=ti();Object.defineProperty(T6,"__esModule",{value:!0});T6.parsePGM=Yut;var Tme=Sme(wme()),Gut=Sme(S6());function zut(e,t){var r=typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Hut(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
117
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function Hut(e,t){if(!!e){if(typeof e=="string")return Ame(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ame(e,t)}}function Ame(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var Wut=Tme.default.mark(kme),Vut=10,Kut=65535;function Yut(e,t){var r=kme(e),i=r.next();if(i.done||i.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");var n=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",l="UNKNOWN",c=0,f=0,h=null,d=null;do{i=r.next();var p=i.value.line;if(!!p.length)if(p[0]==="#"){var y=p.split(" "),g=y[0],b=y[1];if(g!=="#"||!b)continue;var E=y.length>2?y.slice(2):[];if(b==="Description")u=E.join(" ");else if(b==="DateTime")l=E.join(" ");else if(b==="Offset"){if(!y[2])throw new Error("Geoid model file: Error reading offset");n=parseInt(y[2],10)}else if(b==="Scale"){if(!y[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(y[2])}else b===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(y[2]))&&(o=parseFloat(y[2])):b===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(y[2]))&&(s=parseFloat(y[2]))}else{var A=p.split(" ");if(A=A.filter(function(C){return C!==""}),c=parseInt(A[0],10),f=parseInt(A[1],10),!(c&&f))throw new Error("Geoid model file: Error reading raster size");break}}while(!i.done);i=r.next();var k=parseInt(i.value.line,10);if(i.done)throw new Error("Geoid model file: Error reading maxval");if(k!==Kut)throw new Error("Geoid model file: Incorrect value of maxval");if(h=i.value.offset,d=c,n===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(a===0)throw new Error("Geoid model file: Scale not set");if(a<0)throw new Error("Geoid model file: Scale must be positive");if(f<2||c<2)throw new Error("Geoid model file: Raster size too small");if(c&1)throw new Error("Geoid model file: Raster width is odd");if(!(f&1))throw new Error("Geoid model file: Raster height is even");var R=c/360,F=(f-1)/180;return new Gut.default({cubic:t.cubic,_width:c,_height:f,_rlonres:R,_rlatres:F,_offset:n,_scale:a,_swidth:d,_datastart:h,_maxerror:o,_rmserror:s,_description:u,_datetime:l,data:e})}function kme(e){var t,r,i,n;return Tme.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:t=0;case 1:if(r=e.indexOf(Vut,t),r===-1){o.next=9;break}return i=e.subarray(t,r),t=r+1,o.next=7,{offset:t,line:Rme(i)};case 7:o.next=13;break;case 9:return n=e.subarray(t,e.length),t=e.length,o.next=13,{offset:t,line:Rme(n)};case 13:if(t<e.length){o.next=1;break}case 14:return o.abrupt("return",{offset:t,line:""});case 15:case"end":return o.stop()}},Wut)}function Rme(e){var t="",r=zut(e),i;try{for(r.s();!(i=r.n()).done;){var n=i.value;t+=String.fromCharCode(n)}}catch(a){r.e(a)}finally{r.f()}return t}});var Ime=T(ik=>{"use strict";var Xut=ti();Object.defineProperty(ik,"__esModule",{value:!0});Object.defineProperty(ik,"parsePGM",{enumerable:!0,get:function(){return $ut.parsePGM}});Object.defineProperty(ik,"Geoid",{enumerable:!0,get:function(){return Jut.default}});var $ut=Cme(),Jut=Xut(S6())});var Vme=T(uk=>{"use strict";Object.defineProperty(uk,"__esModule",{value:!0});uk.default=void 0;var klt={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,FUNC_ADD:32774,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,BLEND_COLOR:32773,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,VENDOR:7936,RENDERER:7937,VERSION:7938,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,BROWSER_DEFAULT_WEBGL:37444,STATIC_DRAW:35044,STREAM_DRAW:35040,DYNAMIC_DRAW:35048,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,CULL_FACE:2884,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,BLEND:3042,DEPTH_TEST:2929,DITHER:3024,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,SCISSOR_TEST:3089,STENCIL_TEST:2960,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CONTEXT_LOST_WEBGL:37442,CW:2304,CCW:2305,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,COMPILE_STATUS:35713,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_ATTRIBUTES:35721,ACTIVE_UNIFORMS:35718,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,ALWAYS:519,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,GEQUAL:518,NOTEQUAL:517,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,TEXTURE_WIDTH:4096,TEXTURE_HEIGHT:4097,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,MAX_3D_TEXTURE_SIZE:32883,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,MAX_TEXTURE_LOD_BIAS:34045,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,RASTERIZER_DISCARD:35977,VERTEX_ARRAY_BINDING:34229,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,MAX_ELEMENT_INDEX:36203,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,RGB9_E5:35901,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2UI:36975,TEXTURE_IMMUTABLE_FORMAT:37167,TEXTURE_IMMUTABLE_LEVELS:33503,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,UNSIGNED_INT_24_8:34042,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,INT_2_10_10_10_REV:36255,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,MAX_SAMPLES:36183,SAMPLER_BINDING:35097,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,UNSIGNED_NORMALIZED:35863,SIGNED_NORMALIZED:36764,VERTEX_ATTRIB_ARRAY_INTEGER:35069,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,DEPTH24_STENCIL8:35056,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,COLOR:6144,DEPTH:6145,STENCIL:6146,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,INVALID_INDEX:4294967295,TIMEOUT_IGNORED:-1,MAX_CLIENT_WAIT_TIMEOUT_WEBGL:37447,VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,UNMASKED_VENDOR_WEBGL:37445,UNMASKED_RENDERER_WEBGL:37446,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047,TEXTURE_MAX_ANISOTROPY_EXT:34046,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35986,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,UNSIGNED_INT_24_8_WEBGL:34042,HALF_FLOAT_OES:36193,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863,MIN_EXT:32775,MAX_EXT:32776,SRGB_EXT:35904,SRGB_ALPHA_EXT:35906,SRGB8_ALPHA8_EXT:35907,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:33296,FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723,COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067,COLOR_ATTACHMENT4_WEBGL:36068,COLOR_ATTACHMENT5_WEBGL:36069,COLOR_ATTACHMENT6_WEBGL:36070,COLOR_ATTACHMENT7_WEBGL:36071,COLOR_ATTACHMENT8_WEBGL:36072,COLOR_ATTACHMENT9_WEBGL:36073,COLOR_ATTACHMENT10_WEBGL:36074,COLOR_ATTACHMENT11_WEBGL:36075,COLOR_ATTACHMENT12_WEBGL:36076,COLOR_ATTACHMENT13_WEBGL:36077,COLOR_ATTACHMENT14_WEBGL:36078,COLOR_ATTACHMENT15_WEBGL:36079,DRAW_BUFFER0_WEBGL:34853,DRAW_BUFFER1_WEBGL:34854,DRAW_BUFFER2_WEBGL:34855,DRAW_BUFFER3_WEBGL:34856,DRAW_BUFFER4_WEBGL:34857,DRAW_BUFFER5_WEBGL:34858,DRAW_BUFFER6_WEBGL:34859,DRAW_BUFFER7_WEBGL:34860,DRAW_BUFFER8_WEBGL:34861,DRAW_BUFFER9_WEBGL:34862,DRAW_BUFFER10_WEBGL:34863,DRAW_BUFFER11_WEBGL:34864,DRAW_BUFFER12_WEBGL:34865,DRAW_BUFFER13_WEBGL:34866,DRAW_BUFFER14_WEBGL:34867,DRAW_BUFFER15_WEBGL:34868,MAX_COLOR_ATTACHMENTS_WEBGL:36063,MAX_DRAW_BUFFERS_WEBGL:34852,VERTEX_ARRAY_BINDING_OES:34229,QUERY_COUNTER_BITS_EXT:34916,CURRENT_QUERY_EXT:34917,QUERY_RESULT_EXT:34918,QUERY_RESULT_AVAILABLE_EXT:34919,TIME_ELAPSED_EXT:35007,TIMESTAMP_EXT:36392,GPU_DISJOINT_EXT:36795};uk.default=klt});var Eu=typeof process!="object"||String(process)!=="[object process]"||process.browser,Ek={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global},mn=Ek.global||Ek.self||Ek.window;var g4={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]};global["encoding-indexes"]=g4||{};function er(e,t,r){return t<=e&&e<=r}function d0e(e,t){return e.indexOf(t)!==-1}var Pl=Math.floor;function F_(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function p0e(e){for(var t=String(e),r=t.length,i=0,n=[];i<r;){var a=t.charCodeAt(i);if(a<55296||a>57343)n.push(a);else if(56320<=a&&a<=57343)n.push(65533);else if(55296<=a&&a<=56319)if(i===r-1)n.push(65533);else{var o=t.charCodeAt(i+1);if(56320<=o&&o<=57343){var s=a&1023,u=o&1023;n.push(65536+(s<<10)+u),i+=1}else n.push(65533)}i+=1}return n}function m0e(e){for(var t="",r=0;r<e.length;++r){var i=e[r];i<=65535?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode((i>>10)+55296,(i&1023)+56320))}return t}function No(e){return 0<=e&&e<=127}var qo=No,Rr=-1;function Sk(e){this.tokens=[].slice.call(e),this.tokens.reverse()}Sk.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():Rr},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};var di=-1;function Cr(e,t){if(e)throw TypeError("Decoder error");return t||65533}function Bs(e){throw TypeError("The code point "+e+" could not be encoded.")}function g0e(){}g0e.prototype={handler:function(e,t){}};function v0e(){}v0e.prototype={handler:function(e,t){}};function Tk(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(Ak,e)?Ak[e]:null}var v4=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],Ak={};v4.forEach(function(e){e.encodings.forEach(function(t){t.labels.forEach(function(r){Ak[r]=t})})});var Ja={},Qa={};function Lp(e,t){return t&&t[e]||null}function jp(e,t){var r=t.indexOf(e);return r===-1?null:r}function Fa(e){if(!("encoding-indexes"in global))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return global["encoding-indexes"][e]}function y0e(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var t=0,r=0,i=Fa("gb18030-ranges"),n;for(n=0;n<i.length;++n){var a=i[n];if(a[0]<=e)t=a[0],r=a[1];else break}return r+e-t}function b0e(e){if(e===59335)return 7457;var t=0,r=0,i=Fa("gb18030-ranges"),n;for(n=0;n<i.length;++n){var a=i[n];if(a[1]<=e)t=a[1],r=a[0];else break}return r+e-t}function _0e(e){kk=kk||Fa("jis0208").map(function(r,i){return er(i,8272,8835)?null:r});var t=kk;return t.indexOf(e)}var kk;function x0e(e){Rk=Rk||Fa("big5").map(function(r,i){return i<(161-129)*157?null:r});var t=Rk;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?t.lastIndexOf(e):jp(e,t)}var Rk,y4="utf-8";function Wh(e,t){if(!(this instanceof Wh))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):y4,t=F_(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=Tk(e);if(r===null||r.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Qa[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");var i=this;return i._encoding=r,Boolean(t.fatal)&&(i._error_mode="fatal"),Boolean(t.ignoreBOM)&&(i._ignoreBOM=!0),Object.defineProperty||(this.encoding=i._encoding.name.toLowerCase(),this.fatal=i._error_mode==="fatal",this.ignoreBOM=i._ignoreBOM),i}Object.defineProperty&&(Object.defineProperty(Wh.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(Wh.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(Wh.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));Wh.prototype.decode=function(t,r){var i;typeof t=="object"&&t instanceof ArrayBuffer?i=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):i=new Uint8Array(0),r=F_(r),this._do_not_flush||(this._decoder=Qa[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(r.stream);for(var n=new Sk(i),a=[],o;;){var s=n.read();if(s===Rr||(o=this._decoder.handler(n,s),o===di))break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(n,n.read()),o===di)break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}while(!n.endOfStream());this._decoder=null}function u(l){return d0e(["UTF-8","UTF-16LE","UTF-16BE"],this._encoding.name)&&!this._ignoreBOM&&!this._BOMseen&&(l.length>0&&l[0]===65279?(this._BOMseen=!0,l.shift()):l.length>0&&(this._BOMseen=!0)),m0e(l)}return u.call(this,a)};function iv(e,t){if(!(this instanceof iv))throw TypeError("Called as a function. Did you forget 'new'?");t=F_(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";var r=this;if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){e=e!==void 0?String(e):y4;var i=Tk(e);if(i===null||i.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Ja[i.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");r._encoding=i}else r._encoding=Tk("utf-8"),e!==void 0&&"console"in global&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=r._encoding.name.toLowerCase()),r}Object.defineProperty&&Object.defineProperty(iv.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});iv.prototype.encode=function(t,r){t=t===void 0?"":String(t),r=F_(r),this._do_not_flush||(this._encoder=Ja[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(r.stream);for(var i=new Sk(p0e(t)),n=[],a;;){var o=i.read();if(o===Rr||(a=this._encoder.handler(i,o),a===di))break;Array.isArray(a)?n.push.apply(n,a):n.push(a)}if(!this._do_not_flush){for(;a=this._encoder.handler(i,i.read()),a!==di;)Array.isArray(a)?n.push.apply(n,a):n.push(a);this._encoder=null}return new Uint8Array(n)};function w0e(e){var t=e.fatal,r=0,i=0,n=0,a=128,o=191;this.handler=function(s,u){if(u===Rr&&n!==0)return n=0,Cr(t);if(u===Rr)return di;if(n===0){if(er(u,0,127))return u;if(er(u,194,223))n=1,r=u&31;else if(er(u,224,239))u===224&&(a=160),u===237&&(o=159),n=2,r=u&15;else if(er(u,240,244))u===240&&(a=144),u===244&&(o=143),n=3,r=u&7;else return Cr(t);return null}if(!er(u,a,o))return r=n=i=0,a=128,o=191,s.prepend(u),Cr(t);if(a=128,o=191,r=r<<6|u&63,i+=1,i!==n)return null;var l=r;return r=n=i=0,l}}function E0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;var n,a;er(i,128,2047)?(n=1,a=192):er(i,2048,65535)?(n=2,a=224):er(i,65536,1114111)&&(n=3,a=240);for(var o=[(i>>6*n)+a];n>0;){var s=i>>6*(n-1);o.push(128|s&63),n-=1}return o}}Ja["UTF-8"]=function(e){return new E0e(e)};Qa["UTF-8"]=function(e){return new w0e(e)};function S0e(e,t){var r=t.fatal;this.handler=function(i,n){if(n===Rr)return di;if(No(n))return n;var a=e[n-128];return a===null?Cr(r):a}}function T0e(e,t){var r=t.fatal;this.handler=function(i,n){if(n===Rr)return di;if(qo(n))return n;var a=jp(n,e);return a===null&&Bs(n),a+128}}(function(){"encoding-indexes"in global&&v4.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(t){var r=t.name,i=Fa(r.toLowerCase());Qa[r]=function(n){return new S0e(i,n)},Ja[r]=function(n){return new T0e(i,n)}})})})();Qa.GBK=function(e){return new b4(e)};Ja.GBK=function(e){return new _4(e,!0)};function b4(e){var t=e.fatal,r=0,i=0,n=0;this.handler=function(a,o){if(o===Rr&&r===0&&i===0&&n===0)return di;o===Rr&&(r!==0||i!==0||n!==0)&&(r=0,i=0,n=0,Cr(t));var s;if(n!==0){s=null,er(o,48,57)&&(s=y0e((((r-129)*10+i-48)*126+n-129)*10+o-48));var u=[i,n,o];return r=0,i=0,n=0,s===null?(a.prepend(u),Cr(t)):s}if(i!==0)return er(o,129,254)?(n=o,null):(a.prepend([i,o]),r=0,i=0,Cr(t));if(r!==0){if(er(o,48,57))return i=o,null;var l=r,c=null;r=0;var f=o<127?64:65;return(er(o,64,126)||er(o,128,254))&&(c=(l-129)*190+(o-f)),s=c===null?null:Lp(c,Fa("gb18030")),s===null&&No(o)&&a.prepend(o),s===null?Cr(t):s}return No(o)?o:o===128?8364:er(o,129,254)?(r=o,null):Cr(t)}}function _4(e,t){var r=e.fatal;this.handler=function(i,n){if(n===Rr)return di;if(qo(n))return n;if(n===58853)return Bs(n);if(t&&n===8364)return 128;var a=jp(n,Fa("gb18030"));if(a!==null){var o=Pl(a/190)+129,s=a%190,u=s<63?64:65;return[o,s+u]}if(t)return Bs(n);a=b0e(n);var l=Pl(a/10/126/10);a=a-l*10*126*10;var c=Pl(a/10/126);a=a-c*10*126;var f=Pl(a/10),h=a-f*10;return[l+129,c+48,f+129,h+48]}}Ja.gb18030=function(e){return new _4(e)};Qa.gb18030=function(e){return new b4(e)};function A0e(e){var t=e.fatal,r=0;this.handler=function(i,n){if(n===Rr&&r!==0)return r=0,Cr(t);if(n===Rr&&r===0)return di;if(r!==0){var a=r,o=null;r=0;var s=n<127?64:98;switch((er(n,64,126)||er(n,161,254))&&(o=(a-129)*157+(n-s)),o){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var u=o===null?null:Lp(o,Fa("big5"));return u===null&&No(n)&&i.prepend(n),u===null?Cr(t):u}return No(n)?n:er(n,129,254)?(r=n,null):Cr(t)}}function k0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;var n=x0e(i);if(n===null)return Bs(i);var a=Pl(n/157)+129;if(a<161)return Bs(i);var o=n%157,s=o<63?64:98;return[a,o+s]}}Ja.Big5=function(e){return new k0e(e)};Qa.Big5=function(e){return new A0e(e)};function R0e(e){var t=e.fatal,r=!1,i=0;this.handler=function(n,a){if(a===Rr&&i!==0)return i=0,Cr(t);if(a===Rr&&i===0)return di;if(i===142&&er(a,161,223))return i=0,65377-161+a;if(i===143&&er(a,161,254))return r=!0,i=a,null;if(i!==0){var o=i;i=0;var s=null;return er(o,161,254)&&er(a,161,254)&&(s=Lp((o-161)*94+(a-161),Fa(r?"jis0212":"jis0208"))),r=!1,er(a,161,254)||n.prepend(a),s===null?Cr(t):s}return No(a)?a:a===142||a===143||er(a,161,254)?(i=a,null):Cr(t)}}function C0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;if(i===165)return 92;if(i===8254)return 126;if(er(i,65377,65439))return[142,i-65377+161];i===8722&&(i=65293);var n=jp(i,Fa("jis0208"));if(n===null)return Bs(i);var a=Pl(n/94)+161,o=n%94+161;return[a,o]}}Ja["EUC-JP"]=function(e){return new C0e(e)};Qa["EUC-JP"]=function(e){return new R0e(e)};function I0e(e){var t=e.fatal,r={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},i=r.ASCII,n=r.ASCII,a=0,o=!1;this.handler=function(s,u){switch(i){default:case r.ASCII:return u===27?(i=r.EscapeStart,null):er(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===Rr?di:(o=!1,Cr(t));case r.Roman:return u===27?(i=r.EscapeStart,null):u===92?(o=!1,165):u===126?(o=!1,8254):er(u,0,127)&&u!==14&&u!==15&&u!==27&&u!==92&&u!==126?(o=!1,u):u===Rr?di:(o=!1,Cr(t));case r.Katakana:return u===27?(i=r.EscapeStart,null):er(u,33,95)?(o=!1,65377-33+u):u===Rr?di:(o=!1,Cr(t));case r.LeadByte:return u===27?(i=r.EscapeStart,null):er(u,33,126)?(o=!1,a=u,i=r.TrailByte,null):u===Rr?di:(o=!1,Cr(t));case r.TrailByte:if(u===27)return i=r.EscapeStart,Cr(t);if(er(u,33,126)){i=r.LeadByte;var l=(a-33)*94+u-33,c=Lp(l,Fa("jis0208"));return c===null?Cr(t):c}return u===Rr?(i=r.LeadByte,s.prepend(u),Cr(t)):(i=r.LeadByte,Cr(t));case r.EscapeStart:return u===36||u===40?(a=u,i=r.Escape,null):(s.prepend(u),o=!1,i=n,Cr(t));case r.Escape:var f=a;a=0;var h=null;if(f===40&&u===66&&(h=r.ASCII),f===40&&u===74&&(h=r.Roman),f===40&&u===73&&(h=r.Katakana),f===36&&(u===64||u===66)&&(h=r.LeadByte),h!==null){i=i=h;var d=o;return o=!0,d?Cr(t):null}return s.prepend([f,u]),o=!1,i=n,Cr(t)}}}function P0e(e){var t=e.fatal,r={ASCII:0,Roman:1,jis0208:2},i=r.ASCII;this.handler=function(n,a){if(a===Rr&&i!==r.ASCII)return n.prepend(a),i=r.ASCII,[27,40,66];if(a===Rr&&i===r.ASCII)return di;if((i===r.ASCII||i===r.Roman)&&(a===14||a===15||a===27))return Bs(65533);if(i===r.ASCII&&qo(a))return a;if(i===r.Roman&&(qo(a)&&a!==92&&a!==126||a==165||a==8254)){if(qo(a))return a;if(a===165)return 92;if(a===8254)return 126}if(qo(a)&&i!==r.ASCII)return n.prepend(a),i=r.ASCII,[27,40,66];if((a===165||a===8254)&&i!==r.Roman)return n.prepend(a),i=r.Roman,[27,40,74];a===8722&&(a=65293);var o=jp(a,Fa("jis0208"));if(o===null)return Bs(a);if(i!==r.jis0208)return n.prepend(a),i=r.jis0208,[27,36,66];var s=Pl(o/94)+33,u=o%94+33;return[s,u]}}Ja["ISO-2022-JP"]=function(e){return new P0e(e)};Qa["ISO-2022-JP"]=function(e){return new I0e(e)};function B0e(e){var t=e.fatal,r=0;this.handler=function(i,n){if(n===Rr&&r!==0)return r=0,Cr(t);if(n===Rr&&r===0)return di;if(r!==0){var a=r,o=null;r=0;var s=n<127?64:65,u=a<160?129:193;if((er(n,64,126)||er(n,128,252))&&(o=(a-u)*188+n-s),er(o,8836,10715))return 57344-8836+o;var l=o===null?null:Lp(o,Fa("jis0208"));return l===null&&No(n)&&i.prepend(n),l===null?Cr(t):l}return No(n)||n===128?n:er(n,161,223)?65377-161+n:er(n,129,159)||er(n,224,252)?(r=n,null):Cr(t)}}function O0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i)||i===128)return i;if(i===165)return 92;if(i===8254)return 126;if(er(i,65377,65439))return i-65377+161;i===8722&&(i=65293);var n=_0e(i);if(n===null)return Bs(i);var a=Pl(n/188),o=a<31?129:193,s=n%188,u=s<63?64:65;return[a+o,s+u]}}Ja.Shift_JIS=function(e){return new O0e(e)};Qa.Shift_JIS=function(e){return new B0e(e)};function F0e(e){var t=e.fatal,r=0;this.handler=function(i,n){if(n===Rr&&r!==0)return r=0,Cr(t);if(n===Rr&&r===0)return di;if(r!==0){var a=r,o=null;r=0,er(n,65,254)&&(o=(a-129)*190+(n-65));var s=o===null?null:Lp(o,Fa("euc-kr"));return o===null&&No(n)&&i.prepend(n),s===null?Cr(t):s}return No(n)?n:er(n,129,254)?(r=n,null):Cr(t)}}function D0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;var n=jp(i,Fa("euc-kr"));if(n===null)return Bs(i);var a=Pl(n/190)+129,o=n%190+65;return[a,o]}}Ja["EUC-KR"]=function(e){return new D0e(e)};Qa["EUC-KR"]=function(e){return new F0e(e)};function D_(e,t){var r=e>>8,i=e&255;return t?[r,i]:[i,r]}function x4(e,t){var r=t.fatal,i=null,n=null;this.handler=function(a,o){if(o===Rr&&(i!==null||n!==null))return Cr(r);if(o===Rr&&i===null&&n===null)return di;if(i===null)return i=o,null;var s;if(e?s=(i<<8)+o:s=(o<<8)+i,i=null,n!==null){var u=n;return n=null,er(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(a.prepend(D_(s,e)),Cr(r))}return er(s,55296,56319)?(n=s,null):er(s,56320,57343)?Cr(r):s}}function w4(e,t){var r=t.fatal;this.handler=function(i,n){if(n===Rr)return di;if(er(n,0,65535))return D_(n,e);var a=D_((n-65536>>10)+55296,e),o=D_((n-65536&1023)+56320,e);return a.concat(o)}}Ja["UTF-16BE"]=function(e){return new w4(!0,e)};Qa["UTF-16BE"]=function(e){return new x4(!0,e)};Ja["UTF-16LE"]=function(e){return new w4(!1,e)};Qa["UTF-16LE"]=function(e){return new x4(!1,e)};function M0e(e){var t=e.fatal;this.handler=function(r,i){return i===Rr?di:No(i)?i:63360+i-128}}function L0e(e){var t=e.fatal;this.handler=function(r,i){return i===Rr?di:qo(i)?i:er(i,63360,63487)?i-63360+128:Bs(i)}}Ja["x-user-defined"]=function(e){return new L0e(e)};Qa["x-user-defined"]=function(e){return new M0e(e)};var j0e="rejected",N0e="fulfilled";function E4(e){let t=e.map(r=>r.then(i=>({status:N0e,value:i})).catch(i=>({status:j0e,reason:i})));return Promise.all(t)}function M_(e){return Buffer.from(e).toString("base64")}function Ck(e){return Buffer.from(e,"base64").toString("ascii")}var Uo=class{constructor(t){this.map={},t instanceof Uo?t.forEach((r,i)=>this.append(i,r)):Array.isArray(t)?t.forEach(r=>this.append(r[0],r[1])):t&&Object.getOwnPropertyNames(t).forEach(r=>this.append(r,t[r]))}append(t,r){t=nv(t),r=S4(r);let i=this.map[t];this.map[t]=i?`${i}, ${r}`:r}delete(t){delete this.map[nv(t)]}get(t){return t=nv(t),this.has(t)?this.map[t]:null}has(t){return this.map.hasOwnProperty(nv(t))}set(t,r){this.map[nv(t)]=S4(r)}forEach(t,r=null){for(let i in this.map)this.map.hasOwnProperty(i)&&(r?t.call(r,this.map[i],i,this):t(this.map[i],i,this))}keys(){let t=[];return this.forEach(function(r,i){t.push(i)}),Ik(t)}values(){let t=[];return this.forEach(function(r){t.push(r)}),Ik(t)}entries(){let t=[];return this.forEach(function(r,i){t.push([i,r])}),Ik(t)}*[Symbol.iterator](){yield*this.entries()}};function nv(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||e==="")throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function S4(e){return typeof e!="string"&&(e=String(e)),e}function Ik(e){let t={next(){let r=e.shift();return{done:r===void 0,value:r}}};return t[Symbol.iterator]=function(){return t},t}function Pk(e,t){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${t}`)}var L_=Fe(require("zlib"));var q0e=e=>e&&e instanceof ArrayBuffer,U0e=e=>e&&e instanceof Buffer;function T4(e){let t=e.indexOf(","),r,i;return e.slice(t-7,t)===";base64"?(r=Buffer.from(e.slice(t+1),"base64"),i=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),i=e.slice(5,t).trim()),i?i.startsWith(";")&&(i=`text/plain${i}`):i="text/plain;charset=US-ASCII",{arrayBuffer:Bk(r),mimeType:i}}function Bk(e){if(q0e(e))return e;if(U0e(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}function A4(e,t){switch(t.get("content-encoding")){case"br":return e.pipe(L_.default.createBrotliDecompress());case"gzip":return e.pipe(L_.default.createGunzip());case"deflate":return e.pipe(L_.default.createDeflate());default:return e}}async function k4(e){let t=[];return await new Promise((r,i)=>{e.on("error",n=>i(n)),e.on("readable",()=>e.read()),e.on("data",n=>{typeof n=="string"&&i(new Error("Read stream not binary")),t.push(Bk(n))}),e.on("end",()=>{let n=G0e(t);r(n)})})}function G0e(e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),i=new Uint8Array(r),n=0;for(let a of t)i.set(a,n),n+=a.byteLength;return i.buffer}var Fk=Fe(require("stream")),z0e=e=>typeof e=="boolean",R4=e=>typeof e=="function",H0e=e=>e!==null&&typeof e=="object",Ok=e=>H0e(e)&&R4(e.read)&&R4(e.pipe)&&z0e(e.readable),Os=class{constructor(t,r){this.bodyUsed=!1;let{headers:i,status:n=200,statusText:a="OK",url:o}=r||{};this.url=o,this.ok=n===200,this.status=n,this.statusText=a,this.headers=new Uo((r==null?void 0:r.headers)||{}),Ok(t)?this._body=A4(t,i):typeof t=="string"?this._body=Fk.Readable.from([new TextEncoder().encode(t)]):this._body=Fk.Readable.from([t||new ArrayBuffer(0)])}get body(){return Pk(!this.bodyUsed),Pk(Ok(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return Ok(this._body)?await k4(this._body):this._body||new ArrayBuffer(0)}async text(){let t=await this.arrayBuffer();return new TextDecoder().decode(t)}async json(){let t=await this.text();return JSON.parse(t)}async blob(){if(typeof Blob=="undefined")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var C4=Fe(require("http")),I4=Fe(require("https"));var Dk=Fe(require("fs"));async function Mk(e,t){let r=e.split("?")[0];try{let i=await new Promise((s,u)=>{let l=Dk.default.createReadStream(r,{encoding:null});l.once("readable",()=>s(l)),l.on("error",c=>u(c))}),n=200,a="OK",o=W0e(r);return new Os(i,{headers:o,status:n,statusText:a,url:e})}catch(i){let n=400,a=i.message,o={};return new Os(i.message,{headers:o,status:n,statusText:a,url:e})}}function W0e(e){let t={};if(!t["content-length"]){let r=Dk.default.statSync(e);t["content-length"]=r.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip"),new Uo(t)}var Lk=e=>e.startsWith("data:"),V0e=e=>e.startsWith("http:")||e.startsWith("https:");async function av(e,t){try{if(!V0e(e)&&!Lk(e))return await Mk(e,t);if(Lk(e)){let{arrayBuffer:l,mimeType:c}=T4(e);return new Os(l,{headers:{"content-type":c},url:e})}let r={},i=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");let n=await K0e(i,t),a=J0e(e,n,r),{status:o,statusText:s}=$0e(n),u=!t||t.followRedirect||t.followRedirect===void 0;if(o>=300&&o<400&&a.has("location")&&u){let l=Y0e(e,a.get("location"));return await av(l,t)}return new Os(n,{headers:a,status:o,statusText:s,url:e})}catch(r){return new Os(null,{status:400,statusText:String(r),url:e})}}async function K0e(e,t){return await new Promise((r,i)=>{let n=X0e(e,t),a=e.startsWith("https:")?I4.default.request(n,o=>r(o)):C4.default.request(n,o=>r(o));a.on("error",o=>i(o)),a.end()})}function Y0e(e,t){if(t.startsWith("http"))return t;let r=new URL(e);return r.pathname=t,r.href}function X0e(e,t){let r=(t==null?void 0:t.headers)||{},i={};for(let a of Object.keys(r))i[a.toLowerCase()]=r[a];i["accept-encoding"]=i["accept-encoding"]||"gzip,br,deflate";let n=new URL(e);return Ye(ne(ne({hostname:n.hostname,path:n.pathname,method:"GET"},t),t==null?void 0:t.fetch),{headers:i,port:n.port})}function $0e(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function J0e(e,t,r={}){let i={};if(t&&t.headers){let n=t.headers;for(let a in n){let o=n[a];i[a.toLowerCase()]=String(o)}}if(!i["content-length"]){let n=Q0e(e);Number.isFinite(n)&&(i["content-length"]=n)}return Object.assign(i,r),new Uo(i)}function Q0e(e){return Lk(e)?e.length-"data:".length:null}var T9=Fe(E9()),A9=Fe(dv());function S9(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function h1e(e,t){let r=t.type?t.type.replace("image/",""):"jpeg",i=(0,A9.default)(e.data,[e.width,e.height,4],[4,e.width*4,1],0);return(0,T9.default)(i,r,t)}function MR(e,t){let r=h1e(e,t);return new Promise(i=>{let n=[];r.on("data",a=>n.push(a)),r.on("end",()=>{let a=Buffer.concat(n);i(S9(a))})})}var aY=Fe(nY()),oY=["image/png","image/jpeg","image/gif"];async function qI(e,t){if(!t)throw new Error("MIMEType is required to parse image under Node.js");let r=e instanceof Buffer?e:Buffer.from(e);return await SCe(r,t)}function SCe(e,t){return new Promise(r=>(0,aY.default)(e,t,(i,n)=>{if(i)throw i;let a=[...n.shape],o=n.shape.length===4?n.shape.shift():1,s=n.data instanceof Buffer?new Uint8Array(n.data):n.data;r({shape:a,data:s,width:n.shape[0],height:n.shape[1],components:n.shape[2],layers:o?[o]:[]})}))}var lY=Fe(uY());delete global.ReadableStream;var ly=class extends lY.ReadableStream{};var UI=class{constructor(t){this.isWorking=!1;this.isCancelled=!1;this.chunks=t}start(t){this.work(t)}async work(t){let{chunks:r}=this;for(this.isWorking=!0;!this.isCancelled&&(t.desiredSize||0)>0;){let i;try{i=r.next()}catch(n){t.error(n);break}i&&(!i.done&&!this.isCancelled?t.enqueue(i.value):t.close())}this.isWorking=!1}pull(t){this.isWorking||this.work(t)}cancel(){this.isCancelled=!0}};var GI=class extends ly{constructor(t){super(new UI(t.values()),{type:"bytes"});this._chunks=t}async*[Symbol.asyncIterator](t){let r=this.getReader();yield*this._chunks,r.releaseLock()}};var xf=class{constructor(t=[],r={}){this.parts=[],this.size=0;for(let i of t)if(typeof i=="string"){let n=new TextEncoder().encode(i);this.parts.push(n),this.size+=n.byteLength}else if(i instanceof xf)this.size+=i.size,this.parts.push(...i.parts);else if(i instanceof ArrayBuffer)this.parts.push(new Uint8Array(i)),this.size+=i.byteLength;else if(i instanceof Uint8Array)this.parts.push(i),this.size+=i.byteLength;else if(ArrayBuffer.isView(i)){let{buffer:n,byteOffset:a,byteLength:o}=i;this.parts.push(new Uint8Array(n,a,o)),this.size+=o}else{let n=new TextEncoder().encode(String(i));this.parts.push(n),this.size+=n.byteLength}this.type=TCe(r.type)}slice(t=0,r=this.size,i=""){let{size:n,parts:a}=this,o=t<0?Math.max(n+t,0):Math.min(t,n),s=r<0?Math.max(n+r,0):Math.min(r,n),u=Math.max(s-o,0),l=new xf([],{type:i});if(u===0)return l;let c=0,f=[];for(let h of a){let{byteLength:d}=h;if(o>0&&d<=o)o-=d,s-=d;else{let p=h.subarray(o,Math.min(d,s));if(f.push(p),c+=p.byteLength,o=0,c>=u)break}}return l.parts=f,l.size=c,l}async arrayBuffer(){return this._toArrayBuffer()}async text(){let t=new TextDecoder,r="";for(let i of this.parts)r+=t.decode(i);return r}stream(){return new GI(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let t=new ArrayBuffer(this.size),r=new Uint8Array(t),i=0;for(let n of this.parts)r.set(n,i),i+=n.byteLength;return t}};function TCe(e=""){let t=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(t)?"":t}var zI=class extends xf{constructor(t,r,i={}){super(t,i);this.name="";this.webkitRelativePath="";this.name=String(r).replace(/\//g,":"),this.lastModified=(i==null?void 0:i.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};var kCe=!Eu||!("TextEncoder"in mn);kCe&&(mn.TextEncoder=iv);var RCe=!Eu||!("TextDecoder"in mn);RCe&&(mn.TextDecoder=Wh);!Eu&&!("atob"in mn)&&M_&&(mn.atob=M_);!Eu&&!("btoa"in mn)&&Ck&&(mn.btoa=Ck);!Eu&&!("Headers"in mn)&&Uo&&(mn.Headers=Uo);!Eu&&!("Response"in mn)&&Os&&(mn.Response=Os);!Eu&&!("fetch"in mn)&&av&&(mn.fetch=av);!Eu&&!("_encodeImageNode"in mn)&&MR&&(mn._encodeImageNode=MR);!Eu&&!("_parseImageNode"in mn)&&qI&&(mn._parseImageNode=qI,mn._imageFormatsNode=oY);"allSettled"in Promise||(Promise.allSettled=E4);var Rge=Fe(require("path"));function Ft(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var zu={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},cY=zu.self||zu.window||zu.global||{},fY=zu.window||zu.self||zu.global||{},hY=zu.global||zu.self||zu.window||{},dY=zu.document||{};var on=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var pY=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),CCe=pY&&parseFloat(pY[1])||0;var wf="4.0.0-alpha.16";function Zn(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Hu={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},y0t=Hu.self||Hu.window||Hu.global||{},b0t=Hu.window||Hu.self||Hu.global||{},mY=Hu.global||Hu.self||Hu.window||{},_0t=Hu.document||{};var qa=typeof process!="object"||String(process)!=="[object process]"||process.browser,cy=typeof importScripts=="function",gY=typeof window!="undefined"&&typeof window.orientation!="undefined",vY=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),x0t=vY&&parseFloat(vY[1])||0;var Ow=class{constructor(t,r){this.isRunning=!0;this._resolve=()=>{};this._reject=()=>{};this.name=t,this.workerThread=r,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){Zn(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Zn(this.isRunning),this.isRunning=!1,this._reject(t)}};var Rm={};mo(Rm,{NodeWorker:()=>fy});var yY=Fe(require("worker_threads"));rv(Rm,Fe(require("worker_threads")));var fy=yY.Worker;var HI=new Map;function bY(e){Zn(e.source&&!e.url||!e.source&&e.url);let t=HI.get(e.source||e.url);return t||(e.url&&(t=ICe(e.url),HI.set(e.url,t)),e.source&&(t=_Y(e.source),HI.set(e.source,t))),Zn(t),t}function ICe(e){if(!e.startsWith("http"))return e;let t=PCe(e);return _Y(t)}function _Y(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function PCe(e){return`try {
117
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function Hut(e,t){if(!!e){if(typeof e=="string")return Ame(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ame(e,t)}}function Ame(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var Wut=Tme.default.mark(kme),Vut=10,Kut=65535;function Yut(e,t){var r=kme(e),i=r.next();if(i.done||i.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");var n=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",l="UNKNOWN",c=0,f=0,h=null,d=null;do{i=r.next();var p=i.value.line;if(!!p.length)if(p[0]==="#"){var y=p.split(" "),g=y[0],b=y[1];if(g!=="#"||!b)continue;var E=y.length>2?y.slice(2):[];if(b==="Description")u=E.join(" ");else if(b==="DateTime")l=E.join(" ");else if(b==="Offset"){if(!y[2])throw new Error("Geoid model file: Error reading offset");n=parseInt(y[2],10)}else if(b==="Scale"){if(!y[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(y[2])}else b===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(y[2]))&&(o=parseFloat(y[2])):b===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(y[2]))&&(s=parseFloat(y[2]))}else{var A=p.split(" ");if(A=A.filter(function(C){return C!==""}),c=parseInt(A[0],10),f=parseInt(A[1],10),!(c&&f))throw new Error("Geoid model file: Error reading raster size");break}}while(!i.done);i=r.next();var k=parseInt(i.value.line,10);if(i.done)throw new Error("Geoid model file: Error reading maxval");if(k!==Kut)throw new Error("Geoid model file: Incorrect value of maxval");if(h=i.value.offset,d=c,n===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(a===0)throw new Error("Geoid model file: Scale not set");if(a<0)throw new Error("Geoid model file: Scale must be positive");if(f<2||c<2)throw new Error("Geoid model file: Raster size too small");if(c&1)throw new Error("Geoid model file: Raster width is odd");if(!(f&1))throw new Error("Geoid model file: Raster height is even");var R=c/360,F=(f-1)/180;return new Gut.default({cubic:t.cubic,_width:c,_height:f,_rlonres:R,_rlatres:F,_offset:n,_scale:a,_swidth:d,_datastart:h,_maxerror:o,_rmserror:s,_description:u,_datetime:l,data:e})}function kme(e){var t,r,i,n;return Tme.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:t=0;case 1:if(r=e.indexOf(Vut,t),r===-1){o.next=9;break}return i=e.subarray(t,r),t=r+1,o.next=7,{offset:t,line:Rme(i)};case 7:o.next=13;break;case 9:return n=e.subarray(t,e.length),t=e.length,o.next=13,{offset:t,line:Rme(n)};case 13:if(t<e.length){o.next=1;break}case 14:return o.abrupt("return",{offset:t,line:""});case 15:case"end":return o.stop()}},Wut)}function Rme(e){var t="",r=zut(e),i;try{for(r.s();!(i=r.n()).done;){var n=i.value;t+=String.fromCharCode(n)}}catch(a){r.e(a)}finally{r.f()}return t}});var Ime=T(ik=>{"use strict";var Xut=ti();Object.defineProperty(ik,"__esModule",{value:!0});Object.defineProperty(ik,"parsePGM",{enumerable:!0,get:function(){return $ut.parsePGM}});Object.defineProperty(ik,"Geoid",{enumerable:!0,get:function(){return Jut.default}});var $ut=Cme(),Jut=Xut(S6())});var Vme=T(uk=>{"use strict";Object.defineProperty(uk,"__esModule",{value:!0});uk.default=void 0;var klt={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,FUNC_ADD:32774,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,BLEND_COLOR:32773,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,VENDOR:7936,RENDERER:7937,VERSION:7938,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,BROWSER_DEFAULT_WEBGL:37444,STATIC_DRAW:35044,STREAM_DRAW:35040,DYNAMIC_DRAW:35048,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,CULL_FACE:2884,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,BLEND:3042,DEPTH_TEST:2929,DITHER:3024,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,SCISSOR_TEST:3089,STENCIL_TEST:2960,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CONTEXT_LOST_WEBGL:37442,CW:2304,CCW:2305,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,COMPILE_STATUS:35713,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_ATTRIBUTES:35721,ACTIVE_UNIFORMS:35718,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,ALWAYS:519,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,GEQUAL:518,NOTEQUAL:517,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,TEXTURE_WIDTH:4096,TEXTURE_HEIGHT:4097,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,MAX_3D_TEXTURE_SIZE:32883,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,MAX_TEXTURE_LOD_BIAS:34045,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,RASTERIZER_DISCARD:35977,VERTEX_ARRAY_BINDING:34229,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,MAX_ELEMENT_INDEX:36203,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,RGB9_E5:35901,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2UI:36975,TEXTURE_IMMUTABLE_FORMAT:37167,TEXTURE_IMMUTABLE_LEVELS:33503,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,UNSIGNED_INT_24_8:34042,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,INT_2_10_10_10_REV:36255,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,MAX_SAMPLES:36183,SAMPLER_BINDING:35097,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,UNSIGNED_NORMALIZED:35863,SIGNED_NORMALIZED:36764,VERTEX_ATTRIB_ARRAY_INTEGER:35069,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,DEPTH24_STENCIL8:35056,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,COLOR:6144,DEPTH:6145,STENCIL:6146,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,INVALID_INDEX:4294967295,TIMEOUT_IGNORED:-1,MAX_CLIENT_WAIT_TIMEOUT_WEBGL:37447,VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,UNMASKED_VENDOR_WEBGL:37445,UNMASKED_RENDERER_WEBGL:37446,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047,TEXTURE_MAX_ANISOTROPY_EXT:34046,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35986,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,UNSIGNED_INT_24_8_WEBGL:34042,HALF_FLOAT_OES:36193,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863,MIN_EXT:32775,MAX_EXT:32776,SRGB_EXT:35904,SRGB_ALPHA_EXT:35906,SRGB8_ALPHA8_EXT:35907,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:33296,FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723,COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067,COLOR_ATTACHMENT4_WEBGL:36068,COLOR_ATTACHMENT5_WEBGL:36069,COLOR_ATTACHMENT6_WEBGL:36070,COLOR_ATTACHMENT7_WEBGL:36071,COLOR_ATTACHMENT8_WEBGL:36072,COLOR_ATTACHMENT9_WEBGL:36073,COLOR_ATTACHMENT10_WEBGL:36074,COLOR_ATTACHMENT11_WEBGL:36075,COLOR_ATTACHMENT12_WEBGL:36076,COLOR_ATTACHMENT13_WEBGL:36077,COLOR_ATTACHMENT14_WEBGL:36078,COLOR_ATTACHMENT15_WEBGL:36079,DRAW_BUFFER0_WEBGL:34853,DRAW_BUFFER1_WEBGL:34854,DRAW_BUFFER2_WEBGL:34855,DRAW_BUFFER3_WEBGL:34856,DRAW_BUFFER4_WEBGL:34857,DRAW_BUFFER5_WEBGL:34858,DRAW_BUFFER6_WEBGL:34859,DRAW_BUFFER7_WEBGL:34860,DRAW_BUFFER8_WEBGL:34861,DRAW_BUFFER9_WEBGL:34862,DRAW_BUFFER10_WEBGL:34863,DRAW_BUFFER11_WEBGL:34864,DRAW_BUFFER12_WEBGL:34865,DRAW_BUFFER13_WEBGL:34866,DRAW_BUFFER14_WEBGL:34867,DRAW_BUFFER15_WEBGL:34868,MAX_COLOR_ATTACHMENTS_WEBGL:36063,MAX_DRAW_BUFFERS_WEBGL:34852,VERTEX_ARRAY_BINDING_OES:34229,QUERY_COUNTER_BITS_EXT:34916,CURRENT_QUERY_EXT:34917,QUERY_RESULT_EXT:34918,QUERY_RESULT_AVAILABLE_EXT:34919,TIME_ELAPSED_EXT:35007,TIMESTAMP_EXT:36392,GPU_DISJOINT_EXT:36795};uk.default=klt});var Eu=typeof process!="object"||String(process)!=="[object process]"||process.browser,Ek={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global},mn=Ek.global||Ek.self||Ek.window;var g4={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]};global["encoding-indexes"]=g4||{};function er(e,t,r){return t<=e&&e<=r}function d0e(e,t){return e.indexOf(t)!==-1}var Pl=Math.floor;function F_(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function p0e(e){for(var t=String(e),r=t.length,i=0,n=[];i<r;){var a=t.charCodeAt(i);if(a<55296||a>57343)n.push(a);else if(56320<=a&&a<=57343)n.push(65533);else if(55296<=a&&a<=56319)if(i===r-1)n.push(65533);else{var o=t.charCodeAt(i+1);if(56320<=o&&o<=57343){var s=a&1023,u=o&1023;n.push(65536+(s<<10)+u),i+=1}else n.push(65533)}i+=1}return n}function m0e(e){for(var t="",r=0;r<e.length;++r){var i=e[r];i<=65535?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode((i>>10)+55296,(i&1023)+56320))}return t}function No(e){return 0<=e&&e<=127}var qo=No,Rr=-1;function Sk(e){this.tokens=[].slice.call(e),this.tokens.reverse()}Sk.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():Rr},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};var di=-1;function Cr(e,t){if(e)throw TypeError("Decoder error");return t||65533}function Bs(e){throw TypeError("The code point "+e+" could not be encoded.")}function g0e(){}g0e.prototype={handler:function(e,t){}};function v0e(){}v0e.prototype={handler:function(e,t){}};function Tk(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(Ak,e)?Ak[e]:null}var v4=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],Ak={};v4.forEach(function(e){e.encodings.forEach(function(t){t.labels.forEach(function(r){Ak[r]=t})})});var Ja={},Qa={};function Lp(e,t){return t&&t[e]||null}function jp(e,t){var r=t.indexOf(e);return r===-1?null:r}function Fa(e){if(!("encoding-indexes"in global))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return global["encoding-indexes"][e]}function y0e(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var t=0,r=0,i=Fa("gb18030-ranges"),n;for(n=0;n<i.length;++n){var a=i[n];if(a[0]<=e)t=a[0],r=a[1];else break}return r+e-t}function b0e(e){if(e===59335)return 7457;var t=0,r=0,i=Fa("gb18030-ranges"),n;for(n=0;n<i.length;++n){var a=i[n];if(a[1]<=e)t=a[1],r=a[0];else break}return r+e-t}function _0e(e){kk=kk||Fa("jis0208").map(function(r,i){return er(i,8272,8835)?null:r});var t=kk;return t.indexOf(e)}var kk;function x0e(e){Rk=Rk||Fa("big5").map(function(r,i){return i<(161-129)*157?null:r});var t=Rk;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?t.lastIndexOf(e):jp(e,t)}var Rk,y4="utf-8";function Wh(e,t){if(!(this instanceof Wh))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):y4,t=F_(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=Tk(e);if(r===null||r.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Qa[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");var i=this;return i._encoding=r,Boolean(t.fatal)&&(i._error_mode="fatal"),Boolean(t.ignoreBOM)&&(i._ignoreBOM=!0),Object.defineProperty||(this.encoding=i._encoding.name.toLowerCase(),this.fatal=i._error_mode==="fatal",this.ignoreBOM=i._ignoreBOM),i}Object.defineProperty&&(Object.defineProperty(Wh.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(Wh.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(Wh.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));Wh.prototype.decode=function(t,r){var i;typeof t=="object"&&t instanceof ArrayBuffer?i=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):i=new Uint8Array(0),r=F_(r),this._do_not_flush||(this._decoder=Qa[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(r.stream);for(var n=new Sk(i),a=[],o;;){var s=n.read();if(s===Rr||(o=this._decoder.handler(n,s),o===di))break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(n,n.read()),o===di)break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}while(!n.endOfStream());this._decoder=null}function u(l){return d0e(["UTF-8","UTF-16LE","UTF-16BE"],this._encoding.name)&&!this._ignoreBOM&&!this._BOMseen&&(l.length>0&&l[0]===65279?(this._BOMseen=!0,l.shift()):l.length>0&&(this._BOMseen=!0)),m0e(l)}return u.call(this,a)};function iv(e,t){if(!(this instanceof iv))throw TypeError("Called as a function. Did you forget 'new'?");t=F_(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";var r=this;if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){e=e!==void 0?String(e):y4;var i=Tk(e);if(i===null||i.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Ja[i.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");r._encoding=i}else r._encoding=Tk("utf-8"),e!==void 0&&"console"in global&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=r._encoding.name.toLowerCase()),r}Object.defineProperty&&Object.defineProperty(iv.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});iv.prototype.encode=function(t,r){t=t===void 0?"":String(t),r=F_(r),this._do_not_flush||(this._encoder=Ja[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(r.stream);for(var i=new Sk(p0e(t)),n=[],a;;){var o=i.read();if(o===Rr||(a=this._encoder.handler(i,o),a===di))break;Array.isArray(a)?n.push.apply(n,a):n.push(a)}if(!this._do_not_flush){for(;a=this._encoder.handler(i,i.read()),a!==di;)Array.isArray(a)?n.push.apply(n,a):n.push(a);this._encoder=null}return new Uint8Array(n)};function w0e(e){var t=e.fatal,r=0,i=0,n=0,a=128,o=191;this.handler=function(s,u){if(u===Rr&&n!==0)return n=0,Cr(t);if(u===Rr)return di;if(n===0){if(er(u,0,127))return u;if(er(u,194,223))n=1,r=u&31;else if(er(u,224,239))u===224&&(a=160),u===237&&(o=159),n=2,r=u&15;else if(er(u,240,244))u===240&&(a=144),u===244&&(o=143),n=3,r=u&7;else return Cr(t);return null}if(!er(u,a,o))return r=n=i=0,a=128,o=191,s.prepend(u),Cr(t);if(a=128,o=191,r=r<<6|u&63,i+=1,i!==n)return null;var l=r;return r=n=i=0,l}}function E0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;var n,a;er(i,128,2047)?(n=1,a=192):er(i,2048,65535)?(n=2,a=224):er(i,65536,1114111)&&(n=3,a=240);for(var o=[(i>>6*n)+a];n>0;){var s=i>>6*(n-1);o.push(128|s&63),n-=1}return o}}Ja["UTF-8"]=function(e){return new E0e(e)};Qa["UTF-8"]=function(e){return new w0e(e)};function S0e(e,t){var r=t.fatal;this.handler=function(i,n){if(n===Rr)return di;if(No(n))return n;var a=e[n-128];return a===null?Cr(r):a}}function T0e(e,t){var r=t.fatal;this.handler=function(i,n){if(n===Rr)return di;if(qo(n))return n;var a=jp(n,e);return a===null&&Bs(n),a+128}}(function(){"encoding-indexes"in global&&v4.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(t){var r=t.name,i=Fa(r.toLowerCase());Qa[r]=function(n){return new S0e(i,n)},Ja[r]=function(n){return new T0e(i,n)}})})})();Qa.GBK=function(e){return new b4(e)};Ja.GBK=function(e){return new _4(e,!0)};function b4(e){var t=e.fatal,r=0,i=0,n=0;this.handler=function(a,o){if(o===Rr&&r===0&&i===0&&n===0)return di;o===Rr&&(r!==0||i!==0||n!==0)&&(r=0,i=0,n=0,Cr(t));var s;if(n!==0){s=null,er(o,48,57)&&(s=y0e((((r-129)*10+i-48)*126+n-129)*10+o-48));var u=[i,n,o];return r=0,i=0,n=0,s===null?(a.prepend(u),Cr(t)):s}if(i!==0)return er(o,129,254)?(n=o,null):(a.prepend([i,o]),r=0,i=0,Cr(t));if(r!==0){if(er(o,48,57))return i=o,null;var l=r,c=null;r=0;var f=o<127?64:65;return(er(o,64,126)||er(o,128,254))&&(c=(l-129)*190+(o-f)),s=c===null?null:Lp(c,Fa("gb18030")),s===null&&No(o)&&a.prepend(o),s===null?Cr(t):s}return No(o)?o:o===128?8364:er(o,129,254)?(r=o,null):Cr(t)}}function _4(e,t){var r=e.fatal;this.handler=function(i,n){if(n===Rr)return di;if(qo(n))return n;if(n===58853)return Bs(n);if(t&&n===8364)return 128;var a=jp(n,Fa("gb18030"));if(a!==null){var o=Pl(a/190)+129,s=a%190,u=s<63?64:65;return[o,s+u]}if(t)return Bs(n);a=b0e(n);var l=Pl(a/10/126/10);a=a-l*10*126*10;var c=Pl(a/10/126);a=a-c*10*126;var f=Pl(a/10),h=a-f*10;return[l+129,c+48,f+129,h+48]}}Ja.gb18030=function(e){return new _4(e)};Qa.gb18030=function(e){return new b4(e)};function A0e(e){var t=e.fatal,r=0;this.handler=function(i,n){if(n===Rr&&r!==0)return r=0,Cr(t);if(n===Rr&&r===0)return di;if(r!==0){var a=r,o=null;r=0;var s=n<127?64:98;switch((er(n,64,126)||er(n,161,254))&&(o=(a-129)*157+(n-s)),o){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var u=o===null?null:Lp(o,Fa("big5"));return u===null&&No(n)&&i.prepend(n),u===null?Cr(t):u}return No(n)?n:er(n,129,254)?(r=n,null):Cr(t)}}function k0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;var n=x0e(i);if(n===null)return Bs(i);var a=Pl(n/157)+129;if(a<161)return Bs(i);var o=n%157,s=o<63?64:98;return[a,o+s]}}Ja.Big5=function(e){return new k0e(e)};Qa.Big5=function(e){return new A0e(e)};function R0e(e){var t=e.fatal,r=!1,i=0;this.handler=function(n,a){if(a===Rr&&i!==0)return i=0,Cr(t);if(a===Rr&&i===0)return di;if(i===142&&er(a,161,223))return i=0,65377-161+a;if(i===143&&er(a,161,254))return r=!0,i=a,null;if(i!==0){var o=i;i=0;var s=null;return er(o,161,254)&&er(a,161,254)&&(s=Lp((o-161)*94+(a-161),Fa(r?"jis0212":"jis0208"))),r=!1,er(a,161,254)||n.prepend(a),s===null?Cr(t):s}return No(a)?a:a===142||a===143||er(a,161,254)?(i=a,null):Cr(t)}}function C0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;if(i===165)return 92;if(i===8254)return 126;if(er(i,65377,65439))return[142,i-65377+161];i===8722&&(i=65293);var n=jp(i,Fa("jis0208"));if(n===null)return Bs(i);var a=Pl(n/94)+161,o=n%94+161;return[a,o]}}Ja["EUC-JP"]=function(e){return new C0e(e)};Qa["EUC-JP"]=function(e){return new R0e(e)};function I0e(e){var t=e.fatal,r={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},i=r.ASCII,n=r.ASCII,a=0,o=!1;this.handler=function(s,u){switch(i){default:case r.ASCII:return u===27?(i=r.EscapeStart,null):er(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===Rr?di:(o=!1,Cr(t));case r.Roman:return u===27?(i=r.EscapeStart,null):u===92?(o=!1,165):u===126?(o=!1,8254):er(u,0,127)&&u!==14&&u!==15&&u!==27&&u!==92&&u!==126?(o=!1,u):u===Rr?di:(o=!1,Cr(t));case r.Katakana:return u===27?(i=r.EscapeStart,null):er(u,33,95)?(o=!1,65377-33+u):u===Rr?di:(o=!1,Cr(t));case r.LeadByte:return u===27?(i=r.EscapeStart,null):er(u,33,126)?(o=!1,a=u,i=r.TrailByte,null):u===Rr?di:(o=!1,Cr(t));case r.TrailByte:if(u===27)return i=r.EscapeStart,Cr(t);if(er(u,33,126)){i=r.LeadByte;var l=(a-33)*94+u-33,c=Lp(l,Fa("jis0208"));return c===null?Cr(t):c}return u===Rr?(i=r.LeadByte,s.prepend(u),Cr(t)):(i=r.LeadByte,Cr(t));case r.EscapeStart:return u===36||u===40?(a=u,i=r.Escape,null):(s.prepend(u),o=!1,i=n,Cr(t));case r.Escape:var f=a;a=0;var h=null;if(f===40&&u===66&&(h=r.ASCII),f===40&&u===74&&(h=r.Roman),f===40&&u===73&&(h=r.Katakana),f===36&&(u===64||u===66)&&(h=r.LeadByte),h!==null){i=i=h;var d=o;return o=!0,d?Cr(t):null}return s.prepend([f,u]),o=!1,i=n,Cr(t)}}}function P0e(e){var t=e.fatal,r={ASCII:0,Roman:1,jis0208:2},i=r.ASCII;this.handler=function(n,a){if(a===Rr&&i!==r.ASCII)return n.prepend(a),i=r.ASCII,[27,40,66];if(a===Rr&&i===r.ASCII)return di;if((i===r.ASCII||i===r.Roman)&&(a===14||a===15||a===27))return Bs(65533);if(i===r.ASCII&&qo(a))return a;if(i===r.Roman&&(qo(a)&&a!==92&&a!==126||a==165||a==8254)){if(qo(a))return a;if(a===165)return 92;if(a===8254)return 126}if(qo(a)&&i!==r.ASCII)return n.prepend(a),i=r.ASCII,[27,40,66];if((a===165||a===8254)&&i!==r.Roman)return n.prepend(a),i=r.Roman,[27,40,74];a===8722&&(a=65293);var o=jp(a,Fa("jis0208"));if(o===null)return Bs(a);if(i!==r.jis0208)return n.prepend(a),i=r.jis0208,[27,36,66];var s=Pl(o/94)+33,u=o%94+33;return[s,u]}}Ja["ISO-2022-JP"]=function(e){return new P0e(e)};Qa["ISO-2022-JP"]=function(e){return new I0e(e)};function B0e(e){var t=e.fatal,r=0;this.handler=function(i,n){if(n===Rr&&r!==0)return r=0,Cr(t);if(n===Rr&&r===0)return di;if(r!==0){var a=r,o=null;r=0;var s=n<127?64:65,u=a<160?129:193;if((er(n,64,126)||er(n,128,252))&&(o=(a-u)*188+n-s),er(o,8836,10715))return 57344-8836+o;var l=o===null?null:Lp(o,Fa("jis0208"));return l===null&&No(n)&&i.prepend(n),l===null?Cr(t):l}return No(n)||n===128?n:er(n,161,223)?65377-161+n:er(n,129,159)||er(n,224,252)?(r=n,null):Cr(t)}}function O0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i)||i===128)return i;if(i===165)return 92;if(i===8254)return 126;if(er(i,65377,65439))return i-65377+161;i===8722&&(i=65293);var n=_0e(i);if(n===null)return Bs(i);var a=Pl(n/188),o=a<31?129:193,s=n%188,u=s<63?64:65;return[a+o,s+u]}}Ja.Shift_JIS=function(e){return new O0e(e)};Qa.Shift_JIS=function(e){return new B0e(e)};function F0e(e){var t=e.fatal,r=0;this.handler=function(i,n){if(n===Rr&&r!==0)return r=0,Cr(t);if(n===Rr&&r===0)return di;if(r!==0){var a=r,o=null;r=0,er(n,65,254)&&(o=(a-129)*190+(n-65));var s=o===null?null:Lp(o,Fa("euc-kr"));return o===null&&No(n)&&i.prepend(n),s===null?Cr(t):s}return No(n)?n:er(n,129,254)?(r=n,null):Cr(t)}}function D0e(e){var t=e.fatal;this.handler=function(r,i){if(i===Rr)return di;if(qo(i))return i;var n=jp(i,Fa("euc-kr"));if(n===null)return Bs(i);var a=Pl(n/190)+129,o=n%190+65;return[a,o]}}Ja["EUC-KR"]=function(e){return new D0e(e)};Qa["EUC-KR"]=function(e){return new F0e(e)};function D_(e,t){var r=e>>8,i=e&255;return t?[r,i]:[i,r]}function x4(e,t){var r=t.fatal,i=null,n=null;this.handler=function(a,o){if(o===Rr&&(i!==null||n!==null))return Cr(r);if(o===Rr&&i===null&&n===null)return di;if(i===null)return i=o,null;var s;if(e?s=(i<<8)+o:s=(o<<8)+i,i=null,n!==null){var u=n;return n=null,er(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(a.prepend(D_(s,e)),Cr(r))}return er(s,55296,56319)?(n=s,null):er(s,56320,57343)?Cr(r):s}}function w4(e,t){var r=t.fatal;this.handler=function(i,n){if(n===Rr)return di;if(er(n,0,65535))return D_(n,e);var a=D_((n-65536>>10)+55296,e),o=D_((n-65536&1023)+56320,e);return a.concat(o)}}Ja["UTF-16BE"]=function(e){return new w4(!0,e)};Qa["UTF-16BE"]=function(e){return new x4(!0,e)};Ja["UTF-16LE"]=function(e){return new w4(!1,e)};Qa["UTF-16LE"]=function(e){return new x4(!1,e)};function M0e(e){var t=e.fatal;this.handler=function(r,i){return i===Rr?di:No(i)?i:63360+i-128}}function L0e(e){var t=e.fatal;this.handler=function(r,i){return i===Rr?di:qo(i)?i:er(i,63360,63487)?i-63360+128:Bs(i)}}Ja["x-user-defined"]=function(e){return new L0e(e)};Qa["x-user-defined"]=function(e){return new M0e(e)};var j0e="rejected",N0e="fulfilled";function E4(e){let t=e.map(r=>r.then(i=>({status:N0e,value:i})).catch(i=>({status:j0e,reason:i})));return Promise.all(t)}function M_(e){return Buffer.from(e).toString("base64")}function Ck(e){return Buffer.from(e,"base64").toString("ascii")}var Uo=class{constructor(t){this.map={},t instanceof Uo?t.forEach((r,i)=>this.append(i,r)):Array.isArray(t)?t.forEach(r=>this.append(r[0],r[1])):t&&Object.getOwnPropertyNames(t).forEach(r=>this.append(r,t[r]))}append(t,r){t=nv(t),r=S4(r);let i=this.map[t];this.map[t]=i?`${i}, ${r}`:r}delete(t){delete this.map[nv(t)]}get(t){return t=nv(t),this.has(t)?this.map[t]:null}has(t){return this.map.hasOwnProperty(nv(t))}set(t,r){this.map[nv(t)]=S4(r)}forEach(t,r=null){for(let i in this.map)this.map.hasOwnProperty(i)&&(r?t.call(r,this.map[i],i,this):t(this.map[i],i,this))}keys(){let t=[];return this.forEach(function(r,i){t.push(i)}),Ik(t)}values(){let t=[];return this.forEach(function(r){t.push(r)}),Ik(t)}entries(){let t=[];return this.forEach(function(r,i){t.push([i,r])}),Ik(t)}*[Symbol.iterator](){yield*this.entries()}};function nv(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||e==="")throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function S4(e){return typeof e!="string"&&(e=String(e)),e}function Ik(e){let t={next(){let r=e.shift();return{done:r===void 0,value:r}}};return t[Symbol.iterator]=function(){return t},t}function Pk(e,t){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${t}`)}var L_=Fe(require("zlib"));var q0e=e=>e&&e instanceof ArrayBuffer,U0e=e=>e&&e instanceof Buffer;function T4(e){let t=e.indexOf(","),r,i;return e.slice(t-7,t)===";base64"?(r=Buffer.from(e.slice(t+1),"base64"),i=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),i=e.slice(5,t).trim()),i?i.startsWith(";")&&(i=`text/plain${i}`):i="text/plain;charset=US-ASCII",{arrayBuffer:Bk(r),mimeType:i}}function Bk(e){if(q0e(e))return e;if(U0e(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}function A4(e,t){switch(t.get("content-encoding")){case"br":return e.pipe(L_.default.createBrotliDecompress());case"gzip":return e.pipe(L_.default.createGunzip());case"deflate":return e.pipe(L_.default.createDeflate());default:return e}}async function k4(e){let t=[];return await new Promise((r,i)=>{e.on("error",n=>i(n)),e.on("readable",()=>e.read()),e.on("data",n=>{typeof n=="string"&&i(new Error("Read stream not binary")),t.push(Bk(n))}),e.on("end",()=>{let n=G0e(t);r(n)})})}function G0e(e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),i=new Uint8Array(r),n=0;for(let a of t)i.set(a,n),n+=a.byteLength;return i.buffer}var Fk=Fe(require("stream")),z0e=e=>typeof e=="boolean",R4=e=>typeof e=="function",H0e=e=>e!==null&&typeof e=="object",Ok=e=>H0e(e)&&R4(e.read)&&R4(e.pipe)&&z0e(e.readable),Os=class{constructor(t,r){this.bodyUsed=!1;let{headers:i,status:n=200,statusText:a="OK",url:o}=r||{};this.url=o,this.ok=n===200,this.status=n,this.statusText=a,this.headers=new Uo((r==null?void 0:r.headers)||{}),Ok(t)?this._body=A4(t,i):typeof t=="string"?this._body=Fk.Readable.from([new TextEncoder().encode(t)]):this._body=Fk.Readable.from([t||new ArrayBuffer(0)])}get body(){return Pk(!this.bodyUsed),Pk(Ok(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return Ok(this._body)?await k4(this._body):this._body||new ArrayBuffer(0)}async text(){let t=await this.arrayBuffer();return new TextDecoder().decode(t)}async json(){let t=await this.text();return JSON.parse(t)}async blob(){if(typeof Blob=="undefined")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var C4=Fe(require("http")),I4=Fe(require("https"));var Dk=Fe(require("fs"));async function Mk(e,t){let r=e.split("?")[0];try{let i=await new Promise((s,u)=>{let l=Dk.default.createReadStream(r,{encoding:null});l.once("readable",()=>s(l)),l.on("error",c=>u(c))}),n=200,a="OK",o=W0e(r);return new Os(i,{headers:o,status:n,statusText:a,url:e})}catch(i){let n=400,a=i.message,o={};return new Os(i.message,{headers:o,status:n,statusText:a,url:e})}}function W0e(e){let t={};if(!t["content-length"]){let r=Dk.default.statSync(e);t["content-length"]=r.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip"),new Uo(t)}var Lk=e=>e.startsWith("data:"),V0e=e=>e.startsWith("http:")||e.startsWith("https:");async function av(e,t){try{if(!V0e(e)&&!Lk(e))return await Mk(e,t);if(Lk(e)){let{arrayBuffer:l,mimeType:c}=T4(e);return new Os(l,{headers:{"content-type":c},url:e})}let r={},i=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");let n=await K0e(i,t),a=J0e(e,n,r),{status:o,statusText:s}=$0e(n),u=!t||t.followRedirect||t.followRedirect===void 0;if(o>=300&&o<400&&a.has("location")&&u){let l=Y0e(e,a.get("location"));return await av(l,t)}return new Os(n,{headers:a,status:o,statusText:s,url:e})}catch(r){return new Os(null,{status:400,statusText:String(r),url:e})}}async function K0e(e,t){return await new Promise((r,i)=>{let n=X0e(e,t),a=e.startsWith("https:")?I4.default.request(n,o=>r(o)):C4.default.request(n,o=>r(o));a.on("error",o=>i(o)),a.end()})}function Y0e(e,t){if(t.startsWith("http"))return t;let r=new URL(e);return r.pathname=t,r.href}function X0e(e,t){let r=(t==null?void 0:t.headers)||{},i={};for(let a of Object.keys(r))i[a.toLowerCase()]=r[a];i["accept-encoding"]=i["accept-encoding"]||"gzip,br,deflate";let n=new URL(e);return Ye(ne(ne({hostname:n.hostname,path:n.pathname,method:"GET"},t),t==null?void 0:t.fetch),{headers:i,port:n.port})}function $0e(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function J0e(e,t,r={}){let i={};if(t&&t.headers){let n=t.headers;for(let a in n){let o=n[a];i[a.toLowerCase()]=String(o)}}if(!i["content-length"]){let n=Q0e(e);Number.isFinite(n)&&(i["content-length"]=n)}return Object.assign(i,r),new Uo(i)}function Q0e(e){return Lk(e)?e.length-"data:".length:null}var T9=Fe(E9()),A9=Fe(dv());function S9(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function h1e(e,t){let r=t.type?t.type.replace("image/",""):"jpeg",i=(0,A9.default)(e.data,[e.width,e.height,4],[4,e.width*4,1],0);return(0,T9.default)(i,r,t)}function MR(e,t){let r=h1e(e,t);return new Promise(i=>{let n=[];r.on("data",a=>n.push(a)),r.on("end",()=>{let a=Buffer.concat(n);i(S9(a))})})}var aY=Fe(nY()),oY=["image/png","image/jpeg","image/gif"];async function qI(e,t){if(!t)throw new Error("MIMEType is required to parse image under Node.js");let r=e instanceof Buffer?e:Buffer.from(e);return await SCe(r,t)}function SCe(e,t){return new Promise(r=>(0,aY.default)(e,t,(i,n)=>{if(i)throw i;let a=[...n.shape],o=n.shape.length===4?n.shape.shift():1,s=n.data instanceof Buffer?new Uint8Array(n.data):n.data;r({shape:a,data:s,width:n.shape[0],height:n.shape[1],components:n.shape[2],layers:o?[o]:[]})}))}var lY=Fe(uY());delete global.ReadableStream;var ly=class extends lY.ReadableStream{};var UI=class{constructor(t){this.isWorking=!1;this.isCancelled=!1;this.chunks=t}start(t){this.work(t)}async work(t){let{chunks:r}=this;for(this.isWorking=!0;!this.isCancelled&&(t.desiredSize||0)>0;){let i;try{i=r.next()}catch(n){t.error(n);break}i&&(!i.done&&!this.isCancelled?t.enqueue(i.value):t.close())}this.isWorking=!1}pull(t){this.isWorking||this.work(t)}cancel(){this.isCancelled=!0}};var GI=class extends ly{constructor(t){super(new UI(t.values()),{type:"bytes"});this._chunks=t}async*[Symbol.asyncIterator](t){let r=this.getReader();yield*this._chunks,r.releaseLock()}};var xf=class{constructor(t=[],r={}){this.parts=[],this.size=0;for(let i of t)if(typeof i=="string"){let n=new TextEncoder().encode(i);this.parts.push(n),this.size+=n.byteLength}else if(i instanceof xf)this.size+=i.size,this.parts.push(...i.parts);else if(i instanceof ArrayBuffer)this.parts.push(new Uint8Array(i)),this.size+=i.byteLength;else if(i instanceof Uint8Array)this.parts.push(i),this.size+=i.byteLength;else if(ArrayBuffer.isView(i)){let{buffer:n,byteOffset:a,byteLength:o}=i;this.parts.push(new Uint8Array(n,a,o)),this.size+=o}else{let n=new TextEncoder().encode(String(i));this.parts.push(n),this.size+=n.byteLength}this.type=TCe(r.type)}slice(t=0,r=this.size,i=""){let{size:n,parts:a}=this,o=t<0?Math.max(n+t,0):Math.min(t,n),s=r<0?Math.max(n+r,0):Math.min(r,n),u=Math.max(s-o,0),l=new xf([],{type:i});if(u===0)return l;let c=0,f=[];for(let h of a){let{byteLength:d}=h;if(o>0&&d<=o)o-=d,s-=d;else{let p=h.subarray(o,Math.min(d,s));if(f.push(p),c+=p.byteLength,o=0,c>=u)break}}return l.parts=f,l.size=c,l}async arrayBuffer(){return this._toArrayBuffer()}async text(){let t=new TextDecoder,r="";for(let i of this.parts)r+=t.decode(i);return r}stream(){return new GI(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let t=new ArrayBuffer(this.size),r=new Uint8Array(t),i=0;for(let n of this.parts)r.set(n,i),i+=n.byteLength;return t}};function TCe(e=""){let t=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(t)?"":t}var zI=class extends xf{constructor(t,r,i={}){super(t,i);this.name="";this.webkitRelativePath="";this.name=String(r).replace(/\//g,":"),this.lastModified=(i==null?void 0:i.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};var kCe=!Eu||!("TextEncoder"in mn);kCe&&(mn.TextEncoder=iv);var RCe=!Eu||!("TextDecoder"in mn);RCe&&(mn.TextDecoder=Wh);!Eu&&!("atob"in mn)&&M_&&(mn.atob=M_);!Eu&&!("btoa"in mn)&&Ck&&(mn.btoa=Ck);!Eu&&!("Headers"in mn)&&Uo&&(mn.Headers=Uo);!Eu&&!("Response"in mn)&&Os&&(mn.Response=Os);!Eu&&!("fetch"in mn)&&av&&(mn.fetch=av);!Eu&&!("_encodeImageNode"in mn)&&MR&&(mn._encodeImageNode=MR);!Eu&&!("_parseImageNode"in mn)&&qI&&(mn._parseImageNode=qI,mn._imageFormatsNode=oY);"allSettled"in Promise||(Promise.allSettled=E4);var Rge=Fe(require("path"));function Ft(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var zu={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},cY=zu.self||zu.window||zu.global||{},fY=zu.window||zu.self||zu.global||{},hY=zu.global||zu.self||zu.window||{},dY=zu.document||{};var on=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var pY=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),CCe=pY&&parseFloat(pY[1])||0;var wf="4.0.0-alpha.17";function Zn(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Hu={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},y0t=Hu.self||Hu.window||Hu.global||{},b0t=Hu.window||Hu.self||Hu.global||{},mY=Hu.global||Hu.self||Hu.window||{},_0t=Hu.document||{};var qa=typeof process!="object"||String(process)!=="[object process]"||process.browser,cy=typeof importScripts=="function",gY=typeof window!="undefined"&&typeof window.orientation!="undefined",vY=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),x0t=vY&&parseFloat(vY[1])||0;var Ow=class{constructor(t,r){this.isRunning=!0;this._resolve=()=>{};this._reject=()=>{};this.name=t,this.workerThread=r,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){Zn(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Zn(this.isRunning),this.isRunning=!1,this._reject(t)}};var Rm={};mo(Rm,{NodeWorker:()=>fy});var yY=Fe(require("worker_threads"));rv(Rm,Fe(require("worker_threads")));var fy=yY.Worker;var HI=new Map;function bY(e){Zn(e.source&&!e.url||!e.source&&e.url);let t=HI.get(e.source||e.url);return t||(e.url&&(t=ICe(e.url),HI.set(e.url,t)),e.source&&(t=_Y(e.source),HI.set(e.source,t))),Zn(t),t}function ICe(e){if(!e.startsWith("http"))return e;let t=PCe(e);return _Y(t)}function _Y(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function PCe(e){return`try {
118
118
  importScripts('${e}');
119
119
  } catch (error) {
120
120
  console.error(error);
121
121
  throw error;
122
122
  }`}function WI(e,t=!0,r){let i=r||new Set;if(e){if(xY(e))i.add(e);else if(xY(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let n in e)WI(e[n],t,i)}}return r===void 0?Array.from(i):[]}function xY(e){return e?e instanceof ArrayBuffer||typeof MessagePort!="undefined"&&e instanceof MessagePort||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&e instanceof OffscreenCanvas:!1}function VI(e){if(e===null)return{};let t=Object.assign({},e);return Object.keys(t).forEach(r=>{typeof e[r]=="object"&&!ArrayBuffer.isView(e[r])&&!(e[r]instanceof Array)?t[r]=VI(e[r]):typeof t[r]=="function"||t[r]instanceof RegExp?t[r]={}:t[r]=e[r]}),t}var KI=()=>{},cd=class{constructor(t){this.terminated=!1;this._loadableURL="";let{name:r,source:i,url:n}=t;Zn(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=KI,this.onError=a=>console.log(a),this.worker=qa?this._createBrowserWorker():this._createNodeWorker()}static isSupported(){return typeof Worker!="undefined"&&qa||typeof fy!="undefined"&&!qa}destroy(){this.onMessage=KI,this.onError=KI,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,r){r=r||WI(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,t.message&&(r+=`${t.message} in `),t.lineno&&(r+=`:${t.lineno}:${t.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=bY({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new fy(i,{eval:!1})}else if(this.source)t=new fy(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",r=>{this.onMessage(r)}),t.on("error",r=>{this.onError(r)}),t.on("exit",r=>{}),t}};var Fw=class{constructor(t){this.name="unnamed";this.maxConcurrency=1;this.maxMobileConcurrency=1;this.onDebug=()=>{};this.reuseWorkers=!0;this.props={};this.jobQueue=[];this.idleQueue=[];this.count=0;this.isDestroyed=!1;this.source=t.source,this.url=t.url,this.setProps(t)}static isSupported(){return cd.isSupported()}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props=ne(ne({},this.props),t),t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,r=(n,a,o)=>n.done(o),i=(n,a)=>n.error(a)){let n=new Promise(a=>(this.jobQueue.push({name:t,onMessage:r,onError:i,onStart:a}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:t,backlog:this.jobQueue.length});let i=new Ow(r.name,t);t.onMessage=n=>r.onMessage(i,n.type,n.payload),t.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!qa||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new cd({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return gY?this.maxMobileConcurrency:this.maxConcurrency}};var BCe={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},_n=class{constructor(t){this.workerPools=new Map;this.props=ne({},BCe),this.setProps(t),this.workerPools=new Map}static isSupported(){return cd.isSupported()}static getWorkerFarm(t={}){return _n._workerFarm=_n._workerFarm||new _n({}),_n._workerFarm.setProps(t),_n._workerFarm}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props=ne(ne({},this.props),t);for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:i,url:n}=t,a=this.workerPools.get(r);return a||(a=new Fw({name:r,source:i,url:n}),a.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,a)),a}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};var wY="beta",EY=typeof wf!="undefined"?wf:wY;function SY(e){let t=e.version!==EY?` (worker-utils@${EY})`:"";return`${e.name}@${e.version}${t}`}function Ef(e,t={}){let r=t[e.id]||{},i=qa?`${e.id}-worker.js`:`${e.id}-worker-node.js`,n=r.workerUrl;if(!n&&e.id==="compression"&&(n=t.workerUrl),t._workerType==="test"&&(n=`modules/${e.module}/dist/${i}`),!n){let a=e.version;a==="latest"&&(a=wY);let o=a?`@${a}`:"";n=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${i}`}return Zn(n),n}async function YI(e,t,r={},i={}){let n=SY(e),a=_n.getWorkerFarm(r),{source:o}=r,s={name:n,source:o};o||(s.url=Ef(e,r));let u=a.getWorkerPool(s),l=r.jobName||e.name,c=await u.startJob(l,OCe.bind(null,i)),f=VI(r);return c.postMessage("process",{input:t,options:f}),(await c.result).result}async function OCe(e,t,r,i){switch(r){case"done":t.done(i);break;case"error":t.error(new Error(i.error));break;case"process":let{id:n,input:a,options:o}=i;try{if(!e.process){t.postMessage("error",{id:n,error:"Worker not set up to process on main thread"});return}let s=await e.process(a,o);t.postMessage("done",{id:n,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:n,error:u})}break;default:console.warn(`process-on-worker: unknown message ${r}`)}}function XI(e,t=wf){Zn(e,"no worker provided");let r=e.version;return!(!t||!r)}var QI={};mo(QI,{requireFromFile:()=>JI,requireFromString:()=>Dw});var $I=Fe(require("module")),TY=Fe(require("path"));async function JI(e){if(e.startsWith("http")){let r=await(await fetch(e)).text();return Dw(r)}return e.startsWith("/")||(e=`${process.cwd()}/${e}`),require(e)}function Dw(e,t="",r){if(typeof t=="object"&&(r=t,t=""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let i=$I.default._nodeModulePaths(TY.default.dirname(t)),n=module.parent,a=new $I.default(t,n);return a.filename=t,a.paths=[].concat((r==null?void 0:r.prependPaths)||[]).concat(i).concat((r==null?void 0:r.appendPaths)||[]),a._compile(e,t),n&&n.children&&n.children.splice(n.children.indexOf(a),1),a.exports}var FCe="beta",DCe=typeof wf!="undefined"?wf:FCe,ZI={};async function Wu(e,t=null,r={}){return t&&(e=AY(e,t,r)),ZI[e]=ZI[e]||MCe(e),await ZI[e]}function AY(e,t,r){if(e.startsWith("http"))return e;let i=r.modules||{};return i[e]?i[e]:qa?r.CDN?(Zn(r.CDN.startsWith("http")),`${r.CDN}/${t}@${DCe}/dist/libs/${e}`):cy?`../src/libs/${e}`:`modules/${t}/src/libs/${e}`:`modules/${t}/dist/libs/${e}`}async function MCe(e){if(e.endsWith("wasm"))return await(await fetch(e)).arrayBuffer();if(!qa)try{return QI&&JI&&await JI(e)}catch{return null}if(cy)return importScripts(e);let r=await(await fetch(e)).text();return LCe(r,e)}function LCe(e,t){if(!qa)return Dw&&Dw(e,t);if(cy)return eval.call(mY,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}var CY=Fe(require("child_process"));var kY=Fe(require("child_process"));function RY(e=3e3){return new Promise(t=>{kY.default.exec("lsof -i -P -n | grep LISTEN",(r,i)=>{if(r){t(e);return}let n=[],a=/:(\d+) \(LISTEN\)/;i.split(`
123
- `).forEach(s=>{let u=a.exec(s);u&&n.push(Number(u[1]))});let o=e;for(;n.includes(o);)o++;t(o)})})}var IY={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log(`Started ${e.props.command}`)}},Sf=class{constructor({id:t="browser-driver"}={}){this.props=ne({},IY);this.childProcess=null;this.port=0;this.id=t}async start(t){t=ne(ne({},IY),t),this.props=t;let r=[...t.arguments];return this.port=Number(t.port),t.portArg&&(t.autoPort&&(this.port=await RY(t.port)),r.push(t.portArg,String(this.port))),await new Promise((i,n)=>{try{this._setTimeout(()=>{t.onSuccess&&t.onSuccess(this),i({})}),console.log(`Spawning ${t.command} ${t.arguments.join(" ")}`);let a=CY.spawn(t.command,r,t.spawn);this.childProcess=a,a.stdout.on("data",o=>{console.log(o.toString())}),a.stderr.on("data",o=>{console.log(`Child process wrote to stderr: "${o}".`),t.ignoreStderr||(this._clearTimeout(),n(new Error(o)))}),a.on("error",o=>{console.log(`Child process errored with ${o}`),this._clearTimeout(),n(o)}),a.on("close",o=>{console.log(`Child process exited with ${o}`),this.childProcess=null,this._clearTimeout(),i({})})}catch(a){n(a)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(t=0){try{await this.stop(),process.exit(t)}catch(r){console.error(r.message||r),process.exit(1)}}_setTimeout(t){Number(this.props.wait)>0&&(this.successTimer=setTimeout(t,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}};function eP(e,t){return!_n.isSupported()||!qa&&!(t==null?void 0:t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}async function tP(e,t,r,i,n){let a=e.id,o=Ef(e,r),u=_n.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let l=await u.startJob("process-on-worker",jCe.bind(null,n));return l.postMessage("process",{input:t,options:r,context:i}),await(await l.result).result}async function jCe(e,t,r,i){switch(r){case"done":t.done(i);break;case"error":t.error(new Error(i.error));break;case"process":let{id:n,input:a,options:o}=i;try{let s=await e(a,o);t.postMessage("done",{id:n,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function rP(e,t){return!_n.isSupported()||!on&&!(t==null?void 0:t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}function PY(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?BY(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?BY(e,0,t):""}function BY(e,t,r){if(e.byteLength<=t+r)return"";let i=new DataView(e),n="";for(let a=0;a<r;a++)n+=String.fromCharCode(i.getUint8(t+a));return n}function iP(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${PY(e)}"`)}}function nP(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let i=new Uint8Array(e),n=new Uint8Array(t);for(let a=0;a<i.length;++a)if(i[a]!==n[a])return!1;return!0}function Vu(...e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),i=new Uint8Array(r),n=0;for(let a of t)i.set(a,n),n+=a.byteLength;return i.buffer}function sa(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=t.reduce((o,s)=>o+s.length,0),n=new r(i),a=0;for(let o of t)n.set(o,a),a+=o.length;return n}function fd(e,t,r){let i=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(i).buffer}function xo(e,t){return Ft(e>=0),Ft(t>0),e+(t-1)&~(t-1)}function aP(e,t,r){let i;if(e instanceof ArrayBuffer)i=new Uint8Array(e);else{let n=e.byteOffset,a=e.byteLength;i=new Uint8Array(e.buffer||e.arrayBuffer,n,a)}return t.set(i,r),r+xo(i.byteLength,4)}function oP(e,t){let r=e.length,n=Math.ceil(r/t)*t-r,a="";for(let o=0;o<n;++o)a+=" ";return e+a}function Cm(e,t,r,i){if(e)for(let n=0;n<i;n++)e.setUint8(t+n,r.charCodeAt(n));return t+i}function hy(e,t,r,i){if(e)for(let n=0;n<i;n++)e.setUint8(t+n,r[n]);return t+i}function Mw(e,t,r,i){let n=xo(r.byteLength,i),a=n-r.byteLength;if(e){let o=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),s=new Uint8Array(r);o.set(s);for(let u=0;u<a;++u)e.setUint8(t+r.byteLength+u,32)}return t+=n,t}function Im(e,t,r,i){let a=new TextEncoder().encode(r);return t=Mw(e,t,a,i),t}async function sP(e){let t=[];for await(let r of e)t.push(r);return Vu(...t)}function Tf(e){return Tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tf(e)}function uP(e,t){if(Tf(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(Tf(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lP(e){var t=uP(e,"string");return Tf(t)==="symbol"?t:String(t)}function Wt(e,t,r){return t=lP(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dy(){let e;if(typeof window!="undefined"&&window.performance)e=window.performance.now();else if(typeof process!="undefined"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Pm=class{constructor(t,r){Wt(this,"name",void 0),Wt(this,"type",void 0),Wt(this,"sampleSize",1),Wt(this,"time",0),Wt(this,"count",0),Wt(this,"samples",0),Wt(this,"lastTiming",0),Wt(this,"lastSampleTime",0),Wt(this,"lastSampleCount",0),Wt(this,"_count",0),Wt(this,"_time",0),Wt(this,"_samples",0),Wt(this,"_startTime",0),Wt(this,"_timerPending",!1),this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=dy(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(dy()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var py=class{constructor(t){Wt(this,"id",void 0),Wt(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:i}=t,n=this.stats[r];return n||(t instanceof Pm?n=t:n=new Pm(r,i),this.stats[r]=n),n}};var NCe="Queued Requests",qCe="Active Requests",UCe="Cancelled Requests",GCe="Queued Requests Ever",zCe="Active Requests Ever",HCe={id:"request-scheduler",throttleRequests:!0,maxRequests:6},my=class{constructor(t={}){this.activeRequestCount=0;this.requestQueue=[];this.requestMap=new Map;this.deferredUpdate=null;this.props=ne(ne({},HCe),t),this.stats=new py({id:this.props.id}),this.stats.get(NCe),this.stats.get(qCe),this.stats.get(UCe),this.stats.get(GCe),this.stats.get(zCe)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let i={handle:t,priority:0,getPriority:r},n=new Promise(a=>(i.resolve=a,i));return this.requestQueue.push(i),this.requestMap.set(t,n),this._issueNewRequests(),n}_issueRequest(t){let{handle:r,resolve:i}=t,n=!1,a=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:a}):Promise.resolve({done:a})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let i=t[r];this._updateRequest(i)||(t.splice(r,1),this.requestMap.delete(i.handle),r--)}t.sort((r,i)=>r.priority-i.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var WCe="",OY={};function Af(e){for(let t in OY)if(e.startsWith(t)){let r=OY[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${WCe}${e}`),e}var VCe="4.0.0-alpha.16",cP={name:"JSON",id:"json",module:"json",version:VCe,extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:FY,parse:async e=>FY(new TextDecoder().decode(e)),options:{}};function FY(e){return JSON.parse(e)}function Lw(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function fP(e){if(Buffer.isBuffer(e))return e;if(ArrayBuffer.isView(e)&&(e=e.buffer),typeof Buffer!="undefined"&&e instanceof ArrayBuffer)return Buffer.from(e);throw new Error("toBuffer")}function DY(e){return e&&typeof e=="object"&&e.isBuffer}function hP(e){return fP?fP(e):e}function jw(e){if(DY(e))return Lw(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function dP(e){return(t,r)=>new Promise((i,n)=>e(t,r,(a,o)=>a?n(a):i(o)))}function MY(e){return(t,r,i)=>new Promise((n,a)=>e(t,r,i,(o,s)=>o?a(o):n(s)))}var Xs={};mo(Xs,{dirname:()=>YCe,filename:()=>KCe,join:()=>XCe,resolve:()=>$Ce});function LY(){var t;if(typeof process!="undefined"&&typeof process.cwd!="undefined")return process.cwd();let e=(t=window.location)==null?void 0:t.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function KCe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function YCe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function XCe(...e){let t="/";return e=e.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${t}`),"")),i!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function $Ce(...e){let t=[];for(let a=0;a<e.length;a++)t[a]=e[a];let r="",i=!1,n;for(let a=t.length-1;a>=-1&&!i;a--){let o;a>=0?o=t[a]:(n===void 0&&(n=LY()),o=n),o.length!==0&&(r=`${o}/${r}`,i=o.charCodeAt(0)===gy)}return r=JCe(r,!i),i?`/${r}`:r.length>0?r:"."}var gy=47,pP=46;function JCe(e,t){let r="",i=-1,n=0,a,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)a=e.charCodeAt(s);else{if(a===gy)break;a=gy}if(a===gy){if(!(i===s-1||n===1))if(i!==s-1&&n===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==pP||r.charCodeAt(r.length-2)!==pP){if(r.length>2){let u=r.length-1,l=u;for(;l>=0&&r.charCodeAt(l)!==gy;--l);if(l!==u){r=l===-1?"":r.slice(0,l),i=s,n=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",i=s,n=0,o=!1;continue}}t&&(r.length>0?r+="/..":r="..",o=!0)}else{let u=e.slice(i+1,s);r.length>0?r+=`/${u}`:r=u,o=!1}i=s,n=0}else a===pP&&n!==-1?++n:n=-1}return r}var Nw={};mo(Nw,{_readToArrayBuffer:()=>QCe,close:()=>WY,createWriteStream:()=>KY,fstat:()=>VY,isSupported:()=>YY,open:()=>HY,read:()=>mP,readFile:()=>qY,readFileSync:()=>UY,readdir:()=>jY,stat:()=>NY,writeFile:()=>GY,writeFileSync:()=>zY});var no=Fe(require("fs"));var jY,NY,qY,UY,GY,zY,HY,WY,mP,VY,KY,YY=Boolean(no.default);try{jY=dP(no.default.readdir),NY=dP(no.default.stat),qY=no.default.readFile,UY=no.default.readFileSync,GY=MY(no.default.writeFile),zY=no.default.writeFileSync,HY=no.default.open,WY=e=>new Promise((t,r)=>no.default.close(e,i=>i?r(i):t())),mP=no.default.read,VY=no.default.fstat,KY=no.default.createWriteStream,YY=Boolean(no.default)}catch{}async function QCe(e,t,r){let i=Buffer.alloc(r),{bytesRead:n}=await mP(e,i,0,r,t);if(n!==r)throw new Error("fs.read failed");return Lw(i)}var eIe=e=>typeof e=="boolean",vy=e=>typeof e=="function",hd=e=>e!==null&&typeof e=="object",gP=e=>hd(e)&&e.constructor==={}.constructor;var XY=e=>e&&typeof e[Symbol.iterator]=="function",$Y=e=>e&&typeof e[Symbol.asyncIterator]=="function";var Qo=e=>typeof Response!="undefined"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Zo=e=>typeof Blob!="undefined"&&e instanceof Blob,JY=e=>e&&typeof e=="object"&&e.isBuffer;var tIe=e=>typeof ReadableStream!="undefined"&&e instanceof ReadableStream||hd(e)&&vy(e.tee)&&vy(e.cancel)&&vy(e.getReader);var rIe=e=>hd(e)&&vy(e.read)&&vy(e.pipe)&&eIe(e.readable),qw=e=>tIe(e)||rIe(e);var iIe=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,nIe=/^([-\w.]+\/[-\w.+]+)/;function QY(e){let t=nIe.exec(e);return t?t[1]:e}function vP(e){let t=iIe.exec(e);return t?t[1]:""}var ZY=/\?.*/;function eX(e){let t=e.match(ZY);return t&&t[0]}function Bm(e){return e.replace(ZY,"")}function dd(e){return Qo(e)?e.url:Zo(e)?e.name||"":typeof e=="string"?e:""}function yy(e){if(Qo(e)){let t=e,r=t.headers.get("content-type")||"",i=Bm(t.url);return QY(r)||vP(i)}return Zo(e)?e.type||"":typeof e=="string"?vP(e):""}function tX(e){return Qo(e)?e.headers["content-length"]||-1:Zo(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function Uw(e){if(Qo(e))return e;let t={},r=tX(e);r>=0&&(t["content-length"]=String(r));let i=dd(e),n=yy(e);n&&(t["content-type"]=n);let a=await oIe(e);a&&(t["x-first-bytes"]=a),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:i}),o}async function rX(e){if(!e.ok){let t=await aIe(e);throw new Error(t)}}async function aIe(e){let t=`Failed to fetch resource ${e.url} (${e.status}): `;try{let r=e.headers.get("Content-Type"),i=e.statusText;r.includes("application/json")&&(i+=` ${await e.text()}`),t+=i,t=t.length>60?`${t.slice(0,60)}...`:t}catch{}return t}async function oIe(e){let t=5;if(typeof e=="string")return`data:,${e.slice(0,t)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=a=>{var o;return i((o=a==null?void 0:a.target)==null?void 0:o.result)},n.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,t);return`data:base64,${sIe(r)}`}return null}function sIe(e){let t="",r=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)t+=String.fromCharCode(r[i]);return btoa(t)}async function Ua(e,t){if(typeof e=="string"){e=Af(e);let r=t;return(t==null?void 0:t.fetch)&&typeof(t==null?void 0:t.fetch)!="function"&&(r=t.fetch),await fetch(e,r)}return await Uw(e)}async function iX(e,t,r){e=Af(e),on||await Nw.writeFile(e,hP(t),{flag:"w"}),Ft(!1)}function yP(e){if(typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function $s(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||yP()}var uIe=globalThis.self||globalThis.window||globalThis.global,Om=globalThis.window||globalThis.self||globalThis.global,lIe=globalThis.document||{},pd=globalThis.process||{},cIe=globalThis.console,$yt=globalThis.navigator||{};var Gw="4.0.0-alpha.16",Zyt=$s();function fIe(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var bP=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";Wt(this,"storage",void 0),Wt(this,"id",void 0),Wt(this,"config",void 0),this.storage=fIe(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function nX(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function aX(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function zw(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,n=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(r=Math.min(r,i/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(n,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var Hw;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Hw||(Hw={}));var hIe=10;function oX(e){return typeof e!="string"?e:(e=e.toUpperCase(),Hw[e]||Hw.WHITE)}function sX(e,t,r){if(!$s&&typeof e=="string"){if(t){let i=oX(t);e="[".concat(i,"m").concat(e,"")}if(r){let i=oX(r);e="[".concat(i+hIe,"m").concat(e,"")}}return e}function uX(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r),n=e;for(let a of i){let o=n[a];typeof o=="function"&&(t.find(s=>a===s)||(n[a]=o.bind(e)))}}function Fm(e,t){if(!e)throw new Error(t||"Assertion failed")}function md(){let e;if($s()&&Om.performance){var t,r;e=Om===null||Om===void 0||(t=Om.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in pd){var i;let n=pd===null||pd===void 0||(i=pd.hrtime)===null||i===void 0?void 0:i.call(pd);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}var Dm={debug:$s()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},dIe={enabled:!0,level:0};function es(){}var lX={},cX={once:!0},Yl=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};Wt(this,"id",void 0),Wt(this,"VERSION",Gw),Wt(this,"_startTs",md()),Wt(this,"_deltaTs",md()),Wt(this,"_storage",void 0),Wt(this,"userData",{}),Wt(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new bP("__probe-".concat(this.id,"__"),dIe),this.timeStamp("".concat(this.id," started")),uX(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((md()-this._startTs).toPrecision(10))}getDelta(){return Number((md()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Fm(t,r)}warn(t){return this._getLogFunction(0,t,Dm.warn,arguments,cX)}error(t){return this._getLogFunction(0,t,Dm.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Dm.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Dm.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Dm.debug||Dm.info,arguments,cX)}table(t,r,i){return r?this._getLogFunction(t,r,console.table||es,i&&[i],{tag:vIe(r)}):es}image(t){let{logLevel:r,priority:i,image:n,message:a="",scale:o=1}=t;return this._shouldLog(r||i)?$s()?gIe({image:n,message:a,scale:o}):mIe({image:n,message:a,scale:o}):es}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||es)}group(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},n=hX({logLevel:t,message:r,opts:i}),{collapsed:a}=i;return n.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||es)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=fX(t)}_getLogFunction(t,r,i,n,a){if(this._shouldLog(t)){a=hX({logLevel:t,message:r,args:n,opts:a}),i=i||a.method,Fm(i),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=md();let o=a.tag||a.message;if(a.once&&o)if(!lX[o])lX[o]=md();else return es;return r=pIe(this.id,a.message,a),i.bind(console,r,...a.args)}return es}};Wt(Yl,"VERSION",Gw);function fX(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Fm(Number.isFinite(t)&&t>=0),t}function hX(e){let{logLevel:t,message:r}=e;e.logLevel=fX(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&i.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let n=typeof e.message;return Fm(n==="string"||n==="object"),Object.assign(e,{args:i},e.opts)}function pIe(e,t,r){if(typeof t=="string"){let i=r.time?aX(nX(r.total)):"";t=r.time?"".concat(e,": ").concat(i," ").concat(t):"".concat(e,": ").concat(t),t=sX(t,r.color,r.background)}return t}function mIe(e){let{image:t,message:r="",scale:i=1}=e;return console.warn("removed"),es}function gIe(e){let{image:t,message:r="",scale:i=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=zw(a,r,i);console.log(...o)},a.src=t,es}let n=t.nodeName||"";if(n.toLowerCase()==="img")return console.log(...zw(t,r,i)),es;if(n.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...zw(a,r,i)),a.src=t.toDataURL(),es}return es}function vIe(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Abt=new Yl({id:"@probe.gl/log"});var _P=new Yl({id:"loaders.gl"}),xP=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},wP=class{constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var EP={fetch:null,mimeType:void 0,nothrow:!1,log:new wP,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:on,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},dX={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function SP(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state=e._state||{},e._state}var Ku=()=>{let e=SP();return e.globalOptions=e.globalOptions||ne({},EP),e.globalOptions};function pX(e,t,r,i){return r=r||[],r=Array.isArray(r)?r:[r],yIe(e,r),_Ie(t,e,i)}function yIe(e,t){mX(e,null,EP,dX,t);for(let r of t){let i=e&&e[r.id]||{},n=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};mX(i,r.id,n,a,t)}}function mX(e,t,r,i,n){let a=t||"Top level",o=t?`${t}.`:"";for(let s in e){let u=!t&&hd(e[s]),l=s==="baseUri"&&!t,c=s==="workerUrl"&&t;if(!(s in r)&&!l&&!c){if(s in i)_P.warn(`${a} loader option '${o}${s}' no longer supported, use '${i[s]}'`)();else if(!u){let f=bIe(s,n);_P.warn(`${a} loader option '${o}${s}' not recognized. ${f}`)()}}}}function bIe(e,t){let r=e.toLowerCase(),i="";for(let n of t)for(let a in n.options){if(e===a)return`Did you mean '${n.id}.${a}'?`;let o=a.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(i=i||`Did you mean '${n.id}.${a}'?`)}return i}function _Ie(e,t,r){let i=e.options||{},n=ne({},i);return xIe(n,r),n.log===null&&(n.log=new xP),gX(n,Ku()),gX(n,t),n}function gX(e,t){for(let r in t)if(r in t){let i=t[r];gP(i)&&gP(e[r])?e[r]=ne(ne({},e[r]),t[r]):e[r]=t[r]}}function xIe(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function by(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function TP(e){Ft(e,"null loader"),Ft(by(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e=Ye(ne({},e),{options:ne(ne({},e.options),t)})),((e==null?void 0:e.parseTextSync)||(e==null?void 0:e.parseText))&&(e.text=!0),e.text||(e.binary=!0),e}var wIe=()=>{let e=SP();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function vX(){return wIe()}var yX=new Yl({id:"loaders.gl"});var EIe=/\.([^.]+)$/;async function bX(e,t=[],r,i){if(!xX(e))return null;let n=_X(e,t,Ye(ne({},r),{nothrow:!0}),i);if(n)return n;if(Zo(e)&&(e=await e.slice(0,10).arrayBuffer(),n=_X(e,t,r,i)),!n&&!(r==null?void 0:r.nothrow))throw new Error(wX(e));return n}function _X(e,t=[],r,i){if(!xX(e))return null;if(t&&!Array.isArray(t))return TP(t);let n=[];t&&(n=n.concat(t)),(r==null?void 0:r.ignoreRegisteredLoaders)||n.push(...vX()),TIe(n);let a=SIe(e,n,r,i);if(!a&&!(r==null?void 0:r.nothrow))throw new Error(wX(e));return a}function SIe(e,t,r,i){let n=dd(e),a=yy(e),o=Bm(n)||(i==null?void 0:i.url),s=null,u="";return(r==null?void 0:r.mimeType)&&(s=AP(t,r==null?void 0:r.mimeType),u=`match forced by supplied MIME type ${r==null?void 0:r.mimeType}`),s=s||AIe(t,o),u=u||(s?`matched url ${o}`:""),s=s||AP(t,a),u=u||(s?`matched MIME type ${a}`:""),s=s||RIe(t,e),u=u||(s?`matched initial data ${SX(e)}`:""),s=s||AP(t,r==null?void 0:r.fallbackMimeType),u=u||(s?`matched fallback MIME type ${a}`:""),u&&yX.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function xX(e){return!(e instanceof Response&&e.status===204)}function wX(e){let t=dd(e),r=yy(e),i="No valid loader found (";i+=t?`${Xs.filename(t)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=e?SX(e):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function TIe(e){for(let t of e)TP(t)}function AIe(e,t){let r=t&&EIe.exec(t),i=r&&r[1];return i?kIe(e,i):null}function kIe(e,t){t=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(i.toLowerCase()===t)return r;return null}function AP(e,t){for(let r of e)if(r.mimeTypes&&r.mimeTypes.includes(t)||t===`application/x.${r.id}`)return r;return null}function RIe(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(CIe(t,r))return r}else if(ArrayBuffer.isView(t)){if(EX(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&EX(t,0,r))return r;return null}function CIe(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>e.startsWith(i))}function EX(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>IIe(e,t,r,n))}function IIe(e,t,r,i){if(i instanceof ArrayBuffer)return nP(i,e,i.byteLength);switch(typeof i){case"function":return i(e,r);case"string":let n=kP(e,t,i.length);return i===n;default:return!1}}function SX(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?kP(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?kP(e,0,t):""}function kP(e,t,r){if(e.byteLength<t+r)return"";let i=new DataView(e),n="";for(let a=0;a<r;a++)n+=String.fromCharCode(i.getUint8(t+a));return n}var PIe=256*1024;function*TX(e,t){let r=(t==null?void 0:t.chunkSize)||PIe,i=0,n=new TextEncoder;for(;i<e.length;){let a=Math.min(e.length-i,r),o=e.slice(i,i+a);i+=a,yield n.encode(o)}}var BIe=256*1024;function*AX(e,t={}){let{chunkSize:r=BIe}=t,i=0;for(;i<e.byteLength;){let n=Math.min(e.byteLength-i,r),a=new ArrayBuffer(n),o=new Uint8Array(e,i,n);new Uint8Array(a).set(o),i+=n,yield a}}var OIe=1024*1024;async function*kX(e,t){let r=(t==null?void 0:t.chunkSize)||OIe,i=0;for(;i<e.size;){let n=i+r,a=await e.slice(i,n).arrayBuffer();i=n,yield a}}function RP(e,t){return on?FIe(e,t):DIe(e,t)}async function*FIe(e,t){let r=e.getReader(),i;try{for(;;){let n=i||r.read();(t==null?void 0:t._streamReadAhead)&&(i=r.read());let{done:a,value:o}=await n;if(a)return;yield jw(o)}}catch{r.releaseLock()}}async function*DIe(e,t){for await(let r of e)yield jw(r)}function RX(e,t){if(typeof e=="string")return TX(e,t);if(e instanceof ArrayBuffer)return AX(e,t);if(Zo(e))return kX(e,t);if(qw(e))return RP(e,t);if(Qo(e))return RP(e.body,t);throw new Error("makeIterator")}var CX="Cannot convert supplied data type";function MIe(e,t,r){if(t.text&&typeof e=="string")return e;if(JY(e)&&(e=e.buffer),e instanceof ArrayBuffer){let i=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let i=e.buffer,n=e.byteLength||e.length;return(e.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(e.byteOffset,e.byteOffset+n)),i}throw new Error(CX)}async function IX(e,t,r){let i=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||i)return MIe(e,t,r);if(Zo(e)&&(e=await Uw(e)),Qo(e)){let n=e;return await rX(n),t.binary?await n.arrayBuffer():await n.text()}if(qw(e)&&(e=RX(e,r)),XY(e)||$Y(e))return sP(e);throw new Error(CX)}function Ww(e,t){let r=Ku(),i=e||r;return typeof i.fetch=="function"?i.fetch:hd(i.fetch)?n=>Ua(n,i):(t==null?void 0:t.fetch)?t==null?void 0:t.fetch:Ua}function PX(e,t,r){if(r)return r;let i=ne({fetch:Ww(t,e)},e);if(i.url){let n=Bm(i.url);i.baseUrl=n,i.queryString=eX(i.url),i.filename=Xs.filename(n),i.baseUrl=Xs.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function BX(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let i=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...i]:i}return r&&r.length?r:null}async function wo(e,t,r,i){Zn(!i||typeof i=="object"),t&&!Array.isArray(t)&&!by(t)&&(i=void 0,r=t,t=void 0),e=await e,r=r||{};let n=dd(e),o=BX(t,i),s=await bX(e,o,r);return s?(r=pX(r,s,o,n),i=PX({url:n,parse:wo,loaders:o},r,i||null),await LIe(s,e,r,i)):null}async function LIe(e,t,r,i){if(XI(e),Qo(t)){let n=t,{ok:a,redirected:o,status:s,statusText:u,type:l,url:c}=n,f=Object.fromEntries(n.headers.entries());i.response={headers:f,ok:a,redirected:o,status:s,statusText:u,type:l,url:c}}if(t=await IX(t,e,r),e.parseTextSync&&typeof t=="string")return r.dataType="text",e.parseTextSync(t,r,i,e);if(eP(e,r))return await tP(e,t,r,i,wo);if(e.parseText&&typeof t=="string")return await e.parseText(t,r,i,e);if(e.parse)return await e.parse(t,r,i,e);throw Zn(!e.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}async function Wr(e,t,r,i){let n,a;!Array.isArray(t)&&!by(t)?(n=[],a=t,i=void 0):(n=t,a=r);let o=Ww(a),s=e;return typeof e=="string"&&(s=await o(e)),Zo(e)&&(s=await o(e)),Array.isArray(n)?await wo(s,n,a):await wo(s,n,a)}async function Mm(e,t,r){let i=Ku();if(r=ne(ne({},i),r),rP(t,r))return await YI(t,e,r);if(t.encode)return await t.encode(e,r);if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeText)return new TextEncoder().encode(await t.encodeText(e,r));if(t.encodeInBatches){let n=OX(e,t,r),a=[];for await(let o of n)a.push(o);return Vu(...a)}if(!on&&t.encodeURLtoURL){let n=DX("input");await iX(n,e);let a=DX("output"),o=await FX(n,a,t,r);return(await Ua(o)).arrayBuffer()}throw new Error("Writer could not encode data")}function Vw(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);throw new Error("Writer could not synchronously encode data")}function OX(e,t,r){if(t.encodeInBatches){let i=jIe(e);return t.encodeInBatches(i,r)}throw new Error("Writer could not encode data in batches")}async function FX(e,t,r,i){if(e=Af(e),t=Af(t),on||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,i)}function jIe(e){return[{table:e,start:0,end:e.length}]}function DX(e){return`/tmp/${e}`}var iu=Fe(fr()),ng=Fe(ua());function Uy(){let e;if(typeof window!="undefined"&&window.performance)e=window.performance.now();else if(typeof process!="undefined"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Jm=class{constructor(t,r){Wt(this,"name",void 0),Wt(this,"type",void 0),Wt(this,"sampleSize",1),Wt(this,"time",0),Wt(this,"count",0),Wt(this,"samples",0),Wt(this,"lastTiming",0),Wt(this,"lastSampleTime",0),Wt(this,"lastSampleCount",0),Wt(this,"_count",0),Wt(this,"_time",0),Wt(this,"_samples",0),Wt(this,"_startTime",0),Wt(this,"_timerPending",!1),this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Uy(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Uy()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Gy=class{constructor(t){Wt(this,"id",void 0),Wt(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:i}=t,n=this.stats[r];return n||(t instanceof Jm?n=t:n=new Jm(r,i),this.stats[r]=n),n}};var pB=class{constructor(t,r,i){this.item=t,this.previous=r,this.next=i}};var mB=class{constructor(){this.head=null;this.tail=null;this._length=0}get length(){return this._length}add(t){let r=new pB(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){!t||(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let i=t.next;t.next=r,this.tail===t?this.tail=r:i.previous=r,r.next=i,r.previous=t,++this._length}};var gB=class{constructor(){this._list=new mB,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,i){r._cacheNode||(r._cacheNode=this._list.add(r),i&&i(t,r))}unloadTile(t,r,i){let n=r._cacheNode;!n||(this._list.remove(n),r._cacheNode=null,i&&i(t,r))}unloadTiles(t,r){let i=this._trimTiles;this._trimTiles=!1;let n=this._list,a=t.maximumMemoryUsage*1024*1024,o=this._sentinel,s=n.head;for(;s!==o&&(t.gpuMemoryUsageInBytes>a||i);){let u=s.item;s=s.next,this.unloadTile(t,u,r)}}trim(){this._trimTiles=!0}};var vB=Fe(ua()),Sd=Fe(fr());function WJ(e,t){Ft(e),Ft(t);let{rtcCenter:r,gltfUpAxis:i}=t,{computedTransform:n,boundingVolume:{center:a}}=e,o=new Sd.Matrix4(n);switch(r&&o.translate(r),i){case"Z":break;case"Y":let f=new Sd.Matrix4().rotateX(Math.PI/2);o=o.multiplyRight(f);break;case"X":let h=new Sd.Matrix4().rotateY(-Math.PI/2);o=o.multiplyRight(h);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let s=new Sd.Vector3(a);t.cartesianModelMatrix=o,t.cartesianOrigin=s;let u=vB.Ellipsoid.WGS84.cartesianToCartographic(s,new Sd.Vector3),c=vB.Ellipsoid.WGS84.eastNorthUpToFixedFrame(s).invert();t.cartographicModelMatrix=c.multiplyRight(o),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var rl=Fe(fr()),oc=Fe(tl()),nS=Fe(ua()),gQ=new rl.Vector3,DB=new rl.Vector3,MB=new oc.CullingVolume([new oc.Plane,new oc.Plane,new oc.Plane,new oc.Plane,new oc.Plane,new oc.Plane]);function vQ(e,t){let{cameraDirection:r,cameraUp:i,height:n}=e,{metersPerUnit:a}=e.distanceScales,o=aS(e,e.center),s=nS.Ellipsoid.WGS84.eastNorthUpToFixedFrame(o),u=e.unprojectPosition(e.cameraPosition),l=nS.Ellipsoid.WGS84.cartographicToCartesian(u,new rl.Vector3),c=new rl.Vector3(s.transformAsVector(new rl.Vector3(r).scale(a))).normalize(),f=new rl.Vector3(s.transformAsVector(new rl.Vector3(i).scale(a))).normalize();T6e(e);let h=e.constructor,{longitude:d,latitude:p,width:y,bearing:g,zoom:b}=e,E=new h({longitude:d,latitude:p,height:n,width:y,bearing:g,zoom:b,pitch:0});return{camera:{position:l,direction:c,up:f},viewport:e,topDownViewport:E,height:n,cullingVolume:MB,frameNumber:t,sseDenominator:1.15}}function yQ(e,t,r){if(r===0||e.length<=r)return[e,[]];let i=[],{longitude:n,latitude:a}=t.viewport;for(let[l,c]of e.entries()){let[f,h]=c.header.mbs,d=Math.abs(n-f),p=Math.abs(a-h),y=Math.sqrt(p*p+d*d);i.push([l,y])}let o=i.sort((l,c)=>l[1]-c[1]),s=[];for(let l=0;l<r;l++)s.push(e[o[l][0]]);let u=[];for(let l=r;l<o.length;l++)u.push(e[o[l][0]]);return[s,u]}function T6e(e){let t=e.getFrustumPlanes(),r=bQ(t.near,e.cameraPosition),i=aS(e,r),n=aS(e,e.cameraPosition,DB),a=0;MB.planes[a++].fromPointNormal(i,gQ.copy(i).subtract(n));for(let o in t){if(o==="near")continue;let s=t[o],u=bQ(s,r,DB),l=aS(e,u,DB);MB.planes[a++].fromPointNormal(l,gQ.copy(i).subtract(l))}}function bQ(e,t,r=new rl.Vector3){let i=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-i).add(t),r}function aS(e,t,r=new rl.Vector3){let i=e.unprojectPosition(t);return nS.Ellipsoid.WGS84.cartographicToCartesian(i,r)}var LB=Fe(fr()),oS=Fe(tl()),_Q=Fe(ua()),A6e=6378137,k6e=6378137,jB=6356752314245179e-9,xQ=new LB.Vector3;function wQ(e,t){if(e instanceof oS.OrientedBoundingBox){let{halfAxes:r}=e,i=R6e(r);return Math.log2(jB/(i+t[2]))}else if(e instanceof oS.BoundingSphere){let{radius:r}=e;return Math.log2(jB/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:i}=e,n=Math.log2(A6e/r),a=Math.log2(k6e/i);return(n+a)/2}return 1}function NB(e,t,r){let i=_Q.Ellipsoid.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],new LB.Vector3),n=Math.sqrt(Math.pow(i[0]-r[0],2)+Math.pow(i[1]-r[1],2)+Math.pow(i[2]-r[2],2));return Math.log2(jB/(n+t[2]))}function EQ(e,t,r){let[i,n,a,o]=e;return NB({xmin:i,xmax:a,ymin:n,ymax:o,zmin:0,zmax:0},t,r)}function R6e(e){e.getColumn(0,xQ);let t=e.getColumn(1),r=e.getColumn(2);return xQ.add(t).add(r).len()}var ru=Fe(fr()),fS=Fe(tl());var Wa={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},ea;(function(r){r[r.ADD=1]="ADD",r[r.REPLACE=2]="REPLACE"})(ea||(ea={}));var il;(function(n){n.EMPTY="empty",n.SCENEGRAPH="scenegraph",n.POINTCLOUD="pointcloud",n.MESH="mesh"})(il||(il={}));var En;(function(r){r.I3S="I3S",r.TILES3D="TILES3D"})(En||(En={}));var sc;(function(r){r.GEOMETRIC_ERROR="geometricError",r.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(sc||(sc={}));var SQ={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var Lr=Fe(fr()),sS=Fe(tl()),ig=Fe(ua());function TQ(e){return e!=null}var ka=new Lr.Vector3,uS=new Lr.Vector3,C6e=new Lr.Vector3,I6e=new Lr.Vector3;function Mf(e,t,r){if(Ft(e,"3D Tile: boundingVolume must be defined"),e.box)return P6e(e.box,t,r);if(e.region){let[i,n,a,o,s,u]=e.region,l=ig.Ellipsoid.WGS84.cartographicToCartesian([(0,Lr.degrees)(i),(0,Lr.degrees)(o),s],C6e),c=ig.Ellipsoid.WGS84.cartographicToCartesian([(0,Lr.degrees)(a),(0,Lr.degrees)(n),u],I6e),f=new Lr.Vector3().addVectors(l,c).multiplyScalar(.5),h=new Lr.Vector3().subVectors(l,c).len()/2;return kQ([f[0],f[1],f[2],h],new Lr.Matrix4)}if(e.sphere)return kQ(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function AQ(e,t){if(e.box)return B6e(t);if(e.region){let[r,i,n,a,o,s]=e.region;return[[(0,Lr.degrees)(r),(0,Lr.degrees)(i),o],[(0,Lr.degrees)(n),(0,Lr.degrees)(a),s]]}if(e.sphere)return O6e(t);throw new Error("Unkown boundingVolume type")}function P6e(e,t,r){let i=new Lr.Vector3(e[0],e[1],e[2]);t.transform(i,i);let n=[];if(e.length===10){let l=e.slice(3,6),c=new Lr.Quaternion;c.fromArray(e,6);let f=new Lr.Vector3([1,0,0]),h=new Lr.Vector3([0,1,0]),d=new Lr.Vector3([0,0,1]);f.transformByQuaternion(c),f.scale(l[0]),h.transformByQuaternion(c),h.scale(l[1]),d.transformByQuaternion(c),d.scale(l[2]),n=[...f.toArray(),...h.toArray(),...d.toArray()]}else n=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let a=t.transformAsVector(n.slice(0,3)),o=t.transformAsVector(n.slice(3,6)),s=t.transformAsVector(n.slice(6,9)),u=new Lr.Matrix3([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);return TQ(r)?(r.center=i,r.halfAxes=u,r):new sS.OrientedBoundingBox(i,u)}function kQ(e,t,r){let i=new Lr.Vector3(e[0],e[1],e[2]);t.transform(i,i);let n=t.getScale(uS),a=Math.max(Math.max(n[0],n[1]),n[2]),o=e[3]*a;return TQ(r)?(r.center=i,r.radius=o,r):new sS.BoundingSphere(i,o)}function B6e(e){let t=RQ(),{halfAxes:r}=e,i=new Lr.Vector3(r.getColumn(0)),n=new Lr.Vector3(r.getColumn(1)),a=new Lr.Vector3(r.getColumn(2));for(let o=0;o<2;o++){for(let s=0;s<2;s++){for(let u=0;u<2;u++)ka.copy(e.center),ka.add(i),ka.add(n),ka.add(a),CQ(t,ka),a.negate();n.negate()}i.negate()}return t}function O6e(e){let t=RQ(),{center:r,radius:i}=e,n=ig.Ellipsoid.WGS84.scaleToGeodeticSurface(r,ka),a;n?a=ig.Ellipsoid.WGS84.geodeticSurfaceNormal(n):a=new Lr.Vector3(0,0,1);let o=new Lr.Vector3(a[2],-a[1],0);o.len()>0?o.normalize():o=new Lr.Vector3(0,1,0);let s=o.clone().cross(a);for(let u of[o,s,a]){uS.copy(u).scale(i);for(let l=0;l<2;l++)ka.copy(r),ka.add(uS),CQ(t,ka),uS.negate()}return t}function RQ(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function CQ(e,t){ig.Ellipsoid.WGS84.cartesianToCartographic(t,ka),e[0][0]=Math.min(e[0][0],ka[0]),e[0][1]=Math.min(e[0][1],ka[1]),e[0][2]=Math.min(e[0][2],ka[2]),e[1][0]=Math.max(e[1][0],ka[0]),e[1][1]=Math.max(e[1][1],ka[1]),e[1][2]=Math.max(e[1][2],ka[2])}var uc=Fe(fr()),Gxt=new uc.Vector3,zxt=new uc.Vector3,Hxt=new uc.Matrix4,Wxt=new uc.Vector3,Vxt=new uc.Vector3,Kxt=new uc.Vector3;function F6e(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function D6e(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,i=e.dynamicScreenSpaceErrorFactor;return F6e(t,r)*i}return 0}function IQ(e,t,r){let i=e.tileset,n=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,a=r?n:e.lodMetricValue;if(a===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:s,sseDenominator:u}=t,{viewDistanceScale:l}=i.options,c=a*s*(l||1)/(o*u);return c-=D6e(i,o),c}var lc=Fe(fr()),lS=Fe(ua()),qB=new lc.Vector3,PQ=new lc.Vector3,Lf=new lc.Vector3,BQ=new lc.Vector3,M6e=new lc.Vector3,UB=new lc.Matrix4,OQ=new lc.Matrix4;function FQ(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*GB(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function GB(e,t){let{topDownViewport:r}=t,i=e.header.mbs[1],n=e.header.mbs[0],a=e.header.mbs[2],o=e.header.mbs[3],s=[...e.boundingVolume.center],u=r.unprojectPosition(r.cameraPosition);lS.Ellipsoid.WGS84.cartographicToCartesian(u,qB),PQ.copy(qB).subtract(s).normalize(),lS.Ellipsoid.WGS84.eastNorthUpToFixedFrame(s,UB),OQ.copy(UB).invert(),Lf.copy(qB).transform(OQ);let l=Math.sqrt(Lf[0]*Lf[0]+Lf[1]*Lf[1]),c=l*l/Lf[2];BQ.copy([Lf[0],Lf[1],c]);let h=BQ.transform(UB).subtract(s).normalize(),p=PQ.cross(h).normalize().scale(o).add(s),y=lS.Ellipsoid.WGS84.cartesianToCartographic(p),g=r.project([n,i,a]),b=r.project(y);return M6e.copy(g).subtract(b).magnitude()}function DQ(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var cS=class{constructor(t=0){this._map=new Map;this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Ft(t<this._array.length),this._array[t]}set(t,r){Ft(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Ft(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Ft(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var L6e={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},cc=class{constructor(t){this.root=null;this.selectedTiles={};this.requestedTiles={};this.emptyTiles={};this.lastUpdate=new Date().getTime();this.updateDebounceTime=1e3;this._traversalStack=new cS;this._emptyTraversalStack=new cS;this._frameNumber=null;this.options=ne(ne({},L6e),t)}traversalFinished(t){return!0}traverse(t,r,i){this.root=t,this.options=ne(ne({},this.options),i),this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let i=this._traversalStack;for(t._selectionDepth=1,i.push(t);i.length>0;){let a=i.pop(),o=!1;this.canTraverse(a,r)&&(this.updateChildTiles(a,r),o=this.updateAndPushChildren(a,r,i,a.hasRenderContent?a._selectionDepth+1:a._selectionDepth));let s=a.parent,u=Boolean(!s||s._shouldRefine),l=!o;a.hasRenderContent?a.refine===ea.ADD?(this.loadTile(a,r),this.selectTile(a,r)):a.refine===ea.REPLACE&&(this.loadTile(a,r),l&&this.selectTile(a,r)):(this.emptyTiles[a.id]=a,this.loadTile(a,r),l&&this.selectTile(a,r)),this.touchTile(a,r),a._shouldRefine=o&&u}let n=new Date().getTime();(this.traversalFinished(r)||n-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=n,this.options.onTraversalEnd(r))}updateChildTiles(t,r){let i=t.children;for(let n of i)this.updateTile(n,r)}updateAndPushChildren(t,r,i,n){let{loadSiblings:a,skipLevelOfDetail:o}=this.options,s=t.children;s.sort(this.compareDistanceToCamera.bind(this));let u=t.refine===ea.REPLACE&&t.hasRenderContent&&!o,l=!1,c=!0;for(let f of s)if(f._selectionDepth=n,f.isVisibleAndInRequestVolume?(i.find(f)&&i.delete(f),i.push(f),l=!0):(u||a)&&(this.loadTile(f,r),this.touchTile(f,r)),u){let h;if(f._inRequestVolume?f.hasRenderContent?h=f.contentAvailable:h=this.executeEmptyTraversal(f,r):h=!1,c=c&&h,!c)return!1}return l||(c=!1),c}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){this.shouldLoadTile(t)&&(t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r,i=!1,n=!1){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!n&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,r,i):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,r,i=!1){let n=t._screenSpaceError;return i&&(n=t.getScreenSpaceError(r,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(t,r){let i=[];if(this.options.viewportTraversersMap)for(let n in this.options.viewportTraversersMap)this.options.viewportTraversersMap[n]===r.viewport.id&&i.push(n);else i.push(r.viewport.id);t.updateVisibility(r,i)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let i=!1;for(let n of t.children)n.updateVisibility(r),i=i||n.isVisibleAndInRequestVolume;return i}executeEmptyTraversal(t,r){let i=!0,n=this._emptyTraversalStack;for(n.push(t);n.length>0&&i;){let a=n.pop();if(this.updateTile(a,r),a.isVisibleAndInRequestVolume||this.loadTile(a,r),this.touchTile(a,r),!a.hasRenderContent&&this.canTraverse(a,r,!1,!0)){let s=a.children;for(let u of s)n.find(u)&&n.delete(u),n.push(u)}else a.contentAvailable||(i=!1)}return i}};var MQ=new ru.Vector3;function j6e(e){return e!=null}var fc=class{constructor(t,r,i,n=""){this.lodMetricType="geometricError";this.lodMetricValue=0;this.boundingVolume=null;this.content=null;this.contentState=Wa.UNLOADED;this.gpuMemoryUsageInBytes=0;this.children=[];this.depth=0;this.viewportIds=[];this.transform=new ru.Matrix4;this.extensions=null;this.implicitTiling=null;this.userData={};this.hasEmptyContent=!1;this.hasTilesetContent=!1;this.traverser=new cc({});this._cacheNode=null;this._frameNumber=null;this._expireDate=null;this._expiredContent=null;this._distanceToCamera=0;this._screenSpaceError=0;this._visible=void 0;this._initialTransform=new ru.Matrix4;this._priority=0;this._selectedFrame=0;this._requestedFrame=0;this._selectionDepth=0;this._touchedFrame=0;this._centerZDepth=0;this._shouldRefine=!1;this._stackLength=0;this._visitedFrame=0;this._inRequestVolume=!1;this._lodJudge=null;this.header=r,this.tileset=t,this.id=n||r.id,this.url=r.url,this.parent=i,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===Wa.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===Wa.UNLOADED}get contentExpired(){return this.contentState===Wa.EXPIRED}get contentFailed(){return this.contentState===Wa.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=AQ(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case En.I3S:return GB(this,t);case En.TILES3D:return IQ(this,t,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:r}=t.options,i=this.refine===ea.ADD||r;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Wa.UNLOADED)return-1;let n=this.parent,o=n&&(!i||this._screenSpaceError===0||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,s=t.root?t.root._screenSpaceError:0;return Math.max(s-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Wa.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=Wa.UNLOADED,!1;try{let i=this.tileset.getTileUrl(this.contentUrl),n=this.tileset.loader,a=Ye(ne({},this.tileset.loadOptions),{[n.id]:ne(Ye(ne({},this.tileset.loadOptions[n.id]),{isTileset:this.type==="json"}),this._getLoaderSpecificOptions(n.id))});return this.content=await Wr(i,n,a),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Wa.READY,this._onContentLoaded(),!0}catch(i){throw this.contentState=Wa.FAILED,i}finally{r.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=Wa.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let i=this.parent,n=i?i._visibilityPlaneMask:fS.CullingVolume.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let a=i?i.computedTransform:this.tileset.modelMatrix;this._updateTransform(a)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,n),this._visible=this._visibilityPlaneMask!==fS.CullingVolume.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}visibility(t,r){let{cullingVolume:i}=t,{boundingVolume:n}=this;return i.computeVisibilityWithPlaneMask(n,r)}contentVisibility(){return!0}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return MQ.subVectors(r.center,t.position),t.direction.dot(MQ)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(j6e(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Wa.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new ru.Matrix4(t.transform):new ru.Matrix4;let r=this.parent,i=this.tileset,n=r&&r.computedTransform?r.computedTransform.clone():i.modelMatrix.clone();this.computedTransform=new ru.Matrix4(n).multiplyRight(this.transform);let a=r&&r._initialTransform?r._initialTransform.clone():new ru.Matrix4;this._initialTransform=new ru.Matrix4(a).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Wa.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=fS.CullingVolume.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||ea.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=Mf(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;!r||(r.boundingVolume&&(this._contentBoundingVolume=Mf(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Mf(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new ru.Matrix4){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return Ye(ne({},this.tileset.options.i3s),{_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1});case"3d-tiles":case"cesium-ion":default:return DQ(this.tileset.tileset)}}};var zB=class extends cc{compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let i=t.children.length>0;if(t.hasTilesetContent&&i){let o=t.children[0];this.updateTileVisibility(o,r),t._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let n=t.refine===ea.REPLACE,a=t._optimChildrenWithinParent===SQ.USE_OPTIMIZATION;if(n&&a&&i&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:i}=t;return!i||i.hasTilesetContent||i.refine!==ea.ADD?!1:!this.shouldRefine(t,r,!0)}};var HB=class{constructor(){this.frameNumberMap=new Map}register(t,r){let i=this.frameNumberMap.get(t)||new Map,n=i.get(r)||0;i.set(r,n+1),this.frameNumberMap.set(t,i)}deregister(t,r){let i=this.frameNumberMap.get(t);if(!i)return;let n=i.get(r)||1;i.set(r,n-1)}isZero(t,r){var n;return(((n=this.frameNumberMap.get(t))==null?void 0:n.get(r))||0)===0}};var WB={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},VB=class{constructor(){this.pendingTilesRegister=new HB;this._statusMap={}}add(t,r,i,n){if(!this._statusMap[r]){let{frameNumber:a,viewport:{id:o}}=n;this._statusMap[r]={request:t,callback:i,key:r,frameState:n,status:WB.REQUESTED},this.pendingTilesRegister.register(o,a),t().then(s=>{this._statusMap[r].status=WB.COMPLETED;let{frameNumber:u,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,u),this._statusMap[r].callback(s,n)}).catch(s=>{this._statusMap[r].status=WB.ERROR;let{frameNumber:u,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,u),i(s)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:i,viewport:{id:n}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(n,i);let{frameNumber:a,viewport:{id:o}}=r;this.pendingTilesRegister.register(o,a),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var KB=class extends cc{constructor(t){super(t);this._tileManager=new VB}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=FQ(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let i=t.header.children||[],n=t.children,a=t.tileset;for(let o of i){let s=`${o.id}-${r.viewport.id}`,u=n&&n.find(l=>l.id===s);if(u)u&&this.updateTile(u,r);else{let l=()=>this._loadTile(o.id,a);this._tileManager.find(s)?this._tileManager.update(s,r):(a.tileset.nodePages&&(l=()=>a.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(l,s,f=>this._onTileLoad(f,t,s),r))}}return!1}async _loadTile(t,r){let{loader:i}=r,n=r.getTileUrl(`${r.url}/nodes/${t}`),a=Ye(ne({},r.loadOptions),{i3s:Ye(ne({},r.loadOptions.i3s),{isTileHeader:!0})});return await Wr(n,i,a)}_onTileLoad(t,r,i){let n=new fc(r.tileset,t,r,i);r.children.push(n);let a=this._tileManager.find(n.id).frameState;this.updateTile(n,a),this._frameNumber===a.frameNumber&&(this.traversalFinished(a)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,a)}};var N6e={description:"",ellipsoid:ng.Ellipsoid.WGS84,modelMatrix:new iu.Matrix4,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},hS="Tiles In Tileset(s)",YB="Tiles In Memory",LQ="Tiles In View",jQ="Tiles To Render",NQ="Tiles Loaded",XB="Tiles Loading",qQ="Tiles Unloaded",UQ="Failed Tile Loads",GQ="Points/Vertices",$B="Tile Memory Use",dS=class{constructor(t,r){this.root=null;this.roots={};this.asset={};this.description="";this.extras=null;this.attributions={};this.credits={};this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1};this.cartographicCenter=null;this.cartesianCenter=null;this.zoom=1;this.boundingVolume=null;this.dynamicScreenSpaceErrorComputedDensity=0;this.maximumMemoryUsage=32;this.gpuMemoryUsageInBytes=0;this._frameNumber=0;this._queryParams={};this._extensionsUsed=[];this._tiles={};this._pendingCount=0;this.selectedTiles=[];this.traverseCounter=0;this.geometricError=0;this.lastUpdatedVieports=null;this._requestedTiles=[];this._emptyTiles=[];this.frameStateData={};this._cache=new gB;this.updatePromise=null;this.options=ne(ne({},N6e),r),this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||Xs.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new my({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.stats=new Gy({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options=ne(ne({},this.options),t)}setOptions(t){this.options=ne(ne({},this.options),t)}getTileUrl(t){return t.startsWith("data:")?t:`${t}${t.includes("?")?"&":"?"}${this.queryParams}`}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=[];for(let n of r){let a=n.id;this._needTraverse(a)?i.push(a):this.traverseCounter--}for(let n of r){let a=n.id;if(this.roots[a]||(this.roots[a]=this._initializeTileHeaders(this.tileset,null)),!i.includes(a))continue;let o=vQ(n,this._frameNumber);this._traverser.traverse(this.roots[a],o,this.options)}}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let i=this.frameStateData[r],n=Object.values(this._traverser.selectedTiles),[a,o]=yQ(n,t,this.options.maximumTilesSelected);i.selectedTiles=a;for(let s of o)s.unselect();i._requestedTiles=Object.values(this._traverser.requestedTiles),i._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let r=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,r){if(t.length!==r.length)return!0;let i=new Set(t.map(o=>o.id)),n=new Set(r.map(o=>o.id)),a=t.filter(o=>!n.has(o.id)).length>0;return a=a||r.filter(o=>!i.has(o.id)).length>0,a}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r))}_updateStats(){let t=0,r=0;for(let i of this.selectedTiles)i.contentAvailable&&i.content&&(t++,i.content.pointCount?r+=i.content.pointCount:r+=i.content.vertexCount);this.stats.get(LQ).count=this.selectedTiles.length,this.stats.get(jQ).count=t,this.stats.get(GQ).count=r}async _initializeTileSet(t){this.type===En.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===En.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===En.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var i;let t=this.tileset.fullExtent;if(t){let{xmin:n,xmax:a,ymin:o,ymax:s,zmin:u,zmax:l}=t;this.cartographicCenter=new iu.Vector3(n+(a-n)/2,o+(s-o)/2,u+(l-u)/2),this.cartesianCenter=ng.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter,new iu.Vector3),this.zoom=NB(t,this.cartographicCenter,this.cartesianCenter);return}let r=(i=this.tileset.store)==null?void 0:i.extent;if(r){let[n,a,o,s]=r;this.cartographicCenter=new iu.Vector3(n+(o-n)/2,a+(s-a)/2,0),this.cartesianCenter=ng.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter,new iu.Vector3),this.zoom=EQ(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new iu.Vector3,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:r}=t.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new iu.Vector3,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?this.cartographicCenter=ng.Ellipsoid.WGS84.cartesianToCartographic(r,new iu.Vector3):this.cartographicCenter=new iu.Vector3(0,0,-ng.Ellipsoid.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=wQ(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(hS),this.stats.get(XB),this.stats.get(YB),this.stats.get(LQ),this.stats.get(jQ),this.stats.get(NQ),this.stats.get(qQ),this.stats.get(UQ),this.stats.get(GQ),this.stats.get($B,"memory")}_initializeTileHeaders(t,r){var n;let i=new fc(this,t.root,r);if(r&&(r.children.push(i),i.depth=r.depth+1),this.type===En.TILES3D){let a=[];for(a.push(i);a.length>0;){let o=a.pop();this.stats.get(hS).incrementCount();let s=o.header.children||[];for(let u of s){let l=new fc(this,u,o);if((n=l.contentUrl)==null?void 0:n.includes("?session=")){let f=new URL(l.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(l),l.depth=o.depth+1,a.push(l)}}}return i}_initializeTraverser(){let t;switch(this.type){case En.TILES3D:t=zB;break;case En.I3S:t=KB;break;default:t=cc}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r;try{this._onStartTileLoading(),r=await t.loadContent()}catch(i){this._onTileLoadError(t,i instanceof Error?i:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}_onTileLoadError(t,r){this.stats.get(UQ).incrementCount();let i=r.message||r.toString(),n=t.url;console.error(`A 3D tile failed to load: ${t.url} ${i}`),this.options.onTileError(t,i,n)}_onTileLoad(t,r){var i,n;if(!!r){if(this.type===En.I3S){let a=((n=(i=this.tileset)==null?void 0:i.nodePagesTile)==null?void 0:n.nodesInNodePages)||0;this.stats.get(hS).reset(),this.stats.get(hS).addCount(a)}t&&t.content&&WJ(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){var r;if(this.type===En.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===En.TILES3D){let{extensionsRemoved:i=[]}=((r=t.content)==null?void 0:r.gltf)||{};i.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),i.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),i.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(XB).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(XB).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(NQ).incrementCount(),this.stats.get(YB).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get($B).count=this.gpuMemoryUsageInBytes}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(YB).decrementCount(),this.stats.get(qQ).incrementCount(),this.stats.get($B).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let i of r.children)t.push(i);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,i=[];for(i.push(r);i.length>0;){t=i.pop();for(let n of t.children)i.push(n);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let r=new URLSearchParams(t.queryString),i=Object.fromEntries(r.entries());this._queryParams=ne(ne({},this._queryParams),i)}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var ag="4.0.0-alpha.16";var ss={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Hwt=Object.keys(ss),jf={BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]};function JB(e,t,r){Ft(e instanceof ArrayBuffer);let i=new TextDecoder("utf8"),n=new Uint8Array(e,t,r);return i.decode(n)}function zQ(e,t=0){let r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}var pS="4.0.0-alpha.16";var q6e={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},HQ={name:"Draco",id:"draco",module:"draco",version:pS,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:q6e};function WQ(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function QB(e){let t=1/0,r=1/0,i=1/0,n=-1/0,a=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let l=0;l<u;l+=3){let c=s[l],f=s[l+1],h=s[l+2];t=c<t?c:t,r=f<r?f:r,i=h<i?h:i,n=c>n?c:n,a=f>a?f:a,o=h>o?h:o}return[[t,r,i],[n,a,o]]}function ZB(e,t,r){let i=WQ(t.value),n=r||VQ(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:i}]},nullable:!1,metadata:n}}function VQ(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function KQ(e,t,r){let i=XQ(t.metadata),n=[],a=U6e(t.attributes);for(let o in e){let s=e[o],u=YQ(o,s,a[o]);n.push(u)}if(r){let o=YQ("indices",r);n.push(o)}return{fields:n,metadata:i}}function U6e(e){let t={};for(let r in e){let i=e[r];t[i.name||"undefined"]=i}return t}function YQ(e,t,r){let i=r?XQ(r.metadata):void 0;return ZB(e,t,i)}function XQ(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var $Q={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},G6e={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},z6e=4,mS=class{constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,r={}){let i=new this.draco.DecoderBuffer;i.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(r);let n=this.decoder.GetEncodedGeometryType(i),a=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(n){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,a);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,a);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!a.ptr){let h=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(h)}let s=this._getDracoLoaderData(a,n,r),u=this._getMeshData(a,s,r),l=QB(u.attributes),c=KQ(u.attributes,s,u.indices);return Ye(ne({loader:"draco",loaderData:s,header:{vertexCount:a.num_points(),boundingBox:l}},u),{schema:c})}finally{this.draco.destroy(i),a&&this.draco.destroy(a)}}_getDracoLoaderData(t,r,i){let n=this._getTopLevelMetadata(t),a=this._getDracoAttributes(t,i);return{geometry_type:r,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:n,attributes:a}}_getDracoAttributes(t,r){let i={};for(let n=0;n<t.num_attributes();n++){let a=this.decoder.GetAttribute(t,n),o=this._getAttributeMetadata(t,n);i[a.unique_id()]={unique_id:a.unique_id(),attribute_type:a.attribute_type(),data_type:a.data_type(),num_components:a.num_components(),byte_offset:a.byte_offset(),byte_stride:a.byte_stride(),normalized:a.normalized(),attribute_index:n,metadata:o};let s=this._getQuantizationTransform(a,r);s&&(i[a.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(a,r);u&&(i[a.unique_id()].octahedron_transform=u)}return i}_getMeshData(t,r,i){let n=this._getMeshAttributes(r,t,i);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(i.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,r,i){let n={};for(let a of Object.values(t.attributes)){let o=this._deduceAttributeName(a,i);a.name=o;let{value:s,size:u}=this._getAttributeValues(r,a);n[o]={value:s,size:u,byteOffset:a.byte_offset,byteStride:a.byte_stride,normalized:a.normalized}}return n}_getTriangleListIndices(t){let i=t.num_faces()*3,n=i*z6e,a=this.draco._malloc(n);try{return this.decoder.GetTrianglesUInt32Array(t,n,a),new Uint32Array(this.draco.HEAPF32.buffer,a,i).slice()}finally{this.draco._free(a)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),V6e(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let i=G6e[r.data_type],n=r.num_components,o=t.num_points()*n,s=o*i.BYTES_PER_ELEMENT,u=H6e(this.draco,i),l,c=this.draco._malloc(s);try{let f=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,u,s,c),l=new i(this.draco.HEAPF32.buffer,c,o).slice()}finally{this.draco._free(c)}return{value:l,size:n}}_deduceAttributeName(t,r){let i=t.unique_id;for(let[o,s]of Object.entries(r.extraAttributes||{}))if(s===i)return o;let n=t.attribute_type;for(let o in $Q)if(this.draco[o]===n)return $Q[o];let a=r.attributeNameEntry||"name";return t.metadata[a]?t.metadata[a].string:`CUSTOM_ATTRIBUTE_${i}`}_getTopLevelMetadata(t){let r=this.decoder.GetMetadata(t);return this._getDracoMetadata(r)}_getAttributeMetadata(t,r){let i=this.decoder.GetAttributeMetadata(t,r);return this._getDracoMetadata(i)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let r={},i=this.metadataQuerier.NumEntries(t);for(let n=0;n<i;n++){let a=this.metadataQuerier.GetEntryName(t,n);r[a]=this._getDracoMetadataField(t,a)}return r}_getDracoMetadataField(t,r){let i=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,i);let n=W6e(i);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:n}}finally{this.draco.destroy(i)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:i=[]}=t,n=[...r,...i];for(let a of n)this.decoder.SkipAttributeTransform(this.draco[a])}_getQuantizationTransform(t,r){let{quantizedAttributes:i=[]}=r,n=t.attribute_type();if(i.map(o=>this.decoder[o]).includes(n)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(s=>o.min_value(s))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,r){let{octahedronAttributes:i=[]}=r,n=t.attribute_type();if(i.map(o=>this.decoder[o]).includes(n)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function H6e(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function W6e(e){let t=e.size(),r=new Int32Array(t);for(let i=0;i<t;i++)r[i]=e.GetValue(i);return r}function V6e(e){let t=e.size(),r=new Int32Array(t);for(let i=0;i<t;i++)r[i]=e.GetValue(i);return r}var K6e="1.5.5",Y6e="1.4.1",eO=`https://www.gstatic.com/draco/versioned/decoders/${K6e}`,X6e=`${eO}/draco_decoder.js`,$6e=`${eO}/draco_wasm_wrapper.js`,J6e=`${eO}/draco_decoder.wasm`,dEt=`https://raw.githubusercontent.com/google/draco/${Y6e}/javascript/draco_encoder.js`,Jy;async function JQ(e){let t=e.modules||{};return t.draco3d?Jy=Jy||t.draco3d.createDecoderModule({}).then(r=>({draco:r})):Jy=Jy||Q6e(e),await Jy}async function Q6e(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await Wu(X6e,"draco",e);break;case"wasm":default:[t,r]=await Promise.all([await Wu($6e,"draco",e),await Wu(J6e,"draco",e)])}return t=t||globalThis.DracoDecoderModule,await Z6e(t,r)}function Z6e(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(i=>{e(Ye(ne({},r),{onModuleLoaded:n=>i({draco:n})}))})}var Qy={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:pS,worker:!0,options:{draco:{},source:null}};var og=Ye(ne({},HQ),{parse:e4e});async function e4e(e,t){let{draco:r}=await JQ(t),i=new mS(r);try{return i.parseSync(e,t==null?void 0:t.draco)}finally{i.destroy()}}var t4e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ln={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Zt=ne(ne({},t4e),ln);var tO={[ln.DOUBLE]:Float64Array,[ln.FLOAT]:Float32Array,[ln.UNSIGNED_SHORT]:Uint16Array,[ln.UNSIGNED_INT]:Uint32Array,[ln.UNSIGNED_BYTE]:Uint8Array,[ln.BYTE]:Int8Array,[ln.SHORT]:Int16Array,[ln.INT]:Int32Array},r4e={DOUBLE:ln.DOUBLE,FLOAT:ln.FLOAT,UNSIGNED_SHORT:ln.UNSIGNED_SHORT,UNSIGNED_INT:ln.UNSIGNED_INT,UNSIGNED_BYTE:ln.UNSIGNED_BYTE,BYTE:ln.BYTE,SHORT:ln.SHORT,INT:ln.INT},rO="Failed to convert GL type",Va=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in tO)if(tO[r]===t)return r;throw new Error(rO)}static fromName(t){let r=r4e[t];if(!r)throw new Error(rO);return r}static getArrayType(t){switch(t){case ln.UNSIGNED_SHORT_5_6_5:case ln.UNSIGNED_SHORT_4_4_4_4:case ln.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=tO[t];if(!r)throw new Error(rO);return r}}static getByteSize(t){return Va.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Va.getArrayType(t))}static createTypedArray(t,r,i=0,n){n===void 0&&(n=(r.byteLength-i)/Va.getByteSize(t));let a=Va.getArrayType(t);return new a(r,i,n)}};function QQ(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function iO(e,t=[0,0,0]){let r=e>>11&31,i=e>>5&63,n=e&31;return t[0]=r<<3,t[1]=i<<2,t[2]=n<<3,t}var hc=Fe(fr());var AEt=1/256;var kEt=new hc.Vector2,REt=new hc.Vector3,CEt=new hc.Vector2,IEt=new hc.Vector2,PEt=new Uint8Array(1);function ZQ(e,t=255){return(0,hc.clamp)(e,0,t)/t*2-1}function eZ(e){return e<0?-1:1}function tZ(e,t,r,i){if(QQ(i),e<0||e>r||t<0||t>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(i.x=ZQ(e,r),i.y=ZQ(t,r),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){let n=i.x;i.x=(1-Math.abs(i.y))*eZ(n),i.y=(1-Math.abs(n))*eZ(i.y)}return i.normalize()}function nO(e,t,r){return tZ(e,t,255,r)}var sO=Fe(fr());var Nf=class{constructor(t,r){this.featuresLength=0;this._cachedTypedArrays={};this.json=t,this.buffer=r}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,r=Zt.UNSIGNED_INT,i=1){let n=this.json[t];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(t,r,i,1,n.byteOffset):n}getPropertyArray(t,r,i){let n=this.json[t];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(r=Va.fromName(n.componentType)),this._getTypedArrayFromBinary(t,r,i,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(t,r,n)}getProperty(t,r,i,n,a){let o=this.json[t];if(!o)return o;let s=this.getPropertyArray(t,r,i);if(i===1)return s[n];for(let u=0;u<i;++u)a[u]=s[i*n+u];return a}_getTypedArrayFromBinary(t,r,i,n,a){let o=this._cachedTypedArrays,s=o[t];return s||(s=Va.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+a,n*i),o[t]=s),s}_getTypedArrayFromArray(t,r,i){let n=this._cachedTypedArrays,a=n[t];return a||(a=Va.createTypedArray(r,i),n[t]=a),a}};var i4e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},n4e={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},a4e={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};function rZ(e,t,r,i){let{componentType:n}=e;Ft(e.componentType);let a=typeof n=="string"?Va.fromName(n):n,o=i4e[e.type],s=n4e[e.type],u=a4e[e.type];return r+=e.byteOffset,{values:Va.createTypedArray(a,t,r,o*i),type:a,size:o,unpacker:s,packer:u}}var nl=e=>e!==void 0;function iZ(e,t,r){if(!t)return null;let i=e.getExtension("3DTILES_batch_table_hierarchy"),n=t.HIERARCHY;return n&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=n,i=n),i?o4e(i,r):null}function o4e(e,t){let r,i,n,a=e.instancesLength,o=e.classes,s=e.classIds,u=e.parentCounts,l=e.parentIds,c=a;nl(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,n=getBinaryAccessor(s),s=n.createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,a));let f;if(nl(u))for(nl(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,n=getBinaryAccessor(u),u=n.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a)),f=new Uint16Array(a),c=0,r=0;r<a;++r)f[r]=c,c+=u[r];nl(l)&&nl(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,n=getBinaryAccessor(l),l=n.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,c));let h=o.length;for(r=0;r<h;++r){let g=o[r].length,b=o[r].instances,E=getBinaryProperties(g,b,t);o[r].instances=combine(E,b)}let d=new Array(h).fill(0),p=new Uint16Array(a);for(r=0;r<a;++r)i=s[r],p[r]=d[i],++d[i];let y={classes:o,classIds:s,classIndexes:p,parentCounts:u,parentIndexes:f,parentIds:l};return l4e(y),y}function sg(e,t,r){if(!e)return;let i=e.parentCounts;return e.parentIds?r(e,t):i>0?s4e(e,t,r):u4e(e,t,r)}function s4e(e,t,r){let i=e.classIds,n=e.parentCounts,a=e.parentIds,o=e.parentIndexes,s=i.length,u=scratchVisited;u.length=Math.max(u.length,s);let l=++marker,c=scratchStack;for(c.length=0,c.push(t);c.length>0;){if(t=c.pop(),u[t]===l)continue;u[t]=l;let f=r(e,t);if(nl(f))return f;let h=n[t],d=o[t];for(let p=0;p<h;++p){let y=a[d+p];y!==t&&c.push(y)}}return null}function u4e(e,t,r){let i=!0;for(;i;){let n=r(e,t);if(nl(n))return n;let a=e.parentIds[t];i=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}function l4e(e){let t=[],i=e.classIds.length;for(let n=0;n<i;++n)nZ(e,n,stack)}function nZ(e,t,r){let i=e.parentCounts,n=e.parentIds,a=e.parentIndexes,s=e.classIds.length;if(!nl(n))return;assert(t<s,`Parent index ${t} exceeds the total number of instances: ${s}`),assert(r.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(t);let u=nl(i)?i[t]:1,l=nl(i)?a[t]:t;for(let c=0;c<u;++c){let f=n[l+c];f!==t&&nZ(e,f,r)}r.pop(t)}function so(e){return e!=null}var gS=(e,t)=>e,c4e={HIERARCHY:!0,extensions:!0,extras:!0},ug=class{constructor(t,r,i,n={}){var a;Ft(i>=0),this.json=t||{},this.binary=r,this.featureCount=i,this._extensions=((a=this.json)==null?void 0:a.extensions)||{},this._properties={};for(let o in this.json)c4e[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=iZ(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,r){if(this._checkBatchId(t),Ft(typeof r=="string",r),this._hierarchy){let i=sg(this._hierarchy,t,(n,a)=>{let o=n.classIds[a];return n.classes[o].name===r});return so(i)}return!1}isExactClass(t,r){return Ft(typeof r=="string",r),this.getExactClassName(t)===r}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let r=this._hierarchy.classIds[t];return this._hierarchy.classes[r].name}}hasProperty(t,r){return this._checkBatchId(t),Ft(typeof r=="string",r),so(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=so(r)?r:[],r.length=0;let i=Object.keys(this._properties);return r.push(...i),this._hierarchy&&this._getPropertyNamesInHierarchy(t,r),r}getProperty(t,r){if(this._checkBatchId(t),Ft(typeof r=="string",r),this._binaryProperties){let n=this._binaryProperties[r];if(so(n))return this._getBinaryProperty(n,t)}let i=this._properties[r];if(so(i))return gS(i[t],!0);if(this._hierarchy){let n=this._getHierarchyProperty(t,r);if(so(n))return n}}setProperty(t,r,i){let n=this.featureCount;if(this._checkBatchId(t),Ft(typeof r=="string",r),this._binaryProperties){let o=this._binaryProperties[r];if(o){this._setBinaryProperty(o,t,i);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,r,i))return;let a=this._properties[r];so(a)||(this._properties[r]=new Array(n),a=this._properties[r]),a[t]=gS(i,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,r){return t.unpack(t.typedArray,r)}_setBinaryProperty(t,r,i){t.pack(i,t.typedArray,r)}_initializeBinaryProperties(){let t=null;for(let r in this._properties){let i=this._properties[r],n=this._initializeBinaryProperty(r,i);n&&(t=t||{},t[r]=n)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let i=r;Ft(this.binary,`Property ${t} requires a batch table binary.`),Ft(i.type,`Property ${t} requires a type.`);let n=rZ(i,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let i=sg(this._hierarchy,t,(n,a)=>{let o=n.classIds[a],s=n.classes[o].instances;return so(s[r])});return so(i)}_getPropertyNamesInHierarchy(t,r){sg(this._hierarchy,t,(i,n)=>{let a=i.classIds[n],o=i.classes[a].instances;for(let s in o)o.hasOwnProperty(s)&&r.indexOf(s)===-1&&r.push(s)})}_getHierarchyProperty(t,r){return sg(this._hierarchy,t,(i,n)=>{let a=i.classIds[n],o=i.classes[a],s=i.classIndexes[n],u=o.instances[r];return so(u)?so(u.typedArray)?this._getBinaryProperty(u,s):gS(u[s],!0):null})}_setHierarchyProperty(t,r,i,n){let a=sg(this._hierarchy,r,(o,s)=>{let u=o.classIds[s],l=o.classes[u],c=o.classIndexes[s],f=l.instances[i];return so(f)?(Ft(s===r,`Inherited property "${i}" is read-only.`),so(f.typedArray)?this._setBinaryProperty(f,c,n):f[c]=gS(n,!0),!0):!1});return so(a)}};var aO=4;function qf(e,t,r=0){let i=new DataView(t);if(e.magic=i.getUint32(r,!0),r+=aO,e.version=i.getUint32(r,!0),r+=aO,e.byteLength=i.getUint32(r,!0),r+=aO,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var lg=4,aZ="b3dm tile in legacy format.";function cg(e,t,r){let i=new DataView(t),n;e.header=e.header||{};let a=i.getUint32(r,!0);r+=lg;let o=i.getUint32(r,!0);r+=lg;let s=i.getUint32(r,!0);r+=lg;let u=i.getUint32(r,!0);return r+=lg,s>=570425344?(r-=lg*2,n=a,s=o,u=0,a=0,o=0,console.warn(aZ)):u>=570425344&&(r-=lg,n=s,s=a,u=o,a=0,o=0,console.warn(aZ)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=n,r}function fg(e,t,r,i){return r=f4e(e,t,r,i),r=h4e(e,t,r,i),r}function f4e(e,t,r,i){let{featureTableJsonByteLength:n,featureTableBinaryByteLength:a,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},n&&n>0){let s=JB(t,r,n);e.featureTableJson=JSON.parse(s)}return r+=n||0,e.featureTableBinary=new Uint8Array(t,r,a),r+=a||0,r}function h4e(e,t,r,i){let{batchTableJsonByteLength:n,batchTableBinaryByteLength:a}=e.header||{};if(n&&n>0){let o=JB(t,r,n);e.batchTableJson=JSON.parse(o),r+=n,a&&a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}function oO(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:i,isRGB565:n,pointCount:a=0}=e;if(i&&r){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;s++){let u=i[s],c=r.getProperty(u,"dimensions").map(f=>f*255);o[s*3]=c[0],o[s*3+1]=c[1],o[s*3+2]=c[2]}return{type:Zt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&n){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;s++){let u=iO(t[s]);o[s*3]=u[0],o[s*3+1]=u[1],o[s*3+2]=u[2]}return{type:Zt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===a*3?{type:Zt.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Zt.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var oZ=Fe(fr());var sZ=new oZ.Vector3;function uZ(e,t){if(!t)return null;if(e.isOctEncoded16P){let r=new Float32Array((e.pointsLength||0)*3);for(let i=0;i<(e.pointsLength||0);i++)nO(t[i*2],t[i*2+1],sZ),sZ.toArray(r,i*3);return{type:Zt.FLOAT,size:2,value:r}}return{type:Zt.FLOAT,size:2,value:t}}var lZ=Fe(fr());function cZ(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,d4e(e,t)):{type:Zt.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function d4e(e,t){let r=new lZ.Vector3,i=new Float32Array(e.pointCount*3);for(let n=0;n<e.pointCount;n++)r.set(t[n*3],t[n*3+1],t[n*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(i,n*3);return i}async function fZ(e,t,r,i,n){r=qf(e,t,r),r=cg(e,t,r),r=fg(e,t,r,i),p4e(e);let{featureTable:a,batchTable:o}=m4e(e);return await _4e(e,a,o,i,n),g4e(e,a,i),v4e(e,a,o),y4e(e,a),r}function p4e(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function m4e(e){let t=new Nf(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",Zt.FLOAT,3);let i=b4e(e,t);return{featureTable:t,batchTable:i}}function g4e(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",Zt.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let i=t.getPropertyArray("POSITION_QUANTIZED",Zt.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Zt.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Zt.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=cZ(e,i,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function v4e(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let i=null;t.hasProperty("RGBA")?(i=t.getPropertyArray("RGBA",Zt.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?i=t.getPropertyArray("RGB",Zt.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(i=t.getPropertyArray("RGB565",Zt.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=oO(e,i,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Zt.UNSIGNED_BYTE,4))}function y4e(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",Zt.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Zt.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=uZ(e,r)}}function b4e(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Zt.UNSIGNED_SHORT,1),e.batchIds)){let i=t.getGlobalProperty("BATCH_LENGTH");if(!i)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:n,batchTableBinary:a}=e;r=new ug(n,a,i)}return r}async function _4e(e,t,r,i,n){let a,o,s,u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){o=l.properties;let f=l.byteOffset,h=l.byteLength;if(!o||!Number.isFinite(f)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");a=(e.featureTableBinary||[]).slice(f,f+h),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!a)return!0;let c={buffer:a,properties:ne(ne({},o),s),featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await x4e(e,c,i,n)}async function x4e(e,t,r,i){if(!i)return;let{parse:n}=i,a=Ye(ne({},r),{draco:Ye(ne({},r==null?void 0:r.draco),{extraAttributes:t.batchTableProperties||{}})});delete a["3d-tiles"];let o=await n(t.buffer,og,a),s=o.attributes.POSITION&&o.attributes.POSITION.value,u=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,l=o.attributes.NORMAL&&o.attributes.NORMAL.value,c=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,f=s&&o.attributes.POSITION.value.quantization,h=l&&o.attributes.NORMAL.value.quantization;if(f){let p=o.POSITION.data.quantization,y=p.range;e.quantizedVolumeScale=new sO.Vector3(y,y,y),e.quantizedVolumeOffset=new sO.Vector3(p.minValues),e.quantizedRange=(1<<p.quantizationBits)-1,e.isQuantizedDraco=!0}h&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let d={};if(t.batchTableProperties)for(let p of Object.keys(t.batchTableProperties))o.attributes[p]&&o.attributes[p].value&&(d[p.toLowerCase()]=o.attributes[p].value);e.attributes=ne({positions:s,colors:oO(e,u,void 0),normals:l,batchIds:c},d)}var vS="4.0.0-alpha.16";var yS="4.0.0-alpha.16";var{_parseImageNode:w4e}=globalThis,uO=typeof Image!="undefined",lO=typeof ImageBitmap!="undefined",E4e=Boolean(w4e),cO=on?!0:E4e;function hZ(e){switch(e){case"auto":return lO||uO||cO;case"imagebitmap":return lO;case"image":return uO;case"data":return cO;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function dZ(){if(lO)return"imagebitmap";if(uO)return"image";if(cO)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function pZ(e){let t=S4e(e);if(!t)throw new Error("Not an image");return t}function fO(e){return hg(e)}function hg(e){switch(pZ(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function S4e(e){return typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap?"imagebitmap":typeof Image!="undefined"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var T4e=/^data:image\/svg\+xml/,A4e=/\.svg((\?|#).*)?$/;function bS(e){return e&&(T4e.test(e)||A4e.test(e))}function mZ(e,t){if(bS(t)){let i=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(a){throw new Error(a.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return hO(e,t)}function hO(e,t){if(bS(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Zy(e,t,r){let i=mZ(e,r),n=self.URL||self.webkitURL,a=typeof i!="string"&&n.createObjectURL(i);try{return await k4e(a||i,t)}finally{a&&n.revokeObjectURL(a)}}async function k4e(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=a=>n(new Error(`Could not load image ${e}: ${a}`))}catch(a){n(a)}})}var R4e={},gZ=!0;async function dO(e,t,r){let i;bS(r)?i=await Zy(e,t,r):i=hO(e,r);let n=t&&t.imagebitmap;return await C4e(i,n)}async function C4e(e,t=null){if((I4e(t)||!gZ)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),gZ=!1}return await createImageBitmap(e)}function I4e(e){for(let t in e||R4e)return!1;return!0}function vZ(e){return!F4e(e,"ftyp",4)||(e[8]&96)==0?null:P4e(e)}function P4e(e){switch(B4e(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function B4e(e,t,r){return String.fromCharCode(...e.slice(t,r))}function O4e(e){return[...e].map(t=>t.charCodeAt(0))}function F4e(e,t,r=0){let i=O4e(t);for(let n=0;n<i.length;++n)if(i[n]!==e[n+r])return!1;return!0}var al=!1,eb=!0;function kd(e){let t=tb(e);return M4e(t)||N4e(t)||L4e(t)||j4e(t)||D4e(t)}function D4e(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=vZ(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function M4e(e){let t=tb(e);return t.byteLength>=24&&t.getUint32(0,al)===2303741511?{mimeType:"image/png",width:t.getUint32(16,al),height:t.getUint32(20,al)}:null}function L4e(e){let t=tb(e);return t.byteLength>=10&&t.getUint32(0,al)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,eb),height:t.getUint16(8,eb)}:null}function j4e(e){let t=tb(e);return t.byteLength>=14&&t.getUint16(0,al)===16973&&t.getUint32(2,eb)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,eb),height:t.getUint32(22,eb)}:null}function N4e(e){let t=tb(e);if(!(t.byteLength>=3&&t.getUint16(0,al)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=q4e(),a=2;for(;a+9<t.byteLength;){let o=t.getUint16(a,al);if(n.has(o))return{mimeType:"image/jpeg",height:t.getUint16(a+5,al),width:t.getUint16(a+7,al)};if(!i.has(o))return null;a+=2,a+=t.getUint16(a,al)}return null}function q4e(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);let t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}function tb(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function pO(e,t){let{mimeType:r}=kd(e)||{},i=globalThis._parseImageNode;return Ft(i),await i(e,r)}async function mO(e,t,r){t=t||{};let n=(t.image||{}).type||"auto",{url:a}=r||{},o=U4e(n),s;switch(o){case"imagebitmap":s=await dO(e,t,a);break;case"image":s=await Zy(e,t,a);break;case"data":s=await pO(e,t);break;default:Ft(!1)}return n==="data"&&(s=hg(s)),s}function U4e(e){switch(e){case"auto":case"data":return dZ();default:return hZ(e),e}}var G4e=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],z4e=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],H4e={image:{type:"auto",decode:!0}},dg={id:"image",module:"images",name:"Images",version:yS,mimeTypes:z4e,extensions:G4e,parse:mO,tests:[e=>Boolean(kd(new DataView(e)))],options:H4e};var{_encodeImageNode:yZ}=globalThis;async function bZ(e,t){return t=t||{},t.image=t.image||{},yZ?yZ(e,{type:t.image.mimeType}):W4e(e,t)}var _Z=!0;async function W4e(e,t){let{mimeType:r,jpegQuality:i}=t.image,{width:n,height:a}=fO(e),o=document.createElement("canvas");o.width=n,o.height=a,V4e(e,o);let s=await new Promise(u=>{if(i&&_Z)try{o.toBlob(u,r,i);return}catch{_Z=!1}o.toBlob(u,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}function V4e(e,t,r=0,i=0){if(r===0&&i===0&&typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let a=t.getContext("bitmaprenderer");if(a)return a.transferFromImageBitmap(e),t}let n=t.getContext("2d");if(e.data){let a=new Uint8ClampedArray(e.data),o=new ImageData(a,e.width,e.height);return n.putImageData(o,0,0),t}return n.drawImage(e,0,0),t}var gO={name:"Images",id:"image",module:"images",version:yS,extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:bZ};var vO={};function yO(e){if(vO[e]===void 0){let t=on?Y4e(e):K4e(e);vO[e]=t}return vO[e]}function K4e(e){let t=["image/png","image/jpeg","image/gif"],{_parseImageNode:r,_imageFormatsNode:i=t}=globalThis;return Boolean(r)&&i.includes(e)}function Y4e(e){switch(e){case"image/avif":case"image/webp":return X4e(e);default:return!0}}function X4e(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var pg="4.0.0-alpha.16";var xZ="4.0.0-alpha.16",$4e=`https://unpkg.com/@loaders.gl/textures@${xZ}/dist/libs/basis_encoder.wasm`,J4e=`https://unpkg.com/@loaders.gl/textures@${xZ}/dist/libs/basis_encoder.js`,bO;async function _O(e){let t=e.modules||{};return t.basis?t.basis:(bO=bO||Q4e(e),await bO)}async function Q4e(e){let t=null,r=null;return[t,r]=await Promise.all([await Wu("basis_transcoder.js","textures",e),await Wu("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await Z4e(t,r)}function Z4e(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(i=>{e(r).then(n=>{let{BasisFile:a,initializeBasis:o}=n;o(),i({BasisFile:a})})})}var xO;async function wO(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(xO=xO||e5e(e),await xO)}async function e5e(e){let t=null,r=null;return[t,r]=await Promise.all([await Wu(J4e,"textures",e),await Wu($4e,"textures",e)]),t=t||globalThis.BASIS,await t5e(t,r)}function t5e(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(i=>{e(r).then(n=>{let{BasisFile:a,KTX2File:o,initializeBasis:s,BasisEncoder:u}=n;s(),i({BasisFile:a,KTX2File:o,BasisEncoder:u})})})}var Se={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var r5e=["","WEBKIT_","MOZ_"],wZ={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},_S=null;function rb(e){if(!_S){e=e||i5e()||void 0,_S=new Set;for(let t of r5e)for(let r in wZ)if(e&&e.getExtension(`${t}${r}`)){let i=wZ[r];_S.add(i)}}return _S}function i5e(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var FZ=Fe(BZ());function mg(e,t){let r=new Array(t.mipMapLevels),i=t.width,n=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){let s=o5e(t,i,n,e,o),u=a5e(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:i,height:n,levelSize:s},i=Math.max(1,i>>1),n=Math.max(1,n>>1),a+=s}return r}function a5e(e,t,r,i){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,i)}function o5e(e,t,r,i,n){return Array.isArray(i)?e.sizeFunction(i[n]):e.sizeFunction(t,r)}var s5e={131:Se.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Se.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Se.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Se.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Se.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Se.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Se.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Se.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Se.COMPRESSED_RED_RGTC1_EXT,140:Se.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Se.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Se.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Se.COMPRESSED_RGB8_ETC2,148:Se.COMPRESSED_SRGB8_ETC2,149:Se.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Se.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Se.COMPRESSED_RGBA8_ETC2_EAC,152:Se.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Se.COMPRESSED_R11_EAC,154:Se.COMPRESSED_SIGNED_R11_EAC,155:Se.COMPRESSED_RG11_EAC,156:Se.COMPRESSED_SIGNED_RG11_EAC,157:Se.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Se.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Se.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Se.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Se.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Se.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Se.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Se.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Se.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Se.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Se.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Se.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Se.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Se.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Se.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Se.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Se.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Se.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Se.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Se.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Se.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Se.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Se.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Se.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Se.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Se.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Se.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Se.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Se.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Se.COMPRESSED_RGBA_ASTC_12x12_KHR};function OZ(e){return s5e[e]}var Ao=[171,75,84,88,32,50,48,187,13,10,26,10];function TS(e){let t=new Uint8Array(e);return!(t.byteLength<Ao.length||t[0]!==Ao[0]||t[1]!==Ao[1]||t[2]!==Ao[2]||t[3]!==Ao[3]||t[4]!==Ao[4]||t[5]!==Ao[5]||t[6]!==Ao[6]||t[7]!==Ao[7]||t[8]!==Ao[8]||t[9]!==Ao[9]||t[10]!==Ao[10]||t[11]!==Ao[11])}function DZ(e){let t=new Uint8Array(e),r=(0,FZ.read)(t),i=Math.max(1,r.levels.length),n=r.pixelWidth,a=r.pixelHeight,o=OZ(r.vkFormat);return mg(r.levels,{mipMapLevels:i,width:n,height:a,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var u5e={etc1:{basisFormat:0,compressed:!0,format:Se.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Se.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Se.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Se.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Se.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Se.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function nb(e,t){if(t.basis.containerFormat==="auto"){if(TS(e)){let i=await wO(t);return MZ(i.KTX2File,e,t)}let{BasisFile:r}=await _O(t);return kO(r,e,t)}switch(t.basis.module){case"encoder":let r=await wO(t);switch(t.basis.containerFormat){case"ktx2":return MZ(r.KTX2File,e,t);case"basis":default:return kO(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:i}=await _O(t);return kO(i,e,t)}}function kO(e,t,r){let i=new e(new Uint8Array(t));try{if(!i.startTranscoding())throw new Error("Failed to start basis transcoding");let n=i.getNumImages(),a=[];for(let o=0;o<n;o++){let s=i.getNumLevels(o),u=[];for(let l=0;l<s;l++)u.push(l5e(i,o,l,r));a.push(u)}return a}finally{i.close(),i.delete()}}function l5e(e,t,r,i){let n=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:l}=LZ(i,o),c=e.getImageTranscodedSizeInBytes(t,r,l),f=new Uint8Array(c);if(!e.transcodeImage(f,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:n,height:a,data:f,compressed:s,format:u,hasAlpha:o}}function MZ(e,t,r){let i=new e(new Uint8Array(t));try{if(!i.startTranscoding())throw new Error("failed to start KTX2 transcoding");let n=i.getLevels(),a=[];for(let o=0;o<n;o++){a.push(c5e(i,o,r));break}return[a]}finally{i.close(),i.delete()}}function c5e(e,t,r){let{alphaFlag:i,height:n,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=LZ(r,i),l=e.getImageTranscodedSizeInBytes(t,0,0,u),c=new Uint8Array(l);if(!e.transcodeImage(c,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:n,data:c,compressed:o,levelSize:l,hasAlpha:i,format:s}}function LZ(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=gg()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),u5e[r]}function gg(){let e=rb();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var jZ={name:"Basis",id:"basis",module:"textures",version:pg,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},Rd=Ye(ne({},jZ),{parse:nb});var ko={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},f5e={DXT1:Se.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Se.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Se.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Se.COMPRESSED_RGB_ATC_WEBGL,ATCA:Se.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Se.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},h5e=UZ,d5e=AS,p5e=AS,m5e={DXT1:UZ,DXT3:AS,DXT5:AS,"ATC ":h5e,ATCA:d5e,ATCI:p5e};function NZ(e){return new Uint32Array(e,0,ko.HEADER_LENGTH)[ko.MAGIC_NUMBER_INDEX]===ko.MAGIC_NUMBER}function qZ(e){let t=new Int32Array(e,0,ko.HEADER_LENGTH),r=t[ko.HEADER_PF_FOURCC_INDEX];Ft(Boolean(t[ko.HEADER_PF_FLAGS_INDEX]&ko.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let i=g5e(r),n=f5e[i],a=m5e[i];Ft(n&&a,`DDS: Unknown pixel format ${r}`);let o=1;t[ko.HEADER_FLAGS_INDEX]&ko.DDSD_MIPMAPCOUNT&&(o=Math.max(1,t[ko.MIPMAPCOUNT_INDEX]));let s=t[ko.HEADER_WIDTH_INDEX],u=t[ko.HEADER_HEIGHT_INDEX],l=t[ko.HEADER_SIZE_INDEX]+4,c=new Uint8Array(e,l);return mg(c,{mipMapLevels:o,width:s,height:u,sizeFunction:a,internalFormat:n})}function UZ(e,t){return(e+3>>2)*(t+3>>2)*8}function AS(e,t){return(e+3>>2)*(t+3>>2)*16}function g5e(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var us={MAGIC_NUMBER:55727696,MAGIC_NUMBER_EXTRA:1347834371,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,COLOUR_SPACE_INDEX:4,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12},v5e={0:[Se.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Se.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Se.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Se.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Se.COMPRESSED_RGB_ETC1_WEBGL],7:[Se.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Se.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Se.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Se.COMPRESSED_RGB8_ETC2],23:[Se.COMPRESSED_RGBA8_ETC2_EAC],24:[Se.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Se.COMPRESSED_R11_EAC],26:[Se.COMPRESSED_RG11_EAC],27:[Se.COMPRESSED_RGBA_ASTC_4X4_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Se.COMPRESSED_RGBA_ASTC_5X4_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Se.COMPRESSED_RGBA_ASTC_5X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Se.COMPRESSED_RGBA_ASTC_6X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Se.COMPRESSED_RGBA_ASTC_6X6_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Se.COMPRESSED_RGBA_ASTC_8X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Se.COMPRESSED_RGBA_ASTC_8X6_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Se.COMPRESSED_RGBA_ASTC_8X8_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Se.COMPRESSED_RGBA_ASTC_10X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Se.COMPRESSED_RGBA_ASTC_10X6_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Se.COMPRESSED_RGBA_ASTC_10X8_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Se.COMPRESSED_RGBA_ASTC_10X10_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Se.COMPRESSED_RGBA_ASTC_12X10_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Se.COMPRESSED_RGBA_ASTC_12X12_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},y5e={0:HZ,1:HZ,2:WZ,3:WZ,6:ab,7:ab,9:ob,11:ob,22:ab,23:ob,24:ab,25:ab,26:ob,27:ob,28:b5e,29:_5e,30:x5e,31:w5e,32:E5e,33:S5e,34:T5e,35:A5e,36:k5e,37:R5e,38:C5e,39:I5e,40:P5e};function GZ(e){let r=new Uint32Array(e,0,us.HEADER_LENGTH)[us.MAGIC_NUMBER_INDEX];return r===us.MAGIC_NUMBER||r===us.MAGIC_NUMBER_EXTRA}function zZ(e){let t=new Uint32Array(e,0,us.HEADER_LENGTH),r=t[us.PIXEL_FORMAT_INDEX],i=t[us.COLOUR_SPACE_INDEX],n=v5e[r]||[],a=n.length>1&&i?n[1]:n[0],o=y5e[r],s=t[us.MIPMAPCOUNT_INDEX],u=t[us.WIDTH_INDEX],l=t[us.HEIGHT_INDEX],c=us.HEADER_SIZE+t[us.METADATA_SIZE_INDEX],f=new Uint8Array(e,c);return mg(f,{mipMapLevels:s,width:u,height:l,sizeFunction:o,internalFormat:a})}function HZ(e,t){return e=Math.max(e,16),t=Math.max(t,8),e*t/4}function WZ(e,t){return e=Math.max(e,8),t=Math.max(t,8),e*t/2}function ab(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function ob(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function b5e(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16}function _5e(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16}function x5e(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16}function w5e(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16}function E5e(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16}function S5e(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16}function T5e(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16}function A5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16}function k5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16}function R5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16}function C5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16}function I5e(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16}function P5e(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}function VZ(e){if(TS(e))return DZ(e);if(NZ(e))return qZ(e);if(GZ(e))return zZ(e);throw new Error("Texture container format not recognized")}var B5e={"compressed-texture":{libraryPath:"libs/",useBasis:!1}},KZ={name:"Texture Containers",id:"compressed-texture",module:"textures",version:pg,worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:B5e},kS=Ye(ne({},KZ),{parse:async(e,t)=>t["compressed-texture"].useBasis?(t.basis=Ye(ne({format:{alpha:"BC3",noAlpha:"BC1"}},t.basis),{containerFormat:"ktx2",module:"encoder"}),(await nb(e,t))[0]):VZ(e)});var RS={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:pg,extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}};function jn(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var vg=!0,YZ=1735152710,RO=12,CS=8,O5e=1313821514,F5e=5130562,D5e=0,M5e=0,L5e=1;function j5e(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function XZ(e,t=0,r={}){let i=new DataView(e),{magic:n=YZ}=r,a=i.getUint32(t,!1);return a===n||a===YZ}function $Z(e,t,r=0,i={}){let n=new DataView(t),a=j5e(n,r+0),o=n.getUint32(r+4,vg),s=n.getUint32(r+8,vg);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=RO,e.version){case 1:return N5e(e,n,r);case 2:return q5e(e,n,r,i={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function N5e(e,t,r){Ft(e.header.byteLength>RO+CS);let i=t.getUint32(r+0,vg),n=t.getUint32(r+4,vg);return r+=CS,Ft(n===D5e),CO(e,t,r,i),r+=i,r+=IO(e,t,r,e.header.byteLength),r}function q5e(e,t,r,i){return Ft(e.header.byteLength>RO+CS),U5e(e,t,r,i),r+e.header.byteLength}function U5e(e,t,r,i){for(;r+8<=e.header.byteLength;){let n=t.getUint32(r+0,vg),a=t.getUint32(r+4,vg);switch(r+=CS,a){case O5e:CO(e,t,r,n);break;case F5e:IO(e,t,r,n);break;case M5e:i.strict||CO(e,t,r,n);break;case L5e:i.strict||IO(e,t,r,n);break;default:break}r+=xo(n,4)}return r}function CO(e,t,r,i){let n=new Uint8Array(t.buffer,r,i),o=new TextDecoder("utf8").decode(n);return e.json=JSON.parse(o),xo(i,4)}function IO(e,t,r,i){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:i,arrayBuffer:t.buffer}),xo(i,4)}function PO(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let i=t.baseUri||t.uri;if(!i)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return i.substr(0,i.lastIndexOf("/")+1)+e}function JZ(e,t,r){let i=e.bufferViews[r];jn(i);let n=i.buffer,a=t[n];jn(a);let o=(i.byteOffset||0)+a.byteOffset;return new Uint8Array(a.arrayBuffer,o,i.byteLength)}var OO={};mo(OO,{decode:()=>oNe,name:()=>aNe});var G5e=1.33,QZ=["SCALAR","VEC2","VEC3","VEC4"],z5e=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],H5e=new Map(z5e),W5e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},V5e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},K5e={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function IS(e){return QZ[e-1]||QZ[0]}function yg(e){let t=H5e.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function bg(e,t){let r=K5e[e.componentType],i=W5e[e.type],n=V5e[e.componentType],a=e.count*i,o=e.count*i*n;return jn(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function sb(e){let{images:t,bufferViews:r}=e;t=t||[],r=r||[];let i=t.map(o=>o.bufferView);r=r.filter(o=>!i.includes(o));let n=r.reduce((o,s)=>o+s.byteLength,0),a=t.reduce((o,s)=>{let{width:u,height:l}=s.image;return o+u*l},0);return n+Math.ceil(4*a*G5e)}function Y5e(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var ci=class{constructor(t){this.gltf={json:(t==null?void 0:t.json)||Y5e(),buffers:(t==null?void 0:t.buffers)||[],images:(t==null?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let r=this.getUsedExtensions().find(n=>n===t),i=this.getRequiredExtensions().find(n=>n===t);return typeof r=="string"||typeof i=="string"}getExtension(t){let r=this.getUsedExtensions().find(n=>n===t),i=this.json.extensions||{};return r?i[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(i=>i===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,r){return(t.extensions||{})[r]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,r){if(typeof r=="object")return r;let i=this.json[t]&&this.json[t][r];if(!i)throw new Error(`glTF file error: Could not find ${t}[${r}]`);return i}getTypedArrayForBufferView(t){t=this.getBufferView(t);let r=t.buffer,i=this.gltf.buffers[r];jn(i);let n=(t.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,n,t.byteLength)}getTypedArrayForAccessor(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),n=this.getBuffer(r.buffer).data,{ArrayType:a,length:o}=bg(t,r),s=r.byteOffset+t.byteOffset;return new a(n,s,o)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),n=this.getBuffer(r.buffer).data,a=r.byteOffset||0;return new Uint8Array(n,a,r.byteLength)}addApplicationData(t,r){return this.json[t]=r,this}addExtraData(t,r){return this.json.extras=this.json.extras||{},this.json.extras[t]=r,this}addObjectExtension(t,r,i){return t.extensions=t.extensions||{},t.extensions[r]=i,this.registerUsedExtension(r),this}setObjectExtension(t,r,i){let n=t.extensions||{};n[r]=i}removeObjectExtension(t,r){let i=(t==null?void 0:t.extensions)||{};if(i[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(r)||n.push(r)}delete i[r]}addExtension(t,r={}){return jn(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return jn(r),this.addExtension(t,r),this.registerRequiredExtension(t),r}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var r;if((r=this.json.extensions)==null?void 0:r[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let i=this.json.extensionsRemoved;i.includes(t)||i.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:r}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(t){let{meshIndex:r,matrix:i}=t;this.json.nodes=this.json.nodes||[];let n={mesh:r};return i&&(n.matrix=i),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:i,material:n,mode:a=4}=t,s={primitives:[{attributes:this._addAttributes(r),mode:a}]};if(i){let u=this._addIndices(i);s.primitives[0].indices=u}return Number.isFinite(n)&&(s.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){let i={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),this.json.meshes.length-1}addImage(t,r){let i=kd(t),n=r||(i==null?void 0:i.mimeType),o={bufferView:this.addBufferView(t),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t,r=0,i=this.byteLength){let n=t.byteLength;jn(Number.isFinite(n)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let a={buffer:r,byteOffset:i,byteLength:n};return this.byteLength+=xo(n,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(a),this.json.bufferViews.length-1}addAccessor(t,r){let i={bufferView:t,type:IS(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}addBinaryBuffer(t,r={size:3}){let i=this.addBufferView(t),n={min:r.min,max:r.max};(!n.min||!n.max)&&(n=this._getAccessorMinMax(t,r.size));let a={size:r.size,componentType:yg(t),count:Math.round(t.length/r.size),min:n.min,max:n.max};return this.addAccessor(i,Object.assign(a,r))}addTexture(t){let{imageIndex:r}=t,i={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(i),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var a,o;this.gltf.buffers=[];let t=this.byteLength,r=new ArrayBuffer(t),i=new Uint8Array(r),n=0;for(let s of this.sourceBuffers||[])n=aP(s,i,n);((o=(a=this.json)==null?void 0:a.buffers)==null?void 0:o[0])?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,r){let i=!0;for(;i;){let n=t.indexOf(r);n>-1?t.splice(n,1):i=!1}}_addAttributes(t={}){let r={};for(let i in t){let n=t[i],a=this._getGltfAttributeName(i),o=this.addBinaryBuffer(n.value,n);r[a]=o}return r}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,r){let i={min:null,max:null};if(t.length<r)return i;i.min=[],i.max=[];let n=t.subarray(0,r);for(let a of n)i.min.push(a),i.max.push(a);for(let a=r;a<t.length;a+=r)for(let o=0;o<r;o++)i.min[0+o]=Math.min(i.min[0+o],t[a+o]),i.max[0+o]=Math.max(i.max[0+o],t[a+o]);return i}};var X5e="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",$5e="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",J5e=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]),Q5e=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Z5e={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},eNe={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function ZZ(e,t,r,i,n,a="NONE"){let o=await tNe();nNe(o,o.exports[eNe[n]],e,t,r,i,o.exports[Z5e[a||"NONE"]])}var BO;async function tNe(){return BO||(BO=rNe()),BO}async function rNe(){let e=X5e;WebAssembly.validate(J5e)&&(e=$5e,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(iNe(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function iNe(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;++i){let n=e.charCodeAt(i);t[i]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i<e.length;++i)t[r++]=t[i]<60?Q5e[t[i]]:(t[i]-60)*64+t[++i];return t.buffer.slice(0,r)}function nNe(e,t,r,i,n,a,o){let s=e.exports.sbrk,u=i+3&~3,l=s(u*n),c=s(a.length),f=new Uint8Array(e.exports.memory.buffer);f.set(a,c);let h=t(l,i,n,c,a.length);if(h===0&&o&&o(l,u,n),r.set(f.subarray(l,l+i*n)),s(l-s(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var PS="EXT_meshopt_compression",aNe=PS;async function oNe(e,t){var n;let r=new ci(e);if(!((n=t==null?void 0:t.gltf)==null?void 0:n.decompressMeshes))return;let i=[];for(let a of e.json.bufferViews||[])i.push(sNe(r,a));await Promise.all(i),r.removeExtension(PS)}async function sNe(e,t){let r=e.getObjectExtension(t,PS);if(r){let{byteOffset:i=0,byteLength:n=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:l}=r,c=e.gltf.buffers[l],f=new Uint8Array(c.arrayBuffer,c.byteOffset+i,n),h=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await ZZ(h,o,a,f,s,u),e.removeObjectExtension(t,PS)}}var FO={};mo(FO,{name:()=>uNe,preprocess:()=>lNe});var _g="EXT_texture_webp",uNe=_g;function lNe(e,t){let r=new ci(e);if(!yO("image/webp")){if(r.getRequiredExtensions().includes(_g))throw new Error(`gltf: Required extension ${_g} not supported by browser`);return}let{json:i}=r;for(let n of i.textures||[]){let a=r.getObjectExtension(n,_g);a&&(n.source=a.source),r.removeObjectExtension(n,_g)}r.removeExtension(_g)}var DO={};mo(DO,{name:()=>cNe,preprocess:()=>fNe});var BS="KHR_texture_basisu",cNe=BS;function fNe(e,t){let r=new ci(e),{json:i}=r;for(let n of i.textures||[]){let a=r.getObjectExtension(n,BS);a&&(n.source=a.source,r.removeObjectExtension(n,BS))}r.removeExtension(BS)}var LO={};mo(LO,{decode:()=>gNe,encode:()=>vNe,name:()=>pNe,preprocess:()=>mNe});function eee(e){let t={};for(let r in e){let i=e[r];if(r!=="indices"){let n=MO(i);t[r]=n}}return t}function MO(e){let{buffer:t,size:r,count:i}=hNe(e);return{value:t,size:r,byteOffset:0,count:i,type:IS(r),componentType:yg(t)}}function hNe(e){let t=e,r=1,i=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=dNe(t,Float32Array)),i=t.length/r),{buffer:t,size:r,count:i}}function dNe(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var Uf="KHR_draco_mesh_compression",pNe=Uf;function mNe(e,t,r){let i=new ci(e);for(let n of tee(i))i.getObjectExtension(n,Uf)}async function gNe(e,t,r){var a;if(!((a=t==null?void 0:t.gltf)==null?void 0:a.decompressMeshes))return;let i=new ci(e),n=[];for(let o of tee(i))i.getObjectExtension(o,Uf)&&n.push(yNe(i,o,t,r));await Promise.all(n),i.removeExtension(Uf)}function vNe(e,t={}){let r=new ci(e);for(let i of r.json.meshes||[])bNe(i,t),r.addRequiredExtension(Uf)}async function yNe(e,t,r,i){let n=e.getObjectExtension(t,Uf);if(!n)return;let a=e.getTypedArrayForBufferView(n.bufferView),o=fd(a.buffer,a.byteOffset),{parse:s}=i,u=ne({},r);delete u["3d-tiles"];let l=await s(o,og,u,i),c=eee(l.attributes);for(let[f,h]of Object.entries(c))if(f in t.attributes){let d=t.attributes[f],p=e.getAccessor(d);(p==null?void 0:p.min)&&(p==null?void 0:p.max)&&(h.min=p.min,h.max=p.max)}t.attributes=c,l.indices&&(t.indices=MO(l.indices)),e.removeObjectExtension(t,Uf),_Ne(t)}function bNe(e,t,r=4,i,n){var c;if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let a=i.DracoWriter.encodeSync({attributes:e}),o=(c=n==null?void 0:n.parseSync)==null?void 0:c.call(n,{attributes:e}),s=i._addFauxAttributes(o.attributes),u=i.addBufferView(a);return{primitives:[{attributes:s,mode:r,extensions:{[Uf]:{bufferView:u,attributes:s}}}]}}function _Ne(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*tee(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var NO={};mo(NO,{decode:()=>SNe,name:()=>xNe});var xg=Fe(fr());var ree={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},iee={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var jO="KHR_texture_transform",xNe=jO,OS=new xg.Vector3,wNe=new xg.Matrix3,ENe=new xg.Matrix3;async function SNe(e,t){if(!new ci(e).hasExtension(jO))return;let n=e.json.materials||[];for(let a=0;a<n.length;a++)TNe(a,e)}function TNe(e,t){var l,c,f;let r=[],i=(l=t.json.materials)==null?void 0:l[e],n=(c=i==null?void 0:i.pbrMetallicRoughness)==null?void 0:c.baseColorTexture;n&&ub(t,e,n,r);let a=i==null?void 0:i.emissiveTexture;a&&ub(t,e,a,r);let o=i==null?void 0:i.normalTexture;o&&ub(t,e,o,r);let s=i==null?void 0:i.occlusionTexture;s&&ub(t,e,s,r);let u=(f=i==null?void 0:i.pbrMetallicRoughness)==null?void 0:f.metallicRoughnessTexture;u&&ub(t,e,u,r)}function ub(e,t,r,i){let n=ANe(r,i);if(!n)return;let a=e.json.meshes||[];for(let o of a)for(let s of o.primitives){let u=s.material;Number.isFinite(u)&&t===u&&kNe(e,s,n)}}function ANe(e,t){var o;let r=(o=e.extensions)==null?void 0:o[jO],{texCoord:i=0}=e,{texCoord:n=i}=r;if(!(t.findIndex(([s,u])=>s===i&&u===n)!==-1)){let s=INe(r);return i!==n&&(e.texCoord=n),t.push([i,n]),{originalTexCoord:i,texCoord:n,matrix:s}}return null}function kNe(e,t,r){var s,u;let{originalTexCoord:i,texCoord:n,matrix:a}=r,o=t.attributes[`TEXCOORD_${i}`];if(Number.isFinite(o)){let l=(s=e.json.accessors)==null?void 0:s[o];if(l&&l.bufferView){let c=(u=e.json.bufferViews)==null?void 0:u[l.bufferView];if(c){let{arrayBuffer:f,byteOffset:h}=e.buffers[c.buffer],d=(h||0)+(l.byteOffset||0)+(c.byteOffset||0),{ArrayType:p,length:y}=bg(l,c),g=iee[l.componentType],b=ree[l.type],E=c.byteStride||g*b,A=new Float32Array(y);for(let k=0;k<l.count;k++){let R=new p(f,d+k*E,2);OS.set(R[0],R[1],1),OS.transformByMatrix3(a),A.set([OS[0],OS[1]],k*b)}i===n?RNe(l,c,e.buffers,A):CNe(n,l,t,e,A)}}}}function RNe(e,t,r,i){e.componentType=5126,r.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=i.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function CNe(e,t,r,i,n){i.buffers.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength});let a=i.json.bufferViews;if(!a)return;a.push({buffer:i.buffers.length-1,byteLength:n.buffer.byteLength,byteOffset:0});let o=i.json.accessors;!o||(o.push({bufferView:(a==null?void 0:a.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=o.length-1)}function INe(e){let{offset:t=[0,0],rotation:r=0,scale:i=[1,1]}=e,n=new xg.Matrix3().set(1,0,0,0,1,0,t[0],t[1],1),a=wNe.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=ENe.set(i[0],0,0,0,i[1],0,0,0,1);return n.multiplyRight(a).multiplyRight(o)}var qO={};mo(qO,{decode:()=>BNe,encode:()=>ONe,name:()=>PNe});var Cd="KHR_lights_punctual",PNe=Cd;async function BNe(e){let t=new ci(e),{json:r}=t,i=t.getExtension(Cd);i&&(t.json.lights=i.lights,t.removeExtension(Cd));for(let n of r.nodes||[]){let a=t.getObjectExtension(n,Cd);a&&(n.light=a.light),t.removeObjectExtension(n,Cd)}}async function ONe(e){let t=new ci(e),{json:r}=t;if(r.lights){let i=t.addExtension(Cd);jn(!i.lights),i.lights=r.lights,delete r.lights}if(t.json.lights){for(let i of t.json.lights){let n=i.node;t.addObjectExtension(n,Cd,i)}delete t.json.lights}}var UO={};mo(UO,{decode:()=>DNe,encode:()=>MNe,name:()=>FNe});var lb="KHR_materials_unlit",FNe=lb;async function DNe(e){let t=new ci(e),{json:r}=t;for(let i of r.materials||[])i.extensions&&i.extensions.KHR_materials_unlit&&(i.unlit=!0),t.removeObjectExtension(i,lb);t.removeExtension(lb)}function MNe(e){let t=new ci(e),{json:r}=t;if(t.materials)for(let i of r.materials||[])i.unlit&&(delete i.unlit,t.addObjectExtension(i,lb,{}),t.addExtension(lb))}var GO={};mo(GO,{decode:()=>jNe,encode:()=>NNe,name:()=>LNe});var cb="KHR_techniques_webgl",LNe=cb;async function jNe(e){let t=new ci(e),{json:r}=t,i=t.getExtension(cb);if(i){let n=qNe(i,t);for(let a of r.materials||[]){let o=t.getObjectExtension(a,cb);o&&(a.technique=Object.assign({},o,n[o.technique]),a.technique.values=UNe(a.technique,t)),t.removeObjectExtension(a,cb)}t.removeExtension(cb)}}async function NNe(e,t){}function qNe(e,t){let{programs:r=[],shaders:i=[],techniques:n=[]}=e,a=new TextDecoder;return i.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=a.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(o=>{o.fragmentShader=i[o.fragmentShader],o.vertexShader=i[o.vertexShader]}),n.forEach(o=>{o.program=r[o.program]}),n}function UNe(e,t){let r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(i=>{e.uniforms[i].value&&!(i in r)&&(r[i]=e.uniforms[i].value)}),Object.keys(r).forEach(i=>{typeof r[i]=="object"&&r[i].index!==void 0&&(r[i].texture=t.getTexture(r[i].index))}),r}var zO={};mo(zO,{decode:()=>zNe,name:()=>GNe});var nee="EXT_feature_metadata",GNe=nee;async function zNe(e,t){let r=new ci(e);HNe(r,t)}function HNe(e,t){var o,s;let r=e.getExtension(nee);if(!r)return;let i=(o=r.schema)==null?void 0:o.classes,{featureTables:n}=r;if(i&&n)for(let u in i){let l=i[u],c=ZNe(n,u);c&&WNe(e,c,l)}let{featureTextures:a}=r;if(i&&a&&((s=t.gltf)==null?void 0:s.loadImages))for(let u in i){let l=i[u],c=e9e(a,u);c&&VNe(e,c,l)}}function WNe(e,t,r){var i;for(let n in r.properties){let a=r.properties[n],o=(i=t==null?void 0:t.properties)==null?void 0:i[n],s=t.count;if(o){let u=KNe(e,a,s,o);o.data=u}}}function VNe(e,t,r){var n;let i=t.class;for(let a in r.properties){let o=(n=t==null?void 0:t.properties)==null?void 0:n[a];if(o){let s=YNe(e,o,i);o.data=s}}}function KNe(e,t,r,i){let n=i.bufferView,a=e.getTypedArrayForBufferView(n);switch(t.type){case"STRING":{let o=i.stringOffsetBufferView,s=e.getTypedArrayForBufferView(o);return t9e(a,s,r)}default:}return a}function YNe(e,t,r){let i=e.gltf.json;if(!i.meshes)return[];let n=[];for(let a of i.meshes)for(let o of a.primitives)XNe(e,r,t,n,o);return n}function XNe(e,t,r,i,n){var k,R,F;let a=e.gltf.json,o=[],s=`TEXCOORD_${r.texture.texCoord}`,u=n.attributes[s],l=e.getBufferView(u),c=e.getTypedArrayForBufferView(l),f=new Float32Array(c.buffer,c.byteOffset,c.length/4),h=r.texture.index,d=(k=a.textures)==null?void 0:k[h],p=d==null?void 0:d.source;if(typeof p!="undefined"){let C=(R=a.images)==null?void 0:R[p],j=C==null?void 0:C.mimeType,O=(F=e.gltf.images)==null?void 0:F[p];if(O)for(let W=0;W<f.length;W+=2){let N=$Ne(O,j,f,W,r.channels);o.push(N)}}let y=[];for(let C of o){let j=i.findIndex(O=>O===C);j===-1&&(j=i.push(C)-1),y.push(j)}let g=new Uint32Array(y),b=e.gltf.buffers.push({arrayBuffer:g.buffer,byteOffset:0,byteLength:g.byteLength})-1,E=e.addBufferView(g,b,0),A=e.addAccessor(E,{size:1,componentType:yg(g),count:g.length});n.attributes[t]=A}function $Ne(e,t,r,i,n){let a={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=r[i],s=r[i+1],u=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(u=4);let l=QNe(o,s,e,u),c=0;for(let f of n){let h=a[f];c|=JNe(e,l+h.offset)<<h.shift}return c}function JNe(e,t){let r=hg(e);if(r.data.length<=t)throw new Error(`${r.data.length} <= ${t}`);return r.data[t]}function QNe(e,t,r,i=1){let n=r.width,a=aee(e)*(n-1),o=Math.round(a),s=r.height,u=aee(t)*(s-1),l=Math.round(u),c=r.components?r.components:i;return(l*n+o)*c}function aee(e){return(e%1+1)%1}function ZNe(e,t){for(let r in e){let i=e[r];if(i.class===t)return i}return null}function e9e(e,t){for(let r in e){let i=e[r];if(i.class===t)return i}return null}function t9e(e,t,r){let i=[],n=new TextDecoder("utf8"),a=0,o=4;for(let s=0;s<r;s++){let u=t[(s+1)*o]-t[s*o],l=e.subarray(a,u+a),c=n.decode(l);i.push(c),a+=u}return i}var oee=[OO,FO,DO,LO,qO,UO,GO,NO,zO];function see(e,t={},r){var n;let i=oee.filter(a=>lee(a.name,t));for(let a of i)(n=a.preprocess)==null||n.call(a,e,t,r)}async function uee(e,t={},r){var n;let i=oee.filter(a=>lee(a.name,t));for(let a of i)await((n=a.decode)==null?void 0:n.call(a,e,t,r))}function lee(e,t){var n;let r=((n=t==null?void 0:t.gltf)==null?void 0:n.excludeExtensions)||{};return!(e in r&&!r[e])}var HO="KHR_binary_glTF";function cee(e){let t=new ci(e),{json:r}=t;for(let i of r.images||[]){let n=t.getObjectExtension(i,HO);n&&Object.assign(i,n),t.removeObjectExtension(i,HO)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(HO)}var fee={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},r9e={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},hee=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}}normalize(t,r){this.json=t.json;let i=t.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${i.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(i),this._convertTopLevelObjectsToArrays(i),cee(t),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let r in fee)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let i=t[r];if(!(!i||Array.isArray(i))){t[r]=[];for(let n in i){let a=i[n];a.id=a.id||n;let o=t[r].length;t[r].push(a),this.idToIndexMap[r][n]=o}}}_convertObjectIdsToArrayIndices(t){for(let r in fee)this._convertIdsToIndices(t,r);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let r of t.textures)this._convertTextureIds(r);for(let r of t.meshes)this._convertMeshIds(r);for(let r of t.nodes)this._convertNodeIds(r);for(let r of t.scenes)this._convertSceneIds(r)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let r of t.primitives){let{attributes:i,indices:n,material:a}=r;for(let o in i)i[o]=this._convertIdToIndex(i[o],"accessor");n&&(r.indices=this._convertIdToIndex(n,"accessor")),a&&(r.material=this._convertIdToIndex(a,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(r=>this._convertIdToIndex(r,"node"))),t.meshes&&(t.meshes=t.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(t,r){t[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),t[r]=[]);for(let i of t[r])for(let n in i){let a=i[n],o=this._convertIdToIndex(a,n);i[n]=o}}_convertIdToIndex(t,r){let i=r9e[r];if(i in this.idToIndexMap){let n=this.idToIndexMap[i][t];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return n}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){var r,i,n;for(let a of t.materials){a.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=a.values)==null?void 0:r.tex)||((i=a.values)==null?void 0:i.texture2d_0)||((n=a.values)==null?void 0:n.diffuseTex),s=t.textures.findIndex(u=>u.id===o);s!==-1&&(a.pbrMetallicRoughness.baseColorTexture={index:s})}}};function dee(e,t={}){return new hee().normalize(e,t)}async function pee(e,t,r=0,i,n){var a,o,s;return i9e(e,t,r,i),dee(e,{normalize:(a=i==null?void 0:i.gltf)==null?void 0:a.normalize}),see(e,i,n),((o=i==null?void 0:i.gltf)==null?void 0:o.loadBuffers)&&e.json.buffers&&await n9e(e,i,n),((s=i==null?void 0:i.gltf)==null?void 0:s.loadImages)&&await a9e(e,i,n),await uee(e,i,n),e}function i9e(e,t,r,i){if(i.uri&&(e.baseUri=i.uri),t instanceof ArrayBuffer&&!XZ(t,r,i)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=iP(t);else if(t instanceof ArrayBuffer){let o={};r=$Z(o,t,r,i.glb),jn(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else jn(!1,"GLTF: must be ArrayBuffer or string");let n=e.json.buffers||[];if(e.buffers=new Array(n.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let a=e.json.images||[];e.images=new Array(a.length).fill({})}async function n9e(e,t,r){var n,a;let i=e.json.buffers||[];for(let o=0;o<i.length;++o){let s=i[o];if(s.uri){let{fetch:u}=r;jn(u);let l=PO(s.uri,t),c=await((n=r==null?void 0:r.fetch)==null?void 0:n.call(r,l)),f=await((a=c==null?void 0:c.arrayBuffer)==null?void 0:a.call(c));e.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete s.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}async function a9e(e,t,r){let i=o9e(e),n=e.json.images||[],a=[];for(let o of i)a.push(s9e(e,n[o],o,t,r));return await Promise.all(a)}function o9e(e){let t=new Set,r=e.json.textures||[];for(let i of r)i.source!==void 0&&t.add(i.source);return Array.from(t).sort()}async function s9e(e,t,r,i,n){let{fetch:a,parse:o}=n,s;if(t.uri&&!t.hasOwnProperty("bufferView")){let l=PO(t.uri,i);s=await(await a(l)).arrayBuffer(),t.bufferView={data:s}}if(Number.isFinite(t.bufferView)){let l=JZ(e.json,e.buffers,t.bufferView);s=fd(l.buffer,l.byteOffset,l.byteLength)}jn(s,"glTF image has no data");let u=await o(s,[dg,Rd],{mimeType:t.mimeType,basis:i.basis||{format:gg()}},n);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}var dc={name:"glTF",id:"gltf",module:"gltf",version:vS,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:u9e,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes",postProcess:"removed in v4"}}};async function u9e(e,t={},r){t=ne(ne({},dc.options),t),t.gltf=ne(ne({},dc.options.gltf),t.gltf);let{byteOffset:i=0}=t;return await pee({},e,i,t,r)}var l9e=1179937895,c9e=1313821514,f9e=5130562,ol=!0;function mee(e,t,r=0,i={}){let{magic:n=l9e,version:a=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,n,ol),t.setUint32(r+4,a,ol),t.setUint32(r+8,0,ol));let l=r+8;r+=12;let c=r;t&&(t.setUint32(r+0,0,ol),t.setUint32(r+4,c9e,ol)),r+=8;let f=JSON.stringify(o);if(r=Im(t,r,f,4),t){let h=r-c-8;t.setUint32(c+0,h,ol)}if(s){let h=r;if(t&&(t.setUint32(r+0,0,ol),t.setUint32(r+4,f9e,ol)),r+=8,r=Mw(t,r,s,4),t){let d=r-h-8;t.setUint32(h+0,d,ol)}}if(t){let h=r-u;t.setUint32(l,h,ol)}return r}function WO(e,t,r,i){return h9e(e),mee(e,t,r,i)}function h9e(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}var VO={name:"glTF",id:"gltf",module:"gltf",version:vS,extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:d9e,options:{gltf:{}}};function d9e(e,t={}){let{byteOffset:r=0}=t,i=WO(e,null,r,t),n=new ArrayBuffer(i),a=new DataView(n);return WO(e,a,r,t),n}var p9e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},m9e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ls={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},g9e={magFilter:ls.TEXTURE_MAG_FILTER,minFilter:ls.TEXTURE_MIN_FILTER,wrapS:ls.TEXTURE_WRAP_S,wrapT:ls.TEXTURE_WRAP_T},v9e={[ls.TEXTURE_MAG_FILTER]:ls.LINEAR,[ls.TEXTURE_MIN_FILTER]:ls.NEAREST_MIPMAP_LINEAR,[ls.TEXTURE_WRAP_S]:ls.REPEAT,[ls.TEXTURE_WRAP_T]:ls.REPEAT};function y9e(){return{id:"default-sampler",parameters:v9e}}function b9e(e){return m9e[e]}function _9e(e){return p9e[e]}var gee=class{constructor(){this.baseUri="";this.buffers=[];this.images=[]}postProcess(t,r={}){let{json:i,buffers:n=[],images:a=[]}=t,{baseUri:o=""}=t;return jn(i),this.baseUri=o,this.buffers=n,this.images=a,this.jsonUnprocessed=i,this.json=this._resolveTree(t.json,r),this.json}_resolveTree(t,r={}){let i=ne({},t);return this.json=i,t.bufferViews&&(i.bufferViews=t.bufferViews.map((n,a)=>this._resolveBufferView(n,a))),t.images&&(i.images=t.images.map((n,a)=>this._resolveImage(n,a))),t.samplers&&(i.samplers=t.samplers.map((n,a)=>this._resolveSampler(n,a))),t.textures&&(i.textures=t.textures.map((n,a)=>this._resolveTexture(n,a))),t.accessors&&(i.accessors=t.accessors.map((n,a)=>this._resolveAccessor(n,a))),t.materials&&(i.materials=t.materials.map((n,a)=>this._resolveMaterial(n,a))),t.meshes&&(i.meshes=t.meshes.map((n,a)=>this._resolveMesh(n,a))),t.nodes&&(i.nodes=t.nodes.map((n,a)=>this._resolveNode(n,a)),i.nodes=i.nodes.map((n,a)=>this._resolveNodeChildren(n))),t.skins&&(i.skins=t.skins.map((n,a)=>this._resolveSkin(n,a))),t.scenes&&(i.scenes=t.scenes.map((n,a)=>this._resolveScene(n,a))),typeof this.json.scene=="number"&&i.scenes&&(i.scene=i.scenes[this.json.scene]),i}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,r){if(typeof r=="object")return r;let i=t&&t[r];return i||console.warn(`glTF file error: Could not find ${t}[${r}]`),i}_resolveScene(t,r){return Ye(ne({},t),{id:t.id||`scene-${r}`,nodes:(t.nodes||[]).map(i=>this.getNode(i))})}_resolveNode(t,r){let i=Ye(ne({},t),{id:(t==null?void 0:t.id)||`node-${r}`});return t.mesh!==void 0&&(i.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(i.camera=this.getCamera(t.camera)),t.skin!==void 0&&(i.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(i.mesh=t.meshes.reduce((n,a)=>{let o=this.getMesh(a);return n.id=o.id,n.primitives=n.primitives.concat(o.primitives),n},{primitives:[]})),i}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(r=>this.getNode(r))),t}_resolveSkin(t,r){let i=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return Ye(ne({},t),{id:t.id||`skin-${r}`,inverseBindMatrices:i})}_resolveMesh(t,r){let i=Ye(ne({},t),{id:t.id||`mesh-${r}`,primitives:[]});return t.primitives&&(i.primitives=t.primitives.map(n=>{let a=Ye(ne({},n),{attributes:{},indices:void 0,material:void 0}),o=n.attributes;for(let s in o)a.attributes[s]=this.getAccessor(o[s]);return n.indices!==void 0&&(a.indices=this.getAccessor(n.indices)),n.material!==void 0&&(a.material=this.getMaterial(n.material)),a})),i}_resolveMaterial(t,r){let i=Ye(ne({},t),{id:t.id||`material-${r}`});if(i.normalTexture&&(i.normalTexture=ne({},i.normalTexture),i.normalTexture.texture=this.getTexture(i.normalTexture.index)),i.occlusionTexture&&(i.occlusionTexture=ne({},i.occlusionTexture),i.occlusionTexture.texture=this.getTexture(i.occlusionTexture.index)),i.emissiveTexture&&(i.emissiveTexture=ne({},i.emissiveTexture),i.emissiveTexture.texture=this.getTexture(i.emissiveTexture.index)),i.emissiveFactor||(i.emissiveFactor=i.emissiveTexture?[1,1,1]:[0,0,0]),i.pbrMetallicRoughness){i.pbrMetallicRoughness=ne({},i.pbrMetallicRoughness);let n=i.pbrMetallicRoughness;n.baseColorTexture&&(n.baseColorTexture=ne({},n.baseColorTexture),n.baseColorTexture.texture=this.getTexture(n.baseColorTexture.index)),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture=ne({},n.metallicRoughnessTexture),n.metallicRoughnessTexture.texture=this.getTexture(n.metallicRoughnessTexture.index))}return i}_resolveAccessor(t,r){let i=b9e(t.componentType),n=_9e(t.type),a=i*n,o=Ye(ne({},t),{id:t.id||`accessor-${r}`,bytesPerComponent:i,components:n,bytesPerElement:a,value:void 0,bufferView:void 0,sparse:void 0});if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let s=o.bufferView.buffer,{ArrayType:u,byteLength:l}=bg(o,o.bufferView),c=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+s.byteOffset,f=s.arrayBuffer.slice(c,c+l);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(s,c,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new u(f)}return o}_getValueFromInterleavedBuffer(t,r,i,n,a){let o=new Uint8Array(a*n);for(let s=0;s<a;s++){let u=r+s*i;o.set(new Uint8Array(t.arrayBuffer.slice(u,u+n)),s*n)}return o.buffer}_resolveTexture(t,r){return Ye(ne({},t),{id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):y9e(),source:typeof t.source=="number"?this.getImage(t.source):void 0})}_resolveSampler(t,r){let i=Ye(ne({id:t.id||`sampler-${r}`},t),{parameters:{}});for(let n in i){let a=this._enumSamplerParameter(n);a!==void 0&&(i.parameters[a]=i[n])}return i}_enumSamplerParameter(t){return g9e[t]}_resolveImage(t,r){let i=Ye(ne({},t),{id:t.id||`image-${r}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0}),n=this.images[r];return n&&(i.image=n),i}_resolveBufferView(t,r){let i=t.buffer,n=this.buffers[i].arrayBuffer,a=this.buffers[i].byteOffset||0;return t.byteOffset&&(a+=t.byteOffset),Ye(ne({id:`bufferView-${r}`},t),{buffer:this.buffers[i],data:new Uint8Array(n,a,t.byteLength)})}_resolveCamera(t,r){let i=Ye(ne({},t),{id:t.id||`camera-${r}`});return i.perspective,i.orthographic,i}};function fb(e,t){return new gee().postProcess(e,t)}var FS={URI:0,EMBEDDED:1};function DS(e,t,r,i){e.rotateYtoZ=!0;let n=(e.byteOffset||0)+(e.byteLength||0)-r;if(n===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=(i==null?void 0:i["3d-tiles"])&&i["3d-tiles"].assetGltfUpAxis?i["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=fd(t,r,n),e.gltfByteOffset=0,e.gltfByteLength=n,r%4==0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function MS(e,t,r,i){let n=(r==null?void 0:r["3d-tiles"])||{};if(x9e(e,t,r),n.loadGLTF){if(!i)return;let{parse:a,fetch:o}=i;if(e.gltfUrl){let s=await o(e.gltfUrl,r);e.gltfArrayBuffer=await s.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let s=await a(e.gltfArrayBuffer,dc,r,i);e.gltf=fb(s),e.gpuMemoryUsageInBytes=sb(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function x9e(e,t,r){switch(t){case FS.URI:if(e.gltfArrayBuffer){let i=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),a=new TextDecoder().decode(i);e.gltfUrl=a.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case FS.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function vee(e,t,r,i,n){var o;r=w9e(e,t,r,i,n),await MS(e,FS.EMBEDDED,i,n);let a=(o=e==null?void 0:e.gltf)==null?void 0:o.extensions;return a&&a.CESIUM_RTC&&(e.rtcCenter=a.CESIUM_RTC.center),r}function w9e(e,t,r,i,n){r=qf(e,t,r),r=cg(e,t,r),r=fg(e,t,r,i),r=DS(e,t,r,i);let a=new Nf(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Zt.FLOAT,3),r}var Ro=Fe(fr()),yee=Fe(ua());async function bee(e,t,r,i,n){return r=E9e(e,t,r,i,n),await MS(e,e.gltfFormat||0,i,n),r}function E9e(e,t,r,i,n){var l;if(r=qf(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=cg(e,t,r);let a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r+=4,r=fg(e,t,r,i),r=DS(e,t,r,i),!((l=e==null?void 0:e.header)==null?void 0:l.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let o=new Nf(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",Zt.FLOAT,3);let u=new ug(e.batchTableJson,e.batchTableBinary,s);return S9e(e,o,u,s),r}function S9e(e,t,r,i){let n=new Array(i),a=new Ro.Vector3,o=new Ro.Vector3,s=new Ro.Vector3,u=new Ro.Vector3,l=new Ro.Matrix3,c=new Ro.Quaternion,f=new Ro.Vector3,h={},d=new Ro.Matrix4,p=[],y=[],g=[],b=[];for(let E=0;E<i;E++){let A;if(t.hasProperty("POSITION"))A=t.getProperty("POSITION",Zt.FLOAT,3,E,a);else if(t.hasProperty("POSITION_QUANTIZED")){A=t.getProperty("POSITION_QUANTIZED",Zt.UNSIGNED_SHORT,3,E,a);let W=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Zt.FLOAT,3);if(!W)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let N=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Zt.FLOAT,3);if(!N)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let H=65535;for(let L=0;L<3;L++)A[L]=A[L]/H*N[L]+W[L]}if(!A)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(A),h.translation=a,e.normalUp=t.getProperty("NORMAL_UP",Zt.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",Zt.FLOAT,3,E,y);let k=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",Zt.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Zt.UNSIGNED_SHORT,2,E,y),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(yee.Ellipsoid.WGS84.eastNorthUpToFixedFrame(a,d),d.getRotationMatrix3(l)):l.identity()}k&&(u.copy(o).cross(s).normalize(),l.setColumn(0,o),l.setColumn(1,s),l.setColumn(2,u)),c.fromMatrix3(l),h.rotation=c,f.set(1,1,1);let R=t.getProperty("SCALE",Zt.FLOAT,1,E,g);Number.isFinite(R)&&f.multiplyByScalar(R);let F=t.getProperty("SCALE_NON_UNIFORM",Zt.FLOAT,3,E,p);F&&f.scale(F),h.scale=f;let C=t.getProperty("BATCH_ID",Zt.UNSIGNED_SHORT,1,E,b);C===void 0&&(C=E);let j=new Ro.Matrix4().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(j),d.scale(h.scale);let O=d.clone();n[E]={modelMatrix:O,batchId:C}}e.instances=n}async function _ee(e,t,r,i,n,a){r=qf(e,t,r);let o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-r>12;){let s={};e.tiles.push(s),r=await a(t,r,i,n,s)}return r}async function xee(e,t,r,i){var n;if(e.rotateYtoZ=!0,e.gltfUpAxis=(r==null?void 0:r["3d-tiles"])&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",(n=r==null?void 0:r["3d-tiles"])==null?void 0:n.loadGLTF){if(!i)return;let{parse:a}=i,o=await a(t,dc,r,i);e.gltf=fb(o),e.gpuMemoryUsageInBytes=sb(e.gltf)}else e.gltfArrayBuffer=t}async function KO(e,t=0,r,i,n={}){switch(n.byteOffset=t,n.type=zQ(e,t),n.type){case ss.COMPOSITE:return await _ee(n,e,t,r,i,KO);case ss.BATCHED_3D_MODEL:return await vee(n,e,t,r,i);case ss.GLTF:return await xee(n,e,r,i);case ss.INSTANCED_3D_MODEL:return await bee(n,e,t,r,i);case ss.POINT_CLOUD:return await fZ(n,e,t,r,i);default:throw new Error(`3DTileLoader: unknown type ${n.type}`)}}var T9e=1952609651,A9e=1;async function YO(e,t,r){if(new Uint32Array(e.slice(0,4))[0]!==T9e)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==A9e)throw new Error("Wrong subtree file verson, must be 1");let a=wee(e.slice(8,16)),o=new Uint8Array(e,24,a),u=new TextDecoder("utf8").decode(o),l=JSON.parse(u),c=wee(e.slice(16,24)),f=new ArrayBuffer(0);if(c&&(f=e.slice(24+a)),await LS(l,l.tileAvailability,f,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await LS(l,h,f,r);else await LS(l,l.contentAvailability,f,r);return await LS(l,l.childSubtreeAvailability,f,r),l}async function LS(e,t,r,i){let n=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof n!="number")return;let a=e.bufferViews[n],o=e.buffers[a.buffer];if(!(i==null?void 0:i.baseUrl))throw new Error("Url is not provided");if(!i.fetch)throw new Error("fetch is not provided");if(o.uri){let s=`${(i==null?void 0:i.baseUrl)||""}/${o.uri}`,l=await(await i.fetch(s)).arrayBuffer();t.explicitBitstream=new Uint8Array(l,a.byteOffset,a.byteLength);return}t.explicitBitstream=new Uint8Array(r,a.byteOffset,a.byteLength)}function wee(e){let t=new DataView(e),r=t.getUint32(0,!0),i=t.getUint32(4,!0);return r+2**32*i}var jS={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:ag,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:YO,options:{}};function XO(e){if(typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function nu(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||XO()}var k9e=globalThis.self||globalThis.window||globalThis.global,wg=globalThis.window||globalThis.self||globalThis.global,R9e=globalThis.document||{},Id=globalThis.process||{},C9e=globalThis.console,Z2t=globalThis.navigator||{};var NS="4.0.0-alpha.16",rkt=nu();function I9e(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var $O=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=I9e(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Eee(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function See(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function qS(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,n=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(r=Math.min(r,i/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(n,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var US;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(US||(US={}));var P9e=10;function Tee(e){return typeof e!="string"?e:(e=e.toUpperCase(),US[e]||US.WHITE)}function Aee(e,t,r){if(!nu&&typeof e=="string"){if(t){let i=Tee(t);e="[".concat(i,"m").concat(e,"")}if(r){let i=Tee(r);e="[".concat(i+P9e,"m").concat(e,"")}}return e}function kee(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r),n=e;for(let a of i){let o=n[a];typeof o=="function"&&(t.find(s=>a===s)||(n[a]=o.bind(e)))}}function Eg(e,t){if(!e)throw new Error(t||"Assertion failed")}function Pd(){let e;if(nu()&&wg.performance){var t,r;e=wg===null||wg===void 0||(t=wg.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Id){var i;let n=Id===null||Id===void 0||(i=Id.hrtime)===null||i===void 0?void 0:i.call(Id);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}var Sg={debug:nu()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},B9e={enabled:!0,level:0};function cs(){}var Ree={},Cee={once:!0},GS=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=NS,this._startTs=Pd(),this._deltaTs=Pd(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new $O("__probe-".concat(this.id,"__"),B9e),this.timeStamp("".concat(this.id," started")),kee(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Pd()-this._startTs).toPrecision(10))}getDelta(){return Number((Pd()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Eg(t,r)}warn(t){return this._getLogFunction(0,t,Sg.warn,arguments,Cee)}error(t){return this._getLogFunction(0,t,Sg.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Sg.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Sg.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Sg.debug||Sg.info,arguments,Cee)}table(t,r,i){return r?this._getLogFunction(t,r,console.table||cs,i&&[i],{tag:M9e(r)}):cs}image(t){let{logLevel:r,priority:i,image:n,message:a="",scale:o=1}=t;return this._shouldLog(r||i)?nu()?D9e({image:n,message:a,scale:o}):F9e({image:n,message:a,scale:o}):cs}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||cs)}group(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},n=Pee({logLevel:t,message:r,opts:i}),{collapsed:a}=i;return n.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||cs)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Iee(t)}_getLogFunction(t,r,i,n,a){if(this._shouldLog(t)){a=Pee({logLevel:t,message:r,args:n,opts:a}),i=i||a.method,Eg(i),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=Pd();let o=a.tag||a.message;if(a.once&&o)if(!Ree[o])Ree[o]=Pd();else return cs;return r=O9e(this.id,a.message,a),i.bind(console,r,...a.args)}return cs}};GS.VERSION=NS;function Iee(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Eg(Number.isFinite(t)&&t>=0),t}function Pee(e){let{logLevel:t,message:r}=e;e.logLevel=Iee(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&i.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let n=typeof e.message;return Eg(n==="string"||n==="object"),Object.assign(e,{args:i},e.opts)}function O9e(e,t,r){if(typeof t=="string"){let i=r.time?See(Eee(r.total)):"";t=r.time?"".concat(e,": ").concat(i," ").concat(t):"".concat(e,": ").concat(t),t=Aee(t,r.color,r.background)}return t}function F9e(e){let{image:t,message:r="",scale:i=1}=e;return console.warn("removed"),cs}function D9e(e){let{image:t,message:r="",scale:i=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=qS(a,r,i);console.log(...o)},a.src=t,cs}let n=t.nodeName||"";if(n.toLowerCase()==="img")return console.log(...qS(t,r,i)),cs;if(n.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...qS(a,r,i)),a.src=t.toDataURL(),cs}return cs}function M9e(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var JO=new GS({id:"@probe.gl/log"});var fs=null;try{fs=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function xi(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}xi.prototype.__isLong__;Object.defineProperty(xi.prototype,"__isLong__",{value:!0});function Ra(e){return(e&&e.__isLong__)===!0}function Bee(e){var t=Math.clz32(e&-e);return e?31-t:t}xi.isLong=Ra;var Oee={},Fee={};function Bd(e,t){var r,i,n;return t?(e>>>=0,(n=0<=e&&e<256)&&(i=Fee[e],i)?i:(r=Vr(e,0,!0),n&&(Fee[e]=r),r)):(e|=0,(n=-128<=e&&e<128)&&(i=Oee[e],i)?i:(r=Vr(e,e<0?-1:0,!1),n&&(Oee[e]=r),r))}xi.fromInt=Bd;function hs(e,t){if(isNaN(e))return t?pc:ou;if(t){if(e<0)return pc;if(e>=Mee)return Uee}else{if(e<=-Lee)return uo;if(e+1>=Lee)return qee}return e<0?hs(-e,t).neg():Vr(e%Tg|0,e/Tg|0,t)}xi.fromNumber=hs;function Vr(e,t,r){return new xi(e,t,r)}xi.fromBits=Vr;var zS=Math.pow;function QO(e,t,r){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(r=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?pc:ou;if(r=r||10,r<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return QO(e.substring(1),t,r).neg();for(var n=hs(zS(r,8)),a=ou,o=0;o<e.length;o+=8){var s=Math.min(8,e.length-o),u=parseInt(e.substring(o,o+s),r);if(s<8){var l=hs(zS(r,s));a=a.mul(l).add(hs(u))}else a=a.mul(n),a=a.add(hs(u))}return a.unsigned=t,a}xi.fromString=QO;function au(e,t){return typeof e=="number"?hs(e,t):typeof e=="string"?QO(e,t):Vr(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}xi.fromValue=au;var Dee=1<<16,L9e=1<<24,Tg=Dee*Dee,Mee=Tg*Tg,Lee=Mee/2,jee=Bd(L9e),ou=Bd(0);xi.ZERO=ou;var pc=Bd(0,!0);xi.UZERO=pc;var Ag=Bd(1);xi.ONE=Ag;var Nee=Bd(1,!0);xi.UONE=Nee;var ZO=Bd(-1);xi.NEG_ONE=ZO;var qee=Vr(4294967295|0,2147483647|0,!1);xi.MAX_VALUE=qee;var Uee=Vr(4294967295|0,4294967295|0,!0);xi.MAX_UNSIGNED_VALUE=Uee;var uo=Vr(0,2147483648|0,!1);xi.MIN_VALUE=uo;var ze=xi.prototype;ze.toInt=function(){return this.unsigned?this.low>>>0:this.low};ze.toNumber=function(){return this.unsigned?(this.high>>>0)*Tg+(this.low>>>0):this.high*Tg+(this.low>>>0)};ze.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(uo)){var r=hs(t),i=this.div(r),n=i.mul(r).sub(this);return i.toString(t)+n.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var a=hs(zS(t,6),this.unsigned),o=this,s="";;){var u=o.div(a),l=o.sub(u.mul(a)).toInt()>>>0,c=l.toString(t);if(o=u,o.isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}};ze.getHighBits=function(){return this.high};ze.getHighBitsUnsigned=function(){return this.high>>>0};ze.getLowBits=function(){return this.low};ze.getLowBitsUnsigned=function(){return this.low>>>0};ze.getNumBitsAbs=function(){if(this.isNegative())return this.eq(uo)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&(t&1<<r)==0;r--);return this.high!=0?r+33:r+1};ze.isZero=function(){return this.high===0&&this.low===0};ze.eqz=ze.isZero;ze.isNegative=function(){return!this.unsigned&&this.high<0};ze.isPositive=function(){return this.unsigned||this.high>=0};ze.isOdd=function(){return(this.low&1)==1};ze.isEven=function(){return(this.low&1)==0};ze.equals=function(t){return Ra(t)||(t=au(t)),this.unsigned!==t.unsigned&&this.high>>>31==1&&t.high>>>31==1?!1:this.high===t.high&&this.low===t.low};ze.eq=ze.equals;ze.notEquals=function(t){return!this.eq(t)};ze.neq=ze.notEquals;ze.ne=ze.notEquals;ze.lessThan=function(t){return this.comp(t)<0};ze.lt=ze.lessThan;ze.lessThanOrEqual=function(t){return this.comp(t)<=0};ze.lte=ze.lessThanOrEqual;ze.le=ze.lessThanOrEqual;ze.greaterThan=function(t){return this.comp(t)>0};ze.gt=ze.greaterThan;ze.greaterThanOrEqual=function(t){return this.comp(t)>=0};ze.gte=ze.greaterThanOrEqual;ze.ge=ze.greaterThanOrEqual;ze.compare=function(t){if(Ra(t)||(t=au(t)),this.eq(t))return 0;var r=this.isNegative(),i=t.isNegative();return r&&!i?-1:!r&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};ze.comp=ze.compare;ze.negate=function(){return!this.unsigned&&this.eq(uo)?uo:this.not().add(Ag)};ze.neg=ze.negate;ze.add=function(t){Ra(t)||(t=au(t));var r=this.high>>>16,i=this.high&65535,n=this.low>>>16,a=this.low&65535,o=t.high>>>16,s=t.high&65535,u=t.low>>>16,l=t.low&65535,c=0,f=0,h=0,d=0;return d+=a+l,h+=d>>>16,d&=65535,h+=n+u,f+=h>>>16,h&=65535,f+=i+s,c+=f>>>16,f&=65535,c+=r+o,c&=65535,Vr(h<<16|d,c<<16|f,this.unsigned)};ze.subtract=function(t){return Ra(t)||(t=au(t)),this.add(t.neg())};ze.sub=ze.subtract;ze.multiply=function(t){if(this.isZero())return this;if(Ra(t)||(t=au(t)),fs){var r=fs.mul(this.low,this.high,t.low,t.high);return Vr(r,fs.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?pc:ou;if(this.eq(uo))return t.isOdd()?uo:ou;if(t.eq(uo))return this.isOdd()?uo:ou;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(jee)&&t.lt(jee))return hs(this.toNumber()*t.toNumber(),this.unsigned);var i=this.high>>>16,n=this.high&65535,a=this.low>>>16,o=this.low&65535,s=t.high>>>16,u=t.high&65535,l=t.low>>>16,c=t.low&65535,f=0,h=0,d=0,p=0;return p+=o*c,d+=p>>>16,p&=65535,d+=a*c,h+=d>>>16,d&=65535,d+=o*l,h+=d>>>16,d&=65535,h+=n*c,f+=h>>>16,h&=65535,h+=a*l,f+=h>>>16,h&=65535,h+=o*u,f+=h>>>16,h&=65535,f+=i*c+n*l+a*u+o*s,f&=65535,Vr(d<<16|p,f<<16|h,this.unsigned)};ze.mul=ze.multiply;ze.divide=function(t){if(Ra(t)||(t=au(t)),t.isZero())throw Error("division by zero");if(fs){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?fs.div_u:fs.div_s)(this.low,this.high,t.low,t.high);return Vr(r,fs.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?pc:ou;var i,n,a;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return pc;if(t.gt(this.shru(1)))return Nee;a=pc}else{if(this.eq(uo)){if(t.eq(Ag)||t.eq(ZO))return uo;if(t.eq(uo))return Ag;var o=this.shr(1);return i=o.div(t).shl(1),i.eq(ou)?t.isNegative()?Ag:ZO:(n=this.sub(t.mul(i)),a=i.add(n.div(t)),a)}else if(t.eq(uo))return this.unsigned?pc:ou;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=ou}for(n=this;n.gte(t);){i=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(i)/Math.LN2),u=s<=48?1:zS(2,s-48),l=hs(i),c=l.mul(t);c.isNegative()||c.gt(n);)i-=u,l=hs(i,this.unsigned),c=l.mul(t);l.isZero()&&(l=Ag),a=a.add(l),n=n.sub(c)}return a};ze.div=ze.divide;ze.modulo=function(t){if(Ra(t)||(t=au(t)),fs){var r=(this.unsigned?fs.rem_u:fs.rem_s)(this.low,this.high,t.low,t.high);return Vr(r,fs.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};ze.mod=ze.modulo;ze.rem=ze.modulo;ze.not=function(){return Vr(~this.low,~this.high,this.unsigned)};ze.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};ze.clz=ze.countLeadingZeros;ze.countTrailingZeros=function(){return this.low?Bee(this.low):Bee(this.high)+32};ze.ctz=ze.countTrailingZeros;ze.and=function(t){return Ra(t)||(t=au(t)),Vr(this.low&t.low,this.high&t.high,this.unsigned)};ze.or=function(t){return Ra(t)||(t=au(t)),Vr(this.low|t.low,this.high|t.high,this.unsigned)};ze.xor=function(t){return Ra(t)||(t=au(t)),Vr(this.low^t.low,this.high^t.high,this.unsigned)};ze.shiftLeft=function(t){return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?Vr(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):Vr(0,this.low<<t-32,this.unsigned)};ze.shl=ze.shiftLeft;ze.shiftRight=function(t){return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?Vr(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):Vr(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};ze.shr=ze.shiftRight;ze.shiftRightUnsigned=function(t){return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?Vr(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?Vr(this.high,0,this.unsigned):Vr(this.high>>>t-32,0,this.unsigned)};ze.shru=ze.shiftRightUnsigned;ze.shr_u=ze.shiftRightUnsigned;ze.rotateLeft=function(t){var r;return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t===32?Vr(this.high,this.low,this.unsigned):t<32?(r=32-t,Vr(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,Vr(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))};ze.rotl=ze.rotateLeft;ze.rotateRight=function(t){var r;return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t===32?Vr(this.high,this.low,this.unsigned):t<32?(r=32-t,Vr(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,Vr(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};ze.rotr=ze.rotateRight;ze.toSigned=function(){return this.unsigned?Vr(this.low,this.high,!1):this};ze.toUnsigned=function(){return this.unsigned?this:Vr(this.low,this.high,!0)};ze.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};ze.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};ze.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};xi.fromBytes=function(t,r,i){return i?xi.fromBytesLE(t,r):xi.fromBytesBE(t,r)};xi.fromBytesLE=function(t,r){return new xi(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};xi.fromBytesBE=function(t,r){return new xi(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var kg=xi;var j9e=16;function hb(e){e==="X"&&(e="");let t=e.padEnd(j9e,"0");return kg.fromString(t,!0,16)}function e8(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let i=t;t*=4;let a=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-i-a.length).join("0")+a}function t8(e,t){let r=N9e(e).shiftRightUnsigned(2);return e.add(kg.fromNumber(2*t+1-4).multiply(r))}function N9e(e){return e.and(e.not().add(1))}var q9e=3,U9e=30,G9e=2*U9e+1,Gee=180/Math.PI;function zee(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),r=parseInt(t[0],10),i=t[1],n=i.length,a=0,o=[0,0];for(let s=n-1;s>=0;s--){a=n-s;let u=i[s],l=0,c=0;u==="1"?c=1:u==="2"?(l=1,c=1):u==="3"&&(l=1);let f=Math.pow(2,a-1);z9e(f,o,l,c),o[0]+=f*l,o[1]+=f*c}if(r%2==1){let s=o[0];o[0]=o[1],o[1]=s}return{face:r,ij:o,level:a}}function Hee(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<q9e+G9e;)t="0"+t;let r=t.lastIndexOf("1"),i=t.substring(0,3),n=t.substring(3,r),a=n.length/2,o=kg.fromString(i,!0,2).toString(10),s="";if(a!==0)for(s=kg.fromString(n,!0,2).toString(4);s.length<a;)s="0"+s;return`${o}/${s}`}function r8(e,t,r){let i=1<<t;return[(e[0]+r[0])/i,(e[1]+r[1])/i]}function Wee(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function i8(e){return[Wee(e[0]),Wee(e[1])]}function n8(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function a8([e,t,r]){let i=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Gee,i*Gee]}function z9e(e,t,r,i){if(i===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let n=t[0];t[0]=t[1],t[1]=n}}function Vee(e){let t=r8(e.ij,e.level,[.5,.5]),r=i8(t),i=n8(e.face,r);return a8(i)}var H9e=100;function o8(e){let{face:t,ij:r,level:i}=e,n=[[0,0],[0,1],[1,1],[1,0],[0,0]],a=Math.max(1,Math.ceil(H9e*Math.pow(2,-i))),o=new Float64Array(4*a*2+2),s=0,u=0;for(let l=0;l<4;l++){let c=n[l].slice(0),f=n[l+1],h=(f[0]-c[0])/a,d=(f[1]-c[1])/a;for(let p=0;p<a;p++){c[0]+=h,c[1]+=d;let y=r8(r,i,c),g=i8(y),b=n8(t,g),E=a8(b);Math.abs(E[1])>89.999&&(E[0]=u);let A=E[0]-u;E[0]+=A>180?-360:A<-180?360:0,o[s++]=E[0],o[s++]=E[1],u=E[0]}}return o[s++]=o[0],o[s++]=o[1],o}function Rg(e){let t=W9e(e);return zee(t)}function W9e(e){if(e.indexOf("/")>0)return e;let t=hb(e);return Hee(t)}function s8(e){let t=Rg(e);return Vee(t)}function Kee(e){let t;if(e.face===2||e.face===5){let r=null,i=0;for(let n=0;n<4;n++){let a=`${e.face}/${n}`,o=Rg(a),s=o8(o);(typeof r=="undefined"||r===null)&&(r=new Float64Array(4*s.length)),r.set(s,i),i+=s.length}t=Yee(r)}else{let r=o8(e);t=Yee(r)}return t}function Yee(e){if(e.length%2!=0)throw new Error("Invalid corners");let t=[],r=[];for(let i=0;i<e.length;i+=2)t.push(e[i]),r.push(e[i+1]);return t.sort((i,n)=>i-n),r.sort((i,n)=>i-n),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}var mc=Fe(fr());function u8(e,t){let r=(t==null?void 0:t.minimumHeight)||0,i=(t==null?void 0:t.maximumHeight)||0,n=Rg(e),a=Kee(n),o=a.west,s=a.south,u=a.east,l=a.north,c=[];return c.push(new mc.Vector3(o,l,r)),c.push(new mc.Vector3(u,l,r)),c.push(new mc.Vector3(u,s,r)),c.push(new mc.Vector3(o,s,r)),c.push(new mc.Vector3(o,l,i)),c.push(new mc.Vector3(u,l,i)),c.push(new mc.Vector3(u,s,i)),c.push(new mc.Vector3(o,s,i)),c}var Xee=Fe(fr()),$ee=Fe(tl());var Jee=Fe(ua());function HS(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},i=u8(t,r),n=s8(t),a=n[0],o=n[1],s=Jee.Ellipsoid.WGS84.cartographicToCartesian([a,o,r.maximumHeight]),u=new Xee.Vector3(s[0],s[1],s[2]);i.push(u);let l=(0,$ee.makeOrientedBoundingBoxFromPoints)(i);return[...l.center,...l.halfAxes]}var V9e=4,K9e=8,Y9e={QUADTREE:V9e,OCTREE:K9e};function X9e(e,t,r){if(e==null?void 0:e.box){let i=hb(e.s2VolumeInfo.token),n=t8(i,t),a=e8(n),o=ne({},e.s2VolumeInfo);switch(o.token=a,r){case"OCTREE":let l=e.s2VolumeInfo,c=l.maximumHeight-l.minimumHeight,f=c/2,h=l.minimumHeight+c/2;l.minimumHeight=h-f,l.maximumHeight=h+f;break;default:break}return{box:HS(o),s2VolumeInfo:o}}}async function l8(e){let{implicitOptions:t,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:i=0,globalData:n={level:0,mortonIndex:0,x:0,y:0,z:0},s2VolumeBox:a,loaderOptions:o}=e,{subtree:s,level:u=0}=e,{subdivisionScheme:l,subtreeLevels:c,maximumLevel:f,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=t,y={children:[],lodMetricValue:0,contentUrl:""};if(!f)return JO.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),y;let g=u+n.level;if(g>f)return y;let b=Y9e[l],E=Math.log2(b),A=i&1,k=i>>1&1,R=i>>2&1,F=(b**u-1)/(b-1),C=Od(r.mortonIndex,i,E),j=F+C,O=Od(r.x,A,1),W=Od(r.y,k,1),N=Od(r.z,R,1),H=!1;u>=c&&(H=c8(s.childSubtreeAvailability,C));let L=Od(n.x,O,u*E),z=Od(n.y,W,u*E),X=Od(n.z,N,u*E);if(H){let de=`${p}/${d}`,Me=WS(de,g,L,z,X);s=await Wr(Me,jS,o),n.mortonIndex=C,n.x=O,n.y=W,n.z=N,n.level=u,C=0,j=0,O=0,W=0,N=0,u=0}if(!c8(s.tileAvailability,j))return y;c8(s.contentAvailability,j)&&(y.contentUrl=WS(h,g,L,z,X));let ae=u+1,ue={mortonIndex:C,x:O,y:W,z:N};for(let de=0;de<b;de++){let Me=X9e(a,de,l),Pe=await l8({subtree:s,implicitOptions:t,loaderOptions:o,parentData:ue,childIndex:de,level:ae,globalData:ne({},n),s2VolumeBox:Me});if(Pe.contentUrl||Pe.children.length){let qe=g+1,Ae=$9e(Pe,qe,{childTileX:O,childTileY:W,childTileZ:N},t,a);y.children.push(Ae)}}return y}function c8(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&JO.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?Z9e(t,r.explicitBitstream):!1}function $9e(e,t,r,i,n){let{basePath:a,refine:o,getRefine:s,lodMetricType:u,getTileType:l,rootLodMetricValue:c,rootBoundingVolume:f}=i,h=e.contentUrl&&e.contentUrl.replace(`${a}/`,""),d=c/2**t,p=(n==null?void 0:n.box)?{box:n.box}:f,y=J9e(t,p,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:s(o),type:l(e),lodMetricType:u,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:y}}function J9e(e,t,r){if(t.region){let{childTileX:i,childTileY:n,childTileZ:a}=r,[o,s,u,l,c,f]=t.region,h=2**e,d=(u-o)/h,p=(l-s)/h,y=(f-c)/h,[g,b]=[o+d*i,o+d*(i+1)],[E,A]=[s+p*n,s+p*(n+1)],[k,R]=[c+y*a,c+y*(a+1)];return{region:[g,E,b,A,k,R]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${t}`)}function Od(e,t,r){return(e<<r)+t}function WS(e,t,r,i,n){let a=Q9e({level:t,x:r,y:i,z:n});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>a[o])}function Q9e(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function Z9e(e,t){let r=Math.floor(e/8),i=e%8;return(t[r]>>i&1)===1}function f8(e,t=""){if(!t)return il.EMPTY;let i=t.split("?")[0].split(".").pop();switch(i){case"pnts":return il.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return il.SCENEGRAPH;default:return i||il.EMPTY}}function h8(e){switch(e){case"REPLACE":case"replace":return ea.REPLACE;case"ADD":case"add":return ea.ADD;default:return e}}function d8(e="",t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let i=new URL(e,`${t}/`);return decodeURI(i.toString())}else if(e.startsWith("/"))return e;return`${t}/${e}`}function Qee(e,t){var n;if(!e)return null;let r;if(e.content){let a=e.content.uri||((n=e.content)==null?void 0:n.url);r=d8(a,t)}return Ye(ne({},e),{id:r,contentUrl:r,lodMetricType:sc.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:f8(e,r),refine:h8(e.refine)})}async function Zee(e,t,r){let i=null,n=tte(e.root);n&&e.root?i=await ete(e.root,e,t,n,r):i=Qee(e.root,t);let a=[];for(a.push(i);a.length>0;){let o=a.pop()||{},s=o.children||[],u=[];for(let l of s){let c=tte(l),f;c?f=await ete(l,e,t,c,r):f=Qee(l,t),f&&(u.push(f),a.push(f))}o.children=u}return i}async function ete(e,t,r,i,n){var A,k,R;let{subdivisionScheme:a,maximumLevel:o,availableLevels:s,subtreeLevels:u,subtrees:{uri:l}}=i,c=WS(l,0,0,0,0),f=d8(c,r),h=await Wr(f,jS,n),d=d8((A=e.content)==null?void 0:A.uri,r),p=(k=t==null?void 0:t.root)==null?void 0:k.refine,y=e.geometricError,g=(R=e.boundingVolume.extensions)==null?void 0:R["3DTILES_bounding_volume_S2"];if(g){let C={box:HS(g),s2VolumeInfo:g};e.boundingVolume=C}let b=e.boundingVolume,E={contentUrlTemplate:d,subtreesUriTemplate:l,subdivisionScheme:a,subtreeLevels:u,maximumLevel:Number.isFinite(s)?s-1:o,refine:p,basePath:r,lodMetricType:sc.GEOMETRIC_ERROR,rootLodMetricValue:y,rootBoundingVolume:b,getTileType:f8,getRefine:h8};return await eqe(e,r,h,E,n)}async function eqe(e,t,r,i,n){if(!e)return null;let{children:a,contentUrl:o}=await l8({subtree:r,implicitOptions:i,loaderOptions:n}),s,u=null;return o&&(s=o,u={uri:o.replace(`${t}/`,"")}),Ye(ne({},e),{id:s,contentUrl:s,lodMetricType:sc.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:f8(e,s),refine:h8(e.refine),content:u||e.content,children:a})}function tte(e){var t;return((t=e==null?void 0:e.extensions)==null?void 0:t["3DTILES_implicit_tiling"])||(e==null?void 0:e.implicitTiling)}var gc={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:ag,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:tqe,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function tqe(e,t={},r){let i=t["3d-tiles"]||{},n;return i.isTileset==="auto"?n=(r==null?void 0:r.url)&&r.url.indexOf(".json")!==-1:n=i.isTileset,n?rqe(e,t,r):iqe(e,t,r)}async function rqe(e,t,r){var u;let i=JSON.parse(new TextDecoder().decode(e)),n=(r==null?void 0:r.url)||"",a=nqe(n),o=await Zee(i,a,t||{});return Ye(ne({},i),{loader:gc,url:n,queryString:(r==null?void 0:r.queryString)||"",basePath:a,root:o||i.root,type:En.TILES3D,lodMetricType:sc.GEOMETRIC_ERROR,lodMetricValue:((u=i.root)==null?void 0:u.geometricError)||0})}async function iqe(e,t,r){let i={content:{featureIds:null}};return await KO(e,0,t,r,i.content),i.content}function nqe(e){return Xs.dirname(e)}var rte="https://api.cesium.com/v1/assets";async function ite(e,t){if(!t){let a=await aqe(e);for(let o of a.items)o.type==="3DTILES"&&(t=o.id)}let r=await oqe(e,t),{type:i,url:n}=r;return Ft(i==="3DTILES"&&n),r.headers={Authorization:`Bearer ${r.accessToken}`},r}async function aqe(e){Ft(e);let t=rte,r={Authorization:`Bearer ${e}`},i=await Ua(t,{fetch:{headers:r}});if(!i.ok)throw new Error(i.statusText);return await i.json()}async function oqe(e,t){Ft(e,t);let r={Authorization:`Bearer ${e}`},i=`${rte}/${t}`,n=await Ua(`${i}`,{fetch:{headers:r}});if(!n.ok)throw new Error(n.statusText);let a=await n.json();if(n=await Ua(`${i}/endpoint`,{fetch:{headers:r}}),!n.ok)throw new Error(n.statusText);let o=await n.json();return a=ne(ne({},a),o),a}async function sqe(e,t={}){t=t["cesium-ion"]||{};let{accessToken:r}=t,i=t.assetId;if(!Number.isFinite(i)){let n=e.match(/\/([0-9]+)\/tileset.json/);i=n&&n[1]}return ite(r,i)}var VS=Ye(ne({},gc),{id:"cesium-ion",name:"Cesium Ion",preload:sqe,parse:async(e,t,r)=>(t=ne({},t),t["3d-tiles"]=t["cesium-ion"],t.loader=VS,gc.parse(e,t,r)),options:{"cesium-ion":Ye(ne({},gc.options["3d-tiles"]),{accessToken:null})}});function Gf(e,t,r){let i=12;if(!t)return r+i;let{magic:n,version:a=1,byteLength:o=12}=e;return Ft(Array.isArray(n)&&Number.isFinite(a)&&Number.isFinite(o)),t.setUint8(r+0,n[0]),t.setUint8(r+1,n[1]),t.setUint8(r+2,n[2]),t.setUint8(r+3,n[3]),t.setUint32(r+4,a,!0),t.setUint32(r+8,o,!0),r+=i,r}function zf(e,t,r){!e||e.setUint32(t+8,r,!0)}function nte(e,t,r,i,n){e=ne({magic:jf.COMPOSITE,tiles:[]},e);let a=r;r+=Gf(e,t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let o=0;o<e.tiles.length;++o)r+=n(e.tiles[o],t,r,i);return zf(t,a,r-a),r}function ate(e,t,r,i){let{featuresLength:n=0,batchTable:a}=e,o={BATCH_LENGTH:n},s=JSON.stringify(o),u=a?JSON.stringify(a):"",l=xo(s.length,8),c=u?xo(u.length,8):0;e=ne({magic:jf.BATCHED_MODEL},e);let f=r;r=Gf(e,t,r),t&&(t.setUint32(12,l,!0),t.setUint32(16,0,!0),t.setUint32(20,c,!0),t.setUint32(24,0,!0)),r+=16,r=Im(t,r,s,8),a&&(r=Im(t,r,u,8));let h=e.gltfEncoded;return h&&(r=hy(t,r,h,h.byteLength)),zf(t,f,r-f),r}function ote(e,t,r,i){let{featuresLength:n=1,gltfFormat:a=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:n,POSITION:new Array(n*3).fill(0)},l=JSON.stringify(u),c=l.length;e=ne({magic:jf.INSTANCED_MODEL},e);let f=r;return r=Gf(e,t,0),t&&(t.setUint32(12,c,!0),t.setUint32(16,0,!0),t.setUint32(20,0,!0),t.setUint32(24,0,!0),t.setUint32(28,a,!0)),r+=20,r+=Cm(t,r,l,c),r+=Cm(t,r,o,s),zf(t,f,r-f),r}var uqe={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function ste(e,t,r,i){let{featureTableJson:n=uqe}=e,a=JSON.stringify(n);a=oP(a,4);let{featureTableJsonByteLength:o=a.length}=e,s=new ArrayBuffer(12),u=s.byteLength;e=ne({magic:jf.POINT_CLOUD},e);let l=r;return r+=Gf(e,t,0),t&&(t.setUint32(r+0,o,!0),t.setUint32(r+4,u,!0),t.setUint32(r+8,0,!0),t.setUint32(r+12,0,!0)),r+=16,r+=Cm(t,r,a,o),r+=hy(t,r,s,u),zf(t,l,r-l),r}function p8(e,t){let r=m8(e,null,0,t),i=new ArrayBuffer(r),n=new DataView(i);return m8(e,n,0,t),i}function m8(e,t,r,i){switch(Ft(typeof e.type=="string"),e.type){case ss.COMPOSITE:return nte(e,t,r,i,m8);case ss.POINT_CLOUD:return ste(e,t,r,i);case ss.BATCHED_3D_MODEL:return ate(e,t,r,i);case ss.INSTANCED_3D_MODEL:return ote(e,t,r,i);default:throw new Error("3D Tiles: unknown tile type")}}var g8={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:ag,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],encodeSync:lqe,binary:!0,options:{["3d-tiles"]:{}}};function lqe(e,t){return p8(e,t)}var Ba=Fe(require("path"));var sl=Fe(Ate()),b3t=sl.default.v1,_3t=sl.default.v3,yc=sl.default.v4,x3t=sl.default.v5,w3t=sl.default.NIL,E3t=sl.default.version,S3t=sl.default.validate,T3t=sl.default.stringify,A3t=sl.default.parse;var Ap=Fe(require("process")),sk=Fe(uu()),F6=Fe(k8());var L0=Fe(require("path")),qpe=Fe(uu());var Lte=()=>({folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}});var D0=Fe(require("fs")),M0=Fe(require("path"));var Mpe=Fe(require("zlib")),Lpe=Fe(require("path")),s_=Fe(require("fs")),vst=Fe(pfe());var yst=Fe(h6());var bst=Fe(S8());function Y2(e){let t=`${e}.gz`,r=(0,Mpe.createGzip)(),i=(0,s_.createReadStream)(e),n=(0,s_.createWriteStream)(t);return new Promise((a,o)=>{i.on("end",()=>{console.log(`${t} compressed and saved.`),a(t)}),i.on("error",s=>{console.log(`${t}: compression error!`),o(s)}),i.pipe(r).pipe(n)})}async function jpe(e,t,r,i,n){process.platform==="win32"?await xst(e,t,r,i,n):await _st(e,t,r,i)}async function _st(e,t,r=0,i="."){let n=u_(t),a=[`-${r}`,"-r",n,i];await new Sf().start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}async function xst(e,t,r=0,i=(0,Lpe.join)(".","*"),n){i[0]==="@"&&(i=`*${i.substr(1)}`);let a=u_(t),o=["a","-tzip",`-mx=${r}`,a,i];await new Sf().start({command:n,arguments:o,spawn:{cwd:`${e}`},wait:0})}async function Un(e,t,r="index.json"){let i;t instanceof Promise?i=new Uint8Array(await t):t instanceof ArrayBuffer?i=new Uint8Array(t):i=t,await D0.promises.mkdir(e,{recursive:!0});let n=(0,M0.join)(e,r);try{await D0.promises.writeFile(n,i)}catch(a){throw a}return console.log(`${n} saved.`),n}async function wl(e,t,r="index.json",i=!0,n){let a=await Un(e,t,r);if(i){if(n)return n.includes(a)?null:(n.push(a),`${a}.gz`);{let o=await Y2(a);return await d6(a),o}}return a}async function X2(e,t){return new Promise((r,i)=>{let n=0;console.log(`load ${e}/${t}.`);let a=setInterval(()=>{let o=(0,M0.join)(e,t);Wr(o,cP).then(s=>{clearInterval(a),r(s)}).catch(()=>{n++,n>100&&(clearInterval(a),i(new Error(`Cannon load ${e}/${t}.`)))})},200)})}async function Npe(e){try{return await D0.promises.stat(e),!0}catch{return!1}}function l_(e){return D0.promises.rm(e,{recursive:!0})}function d6(e){return D0.promises.unlink(e)}function u_(e){return(0,M0.isAbsolute)(e)?e:(0,M0.join)(process.cwd(),e)}var co=class{constructor(t,r,i){this.length=0;this.nodesPerPage=r,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=t,this.converter=i,this.length=0}useWriteFunction(t){this.writeFile=t}getNodePageFileName(t){let r,i;return this.converter.options.slpk?(r=(0,L0.join)(this.converter.layers0Path,"nodepages"),i=`${t.toString()}.json`):(r=(0,L0.join)(this.converter.layers0Path,"nodepages",t.toString()),i="index.json"),{filePath:r,fileName:i}}async loadNodePage(t){let{filePath:r,fileName:i}=this.getNodePageFileName(t),n=(0,L0.join)(r,i);return await Npe(n)?(console.log(`load ${n}.`),await X2(r,i)):{nodes:[]}}getPageIndexByNodeId(t){return Math.floor(t/this.nodesPerPage)}async getPageByNodeId(t){let r=this.getPageIndexByNodeId(t);return this.converter.options.instantNodeWriting?await this.loadNodePage(r):this.nodePages[r]}async getNodeById(t,r){let i=t%this.nodesPerPage;return r=r||await this.getPageByNodeId(t),r.nodes[i]}async addChildRelation(t,r){var n;if(t==null)return;let i=await this.getNodeById(t);(n=i.children)==null||n.push(r),await this.saveNode(i)}async push(t,r){if(t.index=this.nodesCounter++,!this.converter.options.instantNodeWriting){let i=this.nodePages[this.nodePages.length-1];i.nodes.length===this.nodesPerPage&&(i={nodes:[]},this.nodePages.push(i)),i.nodes.push(t)}return await this.addChildRelation(r,t.index),co.updateResourceInMesh(t),await this.saveNode(t),t}async saveNode(t){if(this.converter.options.instantNodeWriting){let r=this.getPageIndexByNodeId(t.index),i=await this.getPageByNodeId(t.index),{filePath:n,fileName:a}=this.getNodePageFileName(r),o=await this.getNodeById(t.index,i);o?co.updateAll(o,t):i.nodes.push(t);let s=JSON.stringify(i);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:()=>this.writeFile(n,s,a,!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(n,s)},!0)}else return}async saveMetadata(){let t=(0,qpe.default)({nodeCount:this.nodesCounter},Lte()),r=!1;await this.converter.writeQueue.enqueue({archiveKey:"metadata.json",writePromise:()=>this.writeFile(this.converter.layers0Path,JSON.stringify(t),"metadata.json",r)})}async save(){if(this.converter.options.instantNodeWriting){await this.saveMetadata();return}if(this.converter.options.slpk){for(let[t,r]of this.nodePages.entries()){let i=JSON.stringify(r),n=(0,L0.join)(this.converter.layers0Path,"nodepages");await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${t.toString()}.json.gz`,writePromise:()=>this.writeFile(n,i,`${t.toString()}.json`)})}await this.saveMetadata()}else for(let[t,r]of this.nodePages.entries()){let i=JSON.stringify(r),n=(0,L0.join)(this.converter.layers0Path,"nodepages",t.toString());await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(n,i)})}}static updateResourceInMesh(t){t.mesh&&isFinite(t.index)&&(t.mesh.geometry.resource=t.index)}static updateAll(t,r){return Object.assign(t,r,{index:t.index}),co.updateResourceInMesh(t),t}static updateMaterialByNodeId(t,r){!t.mesh||(t.mesh.material={definition:r,resource:t.index})}static updateVertexCountByNodeId(t,r){!t.mesh||(t.mesh.geometry.vertexCount=r)}static updateNodeAttributeByNodeId(t){!t.mesh||!t.index||(t.mesh.attribute.resource=t.index)}static updateFeatureCountByNodeId(t,r){!t.mesh||(t.mesh.geometry.featureCount=r)}static updateTexelCountHintByNodeId(t,r){!t.mesh||!t.mesh.material||(t.mesh.material.texelCountHint=r)}};var c_=Fe(require("path")),$2=Fe(require("fs"));function J2(e){let t=1e6,r=e[0],i=Math.floor(r/3600);r=r-i*3600;let n=Math.floor(r/60);r=r-n*60;let a=Math.floor(r),o=e[1]/t,s="";return i&&(s+=`${i}h `),n&&(s+=`${n}m `),a&&(s+=`${a}s`),s||(s+=`${o}ms`),s}async function Q2(e){let{slpk:t,outputPath:r,tilesetName:i}=e,n=u_(r);try{if(t){let s=(0,c_.join)(n,`${i}.slpk`);return(await $2.promises.stat(s)).size}let a=(0,c_.join)(n,i);return await Upe(a)}catch(a){return console.log("Calculate file sizes error: ",a),null}}async function Upe(e){let t=0,r=await $2.promises.readdir(e);for(let i of r){let n=await $2.promises.stat((0,c_.join)(e,i));n.isDirectory()?t+=await Upe((0,c_.join)(e,i)):t+=n.size}return t}var Rs=Fe(fr()),y6=Fe(ua());var ame=Fe(k8());var Sp=3,j0=9;function Gpe(e){let{positions:t,normals:r,texCoords:i,colors:n,uvRegions:a,featureIndices:o}=e,s=t.length/j0;if(!o.length)return{faceRange:new Uint32Array([0,s-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:i,colors:n,uvRegions:a};let u=wst(o),l=Est(ne(ne({},u),e)),c=Sst(l);return Tst(c,u.featureCount)}function wst(e){let t=1,r=1,i=zpe(e.slice(0,Sp)),n=[],a=[],o=[i];n[0]=0,a[0]=i;for(let l=Sp;l<e.length;l+=Sp){let c=zpe(e.slice(l,l+Sp));i!==c&&(n[t]=l/Sp-1,n[t+1]=l/Sp,a[r]=c,o.includes(c)||o.push(c),t+=2,r+=1),i=c}n[t]=e.length/Sp-1;let s=new Uint32Array(n),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}function zpe(e){let t={},r=e[0],i=1;for(let n of e)t[n]=(t[n]||0)+1,i=i>t[n]?i:t[n],r=i>t[n]?r:n;return r}function Est(e){let{featureIds:t,positions:r,normals:i,colors:n,uvRegions:a,texCoords:o,faceRange:s=new Uint32Array(0)}=e,u=[],l=new Float32Array(r),c=new Float32Array(i),f=new Uint8Array(n),h=new Float32Array(o),d=new Uint16Array(a);for(let p=0;p<t.length;p++){let y=s[p*2],g=s[p*2+1],b=f_("positions",y,g),E=f_("normals",y,g),A=f_("colors",y,g),k=f_("uvRegions",y,g),R=f_("texCoords",y,g);u.push({featureId:t[p],positions:l.slice(0,b),normals:c.slice(0,E),colors:f.slice(0,A),uvRegions:d.slice(0,k),texCoords:h.slice(0,R)}),l=l.slice(b),c=c.slice(E),f=f.slice(A),d=d.slice(k),h=h.slice(R)}return u.sort((p,y)=>p.featureId-y.featureId)}function f_(e,t,r){let i=4,n=2,a=r-t+1,o=a*3;switch(e){case"positions":case"normals":return a*j0;case"colors":case"uvRegions":return o*i;case"texCoords":return o*n;default:return 0}}function Sst(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],n=t.find(a=>a.featureId===i.featureId);n?(n.positions=sa(n.positions,i.positions),n.normals=sa(n.normals,i.normals),n.colors=sa(n.colors,i.colors),n.texCoords=sa(n.texCoords,i.texCoords)):t.push(i)}return t}function Tst(e,t){let r=e[0],i=[r.featureId||0],n=new Float32Array(r.positions),a=new Float32Array(r.normals),o=new Uint8Array(r.colors),s=new Uint16Array(r.uvRegions),u=new Float32Array(r.texCoords),l=[0],c=0,f=0;for(let d=1;d<e.length;d++){let p=e[d];i.push(p.featureId||0),n=sa(n,p.positions),a=sa(a,p.normals),o=sa(o,p.colors),s=sa(s,p.uvRegions),u=sa(u,p.texCoords);let y=e[c];l.push(y.positions.length/j0-1+f),l.push(y.positions.length/j0+f),f+=y.positions.length/j0,c+=1}return l.push(n.length/j0-1),{faceRange:new Uint32Array(l),featureIds:i,positions:n,normals:a,colors:o,uvRegions:s,texCoords:u,featureCount:t}}var Pa=Fe(fr()),N0=Fe(ua()),Lc=Fe(tl());function p6(e,t){let r,i,n,a=N0.Ellipsoid.WGS84.cartesianToCartographic(e.center,new Pa.Vector3);return a[2]=a[2]-t.getHeight(a[1],a[0]),e instanceof Lc.OrientedBoundingBox?(i=e.halfSize,r=new Pa.Vector3(i[0],i[1],i[2]).len(),n=e.quaternion):(r=e.radius,i=[r,r,r],n=new Pa.Quaternion().fromMatrix3(new Pa.Matrix3([i[0],0,0,0,i[1],0,0,0,i[2]])).normalize()),{mbs:[a[0],a[1],a[2],r],obb:{center:[a[0],a[1],a[2]],halfSize:i,quaternion:n}}}function Hpe(e,t){let r=Ast(e),i=(0,Lc.makeOrientedBoundingBoxFromPoints)(r),n=(0,Lc.makeBoundingSphereFromPoints)(r),a=N0.Ellipsoid.WGS84.cartesianToCartographic(n.center,new Pa.Vector3),o=N0.Ellipsoid.WGS84.cartesianToCartographic(i.center,new Pa.Vector3);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],n.radius],obb:{center:o,halfSize:i.halfSize,quaternion:i.quaternion}}}function Ast(e){let t=[];for(let r=0;r<e.length;r+=3){let i=new Pa.Vector3([e[r],e[r+1],e[r+2]]);t.push(i)}return t}function Wpe(e){let t;e instanceof Lc.BoundingSphere?t=e:t=e.getBoundingSphere();let r=t.center,i=t.radius,n=N0.Ellipsoid.WGS84.cartesianToCartographic(new Pa.Vector3(r[0]+i,r[1]+i,r[2]+i),new Pa.Vector3),a=N0.Ellipsoid.WGS84.cartesianToCartographic(new Pa.Vector3(r[0]-i,r[1]-i,r[2]-i),new Pa.Vector3);return{xmin:Math.min(a[0],n[0]),xmax:Math.max(a[0],n[0]),ymin:Math.min(a[1],n[1]),ymax:Math.max(a[1],n[1]),zmin:Math.min(a[2],n[2]),zmax:Math.max(a[2],n[2])}}function m6(e){let t=e[3],r=new Pa.Vector3(e[0],e[1],e[2]),i=new Pa.Matrix3([t,0,0,0,t,0,0,0,t]);return new Lc.OrientedBoundingBox(r,i)}var Tp=Fe(fr()),Vpe=Fe(ua());function Kpe(e,t,r){var s,u,l,c,f,h,d,p;let i=((u=(s=e.gltf)==null?void 0:s.scene)==null?void 0:u.nodes)||((f=(c=(l=e.gltf)==null?void 0:l.scenes)==null?void 0:c[0])==null?void 0:f.nodes)||((h=e.gltf)==null?void 0:h.nodes)||[],n=((p=(d=e.gltf)==null?void 0:d.images)==null?void 0:p.map(y=>{var g,b;if((g=y==null?void 0:y.image)==null?void 0:g.compressed)return null;{let E=(b=y==null?void 0:y.image)==null?void 0:b.data,A=new Uint8Array(E.length);return A.set(E),{data:A,compressed:!1,height:y.image.height,width:y.image.width,components:y.image.components,mimeType:y.mimeType}}}))||[];Ype(i);let{cartographicOrigin:a,modelMatrix:o}=Rst(e,t,r);return{nodes:i,images:n,cartographicOrigin:a,cartesianModelMatrix:o}}function kst(e){let t={};for(let r in e)t[r]={value:e[r].value};return t}function Rst(e,t,r){let{rtcCenter:i,gltfUpAxis:n}=e,{center:a}=r,o=new Tp.Matrix4(t);switch(i&&o.translate(i),n){case"Z":break;case"Y":let l=new Tp.Matrix4().rotateX(Math.PI/2);o=o.multiplyRight(l);break;case"X":let c=new Tp.Matrix4().rotateY(-Math.PI/2);o=o.multiplyRight(c);break;default:break}let s=new Tp.Vector3(a),u=Vpe.Ellipsoid.WGS84.cartesianToCartographic(s,new Tp.Vector3);return{modelMatrix:o,cartographicOrigin:u}}function Ype(e){var t;for(let r=0;r<e.length;r++){let i=e[r];i.mesh&&(e[r]=Ye(ne({},i),{mesh:Ye(ne({},i.mesh),{primitives:(t=i.mesh)==null?void 0:t.primitives.map(n=>{var a,o,s;return Ye(ne({},n),{indices:{value:(a=n==null?void 0:n.indices)==null?void 0:a.value},attributes:kst(n.attributes),material:{id:(o=n==null?void 0:n.material)==null?void 0:o.id,uniqueId:(s=n==null?void 0:n.material)==null?void 0:s.uniqueId}})})})})),i.children&&Ype(i.children)}}var Cst="EXT_mesh_features",Ist="EXT_feature_metadata";function Xpe(e,t,r){let i=t==null?void 0:t.extensions;if(!i)return[];for(let[n,a]of Object.entries(i||{}))switch(n){case Ist:return Pst(e,a,r);case Cst:return console.warn("EXT_mesh_features extension is not supported yet"),[];default:return[]}return[]}function Pst(e,t,r){var o,s,u,l,c,f,h;let i=(o=t==null?void 0:t.featureIdAttributes)==null?void 0:o[0];if((s=i==null?void 0:i.featureIds)==null?void 0:s.attribute)return e[i.featureIds.attribute].value;if(((u=i==null?void 0:i.featureIds)==null?void 0:u.hasOwnProperty("constant"))&&((l=i==null?void 0:i.featureIds)==null?void 0:l.hasOwnProperty("divisor"))){let d=((c=e==null?void 0:e.POSITIONS)==null?void 0:c.value.length)/3||0;return Bst(d,i.featureIds.constant,i.featureIds.divisor)}let n=(t==null?void 0:t.featureIdTextures)&&(t==null?void 0:t.featureIdTextures[0]);if(n){let p=`TEXCOORD_${((h=(f=n==null?void 0:n.featureIds)==null?void 0:f.texture)==null?void 0:h.texCoord)||0}`,y=e[p].value;return Ost(n,y,r)}let a=(t==null?void 0:t.featureTextures)&&(t==null?void 0:t.featureTextures[0]);return a?e[a].value:[]}function Bst(e,t=0,r=0){let i=[];if(r>0){let n=t,a=r;for(let o=0;o<e;o++)i.push(n),a-=1,a===0&&(n++,a=r)}else i=Array(e).fill(t,0,e);return i}function Ost(e,t,r){var l,c,f;if(!(r==null?void 0:r.length))return[];let i={r:0,g:1,b:2,a:3},n=(c=(l=e==null?void 0:e.featureIds)==null?void 0:l.texture)==null?void 0:c.index,a=(f=e==null?void 0:e.featureIds)==null?void 0:f.channels;if(!a||n===void 0)return[];let o=r[n],s=[],u=i[a];if(o&&(o==null?void 0:o.width)&&(o==null?void 0:o.height)&&(o==null?void 0:o.components))for(let h=0;h<t.length;h+=2){let d=t[h],p=t[h+1],y=Math.min($pe(d)*o.width|0,o.width-1),b=(Math.min($pe(p)*o.height|0,o.height-1)*o.width+y)*o.components+u,E=new Uint8Array(o.data)[b];s.push(E)}else console.warn(`Can't get batch Ids from ${(o==null?void 0:o.mimeType)||""} compressed texture`);return s}function $pe(e){return(e%1+1)%1}function Jpe(e,t){let r={};for(let i in t){let n=t[i];r[i]=Fst(n,e)}return r}function Fst(e,t){let r=[];for(let i of t){let n=e[i]||null;r.push(n)}return r}function Qpe(e,t){let r=!1;for(let i of Object.values(t))e.length!==i.length&&(r=!0);return r}var h_="string",g6="Int32",v6="double",Z2="OBJECTID";function Zpe(e,t){return e===Z2?Z2:typeof t===h_?h_:typeof t=="number"?Number.isInteger(t)?g6:v6:h_}function eme(e,t,r){let i={key:`f_${e}`,name:t,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(r){case Z2:Dst(i);break;case h_:nme(i);break;case v6:Mst(i);break;case g6:break;default:nme(i)}return i}function tme(e){switch(e){case Z2:return"esriFieldTypeOID";case h_:return"esriFieldTypeString";case g6:return"esriFieldTypeInteger";case v6:return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}function rme(e,t){return{name:e,type:t,alias:e}}function ime(e){let t="{OBJECTID}",r=[],i=[],n=[],a=[];for(let o in e)i.push({fieldName:o,visible:!0,isEditable:!1,label:o});return n.push({fieldInfos:i,type:"fields"}),{title:t,mediaInfos:r,popupElements:n,fieldInfos:i,expressionInfos:a}}function nme(e){e.ordering.unshift("attributeByteCounts"),e.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),e.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},e.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}function Dst(e){e.attributeValues={valueType:"Oid32",valuesPerElement:1}}function Mst(e){e.attributeValues={valueType:"Float64",valuesPerElement:1}}var ek=e=>{let t=new Uint32Array(e);for(let r=0;r<e;r++)t[r]=r;return t};var Lst=1,jst=1,gu=3,d_=2,Nst=4,qst="string",Ust="Int32",Gst="Float64",zst="Oid32",ome=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"],sme="EXT_feature_metadata",ume="EXT_mesh_features",Nh=new Rs.Vector3;async function b6(e,t,r,i,n,a,o,s,u,l,c,f){var b;let h=u,d=await nut((b=e.gltf)==null?void 0:b.materials,l),p=Kpe(e,t,r),y=await Vst(p,d,h);u&&Hst(y,c);let g=[];for(let E of d){let A=E.mergedMaterials[0].originalMaterialId;if(!y.has(A))continue;let k=y.get(A);if(!k)continue;let{material:R,texture:F}=E,C=await i();g.push(await Wst({convertedAttributes:k,material:R,texture:F,tileContent:e,nodeId:C,featuresHashArray:a,propertyTable:n,attributeStorageInfo:o,draco:s,workerSource:f}))}return g.length?g:null}function Hst(e,t){for(let r of e.values()){let i=Hpe(r.positions,t);r.boundingVolumes=i;let n=i.obb.center;for(let a=0;a<r.positions.length;a+=gu){let o=r.positions.subarray(a,a+gu);y6.Ellipsoid.WGS84.cartesianToCartographic(Array.from(o),Nh),Nh[2]=Nh[2]-t.getHeight(Nh[1],Nh[0]),Nh=Nh.subtract(n),r.positions.set(Nh,a)}}}async function Wst({convertedAttributes:e,material:t,texture:r,tileContent:i,nodeId:n,featuresHashArray:a,propertyTable:o,attributeStorageInfo:s,draco:u,workerSource:l}){var O;let c=e.boundingVolumes,f=e.positions.length/gu,{faceRange:h,featureIds:d,positions:p,normals:y,colors:g,uvRegions:b,texCoords:E,featureCount:A}=Gpe(e);i.batchTableJson&&mut(d,e.featureIndices,a,i.batchTableJson);let k=new Uint32Array(2),R=Sut(d);k.set([f,A],0);let F=new Uint8Array(Vu(k.buffer,p.buffer,y.buffer,r?E.buffer:new ArrayBuffer(0),g.buffer,b,R.buffer,h.buffer)),C=u?Tut(f,e,{positions:p,normals:y,texCoords:r?E:new Float32Array(0),colors:g,uvRegions:b,featureIds:d,faceRange:h},l.draco):null,j=[];return s&&o&&(j=but(d,o,s)),{nodeId:n,geometry:F,compressedGeometry:C,texture:r,hasUvRegions:Boolean(b.length),sharedResources:cut(((O=i.gltf)==null?void 0:O.materials)||[],n),meshMaterial:t,vertexCount:f,attributes:j,featureCount:A,boundingVolumes:c}}async function Vst(e,t,r){let{nodes:i,images:n,cartographicOrigin:a,cartesianModelMatrix:o}=e,s=new Map;for(let u of t){let l={positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),uvRegions:new Uint16Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null,mergedMaterials:u.mergedMaterials};for(let c of u.mergedMaterials)s.set(c.originalMaterialId,l)}lme(i,n,a,o,s,r);for(let u of s.keys()){let l=s.get(u);if(!!l){if(l.positions.length===0){s.delete(u);continue}l.featureIndicesGroups&&(l.featureIndices=l.featureIndicesGroups.reduce((c,f)=>c.concat(f)),delete l.featureIndicesGroups)}}return s}function lme(e,t,r,i,n,a,o=new Rs.Matrix4([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){if(e)for(let s of e)Yst(s,t,r,i,n,a,o)}function Kst(e,t){let r=t,{matrix:i,rotation:n,scale:a,translation:o}=e;return i&&(r=t.multiplyRight(i)),o&&(r=r.translate(o)),n&&(r=r.rotateXYZ(n)),a&&(r=r.scale(a)),r}function Yst(e,t,r,i,n,a,o=new Rs.Matrix4([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){let s=Kst(e,o),u=e.mesh;u&&Xst(u,t,r,i,n,a,s),lme(e.children||[],t,r,i,n,a,s)}function Xst(e,t,r,i,n,a=!1,o=new Rs.Matrix4([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){var s;for(let u of e.primitives){let l=null,c;u.material?(l=n.get(u.material.id),c=(s=l==null?void 0:l.mergedMaterials.find(({originalMaterialId:d})=>{var p;return d===((p=u.material)==null?void 0:p.id)}))==null?void 0:s.uvRegion):n.has("default")&&(l=n.get("default")),Ft(l!==null,"Primitive - material mapping failed"),Ft(u.mode===void 0||u.mode===Zt.TRIANGLES||u.mode===Zt.TRIANGLE_STRIP,`Primitive - unsupported mode ${u.mode}`);let f=u.attributes;if(!l)continue;let h=$st(u);l.positions=sa(l.positions,cme({vertices:f.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:i,nodeMatrix:o,indices:h,attributeSpecificTransformation:Jst,useCartesianPositions:a})),l.normals=sa(l.normals,cme({vertices:f.NORMAL&&f.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:i,nodeMatrix:o,indices:h,attributeSpecificTransformation:Qst,useCartesianPositions:!1})),l.texCoords=sa(l.texCoords,Zst(f.TEXCOORD_0&&f.TEXCOORD_0.value,h)),l.colors=sa(l.colors,eut(f.COLOR_0,h)),c&&(l.uvRegions=sa(l.uvRegions,tut(c,h))),l.featureIndicesGroups=l.featureIndicesGroups||[],l.featureIndicesGroups.push(rut(iut(f,u,t),h))}}function $st(e){var r;let t=(r=e.indices)==null?void 0:r.value;if(!t){let i=e.attributes.POSITION.value;return ek(i.length/gu)}if(t&&e.mode===Zt.TRIANGLE_STRIP){let i=t.constructor,n=new i((t.length-2)*3),a=0,o=t.slice(0,3);n.set(o,0);for(let s=1;s+2<t.length;s++)a+=3,o=t.slice(s,s+3),s%2==0?n.set(o,a):n.set(o.reverse(),a);t=n}return t}function cme(e){let{vertices:t,indices:r,attributeSpecificTransformation:i}=e,n=new Float32Array(r.length*gu);if(!t)return n;for(let a=0;a<r.length;a++){let o=r[a]*gu,s=t.subarray(o,o+gu),u=new Rs.Vector3(Array.from(s));u=i(u,e),n[a*gu]=u.x,n[a*gu+1]=u.y,n[a*gu+2]=u.z}return n}function Jst(e,t){let{cartesianModelMatrix:r,cartographicOrigin:i,nodeMatrix:n,useCartesianPositions:a}=t;return n&&(e=e.transform(n)),e=e.transform(r),a||(y6.Ellipsoid.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(i)),e}function Qst(e,t){let{cartesianModelMatrix:r,nodeMatrix:i}=t;return i&&(e=e.transformAsVector(i)),e=e.transformAsVector(r),e}function Zst(e,t){let r=new Float32Array(t.length*d_);if(!e)return r.fill(1),r;for(let i=0;i<t.length;i++){let n=t[i]*d_,a=e.subarray(n,n+d_);r[i*d_]=a[0],r[i*d_+1]=a[1]}return r}function eut(e,t){let r=(e==null?void 0:e.components)||Nst,i=new Uint8Array(t.length*r);if(!e)return i.fill(255),i;let n=e.value;for(let a=0;a<t.length;a++){let o=t[a]*r,s=n.subarray(o,o+r),u=new Uint8Array(r);for(let l=0;l<s.length;l++)u[l]=s[l]*255;i.set(u,a*r)}return i}function tut(e,t){let r=new Uint16Array(t.length*4);for(let i=0;i<r.length;i+=4)r.set(e,i);return r}function rut(e,t){if(!e.length||!t.length)return[];let r=[];for(let i=0;i<t.length;i++){let n=t[i];r.push(e[n])}return r}function iut(e,t,r){let i=Xpe(e,t,r);if(i.length)return i;for(let n=0;n<ome.length;n++){let a=ome[n];if(e[a]&&e[a].value)return e[a].value}return[]}async function nut(e=[],t){let r=[];for(let i of e)r.push(sut(i));return t&&(r=await aut(r)),r}async function aut(e){var r,i;let t=[];for(;e.length>0;){let n=e.splice(0,1)[0],a=[];for(let o=0;o<e.length;o++){let s=e[o];(n.texture&&s.texture||!n.texture&&!s.texture)&&(n=await out(n,s),a.push(o))}if(n.texture&&a.length){let o=(r=n.mergedMaterials)==null?void 0:r.reduce((l,{textureSize:c})=>l+((c==null?void 0:c.width)||0),0),s=(i=n.mergedMaterials)==null?void 0:i.reduce((l,{textureSize:c})=>Math.max(l,(c==null?void 0:c.height)||0),0),u=-1;for(let l of n.mergedMaterials)if(l.textureSize){let c=u+1+l.textureSize.width/o*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1;l.uvRegion=new Uint16Array([u+1,0,c,l.textureSize.height/s*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1]),u=c}n.texture.image.width=o,n.texture.image.height=s}for(let o of a.reverse())e.splice(o,1);t.push(n)}return t.length||t.push({material:lut(),mergedMaterials:[{originalMaterialId:"default"}]}),t}async function out(e,t){var r,i;if(((r=e.texture)==null?void 0:r.bufferView)&&((i=t.texture)==null?void 0:i.bufferView)&&e.mergedMaterials&&t.mergedMaterials){let n=Buffer.from(e.texture.bufferView.data),a=Buffer.from(t.texture.bufferView.data);try{let{joinImages:o}=await import("join-images"),s=await o([n,a],{direction:"horizontal"});e.texture.bufferView.data=await s.toFormat(e.texture.mimeType==="image/png"?"png":"jpeg").toBuffer()}catch(o){throw console.log("Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)"),o}e.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId=1}return e.mergedMaterials=e.mergedMaterials.concat(t.mergedMaterials),e}function sut(e){var n,a,o,s,u;let t={doubleSided:e.doubleSided,emissiveFactor:(n=e.emissiveFactor)==null?void 0:n.map(l=>Math.round(l*255)),alphaMode:uut(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:((a=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:a.roughnessFactor)||Lst,metallicFactor:((o=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:o.metallicFactor)||jst}},r;((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)?(r=e.pbrMetallicRoughness.baseColorTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(r=e.emissiveTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),e.id=Number.isFinite(e.id)?e.id:yc();let i=[{originalMaterialId:e.id}];if(r)i[0].textureSize={width:r.image.width,height:r.image.height};else{let l=(u=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:u.baseColorFactor;t.pbrMetallicRoughness.baseColorFactor=l&&l.map(c=>Math.round(c*255))||void 0}return{material:t,texture:r,mergedMaterials:i}}function uut(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function lut(){return{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}}function cut(e,t){let r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(let i of e){let{materialDefinitionInfo:n,textureDefinitionInfo:a}=fut(i,t);r.materialDefinitionInfos.push(n),a&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(a))}return r}function fut(e,t){var s;let r=((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)||e.emissiveTexture,i=null;r&&(i=dut(r.texture,t));let{baseColorFactor:n,metallicFactor:a}=(e==null?void 0:e.pbrMetallicRoughness)||{},o=n;return(!n||n[3]===0)&&e.emissiveFactor&&(o=e.emissiveFactor,o[3]=o[3]||1),{materialDefinitionInfo:hut(o||[1,1,1,1],a),textureDefinitionInfo:i}}function hut(e,t=1){let r=.04/255,i=new Rs.Vector4(0,0,0,1),n=new Rs.Vector4(1,1,1,1),a=new Rs.Vector4(r,r,r,0),o=new Rs.Vector4(e),s=n.subtract(a).multiply(o),u=s.lerp(s,i,t);a[3]=1;let l=a.lerp(a,o,t);return{params:{diffuse:u.toArray(),specular:l.toArray(),renderMode:"solid"}}}function dut(e,t){var r,i,n,a;return{encoding:((r=e==null?void 0:e.source)==null?void 0:r.mimeType)?[e.source.mimeType]:void 0,images:[{id:put(e,t),size:(i=e.source)==null?void 0:i.image.width,length:((n=e.source)==null?void 0:n.image.data.length)?[(a=e.source)==null?void 0:a.image.data.length]:void 0}]}}function put(e,t){var y;let{width:r,height:i}=((y=e.source)==null?void 0:y.image)||{};if(!r||!i)return"";let n=1,a=0,o=t+1,s=32-o.toString(2).length,u="0".repeat(s).concat(o.toString(2)),l=n<<28,c=a<<24,f=r-1<<12,h=i-1<<0,d=l+c+f+h;return BigInt(`0b${d.toString(2)}${u}`).toString()}function mut(e,t,r,i){let n=gut(e,i,r);fme(t,n),fme(e,n)}function gut(e,t,r){let i={};for(let n=0;n<e.length;n++){let a=e[n],o=yut(n,t,r);i[a.toString()]=o}return i}function vut(e,t){let r="";for(let i in e)r+=e[i][t];return r}function yut(e,t,r){let i=vut(t,e),n=(0,ame.default)(i);return r.includes(n)?r.indexOf(n):r.push(n)-1}function fme(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function but(e,t,r){let i=[],a=Qpe(e,t)?Jpe(e,t):t,o=ne({OBJECTID:e},a);for(let s in o){let u=xut(s,r),l=o[s],c=_ut(u,l);i.push(c)}return i}function _ut(e,t){let r;switch(e){case zst:case Ust:r=wut(t);break;case Gst:r=Eut(t);break;case qst:r=hme(t);break;default:r=hme(t)}return r}function xut(e,t){return t.find(i=>i.name===e).attributeValues.valueType}function wut(e){let t=new Uint32Array([e.length]),r=new Uint32Array(e);return Vu(t.buffer,r.buffer)}function Eut(e){let t=new Uint32Array([e.length]),r=new Uint8Array(4),i=new Float64Array(e);return Vu(t.buffer,r.buffer,i.buffer)}function hme(e){let t=new Uint32Array([e.length]),r=0,i=new Uint32Array(e.length),n=[];for(let o=0;o<e.length;o++){let s=`${String(e[o])}\0`,u=Buffer.from(s),l=u.length;r+=l,i[o]=l,n.push(u)}let a=new Uint32Array([r]);return Vu(t.buffer,a.buffer,i.buffer,...n)}function Sut(e){let t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}async function Tut(e,t,r,i){let{positions:n,normals:a,texCoords:o,colors:s,uvRegions:u,featureIds:l,faceRange:c}=r,f=new Uint32Array(e);for(let g=0;g<f.length;g++)f.set([g],g);let h=new Uint32Array(t.featureIndices.length?t.featureIndices:e),d=Aut(h,c),p={positions:n,normals:a,colors:s,"feature-index":d};o.length&&(p.texCoords=o);let y={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(l)}};return u.length&&(p["uv-region"]=u,y["uv-region"]={"i3s-attribute-type":"uv-region"}),Mm({attributes:p,indices:f},Qy,Ye(ne({},Qy.options),{source:i,reuseWorkers:!0,_nodeWorkers:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:y}}))}function Aut(e,t){let r=new Uint32Array(e.length),i=0,n=0;for(let a=1;a<t.length;a+=2){let o=(t[a]+1)*gu;r.fill(i,n,o),i++,n=o+1}return r}function dme(e){if(!e)return null;let t=e==null?void 0:e.batchTableJson;if(t)return t;let{extensionName:r,extension:i}=kut(e);switch(r){case ume:return console.warn("The I3S converter does not yet support the EXT_mesh_features extension"),null;case sme:return Rut(i);default:return null}}function kut(e){var a,o,s,u;let t=[sme,ume];if(!((a=e==null?void 0:e.gltf)==null?void 0:a.extensionsUsed))return{extensionName:null,extension:null};let i="";for(let l of((o=e==null?void 0:e.gltf)==null?void 0:o.extensionsUsed)||[])if(t.includes(l)){i=l;break}if(!i)return{extensionName:null,extension:null};let n=(u=(s=e==null?void 0:e.gltf)==null?void 0:s.extensions)==null?void 0:u[i];return{extensionName:i,extension:n}}function Rut(e){var t,r;if(e==null?void 0:e.featureTables){let i=(t=Object.keys(e.featureTables))==null?void 0:t[0];if(i){let n=e==null?void 0:e.featureTables[i],a={};for(let o in n.properties)a[o]=n.properties[o].data;return a}}if(e==null?void 0:e.featureTextures){let i=(r=Object.keys(e.featureTextures))==null?void 0:r[0];if(i){let n=e==null?void 0:e.featureTextures[i],a={};for(let o in n.properties)a[o]=n.properties[o].data;return a}}return console.warn("The I3S converter couldn't handle EXT_feature_metadata extension: There is neither featureTables, no featureTextures in the extension."),null}var mme=Fe(uu()),gme=Fe(require("path"));var pme=()=>({serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}});async function vme(e,t,r){let i={serviceItemId:yc().replace(/-/gi,""),layerName:e,layers0:t},n=(0,mme.default)(i,pme()),a=(0,gme.join)(r,"SceneServer");await Un(a,JSON.stringify(n))}var _6=16;function yme(e,t){let r=[],i=e.boundingVolume,n=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:t.mbs[3]*2*_6/n},o={metricType:"maxScreenThresholdSQ",maxError:Math.PI*.25*a.maxError*a.maxError};return i.constructor.name==="OrientedBoundingBox"?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function x6(e){let r=(e.header.lodSelection.maxScreenThreshold||{}).maxError;if(!r){let i=e.header.lodSelection.maxScreenThresholdSQ;i&&(r=Math.sqrt(i.maxError/(Math.PI*.25)))}return r||(r=_6),e.header.mbs[3]*2*_6/r}var Pme=Fe(Ime()),Qut="4.0.0-alpha.16",nk={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:Qut,mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>(0,Pme.parsePGM)(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};var q0=Fe(uu());var Bme={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}};var Zut=()=>({wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}}),elt=()=>({heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}}),tlt=()=>({nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}}),rlt=()=>({xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}}),Ome=()=>({version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>(0,q0.default)(e,Zut())},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>(0,q0.default)(e,Bme)},fullExtent:{path:"fullExtent",transform:e=>(0,q0.default)(e,rlt())},heightModelInfo:{path:"heightModelInfo",transform:e=>(0,q0.default)(e,elt())},nodePages:{path:"nodePages",transform:e=>(0,q0.default)(e,tlt())},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"geometryDefinitions",default:[]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}});var A6=Fe(uu()),ilt=()=>({offset:{default:8},position:{default:{type:"Float32",component:3}},normal:{default:{type:"Float32",component:3}},uv0:{path:"hasTexture",transform:e=>e&&{type:"Float32",component:2}||!1,omitValues:[!1]},color:{default:{type:"UInt8",component:4}},uvRegion:{path:"hasUvRegions",transform:e=>e&&{type:"UInt16",component:4}||!1,omitValues:[!1]},featureId:{default:{binding:"per-feature",type:"UInt64",component:1}},faceRange:{default:{binding:"per-feature",type:"UInt32",component:2}}}),nlt=()=>({"compressedAttributes.encoding":{default:"draco"},"compressedAttributes.attributes":{path:"geometryConfig",transform:e=>{let t=["position","normal"];return e.hasTexture&&t.push("uv0"),t.push("color"),e.hasUvRegions&&t.push("uv-region"),t.push("feature-index"),t}}}),Fme=()=>({geometryBuffers:{path:"geometryConfig",transform:e=>{let t=[(0,A6.default)(e,ilt())];return e.draco&&t.push((0,A6.default)({geometryConfig:e},nlt())),t}}});var p_=Fe(uu()),alt=()=>({renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1]},diffuse:{path:"diffuse",default:[1,1,1]},specular:{path:"specular",default:[0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}}),olt=()=>({name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>(0,p_.default)(r,alt())}}),slt=()=>({id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}),ult=()=>({encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(i=>(0,p_.default)(i,slt()))}}),Dme=()=>({materialDefinitions:{path:"materialDefinitionInfos",transform:llt},textureDefinitions:{path:"textureDefinitionInfos",transform:clt}});function llt(e,t,r){let i={};for(let[n,a]of e.entries())i[`Mat${r.nodePath}${n}`]=(0,p_.default)(a,olt());return i}function clt(e,t,r){if(!e)return null;let i={};for(let[n,a]of e.entries()){let o=`${r.nodePath}${n}`;a.imageIndex=o,i[o]=(0,p_.default)(a,ult())}return i}var ak=Fe(tl()),Mme=Fe(fr()),k6=Fe(ua()),flt=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]);function Lme(e){var r,i;if(!((r=e==null?void 0:e.parentNode)==null?void 0:r.obb)||!((i=e==null?void 0:e.parentNode)==null?void 0:i.mbs))return[];let t=[];return hlt(t,e),dlt(t,e),t}function hlt(e,t){var o;let r=plt(t.parentNode.obb),i=mlt(t);if(glt(r,i))return;let a=`OBB of Tile (${t.id}) doesn't fit into Parent (${(o=t.parentNode)==null?void 0:o.id}) tile OBB`;e.push(a)}function dlt(e,t){var a;let r=jme(t.mbs),i=jme(t.parentNode.mbs);if(r.center.distanceTo(i.center)+r.radius>i.radius){let o=`MBS of Tile (${t.id}) doesn't fit into Parent (${(a=t.parentNode)==null?void 0:a.id}) tile MBS`;e.push(o)}}function jme(e){return new ak.BoundingSphere([e[0],e[1],e[2]],e[3])}function plt(e){let{center:t,halfSize:r,quaternion:i}=e;return new ak.OrientedBoundingBox().fromCenterHalfSizeQuaternion(t,r,i)}function mlt(e){let t=e.obb.halfSize,r=flt,i=k6.Ellipsoid.WGS84.cartographicToCartesian(e.obb.center),n=[];for(let a=0;a<r.length;a+=3){let s=new Mme.Vector3(r[a]*=t[0],r[a+1]*=t[1],r[a+2]*=t[2]).transformByQuaternion(e.obb.quaternion).add(i);n=n.concat(s)}return n}function glt(e,t){let r=!0;for(let i=0;i<t.length/3;i+=3){let n=[t[i],t[i+1],t[i+2]],a=k6.Ellipsoid.WGS84.cartesianToCartographic(n);if(e.distanceTo(a)>0){r=!1;break}}return r}var Mo;(function(s){s.POINTS="POINTS",s.LINES="LINES",s.LINE_LOOP="LINE_LOOP",s.LINE_STRIP="LINE_STRIP",s.TRIANGLES="TRIANGLES",s.TRIANGLE_STRIP="TRIANGLE_STRIP",s.TRIANGLE_FAN="TRIANGLE_FAN"})(Mo||(Mo={}));var R6=class extends Array{enqueue(t){this.push(t)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return this.length===0}};var Nme=Fe(require("process")),vlt=4*1024*1024*1024,m_=class extends R6{constructor(t=2e3,r=400){super();this.writePromise=null;this.fileMap={};this.listeningInterval=t,this.writeConcurrency=r}async enqueue(t,r=!1){if(r){let{archiveKey:i,writePromise:n}=t,a=await n();i&&a&&(this.fileMap[i]=a)}else super.enqueue(t),Nme.default.memoryUsage().rss>vlt&&await this.startWrite()}startListening(){this.intervalId=setInterval(this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){this.writePromise||(this.writePromise=this.doWrite()),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){let t=[],r=[];for(let n=0;n<this.writeConcurrency;n++){let a=this.dequeue();if(!a)break;let{archiveKey:o,writePromise:s}=a;r.push(o);let u=s();t.push(u)}let i=await Promise.allSettled(t);this.updateFileMap(r,i)}}updateFileMap(t,r){for(let i=0;i<t.length;i++){let n=t[i];n&&"value"in r[i]&&(this.fileMap[n]=r[i].value)}}};var U0="Tile converter does not work in browser, only in node js environment";var I6=Fe(require("path")),P6=Fe(uu());var qme=Fe(uu()),Ume=()=>({mbs:{path:"mbs"},obb:{path:"obb"}}),ylt=()=>({href:{path:"href"}}),blt=()=>ne(ne({id:{path:"id"}},ylt()),Ume()),C6=()=>Ye(ne({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"}},Ume()),{lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>(0,qme.default)(e,blt()),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});var El=class{constructor(t,r){this.data=null;this.children=[];this._finalized=!1;this.inPageId=t,this.id=t===0?"root":t.toString(),this.converter=r}get finalized(){return this._finalized}async addData(t){return this.converter.options.instantNodeWriting?await this.write(t):this.data=t,this}async addChildren(t){let r=[];for(let n of t){let a=await n.load();r.push({id:n.id,href:`../${n.id}`,obb:a.obb,mbs:a.mbs})}this.children=this.children.concat(t);let i=this.data;this.converter.options.instantNodeWriting&&(i=await this.load()),i&&(i.children=i.children??[],i.children=i.children.concat(r)),this.converter.options.instantNodeWriting&&i&&await this.write(i)}async addNeighbors(){var r;if(this.finalized)return;let t=await this.load();for(let i of this.children){let n=await i.load();if(n.neighbors=n.neighbors??[],Number((r=t==null?void 0:t.children)==null?void 0:r.length)<1e3)for(let a of t.children||[])i.id!==a.id&&n.neighbors.push(ne({},a));else console.warn(`Node ${i.id}: neighbors attribute is omited because of large number of neigbors`),delete n.neighbors;this.converter.options.instantNodeWriting&&n&&await i.write(n),await i.save()}this.finalize()}async save(){this.data&&await this.write(this.data)}finalize(){this._finalized=!0;for(let t of this.children)t.flush()}async write(t){let r=(0,I6.join)(this.converter.layers0Path,"nodes",this.id);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodes/${this.id}/3dNodeIndexDocument.json.gz`,writePromise:()=>wl(r,JSON.stringify(t),"3dNodeIndexDocument.json",!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>Un(r,JSON.stringify(t))},!0)}async load(){if(this.data)return this.data;let t=this.id,r=(0,I6.join)(this.converter.layers0Path,"nodes",t),i="index.json";return this.converter.options.slpk&&(i="3dNodeIndexDocument.json"),await X2(r,i)}flush(){this.data=null}static async createRootNode(t,r){let i=El.createRootNodeIndexDocument(t);return await new El(0,r).addData(i)}static async createNode(t,r,i,n,a,o){let s=await El.createNodeIndexDocument(t,r,i,n,a);return await new El(n.index,o).addData(s)}static createRootNodeIndexDocument(t){let r=Ye(ne({version:`{${yc().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}]},t),{children:[]});return(0,P6.default)(r,C6())}static async createNodeIndexDocument(t,r,i,n,a){var h,d;let{texture:o,attributes:s}=a,u=n.index,l=await t.load(),c=Ye(ne({version:l.version,id:u.toString(),level:l.level+1},r),{lodSelection:i,parentNode:{id:t.id,href:`../${t.id}`,mbs:l.mbs,obb:l.obb},children:[],neighbors:[]}),f=(0,P6.default)(c,C6());if(n.mesh&&(f.geometryData=[{href:"./geometries/0"}],f.sharedResource={href:"./shared"},o&&(f.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),s&&s.length&&((d=(h=t.converter.layers0)==null?void 0:h.attributeStorageInfo)==null?void 0:d.length))){f.attributeData=[];for(let p=0;p<s.length;p++){let y=t.converter.layers0.attributeStorageInfo[p].key;f.attributeData.push({href:`./attributes/${y}/0`})}}return f}};var B6=async(e,t,r)=>{let i=t.type==="json";if(!e||!t.contentUrl||!i)return;let n=Ye(ne({},r),{[e.loader.id]:{isTileset:i,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}),a=await Wr(t.contentUrl,e.loader,n);a.root&&(t.children=[a.root])},O6=async(e,t,r)=>{let i=t.type==="json";if(!e||!t.contentUrl||i)return null;let n=Ye(ne({},r),{[e.loader.id]:Ye(ne({},r[e.loader.id]||{}),{isTileset:i,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"})});return await Wr(t.contentUrl,e.loader,n)};var D6=Fe(fr());var ok=async(e,t,r,i,n,a=0)=>{if(n&&a>n)return;let o=[],s=await r(e,t);o.push(s);for(let u of e.children)await ok(u,s,r,i,n,a+1);i&&await i(o,t)};var _lt=[Mo.POINTS,Mo.LINES,Mo.LINE_LOOP,Mo.LINE_STRIP,Mo.TRIANGLES,Mo.TRIANGLE_STRIP,Mo.TRIANGLE_FAN],Gme=async e=>{let t={meshTopologyTypes:new Set};if(!(e==null?void 0:e.gltfArrayBuffer))return t;let i=(await wo(e.gltfArrayBuffer,dc,{gltf:{normalize:!1,loadBuffers:!1,loadImages:!1,decompressMeshes:!1}})).json;if(!i)return t;let n=xlt(i);return t.meshTopologyTypes=n,t},xlt=e=>{let t=new Set;for(let r of e.meshes||[])for(let i of r.primitives){let{mode:n}=i;typeof n!="number"&&(n=4),t.add(_lt[n])}return t},zme=(e,t)=>{for(let r of t.meshTopologyTypes)e.meshTopologyTypes.add(r)};var Wme,wlt=((Wme=Ap.default.env)==null?void 0:Wme.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ",Hme=64,Elt="3DTILES",Slt="3DObject",Tlt=1800,Alt="https://",g_=class{constructor(){this.boundingVolumeWarnings=[];this.conversionStartTime=[0,0];this.refreshTokenTime=[0,0];this.sourceTileset=null;this.loadOptions={_nodeWorkers:!0,reuseWorkers:!0,basis:{format:"rgba32",workerUrl:"./modules/textures/dist/basis-worker-node.js"},draco:{workerUrl:"./modules/draco/dist/draco-worker-node.js"},fetch:{}};this.geoidHeightModel=null;this.Loader=gc;this.workerSource={};this.writeQueue=new m_;this.compressList=null;this.preprocessData={meshTopologyTypes:new Set};this.nodePages=new co(Un,Hme,this),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.geometryMap=new Map,this.geometryConfigs=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1,this.compressList=null}async convert(t){if(on)return console.log(U0),U0;this.conversionStartTime=Ap.default.hrtime();let{tilesetName:r,slpk:i,egmFilePath:n,inputUrl:a,validate:o,outputPath:s,draco:u=!0,sevenZipExe:l,maxDepth:c,token:f,generateTextures:h,generateBoundingVolumes:d,instantNodeWriting:p=!1,mergeMaterials:y=!0}=t;this.options={maxDepth:c,slpk:i,sevenZipExe:l,egmFilePath:n,draco:u,token:f,inputUrl:a,instantNodeWriting:p,mergeMaterials:y},this.compressList=this.options.instantNodeWriting&&[]||null,this.validate=Boolean(o),this.Loader=a.indexOf(Alt)!==-1?VS:gc,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(d),this.writeQueue=new m_,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await Wr(n,nk),console.log("Loading egm file completed!"),i&&this.nodePages.useWriteFunction(wl),await this.loadWorkers();try{let g=await this._fetchPreloadOptions(),b=a;g.url&&(b=g.url),g.headers&&(this.loadOptions.fetch={headers:g.headers}),this.sourceTileset=await Wr(b,this.Loader,this.loadOptions),await this.preprocessConversion()&&(await this._createAndSaveTileset(s,r),await this._finishConversion({slpk:Boolean(i),outputPath:s,tilesetName:r}))}catch(g){throw g}finally{await this.writeQueue.finalize(),_n.getWorkerFarm({}).destroy()}return"success"}async preprocessConversion(){console.log("Analyze source tileset");let t=this.sourceTileset.root;await ok(t,null,this.analyzeTile.bind(this),void 0,this.options.maxDepth);let{meshTopologyTypes:r}=this.preprocessData;return console.log("------------------------------------------------"),console.log("Preprocess results:"),console.log(`glTF mesh topology types: ${Array.from(r).join(", ")}`),console.log("------------------------------------------------"),!r.has(Mo.TRIANGLES)&&!r.has(Mo.TRIANGLE_STRIP)?(console.log("The tileset is of unsupported mesh topology types. The conversion will be interrupted."),console.log("------------------------------------------------"),!1):!0}async analyzeTile(t,r){if(t.type==="json")return await B6(this.sourceTileset,t,this.loadOptions),null;t.id&&console.log(`[analyze]: ${t.id}`);let i=null;try{i=await O6(this.sourceTileset,t,Ye(ne({},this.loadOptions),{"3d-tiles":Ye(ne({},this.loadOptions["3d-tiles"]),{loadGLTF:!1})}))}catch{console.log(`[warning]: Failed to load ${t.contentUrl}. An I3S tile with empty content will be added to the output tileset`)}let n=await Gme(i);return zme(this.preprocessData,n),null}async _createAndSaveTileset(t,r){var u,l,c;let i=(0,Ba.join)(`${t}`,`${r}`);try{await l_(i)}catch{}this.layers0Path=(0,Ba.join)(i,"SceneServer","layers","0"),this.materialDefinitions=[],this.materialMap=new Map;let n=this.sourceTileset.root,a=Mf(n.boundingVolume,new D6.Matrix4(n.transform),null);this._formLayers0(r,a,(c=(l=(u=this.sourceTileset)==null?void 0:u.root)==null?void 0:l.boundingVolume)==null?void 0:c.region);let o=p6(a,this.geoidHeightModel);await this.nodePages.push({index:0,lodThreshold:0,obb:o.obb,children:[]});let s=await El.createRootNode(o,this);await ok(n,{transform:new D6.Matrix4(n.transform),parentNodes:[s]},this.convertTile.bind(this),this.finalizeTile.bind(this),this.options.maxDepth),this.layers0.materialDefinitions=this.materialDefinitions,this.layers0.geometryDefinitions=(0,sk.default)(this.geometryConfigs.map(f=>({geometryConfig:Ye(ne({},f),{draco:this.options.draco})})),Fme()),this.layersHasTexture===!1&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(f=>f!=="uv0")),await this._writeLayers0(),vme(r,this.layers0,i);for(let f of this.compressList||[])await Y2(f),await d6(f);await this.nodePages.save(),await this.writeQueue.finalize(),await this._createSlpk(i)}_formLayers0(t,r,i){var s;if(!((s=this.sourceTileset)==null?void 0:s.root))return;let n=Wpe(r);i&&(n.zmin=i[4],n.zmax=i[5]);let a=[n.xmin,n.ymin,n.xmax,n.ymax],o={version:`{${yc().toUpperCase()}}`,id:0,name:t,href:"./layers/0",store:{id:`{${yc().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:Hme},compressGeometry:this.options.draco,fullExtent:n};this.layers0=(0,sk.default)(o,Ome())}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:()=>wl(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:()=>Un(this.layers0Path,JSON.stringify(this.layers0))})}async _createSlpk(t){if(this.options.slpk){let r=(0,Ba.join)(t,"SceneServer","layers","0"),i=`${t}.slpk`;await jpe(r,i,0,".",this.options.sevenZipExe);try{await l_(t)}catch{}}}async convertTile(t,r){if(t.type==="json"||t.type==="empty")return t.type==="json"&&(t.id&&console.log(`[load]: ${t.id}`),await B6(this.sourceTileset,t,this.loadOptions)),r;t.id&&console.log(`[convert]: ${t.id}`);let{parentNodes:i,transform:n}=r,a=n.clone();t.transform&&(a=a.multiplyRight(t.transform));let o=i[0],s=await this._createNode(o,t,a);return await o.addChildren(s),{transform:a,parentNodes:s}}async finalizeTile(t,r){for(let i of t)for(let n of i.parentNodes)await n.addNeighbors();for(let i of r.parentNodes)await i.save()}async _createNode(t,r,i){var d,p;this._checkAddRefinementTypeForTile(r),await this._updateTilesetOptions();let n=null;try{n=await O6(this.sourceTileset,r,this.loadOptions)}catch{console.log(`[warning]: Failed to load ${r.contentUrl}`)}let a=Mf(r.boundingVolume,i,null),o=p6(a,this.geoidHeightModel),s=dme(n);s&&!((p=(d=this.layers0)==null?void 0:d.attributeStorageInfo)==null?void 0:p.length)&&this._convertPropertyTableToNodeAttributes(s);let u=await this._convertResources(r,i,a,n,t.inPageId,s),l=[],c=[],f=[],h={geometry:null,compressedGeometry:null,texture:null,hasUvRegions:!1,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(let y of u||[h]){this.layersHasTexture=this.layersHasTexture||Boolean(y.texture),this.generateBoundingVolumes&&y.boundingVolumes&&(o=y.boundingVolumes);let g=yme(r,o),b=g.find(R=>R.metricType==="maxScreenThresholdSQ")||{maxError:0},E=await this._updateNodeInNodePages(b,o,r,t.inPageId,y),A=await El.createNodeIndexDocument(t,o,g,E,y),k=await new El(E.index,this).addData(A);l.push(k),E.mesh&&await this._writeResources(y,k.id),this.validate&&(this.boundingVolumeWarnings=Lme(A),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),c.push(E.index),f.push(E)}return l}async _convertResources(t,r,i,n,a,o){var l;if(!this.isContentSupported(t)||!n)return null;let s={center:[],halfSize:[],quaternion:[]};return await b6(n,r,i,async()=>(await this.nodePages.push({index:0,obb:s},a)).index,o,this.featuresHashArray,(l=this.layers0)==null?void 0:l.attributeStorageInfo,this.options.draco,this.generateBoundingVolumes,this.options.mergeMaterials,this.geoidHeightModel,this.workerSource)}async _updateNodeInNodePages(t,r,i,n,a){let{meshMaterial:o,texture:s,vertexCount:u,featureCount:l,geometry:c,hasUvRegions:f}=a,h={index:0,lodThreshold:t.maxError,obb:r.obb,children:[]};c&&this.isContentSupported(i)&&(h.mesh={geometry:{definition:this.findOrCreateGeometryDefinition(Boolean(s),f),resource:0},attribute:{resource:0},material:{definition:0}});let d=a.nodeId,p;if(d?p=await this.nodePages.getNodeById(d):p=await this.nodePages.push(h,n),h.mesh||console.log(`[warning]: node ${p.index} is created with empty content`),co.updateAll(p,h),o&&co.updateMaterialByNodeId(p,this._findOrCreateMaterial(o)),s){let y=s.image.height*s.image.width;co.updateTexelCountHintByNodeId(p,y)}return u&&(this.vertexCounter+=u,co.updateVertexCountByNodeId(p,u)),co.updateNodeAttributeByNodeId(p),l&&co.updateFeatureCountByNodeId(p,l),this.nodePages.saveNode(p),p}async _writeResources(t,r){let{geometry:i,compressedGeometry:n,texture:a,sharedResources:o,attributes:s}=t,u=(0,Ba.join)(this.layers0Path,"nodes",r),l=(0,Ba.join)("nodes",r);await this._writeGeometries(i,n,u,l),await this._writeShared(o,u,l,r),await this._writeTexture(a,u,l),await this._writeAttributes(s,u,l)}async _writeGeometries(t,r,i,n){if(this.options.slpk){let a=(0,Ba.join)(i,"geometries");await this.writeQueue.enqueue({archiveKey:`${n}/geometries/0.bin.gz`,writePromise:()=>wl(a,t,"0.bin")})}else{let a=(0,Ba.join)(i,"geometries/0/");await this.writeQueue.enqueue({writePromise:()=>Un(a,t,"index.bin")})}if(this.options.draco)if(this.options.slpk){let a=(0,Ba.join)(i,"geometries");await this.writeQueue.enqueue({archiveKey:`${n}/geometries/1.bin.gz`,writePromise:()=>wl(a,r,"1.bin")})}else{let a=(0,Ba.join)(i,"geometries/1/");await this.writeQueue.enqueue({writePromise:()=>Un(a,r,"index.bin")})}}async _writeShared(t,r,i,n){if(!t)return;t.nodePath=n;let a=(0,sk.default)(t,Dme()),o=JSON.stringify(a);if(this.options.slpk){let s=(0,Ba.join)(r,"shared");await this.writeQueue.enqueue({archiveKey:`${i}/shared/sharedResource.json.gz`,writePromise:()=>wl(s,o,"sharedResource.json")})}else{let s=(0,Ba.join)(r,"shared/");await this.writeQueue.enqueue({writePromise:()=>Un(s,o)})}}async _writeTexture(t,r,i){if(t){let n=this._getFormatByMimeType(t==null?void 0:t.mimeType),a=[],o=t.bufferView.data;switch(n){case"jpg":case"png":{if(a.push({name:"0",format:n}),await this.writeTextureFile(o,"0",n,r,i),this.generateTextures){a.push({name:"1",format:"ktx2"});let s=t.image.data.subarray(),u=new Uint8Array(s),l=Mm(Ye(ne({},t.image),{data:u}),RS,Ye(ne({},RS.options),{source:this.workerSource.ktx2,reuseWorkers:!0,_nodeWorkers:!0}));await this.writeTextureFile(l,"1","ktx2",r,i)}break}case"ktx2":if(a.push({name:"1",format:n}),await this.writeTextureFile(o,"1",n,r,i),this.generateTextures){a.push({name:"0",format:"jpg"});let s=Mm(t.image.data[0],gO);await this.writeTextureFile(s,"0","jpg",r,i)}}this.layers0.textureSetDefinitions.length||(this.layers0.textureSetDefinitions.push({formats:a}),this.layers0.textureSetDefinitions.push({formats:a,atlas:!0}))}}async writeTextureFile(t,r,i,n,a){if(this.options.slpk){let o=(0,Ba.join)(n,"textures"),s=!1;await this.writeQueue.enqueue({archiveKey:`${a}/textures/${r}.${i}`,writePromise:()=>wl(o,t,`${r}.${i}`,s)})}else{let o=(0,Ba.join)(n,`textures/${r}/`);await this.writeQueue.enqueue({writePromise:()=>Un(o,t,`index.${i}`)})}}async _writeAttributes(t=[],r,i){var n,a;if((t==null?void 0:t.length)&&((a=(n=this.layers0)==null?void 0:n.attributeStorageInfo)==null?void 0:a.length))for(let o=0;o<t.length;o++){let s=this.layers0.attributeStorageInfo[o].key,u=new Uint8Array(t[o]);if(this.options.slpk){let l=(0,Ba.join)(r,"attributes",s);await this.writeQueue.enqueue({archiveKey:`${i}/attributes/${s}.bin.gz`,writePromise:()=>wl(l,u,"0.bin")})}else{let l=(0,Ba.join)(r,`attributes/${s}/0`);await this.writeQueue.enqueue({writePromise:()=>Un(l,u,"index.bin")})}}}_getFormatByMimeType(t){switch(t){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(t){let r=(0,F6.default)(JSON.stringify(t));if(this.materialMap.has(r))return this.materialMap.get(r)||0;let i=this.materialDefinitions.push(t)-1;return this.materialMap.set(r,i),i}findOrCreateGeometryDefinition(t,r){let i={hasTexture:t,hasUvRegions:r},n=(0,F6.default)(JSON.stringify(i));if(this.geometryMap.has(n))return this.geometryMap.get(n)||0;let a=this.geometryConfigs.push(i)-1;return this.geometryMap.set(n,a),a}_convertPropertyTableToNodeAttributes(t){let r=0,i=ne({OBJECTID:[0]},t);for(let n in i){let a=i[n][0],o=Zpe(n,a),s=eme(r,n,o),u=tme(o),l=rme(n,u),c=ime(i);this.layers0.attributeStorageInfo.push(s),this.layers0.fields.push(l),this.layers0.popupInfo=c,this.layers0.layerType=Slt,r+=1}}async _finishConversion(t){let{tilesCount:r,tilesWithAddRefineCount:i}=this.refinementCounter,n=i?i/r*100:0,a=await Q2(t),o=Ap.default.hrtime(this.conversionStartTime),s=J2(o);console.log("------------------------------------------------"),console.log(`Finishing conversion of ${Elt}`),console.log(`Total conversion time: ${s}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",a," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',n,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};let t={"cesium-ion":{accessToken:this.options.token||wlt}},r=await this.Loader.preload(this.options.inputUrl,t);return this.refreshTokenTime=Ap.default.hrtime(),ne(ne({},t),r)}async _updateTilesetOptions(){if(Ap.default.hrtime(this.refreshTokenTime)[0]<Tlt)return;this.refreshTokenTime=Ap.default.hrtime();let r=await this._fetchPreloadOptions();r.headers&&(this.loadOptions.fetch=Ye(ne({},this.loadOptions.fetch),{headers:r.headers}),console.log("Authorization Bearer token has been updated"))}_checkAddRefinementTypeForTile(t){let r=1;t.refine===r&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(t){return["b3dm","glTF","scenegraph"].includes(t.type||"")}async loadWorkers(){if(console.log("Loading workers source..."),this.options.draco){let t=Ef(Qy,ne({},Ku())),i=await(await Ua(t)).text();this.workerSource.draco=i}if(this.generateTextures){let t=Ef(RS,ne({},Ku())),i=await(await Ua(t)).text();this.workerSource.ktx2=i}console.log("Loading workers source completed!")}};var wge=Fe(require("path")),q6=Fe(require("process")),Ege=Fe(uu());var G0=Fe(Vme());function M6(e){switch(e){case"UInt8":return Uint8Array;case"UInt16":return Uint16Array;case"UInt32":return Uint32Array;case"Float32":return Float32Array;case"UInt64":return Float64Array;default:throw new Error(`parse i3s tile content: unknown type of data: ${e}`)}}var Kme={UInt8:G0.default.UNSIGNED_BYTE,UInt16:G0.default.UNSIGNED_SHORT,Float32:G0.default.FLOAT,UInt32:G0.default.UNSIGNED_INT,UInt64:G0.default.DOUBLE};function z0(e){switch(e){case"UInt8":return 1;case"UInt16":case"Int16":return 2;case"UInt32":case"Int32":case"Float32":return 4;case"UInt64":case"Int64":case"Float64":return 8;default:throw new Error(`parse i3s tile content: unknown size of data: ${e}`)}}var Yme="String",Xme="Oid32",$me="Float64",Jme="Int16",vu;(function(a){a[a.DEFAULT=-1]="DEFAULT",a[a.LNGLAT=1]="LNGLAT",a[a.METER_OFFSETS=2]="METER_OFFSETS",a[a.LNGLAT_OFFSETS=3]="LNGLAT_OFFSETS",a[a.CARTESIAN=0]="CARTESIAN"})(vu||(vu={}));var Gh=Fe(fr()),lk=Fe(ua());var v_;(function(r){r.vertexCount="vertexCount",r.featureCount="featureCount"})(v_||(v_={}));function Uh(e,t=null){return t?`${e}?token=${t}`:e}function Qme(e,t){let{attributeData:r=[]}=t,i=[];for(let n=0;n<r.length;n++){let a=r[n].href.replace("./","");i.push(`${e}/${a}`)}return i}function Zme(e,t){let r=[],{attributeStorageInfo:i,url:n}=e;for(let a=0;a<i.length;a++){let o=i[a].key;r.push(`${n}/nodes/${t}/attributes/${o}/0`)}return r}function ege(e,t){let{attributeName:r,attributeType:i}=t;return r?{[r]:i?Rlt(i,e):null}:{}}function Rlt(e,t){switch(e){case Yme:return Plt(t);case Xme:return tge(t);case $me:return Ilt(t);case Jme:return Clt(t);default:return tge(t)}}function tge(e){let t=4;return new Uint32Array(e,t)}function Clt(e){let t=4;return new Int16Array(e,t)}function Ilt(e){let t=8;return new Float64Array(e,t)}function Plt(e){let t=0,r=8,i=4,n=[];try{let a=new DataView(e,t,i).getUint32(t,!0),o=new Uint32Array(e,r,a),s=r+a*i;for(let u of o){let l=new TextDecoder("utf-8"),c=new Uint8Array(e,s,u);n.push(l.decode(c)),s+=u}}catch(a){console.error("Parse string attribute error: ",a.message)}return n}var Blt="4.0.0-alpha.16";var y_={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:Blt,mimeTypes:["application/binary"],parse:async(e,t)=>ege(e,t),extensions:["bin"],options:{},binary:!0};function rge(e){return e.hasOwnProperty("objectIds")?"Oid32":e.hasOwnProperty("attributeValues")?e.attributeValues.valueType:""}async function ige(e,t,r,i,n){var c;if(!((c=n==null?void 0:n.i3s)==null?void 0:c.colorsByAttribute))return e;let a=i.fields.find(({name:f})=>{var h,d;return f===((d=(h=n==null?void 0:n.i3s)==null?void 0:h.colorsByAttribute)==null?void 0:d.attributeName)});if(!a||!["esriFieldTypeDouble","esriFieldTypeInteger","esriFieldTypeSmallInteger"].includes(a.type))return e;let o=await nge(a.name,r,i,n);if(!o)return e;let s=i.fields.find(({type:f})=>f==="esriFieldTypeOID");if(!s)return e;let u=await nge(s.name,r,i,n);if(!u)return e;let l={};for(let f=0;f<u[s.name].length;f++)l[u[s.name][f]]=Olt(o[a.name][f],n);for(let f=0;f<t.value.length;f++){let h=l[t.value[f]];!h||(n.i3s.colorsByAttribute.mode==="multiply"?h.forEach((d,p)=>{e.value[f*4+p]=e.value[f*4+p]*d/255}):e.value.set(h,f*4))}return e}function Olt(e,t){var u;if(!((u=t==null?void 0:t.i3s)==null?void 0:u.colorsByAttribute))return[255,255,255,255];let{minValue:r,maxValue:i,minColor:n,maxColor:a}=t.i3s.colorsByAttribute,o=(e-r)/(i-r),s=[255,255,255,255];for(let l=0;l<n.length;l++)s[l]=Math.round((a[l]-n[l])*o+n[l]);return s}async function nge(e,{attributeUrls:t},{attributeStorageInfo:r},i){var u;let n=r.findIndex(({name:l})=>e===l);if(n===-1)return null;let a=Uh(t[n],(u=i==null?void 0:i.i3s)==null?void 0:u.token),o=rge(r[n]);return await Wr(a,y_,{attributeName:e,attributeType:o})}var ck=new Gh.Vector3([0,0,0]);function Flt(e){switch(e){case"ktx-etc2":case"dds":return kS;case"ktx2":return Rd;case"jpg":case"png":default:return dg}}var Dlt="i3s-attribute-type";async function age(e,t,r,i,n){var o;let a={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new Gh.Matrix4,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){let s=Uh(t.textureUrl,(o=i==null?void 0:i.i3s)==null?void 0:o.token),u=Flt(t.textureFormat),c=await(await fetch(s,i==null?void 0:i.fetch)).arrayBuffer();if(i==null?void 0:i.i3s.decodeTextures){if(u===dg){let f=Ye(ne({},t.textureLoaderOptions),{image:{type:"data"}});try{a.texture=await n.parse(c,f)}catch{a.texture=await wo(c,u,f)}}else if(u===kS||u===Rd){let f=await Wr(c,u,t.textureLoaderOptions);u===Rd&&(f=f[0]),a.texture={compressed:!0,mipmaps:!1,width:f[0].width,height:f[0].height,data:f}}}else a.texture=c}return a.material=Hlt(t.materialDefinition,a.texture),a.material&&(a.texture=null),await Mlt(e,a,t,r,i)}async function Mlt(e,t,r,i,n){var f,h;let a=e.byteLength,o,s,u=0,l=0,c;if(r.isDracoGeometry){let d=await wo(e,og,{draco:{attributeNameEntry:Dlt}});s=d.header.vertexCount,c=(f=d.indices)==null?void 0:f.value;let{POSITION:p,NORMAL:y,COLOR_0:g,TEXCOORD_0:b,["feature-index"]:E,["uv-region"]:A}=d.attributes;o={position:p,normal:y,color:g,uv0:b,uvRegion:A,id:E},Llt(o,d);let k=Ylt(E);k&&Klt(o,k)}else{let{vertexAttributes:d,ordering:p,featureAttributes:y,featureAttributeOrder:g}=i.store.defaultGeometrySchema,b=Nlt(e,i);u=b.byteOffset,s=b.vertexCount,l=b.featureCount;let{attributes:E,byteOffset:A}=sge(e,u,d,s,p),{attributes:k}=sge(e,A,y,l,g);Vlt(k),o=jlt(E,k)}if(!((h=n==null?void 0:n.i3s)==null?void 0:h.coordinateSystem)||n.i3s.coordinateSystem===vu.METER_OFFSETS){let d=Ult(o.position,r);t.modelMatrix=d.invert(),t.coordinateSystem=vu.METER_OFFSETS}else t.modelMatrix=zlt(o.position),t.coordinateSystem=vu.LNGLAT_OFFSETS;o.color=await ige(o.color,o.id,r,i,n),t.attributes={positions:o.position,normals:o.normal,colors:oge(o.color),texCoords:o.uv0,uvRegions:oge(o.uvRegion||o.region)},t.indices=c||null,o.id&&o.id.value&&(t.featureIds=o.id.value);for(let d in t.attributes)t.attributes[d]||delete t.attributes[d];return t.vertexCount=s,t.byteLength=a,t}function Llt(e,t){for(let r in t.loaderData.attributes){let i=t.loaderData.attributes[r];switch(i.name){case"POSITION":e.position.metadata=i.metadata;break;case"feature-index":e.id.metadata=i.metadata;break;default:break}}}function jlt(e,t){return ne(ne({},e),t)}function oge(e){return e&&(e.normalized=!0,e)}function Nlt(e,t){let r=0,i=0,n=0;for(let{property:a,type:o}of t.store.defaultGeometrySchema.header){let s=M6(o);switch(a){case v_.vertexCount:i=new s(e,0,4)[0],r+=z0(o);break;case v_.featureCount:n=new s(e,4,4)[0],r+=z0(o);break;default:break}}return{vertexCount:i,featureCount:n,byteOffset:r}}function sge(e,t,r,i,n){let a={};for(let o of n)if(r[o]){let{valueType:s,valuesPerElement:u}=r[o];if(t+i*u*z0(s)<=e.byteLength){let l=e.slice(t),c;if(s==="UInt64")c=qlt(l,i*u,z0(s));else{let f=M6(s);c=new f(l,0,i*u)}switch(a[o]={value:c,type:Kme[s],size:u},o){case"color":a.color.normalized=!0;break;case"position":case"region":case"normal":default:}t=t+i*u*z0(s)}else if(o!=="uv0")break}return{attributes:a,byteOffset:t}}function qlt(e,t,r){let i=[],n=new DataView(e),a=0;for(let o=0;o<t;o++){let s=n.getUint32(a,!0),u=n.getUint32(a+4,!0),l=s+2**32*u;i.push(l),a+=r}return new Uint32Array(i)}function Ult(e,t){let r=t.mbs,i=e.value,n=e.metadata,a=new Gh.Matrix4,o=new Gh.Vector3(r[0],r[1],r[2]),s=new Gh.Vector3;return lk.Ellipsoid.WGS84.cartographicToCartesian(o,s),lk.Ellipsoid.WGS84.eastNorthUpToFixedFrame(s,a),e.value=Glt(i,n,o),a}function Glt(e,t={},r){let i=new Float64Array(e.length),n=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let o=0;o<i.length;o+=3)i[o]=e[o]*n+r.x,i[o+1]=e[o+1]*a+r.y,i[o+2]=e[o+2]+r.z;for(let o=0;o<i.length;o+=3)lk.Ellipsoid.WGS84.cartographicToCartesian(i.subarray(o,o+3),ck),i[o]=ck.x,i[o+1]=ck.y,i[o+2]=ck.z;return i}function zlt(e){var a,o;let t=e.metadata,r=((a=t==null?void 0:t["i3s-scale_x"])==null?void 0:a.double)||1,i=((o=t==null?void 0:t["i3s-scale_y"])==null?void 0:o.double)||1,n=new Gh.Matrix4;return n[0]=r,n[5]=i,n}function Hlt(e,t){let r;return e?r=Ye(ne({},e),{pbrMetallicRoughness:e.pbrMetallicRoughness?ne({},e.pbrMetallicRoughness):{baseColorFactor:[255,255,255,255]}}):(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase()),r.emissiveFactor&&(r.emissiveFactor=uge(r.emissiveFactor)),r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=uge(r.pbrMetallicRoughness.baseColorFactor)),t&&Wlt(r,t),r}function uge(e){let t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}function Wlt(e,t){let r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture=Ye(ne({},e.pbrMetallicRoughness.baseColorTexture),{texture:r}):e.emissiveTexture?e.emissiveTexture=Ye(ne({},e.emissiveTexture),{texture:r}):e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture=Ye(ne({},e.pbrMetallicRoughness.metallicRoughnessTexture),{texture:r}):e.normalTexture?e.normalTexture=Ye(ne({},e.normalTexture),{texture:r}):e.occlusionTexture&&(e.occlusionTexture=Ye(ne({},e.occlusionTexture),{texture:r}))}function Vlt(e){let{id:t,faceRange:r}=e;if(!t||!r)return;let i=t.value,n=r.value,a=n[n.length-1]+1,o=new Uint32Array(a*3),s=0,u=0;for(let l=1;l<n.length;l+=2){let c=Number(i[s]),f=n[l],h=n[l-1],d=f-h+1,p=u+d*3;o.fill(c,u,p),s++,u=p}e.id.value=o}function Klt(e,t){let r=e.id.value,i=new Float32Array(r.length);for(let n=0;n<r.length;n++)i[n]=t[r[n]];e.id.value=i}function Ylt(e){var t,r;return(r=(t=e==null?void 0:e.metadata)==null?void 0:t["i3s-feature-ids"])==null?void 0:r.intArray}var Xlt="4.0.0-alpha.16",lge={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:Xlt,mimeTypes:["application/octet-stream"],parse:$lt,extensions:["bin"],options:{"i3s-content":{}}};async function $lt(e,t,r){let{tile:i,_tileOptions:n,tileset:a,_tilesetOptions:o}=(t==null?void 0:t.i3s)||{},s=n||i,u=o||a;return!s||!u?null:await age(e,s,u,t,r)}var fge=Fe(tl()),j6=Fe(ua());var Jlt="4.0.0-alpha.16";async function Qlt(e,t){return JSON.parse(new TextDecoder().decode(e))}var cge={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:Jlt,mimeTypes:["application/json"],parse:Qlt,extensions:["json"],options:{}};var fk=class{constructor(t,r){this.nodePages=[];this.pendingNodePages=[];this.textureDefinitionsSelectedFormats=[];this.textureLoaderOptions={};var i,n;this.tileset=ne({},t),this.nodesPerPage=((i=t.nodePages)==null?void 0:i.nodesPerPage)||64,this.lodSelectionMetricType=(n=t.nodePages)==null?void 0:n.lodSelectionMetricType,this.options=r,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){var n;let r=Math.floor(t/this.nodesPerPage);if(!this.nodePages[r]&&!this.pendingNodePages[r]){let a=Uh(`${this.tileset.url}/nodepages/${r}`,(n=this.options.i3s)==null?void 0:n.token);this.pendingNodePages[r]={status:"Pending",promise:Wr(a,cge,this.options)},this.nodePages[r]=await this.pendingNodePages[r].promise,this.nodesInNodePages+=this.nodePages[r].nodes.length,this.pendingNodePages[r].status="Done"}this.pendingNodePages[r].status==="Pending"&&(this.nodePages[r]=await this.pendingNodePages[r].promise);let i=t%this.nodesPerPage;return this.nodePages[r].nodes[i]}async formTileFromNodePages(t){let r=await this.getNodeById(t),i=[],n=[];for(let d of r.children||[])n.push(this.getNodeById(d));let a=await Promise.all(n);for(let d of a)i.push({id:d.index.toString(),obb:d.obb});let o,s,u,l="jpg",c=[],f=!1;if(r&&r.mesh){let{url:d,isDracoGeometry:p}=r.mesh.geometry&&this.getContentUrl(r.mesh.geometry)||{isDracoGeometry:!1};o=d,f=p;let{textureData:y,materialDefinition:g}=this.getInformationFromMaterial(r.mesh.material);u=g,l=y.format||l,y.name&&(s=`${this.tileset.url}/nodes/${r.mesh.material.resource}/textures/${y.name}`),this.tileset.attributeStorageInfo&&(c=Zme(this.tileset,r.mesh.attribute.resource))}let h=this.getLodSelection(r);return L6({id:t.toString(),lodSelection:h,obb:r.obb,contentUrl:o,textureUrl:s,attributeUrls:c,materialDefinition:u,textureFormat:l,textureLoaderOptions:this.textureLoaderOptions,children:i,isDracoGeometry:f})}getContentUrl(t){let r=null,i=this.tileset.geometryDefinitions[t.definition],n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=i.geometryBuffers.findIndex(a=>a.compressedAttributes&&a.compressedAttributes.encoding==="draco")),n===-1&&(n=i.geometryBuffers.findIndex(a=>!a.compressedAttributes)),n!==-1){let a=Boolean(i.geometryBuffers[n].compressedAttributes);r={url:`${this.tileset.url}/nodes/${t.resource}/geometries/${n}`,isDracoGeometry:a}}return r}getLodSelection(t){let r=[];return this.lodSelectionMetricType==="maxScreenThresholdSQ"&&r.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(t.lodThreshold/(Math.PI*.25))}),r.push({metricType:this.lodSelectionMetricType,maxError:t.lodThreshold}),r}getInformationFromMaterial(t){var i,n,a;let r={textureData:{name:null}};if(t){let o=(i=this.tileset.materialDefinitions)==null?void 0:i[t.definition];if(o){r.materialDefinition=o;let s=(a=(n=o==null?void 0:o.pbrMetallicRoughness)==null?void 0:n.baseColorTexture)==null?void 0:a.textureSetDefinitionId;typeof s=="number"&&(r.textureData=this.textureDefinitionsSelectedFormats[s]||r.textureData)}}return r}initSelectedFormatsForTextureDefinitions(t){this.textureDefinitionsSelectedFormats=[];let r=this.getSupportedTextureFormats(),i=t.textureSetDefinitions||[];for(let n of i){let a=n&&n.formats||[],o=null;for(let s of r){let u=a.find(l=>l.format===s);if(u){o=u;break}}o&&o.format==="ktx2"&&(this.textureLoaderOptions.basis={format:gg(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(o)}}getSupportedTextureFormats(){let t=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){let r=rb();r.has("etc2")&&t.push("ktx-etc2"),r.has("dxt")&&t.push("dds"),t.push("ktx2")}return t.push("jpg"),t.push("png"),t}};function hge(e,t){let r=t.url||"",i;e.geometryData&&(i=`${r}/${e.geometryData[0].href}`);let n;e.textureData&&(n=`${r}/${e.textureData[0].href}`);let a;return e.attributeData&&(a=Qme(r,e)),L6(Ye(ne({},e),{url:r,contentUrl:i,textureUrl:n,attributeUrls:a,isDracoGeometry:!1}))}function L6(e){var u,l;let t={},r=[0,0,0,1];if(e.mbs)r=e.mbs,t.sphere=[...j6.Ellipsoid.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){t.box=[...j6.Ellipsoid.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];let f=new fge.OrientedBoundingBox().fromCenterHalfSizeQuaternion(t.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();t.sphere=[...f.center,f.radius],r=[...e.obb.center,f.radius]}let i=(u=e.lodSelection)==null?void 0:u[0].metricType,n=(l=e.lodSelection)==null?void 0:l[0].maxError,a=e.transform,o=il.MESH,s=ea.REPLACE;return Ye(ne({},e),{mbs:r,boundingVolume:t,lodMetricType:i,lodMetricValue:n,transformMatrix:a,type:o,refine:s})}async function dge(e,t,r){var i;if(e.url=r.url,e.nodePages)e.nodePagesTile=new fk(e,t),e.root=e.nodePagesTile.formTileFromNodePages(0);else{let n=Uh(`${e.url}/nodes/root`,(i=t.i3s)==null?void 0:i.token);e.root=await Wr(n,e.loader,Ye(ne({},t),{i3s:Ye(ne({},t.i3s),{loadContent:!1,isTileHeader:!0,isTileset:!1})}))}e.basePath=e.url,e.type=En.I3S,e.lodMetricType=e.root.lodMetricType,e.lodMetricValue=e.root.lodMetricValue}var Zlt="4.0.0-alpha.16",ect=/layers\/[0-9]+$/,tct=/nodes\/([0-9-]+|root)$/,rct="504b0304",ict="PointCloud",hk={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:Zlt,mimeTypes:["application/octet-stream"],parse:nct,extensions:["bin"],options:{i3s:{token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,_tileOptions:null,_tilesetOptions:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:vu.METER_OFFSETS,colorsByAttribute:null}}};async function nct(e,t={},r){let i=r.url;if(t.i3s=t.i3s||{},uct(e)===rct)throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let a;t.i3s.isTileset==="auto"?a=ect.test(i):a=t.i3s.isTileset;let o;return t.isTileHeader==="auto"?o=tct.test(i):o=t.i3s.isTileHeader,a?e=await oct(e,t,r):o?e=await sct(e,r):e=await act(e,t),e}async function act(e,t){return await wo(e,lge,t)}async function oct(e,t,r){let i=JSON.parse(new TextDecoder().decode(e));if((i==null?void 0:i.layerType)===ict)throw new Error("Point Cloud layers currently are not supported by I3SLoader");return i.loader=hk,await dge(i,t,r),i}async function sct(e,t){return e=JSON.parse(new TextDecoder().decode(e)),hge(e,t)}function uct(e){return e instanceof ArrayBuffer?[...new Uint8Array(e,0,4)].map(t=>t.toString(16).padStart(2,"0")).join(""):null}var pge=Fe(fr()),mge=Fe(ua()),gge=Fe(tl());function N6(e,t){let r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],i=mge.Ellipsoid.WGS84.cartographicToCartesian(r,new pge.Vector3),n=new gge.OrientedBoundingBox().fromCenterHalfSizeQuaternion(i,e.halfSize,e.quaternion);return[...n.center,...n.halfAxes.toArray()]}var dk=Fe(uu()),lct=()=>({version:{path:"version",default:"1.0"}}),vge=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(t=>(0,dk.default)(t,vge()))}}),yge=()=>({asset:{path:"asset",transform:e=>(0,dk.default)(e,lct())},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>(0,dk.default)(e,vge())}});var kp=Fe(fr()),_ge=Fe(ua());function bge(e,t){let r=new Float32Array(e.length),i=fct(t);for(let n=0;n<e.length;n+=2){let a=e.subarray(n,n+2),o=i.slice(n*2,n*2+4),s=cct([a[0],a[1]]),u=[o[2]-o[0],o[3]-o[1]],l=[s[0]*u[0],s[1]*u[1]],c=[l[0]+o[0],l[1]+o[1]];r[n]=c[0],r[n+1]=c[1]}return r}function cct(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function fct(e){let t=65535,r=[];for(let i=0;i<e.length;i++)r[i]=e[i]/t;return r}var hct=new kp.Matrix4([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),xge=new kp.Vector3,pk=class{async convert(t,r=null){let i=await this.buildGltf(t,r);return Vw({gltfEncoded:new Uint8Array(i),type:"b3dm",featuresLength:this._getFeaturesLength(r),batchTable:r},g8)}async buildGltf(t,r){let{tileContent:i,textureFormat:n}=t,{material:a,attributes:o,indices:s,cartesianOrigin:u,cartographicOrigin:l,modelMatrix:c}=i,f=new ci,h=await this._addI3sTextureToGltf(i,n,f),d=this._convertI3sMaterialToGltfMaterial(a,h),p=f.addMaterial(d),y=o.positions,g=y.value;o.uvRegions&&o.texCoords&&(o.texCoords.value=bge(o.texCoords.value,o.uvRegions.value)),o.positions.value=this._normalizePositions(g,u,l,c),this._createBatchIds(i,r),o.normals&&!this._checkNormals(o.normals.value)&&delete o.normals;let b=s||ek(g.length/y.size),E=f.addMesh({attributes:o,indices:b,material:p,mode:4}),A=this._generateTransformMatrix(u),k=f.addNode({meshIndex:E,matrix:A}),R=f.addScene({nodeIndices:[k]});return f.setDefaultScene(R),f.createBinaryChunk(),Vw(f.gltf,VO)}async _addI3sTextureToGltf(t,r,i){let{texture:n,material:a,attributes:o}=t,s=null,u=n;if(!n&&a&&(u=a.pbrMetallicRoughness&&a.pbrMetallicRoughness.baseColorTexture&&a.pbrMetallicRoughness.baseColorTexture.texture.source.image),u){let l=this._deduceMimeTypeFromFormat(r),c=i.addImage(u,l);s=i.addTexture({imageIndex:c}),delete o.colors}return s}_normalizePositions(t,r,i,n){let a=new Float32Array(t.length);for(let o=0;o<t.length;o+=3){let s=t.subarray(o,o+3),u=new kp.Vector3(r),l=new kp.Vector3(Array.from(s)).transform(n).add(i);_ge.Ellipsoid.WGS84.cartographicToCartesian(l,xge),l=xge.subtract(u),a.set(l,o)}return a}_generateTransformMatrix(t){return new kp.Matrix4().translate(t).multiplyLeft(hct)}_createBatchIds(t,r){let{featureIds:i}=t,{OBJECTID:n}=r||{};if(!(!i||!n)){for(let a=0;a<i.length;a++){let o=i[a],s=n.indexOf(o);i[a]=s}t.attributes._BATCHID={size:1,byteOffset:0,value:i}}}_deduceMimeTypeFromFormat(t){switch(t){case"jpg":return"image/jpeg";case"png":return"image/png";case"ktx2":return"image/ktx2";default:return console.warn(`Unexpected texture format in I3S: ${t}`),"image/jpeg"}}_convertI3sMaterialToGltfMaterial(t,r){let i=r!==null;return t?(r!==null&&(t=this._setGltfTexture(t,r)),t):(t={alphaMode:"OPAQUE",doubleSided:!1,pbrMetallicRoughness:{metallicFactor:0,roughnessFactor:1}},i?t.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,1],t)}_setGltfTexture(t,r){let i=Ye(ne({},t),{pbrMetallicRoughness:ne({},t.pbrMetallicRoughness)});return t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture?i.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.emissiveTexture?i.emissiveTexture={index:r,texCoord:0}:t.pbrMetallicRoughness&&t.pbrMetallicRoughness.metallicRoughnessTexture?i.pbrMetallicRoughness.metallicRoughnessTexture={index:r,texCoord:0}:t.normalTexture?i.normalTexture={index:r,texCoord:0}:t.occlusionTexture&&(i.occlusionTexture={index:r,texCoord:0}),i}_getFeaturesLength(t){if(!t)return 0;let r=Object.keys(t)[0];return r?t[r].length:0}_checkNormals(t){return t.find(r=>r)}};var dct="I3S",b_=class{constructor(){this.workerSource={};this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={}}async convert(t){if(on)return console.log(U0),U0;let{inputUrl:r,outputPath:i,tilesetName:n,maxDepth:a,egmFilePath:o}=t;this.conversionStartTime=q6.default.hrtime(),this.options={maxDepth:a},console.log("Loading egm file..."),this.geoidHeightModel=await Wr(o,nk),console.log("Loading egm file completed!");let s=await Wr(r,hk,{});this.sourceTileset=new dS(s,{loadOptions:{_nodeWorkers:!0,reuseWorkers:!0,i3s:{coordinateSystem:vu.LNGLAT_OFFSETS,decodeTextures:!1},"i3s-content":{workerUrl:"./modules/i3s/dist/i3s-content-worker-node.js"}}}),await this.sourceTileset.tilesetInitializationPromise;let u=this.sourceTileset.root;u.header.obb||(u.header.obb=m6(u.header.mbs)),this.tilesetPath=(0,wge.join)(`${i}`,`${n}`),this.attributeStorageInfo=s.attributeStorageInfo;try{await l_(this.tilesetPath)}catch{}let l={boundingVolume:{box:N6(u.header.obb,this.geoidHeightModel)},geometricError:x6(u),children:[]};await this._addChildren(u,l,1);let c=(0,Ege.default)({root:l},yge());await Un(this.tilesetPath,JSON.stringify(c),"tileset.json"),this._finishConversion({slpk:!1,outputPath:i,tilesetName:n}),_n.getWorkerFarm({}).destroy()}async convertChildNode(t,r,i,n){var o;let a=await this._loadChildNode(t,n);if(t.children.push(a),a.contentUrl){await this.sourceTileset._loadTile(a),this.vertexCounter+=a.content.vertexCount;let s=null;this.attributeStorageInfo&&(s=await this._loadChildAttributes(a,this.attributeStorageInfo)),a.header.obb||(a.header.obb=m6(a.header.mbs));let u={box:N6(a.header.obb,this.geoidHeightModel)},l={boundingVolume:u,geometricError:x6(a),children:[]},c={tileContent:a.content,textureFormat:(o=a==null?void 0:a.header)==null?void 0:o.textureFormat},h=await new pk().convert(c,s);l.content={uri:`${a.id}.b3dm`,boundingVolume:u},await Un(this.tilesetPath,new Uint8Array(h),`${a.id}.b3dm`),r.children.push(l),a.unloadContent(),await this._addChildren(a,l,i+1)}else await this._addChildren(a,r,i+1)}async _addChildren(t,r,i){if(this.options.maxDepth&&i>this.options.maxDepth)return;let n=[];for(let a of t.header.children||[])n.push(this.convertChildNode(t,r,i,a));await Promise.all(n)}async _loadChildNode(t,r){let i;if(this.sourceTileset.tileset.nodePages)console.log(`Node conversion: ${r.id}`),i=await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(r.id);else{let{loader:n}=this.sourceTileset,a=this._relativeUrlToFullUrl(t.url,r.href),o={i3s:Ye(ne({},this.sourceTileset.loadOptions),{isTileHeader:!0,loadContent:!1})};console.log(`Node conversion: ${a}`),i=await Wr(a,n,o)}return new fc(this.sourceTileset,i,t)}_relativeUrlToFullUrl(t,r){let i=t.split("/"),n=r.split("/");for(let a of n)switch(a){case".":continue;case"..":i=i.slice(0,-1);break;default:i.push(a)}return i.join("/")}async _loadChildAttributes(t,r){let i=[],{attributeUrls:n}=t.header;for(let o=0;o<n.length;o++){let s=n[o],u=r[o],l={attributeName:u.name,attributeType:this._getAttributeType(u)};i.push(Wr(s,y_,l))}let a=await Promise.all(i);return this._replaceNestedArrays(a),Object.assign({},...a)}_getAttributeType(t){return t.attributeValues?t.attributeValues.valueType:t.objectIds?"Oid32":""}_replaceNestedArrays(t){for(let r=0;r<t.length;r++){let i=t[r];for(let n in i)i[n]=Array.from(i[n])}}async _finishConversion(t){let r=await Q2(t),i=q6.default.hrtime(this.conversionStartTime),n=J2(i);console.log("------------------------------------------------"),console.log(`Finish conversion of ${dct}`),console.log(`Total conversion time: ${n}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",r," bytes"),console.log("------------------------------------------------")}};var Sge=Fe(h6()),pct="4.0.0-alpha.16",U6={id:"zip",module:"zip",name:"Zip Archive",version:pct,extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:mct};async function mct(e,t={}){let r=[],i={};try{let n=new Sge.default;return(await n.loadAsync(e,t)).forEach((o,s)=>{let u=s.name,l=gct(n,u,t).then(c=>{i[o]=c});r.push(l)}),await Promise.all(r),i}catch(n){throw t.log.error(`Unable to read zip archive: ${n}`),n}}async function gct(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(i){return r.log.error(`Unable to read ${t} from zip archive: ${i}`),i}}var G6=Fe(require("path"));var vct="4.0.0-alpha.16",yct="https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",z6=class{async install(t="",r=""){console.log('Installing "EGM2008-5" model...');let i=await Wr(yct,U6,{}),n=process.cwd();t&&(n=(0,G6.join)(n,t)),await Un(n,new Uint8Array(i["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log('Installing "I3S Content Loader worker"'),await this.installWorker("i3s","i3s-content-worker-node.js",r),console.log('Installing "Draco Loader worker"'),await this.installWorker("draco","draco-worker-node.js",r),console.log('Installing "Basis Loader worker"'),await this.installWorker("textures","basis-worker-node.js",r),console.log('Installing "join-images" npm package'),await new Sf().start({command:process.platform==="win32"?"npm.cmd":"npm",arguments:["install","sharp@0.30.4","join-images@1.1.3"],wait:0,ignoreStderr:!0}),console.log("All dependencies were installed succesfully.")}async installWorker(t,r,i){let a=await(await Ua(`https://unpkg.com/@loaders.gl/${t}@${vct}/dist/${r}`)).arrayBuffer();if(!a)return;let o=(0,G6.join)(process.cwd(),i,"modules",t,"dist");await Un(o,a,r)}};function Sl(e,t){if(e+1>=t.length)return"";let r=t[e+1];return r.indexOf("--")===0?"":r}function Tge(e,t){let r=Sl(e,t);return console.log(`Input tileset value: ${r}`),console.log(`Modified tileset value: ${r.replace(/\\/g,"/")}`),r.replace(/\\/g,"/")}function Age(e){return e.reduce((t,r)=>{let i=r.indexOf("="),n=r.slice(0,i),a=r.slice(i+1,r.length);return r.includes("=")&&r.startsWith("--")&&a?t.concat(n,a):t.concat(r)},[])}function kge(e,t){let r=Sl(e,t),i=Number.parseInt(r);return isFinite(i)?i:NaN}function Nc(e,t){let r=Sl(e,t).toLowerCase().trim();return["--no-draco","--split-nodes"].includes(t[e])&&!r?!1:!r||r==="true"}var H6={I3S:"I3S",_3DTILES:"3DTILES"};async function bct(){let[,,...e]=process.argv;e.length===0&&W6();let t=Age(e),r=wct(t);if(r.installDependencies){new z6().install("deps");return}let i=xct(r);await _ct(i)}bct().catch(e=>{console.log(e),process.exit(1)});function W6(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--instant-node-writing [Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed]"),console.log("--split-nodes [Prevent to merge similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]"),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Will generate obb and mbs bounding volumes from geometry]"),console.log("--validate [Enable validation]"),process.exit(0)}async function _ct(e){switch(console.log("------------------------------------------------"),console.log(`Starting conversion of ${e.inputType}`),console.log("------------------------------------------------"),e.inputType.toUpperCase()){case H6.I3S:new b_().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case H6._3DTILES:await new g_().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,egmFilePath:e.egm,token:e.token,draco:e.draco,mergeMaterials:e.mergeMaterials,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate,instantNodeWriting:e.instantNodeWriting});break;default:W6()}}function xct(e){let t={name:()=>console.log("Missed: --name [Tileset name]"),output:()=>console.log("Missed: --output [Output path name]"),sevenZipExe:()=>console.log("Missed: --7zExe [7z archiver executable path]"),egm:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]"),tileset:()=>console.log("Missed: --tileset [tileset.json file]"),inputType:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]")},r=[];for(let i in t){let n=e[i],a=Boolean(n)&&i==="inputType"&&!Object.values(H6).includes(n.toUpperCase());(!n||a)&&r.push(t[i])}return r.length&&(r.forEach(i=>i()),process.exit(1)),e}function wct(e){let t={output:"data",instantNodeWriting:!1,mergeMaterials:!0,sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:(0,Rge.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1};return e.forEach((r,i)=>{if(r.indexOf("--")===0)switch(r){case"--input-type":t.inputType=Sl(i,e);break;case"--tileset":t.tileset=Tge(i,e);break;case"--name":t.name=Sl(i,e);break;case"--output":t.output=Sl(i,e);break;case"--instant-node-writing":t.instantNodeWriting=Nc(i,e);break;case"--split-nodes":t.mergeMaterials=Nc(i,e);break;case"--max-depth":t.maxDepth=kge(i,e);break;case"--slpk":t.slpk=Nc(i,e);break;case"--7zExe":t.sevenZipExe=Sl(i,e);break;case"--egm":t.egm=Sl(i,e);break;case"--token":t.token=Sl(i,e);break;case"--no-draco":t.draco=Nc(i,e);break;case"--validate":t.validate=Nc(i,e);break;case"--install-dependencies":t.installDependencies=Nc(i,e);break;case"--generate-textures":t.generateTextures=Nc(i,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=Nc(i,e);break;case"--help":W6();break;default:console.warn(`Unknown option ${r}`),process.exit(0)}}),t}
123
+ `).forEach(s=>{let u=a.exec(s);u&&n.push(Number(u[1]))});let o=e;for(;n.includes(o);)o++;t(o)})})}var IY={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log(`Started ${e.props.command}`)}},Sf=class{constructor({id:t="browser-driver"}={}){this.props=ne({},IY);this.childProcess=null;this.port=0;this.id=t}async start(t){t=ne(ne({},IY),t),this.props=t;let r=[...t.arguments];return this.port=Number(t.port),t.portArg&&(t.autoPort&&(this.port=await RY(t.port)),r.push(t.portArg,String(this.port))),await new Promise((i,n)=>{try{this._setTimeout(()=>{t.onSuccess&&t.onSuccess(this),i({})}),console.log(`Spawning ${t.command} ${t.arguments.join(" ")}`);let a=CY.spawn(t.command,r,t.spawn);this.childProcess=a,a.stdout.on("data",o=>{console.log(o.toString())}),a.stderr.on("data",o=>{console.log(`Child process wrote to stderr: "${o}".`),t.ignoreStderr||(this._clearTimeout(),n(new Error(o)))}),a.on("error",o=>{console.log(`Child process errored with ${o}`),this._clearTimeout(),n(o)}),a.on("close",o=>{console.log(`Child process exited with ${o}`),this.childProcess=null,this._clearTimeout(),i({})})}catch(a){n(a)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(t=0){try{await this.stop(),process.exit(t)}catch(r){console.error(r.message||r),process.exit(1)}}_setTimeout(t){Number(this.props.wait)>0&&(this.successTimer=setTimeout(t,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}};function eP(e,t){return!_n.isSupported()||!qa&&!(t==null?void 0:t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}async function tP(e,t,r,i,n){let a=e.id,o=Ef(e,r),u=_n.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let l=await u.startJob("process-on-worker",jCe.bind(null,n));return l.postMessage("process",{input:t,options:r,context:i}),await(await l.result).result}async function jCe(e,t,r,i){switch(r){case"done":t.done(i);break;case"error":t.error(new Error(i.error));break;case"process":let{id:n,input:a,options:o}=i;try{let s=await e(a,o);t.postMessage("done",{id:n,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function rP(e,t){return!_n.isSupported()||!on&&!(t==null?void 0:t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}function PY(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?BY(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?BY(e,0,t):""}function BY(e,t,r){if(e.byteLength<=t+r)return"";let i=new DataView(e),n="";for(let a=0;a<r;a++)n+=String.fromCharCode(i.getUint8(t+a));return n}function iP(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${PY(e)}"`)}}function nP(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let i=new Uint8Array(e),n=new Uint8Array(t);for(let a=0;a<i.length;++a)if(i[a]!==n[a])return!1;return!0}function Vu(...e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),i=new Uint8Array(r),n=0;for(let a of t)i.set(a,n),n+=a.byteLength;return i.buffer}function sa(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=t.reduce((o,s)=>o+s.length,0),n=new r(i),a=0;for(let o of t)n.set(o,a),a+=o.length;return n}function fd(e,t,r){let i=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(i).buffer}function xo(e,t){return Ft(e>=0),Ft(t>0),e+(t-1)&~(t-1)}function aP(e,t,r){let i;if(e instanceof ArrayBuffer)i=new Uint8Array(e);else{let n=e.byteOffset,a=e.byteLength;i=new Uint8Array(e.buffer||e.arrayBuffer,n,a)}return t.set(i,r),r+xo(i.byteLength,4)}function oP(e,t){let r=e.length,n=Math.ceil(r/t)*t-r,a="";for(let o=0;o<n;++o)a+=" ";return e+a}function Cm(e,t,r,i){if(e)for(let n=0;n<i;n++)e.setUint8(t+n,r.charCodeAt(n));return t+i}function hy(e,t,r,i){if(e)for(let n=0;n<i;n++)e.setUint8(t+n,r[n]);return t+i}function Mw(e,t,r,i){let n=xo(r.byteLength,i),a=n-r.byteLength;if(e){let o=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),s=new Uint8Array(r);o.set(s);for(let u=0;u<a;++u)e.setUint8(t+r.byteLength+u,32)}return t+=n,t}function Im(e,t,r,i){let a=new TextEncoder().encode(r);return t=Mw(e,t,a,i),t}async function sP(e){let t=[];for await(let r of e)t.push(r);return Vu(...t)}function Tf(e){return Tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tf(e)}function uP(e,t){if(Tf(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(Tf(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lP(e){var t=uP(e,"string");return Tf(t)==="symbol"?t:String(t)}function Wt(e,t,r){return t=lP(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dy(){let e;if(typeof window!="undefined"&&window.performance)e=window.performance.now();else if(typeof process!="undefined"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Pm=class{constructor(t,r){Wt(this,"name",void 0),Wt(this,"type",void 0),Wt(this,"sampleSize",1),Wt(this,"time",0),Wt(this,"count",0),Wt(this,"samples",0),Wt(this,"lastTiming",0),Wt(this,"lastSampleTime",0),Wt(this,"lastSampleCount",0),Wt(this,"_count",0),Wt(this,"_time",0),Wt(this,"_samples",0),Wt(this,"_startTime",0),Wt(this,"_timerPending",!1),this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=dy(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(dy()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var py=class{constructor(t){Wt(this,"id",void 0),Wt(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:i}=t,n=this.stats[r];return n||(t instanceof Pm?n=t:n=new Pm(r,i),this.stats[r]=n),n}};var NCe="Queued Requests",qCe="Active Requests",UCe="Cancelled Requests",GCe="Queued Requests Ever",zCe="Active Requests Ever",HCe={id:"request-scheduler",throttleRequests:!0,maxRequests:6},my=class{constructor(t={}){this.activeRequestCount=0;this.requestQueue=[];this.requestMap=new Map;this.deferredUpdate=null;this.props=ne(ne({},HCe),t),this.stats=new py({id:this.props.id}),this.stats.get(NCe),this.stats.get(qCe),this.stats.get(UCe),this.stats.get(GCe),this.stats.get(zCe)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let i={handle:t,priority:0,getPriority:r},n=new Promise(a=>(i.resolve=a,i));return this.requestQueue.push(i),this.requestMap.set(t,n),this._issueNewRequests(),n}_issueRequest(t){let{handle:r,resolve:i}=t,n=!1,a=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:a}):Promise.resolve({done:a})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let i=t[r];this._updateRequest(i)||(t.splice(r,1),this.requestMap.delete(i.handle),r--)}t.sort((r,i)=>r.priority-i.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var WCe="",OY={};function Af(e){for(let t in OY)if(e.startsWith(t)){let r=OY[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${WCe}${e}`),e}var VCe="4.0.0-alpha.17",cP={name:"JSON",id:"json",module:"json",version:VCe,extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:FY,parse:async e=>FY(new TextDecoder().decode(e)),options:{}};function FY(e){return JSON.parse(e)}function Lw(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function fP(e){if(Buffer.isBuffer(e))return e;if(ArrayBuffer.isView(e)&&(e=e.buffer),typeof Buffer!="undefined"&&e instanceof ArrayBuffer)return Buffer.from(e);throw new Error("toBuffer")}function DY(e){return e&&typeof e=="object"&&e.isBuffer}function hP(e){return fP?fP(e):e}function jw(e){if(DY(e))return Lw(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function dP(e){return(t,r)=>new Promise((i,n)=>e(t,r,(a,o)=>a?n(a):i(o)))}function MY(e){return(t,r,i)=>new Promise((n,a)=>e(t,r,i,(o,s)=>o?a(o):n(s)))}var Xs={};mo(Xs,{dirname:()=>YCe,filename:()=>KCe,join:()=>XCe,resolve:()=>$Ce});function LY(){var t;if(typeof process!="undefined"&&typeof process.cwd!="undefined")return process.cwd();let e=(t=window.location)==null?void 0:t.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function KCe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function YCe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function XCe(...e){let t="/";return e=e.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${t}`),"")),i!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function $Ce(...e){let t=[];for(let a=0;a<e.length;a++)t[a]=e[a];let r="",i=!1,n;for(let a=t.length-1;a>=-1&&!i;a--){let o;a>=0?o=t[a]:(n===void 0&&(n=LY()),o=n),o.length!==0&&(r=`${o}/${r}`,i=o.charCodeAt(0)===gy)}return r=JCe(r,!i),i?`/${r}`:r.length>0?r:"."}var gy=47,pP=46;function JCe(e,t){let r="",i=-1,n=0,a,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)a=e.charCodeAt(s);else{if(a===gy)break;a=gy}if(a===gy){if(!(i===s-1||n===1))if(i!==s-1&&n===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==pP||r.charCodeAt(r.length-2)!==pP){if(r.length>2){let u=r.length-1,l=u;for(;l>=0&&r.charCodeAt(l)!==gy;--l);if(l!==u){r=l===-1?"":r.slice(0,l),i=s,n=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",i=s,n=0,o=!1;continue}}t&&(r.length>0?r+="/..":r="..",o=!0)}else{let u=e.slice(i+1,s);r.length>0?r+=`/${u}`:r=u,o=!1}i=s,n=0}else a===pP&&n!==-1?++n:n=-1}return r}var Nw={};mo(Nw,{_readToArrayBuffer:()=>QCe,close:()=>WY,createWriteStream:()=>KY,fstat:()=>VY,isSupported:()=>YY,open:()=>HY,read:()=>mP,readFile:()=>qY,readFileSync:()=>UY,readdir:()=>jY,stat:()=>NY,writeFile:()=>GY,writeFileSync:()=>zY});var no=Fe(require("fs"));var jY,NY,qY,UY,GY,zY,HY,WY,mP,VY,KY,YY=Boolean(no.default);try{jY=dP(no.default.readdir),NY=dP(no.default.stat),qY=no.default.readFile,UY=no.default.readFileSync,GY=MY(no.default.writeFile),zY=no.default.writeFileSync,HY=no.default.open,WY=e=>new Promise((t,r)=>no.default.close(e,i=>i?r(i):t())),mP=no.default.read,VY=no.default.fstat,KY=no.default.createWriteStream,YY=Boolean(no.default)}catch{}async function QCe(e,t,r){let i=Buffer.alloc(r),{bytesRead:n}=await mP(e,i,0,r,t);if(n!==r)throw new Error("fs.read failed");return Lw(i)}var eIe=e=>typeof e=="boolean",vy=e=>typeof e=="function",hd=e=>e!==null&&typeof e=="object",gP=e=>hd(e)&&e.constructor==={}.constructor;var XY=e=>e&&typeof e[Symbol.iterator]=="function",$Y=e=>e&&typeof e[Symbol.asyncIterator]=="function";var Qo=e=>typeof Response!="undefined"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Zo=e=>typeof Blob!="undefined"&&e instanceof Blob,JY=e=>e&&typeof e=="object"&&e.isBuffer;var tIe=e=>typeof ReadableStream!="undefined"&&e instanceof ReadableStream||hd(e)&&vy(e.tee)&&vy(e.cancel)&&vy(e.getReader);var rIe=e=>hd(e)&&vy(e.read)&&vy(e.pipe)&&eIe(e.readable),qw=e=>tIe(e)||rIe(e);var iIe=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,nIe=/^([-\w.]+\/[-\w.+]+)/;function QY(e){let t=nIe.exec(e);return t?t[1]:e}function vP(e){let t=iIe.exec(e);return t?t[1]:""}var ZY=/\?.*/;function eX(e){let t=e.match(ZY);return t&&t[0]}function Bm(e){return e.replace(ZY,"")}function dd(e){return Qo(e)?e.url:Zo(e)?e.name||"":typeof e=="string"?e:""}function yy(e){if(Qo(e)){let t=e,r=t.headers.get("content-type")||"",i=Bm(t.url);return QY(r)||vP(i)}return Zo(e)?e.type||"":typeof e=="string"?vP(e):""}function tX(e){return Qo(e)?e.headers["content-length"]||-1:Zo(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function Uw(e){if(Qo(e))return e;let t={},r=tX(e);r>=0&&(t["content-length"]=String(r));let i=dd(e),n=yy(e);n&&(t["content-type"]=n);let a=await oIe(e);a&&(t["x-first-bytes"]=a),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:i}),o}async function rX(e){if(!e.ok){let t=await aIe(e);throw new Error(t)}}async function aIe(e){let t=`Failed to fetch resource ${e.url} (${e.status}): `;try{let r=e.headers.get("Content-Type"),i=e.statusText;r.includes("application/json")&&(i+=` ${await e.text()}`),t+=i,t=t.length>60?`${t.slice(0,60)}...`:t}catch{}return t}async function oIe(e){let t=5;if(typeof e=="string")return`data:,${e.slice(0,t)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=a=>{var o;return i((o=a==null?void 0:a.target)==null?void 0:o.result)},n.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,t);return`data:base64,${sIe(r)}`}return null}function sIe(e){let t="",r=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)t+=String.fromCharCode(r[i]);return btoa(t)}async function Ua(e,t){if(typeof e=="string"){let r=Af(e);return await fetch(r,t)}return await Uw(e)}async function iX(e,t,r){e=Af(e),on||await Nw.writeFile(e,hP(t),{flag:"w"}),Ft(!1)}function yP(e){if(typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function $s(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||yP()}var uIe=globalThis.self||globalThis.window||globalThis.global,Om=globalThis.window||globalThis.self||globalThis.global,lIe=globalThis.document||{},pd=globalThis.process||{},cIe=globalThis.console,$yt=globalThis.navigator||{};var Gw="4.0.0-alpha.17",Zyt=$s();function fIe(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var bP=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";Wt(this,"storage",void 0),Wt(this,"id",void 0),Wt(this,"config",void 0),this.storage=fIe(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function nX(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function aX(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function zw(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,n=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(r=Math.min(r,i/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(n,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var Hw;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Hw||(Hw={}));var hIe=10;function oX(e){return typeof e!="string"?e:(e=e.toUpperCase(),Hw[e]||Hw.WHITE)}function sX(e,t,r){if(!$s&&typeof e=="string"){if(t){let i=oX(t);e="[".concat(i,"m").concat(e,"")}if(r){let i=oX(r);e="[".concat(i+hIe,"m").concat(e,"")}}return e}function uX(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r),n=e;for(let a of i){let o=n[a];typeof o=="function"&&(t.find(s=>a===s)||(n[a]=o.bind(e)))}}function Fm(e,t){if(!e)throw new Error(t||"Assertion failed")}function md(){let e;if($s()&&Om.performance){var t,r;e=Om===null||Om===void 0||(t=Om.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in pd){var i;let n=pd===null||pd===void 0||(i=pd.hrtime)===null||i===void 0?void 0:i.call(pd);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}var Dm={debug:$s()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},dIe={enabled:!0,level:0};function es(){}var lX={},cX={once:!0},Yl=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};Wt(this,"id",void 0),Wt(this,"VERSION",Gw),Wt(this,"_startTs",md()),Wt(this,"_deltaTs",md()),Wt(this,"_storage",void 0),Wt(this,"userData",{}),Wt(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new bP("__probe-".concat(this.id,"__"),dIe),this.timeStamp("".concat(this.id," started")),uX(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((md()-this._startTs).toPrecision(10))}getDelta(){return Number((md()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Fm(t,r)}warn(t){return this._getLogFunction(0,t,Dm.warn,arguments,cX)}error(t){return this._getLogFunction(0,t,Dm.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Dm.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Dm.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Dm.debug||Dm.info,arguments,cX)}table(t,r,i){return r?this._getLogFunction(t,r,console.table||es,i&&[i],{tag:vIe(r)}):es}image(t){let{logLevel:r,priority:i,image:n,message:a="",scale:o=1}=t;return this._shouldLog(r||i)?$s()?gIe({image:n,message:a,scale:o}):mIe({image:n,message:a,scale:o}):es}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||es)}group(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},n=hX({logLevel:t,message:r,opts:i}),{collapsed:a}=i;return n.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||es)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=fX(t)}_getLogFunction(t,r,i,n,a){if(this._shouldLog(t)){a=hX({logLevel:t,message:r,args:n,opts:a}),i=i||a.method,Fm(i),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=md();let o=a.tag||a.message;if(a.once&&o)if(!lX[o])lX[o]=md();else return es;return r=pIe(this.id,a.message,a),i.bind(console,r,...a.args)}return es}};Wt(Yl,"VERSION",Gw);function fX(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Fm(Number.isFinite(t)&&t>=0),t}function hX(e){let{logLevel:t,message:r}=e;e.logLevel=fX(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&i.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let n=typeof e.message;return Fm(n==="string"||n==="object"),Object.assign(e,{args:i},e.opts)}function pIe(e,t,r){if(typeof t=="string"){let i=r.time?aX(nX(r.total)):"";t=r.time?"".concat(e,": ").concat(i," ").concat(t):"".concat(e,": ").concat(t),t=sX(t,r.color,r.background)}return t}function mIe(e){let{image:t,message:r="",scale:i=1}=e;return console.warn("removed"),es}function gIe(e){let{image:t,message:r="",scale:i=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=zw(a,r,i);console.log(...o)},a.src=t,es}let n=t.nodeName||"";if(n.toLowerCase()==="img")return console.log(...zw(t,r,i)),es;if(n.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...zw(a,r,i)),a.src=t.toDataURL(),es}return es}function vIe(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Abt=new Yl({id:"@probe.gl/log"});var _P=new Yl({id:"loaders.gl"}),xP=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},wP=class{constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var EP={fetch:null,mimeType:void 0,nothrow:!1,log:new wP,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:on,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},dX={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function SP(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state=e._state||{},e._state}var Ku=()=>{let e=SP();return e.globalOptions=e.globalOptions||ne({},EP),e.globalOptions};function pX(e,t,r,i){return r=r||[],r=Array.isArray(r)?r:[r],yIe(e,r),_Ie(t,e,i)}function yIe(e,t){mX(e,null,EP,dX,t);for(let r of t){let i=e&&e[r.id]||{},n=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};mX(i,r.id,n,a,t)}}function mX(e,t,r,i,n){let a=t||"Top level",o=t?`${t}.`:"";for(let s in e){let u=!t&&hd(e[s]),l=s==="baseUri"&&!t,c=s==="workerUrl"&&t;if(!(s in r)&&!l&&!c){if(s in i)_P.warn(`${a} loader option '${o}${s}' no longer supported, use '${i[s]}'`)();else if(!u){let f=bIe(s,n);_P.warn(`${a} loader option '${o}${s}' not recognized. ${f}`)()}}}}function bIe(e,t){let r=e.toLowerCase(),i="";for(let n of t)for(let a in n.options){if(e===a)return`Did you mean '${n.id}.${a}'?`;let o=a.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(i=i||`Did you mean '${n.id}.${a}'?`)}return i}function _Ie(e,t,r){let i=e.options||{},n=ne({},i);return xIe(n,r),n.log===null&&(n.log=new xP),gX(n,Ku()),gX(n,t),n}function gX(e,t){for(let r in t)if(r in t){let i=t[r];gP(i)&&gP(e[r])?e[r]=ne(ne({},e[r]),t[r]):e[r]=t[r]}}function xIe(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function by(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function TP(e){Ft(e,"null loader"),Ft(by(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e=Ye(ne({},e),{options:ne(ne({},e.options),t)})),((e==null?void 0:e.parseTextSync)||(e==null?void 0:e.parseText))&&(e.text=!0),e.text||(e.binary=!0),e}var wIe=()=>{let e=SP();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function vX(){return wIe()}var yX=new Yl({id:"loaders.gl"});var EIe=/\.([^.]+)$/;async function bX(e,t=[],r,i){if(!xX(e))return null;let n=_X(e,t,Ye(ne({},r),{nothrow:!0}),i);if(n)return n;if(Zo(e)&&(e=await e.slice(0,10).arrayBuffer(),n=_X(e,t,r,i)),!n&&!(r==null?void 0:r.nothrow))throw new Error(wX(e));return n}function _X(e,t=[],r,i){if(!xX(e))return null;if(t&&!Array.isArray(t))return TP(t);let n=[];t&&(n=n.concat(t)),(r==null?void 0:r.ignoreRegisteredLoaders)||n.push(...vX()),TIe(n);let a=SIe(e,n,r,i);if(!a&&!(r==null?void 0:r.nothrow))throw new Error(wX(e));return a}function SIe(e,t,r,i){let n=dd(e),a=yy(e),o=Bm(n)||(i==null?void 0:i.url),s=null,u="";return(r==null?void 0:r.mimeType)&&(s=AP(t,r==null?void 0:r.mimeType),u=`match forced by supplied MIME type ${r==null?void 0:r.mimeType}`),s=s||AIe(t,o),u=u||(s?`matched url ${o}`:""),s=s||AP(t,a),u=u||(s?`matched MIME type ${a}`:""),s=s||RIe(t,e),u=u||(s?`matched initial data ${SX(e)}`:""),s=s||AP(t,r==null?void 0:r.fallbackMimeType),u=u||(s?`matched fallback MIME type ${a}`:""),u&&yX.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function xX(e){return!(e instanceof Response&&e.status===204)}function wX(e){let t=dd(e),r=yy(e),i="No valid loader found (";i+=t?`${Xs.filename(t)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=e?SX(e):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function TIe(e){for(let t of e)TP(t)}function AIe(e,t){let r=t&&EIe.exec(t),i=r&&r[1];return i?kIe(e,i):null}function kIe(e,t){t=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(i.toLowerCase()===t)return r;return null}function AP(e,t){for(let r of e)if(r.mimeTypes&&r.mimeTypes.includes(t)||t===`application/x.${r.id}`)return r;return null}function RIe(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(CIe(t,r))return r}else if(ArrayBuffer.isView(t)){if(EX(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&EX(t,0,r))return r;return null}function CIe(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>e.startsWith(i))}function EX(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>IIe(e,t,r,n))}function IIe(e,t,r,i){if(i instanceof ArrayBuffer)return nP(i,e,i.byteLength);switch(typeof i){case"function":return i(e,r);case"string":let n=kP(e,t,i.length);return i===n;default:return!1}}function SX(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?kP(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?kP(e,0,t):""}function kP(e,t,r){if(e.byteLength<t+r)return"";let i=new DataView(e),n="";for(let a=0;a<r;a++)n+=String.fromCharCode(i.getUint8(t+a));return n}var PIe=256*1024;function*TX(e,t){let r=(t==null?void 0:t.chunkSize)||PIe,i=0,n=new TextEncoder;for(;i<e.length;){let a=Math.min(e.length-i,r),o=e.slice(i,i+a);i+=a,yield n.encode(o)}}var BIe=256*1024;function*AX(e,t={}){let{chunkSize:r=BIe}=t,i=0;for(;i<e.byteLength;){let n=Math.min(e.byteLength-i,r),a=new ArrayBuffer(n),o=new Uint8Array(e,i,n);new Uint8Array(a).set(o),i+=n,yield a}}var OIe=1024*1024;async function*kX(e,t){let r=(t==null?void 0:t.chunkSize)||OIe,i=0;for(;i<e.size;){let n=i+r,a=await e.slice(i,n).arrayBuffer();i=n,yield a}}function RP(e,t){return on?FIe(e,t):DIe(e,t)}async function*FIe(e,t){let r=e.getReader(),i;try{for(;;){let n=i||r.read();(t==null?void 0:t._streamReadAhead)&&(i=r.read());let{done:a,value:o}=await n;if(a)return;yield jw(o)}}catch{r.releaseLock()}}async function*DIe(e,t){for await(let r of e)yield jw(r)}function RX(e,t){if(typeof e=="string")return TX(e,t);if(e instanceof ArrayBuffer)return AX(e,t);if(Zo(e))return kX(e,t);if(qw(e))return RP(e,t);if(Qo(e))return RP(e.body,t);throw new Error("makeIterator")}var CX="Cannot convert supplied data type";function MIe(e,t,r){if(t.text&&typeof e=="string")return e;if(JY(e)&&(e=e.buffer),e instanceof ArrayBuffer){let i=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let i=e.buffer,n=e.byteLength||e.length;return(e.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(e.byteOffset,e.byteOffset+n)),i}throw new Error(CX)}async function IX(e,t,r){let i=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||i)return MIe(e,t,r);if(Zo(e)&&(e=await Uw(e)),Qo(e)){let n=e;return await rX(n),t.binary?await n.arrayBuffer():await n.text()}if(qw(e)&&(e=RX(e,r)),XY(e)||$Y(e))return sP(e);throw new Error(CX)}function Ww(e,t){let r=Ku(),i=e||r;return typeof i.fetch=="function"?i.fetch:hd(i.fetch)?n=>Ua(n,i):(t==null?void 0:t.fetch)?t==null?void 0:t.fetch:Ua}function PX(e,t,r){if(r)return r;let i=ne({fetch:Ww(t,e)},e);if(i.url){let n=Bm(i.url);i.baseUrl=n,i.queryString=eX(i.url),i.filename=Xs.filename(n),i.baseUrl=Xs.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function BX(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let i=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...i]:i}return r&&r.length?r:null}async function wo(e,t,r,i){Zn(!i||typeof i=="object"),t&&!Array.isArray(t)&&!by(t)&&(i=void 0,r=t,t=void 0),e=await e,r=r||{};let n=dd(e),o=BX(t,i),s=await bX(e,o,r);return s?(r=pX(r,s,o,n),i=PX({url:n,parse:wo,loaders:o},r,i||null),await LIe(s,e,r,i)):null}async function LIe(e,t,r,i){if(XI(e),Qo(t)){let n=t,{ok:a,redirected:o,status:s,statusText:u,type:l,url:c}=n,f=Object.fromEntries(n.headers.entries());i.response={headers:f,ok:a,redirected:o,status:s,statusText:u,type:l,url:c}}if(t=await IX(t,e,r),e.parseTextSync&&typeof t=="string")return r.dataType="text",e.parseTextSync(t,r,i,e);if(eP(e,r))return await tP(e,t,r,i,wo);if(e.parseText&&typeof t=="string")return await e.parseText(t,r,i,e);if(e.parse)return await e.parse(t,r,i,e);throw Zn(!e.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}async function Wr(e,t,r,i){let n,a;!Array.isArray(t)&&!by(t)?(n=[],a=t,i=void 0):(n=t,a=r);let o=Ww(a),s=e;return typeof e=="string"&&(s=await o(e)),Zo(e)&&(s=await o(e)),Array.isArray(n)?await wo(s,n,a):await wo(s,n,a)}async function Mm(e,t,r){let i=Ku();if(r=ne(ne({},i),r),rP(t,r))return await YI(t,e,r);if(t.encode)return await t.encode(e,r);if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeText)return new TextEncoder().encode(await t.encodeText(e,r));if(t.encodeInBatches){let n=OX(e,t,r),a=[];for await(let o of n)a.push(o);return Vu(...a)}if(!on&&t.encodeURLtoURL){let n=DX("input");await iX(n,e);let a=DX("output"),o=await FX(n,a,t,r);return(await Ua(o)).arrayBuffer()}throw new Error("Writer could not encode data")}function Vw(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);throw new Error("Writer could not synchronously encode data")}function OX(e,t,r){if(t.encodeInBatches){let i=jIe(e);return t.encodeInBatches(i,r)}throw new Error("Writer could not encode data in batches")}async function FX(e,t,r,i){if(e=Af(e),t=Af(t),on||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,i)}function jIe(e){return[{table:e,start:0,end:e.length}]}function DX(e){return`/tmp/${e}`}var iu=Fe(fr()),ng=Fe(ua());function Uy(){let e;if(typeof window!="undefined"&&window.performance)e=window.performance.now();else if(typeof process!="undefined"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Jm=class{constructor(t,r){Wt(this,"name",void 0),Wt(this,"type",void 0),Wt(this,"sampleSize",1),Wt(this,"time",0),Wt(this,"count",0),Wt(this,"samples",0),Wt(this,"lastTiming",0),Wt(this,"lastSampleTime",0),Wt(this,"lastSampleCount",0),Wt(this,"_count",0),Wt(this,"_time",0),Wt(this,"_samples",0),Wt(this,"_startTime",0),Wt(this,"_timerPending",!1),this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Uy(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Uy()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Gy=class{constructor(t){Wt(this,"id",void 0),Wt(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:i}=t,n=this.stats[r];return n||(t instanceof Jm?n=t:n=new Jm(r,i),this.stats[r]=n),n}};var pB=class{constructor(t,r,i){this.item=t,this.previous=r,this.next=i}};var mB=class{constructor(){this.head=null;this.tail=null;this._length=0}get length(){return this._length}add(t){let r=new pB(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){!t||(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let i=t.next;t.next=r,this.tail===t?this.tail=r:i.previous=r,r.next=i,r.previous=t,++this._length}};var gB=class{constructor(){this._list=new mB,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,i){r._cacheNode||(r._cacheNode=this._list.add(r),i&&i(t,r))}unloadTile(t,r,i){let n=r._cacheNode;!n||(this._list.remove(n),r._cacheNode=null,i&&i(t,r))}unloadTiles(t,r){let i=this._trimTiles;this._trimTiles=!1;let n=this._list,a=t.maximumMemoryUsage*1024*1024,o=this._sentinel,s=n.head;for(;s!==o&&(t.gpuMemoryUsageInBytes>a||i);){let u=s.item;s=s.next,this.unloadTile(t,u,r)}}trim(){this._trimTiles=!0}};var vB=Fe(ua()),Sd=Fe(fr());function WJ(e,t){Ft(e),Ft(t);let{rtcCenter:r,gltfUpAxis:i}=t,{computedTransform:n,boundingVolume:{center:a}}=e,o=new Sd.Matrix4(n);switch(r&&o.translate(r),i){case"Z":break;case"Y":let f=new Sd.Matrix4().rotateX(Math.PI/2);o=o.multiplyRight(f);break;case"X":let h=new Sd.Matrix4().rotateY(-Math.PI/2);o=o.multiplyRight(h);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let s=new Sd.Vector3(a);t.cartesianModelMatrix=o,t.cartesianOrigin=s;let u=vB.Ellipsoid.WGS84.cartesianToCartographic(s,new Sd.Vector3),c=vB.Ellipsoid.WGS84.eastNorthUpToFixedFrame(s).invert();t.cartographicModelMatrix=c.multiplyRight(o),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var rl=Fe(fr()),oc=Fe(tl()),nS=Fe(ua()),gQ=new rl.Vector3,DB=new rl.Vector3,MB=new oc.CullingVolume([new oc.Plane,new oc.Plane,new oc.Plane,new oc.Plane,new oc.Plane,new oc.Plane]);function vQ(e,t){let{cameraDirection:r,cameraUp:i,height:n}=e,{metersPerUnit:a}=e.distanceScales,o=aS(e,e.center),s=nS.Ellipsoid.WGS84.eastNorthUpToFixedFrame(o),u=e.unprojectPosition(e.cameraPosition),l=nS.Ellipsoid.WGS84.cartographicToCartesian(u,new rl.Vector3),c=new rl.Vector3(s.transformAsVector(new rl.Vector3(r).scale(a))).normalize(),f=new rl.Vector3(s.transformAsVector(new rl.Vector3(i).scale(a))).normalize();T6e(e);let h=e.constructor,{longitude:d,latitude:p,width:y,bearing:g,zoom:b}=e,E=new h({longitude:d,latitude:p,height:n,width:y,bearing:g,zoom:b,pitch:0});return{camera:{position:l,direction:c,up:f},viewport:e,topDownViewport:E,height:n,cullingVolume:MB,frameNumber:t,sseDenominator:1.15}}function yQ(e,t,r){if(r===0||e.length<=r)return[e,[]];let i=[],{longitude:n,latitude:a}=t.viewport;for(let[l,c]of e.entries()){let[f,h]=c.header.mbs,d=Math.abs(n-f),p=Math.abs(a-h),y=Math.sqrt(p*p+d*d);i.push([l,y])}let o=i.sort((l,c)=>l[1]-c[1]),s=[];for(let l=0;l<r;l++)s.push(e[o[l][0]]);let u=[];for(let l=r;l<o.length;l++)u.push(e[o[l][0]]);return[s,u]}function T6e(e){let t=e.getFrustumPlanes(),r=bQ(t.near,e.cameraPosition),i=aS(e,r),n=aS(e,e.cameraPosition,DB),a=0;MB.planes[a++].fromPointNormal(i,gQ.copy(i).subtract(n));for(let o in t){if(o==="near")continue;let s=t[o],u=bQ(s,r,DB),l=aS(e,u,DB);MB.planes[a++].fromPointNormal(l,gQ.copy(i).subtract(l))}}function bQ(e,t,r=new rl.Vector3){let i=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-i).add(t),r}function aS(e,t,r=new rl.Vector3){let i=e.unprojectPosition(t);return nS.Ellipsoid.WGS84.cartographicToCartesian(i,r)}var LB=Fe(fr()),oS=Fe(tl()),_Q=Fe(ua()),A6e=6378137,k6e=6378137,jB=6356752314245179e-9,xQ=new LB.Vector3;function wQ(e,t){if(e instanceof oS.OrientedBoundingBox){let{halfAxes:r}=e,i=R6e(r);return Math.log2(jB/(i+t[2]))}else if(e instanceof oS.BoundingSphere){let{radius:r}=e;return Math.log2(jB/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:i}=e,n=Math.log2(A6e/r),a=Math.log2(k6e/i);return(n+a)/2}return 1}function NB(e,t,r){let i=_Q.Ellipsoid.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],new LB.Vector3),n=Math.sqrt(Math.pow(i[0]-r[0],2)+Math.pow(i[1]-r[1],2)+Math.pow(i[2]-r[2],2));return Math.log2(jB/(n+t[2]))}function EQ(e,t,r){let[i,n,a,o]=e;return NB({xmin:i,xmax:a,ymin:n,ymax:o,zmin:0,zmax:0},t,r)}function R6e(e){e.getColumn(0,xQ);let t=e.getColumn(1),r=e.getColumn(2);return xQ.add(t).add(r).len()}var ru=Fe(fr()),fS=Fe(tl());var Wa={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},ea;(function(r){r[r.ADD=1]="ADD",r[r.REPLACE=2]="REPLACE"})(ea||(ea={}));var il;(function(n){n.EMPTY="empty",n.SCENEGRAPH="scenegraph",n.POINTCLOUD="pointcloud",n.MESH="mesh"})(il||(il={}));var En;(function(r){r.I3S="I3S",r.TILES3D="TILES3D"})(En||(En={}));var sc;(function(r){r.GEOMETRIC_ERROR="geometricError",r.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(sc||(sc={}));var SQ={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var Lr=Fe(fr()),sS=Fe(tl()),ig=Fe(ua());function TQ(e){return e!=null}var ka=new Lr.Vector3,uS=new Lr.Vector3,C6e=new Lr.Vector3,I6e=new Lr.Vector3;function Mf(e,t,r){if(Ft(e,"3D Tile: boundingVolume must be defined"),e.box)return P6e(e.box,t,r);if(e.region){let[i,n,a,o,s,u]=e.region,l=ig.Ellipsoid.WGS84.cartographicToCartesian([(0,Lr.degrees)(i),(0,Lr.degrees)(o),s],C6e),c=ig.Ellipsoid.WGS84.cartographicToCartesian([(0,Lr.degrees)(a),(0,Lr.degrees)(n),u],I6e),f=new Lr.Vector3().addVectors(l,c).multiplyScalar(.5),h=new Lr.Vector3().subVectors(l,c).len()/2;return kQ([f[0],f[1],f[2],h],new Lr.Matrix4)}if(e.sphere)return kQ(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function AQ(e,t){if(e.box)return B6e(t);if(e.region){let[r,i,n,a,o,s]=e.region;return[[(0,Lr.degrees)(r),(0,Lr.degrees)(i),o],[(0,Lr.degrees)(n),(0,Lr.degrees)(a),s]]}if(e.sphere)return O6e(t);throw new Error("Unkown boundingVolume type")}function P6e(e,t,r){let i=new Lr.Vector3(e[0],e[1],e[2]);t.transform(i,i);let n=[];if(e.length===10){let l=e.slice(3,6),c=new Lr.Quaternion;c.fromArray(e,6);let f=new Lr.Vector3([1,0,0]),h=new Lr.Vector3([0,1,0]),d=new Lr.Vector3([0,0,1]);f.transformByQuaternion(c),f.scale(l[0]),h.transformByQuaternion(c),h.scale(l[1]),d.transformByQuaternion(c),d.scale(l[2]),n=[...f.toArray(),...h.toArray(),...d.toArray()]}else n=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let a=t.transformAsVector(n.slice(0,3)),o=t.transformAsVector(n.slice(3,6)),s=t.transformAsVector(n.slice(6,9)),u=new Lr.Matrix3([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);return TQ(r)?(r.center=i,r.halfAxes=u,r):new sS.OrientedBoundingBox(i,u)}function kQ(e,t,r){let i=new Lr.Vector3(e[0],e[1],e[2]);t.transform(i,i);let n=t.getScale(uS),a=Math.max(Math.max(n[0],n[1]),n[2]),o=e[3]*a;return TQ(r)?(r.center=i,r.radius=o,r):new sS.BoundingSphere(i,o)}function B6e(e){let t=RQ(),{halfAxes:r}=e,i=new Lr.Vector3(r.getColumn(0)),n=new Lr.Vector3(r.getColumn(1)),a=new Lr.Vector3(r.getColumn(2));for(let o=0;o<2;o++){for(let s=0;s<2;s++){for(let u=0;u<2;u++)ka.copy(e.center),ka.add(i),ka.add(n),ka.add(a),CQ(t,ka),a.negate();n.negate()}i.negate()}return t}function O6e(e){let t=RQ(),{center:r,radius:i}=e,n=ig.Ellipsoid.WGS84.scaleToGeodeticSurface(r,ka),a;n?a=ig.Ellipsoid.WGS84.geodeticSurfaceNormal(n):a=new Lr.Vector3(0,0,1);let o=new Lr.Vector3(a[2],-a[1],0);o.len()>0?o.normalize():o=new Lr.Vector3(0,1,0);let s=o.clone().cross(a);for(let u of[o,s,a]){uS.copy(u).scale(i);for(let l=0;l<2;l++)ka.copy(r),ka.add(uS),CQ(t,ka),uS.negate()}return t}function RQ(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function CQ(e,t){ig.Ellipsoid.WGS84.cartesianToCartographic(t,ka),e[0][0]=Math.min(e[0][0],ka[0]),e[0][1]=Math.min(e[0][1],ka[1]),e[0][2]=Math.min(e[0][2],ka[2]),e[1][0]=Math.max(e[1][0],ka[0]),e[1][1]=Math.max(e[1][1],ka[1]),e[1][2]=Math.max(e[1][2],ka[2])}var uc=Fe(fr()),Gxt=new uc.Vector3,zxt=new uc.Vector3,Hxt=new uc.Matrix4,Wxt=new uc.Vector3,Vxt=new uc.Vector3,Kxt=new uc.Vector3;function F6e(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function D6e(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,i=e.dynamicScreenSpaceErrorFactor;return F6e(t,r)*i}return 0}function IQ(e,t,r){let i=e.tileset,n=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,a=r?n:e.lodMetricValue;if(a===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:s,sseDenominator:u}=t,{viewDistanceScale:l}=i.options,c=a*s*(l||1)/(o*u);return c-=D6e(i,o),c}var lc=Fe(fr()),lS=Fe(ua()),qB=new lc.Vector3,PQ=new lc.Vector3,Lf=new lc.Vector3,BQ=new lc.Vector3,M6e=new lc.Vector3,UB=new lc.Matrix4,OQ=new lc.Matrix4;function FQ(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*GB(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function GB(e,t){let{topDownViewport:r}=t,i=e.header.mbs[1],n=e.header.mbs[0],a=e.header.mbs[2],o=e.header.mbs[3],s=[...e.boundingVolume.center],u=r.unprojectPosition(r.cameraPosition);lS.Ellipsoid.WGS84.cartographicToCartesian(u,qB),PQ.copy(qB).subtract(s).normalize(),lS.Ellipsoid.WGS84.eastNorthUpToFixedFrame(s,UB),OQ.copy(UB).invert(),Lf.copy(qB).transform(OQ);let l=Math.sqrt(Lf[0]*Lf[0]+Lf[1]*Lf[1]),c=l*l/Lf[2];BQ.copy([Lf[0],Lf[1],c]);let h=BQ.transform(UB).subtract(s).normalize(),p=PQ.cross(h).normalize().scale(o).add(s),y=lS.Ellipsoid.WGS84.cartesianToCartographic(p),g=r.project([n,i,a]),b=r.project(y);return M6e.copy(g).subtract(b).magnitude()}function DQ(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var cS=class{constructor(t=0){this._map=new Map;this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Ft(t<this._array.length),this._array[t]}set(t,r){Ft(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Ft(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Ft(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var L6e={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},cc=class{constructor(t){this.root=null;this.selectedTiles={};this.requestedTiles={};this.emptyTiles={};this.lastUpdate=new Date().getTime();this.updateDebounceTime=1e3;this._traversalStack=new cS;this._emptyTraversalStack=new cS;this._frameNumber=null;this.options=ne(ne({},L6e),t)}traversalFinished(t){return!0}traverse(t,r,i){this.root=t,this.options=ne(ne({},this.options),i),this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let i=this._traversalStack;for(t._selectionDepth=1,i.push(t);i.length>0;){let a=i.pop(),o=!1;this.canTraverse(a,r)&&(this.updateChildTiles(a,r),o=this.updateAndPushChildren(a,r,i,a.hasRenderContent?a._selectionDepth+1:a._selectionDepth));let s=a.parent,u=Boolean(!s||s._shouldRefine),l=!o;a.hasRenderContent?a.refine===ea.ADD?(this.loadTile(a,r),this.selectTile(a,r)):a.refine===ea.REPLACE&&(this.loadTile(a,r),l&&this.selectTile(a,r)):(this.emptyTiles[a.id]=a,this.loadTile(a,r),l&&this.selectTile(a,r)),this.touchTile(a,r),a._shouldRefine=o&&u}let n=new Date().getTime();(this.traversalFinished(r)||n-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=n,this.options.onTraversalEnd(r))}updateChildTiles(t,r){let i=t.children;for(let n of i)this.updateTile(n,r)}updateAndPushChildren(t,r,i,n){let{loadSiblings:a,skipLevelOfDetail:o}=this.options,s=t.children;s.sort(this.compareDistanceToCamera.bind(this));let u=t.refine===ea.REPLACE&&t.hasRenderContent&&!o,l=!1,c=!0;for(let f of s)if(f._selectionDepth=n,f.isVisibleAndInRequestVolume?(i.find(f)&&i.delete(f),i.push(f),l=!0):(u||a)&&(this.loadTile(f,r),this.touchTile(f,r)),u){let h;if(f._inRequestVolume?f.hasRenderContent?h=f.contentAvailable:h=this.executeEmptyTraversal(f,r):h=!1,c=c&&h,!c)return!1}return l||(c=!1),c}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){this.shouldLoadTile(t)&&(t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r,i=!1,n=!1){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!n&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,r,i):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,r,i=!1){let n=t._screenSpaceError;return i&&(n=t.getScreenSpaceError(r,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(t,r){let i=[];if(this.options.viewportTraversersMap)for(let n in this.options.viewportTraversersMap)this.options.viewportTraversersMap[n]===r.viewport.id&&i.push(n);else i.push(r.viewport.id);t.updateVisibility(r,i)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let i=!1;for(let n of t.children)n.updateVisibility(r),i=i||n.isVisibleAndInRequestVolume;return i}executeEmptyTraversal(t,r){let i=!0,n=this._emptyTraversalStack;for(n.push(t);n.length>0&&i;){let a=n.pop();if(this.updateTile(a,r),a.isVisibleAndInRequestVolume||this.loadTile(a,r),this.touchTile(a,r),!a.hasRenderContent&&this.canTraverse(a,r,!1,!0)){let s=a.children;for(let u of s)n.find(u)&&n.delete(u),n.push(u)}else a.contentAvailable||(i=!1)}return i}};var MQ=new ru.Vector3;function j6e(e){return e!=null}var fc=class{constructor(t,r,i,n=""){this.lodMetricType="geometricError";this.lodMetricValue=0;this.boundingVolume=null;this.content=null;this.contentState=Wa.UNLOADED;this.gpuMemoryUsageInBytes=0;this.children=[];this.depth=0;this.viewportIds=[];this.transform=new ru.Matrix4;this.extensions=null;this.implicitTiling=null;this.userData={};this.hasEmptyContent=!1;this.hasTilesetContent=!1;this.traverser=new cc({});this._cacheNode=null;this._frameNumber=null;this._expireDate=null;this._expiredContent=null;this._distanceToCamera=0;this._screenSpaceError=0;this._visible=void 0;this._initialTransform=new ru.Matrix4;this._priority=0;this._selectedFrame=0;this._requestedFrame=0;this._selectionDepth=0;this._touchedFrame=0;this._centerZDepth=0;this._shouldRefine=!1;this._stackLength=0;this._visitedFrame=0;this._inRequestVolume=!1;this._lodJudge=null;this.header=r,this.tileset=t,this.id=n||r.id,this.url=r.url,this.parent=i,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===Wa.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===Wa.UNLOADED}get contentExpired(){return this.contentState===Wa.EXPIRED}get contentFailed(){return this.contentState===Wa.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=AQ(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case En.I3S:return GB(this,t);case En.TILES3D:return IQ(this,t,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:r}=t.options,i=this.refine===ea.ADD||r;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Wa.UNLOADED)return-1;let n=this.parent,o=n&&(!i||this._screenSpaceError===0||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,s=t.root?t.root._screenSpaceError:0;return Math.max(s-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Wa.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=Wa.UNLOADED,!1;try{let i=this.tileset.getTileUrl(this.contentUrl),n=this.tileset.loader,a=Ye(ne({},this.tileset.loadOptions),{[n.id]:ne(Ye(ne({},this.tileset.loadOptions[n.id]),{isTileset:this.type==="json"}),this._getLoaderSpecificOptions(n.id))});return this.content=await Wr(i,n,a),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Wa.READY,this._onContentLoaded(),!0}catch(i){throw this.contentState=Wa.FAILED,i}finally{r.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=Wa.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let i=this.parent,n=i?i._visibilityPlaneMask:fS.CullingVolume.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let a=i?i.computedTransform:this.tileset.modelMatrix;this._updateTransform(a)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,n),this._visible=this._visibilityPlaneMask!==fS.CullingVolume.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}visibility(t,r){let{cullingVolume:i}=t,{boundingVolume:n}=this;return i.computeVisibilityWithPlaneMask(n,r)}contentVisibility(){return!0}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return MQ.subVectors(r.center,t.position),t.direction.dot(MQ)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(j6e(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Wa.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new ru.Matrix4(t.transform):new ru.Matrix4;let r=this.parent,i=this.tileset,n=r&&r.computedTransform?r.computedTransform.clone():i.modelMatrix.clone();this.computedTransform=new ru.Matrix4(n).multiplyRight(this.transform);let a=r&&r._initialTransform?r._initialTransform.clone():new ru.Matrix4;this._initialTransform=new ru.Matrix4(a).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Wa.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=fS.CullingVolume.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||ea.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=Mf(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;!r||(r.boundingVolume&&(this._contentBoundingVolume=Mf(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Mf(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new ru.Matrix4){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return Ye(ne({},this.tileset.options.i3s),{_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1});case"3d-tiles":case"cesium-ion":default:return DQ(this.tileset.tileset)}}};var zB=class extends cc{compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let i=t.children.length>0;if(t.hasTilesetContent&&i){let o=t.children[0];this.updateTileVisibility(o,r),t._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let n=t.refine===ea.REPLACE,a=t._optimChildrenWithinParent===SQ.USE_OPTIMIZATION;if(n&&a&&i&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:i}=t;return!i||i.hasTilesetContent||i.refine!==ea.ADD?!1:!this.shouldRefine(t,r,!0)}};var HB=class{constructor(){this.frameNumberMap=new Map}register(t,r){let i=this.frameNumberMap.get(t)||new Map,n=i.get(r)||0;i.set(r,n+1),this.frameNumberMap.set(t,i)}deregister(t,r){let i=this.frameNumberMap.get(t);if(!i)return;let n=i.get(r)||1;i.set(r,n-1)}isZero(t,r){var n;return(((n=this.frameNumberMap.get(t))==null?void 0:n.get(r))||0)===0}};var WB={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},VB=class{constructor(){this.pendingTilesRegister=new HB;this._statusMap={}}add(t,r,i,n){if(!this._statusMap[r]){let{frameNumber:a,viewport:{id:o}}=n;this._statusMap[r]={request:t,callback:i,key:r,frameState:n,status:WB.REQUESTED},this.pendingTilesRegister.register(o,a),t().then(s=>{this._statusMap[r].status=WB.COMPLETED;let{frameNumber:u,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,u),this._statusMap[r].callback(s,n)}).catch(s=>{this._statusMap[r].status=WB.ERROR;let{frameNumber:u,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,u),i(s)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:i,viewport:{id:n}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(n,i);let{frameNumber:a,viewport:{id:o}}=r;this.pendingTilesRegister.register(o,a),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var KB=class extends cc{constructor(t){super(t);this._tileManager=new VB}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=FQ(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let i=t.header.children||[],n=t.children,a=t.tileset;for(let o of i){let s=`${o.id}-${r.viewport.id}`,u=n&&n.find(l=>l.id===s);if(u)u&&this.updateTile(u,r);else{let l=()=>this._loadTile(o.id,a);this._tileManager.find(s)?this._tileManager.update(s,r):(a.tileset.nodePages&&(l=()=>a.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(l,s,f=>this._onTileLoad(f,t,s),r))}}return!1}async _loadTile(t,r){let{loader:i}=r,n=r.getTileUrl(`${r.url}/nodes/${t}`),a=Ye(ne({},r.loadOptions),{i3s:Ye(ne({},r.loadOptions.i3s),{isTileHeader:!0})});return await Wr(n,i,a)}_onTileLoad(t,r,i){let n=new fc(r.tileset,t,r,i);r.children.push(n);let a=this._tileManager.find(n.id).frameState;this.updateTile(n,a),this._frameNumber===a.frameNumber&&(this.traversalFinished(a)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,a)}};var N6e={description:"",ellipsoid:ng.Ellipsoid.WGS84,modelMatrix:new iu.Matrix4,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},hS="Tiles In Tileset(s)",YB="Tiles In Memory",LQ="Tiles In View",jQ="Tiles To Render",NQ="Tiles Loaded",XB="Tiles Loading",qQ="Tiles Unloaded",UQ="Failed Tile Loads",GQ="Points/Vertices",$B="Tile Memory Use",dS=class{constructor(t,r){this.root=null;this.roots={};this.asset={};this.description="";this.extras=null;this.attributions={};this.credits={};this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1};this.cartographicCenter=null;this.cartesianCenter=null;this.zoom=1;this.boundingVolume=null;this.dynamicScreenSpaceErrorComputedDensity=0;this.maximumMemoryUsage=32;this.gpuMemoryUsageInBytes=0;this._frameNumber=0;this._queryParams={};this._extensionsUsed=[];this._tiles={};this._pendingCount=0;this.selectedTiles=[];this.traverseCounter=0;this.geometricError=0;this.lastUpdatedVieports=null;this._requestedTiles=[];this._emptyTiles=[];this.frameStateData={};this._cache=new gB;this.updatePromise=null;this.options=ne(ne({},N6e),r),this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||Xs.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new my({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.stats=new Gy({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options=ne(ne({},this.options),t)}setOptions(t){this.options=ne(ne({},this.options),t)}getTileUrl(t){return t.startsWith("data:")?t:`${t}${t.includes("?")?"&":"?"}${this.queryParams}`}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=[];for(let n of r){let a=n.id;this._needTraverse(a)?i.push(a):this.traverseCounter--}for(let n of r){let a=n.id;if(this.roots[a]||(this.roots[a]=this._initializeTileHeaders(this.tileset,null)),!i.includes(a))continue;let o=vQ(n,this._frameNumber);this._traverser.traverse(this.roots[a],o,this.options)}}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let i=this.frameStateData[r],n=Object.values(this._traverser.selectedTiles),[a,o]=yQ(n,t,this.options.maximumTilesSelected);i.selectedTiles=a;for(let s of o)s.unselect();i._requestedTiles=Object.values(this._traverser.requestedTiles),i._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let r=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,r){if(t.length!==r.length)return!0;let i=new Set(t.map(o=>o.id)),n=new Set(r.map(o=>o.id)),a=t.filter(o=>!n.has(o.id)).length>0;return a=a||r.filter(o=>!i.has(o.id)).length>0,a}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r))}_updateStats(){let t=0,r=0;for(let i of this.selectedTiles)i.contentAvailable&&i.content&&(t++,i.content.pointCount?r+=i.content.pointCount:r+=i.content.vertexCount);this.stats.get(LQ).count=this.selectedTiles.length,this.stats.get(jQ).count=t,this.stats.get(GQ).count=r}async _initializeTileSet(t){this.type===En.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===En.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===En.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var i;let t=this.tileset.fullExtent;if(t){let{xmin:n,xmax:a,ymin:o,ymax:s,zmin:u,zmax:l}=t;this.cartographicCenter=new iu.Vector3(n+(a-n)/2,o+(s-o)/2,u+(l-u)/2),this.cartesianCenter=ng.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter,new iu.Vector3),this.zoom=NB(t,this.cartographicCenter,this.cartesianCenter);return}let r=(i=this.tileset.store)==null?void 0:i.extent;if(r){let[n,a,o,s]=r;this.cartographicCenter=new iu.Vector3(n+(o-n)/2,a+(s-a)/2,0),this.cartesianCenter=ng.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter,new iu.Vector3),this.zoom=EQ(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new iu.Vector3,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:r}=t.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new iu.Vector3,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?this.cartographicCenter=ng.Ellipsoid.WGS84.cartesianToCartographic(r,new iu.Vector3):this.cartographicCenter=new iu.Vector3(0,0,-ng.Ellipsoid.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=wQ(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(hS),this.stats.get(XB),this.stats.get(YB),this.stats.get(LQ),this.stats.get(jQ),this.stats.get(NQ),this.stats.get(qQ),this.stats.get(UQ),this.stats.get(GQ),this.stats.get($B,"memory")}_initializeTileHeaders(t,r){var n;let i=new fc(this,t.root,r);if(r&&(r.children.push(i),i.depth=r.depth+1),this.type===En.TILES3D){let a=[];for(a.push(i);a.length>0;){let o=a.pop();this.stats.get(hS).incrementCount();let s=o.header.children||[];for(let u of s){let l=new fc(this,u,o);if((n=l.contentUrl)==null?void 0:n.includes("?session=")){let f=new URL(l.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(l),l.depth=o.depth+1,a.push(l)}}}return i}_initializeTraverser(){let t;switch(this.type){case En.TILES3D:t=zB;break;case En.I3S:t=KB;break;default:t=cc}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r;try{this._onStartTileLoading(),r=await t.loadContent()}catch(i){this._onTileLoadError(t,i instanceof Error?i:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}_onTileLoadError(t,r){this.stats.get(UQ).incrementCount();let i=r.message||r.toString(),n=t.url;console.error(`A 3D tile failed to load: ${t.url} ${i}`),this.options.onTileError(t,i,n)}_onTileLoad(t,r){var i,n;if(!!r){if(this.type===En.I3S){let a=((n=(i=this.tileset)==null?void 0:i.nodePagesTile)==null?void 0:n.nodesInNodePages)||0;this.stats.get(hS).reset(),this.stats.get(hS).addCount(a)}t&&t.content&&WJ(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){var r;if(this.type===En.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===En.TILES3D){let{extensionsRemoved:i=[]}=((r=t.content)==null?void 0:r.gltf)||{};i.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),i.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),i.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(XB).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(XB).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(NQ).incrementCount(),this.stats.get(YB).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get($B).count=this.gpuMemoryUsageInBytes}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(YB).decrementCount(),this.stats.get(qQ).incrementCount(),this.stats.get($B).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let i of r.children)t.push(i);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,i=[];for(i.push(r);i.length>0;){t=i.pop();for(let n of t.children)i.push(n);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let r=new URLSearchParams(t.queryString),i=Object.fromEntries(r.entries());this._queryParams=ne(ne({},this._queryParams),i)}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var ag="4.0.0-alpha.17";var ss={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Hwt=Object.keys(ss),jf={BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]};function JB(e,t,r){Ft(e instanceof ArrayBuffer);let i=new TextDecoder("utf8"),n=new Uint8Array(e,t,r);return i.decode(n)}function zQ(e,t=0){let r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}var pS="4.0.0-alpha.17";var q6e={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},HQ={name:"Draco",id:"draco",module:"draco",version:pS,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:q6e};function WQ(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function QB(e){let t=1/0,r=1/0,i=1/0,n=-1/0,a=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let l=0;l<u;l+=3){let c=s[l],f=s[l+1],h=s[l+2];t=c<t?c:t,r=f<r?f:r,i=h<i?h:i,n=c>n?c:n,a=f>a?f:a,o=h>o?h:o}return[[t,r,i],[n,a,o]]}function ZB(e,t,r){let i=WQ(t.value),n=r||VQ(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:i}]},nullable:!1,metadata:n}}function VQ(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function KQ(e,t,r){let i=XQ(t.metadata),n=[],a=U6e(t.attributes);for(let o in e){let s=e[o],u=YQ(o,s,a[o]);n.push(u)}if(r){let o=YQ("indices",r);n.push(o)}return{fields:n,metadata:i}}function U6e(e){let t={};for(let r in e){let i=e[r];t[i.name||"undefined"]=i}return t}function YQ(e,t,r){let i=r?XQ(r.metadata):void 0;return ZB(e,t,i)}function XQ(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var $Q={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},G6e={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},z6e=4,mS=class{constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,r={}){let i=new this.draco.DecoderBuffer;i.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(r);let n=this.decoder.GetEncodedGeometryType(i),a=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(n){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,a);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,a);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!a.ptr){let h=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(h)}let s=this._getDracoLoaderData(a,n,r),u=this._getMeshData(a,s,r),l=QB(u.attributes),c=KQ(u.attributes,s,u.indices);return Ye(ne({loader:"draco",loaderData:s,header:{vertexCount:a.num_points(),boundingBox:l}},u),{schema:c})}finally{this.draco.destroy(i),a&&this.draco.destroy(a)}}_getDracoLoaderData(t,r,i){let n=this._getTopLevelMetadata(t),a=this._getDracoAttributes(t,i);return{geometry_type:r,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:n,attributes:a}}_getDracoAttributes(t,r){let i={};for(let n=0;n<t.num_attributes();n++){let a=this.decoder.GetAttribute(t,n),o=this._getAttributeMetadata(t,n);i[a.unique_id()]={unique_id:a.unique_id(),attribute_type:a.attribute_type(),data_type:a.data_type(),num_components:a.num_components(),byte_offset:a.byte_offset(),byte_stride:a.byte_stride(),normalized:a.normalized(),attribute_index:n,metadata:o};let s=this._getQuantizationTransform(a,r);s&&(i[a.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(a,r);u&&(i[a.unique_id()].octahedron_transform=u)}return i}_getMeshData(t,r,i){let n=this._getMeshAttributes(r,t,i);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(i.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,r,i){let n={};for(let a of Object.values(t.attributes)){let o=this._deduceAttributeName(a,i);a.name=o;let{value:s,size:u}=this._getAttributeValues(r,a);n[o]={value:s,size:u,byteOffset:a.byte_offset,byteStride:a.byte_stride,normalized:a.normalized}}return n}_getTriangleListIndices(t){let i=t.num_faces()*3,n=i*z6e,a=this.draco._malloc(n);try{return this.decoder.GetTrianglesUInt32Array(t,n,a),new Uint32Array(this.draco.HEAPF32.buffer,a,i).slice()}finally{this.draco._free(a)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),V6e(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let i=G6e[r.data_type],n=r.num_components,o=t.num_points()*n,s=o*i.BYTES_PER_ELEMENT,u=H6e(this.draco,i),l,c=this.draco._malloc(s);try{let f=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,u,s,c),l=new i(this.draco.HEAPF32.buffer,c,o).slice()}finally{this.draco._free(c)}return{value:l,size:n}}_deduceAttributeName(t,r){let i=t.unique_id;for(let[o,s]of Object.entries(r.extraAttributes||{}))if(s===i)return o;let n=t.attribute_type;for(let o in $Q)if(this.draco[o]===n)return $Q[o];let a=r.attributeNameEntry||"name";return t.metadata[a]?t.metadata[a].string:`CUSTOM_ATTRIBUTE_${i}`}_getTopLevelMetadata(t){let r=this.decoder.GetMetadata(t);return this._getDracoMetadata(r)}_getAttributeMetadata(t,r){let i=this.decoder.GetAttributeMetadata(t,r);return this._getDracoMetadata(i)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let r={},i=this.metadataQuerier.NumEntries(t);for(let n=0;n<i;n++){let a=this.metadataQuerier.GetEntryName(t,n);r[a]=this._getDracoMetadataField(t,a)}return r}_getDracoMetadataField(t,r){let i=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,i);let n=W6e(i);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:n}}finally{this.draco.destroy(i)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:i=[]}=t,n=[...r,...i];for(let a of n)this.decoder.SkipAttributeTransform(this.draco[a])}_getQuantizationTransform(t,r){let{quantizedAttributes:i=[]}=r,n=t.attribute_type();if(i.map(o=>this.decoder[o]).includes(n)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(s=>o.min_value(s))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,r){let{octahedronAttributes:i=[]}=r,n=t.attribute_type();if(i.map(o=>this.decoder[o]).includes(n)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function H6e(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function W6e(e){let t=e.size(),r=new Int32Array(t);for(let i=0;i<t;i++)r[i]=e.GetValue(i);return r}function V6e(e){let t=e.size(),r=new Int32Array(t);for(let i=0;i<t;i++)r[i]=e.GetValue(i);return r}var K6e="1.5.5",Y6e="1.4.1",eO=`https://www.gstatic.com/draco/versioned/decoders/${K6e}`,X6e=`${eO}/draco_decoder.js`,$6e=`${eO}/draco_wasm_wrapper.js`,J6e=`${eO}/draco_decoder.wasm`,dEt=`https://raw.githubusercontent.com/google/draco/${Y6e}/javascript/draco_encoder.js`,Jy;async function JQ(e){let t=e.modules||{};return t.draco3d?Jy=Jy||t.draco3d.createDecoderModule({}).then(r=>({draco:r})):Jy=Jy||Q6e(e),await Jy}async function Q6e(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await Wu(X6e,"draco",e);break;case"wasm":default:[t,r]=await Promise.all([await Wu($6e,"draco",e),await Wu(J6e,"draco",e)])}return t=t||globalThis.DracoDecoderModule,await Z6e(t,r)}function Z6e(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(i=>{e(Ye(ne({},r),{onModuleLoaded:n=>i({draco:n})}))})}var Qy={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:pS,worker:!0,options:{draco:{},source:null}};var og=Ye(ne({},HQ),{parse:e4e});async function e4e(e,t){let{draco:r}=await JQ(t),i=new mS(r);try{return i.parseSync(e,t==null?void 0:t.draco)}finally{i.destroy()}}var t4e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ln={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Zt=ne(ne({},t4e),ln);var tO={[ln.DOUBLE]:Float64Array,[ln.FLOAT]:Float32Array,[ln.UNSIGNED_SHORT]:Uint16Array,[ln.UNSIGNED_INT]:Uint32Array,[ln.UNSIGNED_BYTE]:Uint8Array,[ln.BYTE]:Int8Array,[ln.SHORT]:Int16Array,[ln.INT]:Int32Array},r4e={DOUBLE:ln.DOUBLE,FLOAT:ln.FLOAT,UNSIGNED_SHORT:ln.UNSIGNED_SHORT,UNSIGNED_INT:ln.UNSIGNED_INT,UNSIGNED_BYTE:ln.UNSIGNED_BYTE,BYTE:ln.BYTE,SHORT:ln.SHORT,INT:ln.INT},rO="Failed to convert GL type",Va=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in tO)if(tO[r]===t)return r;throw new Error(rO)}static fromName(t){let r=r4e[t];if(!r)throw new Error(rO);return r}static getArrayType(t){switch(t){case ln.UNSIGNED_SHORT_5_6_5:case ln.UNSIGNED_SHORT_4_4_4_4:case ln.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=tO[t];if(!r)throw new Error(rO);return r}}static getByteSize(t){return Va.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Va.getArrayType(t))}static createTypedArray(t,r,i=0,n){n===void 0&&(n=(r.byteLength-i)/Va.getByteSize(t));let a=Va.getArrayType(t);return new a(r,i,n)}};function QQ(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function iO(e,t=[0,0,0]){let r=e>>11&31,i=e>>5&63,n=e&31;return t[0]=r<<3,t[1]=i<<2,t[2]=n<<3,t}var hc=Fe(fr());var AEt=1/256;var kEt=new hc.Vector2,REt=new hc.Vector3,CEt=new hc.Vector2,IEt=new hc.Vector2,PEt=new Uint8Array(1);function ZQ(e,t=255){return(0,hc.clamp)(e,0,t)/t*2-1}function eZ(e){return e<0?-1:1}function tZ(e,t,r,i){if(QQ(i),e<0||e>r||t<0||t>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(i.x=ZQ(e,r),i.y=ZQ(t,r),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){let n=i.x;i.x=(1-Math.abs(i.y))*eZ(n),i.y=(1-Math.abs(n))*eZ(i.y)}return i.normalize()}function nO(e,t,r){return tZ(e,t,255,r)}var sO=Fe(fr());var Nf=class{constructor(t,r){this.featuresLength=0;this._cachedTypedArrays={};this.json=t,this.buffer=r}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,r=Zt.UNSIGNED_INT,i=1){let n=this.json[t];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(t,r,i,1,n.byteOffset):n}getPropertyArray(t,r,i){let n=this.json[t];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(r=Va.fromName(n.componentType)),this._getTypedArrayFromBinary(t,r,i,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(t,r,n)}getProperty(t,r,i,n,a){let o=this.json[t];if(!o)return o;let s=this.getPropertyArray(t,r,i);if(i===1)return s[n];for(let u=0;u<i;++u)a[u]=s[i*n+u];return a}_getTypedArrayFromBinary(t,r,i,n,a){let o=this._cachedTypedArrays,s=o[t];return s||(s=Va.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+a,n*i),o[t]=s),s}_getTypedArrayFromArray(t,r,i){let n=this._cachedTypedArrays,a=n[t];return a||(a=Va.createTypedArray(r,i),n[t]=a),a}};var i4e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},n4e={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},a4e={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};function rZ(e,t,r,i){let{componentType:n}=e;Ft(e.componentType);let a=typeof n=="string"?Va.fromName(n):n,o=i4e[e.type],s=n4e[e.type],u=a4e[e.type];return r+=e.byteOffset,{values:Va.createTypedArray(a,t,r,o*i),type:a,size:o,unpacker:s,packer:u}}var nl=e=>e!==void 0;function iZ(e,t,r){if(!t)return null;let i=e.getExtension("3DTILES_batch_table_hierarchy"),n=t.HIERARCHY;return n&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=n,i=n),i?o4e(i,r):null}function o4e(e,t){let r,i,n,a=e.instancesLength,o=e.classes,s=e.classIds,u=e.parentCounts,l=e.parentIds,c=a;nl(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,n=getBinaryAccessor(s),s=n.createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,a));let f;if(nl(u))for(nl(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,n=getBinaryAccessor(u),u=n.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a)),f=new Uint16Array(a),c=0,r=0;r<a;++r)f[r]=c,c+=u[r];nl(l)&&nl(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,n=getBinaryAccessor(l),l=n.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,c));let h=o.length;for(r=0;r<h;++r){let g=o[r].length,b=o[r].instances,E=getBinaryProperties(g,b,t);o[r].instances=combine(E,b)}let d=new Array(h).fill(0),p=new Uint16Array(a);for(r=0;r<a;++r)i=s[r],p[r]=d[i],++d[i];let y={classes:o,classIds:s,classIndexes:p,parentCounts:u,parentIndexes:f,parentIds:l};return l4e(y),y}function sg(e,t,r){if(!e)return;let i=e.parentCounts;return e.parentIds?r(e,t):i>0?s4e(e,t,r):u4e(e,t,r)}function s4e(e,t,r){let i=e.classIds,n=e.parentCounts,a=e.parentIds,o=e.parentIndexes,s=i.length,u=scratchVisited;u.length=Math.max(u.length,s);let l=++marker,c=scratchStack;for(c.length=0,c.push(t);c.length>0;){if(t=c.pop(),u[t]===l)continue;u[t]=l;let f=r(e,t);if(nl(f))return f;let h=n[t],d=o[t];for(let p=0;p<h;++p){let y=a[d+p];y!==t&&c.push(y)}}return null}function u4e(e,t,r){let i=!0;for(;i;){let n=r(e,t);if(nl(n))return n;let a=e.parentIds[t];i=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}function l4e(e){let t=[],i=e.classIds.length;for(let n=0;n<i;++n)nZ(e,n,stack)}function nZ(e,t,r){let i=e.parentCounts,n=e.parentIds,a=e.parentIndexes,s=e.classIds.length;if(!nl(n))return;assert(t<s,`Parent index ${t} exceeds the total number of instances: ${s}`),assert(r.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(t);let u=nl(i)?i[t]:1,l=nl(i)?a[t]:t;for(let c=0;c<u;++c){let f=n[l+c];f!==t&&nZ(e,f,r)}r.pop(t)}function so(e){return e!=null}var gS=(e,t)=>e,c4e={HIERARCHY:!0,extensions:!0,extras:!0},ug=class{constructor(t,r,i,n={}){var a;Ft(i>=0),this.json=t||{},this.binary=r,this.featureCount=i,this._extensions=((a=this.json)==null?void 0:a.extensions)||{},this._properties={};for(let o in this.json)c4e[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=iZ(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,r){if(this._checkBatchId(t),Ft(typeof r=="string",r),this._hierarchy){let i=sg(this._hierarchy,t,(n,a)=>{let o=n.classIds[a];return n.classes[o].name===r});return so(i)}return!1}isExactClass(t,r){return Ft(typeof r=="string",r),this.getExactClassName(t)===r}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let r=this._hierarchy.classIds[t];return this._hierarchy.classes[r].name}}hasProperty(t,r){return this._checkBatchId(t),Ft(typeof r=="string",r),so(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=so(r)?r:[],r.length=0;let i=Object.keys(this._properties);return r.push(...i),this._hierarchy&&this._getPropertyNamesInHierarchy(t,r),r}getProperty(t,r){if(this._checkBatchId(t),Ft(typeof r=="string",r),this._binaryProperties){let n=this._binaryProperties[r];if(so(n))return this._getBinaryProperty(n,t)}let i=this._properties[r];if(so(i))return gS(i[t],!0);if(this._hierarchy){let n=this._getHierarchyProperty(t,r);if(so(n))return n}}setProperty(t,r,i){let n=this.featureCount;if(this._checkBatchId(t),Ft(typeof r=="string",r),this._binaryProperties){let o=this._binaryProperties[r];if(o){this._setBinaryProperty(o,t,i);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,r,i))return;let a=this._properties[r];so(a)||(this._properties[r]=new Array(n),a=this._properties[r]),a[t]=gS(i,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,r){return t.unpack(t.typedArray,r)}_setBinaryProperty(t,r,i){t.pack(i,t.typedArray,r)}_initializeBinaryProperties(){let t=null;for(let r in this._properties){let i=this._properties[r],n=this._initializeBinaryProperty(r,i);n&&(t=t||{},t[r]=n)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let i=r;Ft(this.binary,`Property ${t} requires a batch table binary.`),Ft(i.type,`Property ${t} requires a type.`);let n=rZ(i,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let i=sg(this._hierarchy,t,(n,a)=>{let o=n.classIds[a],s=n.classes[o].instances;return so(s[r])});return so(i)}_getPropertyNamesInHierarchy(t,r){sg(this._hierarchy,t,(i,n)=>{let a=i.classIds[n],o=i.classes[a].instances;for(let s in o)o.hasOwnProperty(s)&&r.indexOf(s)===-1&&r.push(s)})}_getHierarchyProperty(t,r){return sg(this._hierarchy,t,(i,n)=>{let a=i.classIds[n],o=i.classes[a],s=i.classIndexes[n],u=o.instances[r];return so(u)?so(u.typedArray)?this._getBinaryProperty(u,s):gS(u[s],!0):null})}_setHierarchyProperty(t,r,i,n){let a=sg(this._hierarchy,r,(o,s)=>{let u=o.classIds[s],l=o.classes[u],c=o.classIndexes[s],f=l.instances[i];return so(f)?(Ft(s===r,`Inherited property "${i}" is read-only.`),so(f.typedArray)?this._setBinaryProperty(f,c,n):f[c]=gS(n,!0),!0):!1});return so(a)}};var aO=4;function qf(e,t,r=0){let i=new DataView(t);if(e.magic=i.getUint32(r,!0),r+=aO,e.version=i.getUint32(r,!0),r+=aO,e.byteLength=i.getUint32(r,!0),r+=aO,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var lg=4,aZ="b3dm tile in legacy format.";function cg(e,t,r){let i=new DataView(t),n;e.header=e.header||{};let a=i.getUint32(r,!0);r+=lg;let o=i.getUint32(r,!0);r+=lg;let s=i.getUint32(r,!0);r+=lg;let u=i.getUint32(r,!0);return r+=lg,s>=570425344?(r-=lg*2,n=a,s=o,u=0,a=0,o=0,console.warn(aZ)):u>=570425344&&(r-=lg,n=s,s=a,u=o,a=0,o=0,console.warn(aZ)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=n,r}function fg(e,t,r,i){return r=f4e(e,t,r,i),r=h4e(e,t,r,i),r}function f4e(e,t,r,i){let{featureTableJsonByteLength:n,featureTableBinaryByteLength:a,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},n&&n>0){let s=JB(t,r,n);e.featureTableJson=JSON.parse(s)}return r+=n||0,e.featureTableBinary=new Uint8Array(t,r,a),r+=a||0,r}function h4e(e,t,r,i){let{batchTableJsonByteLength:n,batchTableBinaryByteLength:a}=e.header||{};if(n&&n>0){let o=JB(t,r,n);e.batchTableJson=JSON.parse(o),r+=n,a&&a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}function oO(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:i,isRGB565:n,pointCount:a=0}=e;if(i&&r){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;s++){let u=i[s],c=r.getProperty(u,"dimensions").map(f=>f*255);o[s*3]=c[0],o[s*3+1]=c[1],o[s*3+2]=c[2]}return{type:Zt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&n){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;s++){let u=iO(t[s]);o[s*3]=u[0],o[s*3+1]=u[1],o[s*3+2]=u[2]}return{type:Zt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===a*3?{type:Zt.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Zt.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var oZ=Fe(fr());var sZ=new oZ.Vector3;function uZ(e,t){if(!t)return null;if(e.isOctEncoded16P){let r=new Float32Array((e.pointsLength||0)*3);for(let i=0;i<(e.pointsLength||0);i++)nO(t[i*2],t[i*2+1],sZ),sZ.toArray(r,i*3);return{type:Zt.FLOAT,size:2,value:r}}return{type:Zt.FLOAT,size:2,value:t}}var lZ=Fe(fr());function cZ(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,d4e(e,t)):{type:Zt.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function d4e(e,t){let r=new lZ.Vector3,i=new Float32Array(e.pointCount*3);for(let n=0;n<e.pointCount;n++)r.set(t[n*3],t[n*3+1],t[n*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(i,n*3);return i}async function fZ(e,t,r,i,n){r=qf(e,t,r),r=cg(e,t,r),r=fg(e,t,r,i),p4e(e);let{featureTable:a,batchTable:o}=m4e(e);return await _4e(e,a,o,i,n),g4e(e,a,i),v4e(e,a,o),y4e(e,a),r}function p4e(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function m4e(e){let t=new Nf(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",Zt.FLOAT,3);let i=b4e(e,t);return{featureTable:t,batchTable:i}}function g4e(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",Zt.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let i=t.getPropertyArray("POSITION_QUANTIZED",Zt.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Zt.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Zt.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=cZ(e,i,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function v4e(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let i=null;t.hasProperty("RGBA")?(i=t.getPropertyArray("RGBA",Zt.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?i=t.getPropertyArray("RGB",Zt.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(i=t.getPropertyArray("RGB565",Zt.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=oO(e,i,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Zt.UNSIGNED_BYTE,4))}function y4e(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",Zt.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Zt.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=uZ(e,r)}}function b4e(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Zt.UNSIGNED_SHORT,1),e.batchIds)){let i=t.getGlobalProperty("BATCH_LENGTH");if(!i)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:n,batchTableBinary:a}=e;r=new ug(n,a,i)}return r}async function _4e(e,t,r,i,n){let a,o,s,u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){o=l.properties;let f=l.byteOffset,h=l.byteLength;if(!o||!Number.isFinite(f)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");a=(e.featureTableBinary||[]).slice(f,f+h),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!a)return!0;let c={buffer:a,properties:ne(ne({},o),s),featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await x4e(e,c,i,n)}async function x4e(e,t,r,i){if(!i)return;let{parse:n}=i,a=Ye(ne({},r),{draco:Ye(ne({},r==null?void 0:r.draco),{extraAttributes:t.batchTableProperties||{}})});delete a["3d-tiles"];let o=await n(t.buffer,og,a),s=o.attributes.POSITION&&o.attributes.POSITION.value,u=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,l=o.attributes.NORMAL&&o.attributes.NORMAL.value,c=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,f=s&&o.attributes.POSITION.value.quantization,h=l&&o.attributes.NORMAL.value.quantization;if(f){let p=o.POSITION.data.quantization,y=p.range;e.quantizedVolumeScale=new sO.Vector3(y,y,y),e.quantizedVolumeOffset=new sO.Vector3(p.minValues),e.quantizedRange=(1<<p.quantizationBits)-1,e.isQuantizedDraco=!0}h&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let d={};if(t.batchTableProperties)for(let p of Object.keys(t.batchTableProperties))o.attributes[p]&&o.attributes[p].value&&(d[p.toLowerCase()]=o.attributes[p].value);e.attributes=ne({positions:s,colors:oO(e,u,void 0),normals:l,batchIds:c},d)}var vS="4.0.0-alpha.17";var yS="4.0.0-alpha.17";var{_parseImageNode:w4e}=globalThis,uO=typeof Image!="undefined",lO=typeof ImageBitmap!="undefined",E4e=Boolean(w4e),cO=on?!0:E4e;function hZ(e){switch(e){case"auto":return lO||uO||cO;case"imagebitmap":return lO;case"image":return uO;case"data":return cO;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function dZ(){if(lO)return"imagebitmap";if(uO)return"image";if(cO)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function pZ(e){let t=S4e(e);if(!t)throw new Error("Not an image");return t}function fO(e){return hg(e)}function hg(e){switch(pZ(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function S4e(e){return typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap?"imagebitmap":typeof Image!="undefined"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var T4e=/^data:image\/svg\+xml/,A4e=/\.svg((\?|#).*)?$/;function bS(e){return e&&(T4e.test(e)||A4e.test(e))}function mZ(e,t){if(bS(t)){let i=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(a){throw new Error(a.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return hO(e,t)}function hO(e,t){if(bS(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Zy(e,t,r){let i=mZ(e,r),n=self.URL||self.webkitURL,a=typeof i!="string"&&n.createObjectURL(i);try{return await k4e(a||i,t)}finally{a&&n.revokeObjectURL(a)}}async function k4e(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=a=>n(new Error(`Could not load image ${e}: ${a}`))}catch(a){n(a)}})}var R4e={},gZ=!0;async function dO(e,t,r){let i;bS(r)?i=await Zy(e,t,r):i=hO(e,r);let n=t&&t.imagebitmap;return await C4e(i,n)}async function C4e(e,t=null){if((I4e(t)||!gZ)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),gZ=!1}return await createImageBitmap(e)}function I4e(e){for(let t in e||R4e)return!1;return!0}function vZ(e){return!F4e(e,"ftyp",4)||(e[8]&96)==0?null:P4e(e)}function P4e(e){switch(B4e(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function B4e(e,t,r){return String.fromCharCode(...e.slice(t,r))}function O4e(e){return[...e].map(t=>t.charCodeAt(0))}function F4e(e,t,r=0){let i=O4e(t);for(let n=0;n<i.length;++n)if(i[n]!==e[n+r])return!1;return!0}var al=!1,eb=!0;function kd(e){let t=tb(e);return M4e(t)||N4e(t)||L4e(t)||j4e(t)||D4e(t)}function D4e(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=vZ(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function M4e(e){let t=tb(e);return t.byteLength>=24&&t.getUint32(0,al)===2303741511?{mimeType:"image/png",width:t.getUint32(16,al),height:t.getUint32(20,al)}:null}function L4e(e){let t=tb(e);return t.byteLength>=10&&t.getUint32(0,al)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,eb),height:t.getUint16(8,eb)}:null}function j4e(e){let t=tb(e);return t.byteLength>=14&&t.getUint16(0,al)===16973&&t.getUint32(2,eb)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,eb),height:t.getUint32(22,eb)}:null}function N4e(e){let t=tb(e);if(!(t.byteLength>=3&&t.getUint16(0,al)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=q4e(),a=2;for(;a+9<t.byteLength;){let o=t.getUint16(a,al);if(n.has(o))return{mimeType:"image/jpeg",height:t.getUint16(a+5,al),width:t.getUint16(a+7,al)};if(!i.has(o))return null;a+=2,a+=t.getUint16(a,al)}return null}function q4e(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);let t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}function tb(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function pO(e,t){let{mimeType:r}=kd(e)||{},i=globalThis._parseImageNode;return Ft(i),await i(e,r)}async function mO(e,t,r){t=t||{};let n=(t.image||{}).type||"auto",{url:a}=r||{},o=U4e(n),s;switch(o){case"imagebitmap":s=await dO(e,t,a);break;case"image":s=await Zy(e,t,a);break;case"data":s=await pO(e,t);break;default:Ft(!1)}return n==="data"&&(s=hg(s)),s}function U4e(e){switch(e){case"auto":case"data":return dZ();default:return hZ(e),e}}var G4e=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],z4e=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],H4e={image:{type:"auto",decode:!0}},dg={id:"image",module:"images",name:"Images",version:yS,mimeTypes:z4e,extensions:G4e,parse:mO,tests:[e=>Boolean(kd(new DataView(e)))],options:H4e};var{_encodeImageNode:yZ}=globalThis;async function bZ(e,t){return t=t||{},t.image=t.image||{},yZ?yZ(e,{type:t.image.mimeType}):W4e(e,t)}var _Z=!0;async function W4e(e,t){let{mimeType:r,jpegQuality:i}=t.image,{width:n,height:a}=fO(e),o=document.createElement("canvas");o.width=n,o.height=a,V4e(e,o);let s=await new Promise(u=>{if(i&&_Z)try{o.toBlob(u,r,i);return}catch{_Z=!1}o.toBlob(u,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}function V4e(e,t,r=0,i=0){if(r===0&&i===0&&typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let a=t.getContext("bitmaprenderer");if(a)return a.transferFromImageBitmap(e),t}let n=t.getContext("2d");if(e.data){let a=new Uint8ClampedArray(e.data),o=new ImageData(a,e.width,e.height);return n.putImageData(o,0,0),t}return n.drawImage(e,0,0),t}var gO={name:"Images",id:"image",module:"images",version:yS,extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:bZ};var vO={};function yO(e){if(vO[e]===void 0){let t=on?Y4e(e):K4e(e);vO[e]=t}return vO[e]}function K4e(e){let t=["image/png","image/jpeg","image/gif"],{_parseImageNode:r,_imageFormatsNode:i=t}=globalThis;return Boolean(r)&&i.includes(e)}function Y4e(e){switch(e){case"image/avif":case"image/webp":return X4e(e);default:return!0}}function X4e(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var pg="4.0.0-alpha.17";var xZ="4.0.0-alpha.17",$4e=`https://unpkg.com/@loaders.gl/textures@${xZ}/dist/libs/basis_encoder.wasm`,J4e=`https://unpkg.com/@loaders.gl/textures@${xZ}/dist/libs/basis_encoder.js`,bO;async function _O(e){let t=e.modules||{};return t.basis?t.basis:(bO=bO||Q4e(e),await bO)}async function Q4e(e){let t=null,r=null;return[t,r]=await Promise.all([await Wu("basis_transcoder.js","textures",e),await Wu("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await Z4e(t,r)}function Z4e(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(i=>{e(r).then(n=>{let{BasisFile:a,initializeBasis:o}=n;o(),i({BasisFile:a})})})}var xO;async function wO(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(xO=xO||e5e(e),await xO)}async function e5e(e){let t=null,r=null;return[t,r]=await Promise.all([await Wu(J4e,"textures",e),await Wu($4e,"textures",e)]),t=t||globalThis.BASIS,await t5e(t,r)}function t5e(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(i=>{e(r).then(n=>{let{BasisFile:a,KTX2File:o,initializeBasis:s,BasisEncoder:u}=n;s(),i({BasisFile:a,KTX2File:o,BasisEncoder:u})})})}var Se={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var r5e=["","WEBKIT_","MOZ_"],wZ={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},_S=null;function rb(e){if(!_S){e=e||i5e()||void 0,_S=new Set;for(let t of r5e)for(let r in wZ)if(e&&e.getExtension(`${t}${r}`)){let i=wZ[r];_S.add(i)}}return _S}function i5e(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var FZ=Fe(BZ());function mg(e,t){let r=new Array(t.mipMapLevels),i=t.width,n=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){let s=o5e(t,i,n,e,o),u=a5e(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:i,height:n,levelSize:s},i=Math.max(1,i>>1),n=Math.max(1,n>>1),a+=s}return r}function a5e(e,t,r,i){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,i)}function o5e(e,t,r,i,n){return Array.isArray(i)?e.sizeFunction(i[n]):e.sizeFunction(t,r)}var s5e={131:Se.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Se.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Se.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Se.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Se.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Se.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Se.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Se.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Se.COMPRESSED_RED_RGTC1_EXT,140:Se.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Se.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Se.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Se.COMPRESSED_RGB8_ETC2,148:Se.COMPRESSED_SRGB8_ETC2,149:Se.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Se.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Se.COMPRESSED_RGBA8_ETC2_EAC,152:Se.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Se.COMPRESSED_R11_EAC,154:Se.COMPRESSED_SIGNED_R11_EAC,155:Se.COMPRESSED_RG11_EAC,156:Se.COMPRESSED_SIGNED_RG11_EAC,157:Se.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Se.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Se.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Se.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Se.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Se.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Se.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Se.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Se.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Se.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Se.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Se.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Se.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Se.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Se.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Se.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Se.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Se.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Se.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Se.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Se.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Se.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Se.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Se.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Se.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Se.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Se.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Se.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Se.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Se.COMPRESSED_RGBA_ASTC_12x12_KHR};function OZ(e){return s5e[e]}var Ao=[171,75,84,88,32,50,48,187,13,10,26,10];function TS(e){let t=new Uint8Array(e);return!(t.byteLength<Ao.length||t[0]!==Ao[0]||t[1]!==Ao[1]||t[2]!==Ao[2]||t[3]!==Ao[3]||t[4]!==Ao[4]||t[5]!==Ao[5]||t[6]!==Ao[6]||t[7]!==Ao[7]||t[8]!==Ao[8]||t[9]!==Ao[9]||t[10]!==Ao[10]||t[11]!==Ao[11])}function DZ(e){let t=new Uint8Array(e),r=(0,FZ.read)(t),i=Math.max(1,r.levels.length),n=r.pixelWidth,a=r.pixelHeight,o=OZ(r.vkFormat);return mg(r.levels,{mipMapLevels:i,width:n,height:a,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var u5e={etc1:{basisFormat:0,compressed:!0,format:Se.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Se.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Se.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Se.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Se.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Se.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function nb(e,t){if(t.basis.containerFormat==="auto"){if(TS(e)){let i=await wO(t);return MZ(i.KTX2File,e,t)}let{BasisFile:r}=await _O(t);return kO(r,e,t)}switch(t.basis.module){case"encoder":let r=await wO(t);switch(t.basis.containerFormat){case"ktx2":return MZ(r.KTX2File,e,t);case"basis":default:return kO(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:i}=await _O(t);return kO(i,e,t)}}function kO(e,t,r){let i=new e(new Uint8Array(t));try{if(!i.startTranscoding())throw new Error("Failed to start basis transcoding");let n=i.getNumImages(),a=[];for(let o=0;o<n;o++){let s=i.getNumLevels(o),u=[];for(let l=0;l<s;l++)u.push(l5e(i,o,l,r));a.push(u)}return a}finally{i.close(),i.delete()}}function l5e(e,t,r,i){let n=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:l}=LZ(i,o),c=e.getImageTranscodedSizeInBytes(t,r,l),f=new Uint8Array(c);if(!e.transcodeImage(f,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:n,height:a,data:f,compressed:s,format:u,hasAlpha:o}}function MZ(e,t,r){let i=new e(new Uint8Array(t));try{if(!i.startTranscoding())throw new Error("failed to start KTX2 transcoding");let n=i.getLevels(),a=[];for(let o=0;o<n;o++){a.push(c5e(i,o,r));break}return[a]}finally{i.close(),i.delete()}}function c5e(e,t,r){let{alphaFlag:i,height:n,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=LZ(r,i),l=e.getImageTranscodedSizeInBytes(t,0,0,u),c=new Uint8Array(l);if(!e.transcodeImage(c,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:n,data:c,compressed:o,levelSize:l,hasAlpha:i,format:s}}function LZ(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=gg()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),u5e[r]}function gg(){let e=rb();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var jZ={name:"Basis",id:"basis",module:"textures",version:pg,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},Rd=Ye(ne({},jZ),{parse:nb});var ko={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},f5e={DXT1:Se.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Se.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Se.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Se.COMPRESSED_RGB_ATC_WEBGL,ATCA:Se.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Se.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},h5e=UZ,d5e=AS,p5e=AS,m5e={DXT1:UZ,DXT3:AS,DXT5:AS,"ATC ":h5e,ATCA:d5e,ATCI:p5e};function NZ(e){return new Uint32Array(e,0,ko.HEADER_LENGTH)[ko.MAGIC_NUMBER_INDEX]===ko.MAGIC_NUMBER}function qZ(e){let t=new Int32Array(e,0,ko.HEADER_LENGTH),r=t[ko.HEADER_PF_FOURCC_INDEX];Ft(Boolean(t[ko.HEADER_PF_FLAGS_INDEX]&ko.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let i=g5e(r),n=f5e[i],a=m5e[i];Ft(n&&a,`DDS: Unknown pixel format ${r}`);let o=1;t[ko.HEADER_FLAGS_INDEX]&ko.DDSD_MIPMAPCOUNT&&(o=Math.max(1,t[ko.MIPMAPCOUNT_INDEX]));let s=t[ko.HEADER_WIDTH_INDEX],u=t[ko.HEADER_HEIGHT_INDEX],l=t[ko.HEADER_SIZE_INDEX]+4,c=new Uint8Array(e,l);return mg(c,{mipMapLevels:o,width:s,height:u,sizeFunction:a,internalFormat:n})}function UZ(e,t){return(e+3>>2)*(t+3>>2)*8}function AS(e,t){return(e+3>>2)*(t+3>>2)*16}function g5e(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var us={MAGIC_NUMBER:55727696,MAGIC_NUMBER_EXTRA:1347834371,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,COLOUR_SPACE_INDEX:4,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12},v5e={0:[Se.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Se.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Se.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Se.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Se.COMPRESSED_RGB_ETC1_WEBGL],7:[Se.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Se.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Se.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Se.COMPRESSED_RGB8_ETC2],23:[Se.COMPRESSED_RGBA8_ETC2_EAC],24:[Se.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Se.COMPRESSED_R11_EAC],26:[Se.COMPRESSED_RG11_EAC],27:[Se.COMPRESSED_RGBA_ASTC_4X4_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Se.COMPRESSED_RGBA_ASTC_5X4_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Se.COMPRESSED_RGBA_ASTC_5X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Se.COMPRESSED_RGBA_ASTC_6X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Se.COMPRESSED_RGBA_ASTC_6X6_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Se.COMPRESSED_RGBA_ASTC_8X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Se.COMPRESSED_RGBA_ASTC_8X6_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Se.COMPRESSED_RGBA_ASTC_8X8_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Se.COMPRESSED_RGBA_ASTC_10X5_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Se.COMPRESSED_RGBA_ASTC_10X6_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Se.COMPRESSED_RGBA_ASTC_10X8_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Se.COMPRESSED_RGBA_ASTC_10X10_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Se.COMPRESSED_RGBA_ASTC_12X10_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Se.COMPRESSED_RGBA_ASTC_12X12_KHR,Se.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},y5e={0:HZ,1:HZ,2:WZ,3:WZ,6:ab,7:ab,9:ob,11:ob,22:ab,23:ob,24:ab,25:ab,26:ob,27:ob,28:b5e,29:_5e,30:x5e,31:w5e,32:E5e,33:S5e,34:T5e,35:A5e,36:k5e,37:R5e,38:C5e,39:I5e,40:P5e};function GZ(e){let r=new Uint32Array(e,0,us.HEADER_LENGTH)[us.MAGIC_NUMBER_INDEX];return r===us.MAGIC_NUMBER||r===us.MAGIC_NUMBER_EXTRA}function zZ(e){let t=new Uint32Array(e,0,us.HEADER_LENGTH),r=t[us.PIXEL_FORMAT_INDEX],i=t[us.COLOUR_SPACE_INDEX],n=v5e[r]||[],a=n.length>1&&i?n[1]:n[0],o=y5e[r],s=t[us.MIPMAPCOUNT_INDEX],u=t[us.WIDTH_INDEX],l=t[us.HEIGHT_INDEX],c=us.HEADER_SIZE+t[us.METADATA_SIZE_INDEX],f=new Uint8Array(e,c);return mg(f,{mipMapLevels:s,width:u,height:l,sizeFunction:o,internalFormat:a})}function HZ(e,t){return e=Math.max(e,16),t=Math.max(t,8),e*t/4}function WZ(e,t){return e=Math.max(e,8),t=Math.max(t,8),e*t/2}function ab(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function ob(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function b5e(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16}function _5e(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16}function x5e(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16}function w5e(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16}function E5e(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16}function S5e(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16}function T5e(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16}function A5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16}function k5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16}function R5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16}function C5e(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16}function I5e(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16}function P5e(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}function VZ(e){if(TS(e))return DZ(e);if(NZ(e))return qZ(e);if(GZ(e))return zZ(e);throw new Error("Texture container format not recognized")}var B5e={"compressed-texture":{libraryPath:"libs/",useBasis:!1}},KZ={name:"Texture Containers",id:"compressed-texture",module:"textures",version:pg,worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:B5e},kS=Ye(ne({},KZ),{parse:async(e,t)=>t["compressed-texture"].useBasis?(t.basis=Ye(ne({format:{alpha:"BC3",noAlpha:"BC1"}},t.basis),{containerFormat:"ktx2",module:"encoder"}),(await nb(e,t))[0]):VZ(e)});var RS={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:pg,extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}};function jn(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var vg=!0,YZ=1735152710,RO=12,CS=8,O5e=1313821514,F5e=5130562,D5e=0,M5e=0,L5e=1;function j5e(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function XZ(e,t=0,r={}){let i=new DataView(e),{magic:n=YZ}=r,a=i.getUint32(t,!1);return a===n||a===YZ}function $Z(e,t,r=0,i={}){let n=new DataView(t),a=j5e(n,r+0),o=n.getUint32(r+4,vg),s=n.getUint32(r+8,vg);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=RO,e.version){case 1:return N5e(e,n,r);case 2:return q5e(e,n,r,i={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function N5e(e,t,r){Ft(e.header.byteLength>RO+CS);let i=t.getUint32(r+0,vg),n=t.getUint32(r+4,vg);return r+=CS,Ft(n===D5e),CO(e,t,r,i),r+=i,r+=IO(e,t,r,e.header.byteLength),r}function q5e(e,t,r,i){return Ft(e.header.byteLength>RO+CS),U5e(e,t,r,i),r+e.header.byteLength}function U5e(e,t,r,i){for(;r+8<=e.header.byteLength;){let n=t.getUint32(r+0,vg),a=t.getUint32(r+4,vg);switch(r+=CS,a){case O5e:CO(e,t,r,n);break;case F5e:IO(e,t,r,n);break;case M5e:i.strict||CO(e,t,r,n);break;case L5e:i.strict||IO(e,t,r,n);break;default:break}r+=xo(n,4)}return r}function CO(e,t,r,i){let n=new Uint8Array(t.buffer,r,i),o=new TextDecoder("utf8").decode(n);return e.json=JSON.parse(o),xo(i,4)}function IO(e,t,r,i){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:i,arrayBuffer:t.buffer}),xo(i,4)}function PO(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let i=t.baseUri||t.uri;if(!i)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return i.substr(0,i.lastIndexOf("/")+1)+e}function JZ(e,t,r){let i=e.bufferViews[r];jn(i);let n=i.buffer,a=t[n];jn(a);let o=(i.byteOffset||0)+a.byteOffset;return new Uint8Array(a.arrayBuffer,o,i.byteLength)}var OO={};mo(OO,{decode:()=>oNe,name:()=>aNe});var G5e=1.33,QZ=["SCALAR","VEC2","VEC3","VEC4"],z5e=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],H5e=new Map(z5e),W5e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},V5e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},K5e={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function IS(e){return QZ[e-1]||QZ[0]}function yg(e){let t=H5e.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function bg(e,t){let r=K5e[e.componentType],i=W5e[e.type],n=V5e[e.componentType],a=e.count*i,o=e.count*i*n;return jn(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function sb(e){let{images:t,bufferViews:r}=e;t=t||[],r=r||[];let i=t.map(o=>o.bufferView);r=r.filter(o=>!i.includes(o));let n=r.reduce((o,s)=>o+s.byteLength,0),a=t.reduce((o,s)=>{let{width:u,height:l}=s.image;return o+u*l},0);return n+Math.ceil(4*a*G5e)}function Y5e(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var ci=class{constructor(t){this.gltf={json:(t==null?void 0:t.json)||Y5e(),buffers:(t==null?void 0:t.buffers)||[],images:(t==null?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let r=this.getUsedExtensions().find(n=>n===t),i=this.getRequiredExtensions().find(n=>n===t);return typeof r=="string"||typeof i=="string"}getExtension(t){let r=this.getUsedExtensions().find(n=>n===t),i=this.json.extensions||{};return r?i[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(i=>i===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,r){return(t.extensions||{})[r]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,r){if(typeof r=="object")return r;let i=this.json[t]&&this.json[t][r];if(!i)throw new Error(`glTF file error: Could not find ${t}[${r}]`);return i}getTypedArrayForBufferView(t){t=this.getBufferView(t);let r=t.buffer,i=this.gltf.buffers[r];jn(i);let n=(t.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,n,t.byteLength)}getTypedArrayForAccessor(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),n=this.getBuffer(r.buffer).data,{ArrayType:a,length:o}=bg(t,r),s=r.byteOffset+t.byteOffset;return new a(n,s,o)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),n=this.getBuffer(r.buffer).data,a=r.byteOffset||0;return new Uint8Array(n,a,r.byteLength)}addApplicationData(t,r){return this.json[t]=r,this}addExtraData(t,r){return this.json.extras=this.json.extras||{},this.json.extras[t]=r,this}addObjectExtension(t,r,i){return t.extensions=t.extensions||{},t.extensions[r]=i,this.registerUsedExtension(r),this}setObjectExtension(t,r,i){let n=t.extensions||{};n[r]=i}removeObjectExtension(t,r){let i=(t==null?void 0:t.extensions)||{};if(i[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(r)||n.push(r)}delete i[r]}addExtension(t,r={}){return jn(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return jn(r),this.addExtension(t,r),this.registerRequiredExtension(t),r}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var r;if((r=this.json.extensions)==null?void 0:r[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let i=this.json.extensionsRemoved;i.includes(t)||i.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:r}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(t){let{meshIndex:r,matrix:i}=t;this.json.nodes=this.json.nodes||[];let n={mesh:r};return i&&(n.matrix=i),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:i,material:n,mode:a=4}=t,s={primitives:[{attributes:this._addAttributes(r),mode:a}]};if(i){let u=this._addIndices(i);s.primitives[0].indices=u}return Number.isFinite(n)&&(s.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){let i={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),this.json.meshes.length-1}addImage(t,r){let i=kd(t),n=r||(i==null?void 0:i.mimeType),o={bufferView:this.addBufferView(t),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t,r=0,i=this.byteLength){let n=t.byteLength;jn(Number.isFinite(n)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let a={buffer:r,byteOffset:i,byteLength:n};return this.byteLength+=xo(n,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(a),this.json.bufferViews.length-1}addAccessor(t,r){let i={bufferView:t,type:IS(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}addBinaryBuffer(t,r={size:3}){let i=this.addBufferView(t),n={min:r.min,max:r.max};(!n.min||!n.max)&&(n=this._getAccessorMinMax(t,r.size));let a={size:r.size,componentType:yg(t),count:Math.round(t.length/r.size),min:n.min,max:n.max};return this.addAccessor(i,Object.assign(a,r))}addTexture(t){let{imageIndex:r}=t,i={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(i),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var a,o;this.gltf.buffers=[];let t=this.byteLength,r=new ArrayBuffer(t),i=new Uint8Array(r),n=0;for(let s of this.sourceBuffers||[])n=aP(s,i,n);((o=(a=this.json)==null?void 0:a.buffers)==null?void 0:o[0])?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,r){let i=!0;for(;i;){let n=t.indexOf(r);n>-1?t.splice(n,1):i=!1}}_addAttributes(t={}){let r={};for(let i in t){let n=t[i],a=this._getGltfAttributeName(i),o=this.addBinaryBuffer(n.value,n);r[a]=o}return r}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,r){let i={min:null,max:null};if(t.length<r)return i;i.min=[],i.max=[];let n=t.subarray(0,r);for(let a of n)i.min.push(a),i.max.push(a);for(let a=r;a<t.length;a+=r)for(let o=0;o<r;o++)i.min[0+o]=Math.min(i.min[0+o],t[a+o]),i.max[0+o]=Math.max(i.max[0+o],t[a+o]);return i}};var X5e="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",$5e="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",J5e=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]),Q5e=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Z5e={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},eNe={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function ZZ(e,t,r,i,n,a="NONE"){let o=await tNe();nNe(o,o.exports[eNe[n]],e,t,r,i,o.exports[Z5e[a||"NONE"]])}var BO;async function tNe(){return BO||(BO=rNe()),BO}async function rNe(){let e=X5e;WebAssembly.validate(J5e)&&(e=$5e,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(iNe(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function iNe(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;++i){let n=e.charCodeAt(i);t[i]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i<e.length;++i)t[r++]=t[i]<60?Q5e[t[i]]:(t[i]-60)*64+t[++i];return t.buffer.slice(0,r)}function nNe(e,t,r,i,n,a,o){let s=e.exports.sbrk,u=i+3&~3,l=s(u*n),c=s(a.length),f=new Uint8Array(e.exports.memory.buffer);f.set(a,c);let h=t(l,i,n,c,a.length);if(h===0&&o&&o(l,u,n),r.set(f.subarray(l,l+i*n)),s(l-s(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var PS="EXT_meshopt_compression",aNe=PS;async function oNe(e,t){var n;let r=new ci(e);if(!((n=t==null?void 0:t.gltf)==null?void 0:n.decompressMeshes))return;let i=[];for(let a of e.json.bufferViews||[])i.push(sNe(r,a));await Promise.all(i),r.removeExtension(PS)}async function sNe(e,t){let r=e.getObjectExtension(t,PS);if(r){let{byteOffset:i=0,byteLength:n=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:l}=r,c=e.gltf.buffers[l],f=new Uint8Array(c.arrayBuffer,c.byteOffset+i,n),h=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await ZZ(h,o,a,f,s,u),e.removeObjectExtension(t,PS)}}var FO={};mo(FO,{name:()=>uNe,preprocess:()=>lNe});var _g="EXT_texture_webp",uNe=_g;function lNe(e,t){let r=new ci(e);if(!yO("image/webp")){if(r.getRequiredExtensions().includes(_g))throw new Error(`gltf: Required extension ${_g} not supported by browser`);return}let{json:i}=r;for(let n of i.textures||[]){let a=r.getObjectExtension(n,_g);a&&(n.source=a.source),r.removeObjectExtension(n,_g)}r.removeExtension(_g)}var DO={};mo(DO,{name:()=>cNe,preprocess:()=>fNe});var BS="KHR_texture_basisu",cNe=BS;function fNe(e,t){let r=new ci(e),{json:i}=r;for(let n of i.textures||[]){let a=r.getObjectExtension(n,BS);a&&(n.source=a.source,r.removeObjectExtension(n,BS))}r.removeExtension(BS)}var LO={};mo(LO,{decode:()=>gNe,encode:()=>vNe,name:()=>pNe,preprocess:()=>mNe});function eee(e){let t={};for(let r in e){let i=e[r];if(r!=="indices"){let n=MO(i);t[r]=n}}return t}function MO(e){let{buffer:t,size:r,count:i}=hNe(e);return{value:t,size:r,byteOffset:0,count:i,type:IS(r),componentType:yg(t)}}function hNe(e){let t=e,r=1,i=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=dNe(t,Float32Array)),i=t.length/r),{buffer:t,size:r,count:i}}function dNe(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var Uf="KHR_draco_mesh_compression",pNe=Uf;function mNe(e,t,r){let i=new ci(e);for(let n of tee(i))i.getObjectExtension(n,Uf)}async function gNe(e,t,r){var a;if(!((a=t==null?void 0:t.gltf)==null?void 0:a.decompressMeshes))return;let i=new ci(e),n=[];for(let o of tee(i))i.getObjectExtension(o,Uf)&&n.push(yNe(i,o,t,r));await Promise.all(n),i.removeExtension(Uf)}function vNe(e,t={}){let r=new ci(e);for(let i of r.json.meshes||[])bNe(i,t),r.addRequiredExtension(Uf)}async function yNe(e,t,r,i){let n=e.getObjectExtension(t,Uf);if(!n)return;let a=e.getTypedArrayForBufferView(n.bufferView),o=fd(a.buffer,a.byteOffset),{parse:s}=i,u=ne({},r);delete u["3d-tiles"];let l=await s(o,og,u,i),c=eee(l.attributes);for(let[f,h]of Object.entries(c))if(f in t.attributes){let d=t.attributes[f],p=e.getAccessor(d);(p==null?void 0:p.min)&&(p==null?void 0:p.max)&&(h.min=p.min,h.max=p.max)}t.attributes=c,l.indices&&(t.indices=MO(l.indices)),e.removeObjectExtension(t,Uf),_Ne(t)}function bNe(e,t,r=4,i,n){var c;if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let a=i.DracoWriter.encodeSync({attributes:e}),o=(c=n==null?void 0:n.parseSync)==null?void 0:c.call(n,{attributes:e}),s=i._addFauxAttributes(o.attributes),u=i.addBufferView(a);return{primitives:[{attributes:s,mode:r,extensions:{[Uf]:{bufferView:u,attributes:s}}}]}}function _Ne(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*tee(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var NO={};mo(NO,{decode:()=>SNe,name:()=>xNe});var xg=Fe(fr());var ree={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},iee={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var jO="KHR_texture_transform",xNe=jO,OS=new xg.Vector3,wNe=new xg.Matrix3,ENe=new xg.Matrix3;async function SNe(e,t){if(!new ci(e).hasExtension(jO))return;let n=e.json.materials||[];for(let a=0;a<n.length;a++)TNe(a,e)}function TNe(e,t){var l,c,f;let r=[],i=(l=t.json.materials)==null?void 0:l[e],n=(c=i==null?void 0:i.pbrMetallicRoughness)==null?void 0:c.baseColorTexture;n&&ub(t,e,n,r);let a=i==null?void 0:i.emissiveTexture;a&&ub(t,e,a,r);let o=i==null?void 0:i.normalTexture;o&&ub(t,e,o,r);let s=i==null?void 0:i.occlusionTexture;s&&ub(t,e,s,r);let u=(f=i==null?void 0:i.pbrMetallicRoughness)==null?void 0:f.metallicRoughnessTexture;u&&ub(t,e,u,r)}function ub(e,t,r,i){let n=ANe(r,i);if(!n)return;let a=e.json.meshes||[];for(let o of a)for(let s of o.primitives){let u=s.material;Number.isFinite(u)&&t===u&&kNe(e,s,n)}}function ANe(e,t){var o;let r=(o=e.extensions)==null?void 0:o[jO],{texCoord:i=0}=e,{texCoord:n=i}=r;if(!(t.findIndex(([s,u])=>s===i&&u===n)!==-1)){let s=INe(r);return i!==n&&(e.texCoord=n),t.push([i,n]),{originalTexCoord:i,texCoord:n,matrix:s}}return null}function kNe(e,t,r){var s,u;let{originalTexCoord:i,texCoord:n,matrix:a}=r,o=t.attributes[`TEXCOORD_${i}`];if(Number.isFinite(o)){let l=(s=e.json.accessors)==null?void 0:s[o];if(l&&l.bufferView){let c=(u=e.json.bufferViews)==null?void 0:u[l.bufferView];if(c){let{arrayBuffer:f,byteOffset:h}=e.buffers[c.buffer],d=(h||0)+(l.byteOffset||0)+(c.byteOffset||0),{ArrayType:p,length:y}=bg(l,c),g=iee[l.componentType],b=ree[l.type],E=c.byteStride||g*b,A=new Float32Array(y);for(let k=0;k<l.count;k++){let R=new p(f,d+k*E,2);OS.set(R[0],R[1],1),OS.transformByMatrix3(a),A.set([OS[0],OS[1]],k*b)}i===n?RNe(l,c,e.buffers,A):CNe(n,l,t,e,A)}}}}function RNe(e,t,r,i){e.componentType=5126,r.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=i.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function CNe(e,t,r,i,n){i.buffers.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength});let a=i.json.bufferViews;if(!a)return;a.push({buffer:i.buffers.length-1,byteLength:n.buffer.byteLength,byteOffset:0});let o=i.json.accessors;!o||(o.push({bufferView:(a==null?void 0:a.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=o.length-1)}function INe(e){let{offset:t=[0,0],rotation:r=0,scale:i=[1,1]}=e,n=new xg.Matrix3().set(1,0,0,0,1,0,t[0],t[1],1),a=wNe.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=ENe.set(i[0],0,0,0,i[1],0,0,0,1);return n.multiplyRight(a).multiplyRight(o)}var qO={};mo(qO,{decode:()=>BNe,encode:()=>ONe,name:()=>PNe});var Cd="KHR_lights_punctual",PNe=Cd;async function BNe(e){let t=new ci(e),{json:r}=t,i=t.getExtension(Cd);i&&(t.json.lights=i.lights,t.removeExtension(Cd));for(let n of r.nodes||[]){let a=t.getObjectExtension(n,Cd);a&&(n.light=a.light),t.removeObjectExtension(n,Cd)}}async function ONe(e){let t=new ci(e),{json:r}=t;if(r.lights){let i=t.addExtension(Cd);jn(!i.lights),i.lights=r.lights,delete r.lights}if(t.json.lights){for(let i of t.json.lights){let n=i.node;t.addObjectExtension(n,Cd,i)}delete t.json.lights}}var UO={};mo(UO,{decode:()=>DNe,encode:()=>MNe,name:()=>FNe});var lb="KHR_materials_unlit",FNe=lb;async function DNe(e){let t=new ci(e),{json:r}=t;for(let i of r.materials||[])i.extensions&&i.extensions.KHR_materials_unlit&&(i.unlit=!0),t.removeObjectExtension(i,lb);t.removeExtension(lb)}function MNe(e){let t=new ci(e),{json:r}=t;if(t.materials)for(let i of r.materials||[])i.unlit&&(delete i.unlit,t.addObjectExtension(i,lb,{}),t.addExtension(lb))}var GO={};mo(GO,{decode:()=>jNe,encode:()=>NNe,name:()=>LNe});var cb="KHR_techniques_webgl",LNe=cb;async function jNe(e){let t=new ci(e),{json:r}=t,i=t.getExtension(cb);if(i){let n=qNe(i,t);for(let a of r.materials||[]){let o=t.getObjectExtension(a,cb);o&&(a.technique=Object.assign({},o,n[o.technique]),a.technique.values=UNe(a.technique,t)),t.removeObjectExtension(a,cb)}t.removeExtension(cb)}}async function NNe(e,t){}function qNe(e,t){let{programs:r=[],shaders:i=[],techniques:n=[]}=e,a=new TextDecoder;return i.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=a.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(o=>{o.fragmentShader=i[o.fragmentShader],o.vertexShader=i[o.vertexShader]}),n.forEach(o=>{o.program=r[o.program]}),n}function UNe(e,t){let r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(i=>{e.uniforms[i].value&&!(i in r)&&(r[i]=e.uniforms[i].value)}),Object.keys(r).forEach(i=>{typeof r[i]=="object"&&r[i].index!==void 0&&(r[i].texture=t.getTexture(r[i].index))}),r}var zO={};mo(zO,{decode:()=>zNe,name:()=>GNe});var nee="EXT_feature_metadata",GNe=nee;async function zNe(e,t){let r=new ci(e);HNe(r,t)}function HNe(e,t){var o,s;let r=e.getExtension(nee);if(!r)return;let i=(o=r.schema)==null?void 0:o.classes,{featureTables:n}=r;if(i&&n)for(let u in i){let l=i[u],c=ZNe(n,u);c&&WNe(e,c,l)}let{featureTextures:a}=r;if(i&&a&&((s=t.gltf)==null?void 0:s.loadImages))for(let u in i){let l=i[u],c=e9e(a,u);c&&VNe(e,c,l)}}function WNe(e,t,r){var i;for(let n in r.properties){let a=r.properties[n],o=(i=t==null?void 0:t.properties)==null?void 0:i[n],s=t.count;if(o){let u=KNe(e,a,s,o);o.data=u}}}function VNe(e,t,r){var n;let i=t.class;for(let a in r.properties){let o=(n=t==null?void 0:t.properties)==null?void 0:n[a];if(o){let s=YNe(e,o,i);o.data=s}}}function KNe(e,t,r,i){let n=i.bufferView,a=e.getTypedArrayForBufferView(n);switch(t.type){case"STRING":{let o=i.stringOffsetBufferView,s=e.getTypedArrayForBufferView(o);return t9e(a,s,r)}default:}return a}function YNe(e,t,r){let i=e.gltf.json;if(!i.meshes)return[];let n=[];for(let a of i.meshes)for(let o of a.primitives)XNe(e,r,t,n,o);return n}function XNe(e,t,r,i,n){var k,R,F;let a=e.gltf.json,o=[],s=`TEXCOORD_${r.texture.texCoord}`,u=n.attributes[s],l=e.getBufferView(u),c=e.getTypedArrayForBufferView(l),f=new Float32Array(c.buffer,c.byteOffset,c.length/4),h=r.texture.index,d=(k=a.textures)==null?void 0:k[h],p=d==null?void 0:d.source;if(typeof p!="undefined"){let C=(R=a.images)==null?void 0:R[p],j=C==null?void 0:C.mimeType,O=(F=e.gltf.images)==null?void 0:F[p];if(O)for(let W=0;W<f.length;W+=2){let N=$Ne(O,j,f,W,r.channels);o.push(N)}}let y=[];for(let C of o){let j=i.findIndex(O=>O===C);j===-1&&(j=i.push(C)-1),y.push(j)}let g=new Uint32Array(y),b=e.gltf.buffers.push({arrayBuffer:g.buffer,byteOffset:0,byteLength:g.byteLength})-1,E=e.addBufferView(g,b,0),A=e.addAccessor(E,{size:1,componentType:yg(g),count:g.length});n.attributes[t]=A}function $Ne(e,t,r,i,n){let a={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=r[i],s=r[i+1],u=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(u=4);let l=QNe(o,s,e,u),c=0;for(let f of n){let h=a[f];c|=JNe(e,l+h.offset)<<h.shift}return c}function JNe(e,t){let r=hg(e);if(r.data.length<=t)throw new Error(`${r.data.length} <= ${t}`);return r.data[t]}function QNe(e,t,r,i=1){let n=r.width,a=aee(e)*(n-1),o=Math.round(a),s=r.height,u=aee(t)*(s-1),l=Math.round(u),c=r.components?r.components:i;return(l*n+o)*c}function aee(e){return(e%1+1)%1}function ZNe(e,t){for(let r in e){let i=e[r];if(i.class===t)return i}return null}function e9e(e,t){for(let r in e){let i=e[r];if(i.class===t)return i}return null}function t9e(e,t,r){let i=[],n=new TextDecoder("utf8"),a=0,o=4;for(let s=0;s<r;s++){let u=t[(s+1)*o]-t[s*o],l=e.subarray(a,u+a),c=n.decode(l);i.push(c),a+=u}return i}var oee=[OO,FO,DO,LO,qO,UO,GO,NO,zO];function see(e,t={},r){var n;let i=oee.filter(a=>lee(a.name,t));for(let a of i)(n=a.preprocess)==null||n.call(a,e,t,r)}async function uee(e,t={},r){var n;let i=oee.filter(a=>lee(a.name,t));for(let a of i)await((n=a.decode)==null?void 0:n.call(a,e,t,r))}function lee(e,t){var n;let r=((n=t==null?void 0:t.gltf)==null?void 0:n.excludeExtensions)||{};return!(e in r&&!r[e])}var HO="KHR_binary_glTF";function cee(e){let t=new ci(e),{json:r}=t;for(let i of r.images||[]){let n=t.getObjectExtension(i,HO);n&&Object.assign(i,n),t.removeObjectExtension(i,HO)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(HO)}var fee={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},r9e={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},hee=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}}normalize(t,r){this.json=t.json;let i=t.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${i.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(i),this._convertTopLevelObjectsToArrays(i),cee(t),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let r in fee)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let i=t[r];if(!(!i||Array.isArray(i))){t[r]=[];for(let n in i){let a=i[n];a.id=a.id||n;let o=t[r].length;t[r].push(a),this.idToIndexMap[r][n]=o}}}_convertObjectIdsToArrayIndices(t){for(let r in fee)this._convertIdsToIndices(t,r);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let r of t.textures)this._convertTextureIds(r);for(let r of t.meshes)this._convertMeshIds(r);for(let r of t.nodes)this._convertNodeIds(r);for(let r of t.scenes)this._convertSceneIds(r)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let r of t.primitives){let{attributes:i,indices:n,material:a}=r;for(let o in i)i[o]=this._convertIdToIndex(i[o],"accessor");n&&(r.indices=this._convertIdToIndex(n,"accessor")),a&&(r.material=this._convertIdToIndex(a,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(r=>this._convertIdToIndex(r,"node"))),t.meshes&&(t.meshes=t.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(t,r){t[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),t[r]=[]);for(let i of t[r])for(let n in i){let a=i[n],o=this._convertIdToIndex(a,n);i[n]=o}}_convertIdToIndex(t,r){let i=r9e[r];if(i in this.idToIndexMap){let n=this.idToIndexMap[i][t];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return n}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){var r,i,n;for(let a of t.materials){a.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=a.values)==null?void 0:r.tex)||((i=a.values)==null?void 0:i.texture2d_0)||((n=a.values)==null?void 0:n.diffuseTex),s=t.textures.findIndex(u=>u.id===o);s!==-1&&(a.pbrMetallicRoughness.baseColorTexture={index:s})}}};function dee(e,t={}){return new hee().normalize(e,t)}async function pee(e,t,r=0,i,n){var a,o,s;return i9e(e,t,r,i),dee(e,{normalize:(a=i==null?void 0:i.gltf)==null?void 0:a.normalize}),see(e,i,n),((o=i==null?void 0:i.gltf)==null?void 0:o.loadBuffers)&&e.json.buffers&&await n9e(e,i,n),((s=i==null?void 0:i.gltf)==null?void 0:s.loadImages)&&await a9e(e,i,n),await uee(e,i,n),e}function i9e(e,t,r,i){if(i.uri&&(e.baseUri=i.uri),t instanceof ArrayBuffer&&!XZ(t,r,i)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=iP(t);else if(t instanceof ArrayBuffer){let o={};r=$Z(o,t,r,i.glb),jn(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else jn(!1,"GLTF: must be ArrayBuffer or string");let n=e.json.buffers||[];if(e.buffers=new Array(n.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let a=e.json.images||[];e.images=new Array(a.length).fill({})}async function n9e(e,t,r){var n,a;let i=e.json.buffers||[];for(let o=0;o<i.length;++o){let s=i[o];if(s.uri){let{fetch:u}=r;jn(u);let l=PO(s.uri,t),c=await((n=r==null?void 0:r.fetch)==null?void 0:n.call(r,l)),f=await((a=c==null?void 0:c.arrayBuffer)==null?void 0:a.call(c));e.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete s.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}async function a9e(e,t,r){let i=o9e(e),n=e.json.images||[],a=[];for(let o of i)a.push(s9e(e,n[o],o,t,r));return await Promise.all(a)}function o9e(e){let t=new Set,r=e.json.textures||[];for(let i of r)i.source!==void 0&&t.add(i.source);return Array.from(t).sort()}async function s9e(e,t,r,i,n){let{fetch:a,parse:o}=n,s;if(t.uri&&!t.hasOwnProperty("bufferView")){let l=PO(t.uri,i);s=await(await a(l)).arrayBuffer(),t.bufferView={data:s}}if(Number.isFinite(t.bufferView)){let l=JZ(e.json,e.buffers,t.bufferView);s=fd(l.buffer,l.byteOffset,l.byteLength)}jn(s,"glTF image has no data");let u=await o(s,[dg,Rd],{mimeType:t.mimeType,basis:i.basis||{format:gg()}},n);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}var dc={name:"glTF",id:"gltf",module:"gltf",version:vS,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:u9e,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes",postProcess:"removed in v4"}}};async function u9e(e,t={},r){t=ne(ne({},dc.options),t),t.gltf=ne(ne({},dc.options.gltf),t.gltf);let{byteOffset:i=0}=t;return await pee({},e,i,t,r)}var l9e=1179937895,c9e=1313821514,f9e=5130562,ol=!0;function mee(e,t,r=0,i={}){let{magic:n=l9e,version:a=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,n,ol),t.setUint32(r+4,a,ol),t.setUint32(r+8,0,ol));let l=r+8;r+=12;let c=r;t&&(t.setUint32(r+0,0,ol),t.setUint32(r+4,c9e,ol)),r+=8;let f=JSON.stringify(o);if(r=Im(t,r,f,4),t){let h=r-c-8;t.setUint32(c+0,h,ol)}if(s){let h=r;if(t&&(t.setUint32(r+0,0,ol),t.setUint32(r+4,f9e,ol)),r+=8,r=Mw(t,r,s,4),t){let d=r-h-8;t.setUint32(h+0,d,ol)}}if(t){let h=r-u;t.setUint32(l,h,ol)}return r}function WO(e,t,r,i){return h9e(e),mee(e,t,r,i)}function h9e(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}var VO={name:"glTF",id:"gltf",module:"gltf",version:vS,extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:d9e,options:{gltf:{}}};function d9e(e,t={}){let{byteOffset:r=0}=t,i=WO(e,null,r,t),n=new ArrayBuffer(i),a=new DataView(n);return WO(e,a,r,t),n}var p9e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},m9e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ls={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},g9e={magFilter:ls.TEXTURE_MAG_FILTER,minFilter:ls.TEXTURE_MIN_FILTER,wrapS:ls.TEXTURE_WRAP_S,wrapT:ls.TEXTURE_WRAP_T},v9e={[ls.TEXTURE_MAG_FILTER]:ls.LINEAR,[ls.TEXTURE_MIN_FILTER]:ls.NEAREST_MIPMAP_LINEAR,[ls.TEXTURE_WRAP_S]:ls.REPEAT,[ls.TEXTURE_WRAP_T]:ls.REPEAT};function y9e(){return{id:"default-sampler",parameters:v9e}}function b9e(e){return m9e[e]}function _9e(e){return p9e[e]}var gee=class{constructor(){this.baseUri="";this.buffers=[];this.images=[]}postProcess(t,r={}){let{json:i,buffers:n=[],images:a=[]}=t,{baseUri:o=""}=t;return jn(i),this.baseUri=o,this.buffers=n,this.images=a,this.jsonUnprocessed=i,this.json=this._resolveTree(t.json,r),this.json}_resolveTree(t,r={}){let i=ne({},t);return this.json=i,t.bufferViews&&(i.bufferViews=t.bufferViews.map((n,a)=>this._resolveBufferView(n,a))),t.images&&(i.images=t.images.map((n,a)=>this._resolveImage(n,a))),t.samplers&&(i.samplers=t.samplers.map((n,a)=>this._resolveSampler(n,a))),t.textures&&(i.textures=t.textures.map((n,a)=>this._resolveTexture(n,a))),t.accessors&&(i.accessors=t.accessors.map((n,a)=>this._resolveAccessor(n,a))),t.materials&&(i.materials=t.materials.map((n,a)=>this._resolveMaterial(n,a))),t.meshes&&(i.meshes=t.meshes.map((n,a)=>this._resolveMesh(n,a))),t.nodes&&(i.nodes=t.nodes.map((n,a)=>this._resolveNode(n,a)),i.nodes=i.nodes.map((n,a)=>this._resolveNodeChildren(n))),t.skins&&(i.skins=t.skins.map((n,a)=>this._resolveSkin(n,a))),t.scenes&&(i.scenes=t.scenes.map((n,a)=>this._resolveScene(n,a))),typeof this.json.scene=="number"&&i.scenes&&(i.scene=i.scenes[this.json.scene]),i}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,r){if(typeof r=="object")return r;let i=t&&t[r];return i||console.warn(`glTF file error: Could not find ${t}[${r}]`),i}_resolveScene(t,r){return Ye(ne({},t),{id:t.id||`scene-${r}`,nodes:(t.nodes||[]).map(i=>this.getNode(i))})}_resolveNode(t,r){let i=Ye(ne({},t),{id:(t==null?void 0:t.id)||`node-${r}`});return t.mesh!==void 0&&(i.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(i.camera=this.getCamera(t.camera)),t.skin!==void 0&&(i.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(i.mesh=t.meshes.reduce((n,a)=>{let o=this.getMesh(a);return n.id=o.id,n.primitives=n.primitives.concat(o.primitives),n},{primitives:[]})),i}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(r=>this.getNode(r))),t}_resolveSkin(t,r){let i=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return Ye(ne({},t),{id:t.id||`skin-${r}`,inverseBindMatrices:i})}_resolveMesh(t,r){let i=Ye(ne({},t),{id:t.id||`mesh-${r}`,primitives:[]});return t.primitives&&(i.primitives=t.primitives.map(n=>{let a=Ye(ne({},n),{attributes:{},indices:void 0,material:void 0}),o=n.attributes;for(let s in o)a.attributes[s]=this.getAccessor(o[s]);return n.indices!==void 0&&(a.indices=this.getAccessor(n.indices)),n.material!==void 0&&(a.material=this.getMaterial(n.material)),a})),i}_resolveMaterial(t,r){let i=Ye(ne({},t),{id:t.id||`material-${r}`});if(i.normalTexture&&(i.normalTexture=ne({},i.normalTexture),i.normalTexture.texture=this.getTexture(i.normalTexture.index)),i.occlusionTexture&&(i.occlusionTexture=ne({},i.occlusionTexture),i.occlusionTexture.texture=this.getTexture(i.occlusionTexture.index)),i.emissiveTexture&&(i.emissiveTexture=ne({},i.emissiveTexture),i.emissiveTexture.texture=this.getTexture(i.emissiveTexture.index)),i.emissiveFactor||(i.emissiveFactor=i.emissiveTexture?[1,1,1]:[0,0,0]),i.pbrMetallicRoughness){i.pbrMetallicRoughness=ne({},i.pbrMetallicRoughness);let n=i.pbrMetallicRoughness;n.baseColorTexture&&(n.baseColorTexture=ne({},n.baseColorTexture),n.baseColorTexture.texture=this.getTexture(n.baseColorTexture.index)),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture=ne({},n.metallicRoughnessTexture),n.metallicRoughnessTexture.texture=this.getTexture(n.metallicRoughnessTexture.index))}return i}_resolveAccessor(t,r){let i=b9e(t.componentType),n=_9e(t.type),a=i*n,o=Ye(ne({},t),{id:t.id||`accessor-${r}`,bytesPerComponent:i,components:n,bytesPerElement:a,value:void 0,bufferView:void 0,sparse:void 0});if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let s=o.bufferView.buffer,{ArrayType:u,byteLength:l}=bg(o,o.bufferView),c=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+s.byteOffset,f=s.arrayBuffer.slice(c,c+l);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(s,c,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new u(f)}return o}_getValueFromInterleavedBuffer(t,r,i,n,a){let o=new Uint8Array(a*n);for(let s=0;s<a;s++){let u=r+s*i;o.set(new Uint8Array(t.arrayBuffer.slice(u,u+n)),s*n)}return o.buffer}_resolveTexture(t,r){return Ye(ne({},t),{id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):y9e(),source:typeof t.source=="number"?this.getImage(t.source):void 0})}_resolveSampler(t,r){let i=Ye(ne({id:t.id||`sampler-${r}`},t),{parameters:{}});for(let n in i){let a=this._enumSamplerParameter(n);a!==void 0&&(i.parameters[a]=i[n])}return i}_enumSamplerParameter(t){return g9e[t]}_resolveImage(t,r){let i=Ye(ne({},t),{id:t.id||`image-${r}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0}),n=this.images[r];return n&&(i.image=n),i}_resolveBufferView(t,r){let i=t.buffer,n=this.buffers[i].arrayBuffer,a=this.buffers[i].byteOffset||0;return t.byteOffset&&(a+=t.byteOffset),Ye(ne({id:`bufferView-${r}`},t),{buffer:this.buffers[i],data:new Uint8Array(n,a,t.byteLength)})}_resolveCamera(t,r){let i=Ye(ne({},t),{id:t.id||`camera-${r}`});return i.perspective,i.orthographic,i}};function fb(e,t){return new gee().postProcess(e,t)}var FS={URI:0,EMBEDDED:1};function DS(e,t,r,i){e.rotateYtoZ=!0;let n=(e.byteOffset||0)+(e.byteLength||0)-r;if(n===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=(i==null?void 0:i["3d-tiles"])&&i["3d-tiles"].assetGltfUpAxis?i["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=fd(t,r,n),e.gltfByteOffset=0,e.gltfByteLength=n,r%4==0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function MS(e,t,r,i){let n=(r==null?void 0:r["3d-tiles"])||{};if(x9e(e,t,r),n.loadGLTF){if(!i)return;let{parse:a,fetch:o}=i;if(e.gltfUrl){let s=await o(e.gltfUrl,r);e.gltfArrayBuffer=await s.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let s=await a(e.gltfArrayBuffer,dc,r,i);e.gltf=fb(s),e.gpuMemoryUsageInBytes=sb(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function x9e(e,t,r){switch(t){case FS.URI:if(e.gltfArrayBuffer){let i=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),a=new TextDecoder().decode(i);e.gltfUrl=a.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case FS.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function vee(e,t,r,i,n){var o;r=w9e(e,t,r,i,n),await MS(e,FS.EMBEDDED,i,n);let a=(o=e==null?void 0:e.gltf)==null?void 0:o.extensions;return a&&a.CESIUM_RTC&&(e.rtcCenter=a.CESIUM_RTC.center),r}function w9e(e,t,r,i,n){r=qf(e,t,r),r=cg(e,t,r),r=fg(e,t,r,i),r=DS(e,t,r,i);let a=new Nf(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Zt.FLOAT,3),r}var Ro=Fe(fr()),yee=Fe(ua());async function bee(e,t,r,i,n){return r=E9e(e,t,r,i,n),await MS(e,e.gltfFormat||0,i,n),r}function E9e(e,t,r,i,n){var l;if(r=qf(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=cg(e,t,r);let a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r+=4,r=fg(e,t,r,i),r=DS(e,t,r,i),!((l=e==null?void 0:e.header)==null?void 0:l.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let o=new Nf(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",Zt.FLOAT,3);let u=new ug(e.batchTableJson,e.batchTableBinary,s);return S9e(e,o,u,s),r}function S9e(e,t,r,i){let n=new Array(i),a=new Ro.Vector3,o=new Ro.Vector3,s=new Ro.Vector3,u=new Ro.Vector3,l=new Ro.Matrix3,c=new Ro.Quaternion,f=new Ro.Vector3,h={},d=new Ro.Matrix4,p=[],y=[],g=[],b=[];for(let E=0;E<i;E++){let A;if(t.hasProperty("POSITION"))A=t.getProperty("POSITION",Zt.FLOAT,3,E,a);else if(t.hasProperty("POSITION_QUANTIZED")){A=t.getProperty("POSITION_QUANTIZED",Zt.UNSIGNED_SHORT,3,E,a);let W=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Zt.FLOAT,3);if(!W)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let N=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Zt.FLOAT,3);if(!N)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let H=65535;for(let L=0;L<3;L++)A[L]=A[L]/H*N[L]+W[L]}if(!A)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(A),h.translation=a,e.normalUp=t.getProperty("NORMAL_UP",Zt.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",Zt.FLOAT,3,E,y);let k=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",Zt.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Zt.UNSIGNED_SHORT,2,E,y),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(yee.Ellipsoid.WGS84.eastNorthUpToFixedFrame(a,d),d.getRotationMatrix3(l)):l.identity()}k&&(u.copy(o).cross(s).normalize(),l.setColumn(0,o),l.setColumn(1,s),l.setColumn(2,u)),c.fromMatrix3(l),h.rotation=c,f.set(1,1,1);let R=t.getProperty("SCALE",Zt.FLOAT,1,E,g);Number.isFinite(R)&&f.multiplyByScalar(R);let F=t.getProperty("SCALE_NON_UNIFORM",Zt.FLOAT,3,E,p);F&&f.scale(F),h.scale=f;let C=t.getProperty("BATCH_ID",Zt.UNSIGNED_SHORT,1,E,b);C===void 0&&(C=E);let j=new Ro.Matrix4().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(j),d.scale(h.scale);let O=d.clone();n[E]={modelMatrix:O,batchId:C}}e.instances=n}async function _ee(e,t,r,i,n,a){r=qf(e,t,r);let o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-r>12;){let s={};e.tiles.push(s),r=await a(t,r,i,n,s)}return r}async function xee(e,t,r,i){var n;if(e.rotateYtoZ=!0,e.gltfUpAxis=(r==null?void 0:r["3d-tiles"])&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",(n=r==null?void 0:r["3d-tiles"])==null?void 0:n.loadGLTF){if(!i)return;let{parse:a}=i,o=await a(t,dc,r,i);e.gltf=fb(o),e.gpuMemoryUsageInBytes=sb(e.gltf)}else e.gltfArrayBuffer=t}async function KO(e,t=0,r,i,n={}){switch(n.byteOffset=t,n.type=zQ(e,t),n.type){case ss.COMPOSITE:return await _ee(n,e,t,r,i,KO);case ss.BATCHED_3D_MODEL:return await vee(n,e,t,r,i);case ss.GLTF:return await xee(n,e,r,i);case ss.INSTANCED_3D_MODEL:return await bee(n,e,t,r,i);case ss.POINT_CLOUD:return await fZ(n,e,t,r,i);default:throw new Error(`3DTileLoader: unknown type ${n.type}`)}}var T9e=1952609651,A9e=1;async function YO(e,t,r){if(new Uint32Array(e.slice(0,4))[0]!==T9e)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==A9e)throw new Error("Wrong subtree file verson, must be 1");let a=wee(e.slice(8,16)),o=new Uint8Array(e,24,a),u=new TextDecoder("utf8").decode(o),l=JSON.parse(u),c=wee(e.slice(16,24)),f=new ArrayBuffer(0);if(c&&(f=e.slice(24+a)),await LS(l,l.tileAvailability,f,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await LS(l,h,f,r);else await LS(l,l.contentAvailability,f,r);return await LS(l,l.childSubtreeAvailability,f,r),l}async function LS(e,t,r,i){let n=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof n!="number")return;let a=e.bufferViews[n],o=e.buffers[a.buffer];if(!(i==null?void 0:i.baseUrl))throw new Error("Url is not provided");if(!i.fetch)throw new Error("fetch is not provided");if(o.uri){let s=`${(i==null?void 0:i.baseUrl)||""}/${o.uri}`,l=await(await i.fetch(s)).arrayBuffer();t.explicitBitstream=new Uint8Array(l,a.byteOffset,a.byteLength);return}t.explicitBitstream=new Uint8Array(r,a.byteOffset,a.byteLength)}function wee(e){let t=new DataView(e),r=t.getUint32(0,!0),i=t.getUint32(4,!0);return r+2**32*i}var jS={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:ag,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:YO,options:{}};function XO(e){if(typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function nu(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||XO()}var k9e=globalThis.self||globalThis.window||globalThis.global,wg=globalThis.window||globalThis.self||globalThis.global,R9e=globalThis.document||{},Id=globalThis.process||{},C9e=globalThis.console,Z2t=globalThis.navigator||{};var NS="4.0.0-alpha.17",rkt=nu();function I9e(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var $O=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=I9e(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Eee(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function See(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function qS(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,n=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(r=Math.min(r,i/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(n,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var US;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(US||(US={}));var P9e=10;function Tee(e){return typeof e!="string"?e:(e=e.toUpperCase(),US[e]||US.WHITE)}function Aee(e,t,r){if(!nu&&typeof e=="string"){if(t){let i=Tee(t);e="[".concat(i,"m").concat(e,"")}if(r){let i=Tee(r);e="[".concat(i+P9e,"m").concat(e,"")}}return e}function kee(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r),n=e;for(let a of i){let o=n[a];typeof o=="function"&&(t.find(s=>a===s)||(n[a]=o.bind(e)))}}function Eg(e,t){if(!e)throw new Error(t||"Assertion failed")}function Pd(){let e;if(nu()&&wg.performance){var t,r;e=wg===null||wg===void 0||(t=wg.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Id){var i;let n=Id===null||Id===void 0||(i=Id.hrtime)===null||i===void 0?void 0:i.call(Id);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}var Sg={debug:nu()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},B9e={enabled:!0,level:0};function cs(){}var Ree={},Cee={once:!0},GS=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=NS,this._startTs=Pd(),this._deltaTs=Pd(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new $O("__probe-".concat(this.id,"__"),B9e),this.timeStamp("".concat(this.id," started")),kee(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Pd()-this._startTs).toPrecision(10))}getDelta(){return Number((Pd()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Eg(t,r)}warn(t){return this._getLogFunction(0,t,Sg.warn,arguments,Cee)}error(t){return this._getLogFunction(0,t,Sg.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Sg.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Sg.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Sg.debug||Sg.info,arguments,Cee)}table(t,r,i){return r?this._getLogFunction(t,r,console.table||cs,i&&[i],{tag:M9e(r)}):cs}image(t){let{logLevel:r,priority:i,image:n,message:a="",scale:o=1}=t;return this._shouldLog(r||i)?nu()?D9e({image:n,message:a,scale:o}):F9e({image:n,message:a,scale:o}):cs}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||cs)}group(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},n=Pee({logLevel:t,message:r,opts:i}),{collapsed:a}=i;return n.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||cs)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Iee(t)}_getLogFunction(t,r,i,n,a){if(this._shouldLog(t)){a=Pee({logLevel:t,message:r,args:n,opts:a}),i=i||a.method,Eg(i),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=Pd();let o=a.tag||a.message;if(a.once&&o)if(!Ree[o])Ree[o]=Pd();else return cs;return r=O9e(this.id,a.message,a),i.bind(console,r,...a.args)}return cs}};GS.VERSION=NS;function Iee(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Eg(Number.isFinite(t)&&t>=0),t}function Pee(e){let{logLevel:t,message:r}=e;e.logLevel=Iee(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&i.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let n=typeof e.message;return Eg(n==="string"||n==="object"),Object.assign(e,{args:i},e.opts)}function O9e(e,t,r){if(typeof t=="string"){let i=r.time?See(Eee(r.total)):"";t=r.time?"".concat(e,": ").concat(i," ").concat(t):"".concat(e,": ").concat(t),t=Aee(t,r.color,r.background)}return t}function F9e(e){let{image:t,message:r="",scale:i=1}=e;return console.warn("removed"),cs}function D9e(e){let{image:t,message:r="",scale:i=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=qS(a,r,i);console.log(...o)},a.src=t,cs}let n=t.nodeName||"";if(n.toLowerCase()==="img")return console.log(...qS(t,r,i)),cs;if(n.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...qS(a,r,i)),a.src=t.toDataURL(),cs}return cs}function M9e(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var JO=new GS({id:"@probe.gl/log"});var fs=null;try{fs=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function xi(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}xi.prototype.__isLong__;Object.defineProperty(xi.prototype,"__isLong__",{value:!0});function Ra(e){return(e&&e.__isLong__)===!0}function Bee(e){var t=Math.clz32(e&-e);return e?31-t:t}xi.isLong=Ra;var Oee={},Fee={};function Bd(e,t){var r,i,n;return t?(e>>>=0,(n=0<=e&&e<256)&&(i=Fee[e],i)?i:(r=Vr(e,0,!0),n&&(Fee[e]=r),r)):(e|=0,(n=-128<=e&&e<128)&&(i=Oee[e],i)?i:(r=Vr(e,e<0?-1:0,!1),n&&(Oee[e]=r),r))}xi.fromInt=Bd;function hs(e,t){if(isNaN(e))return t?pc:ou;if(t){if(e<0)return pc;if(e>=Mee)return Uee}else{if(e<=-Lee)return uo;if(e+1>=Lee)return qee}return e<0?hs(-e,t).neg():Vr(e%Tg|0,e/Tg|0,t)}xi.fromNumber=hs;function Vr(e,t,r){return new xi(e,t,r)}xi.fromBits=Vr;var zS=Math.pow;function QO(e,t,r){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(r=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?pc:ou;if(r=r||10,r<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return QO(e.substring(1),t,r).neg();for(var n=hs(zS(r,8)),a=ou,o=0;o<e.length;o+=8){var s=Math.min(8,e.length-o),u=parseInt(e.substring(o,o+s),r);if(s<8){var l=hs(zS(r,s));a=a.mul(l).add(hs(u))}else a=a.mul(n),a=a.add(hs(u))}return a.unsigned=t,a}xi.fromString=QO;function au(e,t){return typeof e=="number"?hs(e,t):typeof e=="string"?QO(e,t):Vr(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}xi.fromValue=au;var Dee=1<<16,L9e=1<<24,Tg=Dee*Dee,Mee=Tg*Tg,Lee=Mee/2,jee=Bd(L9e),ou=Bd(0);xi.ZERO=ou;var pc=Bd(0,!0);xi.UZERO=pc;var Ag=Bd(1);xi.ONE=Ag;var Nee=Bd(1,!0);xi.UONE=Nee;var ZO=Bd(-1);xi.NEG_ONE=ZO;var qee=Vr(4294967295|0,2147483647|0,!1);xi.MAX_VALUE=qee;var Uee=Vr(4294967295|0,4294967295|0,!0);xi.MAX_UNSIGNED_VALUE=Uee;var uo=Vr(0,2147483648|0,!1);xi.MIN_VALUE=uo;var ze=xi.prototype;ze.toInt=function(){return this.unsigned?this.low>>>0:this.low};ze.toNumber=function(){return this.unsigned?(this.high>>>0)*Tg+(this.low>>>0):this.high*Tg+(this.low>>>0)};ze.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(uo)){var r=hs(t),i=this.div(r),n=i.mul(r).sub(this);return i.toString(t)+n.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var a=hs(zS(t,6),this.unsigned),o=this,s="";;){var u=o.div(a),l=o.sub(u.mul(a)).toInt()>>>0,c=l.toString(t);if(o=u,o.isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}};ze.getHighBits=function(){return this.high};ze.getHighBitsUnsigned=function(){return this.high>>>0};ze.getLowBits=function(){return this.low};ze.getLowBitsUnsigned=function(){return this.low>>>0};ze.getNumBitsAbs=function(){if(this.isNegative())return this.eq(uo)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&(t&1<<r)==0;r--);return this.high!=0?r+33:r+1};ze.isZero=function(){return this.high===0&&this.low===0};ze.eqz=ze.isZero;ze.isNegative=function(){return!this.unsigned&&this.high<0};ze.isPositive=function(){return this.unsigned||this.high>=0};ze.isOdd=function(){return(this.low&1)==1};ze.isEven=function(){return(this.low&1)==0};ze.equals=function(t){return Ra(t)||(t=au(t)),this.unsigned!==t.unsigned&&this.high>>>31==1&&t.high>>>31==1?!1:this.high===t.high&&this.low===t.low};ze.eq=ze.equals;ze.notEquals=function(t){return!this.eq(t)};ze.neq=ze.notEquals;ze.ne=ze.notEquals;ze.lessThan=function(t){return this.comp(t)<0};ze.lt=ze.lessThan;ze.lessThanOrEqual=function(t){return this.comp(t)<=0};ze.lte=ze.lessThanOrEqual;ze.le=ze.lessThanOrEqual;ze.greaterThan=function(t){return this.comp(t)>0};ze.gt=ze.greaterThan;ze.greaterThanOrEqual=function(t){return this.comp(t)>=0};ze.gte=ze.greaterThanOrEqual;ze.ge=ze.greaterThanOrEqual;ze.compare=function(t){if(Ra(t)||(t=au(t)),this.eq(t))return 0;var r=this.isNegative(),i=t.isNegative();return r&&!i?-1:!r&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};ze.comp=ze.compare;ze.negate=function(){return!this.unsigned&&this.eq(uo)?uo:this.not().add(Ag)};ze.neg=ze.negate;ze.add=function(t){Ra(t)||(t=au(t));var r=this.high>>>16,i=this.high&65535,n=this.low>>>16,a=this.low&65535,o=t.high>>>16,s=t.high&65535,u=t.low>>>16,l=t.low&65535,c=0,f=0,h=0,d=0;return d+=a+l,h+=d>>>16,d&=65535,h+=n+u,f+=h>>>16,h&=65535,f+=i+s,c+=f>>>16,f&=65535,c+=r+o,c&=65535,Vr(h<<16|d,c<<16|f,this.unsigned)};ze.subtract=function(t){return Ra(t)||(t=au(t)),this.add(t.neg())};ze.sub=ze.subtract;ze.multiply=function(t){if(this.isZero())return this;if(Ra(t)||(t=au(t)),fs){var r=fs.mul(this.low,this.high,t.low,t.high);return Vr(r,fs.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?pc:ou;if(this.eq(uo))return t.isOdd()?uo:ou;if(t.eq(uo))return this.isOdd()?uo:ou;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(jee)&&t.lt(jee))return hs(this.toNumber()*t.toNumber(),this.unsigned);var i=this.high>>>16,n=this.high&65535,a=this.low>>>16,o=this.low&65535,s=t.high>>>16,u=t.high&65535,l=t.low>>>16,c=t.low&65535,f=0,h=0,d=0,p=0;return p+=o*c,d+=p>>>16,p&=65535,d+=a*c,h+=d>>>16,d&=65535,d+=o*l,h+=d>>>16,d&=65535,h+=n*c,f+=h>>>16,h&=65535,h+=a*l,f+=h>>>16,h&=65535,h+=o*u,f+=h>>>16,h&=65535,f+=i*c+n*l+a*u+o*s,f&=65535,Vr(d<<16|p,f<<16|h,this.unsigned)};ze.mul=ze.multiply;ze.divide=function(t){if(Ra(t)||(t=au(t)),t.isZero())throw Error("division by zero");if(fs){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?fs.div_u:fs.div_s)(this.low,this.high,t.low,t.high);return Vr(r,fs.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?pc:ou;var i,n,a;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return pc;if(t.gt(this.shru(1)))return Nee;a=pc}else{if(this.eq(uo)){if(t.eq(Ag)||t.eq(ZO))return uo;if(t.eq(uo))return Ag;var o=this.shr(1);return i=o.div(t).shl(1),i.eq(ou)?t.isNegative()?Ag:ZO:(n=this.sub(t.mul(i)),a=i.add(n.div(t)),a)}else if(t.eq(uo))return this.unsigned?pc:ou;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=ou}for(n=this;n.gte(t);){i=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(i)/Math.LN2),u=s<=48?1:zS(2,s-48),l=hs(i),c=l.mul(t);c.isNegative()||c.gt(n);)i-=u,l=hs(i,this.unsigned),c=l.mul(t);l.isZero()&&(l=Ag),a=a.add(l),n=n.sub(c)}return a};ze.div=ze.divide;ze.modulo=function(t){if(Ra(t)||(t=au(t)),fs){var r=(this.unsigned?fs.rem_u:fs.rem_s)(this.low,this.high,t.low,t.high);return Vr(r,fs.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};ze.mod=ze.modulo;ze.rem=ze.modulo;ze.not=function(){return Vr(~this.low,~this.high,this.unsigned)};ze.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};ze.clz=ze.countLeadingZeros;ze.countTrailingZeros=function(){return this.low?Bee(this.low):Bee(this.high)+32};ze.ctz=ze.countTrailingZeros;ze.and=function(t){return Ra(t)||(t=au(t)),Vr(this.low&t.low,this.high&t.high,this.unsigned)};ze.or=function(t){return Ra(t)||(t=au(t)),Vr(this.low|t.low,this.high|t.high,this.unsigned)};ze.xor=function(t){return Ra(t)||(t=au(t)),Vr(this.low^t.low,this.high^t.high,this.unsigned)};ze.shiftLeft=function(t){return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?Vr(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):Vr(0,this.low<<t-32,this.unsigned)};ze.shl=ze.shiftLeft;ze.shiftRight=function(t){return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?Vr(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):Vr(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};ze.shr=ze.shiftRight;ze.shiftRightUnsigned=function(t){return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?Vr(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?Vr(this.high,0,this.unsigned):Vr(this.high>>>t-32,0,this.unsigned)};ze.shru=ze.shiftRightUnsigned;ze.shr_u=ze.shiftRightUnsigned;ze.rotateLeft=function(t){var r;return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t===32?Vr(this.high,this.low,this.unsigned):t<32?(r=32-t,Vr(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,Vr(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))};ze.rotl=ze.rotateLeft;ze.rotateRight=function(t){var r;return Ra(t)&&(t=t.toInt()),(t&=63)==0?this:t===32?Vr(this.high,this.low,this.unsigned):t<32?(r=32-t,Vr(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,Vr(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};ze.rotr=ze.rotateRight;ze.toSigned=function(){return this.unsigned?Vr(this.low,this.high,!1):this};ze.toUnsigned=function(){return this.unsigned?this:Vr(this.low,this.high,!0)};ze.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};ze.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};ze.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};xi.fromBytes=function(t,r,i){return i?xi.fromBytesLE(t,r):xi.fromBytesBE(t,r)};xi.fromBytesLE=function(t,r){return new xi(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};xi.fromBytesBE=function(t,r){return new xi(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var kg=xi;var j9e=16;function hb(e){e==="X"&&(e="");let t=e.padEnd(j9e,"0");return kg.fromString(t,!0,16)}function e8(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let i=t;t*=4;let a=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-i-a.length).join("0")+a}function t8(e,t){let r=N9e(e).shiftRightUnsigned(2);return e.add(kg.fromNumber(2*t+1-4).multiply(r))}function N9e(e){return e.and(e.not().add(1))}var q9e=3,U9e=30,G9e=2*U9e+1,Gee=180/Math.PI;function zee(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),r=parseInt(t[0],10),i=t[1],n=i.length,a=0,o=[0,0];for(let s=n-1;s>=0;s--){a=n-s;let u=i[s],l=0,c=0;u==="1"?c=1:u==="2"?(l=1,c=1):u==="3"&&(l=1);let f=Math.pow(2,a-1);z9e(f,o,l,c),o[0]+=f*l,o[1]+=f*c}if(r%2==1){let s=o[0];o[0]=o[1],o[1]=s}return{face:r,ij:o,level:a}}function Hee(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<q9e+G9e;)t="0"+t;let r=t.lastIndexOf("1"),i=t.substring(0,3),n=t.substring(3,r),a=n.length/2,o=kg.fromString(i,!0,2).toString(10),s="";if(a!==0)for(s=kg.fromString(n,!0,2).toString(4);s.length<a;)s="0"+s;return`${o}/${s}`}function r8(e,t,r){let i=1<<t;return[(e[0]+r[0])/i,(e[1]+r[1])/i]}function Wee(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function i8(e){return[Wee(e[0]),Wee(e[1])]}function n8(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function a8([e,t,r]){let i=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Gee,i*Gee]}function z9e(e,t,r,i){if(i===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let n=t[0];t[0]=t[1],t[1]=n}}function Vee(e){let t=r8(e.ij,e.level,[.5,.5]),r=i8(t),i=n8(e.face,r);return a8(i)}var H9e=100;function o8(e){let{face:t,ij:r,level:i}=e,n=[[0,0],[0,1],[1,1],[1,0],[0,0]],a=Math.max(1,Math.ceil(H9e*Math.pow(2,-i))),o=new Float64Array(4*a*2+2),s=0,u=0;for(let l=0;l<4;l++){let c=n[l].slice(0),f=n[l+1],h=(f[0]-c[0])/a,d=(f[1]-c[1])/a;for(let p=0;p<a;p++){c[0]+=h,c[1]+=d;let y=r8(r,i,c),g=i8(y),b=n8(t,g),E=a8(b);Math.abs(E[1])>89.999&&(E[0]=u);let A=E[0]-u;E[0]+=A>180?-360:A<-180?360:0,o[s++]=E[0],o[s++]=E[1],u=E[0]}}return o[s++]=o[0],o[s++]=o[1],o}function Rg(e){let t=W9e(e);return zee(t)}function W9e(e){if(e.indexOf("/")>0)return e;let t=hb(e);return Hee(t)}function s8(e){let t=Rg(e);return Vee(t)}function Kee(e){let t;if(e.face===2||e.face===5){let r=null,i=0;for(let n=0;n<4;n++){let a=`${e.face}/${n}`,o=Rg(a),s=o8(o);(typeof r=="undefined"||r===null)&&(r=new Float64Array(4*s.length)),r.set(s,i),i+=s.length}t=Yee(r)}else{let r=o8(e);t=Yee(r)}return t}function Yee(e){if(e.length%2!=0)throw new Error("Invalid corners");let t=[],r=[];for(let i=0;i<e.length;i+=2)t.push(e[i]),r.push(e[i+1]);return t.sort((i,n)=>i-n),r.sort((i,n)=>i-n),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}var mc=Fe(fr());function u8(e,t){let r=(t==null?void 0:t.minimumHeight)||0,i=(t==null?void 0:t.maximumHeight)||0,n=Rg(e),a=Kee(n),o=a.west,s=a.south,u=a.east,l=a.north,c=[];return c.push(new mc.Vector3(o,l,r)),c.push(new mc.Vector3(u,l,r)),c.push(new mc.Vector3(u,s,r)),c.push(new mc.Vector3(o,s,r)),c.push(new mc.Vector3(o,l,i)),c.push(new mc.Vector3(u,l,i)),c.push(new mc.Vector3(u,s,i)),c.push(new mc.Vector3(o,s,i)),c}var Xee=Fe(fr()),$ee=Fe(tl());var Jee=Fe(ua());function HS(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},i=u8(t,r),n=s8(t),a=n[0],o=n[1],s=Jee.Ellipsoid.WGS84.cartographicToCartesian([a,o,r.maximumHeight]),u=new Xee.Vector3(s[0],s[1],s[2]);i.push(u);let l=(0,$ee.makeOrientedBoundingBoxFromPoints)(i);return[...l.center,...l.halfAxes]}var V9e=4,K9e=8,Y9e={QUADTREE:V9e,OCTREE:K9e};function X9e(e,t,r){if(e==null?void 0:e.box){let i=hb(e.s2VolumeInfo.token),n=t8(i,t),a=e8(n),o=ne({},e.s2VolumeInfo);switch(o.token=a,r){case"OCTREE":let l=e.s2VolumeInfo,c=l.maximumHeight-l.minimumHeight,f=c/2,h=l.minimumHeight+c/2;l.minimumHeight=h-f,l.maximumHeight=h+f;break;default:break}return{box:HS(o),s2VolumeInfo:o}}}async function l8(e){let{implicitOptions:t,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:i=0,globalData:n={level:0,mortonIndex:0,x:0,y:0,z:0},s2VolumeBox:a,loaderOptions:o}=e,{subtree:s,level:u=0}=e,{subdivisionScheme:l,subtreeLevels:c,maximumLevel:f,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=t,y={children:[],lodMetricValue:0,contentUrl:""};if(!f)return JO.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),y;let g=u+n.level;if(g>f)return y;let b=Y9e[l],E=Math.log2(b),A=i&1,k=i>>1&1,R=i>>2&1,F=(b**u-1)/(b-1),C=Od(r.mortonIndex,i,E),j=F+C,O=Od(r.x,A,1),W=Od(r.y,k,1),N=Od(r.z,R,1),H=!1;u>=c&&(H=c8(s.childSubtreeAvailability,C));let L=Od(n.x,O,u*E),z=Od(n.y,W,u*E),X=Od(n.z,N,u*E);if(H){let de=`${p}/${d}`,Me=WS(de,g,L,z,X);s=await Wr(Me,jS,o),n.mortonIndex=C,n.x=O,n.y=W,n.z=N,n.level=u,C=0,j=0,O=0,W=0,N=0,u=0}if(!c8(s.tileAvailability,j))return y;c8(s.contentAvailability,j)&&(y.contentUrl=WS(h,g,L,z,X));let ae=u+1,ue={mortonIndex:C,x:O,y:W,z:N};for(let de=0;de<b;de++){let Me=X9e(a,de,l),Pe=await l8({subtree:s,implicitOptions:t,loaderOptions:o,parentData:ue,childIndex:de,level:ae,globalData:ne({},n),s2VolumeBox:Me});if(Pe.contentUrl||Pe.children.length){let qe=g+1,Ae=$9e(Pe,qe,{childTileX:O,childTileY:W,childTileZ:N},t,a);y.children.push(Ae)}}return y}function c8(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&JO.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?Z9e(t,r.explicitBitstream):!1}function $9e(e,t,r,i,n){let{basePath:a,refine:o,getRefine:s,lodMetricType:u,getTileType:l,rootLodMetricValue:c,rootBoundingVolume:f}=i,h=e.contentUrl&&e.contentUrl.replace(`${a}/`,""),d=c/2**t,p=(n==null?void 0:n.box)?{box:n.box}:f,y=J9e(t,p,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:s(o),type:l(e),lodMetricType:u,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:y}}function J9e(e,t,r){if(t.region){let{childTileX:i,childTileY:n,childTileZ:a}=r,[o,s,u,l,c,f]=t.region,h=2**e,d=(u-o)/h,p=(l-s)/h,y=(f-c)/h,[g,b]=[o+d*i,o+d*(i+1)],[E,A]=[s+p*n,s+p*(n+1)],[k,R]=[c+y*a,c+y*(a+1)];return{region:[g,E,b,A,k,R]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${t}`)}function Od(e,t,r){return(e<<r)+t}function WS(e,t,r,i,n){let a=Q9e({level:t,x:r,y:i,z:n});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>a[o])}function Q9e(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function Z9e(e,t){let r=Math.floor(e/8),i=e%8;return(t[r]>>i&1)===1}function f8(e,t=""){if(!t)return il.EMPTY;let i=t.split("?")[0].split(".").pop();switch(i){case"pnts":return il.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return il.SCENEGRAPH;default:return i||il.EMPTY}}function h8(e){switch(e){case"REPLACE":case"replace":return ea.REPLACE;case"ADD":case"add":return ea.ADD;default:return e}}function d8(e="",t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let i=new URL(e,`${t}/`);return decodeURI(i.toString())}else if(e.startsWith("/"))return e;return`${t}/${e}`}function Qee(e,t){var n;if(!e)return null;let r;if(e.content){let a=e.content.uri||((n=e.content)==null?void 0:n.url);r=d8(a,t)}return Ye(ne({},e),{id:r,contentUrl:r,lodMetricType:sc.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:f8(e,r),refine:h8(e.refine)})}async function Zee(e,t,r){let i=null,n=tte(e.root);n&&e.root?i=await ete(e.root,e,t,n,r):i=Qee(e.root,t);let a=[];for(a.push(i);a.length>0;){let o=a.pop()||{},s=o.children||[],u=[];for(let l of s){let c=tte(l),f;c?f=await ete(l,e,t,c,r):f=Qee(l,t),f&&(u.push(f),a.push(f))}o.children=u}return i}async function ete(e,t,r,i,n){var A,k,R;let{subdivisionScheme:a,maximumLevel:o,availableLevels:s,subtreeLevels:u,subtrees:{uri:l}}=i,c=WS(l,0,0,0,0),f=d8(c,r),h=await Wr(f,jS,n),d=d8((A=e.content)==null?void 0:A.uri,r),p=(k=t==null?void 0:t.root)==null?void 0:k.refine,y=e.geometricError,g=(R=e.boundingVolume.extensions)==null?void 0:R["3DTILES_bounding_volume_S2"];if(g){let C={box:HS(g),s2VolumeInfo:g};e.boundingVolume=C}let b=e.boundingVolume,E={contentUrlTemplate:d,subtreesUriTemplate:l,subdivisionScheme:a,subtreeLevels:u,maximumLevel:Number.isFinite(s)?s-1:o,refine:p,basePath:r,lodMetricType:sc.GEOMETRIC_ERROR,rootLodMetricValue:y,rootBoundingVolume:b,getTileType:f8,getRefine:h8};return await eqe(e,r,h,E,n)}async function eqe(e,t,r,i,n){if(!e)return null;let{children:a,contentUrl:o}=await l8({subtree:r,implicitOptions:i,loaderOptions:n}),s,u=null;return o&&(s=o,u={uri:o.replace(`${t}/`,"")}),Ye(ne({},e),{id:s,contentUrl:s,lodMetricType:sc.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:f8(e,s),refine:h8(e.refine),content:u||e.content,children:a})}function tte(e){var t;return((t=e==null?void 0:e.extensions)==null?void 0:t["3DTILES_implicit_tiling"])||(e==null?void 0:e.implicitTiling)}var gc={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:ag,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:tqe,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function tqe(e,t={},r){let i=t["3d-tiles"]||{},n;return i.isTileset==="auto"?n=(r==null?void 0:r.url)&&r.url.indexOf(".json")!==-1:n=i.isTileset,n?rqe(e,t,r):iqe(e,t,r)}async function rqe(e,t,r){var u;let i=JSON.parse(new TextDecoder().decode(e)),n=(r==null?void 0:r.url)||"",a=nqe(n),o=await Zee(i,a,t||{});return Ye(ne({},i),{loader:gc,url:n,queryString:(r==null?void 0:r.queryString)||"",basePath:a,root:o||i.root,type:En.TILES3D,lodMetricType:sc.GEOMETRIC_ERROR,lodMetricValue:((u=i.root)==null?void 0:u.geometricError)||0})}async function iqe(e,t,r){let i={content:{featureIds:null}};return await KO(e,0,t,r,i.content),i.content}function nqe(e){return Xs.dirname(e)}var rte="https://api.cesium.com/v1/assets";async function ite(e,t){if(!t){let a=await aqe(e);for(let o of a.items)o.type==="3DTILES"&&(t=o.id)}let r=await oqe(e,t),{type:i,url:n}=r;return Ft(i==="3DTILES"&&n),r.headers={Authorization:`Bearer ${r.accessToken}`},r}async function aqe(e){Ft(e);let t=rte,r={Authorization:`Bearer ${e}`},i=await Ua(t,{headers:r});if(!i.ok)throw new Error(i.statusText);return await i.json()}async function oqe(e,t){Ft(e,t);let r={Authorization:`Bearer ${e}`},i=`${rte}/${t}`,n=await Ua(`${i}`,{headers:r});if(!n.ok)throw new Error(n.statusText);let a=await n.json();if(n=await Ua(`${i}/endpoint`,{headers:r}),!n.ok)throw new Error(n.statusText);let o=await n.json();return a=ne(ne({},a),o),a}async function sqe(e,t={}){t=t["cesium-ion"]||{};let{accessToken:r}=t,i=t.assetId;if(!Number.isFinite(i)){let n=e.match(/\/([0-9]+)\/tileset.json/);i=n&&n[1]}return ite(r,i)}var VS=Ye(ne({},gc),{id:"cesium-ion",name:"Cesium Ion",preload:sqe,parse:async(e,t,r)=>(t=ne({},t),t["3d-tiles"]=t["cesium-ion"],t.loader=VS,gc.parse(e,t,r)),options:{"cesium-ion":Ye(ne({},gc.options["3d-tiles"]),{accessToken:null})}});function Gf(e,t,r){let i=12;if(!t)return r+i;let{magic:n,version:a=1,byteLength:o=12}=e;return Ft(Array.isArray(n)&&Number.isFinite(a)&&Number.isFinite(o)),t.setUint8(r+0,n[0]),t.setUint8(r+1,n[1]),t.setUint8(r+2,n[2]),t.setUint8(r+3,n[3]),t.setUint32(r+4,a,!0),t.setUint32(r+8,o,!0),r+=i,r}function zf(e,t,r){!e||e.setUint32(t+8,r,!0)}function nte(e,t,r,i,n){e=ne({magic:jf.COMPOSITE,tiles:[]},e);let a=r;r+=Gf(e,t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let o=0;o<e.tiles.length;++o)r+=n(e.tiles[o],t,r,i);return zf(t,a,r-a),r}function ate(e,t,r,i){let{featuresLength:n=0,batchTable:a}=e,o={BATCH_LENGTH:n},s=JSON.stringify(o),u=a?JSON.stringify(a):"",l=xo(s.length,8),c=u?xo(u.length,8):0;e=ne({magic:jf.BATCHED_MODEL},e);let f=r;r=Gf(e,t,r),t&&(t.setUint32(12,l,!0),t.setUint32(16,0,!0),t.setUint32(20,c,!0),t.setUint32(24,0,!0)),r+=16,r=Im(t,r,s,8),a&&(r=Im(t,r,u,8));let h=e.gltfEncoded;return h&&(r=hy(t,r,h,h.byteLength)),zf(t,f,r-f),r}function ote(e,t,r,i){let{featuresLength:n=1,gltfFormat:a=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:n,POSITION:new Array(n*3).fill(0)},l=JSON.stringify(u),c=l.length;e=ne({magic:jf.INSTANCED_MODEL},e);let f=r;return r=Gf(e,t,0),t&&(t.setUint32(12,c,!0),t.setUint32(16,0,!0),t.setUint32(20,0,!0),t.setUint32(24,0,!0),t.setUint32(28,a,!0)),r+=20,r+=Cm(t,r,l,c),r+=Cm(t,r,o,s),zf(t,f,r-f),r}var uqe={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function ste(e,t,r,i){let{featureTableJson:n=uqe}=e,a=JSON.stringify(n);a=oP(a,4);let{featureTableJsonByteLength:o=a.length}=e,s=new ArrayBuffer(12),u=s.byteLength;e=ne({magic:jf.POINT_CLOUD},e);let l=r;return r+=Gf(e,t,0),t&&(t.setUint32(r+0,o,!0),t.setUint32(r+4,u,!0),t.setUint32(r+8,0,!0),t.setUint32(r+12,0,!0)),r+=16,r+=Cm(t,r,a,o),r+=hy(t,r,s,u),zf(t,l,r-l),r}function p8(e,t){let r=m8(e,null,0,t),i=new ArrayBuffer(r),n=new DataView(i);return m8(e,n,0,t),i}function m8(e,t,r,i){switch(Ft(typeof e.type=="string"),e.type){case ss.COMPOSITE:return nte(e,t,r,i,m8);case ss.POINT_CLOUD:return ste(e,t,r,i);case ss.BATCHED_3D_MODEL:return ate(e,t,r,i);case ss.INSTANCED_3D_MODEL:return ote(e,t,r,i);default:throw new Error("3D Tiles: unknown tile type")}}var g8={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:ag,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],encodeSync:lqe,binary:!0,options:{["3d-tiles"]:{}}};function lqe(e,t){return p8(e,t)}var Ba=Fe(require("path"));var sl=Fe(Ate()),b3t=sl.default.v1,_3t=sl.default.v3,yc=sl.default.v4,x3t=sl.default.v5,w3t=sl.default.NIL,E3t=sl.default.version,S3t=sl.default.validate,T3t=sl.default.stringify,A3t=sl.default.parse;var Ap=Fe(require("process")),sk=Fe(uu()),F6=Fe(k8());var L0=Fe(require("path")),qpe=Fe(uu());var Lte=()=>({folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}});var D0=Fe(require("fs")),M0=Fe(require("path"));var Mpe=Fe(require("zlib")),Lpe=Fe(require("path")),s_=Fe(require("fs")),vst=Fe(pfe());var yst=Fe(h6());var bst=Fe(S8());function Y2(e){let t=`${e}.gz`,r=(0,Mpe.createGzip)(),i=(0,s_.createReadStream)(e),n=(0,s_.createWriteStream)(t);return new Promise((a,o)=>{i.on("end",()=>{console.log(`${t} compressed and saved.`),a(t)}),i.on("error",s=>{console.log(`${t}: compression error!`),o(s)}),i.pipe(r).pipe(n)})}async function jpe(e,t,r,i,n){process.platform==="win32"?await xst(e,t,r,i,n):await _st(e,t,r,i)}async function _st(e,t,r=0,i="."){let n=u_(t),a=[`-${r}`,"-r",n,i];await new Sf().start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}async function xst(e,t,r=0,i=(0,Lpe.join)(".","*"),n){i[0]==="@"&&(i=`*${i.substr(1)}`);let a=u_(t),o=["a","-tzip",`-mx=${r}`,a,i];await new Sf().start({command:n,arguments:o,spawn:{cwd:`${e}`},wait:0})}async function Un(e,t,r="index.json"){let i;t instanceof Promise?i=new Uint8Array(await t):t instanceof ArrayBuffer?i=new Uint8Array(t):i=t,await D0.promises.mkdir(e,{recursive:!0});let n=(0,M0.join)(e,r);try{await D0.promises.writeFile(n,i)}catch(a){throw a}return console.log(`${n} saved.`),n}async function wl(e,t,r="index.json",i=!0,n){let a=await Un(e,t,r);if(i){if(n)return n.includes(a)?null:(n.push(a),`${a}.gz`);{let o=await Y2(a);return await d6(a),o}}return a}async function X2(e,t){return new Promise((r,i)=>{let n=0;console.log(`load ${e}/${t}.`);let a=setInterval(()=>{let o=(0,M0.join)(e,t);Wr(o,cP).then(s=>{clearInterval(a),r(s)}).catch(()=>{n++,n>100&&(clearInterval(a),i(new Error(`Cannon load ${e}/${t}.`)))})},200)})}async function Npe(e){try{return await D0.promises.stat(e),!0}catch{return!1}}function l_(e){return D0.promises.rm(e,{recursive:!0})}function d6(e){return D0.promises.unlink(e)}function u_(e){return(0,M0.isAbsolute)(e)?e:(0,M0.join)(process.cwd(),e)}var co=class{constructor(t,r,i){this.length=0;this.nodesPerPage=r,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=t,this.converter=i,this.length=0}useWriteFunction(t){this.writeFile=t}getNodePageFileName(t){let r,i;return this.converter.options.slpk?(r=(0,L0.join)(this.converter.layers0Path,"nodepages"),i=`${t.toString()}.json`):(r=(0,L0.join)(this.converter.layers0Path,"nodepages",t.toString()),i="index.json"),{filePath:r,fileName:i}}async loadNodePage(t){let{filePath:r,fileName:i}=this.getNodePageFileName(t),n=(0,L0.join)(r,i);return await Npe(n)?(console.log(`load ${n}.`),await X2(r,i)):{nodes:[]}}getPageIndexByNodeId(t){return Math.floor(t/this.nodesPerPage)}async getPageByNodeId(t){let r=this.getPageIndexByNodeId(t);return this.converter.options.instantNodeWriting?await this.loadNodePage(r):this.nodePages[r]}async getNodeById(t,r){let i=t%this.nodesPerPage;return r=r||await this.getPageByNodeId(t),r.nodes[i]}async addChildRelation(t,r){var n;if(t==null)return;let i=await this.getNodeById(t);(n=i.children)==null||n.push(r),await this.saveNode(i)}async push(t,r){if(t.index=this.nodesCounter++,!this.converter.options.instantNodeWriting){let i=this.nodePages[this.nodePages.length-1];i.nodes.length===this.nodesPerPage&&(i={nodes:[]},this.nodePages.push(i)),i.nodes.push(t)}return await this.addChildRelation(r,t.index),co.updateResourceInMesh(t),await this.saveNode(t),t}async saveNode(t){if(this.converter.options.instantNodeWriting){let r=this.getPageIndexByNodeId(t.index),i=await this.getPageByNodeId(t.index),{filePath:n,fileName:a}=this.getNodePageFileName(r),o=await this.getNodeById(t.index,i);o?co.updateAll(o,t):i.nodes.push(t);let s=JSON.stringify(i);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:()=>this.writeFile(n,s,a,!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(n,s)},!0)}else return}async saveMetadata(){let t=(0,qpe.default)({nodeCount:this.nodesCounter},Lte()),r=!1;await this.converter.writeQueue.enqueue({archiveKey:"metadata.json",writePromise:()=>this.writeFile(this.converter.layers0Path,JSON.stringify(t),"metadata.json",r)})}async save(){if(this.converter.options.instantNodeWriting){await this.saveMetadata();return}if(this.converter.options.slpk){for(let[t,r]of this.nodePages.entries()){let i=JSON.stringify(r),n=(0,L0.join)(this.converter.layers0Path,"nodepages");await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${t.toString()}.json.gz`,writePromise:()=>this.writeFile(n,i,`${t.toString()}.json`)})}await this.saveMetadata()}else for(let[t,r]of this.nodePages.entries()){let i=JSON.stringify(r),n=(0,L0.join)(this.converter.layers0Path,"nodepages",t.toString());await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(n,i)})}}static updateResourceInMesh(t){t.mesh&&isFinite(t.index)&&(t.mesh.geometry.resource=t.index)}static updateAll(t,r){return Object.assign(t,r,{index:t.index}),co.updateResourceInMesh(t),t}static updateMaterialByNodeId(t,r){!t.mesh||(t.mesh.material={definition:r,resource:t.index})}static updateVertexCountByNodeId(t,r){!t.mesh||(t.mesh.geometry.vertexCount=r)}static updateNodeAttributeByNodeId(t){!t.mesh||!t.index||(t.mesh.attribute.resource=t.index)}static updateFeatureCountByNodeId(t,r){!t.mesh||(t.mesh.geometry.featureCount=r)}static updateTexelCountHintByNodeId(t,r){!t.mesh||!t.mesh.material||(t.mesh.material.texelCountHint=r)}};var c_=Fe(require("path")),$2=Fe(require("fs"));function J2(e){let t=1e6,r=e[0],i=Math.floor(r/3600);r=r-i*3600;let n=Math.floor(r/60);r=r-n*60;let a=Math.floor(r),o=e[1]/t,s="";return i&&(s+=`${i}h `),n&&(s+=`${n}m `),a&&(s+=`${a}s`),s||(s+=`${o}ms`),s}async function Q2(e){let{slpk:t,outputPath:r,tilesetName:i}=e,n=u_(r);try{if(t){let s=(0,c_.join)(n,`${i}.slpk`);return(await $2.promises.stat(s)).size}let a=(0,c_.join)(n,i);return await Upe(a)}catch(a){return console.log("Calculate file sizes error: ",a),null}}async function Upe(e){let t=0,r=await $2.promises.readdir(e);for(let i of r){let n=await $2.promises.stat((0,c_.join)(e,i));n.isDirectory()?t+=await Upe((0,c_.join)(e,i)):t+=n.size}return t}var Rs=Fe(fr()),y6=Fe(ua());var ame=Fe(k8());var Sp=3,j0=9;function Gpe(e){let{positions:t,normals:r,texCoords:i,colors:n,uvRegions:a,featureIndices:o}=e,s=t.length/j0;if(!o.length)return{faceRange:new Uint32Array([0,s-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:i,colors:n,uvRegions:a};let u=wst(o),l=Est(ne(ne({},u),e)),c=Sst(l);return Tst(c,u.featureCount)}function wst(e){let t=1,r=1,i=zpe(e.slice(0,Sp)),n=[],a=[],o=[i];n[0]=0,a[0]=i;for(let l=Sp;l<e.length;l+=Sp){let c=zpe(e.slice(l,l+Sp));i!==c&&(n[t]=l/Sp-1,n[t+1]=l/Sp,a[r]=c,o.includes(c)||o.push(c),t+=2,r+=1),i=c}n[t]=e.length/Sp-1;let s=new Uint32Array(n),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}function zpe(e){let t={},r=e[0],i=1;for(let n of e)t[n]=(t[n]||0)+1,i=i>t[n]?i:t[n],r=i>t[n]?r:n;return r}function Est(e){let{featureIds:t,positions:r,normals:i,colors:n,uvRegions:a,texCoords:o,faceRange:s=new Uint32Array(0)}=e,u=[],l=new Float32Array(r),c=new Float32Array(i),f=new Uint8Array(n),h=new Float32Array(o),d=new Uint16Array(a);for(let p=0;p<t.length;p++){let y=s[p*2],g=s[p*2+1],b=f_("positions",y,g),E=f_("normals",y,g),A=f_("colors",y,g),k=f_("uvRegions",y,g),R=f_("texCoords",y,g);u.push({featureId:t[p],positions:l.slice(0,b),normals:c.slice(0,E),colors:f.slice(0,A),uvRegions:d.slice(0,k),texCoords:h.slice(0,R)}),l=l.slice(b),c=c.slice(E),f=f.slice(A),d=d.slice(k),h=h.slice(R)}return u.sort((p,y)=>p.featureId-y.featureId)}function f_(e,t,r){let i=4,n=2,a=r-t+1,o=a*3;switch(e){case"positions":case"normals":return a*j0;case"colors":case"uvRegions":return o*i;case"texCoords":return o*n;default:return 0}}function Sst(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],n=t.find(a=>a.featureId===i.featureId);n?(n.positions=sa(n.positions,i.positions),n.normals=sa(n.normals,i.normals),n.colors=sa(n.colors,i.colors),n.texCoords=sa(n.texCoords,i.texCoords)):t.push(i)}return t}function Tst(e,t){let r=e[0],i=[r.featureId||0],n=new Float32Array(r.positions),a=new Float32Array(r.normals),o=new Uint8Array(r.colors),s=new Uint16Array(r.uvRegions),u=new Float32Array(r.texCoords),l=[0],c=0,f=0;for(let d=1;d<e.length;d++){let p=e[d];i.push(p.featureId||0),n=sa(n,p.positions),a=sa(a,p.normals),o=sa(o,p.colors),s=sa(s,p.uvRegions),u=sa(u,p.texCoords);let y=e[c];l.push(y.positions.length/j0-1+f),l.push(y.positions.length/j0+f),f+=y.positions.length/j0,c+=1}return l.push(n.length/j0-1),{faceRange:new Uint32Array(l),featureIds:i,positions:n,normals:a,colors:o,uvRegions:s,texCoords:u,featureCount:t}}var Pa=Fe(fr()),N0=Fe(ua()),Lc=Fe(tl());function p6(e,t){let r,i,n,a=N0.Ellipsoid.WGS84.cartesianToCartographic(e.center,new Pa.Vector3);return a[2]=a[2]-t.getHeight(a[1],a[0]),e instanceof Lc.OrientedBoundingBox?(i=e.halfSize,r=new Pa.Vector3(i[0],i[1],i[2]).len(),n=e.quaternion):(r=e.radius,i=[r,r,r],n=new Pa.Quaternion().fromMatrix3(new Pa.Matrix3([i[0],0,0,0,i[1],0,0,0,i[2]])).normalize()),{mbs:[a[0],a[1],a[2],r],obb:{center:[a[0],a[1],a[2]],halfSize:i,quaternion:n}}}function Hpe(e,t){let r=Ast(e),i=(0,Lc.makeOrientedBoundingBoxFromPoints)(r),n=(0,Lc.makeBoundingSphereFromPoints)(r),a=N0.Ellipsoid.WGS84.cartesianToCartographic(n.center,new Pa.Vector3),o=N0.Ellipsoid.WGS84.cartesianToCartographic(i.center,new Pa.Vector3);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],n.radius],obb:{center:o,halfSize:i.halfSize,quaternion:i.quaternion}}}function Ast(e){let t=[];for(let r=0;r<e.length;r+=3){let i=new Pa.Vector3([e[r],e[r+1],e[r+2]]);t.push(i)}return t}function Wpe(e){let t;e instanceof Lc.BoundingSphere?t=e:t=e.getBoundingSphere();let r=t.center,i=t.radius,n=N0.Ellipsoid.WGS84.cartesianToCartographic(new Pa.Vector3(r[0]+i,r[1]+i,r[2]+i),new Pa.Vector3),a=N0.Ellipsoid.WGS84.cartesianToCartographic(new Pa.Vector3(r[0]-i,r[1]-i,r[2]-i),new Pa.Vector3);return{xmin:Math.min(a[0],n[0]),xmax:Math.max(a[0],n[0]),ymin:Math.min(a[1],n[1]),ymax:Math.max(a[1],n[1]),zmin:Math.min(a[2],n[2]),zmax:Math.max(a[2],n[2])}}function m6(e){let t=e[3],r=new Pa.Vector3(e[0],e[1],e[2]),i=new Pa.Matrix3([t,0,0,0,t,0,0,0,t]);return new Lc.OrientedBoundingBox(r,i)}var Tp=Fe(fr()),Vpe=Fe(ua());function Kpe(e,t,r){var s,u,l,c,f,h,d,p;let i=((u=(s=e.gltf)==null?void 0:s.scene)==null?void 0:u.nodes)||((f=(c=(l=e.gltf)==null?void 0:l.scenes)==null?void 0:c[0])==null?void 0:f.nodes)||((h=e.gltf)==null?void 0:h.nodes)||[],n=((p=(d=e.gltf)==null?void 0:d.images)==null?void 0:p.map(y=>{var g,b;if((g=y==null?void 0:y.image)==null?void 0:g.compressed)return null;{let E=(b=y==null?void 0:y.image)==null?void 0:b.data,A=new Uint8Array(E.length);return A.set(E),{data:A,compressed:!1,height:y.image.height,width:y.image.width,components:y.image.components,mimeType:y.mimeType}}}))||[];Ype(i);let{cartographicOrigin:a,modelMatrix:o}=Rst(e,t,r);return{nodes:i,images:n,cartographicOrigin:a,cartesianModelMatrix:o}}function kst(e){let t={};for(let r in e)t[r]={value:e[r].value};return t}function Rst(e,t,r){let{rtcCenter:i,gltfUpAxis:n}=e,{center:a}=r,o=new Tp.Matrix4(t);switch(i&&o.translate(i),n){case"Z":break;case"Y":let l=new Tp.Matrix4().rotateX(Math.PI/2);o=o.multiplyRight(l);break;case"X":let c=new Tp.Matrix4().rotateY(-Math.PI/2);o=o.multiplyRight(c);break;default:break}let s=new Tp.Vector3(a),u=Vpe.Ellipsoid.WGS84.cartesianToCartographic(s,new Tp.Vector3);return{modelMatrix:o,cartographicOrigin:u}}function Ype(e){var t;for(let r=0;r<e.length;r++){let i=e[r];i.mesh&&(e[r]=Ye(ne({},i),{mesh:Ye(ne({},i.mesh),{primitives:(t=i.mesh)==null?void 0:t.primitives.map(n=>{var a,o,s;return Ye(ne({},n),{indices:{value:(a=n==null?void 0:n.indices)==null?void 0:a.value},attributes:kst(n.attributes),material:{id:(o=n==null?void 0:n.material)==null?void 0:o.id,uniqueId:(s=n==null?void 0:n.material)==null?void 0:s.uniqueId}})})})})),i.children&&Ype(i.children)}}var Cst="EXT_mesh_features",Ist="EXT_feature_metadata";function Xpe(e,t,r){let i=t==null?void 0:t.extensions;if(!i)return[];for(let[n,a]of Object.entries(i||{}))switch(n){case Ist:return Pst(e,a,r);case Cst:return console.warn("EXT_mesh_features extension is not supported yet"),[];default:return[]}return[]}function Pst(e,t,r){var o,s,u,l,c,f,h;let i=(o=t==null?void 0:t.featureIdAttributes)==null?void 0:o[0];if((s=i==null?void 0:i.featureIds)==null?void 0:s.attribute)return e[i.featureIds.attribute].value;if(((u=i==null?void 0:i.featureIds)==null?void 0:u.hasOwnProperty("constant"))&&((l=i==null?void 0:i.featureIds)==null?void 0:l.hasOwnProperty("divisor"))){let d=((c=e==null?void 0:e.POSITIONS)==null?void 0:c.value.length)/3||0;return Bst(d,i.featureIds.constant,i.featureIds.divisor)}let n=(t==null?void 0:t.featureIdTextures)&&(t==null?void 0:t.featureIdTextures[0]);if(n){let p=`TEXCOORD_${((h=(f=n==null?void 0:n.featureIds)==null?void 0:f.texture)==null?void 0:h.texCoord)||0}`,y=e[p].value;return Ost(n,y,r)}let a=(t==null?void 0:t.featureTextures)&&(t==null?void 0:t.featureTextures[0]);return a?e[a].value:[]}function Bst(e,t=0,r=0){let i=[];if(r>0){let n=t,a=r;for(let o=0;o<e;o++)i.push(n),a-=1,a===0&&(n++,a=r)}else i=Array(e).fill(t,0,e);return i}function Ost(e,t,r){var l,c,f;if(!(r==null?void 0:r.length))return[];let i={r:0,g:1,b:2,a:3},n=(c=(l=e==null?void 0:e.featureIds)==null?void 0:l.texture)==null?void 0:c.index,a=(f=e==null?void 0:e.featureIds)==null?void 0:f.channels;if(!a||n===void 0)return[];let o=r[n],s=[],u=i[a];if(o&&(o==null?void 0:o.width)&&(o==null?void 0:o.height)&&(o==null?void 0:o.components))for(let h=0;h<t.length;h+=2){let d=t[h],p=t[h+1],y=Math.min($pe(d)*o.width|0,o.width-1),b=(Math.min($pe(p)*o.height|0,o.height-1)*o.width+y)*o.components+u,E=new Uint8Array(o.data)[b];s.push(E)}else console.warn(`Can't get batch Ids from ${(o==null?void 0:o.mimeType)||""} compressed texture`);return s}function $pe(e){return(e%1+1)%1}function Jpe(e,t){let r={};for(let i in t){let n=t[i];r[i]=Fst(n,e)}return r}function Fst(e,t){let r=[];for(let i of t){let n=e[i]||null;r.push(n)}return r}function Qpe(e,t){let r=!1;for(let i of Object.values(t))e.length!==i.length&&(r=!0);return r}var h_="string",g6="Int32",v6="double",Z2="OBJECTID";function Zpe(e,t){return e===Z2?Z2:typeof t===h_?h_:typeof t=="number"?Number.isInteger(t)?g6:v6:h_}function eme(e,t,r){let i={key:`f_${e}`,name:t,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(r){case Z2:Dst(i);break;case h_:nme(i);break;case v6:Mst(i);break;case g6:break;default:nme(i)}return i}function tme(e){switch(e){case Z2:return"esriFieldTypeOID";case h_:return"esriFieldTypeString";case g6:return"esriFieldTypeInteger";case v6:return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}function rme(e,t){return{name:e,type:t,alias:e}}function ime(e){let t="{OBJECTID}",r=[],i=[],n=[],a=[];for(let o in e)i.push({fieldName:o,visible:!0,isEditable:!1,label:o});return n.push({fieldInfos:i,type:"fields"}),{title:t,mediaInfos:r,popupElements:n,fieldInfos:i,expressionInfos:a}}function nme(e){e.ordering.unshift("attributeByteCounts"),e.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),e.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},e.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}function Dst(e){e.attributeValues={valueType:"Oid32",valuesPerElement:1}}function Mst(e){e.attributeValues={valueType:"Float64",valuesPerElement:1}}var ek=e=>{let t=new Uint32Array(e);for(let r=0;r<e;r++)t[r]=r;return t};var Lst=1,jst=1,gu=3,d_=2,Nst=4,qst="string",Ust="Int32",Gst="Float64",zst="Oid32",ome=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"],sme="EXT_feature_metadata",ume="EXT_mesh_features",Nh=new Rs.Vector3;async function b6(e,t,r,i,n,a,o,s,u,l,c,f){var b;let h=u,d=await nut((b=e.gltf)==null?void 0:b.materials,l),p=Kpe(e,t,r),y=await Vst(p,d,h);u&&Hst(y,c);let g=[];for(let E of d){let A=E.mergedMaterials[0].originalMaterialId;if(!y.has(A))continue;let k=y.get(A);if(!k)continue;let{material:R,texture:F}=E,C=await i();g.push(await Wst({convertedAttributes:k,material:R,texture:F,tileContent:e,nodeId:C,featuresHashArray:a,propertyTable:n,attributeStorageInfo:o,draco:s,workerSource:f}))}return g.length?g:null}function Hst(e,t){for(let r of e.values()){let i=Hpe(r.positions,t);r.boundingVolumes=i;let n=i.obb.center;for(let a=0;a<r.positions.length;a+=gu){let o=r.positions.subarray(a,a+gu);y6.Ellipsoid.WGS84.cartesianToCartographic(Array.from(o),Nh),Nh[2]=Nh[2]-t.getHeight(Nh[1],Nh[0]),Nh=Nh.subtract(n),r.positions.set(Nh,a)}}}async function Wst({convertedAttributes:e,material:t,texture:r,tileContent:i,nodeId:n,featuresHashArray:a,propertyTable:o,attributeStorageInfo:s,draco:u,workerSource:l}){var O;let c=e.boundingVolumes,f=e.positions.length/gu,{faceRange:h,featureIds:d,positions:p,normals:y,colors:g,uvRegions:b,texCoords:E,featureCount:A}=Gpe(e);i.batchTableJson&&mut(d,e.featureIndices,a,i.batchTableJson);let k=new Uint32Array(2),R=Sut(d);k.set([f,A],0);let F=new Uint8Array(Vu(k.buffer,p.buffer,y.buffer,r?E.buffer:new ArrayBuffer(0),g.buffer,b,R.buffer,h.buffer)),C=u?Tut(f,e,{positions:p,normals:y,texCoords:r?E:new Float32Array(0),colors:g,uvRegions:b,featureIds:d,faceRange:h},l.draco):null,j=[];return s&&o&&(j=but(d,o,s)),{nodeId:n,geometry:F,compressedGeometry:C,texture:r,hasUvRegions:Boolean(b.length),sharedResources:cut(((O=i.gltf)==null?void 0:O.materials)||[],n),meshMaterial:t,vertexCount:f,attributes:j,featureCount:A,boundingVolumes:c}}async function Vst(e,t,r){let{nodes:i,images:n,cartographicOrigin:a,cartesianModelMatrix:o}=e,s=new Map;for(let u of t){let l={positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),uvRegions:new Uint16Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null,mergedMaterials:u.mergedMaterials};for(let c of u.mergedMaterials)s.set(c.originalMaterialId,l)}lme(i,n,a,o,s,r);for(let u of s.keys()){let l=s.get(u);if(!!l){if(l.positions.length===0){s.delete(u);continue}l.featureIndicesGroups&&(l.featureIndices=l.featureIndicesGroups.reduce((c,f)=>c.concat(f)),delete l.featureIndicesGroups)}}return s}function lme(e,t,r,i,n,a,o=new Rs.Matrix4([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){if(e)for(let s of e)Yst(s,t,r,i,n,a,o)}function Kst(e,t){let r=t,{matrix:i,rotation:n,scale:a,translation:o}=e;return i&&(r=t.multiplyRight(i)),o&&(r=r.translate(o)),n&&(r=r.rotateXYZ(n)),a&&(r=r.scale(a)),r}function Yst(e,t,r,i,n,a,o=new Rs.Matrix4([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){let s=Kst(e,o),u=e.mesh;u&&Xst(u,t,r,i,n,a,s),lme(e.children||[],t,r,i,n,a,s)}function Xst(e,t,r,i,n,a=!1,o=new Rs.Matrix4([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){var s;for(let u of e.primitives){let l=null,c;u.material?(l=n.get(u.material.id),c=(s=l==null?void 0:l.mergedMaterials.find(({originalMaterialId:d})=>{var p;return d===((p=u.material)==null?void 0:p.id)}))==null?void 0:s.uvRegion):n.has("default")&&(l=n.get("default")),Ft(l!==null,"Primitive - material mapping failed"),Ft(u.mode===void 0||u.mode===Zt.TRIANGLES||u.mode===Zt.TRIANGLE_STRIP,`Primitive - unsupported mode ${u.mode}`);let f=u.attributes;if(!l)continue;let h=$st(u);l.positions=sa(l.positions,cme({vertices:f.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:i,nodeMatrix:o,indices:h,attributeSpecificTransformation:Jst,useCartesianPositions:a})),l.normals=sa(l.normals,cme({vertices:f.NORMAL&&f.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:i,nodeMatrix:o,indices:h,attributeSpecificTransformation:Qst,useCartesianPositions:!1})),l.texCoords=sa(l.texCoords,Zst(f.TEXCOORD_0&&f.TEXCOORD_0.value,h)),l.colors=sa(l.colors,eut(f.COLOR_0,h)),c&&(l.uvRegions=sa(l.uvRegions,tut(c,h))),l.featureIndicesGroups=l.featureIndicesGroups||[],l.featureIndicesGroups.push(rut(iut(f,u,t),h))}}function $st(e){var r;let t=(r=e.indices)==null?void 0:r.value;if(!t){let i=e.attributes.POSITION.value;return ek(i.length/gu)}if(t&&e.mode===Zt.TRIANGLE_STRIP){let i=t.constructor,n=new i((t.length-2)*3),a=0,o=t.slice(0,3);n.set(o,0);for(let s=1;s+2<t.length;s++)a+=3,o=t.slice(s,s+3),s%2==0?n.set(o,a):n.set(o.reverse(),a);t=n}return t}function cme(e){let{vertices:t,indices:r,attributeSpecificTransformation:i}=e,n=new Float32Array(r.length*gu);if(!t)return n;for(let a=0;a<r.length;a++){let o=r[a]*gu,s=t.subarray(o,o+gu),u=new Rs.Vector3(Array.from(s));u=i(u,e),n[a*gu]=u.x,n[a*gu+1]=u.y,n[a*gu+2]=u.z}return n}function Jst(e,t){let{cartesianModelMatrix:r,cartographicOrigin:i,nodeMatrix:n,useCartesianPositions:a}=t;return n&&(e=e.transform(n)),e=e.transform(r),a||(y6.Ellipsoid.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(i)),e}function Qst(e,t){let{cartesianModelMatrix:r,nodeMatrix:i}=t;return i&&(e=e.transformAsVector(i)),e=e.transformAsVector(r),e}function Zst(e,t){let r=new Float32Array(t.length*d_);if(!e)return r.fill(1),r;for(let i=0;i<t.length;i++){let n=t[i]*d_,a=e.subarray(n,n+d_);r[i*d_]=a[0],r[i*d_+1]=a[1]}return r}function eut(e,t){let r=(e==null?void 0:e.components)||Nst,i=new Uint8Array(t.length*r);if(!e)return i.fill(255),i;let n=e.value;for(let a=0;a<t.length;a++){let o=t[a]*r,s=n.subarray(o,o+r),u=new Uint8Array(r);for(let l=0;l<s.length;l++)u[l]=s[l]*255;i.set(u,a*r)}return i}function tut(e,t){let r=new Uint16Array(t.length*4);for(let i=0;i<r.length;i+=4)r.set(e,i);return r}function rut(e,t){if(!e.length||!t.length)return[];let r=[];for(let i=0;i<t.length;i++){let n=t[i];r.push(e[n])}return r}function iut(e,t,r){let i=Xpe(e,t,r);if(i.length)return i;for(let n=0;n<ome.length;n++){let a=ome[n];if(e[a]&&e[a].value)return e[a].value}return[]}async function nut(e=[],t){let r=[];for(let i of e)r.push(sut(i));return t&&(r=await aut(r)),r}async function aut(e){var r,i;let t=[];for(;e.length>0;){let n=e.splice(0,1)[0],a=[];for(let o=0;o<e.length;o++){let s=e[o];(n.texture&&s.texture||!n.texture&&!s.texture)&&(n=await out(n,s),a.push(o))}if(n.texture&&a.length){let o=(r=n.mergedMaterials)==null?void 0:r.reduce((l,{textureSize:c})=>l+((c==null?void 0:c.width)||0),0),s=(i=n.mergedMaterials)==null?void 0:i.reduce((l,{textureSize:c})=>Math.max(l,(c==null?void 0:c.height)||0),0),u=-1;for(let l of n.mergedMaterials)if(l.textureSize){let c=u+1+l.textureSize.width/o*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1;l.uvRegion=new Uint16Array([u+1,0,c,l.textureSize.height/s*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1]),u=c}n.texture.image.width=o,n.texture.image.height=s}for(let o of a.reverse())e.splice(o,1);t.push(n)}return t.length||t.push({material:lut(),mergedMaterials:[{originalMaterialId:"default"}]}),t}async function out(e,t){var r,i;if(((r=e.texture)==null?void 0:r.bufferView)&&((i=t.texture)==null?void 0:i.bufferView)&&e.mergedMaterials&&t.mergedMaterials){let n=Buffer.from(e.texture.bufferView.data),a=Buffer.from(t.texture.bufferView.data);try{let{joinImages:o}=await import("join-images"),s=await o([n,a],{direction:"horizontal"});e.texture.bufferView.data=await s.toFormat(e.texture.mimeType==="image/png"?"png":"jpeg").toBuffer()}catch(o){throw console.log("Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)"),o}e.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId=1}return e.mergedMaterials=e.mergedMaterials.concat(t.mergedMaterials),e}function sut(e){var n,a,o,s,u;let t={doubleSided:e.doubleSided,emissiveFactor:(n=e.emissiveFactor)==null?void 0:n.map(l=>Math.round(l*255)),alphaMode:uut(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:((a=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:a.roughnessFactor)||Lst,metallicFactor:((o=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:o.metallicFactor)||jst}},r;((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)?(r=e.pbrMetallicRoughness.baseColorTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(r=e.emissiveTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),e.id=Number.isFinite(e.id)?e.id:yc();let i=[{originalMaterialId:e.id}];if(r)i[0].textureSize={width:r.image.width,height:r.image.height};else{let l=(u=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:u.baseColorFactor;t.pbrMetallicRoughness.baseColorFactor=l&&l.map(c=>Math.round(c*255))||void 0}return{material:t,texture:r,mergedMaterials:i}}function uut(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function lut(){return{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}}function cut(e,t){let r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(let i of e){let{materialDefinitionInfo:n,textureDefinitionInfo:a}=fut(i,t);r.materialDefinitionInfos.push(n),a&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(a))}return r}function fut(e,t){var s;let r=((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)||e.emissiveTexture,i=null;r&&(i=dut(r.texture,t));let{baseColorFactor:n,metallicFactor:a}=(e==null?void 0:e.pbrMetallicRoughness)||{},o=n;return(!n||n[3]===0)&&e.emissiveFactor&&(o=e.emissiveFactor,o[3]=o[3]||1),{materialDefinitionInfo:hut(o||[1,1,1,1],a),textureDefinitionInfo:i}}function hut(e,t=1){let r=.04/255,i=new Rs.Vector4(0,0,0,1),n=new Rs.Vector4(1,1,1,1),a=new Rs.Vector4(r,r,r,0),o=new Rs.Vector4(e),s=n.subtract(a).multiply(o),u=s.lerp(s,i,t);a[3]=1;let l=a.lerp(a,o,t);return{params:{diffuse:u.toArray(),specular:l.toArray(),renderMode:"solid"}}}function dut(e,t){var r,i,n,a;return{encoding:((r=e==null?void 0:e.source)==null?void 0:r.mimeType)?[e.source.mimeType]:void 0,images:[{id:put(e,t),size:(i=e.source)==null?void 0:i.image.width,length:((n=e.source)==null?void 0:n.image.data.length)?[(a=e.source)==null?void 0:a.image.data.length]:void 0}]}}function put(e,t){var y;let{width:r,height:i}=((y=e.source)==null?void 0:y.image)||{};if(!r||!i)return"";let n=1,a=0,o=t+1,s=32-o.toString(2).length,u="0".repeat(s).concat(o.toString(2)),l=n<<28,c=a<<24,f=r-1<<12,h=i-1<<0,d=l+c+f+h;return BigInt(`0b${d.toString(2)}${u}`).toString()}function mut(e,t,r,i){let n=gut(e,i,r);fme(t,n),fme(e,n)}function gut(e,t,r){let i={};for(let n=0;n<e.length;n++){let a=e[n],o=yut(n,t,r);i[a.toString()]=o}return i}function vut(e,t){let r="";for(let i in e)r+=e[i][t];return r}function yut(e,t,r){let i=vut(t,e),n=(0,ame.default)(i);return r.includes(n)?r.indexOf(n):r.push(n)-1}function fme(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function but(e,t,r){let i=[],a=Qpe(e,t)?Jpe(e,t):t,o=ne({OBJECTID:e},a);for(let s in o){let u=xut(s,r),l=o[s],c=_ut(u,l);i.push(c)}return i}function _ut(e,t){let r;switch(e){case zst:case Ust:r=wut(t);break;case Gst:r=Eut(t);break;case qst:r=hme(t);break;default:r=hme(t)}return r}function xut(e,t){return t.find(i=>i.name===e).attributeValues.valueType}function wut(e){let t=new Uint32Array([e.length]),r=new Uint32Array(e);return Vu(t.buffer,r.buffer)}function Eut(e){let t=new Uint32Array([e.length]),r=new Uint8Array(4),i=new Float64Array(e);return Vu(t.buffer,r.buffer,i.buffer)}function hme(e){let t=new Uint32Array([e.length]),r=0,i=new Uint32Array(e.length),n=[];for(let o=0;o<e.length;o++){let s=`${String(e[o])}\0`,u=Buffer.from(s),l=u.length;r+=l,i[o]=l,n.push(u)}let a=new Uint32Array([r]);return Vu(t.buffer,a.buffer,i.buffer,...n)}function Sut(e){let t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}async function Tut(e,t,r,i){let{positions:n,normals:a,texCoords:o,colors:s,uvRegions:u,featureIds:l,faceRange:c}=r,f=new Uint32Array(e);for(let g=0;g<f.length;g++)f.set([g],g);let h=new Uint32Array(t.featureIndices.length?t.featureIndices:e),d=Aut(h,c),p={positions:n,normals:a,colors:s,"feature-index":d};o.length&&(p.texCoords=o);let y={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(l)}};return u.length&&(p["uv-region"]=u,y["uv-region"]={"i3s-attribute-type":"uv-region"}),Mm({attributes:p,indices:f},Qy,Ye(ne({},Qy.options),{source:i,reuseWorkers:!0,_nodeWorkers:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:y}}))}function Aut(e,t){let r=new Uint32Array(e.length),i=0,n=0;for(let a=1;a<t.length;a+=2){let o=(t[a]+1)*gu;r.fill(i,n,o),i++,n=o+1}return r}function dme(e){if(!e)return null;let t=e==null?void 0:e.batchTableJson;if(t)return t;let{extensionName:r,extension:i}=kut(e);switch(r){case ume:return console.warn("The I3S converter does not yet support the EXT_mesh_features extension"),null;case sme:return Rut(i);default:return null}}function kut(e){var a,o,s,u;let t=[sme,ume];if(!((a=e==null?void 0:e.gltf)==null?void 0:a.extensionsUsed))return{extensionName:null,extension:null};let i="";for(let l of((o=e==null?void 0:e.gltf)==null?void 0:o.extensionsUsed)||[])if(t.includes(l)){i=l;break}if(!i)return{extensionName:null,extension:null};let n=(u=(s=e==null?void 0:e.gltf)==null?void 0:s.extensions)==null?void 0:u[i];return{extensionName:i,extension:n}}function Rut(e){var t,r;if(e==null?void 0:e.featureTables){let i=(t=Object.keys(e.featureTables))==null?void 0:t[0];if(i){let n=e==null?void 0:e.featureTables[i],a={};for(let o in n.properties)a[o]=n.properties[o].data;return a}}if(e==null?void 0:e.featureTextures){let i=(r=Object.keys(e.featureTextures))==null?void 0:r[0];if(i){let n=e==null?void 0:e.featureTextures[i],a={};for(let o in n.properties)a[o]=n.properties[o].data;return a}}return console.warn("The I3S converter couldn't handle EXT_feature_metadata extension: There is neither featureTables, no featureTextures in the extension."),null}var mme=Fe(uu()),gme=Fe(require("path"));var pme=()=>({serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}});async function vme(e,t,r){let i={serviceItemId:yc().replace(/-/gi,""),layerName:e,layers0:t},n=(0,mme.default)(i,pme()),a=(0,gme.join)(r,"SceneServer");await Un(a,JSON.stringify(n))}var _6=16;function yme(e,t){let r=[],i=e.boundingVolume,n=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:t.mbs[3]*2*_6/n},o={metricType:"maxScreenThresholdSQ",maxError:Math.PI*.25*a.maxError*a.maxError};return i.constructor.name==="OrientedBoundingBox"?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function x6(e){let r=(e.header.lodSelection.maxScreenThreshold||{}).maxError;if(!r){let i=e.header.lodSelection.maxScreenThresholdSQ;i&&(r=Math.sqrt(i.maxError/(Math.PI*.25)))}return r||(r=_6),e.header.mbs[3]*2*_6/r}var Pme=Fe(Ime()),Qut="4.0.0-alpha.17",nk={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:Qut,mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>(0,Pme.parsePGM)(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};var q0=Fe(uu());var Bme={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}};var Zut=()=>({wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}}),elt=()=>({heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}}),tlt=()=>({nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}}),rlt=()=>({xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}}),Ome=()=>({version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>(0,q0.default)(e,Zut())},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>(0,q0.default)(e,Bme)},fullExtent:{path:"fullExtent",transform:e=>(0,q0.default)(e,rlt())},heightModelInfo:{path:"heightModelInfo",transform:e=>(0,q0.default)(e,elt())},nodePages:{path:"nodePages",transform:e=>(0,q0.default)(e,tlt())},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"geometryDefinitions",default:[]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}});var A6=Fe(uu()),ilt=()=>({offset:{default:8},position:{default:{type:"Float32",component:3}},normal:{default:{type:"Float32",component:3}},uv0:{path:"hasTexture",transform:e=>e&&{type:"Float32",component:2}||!1,omitValues:[!1]},color:{default:{type:"UInt8",component:4}},uvRegion:{path:"hasUvRegions",transform:e=>e&&{type:"UInt16",component:4}||!1,omitValues:[!1]},featureId:{default:{binding:"per-feature",type:"UInt64",component:1}},faceRange:{default:{binding:"per-feature",type:"UInt32",component:2}}}),nlt=()=>({"compressedAttributes.encoding":{default:"draco"},"compressedAttributes.attributes":{path:"geometryConfig",transform:e=>{let t=["position","normal"];return e.hasTexture&&t.push("uv0"),t.push("color"),e.hasUvRegions&&t.push("uv-region"),t.push("feature-index"),t}}}),Fme=()=>({geometryBuffers:{path:"geometryConfig",transform:e=>{let t=[(0,A6.default)(e,ilt())];return e.draco&&t.push((0,A6.default)({geometryConfig:e},nlt())),t}}});var p_=Fe(uu()),alt=()=>({renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1]},diffuse:{path:"diffuse",default:[1,1,1]},specular:{path:"specular",default:[0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}}),olt=()=>({name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>(0,p_.default)(r,alt())}}),slt=()=>({id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}),ult=()=>({encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(i=>(0,p_.default)(i,slt()))}}),Dme=()=>({materialDefinitions:{path:"materialDefinitionInfos",transform:llt},textureDefinitions:{path:"textureDefinitionInfos",transform:clt}});function llt(e,t,r){let i={};for(let[n,a]of e.entries())i[`Mat${r.nodePath}${n}`]=(0,p_.default)(a,olt());return i}function clt(e,t,r){if(!e)return null;let i={};for(let[n,a]of e.entries()){let o=`${r.nodePath}${n}`;a.imageIndex=o,i[o]=(0,p_.default)(a,ult())}return i}var ak=Fe(tl()),Mme=Fe(fr()),k6=Fe(ua()),flt=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]);function Lme(e){var r,i;if(!((r=e==null?void 0:e.parentNode)==null?void 0:r.obb)||!((i=e==null?void 0:e.parentNode)==null?void 0:i.mbs))return[];let t=[];return hlt(t,e),dlt(t,e),t}function hlt(e,t){var o;let r=plt(t.parentNode.obb),i=mlt(t);if(glt(r,i))return;let a=`OBB of Tile (${t.id}) doesn't fit into Parent (${(o=t.parentNode)==null?void 0:o.id}) tile OBB`;e.push(a)}function dlt(e,t){var a;let r=jme(t.mbs),i=jme(t.parentNode.mbs);if(r.center.distanceTo(i.center)+r.radius>i.radius){let o=`MBS of Tile (${t.id}) doesn't fit into Parent (${(a=t.parentNode)==null?void 0:a.id}) tile MBS`;e.push(o)}}function jme(e){return new ak.BoundingSphere([e[0],e[1],e[2]],e[3])}function plt(e){let{center:t,halfSize:r,quaternion:i}=e;return new ak.OrientedBoundingBox().fromCenterHalfSizeQuaternion(t,r,i)}function mlt(e){let t=e.obb.halfSize,r=flt,i=k6.Ellipsoid.WGS84.cartographicToCartesian(e.obb.center),n=[];for(let a=0;a<r.length;a+=3){let s=new Mme.Vector3(r[a]*=t[0],r[a+1]*=t[1],r[a+2]*=t[2]).transformByQuaternion(e.obb.quaternion).add(i);n=n.concat(s)}return n}function glt(e,t){let r=!0;for(let i=0;i<t.length/3;i+=3){let n=[t[i],t[i+1],t[i+2]],a=k6.Ellipsoid.WGS84.cartesianToCartographic(n);if(e.distanceTo(a)>0){r=!1;break}}return r}var Mo;(function(s){s.POINTS="POINTS",s.LINES="LINES",s.LINE_LOOP="LINE_LOOP",s.LINE_STRIP="LINE_STRIP",s.TRIANGLES="TRIANGLES",s.TRIANGLE_STRIP="TRIANGLE_STRIP",s.TRIANGLE_FAN="TRIANGLE_FAN"})(Mo||(Mo={}));var R6=class extends Array{enqueue(t){this.push(t)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return this.length===0}};var Nme=Fe(require("process")),vlt=4*1024*1024*1024,m_=class extends R6{constructor(t=2e3,r=400){super();this.writePromise=null;this.fileMap={};this.listeningInterval=t,this.writeConcurrency=r}async enqueue(t,r=!1){if(r){let{archiveKey:i,writePromise:n}=t,a=await n();i&&a&&(this.fileMap[i]=a)}else super.enqueue(t),Nme.default.memoryUsage().rss>vlt&&await this.startWrite()}startListening(){this.intervalId=setInterval(this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){this.writePromise||(this.writePromise=this.doWrite()),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){let t=[],r=[];for(let n=0;n<this.writeConcurrency;n++){let a=this.dequeue();if(!a)break;let{archiveKey:o,writePromise:s}=a;r.push(o);let u=s();t.push(u)}let i=await Promise.allSettled(t);this.updateFileMap(r,i)}}updateFileMap(t,r){for(let i=0;i<t.length;i++){let n=t[i];n&&"value"in r[i]&&(this.fileMap[n]=r[i].value)}}};var U0="Tile converter does not work in browser, only in node js environment";var I6=Fe(require("path")),P6=Fe(uu());var qme=Fe(uu()),Ume=()=>({mbs:{path:"mbs"},obb:{path:"obb"}}),ylt=()=>({href:{path:"href"}}),blt=()=>ne(ne({id:{path:"id"}},ylt()),Ume()),C6=()=>Ye(ne({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"}},Ume()),{lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>(0,qme.default)(e,blt()),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});var El=class{constructor(t,r){this.data=null;this.children=[];this._finalized=!1;this.inPageId=t,this.id=t===0?"root":t.toString(),this.converter=r}get finalized(){return this._finalized}async addData(t){return this.converter.options.instantNodeWriting?await this.write(t):this.data=t,this}async addChildren(t){let r=[];for(let n of t){let a=await n.load();r.push({id:n.id,href:`../${n.id}`,obb:a.obb,mbs:a.mbs})}this.children=this.children.concat(t);let i=this.data;this.converter.options.instantNodeWriting&&(i=await this.load()),i&&(i.children=i.children??[],i.children=i.children.concat(r)),this.converter.options.instantNodeWriting&&i&&await this.write(i)}async addNeighbors(){var r;if(this.finalized)return;let t=await this.load();for(let i of this.children){let n=await i.load();if(n.neighbors=n.neighbors??[],Number((r=t==null?void 0:t.children)==null?void 0:r.length)<1e3)for(let a of t.children||[])i.id!==a.id&&n.neighbors.push(ne({},a));else console.warn(`Node ${i.id}: neighbors attribute is omited because of large number of neigbors`),delete n.neighbors;this.converter.options.instantNodeWriting&&n&&await i.write(n),await i.save()}this.finalize()}async save(){this.data&&await this.write(this.data)}finalize(){this._finalized=!0;for(let t of this.children)t.flush()}async write(t){let r=(0,I6.join)(this.converter.layers0Path,"nodes",this.id);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodes/${this.id}/3dNodeIndexDocument.json.gz`,writePromise:()=>wl(r,JSON.stringify(t),"3dNodeIndexDocument.json",!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>Un(r,JSON.stringify(t))},!0)}async load(){if(this.data)return this.data;let t=this.id,r=(0,I6.join)(this.converter.layers0Path,"nodes",t),i="index.json";return this.converter.options.slpk&&(i="3dNodeIndexDocument.json"),await X2(r,i)}flush(){this.data=null}static async createRootNode(t,r){let i=El.createRootNodeIndexDocument(t);return await new El(0,r).addData(i)}static async createNode(t,r,i,n,a,o){let s=await El.createNodeIndexDocument(t,r,i,n,a);return await new El(n.index,o).addData(s)}static createRootNodeIndexDocument(t){let r=Ye(ne({version:`{${yc().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}]},t),{children:[]});return(0,P6.default)(r,C6())}static async createNodeIndexDocument(t,r,i,n,a){var h,d;let{texture:o,attributes:s}=a,u=n.index,l=await t.load(),c=Ye(ne({version:l.version,id:u.toString(),level:l.level+1},r),{lodSelection:i,parentNode:{id:t.id,href:`../${t.id}`,mbs:l.mbs,obb:l.obb},children:[],neighbors:[]}),f=(0,P6.default)(c,C6());if(n.mesh&&(f.geometryData=[{href:"./geometries/0"}],f.sharedResource={href:"./shared"},o&&(f.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),s&&s.length&&((d=(h=t.converter.layers0)==null?void 0:h.attributeStorageInfo)==null?void 0:d.length))){f.attributeData=[];for(let p=0;p<s.length;p++){let y=t.converter.layers0.attributeStorageInfo[p].key;f.attributeData.push({href:`./attributes/${y}/0`})}}return f}};var B6=async(e,t,r)=>{let i=t.type==="json";if(!e||!t.contentUrl||!i)return;let n=Ye(ne({},r),{[e.loader.id]:{isTileset:i,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}),a=await Wr(t.contentUrl,e.loader,n);a.root&&(t.children=[a.root])},O6=async(e,t,r)=>{let i=t.type==="json";if(!e||!t.contentUrl||i)return null;let n=Ye(ne({},r),{[e.loader.id]:Ye(ne({},r[e.loader.id]||{}),{isTileset:i,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"})});return await Wr(t.contentUrl,e.loader,n)};var D6=Fe(fr());var ok=async(e,t,r,i,n,a=0)=>{if(n&&a>n)return;let o=[],s=await r(e,t);o.push(s);for(let u of e.children)await ok(u,s,r,i,n,a+1);i&&await i(o,t)};var _lt=[Mo.POINTS,Mo.LINES,Mo.LINE_LOOP,Mo.LINE_STRIP,Mo.TRIANGLES,Mo.TRIANGLE_STRIP,Mo.TRIANGLE_FAN],Gme=async e=>{let t={meshTopologyTypes:new Set};if(!(e==null?void 0:e.gltfArrayBuffer))return t;let i=(await wo(e.gltfArrayBuffer,dc,{gltf:{normalize:!1,loadBuffers:!1,loadImages:!1,decompressMeshes:!1}})).json;if(!i)return t;let n=xlt(i);return t.meshTopologyTypes=n,t},xlt=e=>{let t=new Set;for(let r of e.meshes||[])for(let i of r.primitives){let{mode:n}=i;typeof n!="number"&&(n=4),t.add(_lt[n])}return t},zme=(e,t)=>{for(let r of t.meshTopologyTypes)e.meshTopologyTypes.add(r)};var Wme,wlt=((Wme=Ap.default.env)==null?void 0:Wme.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ",Hme=64,Elt="3DTILES",Slt="3DObject",Tlt=1800,Alt="https://",g_=class{constructor(){this.boundingVolumeWarnings=[];this.conversionStartTime=[0,0];this.refreshTokenTime=[0,0];this.sourceTileset=null;this.loadOptions={_nodeWorkers:!0,reuseWorkers:!0,basis:{format:"rgba32",workerUrl:"./modules/textures/dist/basis-worker-node.js"},draco:{workerUrl:"./modules/draco/dist/draco-worker-node.js"},fetch:{}};this.geoidHeightModel=null;this.Loader=gc;this.workerSource={};this.writeQueue=new m_;this.compressList=null;this.preprocessData={meshTopologyTypes:new Set};this.nodePages=new co(Un,Hme,this),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.geometryMap=new Map,this.geometryConfigs=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1,this.compressList=null}async convert(t){if(on)return console.log(U0),U0;this.conversionStartTime=Ap.default.hrtime();let{tilesetName:r,slpk:i,egmFilePath:n,inputUrl:a,validate:o,outputPath:s,draco:u=!0,sevenZipExe:l,maxDepth:c,token:f,generateTextures:h,generateBoundingVolumes:d,instantNodeWriting:p=!1,mergeMaterials:y=!0}=t;this.options={maxDepth:c,slpk:i,sevenZipExe:l,egmFilePath:n,draco:u,token:f,inputUrl:a,instantNodeWriting:p,mergeMaterials:y},this.compressList=this.options.instantNodeWriting&&[]||null,this.validate=Boolean(o),this.Loader=a.indexOf(Alt)!==-1?VS:gc,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(d),this.writeQueue=new m_,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await Wr(n,nk),console.log("Loading egm file completed!"),i&&this.nodePages.useWriteFunction(wl),await this.loadWorkers();try{let g=await this._fetchPreloadOptions(),b=a;g.url&&(b=g.url),g.headers&&(this.loadOptions.fetch={headers:g.headers}),this.sourceTileset=await Wr(b,this.Loader,this.loadOptions),await this.preprocessConversion()&&(await this._createAndSaveTileset(s,r),await this._finishConversion({slpk:Boolean(i),outputPath:s,tilesetName:r}))}catch(g){throw g}finally{await this.writeQueue.finalize(),_n.getWorkerFarm({}).destroy()}return"success"}async preprocessConversion(){console.log("Analyze source tileset");let t=this.sourceTileset.root;await ok(t,null,this.analyzeTile.bind(this),void 0,this.options.maxDepth);let{meshTopologyTypes:r}=this.preprocessData;return console.log("------------------------------------------------"),console.log("Preprocess results:"),console.log(`glTF mesh topology types: ${Array.from(r).join(", ")}`),console.log("------------------------------------------------"),!r.has(Mo.TRIANGLES)&&!r.has(Mo.TRIANGLE_STRIP)?(console.log("The tileset is of unsupported mesh topology types. The conversion will be interrupted."),console.log("------------------------------------------------"),!1):!0}async analyzeTile(t,r){if(t.type==="json")return await B6(this.sourceTileset,t,this.loadOptions),null;t.id&&console.log(`[analyze]: ${t.id}`);let i=null;try{i=await O6(this.sourceTileset,t,Ye(ne({},this.loadOptions),{"3d-tiles":Ye(ne({},this.loadOptions["3d-tiles"]),{loadGLTF:!1})}))}catch{console.log(`[warning]: Failed to load ${t.contentUrl}. An I3S tile with empty content will be added to the output tileset`)}let n=await Gme(i);return zme(this.preprocessData,n),null}async _createAndSaveTileset(t,r){var u,l,c;let i=(0,Ba.join)(`${t}`,`${r}`);try{await l_(i)}catch{}this.layers0Path=(0,Ba.join)(i,"SceneServer","layers","0"),this.materialDefinitions=[],this.materialMap=new Map;let n=this.sourceTileset.root,a=Mf(n.boundingVolume,new D6.Matrix4(n.transform),null);this._formLayers0(r,a,(c=(l=(u=this.sourceTileset)==null?void 0:u.root)==null?void 0:l.boundingVolume)==null?void 0:c.region);let o=p6(a,this.geoidHeightModel);await this.nodePages.push({index:0,lodThreshold:0,obb:o.obb,children:[]});let s=await El.createRootNode(o,this);await ok(n,{transform:new D6.Matrix4(n.transform),parentNodes:[s]},this.convertTile.bind(this),this.finalizeTile.bind(this),this.options.maxDepth),this.layers0.materialDefinitions=this.materialDefinitions,this.layers0.geometryDefinitions=(0,sk.default)(this.geometryConfigs.map(f=>({geometryConfig:Ye(ne({},f),{draco:this.options.draco})})),Fme()),this.layersHasTexture===!1&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(f=>f!=="uv0")),await this._writeLayers0(),vme(r,this.layers0,i);for(let f of this.compressList||[])await Y2(f),await d6(f);await this.nodePages.save(),await this.writeQueue.finalize(),await this._createSlpk(i)}_formLayers0(t,r,i){var s;if(!((s=this.sourceTileset)==null?void 0:s.root))return;let n=Wpe(r);i&&(n.zmin=i[4],n.zmax=i[5]);let a=[n.xmin,n.ymin,n.xmax,n.ymax],o={version:`{${yc().toUpperCase()}}`,id:0,name:t,href:"./layers/0",store:{id:`{${yc().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:Hme},compressGeometry:this.options.draco,fullExtent:n};this.layers0=(0,sk.default)(o,Ome())}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:()=>wl(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:()=>Un(this.layers0Path,JSON.stringify(this.layers0))})}async _createSlpk(t){if(this.options.slpk){let r=(0,Ba.join)(t,"SceneServer","layers","0"),i=`${t}.slpk`;await jpe(r,i,0,".",this.options.sevenZipExe);try{await l_(t)}catch{}}}async convertTile(t,r){if(t.type==="json"||t.type==="empty")return t.type==="json"&&(t.id&&console.log(`[load]: ${t.id}`),await B6(this.sourceTileset,t,this.loadOptions)),r;t.id&&console.log(`[convert]: ${t.id}`);let{parentNodes:i,transform:n}=r,a=n.clone();t.transform&&(a=a.multiplyRight(t.transform));let o=i[0],s=await this._createNode(o,t,a);return await o.addChildren(s),{transform:a,parentNodes:s}}async finalizeTile(t,r){for(let i of t)for(let n of i.parentNodes)await n.addNeighbors();for(let i of r.parentNodes)await i.save()}async _createNode(t,r,i){var d,p;this._checkAddRefinementTypeForTile(r),await this._updateTilesetOptions();let n=null;try{n=await O6(this.sourceTileset,r,this.loadOptions)}catch{console.log(`[warning]: Failed to load ${r.contentUrl}`)}let a=Mf(r.boundingVolume,i,null),o=p6(a,this.geoidHeightModel),s=dme(n);s&&!((p=(d=this.layers0)==null?void 0:d.attributeStorageInfo)==null?void 0:p.length)&&this._convertPropertyTableToNodeAttributes(s);let u=await this._convertResources(r,i,a,n,t.inPageId,s),l=[],c=[],f=[],h={geometry:null,compressedGeometry:null,texture:null,hasUvRegions:!1,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(let y of u||[h]){this.layersHasTexture=this.layersHasTexture||Boolean(y.texture),this.generateBoundingVolumes&&y.boundingVolumes&&(o=y.boundingVolumes);let g=yme(r,o),b=g.find(R=>R.metricType==="maxScreenThresholdSQ")||{maxError:0},E=await this._updateNodeInNodePages(b,o,r,t.inPageId,y),A=await El.createNodeIndexDocument(t,o,g,E,y),k=await new El(E.index,this).addData(A);l.push(k),E.mesh&&await this._writeResources(y,k.id),this.validate&&(this.boundingVolumeWarnings=Lme(A),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),c.push(E.index),f.push(E)}return l}async _convertResources(t,r,i,n,a,o){var l;if(!this.isContentSupported(t)||!n)return null;let s={center:[],halfSize:[],quaternion:[]};return await b6(n,r,i,async()=>(await this.nodePages.push({index:0,obb:s},a)).index,o,this.featuresHashArray,(l=this.layers0)==null?void 0:l.attributeStorageInfo,this.options.draco,this.generateBoundingVolumes,this.options.mergeMaterials,this.geoidHeightModel,this.workerSource)}async _updateNodeInNodePages(t,r,i,n,a){let{meshMaterial:o,texture:s,vertexCount:u,featureCount:l,geometry:c,hasUvRegions:f}=a,h={index:0,lodThreshold:t.maxError,obb:r.obb,children:[]};c&&this.isContentSupported(i)&&(h.mesh={geometry:{definition:this.findOrCreateGeometryDefinition(Boolean(s),f),resource:0},attribute:{resource:0},material:{definition:0}});let d=a.nodeId,p;if(d?p=await this.nodePages.getNodeById(d):p=await this.nodePages.push(h,n),h.mesh||console.log(`[warning]: node ${p.index} is created with empty content`),co.updateAll(p,h),o&&co.updateMaterialByNodeId(p,this._findOrCreateMaterial(o)),s){let y=s.image.height*s.image.width;co.updateTexelCountHintByNodeId(p,y)}return u&&(this.vertexCounter+=u,co.updateVertexCountByNodeId(p,u)),co.updateNodeAttributeByNodeId(p),l&&co.updateFeatureCountByNodeId(p,l),this.nodePages.saveNode(p),p}async _writeResources(t,r){let{geometry:i,compressedGeometry:n,texture:a,sharedResources:o,attributes:s}=t,u=(0,Ba.join)(this.layers0Path,"nodes",r),l=(0,Ba.join)("nodes",r);await this._writeGeometries(i,n,u,l),await this._writeShared(o,u,l,r),await this._writeTexture(a,u,l),await this._writeAttributes(s,u,l)}async _writeGeometries(t,r,i,n){if(this.options.slpk){let a=(0,Ba.join)(i,"geometries");await this.writeQueue.enqueue({archiveKey:`${n}/geometries/0.bin.gz`,writePromise:()=>wl(a,t,"0.bin")})}else{let a=(0,Ba.join)(i,"geometries/0/");await this.writeQueue.enqueue({writePromise:()=>Un(a,t,"index.bin")})}if(this.options.draco)if(this.options.slpk){let a=(0,Ba.join)(i,"geometries");await this.writeQueue.enqueue({archiveKey:`${n}/geometries/1.bin.gz`,writePromise:()=>wl(a,r,"1.bin")})}else{let a=(0,Ba.join)(i,"geometries/1/");await this.writeQueue.enqueue({writePromise:()=>Un(a,r,"index.bin")})}}async _writeShared(t,r,i,n){if(!t)return;t.nodePath=n;let a=(0,sk.default)(t,Dme()),o=JSON.stringify(a);if(this.options.slpk){let s=(0,Ba.join)(r,"shared");await this.writeQueue.enqueue({archiveKey:`${i}/shared/sharedResource.json.gz`,writePromise:()=>wl(s,o,"sharedResource.json")})}else{let s=(0,Ba.join)(r,"shared/");await this.writeQueue.enqueue({writePromise:()=>Un(s,o)})}}async _writeTexture(t,r,i){if(t){let n=this._getFormatByMimeType(t==null?void 0:t.mimeType),a=[],o=t.bufferView.data;switch(n){case"jpg":case"png":{if(a.push({name:"0",format:n}),await this.writeTextureFile(o,"0",n,r,i),this.generateTextures){a.push({name:"1",format:"ktx2"});let s=t.image.data.subarray(),u=new Uint8Array(s),l=Mm(Ye(ne({},t.image),{data:u}),RS,Ye(ne({},RS.options),{source:this.workerSource.ktx2,reuseWorkers:!0,_nodeWorkers:!0}));await this.writeTextureFile(l,"1","ktx2",r,i)}break}case"ktx2":if(a.push({name:"1",format:n}),await this.writeTextureFile(o,"1",n,r,i),this.generateTextures){a.push({name:"0",format:"jpg"});let s=Mm(t.image.data[0],gO);await this.writeTextureFile(s,"0","jpg",r,i)}}this.layers0.textureSetDefinitions.length||(this.layers0.textureSetDefinitions.push({formats:a}),this.layers0.textureSetDefinitions.push({formats:a,atlas:!0}))}}async writeTextureFile(t,r,i,n,a){if(this.options.slpk){let o=(0,Ba.join)(n,"textures"),s=!1;await this.writeQueue.enqueue({archiveKey:`${a}/textures/${r}.${i}`,writePromise:()=>wl(o,t,`${r}.${i}`,s)})}else{let o=(0,Ba.join)(n,`textures/${r}/`);await this.writeQueue.enqueue({writePromise:()=>Un(o,t,`index.${i}`)})}}async _writeAttributes(t=[],r,i){var n,a;if((t==null?void 0:t.length)&&((a=(n=this.layers0)==null?void 0:n.attributeStorageInfo)==null?void 0:a.length))for(let o=0;o<t.length;o++){let s=this.layers0.attributeStorageInfo[o].key,u=new Uint8Array(t[o]);if(this.options.slpk){let l=(0,Ba.join)(r,"attributes",s);await this.writeQueue.enqueue({archiveKey:`${i}/attributes/${s}.bin.gz`,writePromise:()=>wl(l,u,"0.bin")})}else{let l=(0,Ba.join)(r,`attributes/${s}/0`);await this.writeQueue.enqueue({writePromise:()=>Un(l,u,"index.bin")})}}}_getFormatByMimeType(t){switch(t){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(t){let r=(0,F6.default)(JSON.stringify(t));if(this.materialMap.has(r))return this.materialMap.get(r)||0;let i=this.materialDefinitions.push(t)-1;return this.materialMap.set(r,i),i}findOrCreateGeometryDefinition(t,r){let i={hasTexture:t,hasUvRegions:r},n=(0,F6.default)(JSON.stringify(i));if(this.geometryMap.has(n))return this.geometryMap.get(n)||0;let a=this.geometryConfigs.push(i)-1;return this.geometryMap.set(n,a),a}_convertPropertyTableToNodeAttributes(t){let r=0,i=ne({OBJECTID:[0]},t);for(let n in i){let a=i[n][0],o=Zpe(n,a),s=eme(r,n,o),u=tme(o),l=rme(n,u),c=ime(i);this.layers0.attributeStorageInfo.push(s),this.layers0.fields.push(l),this.layers0.popupInfo=c,this.layers0.layerType=Slt,r+=1}}async _finishConversion(t){let{tilesCount:r,tilesWithAddRefineCount:i}=this.refinementCounter,n=i?i/r*100:0,a=await Q2(t),o=Ap.default.hrtime(this.conversionStartTime),s=J2(o);console.log("------------------------------------------------"),console.log(`Finishing conversion of ${Elt}`),console.log(`Total conversion time: ${s}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",a," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',n,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};let t={"cesium-ion":{accessToken:this.options.token||wlt}},r=await this.Loader.preload(this.options.inputUrl,t);return this.refreshTokenTime=Ap.default.hrtime(),ne(ne({},t),r)}async _updateTilesetOptions(){if(Ap.default.hrtime(this.refreshTokenTime)[0]<Tlt)return;this.refreshTokenTime=Ap.default.hrtime();let r=await this._fetchPreloadOptions();r.headers&&(this.loadOptions.fetch=Ye(ne({},this.loadOptions.fetch),{headers:r.headers}),console.log("Authorization Bearer token has been updated"))}_checkAddRefinementTypeForTile(t){let r=1;t.refine===r&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(t){return["b3dm","glTF","scenegraph"].includes(t.type||"")}async loadWorkers(){if(console.log("Loading workers source..."),this.options.draco){let t=Ef(Qy,ne({},Ku())),i=await(await Ua(t)).text();this.workerSource.draco=i}if(this.generateTextures){let t=Ef(RS,ne({},Ku())),i=await(await Ua(t)).text();this.workerSource.ktx2=i}console.log("Loading workers source completed!")}};var wge=Fe(require("path")),q6=Fe(require("process")),Ege=Fe(uu());var G0=Fe(Vme());function M6(e){switch(e){case"UInt8":return Uint8Array;case"UInt16":return Uint16Array;case"UInt32":return Uint32Array;case"Float32":return Float32Array;case"UInt64":return Float64Array;default:throw new Error(`parse i3s tile content: unknown type of data: ${e}`)}}var Kme={UInt8:G0.default.UNSIGNED_BYTE,UInt16:G0.default.UNSIGNED_SHORT,Float32:G0.default.FLOAT,UInt32:G0.default.UNSIGNED_INT,UInt64:G0.default.DOUBLE};function z0(e){switch(e){case"UInt8":return 1;case"UInt16":case"Int16":return 2;case"UInt32":case"Int32":case"Float32":return 4;case"UInt64":case"Int64":case"Float64":return 8;default:throw new Error(`parse i3s tile content: unknown size of data: ${e}`)}}var Yme="String",Xme="Oid32",$me="Float64",Jme="Int16",vu;(function(a){a[a.DEFAULT=-1]="DEFAULT",a[a.LNGLAT=1]="LNGLAT",a[a.METER_OFFSETS=2]="METER_OFFSETS",a[a.LNGLAT_OFFSETS=3]="LNGLAT_OFFSETS",a[a.CARTESIAN=0]="CARTESIAN"})(vu||(vu={}));var Gh=Fe(fr()),lk=Fe(ua());var v_;(function(r){r.vertexCount="vertexCount",r.featureCount="featureCount"})(v_||(v_={}));function Uh(e,t=null){return t?`${e}?token=${t}`:e}function Qme(e,t){let{attributeData:r=[]}=t,i=[];for(let n=0;n<r.length;n++){let a=r[n].href.replace("./","");i.push(`${e}/${a}`)}return i}function Zme(e,t){let r=[],{attributeStorageInfo:i,url:n}=e;for(let a=0;a<i.length;a++){let o=i[a].key;r.push(`${n}/nodes/${t}/attributes/${o}/0`)}return r}function ege(e,t){let{attributeName:r,attributeType:i}=t;return r?{[r]:i?Rlt(i,e):null}:{}}function Rlt(e,t){switch(e){case Yme:return Plt(t);case Xme:return tge(t);case $me:return Ilt(t);case Jme:return Clt(t);default:return tge(t)}}function tge(e){let t=4;return new Uint32Array(e,t)}function Clt(e){let t=4;return new Int16Array(e,t)}function Ilt(e){let t=8;return new Float64Array(e,t)}function Plt(e){let t=0,r=8,i=4,n=[];try{let a=new DataView(e,t,i).getUint32(t,!0),o=new Uint32Array(e,r,a),s=r+a*i;for(let u of o){let l=new TextDecoder("utf-8"),c=new Uint8Array(e,s,u);n.push(l.decode(c)),s+=u}}catch(a){console.error("Parse string attribute error: ",a.message)}return n}var Blt="4.0.0-alpha.17";var y_={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:Blt,mimeTypes:["application/binary"],parse:async(e,t)=>ege(e,t),extensions:["bin"],options:{},binary:!0};function rge(e){return e.hasOwnProperty("objectIds")?"Oid32":e.hasOwnProperty("attributeValues")?e.attributeValues.valueType:""}async function ige(e,t,r,i,n){var c;if(!((c=n==null?void 0:n.i3s)==null?void 0:c.colorsByAttribute))return e;let a=i.fields.find(({name:f})=>{var h,d;return f===((d=(h=n==null?void 0:n.i3s)==null?void 0:h.colorsByAttribute)==null?void 0:d.attributeName)});if(!a||!["esriFieldTypeDouble","esriFieldTypeInteger","esriFieldTypeSmallInteger"].includes(a.type))return e;let o=await nge(a.name,r,i,n);if(!o)return e;let s=i.fields.find(({type:f})=>f==="esriFieldTypeOID");if(!s)return e;let u=await nge(s.name,r,i,n);if(!u)return e;let l={};for(let f=0;f<u[s.name].length;f++)l[u[s.name][f]]=Olt(o[a.name][f],n);for(let f=0;f<t.value.length;f++){let h=l[t.value[f]];!h||(n.i3s.colorsByAttribute.mode==="multiply"?h.forEach((d,p)=>{e.value[f*4+p]=e.value[f*4+p]*d/255}):e.value.set(h,f*4))}return e}function Olt(e,t){var u;if(!((u=t==null?void 0:t.i3s)==null?void 0:u.colorsByAttribute))return[255,255,255,255];let{minValue:r,maxValue:i,minColor:n,maxColor:a}=t.i3s.colorsByAttribute,o=(e-r)/(i-r),s=[255,255,255,255];for(let l=0;l<n.length;l++)s[l]=Math.round((a[l]-n[l])*o+n[l]);return s}async function nge(e,{attributeUrls:t},{attributeStorageInfo:r},i){var u;let n=r.findIndex(({name:l})=>e===l);if(n===-1)return null;let a=Uh(t[n],(u=i==null?void 0:i.i3s)==null?void 0:u.token),o=rge(r[n]);return await Wr(a,y_,{attributeName:e,attributeType:o})}var ck=new Gh.Vector3([0,0,0]);function Flt(e){switch(e){case"ktx-etc2":case"dds":return kS;case"ktx2":return Rd;case"jpg":case"png":default:return dg}}var Dlt="i3s-attribute-type";async function age(e,t,r,i,n){var o;let a={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new Gh.Matrix4,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){let s=Uh(t.textureUrl,(o=i==null?void 0:i.i3s)==null?void 0:o.token),u=Flt(t.textureFormat),c=await(await fetch(s,i==null?void 0:i.fetch)).arrayBuffer();if(i==null?void 0:i.i3s.decodeTextures){if(u===dg){let f=Ye(ne({},t.textureLoaderOptions),{image:{type:"data"}});try{a.texture=await n.parse(c,f)}catch{a.texture=await wo(c,u,f)}}else if(u===kS||u===Rd){let f=await Wr(c,u,t.textureLoaderOptions);u===Rd&&(f=f[0]),a.texture={compressed:!0,mipmaps:!1,width:f[0].width,height:f[0].height,data:f}}}else a.texture=c}return a.material=Hlt(t.materialDefinition,a.texture),a.material&&(a.texture=null),await Mlt(e,a,t,r,i)}async function Mlt(e,t,r,i,n){var f,h;let a=e.byteLength,o,s,u=0,l=0,c;if(r.isDracoGeometry){let d=await wo(e,og,{draco:{attributeNameEntry:Dlt}});s=d.header.vertexCount,c=(f=d.indices)==null?void 0:f.value;let{POSITION:p,NORMAL:y,COLOR_0:g,TEXCOORD_0:b,["feature-index"]:E,["uv-region"]:A}=d.attributes;o={position:p,normal:y,color:g,uv0:b,uvRegion:A,id:E},Llt(o,d);let k=Ylt(E);k&&Klt(o,k)}else{let{vertexAttributes:d,ordering:p,featureAttributes:y,featureAttributeOrder:g}=i.store.defaultGeometrySchema,b=Nlt(e,i);u=b.byteOffset,s=b.vertexCount,l=b.featureCount;let{attributes:E,byteOffset:A}=sge(e,u,d,s,p),{attributes:k}=sge(e,A,y,l,g);Vlt(k),o=jlt(E,k)}if(!((h=n==null?void 0:n.i3s)==null?void 0:h.coordinateSystem)||n.i3s.coordinateSystem===vu.METER_OFFSETS){let d=Ult(o.position,r);t.modelMatrix=d.invert(),t.coordinateSystem=vu.METER_OFFSETS}else t.modelMatrix=zlt(o.position),t.coordinateSystem=vu.LNGLAT_OFFSETS;o.color=await ige(o.color,o.id,r,i,n),t.attributes={positions:o.position,normals:o.normal,colors:oge(o.color),texCoords:o.uv0,uvRegions:oge(o.uvRegion||o.region)},t.indices=c||null,o.id&&o.id.value&&(t.featureIds=o.id.value);for(let d in t.attributes)t.attributes[d]||delete t.attributes[d];return t.vertexCount=s,t.byteLength=a,t}function Llt(e,t){for(let r in t.loaderData.attributes){let i=t.loaderData.attributes[r];switch(i.name){case"POSITION":e.position.metadata=i.metadata;break;case"feature-index":e.id.metadata=i.metadata;break;default:break}}}function jlt(e,t){return ne(ne({},e),t)}function oge(e){return e&&(e.normalized=!0,e)}function Nlt(e,t){let r=0,i=0,n=0;for(let{property:a,type:o}of t.store.defaultGeometrySchema.header){let s=M6(o);switch(a){case v_.vertexCount:i=new s(e,0,4)[0],r+=z0(o);break;case v_.featureCount:n=new s(e,4,4)[0],r+=z0(o);break;default:break}}return{vertexCount:i,featureCount:n,byteOffset:r}}function sge(e,t,r,i,n){let a={};for(let o of n)if(r[o]){let{valueType:s,valuesPerElement:u}=r[o];if(t+i*u*z0(s)<=e.byteLength){let l=e.slice(t),c;if(s==="UInt64")c=qlt(l,i*u,z0(s));else{let f=M6(s);c=new f(l,0,i*u)}switch(a[o]={value:c,type:Kme[s],size:u},o){case"color":a.color.normalized=!0;break;case"position":case"region":case"normal":default:}t=t+i*u*z0(s)}else if(o!=="uv0")break}return{attributes:a,byteOffset:t}}function qlt(e,t,r){let i=[],n=new DataView(e),a=0;for(let o=0;o<t;o++){let s=n.getUint32(a,!0),u=n.getUint32(a+4,!0),l=s+2**32*u;i.push(l),a+=r}return new Uint32Array(i)}function Ult(e,t){let r=t.mbs,i=e.value,n=e.metadata,a=new Gh.Matrix4,o=new Gh.Vector3(r[0],r[1],r[2]),s=new Gh.Vector3;return lk.Ellipsoid.WGS84.cartographicToCartesian(o,s),lk.Ellipsoid.WGS84.eastNorthUpToFixedFrame(s,a),e.value=Glt(i,n,o),a}function Glt(e,t={},r){let i=new Float64Array(e.length),n=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let o=0;o<i.length;o+=3)i[o]=e[o]*n+r.x,i[o+1]=e[o+1]*a+r.y,i[o+2]=e[o+2]+r.z;for(let o=0;o<i.length;o+=3)lk.Ellipsoid.WGS84.cartographicToCartesian(i.subarray(o,o+3),ck),i[o]=ck.x,i[o+1]=ck.y,i[o+2]=ck.z;return i}function zlt(e){var a,o;let t=e.metadata,r=((a=t==null?void 0:t["i3s-scale_x"])==null?void 0:a.double)||1,i=((o=t==null?void 0:t["i3s-scale_y"])==null?void 0:o.double)||1,n=new Gh.Matrix4;return n[0]=r,n[5]=i,n}function Hlt(e,t){let r;return e?r=Ye(ne({},e),{pbrMetallicRoughness:e.pbrMetallicRoughness?ne({},e.pbrMetallicRoughness):{baseColorFactor:[255,255,255,255]}}):(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase()),r.emissiveFactor&&(r.emissiveFactor=uge(r.emissiveFactor)),r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=uge(r.pbrMetallicRoughness.baseColorFactor)),t&&Wlt(r,t),r}function uge(e){let t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}function Wlt(e,t){let r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture=Ye(ne({},e.pbrMetallicRoughness.baseColorTexture),{texture:r}):e.emissiveTexture?e.emissiveTexture=Ye(ne({},e.emissiveTexture),{texture:r}):e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture=Ye(ne({},e.pbrMetallicRoughness.metallicRoughnessTexture),{texture:r}):e.normalTexture?e.normalTexture=Ye(ne({},e.normalTexture),{texture:r}):e.occlusionTexture&&(e.occlusionTexture=Ye(ne({},e.occlusionTexture),{texture:r}))}function Vlt(e){let{id:t,faceRange:r}=e;if(!t||!r)return;let i=t.value,n=r.value,a=n[n.length-1]+1,o=new Uint32Array(a*3),s=0,u=0;for(let l=1;l<n.length;l+=2){let c=Number(i[s]),f=n[l],h=n[l-1],d=f-h+1,p=u+d*3;o.fill(c,u,p),s++,u=p}e.id.value=o}function Klt(e,t){let r=e.id.value,i=new Float32Array(r.length);for(let n=0;n<r.length;n++)i[n]=t[r[n]];e.id.value=i}function Ylt(e){var t,r;return(r=(t=e==null?void 0:e.metadata)==null?void 0:t["i3s-feature-ids"])==null?void 0:r.intArray}var Xlt="4.0.0-alpha.17",lge={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:Xlt,mimeTypes:["application/octet-stream"],parse:$lt,extensions:["bin"],options:{"i3s-content":{}}};async function $lt(e,t,r){let{tile:i,_tileOptions:n,tileset:a,_tilesetOptions:o}=(t==null?void 0:t.i3s)||{},s=n||i,u=o||a;return!s||!u?null:await age(e,s,u,t,r)}var fge=Fe(tl()),j6=Fe(ua());var Jlt="4.0.0-alpha.17";async function Qlt(e,t){return JSON.parse(new TextDecoder().decode(e))}var cge={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:Jlt,mimeTypes:["application/json"],parse:Qlt,extensions:["json"],options:{}};var fk=class{constructor(t,r){this.nodePages=[];this.pendingNodePages=[];this.textureDefinitionsSelectedFormats=[];this.textureLoaderOptions={};var i,n;this.tileset=ne({},t),this.nodesPerPage=((i=t.nodePages)==null?void 0:i.nodesPerPage)||64,this.lodSelectionMetricType=(n=t.nodePages)==null?void 0:n.lodSelectionMetricType,this.options=r,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){var n;let r=Math.floor(t/this.nodesPerPage);if(!this.nodePages[r]&&!this.pendingNodePages[r]){let a=Uh(`${this.tileset.url}/nodepages/${r}`,(n=this.options.i3s)==null?void 0:n.token);this.pendingNodePages[r]={status:"Pending",promise:Wr(a,cge,this.options)},this.nodePages[r]=await this.pendingNodePages[r].promise,this.nodesInNodePages+=this.nodePages[r].nodes.length,this.pendingNodePages[r].status="Done"}this.pendingNodePages[r].status==="Pending"&&(this.nodePages[r]=await this.pendingNodePages[r].promise);let i=t%this.nodesPerPage;return this.nodePages[r].nodes[i]}async formTileFromNodePages(t){let r=await this.getNodeById(t),i=[],n=[];for(let d of r.children||[])n.push(this.getNodeById(d));let a=await Promise.all(n);for(let d of a)i.push({id:d.index.toString(),obb:d.obb});let o,s,u,l="jpg",c=[],f=!1;if(r&&r.mesh){let{url:d,isDracoGeometry:p}=r.mesh.geometry&&this.getContentUrl(r.mesh.geometry)||{isDracoGeometry:!1};o=d,f=p;let{textureData:y,materialDefinition:g}=this.getInformationFromMaterial(r.mesh.material);u=g,l=y.format||l,y.name&&(s=`${this.tileset.url}/nodes/${r.mesh.material.resource}/textures/${y.name}`),this.tileset.attributeStorageInfo&&(c=Zme(this.tileset,r.mesh.attribute.resource))}let h=this.getLodSelection(r);return L6({id:t.toString(),lodSelection:h,obb:r.obb,contentUrl:o,textureUrl:s,attributeUrls:c,materialDefinition:u,textureFormat:l,textureLoaderOptions:this.textureLoaderOptions,children:i,isDracoGeometry:f})}getContentUrl(t){let r=null,i=this.tileset.geometryDefinitions[t.definition],n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=i.geometryBuffers.findIndex(a=>a.compressedAttributes&&a.compressedAttributes.encoding==="draco")),n===-1&&(n=i.geometryBuffers.findIndex(a=>!a.compressedAttributes)),n!==-1){let a=Boolean(i.geometryBuffers[n].compressedAttributes);r={url:`${this.tileset.url}/nodes/${t.resource}/geometries/${n}`,isDracoGeometry:a}}return r}getLodSelection(t){let r=[];return this.lodSelectionMetricType==="maxScreenThresholdSQ"&&r.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(t.lodThreshold/(Math.PI*.25))}),r.push({metricType:this.lodSelectionMetricType,maxError:t.lodThreshold}),r}getInformationFromMaterial(t){var i,n,a;let r={textureData:{name:null}};if(t){let o=(i=this.tileset.materialDefinitions)==null?void 0:i[t.definition];if(o){r.materialDefinition=o;let s=(a=(n=o==null?void 0:o.pbrMetallicRoughness)==null?void 0:n.baseColorTexture)==null?void 0:a.textureSetDefinitionId;typeof s=="number"&&(r.textureData=this.textureDefinitionsSelectedFormats[s]||r.textureData)}}return r}initSelectedFormatsForTextureDefinitions(t){this.textureDefinitionsSelectedFormats=[];let r=this.getSupportedTextureFormats(),i=t.textureSetDefinitions||[];for(let n of i){let a=n&&n.formats||[],o=null;for(let s of r){let u=a.find(l=>l.format===s);if(u){o=u;break}}o&&o.format==="ktx2"&&(this.textureLoaderOptions.basis={format:gg(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(o)}}getSupportedTextureFormats(){let t=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){let r=rb();r.has("etc2")&&t.push("ktx-etc2"),r.has("dxt")&&t.push("dds"),t.push("ktx2")}return t.push("jpg"),t.push("png"),t}};function hge(e,t){let r=t.url||"",i;e.geometryData&&(i=`${r}/${e.geometryData[0].href}`);let n;e.textureData&&(n=`${r}/${e.textureData[0].href}`);let a;return e.attributeData&&(a=Qme(r,e)),L6(Ye(ne({},e),{url:r,contentUrl:i,textureUrl:n,attributeUrls:a,isDracoGeometry:!1}))}function L6(e){var u,l;let t={},r=[0,0,0,1];if(e.mbs)r=e.mbs,t.sphere=[...j6.Ellipsoid.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){t.box=[...j6.Ellipsoid.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];let f=new fge.OrientedBoundingBox().fromCenterHalfSizeQuaternion(t.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();t.sphere=[...f.center,f.radius],r=[...e.obb.center,f.radius]}let i=(u=e.lodSelection)==null?void 0:u[0].metricType,n=(l=e.lodSelection)==null?void 0:l[0].maxError,a=e.transform,o=il.MESH,s=ea.REPLACE;return Ye(ne({},e),{mbs:r,boundingVolume:t,lodMetricType:i,lodMetricValue:n,transformMatrix:a,type:o,refine:s})}async function dge(e,t,r){var i;if(e.url=r.url,e.nodePages)e.nodePagesTile=new fk(e,t),e.root=e.nodePagesTile.formTileFromNodePages(0);else{let n=Uh(`${e.url}/nodes/root`,(i=t.i3s)==null?void 0:i.token);e.root=await Wr(n,e.loader,Ye(ne({},t),{i3s:Ye(ne({},t.i3s),{loadContent:!1,isTileHeader:!0,isTileset:!1})}))}e.basePath=e.url,e.type=En.I3S,e.lodMetricType=e.root.lodMetricType,e.lodMetricValue=e.root.lodMetricValue}var Zlt="4.0.0-alpha.17",ect=/layers\/[0-9]+$/,tct=/nodes\/([0-9-]+|root)$/,rct="504b0304",ict="PointCloud",hk={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:Zlt,mimeTypes:["application/octet-stream"],parse:nct,extensions:["bin"],options:{i3s:{token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,_tileOptions:null,_tilesetOptions:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:vu.METER_OFFSETS,colorsByAttribute:null}}};async function nct(e,t={},r){let i=r.url;if(t.i3s=t.i3s||{},uct(e)===rct)throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let a;t.i3s.isTileset==="auto"?a=ect.test(i):a=t.i3s.isTileset;let o;return t.isTileHeader==="auto"?o=tct.test(i):o=t.i3s.isTileHeader,a?e=await oct(e,t,r):o?e=await sct(e,r):e=await act(e,t),e}async function act(e,t){return await wo(e,lge,t)}async function oct(e,t,r){let i=JSON.parse(new TextDecoder().decode(e));if((i==null?void 0:i.layerType)===ict)throw new Error("Point Cloud layers currently are not supported by I3SLoader");return i.loader=hk,await dge(i,t,r),i}async function sct(e,t){return e=JSON.parse(new TextDecoder().decode(e)),hge(e,t)}function uct(e){return e instanceof ArrayBuffer?[...new Uint8Array(e,0,4)].map(t=>t.toString(16).padStart(2,"0")).join(""):null}var pge=Fe(fr()),mge=Fe(ua()),gge=Fe(tl());function N6(e,t){let r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],i=mge.Ellipsoid.WGS84.cartographicToCartesian(r,new pge.Vector3),n=new gge.OrientedBoundingBox().fromCenterHalfSizeQuaternion(i,e.halfSize,e.quaternion);return[...n.center,...n.halfAxes.toArray()]}var dk=Fe(uu()),lct=()=>({version:{path:"version",default:"1.0"}}),vge=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(t=>(0,dk.default)(t,vge()))}}),yge=()=>({asset:{path:"asset",transform:e=>(0,dk.default)(e,lct())},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>(0,dk.default)(e,vge())}});var kp=Fe(fr()),_ge=Fe(ua());function bge(e,t){let r=new Float32Array(e.length),i=fct(t);for(let n=0;n<e.length;n+=2){let a=e.subarray(n,n+2),o=i.slice(n*2,n*2+4),s=cct([a[0],a[1]]),u=[o[2]-o[0],o[3]-o[1]],l=[s[0]*u[0],s[1]*u[1]],c=[l[0]+o[0],l[1]+o[1]];r[n]=c[0],r[n+1]=c[1]}return r}function cct(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function fct(e){let t=65535,r=[];for(let i=0;i<e.length;i++)r[i]=e[i]/t;return r}var hct=new kp.Matrix4([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),xge=new kp.Vector3,pk=class{async convert(t,r=null){let i=await this.buildGltf(t,r);return Vw({gltfEncoded:new Uint8Array(i),type:"b3dm",featuresLength:this._getFeaturesLength(r),batchTable:r},g8)}async buildGltf(t,r){let{tileContent:i,textureFormat:n}=t,{material:a,attributes:o,indices:s,cartesianOrigin:u,cartographicOrigin:l,modelMatrix:c}=i,f=new ci,h=await this._addI3sTextureToGltf(i,n,f),d=this._convertI3sMaterialToGltfMaterial(a,h),p=f.addMaterial(d),y=o.positions,g=y.value;o.uvRegions&&o.texCoords&&(o.texCoords.value=bge(o.texCoords.value,o.uvRegions.value)),o.positions.value=this._normalizePositions(g,u,l,c),this._createBatchIds(i,r),o.normals&&!this._checkNormals(o.normals.value)&&delete o.normals;let b=s||ek(g.length/y.size),E=f.addMesh({attributes:o,indices:b,material:p,mode:4}),A=this._generateTransformMatrix(u),k=f.addNode({meshIndex:E,matrix:A}),R=f.addScene({nodeIndices:[k]});return f.setDefaultScene(R),f.createBinaryChunk(),Vw(f.gltf,VO)}async _addI3sTextureToGltf(t,r,i){let{texture:n,material:a,attributes:o}=t,s=null,u=n;if(!n&&a&&(u=a.pbrMetallicRoughness&&a.pbrMetallicRoughness.baseColorTexture&&a.pbrMetallicRoughness.baseColorTexture.texture.source.image),u){let l=this._deduceMimeTypeFromFormat(r),c=i.addImage(u,l);s=i.addTexture({imageIndex:c}),delete o.colors}return s}_normalizePositions(t,r,i,n){let a=new Float32Array(t.length);for(let o=0;o<t.length;o+=3){let s=t.subarray(o,o+3),u=new kp.Vector3(r),l=new kp.Vector3(Array.from(s)).transform(n).add(i);_ge.Ellipsoid.WGS84.cartographicToCartesian(l,xge),l=xge.subtract(u),a.set(l,o)}return a}_generateTransformMatrix(t){return new kp.Matrix4().translate(t).multiplyLeft(hct)}_createBatchIds(t,r){let{featureIds:i}=t,{OBJECTID:n}=r||{};if(!(!i||!n)){for(let a=0;a<i.length;a++){let o=i[a],s=n.indexOf(o);i[a]=s}t.attributes._BATCHID={size:1,byteOffset:0,value:i}}}_deduceMimeTypeFromFormat(t){switch(t){case"jpg":return"image/jpeg";case"png":return"image/png";case"ktx2":return"image/ktx2";default:return console.warn(`Unexpected texture format in I3S: ${t}`),"image/jpeg"}}_convertI3sMaterialToGltfMaterial(t,r){let i=r!==null;return t?(r!==null&&(t=this._setGltfTexture(t,r)),t):(t={alphaMode:"OPAQUE",doubleSided:!1,pbrMetallicRoughness:{metallicFactor:0,roughnessFactor:1}},i?t.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,1],t)}_setGltfTexture(t,r){let i=Ye(ne({},t),{pbrMetallicRoughness:ne({},t.pbrMetallicRoughness)});return t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture?i.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.emissiveTexture?i.emissiveTexture={index:r,texCoord:0}:t.pbrMetallicRoughness&&t.pbrMetallicRoughness.metallicRoughnessTexture?i.pbrMetallicRoughness.metallicRoughnessTexture={index:r,texCoord:0}:t.normalTexture?i.normalTexture={index:r,texCoord:0}:t.occlusionTexture&&(i.occlusionTexture={index:r,texCoord:0}),i}_getFeaturesLength(t){if(!t)return 0;let r=Object.keys(t)[0];return r?t[r].length:0}_checkNormals(t){return t.find(r=>r)}};var dct="I3S",b_=class{constructor(){this.workerSource={};this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={}}async convert(t){if(on)return console.log(U0),U0;let{inputUrl:r,outputPath:i,tilesetName:n,maxDepth:a,egmFilePath:o}=t;this.conversionStartTime=q6.default.hrtime(),this.options={maxDepth:a},console.log("Loading egm file..."),this.geoidHeightModel=await Wr(o,nk),console.log("Loading egm file completed!");let s=await Wr(r,hk,{});this.sourceTileset=new dS(s,{loadOptions:{_nodeWorkers:!0,reuseWorkers:!0,i3s:{coordinateSystem:vu.LNGLAT_OFFSETS,decodeTextures:!1},"i3s-content":{workerUrl:"./modules/i3s/dist/i3s-content-worker-node.js"}}}),await this.sourceTileset.tilesetInitializationPromise;let u=this.sourceTileset.root;u.header.obb||(u.header.obb=m6(u.header.mbs)),this.tilesetPath=(0,wge.join)(`${i}`,`${n}`),this.attributeStorageInfo=s.attributeStorageInfo;try{await l_(this.tilesetPath)}catch{}let l={boundingVolume:{box:N6(u.header.obb,this.geoidHeightModel)},geometricError:x6(u),children:[]};await this._addChildren(u,l,1);let c=(0,Ege.default)({root:l},yge());await Un(this.tilesetPath,JSON.stringify(c),"tileset.json"),this._finishConversion({slpk:!1,outputPath:i,tilesetName:n}),_n.getWorkerFarm({}).destroy()}async convertChildNode(t,r,i,n){var o;let a=await this._loadChildNode(t,n);if(t.children.push(a),a.contentUrl){await this.sourceTileset._loadTile(a),this.vertexCounter+=a.content.vertexCount;let s=null;this.attributeStorageInfo&&(s=await this._loadChildAttributes(a,this.attributeStorageInfo)),a.header.obb||(a.header.obb=m6(a.header.mbs));let u={box:N6(a.header.obb,this.geoidHeightModel)},l={boundingVolume:u,geometricError:x6(a),children:[]},c={tileContent:a.content,textureFormat:(o=a==null?void 0:a.header)==null?void 0:o.textureFormat},h=await new pk().convert(c,s);l.content={uri:`${a.id}.b3dm`,boundingVolume:u},await Un(this.tilesetPath,new Uint8Array(h),`${a.id}.b3dm`),r.children.push(l),a.unloadContent(),await this._addChildren(a,l,i+1)}else await this._addChildren(a,r,i+1)}async _addChildren(t,r,i){if(this.options.maxDepth&&i>this.options.maxDepth)return;let n=[];for(let a of t.header.children||[])n.push(this.convertChildNode(t,r,i,a));await Promise.all(n)}async _loadChildNode(t,r){let i;if(this.sourceTileset.tileset.nodePages)console.log(`Node conversion: ${r.id}`),i=await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(r.id);else{let{loader:n}=this.sourceTileset,a=this._relativeUrlToFullUrl(t.url,r.href),o={i3s:Ye(ne({},this.sourceTileset.loadOptions),{isTileHeader:!0,loadContent:!1})};console.log(`Node conversion: ${a}`),i=await Wr(a,n,o)}return new fc(this.sourceTileset,i,t)}_relativeUrlToFullUrl(t,r){let i=t.split("/"),n=r.split("/");for(let a of n)switch(a){case".":continue;case"..":i=i.slice(0,-1);break;default:i.push(a)}return i.join("/")}async _loadChildAttributes(t,r){let i=[],{attributeUrls:n}=t.header;for(let o=0;o<n.length;o++){let s=n[o],u=r[o],l={attributeName:u.name,attributeType:this._getAttributeType(u)};i.push(Wr(s,y_,l))}let a=await Promise.all(i);return this._replaceNestedArrays(a),Object.assign({},...a)}_getAttributeType(t){return t.attributeValues?t.attributeValues.valueType:t.objectIds?"Oid32":""}_replaceNestedArrays(t){for(let r=0;r<t.length;r++){let i=t[r];for(let n in i)i[n]=Array.from(i[n])}}async _finishConversion(t){let r=await Q2(t),i=q6.default.hrtime(this.conversionStartTime),n=J2(i);console.log("------------------------------------------------"),console.log(`Finish conversion of ${dct}`),console.log(`Total conversion time: ${n}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",r," bytes"),console.log("------------------------------------------------")}};var Sge=Fe(h6()),pct="4.0.0-alpha.17",U6={id:"zip",module:"zip",name:"Zip Archive",version:pct,extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:mct};async function mct(e,t={}){let r=[],i={};try{let n=new Sge.default;return(await n.loadAsync(e,t)).forEach((o,s)=>{let u=s.name,l=gct(n,u,t).then(c=>{i[o]=c});r.push(l)}),await Promise.all(r),i}catch(n){throw t.log.error(`Unable to read zip archive: ${n}`),n}}async function gct(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(i){return r.log.error(`Unable to read ${t} from zip archive: ${i}`),i}}var G6=Fe(require("path"));var vct="4.0.0-alpha.17",yct="https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",z6=class{async install(t="",r=""){console.log('Installing "EGM2008-5" model...');let i=await Wr(yct,U6,{}),n=process.cwd();t&&(n=(0,G6.join)(n,t)),await Un(n,new Uint8Array(i["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log('Installing "I3S Content Loader worker"'),await this.installWorker("i3s","i3s-content-worker-node.js",r),console.log('Installing "Draco Loader worker"'),await this.installWorker("draco","draco-worker-node.js",r),console.log('Installing "Basis Loader worker"'),await this.installWorker("textures","basis-worker-node.js",r),console.log('Installing "join-images" npm package'),await new Sf().start({command:process.platform==="win32"?"npm.cmd":"npm",arguments:["install","sharp@0.30.4","join-images@1.1.3"],wait:0,ignoreStderr:!0}),console.log("All dependencies were installed succesfully.")}async installWorker(t,r,i){let a=await(await Ua(`https://unpkg.com/@loaders.gl/${t}@${vct}/dist/${r}`)).arrayBuffer();if(!a)return;let o=(0,G6.join)(process.cwd(),i,"modules",t,"dist");await Un(o,a,r)}};function Sl(e,t){if(e+1>=t.length)return"";let r=t[e+1];return r.indexOf("--")===0?"":r}function Tge(e,t){let r=Sl(e,t);return console.log(`Input tileset value: ${r}`),console.log(`Modified tileset value: ${r.replace(/\\/g,"/")}`),r.replace(/\\/g,"/")}function Age(e){return e.reduce((t,r)=>{let i=r.indexOf("="),n=r.slice(0,i),a=r.slice(i+1,r.length);return r.includes("=")&&r.startsWith("--")&&a?t.concat(n,a):t.concat(r)},[])}function kge(e,t){let r=Sl(e,t),i=Number.parseInt(r);return isFinite(i)?i:NaN}function Nc(e,t){let r=Sl(e,t).toLowerCase().trim();return["--no-draco","--split-nodes"].includes(t[e])&&!r?!1:!r||r==="true"}var H6={I3S:"I3S",_3DTILES:"3DTILES"};async function bct(){let[,,...e]=process.argv;e.length===0&&W6();let t=Age(e),r=wct(t);if(r.installDependencies){new z6().install("deps");return}let i=xct(r);await _ct(i)}bct().catch(e=>{console.log(e),process.exit(1)});function W6(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--instant-node-writing [Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed]"),console.log("--split-nodes [Prevent to merge similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]"),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Will generate obb and mbs bounding volumes from geometry]"),console.log("--validate [Enable validation]"),process.exit(0)}async function _ct(e){switch(console.log("------------------------------------------------"),console.log(`Starting conversion of ${e.inputType}`),console.log("------------------------------------------------"),e.inputType.toUpperCase()){case H6.I3S:new b_().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case H6._3DTILES:await new g_().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,egmFilePath:e.egm,token:e.token,draco:e.draco,mergeMaterials:e.mergeMaterials,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate,instantNodeWriting:e.instantNodeWriting});break;default:W6()}}function xct(e){let t={name:()=>console.log("Missed: --name [Tileset name]"),output:()=>console.log("Missed: --output [Output path name]"),sevenZipExe:()=>console.log("Missed: --7zExe [7z archiver executable path]"),egm:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]"),tileset:()=>console.log("Missed: --tileset [tileset.json file]"),inputType:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]")},r=[];for(let i in t){let n=e[i],a=Boolean(n)&&i==="inputType"&&!Object.values(H6).includes(n.toUpperCase());(!n||a)&&r.push(t[i])}return r.length&&(r.forEach(i=>i()),process.exit(1)),e}function wct(e){let t={output:"data",instantNodeWriting:!1,mergeMaterials:!0,sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:(0,Rge.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1};return e.forEach((r,i)=>{if(r.indexOf("--")===0)switch(r){case"--input-type":t.inputType=Sl(i,e);break;case"--tileset":t.tileset=Tge(i,e);break;case"--name":t.name=Sl(i,e);break;case"--output":t.output=Sl(i,e);break;case"--instant-node-writing":t.instantNodeWriting=Nc(i,e);break;case"--split-nodes":t.mergeMaterials=Nc(i,e);break;case"--max-depth":t.maxDepth=kge(i,e);break;case"--slpk":t.slpk=Nc(i,e);break;case"--7zExe":t.sevenZipExe=Sl(i,e);break;case"--egm":t.egm=Sl(i,e);break;case"--token":t.token=Sl(i,e);break;case"--no-draco":t.draco=Nc(i,e);break;case"--validate":t.validate=Nc(i,e);break;case"--install-dependencies":t.installDependencies=Nc(i,e);break;case"--generate-textures":t.generateTextures=Nc(i,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=Nc(i,e);break;case"--help":W6();break;default:console.warn(`Unknown option ${r}`),process.exit(0)}}),t}
124
124
  /*!
125
125
  * Copyright 2010 LearnBoost <dev@learnboost.com>
126
126
  *