@loaders.gl/i3s 4.2.1 → 4.2.3

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.
@@ -92,12 +92,12 @@ caused by: `+Wr.fullStack(r):e.stack};Wr.errorFromList=function(e){return zt.arr
92
92
  `)}),a("--"+t.boundary+"--"),t.request.postambleCRLF&&a(`\r
93
93
  `),i};jc.prototype.onRequest=function(e){var r=this,t=r.isChunked(e),i=e.data||e;r.setHeaders(t),r.chunked=t,r.body=r.build(i,t)};K6.Multipart=jc});var J6=D(Q6=>{"use strict";var X6=require("url"),xN=/^https?:/;function gp(e){this.request=e,this.followRedirect=!0,this.followRedirects=!0,this.followAllRedirects=!1,this.followOriginalHttpMethod=!1,this.allowRedirect=function(){return!0},this.maxRedirects=10,this.redirects=[],this.redirectsFollowed=0,this.removeRefererHeader=!1}gp.prototype.onRequest=function(e){var r=this;e.maxRedirects!==void 0&&(r.maxRedirects=e.maxRedirects),typeof e.followRedirect=="function"&&(r.allowRedirect=e.followRedirect),e.followRedirect!==void 0&&(r.followRedirects=!!e.followRedirect),e.followAllRedirects!==void 0&&(r.followAllRedirects=e.followAllRedirects),(r.followRedirects||r.followAllRedirects)&&(r.redirects=r.redirects||[]),e.removeRefererHeader!==void 0&&(r.removeRefererHeader=e.removeRefererHeader),e.followOriginalHttpMethod!==void 0&&(r.followOriginalHttpMethod=e.followOriginalHttpMethod)};gp.prototype.redirectTo=function(e){var r=this,t=r.request,i=null;if(e.statusCode>=300&&e.statusCode<400&&e.caseless.has("location")){var a=e.caseless.get("location");if(t.debug("redirect",a),r.followAllRedirects)i=a;else if(r.followRedirects)switch(t.method){case"PATCH":case"PUT":case"POST":case"DELETE":break;default:i=a;break}}else if(e.statusCode===401){var n=t._auth.onResponse(e);n&&(t.setHeader("authorization",n),i=t.uri)}return i};gp.prototype.onResponse=function(e){var r=this,t=r.request,i=r.redirectTo(e);if(!i||!r.allowRedirect.call(t,e))return!1;if(t.debug("redirect to",i),e.resume&&e.resume(),r.redirectsFollowed>=r.maxRedirects)return t.emit("error",new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+t.uri.href)),!1;r.redirectsFollowed+=1,xN.test(i)||(i=X6.resolve(t.uri.href,i));var a=t.uri;return t.uri=X6.parse(i),t.uri.protocol!==a.protocol&&delete t.agent,r.redirects.push({statusCode:e.statusCode,redirectUri:i}),r.followAllRedirects&&t.method!=="HEAD"&&e.statusCode!==401&&e.statusCode!==307&&(t.method=r.followOriginalHttpMethod?t.method:"GET"),delete t.src,delete t.req,delete t._started,e.statusCode!==401&&e.statusCode!==307&&(delete t.body,delete t._form,t.headers&&(t.removeHeader("host"),t.removeHeader("content-type"),t.removeHeader("content-length"),t.uri.hostname!==t.originalHost.split(":")[0]&&t.removeHeader("authorization"))),r.removeRefererHeader||t.setHeader("referer",a.href),t.emit("redirect"),t.init(),!0};Q6.Redirect=gp});var t5=D(su=>{"use strict";var oZ=require("net"),wN=require("tls"),Ig=require("http"),Z6=require("https"),_N=require("events"),kN=require("assert"),SN=require("util"),EN=Cs().Buffer;su.httpOverHttp=jN;su.httpsOverHttp=AN;su.httpOverHttps=TN;su.httpsOverHttps=PN;function jN(e){var r=new pn(e);return r.request=Ig.request,r}function AN(e){var r=new pn(e);return r.request=Ig.request,r.createSocket=e5,r.defaultPort=443,r}function TN(e){var r=new pn(e);return r.request=Z6.request,r}function PN(e){var r=new pn(e);return r.request=Z6.request,r.createSocket=e5,r.defaultPort=443,r}function pn(e){var r=this;r.options=e||{},r.proxyOptions=r.options.proxy||{},r.maxSockets=r.options.maxSockets||Ig.Agent.defaultMaxSockets,r.requests=[],r.sockets=[],r.on("free",function(i,a,n){for(var o=0,s=r.requests.length;o<s;++o){var u=r.requests[o];if(u.host===a&&u.port===n){r.requests.splice(o,1),u.request.onSocket(i);return}}i.destroy(),r.removeSocket(i)})}SN.inherits(pn,_N.EventEmitter);pn.prototype.addRequest=function(r,t){var i=this;if(typeof t=="string"&&(t={host:t,port:arguments[2],path:arguments[3]}),i.sockets.length>=this.maxSockets){i.requests.push({host:t.host,port:t.port,request:r});return}i.createConnection({host:t.host,port:t.port,request:r})};pn.prototype.createConnection=function(r){var t=this;t.createSocket(r,function(i){i.on("free",a),i.on("close",n),i.on("agentRemove",n),r.request.onSocket(i);function a(){t.emit("free",i,r.host,r.port)}function n(o){t.removeSocket(i),i.removeListener("free",a),i.removeListener("close",n),i.removeListener("agentRemove",n)}})};pn.prototype.createSocket=function(r,t){var i=this,a={};i.sockets.push(a);var n=r5({},i.proxyOptions,{method:"CONNECT",path:r.host+":"+r.port,agent:!1});n.proxyAuth&&(n.headers=n.headers||{},n.headers["Proxy-Authorization"]="Basic "+EN.from(n.proxyAuth).toString("base64")),Jo("making CONNECT request");var o=i.request(n);o.useChunkedEncodingByDefault=!1,o.once("response",s),o.once("upgrade",u),o.once("connect",l),o.once("error",f),o.end();function s(h){h.upgrade=!0}function u(h,d,m){process.nextTick(function(){l(h,d,m)})}function l(h,d,m){if(o.removeAllListeners(),d.removeAllListeners(),h.statusCode===200)kN.equal(m.length,0),Jo("tunneling connection has established"),i.sockets[i.sockets.indexOf(a)]=d,t(d);else{Jo("tunneling socket could not be established, statusCode=%d",h.statusCode);var y=new Error("tunneling socket could not be established, statusCode="+h.statusCode);y.code="ECONNRESET",r.request.emit("error",y),i.removeSocket(a)}}function f(h){o.removeAllListeners(),Jo(`tunneling socket could not be established, cause=%s
94
94
  `,h.message,h.stack);var d=new Error("tunneling socket could not be established, cause="+h.message);d.code="ECONNRESET",r.request.emit("error",d),i.removeSocket(a)}};pn.prototype.removeSocket=function(r){var t=this.sockets.indexOf(r);if(t!==-1){this.sockets.splice(t,1);var i=this.requests.shift();i&&this.createConnection(i)}};function e5(e,r){var t=this;pn.prototype.createSocket.call(t,e,function(i){var a=wN.connect(0,r5({},t.options,{servername:e.host,socket:i}));t.sockets[t.sockets.indexOf(i)]=a,r(a)})}function r5(e){for(var r=1,t=arguments.length;r<t;++r){var i=arguments[r];if(typeof i=="object")for(var a=Object.keys(i),n=0,o=a.length;n<o;++n){var s=a[n];i[s]!==void 0&&(e[s]=i[s])}}return e}var Jo;process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG)?Jo=function(){var e=Array.prototype.slice.call(arguments);typeof e[0]=="string"?e[0]="TUNNEL: "+e[0]:e.unshift("TUNNEL:"),console.error.apply(console,e)}:Jo=function(){};su.debug=Jo});var o5=D(n5=>{"use strict";var RN=require("url"),CN=t5(),a5=["accept","accept-charset","accept-encoding","accept-language","accept-ranges","cache-control","content-encoding","content-language","content-location","content-md5","content-range","content-type","connection","date","expect","max-forwards","pragma","referer","te","user-agent","via"],i5=["proxy-authorization"];function ON(e){var r=e.port,t=e.protocol,i=e.hostname+":";return r?i+=r:t==="https:"?i+="443":i+="80",i}function IN(e,r){var t=r.reduce(function(i,a){return i[a.toLowerCase()]=!0,i},{});return Object.keys(e).filter(function(i){return t[i.toLowerCase()]}).reduce(function(i,a){return i[a]=e[a],i},{})}function BN(e,r){var t=e.proxy,i={proxy:{host:t.hostname,port:+t.port,proxyAuth:t.auth,headers:r},headers:e.headers,ca:e.ca,cert:e.cert,key:e.key,passphrase:e.passphrase,pfx:e.pfx,ciphers:e.ciphers,rejectUnauthorized:e.rejectUnauthorized,secureOptions:e.secureOptions,secureProtocol:e.secureProtocol};return i}function FN(e,r){var t=e.protocol==="https:"?"https":"http",i=r.protocol==="https:"?"Https":"Http";return[t,i].join("Over")}function DN(e){var r=e.uri,t=e.proxy,i=FN(r,t);return CN[i]}function Ac(e){this.request=e,this.proxyHeaderWhiteList=a5,this.proxyHeaderExclusiveList=[],typeof e.tunnel<"u"&&(this.tunnelOverride=e.tunnel)}Ac.prototype.isEnabled=function(){var e=this,r=e.request;return typeof e.tunnelOverride<"u"?e.tunnelOverride:r.uri.protocol==="https:"};Ac.prototype.setup=function(e){var r=this,t=r.request;if(e=e||{},typeof t.proxy=="string"&&(t.proxy=RN.parse(t.proxy)),!t.proxy||!t.tunnel)return!1;e.proxyHeaderWhiteList&&(r.proxyHeaderWhiteList=e.proxyHeaderWhiteList),e.proxyHeaderExclusiveList&&(r.proxyHeaderExclusiveList=e.proxyHeaderExclusiveList);var i=r.proxyHeaderExclusiveList.concat(i5),a=r.proxyHeaderWhiteList.concat(i),n=IN(t.headers,a);n.host=ON(t.uri),i.forEach(t.removeHeader,t);var o=DN(t),s=BN(t,n);return t.agent=o(s),!0};Ac.defaultProxyHeaderWhiteList=a5;Ac.defaultProxyHeaderExclusiveList=i5;n5.Tunnel=Ac});var u5=D((s5,Tc)=>{(function(){var e,r,t,i,a,n;typeof performance<"u"&&performance!==null&&performance.now?Tc.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(Tc.exports=function(){return(e()-a)/1e6},r=process.hrtime,e=function(){var o;return o=r(),o[0]*1e9+o[1]},i=e(),n=process.uptime()*1e9,a=i-n):Date.now?(Tc.exports=function(){return Date.now()-t},t=Date.now()):(Tc.exports=function(){return new Date().getTime()-t},t=new Date().getTime())}).call(s5)});var y5=D((cZ,b5)=>{"use strict";var LN=require("http"),p5=require("https"),Pc=require("url"),Fg=require("util"),bp=require("stream"),vp=require("zlib"),Bg=Kw(),qN=i_(),MN=K3(),zN=Hf(),d5=Gf(),c5=aS(),NN=CS(),UN=Nl(),l5=Q0(),HN=LS().strict,cu=Vl(),GN=um(),WN=zS(),VN=JS().Querystring,$N=j6().Har,KN=F6().Auth,YN=V6().OAuth,XN=$6(),QN=Y6().Multipart,JN=J6().Redirect,Dg=o5().Tunnel,uu=u5(),Rc=Cs().Buffer,f5=cu.safeStringify,ZN=cu.isReadStream,eU=cu.toBase64,rU=cu.defer,h5=cu.copy,tU=cu.version,m5=GN.jar(),g5={};function aU(e,r){var t={};for(var i in r){var a=e.indexOf(i)===-1;a&&(t[i]=r[i])}return t}function iU(e,r){var t={};for(var i in r){var a=e.indexOf(i)!==-1,n=typeof r[i]=="function";a&&n||(t[i]=r[i])}return t}function v5(){var e=this;return{uri:e.uri,method:e.method,headers:e.headers}}function nU(){var e=this;return{statusCode:e.statusCode,body:e.body,headers:e.headers,request:v5.call(e.request)}}function Lr(e){var r=this;e.har&&(r._har=new $N(r),e=r._har.options(e)),bp.Stream.call(r);var t=Object.keys(Lr.prototype),i=aU(t,e);UN(r,i),e=iU(t,e),r.readable=!0,r.writable=!0,e.method&&(r.explicitMethod=!0),r._qs=new VN(r),r._auth=new KN(r),r._oauth=new YN(r),r._multipart=new QN(r),r._redirect=new JN(r),r._tunnel=new Dg(r),r.init(e)}Fg.inherits(Lr,bp.Stream);Lr.debug=process.env.NODE_DEBUG&&/\brequest\b/.test(process.env.NODE_DEBUG);function na(){Lr.debug&&console.error("REQUEST %s",Fg.format.apply(Fg,arguments))}Lr.prototype.debug=na;Lr.prototype.init=function(e){var r=this;e||(e={}),r.headers=r.headers?h5(r.headers):{};for(var t in r.headers)typeof r.headers[t]>"u"&&delete r.headers[t];if(d5.httpify(r,r.headers),r.method||(r.method=e.method||"GET"),r.localAddress||(r.localAddress=e.localAddress),r._qs.init(e),na(e),!r.pool&&r.pool!==!1&&(r.pool=g5),r.dests=r.dests||[],r.__isRequestRequest=!0,!r._callback&&r.callback&&(r._callback=r.callback,r.callback=function(){r._callbackCalled||(r._callbackCalled=!0,r._callback.apply(r,arguments))},r.on("error",r.callback.bind()),r.on("complete",r.callback.bind(r,null))),!r.uri&&r.url&&(r.uri=r.url,delete r.url),r.baseUrl){if(typeof r.baseUrl!="string")return r.emit("error",new Error("options.baseUrl must be a string"));if(typeof r.uri!="string")return r.emit("error",new Error("options.uri must be a string when using options.baseUrl"));if(r.uri.indexOf("//")===0||r.uri.indexOf("://")!==-1)return r.emit("error",new Error("options.uri must be a path when using options.baseUrl"));var i=r.baseUrl.lastIndexOf("/")===r.baseUrl.length-1,a=r.uri.indexOf("/")===0;i&&a?r.uri=r.baseUrl+r.uri.slice(1):i||a?r.uri=r.baseUrl+r.uri:r.uri===""?r.uri=r.baseUrl:r.uri=r.baseUrl+"/"+r.uri,delete r.baseUrl}if(!r.uri)return r.emit("error",new Error("options.uri is a required argument"));if(typeof r.uri=="string"&&(r.uri=Pc.parse(r.uri)),r.uri.href||(r.uri.href=Pc.format(r.uri)),r.uri.protocol==="unix:")return r.emit("error",new Error("`unix://` URL scheme is no longer supported. Please use the format `http://unix:SOCKET:PATH`"));if(r.uri.host==="unix"&&r.enableUnixSocket(),r.strictSSL===!1&&(r.rejectUnauthorized=!1),r.uri.pathname||(r.uri.pathname="/"),!(r.uri.host||r.uri.hostname&&r.uri.port)&&!r.uri.isUnix){var n=Pc.format(r.uri),o='Invalid URI "'+n+'"';return Object.keys(e).length===0&&(o+=". This can be caused by a crappy redirection."),r.abort(),r.emit("error",new Error(o))}if(r.hasOwnProperty("proxy")||(r.proxy=WN(r.uri)),r.tunnel=r._tunnel.isEnabled(),r.proxy&&r._tunnel.setup(e),r._redirect.onRequest(e),r.setHost=!1,!r.hasHeader("host")){var s=r.originalHostHeaderName||"host";r.setHeader(s,r.uri.host),r.uri.port&&(r.uri.port==="80"&&r.uri.protocol==="http:"||r.uri.port==="443"&&r.uri.protocol==="https:")&&r.setHeader(s,r.uri.hostname),r.setHost=!0}if(r.jar(r._jar||e.jar),r.uri.port||(r.uri.protocol==="http:"?r.uri.port=80:r.uri.protocol==="https:"&&(r.uri.port=443)),r.proxy&&!r.tunnel?(r.port=r.proxy.port,r.host=r.proxy.hostname):(r.port=r.uri.port,r.host=r.uri.hostname),e.form&&r.form(e.form),e.formData){var u=e.formData,l=r.form(),f=function(I,F){F&&F.hasOwnProperty("value")&&F.hasOwnProperty("options")?l.append(I,F.value,F.options):l.append(I,F)};for(var h in u)if(u.hasOwnProperty(h)){var d=u[h];if(d instanceof Array)for(var m=0;m<d.length;m++)f(h,d[m]);else f(h,d)}}if(e.qs&&r.qs(e.qs),r.uri.path?r.path=r.uri.path:r.path=r.uri.pathname+(r.uri.search||""),r.path.length===0&&(r.path="/"),e.aws&&r.aws(e.aws),e.hawk&&r.hawk(e.hawk),e.httpSignature&&r.httpSignature(e.httpSignature),e.auth&&(Object.prototype.hasOwnProperty.call(e.auth,"username")&&(e.auth.user=e.auth.username),Object.prototype.hasOwnProperty.call(e.auth,"password")&&(e.auth.pass=e.auth.password),r.auth(e.auth.user,e.auth.pass,e.auth.sendImmediately,e.auth.bearer)),r.gzip&&!r.hasHeader("accept-encoding")&&r.setHeader("accept-encoding","gzip, deflate"),r.uri.auth&&!r.hasHeader("authorization")){var y=r.uri.auth.split(":").map(function(I){return r._qs.unescape(I)});r.auth(y[0],y.slice(1).join(":"),!0)}if(!r.tunnel&&r.proxy&&r.proxy.auth&&!r.hasHeader("proxy-authorization")){var k=r.proxy.auth.split(":").map(function(I){return r._qs.unescape(I)}),x="Basic "+eU(k.join(":"));r.setHeader("proxy-authorization",x)}r.proxy&&!r.tunnel&&(r.path=r.uri.protocol+"//"+r.uri.host+r.path),e.json&&r.json(e.json),e.multipart&&r.multipart(e.multipart),e.time&&(r.timing=!0,r.elapsedTime=r.elapsedTime||0);function A(){if(HN(r.body)&&(r.body=Rc.from(r.body)),!r.hasHeader("content-length")){var I;typeof r.body=="string"?I=Rc.byteLength(r.body):Array.isArray(r.body)?I=r.body.reduce(function(F,H){return F+H.length},0):I=r.body.length,I?r.setHeader("content-length",I):r.emit("error",new Error("Argument error, options.body."))}}r.body&&!l5(r.body)&&A(),e.oauth?r.oauth(e.oauth):r._oauth.params&&r.hasHeader("authorization")&&r.oauth(r._oauth.params);var P=r.proxy&&!r.tunnel?r.proxy.protocol:r.uri.protocol,T={"http:":LN,"https:":p5},B=r.httpModules||{};if(r.httpModule=B[P]||T[P],!r.httpModule)return r.emit("error",new Error("Invalid protocol: "+P));if(e.ca&&(r.ca=e.ca),!r.agent)if(e.agentOptions&&(r.agentOptions=e.agentOptions),e.agentClass)r.agentClass=e.agentClass;else if(e.forever){var C=tU();C.major===0&&C.minor<=10?r.agentClass=P==="http:"?c5:c5.SSL:(r.agentClass=r.httpModule.Agent,r.agentOptions=r.agentOptions||{},r.agentOptions.keepAlive=!0)}else r.agentClass=r.httpModule.Agent;r.pool===!1?r.agent=!1:r.agent=r.agent||r.getNewAgent(),r.on("pipe",function(I){if(r.ntick&&r._started&&r.emit("error",new Error("You cannot pipe to this stream after the outbound request has started.")),r.src=I,ZN(I))r.hasHeader("content-type")||r.setHeader("content-type",zN.lookup(I.path));else{if(I.headers)for(var F in I.headers)r.hasHeader(F)||r.setHeader(F,I.headers[F]);r._json&&!r.hasHeader("content-type")&&r.setHeader("content-type","application/json"),I.method&&!r.explicitMethod&&(r.method=I.method)}}),rU(function(){if(!r._aborted){var I=function(){if(r._form&&(r._auth.hasAuth?r._auth.hasAuth&&r._auth.sentAuth&&r._form.pipe(r):r._form.pipe(r)),r._multipart&&r._multipart.chunked&&r._multipart.body.pipe(r),r.body)l5(r.body)?r.body.pipe(r):(A(),Array.isArray(r.body)?r.body.forEach(function(F){r.write(F)}):r.write(r.body),r.end());else if(r.requestBodyStream)console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe."),r.requestBodyStream.pipe(r);else if(!r.src){if(r._auth.hasAuth&&!r._auth.sentAuth){r.end();return}r.method!=="GET"&&typeof r.method<"u"&&r.setHeader("content-length",0),r.end()}};r._form&&!r.hasHeader("content-length")?(r.setHeader(r._form.getHeaders(),!0),r._form.getLength(function(F,H){!F&&!isNaN(H)&&r.setHeader("content-length",H),I()})):I(),r.ntick=!0}})};Lr.prototype.getNewAgent=function(){var e=this,r=e.agentClass,t={};if(e.agentOptions)for(var i in e.agentOptions)t[i]=e.agentOptions[i];e.ca&&(t.ca=e.ca),e.ciphers&&(t.ciphers=e.ciphers),e.secureProtocol&&(t.secureProtocol=e.secureProtocol),e.secureOptions&&(t.secureOptions=e.secureOptions),typeof e.rejectUnauthorized<"u"&&(t.rejectUnauthorized=e.rejectUnauthorized),e.cert&&e.key&&(t.key=e.key,t.cert=e.cert),e.pfx&&(t.pfx=e.pfx),e.passphrase&&(t.passphrase=e.passphrase);var a="";r!==e.httpModule.Agent&&(a+=r.name);var n=e.proxy;typeof n=="string"&&(n=Pc.parse(n));var o=n&&n.protocol==="https:"||this.uri.protocol==="https:";return o&&(t.ca&&(a&&(a+=":"),a+=t.ca),typeof t.rejectUnauthorized<"u"&&(a&&(a+=":"),a+=t.rejectUnauthorized),t.cert&&(a&&(a+=":"),a+=t.cert.toString("ascii")+t.key.toString("ascii")),t.pfx&&(a&&(a+=":"),a+=t.pfx.toString("ascii")),t.ciphers&&(a&&(a+=":"),a+=t.ciphers),t.secureProtocol&&(a&&(a+=":"),a+=t.secureProtocol),t.secureOptions&&(a&&(a+=":"),a+=t.secureOptions)),e.pool===g5&&!a&&Object.keys(t).length===0&&e.httpModule.globalAgent?e.httpModule.globalAgent:(a=e.uri.protocol+a,e.pool[a]||(e.pool[a]=new r(t),e.pool.maxSockets&&(e.pool[a].maxSockets=e.pool.maxSockets)),e.pool[a])};Lr.prototype.start=function(){var e=this;if(e.timing)var r=new Date().getTime(),t=uu();if(!e._aborted){e._started=!0,e.method=e.method||"GET",e.href=e.uri.href,e.src&&e.src.stat&&e.src.stat.size&&!e.hasHeader("content-length")&&e.setHeader("content-length",e.src.stat.size),e._aws&&e.aws(e._aws,!0);var i=h5(e);delete i.auth,na("make request",e.uri.href),delete i.timeout;try{e.req=e.httpModule.request(i)}catch(n){e.emit("error",n);return}e.timing&&(e.startTime=r,e.startTimeNow=t,e.timings={});var a;e.timeout&&!e.timeoutTimer&&(e.timeout<0?a=0:typeof e.timeout=="number"&&isFinite(e.timeout)&&(a=e.timeout)),e.req.on("response",e.onRequestResponse.bind(e)),e.req.on("error",e.onRequestError.bind(e)),e.req.on("drain",function(){e.emit("drain")}),e.req.on("socket",function(n){var o=n._connecting||n.connecting;if(e.timing&&(e.timings.socket=uu()-e.startTimeNow,o)){var s=function(){e.timings.lookup=uu()-e.startTimeNow},u=function(){e.timings.connect=uu()-e.startTimeNow};n.once("lookup",s),n.once("connect",u),e.req.once("error",function(){n.removeListener("lookup",s),n.removeListener("connect",u)})}var l=function(){e.req.setTimeout(a,function(){if(e.req){e.abort();var h=new Error("ESOCKETTIMEDOUT");h.code="ESOCKETTIMEDOUT",h.connect=!1,e.emit("error",h)}})};if(a!==void 0)if(o){var f=function(){n.removeListener("connect",f),e.clearTimeout(),l()};n.on("connect",f),e.req.on("error",function(h){n.removeListener("connect",f)}),e.timeoutTimer=setTimeout(function(){n.removeListener("connect",f),e.abort();var h=new Error("ETIMEDOUT");h.code="ETIMEDOUT",h.connect=!0,e.emit("error",h)},a)}else l();e.emit("socket",n)}),e.emit("request",e.req)}};Lr.prototype.onRequestError=function(e){var r=this;if(!r._aborted){if(r.req&&r.req._reusedSocket&&e.code==="ECONNRESET"&&r.agent.addRequestNoreuse){r.agent={addRequest:r.agent.addRequestNoreuse.bind(r.agent)},r.start(),r.req.end();return}r.clearTimeout(),r.emit("error",e)}};Lr.prototype.onRequestResponse=function(e){var r=this;if(r.timing&&(r.timings.response=uu()-r.startTimeNow),na("onRequestResponse",r.uri.href,e.statusCode,e.headers),e.on("end",function(){r.timing&&(r.timings.end=uu()-r.startTimeNow,e.timingStart=r.startTime,r.timings.socket||(r.timings.socket=0),r.timings.lookup||(r.timings.lookup=r.timings.socket),r.timings.connect||(r.timings.connect=r.timings.lookup),r.timings.response||(r.timings.response=r.timings.connect),na("elapsed time",r.timings.end),r.elapsedTime+=Math.round(r.timings.end),e.elapsedTime=r.elapsedTime,e.timings=r.timings,e.timingPhases={wait:r.timings.socket,dns:r.timings.lookup-r.timings.socket,tcp:r.timings.connect-r.timings.lookup,firstByte:r.timings.response-r.timings.connect,download:r.timings.end-r.timings.response,total:r.timings.end}),na("response end",r.uri.href,e.statusCode,e.headers)}),r._aborted){na("aborted",r.uri.href),e.resume();return}if(r.response=e,e.request=r,e.toJSON=nU,r.httpModule===p5&&r.strictSSL&&(!e.hasOwnProperty("socket")||!e.socket.authorized)){na("strict ssl error",r.uri.href);var t=e.hasOwnProperty("socket")?e.socket.authorizationError:r.uri.href+" does not support SSL";r.emit("error",new Error("SSL Error: "+t));return}r.originalHost=r.getHeader("host"),r.originalHostHeaderName||(r.originalHostHeaderName=r.hasHeader("host")),r.setHost&&r.removeHeader("host"),r.clearTimeout();var i=r._jar&&r._jar.setCookie?r._jar:m5,a=function(f){try{i.setCookie(f,r.uri.href,{ignoreError:!0})}catch(h){r.emit("error",h)}};if(e.caseless=d5(e.headers),e.caseless.has("set-cookie")&&!r._disableCookies){var n=e.caseless.has("set-cookie");Array.isArray(e.headers[n])?e.headers[n].forEach(a):a(e.headers[n])}if(!r._redirect.onResponse(e)){{e.on("close",function(){r._ended||r.response.emit("end")}),e.once("end",function(){r._ended=!0});var o=function(f){return r.method==="HEAD"||f>=100&&f<200||f===204||f===304},s;if(r.gzip&&!o(e.statusCode)){var u=e.headers["content-encoding"]||"identity";u=u.trim().toLowerCase();var l={flush:vp.Z_SYNC_FLUSH,finishFlush:vp.Z_SYNC_FLUSH};u==="gzip"?(s=vp.createGunzip(l),e.pipe(s)):u==="deflate"?(s=vp.createInflate(l),e.pipe(s)):(u!=="identity"&&na("ignoring unrecognized Content-Encoding "+u),s=e)}else s=e;r.encoding&&(r.dests.length!==0?console.error("Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid."):s.setEncoding(r.encoding)),r._paused&&s.pause(),r.responseContent=s,r.emit("response",e),r.dests.forEach(function(f){r.pipeDest(f)}),s.on("data",function(f){r.timing&&!r.responseStarted&&(r.responseStartTime=new Date().getTime(),e.responseStartTime=r.responseStartTime),r._destdata=!0,r.emit("data",f)}),s.once("end",function(f){r.emit("end",f)}),s.on("error",function(f){r.emit("error",f)}),s.on("close",function(){r.emit("close")}),r.callback?r.readResponseBody(e):r.on("end",function(){if(r._aborted){na("aborted",r.uri.href);return}r.emit("complete",e)})}na("finish init function",r.uri.href)}};Lr.prototype.readResponseBody=function(e){var r=this;na("reading response's body");var t=[],i=0,a=[];r.on("data",function(n){Rc.isBuffer(n)?n.length&&(i+=n.length,t.push(n)):a.push(n)}),r.on("end",function(){if(na("end event",r.uri.href),r._aborted){na("aborted",r.uri.href),t=[],i=0;return}if(i?(na("has body",r.uri.href,i),e.body=Rc.concat(t,i),r.encoding!==null&&(e.body=e.body.toString(r.encoding)),t=[],i=0):a.length&&(r.encoding==="utf8"&&a[0].length>0&&a[0][0]==="\uFEFF"&&(a[0]=a[0].substring(1)),e.body=a.join("")),r._json)try{e.body=JSON.parse(e.body,r._jsonReviver)}catch{na("invalid JSON received",r.uri.href)}na("emitting complete",r.uri.href),typeof e.body>"u"&&!r._json&&(e.body=r.encoding===null?Rc.alloc(0):""),r.emit("complete",e,e.body)})};Lr.prototype.abort=function(){var e=this;e._aborted=!0,e.req?e.req.abort():e.response&&e.response.destroy(),e.clearTimeout(),e.emit("abort")};Lr.prototype.pipeDest=function(e){var r=this,t=r.response;if(e.headers&&!e.headersSent){if(t.caseless.has("content-type")){var i=t.caseless.has("content-type");e.setHeader?e.setHeader(i,t.headers[i]):e.headers[i]=t.headers[i]}if(t.caseless.has("content-length")){var a=t.caseless.has("content-length");e.setHeader?e.setHeader(a,t.headers[a]):e.headers[a]=t.headers[a]}}if(e.setHeader&&!e.headersSent){for(var n in t.headers)(!r.gzip||n!=="content-encoding")&&e.setHeader(n,t.headers[n]);e.statusCode=t.statusCode}r.pipefilter&&r.pipefilter(t,e)};Lr.prototype.qs=function(e,r){var t=this,i;!r&&t.uri.query?i=t._qs.parse(t.uri.query):i={};for(var a in e)i[a]=e[a];var n=t._qs.stringify(i);return n===""||(t.uri=Pc.parse(t.uri.href.split("?")[0]+"?"+n),t.url=t.uri,t.path=t.uri.path,t.uri.host==="unix"&&t.enableUnixSocket()),t};Lr.prototype.form=function(e){var r=this;return e?(/^application\/x-www-form-urlencoded\b/.test(r.getHeader("content-type"))||r.setHeader("content-type","application/x-www-form-urlencoded"),r.body=typeof e=="string"?r._qs.rfc3986(e.toString("utf8")):r._qs.stringify(e).toString("utf8"),r):(r._form=new NN,r._form.on("error",function(t){t.message="form-data: "+t.message,r.emit("error",t),r.abort()}),r._form)};Lr.prototype.multipart=function(e){var r=this;return r._multipart.onRequest(e),r._multipart.chunked||(r.body=r._multipart.body),r};Lr.prototype.json=function(e){var r=this;return r.hasHeader("accept")||r.setHeader("accept","application/json"),typeof r.jsonReplacer=="function"&&(r._jsonReplacer=r.jsonReplacer),r._json=!0,typeof e=="boolean"?r.body!==void 0&&(/^application\/x-www-form-urlencoded\b/.test(r.getHeader("content-type"))?r.body=r._qs.rfc3986(r.body):r.body=f5(r.body,r._jsonReplacer),r.hasHeader("content-type")||r.setHeader("content-type","application/json")):(r.body=f5(e,r._jsonReplacer),r.hasHeader("content-type")||r.setHeader("content-type","application/json")),typeof r.jsonReviver=="function"&&(r._jsonReviver=r.jsonReviver),r};Lr.prototype.getHeader=function(e,r){var t=this,i,a,n;return r||(r=t.headers),Object.keys(r).forEach(function(o){o.length===e.length&&(a=new RegExp(e,"i"),n=o.match(a),n&&(i=r[o]))}),i};Lr.prototype.enableUnixSocket=function(){var e=this.uri.path.split(":"),r=e[0],t=e[1];this.socketPath=r,this.uri.pathname=t,this.uri.path=t,this.uri.host=r,this.uri.hostname=r,this.uri.isUnix=!0};Lr.prototype.auth=function(e,r,t,i){var a=this;return a._auth.onRequest(e,r,t,i),a};Lr.prototype.aws=function(e,r){var t=this;if(!r)return t._aws=e,t;if(e.sign_version===4||e.sign_version==="4"){var i={host:t.uri.host,path:t.uri.path,method:t.method,headers:t.headers,body:t.body};e.service&&(i.service=e.service);var a=qN.sign(i,{accessKeyId:e.key,secretAccessKey:e.secret,sessionToken:e.session});t.setHeader("authorization",a.headers.Authorization),t.setHeader("x-amz-date",a.headers["X-Amz-Date"]),a.headers["X-Amz-Security-Token"]&&t.setHeader("x-amz-security-token",a.headers["X-Amz-Security-Token"])}else{var n=new Date;t.setHeader("date",n.toUTCString());var o={key:e.key,secret:e.secret,verb:t.method.toUpperCase(),date:n,contentType:t.getHeader("content-type")||"",md5:t.getHeader("content-md5")||"",amazonHeaders:Bg.canonicalizeHeaders(t.headers)},s=t.uri.path;e.bucket&&s?o.resource="/"+e.bucket+s:e.bucket&&!s?o.resource="/"+e.bucket:!e.bucket&&s?o.resource=s:!e.bucket&&!s&&(o.resource="/"),o.resource=Bg.canonicalizeResource(o.resource),t.setHeader("authorization",Bg.authorization(o))}return t};Lr.prototype.httpSignature=function(e){var r=this;return MN.signRequest({getHeader:function(t){return r.getHeader(t,r.headers)},setHeader:function(t,i){r.setHeader(t,i)},method:r.method,path:r.path},e),na("httpSignature authorization",r.getHeader("authorization")),r};Lr.prototype.hawk=function(e){var r=this;r.setHeader("Authorization",XN.header(r.uri,r.method,e))};Lr.prototype.oauth=function(e){var r=this;return r._oauth.onRequest(e),r};Lr.prototype.jar=function(e){var r=this,t;if(r._redirect.redirectsFollowed===0&&(r.originalCookieHeader=r.getHeader("cookie")),!e)t=!1,r._disableCookies=!0;else{var i=e.getCookieString?e:m5,a=r.uri.href;i&&(t=i.getCookieString(a))}return t&&t.length&&(r.originalCookieHeader?r.setHeader("cookie",r.originalCookieHeader+"; "+t):r.setHeader("cookie",t)),r._jar=e,r};Lr.prototype.pipe=function(e,r){var t=this;if(t.response)if(t._destdata)t.emit("error",new Error("You cannot pipe after data has been emitted from the response."));else if(t._ended)t.emit("error",new Error("You cannot pipe after the response has been ended."));else return bp.Stream.prototype.pipe.call(t,e,r),t.pipeDest(e),e;else return t.dests.push(e),bp.Stream.prototype.pipe.call(t,e,r),e};Lr.prototype.write=function(){var e=this;if(!e._aborted&&(e._started||e.start(),e.req))return e.req.write.apply(e.req,arguments)};Lr.prototype.end=function(e){var r=this;r._aborted||(e&&r.write(e),r._started||r.start(),r.req&&r.req.end())};Lr.prototype.pause=function(){var e=this;e.responseContent?e.responseContent.pause.apply(e.responseContent,arguments):e._paused=!0};Lr.prototype.resume=function(){var e=this;e.responseContent?e.responseContent.resume.apply(e.responseContent,arguments):e._paused=!1};Lr.prototype.destroy=function(){var e=this;this.clearTimeout(),e._ended?e.response&&e.response.destroy():e.end()};Lr.prototype.clearTimeout=function(){this.timeoutTimer&&(clearTimeout(this.timeoutTimer),this.timeoutTimer=null)};Lr.defaultProxyHeaderWhiteList=Dg.defaultProxyHeaderWhiteList.slice();Lr.defaultProxyHeaderExclusiveList=Dg.defaultProxyHeaderExclusiveList.slice();Lr.prototype.toJSON=v5;b5.exports=Lr});var _5=D((lZ,w5)=>{"use strict";var Cc=Nl(),x5=um(),oU=Vl(),sU=oU.paramsHaveRequestBody;function yp(e,r,t){typeof r=="function"&&(t=r);var i={};return r!==null&&typeof r=="object"?Cc(i,r,{uri:e}):typeof e=="string"?Cc(i,{uri:e}):Cc(i,e),i.callback=t||i.callback,i}function Ot(e,r,t){if(typeof e>"u")throw new Error("undefined is not a valid uri or options object.");var i=yp(e,r,t);if(i.method==="HEAD"&&sU(i))throw new Error("HTTP HEAD requests MUST NOT include a request body.");return new Ot.Request(i)}function _o(e){var r=e.toUpperCase();return function(t,i,a){var n=yp(t,i,a);return n.method=r,Ot(n,n.callback)}}Ot.get=_o("get");Ot.head=_o("head");Ot.options=_o("options");Ot.post=_o("post");Ot.put=_o("put");Ot.patch=_o("patch");Ot.del=_o("delete");Ot.delete=_o("delete");Ot.jar=function(e){return x5.jar(e)};Ot.cookie=function(e){return x5.parse(e)};function Lg(e,r,t,i){return function(a,n,o){var s=yp(a,n,o),u={};return Cc(!0,u,r,s),u.pool=s.pool||r.pool,i&&(u.method=i.toUpperCase()),typeof t=="function"&&(e=t),e(u,u.callback)}}Ot.defaults=function(e,r){var t=this;e=e||{},typeof e=="function"&&(r=e,e={});var i=Lg(t,e,r),a=["get","head","post","put","patch","del","delete"];return a.forEach(function(n){i[n]=Lg(t[n],e,r,n)}),i.cookie=Lg(t.cookie,e,r),i.jar=t.jar,i.defaults=t.defaults,i};Ot.forever=function(e,r){var t={};return r&&Cc(t,r),e&&(t.agentOptions=e),t.forever=!0,Ot.defaults(t)};w5.exports=Ot;Ot.Request=y5();Ot.initParams=yp;Object.defineProperty(Ot,"debug",{enumerable:!0,get:function(){return Ot.Request.debug},set:function(e){Ot.Request.debug=e}})});var S5=D((fZ,k5)=>{k5.exports=uU;function uU(e){if(!/^data\:/i.test(e))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");var r=e.indexOf(",");if(r===-1||r<=4)throw new TypeError("malformed data: URI");for(var t=e.substring(5,r).split(";"),i=!1,a="US-ASCII",n=0;n<t.length;n++)t[n]=="base64"?i=!0:t[n].indexOf("charset=")==0&&(a=t[n].substring(8));var o=unescape(e.substring(r+1)),s=i?"base64":"ascii",u=new Buffer(o,s);return u.type=t[0]||"text/plain",u.charset=a,u}});var A5=D((pZ,j5)=>{var cU=S5();function lU(e){return{mimeType:pU(fU(e)),data:cU(e)}}function fU(e){return e.substring(5,e.indexOf(";"))}var E5=/^(\w+\/)+/;function pU(e){e=e.toLowerCase();var r=e.match(E5);return!r||!(r=r[1])?e:e.replace(E5,r)}j5.exports=lU});var P5=D((hZ,T5)=>{"use strict";var Oc=Lu(),dZ=require("path"),dU=V2().PNG,hU=mh(),mU=Q2(),gU=Z2().GifReader,vU=iw(),bU=require("fs"),yU=_5(),xU=Hf(),wU=A5();function _U(e,r){var t=new dU;t.parse(e,function(i,a){if(i){r(i);return}r(null,Oc(new Uint8Array(a.data),[a.width|0,a.height|0,4],[4,4*a.width|0,1],0))})}function kU(e,r){var t;try{t=hU.decode(e)}catch(n){r(n);return}if(!t){r(new Error("Error decoding jpeg"));return}var i=[t.height,t.width,4],a=Oc(t.data,i);r(null,a.transpose(1,0))}function SU(e,r){var t;try{t=new gU(e)}catch(s){r(s);return}if(t.numFrames()>0){var i=[t.numFrames(),t.height,t.width,4];try{var a=new Uint8Array(i[0]*i[1]*i[2]*i[3])}catch(s){r(s);return}var n=Oc(a,i);try{for(var o=0;o<t.numFrames();++o)t.decodeAndBlitFrameRGBA(o,a.subarray(n.index(o,0,0,0),n.index(o+1,0,0,0)))}catch(s){r(s);return}r(null,n.transpose(0,2,1))}else{var i=[t.height,t.width,4],a=new Uint8Array(i[0]*i[1]*i[2]),n=Oc(a,i);try{t.decodeAndBlitFrameRGBA(0,a)}catch(f){r(f);return}r(null,n.transpose(1,0))}}function EU(e,r){var t=new vU(e);try{t.init()}catch(s){r(s);return}var i=t.getData(),a=[i.getHeight(),i.getWidth(),4],n=new Uint8Array(a[0]*a[1]*a[2]),o=Oc(n,a);mU(i,o),r(null,o.transpose(1,0))}function xp(e,r,t){switch(e){case"image/png":_U(r,t);break;case"image/jpg":case"image/jpeg":kU(r,t);break;case"image/gif":SU(r,t);break;case"image/bmp":EU(r,t);break;default:t(new Error("Unsupported file type: "+e))}}T5.exports=function(r,t,i){if(i||(i=t,t=""),Buffer.isBuffer(r)){if(!t){i(new Error("Invalid file type"));return}xp(t,r,i)}else if(r.indexOf("data:")===0)try{var a=wU(r);a?process.nextTick(function(){xp(t||a.mimeType,a.data,i)}):process.nextTick(function(){i(new Error("Error parsing data URI"))})}catch(n){process.nextTick(function(){i(n)})}else r.indexOf("http://")===0||r.indexOf("https://")===0?yU({url:r,encoding:null},function(n,o,s){if(n){i(n);return}if(t=t,t||(o.getHeader!==void 0?t=o.getHeader("content-type"):o.headers!==void 0&&(t=o.headers["content-type"])),!t){i(new Error("Invalid content-type"));return}xp(t,s,i)}):bU.readFile(r,function(n,o){if(n){i(n);return}if(t=t||xU.lookup(r),!t){i(new Error("Invalid file type"));return}xp(t,o,i)})}});var ij=D((Op,aj)=>{(function(e,r){typeof Op=="object"&&typeof aj<"u"?r(Op):typeof define=="function"&&define.amd?define(["exports"],r):(e=typeof globalThis<"u"?globalThis:e||self,r(e.WebStreamsPolyfill={}))})(Op,function(e){"use strict";var r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:function(c){return"Symbol("+c+")"};function t(){}function i(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}var a=i();function n(c){return typeof c=="object"&&c!==null||typeof c=="function"}var o=t,s=Promise,u=Promise.prototype.then,l=Promise.resolve.bind(s),f=Promise.reject.bind(s);function h(c){return new s(c)}function d(c){return l(c)}function m(c){return f(c)}function y(c,g,E){return u.call(c,g,E)}function k(c,g,E){y(y(c,g,E),void 0,o)}function x(c,g){k(c,g)}function A(c,g){k(c,void 0,g)}function P(c,g,E){return y(c,g,E)}function T(c){y(c,void 0,o)}var B=function(){var c=a&&a.queueMicrotask;if(typeof c=="function")return c;var g=d(void 0);return function(E){return y(g,E)}}();function C(c,g,E){if(typeof c!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(c,g,E)}function I(c,g,E){try{return d(C(c,g,E))}catch(L){return m(L)}}var F=16384,H=function(){function c(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(c.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0}),c.prototype.push=function(g){var E=this._back,L=E;E._elements.length===F-1&&(L={_elements:[],_next:void 0}),E._elements.push(g),L!==E&&(this._back=L,E._next=L),++this._size},c.prototype.shift=function(){var g=this._front,E=g,L=this._cursor,Y=L+1,se=g._elements,xe=se[L];return Y===F&&(E=g._next,Y=0),--this._size,this._cursor=Y,g!==E&&(this._front=E),se[L]=void 0,xe},c.prototype.forEach=function(g){for(var E=this._cursor,L=this._front,Y=L._elements;(E!==Y.length||L._next!==void 0)&&!(E===Y.length&&(L=L._next,Y=L._elements,E=0,Y.length===0));)g(Y[E]),++E},c.prototype.peek=function(){var g=this._front,E=this._cursor;return g._elements[E]},c}();function N(c,g){c._ownerReadableStream=g,g._reader=c,g._state==="readable"?U(c):g._state==="closed"?J(c):$(c,g._storedError)}function K(c,g){var E=c._ownerReadableStream;return xi(E,g)}function V(c){c._ownerReadableStream._state==="readable"?le(c,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):ve(c,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),c._ownerReadableStream._reader=void 0,c._ownerReadableStream=void 0}function X(c){return new TypeError("Cannot "+c+" a stream using a released reader")}function U(c){c._closedPromise=h(function(g,E){c._closedPromise_resolve=g,c._closedPromise_reject=E})}function $(c,g){U(c),le(c,g)}function J(c){U(c),fe(c)}function le(c,g){c._closedPromise_reject!==void 0&&(T(c._closedPromise),c._closedPromise_reject(g),c._closedPromise_resolve=void 0,c._closedPromise_reject=void 0)}function ve(c,g){$(c,g)}function fe(c){c._closedPromise_resolve!==void 0&&(c._closedPromise_resolve(void 0),c._closedPromise_resolve=void 0,c._closedPromise_reject=void 0)}var we=r("[[AbortSteps]]"),ye=r("[[ErrorSteps]]"),Me=r("[[CancelSteps]]"),ze=r("[[PullSteps]]"),Ie=Number.isFinite||function(c){return typeof c=="number"&&isFinite(c)},W=Math.trunc||function(c){return c<0?Math.ceil(c):Math.floor(c)};function ke(c){return typeof c=="object"||typeof c=="function"}function Qe(c,g){if(c!==void 0&&!ke(c))throw new TypeError(g+" is not an object.")}function $e(c,g){if(typeof c!="function")throw new TypeError(g+" is not a function.")}function Ve(c){return typeof c=="object"&&c!==null||typeof c=="function"}function tr(c,g){if(!Ve(c))throw new TypeError(g+" is not an object.")}function Be(c,g,E){if(c===void 0)throw new TypeError("Parameter "+g+" is required in '"+E+"'.")}function de(c,g,E){if(c===void 0)throw new TypeError(g+" is required in '"+E+"'.")}function Se(c){return Number(c)}function nr(c){return c===0?0:c}function Pe(c){return nr(W(c))}function cr(c,g){var E=0,L=Number.MAX_SAFE_INTEGER,Y=Number(c);if(Y=nr(Y),!Ie(Y))throw new TypeError(g+" is not a finite number");if(Y=Pe(Y),Y<E||Y>L)throw new TypeError(g+" is outside the accepted range of "+E+" to "+L+", inclusive");return!Ie(Y)||Y===0?0:Y}function qr(c,g){if(!Vn(c))throw new TypeError(g+" is not a ReadableStream.")}function Kr(c){return new Xe(c)}function ee(c,g){c._reader._readRequests.push(g)}function Fe(c,g,E){var L=c._reader,Y=L._readRequests.shift();E?Y._closeSteps():Y._chunkSteps(g)}function Ke(c){return c._reader._readRequests.length}function Ge(c){var g=c._reader;return!(g===void 0||!er(g))}var Xe=function(){function c(g){if(Be(g,1,"ReadableStreamDefaultReader"),qr(g,"First parameter"),$n(g))throw new TypeError("This stream has already been locked for exclusive reading by another reader");N(this,g),this._readRequests=new H}return Object.defineProperty(c.prototype,"closed",{get:function(){return er(this)?this._closedPromise:m(gr("closed"))},enumerable:!1,configurable:!0}),c.prototype.cancel=function(g){return g===void 0&&(g=void 0),er(this)?this._ownerReadableStream===void 0?m(X("cancel")):K(this,g):m(gr("cancel"))},c.prototype.read=function(){if(!er(this))return m(gr("read"));if(this._ownerReadableStream===void 0)return m(X("read from"));var g,E,L=h(function(se,xe){g=se,E=xe}),Y={_chunkSteps:function(se){return g({value:se,done:!1})},_closeSteps:function(){return g({value:void 0,done:!0})},_errorSteps:function(se){return E(se)}};return or(this,Y),L},c.prototype.releaseLock=function(){if(!er(this))throw gr("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");V(this)}},c}();Object.defineProperties(Xe.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(Xe.prototype,r.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function er(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_readRequests")?!1:c instanceof Xe}function or(c,g){var E=c._ownerReadableStream;E._disturbed=!0,E._state==="closed"?g._closeSteps():E._state==="errored"?g._errorSteps(E._storedError):E._readableStreamController[ze](g)}function gr(c){return new TypeError("ReadableStreamDefaultReader.prototype."+c+" can only be used on a ReadableStreamDefaultReader")}var Dr,vr;typeof r.asyncIterator=="symbol"&&(vr=(Dr={},Dr[r.asyncIterator]=function(){return this},Dr),Object.defineProperty(vr,r.asyncIterator,{enumerable:!1}));var be=function(){function c(g,E){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=g,this._preventCancel=E}return c.prototype.next=function(){var g=this,E=function(){return g._nextSteps()};return this._ongoingPromise=this._ongoingPromise?P(this._ongoingPromise,E,E):E(),this._ongoingPromise},c.prototype.return=function(g){var E=this,L=function(){return E._returnSteps(g)};return this._ongoingPromise?P(this._ongoingPromise,L,L):L()},c.prototype._nextSteps=function(){var g=this;if(this._isFinished)return Promise.resolve({value:void 0,done:!0});var E=this._reader;if(E._ownerReadableStream===void 0)return m(X("iterate"));var L,Y,se=h(function(Ze,Ar){L=Ze,Y=Ar}),xe={_chunkSteps:function(Ze){g._ongoingPromise=void 0,B(function(){return L({value:Ze,done:!1})})},_closeSteps:function(){g._ongoingPromise=void 0,g._isFinished=!0,V(E),L({value:void 0,done:!0})},_errorSteps:function(Ze){g._ongoingPromise=void 0,g._isFinished=!0,V(E),Y(Ze)}};return or(E,xe),se},c.prototype._returnSteps=function(g){if(this._isFinished)return Promise.resolve({value:g,done:!0});this._isFinished=!0;var E=this._reader;if(E._ownerReadableStream===void 0)return m(X("finish iterating"));if(!this._preventCancel){var L=K(E,g);return V(E),P(L,function(){return{value:g,done:!0}})}return V(E),d({value:g,done:!0})},c}(),Ye={next:function(){return Pr(this)?this._asyncIteratorImpl.next():m(lr("next"))},return:function(c){return Pr(this)?this._asyncIteratorImpl.return(c):m(lr("return"))}};vr!==void 0&&Object.setPrototypeOf(Ye,vr);function pr(c,g){var E=Kr(c),L=new be(E,g),Y=Object.create(Ye);return Y._asyncIteratorImpl=L,Y}function Pr(c){if(!n(c)||!Object.prototype.hasOwnProperty.call(c,"_asyncIteratorImpl"))return!1;try{return c._asyncIteratorImpl instanceof be}catch{return!1}}function lr(c){return new TypeError("ReadableStreamAsyncIterator."+c+" can only be used on a ReadableSteamAsyncIterator")}var br=Number.isNaN||function(c){return c!==c};function _r(c){return c.slice()}function sr(c,g,E,L,Y){new Uint8Array(c).set(new Uint8Array(E,L,Y),g)}function hr(c){return c}function Vr(c){return!1}function Cr(c,g,E){if(c.slice)return c.slice(g,E);var L=E-g,Y=new ArrayBuffer(L);return sr(Y,0,c,g,L),Y}function Et(c){return!(typeof c!="number"||br(c)||c<0)}function Bt(c){var g=Cr(c.buffer,c.byteOffset,c.byteOffset+c.byteLength);return new Uint8Array(g)}function sa(c){var g=c._queue.shift();return c._queueTotalSize-=g.size,c._queueTotalSize<0&&(c._queueTotalSize=0),g.value}function va(c,g,E){if(!Et(E)||E===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");c._queue.push({value:g,size:E}),c._queueTotalSize+=E}function rt(c){var g=c._queue.peek();return g.value}function ut(c){c._queue=new H,c._queueTotalSize=0}var mt=function(){function c(){throw new TypeError("Illegal constructor")}return Object.defineProperty(c.prototype,"view",{get:function(){if(!ua(this))throw Ne("view");return this._view},enumerable:!1,configurable:!0}),c.prototype.respond=function(g){if(!ua(this))throw Ne("respond");if(Be(g,1,"respond"),g=cr(g,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");Vr(this._view.buffer),Je(this._associatedReadableByteStreamController,g)},c.prototype.respondWithNewView=function(g){if(!ua(this))throw Ne("respondWithNewView");if(Be(g,1,"respondWithNewView"),!ArrayBuffer.isView(g))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");Vr(g.buffer),Re(this._associatedReadableByteStreamController,g)},c}();Object.defineProperties(mt.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(mt.prototype,r.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var Ft=function(){function c(){throw new TypeError("Illegal constructor")}return Object.defineProperty(c.prototype,"byobRequest",{get:function(){if(!gt(this))throw ge("byobRequest");return Oe(this)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"desiredSize",{get:function(){if(!gt(this))throw ge("desiredSize");return ar(this)},enumerable:!1,configurable:!0}),c.prototype.close=function(){if(!gt(this))throw ge("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var g=this._controlledReadableByteStream._state;if(g!=="readable")throw new TypeError("The stream (in "+g+" state) is not in the readable state and cannot be closed");De(this)},c.prototype.enqueue=function(g){if(!gt(this))throw ge("enqueue");if(Be(g,1,"enqueue"),!ArrayBuffer.isView(g))throw new TypeError("chunk must be an array buffer view");if(g.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(g.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");var E=this._controlledReadableByteStream._state;if(E!=="readable")throw new TypeError("The stream (in "+E+" state) is not in the readable state and cannot be enqueued to");je(this,g)},c.prototype.error=function(g){if(g===void 0&&(g=void 0),!gt(this))throw ge("error");Ce(this,g)},c.prototype[Me]=function(g){tt(this),ut(this);var E=this._cancelAlgorithm(g);return He(this),E},c.prototype[ze]=function(g){var E=this._controlledReadableByteStream;if(this._queueTotalSize>0){var L=this._queue.shift();this._queueTotalSize-=L.byteLength,_(this);var Y=new Uint8Array(L.buffer,L.byteOffset,L.byteLength);g._chunkSteps(Y);return}var se=this._autoAllocateChunkSize;if(se!==void 0){var xe=void 0;try{xe=new ArrayBuffer(se)}catch(Ar){g._errorSteps(Ar);return}var Ze={buffer:xe,bufferByteLength:se,byteOffset:0,byteLength:se,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(Ze)}ee(E,g),Nt(this)},c}();Object.defineProperties(Ft.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(Ft.prototype,r.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function gt(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_controlledReadableByteStream")?!1:c instanceof Ft}function ua(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_associatedReadableByteStreamController")?!1:c instanceof mt}function Nt(c){var g=_e(c);if(g){if(c._pulling){c._pullAgain=!0;return}c._pulling=!0;var E=c._pullAlgorithm();k(E,function(){c._pulling=!1,c._pullAgain&&(c._pullAgain=!1,Nt(c))},function(L){Ce(c,L)})}}function tt(c){O(c),c._pendingPullIntos=new H}function Ga(c,g){var E=!1;c._state==="closed"&&(E=!0);var L=w(g);g.readerType==="default"?Fe(c,L,E):pe(c,L,E)}function w(c){var g=c.bytesFilled,E=c.elementSize;return new c.viewConstructor(c.buffer,c.byteOffset,g/E)}function b(c,g,E,L){c._queue.push({buffer:g,byteOffset:E,byteLength:L}),c._queueTotalSize+=L}function v(c,g){var E=g.elementSize,L=g.bytesFilled-g.bytesFilled%E,Y=Math.min(c._queueTotalSize,g.byteLength-g.bytesFilled),se=g.bytesFilled+Y,xe=se-se%E,Ze=Y,Ar=!1;xe>L&&(Ze=xe-g.bytesFilled,Ar=!0);for(var Br=c._queue;Ze>0;){var Mr=Br.peek(),$r=Math.min(Ze,Mr.byteLength),Dt=g.byteOffset+g.bytesFilled;sr(g.buffer,Dt,Mr.buffer,Mr.byteOffset,$r),Mr.byteLength===$r?Br.shift():(Mr.byteOffset+=$r,Mr.byteLength-=$r),c._queueTotalSize-=$r,p(c,$r,g),Ze-=$r}return Ar}function p(c,g,E){E.bytesFilled+=g}function _(c){c._queueTotalSize===0&&c._closeRequested?(He(c),_u(c._controlledReadableByteStream)):Nt(c)}function O(c){c._byobRequest!==null&&(c._byobRequest._associatedReadableByteStreamController=void 0,c._byobRequest._view=null,c._byobRequest=null)}function z(c){for(;c._pendingPullIntos.length>0;){if(c._queueTotalSize===0)return;var g=c._pendingPullIntos.peek();v(c,g)&&(Ue(c),Ga(c._controlledReadableByteStream,g))}}function Q(c,g,E){var L=c._controlledReadableByteStream,Y=1;g.constructor!==DataView&&(Y=g.constructor.BYTES_PER_ELEMENT);var se=g.constructor,xe=g.buffer,Ze={buffer:xe,bufferByteLength:xe.byteLength,byteOffset:g.byteOffset,byteLength:g.byteLength,bytesFilled:0,elementSize:Y,viewConstructor:se,readerType:"byob"};if(c._pendingPullIntos.length>0){c._pendingPullIntos.push(Ze),re(L,E);return}if(L._state==="closed"){var Ar=new se(Ze.buffer,Ze.byteOffset,0);E._closeSteps(Ar);return}if(c._queueTotalSize>0){if(v(c,Ze)){var Br=w(Ze);_(c),E._chunkSteps(Br);return}if(c._closeRequested){var Mr=new TypeError("Insufficient bytes to fill elements in the given buffer");Ce(c,Mr),E._errorSteps(Mr);return}}c._pendingPullIntos.push(Ze),re(L,E),Nt(c)}function ae(c,g){var E=c._controlledReadableByteStream;if(te(E))for(;oe(E)>0;){var L=Ue(c);Ga(E,L)}}function he(c,g,E){if(p(c,g,E),!(E.bytesFilled<E.elementSize)){Ue(c);var L=E.bytesFilled%E.elementSize;if(L>0){var Y=E.byteOffset+E.bytesFilled,se=Cr(E.buffer,Y-L,Y);b(c,se,0,se.byteLength)}E.bytesFilled-=L,Ga(c._controlledReadableByteStream,E),z(c)}}function me(c,g){var E=c._pendingPullIntos.peek();O(c);var L=c._controlledReadableByteStream._state;L==="closed"?ae(c):he(c,g,E),Nt(c)}function Ue(c){var g=c._pendingPullIntos.shift();return g}function _e(c){var g=c._controlledReadableByteStream;if(g._state!=="readable"||c._closeRequested||!c._started)return!1;if(Ge(g)&&Ke(g)>0||te(g)&&oe(g)>0)return!0;var E=ar(c);return E>0}function He(c){c._pullAlgorithm=void 0,c._cancelAlgorithm=void 0}function De(c){var g=c._controlledReadableByteStream;if(!(c._closeRequested||g._state!=="readable")){if(c._queueTotalSize>0){c._closeRequested=!0;return}if(c._pendingPullIntos.length>0){var E=c._pendingPullIntos.peek();if(E.bytesFilled>0){var L=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Ce(c,L),L}}He(c),_u(g)}}function je(c,g){var E=c._controlledReadableByteStream;if(!(c._closeRequested||E._state!=="readable")){var L=g.buffer,Y=g.byteOffset,se=g.byteLength,xe=L;if(c._pendingPullIntos.length>0){var Ze=c._pendingPullIntos.peek();Vr(Ze.buffer),Ze.buffer=Ze.buffer}if(O(c),Ge(E))if(Ke(E)===0)b(c,xe,Y,se);else{c._pendingPullIntos.length>0&&Ue(c);var Ar=new Uint8Array(xe,Y,se);Fe(E,Ar,!1)}else te(E)?(b(c,xe,Y,se),z(c)):b(c,xe,Y,se);Nt(c)}}function Ce(c,g){var E=c._controlledReadableByteStream;E._state==="readable"&&(tt(c),ut(c),He(c),C1(E,g))}function Oe(c){if(c._byobRequest===null&&c._pendingPullIntos.length>0){var g=c._pendingPullIntos.peek(),E=new Uint8Array(g.buffer,g.byteOffset+g.bytesFilled,g.byteLength-g.bytesFilled),L=Object.create(mt.prototype);qe(L,c,E),c._byobRequest=L}return c._byobRequest}function ar(c){var g=c._controlledReadableByteStream._state;return g==="errored"?null:g==="closed"?0:c._strategyHWM-c._queueTotalSize}function Je(c,g){var E=c._pendingPullIntos.peek(),L=c._controlledReadableByteStream._state;if(L==="closed"){if(g!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(g===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(E.bytesFilled+g>E.byteLength)throw new RangeError("bytesWritten out of range")}E.buffer=E.buffer,me(c,g)}function Re(c,g){var E=c._pendingPullIntos.peek(),L=c._controlledReadableByteStream._state;if(L==="closed"){if(g.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(g.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(E.byteOffset+E.bytesFilled!==g.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(E.bufferByteLength!==g.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(E.bytesFilled+g.byteLength>E.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");var Y=g.byteLength;E.buffer=g.buffer,me(c,Y)}function Ae(c,g,E,L,Y,se,xe){g._controlledReadableByteStream=c,g._pullAgain=!1,g._pulling=!1,g._byobRequest=null,g._queue=g._queueTotalSize=void 0,ut(g),g._closeRequested=!1,g._started=!1,g._strategyHWM=se,g._pullAlgorithm=L,g._cancelAlgorithm=Y,g._autoAllocateChunkSize=xe,g._pendingPullIntos=new H,c._readableStreamController=g;var Ze=E();k(d(Ze),function(){g._started=!0,Nt(g)},function(Ar){Ce(g,Ar)})}function Te(c,g,E){var L=Object.create(Ft.prototype),Y=function(){},se=function(){return d(void 0)},xe=function(){return d(void 0)};g.start!==void 0&&(Y=function(){return g.start(L)}),g.pull!==void 0&&(se=function(){return g.pull(L)}),g.cancel!==void 0&&(xe=function(Ar){return g.cancel(Ar)});var Ze=g.autoAllocateChunkSize;if(Ze===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");Ae(c,L,Y,se,xe,E,Ze)}function qe(c,g,E){c._associatedReadableByteStreamController=g,c._view=E}function Ne(c){return new TypeError("ReadableStreamBYOBRequest.prototype."+c+" can only be used on a ReadableStreamBYOBRequest")}function ge(c){return new TypeError("ReadableByteStreamController.prototype."+c+" can only be used on a ReadableByteStreamController")}function Z(c){return new ne(c)}function re(c,g){c._reader._readIntoRequests.push(g)}function pe(c,g,E){var L=c._reader,Y=L._readIntoRequests.shift();E?Y._closeSteps(g):Y._chunkSteps(g)}function oe(c){return c._reader._readIntoRequests.length}function te(c){var g=c._reader;return!(g===void 0||!We(g))}var ne=function(){function c(g){if(Be(g,1,"ReadableStreamBYOBReader"),qr(g,"First parameter"),$n(g))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!gt(g._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");N(this,g),this._readIntoRequests=new H}return Object.defineProperty(c.prototype,"closed",{get:function(){return We(this)?this._closedPromise:m(ir("closed"))},enumerable:!1,configurable:!0}),c.prototype.cancel=function(g){return g===void 0&&(g=void 0),We(this)?this._ownerReadableStream===void 0?m(X("cancel")):K(this,g):m(ir("cancel"))},c.prototype.read=function(g){if(!We(this))return m(ir("read"));if(!ArrayBuffer.isView(g))return m(new TypeError("view must be an array buffer view"));if(g.byteLength===0)return m(new TypeError("view must have non-zero byteLength"));if(g.buffer.byteLength===0)return m(new TypeError("view's buffer must have non-zero byteLength"));if(Vr(g.buffer),this._ownerReadableStream===void 0)return m(X("read from"));var E,L,Y=h(function(xe,Ze){E=xe,L=Ze}),se={_chunkSteps:function(xe){return E({value:xe,done:!1})},_closeSteps:function(xe){return E({value:xe,done:!0})},_errorSteps:function(xe){return L(xe)}};return fr(this,g,se),Y},c.prototype.releaseLock=function(){if(!We(this))throw ir("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");V(this)}},c}();Object.defineProperties(ne.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(ne.prototype,r.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function We(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_readIntoRequests")?!1:c instanceof ne}function fr(c,g,E){var L=c._ownerReadableStream;L._disturbed=!0,L._state==="errored"?E._errorSteps(L._storedError):Q(L._readableStreamController,g,E)}function ir(c){return new TypeError("ReadableStreamBYOBReader.prototype."+c+" can only be used on a ReadableStreamBYOBReader")}function ur(c,g){var E=c.highWaterMark;if(E===void 0)return g;if(br(E)||E<0)throw new RangeError("Invalid highWaterMark");return E}function M(c){var g=c.size;return g||function(){return 1}}function xr(c,g){Qe(c,g);var E=c==null?void 0:c.highWaterMark,L=c==null?void 0:c.size;return{highWaterMark:E===void 0?void 0:Se(E),size:L===void 0?void 0:Tr(L,g+" has member 'size' that")}}function Tr(c,g){return $e(c,g),function(E){return Se(c(E))}}function kr(c,g){Qe(c,g);var E=c==null?void 0:c.abort,L=c==null?void 0:c.close,Y=c==null?void 0:c.start,se=c==null?void 0:c.type,xe=c==null?void 0:c.write;return{abort:E===void 0?void 0:dr(E,c,g+" has member 'abort' that"),close:L===void 0?void 0:jr(L,c,g+" has member 'close' that"),start:Y===void 0?void 0:Sr(Y,c,g+" has member 'start' that"),write:xe===void 0?void 0:at(xe,c,g+" has member 'write' that"),type:se}}function dr(c,g,E){return $e(c,E),function(L){return I(c,g,[L])}}function jr(c,g,E){return $e(c,E),function(){return I(c,g,[])}}function Sr(c,g,E){return $e(c,E),function(L){return C(c,g,[L])}}function at(c,g,E){return $e(c,E),function(L,Y){return I(c,g,[L,Y])}}function Rr(c,g){if(!Le(c))throw new TypeError(g+" is not a WritableStream.")}function S(c){if(typeof c!="object"||c===null)return!1;try{return typeof c.aborted=="boolean"}catch{return!1}}var j=typeof AbortController=="function";function R(){if(j)return new AbortController}var G=function(){function c(g,E){g===void 0&&(g={}),E===void 0&&(E={}),g===void 0?g=null:tr(g,"First parameter");var L=xr(E,"Second parameter"),Y=kr(g,"First parameter");Ee(this);var se=Y.type;if(se!==void 0)throw new RangeError("Invalid type is specified");var xe=M(L),Ze=ur(L,1);LA(this,Y,Ze,xe)}return Object.defineProperty(c.prototype,"locked",{get:function(){if(!Le(this))throw ll("locked");return Or(this)},enumerable:!1,configurable:!0}),c.prototype.abort=function(g){return g===void 0&&(g=void 0),Le(this)?Or(this)?m(new TypeError("Cannot abort a stream that already has a writer")):ct(this,g):m(ll("abort"))},c.prototype.close=function(){return Le(this)?Or(this)?m(new TypeError("Cannot close a stream that already has a writer")):yi(this)?m(new TypeError("Cannot close an already-closing stream")):ca(this):m(ll("close"))},c.prototype.getWriter=function(){if(!Le(this))throw ll("getWriter");return ie(this)},c}();Object.defineProperties(G.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(G.prototype,r.toStringTag,{value:"WritableStream",configurable:!0});function ie(c){return new ds(c)}function ue(c,g,E,L,Y,se){Y===void 0&&(Y=1),se===void 0&&(se=function(){return 1});var xe=Object.create(G.prototype);Ee(xe);var Ze=Object.create(Ro.prototype);return b1(xe,Ze,c,g,E,L,Y,se),xe}function Ee(c){c._state="writable",c._storedError=void 0,c._writer=void 0,c._writableStreamController=void 0,c._writeRequests=new H,c._inFlightWriteRequest=void 0,c._closeRequest=void 0,c._inFlightCloseRequest=void 0,c._pendingAbortRequest=void 0,c._backpressure=!1}function Le(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_writableStreamController")?!1:c instanceof G}function Or(c){return c._writer!==void 0}function ct(c,g){var E;if(c._state==="closed"||c._state==="errored")return d(void 0);c._writableStreamController._abortReason=g,(E=c._writableStreamController._abortController)===null||E===void 0||E.abort();var L=c._state;if(L==="closed"||L==="errored")return d(void 0);if(c._pendingAbortRequest!==void 0)return c._pendingAbortRequest._promise;var Y=!1;L==="erroring"&&(Y=!0,g=void 0);var se=h(function(xe,Ze){c._pendingAbortRequest={_promise:void 0,_resolve:xe,_reject:Ze,_reason:g,_wasAlreadyErroring:Y}});return c._pendingAbortRequest._promise=se,Y||bn(c,g),se}function ca(c){var g=c._state;if(g==="closed"||g==="errored")return m(new TypeError("The stream (in "+g+" state) is not in the writable state and cannot be closed"));var E=h(function(Y,se){var xe={_resolve:Y,_reject:se};c._closeRequest=xe}),L=c._writer;return L!==void 0&&c._backpressure&&g==="writable"&&Sd(L),qA(c._writableStreamController),E}function la(c){var g=h(function(E,L){var Y={_resolve:E,_reject:L};c._writeRequests.push(Y)});return g}function Ta(c,g){var E=c._state;if(E==="writable"){bn(c,g);return}ba(c)}function bn(c,g){var E=c._writableStreamController;c._state="erroring",c._storedError=g;var L=c._writer;L!==void 0&&h1(L,g),!RA(c)&&E._started&&ba(c)}function ba(c){c._state="errored",c._writableStreamController[ye]();var g=c._storedError;if(c._writeRequests.forEach(function(Y){Y._reject(g)}),c._writeRequests=new H,c._pendingAbortRequest===void 0){sl(c);return}var E=c._pendingAbortRequest;if(c._pendingAbortRequest=void 0,E._wasAlreadyErroring){E._reject(g),sl(c);return}var L=c._writableStreamController[we](E._reason);k(L,function(){E._resolve(),sl(c)},function(Y){E._reject(Y),sl(c)})}function Fa(c){c._inFlightWriteRequest._resolve(void 0),c._inFlightWriteRequest=void 0}function To(c,g){c._inFlightWriteRequest._reject(g),c._inFlightWriteRequest=void 0,Ta(c,g)}function bi(c){c._inFlightCloseRequest._resolve(void 0),c._inFlightCloseRequest=void 0;var g=c._state;g==="erroring"&&(c._storedError=void 0,c._pendingAbortRequest!==void 0&&(c._pendingAbortRequest._resolve(),c._pendingAbortRequest=void 0)),c._state="closed";var E=c._writer;E!==void 0&&_1(E)}function ps(c,g){c._inFlightCloseRequest._reject(g),c._inFlightCloseRequest=void 0,c._pendingAbortRequest!==void 0&&(c._pendingAbortRequest._reject(g),c._pendingAbortRequest=void 0),Ta(c,g)}function yi(c){return!(c._closeRequest===void 0&&c._inFlightCloseRequest===void 0)}function RA(c){return!(c._inFlightWriteRequest===void 0&&c._inFlightCloseRequest===void 0)}function CA(c){c._inFlightCloseRequest=c._closeRequest,c._closeRequest=void 0}function OA(c){c._inFlightWriteRequest=c._writeRequests.shift()}function sl(c){c._closeRequest!==void 0&&(c._closeRequest._reject(c._storedError),c._closeRequest=void 0);var g=c._writer;g!==void 0&&_d(g,c._storedError)}function vd(c,g){var E=c._writer;E!==void 0&&g!==c._backpressure&&(g?WA(E):Sd(E)),c._backpressure=g}var ds=function(){function c(g){if(Be(g,1,"WritableStreamDefaultWriter"),Rr(g,"First parameter"),Or(g))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=g,g._writer=this;var E=g._state;if(E==="writable")!yi(g)&&g._backpressure?pl(this):k1(this),fl(this);else if(E==="erroring")kd(this,g._storedError),fl(this);else if(E==="closed")k1(this),HA(this);else{var L=g._storedError;kd(this,L),w1(this,L)}}return Object.defineProperty(c.prototype,"closed",{get:function(){return Po(this)?this._closedPromise:m(Co("closed"))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"desiredSize",{get:function(){if(!Po(this))throw Co("desiredSize");if(this._ownerWritableStream===void 0)throw yu("desiredSize");return DA(this)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"ready",{get:function(){return Po(this)?this._readyPromise:m(Co("ready"))},enumerable:!1,configurable:!0}),c.prototype.abort=function(g){return g===void 0&&(g=void 0),Po(this)?this._ownerWritableStream===void 0?m(yu("abort")):IA(this,g):m(Co("abort"))},c.prototype.close=function(){if(!Po(this))return m(Co("close"));var g=this._ownerWritableStream;return g===void 0?m(yu("close")):yi(g)?m(new TypeError("Cannot close an already-closing stream")):d1(this)},c.prototype.releaseLock=function(){if(!Po(this))throw Co("releaseLock");var g=this._ownerWritableStream;g!==void 0&&m1(this)},c.prototype.write=function(g){return g===void 0&&(g=void 0),Po(this)?this._ownerWritableStream===void 0?m(yu("write to")):g1(this,g):m(Co("write"))},c}();Object.defineProperties(ds.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(ds.prototype,r.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Po(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_ownerWritableStream")?!1:c instanceof ds}function IA(c,g){var E=c._ownerWritableStream;return ct(E,g)}function d1(c){var g=c._ownerWritableStream;return ca(g)}function BA(c){var g=c._ownerWritableStream,E=g._state;return yi(g)||E==="closed"?d(void 0):E==="errored"?m(g._storedError):d1(c)}function FA(c,g){c._closedPromiseState==="pending"?_d(c,g):GA(c,g)}function h1(c,g){c._readyPromiseState==="pending"?S1(c,g):VA(c,g)}function DA(c){var g=c._ownerWritableStream,E=g._state;return E==="errored"||E==="erroring"?null:E==="closed"?0:y1(g._writableStreamController)}function m1(c){var g=c._ownerWritableStream,E=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");h1(c,E),FA(c,E),g._writer=void 0,c._ownerWritableStream=void 0}function g1(c,g){var E=c._ownerWritableStream,L=E._writableStreamController,Y=MA(L,g);if(E!==c._ownerWritableStream)return m(yu("write to"));var se=E._state;if(se==="errored")return m(E._storedError);if(yi(E)||se==="closed")return m(new TypeError("The stream is closing or closed and cannot be written to"));if(se==="erroring")return m(E._storedError);var xe=la(E);return zA(L,g,Y),xe}var v1={},Ro=function(){function c(){throw new TypeError("Illegal constructor")}return Object.defineProperty(c.prototype,"abortReason",{get:function(){if(!bd(this))throw wd("abortReason");return this._abortReason},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"signal",{get:function(){if(!bd(this))throw wd("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal},enumerable:!1,configurable:!0}),c.prototype.error=function(g){if(g===void 0&&(g=void 0),!bd(this))throw wd("error");var E=this._controlledWritableStream._state;E==="writable"&&x1(this,g)},c.prototype[we]=function(g){var E=this._abortAlgorithm(g);return ul(this),E},c.prototype[ye]=function(){ut(this)},c}();Object.defineProperties(Ro.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(Ro.prototype,r.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function bd(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_controlledWritableStream")?!1:c instanceof Ro}function b1(c,g,E,L,Y,se,xe,Ze){g._controlledWritableStream=c,c._writableStreamController=g,g._queue=void 0,g._queueTotalSize=void 0,ut(g),g._abortReason=void 0,g._abortController=R(),g._started=!1,g._strategySizeAlgorithm=Ze,g._strategyHWM=xe,g._writeAlgorithm=L,g._closeAlgorithm=Y,g._abortAlgorithm=se;var Ar=xd(g);vd(c,Ar);var Br=E(),Mr=d(Br);k(Mr,function(){g._started=!0,cl(g)},function($r){g._started=!0,Ta(c,$r)})}function LA(c,g,E,L){var Y=Object.create(Ro.prototype),se=function(){},xe=function(){return d(void 0)},Ze=function(){return d(void 0)},Ar=function(){return d(void 0)};g.start!==void 0&&(se=function(){return g.start(Y)}),g.write!==void 0&&(xe=function(Br){return g.write(Br,Y)}),g.close!==void 0&&(Ze=function(){return g.close()}),g.abort!==void 0&&(Ar=function(Br){return g.abort(Br)}),b1(c,Y,se,xe,Ze,Ar,E,L)}function ul(c){c._writeAlgorithm=void 0,c._closeAlgorithm=void 0,c._abortAlgorithm=void 0,c._strategySizeAlgorithm=void 0}function qA(c){va(c,v1,0),cl(c)}function MA(c,g){try{return c._strategySizeAlgorithm(g)}catch(E){return yd(c,E),1}}function y1(c){return c._strategyHWM-c._queueTotalSize}function zA(c,g,E){try{va(c,g,E)}catch(se){yd(c,se);return}var L=c._controlledWritableStream;if(!yi(L)&&L._state==="writable"){var Y=xd(c);vd(L,Y)}cl(c)}function cl(c){var g=c._controlledWritableStream;if(c._started&&g._inFlightWriteRequest===void 0){var E=g._state;if(E==="erroring"){ba(g);return}if(c._queue.length!==0){var L=rt(c);L===v1?NA(c):UA(c,L)}}}function yd(c,g){c._controlledWritableStream._state==="writable"&&x1(c,g)}function NA(c){var g=c._controlledWritableStream;CA(g),sa(c);var E=c._closeAlgorithm();ul(c),k(E,function(){bi(g)},function(L){ps(g,L)})}function UA(c,g){var E=c._controlledWritableStream;OA(E);var L=c._writeAlgorithm(g);k(L,function(){Fa(E);var Y=E._state;if(sa(c),!yi(E)&&Y==="writable"){var se=xd(c);vd(E,se)}cl(c)},function(Y){E._state==="writable"&&ul(c),To(E,Y)})}function xd(c){var g=y1(c);return g<=0}function x1(c,g){var E=c._controlledWritableStream;ul(c),bn(E,g)}function ll(c){return new TypeError("WritableStream.prototype."+c+" can only be used on a WritableStream")}function wd(c){return new TypeError("WritableStreamDefaultController.prototype."+c+" can only be used on a WritableStreamDefaultController")}function Co(c){return new TypeError("WritableStreamDefaultWriter.prototype."+c+" can only be used on a WritableStreamDefaultWriter")}function yu(c){return new TypeError("Cannot "+c+" a stream using a released writer")}function fl(c){c._closedPromise=h(function(g,E){c._closedPromise_resolve=g,c._closedPromise_reject=E,c._closedPromiseState="pending"})}function w1(c,g){fl(c),_d(c,g)}function HA(c){fl(c),_1(c)}function _d(c,g){c._closedPromise_reject!==void 0&&(T(c._closedPromise),c._closedPromise_reject(g),c._closedPromise_resolve=void 0,c._closedPromise_reject=void 0,c._closedPromiseState="rejected")}function GA(c,g){w1(c,g)}function _1(c){c._closedPromise_resolve!==void 0&&(c._closedPromise_resolve(void 0),c._closedPromise_resolve=void 0,c._closedPromise_reject=void 0,c._closedPromiseState="resolved")}function pl(c){c._readyPromise=h(function(g,E){c._readyPromise_resolve=g,c._readyPromise_reject=E}),c._readyPromiseState="pending"}function kd(c,g){pl(c),S1(c,g)}function k1(c){pl(c),Sd(c)}function S1(c,g){c._readyPromise_reject!==void 0&&(T(c._readyPromise),c._readyPromise_reject(g),c._readyPromise_resolve=void 0,c._readyPromise_reject=void 0,c._readyPromiseState="rejected")}function WA(c){pl(c)}function VA(c,g){kd(c,g)}function Sd(c){c._readyPromise_resolve!==void 0&&(c._readyPromise_resolve(void 0),c._readyPromise_resolve=void 0,c._readyPromise_reject=void 0,c._readyPromiseState="fulfilled")}var E1=typeof DOMException<"u"?DOMException:void 0;function $A(c){if(!(typeof c=="function"||typeof c=="object"))return!1;try{return new c,!0}catch{return!1}}function KA(){var c=function(E,L){this.message=E||"",this.name=L||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return c.prototype=Object.create(Error.prototype),Object.defineProperty(c.prototype,"constructor",{value:c,writable:!0,configurable:!0}),c}var YA=$A(E1)?E1:KA();function j1(c,g,E,L,Y,se){var xe=Kr(c),Ze=ie(g);c._disturbed=!0;var Ar=!1,Br=d(void 0);return h(function(Mr,$r){var Dt;if(se!==void 0){if(Dt=function(){var wr=new YA("Aborted","AbortError"),Yr=[];L||Yr.push(function(){return g._state==="writable"?ct(g,wr):d(void 0)}),Y||Yr.push(function(){return c._state==="readable"?xi(c,wr):d(void 0)}),Wa(function(){return Promise.all(Yr.map(function(bt){return bt()}))},!0,wr)},se.aborted){Dt();return}se.addEventListener("abort",Dt)}function wi(){return h(function(wr,Yr){function bt(Vi){Vi?wr():y(gs(),bt,Yr)}bt(!1)})}function gs(){return Ar?d(!0):y(Ze._readyPromise,function(){return h(function(wr,Yr){or(xe,{_chunkSteps:function(bt){Br=y(g1(Ze,bt),void 0,t),wr(!1)},_closeSteps:function(){return wr(!0)},_errorSteps:Yr})})})}if(fa(c,xe._closedPromise,function(wr){L?xn(!0,wr):Wa(function(){return ct(g,wr)},!0,wr)}),fa(g,Ze._closedPromise,function(wr){Y?xn(!0,wr):Wa(function(){return xi(c,wr)},!0,wr)}),Wi(c,xe._closedPromise,function(){E?xn():Wa(function(){return BA(Ze)})}),yi(g)||g._state==="closed"){var Kn=new TypeError("the destination writable stream closed before all data could be piped to it");Y?xn(!0,Kn):Wa(function(){return xi(c,Kn)},!0,Kn)}T(wi());function Gi(){var wr=Br;return y(Br,function(){return wr!==Br?Gi():void 0})}function fa(wr,Yr,bt){wr._state==="errored"?bt(wr._storedError):A(Yr,bt)}function Wi(wr,Yr,bt){wr._state==="closed"?bt():x(Yr,bt)}function Wa(wr,Yr,bt){if(Ar)return;Ar=!0,g._state==="writable"&&!yi(g)?x(Gi(),Vi):Vi();function Vi(){k(wr(),function(){return vt(Yr,bt)},function(Yn){return vt(!0,Yn)})}}function xn(wr,Yr){Ar||(Ar=!0,g._state==="writable"&&!yi(g)?x(Gi(),function(){return vt(wr,Yr)}):vt(wr,Yr))}function vt(wr,Yr){m1(Ze),V(xe),se!==void 0&&se.removeEventListener("abort",Dt),wr?$r(Yr):Mr(void 0)}})}var Oo=function(){function c(){throw new TypeError("Illegal constructor")}return Object.defineProperty(c.prototype,"desiredSize",{get:function(){if(!dl(this))throw gl("desiredSize");return Ed(this)},enumerable:!1,configurable:!0}),c.prototype.close=function(){if(!dl(this))throw gl("close");if(!hs(this))throw new TypeError("The stream is not in a state that permits close");wu(this)},c.prototype.enqueue=function(g){if(g===void 0&&(g=void 0),!dl(this))throw gl("enqueue");if(!hs(this))throw new TypeError("The stream is not in a state that permits enqueue");return ml(this,g)},c.prototype.error=function(g){if(g===void 0&&(g=void 0),!dl(this))throw gl("error");Wn(this,g)},c.prototype[Me]=function(g){ut(this);var E=this._cancelAlgorithm(g);return hl(this),E},c.prototype[ze]=function(g){var E=this._controlledReadableStream;if(this._queue.length>0){var L=sa(this);this._closeRequested&&this._queue.length===0?(hl(this),_u(E)):xu(this),g._chunkSteps(L)}else ee(E,g),xu(this)},c}();Object.defineProperties(Oo.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(Oo.prototype,r.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function dl(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_controlledReadableStream")?!1:c instanceof Oo}function xu(c){var g=A1(c);if(g){if(c._pulling){c._pullAgain=!0;return}c._pulling=!0;var E=c._pullAlgorithm();k(E,function(){c._pulling=!1,c._pullAgain&&(c._pullAgain=!1,xu(c))},function(L){Wn(c,L)})}}function A1(c){var g=c._controlledReadableStream;if(!hs(c)||!c._started)return!1;if($n(g)&&Ke(g)>0)return!0;var E=Ed(c);return E>0}function hl(c){c._pullAlgorithm=void 0,c._cancelAlgorithm=void 0,c._strategySizeAlgorithm=void 0}function wu(c){if(hs(c)){var g=c._controlledReadableStream;c._closeRequested=!0,c._queue.length===0&&(hl(c),_u(g))}}function ml(c,g){if(hs(c)){var E=c._controlledReadableStream;if($n(E)&&Ke(E)>0)Fe(E,g,!1);else{var L=void 0;try{L=c._strategySizeAlgorithm(g)}catch(Y){throw Wn(c,Y),Y}try{va(c,g,L)}catch(Y){throw Wn(c,Y),Y}}xu(c)}}function Wn(c,g){var E=c._controlledReadableStream;E._state==="readable"&&(ut(c),hl(c),C1(E,g))}function Ed(c){var g=c._controlledReadableStream._state;return g==="errored"?null:g==="closed"?0:c._strategyHWM-c._queueTotalSize}function XA(c){return!A1(c)}function hs(c){var g=c._controlledReadableStream._state;return!c._closeRequested&&g==="readable"}function T1(c,g,E,L,Y,se,xe){g._controlledReadableStream=c,g._queue=void 0,g._queueTotalSize=void 0,ut(g),g._started=!1,g._closeRequested=!1,g._pullAgain=!1,g._pulling=!1,g._strategySizeAlgorithm=xe,g._strategyHWM=se,g._pullAlgorithm=L,g._cancelAlgorithm=Y,c._readableStreamController=g;var Ze=E();k(d(Ze),function(){g._started=!0,xu(g)},function(Ar){Wn(g,Ar)})}function QA(c,g,E,L){var Y=Object.create(Oo.prototype),se=function(){},xe=function(){return d(void 0)},Ze=function(){return d(void 0)};g.start!==void 0&&(se=function(){return g.start(Y)}),g.pull!==void 0&&(xe=function(){return g.pull(Y)}),g.cancel!==void 0&&(Ze=function(Ar){return g.cancel(Ar)}),T1(c,Y,se,xe,Ze,E,L)}function gl(c){return new TypeError("ReadableStreamDefaultController.prototype."+c+" can only be used on a ReadableStreamDefaultController")}function JA(c,g){return gt(c._readableStreamController)?eT(c):ZA(c)}function ZA(c,g){var E=Kr(c),L=!1,Y=!1,se=!1,xe=!1,Ze,Ar,Br,Mr,$r,Dt=h(function(fa){$r=fa});function wi(){if(L)return Y=!0,d(void 0);L=!0;var fa={_chunkSteps:function(Wi){B(function(){Y=!1;var Wa=Wi,xn=Wi;se||ml(Br._readableStreamController,Wa),xe||ml(Mr._readableStreamController,xn),L=!1,Y&&wi()})},_closeSteps:function(){L=!1,se||wu(Br._readableStreamController),xe||wu(Mr._readableStreamController),(!se||!xe)&&$r(void 0)},_errorSteps:function(){L=!1}};return or(E,fa),d(void 0)}function gs(fa){if(se=!0,Ze=fa,xe){var Wi=_r([Ze,Ar]),Wa=xi(c,Wi);$r(Wa)}return Dt}function Kn(fa){if(xe=!0,Ar=fa,se){var Wi=_r([Ze,Ar]),Wa=xi(c,Wi);$r(Wa)}return Dt}function Gi(){}return Br=jd(Gi,wi,gs),Mr=jd(Gi,wi,Kn),A(E._closedPromise,function(fa){Wn(Br._readableStreamController,fa),Wn(Mr._readableStreamController,fa),(!se||!xe)&&$r(void 0)}),[Br,Mr]}function eT(c){var g=Kr(c),E=!1,L=!1,Y=!1,se=!1,xe=!1,Ze,Ar,Br,Mr,$r,Dt=h(function(vt){$r=vt});function wi(vt){A(vt._closedPromise,function(wr){vt===g&&(Ce(Br._readableStreamController,wr),Ce(Mr._readableStreamController,wr),(!se||!xe)&&$r(void 0))})}function gs(){We(g)&&(V(g),g=Kr(c),wi(g));var vt={_chunkSteps:function(wr){B(function(){L=!1,Y=!1;var Yr=wr,bt=wr;if(!se&&!xe)try{bt=Bt(wr)}catch(Vi){Ce(Br._readableStreamController,Vi),Ce(Mr._readableStreamController,Vi),$r(xi(c,Vi));return}se||je(Br._readableStreamController,Yr),xe||je(Mr._readableStreamController,bt),E=!1,L?Gi():Y&&fa()})},_closeSteps:function(){E=!1,se||De(Br._readableStreamController),xe||De(Mr._readableStreamController),Br._readableStreamController._pendingPullIntos.length>0&&Je(Br._readableStreamController,0),Mr._readableStreamController._pendingPullIntos.length>0&&Je(Mr._readableStreamController,0),(!se||!xe)&&$r(void 0)},_errorSteps:function(){E=!1}};or(g,vt)}function Kn(vt,wr){er(g)&&(V(g),g=Z(c),wi(g));var Yr=wr?Mr:Br,bt=wr?Br:Mr,Vi={_chunkSteps:function(Yn){B(function(){L=!1,Y=!1;var vs=wr?xe:se,ju=wr?se:xe;if(ju)vs||Re(Yr._readableStreamController,Yn);else{var G1=void 0;try{G1=Bt(Yn)}catch(Rd){Ce(Yr._readableStreamController,Rd),Ce(bt._readableStreamController,Rd),$r(xi(c,Rd));return}vs||Re(Yr._readableStreamController,Yn),je(bt._readableStreamController,G1)}E=!1,L?Gi():Y&&fa()})},_closeSteps:function(Yn){E=!1;var vs=wr?xe:se,ju=wr?se:xe;vs||De(Yr._readableStreamController),ju||De(bt._readableStreamController),Yn!==void 0&&(vs||Re(Yr._readableStreamController,Yn),!ju&&bt._readableStreamController._pendingPullIntos.length>0&&Je(bt._readableStreamController,0)),(!vs||!ju)&&$r(void 0)},_errorSteps:function(){E=!1}};fr(g,vt,Vi)}function Gi(){if(E)return L=!0,d(void 0);E=!0;var vt=Oe(Br._readableStreamController);return vt===null?gs():Kn(vt._view,!1),d(void 0)}function fa(){if(E)return Y=!0,d(void 0);E=!0;var vt=Oe(Mr._readableStreamController);return vt===null?gs():Kn(vt._view,!0),d(void 0)}function Wi(vt){if(se=!0,Ze=vt,xe){var wr=_r([Ze,Ar]),Yr=xi(c,wr);$r(Yr)}return Dt}function Wa(vt){if(xe=!0,Ar=vt,se){var wr=_r([Ze,Ar]),Yr=xi(c,wr);$r(Yr)}return Dt}function xn(){}return Br=R1(xn,Gi,Wi),Mr=R1(xn,fa,Wa),wi(g),[Br,Mr]}function rT(c,g){Qe(c,g);var E=c,L=E==null?void 0:E.autoAllocateChunkSize,Y=E==null?void 0:E.cancel,se=E==null?void 0:E.pull,xe=E==null?void 0:E.start,Ze=E==null?void 0:E.type;return{autoAllocateChunkSize:L===void 0?void 0:cr(L,g+" has member 'autoAllocateChunkSize' that"),cancel:Y===void 0?void 0:tT(Y,E,g+" has member 'cancel' that"),pull:se===void 0?void 0:aT(se,E,g+" has member 'pull' that"),start:xe===void 0?void 0:iT(xe,E,g+" has member 'start' that"),type:Ze===void 0?void 0:nT(Ze,g+" has member 'type' that")}}function tT(c,g,E){return $e(c,E),function(L){return I(c,g,[L])}}function aT(c,g,E){return $e(c,E),function(L){return I(c,g,[L])}}function iT(c,g,E){return $e(c,E),function(L){return C(c,g,[L])}}function nT(c,g){if(c=""+c,c!=="bytes")throw new TypeError(g+" '"+c+"' is not a valid enumeration value for ReadableStreamType");return c}function oT(c,g){Qe(c,g);var E=c==null?void 0:c.mode;return{mode:E===void 0?void 0:sT(E,g+" has member 'mode' that")}}function sT(c,g){if(c=""+c,c!=="byob")throw new TypeError(g+" '"+c+"' is not a valid enumeration value for ReadableStreamReaderMode");return c}function uT(c,g){Qe(c,g);var E=c==null?void 0:c.preventCancel;return{preventCancel:Boolean(E)}}function P1(c,g){Qe(c,g);var E=c==null?void 0:c.preventAbort,L=c==null?void 0:c.preventCancel,Y=c==null?void 0:c.preventClose,se=c==null?void 0:c.signal;return se!==void 0&&cT(se,g+" has member 'signal' that"),{preventAbort:Boolean(E),preventCancel:Boolean(L),preventClose:Boolean(Y),signal:se}}function cT(c,g){if(!S(c))throw new TypeError(g+" is not an AbortSignal.")}function lT(c,g){Qe(c,g);var E=c==null?void 0:c.readable;de(E,"readable","ReadableWritablePair"),qr(E,g+" has member 'readable' that");var L=c==null?void 0:c.writable;return de(L,"writable","ReadableWritablePair"),Rr(L,g+" has member 'writable' that"),{readable:E,writable:L}}var yn=function(){function c(g,E){g===void 0&&(g={}),E===void 0&&(E={}),g===void 0?g=null:tr(g,"First parameter");var L=xr(E,"Second parameter"),Y=rT(g,"First parameter");if(Ad(this),Y.type==="bytes"){if(L.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");var se=ur(L,0);Te(this,Y,se)}else{var xe=M(L),se=ur(L,1);QA(this,Y,se,xe)}}return Object.defineProperty(c.prototype,"locked",{get:function(){if(!Vn(this))throw Io("locked");return $n(this)},enumerable:!1,configurable:!0}),c.prototype.cancel=function(g){return g===void 0&&(g=void 0),Vn(this)?$n(this)?m(new TypeError("Cannot cancel a stream that already has a reader")):xi(this,g):m(Io("cancel"))},c.prototype.getReader=function(g){if(g===void 0&&(g=void 0),!Vn(this))throw Io("getReader");var E=oT(g,"First parameter");return E.mode===void 0?Kr(this):Z(this)},c.prototype.pipeThrough=function(g,E){if(E===void 0&&(E={}),!Vn(this))throw Io("pipeThrough");Be(g,1,"pipeThrough");var L=lT(g,"First parameter"),Y=P1(E,"Second parameter");if($n(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Or(L.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");var se=j1(this,L.writable,Y.preventClose,Y.preventAbort,Y.preventCancel,Y.signal);return T(se),L.readable},c.prototype.pipeTo=function(g,E){if(E===void 0&&(E={}),!Vn(this))return m(Io("pipeTo"));if(g===void 0)return m("Parameter 1 is required in 'pipeTo'.");if(!Le(g))return m(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));var L;try{L=P1(E,"Second parameter")}catch(Y){return m(Y)}return $n(this)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Or(g)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):j1(this,g,L.preventClose,L.preventAbort,L.preventCancel,L.signal)},c.prototype.tee=function(){if(!Vn(this))throw Io("tee");var g=JA(this);return _r(g)},c.prototype.values=function(g){if(g===void 0&&(g=void 0),!Vn(this))throw Io("values");var E=uT(g,"First parameter");return pr(this,E.preventCancel)},c}();Object.defineProperties(yn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(yn.prototype,r.toStringTag,{value:"ReadableStream",configurable:!0}),typeof r.asyncIterator=="symbol"&&Object.defineProperty(yn.prototype,r.asyncIterator,{value:yn.prototype.values,writable:!0,configurable:!0});function jd(c,g,E,L,Y){L===void 0&&(L=1),Y===void 0&&(Y=function(){return 1});var se=Object.create(yn.prototype);Ad(se);var xe=Object.create(Oo.prototype);return T1(se,xe,c,g,E,L,Y),se}function R1(c,g,E){var L=Object.create(yn.prototype);Ad(L);var Y=Object.create(Ft.prototype);return Ae(L,Y,c,g,E,0,void 0),L}function Ad(c){c._state="readable",c._reader=void 0,c._storedError=void 0,c._disturbed=!1}function Vn(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_readableStreamController")?!1:c instanceof yn}function $n(c){return c._reader!==void 0}function xi(c,g){if(c._disturbed=!0,c._state==="closed")return d(void 0);if(c._state==="errored")return m(c._storedError);_u(c);var E=c._reader;E!==void 0&&We(E)&&(E._readIntoRequests.forEach(function(Y){Y._closeSteps(void 0)}),E._readIntoRequests=new H);var L=c._readableStreamController[Me](g);return P(L,t)}function _u(c){c._state="closed";var g=c._reader;g!==void 0&&(fe(g),er(g)&&(g._readRequests.forEach(function(E){E._closeSteps()}),g._readRequests=new H))}function C1(c,g){c._state="errored",c._storedError=g;var E=c._reader;E!==void 0&&(le(E,g),er(E)?(E._readRequests.forEach(function(L){L._errorSteps(g)}),E._readRequests=new H):(E._readIntoRequests.forEach(function(L){L._errorSteps(g)}),E._readIntoRequests=new H))}function Io(c){return new TypeError("ReadableStream.prototype."+c+" can only be used on a ReadableStream")}function O1(c,g){Qe(c,g);var E=c==null?void 0:c.highWaterMark;return de(E,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Se(E)}}var I1=function(c){return c.byteLength};try{Object.defineProperty(I1,"name",{value:"size",configurable:!0})}catch{}var ku=function(){function c(g){Be(g,1,"ByteLengthQueuingStrategy"),g=O1(g,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=g.highWaterMark}return Object.defineProperty(c.prototype,"highWaterMark",{get:function(){if(!F1(this))throw B1("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"size",{get:function(){if(!F1(this))throw B1("size");return I1},enumerable:!1,configurable:!0}),c}();Object.defineProperties(ku.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(ku.prototype,r.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function B1(c){return new TypeError("ByteLengthQueuingStrategy.prototype."+c+" can only be used on a ByteLengthQueuingStrategy")}function F1(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_byteLengthQueuingStrategyHighWaterMark")?!1:c instanceof ku}var D1=function(){return 1};try{Object.defineProperty(D1,"name",{value:"size",configurable:!0})}catch{}var Su=function(){function c(g){Be(g,1,"CountQueuingStrategy"),g=O1(g,"First parameter"),this._countQueuingStrategyHighWaterMark=g.highWaterMark}return Object.defineProperty(c.prototype,"highWaterMark",{get:function(){if(!q1(this))throw L1("highWaterMark");return this._countQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"size",{get:function(){if(!q1(this))throw L1("size");return D1},enumerable:!1,configurable:!0}),c}();Object.defineProperties(Su.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(Su.prototype,r.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function L1(c){return new TypeError("CountQueuingStrategy.prototype."+c+" can only be used on a CountQueuingStrategy")}function q1(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_countQueuingStrategyHighWaterMark")?!1:c instanceof Su}function fT(c,g){Qe(c,g);var E=c==null?void 0:c.flush,L=c==null?void 0:c.readableType,Y=c==null?void 0:c.start,se=c==null?void 0:c.transform,xe=c==null?void 0:c.writableType;return{flush:E===void 0?void 0:pT(E,c,g+" has member 'flush' that"),readableType:L,start:Y===void 0?void 0:dT(Y,c,g+" has member 'start' that"),transform:se===void 0?void 0:hT(se,c,g+" has member 'transform' that"),writableType:xe}}function pT(c,g,E){return $e(c,E),function(L){return I(c,g,[L])}}function dT(c,g,E){return $e(c,E),function(L){return C(c,g,[L])}}function hT(c,g,E){return $e(c,E),function(L,Y){return I(c,g,[L,Y])}}var Eu=function(){function c(g,E,L){g===void 0&&(g={}),E===void 0&&(E={}),L===void 0&&(L={}),g===void 0&&(g=null);var Y=xr(E,"Second parameter"),se=xr(L,"Third parameter"),xe=fT(g,"First parameter");if(xe.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(xe.writableType!==void 0)throw new RangeError("Invalid writableType specified");var Ze=ur(se,0),Ar=M(se),Br=ur(Y,1),Mr=M(Y),$r,Dt=h(function(wi){$r=wi});mT(this,Dt,Br,Mr,Ze,Ar),vT(this,xe),xe.start!==void 0?$r(xe.start(this._transformStreamController)):$r(void 0)}return Object.defineProperty(c.prototype,"readable",{get:function(){if(!M1(this))throw H1("readable");return this._readable},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"writable",{get:function(){if(!M1(this))throw H1("writable");return this._writable},enumerable:!1,configurable:!0}),c}();Object.defineProperties(Eu.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(Eu.prototype,r.toStringTag,{value:"TransformStream",configurable:!0});function mT(c,g,E,L,Y,se){function xe(){return g}function Ze(Dt){return xT(c,Dt)}function Ar(Dt){return wT(c,Dt)}function Br(){return _T(c)}c._writable=ue(xe,Ze,Br,Ar,E,L);function Mr(){return kT(c)}function $r(Dt){return bl(c,Dt),d(void 0)}c._readable=jd(xe,Mr,$r,Y,se),c._backpressure=void 0,c._backpressureChangePromise=void 0,c._backpressureChangePromise_resolve=void 0,yl(c,!0),c._transformStreamController=void 0}function M1(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_transformStreamController")?!1:c instanceof Eu}function vl(c,g){Wn(c._readable._readableStreamController,g),bl(c,g)}function bl(c,g){z1(c._transformStreamController),yd(c._writable._writableStreamController,g),c._backpressure&&yl(c,!1)}function yl(c,g){c._backpressureChangePromise!==void 0&&c._backpressureChangePromise_resolve(),c._backpressureChangePromise=h(function(E){c._backpressureChangePromise_resolve=E}),c._backpressure=g}var ms=function(){function c(){throw new TypeError("Illegal constructor")}return Object.defineProperty(c.prototype,"desiredSize",{get:function(){if(!xl(this))throw wl("desiredSize");var g=this._controlledTransformStream._readable._readableStreamController;return Ed(g)},enumerable:!1,configurable:!0}),c.prototype.enqueue=function(g){if(g===void 0&&(g=void 0),!xl(this))throw wl("enqueue");N1(this,g)},c.prototype.error=function(g){if(g===void 0&&(g=void 0),!xl(this))throw wl("error");bT(this,g)},c.prototype.terminate=function(){if(!xl(this))throw wl("terminate");yT(this)},c}();Object.defineProperties(ms.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof r.toStringTag=="symbol"&&Object.defineProperty(ms.prototype,r.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function xl(c){return!n(c)||!Object.prototype.hasOwnProperty.call(c,"_controlledTransformStream")?!1:c instanceof ms}function gT(c,g,E,L){g._controlledTransformStream=c,c._transformStreamController=g,g._transformAlgorithm=E,g._flushAlgorithm=L}function vT(c,g){var E=Object.create(ms.prototype),L=function(se){try{return N1(E,se),d(void 0)}catch(xe){return m(xe)}},Y=function(){return d(void 0)};g.transform!==void 0&&(L=function(se){return g.transform(se,E)}),g.flush!==void 0&&(Y=function(){return g.flush(E)}),gT(c,E,L,Y)}function z1(c){c._transformAlgorithm=void 0,c._flushAlgorithm=void 0}function N1(c,g){var E=c._controlledTransformStream,L=E._readable._readableStreamController;if(!hs(L))throw new TypeError("Readable side is not in a state that permits enqueue");try{ml(L,g)}catch(se){throw bl(E,se),E._readable._storedError}var Y=XA(L);Y!==E._backpressure&&yl(E,!0)}function bT(c,g){vl(c._controlledTransformStream,g)}function U1(c,g){var E=c._transformAlgorithm(g);return P(E,void 0,function(L){throw vl(c._controlledTransformStream,L),L})}function yT(c){var g=c._controlledTransformStream,E=g._readable._readableStreamController;wu(E);var L=new TypeError("TransformStream terminated");bl(g,L)}function xT(c,g){var E=c._transformStreamController;if(c._backpressure){var L=c._backpressureChangePromise;return P(L,function(){var Y=c._writable,se=Y._state;if(se==="erroring")throw Y._storedError;return U1(E,g)})}return U1(E,g)}function wT(c,g){return vl(c,g),d(void 0)}function _T(c){var g=c._readable,E=c._transformStreamController,L=E._flushAlgorithm();return z1(E),P(L,function(){if(g._state==="errored")throw g._storedError;wu(g._readableStreamController)},function(Y){throw vl(c,Y),g._storedError})}function kT(c){return yl(c,!1),c._backpressureChangePromise}function wl(c){return new TypeError("TransformStreamDefaultController.prototype."+c+" can only be used on a TransformStreamDefaultController")}function H1(c){return new TypeError("TransformStream.prototype."+c+" can only be used on a TransformStream")}var Td={ReadableStream:yn,ReadableStreamDefaultController:Oo,ReadableByteStreamController:Ft,ReadableStreamBYOBRequest:mt,ReadableStreamDefaultReader:Xe,ReadableStreamBYOBReader:ne,WritableStream:G,WritableStreamDefaultController:Ro,WritableStreamDefaultWriter:ds,ByteLengthQueuingStrategy:ku,CountQueuingStrategy:Su,TransformStream:Eu,TransformStreamDefaultController:ms};if(typeof a<"u")for(var Pd in Td)Object.prototype.hasOwnProperty.call(Td,Pd)&&Object.defineProperty(a,Pd,{value:Td[Pd],writable:!0,configurable:!0});e.ByteLengthQueuingStrategy=ku,e.CountQueuingStrategy=Su,e.ReadableByteStreamController=Ft,e.ReadableStream=yn,e.ReadableStreamBYOBReader=ne,e.ReadableStreamBYOBRequest=mt,e.ReadableStreamDefaultController=Oo,e.ReadableStreamDefaultReader=Xe,e.TransformStream=Eu,e.TransformStreamDefaultController=ms,e.WritableStream=G,e.WritableStreamDefaultController=Ro,e.WritableStreamDefaultWriter=ds,Object.defineProperty(e,"__esModule",{value:!0})})});var sA=D(ld=>{var s1,fd,u1,pd,J4,c1,Z4,eA,rA=new Uint8Array([0]),ga=[171,75,84,88,32,50,48,187,13,10,26,10];(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(s1||(s1={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(fd||(fd={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(u1||(u1={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(pd||(pd={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(J4||(J4={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(c1||(c1={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Z4||(Z4={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(eA||(eA={}));var tA=function(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=s1.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:fd.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:u1.UNSPECIFIED,colorPrimaries:pd.SRGB,transferFunction:pd.SRGB,flags:c1.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null},tl=function(){function e(t,i,a,n){this._dataView=new DataView(t.buffer,t.byteOffset+i,a),this._littleEndian=n,this._offset=0}var r=e.prototype;return r._nextUint8=function(){var t=this._dataView.getUint8(this._offset);return this._offset+=1,t},r._nextUint16=function(){var t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t},r._nextUint32=function(){var t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t},r._nextUint64=function(){var t=this._dataView.getUint32(this._offset,this._littleEndian),i=this._dataView.getUint32(this._offset+4,this._littleEndian),a=t+Math.pow(2,32)*i;return this._offset+=8,a},r._skip=function(t){return this._offset+=t,this},r._scan=function(t,i){i===void 0&&(i=0);for(var a=this._offset,n=0;this._dataView.getUint8(this._offset)!==i&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+a,n)},e}();function l1(){return(l1=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}function aA(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,i=new Array(r);t<r;t++)i[t]=e[t];return i}function iA(e,r){var t;if(typeof Symbol>"u"||e[Symbol.iterator]==null){if(Array.isArray(e)||(t=function(a,n){if(a){if(typeof a=="string")return aA(a,void 0);var o=Object.prototype.toString.call(a).slice(8,-1);return o==="Object"&&a.constructor&&(o=a.constructor.name),o==="Map"||o==="Set"?Array.from(a):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?aA(a,void 0):void 0}}(e))||r&&e&&typeof e.length=="number"){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
95
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return(t=e[Symbol.iterator]()).next.bind(t)}function nA(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Buffer.from(e)}function oA(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):Buffer.from(e).toString("utf8")}function cd(e){for(var r,t=0,i=iA(e);!(r=i()).done;)t+=r.value.byteLength;for(var a,n=new Uint8Array(t),o=0,s=iA(e);!(a=s()).done;){var u=a.value;n.set(new Uint8Array(u),o),o+=u.byteLength}return n}var PV={keepWriter:!1};ld.KTX2Container=tA,ld.read=function(e){var r=new Uint8Array(e.buffer,e.byteOffset,ga.length);if(r[0]!==ga[0]||r[1]!==ga[1]||r[2]!==ga[2]||r[3]!==ga[3]||r[4]!==ga[4]||r[5]!==ga[5]||r[6]!==ga[6]||r[7]!==ga[7]||r[8]!==ga[8]||r[9]!==ga[9]||r[10]!==ga[10]||r[11]!==ga[11])throw new Error("Missing KTX 2.0 identifier.");var t=new tA,i=17*Uint32Array.BYTES_PER_ELEMENT,a=new tl(e,ga.length,i,!0);t.vkFormat=a._nextUint32(),t.typeSize=a._nextUint32(),t.pixelWidth=a._nextUint32(),t.pixelHeight=a._nextUint32(),t.pixelDepth=a._nextUint32(),t.layerCount=a._nextUint32(),t.faceCount=a._nextUint32();var n=a._nextUint32();t.supercompressionScheme=a._nextUint32();for(var o=a._nextUint32(),s=a._nextUint32(),u=a._nextUint32(),l=a._nextUint32(),f=a._nextUint64(),h=a._nextUint64(),d=new tl(e,ga.length+i,3*n*8,!0),m=0;m<n;m++)t.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});for(var y=new tl(e,o,s,!0),k={vendorId:y._skip(4)._nextUint16(),descriptorType:y._nextUint16(),versionNumber:y._nextUint16(),descriptorBlockSize:y._nextUint16(),colorModel:y._nextUint8(),colorPrimaries:y._nextUint8(),transferFunction:y._nextUint8(),flags:y._nextUint8(),texelBlockDimension:{x:y._nextUint8()+1,y:y._nextUint8()+1,z:y._nextUint8()+1,w:y._nextUint8()+1},bytesPlane:[y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8()],samples:[]},x=(k.descriptorBlockSize/4-6)/4,A=0;A<x;A++)k.samples[A]={bitOffset:y._nextUint16(),bitLength:y._nextUint8(),channelID:y._nextUint8(),samplePosition:[y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8()],sampleLower:y._nextUint32(),sampleUpper:y._nextUint32()};t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(k);for(var P=new tl(e,u,l,!0);P._offset<l;){var T=P._nextUint32(),B=P._scan(T),C=oA(B),I=P._scan(T-B.byteLength);t.keyValue[C]=C.match(/^ktx/i)?oA(I):I,T%4&&P._skip(4-T%4)}if(h<=0)return t;for(var F=new tl(e,f,h,!0),H=F._nextUint16(),N=F._nextUint16(),K=F._nextUint32(),V=F._nextUint32(),X=F._nextUint32(),U=F._nextUint32(),$=[],J=0;J<n;J++)$.push({imageFlags:F._nextUint32(),rgbSliceByteOffset:F._nextUint32(),rgbSliceByteLength:F._nextUint32(),alphaSliceByteOffset:F._nextUint32(),alphaSliceByteLength:F._nextUint32()});var le=f+F._offset,ve=le+K,fe=ve+V,we=fe+X,ye=new Uint8Array(e.buffer,e.byteOffset+le,K),Me=new Uint8Array(e.buffer,e.byteOffset+ve,V),ze=new Uint8Array(e.buffer,e.byteOffset+fe,X),Ie=new Uint8Array(e.buffer,e.byteOffset+we,U);return t.globalData={endpointCount:H,selectorCount:N,imageDescs:$,endpointsData:ye,selectorsData:Me,tablesData:ze,extendedData:Ie},t},ld.write=function(e,r){r===void 0&&(r={}),r=l1({},PV,r);var t=new ArrayBuffer(0);if(e.globalData){var i=new ArrayBuffer(20+5*e.globalData.imageDescs.length*4),a=new DataView(i);a.setUint16(0,e.globalData.endpointCount,!0),a.setUint16(2,e.globalData.selectorCount,!0),a.setUint32(4,e.globalData.endpointsData.byteLength,!0),a.setUint32(8,e.globalData.selectorsData.byteLength,!0),a.setUint32(12,e.globalData.tablesData.byteLength,!0),a.setUint32(16,e.globalData.extendedData.byteLength,!0);for(var n=0;n<e.globalData.imageDescs.length;n++){var o=e.globalData.imageDescs[n];a.setUint32(20+5*n*4+0,o.imageFlags,!0),a.setUint32(20+5*n*4+4,o.rgbSliceByteOffset,!0),a.setUint32(20+5*n*4+8,o.rgbSliceByteLength,!0),a.setUint32(20+5*n*4+12,o.alphaSliceByteOffset,!0),a.setUint32(20+5*n*4+16,o.alphaSliceByteLength,!0)}t=cd([i,e.globalData.endpointsData,e.globalData.selectorsData,e.globalData.tablesData,e.globalData.extendedData])}var s=[],u=e.keyValue;for(var l in r.keepWriter||(u=l1({},e.keyValue,{KTXwriter:"KTX-Parse v0.0.4"})),u){var f=u[l],h=nA(l),d=typeof f=="string"?nA(f):f,m=h.byteLength+1+d.byteLength+1,y=m%4?4-m%4:0;s.push(cd([new Uint32Array([m]),h,rA,d,rA,new Uint8Array(y).fill(0)]))}var k=cd(s),x=new ArrayBuffer(44),A=new DataView(x);if(e.dataFormatDescriptor.length!==1||e.dataFormatDescriptor[0].descriptorType!==fd.BASICFORMAT)throw new Error("Only BASICFORMAT Data Format Descriptor output supported.");var P=e.dataFormatDescriptor[0];A.setUint32(0,44,!0),A.setUint16(4,P.vendorId,!0),A.setUint16(6,P.descriptorType,!0),A.setUint16(8,P.versionNumber,!0),A.setUint16(10,P.descriptorBlockSize,!0),A.setUint8(12,P.colorModel),A.setUint8(13,P.colorPrimaries),A.setUint8(14,P.transferFunction),A.setUint8(15,P.flags),A.setUint8(16,P.texelBlockDimension.x-1),A.setUint8(17,P.texelBlockDimension.y-1),A.setUint8(18,P.texelBlockDimension.z-1),A.setUint8(19,P.texelBlockDimension.w-1);for(var T=0;T<8;T++)A.setUint8(20+T,P.bytesPlane[T]);for(var B=0;B<P.samples.length;B++){var C=P.samples[B],I=28+16*B;A.setUint16(I+0,C.bitOffset,!0),A.setUint8(I+2,C.bitLength),A.setUint8(I+3,C.channelID),A.setUint8(I+4,C.samplePosition[0]),A.setUint8(I+5,C.samplePosition[1]),A.setUint8(I+6,C.samplePosition[2]),A.setUint8(I+7,C.samplePosition[3]),A.setUint32(I+8,C.sampleLower,!0),A.setUint32(I+12,C.sampleUpper,!0)}var F=ga.length+68+3*e.levels.length*8,H=F+x.byteLength,N=H+k.byteLength;N%8&&(N+=8-N%8);for(var K=[],V=new DataView(new ArrayBuffer(3*e.levels.length*8)),X=N+t.byteLength,U=0;U<e.levels.length;U++){var $=e.levels[U];K.push($.levelData),V.setBigUint64(24*U+0,BigInt(X),!0),V.setBigUint64(24*U+8,BigInt($.levelData.byteLength),!0),V.setBigUint64(24*U+16,BigInt($.uncompressedByteLength),!0),X+=$.levelData.byteLength}var J=new ArrayBuffer(68),le=new DataView(J);return le.setUint32(0,e.vkFormat,!0),le.setUint32(4,e.typeSize,!0),le.setUint32(8,e.pixelWidth,!0),le.setUint32(12,e.pixelHeight,!0),le.setUint32(16,e.pixelDepth,!0),le.setUint32(20,e.layerCount,!0),le.setUint32(24,e.faceCount,!0),le.setUint32(28,e.levels.length,!0),le.setUint32(32,e.supercompressionScheme,!0),le.setUint32(36,F,!0),le.setUint32(40,x.byteLength,!0),le.setUint32(44,H,!0),le.setUint32(48,k.byteLength,!0),le.setBigUint64(52,BigInt(N),!0),le.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(cd([new Uint8Array(ga).buffer,J,V.buffer,x,k,new ArrayBuffer(N-(H+k.byteLength)),t].concat(K)))}});var V1=typeof process!="object"||String(process)!=="[object process]"||process.browser;var $1={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]};globalThis["encoding-indexes"]=$1||{};function Er(e,r,t){return r<=e&&e<=t}function RT(e,r){return e.indexOf(r)!==-1}var wn=Math.floor;function El(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function CT(e){for(var r=String(e),t=r.length,i=0,a=[];i<t;){var n=r.charCodeAt(i);if(n<55296||n>57343)a.push(n);else if(56320<=n&&n<=57343)a.push(65533);else if(55296<=n&&n<=56319)if(i===t-1)a.push(65533);else{var o=r.charCodeAt(i+1);if(56320<=o&&o<=57343){var s=n&1023,u=o&1023;a.push(65536+(s<<10)+u),i+=1}else a.push(65533)}i+=1}return a}function OT(e){for(var r="",t=0;t<e.length;++t){var i=e[t];i<=65535?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode((i>>10)+55296,(i&1023)+56320))}return r}function ri(e){return 0<=e&&e<=127}var ei=ri,Nr=-1;function Dd(e){this.tokens=[].slice.call(e),this.tokens.reverse()}Dd.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():Nr},prepend:function(e){if(Array.isArray(e))for(var r=e;r.length;)this.tokens.push(r.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var r=e;r.length;)this.tokens.unshift(r.shift());else this.tokens.unshift(e)}};var it=-1;function zr(e,r){if(e)throw TypeError("Decoder error");return r||65533}function _i(e){throw TypeError("The code point "+e+" could not be encoded.")}function IT(){}IT.prototype={handler:function(e,r){}};function BT(){}BT.prototype={handler:function(e,r){}};function Bd(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(Fd,e)?Fd[e]:null}var K1=[{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"}],Fd={};K1.forEach(function(e){e.encodings.forEach(function(r){r.labels.forEach(function(t){Fd[t]=r})})});var Da={},La={};function bs(e,r){return r&&r[e]||null}function ys(e,r){var t=r.indexOf(e);return t===-1?null:t}function Pa(e){if(!("encoding-indexes"in globalThis))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return globalThis["encoding-indexes"][e]}function FT(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var r=0,t=0,i=Pa("gb18030-ranges"),a;for(a=0;a<i.length;++a){var n=i[a];if(n[0]<=e)r=n[0],t=n[1];else break}return t+e-r}function DT(e){if(e===59335)return 7457;var r=0,t=0,i=Pa("gb18030-ranges"),a;for(a=0;a<i.length;++a){var n=i[a];if(n[1]<=e)r=n[1],t=n[0];else break}return t+e-r}function LT(e){Od=Od||Pa("jis0208").map(function(t,i){return Er(i,8272,8835)?null:t});var r=Od;return r.indexOf(e)}var Od;function qT(e){Id=Id||Pa("big5").map(function(t,i){return i<(161-129)*157?null:t});var r=Id;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?r.lastIndexOf(e):ys(e,r)}var Id,Y1="utf-8";function Bo(e,r){if(!(this instanceof Bo))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):Y1,r=El(r),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var t=Bd(e);if(t===null||t.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!La[t.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");var i=this;return i._encoding=t,Boolean(r.fatal)&&(i._error_mode="fatal"),Boolean(r.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(Bo.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(Bo.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(Bo.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));Bo.prototype.decode=function(r,t){var i;typeof r=="object"&&r instanceof ArrayBuffer?i=new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?i=new Uint8Array(r.buffer,r.byteOffset,r.byteLength):i=new Uint8Array(0),t=El(t),this._do_not_flush||(this._decoder=La[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(t.stream);for(var a=new Dd(i),n=[],o;;){var s=a.read();if(s===Nr||(o=this._decoder.handler(a,s),o===it))break;o!==null&&(Array.isArray(o)?n.push.apply(n,o):n.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(a,a.read()),o===it)break;o!==null&&(Array.isArray(o)?n.push.apply(n,o):n.push(o))}while(!a.endOfStream());this._decoder=null}function u(l){return RT(["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)),OT(l)}return u.call(this,n)};function Tu(e,r){if(!(this instanceof Tu))throw TypeError("Called as a function. Did you forget 'new'?");r=El(r),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(r.fatal)?"fatal":"replacement";var t=this;if(Boolean(r.NONSTANDARD_allowLegacyEncoding)){e=e!==void 0?String(e):Y1;var i=Bd(e);if(i===null||i.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Da[i.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");t._encoding=i}else t._encoding=Bd("utf-8"),e!==void 0&&"console"in globalThis&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=t._encoding.name.toLowerCase()),t}Object.defineProperty&&Object.defineProperty(Tu.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});Tu.prototype.encode=function(r,t){r=r===void 0?"":String(r),t=El(t),this._do_not_flush||(this._encoder=Da[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(t.stream);for(var i=new Dd(CT(r)),a=[],n;;){var o=i.read();if(o===Nr||(n=this._encoder.handler(i,o),n===it))break;Array.isArray(n)?a.push.apply(a,n):a.push(n)}if(!this._do_not_flush){for(;n=this._encoder.handler(i,i.read()),n!==it;)Array.isArray(n)?a.push.apply(a,n):a.push(n);this._encoder=null}return new Uint8Array(a)};function MT(e){var r=e.fatal,t=0,i=0,a=0,n=128,o=191;this.handler=function(s,u){if(u===Nr&&a!==0)return a=0,zr(r);if(u===Nr)return it;if(a===0){if(Er(u,0,127))return u;if(Er(u,194,223))a=1,t=u&31;else if(Er(u,224,239))u===224&&(n=160),u===237&&(o=159),a=2,t=u&15;else if(Er(u,240,244))u===240&&(n=144),u===244&&(o=143),a=3,t=u&7;else return zr(r);return null}if(!Er(u,n,o))return t=a=i=0,n=128,o=191,s.prepend(u),zr(r);if(n=128,o=191,t=t<<6|u&63,i+=1,i!==a)return null;var l=t;return t=a=i=0,l}}function zT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(i))return i;var a,n;Er(i,128,2047)?(a=1,n=192):Er(i,2048,65535)?(a=2,n=224):Er(i,65536,1114111)&&(a=3,n=240);for(var o=[(i>>6*a)+n];a>0;){var s=i>>6*(a-1);o.push(128|s&63),a-=1}return o}}Da["UTF-8"]=function(e){return new zT(e)};La["UTF-8"]=function(e){return new MT(e)};function NT(e,r){var t=r.fatal;this.handler=function(i,a){if(a===Nr)return it;if(ri(a))return a;var n=e[a-128];return n===null?zr(t):n}}function UT(e,r){var t=r.fatal;this.handler=function(i,a){if(a===Nr)return it;if(ei(a))return a;var n=ys(a,e);return n===null&&_i(a),n+128}}(function(){"encoding-indexes"in globalThis&&K1.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(r){var t=r.name,i=Pa(t.toLowerCase());La[t]=function(a){return new NT(i,a)},Da[t]=function(a){return new UT(i,a)}})})})();La.GBK=function(e){return new X1(e)};Da.GBK=function(e){return new Q1(e,!0)};function X1(e){var r=e.fatal,t=0,i=0,a=0;this.handler=function(n,o){if(o===Nr&&t===0&&i===0&&a===0)return it;o===Nr&&(t!==0||i!==0||a!==0)&&(t=0,i=0,a=0,zr(r));var s;if(a!==0){s=null,Er(o,48,57)&&(s=FT((((t-129)*10+i-48)*126+a-129)*10+o-48));var u=[i,a,o];return t=0,i=0,a=0,s===null?(n.prepend(u),zr(r)):s}if(i!==0)return Er(o,129,254)?(a=o,null):(n.prepend([i,o]),t=0,i=0,zr(r));if(t!==0){if(Er(o,48,57))return i=o,null;var l=t,f=null;t=0;var h=o<127?64:65;return(Er(o,64,126)||Er(o,128,254))&&(f=(l-129)*190+(o-h)),s=f===null?null:bs(f,Pa("gb18030")),s===null&&ri(o)&&n.prepend(o),s===null?zr(r):s}return ri(o)?o:o===128?8364:Er(o,129,254)?(t=o,null):zr(r)}}function Q1(e,r){var t=e.fatal;this.handler=function(i,a){if(a===Nr)return it;if(ei(a))return a;if(a===58853)return _i(a);if(r&&a===8364)return 128;var n=ys(a,Pa("gb18030"));if(n!==null){var o=wn(n/190)+129,s=n%190,u=s<63?64:65;return[o,s+u]}if(r)return _i(a);n=DT(a);var l=wn(n/10/126/10);n=n-l*10*126*10;var f=wn(n/10/126);n=n-f*10*126;var h=wn(n/10),d=n-h*10;return[l+129,f+48,h+129,d+48]}}Da.gb18030=function(e){return new Q1(e)};La.gb18030=function(e){return new X1(e)};function HT(e){var r=e.fatal,t=0;this.handler=function(i,a){if(a===Nr&&t!==0)return t=0,zr(r);if(a===Nr&&t===0)return it;if(t!==0){var n=t,o=null;t=0;var s=a<127?64:98;switch((Er(a,64,126)||Er(a,161,254))&&(o=(n-129)*157+(a-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:bs(o,Pa("big5"));return u===null&&ri(a)&&i.prepend(a),u===null?zr(r):u}return ri(a)?a:Er(a,129,254)?(t=a,null):zr(r)}}function GT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(i))return i;var a=qT(i);if(a===null)return _i(i);var n=wn(a/157)+129;if(n<161)return _i(i);var o=a%157,s=o<63?64:98;return[n,o+s]}}Da.Big5=function(e){return new GT(e)};La.Big5=function(e){return new HT(e)};function WT(e){var r=e.fatal,t=!1,i=0;this.handler=function(a,n){if(n===Nr&&i!==0)return i=0,zr(r);if(n===Nr&&i===0)return it;if(i===142&&Er(n,161,223))return i=0,65377-161+n;if(i===143&&Er(n,161,254))return t=!0,i=n,null;if(i!==0){var o=i;i=0;var s=null;return Er(o,161,254)&&Er(n,161,254)&&(s=bs((o-161)*94+(n-161),Pa(t?"jis0212":"jis0208"))),t=!1,Er(n,161,254)||a.prepend(n),s===null?zr(r):s}return ri(n)?n:n===142||n===143||Er(n,161,254)?(i=n,null):zr(r)}}function VT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(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 a=ys(i,Pa("jis0208"));if(a===null)return _i(i);var n=wn(a/94)+161,o=a%94+161;return[n,o]}}Da["EUC-JP"]=function(e){return new VT(e)};La["EUC-JP"]=function(e){return new WT(e)};function $T(e){var r=e.fatal,t={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},i=t.ASCII,a=t.ASCII,n=0,o=!1;this.handler=function(s,u){switch(i){default:case t.ASCII:return u===27?(i=t.EscapeStart,null):Er(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===Nr?it:(o=!1,zr(r));case t.Roman:return u===27?(i=t.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===Nr?it:(o=!1,zr(r));case t.Katakana:return u===27?(i=t.EscapeStart,null):Er(u,33,95)?(o=!1,65377-33+u):u===Nr?it:(o=!1,zr(r));case t.LeadByte:return u===27?(i=t.EscapeStart,null):Er(u,33,126)?(o=!1,n=u,i=t.TrailByte,null):u===Nr?it:(o=!1,zr(r));case t.TrailByte:if(u===27)return i=t.EscapeStart,zr(r);if(Er(u,33,126)){i=t.LeadByte;var l=(n-33)*94+u-33,f=bs(l,Pa("jis0208"));return f===null?zr(r):f}return u===Nr?(i=t.LeadByte,s.prepend(u),zr(r)):(i=t.LeadByte,zr(r));case t.EscapeStart:return u===36||u===40?(n=u,i=t.Escape,null):(s.prepend(u),o=!1,i=a,zr(r));case t.Escape:var h=n;n=0;var d=null;if(h===40&&u===66&&(d=t.ASCII),h===40&&u===74&&(d=t.Roman),h===40&&u===73&&(d=t.Katakana),h===36&&(u===64||u===66)&&(d=t.LeadByte),d!==null){i=i=d;var m=o;return o=!0,m?zr(r):null}return s.prepend([h,u]),o=!1,i=a,zr(r)}}}function KT(e){var r=e.fatal,t={ASCII:0,Roman:1,jis0208:2},i=t.ASCII;this.handler=function(a,n){if(n===Nr&&i!==t.ASCII)return a.prepend(n),i=t.ASCII,[27,40,66];if(n===Nr&&i===t.ASCII)return it;if((i===t.ASCII||i===t.Roman)&&(n===14||n===15||n===27))return _i(65533);if(i===t.ASCII&&ei(n))return n;if(i===t.Roman&&(ei(n)&&n!==92&&n!==126||n==165||n==8254)){if(ei(n))return n;if(n===165)return 92;if(n===8254)return 126}if(ei(n)&&i!==t.ASCII)return a.prepend(n),i=t.ASCII,[27,40,66];if((n===165||n===8254)&&i!==t.Roman)return a.prepend(n),i=t.Roman,[27,40,74];n===8722&&(n=65293);var o=ys(n,Pa("jis0208"));if(o===null)return _i(n);if(i!==t.jis0208)return a.prepend(n),i=t.jis0208,[27,36,66];var s=wn(o/94)+33,u=o%94+33;return[s,u]}}Da["ISO-2022-JP"]=function(e){return new KT(e)};La["ISO-2022-JP"]=function(e){return new $T(e)};function YT(e){var r=e.fatal,t=0;this.handler=function(i,a){if(a===Nr&&t!==0)return t=0,zr(r);if(a===Nr&&t===0)return it;if(t!==0){var n=t,o=null;t=0;var s=a<127?64:65,u=n<160?129:193;if((Er(a,64,126)||Er(a,128,252))&&(o=(n-u)*188+a-s),Er(o,8836,10715))return 57344-8836+o;var l=o===null?null:bs(o,Pa("jis0208"));return l===null&&ri(a)&&i.prepend(a),l===null?zr(r):l}return ri(a)||a===128?a:Er(a,161,223)?65377-161+a:Er(a,129,159)||Er(a,224,252)?(t=a,null):zr(r)}}function XT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(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 a=LT(i);if(a===null)return _i(i);var n=wn(a/188),o=n<31?129:193,s=a%188,u=s<63?64:65;return[n+o,s+u]}}Da.Shift_JIS=function(e){return new XT(e)};La.Shift_JIS=function(e){return new YT(e)};function QT(e){var r=e.fatal,t=0;this.handler=function(i,a){if(a===Nr&&t!==0)return t=0,zr(r);if(a===Nr&&t===0)return it;if(t!==0){var n=t,o=null;t=0,Er(a,65,254)&&(o=(n-129)*190+(a-65));var s=o===null?null:bs(o,Pa("euc-kr"));return o===null&&ri(a)&&i.prepend(a),s===null?zr(r):s}return ri(a)?a:Er(a,129,254)?(t=a,null):zr(r)}}function JT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(i))return i;var a=ys(i,Pa("euc-kr"));if(a===null)return _i(i);var n=wn(a/190)+129,o=a%190+65;return[n,o]}}Da["EUC-KR"]=function(e){return new JT(e)};La["EUC-KR"]=function(e){return new QT(e)};function Sl(e,r){var t=e>>8,i=e&255;return r?[t,i]:[i,t]}function J1(e,r){var t=r.fatal,i=null,a=null;this.handler=function(n,o){if(o===Nr&&(i!==null||a!==null))return zr(t);if(o===Nr&&i===null&&a===null)return it;if(i===null)return i=o,null;var s;if(e?s=(i<<8)+o:s=(o<<8)+i,i=null,a!==null){var u=a;return a=null,Er(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(n.prepend(Sl(s,e)),zr(t))}return Er(s,55296,56319)?(a=s,null):Er(s,56320,57343)?zr(t):s}}function Z1(e,r){var t=r.fatal;this.handler=function(i,a){if(a===Nr)return it;if(Er(a,0,65535))return Sl(a,e);var n=Sl((a-65536>>10)+55296,e),o=Sl((a-65536&1023)+56320,e);return n.concat(o)}}Da["UTF-16BE"]=function(e){return new Z1(!0,e)};La["UTF-16BE"]=function(e){return new J1(!0,e)};Da["UTF-16LE"]=function(e){return new Z1(!1,e)};La["UTF-16LE"]=function(e){return new J1(!1,e)};function ZT(e){var r=e.fatal;this.handler=function(t,i){return i===Nr?it:ri(i)?i:63360+i-128}}function eP(e){var r=e.fatal;this.handler=function(t,i){return i===Nr?it:ei(i)?i:Er(i,63360,63487)?i-63360+128:_i(i)}}Da["x-user-defined"]=function(e){return new eP(e)};La["x-user-defined"]=function(e){return new ZT(e)};function Pu(e){return Buffer.from(e).toString("base64")}function Ld(e){return Buffer.from(e,"base64").toString("ascii")}var Yx=Jt($x(),1),Xx=Jt(Lu(),1);function Kx(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function hC(e,r){let t=r.type?r.type.replace("image/",""):"jpeg",i=(0,Xx.default)(e.data,[e.width,e.height,4],[4,e.width*4,1],0);return(0,Yx.default)(i,t,r)}function Qx(e,r){let t=hC(e,r);return new Promise(i=>{let a=[];t.on("data",n=>a.push(n)),t.on("end",()=>{let n=Buffer.concat(a);i(Kx(n))})})}var R5=Jt(P5(),1),qg=["image/png","image/jpeg","image/gif"];async function Mg(e,r){if(!r)throw new Error("MIMEType is required to parse image under Node.js");let t=e instanceof Buffer?e:Buffer.from(e);return await jU(t,r)}function jU(e,r){return new Promise(t=>(0,R5.default)(e,r,(i,a)=>{if(i)throw i;let n=[...a.shape],o=a.shape.length===4?a.shape.shift():1,s=a.data instanceof Buffer?new Uint8Array(a.data):a.data;t({shape:n,data:s,width:a.shape[0],height:a.shape[1],components:a.shape[2],layers:o?[o]:[]})}))}async function zg(e,r,t,i){return i._parse(e,r,t,i)}function Mi(e,r){if(!e)throw new Error(r||"loader assertion failed.")}var dn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},AU=dn.self||dn.window||dn.global||{},TU=dn.window||dn.self||dn.global||{},PU=dn.global||dn.self||dn.window||{},RU=dn.document||{};var Zo=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var C5=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),CU=C5&&parseFloat(C5[1])||0;function ko(e){return ko=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ko(e)}function Ng(e,r){if(ko(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var i=t.call(e,r||"default");if(ko(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Ug(e){var r=Ng(e,"string");return ko(r)==="symbol"?r:String(r)}function ht(e,r,t){return r=Ug(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Hg(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let r=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,t=e||r;return!!(t&&t.indexOf("Electron")>=0)}function zi(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Hg()}var OU=globalThis.self||globalThis.window||globalThis.global,lu=globalThis.window||globalThis.self||globalThis.global,IU=globalThis.document||{},es=globalThis.process||{},BU=globalThis.console,RZ=globalThis.navigator||{};var wp="4.2.0",IZ=zi();function FU(e){try{let r=window[e],t="__storage_test__";return r.setItem(t,t),r.removeItem(t),r}catch{return null}}var _p=class{constructor(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";ht(this,"storage",void 0),ht(this,"id",void 0),ht(this,"config",void 0),this.storage=FU(i),this.id=r,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(r){if(Object.assign(this.config,r),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let r={};if(this.storage){let t=this.storage.getItem(this.id);r=t?JSON.parse(t):{}}return Object.assign(this.config,r),this}};function O5(e){let r;return e<10?r="".concat(e.toFixed(2),"ms"):e<100?r="".concat(e.toFixed(1),"ms"):e<1e3?r="".concat(e.toFixed(0),"ms"):r="".concat((e/1e3).toFixed(2),"s"),r}function I5(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,t=Math.max(r-e.length,0);return"".concat(" ".repeat(t)).concat(e)}function kp(e,r,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,a=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(t=Math.min(t,i/e.width));let n=e.width*t,o=e.height*t,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(a,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(r," %c+"),s]}var Sp;(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"})(Sp||(Sp={}));var DU=10;function B5(e){return typeof e!="string"?e:(e=e.toUpperCase(),Sp[e]||Sp.WHITE)}function F5(e,r,t){if(!zi&&typeof e=="string"){if(r){let i=B5(r);e="\x1B[".concat(i,"m").concat(e,"\x1B[39m")}if(t){let i=B5(t);e="\x1B[".concat(i+DU,"m").concat(e,"\x1B[49m")}}return e}function D5(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],t=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(t),a=e;for(let n of i){let o=a[n];typeof o=="function"&&(r.find(s=>n===s)||(a[n]=o.bind(e)))}}function fu(e,r){if(!e)throw new Error(r||"Assertion failed")}function rs(){let e;if(zi()&&lu.performance){var r,t;e=lu===null||lu===void 0||(r=lu.performance)===null||r===void 0||(t=r.now)===null||t===void 0?void 0:t.call(r)}else if("hrtime"in es){var i;let a=es===null||es===void 0||(i=es.hrtime)===null||i===void 0?void 0:i.call(es);e=a[0]*1e3+a[1]/1e6}else e=Date.now();return e}var pu={debug:zi()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},LU={enabled:!0,level:0};function pi(){}var L5={},q5={once:!0},hn=class{constructor(){let{id:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};ht(this,"id",void 0),ht(this,"VERSION",wp),ht(this,"_startTs",rs()),ht(this,"_deltaTs",rs()),ht(this,"_storage",void 0),ht(this,"userData",{}),ht(this,"LOG_THROTTLE_TIMEOUT",0),this.id=r,this.userData={},this._storage=new _p("__probe-".concat(this.id,"__"),LU),this.timeStamp("".concat(this.id," started")),D5(this),Object.seal(this)}set level(r){this.setLevel(r)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((rs()-this._startTs).toPrecision(10))}getDelta(){return Number((rs()-this._deltaTs).toPrecision(10))}set priority(r){this.level=r}get priority(){return this.level}getPriority(){return this.level}enable(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:r}),this}setLevel(r){return this._storage.setConfiguration({level:r}),this}get(r){return this._storage.config[r]}set(r,t){this._storage.setConfiguration({[r]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(r,t){fu(r,t)}warn(r){return this._getLogFunction(0,r,pu.warn,arguments,q5)}error(r){return this._getLogFunction(0,r,pu.error,arguments)}deprecated(r,t){return this.warn("`".concat(r,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(r,t){return this.error("`".concat(r,"` has been removed. Use `").concat(t,"` instead"))}probe(r,t){return this._getLogFunction(r,t,pu.log,arguments,{time:!0,once:!0})}log(r,t){return this._getLogFunction(r,t,pu.debug,arguments)}info(r,t){return this._getLogFunction(r,t,console.info,arguments)}once(r,t){return this._getLogFunction(r,t,pu.debug||pu.info,arguments,q5)}table(r,t,i){return t?this._getLogFunction(r,t,console.table||pi,i&&[i],{tag:NU(t)}):pi}image(r){let{logLevel:t,priority:i,image:a,message:n="",scale:o=1}=r;return this._shouldLog(t||i)?zi()?zU({image:a,message:n,scale:o}):MU({image:a,message:n,scale:o}):pi}time(r,t){return this._getLogFunction(r,t,console.time?console.time:console.info)}timeEnd(r,t){return this._getLogFunction(r,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(r,t){return this._getLogFunction(r,t,console.timeStamp||pi)}group(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},a=M5({logLevel:r,message:t,opts:i}),{collapsed:n}=i;return a.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(a)}groupCollapsed(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(r,t,Object.assign({},i,{collapsed:!0}))}groupEnd(r){return this._getLogFunction(r,"",console.groupEnd||pi)}withGroup(r,t,i){this.group(r,t)();try{i()}finally{this.groupEnd(r)()}}trace(){console.trace&&console.trace()}_shouldLog(r){return this.isEnabled()&&this.getLevel()>=z5(r)}_getLogFunction(r,t,i,a,n){if(this._shouldLog(r)){n=M5({logLevel:r,message:t,args:a,opts:n}),i=i||n.method,fu(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=rs();let o=n.tag||n.message;if(n.once&&o)if(!L5[o])L5[o]=rs();else return pi;return t=qU(this.id,n.message,n),i.bind(console,t,...n.args)}return pi}};ht(hn,"VERSION",wp);function z5(e){if(!e)return 0;let r;switch(typeof e){case"number":r=e;break;case"object":r=e.logLevel||e.priority||0;break;default:return 0}return fu(Number.isFinite(r)&&r>=0),r}function M5(e){let{logLevel:r,message:t}=e;e.logLevel=z5(r);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==t;);switch(typeof r){case"string":case"function":t!==void 0&&i.unshift(t),e.message=r;break;case"object":Object.assign(e,r);break;default:}typeof e.message=="function"&&(e.message=e.message());let a=typeof e.message;return fu(a==="string"||a==="object"),Object.assign(e,{args:i},e.opts)}function qU(e,r,t){if(typeof r=="string"){let i=t.time?I5(O5(t.total)):"";r=t.time?"".concat(e,": ").concat(i," ").concat(r):"".concat(e,": ").concat(r),r=F5(r,t.color,t.background)}return r}function MU(e){let{image:r,message:t="",scale:i=1}=e;return console.warn("removed"),pi}function zU(e){let{image:r,message:t="",scale:i=1}=e;if(typeof r=="string"){let n=new Image;return n.onload=()=>{let o=kp(n,t,i);console.log(...o)},n.src=r,pi}let a=r.nodeName||"";if(a.toLowerCase()==="img")return console.log(...kp(r,t,i)),pi;if(a.toLowerCase()==="canvas"){let n=new Image;return n.onload=()=>console.log(...kp(n,t,i)),n.src=r.toDataURL(),pi}return pi}function NU(e){for(let r in e)for(let t in e[r])return t||"untitled";return"empty"}var oee=new hn({id:"@probe.gl/log"});function Gg(e,r){return N5(e||{},r)}function N5(e,r,t=0){if(t>3)return r;let i={...e};for(let[a,n]of Object.entries(r))n&&typeof n=="object"&&!Array.isArray(n)?i[a]=N5(i[a]||{},r[a],t+1):i[a]=r[a];return i}function Wg(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function Vg(e){var t,i;return((i=(t=globalThis.loaders)==null?void 0:t.modules)==null?void 0:i[e])||null}var U5="latest";function UU(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0"),globalThis._loadersgl_.version}var Ic=UU();function ma(e,r){if(!e)throw new Error(r||"loaders.gl assertion failed.")}var mn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},dee=mn.self||mn.window||mn.global||{},hee=mn.window||mn.self||mn.global||{},mee=mn.global||mn.self||mn.window||{},gee=mn.document||{};var oa=typeof process!="object"||String(process)!=="[object process]"||process.browser,Bc=typeof importScripts=="function",G5=typeof window<"u"&&typeof window.orientation<"u",H5=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),vee=H5&&parseFloat(H5[1])||0;var Fc=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(r,t){this.name=r,this.workerThread=t,this.result=new Promise((i,a)=>{this._resolve=i,this._reject=a})}postMessage(r,t){this.workerThread.postMessage({source:"loaders.gl",type:r,payload:t})}done(r){ma(this.isRunning),this.isRunning=!1,this._resolve(r)}error(r){ma(this.isRunning),this.isRunning=!1,this._reject(r)}};var So={};kl(So,{NodeWorker:()=>Lc,parentPort:()=>$g});var Dc=Jt(require("worker_threads"),1);Au(So,require("worker_threads"));var $g=Dc==null?void 0:Dc.parentPort,Lc=Dc.Worker;var Kg=new Map;function W5(e){ma(e.source&&!e.url||!e.source&&e.url);let r=Kg.get(e.source||e.url);return r||(e.url&&(r=HU(e.url),Kg.set(e.url,r)),e.source&&(r=V5(e.source),Kg.set(e.source,r))),ma(r),r}function HU(e){if(!e.startsWith("http"))return e;let r=GU(e);return V5(r)}function V5(e){let r=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(r)}function GU(e){return`try {
95
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return(t=e[Symbol.iterator]()).next.bind(t)}function nA(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Buffer.from(e)}function oA(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):Buffer.from(e).toString("utf8")}function cd(e){for(var r,t=0,i=iA(e);!(r=i()).done;)t+=r.value.byteLength;for(var a,n=new Uint8Array(t),o=0,s=iA(e);!(a=s()).done;){var u=a.value;n.set(new Uint8Array(u),o),o+=u.byteLength}return n}var PV={keepWriter:!1};ld.KTX2Container=tA,ld.read=function(e){var r=new Uint8Array(e.buffer,e.byteOffset,ga.length);if(r[0]!==ga[0]||r[1]!==ga[1]||r[2]!==ga[2]||r[3]!==ga[3]||r[4]!==ga[4]||r[5]!==ga[5]||r[6]!==ga[6]||r[7]!==ga[7]||r[8]!==ga[8]||r[9]!==ga[9]||r[10]!==ga[10]||r[11]!==ga[11])throw new Error("Missing KTX 2.0 identifier.");var t=new tA,i=17*Uint32Array.BYTES_PER_ELEMENT,a=new tl(e,ga.length,i,!0);t.vkFormat=a._nextUint32(),t.typeSize=a._nextUint32(),t.pixelWidth=a._nextUint32(),t.pixelHeight=a._nextUint32(),t.pixelDepth=a._nextUint32(),t.layerCount=a._nextUint32(),t.faceCount=a._nextUint32();var n=a._nextUint32();t.supercompressionScheme=a._nextUint32();for(var o=a._nextUint32(),s=a._nextUint32(),u=a._nextUint32(),l=a._nextUint32(),f=a._nextUint64(),h=a._nextUint64(),d=new tl(e,ga.length+i,3*n*8,!0),m=0;m<n;m++)t.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});for(var y=new tl(e,o,s,!0),k={vendorId:y._skip(4)._nextUint16(),descriptorType:y._nextUint16(),versionNumber:y._nextUint16(),descriptorBlockSize:y._nextUint16(),colorModel:y._nextUint8(),colorPrimaries:y._nextUint8(),transferFunction:y._nextUint8(),flags:y._nextUint8(),texelBlockDimension:{x:y._nextUint8()+1,y:y._nextUint8()+1,z:y._nextUint8()+1,w:y._nextUint8()+1},bytesPlane:[y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8()],samples:[]},x=(k.descriptorBlockSize/4-6)/4,A=0;A<x;A++)k.samples[A]={bitOffset:y._nextUint16(),bitLength:y._nextUint8(),channelID:y._nextUint8(),samplePosition:[y._nextUint8(),y._nextUint8(),y._nextUint8(),y._nextUint8()],sampleLower:y._nextUint32(),sampleUpper:y._nextUint32()};t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(k);for(var P=new tl(e,u,l,!0);P._offset<l;){var T=P._nextUint32(),B=P._scan(T),C=oA(B),I=P._scan(T-B.byteLength);t.keyValue[C]=C.match(/^ktx/i)?oA(I):I,T%4&&P._skip(4-T%4)}if(h<=0)return t;for(var F=new tl(e,f,h,!0),H=F._nextUint16(),N=F._nextUint16(),K=F._nextUint32(),V=F._nextUint32(),X=F._nextUint32(),U=F._nextUint32(),$=[],J=0;J<n;J++)$.push({imageFlags:F._nextUint32(),rgbSliceByteOffset:F._nextUint32(),rgbSliceByteLength:F._nextUint32(),alphaSliceByteOffset:F._nextUint32(),alphaSliceByteLength:F._nextUint32()});var le=f+F._offset,ve=le+K,fe=ve+V,we=fe+X,ye=new Uint8Array(e.buffer,e.byteOffset+le,K),Me=new Uint8Array(e.buffer,e.byteOffset+ve,V),ze=new Uint8Array(e.buffer,e.byteOffset+fe,X),Ie=new Uint8Array(e.buffer,e.byteOffset+we,U);return t.globalData={endpointCount:H,selectorCount:N,imageDescs:$,endpointsData:ye,selectorsData:Me,tablesData:ze,extendedData:Ie},t},ld.write=function(e,r){r===void 0&&(r={}),r=l1({},PV,r);var t=new ArrayBuffer(0);if(e.globalData){var i=new ArrayBuffer(20+5*e.globalData.imageDescs.length*4),a=new DataView(i);a.setUint16(0,e.globalData.endpointCount,!0),a.setUint16(2,e.globalData.selectorCount,!0),a.setUint32(4,e.globalData.endpointsData.byteLength,!0),a.setUint32(8,e.globalData.selectorsData.byteLength,!0),a.setUint32(12,e.globalData.tablesData.byteLength,!0),a.setUint32(16,e.globalData.extendedData.byteLength,!0);for(var n=0;n<e.globalData.imageDescs.length;n++){var o=e.globalData.imageDescs[n];a.setUint32(20+5*n*4+0,o.imageFlags,!0),a.setUint32(20+5*n*4+4,o.rgbSliceByteOffset,!0),a.setUint32(20+5*n*4+8,o.rgbSliceByteLength,!0),a.setUint32(20+5*n*4+12,o.alphaSliceByteOffset,!0),a.setUint32(20+5*n*4+16,o.alphaSliceByteLength,!0)}t=cd([i,e.globalData.endpointsData,e.globalData.selectorsData,e.globalData.tablesData,e.globalData.extendedData])}var s=[],u=e.keyValue;for(var l in r.keepWriter||(u=l1({},e.keyValue,{KTXwriter:"KTX-Parse v0.0.4"})),u){var f=u[l],h=nA(l),d=typeof f=="string"?nA(f):f,m=h.byteLength+1+d.byteLength+1,y=m%4?4-m%4:0;s.push(cd([new Uint32Array([m]),h,rA,d,rA,new Uint8Array(y).fill(0)]))}var k=cd(s),x=new ArrayBuffer(44),A=new DataView(x);if(e.dataFormatDescriptor.length!==1||e.dataFormatDescriptor[0].descriptorType!==fd.BASICFORMAT)throw new Error("Only BASICFORMAT Data Format Descriptor output supported.");var P=e.dataFormatDescriptor[0];A.setUint32(0,44,!0),A.setUint16(4,P.vendorId,!0),A.setUint16(6,P.descriptorType,!0),A.setUint16(8,P.versionNumber,!0),A.setUint16(10,P.descriptorBlockSize,!0),A.setUint8(12,P.colorModel),A.setUint8(13,P.colorPrimaries),A.setUint8(14,P.transferFunction),A.setUint8(15,P.flags),A.setUint8(16,P.texelBlockDimension.x-1),A.setUint8(17,P.texelBlockDimension.y-1),A.setUint8(18,P.texelBlockDimension.z-1),A.setUint8(19,P.texelBlockDimension.w-1);for(var T=0;T<8;T++)A.setUint8(20+T,P.bytesPlane[T]);for(var B=0;B<P.samples.length;B++){var C=P.samples[B],I=28+16*B;A.setUint16(I+0,C.bitOffset,!0),A.setUint8(I+2,C.bitLength),A.setUint8(I+3,C.channelID),A.setUint8(I+4,C.samplePosition[0]),A.setUint8(I+5,C.samplePosition[1]),A.setUint8(I+6,C.samplePosition[2]),A.setUint8(I+7,C.samplePosition[3]),A.setUint32(I+8,C.sampleLower,!0),A.setUint32(I+12,C.sampleUpper,!0)}var F=ga.length+68+3*e.levels.length*8,H=F+x.byteLength,N=H+k.byteLength;N%8&&(N+=8-N%8);for(var K=[],V=new DataView(new ArrayBuffer(3*e.levels.length*8)),X=N+t.byteLength,U=0;U<e.levels.length;U++){var $=e.levels[U];K.push($.levelData),V.setBigUint64(24*U+0,BigInt(X),!0),V.setBigUint64(24*U+8,BigInt($.levelData.byteLength),!0),V.setBigUint64(24*U+16,BigInt($.uncompressedByteLength),!0),X+=$.levelData.byteLength}var J=new ArrayBuffer(68),le=new DataView(J);return le.setUint32(0,e.vkFormat,!0),le.setUint32(4,e.typeSize,!0),le.setUint32(8,e.pixelWidth,!0),le.setUint32(12,e.pixelHeight,!0),le.setUint32(16,e.pixelDepth,!0),le.setUint32(20,e.layerCount,!0),le.setUint32(24,e.faceCount,!0),le.setUint32(28,e.levels.length,!0),le.setUint32(32,e.supercompressionScheme,!0),le.setUint32(36,F,!0),le.setUint32(40,x.byteLength,!0),le.setUint32(44,H,!0),le.setUint32(48,k.byteLength,!0),le.setBigUint64(52,BigInt(N),!0),le.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(cd([new Uint8Array(ga).buffer,J,V.buffer,x,k,new ArrayBuffer(N-(H+k.byteLength)),t].concat(K)))}});var V1=typeof process!="object"||String(process)!=="[object process]"||process.browser;var $1={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]};globalThis["encoding-indexes"]=$1||{};function Er(e,r,t){return r<=e&&e<=t}function RT(e,r){return e.indexOf(r)!==-1}var wn=Math.floor;function El(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function CT(e){for(var r=String(e),t=r.length,i=0,a=[];i<t;){var n=r.charCodeAt(i);if(n<55296||n>57343)a.push(n);else if(56320<=n&&n<=57343)a.push(65533);else if(55296<=n&&n<=56319)if(i===t-1)a.push(65533);else{var o=r.charCodeAt(i+1);if(56320<=o&&o<=57343){var s=n&1023,u=o&1023;a.push(65536+(s<<10)+u),i+=1}else a.push(65533)}i+=1}return a}function OT(e){for(var r="",t=0;t<e.length;++t){var i=e[t];i<=65535?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode((i>>10)+55296,(i&1023)+56320))}return r}function ri(e){return 0<=e&&e<=127}var ei=ri,Nr=-1;function Dd(e){this.tokens=[].slice.call(e),this.tokens.reverse()}Dd.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():Nr},prepend:function(e){if(Array.isArray(e))for(var r=e;r.length;)this.tokens.push(r.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var r=e;r.length;)this.tokens.unshift(r.shift());else this.tokens.unshift(e)}};var it=-1;function zr(e,r){if(e)throw TypeError("Decoder error");return r||65533}function _i(e){throw TypeError("The code point "+e+" could not be encoded.")}function IT(){}IT.prototype={handler:function(e,r){}};function BT(){}BT.prototype={handler:function(e,r){}};function Bd(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(Fd,e)?Fd[e]:null}var K1=[{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"}],Fd={};K1.forEach(function(e){e.encodings.forEach(function(r){r.labels.forEach(function(t){Fd[t]=r})})});var Da={},La={};function bs(e,r){return r&&r[e]||null}function ys(e,r){var t=r.indexOf(e);return t===-1?null:t}function Pa(e){if(!("encoding-indexes"in globalThis))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return globalThis["encoding-indexes"][e]}function FT(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var r=0,t=0,i=Pa("gb18030-ranges"),a;for(a=0;a<i.length;++a){var n=i[a];if(n[0]<=e)r=n[0],t=n[1];else break}return t+e-r}function DT(e){if(e===59335)return 7457;var r=0,t=0,i=Pa("gb18030-ranges"),a;for(a=0;a<i.length;++a){var n=i[a];if(n[1]<=e)r=n[1],t=n[0];else break}return t+e-r}function LT(e){Od=Od||Pa("jis0208").map(function(t,i){return Er(i,8272,8835)?null:t});var r=Od;return r.indexOf(e)}var Od;function qT(e){Id=Id||Pa("big5").map(function(t,i){return i<(161-129)*157?null:t});var r=Id;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?r.lastIndexOf(e):ys(e,r)}var Id,Y1="utf-8";function Bo(e,r){if(!(this instanceof Bo))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):Y1,r=El(r),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var t=Bd(e);if(t===null||t.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!La[t.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");var i=this;return i._encoding=t,Boolean(r.fatal)&&(i._error_mode="fatal"),Boolean(r.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(Bo.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(Bo.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(Bo.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));Bo.prototype.decode=function(r,t){var i;typeof r=="object"&&r instanceof ArrayBuffer?i=new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?i=new Uint8Array(r.buffer,r.byteOffset,r.byteLength):i=new Uint8Array(0),t=El(t),this._do_not_flush||(this._decoder=La[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(t.stream);for(var a=new Dd(i),n=[],o;;){var s=a.read();if(s===Nr||(o=this._decoder.handler(a,s),o===it))break;o!==null&&(Array.isArray(o)?n.push.apply(n,o):n.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(a,a.read()),o===it)break;o!==null&&(Array.isArray(o)?n.push.apply(n,o):n.push(o))}while(!a.endOfStream());this._decoder=null}function u(l){return RT(["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)),OT(l)}return u.call(this,n)};function Tu(e,r){if(!(this instanceof Tu))throw TypeError("Called as a function. Did you forget 'new'?");r=El(r),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(r.fatal)?"fatal":"replacement";var t=this;if(Boolean(r.NONSTANDARD_allowLegacyEncoding)){e=e!==void 0?String(e):Y1;var i=Bd(e);if(i===null||i.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Da[i.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");t._encoding=i}else t._encoding=Bd("utf-8"),e!==void 0&&"console"in globalThis&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=t._encoding.name.toLowerCase()),t}Object.defineProperty&&Object.defineProperty(Tu.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});Tu.prototype.encode=function(r,t){r=r===void 0?"":String(r),t=El(t),this._do_not_flush||(this._encoder=Da[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(t.stream);for(var i=new Dd(CT(r)),a=[],n;;){var o=i.read();if(o===Nr||(n=this._encoder.handler(i,o),n===it))break;Array.isArray(n)?a.push.apply(a,n):a.push(n)}if(!this._do_not_flush){for(;n=this._encoder.handler(i,i.read()),n!==it;)Array.isArray(n)?a.push.apply(a,n):a.push(n);this._encoder=null}return new Uint8Array(a)};function MT(e){var r=e.fatal,t=0,i=0,a=0,n=128,o=191;this.handler=function(s,u){if(u===Nr&&a!==0)return a=0,zr(r);if(u===Nr)return it;if(a===0){if(Er(u,0,127))return u;if(Er(u,194,223))a=1,t=u&31;else if(Er(u,224,239))u===224&&(n=160),u===237&&(o=159),a=2,t=u&15;else if(Er(u,240,244))u===240&&(n=144),u===244&&(o=143),a=3,t=u&7;else return zr(r);return null}if(!Er(u,n,o))return t=a=i=0,n=128,o=191,s.prepend(u),zr(r);if(n=128,o=191,t=t<<6|u&63,i+=1,i!==a)return null;var l=t;return t=a=i=0,l}}function zT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(i))return i;var a,n;Er(i,128,2047)?(a=1,n=192):Er(i,2048,65535)?(a=2,n=224):Er(i,65536,1114111)&&(a=3,n=240);for(var o=[(i>>6*a)+n];a>0;){var s=i>>6*(a-1);o.push(128|s&63),a-=1}return o}}Da["UTF-8"]=function(e){return new zT(e)};La["UTF-8"]=function(e){return new MT(e)};function NT(e,r){var t=r.fatal;this.handler=function(i,a){if(a===Nr)return it;if(ri(a))return a;var n=e[a-128];return n===null?zr(t):n}}function UT(e,r){var t=r.fatal;this.handler=function(i,a){if(a===Nr)return it;if(ei(a))return a;var n=ys(a,e);return n===null&&_i(a),n+128}}(function(){"encoding-indexes"in globalThis&&K1.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(r){var t=r.name,i=Pa(t.toLowerCase());La[t]=function(a){return new NT(i,a)},Da[t]=function(a){return new UT(i,a)}})})})();La.GBK=function(e){return new X1(e)};Da.GBK=function(e){return new Q1(e,!0)};function X1(e){var r=e.fatal,t=0,i=0,a=0;this.handler=function(n,o){if(o===Nr&&t===0&&i===0&&a===0)return it;o===Nr&&(t!==0||i!==0||a!==0)&&(t=0,i=0,a=0,zr(r));var s;if(a!==0){s=null,Er(o,48,57)&&(s=FT((((t-129)*10+i-48)*126+a-129)*10+o-48));var u=[i,a,o];return t=0,i=0,a=0,s===null?(n.prepend(u),zr(r)):s}if(i!==0)return Er(o,129,254)?(a=o,null):(n.prepend([i,o]),t=0,i=0,zr(r));if(t!==0){if(Er(o,48,57))return i=o,null;var l=t,f=null;t=0;var h=o<127?64:65;return(Er(o,64,126)||Er(o,128,254))&&(f=(l-129)*190+(o-h)),s=f===null?null:bs(f,Pa("gb18030")),s===null&&ri(o)&&n.prepend(o),s===null?zr(r):s}return ri(o)?o:o===128?8364:Er(o,129,254)?(t=o,null):zr(r)}}function Q1(e,r){var t=e.fatal;this.handler=function(i,a){if(a===Nr)return it;if(ei(a))return a;if(a===58853)return _i(a);if(r&&a===8364)return 128;var n=ys(a,Pa("gb18030"));if(n!==null){var o=wn(n/190)+129,s=n%190,u=s<63?64:65;return[o,s+u]}if(r)return _i(a);n=DT(a);var l=wn(n/10/126/10);n=n-l*10*126*10;var f=wn(n/10/126);n=n-f*10*126;var h=wn(n/10),d=n-h*10;return[l+129,f+48,h+129,d+48]}}Da.gb18030=function(e){return new Q1(e)};La.gb18030=function(e){return new X1(e)};function HT(e){var r=e.fatal,t=0;this.handler=function(i,a){if(a===Nr&&t!==0)return t=0,zr(r);if(a===Nr&&t===0)return it;if(t!==0){var n=t,o=null;t=0;var s=a<127?64:98;switch((Er(a,64,126)||Er(a,161,254))&&(o=(n-129)*157+(a-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:bs(o,Pa("big5"));return u===null&&ri(a)&&i.prepend(a),u===null?zr(r):u}return ri(a)?a:Er(a,129,254)?(t=a,null):zr(r)}}function GT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(i))return i;var a=qT(i);if(a===null)return _i(i);var n=wn(a/157)+129;if(n<161)return _i(i);var o=a%157,s=o<63?64:98;return[n,o+s]}}Da.Big5=function(e){return new GT(e)};La.Big5=function(e){return new HT(e)};function WT(e){var r=e.fatal,t=!1,i=0;this.handler=function(a,n){if(n===Nr&&i!==0)return i=0,zr(r);if(n===Nr&&i===0)return it;if(i===142&&Er(n,161,223))return i=0,65377-161+n;if(i===143&&Er(n,161,254))return t=!0,i=n,null;if(i!==0){var o=i;i=0;var s=null;return Er(o,161,254)&&Er(n,161,254)&&(s=bs((o-161)*94+(n-161),Pa(t?"jis0212":"jis0208"))),t=!1,Er(n,161,254)||a.prepend(n),s===null?zr(r):s}return ri(n)?n:n===142||n===143||Er(n,161,254)?(i=n,null):zr(r)}}function VT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(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 a=ys(i,Pa("jis0208"));if(a===null)return _i(i);var n=wn(a/94)+161,o=a%94+161;return[n,o]}}Da["EUC-JP"]=function(e){return new VT(e)};La["EUC-JP"]=function(e){return new WT(e)};function $T(e){var r=e.fatal,t={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},i=t.ASCII,a=t.ASCII,n=0,o=!1;this.handler=function(s,u){switch(i){default:case t.ASCII:return u===27?(i=t.EscapeStart,null):Er(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===Nr?it:(o=!1,zr(r));case t.Roman:return u===27?(i=t.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===Nr?it:(o=!1,zr(r));case t.Katakana:return u===27?(i=t.EscapeStart,null):Er(u,33,95)?(o=!1,65377-33+u):u===Nr?it:(o=!1,zr(r));case t.LeadByte:return u===27?(i=t.EscapeStart,null):Er(u,33,126)?(o=!1,n=u,i=t.TrailByte,null):u===Nr?it:(o=!1,zr(r));case t.TrailByte:if(u===27)return i=t.EscapeStart,zr(r);if(Er(u,33,126)){i=t.LeadByte;var l=(n-33)*94+u-33,f=bs(l,Pa("jis0208"));return f===null?zr(r):f}return u===Nr?(i=t.LeadByte,s.prepend(u),zr(r)):(i=t.LeadByte,zr(r));case t.EscapeStart:return u===36||u===40?(n=u,i=t.Escape,null):(s.prepend(u),o=!1,i=a,zr(r));case t.Escape:var h=n;n=0;var d=null;if(h===40&&u===66&&(d=t.ASCII),h===40&&u===74&&(d=t.Roman),h===40&&u===73&&(d=t.Katakana),h===36&&(u===64||u===66)&&(d=t.LeadByte),d!==null){i=i=d;var m=o;return o=!0,m?zr(r):null}return s.prepend([h,u]),o=!1,i=a,zr(r)}}}function KT(e){var r=e.fatal,t={ASCII:0,Roman:1,jis0208:2},i=t.ASCII;this.handler=function(a,n){if(n===Nr&&i!==t.ASCII)return a.prepend(n),i=t.ASCII,[27,40,66];if(n===Nr&&i===t.ASCII)return it;if((i===t.ASCII||i===t.Roman)&&(n===14||n===15||n===27))return _i(65533);if(i===t.ASCII&&ei(n))return n;if(i===t.Roman&&(ei(n)&&n!==92&&n!==126||n==165||n==8254)){if(ei(n))return n;if(n===165)return 92;if(n===8254)return 126}if(ei(n)&&i!==t.ASCII)return a.prepend(n),i=t.ASCII,[27,40,66];if((n===165||n===8254)&&i!==t.Roman)return a.prepend(n),i=t.Roman,[27,40,74];n===8722&&(n=65293);var o=ys(n,Pa("jis0208"));if(o===null)return _i(n);if(i!==t.jis0208)return a.prepend(n),i=t.jis0208,[27,36,66];var s=wn(o/94)+33,u=o%94+33;return[s,u]}}Da["ISO-2022-JP"]=function(e){return new KT(e)};La["ISO-2022-JP"]=function(e){return new $T(e)};function YT(e){var r=e.fatal,t=0;this.handler=function(i,a){if(a===Nr&&t!==0)return t=0,zr(r);if(a===Nr&&t===0)return it;if(t!==0){var n=t,o=null;t=0;var s=a<127?64:65,u=n<160?129:193;if((Er(a,64,126)||Er(a,128,252))&&(o=(n-u)*188+a-s),Er(o,8836,10715))return 57344-8836+o;var l=o===null?null:bs(o,Pa("jis0208"));return l===null&&ri(a)&&i.prepend(a),l===null?zr(r):l}return ri(a)||a===128?a:Er(a,161,223)?65377-161+a:Er(a,129,159)||Er(a,224,252)?(t=a,null):zr(r)}}function XT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(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 a=LT(i);if(a===null)return _i(i);var n=wn(a/188),o=n<31?129:193,s=a%188,u=s<63?64:65;return[n+o,s+u]}}Da.Shift_JIS=function(e){return new XT(e)};La.Shift_JIS=function(e){return new YT(e)};function QT(e){var r=e.fatal,t=0;this.handler=function(i,a){if(a===Nr&&t!==0)return t=0,zr(r);if(a===Nr&&t===0)return it;if(t!==0){var n=t,o=null;t=0,Er(a,65,254)&&(o=(n-129)*190+(a-65));var s=o===null?null:bs(o,Pa("euc-kr"));return o===null&&ri(a)&&i.prepend(a),s===null?zr(r):s}return ri(a)?a:Er(a,129,254)?(t=a,null):zr(r)}}function JT(e){var r=e.fatal;this.handler=function(t,i){if(i===Nr)return it;if(ei(i))return i;var a=ys(i,Pa("euc-kr"));if(a===null)return _i(i);var n=wn(a/190)+129,o=a%190+65;return[n,o]}}Da["EUC-KR"]=function(e){return new JT(e)};La["EUC-KR"]=function(e){return new QT(e)};function Sl(e,r){var t=e>>8,i=e&255;return r?[t,i]:[i,t]}function J1(e,r){var t=r.fatal,i=null,a=null;this.handler=function(n,o){if(o===Nr&&(i!==null||a!==null))return zr(t);if(o===Nr&&i===null&&a===null)return it;if(i===null)return i=o,null;var s;if(e?s=(i<<8)+o:s=(o<<8)+i,i=null,a!==null){var u=a;return a=null,Er(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(n.prepend(Sl(s,e)),zr(t))}return Er(s,55296,56319)?(a=s,null):Er(s,56320,57343)?zr(t):s}}function Z1(e,r){var t=r.fatal;this.handler=function(i,a){if(a===Nr)return it;if(Er(a,0,65535))return Sl(a,e);var n=Sl((a-65536>>10)+55296,e),o=Sl((a-65536&1023)+56320,e);return n.concat(o)}}Da["UTF-16BE"]=function(e){return new Z1(!0,e)};La["UTF-16BE"]=function(e){return new J1(!0,e)};Da["UTF-16LE"]=function(e){return new Z1(!1,e)};La["UTF-16LE"]=function(e){return new J1(!1,e)};function ZT(e){var r=e.fatal;this.handler=function(t,i){return i===Nr?it:ri(i)?i:63360+i-128}}function eP(e){var r=e.fatal;this.handler=function(t,i){return i===Nr?it:ei(i)?i:Er(i,63360,63487)?i-63360+128:_i(i)}}Da["x-user-defined"]=function(e){return new eP(e)};La["x-user-defined"]=function(e){return new ZT(e)};function Pu(e){return Buffer.from(e).toString("base64")}function Ld(e){return Buffer.from(e,"base64").toString("ascii")}var Yx=Jt($x(),1),Xx=Jt(Lu(),1);function Kx(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function hC(e,r){let t=r.type?r.type.replace("image/",""):"jpeg",i=(0,Xx.default)(e.data,[e.width,e.height,4],[4,e.width*4,1],0);return(0,Yx.default)(i,t,r)}function Qx(e,r){let t=hC(e,r);return new Promise(i=>{let a=[];t.on("data",n=>a.push(n)),t.on("end",()=>{let n=Buffer.concat(a);i(Kx(n))})})}var R5=Jt(P5(),1),qg=["image/png","image/jpeg","image/gif"];async function Mg(e,r){if(!r)throw new Error("MIMEType is required to parse image under Node.js");let t=e instanceof Buffer?e:Buffer.from(e);return await jU(t,r)}function jU(e,r){return new Promise(t=>(0,R5.default)(e,r,(i,a)=>{if(i)throw i;let n=[...a.shape],o=a.shape.length===4?a.shape.shift():1,s=a.data instanceof Buffer?new Uint8Array(a.data):a.data;t({shape:n,data:s,width:a.shape[0],height:a.shape[1],components:a.shape[2],layers:o?[o]:[]})}))}async function zg(e,r,t,i){return i._parse(e,r,t,i)}function Mi(e,r){if(!e)throw new Error(r||"loader assertion failed.")}var dn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},AU=dn.self||dn.window||dn.global||{},TU=dn.window||dn.self||dn.global||{},PU=dn.global||dn.self||dn.window||{},RU=dn.document||{};var Zo=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var C5=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),CU=C5&&parseFloat(C5[1])||0;function ko(e){return ko=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ko(e)}function Ng(e,r){if(ko(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var i=t.call(e,r||"default");if(ko(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Ug(e){var r=Ng(e,"string");return ko(r)==="symbol"?r:String(r)}function ht(e,r,t){return r=Ug(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Hg(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let r=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,t=e||r;return!!(t&&t.indexOf("Electron")>=0)}function zi(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Hg()}var OU=globalThis.self||globalThis.window||globalThis.global,lu=globalThis.window||globalThis.self||globalThis.global,IU=globalThis.document||{},es=globalThis.process||{},BU=globalThis.console,RZ=globalThis.navigator||{};var wp="4.2.2",IZ=zi();function FU(e){try{let r=window[e],t="__storage_test__";return r.setItem(t,t),r.removeItem(t),r}catch{return null}}var _p=class{constructor(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";ht(this,"storage",void 0),ht(this,"id",void 0),ht(this,"config",void 0),this.storage=FU(i),this.id=r,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(r){if(Object.assign(this.config,r),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let r={};if(this.storage){let t=this.storage.getItem(this.id);r=t?JSON.parse(t):{}}return Object.assign(this.config,r),this}};function O5(e){let r;return e<10?r="".concat(e.toFixed(2),"ms"):e<100?r="".concat(e.toFixed(1),"ms"):e<1e3?r="".concat(e.toFixed(0),"ms"):r="".concat((e/1e3).toFixed(2),"s"),r}function I5(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,t=Math.max(r-e.length,0);return"".concat(" ".repeat(t)).concat(e)}function kp(e,r,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,a=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(t=Math.min(t,i/e.width));let n=e.width*t,o=e.height*t,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(a,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(r," %c+"),s]}var Sp;(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"})(Sp||(Sp={}));var DU=10;function B5(e){return typeof e!="string"?e:(e=e.toUpperCase(),Sp[e]||Sp.WHITE)}function F5(e,r,t){if(!zi&&typeof e=="string"){if(r){let i=B5(r);e="\x1B[".concat(i,"m").concat(e,"\x1B[39m")}if(t){let i=B5(t);e="\x1B[".concat(i+DU,"m").concat(e,"\x1B[49m")}}return e}function D5(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],t=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(t),a=e;for(let n of i){let o=a[n];typeof o=="function"&&(r.find(s=>n===s)||(a[n]=o.bind(e)))}}function fu(e,r){if(!e)throw new Error(r||"Assertion failed")}function rs(){let e;if(zi()&&lu.performance){var r,t;e=lu===null||lu===void 0||(r=lu.performance)===null||r===void 0||(t=r.now)===null||t===void 0?void 0:t.call(r)}else if("hrtime"in es){var i;let a=es===null||es===void 0||(i=es.hrtime)===null||i===void 0?void 0:i.call(es);e=a[0]*1e3+a[1]/1e6}else e=Date.now();return e}var pu={debug:zi()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},LU={enabled:!0,level:0};function pi(){}var L5={},q5={once:!0},hn=class{constructor(){let{id:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};ht(this,"id",void 0),ht(this,"VERSION",wp),ht(this,"_startTs",rs()),ht(this,"_deltaTs",rs()),ht(this,"_storage",void 0),ht(this,"userData",{}),ht(this,"LOG_THROTTLE_TIMEOUT",0),this.id=r,this.userData={},this._storage=new _p("__probe-".concat(this.id,"__"),LU),this.timeStamp("".concat(this.id," started")),D5(this),Object.seal(this)}set level(r){this.setLevel(r)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((rs()-this._startTs).toPrecision(10))}getDelta(){return Number((rs()-this._deltaTs).toPrecision(10))}set priority(r){this.level=r}get priority(){return this.level}getPriority(){return this.level}enable(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:r}),this}setLevel(r){return this._storage.setConfiguration({level:r}),this}get(r){return this._storage.config[r]}set(r,t){this._storage.setConfiguration({[r]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(r,t){fu(r,t)}warn(r){return this._getLogFunction(0,r,pu.warn,arguments,q5)}error(r){return this._getLogFunction(0,r,pu.error,arguments)}deprecated(r,t){return this.warn("`".concat(r,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(r,t){return this.error("`".concat(r,"` has been removed. Use `").concat(t,"` instead"))}probe(r,t){return this._getLogFunction(r,t,pu.log,arguments,{time:!0,once:!0})}log(r,t){return this._getLogFunction(r,t,pu.debug,arguments)}info(r,t){return this._getLogFunction(r,t,console.info,arguments)}once(r,t){return this._getLogFunction(r,t,pu.debug||pu.info,arguments,q5)}table(r,t,i){return t?this._getLogFunction(r,t,console.table||pi,i&&[i],{tag:NU(t)}):pi}image(r){let{logLevel:t,priority:i,image:a,message:n="",scale:o=1}=r;return this._shouldLog(t||i)?zi()?zU({image:a,message:n,scale:o}):MU({image:a,message:n,scale:o}):pi}time(r,t){return this._getLogFunction(r,t,console.time?console.time:console.info)}timeEnd(r,t){return this._getLogFunction(r,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(r,t){return this._getLogFunction(r,t,console.timeStamp||pi)}group(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},a=M5({logLevel:r,message:t,opts:i}),{collapsed:n}=i;return a.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(a)}groupCollapsed(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(r,t,Object.assign({},i,{collapsed:!0}))}groupEnd(r){return this._getLogFunction(r,"",console.groupEnd||pi)}withGroup(r,t,i){this.group(r,t)();try{i()}finally{this.groupEnd(r)()}}trace(){console.trace&&console.trace()}_shouldLog(r){return this.isEnabled()&&this.getLevel()>=z5(r)}_getLogFunction(r,t,i,a,n){if(this._shouldLog(r)){n=M5({logLevel:r,message:t,args:a,opts:n}),i=i||n.method,fu(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=rs();let o=n.tag||n.message;if(n.once&&o)if(!L5[o])L5[o]=rs();else return pi;return t=qU(this.id,n.message,n),i.bind(console,t,...n.args)}return pi}};ht(hn,"VERSION",wp);function z5(e){if(!e)return 0;let r;switch(typeof e){case"number":r=e;break;case"object":r=e.logLevel||e.priority||0;break;default:return 0}return fu(Number.isFinite(r)&&r>=0),r}function M5(e){let{logLevel:r,message:t}=e;e.logLevel=z5(r);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==t;);switch(typeof r){case"string":case"function":t!==void 0&&i.unshift(t),e.message=r;break;case"object":Object.assign(e,r);break;default:}typeof e.message=="function"&&(e.message=e.message());let a=typeof e.message;return fu(a==="string"||a==="object"),Object.assign(e,{args:i},e.opts)}function qU(e,r,t){if(typeof r=="string"){let i=t.time?I5(O5(t.total)):"";r=t.time?"".concat(e,": ").concat(i," ").concat(r):"".concat(e,": ").concat(r),r=F5(r,t.color,t.background)}return r}function MU(e){let{image:r,message:t="",scale:i=1}=e;return console.warn("removed"),pi}function zU(e){let{image:r,message:t="",scale:i=1}=e;if(typeof r=="string"){let n=new Image;return n.onload=()=>{let o=kp(n,t,i);console.log(...o)},n.src=r,pi}let a=r.nodeName||"";if(a.toLowerCase()==="img")return console.log(...kp(r,t,i)),pi;if(a.toLowerCase()==="canvas"){let n=new Image;return n.onload=()=>console.log(...kp(n,t,i)),n.src=r.toDataURL(),pi}return pi}function NU(e){for(let r in e)for(let t in e[r])return t||"untitled";return"empty"}var oee=new hn({id:"@probe.gl/log"});function Gg(e,r){return N5(e||{},r)}function N5(e,r,t=0){if(t>3)return r;let i={...e};for(let[a,n]of Object.entries(r))n&&typeof n=="object"&&!Array.isArray(n)?i[a]=N5(i[a]||{},r[a],t+1):i[a]=r[a];return i}function Wg(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function Vg(e){var t,i;return((i=(t=globalThis.loaders)==null?void 0:t.modules)==null?void 0:i[e])||null}var U5="latest";function UU(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.2"),globalThis._loadersgl_.version}var Ic=UU();function ma(e,r){if(!e)throw new Error(r||"loaders.gl assertion failed.")}var mn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},dee=mn.self||mn.window||mn.global||{},hee=mn.window||mn.self||mn.global||{},mee=mn.global||mn.self||mn.window||{},gee=mn.document||{};var oa=typeof process!="object"||String(process)!=="[object process]"||process.browser,Bc=typeof importScripts=="function",G5=typeof window<"u"&&typeof window.orientation<"u",H5=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),vee=H5&&parseFloat(H5[1])||0;var Fc=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(r,t){this.name=r,this.workerThread=t,this.result=new Promise((i,a)=>{this._resolve=i,this._reject=a})}postMessage(r,t){this.workerThread.postMessage({source:"loaders.gl",type:r,payload:t})}done(r){ma(this.isRunning),this.isRunning=!1,this._resolve(r)}error(r){ma(this.isRunning),this.isRunning=!1,this._reject(r)}};var So={};kl(So,{NodeWorker:()=>Lc,parentPort:()=>$g});var Dc=Jt(require("worker_threads"),1);Au(So,require("worker_threads"));var $g=Dc==null?void 0:Dc.parentPort,Lc=Dc.Worker;var Kg=new Map;function W5(e){ma(e.source&&!e.url||!e.source&&e.url);let r=Kg.get(e.source||e.url);return r||(e.url&&(r=HU(e.url),Kg.set(e.url,r)),e.source&&(r=V5(e.source),Kg.set(e.source,r))),ma(r),r}function HU(e){if(!e.startsWith("http"))return e;let r=GU(e);return V5(r)}function V5(e){let r=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(r)}function GU(e){return`try {
96
96
  importScripts('${e}');
97
97
  } catch (error) {
98
98
  console.error(error);
99
99
  throw error;
100
- }`}function qc(e,r=!0,t){let i=t||new Set;if(e){if($5(e))i.add(e);else if($5(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(r&&typeof e=="object")for(let a in e)qc(e[a],r,i)}}return t===void 0?Array.from(i):[]}function $5(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var Yg=()=>{},Eo=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&oa||typeof Lc<"u"&&!oa}constructor(r){let{name:t,source:i,url:a}=r;ma(i||a),this.name=t,this.source=i,this.url=a,this.onMessage=Yg,this.onError=n=>console.log(n),this.worker=oa?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Yg,this.onError=Yg,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(r,t){t=t||qc(r),this.worker.postMessage(r,t)}_getErrorFromErrorEvent(r){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,r.message&&(t+=`${r.message} in `),r.lineno&&(t+=`:${r.lineno}:${r.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=W5({source:this.source,url:this.url});let r=new Worker(this._loadableURL,{name:this.name});return r.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},r.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},r.onmessageerror=t=>console.error(t),r}_createNodeWorker(){let r;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;r=new Lc(i,{eval:!1})}else if(this.source)r=new Lc(this.source,{eval:!0});else throw new Error("no worker");return r.on("message",t=>{this.onMessage(t)}),r.on("error",t=>{this.onError(t)}),r.on("exit",t=>{}),r}};var Mc=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Eo.isSupported()}constructor(r){this.source=r.source,this.url=r.url,this.setProps(r)}destroy(){this.idleQueue.forEach(r=>r.destroy()),this.isDestroyed=!0}setProps(r){this.props={...this.props,...r},r.name!==void 0&&(this.name=r.name),r.maxConcurrency!==void 0&&(this.maxConcurrency=r.maxConcurrency),r.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=r.maxMobileConcurrency),r.reuseWorkers!==void 0&&(this.reuseWorkers=r.reuseWorkers),r.onDebug!==void 0&&(this.onDebug=r.onDebug)}async startJob(r,t=(a,n,o)=>a.done(o),i=(a,n)=>a.error(n)){let a=new Promise(n=>(this.jobQueue.push({name:r,onMessage:t,onError:i,onStart:n}),this));return this._startQueuedJob(),await a}async _startQueuedJob(){if(!this.jobQueue.length)return;let r=this._getAvailableWorker();if(!r)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:r,backlog:this.jobQueue.length});let i=new Fc(t.name,r);r.onMessage=a=>t.onMessage(i,a.type,a.payload),r.onError=a=>t.onError(i,a),t.onStart(i);try{await i.result}catch(a){console.error(`Worker exception: ${a}`)}finally{this.returnWorkerToQueue(r)}}}returnWorkerToQueue(r){!oa||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(r.destroy(),this.count--):this.idleQueue.push(r),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let r=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Eo({name:r,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return G5?this.maxMobileConcurrency:this.maxConcurrency}};var WU={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},ts=class{props;workerPools=new Map;static isSupported(){return Eo.isSupported()}static getWorkerFarm(r={}){return ts._workerFarm=ts._workerFarm||new ts({}),ts._workerFarm.setProps(r),ts._workerFarm}constructor(r){this.props={...WU},this.setProps(r),this.workerPools=new Map}destroy(){for(let r of this.workerPools.values())r.destroy();this.workerPools=new Map}setProps(r){this.props={...this.props,...r};for(let t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(r){let{name:t,source:i,url:a}=r,n=this.workerPools.get(t);return n||(n=new Mc({name:t,source:i,url:a}),n.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,n)),n}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},jo=ts;W1(jo,"_workerFarm");async function as(){return $g}var Xg=new Map,Qa=class{static async inWorkerThread(){return typeof self<"u"||Boolean(await as())}static set onmessage(r){async function t(i){let a=await as(),{type:n,payload:o}=a?i:i.data;r(n,o)}as().then(i=>{i?(i.on("message",a=>{t(a)}),i.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=t})}static async addEventListener(r){let t=Xg.get(r);t||(t=async a=>{if(!VU(a))return;let n=await as(),{type:o,payload:s}=n?a:a.data;r(o,s)}),await as()?console.error("not implemented"):globalThis.addEventListener("message",t)}static async removeEventListener(r){let t=Xg.get(r);Xg.delete(r),await as()?console.error("not implemented"):globalThis.removeEventListener("message",t)}static async postMessage(r,t){let i={source:"loaders.gl",type:r,payload:t},a=qc(t),n=await as();n?n.postMessage(i,a):globalThis.postMessage(i,a)}};function VU(e){let{type:r,data:t}=e;return r==="message"&&t&&typeof t.source=="string"&&t.source.startsWith("loaders.gl")}function Qg(e,r={}){let t=r[e.id]||{},i=oa?`${e.id}-worker.js`:`${e.id}-worker-node.js`,a=t.workerUrl;if(!a&&e.id==="compression"&&(a=r.workerUrl),r._workerType==="test"&&(oa?a=`modules/${e.module}/dist/${i}`:a=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!a){let n=e.version;n==="latest"&&(n=U5);let o=n?`@${n}`:"";a=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${i}`}return ma(a),a}function Jg(e,r=Ic){ma(e,"no worker provided");let t=e.version;return!(!r||!t)}var Zg={};async function gn(e,r=null,t={},i=null){return r&&(e=K5(e,r,t,i)),Zg[e]=Zg[e]||$U(e),await Zg[e]}function K5(e,r,t={},i=null){if(!t.useLocalLibraries&&e.startsWith("http"))return e;i=i||e;let a=t.modules||{};return a[i]?a[i]:oa?t.CDN?(ma(t.CDN.startsWith("http")),`${t.CDN}/${r}@${Ic}/dist/libs/${i}`):Bc?`../src/libs/${i}`:`modules/${r}/src/libs/${i}`:`modules/${r}/dist/libs/${i}`}async function $U(e){if(e.endsWith("wasm"))return await YU(e);if(!oa)try{let{requireFromFile:t}=globalThis.loaders||{};return await(t==null?void 0:t(e))}catch(t){return console.error(t),null}if(Bc)return importScripts(e);let r=await XU(e);return KU(r,e)}function KU(e,r){if(!oa){let{requireFromString:i}=globalThis.loaders||{};return i==null?void 0:i(e,r)}if(Bc)return eval.call(globalThis,e),null;let t=document.createElement("script");t.id=r;try{t.appendChild(document.createTextNode(e))}catch{t.text=e}return document.body.appendChild(t),null}async function YU(e){let{readFileAsArrayBuffer:r}=globalThis.loaders||{};return oa||!r||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await r(e)}async function XU(e){let{readFileAsText:r}=globalThis.loaders||{};return oa||!r||e.startsWith("http")?await(await fetch(e)).text():await r(e)}var QU=0;async function ev(e){await Qa.inWorkerThread()&&(Qa.onmessage=async(r,t)=>{switch(r){case"process":try{let{input:i,options:a={},context:n={}}=t,o=await ZU({loader:e,arrayBuffer:i,options:a,context:{...n,_parse:JU}});Qa.postMessage("done",{result:o})}catch(i){let a=i instanceof Error?i.message:"";Qa.postMessage("error",{error:a})}break;default:}})}function JU(e,r,t,i){return new Promise((a,n)=>{let o=QU++,s=(l,f)=>{if(f.id===o)switch(l){case"done":Qa.removeEventListener(s),a(f.result);break;case"error":Qa.removeEventListener(s),n(f.error);break;default:}};Qa.addEventListener(s);let u={id:o,input:e,options:t};Qa.postMessage("process",u)})}async function ZU({loader:e,arrayBuffer:r,options:t,context:i}){let a,n;if(e.parseSync||e.parse)a=r,n=e.parseSync||e.parse;else if(e.parseTextSync)a=new TextDecoder().decode(r),n=e.parseTextSync;else throw new Error(`Could not load data with ${e.name} loader`);return t={...t,modules:e&&e.options&&e.options.modules||{},worker:!1},await n(a,{...t},i,e)}function rv(e,r){return!jo.isSupported()||!oa&&!(r!=null&&r._nodeWorkers)?!1:e.worker&&(r==null?void 0:r.worker)}async function tv(e,r,t,i,a){let n=e.id,o=Qg(e,t),u=jo.getWorkerFarm(t).getWorkerPool({name:n,url:o});t=JSON.parse(JSON.stringify(t)),i=JSON.parse(JSON.stringify(i||{}));let l=await u.startJob("process-on-worker",eH.bind(null,a));return l.postMessage("process",{input:r,options:t,context:i}),await(await l.result).result}async function eH(e,r,t,i){switch(t){case"done":r.done(i);break;case"error":r.error(new Error(i.error));break;case"process":let{id:a,input:n,options:o}=i;try{let s=await e(n,o);r.postMessage("done",{id:a,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";r.postMessage("error",{id:a,error:u})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function av(e,r,t){if(t=t||e.byteLength,e.byteLength<t||r.byteLength<t)return!1;let i=new Uint8Array(e),a=new Uint8Array(r);for(let n=0;n<i.length;++n)if(i[n]!==a[n])return!1;return!0}function iv(...e){return Y5(e)}function Y5(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}async function zc(e){let r=[];for await(let t of e)r.push(t);return iv(...r)}var rH="",X5={};function is(e){for(let r in X5)if(e.startsWith(r)){let t=X5[r];e=e.replace(r,t)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${rH}${e}`),e}function Q5(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function J5(e){return e&&typeof e=="object"&&e.isBuffer}function Ep(e){if(J5(e))return Q5(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 r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var ns={};kl(ns,{dirname:()=>iH,filename:()=>aH,join:()=>nH,resolve:()=>oH});function Z5(){var r;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(r=window.location)==null?void 0:r.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function aH(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(r+1):""}function iH(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(0,r):""}function nH(...e){let r="/";return e=e.map((t,i)=>(i&&(t=t.replace(new RegExp(`^${r}`),"")),i!==e.length-1&&(t=t.replace(new RegExp(`${r}$`),"")),t)),e.join(r)}function oH(...e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n];let t="",i=!1,a;for(let n=r.length-1;n>=-1&&!i;n--){let o;n>=0?o=r[n]:(a===void 0&&(a=Z5()),o=a),o.length!==0&&(t=`${o}/${t}`,i=o.charCodeAt(0)===Nc)}return t=sH(t,!i),i?`/${t}`:t.length>0?t:"."}var Nc=47,nv=46;function sH(e,r){let t="",i=-1,a=0,n,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(n===Nc)break;n=Nc}if(n===Nc){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==nv||t.charCodeAt(t.length-2)!==nv){if(t.length>2){let u=t.length-1,l=u;for(;l>=0&&t.charCodeAt(l)!==Nc;--l);if(l!==u){t=l===-1?"":t.slice(0,l),i=s,a=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",i=s,a=0,o=!1;continue}}r&&(t.length>0?t+="/..":t="..",o=!0)}else{let u=e.slice(i+1,s);t.length>0?t+=`/${u}`:t=u,o=!1}i=s,a=0}else n===nv&&a!==-1?++a:a=-1}return t}var qn=Jt(require("fs"),1),os=class{handle;size;bigsize;url;constructor(r,t,i){r=is(r),this.handle=qn.default.openSync(r,t,i);let a=qn.default.fstatSync(this.handle,{bigint:!0});this.size=Number(a.size),this.bigsize=a.size,this.url=r}async close(){return new Promise((r,t)=>{qn.default.close(this.handle,i=>i?t(i):r())})}async truncate(r){return new Promise((t,i)=>{qn.default.ftruncate(this.handle,r,a=>{a?i(a):(this.bigsize=BigInt(r),this.size=Number(this.bigsize),t())})})}async append(r){return new Promise((t,i)=>{qn.default.appendFile(this.handle,r,a=>{a?i(a):(this.bigsize=this.bigsize+BigInt(r.length),this.size=Number(this.bigsize),t())})})}async stat(){return await new Promise((r,t)=>qn.default.fstat(this.handle,{bigint:!0},(i,a)=>{let n={size:Number(a.size),bigsize:a.size,isDirectory:a.isDirectory()};i?t(i):r(n)}))}async read(r,t){let i=new ArrayBuffer(t),a=BigInt(r),n=0,o=new Uint8Array(i),s;for(;t>0;){let u=await uH(this.handle,o,0,t,a);if(u===0)break;n+=u,a+=BigInt(u),t-=u,s!==void 0&&(s+=u)}return n<t?i.slice(0,n):i}async write(r,t=0,i=r.byteLength){return new Promise((a,n)=>{let o=Number(t),s=new Uint8Array(r,Number(t),i);qn.default.write(this.handle,s,0,i,o,(u,l)=>u?n(u):a(l))})}};async function uH(e,r,t,i,a){return await new Promise((n,o)=>qn.default.read(e,r,t,i,a,(s,u)=>s?o(s):n(u)))}var Pp=Jt(require("fs/promises"),1);var sv=Jt(require("fs"),1),ov=require("stream");var jp=Jt(require("zlib"),1),cH=e=>e&&e instanceof ArrayBuffer,lH=e=>e&&e instanceof Buffer;function Ap(e,r){switch(r==null?void 0:r.get("content-encoding")){case"br":return e.pipe(jp.default.createBrotliDecompress());case"gzip":return e.pipe(jp.default.createGunzip());case"deflate":return e.pipe(jp.default.createDeflate());default:return e}}async function ej(e){let r=[];return await new Promise((t,i)=>{e.on("error",a=>i(a)),e.on("readable",()=>e.read()),e.on("data",a=>{typeof a=="string"&&i(new Error("Read stream not binary")),r.push(pH(a))}),e.on("end",()=>{let a=fH(r);t(a)})})}function fH(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}function pH(e){if(cH(e))return e;if(lH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var dH=e=>typeof e=="boolean",rj=e=>typeof e=="function",hH=e=>e!==null&&typeof e=="object",mH=e=>hH(e)&&rj(e.read)&&rj(e.pipe)&&dH(e.readable);async function Tp(e,r){let t=/^file:\/\//;e.replace(t,"/");let i=e.split("?")[0];i=is(i);let a=new Headers;e.endsWith(".gz")&&(a["content-encoding"]="gzip"),e.endsWith(".br")&&(a["content-encoding"]="br");try{let n=await new Promise((h,d)=>{let m=sv.default.createReadStream(i,{encoding:null});m.once("readable",()=>h(m)),m.on("error",y=>d(y))}),o=n;mH(n)?o=Ap(n,a):typeof n=="string"?o=ov.Readable.from([new TextEncoder().encode(n)]):o=ov.Readable.from([n||new ArrayBuffer(0)]);let s=200,u="OK",l=gH(i),f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}catch(n){let o=n.message,s=400,u=o,l={},f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}}function gH(e){let r={};if(!r["content-length"]){let t=sv.default.statSync(e);r["content-length"]=t.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip"),new Headers(r)}var Rp=class{readable=!0;writable=!0;constructor(){}async readdir(r=".",t){return await Pp.default.readdir(r,t)}async stat(r){let t=await Pp.default.stat(r,{bigint:!0});return{size:Number(t.size),bigsize:t.size,isDirectory:t.isDirectory()}}async unlink(r){return await Pp.default.unlink(r)}async fetch(r,t){return await Tp(r,t)}async openReadableFile(r,t="r"){return new os(r,t)}async openWritableFile(r,t="w",i){return new os(r,t,i)}};var Uc=class{constructor(r={}){this.hashBatches=this.hashBatches.bind(this)}async preload(){}async*hashBatches(r,t="base64"){var o,s;let i=[];for await(let u of r)i.push(u),yield u;let a=await this.concatenate(i),n=await this.hash(a,t);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:n})}async concatenate(r){return await zc(r)}};var Hc=Jt(require("crypto"),1),Cp=class extends Uc{name="crypto-node";options;_algorithm;_hash;constructor(r){var t,i;if(super(),this.options=r,!((i=(t=this.options)==null?void 0:t.crypto)!=null&&i.algorithm))throw new Error(this.name)}async hash(r,t){var a,n,o,s;let i=(o=(n=(a=this.options)==null?void 0:a.crypto)==null?void 0:n.algorithm)==null?void 0:o.toLowerCase();try{if(!Hc.createHash)throw new Error("crypto.createHash not available");let u=(s=Hc.createHash)==null?void 0:s(i),l=new Uint8Array(r);return u.update(l).digest("base64")}catch(u){throw Error(`${i} hash not available. ${u}`)}}async*hashBatches(r,t="base64"){var n,o,s,u,l,f,h;if(!Hc.createHash)throw new Error("crypto.createHash not available");let i=(u=Hc.createHash)==null?void 0:u((s=(o=(n=this.options)==null?void 0:n.crypto)==null?void 0:o.algorithm)==null?void 0:s.toLowerCase());for await(let d of r){let m=new Uint8Array(d);i.update(m),yield d}let a=i.digest(t);(h=(f=(l=this.options)==null?void 0:l.crypto)==null?void 0:f.onEnd)==null||h.call(f,{hash:a})}};var gj=require("node:process");var tj=Jt(require("stream"),1),uv=class{},vH=tj.Readable||uv;function lv(e,r){let t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new cv(t,r)}var cv=class extends vH{_pulling;_bytesMode;_iterator;constructor(r,t){super(t),this._iterator=r,this._pulling=!1,this._bytesMode=!t||!t.objectMode}async _read(r){this._pulling||(this._pulling=!0,this._pulling=await this._pull(r,this._iterator))}async _destroy(r,t){var i,a,n,o;this._iterator&&(r?await((a=(i=this._iterator)==null?void 0:i.throw)==null?void 0:a.call(i,r)):await((o=(n=this._iterator)==null?void 0:n.return)==null?void 0:o.call(n,r)),t==null||t(null))}async _pull(r,t){var n;let i=this._bytesMode,a=null;for(;this.readable&&!(a=await t.next()).done&&(r!==null&&(r-=i&&ArrayBuffer.isView(a.value)?a.value.byteLength:1),!(!this.push(new Uint8Array(a.value))||r<=0)););return(a!=null&&a.done||!this.readable)&&(this.push(null)||!0)&&((n=t==null?void 0:t.return)==null||n.call(t)),!this.readable}};var nj=Jt(ij(),1);delete globalThis.ReadableStream;var Ip=class extends nj.ReadableStream{};var Bp=class{chunks;isWorking=!1;isCancelled=!1;constructor(r){this.chunks=r}start(r){this.work(r)}async work(r){let{chunks:t}=this;for(this.isWorking=!0;!this.isCancelled&&(r.desiredSize||0)>0;){let i;try{i=t.next()}catch(a){r.error(a);break}i&&(!i.done&&!this.isCancelled?r.enqueue(i.value):r.close())}this.isWorking=!1}pull(r){this.isWorking||this.work(r)}cancel(){this.isCancelled=!0}};var Fp=class extends Ip{_chunks;constructor(r){super(new Bp(r.values()),{type:"bytes"}),this._chunks=r}async*[Symbol.asyncIterator](r){let t=this.getReader();yield*this._chunks,t.releaseLock()}};var ss=class{type;size;parts;constructor(r=[],t={}){this.parts=[],this.size=0;for(let i of r)if(typeof i=="string"){let a=new TextEncoder().encode(i);this.parts.push(a),this.size+=a.byteLength}else if(i instanceof ss)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:a,byteOffset:n,byteLength:o}=i;this.parts.push(new Uint8Array(a,n,o)),this.size+=o}else{let a=new TextEncoder().encode(String(i));this.parts.push(a),this.size+=a.byteLength}this.type=bH(t.type)}slice(r=0,t=this.size,i=""){let{size:a,parts:n}=this,o=r<0?Math.max(a+r,0):Math.min(r,a),s=t<0?Math.max(a+t,0):Math.min(t,a),u=Math.max(s-o,0),l=new ss([],{type:i});if(u===0)return l;let f=0,h=[];for(let d of n){let{byteLength:m}=d;if(o>0&&m<=o)o-=m,s-=m;else{let y=d.subarray(o,Math.min(m,s));if(h.push(y),f+=y.byteLength,o=0,f>=u)break}}return l.parts=h,l.size=f,l}async arrayBuffer(){return this._toArrayBuffer()}async text(){let r=new TextDecoder,t="";for(let i of this.parts)t+=r.decode(i);return t}stream(){return new Fp(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let r=new ArrayBuffer(this.size),t=new Uint8Array(r),i=0;for(let a of this.parts)t.set(a,i),i+=a.byteLength;return r}};function bH(e=""){let r=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(r)?"":r}function yH(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=ss),globalThis.Blob}var xH=yH();var Dp=class{onload;onabort;onerror;error;onloadstart;onloadend;onprogress;readyState;result;DONE;EMPTY;LOADING;addEventListener;removeEventListener;dispatchEvent;constructor(){this.onload=null}abort(){}async readAsArrayBuffer(r){let t=await r.arrayBuffer();this.onload&&this.onload({target:{result:t}})}async readAsBinaryString(r){throw Error("Not implemented")}async readAsDataURL(r){let t=await r.text(),i=`data://;base64,${Pu(t)}`;this.onload&&this.onload({target:{result:i}})}async readAsText(r){let t=await r.text();this.onload&&this.onload({target:{result:t}})}};var Lp=class extends globalThis.Blob{name="";webkitRelativePath="";lastModified;constructor(r,t,i={}){super(r,i),this.name=String(t).replace(/\//g,":"),this.lastModified=(i==null?void 0:i.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};function oj(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=Dp),typeof File>"u"&&!globalThis.File&&(globalThis.File=Lp),global}var wH=oj();var fv=Jt(require("module"),1),sj=Jt(require("path"),1),Mp=Jt(require("fs"),1);async function uj(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():Mp.default.readFileSync(e).buffer}async function cj(e){return e.startsWith("http")?await(await fetch(e)).text():Mp.default.readFileSync(e,"utf8")}async function lj(e){if(e.startsWith("http")){let i=await(await fetch(e)).text();return qp(i)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let r=Mp.default.readFileSync(e,"utf8");return qp(r)}function qp(e,r="",t){if(typeof r=="object"&&(t=r,r=""),r=r.replace("file://",""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let i=fv.default._nodeModulePaths(sj.default.dirname(r)),a=typeof module<"u"&&(module==null?void 0:module.parent),n=new fv.default(r,a);return n.filename=r,n.paths=[].concat((t==null?void 0:t.prependPaths)||[]).concat(i).concat((t==null?void 0:t.appendPaths)||[]),n._compile(e,r),a&&a.children&&a.children.splice(a.children.indexOf(n),1),n.exports}var Ni=class{map;constructor(r){this.map={},r instanceof Ni?r.forEach((t,i)=>this.append(i,t)):Array.isArray(r)?r.forEach(t=>this.append(t[0],t[1])):r&&Object.getOwnPropertyNames(r).forEach(t=>this.append(t,r[t]))}append(r,t){r=Gc(r),t=fj(t);let i=this.map[r];this.map[r]=i?`${i}, ${t}`:t}delete(r){delete this.map[Gc(r)]}get(r){return r=Gc(r),this.has(r)?this.map[r]:null}has(r){return this.map.hasOwnProperty(Gc(r))}set(r,t){this.map[Gc(r)]=fj(t)}forEach(r,t=null){for(let i in this.map)this.map.hasOwnProperty(i)&&(t?r.call(t,this.map[i],i,this):r(this.map[i],i,this))}keys(){let r=[];return this.forEach(function(t,i){r.push(i)}),pv(r)}values(){let r=[];return this.forEach(function(t){r.push(t)}),pv(r)}entries(){let r=[];return this.forEach(function(t,i){r.push([i,t])}),pv(r)}*[Symbol.iterator](){yield*this.entries()}};function Gc(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 fj(e){return typeof e!="string"&&(e=String(e)),e}function pv(e){let r={next(){let t=e.shift();return{done:t===void 0,value:t}}};return r[Symbol.iterator]=function(){return r},r}function dv(e,r){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${r}`)}var mv=Jt(require("stream"),1),_H=e=>typeof e=="boolean",pj=e=>typeof e=="function",kH=e=>e!==null&&typeof e=="object",hv=e=>kH(e)&&pj(e.read)&&pj(e.pipe)&&_H(e.readable),Mn=class{ok;status;statusText;headers;url;bodyUsed=!1;_body;constructor(r,t){let{headers:i,status:a=200,statusText:n="OK",url:o}=t||{};this.url=o,this.ok=a===200,this.status=a,this.statusText=n,this.headers=new Ni((t==null?void 0:t.headers)||{}),hv(r)?this._body=Ap(r,i):typeof r=="string"?this._body=mv.Readable.from([new TextEncoder().encode(r)]):this._body=mv.Readable.from([r||new ArrayBuffer(0)])}get body(){return dv(!this.bodyUsed),dv(hv(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return hv(this._body)?await ej(this._body):this._body||new ArrayBuffer(0)}async text(){let r=await this.arrayBuffer();return new TextDecoder().decode(r)}async json(){let r=await this.text();return JSON.parse(r)}async blob(){if(typeof Blob>"u")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var hj=Jt(require("http"),1),mj=Jt(require("https"),1);var SH=e=>e&&e instanceof ArrayBuffer,EH=e=>e&&e instanceof Buffer;function dj(e){let r=e.indexOf(","),t,i;return e.slice(r-7,r)===";base64"?(t=Buffer.from(e.slice(r+1),"base64"),i=e.slice(5,r-7).trim()):(t=Buffer.from(decodeURIComponent(e.slice(r+1))),i=e.slice(5,r).trim()),i?i.startsWith(";")&&(i=`text/plain${i}`):i="text/plain;charset=US-ASCII",{arrayBuffer:jH(t),mimeType:i}}function jH(e){if(SH(e))return e;if(EH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var gv=e=>e.startsWith("data:"),AH=e=>e.startsWith("http:")||e.startsWith("https:");async function Wc(e,r){try{if(globalThis.fetch!==Wc&&(AH(e)||gv(e)))return await fetch(e,r);if(gv(e)){let{arrayBuffer:l,mimeType:f}=dj(e);return new Mn(l,{headers:{"content-type":f},url:e})}let t={},i=e;e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip");let a=await TH(i,r),n=OH(e,a,t),{status:o,statusText:s}=CH(a),u=!r||r.followRedirect||r.followRedirect===void 0;if(o>=300&&o<400&&n.has("location")&&u){let l=PH(e,n.get("location"));return await Wc(l,r)}return new Mn(a,{headers:n,status:o,statusText:s,url:e})}catch(t){return new Mn(null,{status:400,statusText:String(t),url:e})}}async function TH(e,r){return await new Promise((t,i)=>{let a=RH(e,r),n=e.startsWith("https:")?mj.default.request(a,o=>t(o)):hj.default.request(a,o=>t(o));n.on("error",o=>i(o)),n.end()})}function PH(e,r){if(r.startsWith("http"))return r;let t=new URL(e);return t.pathname=r,t.href}function RH(e,r){let t=(r==null?void 0:r.headers)||{},i={};for(let n of Object.keys(t))i[n.toLowerCase()]=t[n];i["accept-encoding"]=i["accept-encoding"]||"gzip,br,deflate";let a=new URL(e);return{hostname:a.hostname,path:a.pathname,method:"GET",...r,...r==null?void 0:r.fetch,headers:i,port:a.port}}function CH(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function OH(e,r,t={}){let i={};if(r&&r.headers){let a=r.headers;for(let n in a){let o=a[n];i[n.toLowerCase()]=String(o)}}if(!i["content-length"]){let a=IH(e);Number.isFinite(a)&&(i["content-length"]=a)}return Object.assign(i,t),new Ni(i)}function IH(e){return gv(e)?e.length-5:null}var BH=parseInt(gj.versions.node.split(".")[0]);V1&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=lv;globalThis.loaders.NodeFile=os;globalThis.loaders.NodeFileSystem=Rp;globalThis.loaders.fetchNode=Tp;globalThis.loaders.NodeHash=Cp;globalThis.TextEncoder||(globalThis.TextEncoder=Tu);globalThis.TextDecoder||(globalThis.TextDecoder=Bo);!("atob"in globalThis)&&Pu&&(globalThis.atob=Pu);!("btoa"in globalThis)&&Ld&&(globalThis.btoa=Ld);globalThis.loaders.encodeImageNode=Qx;globalThis.loaders.parseImageNode=Mg;globalThis.loaders.imageFormatsNode=qg;globalThis._parseImageNode=Mg;globalThis._imageFormatsNode=qg;globalThis.loaders.readFileAsArrayBuffer=uj;globalThis.loaders.readFileAsText=cj;globalThis.loaders.requireFromFile=lj;globalThis.loaders.requireFromString=qp;BH<18&&(!("Headers"in globalThis)&&Ni&&(globalThis.Headers=Ni),!("Response"in globalThis)&&Mn&&(globalThis.Response=Mn),!("fetch"in globalThis)&&Wc&&(globalThis.fetch=Wc));var FH=e=>typeof e=="boolean",Vc=e=>typeof e=="function",us=e=>e!==null&&typeof e=="object",vv=e=>us(e)&&e.constructor==={}.constructor;var vj=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",bj=e=>e&&typeof e[Symbol.asyncIterator]=="function";var di=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var hi=e=>typeof Blob<"u"&&e instanceof Blob,yj=e=>e&&typeof e=="object"&&e.isBuffer;var DH=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||us(e)&&Vc(e.tee)&&Vc(e.cancel)&&Vc(e.getReader);var LH=e=>us(e)&&Vc(e.read)&&Vc(e.pipe)&&FH(e.readable),zp=e=>DH(e)||LH(e);var Np=class extends Error{constructor(r,t){super(r),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response};var qH=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,MH=/^([-\w.]+\/[-\w.+]+)/;function bv(e,r){return e.toLowerCase()===r.toLowerCase()}function xj(e){let r=MH.exec(e);return r?r[1]:e}function yv(e){let r=qH.exec(e);return r?r[1]:""}var wj=/\?.*/;function _j(e){let r=e.match(wj);return r&&r[0]}function du(e){return e.replace(wj,"")}function kj(e){if(e.length<50)return e;let r=e.slice(e.length-15);return`${e.substr(0,32)}...${r}`}function cs(e){return di(e)?e.url:hi(e)?e.name||"":typeof e=="string"?e:""}function $c(e){if(di(e)){let r=e,t=r.headers.get("content-type")||"",i=du(r.url);return xj(t)||yv(i)}return hi(e)?e.type||"":typeof e=="string"?yv(e):""}function Sj(e){return di(e)?e.headers["content-length"]||-1:hi(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function Up(e){if(di(e))return e;let r={},t=Sj(e);t>=0&&(r["content-length"]=String(t));let i=cs(e),a=$c(e);a&&(r["content-type"]=a);let n=await NH(e);n&&(r["x-first-bytes"]=n),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:r});return Object.defineProperty(o,"url",{value:i}),o}async function Ej(e){if(!e.ok)throw await zH(e)}async function zH(e){let r=kj(e.url),t=`Failed to fetch resource (${e.status}) ${e.statusText}: ${r}`;t=t.length>100?`${t.slice(0,100)}...`:t;let i={reason:e.statusText,url:e.url,response:e};try{let a=e.headers.get("Content-Type");i.reason=a!=null&&a.includes("application/json")?await e.json():e.text()}catch{}return new Np(t,i)}async function NH(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let t=e.slice(0,5);return await new Promise(i=>{let a=new FileReader;a.onload=n=>{var o;return i((o=n==null?void 0:n.target)==null?void 0:o.result)},a.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=e.slice(0,5);return`data:base64,${UH(t)}`}return null}function UH(e){let r="",t=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)r+=String.fromCharCode(t[i]);return btoa(r)}function HH(e){return!GH(e)&&!WH(e)}function GH(e){return e.startsWith("http:")||e.startsWith("https:")}function WH(e){return e.startsWith("data:")}async function xv(e,r){var t,i;if(typeof e=="string"){let a=is(e);return HH(a)&&(t=globalThis.loaders)!=null&&t.fetchNode?(i=globalThis.loaders)==null?void 0:i.fetchNode(a,r):await fetch(a,r)}return await Up(e)}var wv=new hn({id:"loaders.gl"}),Hp=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Gp=class{console;constructor(){this.console=console}log(...r){return this.console.log.bind(this.console,...r)}info(...r){return this.console.info.bind(this.console,...r)}warn(...r){return this.console.warn.bind(this.console,...r)}error(...r){return this.console.error.bind(this.console,...r)}};var _v={fetch:null,mimeType:void 0,nothrow:!1,log:new Gp,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Zo,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},jj={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 kv(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function Sv(){let e=kv();return e.globalOptions=e.globalOptions||{..._v},e.globalOptions}function Pj(e,r,t,i){return t=t||[],t=Array.isArray(t)?t:[t],VH(e,t),KH(r,e,i)}function VH(e,r){Aj(e,null,_v,jj,r);for(let t of r){let i=e&&e[t.id]||{},a=t.options&&t.options[t.id]||{},n=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};Aj(i,t.id,a,n,r)}}function Aj(e,r,t,i,a){let n=r||"Top level",o=r?`${r}.`:"";for(let s in e){let u=!r&&us(e[s]),l=s==="baseUri"&&!r,f=s==="workerUrl"&&r;if(!(s in t)&&!l&&!f){if(s in i)wv.warn(`${n} loader option '${o}${s}' no longer supported, use '${i[s]}'`)();else if(!u){let h=$H(s,a);wv.warn(`${n} loader option '${o}${s}' not recognized. ${h}`)()}}}}function $H(e,r){let t=e.toLowerCase(),i="";for(let a of r)for(let n in a.options){if(e===n)return`Did you mean '${a.id}.${n}'?`;let o=n.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(i=i||`Did you mean '${a.id}.${n}'?`)}return i}function KH(e,r,t){let a={...e.options||{}};return YH(a,t),a.log===null&&(a.log=new Hp),Tj(a,Sv()),Tj(a,r),a}function Tj(e,r){for(let t in r)if(t in r){let i=r[t];vv(i)&&vv(e[t])?e[t]={...e[t],...r[t]}:e[t]=r[t]}}function YH(e,r){r&&!("baseUri"in e)&&(e.baseUri=r)}function Kc(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function Ev(e){Mi(e,"null loader"),Mi(Kc(e),"invalid loader");let r;return Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),(e!=null&&e.parseTextSync||e!=null&&e.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var XH=()=>{let e=kv();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Rj(){return XH()}var Cj=new hn({id:"loaders.gl"});var QH=/\.([^.]+)$/;async function Bj(e,r=[],t,i){if(!Fj(e))return null;let a=Oj(e,r,{...t,nothrow:!0},i);if(a)return a;if(hi(e)&&(e=await e.slice(0,10).arrayBuffer(),a=Oj(e,r,t,i)),!a&&!(t!=null&&t.nothrow))throw new Error(Dj(e));return a}function Oj(e,r=[],t,i){if(!Fj(e))return null;if(r&&!Array.isArray(r))return Ev(r);let a=[];r&&(a=a.concat(r)),t!=null&&t.ignoreRegisteredLoaders||a.push(...Rj()),ZH(a);let n=JH(e,a,t,i);if(!n&&!(t!=null&&t.nothrow))throw new Error(Dj(e));return n}function JH(e,r,t,i){let a=cs(e),n=$c(e),o=du(a)||(i==null?void 0:i.url),s=null,u="";return t!=null&&t.mimeType&&(s=jv(r,t==null?void 0:t.mimeType),u=`match forced by supplied MIME type ${t==null?void 0:t.mimeType}`),s=s||eG(r,o),u=u||(s?`matched url ${o}`:""),s=s||jv(r,n),u=u||(s?`matched MIME type ${n}`:""),s=s||tG(r,e),u=u||(s?`matched initial data ${Lj(e)}`:""),t!=null&&t.fallbackMimeType&&(s=s||jv(r,t==null?void 0:t.fallbackMimeType),u=u||(s?`matched fallback MIME type ${n}`:"")),u&&Cj.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function Fj(e){return!(e instanceof Response&&e.status===204)}function Dj(e){let r=cs(e),t=$c(e),i="No valid loader found (";i+=r?`${ns.filename(r)}, `:"no url provided, ",i+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let a=e?Lj(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function ZH(e){for(let r of e)Ev(r)}function eG(e,r){let t=r&&QH.exec(r),i=t&&t[1];return i?rG(e,i):null}function rG(e,r){r=r.toLowerCase();for(let t of e)for(let i of t.extensions)if(i.toLowerCase()===r)return t;return null}function jv(e,r){var t;for(let i of e)if((t=i.mimeTypes)!=null&&t.some(a=>bv(r,a))||bv(r,`application/x.${i.id}`))return i;return null}function tG(e,r){if(!r)return null;for(let t of e)if(typeof r=="string"){if(aG(r,t))return t}else if(ArrayBuffer.isView(r)){if(Ij(r.buffer,r.byteOffset,t))return t}else if(r instanceof ArrayBuffer&&Ij(r,0,t))return t;return null}function aG(e,r){return r.testText?r.testText(e):(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>e.startsWith(i))}function Ij(e,r,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(a=>iG(e,r,t,a))}function iG(e,r,t,i){if(i instanceof ArrayBuffer)return av(i,e,i.byteLength);switch(typeof i){case"function":return i(e);case"string":let a=Av(e,r,i.length);return i===a;default:return!1}}function Lj(e,r=5){return typeof e=="string"?e.slice(0,r):ArrayBuffer.isView(e)?Av(e.buffer,e.byteOffset,r):e instanceof ArrayBuffer?Av(e,0,r):""}function Av(e,r,t){if(e.byteLength<r+t)return"";let i=new DataView(e),a="";for(let n=0;n<t;n++)a+=String.fromCharCode(i.getUint8(r+n));return a}function*qj(e,r){let t=(r==null?void 0:r.chunkSize)||262144,i=0,a=new TextEncoder;for(;i<e.length;){let n=Math.min(e.length-i,t),o=e.slice(i,i+n);i+=n,yield a.encode(o)}}function*Mj(e,r={}){let{chunkSize:t=262144}=r,i=0;for(;i<e.byteLength;){let a=Math.min(e.byteLength-i,t),n=new ArrayBuffer(a),o=new Uint8Array(e,i,a);new Uint8Array(n).set(o),i+=a,yield n}}async function*zj(e,r){let t=(r==null?void 0:r.chunkSize)||1048576,i=0;for(;i<e.size;){let a=i+t,n=await e.slice(i,a).arrayBuffer();i=a,yield n}}function Tv(e,r){return Zo?nG(e,r):oG(e,r)}async function*nG(e,r){let t=e.getReader(),i;try{for(;;){let a=i||t.read();r!=null&&r._streamReadAhead&&(i=t.read());let{done:n,value:o}=await a;if(n)return;yield Ep(o)}}catch{t.releaseLock()}}async function*oG(e,r){for await(let t of e)yield Ep(t)}function Nj(e,r){if(typeof e=="string")return qj(e,r);if(e instanceof ArrayBuffer)return Mj(e,r);if(hi(e))return zj(e,r);if(zp(e))return Tv(e,r);if(di(e))return Tv(e.body,r);throw new Error("makeIterator")}var Uj="Cannot convert supplied data type";function sG(e,r,t){if(r.text&&typeof e=="string")return e;if(yj(e)&&(e=e.buffer),e instanceof ArrayBuffer){let i=e;return r.text&&!r.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(r.text&&!r.binary)return new TextDecoder("utf8").decode(e);let i=e.buffer,a=e.byteLength||e.length;return(e.byteOffset!==0||a!==i.byteLength)&&(i=i.slice(e.byteOffset,e.byteOffset+a)),i}throw new Error(Uj)}async function Hj(e,r,t){let i=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||i)return sG(e,r,t);if(hi(e)&&(e=await Up(e)),di(e)){let a=e;return await Ej(a),r.binary?await a.arrayBuffer():await a.text()}if(zp(e)&&(e=Nj(e,t)),vj(e)||bj(e))return zc(e);throw new Error(Uj)}function Wp(e,r){let t=Sv(),i=e||t;return typeof i.fetch=="function"?i.fetch:us(i.fetch)?a=>xv(a,i.fetch):r!=null&&r.fetch?r==null?void 0:r.fetch:xv}function Gj(e,r,t){if(t)return t;let i={fetch:Wp(r,e),...e};if(i.url){let a=du(i.url);i.baseUrl=a,i.queryString=_j(i.url),i.filename=ns.filename(a),i.baseUrl=ns.dirname(a)}return Array.isArray(i.loaders)||(i.loaders=null),i}function Wj(e,r){if(e&&!Array.isArray(e))return e;let t;if(e&&(t=Array.isArray(e)?e:[e]),r&&r.loaders){let i=Array.isArray(r.loaders)?r.loaders:[r.loaders];t=t?[...t,...i]:i}return t&&t.length?t:void 0}async function zn(e,r,t,i){r&&!Array.isArray(r)&&!Kc(r)&&(i=void 0,t=r,r=void 0),e=await e,t=t||{};let a=cs(e),o=Wj(r,i),s=await Bj(e,o,t);return s?(t=Pj(t,s,o,a),i=Gj({url:a,_parse:zn,loaders:o},t,i||null),await uG(s,e,t,i)):null}async function uG(e,r,t,i){if(Jg(e),t=Gg(e.options,t),di(r)){let n=r,{ok:o,redirected:s,status:u,statusText:l,type:f,url:h}=n,d=Object.fromEntries(n.headers.entries());i.response={headers:d,ok:o,redirected:s,status:u,statusText:l,type:f,url:h}}r=await Hj(r,e,t);let a=e;if(a.parseTextSync&&typeof r=="string")return a.parseTextSync(r,t,i);if(rv(e,t))return await tv(e,r,t,i,zn);if(a.parseText&&typeof r=="string")return await a.parseText(r,t,i);if(a.parse)return await a.parse(r,t,i);throw ma(!a.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function Vj(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 Pv(e){let r=1/0,t=1/0,i=1/0,a=-1/0,n=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let l=0;l<u;l+=3){let f=s[l],h=s[l+1],d=s[l+2];r=f<r?f:r,t=h<t?h:t,i=d<i?d:i,a=f>a?f:a,n=h>n?h:n,o=d>o?d:o}return[[r,t,i],[a,n,o]]}function Rv(e,r,t){let i=Vj(r.value),a=t||$j(r);return{name:e,type:{type:"fixed-size-list",listSize:r.size,children:[{name:"value",type:i}]},nullable:!1,metadata:a}}function $j(e){let r={};return"byteOffset"in e&&(r.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(r.byteStride=e.byteStride.toString(10)),"normalized"in e&&(r.normalized=e.normalized.toString()),r}async function Cv(e,r,t,i){let a,n;!Array.isArray(r)&&!Kc(r)?(a=[],n=r,i=void 0):(a=r,n=t);let o=Wp(n),s=e;return typeof e=="string"&&(s=await o(e)),hi(e)&&(s=await o(e)),Array.isArray(a)?await zn(s,a,n):await zn(s,a,n)}var cG=1/Math.PI*180,lG=1/180*Math.PI,fG={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fG}};var It=globalThis.mathgl.config;function Ov(e,{precision:r=It.precision}={}){return e=pG(e),"".concat(parseFloat(e.toPrecision(r)))}function Ao(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Iv(e){return Kj(e)}function Bv(e){return Yj(e)}function Kj(e,r){return Xj(e,t=>t*lG,r)}function Yj(e,r){return Xj(e,t=>t*cG,r)}function Nn(e,r,t){let i=It.EPSILON;t&&(It.EPSILON=t);try{if(e===r)return!0;if(Ao(e)&&Ao(r)){if(e.length!==r.length)return!1;for(let a=0;a<e.length;++a)if(!Nn(e[a],r[a]))return!1;return!0}return e&&e.equals?e.equals(r):r&&r.equals?r.equals(e):typeof e=="number"&&typeof r=="number"?Math.abs(e-r)<=It.EPSILON*Math.max(1,Math.abs(e),Math.abs(r)):!1}finally{It.EPSILON=i}}function pG(e){return Math.round(e/It.EPSILON)*It.EPSILON}function dG(e){return e.clone?e.clone():new Array(e.length)}function Xj(e,r,t){if(Ao(e)){let i=e;t=t||dG(i);for(let a=0;a<t.length&&a<i.length;++a){let n=typeof e=="number"?e:e[a];t[a]=r(n,a,t)}return t}return r(e)}function hG(e){function r(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return r.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e,r}var hu=class extends hG(Array){clone(){return new this.constructor().copy(this)}fromArray(r,t=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=r[i+t];return this.check()}toArray(r=[],t=0){for(let i=0;i<this.ELEMENTS;++i)r[t+i]=this[i];return r}toObject(r){return r}from(r){return Array.isArray(r)?this.copy(r):this.fromObject(r)}to(r){return r===this?this:Ao(r)?this.toArray(r):this.toObject(r)}toTarget(r){return r?this.to(r):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(It)}formatString(r){let t="";for(let i=0;i<this.ELEMENTS;++i)t+=(i>0?", ":"")+Ov(this[i],r);return"".concat(r.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Nn(this[t],r[t]))return!1;return!0}exactEquals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==r[t])return!1;return!0}negate(){for(let r=0;r<this.ELEMENTS;++r)this[r]=-this[r];return this.check()}lerp(r,t,i){if(i===void 0)return this.lerp(this,r,t);for(let a=0;a<this.ELEMENTS;++a){let n=r[a],o=typeof t=="number"?t:t[a];this[a]=n+i*(o-n)}return this.check()}min(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(r[t],this[t]);return this.check()}max(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(r[t],this[t]);return this.check()}clamp(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r[i]),t[i]);return this.check()}add(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]+=t[i];return this.check()}subtract(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]-=t[i];return this.check()}scale(r){if(typeof r=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;else for(let t=0;t<this.ELEMENTS&&t<r.length;++t)this[t]*=r[t];return this.check()}multiplyByScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}check(){if(It.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let r=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)r=r&&Number.isFinite(this[t]);return r}sub(r){return this.subtract(r)}setScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=r;return this.check()}addScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]+=r;return this.check()}subScalar(r){return this.addScalar(-r)}multiplyScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}divideScalar(r){return this.multiplyByScalar(1/r)}clampScalar(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r),t);return this.check()}get elements(){return this}};function mG(e,r){if(e.length!==r)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}function Aa(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Vp(e,r,t=""){if(It.debug&&!mG(e,r))throw new Error("math.gl: ".concat(t," some fields set to invalid numbers'"));return e}function mi(e,r){if(!e)throw new Error("math.gl assertion ".concat(r))}var $p=class extends hu{get x(){return this[0]}set x(r){this[0]=Aa(r)}get y(){return this[1]}set y(r){this[1]=Aa(r)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let r=0;for(let t=0;t<this.ELEMENTS;++t)r+=this[t]*this[t];return r}magnitudeSquared(){return this.lengthSquared()}distance(r){return Math.sqrt(this.distanceSquared(r))}distanceSquared(r){let t=0;for(let i=0;i<this.ELEMENTS;++i){let a=this[i]-r[i];t+=a*a}return Aa(t)}dot(r){let t=0;for(let i=0;i<this.ELEMENTS;++i)t+=this[i]*r[i];return Aa(t)}normalize(){let r=this.magnitude();if(r!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=r;return this.check()}multiply(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]*=t[i];return this.check()}divide(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]/=t[i];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(r){return this.distance(r)}distanceToSquared(r){return this.distanceSquared(r)}getComponent(r){return mi(r>=0&&r<this.ELEMENTS,"index is out of range"),Aa(this[r])}setComponent(r,t){return mi(r>=0&&r<this.ELEMENTS,"index is out of range"),this[r]=t,this.check()}addVectors(r,t){return this.copy(r).add(t)}subVectors(r,t){return this.copy(r).subtract(t)}multiplyVectors(r,t){return this.copy(r).multiply(t)}addScaledVector(r,t){return this.add(new this.constructor(r).multiplyScalar(t))}};var Ui=typeof Float32Array<"u"?Float32Array:Array,Yc=Math.random;function mu(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Qie=Math.PI/180;function gG(){let e=new Ui(2);return Ui!=Float32Array&&(e[0]=0,e[1]=0),e}function Qj(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[4]*a+t[12],e[1]=t[1]*i+t[5]*a+t[13],e}var Jie=function(){let e=gG();return function(r,t,i,a,n,o){let s,u;for(t||(t=2),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],n(e,e,o),r[s]=e[0],r[s+1]=e[1];return r}}();function Jj(e,r,t){let i=r[0],a=r[1],n=t[3]*i+t[7]*a||1;return e[0]=(t[0]*i+t[4]*a)/n,e[1]=(t[1]*i+t[5]*a)/n,e}function Kp(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n||1;return e[0]=(t[0]*i+t[4]*a+t[8]*n)/o,e[1]=(t[1]*i+t[5]*a+t[9]*n)/o,e[2]=(t[2]*i+t[6]*a+t[10]*n)/o,e}function Zj(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[2]*a,e[1]=t[1]*i+t[3]*a,e[2]=r[2],e}var Qc={};kl(Qc,{add:()=>wG,angle:()=>Hv,bezier:()=>FG,ceil:()=>_G,clone:()=>vG,copy:()=>yG,create:()=>e4,cross:()=>Lv,dist:()=>GG,distance:()=>n4,div:()=>HG,divide:()=>i4,dot:()=>Dv,equals:()=>zG,exactEquals:()=>MG,floor:()=>kG,forEach:()=>KG,fromValues:()=>bG,hermite:()=>BG,inverse:()=>RG,len:()=>VG,length:()=>r4,lerp:()=>OG,max:()=>EG,min:()=>SG,mul:()=>UG,multiply:()=>a4,negate:()=>PG,normalize:()=>CG,random:()=>DG,rotateX:()=>zv,rotateY:()=>Nv,rotateZ:()=>Uv,round:()=>jG,scale:()=>AG,scaleAndAdd:()=>TG,set:()=>xG,slerp:()=>IG,sqrDist:()=>WG,sqrLen:()=>$G,squaredDistance:()=>o4,squaredLength:()=>s4,str:()=>qG,sub:()=>NG,subtract:()=>t4,transformMat3:()=>qv,transformMat4:()=>Xc,transformQuat:()=>Mv,zero:()=>LG});function e4(){let e=new Ui(3);return Ui!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vG(e){let r=new Ui(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function r4(e){let r=e[0],t=e[1],i=e[2];return Math.sqrt(r*r+t*t+i*i)}function bG(e,r,t){let i=new Ui(3);return i[0]=e,i[1]=r,i[2]=t,i}function yG(e,r){return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function xG(e,r,t,i){return e[0]=r,e[1]=t,e[2]=i,e}function wG(e,r,t){return e[0]=r[0]+t[0],e[1]=r[1]+t[1],e[2]=r[2]+t[2],e}function t4(e,r,t){return e[0]=r[0]-t[0],e[1]=r[1]-t[1],e[2]=r[2]-t[2],e}function a4(e,r,t){return e[0]=r[0]*t[0],e[1]=r[1]*t[1],e[2]=r[2]*t[2],e}function i4(e,r,t){return e[0]=r[0]/t[0],e[1]=r[1]/t[1],e[2]=r[2]/t[2],e}function _G(e,r){return e[0]=Math.ceil(r[0]),e[1]=Math.ceil(r[1]),e[2]=Math.ceil(r[2]),e}function kG(e,r){return e[0]=Math.floor(r[0]),e[1]=Math.floor(r[1]),e[2]=Math.floor(r[2]),e}function SG(e,r,t){return e[0]=Math.min(r[0],t[0]),e[1]=Math.min(r[1],t[1]),e[2]=Math.min(r[2],t[2]),e}function EG(e,r,t){return e[0]=Math.max(r[0],t[0]),e[1]=Math.max(r[1],t[1]),e[2]=Math.max(r[2],t[2]),e}function jG(e,r){return e[0]=mu(r[0]),e[1]=mu(r[1]),e[2]=mu(r[2]),e}function AG(e,r,t){return e[0]=r[0]*t,e[1]=r[1]*t,e[2]=r[2]*t,e}function TG(e,r,t,i){return e[0]=r[0]+t[0]*i,e[1]=r[1]+t[1]*i,e[2]=r[2]+t[2]*i,e}function n4(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return Math.sqrt(t*t+i*i+a*a)}function o4(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return t*t+i*i+a*a}function s4(e){let r=e[0],t=e[1],i=e[2];return r*r+t*t+i*i}function PG(e,r){return e[0]=-r[0],e[1]=-r[1],e[2]=-r[2],e}function RG(e,r){return e[0]=1/r[0],e[1]=1/r[1],e[2]=1/r[2],e}function CG(e,r){let t=r[0],i=r[1],a=r[2],n=t*t+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=r[0]*n,e[1]=r[1]*n,e[2]=r[2]*n,e}function Dv(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]}function Lv(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[0],s=t[1],u=t[2];return e[0]=a*u-n*s,e[1]=n*o-i*u,e[2]=i*s-a*o,e}function OG(e,r,t,i){let a=r[0],n=r[1],o=r[2];return e[0]=a+i*(t[0]-a),e[1]=n+i*(t[1]-n),e[2]=o+i*(t[2]-o),e}function IG(e,r,t,i){let a=Math.acos(Math.min(Math.max(Dv(r,t),-1),1)),n=Math.sin(a),o=Math.sin((1-i)*a)/n,s=Math.sin(i*a)/n;return e[0]=o*r[0]+s*t[0],e[1]=o*r[1]+s*t[1],e[2]=o*r[2]+s*t[2],e}function BG(e,r,t,i,a,n){let o=n*n,s=o*(2*n-3)+1,u=o*(n-2)+n,l=o*(n-1),f=o*(3-2*n);return e[0]=r[0]*s+t[0]*u+i[0]*l+a[0]*f,e[1]=r[1]*s+t[1]*u+i[1]*l+a[1]*f,e[2]=r[2]*s+t[2]*u+i[2]*l+a[2]*f,e}function FG(e,r,t,i,a,n){let o=1-n,s=o*o,u=n*n,l=s*o,f=3*n*s,h=3*u*o,d=u*n;return e[0]=r[0]*l+t[0]*f+i[0]*h+a[0]*d,e[1]=r[1]*l+t[1]*f+i[1]*h+a[1]*d,e[2]=r[2]*l+t[2]*f+i[2]*h+a[2]*d,e}function DG(e,r){r=r===void 0?1:r;let t=Yc()*2*Math.PI,i=Yc()*2-1,a=Math.sqrt(1-i*i)*r;return e[0]=Math.cos(t)*a,e[1]=Math.sin(t)*a,e[2]=i*r,e}function Xc(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n+t[15];return o=o||1,e[0]=(t[0]*i+t[4]*a+t[8]*n+t[12])/o,e[1]=(t[1]*i+t[5]*a+t[9]*n+t[13])/o,e[2]=(t[2]*i+t[6]*a+t[10]*n+t[14])/o,e}function qv(e,r,t){let i=r[0],a=r[1],n=r[2];return e[0]=i*t[0]+a*t[3]+n*t[6],e[1]=i*t[1]+a*t[4]+n*t[7],e[2]=i*t[2]+a*t[5]+n*t[8],e}function Mv(e,r,t){let i=t[0],a=t[1],n=t[2],o=t[3],s=r[0],u=r[1],l=r[2],f=a*l-n*u,h=n*s-i*l,d=i*u-a*s,m=a*d-n*h,y=n*f-i*d,k=i*h-a*f,x=o*2;return f*=x,h*=x,d*=x,m*=2,y*=2,k*=2,e[0]=s+f+m,e[1]=u+h+y,e[2]=l+d+k,e}function zv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Nv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Uv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Hv(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2],u=Math.sqrt((t*t+i*i+a*a)*(n*n+o*o+s*s)),l=u&&Dv(e,r)/u;return Math.acos(Math.min(Math.max(l,-1),1))}function LG(e){return e[0]=0,e[1]=0,e[2]=0,e}function qG(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function MG(e,r){return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}function zG(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2];return Math.abs(t-n)<=1e-6*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-s)<=1e-6*Math.max(1,Math.abs(a),Math.abs(s))}var NG=t4,UG=a4,HG=i4,GG=n4,WG=o4,VG=r4,$G=s4,KG=function(){let e=e4();return function(r,t,i,a,n,o){let s,u;for(t||(t=3),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2];return r}}();var Gv=[0,0,0],Yp,Ir=class extends $p{static get ZERO(){return Yp||(Yp=new Ir(0,0,0),Object.freeze(Yp)),Yp}constructor(r=0,t=0,i=0){super(-0,-0,-0),arguments.length===1&&Ao(r)?this.copy(r):(It.debug&&(Aa(r),Aa(t),Aa(i)),this[0]=r,this[1]=t,this[2]=i)}set(r,t,i){return this[0]=r,this[1]=t,this[2]=i,this.check()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this.check()}fromObject(r){return It.debug&&(Aa(r.x),Aa(r.y),Aa(r.z)),this[0]=r.x,this[1]=r.y,this[2]=r.z,this.check()}toObject(r){return r.x=this[0],r.y=this[1],r.z=this[2],r}get ELEMENTS(){return 3}get z(){return this[2]}set z(r){this[2]=Aa(r)}angle(r){return Hv(this,r)}cross(r){return Lv(this,this,r),this.check()}rotateX({radians:r,origin:t=Gv}){return zv(this,this,t,r),this.check()}rotateY({radians:r,origin:t=Gv}){return Nv(this,this,t,r),this.check()}rotateZ({radians:r,origin:t=Gv}){return Uv(this,this,t,r),this.check()}transform(r){return this.transformAsPoint(r)}transformAsPoint(r){return Xc(this,this,r),this.check()}transformAsVector(r){return Kp(this,this,r),this.check()}transformByMatrix3(r){return qv(this,this,r),this.check()}transformByMatrix2(r){return Zj(this,this,r),this.check()}transformByQuaternion(r){return Mv(this,this,r),this.check()}};var Xp=class extends hu{toString(){let r="[";if(It.printRowMajor){r+="row-major:";for(let t=0;t<this.RANK;++t)for(let i=0;i<this.RANK;++i)r+=" ".concat(this[i*this.RANK+t])}else{r+="column-major:";for(let t=0;t<this.ELEMENTS;++t)r+=" ".concat(this[t])}return r+="]",r}getElementIndex(r,t){return t*this.RANK+r}getElement(r,t){return this[t*this.RANK+r]}setElement(r,t,i){return this[t*this.RANK+r]=Aa(i),this}getColumn(r,t=new Array(this.RANK).fill(-0)){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)t[a]=this[i+a];return t}setColumn(r,t){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)this[i+a]=t[a];return this}};function YG(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u4(e,r){if(e===r){let t=r[1],i=r[2],a=r[3],n=r[6],o=r[7],s=r[11];e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=t,e[6]=r[9],e[7]=r[13],e[8]=i,e[9]=n,e[11]=r[14],e[12]=a,e[13]=o,e[14]=s}else e[0]=r[0],e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=r[1],e[5]=r[5],e[6]=r[9],e[7]=r[13],e[8]=r[2],e[9]=r[6],e[10]=r[10],e[11]=r[14],e[12]=r[3],e[13]=r[7],e[14]=r[11],e[15]=r[15];return e}function c4(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=r[4],s=r[5],u=r[6],l=r[7],f=r[8],h=r[9],d=r[10],m=r[11],y=r[12],k=r[13],x=r[14],A=r[15],P=t*s-i*o,T=t*u-a*o,B=t*l-n*o,C=i*u-a*s,I=i*l-n*s,F=a*l-n*u,H=f*k-h*y,N=f*x-d*y,K=f*A-m*y,V=h*x-d*k,X=h*A-m*k,U=d*A-m*x,$=P*U-T*X+B*V+C*K-I*N+F*H;return $?($=1/$,e[0]=(s*U-u*X+l*V)*$,e[1]=(a*X-i*U-n*V)*$,e[2]=(k*F-x*I+A*C)*$,e[3]=(d*I-h*F-m*C)*$,e[4]=(u*K-o*U-l*N)*$,e[5]=(t*U-a*K+n*N)*$,e[6]=(x*B-y*F-A*T)*$,e[7]=(f*F-d*B+m*T)*$,e[8]=(o*X-s*K+l*H)*$,e[9]=(i*K-t*X-n*H)*$,e[10]=(y*I-k*B+A*P)*$,e[11]=(h*B-f*I-m*P)*$,e[12]=(s*N-o*V-u*H)*$,e[13]=(t*V-i*N+a*H)*$,e[14]=(k*T-y*C-x*P)*$,e[15]=(f*C-h*T+d*P)*$,e):null}function l4(e){let r=e[0],t=e[1],i=e[2],a=e[3],n=e[4],o=e[5],s=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],m=e[12],y=e[13],k=e[14],x=e[15],A=r*o-t*n,P=r*s-i*n,T=t*s-i*o,B=l*y-f*m,C=l*k-h*m,I=f*k-h*y,F=r*I-t*C+i*B,H=n*I-o*C+s*B,N=l*T-f*P+h*A,K=m*T-y*P+k*A;return u*F-a*H+x*N-d*K}function Wv(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3],s=r[4],u=r[5],l=r[6],f=r[7],h=r[8],d=r[9],m=r[10],y=r[11],k=r[12],x=r[13],A=r[14],P=r[15],T=t[0],B=t[1],C=t[2],I=t[3];return e[0]=T*i+B*s+C*h+I*k,e[1]=T*a+B*u+C*d+I*x,e[2]=T*n+B*l+C*m+I*A,e[3]=T*o+B*f+C*y+I*P,T=t[4],B=t[5],C=t[6],I=t[7],e[4]=T*i+B*s+C*h+I*k,e[5]=T*a+B*u+C*d+I*x,e[6]=T*n+B*l+C*m+I*A,e[7]=T*o+B*f+C*y+I*P,T=t[8],B=t[9],C=t[10],I=t[11],e[8]=T*i+B*s+C*h+I*k,e[9]=T*a+B*u+C*d+I*x,e[10]=T*n+B*l+C*m+I*A,e[11]=T*o+B*f+C*y+I*P,T=t[12],B=t[13],C=t[14],I=t[15],e[12]=T*i+B*s+C*h+I*k,e[13]=T*a+B*u+C*d+I*x,e[14]=T*n+B*l+C*m+I*A,e[15]=T*o+B*f+C*y+I*P,e}function f4(e,r,t){let i=t[0],a=t[1],n=t[2],o,s,u,l,f,h,d,m,y,k,x,A;return r===e?(e[12]=r[0]*i+r[4]*a+r[8]*n+r[12],e[13]=r[1]*i+r[5]*a+r[9]*n+r[13],e[14]=r[2]*i+r[6]*a+r[10]*n+r[14],e[15]=r[3]*i+r[7]*a+r[11]*n+r[15]):(o=r[0],s=r[1],u=r[2],l=r[3],f=r[4],h=r[5],d=r[6],m=r[7],y=r[8],k=r[9],x=r[10],A=r[11],e[0]=o,e[1]=s,e[2]=u,e[3]=l,e[4]=f,e[5]=h,e[6]=d,e[7]=m,e[8]=y,e[9]=k,e[10]=x,e[11]=A,e[12]=o*i+f*a+y*n+r[12],e[13]=s*i+h*a+k*n+r[13],e[14]=u*i+d*a+x*n+r[14],e[15]=l*i+m*a+A*n+r[15]),e}function p4(e,r,t){let i=t[0],a=t[1],n=t[2];return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[3]=r[3]*i,e[4]=r[4]*a,e[5]=r[5]*a,e[6]=r[6]*a,e[7]=r[7]*a,e[8]=r[8]*n,e[9]=r[9]*n,e[10]=r[10]*n,e[11]=r[11]*n,e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function d4(e,r,t,i){let a=i[0],n=i[1],o=i[2],s=Math.sqrt(a*a+n*n+o*o),u,l,f,h,d,m,y,k,x,A,P,T,B,C,I,F,H,N,K,V,X,U,$,J;return s<1e-6?null:(s=1/s,a*=s,n*=s,o*=s,l=Math.sin(t),u=Math.cos(t),f=1-u,h=r[0],d=r[1],m=r[2],y=r[3],k=r[4],x=r[5],A=r[6],P=r[7],T=r[8],B=r[9],C=r[10],I=r[11],F=a*a*f+u,H=n*a*f+o*l,N=o*a*f-n*l,K=a*n*f-o*l,V=n*n*f+u,X=o*n*f+a*l,U=a*o*f+n*l,$=n*o*f-a*l,J=o*o*f+u,e[0]=h*F+k*H+T*N,e[1]=d*F+x*H+B*N,e[2]=m*F+A*H+C*N,e[3]=y*F+P*H+I*N,e[4]=h*K+k*V+T*X,e[5]=d*K+x*V+B*X,e[6]=m*K+A*V+C*X,e[7]=y*K+P*V+I*X,e[8]=h*U+k*$+T*J,e[9]=d*U+x*$+B*J,e[10]=m*U+A*$+C*J,e[11]=y*U+P*$+I*J,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)}function h4(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[4],o=r[5],s=r[6],u=r[7],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[4]=n*a+l*i,e[5]=o*a+f*i,e[6]=s*a+h*i,e[7]=u*a+d*i,e[8]=l*a-n*i,e[9]=f*a-o*i,e[10]=h*a-s*i,e[11]=d*a-u*i,e}function m4(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a-l*i,e[1]=o*a-f*i,e[2]=s*a-h*i,e[3]=u*a-d*i,e[8]=n*i+l*a,e[9]=o*i+f*a,e[10]=s*i+h*a,e[11]=u*i+d*a,e}function g4(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[4],f=r[5],h=r[6],d=r[7];return r!==e&&(e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a+l*i,e[1]=o*a+f*i,e[2]=s*a+h*i,e[3]=u*a+d*i,e[4]=l*a-n*i,e[5]=f*a-o*i,e[6]=h*a-s*i,e[7]=d*a-u*i,e}function v4(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=t+t,s=i+i,u=a+a,l=t*o,f=i*o,h=i*s,d=a*o,m=a*s,y=a*u,k=n*o,x=n*s,A=n*u;return e[0]=1-h-y,e[1]=f+A,e[2]=d-x,e[3]=0,e[4]=f-A,e[5]=1-l-y,e[6]=m+k,e[7]=0,e[8]=d+x,e[9]=m-k,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b4(e,r,t,i,a,n,o){let s=1/(t-r),u=1/(a-i),l=1/(n-o);return e[0]=n*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n*2*u,e[6]=0,e[7]=0,e[8]=(t+r)*s,e[9]=(a+i)*u,e[10]=(o+n)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*n*2*l,e[15]=0,e}function XG(e,r,t,i,a){let n=1/Math.tan(r/2);if(e[0]=n/t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){let o=1/(i-a);e[10]=(a+i)*o,e[14]=2*a*i*o}else e[10]=-1,e[14]=-2*i;return e}var y4=XG;function QG(e,r,t,i,a,n,o){let s=1/(r-t),u=1/(i-a),l=1/(n-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(r+t)*s,e[13]=(a+i)*u,e[14]=(o+n)*l,e[15]=1,e}var x4=QG;function w4(e,r,t,i){let a,n,o,s,u,l,f,h,d,m,y=r[0],k=r[1],x=r[2],A=i[0],P=i[1],T=i[2],B=t[0],C=t[1],I=t[2];return Math.abs(y-B)<1e-6&&Math.abs(k-C)<1e-6&&Math.abs(x-I)<1e-6?YG(e):(h=y-B,d=k-C,m=x-I,a=1/Math.sqrt(h*h+d*d+m*m),h*=a,d*=a,m*=a,n=P*m-T*d,o=T*h-A*m,s=A*d-P*h,a=Math.sqrt(n*n+o*o+s*s),a?(a=1/a,n*=a,o*=a,s*=a):(n=0,o=0,s=0),u=d*s-m*o,l=m*n-h*s,f=h*o-d*n,a=Math.sqrt(u*u+l*l+f*f),a?(a=1/a,u*=a,l*=a,f*=a):(u=0,l=0,f=0),e[0]=n,e[1]=u,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=d,e[7]=0,e[8]=s,e[9]=f,e[10]=m,e[11]=0,e[12]=-(n*y+o*k+s*x),e[13]=-(u*y+l*k+f*x),e[14]=-(h*y+d*k+m*x),e[15]=1,e)}function JG(){let e=new Ui(4);return Ui!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function _4(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3];return e[0]=t[0]*i+t[4]*a+t[8]*n+t[12]*o,e[1]=t[1]*i+t[5]*a+t[9]*n+t[13]*o,e[2]=t[2]*i+t[6]*a+t[10]*n+t[14]*o,e[3]=t[3]*i+t[7]*a+t[11]*n+t[15]*o,e}var pne=function(){let e=JG();return function(r,t,i,a,n,o){let s,u;for(t||(t=4),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],e[3]=r[s+3],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2],r[s+3]=e[3];return r}}();var Kv;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Kv||(Kv={}));var ZG=45*Math.PI/180,eW=1,Vv=.1,$v=500,rW=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),gi=class extends Xp{static get IDENTITY(){return aW()}static get ZERO(){return tW()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Kv}constructor(r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(r)?this.copy(r):this.identity()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this[3]=r[3],this[4]=r[4],this[5]=r[5],this[6]=r[6],this[7]=r[7],this[8]=r[8],this[9]=r[9],this[10]=r[10],this[11]=r[11],this[12]=r[12],this[13]=r[13],this[14]=r[14],this[15]=r[15],this.check()}set(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=t,this[2]=i,this[3]=a,this[4]=n,this[5]=o,this[6]=s,this[7]=u,this[8]=l,this[9]=f,this[10]=h,this[11]=d,this[12]=m,this[13]=y,this[14]=k,this[15]=x,this.check()}setRowMajor(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=n,this[2]=l,this[3]=m,this[4]=t,this[5]=o,this[6]=f,this[7]=y,this[8]=i,this[9]=s,this[10]=h,this[11]=k,this[12]=a,this[13]=u,this[14]=d,this[15]=x,this.check()}toRowMajor(r){return r[0]=this[0],r[1]=this[4],r[2]=this[8],r[3]=this[12],r[4]=this[1],r[5]=this[5],r[6]=this[9],r[7]=this[13],r[8]=this[2],r[9]=this[6],r[10]=this[10],r[11]=this[14],r[12]=this[3],r[13]=this[7],r[14]=this[11],r[15]=this[15],r}identity(){return this.copy(rW)}fromObject(r){return this.check()}fromQuaternion(r){return v4(this,r),this.check()}frustum(r){let{left:t,right:i,bottom:a,top:n,near:o=Vv,far:s=$v}=r;return s===1/0?iW(this,t,i,a,n,o):b4(this,t,i,a,n,o,s),this.check()}lookAt(r){let{eye:t,center:i=[0,0,0],up:a=[0,1,0]}=r;return w4(this,t,i,a),this.check()}ortho(r){let{left:t,right:i,bottom:a,top:n,near:o=Vv,far:s=$v}=r;return x4(this,t,i,a,n,o,s),this.check()}orthographic(r){let{fovy:t=ZG,aspect:i=eW,focalDistance:a=1,near:n=Vv,far:o=$v}=r;k4(t);let s=t/2,u=a*Math.tan(s),l=u*i;return this.ortho({left:-l,right:l,bottom:-u,top:u,near:n,far:o})}perspective(r){let{fovy:t=45*Math.PI/180,aspect:i=1,near:a=.1,far:n=500}=r;return k4(t),y4(this,t,i,a,n),this.check()}determinant(){return l4(this)}getScale(r=[-0,-0,-0]){return r[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),r[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),r[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),r}getTranslation(r=[-0,-0,-0]){return r[0]=this[12],r[1]=this[13],r[2]=this[14],r}getRotation(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=0,r[4]=this[4]*a,r[5]=this[5]*n,r[6]=this[6]*o,r[7]=0,r[8]=this[8]*a,r[9]=this[9]*n,r[10]=this[10]*o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}getRotationMatrix3(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=this[4]*a,r[4]=this[5]*n,r[5]=this[6]*o,r[6]=this[8]*a,r[7]=this[9]*n,r[8]=this[10]*o,r}transpose(){return u4(this,this),this.check()}invert(){return c4(this,this),this.check()}multiplyLeft(r){return Wv(this,r,this),this.check()}multiplyRight(r){return Wv(this,this,r),this.check()}rotateX(r){return h4(this,this,r),this.check()}rotateY(r){return m4(this,this,r),this.check()}rotateZ(r){return g4(this,this,r),this.check()}rotateXYZ(r){return this.rotateX(r[0]).rotateY(r[1]).rotateZ(r[2])}rotateAxis(r,t){return d4(this,this,r,t),this.check()}scale(r){return p4(this,this,Array.isArray(r)?r:[r,r,r]),this.check()}translate(r){return f4(this,this,r),this.check()}transform(r,t){return r.length===4?(t=_4(t||[-0,-0,-0,-0],r,this),Vp(t,4),t):this.transformAsPoint(r,t)}transformAsPoint(r,t){let{length:i}=r,a;switch(i){case 2:a=Qj(t||[-0,-0],r,this);break;case 3:a=Xc(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Vp(a,r.length),a}transformAsVector(r,t){let i;switch(r.length){case 2:i=Jj(t||[-0,-0],r,this);break;case 3:i=Kp(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Vp(i,r.length),i}transformPoint(r,t){return this.transformAsPoint(r,t)}transformVector(r,t){return this.transformAsPoint(r,t)}transformDirection(r,t){return this.transformAsVector(r,t)}makeRotationX(r){return this.identity().rotateX(r)}makeTranslation(r,t,i){return this.identity().translate([r,t,i])}},Qp,Jp;function tW(){return Qp||(Qp=new gi([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Qp)),Qp}function aW(){return Jp||(Jp=new gi,Object.freeze(Jp)),Jp}function k4(e){if(e>Math.PI*2)throw Error("expected radians")}function iW(e,r,t,i,a,n){let o=2*n/(t-r),s=2*n/(a-i),u=(t+r)/(t-r),l=(a+i)/(a-i),f=-1,h=-1,d=-2*n;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=l,e[10]=f,e[11]=h,e[12]=0,e[13]=0,e[14]=d,e[15]=0,e}var ls={};kl(ls,{EPSILON1:()=>nW,EPSILON10:()=>hW,EPSILON11:()=>mW,EPSILON12:()=>gW,EPSILON13:()=>vW,EPSILON14:()=>bW,EPSILON15:()=>yW,EPSILON16:()=>xW,EPSILON17:()=>wW,EPSILON18:()=>_W,EPSILON19:()=>kW,EPSILON2:()=>oW,EPSILON20:()=>SW,EPSILON3:()=>sW,EPSILON4:()=>uW,EPSILON5:()=>cW,EPSILON6:()=>lW,EPSILON7:()=>fW,EPSILON8:()=>pW,EPSILON9:()=>dW,PI_OVER_FOUR:()=>jW,PI_OVER_SIX:()=>AW,PI_OVER_TWO:()=>EW,TWO_PI:()=>TW});var nW=.1,oW=.01,sW=.001,uW=1e-4,cW=1e-5,lW=1e-6,fW=1e-7,pW=1e-8,dW=1e-9,hW=1e-10,mW=1e-11,gW=1e-12,vW=1e-13,bW=1e-14,yW=1e-15,xW=1e-16,wW=1e-17,_W=1e-18,kW=1e-19,SW=1e-20,EW=Math.PI/2,jW=Math.PI/4,AW=Math.PI/6,TW=Math.PI*2;var Hn=6356752314245179e-9,PW={radii:[6378137,6378137,Hn],radiiSquared:[6378137*6378137,6378137*6378137,Hn*Hn],oneOverRadii:[1/6378137,1/6378137,1/Hn],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Hn*Hn)],maximumRadius:Math.max(6378137,6378137,Hn),centerToleranceSquared:.1};function Zp(e){return e}var Une=new Ir;function RW(e,r=[],t=Zp){return"longitude"in e?(r[0]=t(e.longitude),r[1]=t(e.latitude),r[2]=e.height):"x"in e?(r[0]=t(e.x),r[1]=t(e.y),r[2]=e.z):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function S4(e,r=[]){return RW(e,r,It._cartographicRadians?Zp:Iv)}function CW(e,r,t=Zp){return"longitude"in r?(r.longitude=t(e[0]),r.latitude=t(e[1]),r.height=e[2]):"x"in r?(r.x=t(e[0]),r.y=t(e[1]),r.z=e[2]):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function E4(e,r){return CW(e,r,It._cartographicRadians?Zp:Bv)}var j4=1e-14,OW=new Ir,A4={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Yv={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Jc={east:new Ir,north:new Ir,up:new Ir,west:new Ir,south:new Ir,down:new Ir},IW=new Ir,BW=new Ir,FW=new Ir;function Xv(e,r,t,i,a,n){let o=A4[r]&&A4[r][t];mi(o&&(!i||i===o));let s,u,l,f=OW.copy(a);if(Nn(f.x,0,j4)&&Nn(f.y,0,j4)){let d=Math.sign(f.z);s=IW.fromArray(Yv[r]),r!=="east"&&r!=="west"&&s.scale(d),u=BW.fromArray(Yv[t]),t!=="east"&&t!=="west"&&u.scale(d),l=FW.fromArray(Yv[i]),i!=="east"&&i!=="west"&&l.scale(d)}else{let{up:d,east:m,north:y}=Jc;m.set(-f.y,f.x,0).normalize(),e.geodeticSurfaceNormal(f,d),y.copy(d).cross(m);let{down:k,west:x,south:A}=Jc;k.copy(d).scale(-1),x.copy(m).scale(-1),A.copy(y).scale(-1),s=Jc[r],u=Jc[t],l=Jc[i]}return n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=l.x,n[9]=l.y,n[10]=l.z,n[11]=0,n[12]=f.x,n[13]=f.y,n[14]=f.z,n[15]=1,n}var gu=new Ir,DW=new Ir,LW=new Ir;function T4(e,r,t=[]){let{oneOverRadii:i,oneOverRadiiSquared:a,centerToleranceSquared:n}=r;gu.from(e);let o=gu.x,s=gu.y,u=gu.z,l=i.x,f=i.y,h=i.z,d=o*o*l*l,m=s*s*f*f,y=u*u*h*h,k=d+m+y,x=Math.sqrt(1/k);if(!Number.isFinite(x))return;let A=DW;if(A.copy(e).scale(x),k<n)return A.to(t);let P=a.x,T=a.y,B=a.z,C=LW;C.set(A.x*P*2,A.y*T*2,A.z*B*2);let I=(1-x)*gu.len()/(.5*C.len()),F=0,H,N,K,V;do{I-=F,H=1/(1+I*P),N=1/(1+I*T),K=1/(1+I*B);let X=H*H,U=N*N,$=K*K,J=X*H,le=U*N,ve=$*K;V=d*X+m*U+y*$-1;let we=-2*(d*J*P+m*le*T+y*ve*B);F=V/we}while(Math.abs(V)>ls.EPSILON12);return gu.scale([H,N,K]).to(t)}var ed=new Ir,P4=new Ir,zW=new Ir,Hi=new Ir,NW=new Ir,rd=new Ir,Gn=class{constructor(r=0,t=0,i=0){ht(this,"radii",void 0),ht(this,"radiiSquared",void 0),ht(this,"radiiToTheFourth",void 0),ht(this,"oneOverRadii",void 0),ht(this,"oneOverRadiiSquared",void 0),ht(this,"minimumRadius",void 0),ht(this,"maximumRadius",void 0),ht(this,"centerToleranceSquared",ls.EPSILON1),ht(this,"squaredXOverSquaredZ",void 0),mi(r>=0),mi(t>=0),mi(i>=0),this.radii=new Ir(r,t,i),this.radiiSquared=new Ir(r*r,t*t,i*i),this.radiiToTheFourth=new Ir(r*r*r*r,t*t*t*t,i*i*i*i),this.oneOverRadii=new Ir(r===0?0:1/r,t===0?0:1/t,i===0?0:1/i),this.oneOverRadiiSquared=new Ir(r===0?0:1/(r*r),t===0?0:1/(t*t),i===0?0:1/(i*i)),this.minimumRadius=Math.min(r,t,i),this.maximumRadius=Math.max(r,t,i),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(r){return this===r||Boolean(r&&this.radii.equals(r.radii))}toString(){return this.radii.toString()}cartographicToCartesian(r,t=[0,0,0]){let i=P4,a=zW,[,,n]=r;this.geodeticSurfaceNormalCartographic(r,i),a.copy(this.radiiSquared).scale(i);let o=Math.sqrt(i.dot(a));return a.scale(1/o),i.scale(n),a.add(i),a.to(t)}cartesianToCartographic(r,t=[0,0,0]){rd.from(r);let i=this.scaleToGeodeticSurface(rd,Hi);if(!i)return;let a=this.geodeticSurfaceNormal(i,P4),n=NW;n.copy(rd).subtract(i);let o=Math.atan2(a.y,a.x),s=Math.asin(a.z),u=Math.sign(Qc.dot(n,rd))*Qc.length(n);return E4([o,s,u],t)}eastNorthUpToFixedFrame(r,t=new gi){return Xv(this,"east","north","up",r,t)}localFrameToFixedFrame(r,t,i,a,n=new gi){return Xv(this,r,t,i,a,n)}geocentricSurfaceNormal(r,t=[0,0,0]){return ed.from(r).normalize().to(t)}geodeticSurfaceNormalCartographic(r,t=[0,0,0]){let i=S4(r),a=i[0],n=i[1],o=Math.cos(n);return ed.set(o*Math.cos(a),o*Math.sin(a),Math.sin(n)).normalize(),ed.to(t)}geodeticSurfaceNormal(r,t=[0,0,0]){return ed.from(r).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(r,t){return T4(r,this,t)}scaleToGeocentricSurface(r,t=[0,0,0]){Hi.from(r);let i=Hi.x,a=Hi.y,n=Hi.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(i*i*o.x+a*a*o.y+n*n*o.z);return Hi.multiplyScalar(s).to(t)}transformPositionToScaledSpace(r,t=[0,0,0]){return Hi.from(r).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(r,t=[0,0,0]){return Hi.from(r).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(r,t=0,i=[0,0,0]){mi(Nn(this.radii.x,this.radii.y,ls.EPSILON15)),mi(this.radii.z>0),Hi.from(r);let a=Hi.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(a)>=this.radii.z-t))return Hi.set(0,0,a).to(i)}};ht(Gn,"WGS84",new Gn(6378137,6378137,Hn));var R4="4.2.0";var C4,UW=(C4=globalThis.loaders)==null?void 0:C4.parseImageNode,Qv=typeof Image<"u",Jv=typeof ImageBitmap<"u",HW=Boolean(UW),Zv=Zo?!0:HW;function O4(e){switch(e){case"auto":return Jv||Qv||Zv;case"imagebitmap":return Jv;case"image":return Qv;case"data":return Zv;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function I4(){if(Jv)return"imagebitmap";if(Qv)return"image";if(Zv)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function GW(e){let r=WW(e);if(!r)throw new Error("Not an image");return r}function B4(e){switch(GW(e)){case"data":return e;case"image":case"imagebitmap":let r=document.createElement("canvas"),t=r.getContext("2d");if(!t)throw new Error("getImageData");return r.width=e.width,r.height=e.height,t.drawImage(e,0,0),t.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function WW(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var VW=/^data:image\/svg\+xml/,$W=/\.svg((\?|#).*)?$/;function td(e){return e&&(VW.test(e)||$W.test(e))}function F4(e,r){if(td(r)){let i=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(n){throw new Error(n.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return e1(e,r)}function e1(e,r){if(td(r))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ad(e,r,t){let i=F4(e,t),a=self.URL||self.webkitURL,n=typeof i!="string"&&a.createObjectURL(i);try{return await KW(n||i,r)}finally{n&&a.revokeObjectURL(n)}}async function KW(e,r){let t=new Image;return t.src=e,r.image&&r.image.decode&&t.decode?(await t.decode(),t):await new Promise((i,a)=>{try{t.onload=()=>i(t),t.onerror=n=>{let o=n instanceof Error?n.message:"error";a(new Error(o))}}catch(n){a(n)}})}var YW={},D4=!0;async function L4(e,r,t){let i;td(t)?i=await ad(e,r,t):i=e1(e,t);let a=r&&r.imagebitmap;return await XW(i,a)}async function XW(e,r=null){if((QW(r)||!D4)&&(r=null),r)try{return await createImageBitmap(e,r)}catch(t){console.warn(t),D4=!1}return await createImageBitmap(e)}function QW(e){for(let r in e||YW)return!1;return!0}function q4(e){return!rV(e,"ftyp",4)||!(e[8]&96)?null:JW(e)}function JW(e){switch(ZW(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ZW(e,r,t){return String.fromCharCode(...e.slice(r,t))}function eV(e){return[...e].map(r=>r.charCodeAt(0))}function rV(e,r,t=0){let i=eV(r);for(let a=0;a<i.length;++a)if(i[a]!==e[a+t])return!1;return!0}var vn=!1,Zc=!0;function id(e){let r=el(e);return aV(r)||oV(r)||iV(r)||nV(r)||tV(r)}function tV(e){let r=new Uint8Array(e instanceof DataView?e.buffer:e),t=q4(r);return t?{mimeType:t.mimeType,width:0,height:0}:null}function aV(e){let r=el(e);return r.byteLength>=24&&r.getUint32(0,vn)===2303741511?{mimeType:"image/png",width:r.getUint32(16,vn),height:r.getUint32(20,vn)}:null}function iV(e){let r=el(e);return r.byteLength>=10&&r.getUint32(0,vn)===1195984440?{mimeType:"image/gif",width:r.getUint16(6,Zc),height:r.getUint16(8,Zc)}:null}function nV(e){let r=el(e);return r.byteLength>=14&&r.getUint16(0,vn)===16973&&r.getUint32(2,Zc)===r.byteLength?{mimeType:"image/bmp",width:r.getUint32(18,Zc),height:r.getUint32(22,Zc)}:null}function oV(e){let r=el(e);if(!(r.byteLength>=3&&r.getUint16(0,vn)===65496&&r.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:a}=sV(),n=2;for(;n+9<r.byteLength;){let o=r.getUint16(n,vn);if(a.has(o))return{mimeType:"image/jpeg",height:r.getUint16(n+5,vn),width:r.getUint16(n+7,vn)};if(!i.has(o))return null;n+=2,n+=r.getUint16(n,vn)}return null}function sV(){let e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function el(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 M4(e,r){var a;let{mimeType:t}=id(e)||{},i=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return Mi(i),await i(e,t)}async function z4(e,r,t){r=r||{};let a=(r.image||{}).type||"auto",{url:n}=t||{},o=uV(a),s;switch(o){case"imagebitmap":s=await L4(e,r,n);break;case"image":s=await ad(e,r,n);break;case"data":s=await M4(e,r);break;default:Mi(!1)}return a==="data"&&(s=B4(s)),s}function uV(e){switch(e){case"auto":case"data":return I4();default:return O4(e),e}}var cV=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],lV=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],fV={image:{type:"auto",decode:!0}},nd={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:R4,mimeTypes:lV,extensions:cV,parse:z4,tests:[e=>Boolean(id(new DataView(e)))],options:fV};var N4="4.2.0";var U4={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:N4,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function G4(e,r,t){let i=W4(r.metadata),a=[],n=pV(r.attributes);for(let o in e){let s=e[o],u=H4(o,s,n[o]);a.push(u)}if(t){let o=H4("indices",t);a.push(o)}return{fields:a,metadata:i}}function pV(e){let r={};for(let t in e){let i=e[t];r[i.name||"undefined"]=i}return r}function H4(e,r,t){let i=t?W4(t.metadata):void 0;return Rv(e,r,i)}function W4(e){Object.entries(e);let r={};for(let t in e)r[`${t}.string`]=JSON.stringify(e[t]);return r}var V4={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},dV={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},hV=4,rl=class{draco;decoder;metadataQuerier;constructor(r){this.draco=r,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(r,t={}){let i=new this.draco.DecoderBuffer;i.Init(new Int8Array(r),r.byteLength),this._disableAttributeTransforms(t);let a=this.decoder.GetEncodedGeometryType(i),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(a){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,n);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!n.ptr){let d=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(d)}let s=this._getDracoLoaderData(n,a,t),u=this._getMeshData(n,s,t),l=Pv(u.attributes),f=G4(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:l},...u,schema:f}}finally{this.draco.destroy(i),n&&this.draco.destroy(n)}}_getDracoLoaderData(r,t,i){let a=this._getTopLevelMetadata(r),n=this._getDracoAttributes(r,i);return{geometry_type:t,num_attributes:r.num_attributes(),num_points:r.num_points(),num_faces:r instanceof this.draco.Mesh?r.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(r,t){let i={};for(let a=0;a<r.num_attributes();a++){let n=this.decoder.GetAttribute(r,a),o=this._getAttributeMetadata(r,a);i[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:o};let s=this._getQuantizationTransform(n,t);s&&(i[n.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(n,t);u&&(i[n.unique_id()].octahedron_transform=u)}return i}_getMeshData(r,t,i){let a=this._getMeshAttributes(t,r,i);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(r instanceof this.draco.Mesh)switch(i.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(r),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(r),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(r,t,i){let a={};for(let n of Object.values(r.attributes)){let o=this._deduceAttributeName(n,i);n.name=o;let s=this._getAttributeValues(t,n);if(s){let{value:u,size:l}=s;a[o]={value:u,size:l,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}}return a}_getTriangleListIndices(r){let i=r.num_faces()*3,a=i*hV,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(r,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,i).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(r){let t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(r,t),vV(t)}finally{this.draco.destroy(t)}}_getAttributeValues(r,t){let i=dV[t.data_type];if(!i)return console.warn(`DRACO: Unsupported attribute type ${t.data_type}`),null;let a=t.num_components,o=r.num_points()*a,s=o*i.BYTES_PER_ELEMENT,u=mV(this.draco,i),l,f=this.draco._malloc(s);try{let h=this.decoder.GetAttribute(r,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(r,h,u,s,f),l=new i(this.draco.HEAPF32.buffer,f,o).slice()}finally{this.draco._free(f)}return{value:l,size:a}}_deduceAttributeName(r,t){let i=r.unique_id;for(let[o,s]of Object.entries(t.extraAttributes||{}))if(s===i)return o;let a=r.attribute_type;for(let o in V4)if(this.draco[o]===a)return V4[o];let n=t.attributeNameEntry||"name";return r.metadata[n]?r.metadata[n].string:`CUSTOM_ATTRIBUTE_${i}`}_getTopLevelMetadata(r){let t=this.decoder.GetMetadata(r);return this._getDracoMetadata(t)}_getAttributeMetadata(r,t){let i=this.decoder.GetAttributeMetadata(r,t);return this._getDracoMetadata(i)}_getDracoMetadata(r){if(!r||!r.ptr)return{};let t={},i=this.metadataQuerier.NumEntries(r);for(let a=0;a<i;a++){let n=this.metadataQuerier.GetEntryName(r,a);t[n]=this._getDracoMetadataField(r,n)}return t}_getDracoMetadataField(r,t){let i=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(r,t,i);let a=gV(i);return{int:this.metadataQuerier.GetIntEntry(r,t),string:this.metadataQuerier.GetStringEntry(r,t),double:this.metadataQuerier.GetDoubleEntry(r,t),intArray:a}}finally{this.draco.destroy(i)}}_disableAttributeTransforms(r){let{quantizedAttributes:t=[],octahedronAttributes:i=[]}=r,a=[...t,...i];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(r,t){let{quantizedAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))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(r,t){let{octahedronAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function mV(e,r){switch(r){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 gV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}function vV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}var bV="1.5.6",yV="1.4.1",r1=`https://www.gstatic.com/draco/versioned/decoders/${bV}`,Ha={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},t1={[Ha.DECODER]:`${r1}/${Ha.DECODER}`,[Ha.DECODER_WASM]:`${r1}/${Ha.DECODER_WASM}`,[Ha.FALLBACK_DECODER]:`${r1}/${Ha.FALLBACK_DECODER}`,[Ha.ENCODER]:`https://raw.githubusercontent.com/google/draco/${yV}/javascript/${Ha.ENCODER}`},a1;async function $4(e){let r=e.modules||{};return r.draco3d?a1||=r.draco3d.createDecoderModule({}).then(t=>({draco:t})):a1||=xV(e),await a1}async function xV(e){let r,t;switch(e.draco&&e.draco.decoderType){case"js":r=await gn(t1[Ha.FALLBACK_DECODER],"draco",e,Ha.FALLBACK_DECODER);break;case"wasm":default:[r,t]=await Promise.all([await gn(t1[Ha.DECODER],"draco",e,Ha.DECODER),await gn(t1[Ha.DECODER_WASM],"draco",e,Ha.DECODER_WASM)])}return r=r||globalThis.DracoDecoderModule,await wV(r,t)}function wV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e({...t,onModuleLoaded:a=>i({draco:a})})})}var K4={...U4,parse:_V};async function _V(e,r){let{draco:t}=await $4(r),i=new rl(t);try{return i.parseSync(e,r==null?void 0:r.draco)}finally{i.destroy()}}var od="4.2.0";var sd={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Y4;async function n1(e){Wg(e.modules);let r=Vg("basis");return r||(Y4||=kV(e),await Y4)}async function kV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(sd.TRANSCODER,"textures",e),await gn(sd.TRANSCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await SV(r,t)}function SV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,initializeBasis:o}=a;o(),i({BasisFile:n})})})}var i1;async function o1(e){let r=e.modules||{};return r.basisEncoder?r.basisEncoder:(i1=i1||EV(e),await i1)}async function EV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(sd.ENCODER,"textures",e),await gn(sd.ENCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await jV(r,t)}function jV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,KTX2File:o,initializeBasis:s,BasisEncoder:u}=a;s(),i({BasisFile:n,KTX2File:o,BasisEncoder:u})})})}var ce={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 AV=["","WEBKIT_","MOZ_"],X4={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"},ud=null;function Q4(e){if(!ud){e=e||TV()||void 0,ud=new Set;for(let r of AV)for(let t in X4)if(e&&e.getExtension(`${r}${t}`)){let i=X4[t];ud.add(i)}}return ud}function TV(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var cA=Jt(sA(),1);function vu(e,r){let t=new Array(r.mipMapLevels),i=r.width,a=r.height,n=0;for(let o=0;o<r.mipMapLevels;++o){let s=CV(r,i,a,e,o),u=RV(e,o,n,s);t[o]={compressed:!0,format:r.internalFormat,data:u,width:i,height:a,levelSize:s},i=Math.max(1,i>>1),a=Math.max(1,a>>1),n+=s}return t}function RV(e,r,t,i){return Array.isArray(e)?e[r].levelData:new Uint8Array(e.buffer,e.byteOffset+t,i)}function CV(e,r,t,i,a){return Array.isArray(i)?e.sizeFunction(i[a]):e.sizeFunction(r,t)}var OV={131:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,132:ce.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:ce.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:ce.COMPRESSED_RED_RGTC1_EXT,140:ce.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:ce.COMPRESSED_RED_GREEN_RGTC2_EXT,142:ce.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:ce.COMPRESSED_RGB8_ETC2,148:ce.COMPRESSED_SRGB8_ETC2,149:ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:ce.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:ce.COMPRESSED_RGBA8_ETC2_EAC,152:ce.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:ce.COMPRESSED_R11_EAC,154:ce.COMPRESSED_SIGNED_R11_EAC,155:ce.COMPRESSED_RG11_EAC,156:ce.COMPRESSED_SIGNED_RG11_EAC,157:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,158:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,160:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,162:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,164:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,166:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,168:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,170:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,172:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,174:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,176:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,178:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,180:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,182:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:ce.COMPRESSED_RGBA_ASTC_12x12_KHR,184:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:ce.COMPRESSED_RGBA_ASTC_12x12_KHR};function uA(e){return OV[e]}var Ja=[171,75,84,88,32,50,48,187,13,10,26,10];function dd(e){let r=new Uint8Array(e);return!(r.byteLength<Ja.length||r[0]!==Ja[0]||r[1]!==Ja[1]||r[2]!==Ja[2]||r[3]!==Ja[3]||r[4]!==Ja[4]||r[5]!==Ja[5]||r[6]!==Ja[6]||r[7]!==Ja[7]||r[8]!==Ja[8]||r[9]!==Ja[9]||r[10]!==Ja[10]||r[11]!==Ja[11])}function lA(e){let r=new Uint8Array(e),t=(0,cA.read)(r),i=Math.max(1,t.levels.length),a=t.pixelWidth,n=t.pixelHeight,o=uA(t.vkFormat);return vu(t.levels,{mipMapLevels:i,width:a,height:n,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var IV={etc1:{basisFormat:0,compressed:!0,format:ce.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ce.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ce.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:ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ce.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 al(e,r){if(r.basis.containerFormat==="auto"){if(dd(e)){let i=await o1(r);return fA(i.KTX2File,e,r)}let{BasisFile:t}=await n1(r);return f1(t,e,r)}switch(r.basis.module){case"encoder":let t=await o1(r);switch(r.basis.containerFormat){case"ktx2":return fA(t.KTX2File,e,r);case"basis":default:return f1(t.BasisFile,e,r)}case"transcoder":default:let{BasisFile:i}=await n1(r);return f1(i,e,r)}}function f1(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("Failed to start basis transcoding");let a=i.getNumImages(),n=[];for(let o=0;o<a;o++){let s=i.getNumLevels(o),u=[];for(let l=0;l<s;l++)u.push(BV(i,o,l,t));n.push(u)}return n}finally{i.close(),i.delete()}}function BV(e,r,t,i){let a=e.getImageWidth(r,t),n=e.getImageHeight(r,t),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:l}=pA(i,o),f=e.getImageTranscodedSizeInBytes(r,t,l),h=new Uint8Array(f);if(!e.transcodeImage(h,r,t,l,0,0))throw new Error("failed to start Basis transcoding");return{width:a,height:n,data:h,compressed:s,format:u,hasAlpha:o}}function fA(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("failed to start KTX2 transcoding");let a=i.getLevels(),n=[];for(let o=0;o<a;o++){n.push(FV(i,o,t));break}return[n]}finally{i.close(),i.delete()}}function FV(e,r,t){let{alphaFlag:i,height:a,width:n}=e.getImageLevelInfo(r,0,0),{compressed:o,format:s,basisFormat:u}=pA(t,i),l=e.getImageTranscodedSizeInBytes(r,0,0,u),f=new Uint8Array(l);if(!e.transcodeImage(f,r,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:n,height:a,data:f,compressed:o,levelSize:l,hasAlpha:i,format:s}}function pA(e,r){let t=e&&e.basis&&e.basis.format;return t==="auto"&&(t=DV()),typeof t=="object"&&(t=r?t.alpha:t.noAlpha),t=t.toLowerCase(),IV[t]}function DV(){let e=Q4();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 dA={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:od,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"}}},il={...dA,parse:al};var Za={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},LV={DXT1:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":ce.COMPRESSED_RGB_ATC_WEBGL,ATCA:ce.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:ce.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},qV=gA,MV=hd,zV=hd,NV={DXT1:gA,DXT3:hd,DXT5:hd,"ATC ":qV,ATCA:MV,ATCI:zV};function hA(e){return new Uint32Array(e,0,Za.HEADER_LENGTH)[Za.MAGIC_NUMBER_INDEX]===Za.MAGIC_NUMBER}function mA(e){let r=new Int32Array(e,0,Za.HEADER_LENGTH),t=r[Za.HEADER_PF_FOURCC_INDEX];Mi(Boolean(r[Za.HEADER_PF_FLAGS_INDEX]&Za.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let i=UV(t),a=LV[i],n=NV[i];Mi(a&&n,`DDS: Unknown pixel format ${t}`);let o=1;r[Za.HEADER_FLAGS_INDEX]&Za.DDSD_MIPMAPCOUNT&&(o=Math.max(1,r[Za.MIPMAPCOUNT_INDEX]));let s=r[Za.HEADER_WIDTH_INDEX],u=r[Za.HEADER_HEIGHT_INDEX],l=r[Za.HEADER_SIZE_INDEX]+4,f=new Uint8Array(e,l);return vu(f,{mipMapLevels:o,width:s,height:u,sizeFunction:n,internalFormat:a})}function gA(e,r){return(e+3>>2)*(r+3>>2)*8}function hd(e,r){return(e+3>>2)*(r+3>>2)*16}function UV(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var vi={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},HV={0:[ce.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[ce.COMPRESSED_RGB_ETC1_WEBGL],7:[ce.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[ce.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[ce.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[ce.COMPRESSED_RGB8_ETC2],23:[ce.COMPRESSED_RGBA8_ETC2_EAC],24:[ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[ce.COMPRESSED_R11_EAC],26:[ce.COMPRESSED_RG11_EAC],27:[ce.COMPRESSED_RGBA_ASTC_4X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[ce.COMPRESSED_RGBA_ASTC_5X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[ce.COMPRESSED_RGBA_ASTC_5X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[ce.COMPRESSED_RGBA_ASTC_6X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[ce.COMPRESSED_RGBA_ASTC_6X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[ce.COMPRESSED_RGBA_ASTC_8X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[ce.COMPRESSED_RGBA_ASTC_8X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[ce.COMPRESSED_RGBA_ASTC_8X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[ce.COMPRESSED_RGBA_ASTC_10X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[ce.COMPRESSED_RGBA_ASTC_10X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[ce.COMPRESSED_RGBA_ASTC_10X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[ce.COMPRESSED_RGBA_ASTC_10X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[ce.COMPRESSED_RGBA_ASTC_12X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[ce.COMPRESSED_RGBA_ASTC_12X12_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},GV={0:vA,1:vA,2:bA,3:bA,6:nl,7:nl,9:ol,11:ol,22:nl,23:ol,24:nl,25:nl,26:ol,27:ol,28:WV,29:VV,30:$V,31:KV,32:YV,33:XV,34:QV,35:JV,36:ZV,37:e$,38:r$,39:t$,40:a$};function yA(e){let t=new Uint32Array(e,0,vi.HEADER_LENGTH)[vi.MAGIC_NUMBER_INDEX];return t===vi.MAGIC_NUMBER||t===vi.MAGIC_NUMBER_EXTRA}function xA(e){let r=new Uint32Array(e,0,vi.HEADER_LENGTH),t=r[vi.PIXEL_FORMAT_INDEX],i=r[vi.COLOUR_SPACE_INDEX],a=HV[t]||[],n=a.length>1&&i?a[1]:a[0],o=GV[t],s=r[vi.MIPMAPCOUNT_INDEX],u=r[vi.WIDTH_INDEX],l=r[vi.HEIGHT_INDEX],f=vi.HEADER_SIZE+r[vi.METADATA_SIZE_INDEX],h=new Uint8Array(e,f);return vu(h,{mipMapLevels:s,width:u,height:l,sizeFunction:o,internalFormat:n})}function vA(e,r){return e=Math.max(e,16),r=Math.max(r,8),e*r/4}function bA(e,r){return e=Math.max(e,8),r=Math.max(r,8),e*r/2}function nl(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*8}function ol(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*16}function WV(e,r){return Math.floor((e+4)/5)*Math.floor((r+3)/4)*16}function VV(e,r){return Math.floor((e+4)/5)*Math.floor((r+4)/5)*16}function $V(e,r){return Math.floor((e+5)/6)*Math.floor((r+4)/5)*16}function KV(e,r){return Math.floor((e+5)/6)*Math.floor((r+5)/6)*16}function YV(e,r){return Math.floor((e+7)/8)*Math.floor((r+4)/5)*16}function XV(e,r){return Math.floor((e+7)/8)*Math.floor((r+5)/6)*16}function QV(e,r){return Math.floor((e+7)/8)*Math.floor((r+7)/8)*16}function JV(e,r){return Math.floor((e+9)/10)*Math.floor((r+4)/5)*16}function ZV(e,r){return Math.floor((e+9)/10)*Math.floor((r+5)/6)*16}function e$(e,r){return Math.floor((e+9)/10)*Math.floor((r+7)/8)*16}function r$(e,r){return Math.floor((e+9)/10)*Math.floor((r+9)/10)*16}function t$(e,r){return Math.floor((e+11)/12)*Math.floor((r+9)/10)*16}function a$(e,r){return Math.floor((e+11)/12)*Math.floor((r+11)/12)*16}function wA(e){if(dd(e))return lA(e);if(hA(e))return mA(e);if(yA(e))return xA(e);throw new Error("Texture container format not recognized")}var _A={dataType:null,batchType:null,name:"Texture Containers",id:"compressed-texture",module:"textures",version:od,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:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},md={..._A,parse:async(e,r)=>{var t;return(t=r==null?void 0:r["compressed-texture"])!=null&&t.useBasis?(r.basis={format:{alpha:"BC3",noAlpha:"BC1"},...r.basis,containerFormat:"ktx2",module:"encoder"},(await al(e,r))[0]):wA(e)}};function kA(e,r=null){return r?`${e}?token=${r}`:e}var i$={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},n$={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},fs={...i$,...n$};function p1(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 SA={UInt8:fs.UNSIGNED_BYTE,UInt16:fs.UNSIGNED_SHORT,Float32:fs.FLOAT,UInt32:fs.UNSIGNED_INT,UInt64:fs.DOUBLE};function bu(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 gd=new Ir([0,0,0]);function o$(e){switch(e){case"ktx-etc2":case"dds":return md;case"ktx2":return il;case"jpg":case"png":default:return nd}}var s$="i3s-attribute-type";async function TA(e,r,t,i,a){var o;let n={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new gi,coordinateSystem:0,byteLength:0,texture:null};if(r.textureUrl){let s=kA(r.textureUrl,(o=i==null?void 0:i.i3s)==null?void 0:o.token),u=o$(r.textureFormat),h=await(await((a==null?void 0:a.fetch)||fetch)(s)).arrayBuffer();if(i!=null&&i.i3s.decodeTextures){if(u===nd){let d={...r.textureLoaderOptions,image:{type:"data"}};try{let m=await zg(h,[],d,a);n.texture=m}catch{let y=await zn(h,u,d,a);n.texture=y}}else if(u===md||u===il){let d=await Cv(h,u,r.textureLoaderOptions);u===il&&(d=d[0]),n.texture={compressed:!0,mipmaps:!1,width:d[0].width,height:d[0].height,data:d}}}else n.texture=h}return n.material=g$(r.materialDefinition,n.texture),n.material&&(n.texture=null),await u$(e,n,r,t,i)}async function u$(e,r,t,i,a){var h,d;let n=e.byteLength,o,s,u=0,l=0,f;if(t.isDracoGeometry){let m=await zn(e,K4,{draco:{attributeNameEntry:s$}});s=m.header.vertexCount,f=(h=m.indices)==null?void 0:h.value;let{POSITION:y,NORMAL:k,COLOR_0:x,TEXCOORD_0:A,["feature-index"]:P,["uv-region"]:T}=m.attributes;o={position:y,normal:k,color:x,uv0:A,uvRegion:T,id:P},c$(o,m);let B=x$(P);B&&y$(o,B)}else{let{vertexAttributes:m,ordering:y,featureAttributes:k,featureAttributeOrder:x}=i.store.defaultGeometrySchema,A=f$(e,i);u=A.byteOffset,s=A.vertexCount,l=A.featureCount;let{attributes:P,byteOffset:T}=jA(e,u,m,s,y),{attributes:B}=jA(e,T,k,l,x);b$(B),o=l$(P,B)}if(!((d=a==null?void 0:a.i3s)!=null&&d.coordinateSystem)||a.i3s.coordinateSystem===2){let m=d$(o.position,t);r.modelMatrix=m.invert(),r.coordinateSystem=2}else r.modelMatrix=m$(o.position),r.coordinateSystem=3;r.attributes={positions:o.position,normals:o.normal,colors:EA(o.color),texCoords:o.uv0,uvRegions:EA(o.uvRegion||o.region)},r.indices=f||null,o.id&&o.id.value&&(r.featureIds=o.id.value);for(let m in r.attributes)r.attributes[m]||delete r.attributes[m];return r.vertexCount=s,r.byteLength=n,r}function c$(e,r){for(let t in r.loaderData.attributes){let i=r.loaderData.attributes[t];switch(i.name){case"POSITION":e.position.metadata=i.metadata;break;case"feature-index":e.id.metadata=i.metadata;break;default:break}}}function l$(e,r){return{...e,...r}}function EA(e){return e&&(e.normalized=!0,e)}function f$(e,r){let t=0,i=0,a=0;for(let{property:n,type:o}of r.store.defaultGeometrySchema.header){let s=p1(o);switch(n){case"vertexCount".toString():i=new s(e,0,4)[0],t+=bu(o);break;case"featureCount".toString():a=new s(e,4,4)[0],t+=bu(o);break;default:break}}return{vertexCount:i,featureCount:a,byteOffset:t}}function jA(e,r,t,i,a){let n={};for(let o of a)if(t[o]){let{valueType:s,valuesPerElement:u}=t[o];if(r+i*u*bu(s)<=e.byteLength){let l=e.slice(r),f;if(s==="UInt64")f=p$(l,i*u,bu(s));else{let h=p1(s);f=new h(l,0,i*u)}switch(n[o]={value:f,type:SA[s],size:u},o){case"color":n.color.normalized=!0;break;case"position":case"region":case"normal":default:}r=r+i*u*bu(s)}else if(o!=="uv0")break}return{attributes:n,byteOffset:r}}function p$(e,r,t){let i=[],a=new DataView(e),n=0;for(let o=0;o<r;o++){let s=a.getUint32(n,!0),u=a.getUint32(n+4,!0),l=s+2**32*u;i.push(l),n+=t}return new Uint32Array(i)}function d$(e,r){let t=r.mbs,i=e.value,a=e.metadata,n=new gi,o=new Ir(t[0],t[1],t[2]),s=new Ir;return Gn.WGS84.cartographicToCartesian(o,s),Gn.WGS84.eastNorthUpToFixedFrame(s,n),e.value=h$(i,a,o),n}function h$(e,r={},t){let i=new Float64Array(e.length),a=r["i3s-scale_x"]&&r["i3s-scale_x"].double||1,n=r["i3s-scale_y"]&&r["i3s-scale_y"].double||1;for(let o=0;o<i.length;o+=3)i[o]=e[o]*a+t.x,i[o+1]=e[o+1]*n+t.y,i[o+2]=e[o+2]+t.z;for(let o=0;o<i.length;o+=3)Gn.WGS84.cartographicToCartesian(i.subarray(o,o+3),gd),i[o]=gd.x,i[o+1]=gd.y,i[o+2]=gd.z;return i}function m$(e){var n,o;let r=e.metadata,t=((n=r==null?void 0:r["i3s-scale_x"])==null?void 0:n.double)||1,i=((o=r==null?void 0:r["i3s-scale_y"])==null?void 0:o.double)||1,a=new gi;return a[0]=t,a[5]=i,a}function g$(e,r){let t;return e?t={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(t={pbrMetallicRoughness:{}},r?t.pbrMetallicRoughness.baseColorTexture={texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),t.alphaCutoff=t.alphaCutoff||.25,t.alphaMode&&(t.alphaMode=t.alphaMode.toUpperCase()),t.emissiveFactor&&(t.emissiveFactor=AA(t.emissiveFactor)),t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorFactor&&(t.pbrMetallicRoughness.baseColorFactor=AA(t.pbrMetallicRoughness.baseColorFactor)),r&&v$(t,r),t}function AA(e){let r=[...e];for(let t=0;t<e.length;t++)r[t]=e[t]/255;return r}function v$(e,r){let t={source:{image:r}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:t}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:t}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:t}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:t}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:t})}function b$(e){let{id:r,faceRange:t}=e;if(!r||!t)return;let i=r.value,a=t.value,n=a[a.length-1]+1,o=new Uint32Array(n*3),s=0,u=0;for(let l=1;l<a.length;l+=2){let f=Number(i[s]),h=a[l],d=a[l-1],m=h-d+1,y=u+m*3;o.fill(f,u,y),s++,u=y}e.id.value=o}function y$(e,r){let t=e.id.value,i=new Float32Array(t.length);for(let a=0;a<t.length;a++)i[a]=r[t[a]];e.id.value=i}function x$(e){var r,t;return(t=(r=e==null?void 0:e.metadata)==null?void 0:r["i3s-feature-ids"])==null?void 0:t.intArray}var w$="4.2.0",PA={dataType:null,batchType:null,name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:w$,mimeTypes:["application/octet-stream"],parse:_$,extensions:["bin"],options:{"i3s-content":{}}};async function _$(e,r,t){let{tile:i,_tileOptions:a,tileset:n,_tilesetOptions:o}=(r==null?void 0:r.i3s)||{},s=a||i,u=o||n;return!s||!u?null:await TA(e,s,u,r,t)}ev(PA);
100
+ }`}function qc(e,r=!0,t){let i=t||new Set;if(e){if($5(e))i.add(e);else if($5(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(r&&typeof e=="object")for(let a in e)qc(e[a],r,i)}}return t===void 0?Array.from(i):[]}function $5(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var Yg=()=>{},Eo=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&oa||typeof Lc<"u"&&!oa}constructor(r){let{name:t,source:i,url:a}=r;ma(i||a),this.name=t,this.source=i,this.url=a,this.onMessage=Yg,this.onError=n=>console.log(n),this.worker=oa?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Yg,this.onError=Yg,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(r,t){t=t||qc(r),this.worker.postMessage(r,t)}_getErrorFromErrorEvent(r){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,r.message&&(t+=`${r.message} in `),r.lineno&&(t+=`:${r.lineno}:${r.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=W5({source:this.source,url:this.url});let r=new Worker(this._loadableURL,{name:this.name});return r.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},r.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},r.onmessageerror=t=>console.error(t),r}_createNodeWorker(){let r;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;r=new Lc(i,{eval:!1})}else if(this.source)r=new Lc(this.source,{eval:!0});else throw new Error("no worker");return r.on("message",t=>{this.onMessage(t)}),r.on("error",t=>{this.onError(t)}),r.on("exit",t=>{}),r}};var Mc=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Eo.isSupported()}constructor(r){this.source=r.source,this.url=r.url,this.setProps(r)}destroy(){this.idleQueue.forEach(r=>r.destroy()),this.isDestroyed=!0}setProps(r){this.props={...this.props,...r},r.name!==void 0&&(this.name=r.name),r.maxConcurrency!==void 0&&(this.maxConcurrency=r.maxConcurrency),r.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=r.maxMobileConcurrency),r.reuseWorkers!==void 0&&(this.reuseWorkers=r.reuseWorkers),r.onDebug!==void 0&&(this.onDebug=r.onDebug)}async startJob(r,t=(a,n,o)=>a.done(o),i=(a,n)=>a.error(n)){let a=new Promise(n=>(this.jobQueue.push({name:r,onMessage:t,onError:i,onStart:n}),this));return this._startQueuedJob(),await a}async _startQueuedJob(){if(!this.jobQueue.length)return;let r=this._getAvailableWorker();if(!r)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:r,backlog:this.jobQueue.length});let i=new Fc(t.name,r);r.onMessage=a=>t.onMessage(i,a.type,a.payload),r.onError=a=>t.onError(i,a),t.onStart(i);try{await i.result}catch(a){console.error(`Worker exception: ${a}`)}finally{this.returnWorkerToQueue(r)}}}returnWorkerToQueue(r){!oa||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(r.destroy(),this.count--):this.idleQueue.push(r),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let r=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Eo({name:r,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return G5?this.maxMobileConcurrency:this.maxConcurrency}};var WU={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},ts=class{props;workerPools=new Map;static isSupported(){return Eo.isSupported()}static getWorkerFarm(r={}){return ts._workerFarm=ts._workerFarm||new ts({}),ts._workerFarm.setProps(r),ts._workerFarm}constructor(r){this.props={...WU},this.setProps(r),this.workerPools=new Map}destroy(){for(let r of this.workerPools.values())r.destroy();this.workerPools=new Map}setProps(r){this.props={...this.props,...r};for(let t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(r){let{name:t,source:i,url:a}=r,n=this.workerPools.get(t);return n||(n=new Mc({name:t,source:i,url:a}),n.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,n)),n}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},jo=ts;W1(jo,"_workerFarm");async function as(){return $g}var Xg=new Map,Qa=class{static async inWorkerThread(){return typeof self<"u"||Boolean(await as())}static set onmessage(r){async function t(i){let a=await as(),{type:n,payload:o}=a?i:i.data;r(n,o)}as().then(i=>{i?(i.on("message",a=>{t(a)}),i.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=t})}static async addEventListener(r){let t=Xg.get(r);t||(t=async a=>{if(!VU(a))return;let n=await as(),{type:o,payload:s}=n?a:a.data;r(o,s)}),await as()?console.error("not implemented"):globalThis.addEventListener("message",t)}static async removeEventListener(r){let t=Xg.get(r);Xg.delete(r),await as()?console.error("not implemented"):globalThis.removeEventListener("message",t)}static async postMessage(r,t){let i={source:"loaders.gl",type:r,payload:t},a=qc(t),n=await as();n?n.postMessage(i,a):globalThis.postMessage(i,a)}};function VU(e){let{type:r,data:t}=e;return r==="message"&&t&&typeof t.source=="string"&&t.source.startsWith("loaders.gl")}function Qg(e,r={}){let t=r[e.id]||{},i=oa?`${e.id}-worker.js`:`${e.id}-worker-node.js`,a=t.workerUrl;if(!a&&e.id==="compression"&&(a=r.workerUrl),r._workerType==="test"&&(oa?a=`modules/${e.module}/dist/${i}`:a=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!a){let n=e.version;n==="latest"&&(n=U5);let o=n?`@${n}`:"";a=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${i}`}return ma(a),a}function Jg(e,r=Ic){ma(e,"no worker provided");let t=e.version;return!(!r||!t)}var Zg={};async function gn(e,r=null,t={},i=null){return r&&(e=K5(e,r,t,i)),Zg[e]=Zg[e]||$U(e),await Zg[e]}function K5(e,r,t={},i=null){if(!t.useLocalLibraries&&e.startsWith("http"))return e;i=i||e;let a=t.modules||{};return a[i]?a[i]:oa?t.CDN?(ma(t.CDN.startsWith("http")),`${t.CDN}/${r}@${Ic}/dist/libs/${i}`):Bc?`../src/libs/${i}`:`modules/${r}/src/libs/${i}`:`modules/${r}/dist/libs/${i}`}async function $U(e){if(e.endsWith("wasm"))return await YU(e);if(!oa)try{let{requireFromFile:t}=globalThis.loaders||{};return await(t==null?void 0:t(e))}catch(t){return console.error(t),null}if(Bc)return importScripts(e);let r=await XU(e);return KU(r,e)}function KU(e,r){if(!oa){let{requireFromString:i}=globalThis.loaders||{};return i==null?void 0:i(e,r)}if(Bc)return eval.call(globalThis,e),null;let t=document.createElement("script");t.id=r;try{t.appendChild(document.createTextNode(e))}catch{t.text=e}return document.body.appendChild(t),null}async function YU(e){let{readFileAsArrayBuffer:r}=globalThis.loaders||{};return oa||!r||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await r(e)}async function XU(e){let{readFileAsText:r}=globalThis.loaders||{};return oa||!r||e.startsWith("http")?await(await fetch(e)).text():await r(e)}var QU=0;async function ev(e){await Qa.inWorkerThread()&&(Qa.onmessage=async(r,t)=>{switch(r){case"process":try{let{input:i,options:a={},context:n={}}=t,o=await ZU({loader:e,arrayBuffer:i,options:a,context:{...n,_parse:JU}});Qa.postMessage("done",{result:o})}catch(i){let a=i instanceof Error?i.message:"";Qa.postMessage("error",{error:a})}break;default:}})}function JU(e,r,t,i){return new Promise((a,n)=>{let o=QU++,s=(l,f)=>{if(f.id===o)switch(l){case"done":Qa.removeEventListener(s),a(f.result);break;case"error":Qa.removeEventListener(s),n(f.error);break;default:}};Qa.addEventListener(s);let u={id:o,input:e,options:t};Qa.postMessage("process",u)})}async function ZU({loader:e,arrayBuffer:r,options:t,context:i}){let a,n;if(e.parseSync||e.parse)a=r,n=e.parseSync||e.parse;else if(e.parseTextSync)a=new TextDecoder().decode(r),n=e.parseTextSync;else throw new Error(`Could not load data with ${e.name} loader`);return t={...t,modules:e&&e.options&&e.options.modules||{},worker:!1},await n(a,{...t},i,e)}function rv(e,r){return!jo.isSupported()||!oa&&!(r!=null&&r._nodeWorkers)?!1:e.worker&&(r==null?void 0:r.worker)}async function tv(e,r,t,i,a){let n=e.id,o=Qg(e,t),u=jo.getWorkerFarm(t).getWorkerPool({name:n,url:o});t=JSON.parse(JSON.stringify(t)),i=JSON.parse(JSON.stringify(i||{}));let l=await u.startJob("process-on-worker",eH.bind(null,a));return l.postMessage("process",{input:r,options:t,context:i}),await(await l.result).result}async function eH(e,r,t,i){switch(t){case"done":r.done(i);break;case"error":r.error(new Error(i.error));break;case"process":let{id:a,input:n,options:o}=i;try{let s=await e(n,o);r.postMessage("done",{id:a,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";r.postMessage("error",{id:a,error:u})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function av(e,r,t){if(t=t||e.byteLength,e.byteLength<t||r.byteLength<t)return!1;let i=new Uint8Array(e),a=new Uint8Array(r);for(let n=0;n<i.length;++n)if(i[n]!==a[n])return!1;return!0}function iv(...e){return Y5(e)}function Y5(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}async function zc(e){let r=[];for await(let t of e)r.push(t);return iv(...r)}var rH="",X5={};function is(e){for(let r in X5)if(e.startsWith(r)){let t=X5[r];e=e.replace(r,t)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${rH}${e}`),e}function Q5(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function J5(e){return e&&typeof e=="object"&&e.isBuffer}function Ep(e){if(J5(e))return Q5(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 r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var ns={};kl(ns,{dirname:()=>iH,filename:()=>aH,join:()=>nH,resolve:()=>oH});function Z5(){var r;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(r=window.location)==null?void 0:r.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function aH(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(r+1):""}function iH(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(0,r):""}function nH(...e){let r="/";return e=e.map((t,i)=>(i&&(t=t.replace(new RegExp(`^${r}`),"")),i!==e.length-1&&(t=t.replace(new RegExp(`${r}$`),"")),t)),e.join(r)}function oH(...e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n];let t="",i=!1,a;for(let n=r.length-1;n>=-1&&!i;n--){let o;n>=0?o=r[n]:(a===void 0&&(a=Z5()),o=a),o.length!==0&&(t=`${o}/${t}`,i=o.charCodeAt(0)===Nc)}return t=sH(t,!i),i?`/${t}`:t.length>0?t:"."}var Nc=47,nv=46;function sH(e,r){let t="",i=-1,a=0,n,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(n===Nc)break;n=Nc}if(n===Nc){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==nv||t.charCodeAt(t.length-2)!==nv){if(t.length>2){let u=t.length-1,l=u;for(;l>=0&&t.charCodeAt(l)!==Nc;--l);if(l!==u){t=l===-1?"":t.slice(0,l),i=s,a=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",i=s,a=0,o=!1;continue}}r&&(t.length>0?t+="/..":t="..",o=!0)}else{let u=e.slice(i+1,s);t.length>0?t+=`/${u}`:t=u,o=!1}i=s,a=0}else n===nv&&a!==-1?++a:a=-1}return t}var qn=Jt(require("fs"),1),os=class{handle;size;bigsize;url;constructor(r,t,i){r=is(r),this.handle=qn.default.openSync(r,t,i);let a=qn.default.fstatSync(this.handle,{bigint:!0});this.size=Number(a.size),this.bigsize=a.size,this.url=r}async close(){return new Promise((r,t)=>{qn.default.close(this.handle,i=>i?t(i):r())})}async truncate(r){return new Promise((t,i)=>{qn.default.ftruncate(this.handle,r,a=>{a?i(a):(this.bigsize=BigInt(r),this.size=Number(this.bigsize),t())})})}async append(r){return new Promise((t,i)=>{qn.default.appendFile(this.handle,r,a=>{a?i(a):(this.bigsize=this.bigsize+BigInt(r.length),this.size=Number(this.bigsize),t())})})}async stat(){return await new Promise((r,t)=>qn.default.fstat(this.handle,{bigint:!0},(i,a)=>{let n={size:Number(a.size),bigsize:a.size,isDirectory:a.isDirectory()};i?t(i):r(n)}))}async read(r,t){let i=new ArrayBuffer(t),a=BigInt(r),n=0,o=new Uint8Array(i),s;for(;t>0;){let u=await uH(this.handle,o,0,t,a);if(u===0)break;n+=u,a+=BigInt(u),t-=u,s!==void 0&&(s+=u)}return n<t?i.slice(0,n):i}async write(r,t=0,i=r.byteLength){return new Promise((a,n)=>{let o=Number(t),s=new Uint8Array(r,Number(t),i);qn.default.write(this.handle,s,0,i,o,(u,l)=>u?n(u):a(l))})}};async function uH(e,r,t,i,a){return await new Promise((n,o)=>qn.default.read(e,r,t,i,a,(s,u)=>s?o(s):n(u)))}var Pp=Jt(require("fs/promises"),1);var sv=Jt(require("fs"),1),ov=require("stream");var jp=Jt(require("zlib"),1),cH=e=>e&&e instanceof ArrayBuffer,lH=e=>e&&e instanceof Buffer;function Ap(e,r){switch(r==null?void 0:r.get("content-encoding")){case"br":return e.pipe(jp.default.createBrotliDecompress());case"gzip":return e.pipe(jp.default.createGunzip());case"deflate":return e.pipe(jp.default.createDeflate());default:return e}}async function ej(e){let r=[];return await new Promise((t,i)=>{e.on("error",a=>i(a)),e.on("readable",()=>e.read()),e.on("data",a=>{typeof a=="string"&&i(new Error("Read stream not binary")),r.push(pH(a))}),e.on("end",()=>{let a=fH(r);t(a)})})}function fH(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}function pH(e){if(cH(e))return e;if(lH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var dH=e=>typeof e=="boolean",rj=e=>typeof e=="function",hH=e=>e!==null&&typeof e=="object",mH=e=>hH(e)&&rj(e.read)&&rj(e.pipe)&&dH(e.readable);async function Tp(e,r){let t=/^file:\/\//;e.replace(t,"/");let i=e.split("?")[0];i=is(i);let a=new Headers;e.endsWith(".gz")&&(a["content-encoding"]="gzip"),e.endsWith(".br")&&(a["content-encoding"]="br");try{let n=await new Promise((h,d)=>{let m=sv.default.createReadStream(i,{encoding:null});m.once("readable",()=>h(m)),m.on("error",y=>d(y))}),o=n;mH(n)?o=Ap(n,a):typeof n=="string"?o=ov.Readable.from([new TextEncoder().encode(n)]):o=ov.Readable.from([n||new ArrayBuffer(0)]);let s=200,u="OK",l=gH(i),f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}catch(n){let o=n.message,s=400,u=o,l={},f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}}function gH(e){let r={};if(!r["content-length"]){let t=sv.default.statSync(e);r["content-length"]=t.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip"),new Headers(r)}var Rp=class{readable=!0;writable=!0;constructor(){}async readdir(r=".",t){return await Pp.default.readdir(r,t)}async stat(r){let t=await Pp.default.stat(r,{bigint:!0});return{size:Number(t.size),bigsize:t.size,isDirectory:t.isDirectory()}}async unlink(r){return await Pp.default.unlink(r)}async fetch(r,t){return await Tp(r,t)}async openReadableFile(r,t="r"){return new os(r,t)}async openWritableFile(r,t="w",i){return new os(r,t,i)}};var Uc=class{constructor(r={}){this.hashBatches=this.hashBatches.bind(this)}async preload(){}async*hashBatches(r,t="base64"){var o,s;let i=[];for await(let u of r)i.push(u),yield u;let a=await this.concatenate(i),n=await this.hash(a,t);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:n})}async concatenate(r){return await zc(r)}};var Hc=Jt(require("crypto"),1),Cp=class extends Uc{name="crypto-node";options;_algorithm;_hash;constructor(r){var t,i;if(super(),this.options=r,!((i=(t=this.options)==null?void 0:t.crypto)!=null&&i.algorithm))throw new Error(this.name)}async hash(r,t){var a,n,o,s;let i=(o=(n=(a=this.options)==null?void 0:a.crypto)==null?void 0:n.algorithm)==null?void 0:o.toLowerCase();try{if(!Hc.createHash)throw new Error("crypto.createHash not available");let u=(s=Hc.createHash)==null?void 0:s(i),l=new Uint8Array(r);return u.update(l).digest("base64")}catch(u){throw Error(`${i} hash not available. ${u}`)}}async*hashBatches(r,t="base64"){var n,o,s,u,l,f,h;if(!Hc.createHash)throw new Error("crypto.createHash not available");let i=(u=Hc.createHash)==null?void 0:u((s=(o=(n=this.options)==null?void 0:n.crypto)==null?void 0:o.algorithm)==null?void 0:s.toLowerCase());for await(let d of r){let m=new Uint8Array(d);i.update(m),yield d}let a=i.digest(t);(h=(f=(l=this.options)==null?void 0:l.crypto)==null?void 0:f.onEnd)==null||h.call(f,{hash:a})}};var gj=require("node:process");var tj=Jt(require("stream"),1),uv=class{},vH=tj.Readable||uv;function lv(e,r){let t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new cv(t,r)}var cv=class extends vH{_pulling;_bytesMode;_iterator;constructor(r,t){super(t),this._iterator=r,this._pulling=!1,this._bytesMode=!t||!t.objectMode}async _read(r){this._pulling||(this._pulling=!0,this._pulling=await this._pull(r,this._iterator))}async _destroy(r,t){var i,a,n,o;this._iterator&&(r?await((a=(i=this._iterator)==null?void 0:i.throw)==null?void 0:a.call(i,r)):await((o=(n=this._iterator)==null?void 0:n.return)==null?void 0:o.call(n,r)),t==null||t(null))}async _pull(r,t){var n;let i=this._bytesMode,a=null;for(;this.readable&&!(a=await t.next()).done&&(r!==null&&(r-=i&&ArrayBuffer.isView(a.value)?a.value.byteLength:1),!(!this.push(new Uint8Array(a.value))||r<=0)););return(a!=null&&a.done||!this.readable)&&(this.push(null)||!0)&&((n=t==null?void 0:t.return)==null||n.call(t)),!this.readable}};var nj=Jt(ij(),1);delete globalThis.ReadableStream;var Ip=class extends nj.ReadableStream{};var Bp=class{chunks;isWorking=!1;isCancelled=!1;constructor(r){this.chunks=r}start(r){this.work(r)}async work(r){let{chunks:t}=this;for(this.isWorking=!0;!this.isCancelled&&(r.desiredSize||0)>0;){let i;try{i=t.next()}catch(a){r.error(a);break}i&&(!i.done&&!this.isCancelled?r.enqueue(i.value):r.close())}this.isWorking=!1}pull(r){this.isWorking||this.work(r)}cancel(){this.isCancelled=!0}};var Fp=class extends Ip{_chunks;constructor(r){super(new Bp(r.values()),{type:"bytes"}),this._chunks=r}async*[Symbol.asyncIterator](r){let t=this.getReader();yield*this._chunks,t.releaseLock()}};var ss=class{type;size;parts;constructor(r=[],t={}){this.parts=[],this.size=0;for(let i of r)if(typeof i=="string"){let a=new TextEncoder().encode(i);this.parts.push(a),this.size+=a.byteLength}else if(i instanceof ss)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:a,byteOffset:n,byteLength:o}=i;this.parts.push(new Uint8Array(a,n,o)),this.size+=o}else{let a=new TextEncoder().encode(String(i));this.parts.push(a),this.size+=a.byteLength}this.type=bH(t.type)}slice(r=0,t=this.size,i=""){let{size:a,parts:n}=this,o=r<0?Math.max(a+r,0):Math.min(r,a),s=t<0?Math.max(a+t,0):Math.min(t,a),u=Math.max(s-o,0),l=new ss([],{type:i});if(u===0)return l;let f=0,h=[];for(let d of n){let{byteLength:m}=d;if(o>0&&m<=o)o-=m,s-=m;else{let y=d.subarray(o,Math.min(m,s));if(h.push(y),f+=y.byteLength,o=0,f>=u)break}}return l.parts=h,l.size=f,l}async arrayBuffer(){return this._toArrayBuffer()}async text(){let r=new TextDecoder,t="";for(let i of this.parts)t+=r.decode(i);return t}stream(){return new Fp(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let r=new ArrayBuffer(this.size),t=new Uint8Array(r),i=0;for(let a of this.parts)t.set(a,i),i+=a.byteLength;return r}};function bH(e=""){let r=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(r)?"":r}function yH(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=ss),globalThis.Blob}var xH=yH();var Dp=class{onload;onabort;onerror;error;onloadstart;onloadend;onprogress;readyState;result;DONE;EMPTY;LOADING;addEventListener;removeEventListener;dispatchEvent;constructor(){this.onload=null}abort(){}async readAsArrayBuffer(r){let t=await r.arrayBuffer();this.onload&&this.onload({target:{result:t}})}async readAsBinaryString(r){throw Error("Not implemented")}async readAsDataURL(r){let t=await r.text(),i=`data://;base64,${Pu(t)}`;this.onload&&this.onload({target:{result:i}})}async readAsText(r){let t=await r.text();this.onload&&this.onload({target:{result:t}})}};var Lp=class extends globalThis.Blob{name="";webkitRelativePath="";lastModified;constructor(r,t,i={}){super(r,i),this.name=String(t).replace(/\//g,":"),this.lastModified=(i==null?void 0:i.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};function oj(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=Dp),typeof File>"u"&&!globalThis.File&&(globalThis.File=Lp),global}var wH=oj();var fv=Jt(require("module"),1),sj=Jt(require("path"),1),Mp=Jt(require("fs"),1);async function uj(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():Mp.default.readFileSync(e).buffer}async function cj(e){return e.startsWith("http")?await(await fetch(e)).text():Mp.default.readFileSync(e,"utf8")}async function lj(e){if(e.startsWith("http")){let i=await(await fetch(e)).text();return qp(i)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let r=Mp.default.readFileSync(e,"utf8");return qp(r)}function qp(e,r="",t){if(typeof r=="object"&&(t=r,r=""),r=r.replace("file://",""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let i=fv.default._nodeModulePaths(sj.default.dirname(r)),a=typeof module<"u"&&(module==null?void 0:module.parent),n=new fv.default(r,a);return n.filename=r,n.paths=[].concat((t==null?void 0:t.prependPaths)||[]).concat(i).concat((t==null?void 0:t.appendPaths)||[]),n._compile(e,r),a&&a.children&&a.children.splice(a.children.indexOf(n),1),n.exports}var Ni=class{map;constructor(r){this.map={},r instanceof Ni?r.forEach((t,i)=>this.append(i,t)):Array.isArray(r)?r.forEach(t=>this.append(t[0],t[1])):r&&Object.getOwnPropertyNames(r).forEach(t=>this.append(t,r[t]))}append(r,t){r=Gc(r),t=fj(t);let i=this.map[r];this.map[r]=i?`${i}, ${t}`:t}delete(r){delete this.map[Gc(r)]}get(r){return r=Gc(r),this.has(r)?this.map[r]:null}has(r){return this.map.hasOwnProperty(Gc(r))}set(r,t){this.map[Gc(r)]=fj(t)}forEach(r,t=null){for(let i in this.map)this.map.hasOwnProperty(i)&&(t?r.call(t,this.map[i],i,this):r(this.map[i],i,this))}keys(){let r=[];return this.forEach(function(t,i){r.push(i)}),pv(r)}values(){let r=[];return this.forEach(function(t){r.push(t)}),pv(r)}entries(){let r=[];return this.forEach(function(t,i){r.push([i,t])}),pv(r)}*[Symbol.iterator](){yield*this.entries()}};function Gc(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 fj(e){return typeof e!="string"&&(e=String(e)),e}function pv(e){let r={next(){let t=e.shift();return{done:t===void 0,value:t}}};return r[Symbol.iterator]=function(){return r},r}function dv(e,r){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${r}`)}var mv=Jt(require("stream"),1),_H=e=>typeof e=="boolean",pj=e=>typeof e=="function",kH=e=>e!==null&&typeof e=="object",hv=e=>kH(e)&&pj(e.read)&&pj(e.pipe)&&_H(e.readable),Mn=class{ok;status;statusText;headers;url;bodyUsed=!1;_body;constructor(r,t){let{headers:i,status:a=200,statusText:n="OK",url:o}=t||{};this.url=o,this.ok=a===200,this.status=a,this.statusText=n,this.headers=new Ni((t==null?void 0:t.headers)||{}),hv(r)?this._body=Ap(r,i):typeof r=="string"?this._body=mv.Readable.from([new TextEncoder().encode(r)]):this._body=mv.Readable.from([r||new ArrayBuffer(0)])}get body(){return dv(!this.bodyUsed),dv(hv(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return hv(this._body)?await ej(this._body):this._body||new ArrayBuffer(0)}async text(){let r=await this.arrayBuffer();return new TextDecoder().decode(r)}async json(){let r=await this.text();return JSON.parse(r)}async blob(){if(typeof Blob>"u")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var hj=Jt(require("http"),1),mj=Jt(require("https"),1);var SH=e=>e&&e instanceof ArrayBuffer,EH=e=>e&&e instanceof Buffer;function dj(e){let r=e.indexOf(","),t,i;return e.slice(r-7,r)===";base64"?(t=Buffer.from(e.slice(r+1),"base64"),i=e.slice(5,r-7).trim()):(t=Buffer.from(decodeURIComponent(e.slice(r+1))),i=e.slice(5,r).trim()),i?i.startsWith(";")&&(i=`text/plain${i}`):i="text/plain;charset=US-ASCII",{arrayBuffer:jH(t),mimeType:i}}function jH(e){if(SH(e))return e;if(EH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var gv=e=>e.startsWith("data:"),AH=e=>e.startsWith("http:")||e.startsWith("https:");async function Wc(e,r){try{if(globalThis.fetch!==Wc&&(AH(e)||gv(e)))return await fetch(e,r);if(gv(e)){let{arrayBuffer:l,mimeType:f}=dj(e);return new Mn(l,{headers:{"content-type":f},url:e})}let t={},i=e;e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip");let a=await TH(i,r),n=OH(e,a,t),{status:o,statusText:s}=CH(a),u=!r||r.followRedirect||r.followRedirect===void 0;if(o>=300&&o<400&&n.has("location")&&u){let l=PH(e,n.get("location"));return await Wc(l,r)}return new Mn(a,{headers:n,status:o,statusText:s,url:e})}catch(t){return new Mn(null,{status:400,statusText:String(t),url:e})}}async function TH(e,r){return await new Promise((t,i)=>{let a=RH(e,r),n=e.startsWith("https:")?mj.default.request(a,o=>t(o)):hj.default.request(a,o=>t(o));n.on("error",o=>i(o)),n.end()})}function PH(e,r){if(r.startsWith("http"))return r;let t=new URL(e);return t.pathname=r,t.href}function RH(e,r){let t=(r==null?void 0:r.headers)||{},i={};for(let n of Object.keys(t))i[n.toLowerCase()]=t[n];i["accept-encoding"]=i["accept-encoding"]||"gzip,br,deflate";let a=new URL(e);return{hostname:a.hostname,path:a.pathname,method:"GET",...r,...r==null?void 0:r.fetch,headers:i,port:a.port}}function CH(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function OH(e,r,t={}){let i={};if(r&&r.headers){let a=r.headers;for(let n in a){let o=a[n];i[n.toLowerCase()]=String(o)}}if(!i["content-length"]){let a=IH(e);Number.isFinite(a)&&(i["content-length"]=a)}return Object.assign(i,t),new Ni(i)}function IH(e){return gv(e)?e.length-5:null}var BH=parseInt(gj.versions.node.split(".")[0]);V1&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=lv;globalThis.loaders.NodeFile=os;globalThis.loaders.NodeFileSystem=Rp;globalThis.loaders.fetchNode=Tp;globalThis.loaders.NodeHash=Cp;globalThis.TextEncoder||(globalThis.TextEncoder=Tu);globalThis.TextDecoder||(globalThis.TextDecoder=Bo);!("atob"in globalThis)&&Pu&&(globalThis.atob=Pu);!("btoa"in globalThis)&&Ld&&(globalThis.btoa=Ld);globalThis.loaders.encodeImageNode=Qx;globalThis.loaders.parseImageNode=Mg;globalThis.loaders.imageFormatsNode=qg;globalThis._parseImageNode=Mg;globalThis._imageFormatsNode=qg;globalThis.loaders.readFileAsArrayBuffer=uj;globalThis.loaders.readFileAsText=cj;globalThis.loaders.requireFromFile=lj;globalThis.loaders.requireFromString=qp;BH<18&&(!("Headers"in globalThis)&&Ni&&(globalThis.Headers=Ni),!("Response"in globalThis)&&Mn&&(globalThis.Response=Mn),!("fetch"in globalThis)&&Wc&&(globalThis.fetch=Wc));var FH=e=>typeof e=="boolean",Vc=e=>typeof e=="function",us=e=>e!==null&&typeof e=="object",vv=e=>us(e)&&e.constructor==={}.constructor;var vj=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",bj=e=>e&&typeof e[Symbol.asyncIterator]=="function";var di=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var hi=e=>typeof Blob<"u"&&e instanceof Blob,yj=e=>e&&typeof e=="object"&&e.isBuffer;var DH=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||us(e)&&Vc(e.tee)&&Vc(e.cancel)&&Vc(e.getReader);var LH=e=>us(e)&&Vc(e.read)&&Vc(e.pipe)&&FH(e.readable),zp=e=>DH(e)||LH(e);var Np=class extends Error{constructor(r,t){super(r),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response};var qH=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,MH=/^([-\w.]+\/[-\w.+]+)/;function bv(e,r){return e.toLowerCase()===r.toLowerCase()}function xj(e){let r=MH.exec(e);return r?r[1]:e}function yv(e){let r=qH.exec(e);return r?r[1]:""}var wj=/\?.*/;function _j(e){let r=e.match(wj);return r&&r[0]}function du(e){return e.replace(wj,"")}function kj(e){if(e.length<50)return e;let r=e.slice(e.length-15);return`${e.substr(0,32)}...${r}`}function cs(e){return di(e)?e.url:hi(e)?e.name||"":typeof e=="string"?e:""}function $c(e){if(di(e)){let r=e,t=r.headers.get("content-type")||"",i=du(r.url);return xj(t)||yv(i)}return hi(e)?e.type||"":typeof e=="string"?yv(e):""}function Sj(e){return di(e)?e.headers["content-length"]||-1:hi(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function Up(e){if(di(e))return e;let r={},t=Sj(e);t>=0&&(r["content-length"]=String(t));let i=cs(e),a=$c(e);a&&(r["content-type"]=a);let n=await NH(e);n&&(r["x-first-bytes"]=n),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:r});return Object.defineProperty(o,"url",{value:i}),o}async function Ej(e){if(!e.ok)throw await zH(e)}async function zH(e){let r=kj(e.url),t=`Failed to fetch resource (${e.status}) ${e.statusText}: ${r}`;t=t.length>100?`${t.slice(0,100)}...`:t;let i={reason:e.statusText,url:e.url,response:e};try{let a=e.headers.get("Content-Type");i.reason=a!=null&&a.includes("application/json")?await e.json():e.text()}catch{}return new Np(t,i)}async function NH(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let t=e.slice(0,5);return await new Promise(i=>{let a=new FileReader;a.onload=n=>{var o;return i((o=n==null?void 0:n.target)==null?void 0:o.result)},a.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=e.slice(0,5);return`data:base64,${UH(t)}`}return null}function UH(e){let r="",t=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)r+=String.fromCharCode(t[i]);return btoa(r)}function HH(e){return!GH(e)&&!WH(e)}function GH(e){return e.startsWith("http:")||e.startsWith("https:")}function WH(e){return e.startsWith("data:")}async function xv(e,r){var t,i;if(typeof e=="string"){let a=is(e);return HH(a)&&(t=globalThis.loaders)!=null&&t.fetchNode?(i=globalThis.loaders)==null?void 0:i.fetchNode(a,r):await fetch(a,r)}return await Up(e)}var wv=new hn({id:"loaders.gl"}),Hp=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Gp=class{console;constructor(){this.console=console}log(...r){return this.console.log.bind(this.console,...r)}info(...r){return this.console.info.bind(this.console,...r)}warn(...r){return this.console.warn.bind(this.console,...r)}error(...r){return this.console.error.bind(this.console,...r)}};var _v={fetch:null,mimeType:void 0,nothrow:!1,log:new Gp,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Zo,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},jj={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 kv(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function Sv(){let e=kv();return e.globalOptions=e.globalOptions||{..._v},e.globalOptions}function Pj(e,r,t,i){return t=t||[],t=Array.isArray(t)?t:[t],VH(e,t),KH(r,e,i)}function VH(e,r){Aj(e,null,_v,jj,r);for(let t of r){let i=e&&e[t.id]||{},a=t.options&&t.options[t.id]||{},n=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};Aj(i,t.id,a,n,r)}}function Aj(e,r,t,i,a){let n=r||"Top level",o=r?`${r}.`:"";for(let s in e){let u=!r&&us(e[s]),l=s==="baseUri"&&!r,f=s==="workerUrl"&&r;if(!(s in t)&&!l&&!f){if(s in i)wv.warn(`${n} loader option '${o}${s}' no longer supported, use '${i[s]}'`)();else if(!u){let h=$H(s,a);wv.warn(`${n} loader option '${o}${s}' not recognized. ${h}`)()}}}}function $H(e,r){let t=e.toLowerCase(),i="";for(let a of r)for(let n in a.options){if(e===n)return`Did you mean '${a.id}.${n}'?`;let o=n.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(i=i||`Did you mean '${a.id}.${n}'?`)}return i}function KH(e,r,t){let a={...e.options||{}};return YH(a,t),a.log===null&&(a.log=new Hp),Tj(a,Sv()),Tj(a,r),a}function Tj(e,r){for(let t in r)if(t in r){let i=r[t];vv(i)&&vv(e[t])?e[t]={...e[t],...r[t]}:e[t]=r[t]}}function YH(e,r){r&&!("baseUri"in e)&&(e.baseUri=r)}function Kc(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function Ev(e){Mi(e,"null loader"),Mi(Kc(e),"invalid loader");let r;return Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),(e!=null&&e.parseTextSync||e!=null&&e.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var XH=()=>{let e=kv();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Rj(){return XH()}var Cj=new hn({id:"loaders.gl"});var QH=/\.([^.]+)$/;async function Bj(e,r=[],t,i){if(!Fj(e))return null;let a=Oj(e,r,{...t,nothrow:!0},i);if(a)return a;if(hi(e)&&(e=await e.slice(0,10).arrayBuffer(),a=Oj(e,r,t,i)),!a&&!(t!=null&&t.nothrow))throw new Error(Dj(e));return a}function Oj(e,r=[],t,i){if(!Fj(e))return null;if(r&&!Array.isArray(r))return Ev(r);let a=[];r&&(a=a.concat(r)),t!=null&&t.ignoreRegisteredLoaders||a.push(...Rj()),ZH(a);let n=JH(e,a,t,i);if(!n&&!(t!=null&&t.nothrow))throw new Error(Dj(e));return n}function JH(e,r,t,i){let a=cs(e),n=$c(e),o=du(a)||(i==null?void 0:i.url),s=null,u="";return t!=null&&t.mimeType&&(s=jv(r,t==null?void 0:t.mimeType),u=`match forced by supplied MIME type ${t==null?void 0:t.mimeType}`),s=s||eG(r,o),u=u||(s?`matched url ${o}`:""),s=s||jv(r,n),u=u||(s?`matched MIME type ${n}`:""),s=s||tG(r,e),u=u||(s?`matched initial data ${Lj(e)}`:""),t!=null&&t.fallbackMimeType&&(s=s||jv(r,t==null?void 0:t.fallbackMimeType),u=u||(s?`matched fallback MIME type ${n}`:"")),u&&Cj.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function Fj(e){return!(e instanceof Response&&e.status===204)}function Dj(e){let r=cs(e),t=$c(e),i="No valid loader found (";i+=r?`${ns.filename(r)}, `:"no url provided, ",i+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let a=e?Lj(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function ZH(e){for(let r of e)Ev(r)}function eG(e,r){let t=r&&QH.exec(r),i=t&&t[1];return i?rG(e,i):null}function rG(e,r){r=r.toLowerCase();for(let t of e)for(let i of t.extensions)if(i.toLowerCase()===r)return t;return null}function jv(e,r){var t;for(let i of e)if((t=i.mimeTypes)!=null&&t.some(a=>bv(r,a))||bv(r,`application/x.${i.id}`))return i;return null}function tG(e,r){if(!r)return null;for(let t of e)if(typeof r=="string"){if(aG(r,t))return t}else if(ArrayBuffer.isView(r)){if(Ij(r.buffer,r.byteOffset,t))return t}else if(r instanceof ArrayBuffer&&Ij(r,0,t))return t;return null}function aG(e,r){return r.testText?r.testText(e):(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>e.startsWith(i))}function Ij(e,r,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(a=>iG(e,r,t,a))}function iG(e,r,t,i){if(i instanceof ArrayBuffer)return av(i,e,i.byteLength);switch(typeof i){case"function":return i(e);case"string":let a=Av(e,r,i.length);return i===a;default:return!1}}function Lj(e,r=5){return typeof e=="string"?e.slice(0,r):ArrayBuffer.isView(e)?Av(e.buffer,e.byteOffset,r):e instanceof ArrayBuffer?Av(e,0,r):""}function Av(e,r,t){if(e.byteLength<r+t)return"";let i=new DataView(e),a="";for(let n=0;n<t;n++)a+=String.fromCharCode(i.getUint8(r+n));return a}function*qj(e,r){let t=(r==null?void 0:r.chunkSize)||262144,i=0,a=new TextEncoder;for(;i<e.length;){let n=Math.min(e.length-i,t),o=e.slice(i,i+n);i+=n,yield a.encode(o)}}function*Mj(e,r={}){let{chunkSize:t=262144}=r,i=0;for(;i<e.byteLength;){let a=Math.min(e.byteLength-i,t),n=new ArrayBuffer(a),o=new Uint8Array(e,i,a);new Uint8Array(n).set(o),i+=a,yield n}}async function*zj(e,r){let t=(r==null?void 0:r.chunkSize)||1048576,i=0;for(;i<e.size;){let a=i+t,n=await e.slice(i,a).arrayBuffer();i=a,yield n}}function Tv(e,r){return Zo?nG(e,r):oG(e,r)}async function*nG(e,r){let t=e.getReader(),i;try{for(;;){let a=i||t.read();r!=null&&r._streamReadAhead&&(i=t.read());let{done:n,value:o}=await a;if(n)return;yield Ep(o)}}catch{t.releaseLock()}}async function*oG(e,r){for await(let t of e)yield Ep(t)}function Nj(e,r){if(typeof e=="string")return qj(e,r);if(e instanceof ArrayBuffer)return Mj(e,r);if(hi(e))return zj(e,r);if(zp(e))return Tv(e,r);if(di(e))return Tv(e.body,r);throw new Error("makeIterator")}var Uj="Cannot convert supplied data type";function sG(e,r,t){if(r.text&&typeof e=="string")return e;if(yj(e)&&(e=e.buffer),e instanceof ArrayBuffer){let i=e;return r.text&&!r.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(r.text&&!r.binary)return new TextDecoder("utf8").decode(e);let i=e.buffer,a=e.byteLength||e.length;return(e.byteOffset!==0||a!==i.byteLength)&&(i=i.slice(e.byteOffset,e.byteOffset+a)),i}throw new Error(Uj)}async function Hj(e,r,t){let i=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||i)return sG(e,r,t);if(hi(e)&&(e=await Up(e)),di(e)){let a=e;return await Ej(a),r.binary?await a.arrayBuffer():await a.text()}if(zp(e)&&(e=Nj(e,t)),vj(e)||bj(e))return zc(e);throw new Error(Uj)}function Wp(e,r){let t=Sv(),i=e||t;return typeof i.fetch=="function"?i.fetch:us(i.fetch)?a=>xv(a,i.fetch):r!=null&&r.fetch?r==null?void 0:r.fetch:xv}function Gj(e,r,t){if(t)return t;let i={fetch:Wp(r,e),...e};if(i.url){let a=du(i.url);i.baseUrl=a,i.queryString=_j(i.url),i.filename=ns.filename(a),i.baseUrl=ns.dirname(a)}return Array.isArray(i.loaders)||(i.loaders=null),i}function Wj(e,r){if(e&&!Array.isArray(e))return e;let t;if(e&&(t=Array.isArray(e)?e:[e]),r&&r.loaders){let i=Array.isArray(r.loaders)?r.loaders:[r.loaders];t=t?[...t,...i]:i}return t&&t.length?t:void 0}async function zn(e,r,t,i){r&&!Array.isArray(r)&&!Kc(r)&&(i=void 0,t=r,r=void 0),e=await e,t=t||{};let a=cs(e),o=Wj(r,i),s=await Bj(e,o,t);return s?(t=Pj(t,s,o,a),i=Gj({url:a,_parse:zn,loaders:o},t,i||null),await uG(s,e,t,i)):null}async function uG(e,r,t,i){if(Jg(e),t=Gg(e.options,t),di(r)){let n=r,{ok:o,redirected:s,status:u,statusText:l,type:f,url:h}=n,d=Object.fromEntries(n.headers.entries());i.response={headers:d,ok:o,redirected:s,status:u,statusText:l,type:f,url:h}}r=await Hj(r,e,t);let a=e;if(a.parseTextSync&&typeof r=="string")return a.parseTextSync(r,t,i);if(rv(e,t))return await tv(e,r,t,i,zn);if(a.parseText&&typeof r=="string")return await a.parseText(r,t,i);if(a.parse)return await a.parse(r,t,i);throw ma(!a.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function Vj(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 Pv(e){let r=1/0,t=1/0,i=1/0,a=-1/0,n=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let l=0;l<u;l+=3){let f=s[l],h=s[l+1],d=s[l+2];r=f<r?f:r,t=h<t?h:t,i=d<i?d:i,a=f>a?f:a,n=h>n?h:n,o=d>o?d:o}return[[r,t,i],[a,n,o]]}function Rv(e,r,t){let i=Vj(r.value),a=t||$j(r);return{name:e,type:{type:"fixed-size-list",listSize:r.size,children:[{name:"value",type:i}]},nullable:!1,metadata:a}}function $j(e){let r={};return"byteOffset"in e&&(r.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(r.byteStride=e.byteStride.toString(10)),"normalized"in e&&(r.normalized=e.normalized.toString()),r}async function Cv(e,r,t,i){let a,n;!Array.isArray(r)&&!Kc(r)?(a=[],n=r,i=void 0):(a=r,n=t);let o=Wp(n),s=e;return typeof e=="string"&&(s=await o(e)),hi(e)&&(s=await o(e)),Array.isArray(a)?await zn(s,a,n):await zn(s,a,n)}var cG=1/Math.PI*180,lG=1/180*Math.PI,fG={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fG}};var It=globalThis.mathgl.config;function Ov(e,{precision:r=It.precision}={}){return e=pG(e),"".concat(parseFloat(e.toPrecision(r)))}function Ao(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Iv(e){return Kj(e)}function Bv(e){return Yj(e)}function Kj(e,r){return Xj(e,t=>t*lG,r)}function Yj(e,r){return Xj(e,t=>t*cG,r)}function Nn(e,r,t){let i=It.EPSILON;t&&(It.EPSILON=t);try{if(e===r)return!0;if(Ao(e)&&Ao(r)){if(e.length!==r.length)return!1;for(let a=0;a<e.length;++a)if(!Nn(e[a],r[a]))return!1;return!0}return e&&e.equals?e.equals(r):r&&r.equals?r.equals(e):typeof e=="number"&&typeof r=="number"?Math.abs(e-r)<=It.EPSILON*Math.max(1,Math.abs(e),Math.abs(r)):!1}finally{It.EPSILON=i}}function pG(e){return Math.round(e/It.EPSILON)*It.EPSILON}function dG(e){return e.clone?e.clone():new Array(e.length)}function Xj(e,r,t){if(Ao(e)){let i=e;t=t||dG(i);for(let a=0;a<t.length&&a<i.length;++a){let n=typeof e=="number"?e:e[a];t[a]=r(n,a,t)}return t}return r(e)}function hG(e){function r(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return r.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e,r}var hu=class extends hG(Array){clone(){return new this.constructor().copy(this)}fromArray(r,t=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=r[i+t];return this.check()}toArray(r=[],t=0){for(let i=0;i<this.ELEMENTS;++i)r[t+i]=this[i];return r}toObject(r){return r}from(r){return Array.isArray(r)?this.copy(r):this.fromObject(r)}to(r){return r===this?this:Ao(r)?this.toArray(r):this.toObject(r)}toTarget(r){return r?this.to(r):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(It)}formatString(r){let t="";for(let i=0;i<this.ELEMENTS;++i)t+=(i>0?", ":"")+Ov(this[i],r);return"".concat(r.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Nn(this[t],r[t]))return!1;return!0}exactEquals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==r[t])return!1;return!0}negate(){for(let r=0;r<this.ELEMENTS;++r)this[r]=-this[r];return this.check()}lerp(r,t,i){if(i===void 0)return this.lerp(this,r,t);for(let a=0;a<this.ELEMENTS;++a){let n=r[a],o=typeof t=="number"?t:t[a];this[a]=n+i*(o-n)}return this.check()}min(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(r[t],this[t]);return this.check()}max(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(r[t],this[t]);return this.check()}clamp(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r[i]),t[i]);return this.check()}add(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]+=t[i];return this.check()}subtract(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]-=t[i];return this.check()}scale(r){if(typeof r=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;else for(let t=0;t<this.ELEMENTS&&t<r.length;++t)this[t]*=r[t];return this.check()}multiplyByScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}check(){if(It.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let r=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)r=r&&Number.isFinite(this[t]);return r}sub(r){return this.subtract(r)}setScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=r;return this.check()}addScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]+=r;return this.check()}subScalar(r){return this.addScalar(-r)}multiplyScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}divideScalar(r){return this.multiplyByScalar(1/r)}clampScalar(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r),t);return this.check()}get elements(){return this}};function mG(e,r){if(e.length!==r)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}function Aa(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Vp(e,r,t=""){if(It.debug&&!mG(e,r))throw new Error("math.gl: ".concat(t," some fields set to invalid numbers'"));return e}function mi(e,r){if(!e)throw new Error("math.gl assertion ".concat(r))}var $p=class extends hu{get x(){return this[0]}set x(r){this[0]=Aa(r)}get y(){return this[1]}set y(r){this[1]=Aa(r)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let r=0;for(let t=0;t<this.ELEMENTS;++t)r+=this[t]*this[t];return r}magnitudeSquared(){return this.lengthSquared()}distance(r){return Math.sqrt(this.distanceSquared(r))}distanceSquared(r){let t=0;for(let i=0;i<this.ELEMENTS;++i){let a=this[i]-r[i];t+=a*a}return Aa(t)}dot(r){let t=0;for(let i=0;i<this.ELEMENTS;++i)t+=this[i]*r[i];return Aa(t)}normalize(){let r=this.magnitude();if(r!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=r;return this.check()}multiply(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]*=t[i];return this.check()}divide(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]/=t[i];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(r){return this.distance(r)}distanceToSquared(r){return this.distanceSquared(r)}getComponent(r){return mi(r>=0&&r<this.ELEMENTS,"index is out of range"),Aa(this[r])}setComponent(r,t){return mi(r>=0&&r<this.ELEMENTS,"index is out of range"),this[r]=t,this.check()}addVectors(r,t){return this.copy(r).add(t)}subVectors(r,t){return this.copy(r).subtract(t)}multiplyVectors(r,t){return this.copy(r).multiply(t)}addScaledVector(r,t){return this.add(new this.constructor(r).multiplyScalar(t))}};var Ui=typeof Float32Array<"u"?Float32Array:Array,Yc=Math.random;function mu(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Qie=Math.PI/180;function gG(){let e=new Ui(2);return Ui!=Float32Array&&(e[0]=0,e[1]=0),e}function Qj(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[4]*a+t[12],e[1]=t[1]*i+t[5]*a+t[13],e}var Jie=function(){let e=gG();return function(r,t,i,a,n,o){let s,u;for(t||(t=2),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],n(e,e,o),r[s]=e[0],r[s+1]=e[1];return r}}();function Jj(e,r,t){let i=r[0],a=r[1],n=t[3]*i+t[7]*a||1;return e[0]=(t[0]*i+t[4]*a)/n,e[1]=(t[1]*i+t[5]*a)/n,e}function Kp(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n||1;return e[0]=(t[0]*i+t[4]*a+t[8]*n)/o,e[1]=(t[1]*i+t[5]*a+t[9]*n)/o,e[2]=(t[2]*i+t[6]*a+t[10]*n)/o,e}function Zj(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[2]*a,e[1]=t[1]*i+t[3]*a,e[2]=r[2],e}var Qc={};kl(Qc,{add:()=>wG,angle:()=>Hv,bezier:()=>FG,ceil:()=>_G,clone:()=>vG,copy:()=>yG,create:()=>e4,cross:()=>Lv,dist:()=>GG,distance:()=>n4,div:()=>HG,divide:()=>i4,dot:()=>Dv,equals:()=>zG,exactEquals:()=>MG,floor:()=>kG,forEach:()=>KG,fromValues:()=>bG,hermite:()=>BG,inverse:()=>RG,len:()=>VG,length:()=>r4,lerp:()=>OG,max:()=>EG,min:()=>SG,mul:()=>UG,multiply:()=>a4,negate:()=>PG,normalize:()=>CG,random:()=>DG,rotateX:()=>zv,rotateY:()=>Nv,rotateZ:()=>Uv,round:()=>jG,scale:()=>AG,scaleAndAdd:()=>TG,set:()=>xG,slerp:()=>IG,sqrDist:()=>WG,sqrLen:()=>$G,squaredDistance:()=>o4,squaredLength:()=>s4,str:()=>qG,sub:()=>NG,subtract:()=>t4,transformMat3:()=>qv,transformMat4:()=>Xc,transformQuat:()=>Mv,zero:()=>LG});function e4(){let e=new Ui(3);return Ui!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vG(e){let r=new Ui(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function r4(e){let r=e[0],t=e[1],i=e[2];return Math.sqrt(r*r+t*t+i*i)}function bG(e,r,t){let i=new Ui(3);return i[0]=e,i[1]=r,i[2]=t,i}function yG(e,r){return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function xG(e,r,t,i){return e[0]=r,e[1]=t,e[2]=i,e}function wG(e,r,t){return e[0]=r[0]+t[0],e[1]=r[1]+t[1],e[2]=r[2]+t[2],e}function t4(e,r,t){return e[0]=r[0]-t[0],e[1]=r[1]-t[1],e[2]=r[2]-t[2],e}function a4(e,r,t){return e[0]=r[0]*t[0],e[1]=r[1]*t[1],e[2]=r[2]*t[2],e}function i4(e,r,t){return e[0]=r[0]/t[0],e[1]=r[1]/t[1],e[2]=r[2]/t[2],e}function _G(e,r){return e[0]=Math.ceil(r[0]),e[1]=Math.ceil(r[1]),e[2]=Math.ceil(r[2]),e}function kG(e,r){return e[0]=Math.floor(r[0]),e[1]=Math.floor(r[1]),e[2]=Math.floor(r[2]),e}function SG(e,r,t){return e[0]=Math.min(r[0],t[0]),e[1]=Math.min(r[1],t[1]),e[2]=Math.min(r[2],t[2]),e}function EG(e,r,t){return e[0]=Math.max(r[0],t[0]),e[1]=Math.max(r[1],t[1]),e[2]=Math.max(r[2],t[2]),e}function jG(e,r){return e[0]=mu(r[0]),e[1]=mu(r[1]),e[2]=mu(r[2]),e}function AG(e,r,t){return e[0]=r[0]*t,e[1]=r[1]*t,e[2]=r[2]*t,e}function TG(e,r,t,i){return e[0]=r[0]+t[0]*i,e[1]=r[1]+t[1]*i,e[2]=r[2]+t[2]*i,e}function n4(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return Math.sqrt(t*t+i*i+a*a)}function o4(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return t*t+i*i+a*a}function s4(e){let r=e[0],t=e[1],i=e[2];return r*r+t*t+i*i}function PG(e,r){return e[0]=-r[0],e[1]=-r[1],e[2]=-r[2],e}function RG(e,r){return e[0]=1/r[0],e[1]=1/r[1],e[2]=1/r[2],e}function CG(e,r){let t=r[0],i=r[1],a=r[2],n=t*t+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=r[0]*n,e[1]=r[1]*n,e[2]=r[2]*n,e}function Dv(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]}function Lv(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[0],s=t[1],u=t[2];return e[0]=a*u-n*s,e[1]=n*o-i*u,e[2]=i*s-a*o,e}function OG(e,r,t,i){let a=r[0],n=r[1],o=r[2];return e[0]=a+i*(t[0]-a),e[1]=n+i*(t[1]-n),e[2]=o+i*(t[2]-o),e}function IG(e,r,t,i){let a=Math.acos(Math.min(Math.max(Dv(r,t),-1),1)),n=Math.sin(a),o=Math.sin((1-i)*a)/n,s=Math.sin(i*a)/n;return e[0]=o*r[0]+s*t[0],e[1]=o*r[1]+s*t[1],e[2]=o*r[2]+s*t[2],e}function BG(e,r,t,i,a,n){let o=n*n,s=o*(2*n-3)+1,u=o*(n-2)+n,l=o*(n-1),f=o*(3-2*n);return e[0]=r[0]*s+t[0]*u+i[0]*l+a[0]*f,e[1]=r[1]*s+t[1]*u+i[1]*l+a[1]*f,e[2]=r[2]*s+t[2]*u+i[2]*l+a[2]*f,e}function FG(e,r,t,i,a,n){let o=1-n,s=o*o,u=n*n,l=s*o,f=3*n*s,h=3*u*o,d=u*n;return e[0]=r[0]*l+t[0]*f+i[0]*h+a[0]*d,e[1]=r[1]*l+t[1]*f+i[1]*h+a[1]*d,e[2]=r[2]*l+t[2]*f+i[2]*h+a[2]*d,e}function DG(e,r){r=r===void 0?1:r;let t=Yc()*2*Math.PI,i=Yc()*2-1,a=Math.sqrt(1-i*i)*r;return e[0]=Math.cos(t)*a,e[1]=Math.sin(t)*a,e[2]=i*r,e}function Xc(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n+t[15];return o=o||1,e[0]=(t[0]*i+t[4]*a+t[8]*n+t[12])/o,e[1]=(t[1]*i+t[5]*a+t[9]*n+t[13])/o,e[2]=(t[2]*i+t[6]*a+t[10]*n+t[14])/o,e}function qv(e,r,t){let i=r[0],a=r[1],n=r[2];return e[0]=i*t[0]+a*t[3]+n*t[6],e[1]=i*t[1]+a*t[4]+n*t[7],e[2]=i*t[2]+a*t[5]+n*t[8],e}function Mv(e,r,t){let i=t[0],a=t[1],n=t[2],o=t[3],s=r[0],u=r[1],l=r[2],f=a*l-n*u,h=n*s-i*l,d=i*u-a*s,m=a*d-n*h,y=n*f-i*d,k=i*h-a*f,x=o*2;return f*=x,h*=x,d*=x,m*=2,y*=2,k*=2,e[0]=s+f+m,e[1]=u+h+y,e[2]=l+d+k,e}function zv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Nv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Uv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Hv(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2],u=Math.sqrt((t*t+i*i+a*a)*(n*n+o*o+s*s)),l=u&&Dv(e,r)/u;return Math.acos(Math.min(Math.max(l,-1),1))}function LG(e){return e[0]=0,e[1]=0,e[2]=0,e}function qG(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function MG(e,r){return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}function zG(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2];return Math.abs(t-n)<=1e-6*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-s)<=1e-6*Math.max(1,Math.abs(a),Math.abs(s))}var NG=t4,UG=a4,HG=i4,GG=n4,WG=o4,VG=r4,$G=s4,KG=function(){let e=e4();return function(r,t,i,a,n,o){let s,u;for(t||(t=3),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2];return r}}();var Gv=[0,0,0],Yp,Ir=class extends $p{static get ZERO(){return Yp||(Yp=new Ir(0,0,0),Object.freeze(Yp)),Yp}constructor(r=0,t=0,i=0){super(-0,-0,-0),arguments.length===1&&Ao(r)?this.copy(r):(It.debug&&(Aa(r),Aa(t),Aa(i)),this[0]=r,this[1]=t,this[2]=i)}set(r,t,i){return this[0]=r,this[1]=t,this[2]=i,this.check()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this.check()}fromObject(r){return It.debug&&(Aa(r.x),Aa(r.y),Aa(r.z)),this[0]=r.x,this[1]=r.y,this[2]=r.z,this.check()}toObject(r){return r.x=this[0],r.y=this[1],r.z=this[2],r}get ELEMENTS(){return 3}get z(){return this[2]}set z(r){this[2]=Aa(r)}angle(r){return Hv(this,r)}cross(r){return Lv(this,this,r),this.check()}rotateX({radians:r,origin:t=Gv}){return zv(this,this,t,r),this.check()}rotateY({radians:r,origin:t=Gv}){return Nv(this,this,t,r),this.check()}rotateZ({radians:r,origin:t=Gv}){return Uv(this,this,t,r),this.check()}transform(r){return this.transformAsPoint(r)}transformAsPoint(r){return Xc(this,this,r),this.check()}transformAsVector(r){return Kp(this,this,r),this.check()}transformByMatrix3(r){return qv(this,this,r),this.check()}transformByMatrix2(r){return Zj(this,this,r),this.check()}transformByQuaternion(r){return Mv(this,this,r),this.check()}};var Xp=class extends hu{toString(){let r="[";if(It.printRowMajor){r+="row-major:";for(let t=0;t<this.RANK;++t)for(let i=0;i<this.RANK;++i)r+=" ".concat(this[i*this.RANK+t])}else{r+="column-major:";for(let t=0;t<this.ELEMENTS;++t)r+=" ".concat(this[t])}return r+="]",r}getElementIndex(r,t){return t*this.RANK+r}getElement(r,t){return this[t*this.RANK+r]}setElement(r,t,i){return this[t*this.RANK+r]=Aa(i),this}getColumn(r,t=new Array(this.RANK).fill(-0)){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)t[a]=this[i+a];return t}setColumn(r,t){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)this[i+a]=t[a];return this}};function YG(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u4(e,r){if(e===r){let t=r[1],i=r[2],a=r[3],n=r[6],o=r[7],s=r[11];e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=t,e[6]=r[9],e[7]=r[13],e[8]=i,e[9]=n,e[11]=r[14],e[12]=a,e[13]=o,e[14]=s}else e[0]=r[0],e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=r[1],e[5]=r[5],e[6]=r[9],e[7]=r[13],e[8]=r[2],e[9]=r[6],e[10]=r[10],e[11]=r[14],e[12]=r[3],e[13]=r[7],e[14]=r[11],e[15]=r[15];return e}function c4(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=r[4],s=r[5],u=r[6],l=r[7],f=r[8],h=r[9],d=r[10],m=r[11],y=r[12],k=r[13],x=r[14],A=r[15],P=t*s-i*o,T=t*u-a*o,B=t*l-n*o,C=i*u-a*s,I=i*l-n*s,F=a*l-n*u,H=f*k-h*y,N=f*x-d*y,K=f*A-m*y,V=h*x-d*k,X=h*A-m*k,U=d*A-m*x,$=P*U-T*X+B*V+C*K-I*N+F*H;return $?($=1/$,e[0]=(s*U-u*X+l*V)*$,e[1]=(a*X-i*U-n*V)*$,e[2]=(k*F-x*I+A*C)*$,e[3]=(d*I-h*F-m*C)*$,e[4]=(u*K-o*U-l*N)*$,e[5]=(t*U-a*K+n*N)*$,e[6]=(x*B-y*F-A*T)*$,e[7]=(f*F-d*B+m*T)*$,e[8]=(o*X-s*K+l*H)*$,e[9]=(i*K-t*X-n*H)*$,e[10]=(y*I-k*B+A*P)*$,e[11]=(h*B-f*I-m*P)*$,e[12]=(s*N-o*V-u*H)*$,e[13]=(t*V-i*N+a*H)*$,e[14]=(k*T-y*C-x*P)*$,e[15]=(f*C-h*T+d*P)*$,e):null}function l4(e){let r=e[0],t=e[1],i=e[2],a=e[3],n=e[4],o=e[5],s=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],m=e[12],y=e[13],k=e[14],x=e[15],A=r*o-t*n,P=r*s-i*n,T=t*s-i*o,B=l*y-f*m,C=l*k-h*m,I=f*k-h*y,F=r*I-t*C+i*B,H=n*I-o*C+s*B,N=l*T-f*P+h*A,K=m*T-y*P+k*A;return u*F-a*H+x*N-d*K}function Wv(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3],s=r[4],u=r[5],l=r[6],f=r[7],h=r[8],d=r[9],m=r[10],y=r[11],k=r[12],x=r[13],A=r[14],P=r[15],T=t[0],B=t[1],C=t[2],I=t[3];return e[0]=T*i+B*s+C*h+I*k,e[1]=T*a+B*u+C*d+I*x,e[2]=T*n+B*l+C*m+I*A,e[3]=T*o+B*f+C*y+I*P,T=t[4],B=t[5],C=t[6],I=t[7],e[4]=T*i+B*s+C*h+I*k,e[5]=T*a+B*u+C*d+I*x,e[6]=T*n+B*l+C*m+I*A,e[7]=T*o+B*f+C*y+I*P,T=t[8],B=t[9],C=t[10],I=t[11],e[8]=T*i+B*s+C*h+I*k,e[9]=T*a+B*u+C*d+I*x,e[10]=T*n+B*l+C*m+I*A,e[11]=T*o+B*f+C*y+I*P,T=t[12],B=t[13],C=t[14],I=t[15],e[12]=T*i+B*s+C*h+I*k,e[13]=T*a+B*u+C*d+I*x,e[14]=T*n+B*l+C*m+I*A,e[15]=T*o+B*f+C*y+I*P,e}function f4(e,r,t){let i=t[0],a=t[1],n=t[2],o,s,u,l,f,h,d,m,y,k,x,A;return r===e?(e[12]=r[0]*i+r[4]*a+r[8]*n+r[12],e[13]=r[1]*i+r[5]*a+r[9]*n+r[13],e[14]=r[2]*i+r[6]*a+r[10]*n+r[14],e[15]=r[3]*i+r[7]*a+r[11]*n+r[15]):(o=r[0],s=r[1],u=r[2],l=r[3],f=r[4],h=r[5],d=r[6],m=r[7],y=r[8],k=r[9],x=r[10],A=r[11],e[0]=o,e[1]=s,e[2]=u,e[3]=l,e[4]=f,e[5]=h,e[6]=d,e[7]=m,e[8]=y,e[9]=k,e[10]=x,e[11]=A,e[12]=o*i+f*a+y*n+r[12],e[13]=s*i+h*a+k*n+r[13],e[14]=u*i+d*a+x*n+r[14],e[15]=l*i+m*a+A*n+r[15]),e}function p4(e,r,t){let i=t[0],a=t[1],n=t[2];return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[3]=r[3]*i,e[4]=r[4]*a,e[5]=r[5]*a,e[6]=r[6]*a,e[7]=r[7]*a,e[8]=r[8]*n,e[9]=r[9]*n,e[10]=r[10]*n,e[11]=r[11]*n,e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function d4(e,r,t,i){let a=i[0],n=i[1],o=i[2],s=Math.sqrt(a*a+n*n+o*o),u,l,f,h,d,m,y,k,x,A,P,T,B,C,I,F,H,N,K,V,X,U,$,J;return s<1e-6?null:(s=1/s,a*=s,n*=s,o*=s,l=Math.sin(t),u=Math.cos(t),f=1-u,h=r[0],d=r[1],m=r[2],y=r[3],k=r[4],x=r[5],A=r[6],P=r[7],T=r[8],B=r[9],C=r[10],I=r[11],F=a*a*f+u,H=n*a*f+o*l,N=o*a*f-n*l,K=a*n*f-o*l,V=n*n*f+u,X=o*n*f+a*l,U=a*o*f+n*l,$=n*o*f-a*l,J=o*o*f+u,e[0]=h*F+k*H+T*N,e[1]=d*F+x*H+B*N,e[2]=m*F+A*H+C*N,e[3]=y*F+P*H+I*N,e[4]=h*K+k*V+T*X,e[5]=d*K+x*V+B*X,e[6]=m*K+A*V+C*X,e[7]=y*K+P*V+I*X,e[8]=h*U+k*$+T*J,e[9]=d*U+x*$+B*J,e[10]=m*U+A*$+C*J,e[11]=y*U+P*$+I*J,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)}function h4(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[4],o=r[5],s=r[6],u=r[7],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[4]=n*a+l*i,e[5]=o*a+f*i,e[6]=s*a+h*i,e[7]=u*a+d*i,e[8]=l*a-n*i,e[9]=f*a-o*i,e[10]=h*a-s*i,e[11]=d*a-u*i,e}function m4(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a-l*i,e[1]=o*a-f*i,e[2]=s*a-h*i,e[3]=u*a-d*i,e[8]=n*i+l*a,e[9]=o*i+f*a,e[10]=s*i+h*a,e[11]=u*i+d*a,e}function g4(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[4],f=r[5],h=r[6],d=r[7];return r!==e&&(e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a+l*i,e[1]=o*a+f*i,e[2]=s*a+h*i,e[3]=u*a+d*i,e[4]=l*a-n*i,e[5]=f*a-o*i,e[6]=h*a-s*i,e[7]=d*a-u*i,e}function v4(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=t+t,s=i+i,u=a+a,l=t*o,f=i*o,h=i*s,d=a*o,m=a*s,y=a*u,k=n*o,x=n*s,A=n*u;return e[0]=1-h-y,e[1]=f+A,e[2]=d-x,e[3]=0,e[4]=f-A,e[5]=1-l-y,e[6]=m+k,e[7]=0,e[8]=d+x,e[9]=m-k,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b4(e,r,t,i,a,n,o){let s=1/(t-r),u=1/(a-i),l=1/(n-o);return e[0]=n*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n*2*u,e[6]=0,e[7]=0,e[8]=(t+r)*s,e[9]=(a+i)*u,e[10]=(o+n)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*n*2*l,e[15]=0,e}function XG(e,r,t,i,a){let n=1/Math.tan(r/2);if(e[0]=n/t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){let o=1/(i-a);e[10]=(a+i)*o,e[14]=2*a*i*o}else e[10]=-1,e[14]=-2*i;return e}var y4=XG;function QG(e,r,t,i,a,n,o){let s=1/(r-t),u=1/(i-a),l=1/(n-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(r+t)*s,e[13]=(a+i)*u,e[14]=(o+n)*l,e[15]=1,e}var x4=QG;function w4(e,r,t,i){let a,n,o,s,u,l,f,h,d,m,y=r[0],k=r[1],x=r[2],A=i[0],P=i[1],T=i[2],B=t[0],C=t[1],I=t[2];return Math.abs(y-B)<1e-6&&Math.abs(k-C)<1e-6&&Math.abs(x-I)<1e-6?YG(e):(h=y-B,d=k-C,m=x-I,a=1/Math.sqrt(h*h+d*d+m*m),h*=a,d*=a,m*=a,n=P*m-T*d,o=T*h-A*m,s=A*d-P*h,a=Math.sqrt(n*n+o*o+s*s),a?(a=1/a,n*=a,o*=a,s*=a):(n=0,o=0,s=0),u=d*s-m*o,l=m*n-h*s,f=h*o-d*n,a=Math.sqrt(u*u+l*l+f*f),a?(a=1/a,u*=a,l*=a,f*=a):(u=0,l=0,f=0),e[0]=n,e[1]=u,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=d,e[7]=0,e[8]=s,e[9]=f,e[10]=m,e[11]=0,e[12]=-(n*y+o*k+s*x),e[13]=-(u*y+l*k+f*x),e[14]=-(h*y+d*k+m*x),e[15]=1,e)}function JG(){let e=new Ui(4);return Ui!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function _4(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3];return e[0]=t[0]*i+t[4]*a+t[8]*n+t[12]*o,e[1]=t[1]*i+t[5]*a+t[9]*n+t[13]*o,e[2]=t[2]*i+t[6]*a+t[10]*n+t[14]*o,e[3]=t[3]*i+t[7]*a+t[11]*n+t[15]*o,e}var pne=function(){let e=JG();return function(r,t,i,a,n,o){let s,u;for(t||(t=4),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],e[3]=r[s+3],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2],r[s+3]=e[3];return r}}();var Kv;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Kv||(Kv={}));var ZG=45*Math.PI/180,eW=1,Vv=.1,$v=500,rW=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),gi=class extends Xp{static get IDENTITY(){return aW()}static get ZERO(){return tW()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Kv}constructor(r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(r)?this.copy(r):this.identity()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this[3]=r[3],this[4]=r[4],this[5]=r[5],this[6]=r[6],this[7]=r[7],this[8]=r[8],this[9]=r[9],this[10]=r[10],this[11]=r[11],this[12]=r[12],this[13]=r[13],this[14]=r[14],this[15]=r[15],this.check()}set(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=t,this[2]=i,this[3]=a,this[4]=n,this[5]=o,this[6]=s,this[7]=u,this[8]=l,this[9]=f,this[10]=h,this[11]=d,this[12]=m,this[13]=y,this[14]=k,this[15]=x,this.check()}setRowMajor(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=n,this[2]=l,this[3]=m,this[4]=t,this[5]=o,this[6]=f,this[7]=y,this[8]=i,this[9]=s,this[10]=h,this[11]=k,this[12]=a,this[13]=u,this[14]=d,this[15]=x,this.check()}toRowMajor(r){return r[0]=this[0],r[1]=this[4],r[2]=this[8],r[3]=this[12],r[4]=this[1],r[5]=this[5],r[6]=this[9],r[7]=this[13],r[8]=this[2],r[9]=this[6],r[10]=this[10],r[11]=this[14],r[12]=this[3],r[13]=this[7],r[14]=this[11],r[15]=this[15],r}identity(){return this.copy(rW)}fromObject(r){return this.check()}fromQuaternion(r){return v4(this,r),this.check()}frustum(r){let{left:t,right:i,bottom:a,top:n,near:o=Vv,far:s=$v}=r;return s===1/0?iW(this,t,i,a,n,o):b4(this,t,i,a,n,o,s),this.check()}lookAt(r){let{eye:t,center:i=[0,0,0],up:a=[0,1,0]}=r;return w4(this,t,i,a),this.check()}ortho(r){let{left:t,right:i,bottom:a,top:n,near:o=Vv,far:s=$v}=r;return x4(this,t,i,a,n,o,s),this.check()}orthographic(r){let{fovy:t=ZG,aspect:i=eW,focalDistance:a=1,near:n=Vv,far:o=$v}=r;k4(t);let s=t/2,u=a*Math.tan(s),l=u*i;return this.ortho({left:-l,right:l,bottom:-u,top:u,near:n,far:o})}perspective(r){let{fovy:t=45*Math.PI/180,aspect:i=1,near:a=.1,far:n=500}=r;return k4(t),y4(this,t,i,a,n),this.check()}determinant(){return l4(this)}getScale(r=[-0,-0,-0]){return r[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),r[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),r[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),r}getTranslation(r=[-0,-0,-0]){return r[0]=this[12],r[1]=this[13],r[2]=this[14],r}getRotation(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=0,r[4]=this[4]*a,r[5]=this[5]*n,r[6]=this[6]*o,r[7]=0,r[8]=this[8]*a,r[9]=this[9]*n,r[10]=this[10]*o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}getRotationMatrix3(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=this[4]*a,r[4]=this[5]*n,r[5]=this[6]*o,r[6]=this[8]*a,r[7]=this[9]*n,r[8]=this[10]*o,r}transpose(){return u4(this,this),this.check()}invert(){return c4(this,this),this.check()}multiplyLeft(r){return Wv(this,r,this),this.check()}multiplyRight(r){return Wv(this,this,r),this.check()}rotateX(r){return h4(this,this,r),this.check()}rotateY(r){return m4(this,this,r),this.check()}rotateZ(r){return g4(this,this,r),this.check()}rotateXYZ(r){return this.rotateX(r[0]).rotateY(r[1]).rotateZ(r[2])}rotateAxis(r,t){return d4(this,this,r,t),this.check()}scale(r){return p4(this,this,Array.isArray(r)?r:[r,r,r]),this.check()}translate(r){return f4(this,this,r),this.check()}transform(r,t){return r.length===4?(t=_4(t||[-0,-0,-0,-0],r,this),Vp(t,4),t):this.transformAsPoint(r,t)}transformAsPoint(r,t){let{length:i}=r,a;switch(i){case 2:a=Qj(t||[-0,-0],r,this);break;case 3:a=Xc(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Vp(a,r.length),a}transformAsVector(r,t){let i;switch(r.length){case 2:i=Jj(t||[-0,-0],r,this);break;case 3:i=Kp(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Vp(i,r.length),i}transformPoint(r,t){return this.transformAsPoint(r,t)}transformVector(r,t){return this.transformAsPoint(r,t)}transformDirection(r,t){return this.transformAsVector(r,t)}makeRotationX(r){return this.identity().rotateX(r)}makeTranslation(r,t,i){return this.identity().translate([r,t,i])}},Qp,Jp;function tW(){return Qp||(Qp=new gi([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Qp)),Qp}function aW(){return Jp||(Jp=new gi,Object.freeze(Jp)),Jp}function k4(e){if(e>Math.PI*2)throw Error("expected radians")}function iW(e,r,t,i,a,n){let o=2*n/(t-r),s=2*n/(a-i),u=(t+r)/(t-r),l=(a+i)/(a-i),f=-1,h=-1,d=-2*n;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=l,e[10]=f,e[11]=h,e[12]=0,e[13]=0,e[14]=d,e[15]=0,e}var ls={};kl(ls,{EPSILON1:()=>nW,EPSILON10:()=>hW,EPSILON11:()=>mW,EPSILON12:()=>gW,EPSILON13:()=>vW,EPSILON14:()=>bW,EPSILON15:()=>yW,EPSILON16:()=>xW,EPSILON17:()=>wW,EPSILON18:()=>_W,EPSILON19:()=>kW,EPSILON2:()=>oW,EPSILON20:()=>SW,EPSILON3:()=>sW,EPSILON4:()=>uW,EPSILON5:()=>cW,EPSILON6:()=>lW,EPSILON7:()=>fW,EPSILON8:()=>pW,EPSILON9:()=>dW,PI_OVER_FOUR:()=>jW,PI_OVER_SIX:()=>AW,PI_OVER_TWO:()=>EW,TWO_PI:()=>TW});var nW=.1,oW=.01,sW=.001,uW=1e-4,cW=1e-5,lW=1e-6,fW=1e-7,pW=1e-8,dW=1e-9,hW=1e-10,mW=1e-11,gW=1e-12,vW=1e-13,bW=1e-14,yW=1e-15,xW=1e-16,wW=1e-17,_W=1e-18,kW=1e-19,SW=1e-20,EW=Math.PI/2,jW=Math.PI/4,AW=Math.PI/6,TW=Math.PI*2;var Hn=6356752314245179e-9,PW={radii:[6378137,6378137,Hn],radiiSquared:[6378137*6378137,6378137*6378137,Hn*Hn],oneOverRadii:[1/6378137,1/6378137,1/Hn],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Hn*Hn)],maximumRadius:Math.max(6378137,6378137,Hn),centerToleranceSquared:.1};function Zp(e){return e}var Une=new Ir;function RW(e,r=[],t=Zp){return"longitude"in e?(r[0]=t(e.longitude),r[1]=t(e.latitude),r[2]=e.height):"x"in e?(r[0]=t(e.x),r[1]=t(e.y),r[2]=e.z):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function S4(e,r=[]){return RW(e,r,It._cartographicRadians?Zp:Iv)}function CW(e,r,t=Zp){return"longitude"in r?(r.longitude=t(e[0]),r.latitude=t(e[1]),r.height=e[2]):"x"in r?(r.x=t(e[0]),r.y=t(e[1]),r.z=e[2]):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function E4(e,r){return CW(e,r,It._cartographicRadians?Zp:Bv)}var j4=1e-14,OW=new Ir,A4={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Yv={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Jc={east:new Ir,north:new Ir,up:new Ir,west:new Ir,south:new Ir,down:new Ir},IW=new Ir,BW=new Ir,FW=new Ir;function Xv(e,r,t,i,a,n){let o=A4[r]&&A4[r][t];mi(o&&(!i||i===o));let s,u,l,f=OW.copy(a);if(Nn(f.x,0,j4)&&Nn(f.y,0,j4)){let d=Math.sign(f.z);s=IW.fromArray(Yv[r]),r!=="east"&&r!=="west"&&s.scale(d),u=BW.fromArray(Yv[t]),t!=="east"&&t!=="west"&&u.scale(d),l=FW.fromArray(Yv[i]),i!=="east"&&i!=="west"&&l.scale(d)}else{let{up:d,east:m,north:y}=Jc;m.set(-f.y,f.x,0).normalize(),e.geodeticSurfaceNormal(f,d),y.copy(d).cross(m);let{down:k,west:x,south:A}=Jc;k.copy(d).scale(-1),x.copy(m).scale(-1),A.copy(y).scale(-1),s=Jc[r],u=Jc[t],l=Jc[i]}return n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=l.x,n[9]=l.y,n[10]=l.z,n[11]=0,n[12]=f.x,n[13]=f.y,n[14]=f.z,n[15]=1,n}var gu=new Ir,DW=new Ir,LW=new Ir;function T4(e,r,t=[]){let{oneOverRadii:i,oneOverRadiiSquared:a,centerToleranceSquared:n}=r;gu.from(e);let o=gu.x,s=gu.y,u=gu.z,l=i.x,f=i.y,h=i.z,d=o*o*l*l,m=s*s*f*f,y=u*u*h*h,k=d+m+y,x=Math.sqrt(1/k);if(!Number.isFinite(x))return;let A=DW;if(A.copy(e).scale(x),k<n)return A.to(t);let P=a.x,T=a.y,B=a.z,C=LW;C.set(A.x*P*2,A.y*T*2,A.z*B*2);let I=(1-x)*gu.len()/(.5*C.len()),F=0,H,N,K,V;do{I-=F,H=1/(1+I*P),N=1/(1+I*T),K=1/(1+I*B);let X=H*H,U=N*N,$=K*K,J=X*H,le=U*N,ve=$*K;V=d*X+m*U+y*$-1;let we=-2*(d*J*P+m*le*T+y*ve*B);F=V/we}while(Math.abs(V)>ls.EPSILON12);return gu.scale([H,N,K]).to(t)}var ed=new Ir,P4=new Ir,zW=new Ir,Hi=new Ir,NW=new Ir,rd=new Ir,Gn=class{constructor(r=0,t=0,i=0){ht(this,"radii",void 0),ht(this,"radiiSquared",void 0),ht(this,"radiiToTheFourth",void 0),ht(this,"oneOverRadii",void 0),ht(this,"oneOverRadiiSquared",void 0),ht(this,"minimumRadius",void 0),ht(this,"maximumRadius",void 0),ht(this,"centerToleranceSquared",ls.EPSILON1),ht(this,"squaredXOverSquaredZ",void 0),mi(r>=0),mi(t>=0),mi(i>=0),this.radii=new Ir(r,t,i),this.radiiSquared=new Ir(r*r,t*t,i*i),this.radiiToTheFourth=new Ir(r*r*r*r,t*t*t*t,i*i*i*i),this.oneOverRadii=new Ir(r===0?0:1/r,t===0?0:1/t,i===0?0:1/i),this.oneOverRadiiSquared=new Ir(r===0?0:1/(r*r),t===0?0:1/(t*t),i===0?0:1/(i*i)),this.minimumRadius=Math.min(r,t,i),this.maximumRadius=Math.max(r,t,i),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(r){return this===r||Boolean(r&&this.radii.equals(r.radii))}toString(){return this.radii.toString()}cartographicToCartesian(r,t=[0,0,0]){let i=P4,a=zW,[,,n]=r;this.geodeticSurfaceNormalCartographic(r,i),a.copy(this.radiiSquared).scale(i);let o=Math.sqrt(i.dot(a));return a.scale(1/o),i.scale(n),a.add(i),a.to(t)}cartesianToCartographic(r,t=[0,0,0]){rd.from(r);let i=this.scaleToGeodeticSurface(rd,Hi);if(!i)return;let a=this.geodeticSurfaceNormal(i,P4),n=NW;n.copy(rd).subtract(i);let o=Math.atan2(a.y,a.x),s=Math.asin(a.z),u=Math.sign(Qc.dot(n,rd))*Qc.length(n);return E4([o,s,u],t)}eastNorthUpToFixedFrame(r,t=new gi){return Xv(this,"east","north","up",r,t)}localFrameToFixedFrame(r,t,i,a,n=new gi){return Xv(this,r,t,i,a,n)}geocentricSurfaceNormal(r,t=[0,0,0]){return ed.from(r).normalize().to(t)}geodeticSurfaceNormalCartographic(r,t=[0,0,0]){let i=S4(r),a=i[0],n=i[1],o=Math.cos(n);return ed.set(o*Math.cos(a),o*Math.sin(a),Math.sin(n)).normalize(),ed.to(t)}geodeticSurfaceNormal(r,t=[0,0,0]){return ed.from(r).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(r,t){return T4(r,this,t)}scaleToGeocentricSurface(r,t=[0,0,0]){Hi.from(r);let i=Hi.x,a=Hi.y,n=Hi.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(i*i*o.x+a*a*o.y+n*n*o.z);return Hi.multiplyScalar(s).to(t)}transformPositionToScaledSpace(r,t=[0,0,0]){return Hi.from(r).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(r,t=[0,0,0]){return Hi.from(r).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(r,t=0,i=[0,0,0]){mi(Nn(this.radii.x,this.radii.y,ls.EPSILON15)),mi(this.radii.z>0),Hi.from(r);let a=Hi.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(a)>=this.radii.z-t))return Hi.set(0,0,a).to(i)}};ht(Gn,"WGS84",new Gn(6378137,6378137,Hn));var R4="4.2.2";var C4,UW=(C4=globalThis.loaders)==null?void 0:C4.parseImageNode,Qv=typeof Image<"u",Jv=typeof ImageBitmap<"u",HW=Boolean(UW),Zv=Zo?!0:HW;function O4(e){switch(e){case"auto":return Jv||Qv||Zv;case"imagebitmap":return Jv;case"image":return Qv;case"data":return Zv;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function I4(){if(Jv)return"imagebitmap";if(Qv)return"image";if(Zv)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function GW(e){let r=WW(e);if(!r)throw new Error("Not an image");return r}function B4(e){switch(GW(e)){case"data":return e;case"image":case"imagebitmap":let r=document.createElement("canvas"),t=r.getContext("2d");if(!t)throw new Error("getImageData");return r.width=e.width,r.height=e.height,t.drawImage(e,0,0),t.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function WW(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var VW=/^data:image\/svg\+xml/,$W=/\.svg((\?|#).*)?$/;function td(e){return e&&(VW.test(e)||$W.test(e))}function F4(e,r){if(td(r)){let i=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(n){throw new Error(n.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return e1(e,r)}function e1(e,r){if(td(r))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ad(e,r,t){let i=F4(e,t),a=self.URL||self.webkitURL,n=typeof i!="string"&&a.createObjectURL(i);try{return await KW(n||i,r)}finally{n&&a.revokeObjectURL(n)}}async function KW(e,r){let t=new Image;return t.src=e,r.image&&r.image.decode&&t.decode?(await t.decode(),t):await new Promise((i,a)=>{try{t.onload=()=>i(t),t.onerror=n=>{let o=n instanceof Error?n.message:"error";a(new Error(o))}}catch(n){a(n)}})}var YW={},D4=!0;async function L4(e,r,t){let i;td(t)?i=await ad(e,r,t):i=e1(e,t);let a=r&&r.imagebitmap;return await XW(i,a)}async function XW(e,r=null){if((QW(r)||!D4)&&(r=null),r)try{return await createImageBitmap(e,r)}catch(t){console.warn(t),D4=!1}return await createImageBitmap(e)}function QW(e){for(let r in e||YW)return!1;return!0}function q4(e){return!rV(e,"ftyp",4)||!(e[8]&96)?null:JW(e)}function JW(e){switch(ZW(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ZW(e,r,t){return String.fromCharCode(...e.slice(r,t))}function eV(e){return[...e].map(r=>r.charCodeAt(0))}function rV(e,r,t=0){let i=eV(r);for(let a=0;a<i.length;++a)if(i[a]!==e[a+t])return!1;return!0}var vn=!1,Zc=!0;function id(e){let r=el(e);return aV(r)||oV(r)||iV(r)||nV(r)||tV(r)}function tV(e){let r=new Uint8Array(e instanceof DataView?e.buffer:e),t=q4(r);return t?{mimeType:t.mimeType,width:0,height:0}:null}function aV(e){let r=el(e);return r.byteLength>=24&&r.getUint32(0,vn)===2303741511?{mimeType:"image/png",width:r.getUint32(16,vn),height:r.getUint32(20,vn)}:null}function iV(e){let r=el(e);return r.byteLength>=10&&r.getUint32(0,vn)===1195984440?{mimeType:"image/gif",width:r.getUint16(6,Zc),height:r.getUint16(8,Zc)}:null}function nV(e){let r=el(e);return r.byteLength>=14&&r.getUint16(0,vn)===16973&&r.getUint32(2,Zc)===r.byteLength?{mimeType:"image/bmp",width:r.getUint32(18,Zc),height:r.getUint32(22,Zc)}:null}function oV(e){let r=el(e);if(!(r.byteLength>=3&&r.getUint16(0,vn)===65496&&r.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:a}=sV(),n=2;for(;n+9<r.byteLength;){let o=r.getUint16(n,vn);if(a.has(o))return{mimeType:"image/jpeg",height:r.getUint16(n+5,vn),width:r.getUint16(n+7,vn)};if(!i.has(o))return null;n+=2,n+=r.getUint16(n,vn)}return null}function sV(){let e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function el(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 M4(e,r){var a;let{mimeType:t}=id(e)||{},i=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return Mi(i),await i(e,t)}async function z4(e,r,t){r=r||{};let a=(r.image||{}).type||"auto",{url:n}=t||{},o=uV(a),s;switch(o){case"imagebitmap":s=await L4(e,r,n);break;case"image":s=await ad(e,r,n);break;case"data":s=await M4(e,r);break;default:Mi(!1)}return a==="data"&&(s=B4(s)),s}function uV(e){switch(e){case"auto":case"data":return I4();default:return O4(e),e}}var cV=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],lV=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],fV={image:{type:"auto",decode:!0}},nd={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:R4,mimeTypes:lV,extensions:cV,parse:z4,tests:[e=>Boolean(id(new DataView(e)))],options:fV};var N4="4.2.2";var U4={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:N4,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function G4(e,r,t){let i=W4(r.metadata),a=[],n=pV(r.attributes);for(let o in e){let s=e[o],u=H4(o,s,n[o]);a.push(u)}if(t){let o=H4("indices",t);a.push(o)}return{fields:a,metadata:i}}function pV(e){let r={};for(let t in e){let i=e[t];r[i.name||"undefined"]=i}return r}function H4(e,r,t){let i=t?W4(t.metadata):void 0;return Rv(e,r,i)}function W4(e){Object.entries(e);let r={};for(let t in e)r[`${t}.string`]=JSON.stringify(e[t]);return r}var V4={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},dV={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},hV=4,rl=class{draco;decoder;metadataQuerier;constructor(r){this.draco=r,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(r,t={}){let i=new this.draco.DecoderBuffer;i.Init(new Int8Array(r),r.byteLength),this._disableAttributeTransforms(t);let a=this.decoder.GetEncodedGeometryType(i),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(a){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,n);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!n.ptr){let d=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(d)}let s=this._getDracoLoaderData(n,a,t),u=this._getMeshData(n,s,t),l=Pv(u.attributes),f=G4(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:l},...u,schema:f}}finally{this.draco.destroy(i),n&&this.draco.destroy(n)}}_getDracoLoaderData(r,t,i){let a=this._getTopLevelMetadata(r),n=this._getDracoAttributes(r,i);return{geometry_type:t,num_attributes:r.num_attributes(),num_points:r.num_points(),num_faces:r instanceof this.draco.Mesh?r.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(r,t){let i={};for(let a=0;a<r.num_attributes();a++){let n=this.decoder.GetAttribute(r,a),o=this._getAttributeMetadata(r,a);i[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:o};let s=this._getQuantizationTransform(n,t);s&&(i[n.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(n,t);u&&(i[n.unique_id()].octahedron_transform=u)}return i}_getMeshData(r,t,i){let a=this._getMeshAttributes(t,r,i);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(r instanceof this.draco.Mesh)switch(i.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(r),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(r),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(r,t,i){let a={};for(let n of Object.values(r.attributes)){let o=this._deduceAttributeName(n,i);n.name=o;let s=this._getAttributeValues(t,n);if(s){let{value:u,size:l}=s;a[o]={value:u,size:l,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}}return a}_getTriangleListIndices(r){let i=r.num_faces()*3,a=i*hV,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(r,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,i).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(r){let t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(r,t),vV(t)}finally{this.draco.destroy(t)}}_getAttributeValues(r,t){let i=dV[t.data_type];if(!i)return console.warn(`DRACO: Unsupported attribute type ${t.data_type}`),null;let a=t.num_components,o=r.num_points()*a,s=o*i.BYTES_PER_ELEMENT,u=mV(this.draco,i),l,f=this.draco._malloc(s);try{let h=this.decoder.GetAttribute(r,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(r,h,u,s,f),l=new i(this.draco.HEAPF32.buffer,f,o).slice()}finally{this.draco._free(f)}return{value:l,size:a}}_deduceAttributeName(r,t){let i=r.unique_id;for(let[o,s]of Object.entries(t.extraAttributes||{}))if(s===i)return o;let a=r.attribute_type;for(let o in V4)if(this.draco[o]===a)return V4[o];let n=t.attributeNameEntry||"name";return r.metadata[n]?r.metadata[n].string:`CUSTOM_ATTRIBUTE_${i}`}_getTopLevelMetadata(r){let t=this.decoder.GetMetadata(r);return this._getDracoMetadata(t)}_getAttributeMetadata(r,t){let i=this.decoder.GetAttributeMetadata(r,t);return this._getDracoMetadata(i)}_getDracoMetadata(r){if(!r||!r.ptr)return{};let t={},i=this.metadataQuerier.NumEntries(r);for(let a=0;a<i;a++){let n=this.metadataQuerier.GetEntryName(r,a);t[n]=this._getDracoMetadataField(r,n)}return t}_getDracoMetadataField(r,t){let i=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(r,t,i);let a=gV(i);return{int:this.metadataQuerier.GetIntEntry(r,t),string:this.metadataQuerier.GetStringEntry(r,t),double:this.metadataQuerier.GetDoubleEntry(r,t),intArray:a}}finally{this.draco.destroy(i)}}_disableAttributeTransforms(r){let{quantizedAttributes:t=[],octahedronAttributes:i=[]}=r,a=[...t,...i];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(r,t){let{quantizedAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))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(r,t){let{octahedronAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function mV(e,r){switch(r){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 gV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}function vV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}var bV="1.5.6",yV="1.4.1",r1=`https://www.gstatic.com/draco/versioned/decoders/${bV}`,Ha={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},t1={[Ha.DECODER]:`${r1}/${Ha.DECODER}`,[Ha.DECODER_WASM]:`${r1}/${Ha.DECODER_WASM}`,[Ha.FALLBACK_DECODER]:`${r1}/${Ha.FALLBACK_DECODER}`,[Ha.ENCODER]:`https://raw.githubusercontent.com/google/draco/${yV}/javascript/${Ha.ENCODER}`},a1;async function $4(e){let r=e.modules||{};return r.draco3d?a1||=r.draco3d.createDecoderModule({}).then(t=>({draco:t})):a1||=xV(e),await a1}async function xV(e){let r,t;switch(e.draco&&e.draco.decoderType){case"js":r=await gn(t1[Ha.FALLBACK_DECODER],"draco",e,Ha.FALLBACK_DECODER);break;case"wasm":default:[r,t]=await Promise.all([await gn(t1[Ha.DECODER],"draco",e,Ha.DECODER),await gn(t1[Ha.DECODER_WASM],"draco",e,Ha.DECODER_WASM)])}return r=r||globalThis.DracoDecoderModule,await wV(r,t)}function wV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e({...t,onModuleLoaded:a=>i({draco:a})})})}var K4={...U4,parse:_V};async function _V(e,r){let{draco:t}=await $4(r),i=new rl(t);try{return i.parseSync(e,r==null?void 0:r.draco)}finally{i.destroy()}}var od="4.2.2";var sd={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Y4;async function n1(e){Wg(e.modules);let r=Vg("basis");return r||(Y4||=kV(e),await Y4)}async function kV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(sd.TRANSCODER,"textures",e),await gn(sd.TRANSCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await SV(r,t)}function SV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,initializeBasis:o}=a;o(),i({BasisFile:n})})})}var i1;async function o1(e){let r=e.modules||{};return r.basisEncoder?r.basisEncoder:(i1=i1||EV(e),await i1)}async function EV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(sd.ENCODER,"textures",e),await gn(sd.ENCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await jV(r,t)}function jV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,KTX2File:o,initializeBasis:s,BasisEncoder:u}=a;s(),i({BasisFile:n,KTX2File:o,BasisEncoder:u})})})}var ce={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 AV=["","WEBKIT_","MOZ_"],X4={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"},ud=null;function Q4(e){if(!ud){e=e||TV()||void 0,ud=new Set;for(let r of AV)for(let t in X4)if(e&&e.getExtension(`${r}${t}`)){let i=X4[t];ud.add(i)}}return ud}function TV(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var cA=Jt(sA(),1);function vu(e,r){let t=new Array(r.mipMapLevels),i=r.width,a=r.height,n=0;for(let o=0;o<r.mipMapLevels;++o){let s=CV(r,i,a,e,o),u=RV(e,o,n,s);t[o]={compressed:!0,format:r.internalFormat,data:u,width:i,height:a,levelSize:s},i=Math.max(1,i>>1),a=Math.max(1,a>>1),n+=s}return t}function RV(e,r,t,i){return Array.isArray(e)?e[r].levelData:new Uint8Array(e.buffer,e.byteOffset+t,i)}function CV(e,r,t,i,a){return Array.isArray(i)?e.sizeFunction(i[a]):e.sizeFunction(r,t)}var OV={131:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,132:ce.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:ce.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:ce.COMPRESSED_RED_RGTC1_EXT,140:ce.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:ce.COMPRESSED_RED_GREEN_RGTC2_EXT,142:ce.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:ce.COMPRESSED_RGB8_ETC2,148:ce.COMPRESSED_SRGB8_ETC2,149:ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:ce.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:ce.COMPRESSED_RGBA8_ETC2_EAC,152:ce.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:ce.COMPRESSED_R11_EAC,154:ce.COMPRESSED_SIGNED_R11_EAC,155:ce.COMPRESSED_RG11_EAC,156:ce.COMPRESSED_SIGNED_RG11_EAC,157:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,158:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,160:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,162:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,164:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,166:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,168:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,170:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,172:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,174:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,176:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,178:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,180:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,182:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:ce.COMPRESSED_RGBA_ASTC_12x12_KHR,184:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:ce.COMPRESSED_RGBA_ASTC_12x12_KHR};function uA(e){return OV[e]}var Ja=[171,75,84,88,32,50,48,187,13,10,26,10];function dd(e){let r=new Uint8Array(e);return!(r.byteLength<Ja.length||r[0]!==Ja[0]||r[1]!==Ja[1]||r[2]!==Ja[2]||r[3]!==Ja[3]||r[4]!==Ja[4]||r[5]!==Ja[5]||r[6]!==Ja[6]||r[7]!==Ja[7]||r[8]!==Ja[8]||r[9]!==Ja[9]||r[10]!==Ja[10]||r[11]!==Ja[11])}function lA(e){let r=new Uint8Array(e),t=(0,cA.read)(r),i=Math.max(1,t.levels.length),a=t.pixelWidth,n=t.pixelHeight,o=uA(t.vkFormat);return vu(t.levels,{mipMapLevels:i,width:a,height:n,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var IV={etc1:{basisFormat:0,compressed:!0,format:ce.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ce.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ce.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:ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ce.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 al(e,r){if(r.basis.containerFormat==="auto"){if(dd(e)){let i=await o1(r);return fA(i.KTX2File,e,r)}let{BasisFile:t}=await n1(r);return f1(t,e,r)}switch(r.basis.module){case"encoder":let t=await o1(r);switch(r.basis.containerFormat){case"ktx2":return fA(t.KTX2File,e,r);case"basis":default:return f1(t.BasisFile,e,r)}case"transcoder":default:let{BasisFile:i}=await n1(r);return f1(i,e,r)}}function f1(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("Failed to start basis transcoding");let a=i.getNumImages(),n=[];for(let o=0;o<a;o++){let s=i.getNumLevels(o),u=[];for(let l=0;l<s;l++)u.push(BV(i,o,l,t));n.push(u)}return n}finally{i.close(),i.delete()}}function BV(e,r,t,i){let a=e.getImageWidth(r,t),n=e.getImageHeight(r,t),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:l}=pA(i,o),f=e.getImageTranscodedSizeInBytes(r,t,l),h=new Uint8Array(f);if(!e.transcodeImage(h,r,t,l,0,0))throw new Error("failed to start Basis transcoding");return{width:a,height:n,data:h,compressed:s,format:u,hasAlpha:o}}function fA(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("failed to start KTX2 transcoding");let a=i.getLevels(),n=[];for(let o=0;o<a;o++){n.push(FV(i,o,t));break}return[n]}finally{i.close(),i.delete()}}function FV(e,r,t){let{alphaFlag:i,height:a,width:n}=e.getImageLevelInfo(r,0,0),{compressed:o,format:s,basisFormat:u}=pA(t,i),l=e.getImageTranscodedSizeInBytes(r,0,0,u),f=new Uint8Array(l);if(!e.transcodeImage(f,r,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:n,height:a,data:f,compressed:o,levelSize:l,hasAlpha:i,format:s}}function pA(e,r){let t=e&&e.basis&&e.basis.format;return t==="auto"&&(t=DV()),typeof t=="object"&&(t=r?t.alpha:t.noAlpha),t=t.toLowerCase(),IV[t]}function DV(){let e=Q4();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 dA={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:od,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"}}},il={...dA,parse:al};var Za={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},LV={DXT1:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":ce.COMPRESSED_RGB_ATC_WEBGL,ATCA:ce.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:ce.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},qV=gA,MV=hd,zV=hd,NV={DXT1:gA,DXT3:hd,DXT5:hd,"ATC ":qV,ATCA:MV,ATCI:zV};function hA(e){return new Uint32Array(e,0,Za.HEADER_LENGTH)[Za.MAGIC_NUMBER_INDEX]===Za.MAGIC_NUMBER}function mA(e){let r=new Int32Array(e,0,Za.HEADER_LENGTH),t=r[Za.HEADER_PF_FOURCC_INDEX];Mi(Boolean(r[Za.HEADER_PF_FLAGS_INDEX]&Za.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let i=UV(t),a=LV[i],n=NV[i];Mi(a&&n,`DDS: Unknown pixel format ${t}`);let o=1;r[Za.HEADER_FLAGS_INDEX]&Za.DDSD_MIPMAPCOUNT&&(o=Math.max(1,r[Za.MIPMAPCOUNT_INDEX]));let s=r[Za.HEADER_WIDTH_INDEX],u=r[Za.HEADER_HEIGHT_INDEX],l=r[Za.HEADER_SIZE_INDEX]+4,f=new Uint8Array(e,l);return vu(f,{mipMapLevels:o,width:s,height:u,sizeFunction:n,internalFormat:a})}function gA(e,r){return(e+3>>2)*(r+3>>2)*8}function hd(e,r){return(e+3>>2)*(r+3>>2)*16}function UV(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var vi={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},HV={0:[ce.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[ce.COMPRESSED_RGB_ETC1_WEBGL],7:[ce.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[ce.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[ce.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[ce.COMPRESSED_RGB8_ETC2],23:[ce.COMPRESSED_RGBA8_ETC2_EAC],24:[ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[ce.COMPRESSED_R11_EAC],26:[ce.COMPRESSED_RG11_EAC],27:[ce.COMPRESSED_RGBA_ASTC_4X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[ce.COMPRESSED_RGBA_ASTC_5X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[ce.COMPRESSED_RGBA_ASTC_5X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[ce.COMPRESSED_RGBA_ASTC_6X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[ce.COMPRESSED_RGBA_ASTC_6X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[ce.COMPRESSED_RGBA_ASTC_8X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[ce.COMPRESSED_RGBA_ASTC_8X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[ce.COMPRESSED_RGBA_ASTC_8X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[ce.COMPRESSED_RGBA_ASTC_10X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[ce.COMPRESSED_RGBA_ASTC_10X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[ce.COMPRESSED_RGBA_ASTC_10X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[ce.COMPRESSED_RGBA_ASTC_10X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[ce.COMPRESSED_RGBA_ASTC_12X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[ce.COMPRESSED_RGBA_ASTC_12X12_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},GV={0:vA,1:vA,2:bA,3:bA,6:nl,7:nl,9:ol,11:ol,22:nl,23:ol,24:nl,25:nl,26:ol,27:ol,28:WV,29:VV,30:$V,31:KV,32:YV,33:XV,34:QV,35:JV,36:ZV,37:e$,38:r$,39:t$,40:a$};function yA(e){let t=new Uint32Array(e,0,vi.HEADER_LENGTH)[vi.MAGIC_NUMBER_INDEX];return t===vi.MAGIC_NUMBER||t===vi.MAGIC_NUMBER_EXTRA}function xA(e){let r=new Uint32Array(e,0,vi.HEADER_LENGTH),t=r[vi.PIXEL_FORMAT_INDEX],i=r[vi.COLOUR_SPACE_INDEX],a=HV[t]||[],n=a.length>1&&i?a[1]:a[0],o=GV[t],s=r[vi.MIPMAPCOUNT_INDEX],u=r[vi.WIDTH_INDEX],l=r[vi.HEIGHT_INDEX],f=vi.HEADER_SIZE+r[vi.METADATA_SIZE_INDEX],h=new Uint8Array(e,f);return vu(h,{mipMapLevels:s,width:u,height:l,sizeFunction:o,internalFormat:n})}function vA(e,r){return e=Math.max(e,16),r=Math.max(r,8),e*r/4}function bA(e,r){return e=Math.max(e,8),r=Math.max(r,8),e*r/2}function nl(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*8}function ol(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*16}function WV(e,r){return Math.floor((e+4)/5)*Math.floor((r+3)/4)*16}function VV(e,r){return Math.floor((e+4)/5)*Math.floor((r+4)/5)*16}function $V(e,r){return Math.floor((e+5)/6)*Math.floor((r+4)/5)*16}function KV(e,r){return Math.floor((e+5)/6)*Math.floor((r+5)/6)*16}function YV(e,r){return Math.floor((e+7)/8)*Math.floor((r+4)/5)*16}function XV(e,r){return Math.floor((e+7)/8)*Math.floor((r+5)/6)*16}function QV(e,r){return Math.floor((e+7)/8)*Math.floor((r+7)/8)*16}function JV(e,r){return Math.floor((e+9)/10)*Math.floor((r+4)/5)*16}function ZV(e,r){return Math.floor((e+9)/10)*Math.floor((r+5)/6)*16}function e$(e,r){return Math.floor((e+9)/10)*Math.floor((r+7)/8)*16}function r$(e,r){return Math.floor((e+9)/10)*Math.floor((r+9)/10)*16}function t$(e,r){return Math.floor((e+11)/12)*Math.floor((r+9)/10)*16}function a$(e,r){return Math.floor((e+11)/12)*Math.floor((r+11)/12)*16}function wA(e){if(dd(e))return lA(e);if(hA(e))return mA(e);if(yA(e))return xA(e);throw new Error("Texture container format not recognized")}var _A={dataType:null,batchType:null,name:"Texture Containers",id:"compressed-texture",module:"textures",version:od,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:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},md={..._A,parse:async(e,r)=>{var t;return(t=r==null?void 0:r["compressed-texture"])!=null&&t.useBasis?(r.basis={format:{alpha:"BC3",noAlpha:"BC1"},...r.basis,containerFormat:"ktx2",module:"encoder"},(await al(e,r))[0]):wA(e)}};function kA(e,r=null){return r?`${e}?token=${r}`:e}var i$={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},n$={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},fs={...i$,...n$};function p1(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 SA={UInt8:fs.UNSIGNED_BYTE,UInt16:fs.UNSIGNED_SHORT,Float32:fs.FLOAT,UInt32:fs.UNSIGNED_INT,UInt64:fs.DOUBLE};function bu(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 gd=new Ir([0,0,0]);function o$(e){switch(e){case"ktx-etc2":case"dds":return md;case"ktx2":return il;case"jpg":case"png":default:return nd}}var s$="i3s-attribute-type";async function TA(e,r,t,i,a){var o;let n={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new gi,coordinateSystem:0,byteLength:0,texture:null};if(r.textureUrl){let s=kA(r.textureUrl,(o=i==null?void 0:i.i3s)==null?void 0:o.token),u=o$(r.textureFormat),h=await(await((a==null?void 0:a.fetch)||fetch)(s)).arrayBuffer();if(i!=null&&i.i3s.decodeTextures){if(u===nd){let d={...r.textureLoaderOptions,image:{type:"data"}};try{let m=await zg(h,[],d,a);n.texture=m}catch{let y=await zn(h,u,d,a);n.texture=y}}else if(u===md||u===il){let d=await Cv(h,u,r.textureLoaderOptions);u===il&&(d=d[0]),n.texture={compressed:!0,mipmaps:!1,width:d[0].width,height:d[0].height,data:d}}}else n.texture=h}return n.material=g$(r.materialDefinition,n.texture),n.material&&(n.texture=null),await u$(e,n,r,t,i)}async function u$(e,r,t,i,a){var h,d;let n=e.byteLength,o,s,u=0,l=0,f;if(t.isDracoGeometry){let m=await zn(e,K4,{draco:{attributeNameEntry:s$}});s=m.header.vertexCount,f=(h=m.indices)==null?void 0:h.value;let{POSITION:y,NORMAL:k,COLOR_0:x,TEXCOORD_0:A,["feature-index"]:P,["uv-region"]:T}=m.attributes;o={position:y,normal:k,color:x,uv0:A,uvRegion:T,id:P},c$(o,m);let B=x$(P);B&&y$(o,B)}else{let{vertexAttributes:m,ordering:y,featureAttributes:k,featureAttributeOrder:x}=i.store.defaultGeometrySchema,A=f$(e,i);u=A.byteOffset,s=A.vertexCount,l=A.featureCount;let{attributes:P,byteOffset:T}=jA(e,u,m,s,y),{attributes:B}=jA(e,T,k,l,x);b$(B),o=l$(P,B)}if(!((d=a==null?void 0:a.i3s)!=null&&d.coordinateSystem)||a.i3s.coordinateSystem===2){let m=d$(o.position,t);r.modelMatrix=m.invert(),r.coordinateSystem=2}else r.modelMatrix=m$(o.position),r.coordinateSystem=3;r.attributes={positions:o.position,normals:o.normal,colors:EA(o.color),texCoords:o.uv0,uvRegions:EA(o.uvRegion||o.region)},r.indices=f||null,o.id&&o.id.value&&(r.featureIds=o.id.value);for(let m in r.attributes)r.attributes[m]||delete r.attributes[m];return r.vertexCount=s,r.byteLength=n,r}function c$(e,r){for(let t in r.loaderData.attributes){let i=r.loaderData.attributes[t];switch(i.name){case"POSITION":e.position.metadata=i.metadata;break;case"feature-index":e.id.metadata=i.metadata;break;default:break}}}function l$(e,r){return{...e,...r}}function EA(e){return e&&(e.normalized=!0,e)}function f$(e,r){let t=0,i=0,a=0;for(let{property:n,type:o}of r.store.defaultGeometrySchema.header){let s=p1(o);switch(n){case"vertexCount".toString():i=new s(e,0,4)[0],t+=bu(o);break;case"featureCount".toString():a=new s(e,4,4)[0],t+=bu(o);break;default:break}}return{vertexCount:i,featureCount:a,byteOffset:t}}function jA(e,r,t,i,a){let n={};for(let o of a)if(t[o]){let{valueType:s,valuesPerElement:u}=t[o];if(r+i*u*bu(s)<=e.byteLength){let l=e.slice(r),f;if(s==="UInt64")f=p$(l,i*u,bu(s));else{let h=p1(s);f=new h(l,0,i*u)}switch(n[o]={value:f,type:SA[s],size:u},o){case"color":n.color.normalized=!0;break;case"position":case"region":case"normal":default:}r=r+i*u*bu(s)}else if(o!=="uv0")break}return{attributes:n,byteOffset:r}}function p$(e,r,t){let i=[],a=new DataView(e),n=0;for(let o=0;o<r;o++){let s=a.getUint32(n,!0),u=a.getUint32(n+4,!0),l=s+2**32*u;i.push(l),n+=t}return new Uint32Array(i)}function d$(e,r){let t=r.mbs,i=e.value,a=e.metadata,n=new gi,o=new Ir(t[0],t[1],t[2]),s=new Ir;return Gn.WGS84.cartographicToCartesian(o,s),Gn.WGS84.eastNorthUpToFixedFrame(s,n),e.value=h$(i,a,o),n}function h$(e,r={},t){let i=new Float64Array(e.length),a=r["i3s-scale_x"]&&r["i3s-scale_x"].double||1,n=r["i3s-scale_y"]&&r["i3s-scale_y"].double||1;for(let o=0;o<i.length;o+=3)i[o]=e[o]*a+t.x,i[o+1]=e[o+1]*n+t.y,i[o+2]=e[o+2]+t.z;for(let o=0;o<i.length;o+=3)Gn.WGS84.cartographicToCartesian(i.subarray(o,o+3),gd),i[o]=gd.x,i[o+1]=gd.y,i[o+2]=gd.z;return i}function m$(e){var n,o;let r=e.metadata,t=((n=r==null?void 0:r["i3s-scale_x"])==null?void 0:n.double)||1,i=((o=r==null?void 0:r["i3s-scale_y"])==null?void 0:o.double)||1,a=new gi;return a[0]=t,a[5]=i,a}function g$(e,r){let t;return e?t={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(t={pbrMetallicRoughness:{}},r?t.pbrMetallicRoughness.baseColorTexture={texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),t.alphaCutoff=t.alphaCutoff||.25,t.alphaMode&&(t.alphaMode=t.alphaMode.toUpperCase()),t.emissiveFactor&&(t.emissiveFactor=AA(t.emissiveFactor)),t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorFactor&&(t.pbrMetallicRoughness.baseColorFactor=AA(t.pbrMetallicRoughness.baseColorFactor)),r&&v$(t,r),t}function AA(e){let r=[...e];for(let t=0;t<e.length;t++)r[t]=e[t]/255;return r}function v$(e,r){let t={source:{image:r}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:t}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:t}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:t}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:t}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:t})}function b$(e){let{id:r,faceRange:t}=e;if(!r||!t)return;let i=r.value,a=t.value,n=a[a.length-1]+1,o=new Uint32Array(n*3),s=0,u=0;for(let l=1;l<a.length;l+=2){let f=Number(i[s]),h=a[l],d=a[l-1],m=h-d+1,y=u+m*3;o.fill(f,u,y),s++,u=y}e.id.value=o}function y$(e,r){let t=e.id.value,i=new Float32Array(t.length);for(let a=0;a<t.length;a++)i[a]=r[t[a]];e.id.value=i}function x$(e){var r,t;return(t=(r=e==null?void 0:e.metadata)==null?void 0:r["i3s-feature-ids"])==null?void 0:t.intArray}var w$="4.2.2",PA={dataType:null,batchType:null,name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:w$,mimeTypes:["application/octet-stream"],parse:_$,extensions:["bin"],options:{"i3s-content":{}}};async function _$(e,r,t){let{tile:i,_tileOptions:a,tileset:n,_tilesetOptions:o}=(r==null?void 0:r.i3s)||{},s=a||i,u=o||n;return!s||!u?null:await TA(e,s,u,r,t)}ev(PA);
101
101
  /*! Bundled license information:
102
102
 
103
103
  is-buffer/index.js: