@loaders.gl/core 5.0.0-alpha.5 → 5.0.0-alpha.7

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.
Files changed (33) hide show
  1. package/dist/dist.dev.js +398 -49
  2. package/dist/dist.min.js +3 -3
  3. package/dist/index.cjs +405 -51
  4. package/dist/index.cjs.map +3 -3
  5. package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
  6. package/dist/lib/api/parse-in-batches.js +6 -2
  7. package/dist/lib/api/parse-in-batches.js.map +1 -1
  8. package/dist/lib/api/parse.js +2 -2
  9. package/dist/lib/api/parse.js.map +1 -1
  10. package/dist/lib/init.js +1 -1
  11. package/dist/lib/loader-utils/get-fetch-function.d.ts.map +1 -1
  12. package/dist/lib/loader-utils/get-fetch-function.js +2 -1
  13. package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
  14. package/dist/lib/loader-utils/loader-context.d.ts +1 -1
  15. package/dist/lib/loader-utils/loader-context.d.ts.map +1 -1
  16. package/dist/lib/loader-utils/loader-context.js +6 -3
  17. package/dist/lib/loader-utils/loader-context.js.map +1 -1
  18. package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
  19. package/dist/lib/loader-utils/option-defaults.js +1 -0
  20. package/dist/lib/loader-utils/option-defaults.js.map +1 -1
  21. package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
  22. package/dist/lib/loader-utils/option-utils.js +12 -1
  23. package/dist/lib/loader-utils/option-utils.js.map +1 -1
  24. package/dist/null-loader.js +1 -1
  25. package/dist/null-worker-node.js +29 -3
  26. package/dist/null-worker.js +29 -3
  27. package/package.json +6 -6
  28. package/src/lib/api/parse-in-batches.ts +11 -2
  29. package/src/lib/api/parse.ts +2 -2
  30. package/src/lib/loader-utils/get-fetch-function.ts +2 -1
  31. package/src/lib/loader-utils/loader-context.ts +6 -3
  32. package/src/lib/loader-utils/option-defaults.ts +1 -0
  33. package/src/lib/loader-utils/option-utils.ts +13 -1
package/dist/dist.min.js CHANGED
@@ -4,13 +4,13 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var Xe=Object.defineProperty;var So=Object.getOwnPropertyDescriptor;var Lo=Object.getOwnPropertyNames;var _o=Object.prototype.hasOwnProperty;var Kr=(e,r)=>{for(var t in r)Xe(e,t,{get:r[t],enumerable:!0})},Bo=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Lo(r))!_o.call(e,n)&&n!==t&&Xe(e,n,{get:()=>r[n],enumerable:!(o=So(r,n))||o.enumerable});return e};var Eo=e=>Bo(Xe({},"__esModule",{value:!0}),e);var ps={};Kr(ps,{FetchError:()=>me,JSONLoader:()=>Pr,NullLoader:()=>bo,NullWorkerLoader:()=>wo,RequestScheduler:()=>le,_BrowserFileSystem:()=>Ye,_fetchProgress:()=>xo,_selectSource:()=>ho,_unregisterLoaders:()=>Vt,assert:()=>ne,concatenateArrayBuffersAsync:()=>z,coreApi:()=>ye,createDataSource:()=>po,document:()=>or,encode:()=>fo,encodeInBatches:()=>mo,encodeSync:()=>Gr,encodeTable:()=>Hr,encodeTableAsText:()=>ao,encodeTableInBatches:()=>Qr,encodeText:()=>uo,encodeTextSync:()=>lo,encodeURLtoURL:()=>Jr,fetchFile:()=>T,forEach:()=>Lr,getLoaderOptions:()=>C,getPathPrefix:()=>Cr,global:()=>tr,isAsyncIterable:()=>X,isBrowser:()=>w,isIterable:()=>D,isIterator:()=>ce,isPromise:()=>we,isPureObject:()=>k,isReadableStream:()=>O,isResponse:()=>d,isWorker:()=>nr,isWritableStream:()=>lr,load:()=>te,loadInBatches:()=>Z,makeIterator:()=>re,makeLineIterator:()=>kr,makeNumberedLineIterator:()=>Sr,makeStream:()=>yo,makeTextDecoderIterator:()=>Tr,makeTextEncoderIterator:()=>Ar,parse:()=>p,parseFile:()=>Q,parseInBatches:()=>b,parseSync:()=>J,preload:()=>so,preloadSync:()=>io,readArrayBuffer:()=>Mt,registerLoaders:()=>zt,resolvePath:()=>q,selectLoader:()=>I,selectLoaderSync:()=>L,self:()=>er,setLoaderOptions:()=>Mr,setPathPrefix:()=>Rr,window:()=>rr});function ne(e,r){if(!e)throw new Error(r||"loader assertion failed.")}var E={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},er=E.self||E.window||E.global||{},rr=E.window||E.self||E.global||{},tr=E.global||E.self||E.window||{},or=E.document||{};var w=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),nr=typeof importScripts=="function",Yr=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ro=Yr&&parseFloat(Yr[1])||0;var Me=globalThis,Co=globalThis.document||{},Ne=globalThis.process||{},Io=globalThis.console,ws=globalThis.navigator||{};function Xr(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let r=typeof navigator<"u"&&navigator.userAgent,t=e||r;return!!(t&&t.indexOf("Electron")>=0)}function K(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Xr()}var sr="4.1.1";function se(e,r){if(!e)throw new Error(r||"Assertion failed")}function ir(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 se(Number.isFinite(r)&&r>=0),r}function et(e){let{logLevel:r,message:t}=e;e.logLevel=ir(r);let o=e.args?Array.from(e.args):[];for(;o.length&&o.shift()!==t;);switch(typeof r){case"string":case"function":t!==void 0&&o.unshift(t),e.message=r;break;case"object":Object.assign(e,r);break;default:}typeof e.message=="function"&&(e.message=e.message());let n=typeof e.message;return se(n==="string"||n==="object"),Object.assign(e,{args:o},e.opts)}var Y=()=>{},Ue=class{constructor({level:r=0}={}){this.userData={},this._onceCache=new Set,this._level=r}set level(r){this.setLevel(r)}get level(){return this.getLevel()}setLevel(r){return this._level=r,this}getLevel(){return this._level}warn(r,...t){return this._log("warn",0,r,t,{once:!0})}error(r,...t){return this._log("error",0,r,t)}log(r,t,...o){return this._log("log",r,t,o)}info(r,t,...o){return this._log("info",r,t,o)}once(r,t,...o){return this._log("once",r,t,o,{once:!0})}_log(r,t,o,n,s={}){let a=et({logLevel:t,message:o,args:this._buildArgs(t,o,n),opts:s});return this._createLogFunction(r,a,s)}_buildArgs(r,t,o){return[r,t,...o]}_createLogFunction(r,t,o){if(!this._shouldLog(t.logLevel))return Y;let n=this._getOnceTag(o.tag??t.tag??t.message);if((o.once||t.once)&&n!==void 0){if(this._onceCache.has(n))return Y;this._onceCache.add(n)}return this._emit(r,t)}_shouldLog(r){return this.getLevel()>=ir(r)}_getOnceTag(r){if(r!==void 0)try{return typeof r=="string"?r:String(r)}catch{return}}};function Oo(e){try{let r=window[e],t="__storage_test__";return r.setItem(t,t),r.removeItem(t),r}catch{return null}}var $e=class{constructor(r,t,o="sessionStorage"){this.storage=Oo(o),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 rt(e){let r;return e<10?r=`${e.toFixed(2)}ms`:e<100?r=`${e.toFixed(1)}ms`:e<1e3?r=`${e.toFixed(0)}ms`:r=`${(e/1e3).toFixed(2)}s`,r}function tt(e,r=8){let t=Math.max(r-e.length,0);return`${" ".repeat(t)}${e}`}var ve;(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"})(ve||(ve={}));var Wo=10;function ot(e){return typeof e!="string"?e:(e=e.toUpperCase(),ve[e]||ve.WHITE)}function nt(e,r,t){return!K&&typeof e=="string"&&(r&&(e=`\x1B[${ot(r)}m${e}\x1B[39m`),t&&(e=`\x1B[${ot(t)+Wo}m${e}\x1B[49m`)),e}function st(e,r=["constructor"]){let t=Object.getPrototypeOf(e),o=Object.getOwnPropertyNames(t),n=e;for(let s of o){let a=n[s];typeof a=="function"&&(r.find(i=>s===i)||(n[s]=a.bind(e)))}}function ie(){let e;if(K()&&Me.performance)e=Me?.performance?.now?.();else if("hrtime"in Ne){let r=Ne?.hrtime?.();e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}var ae={debug:K()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ar={enabled:!0,level:0},_=class extends Ue{constructor({id:r}={id:""}){super({level:0}),this.VERSION=sr,this._startTs=ie(),this._deltaTs=ie(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=r,this.userData={},this._storage=new $e(`__probe-${this.id}__`,{[this.id]:ar}),this.timeStamp(`${this.id} started`),st(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((ie()-this._startTs).toPrecision(10))}getDelta(){return Number((ie()-this._deltaTs).toPrecision(10))}set priority(r){this.level=r}get priority(){return this.level}getPriority(){return this.level}enable(r=!0){return this._updateConfiguration({enabled:r}),this}setLevel(r){return this._updateConfiguration({level:r}),this}get(r){return this._getConfiguration()[r]}set(r,t){this._updateConfiguration({[r]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(r,t){if(!r)throw new Error(t||"Assertion failed")}warn(r,...t){return this._log("warn",0,r,t,{method:ae.warn,once:!0})}error(r,...t){return this._log("error",0,r,t,{method:ae.error})}deprecated(r,t){return this.warn(`\`${r}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(r,t){return this.error(`\`${r}\` has been removed. Use \`${t}\` instead`)}probe(r,t,...o){return this._log("log",r,t,o,{method:ae.log,time:!0,once:!0})}log(r,t,...o){return this._log("log",r,t,o,{method:ae.debug})}info(r,t,...o){return this._log("info",r,t,o,{method:console.info})}once(r,t,...o){return this._log("once",r,t,o,{method:ae.debug||ae.info,once:!0})}table(r,t,o){return t?this._log("table",r,t,o&&[o]||[],{method:console.table||Y,tag:Mo(t)}):Y}time(r,t){return this._log("time",r,t,[],{method:console.time?console.time:console.info})}timeEnd(r,t){return this._log("time",r,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(r,t){return this._log("time",r,t,[],{method:console.timeStamp||Y})}group(r,t,o={collapsed:!1}){let n=(o.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",r,t,[],{method:n})}groupCollapsed(r,t,o={}){return this.group(r,t,Object.assign({},o,{collapsed:!0}))}groupEnd(r){return this._log("groupEnd",r,"",[],{method:console.groupEnd||Y})}withGroup(r,t,o){this.group(r,t)();try{o()}finally{this.groupEnd(r)()}}trace(){console.trace&&console.trace()}_shouldLog(r){return this.isEnabled()&&super._shouldLog(r)}_emit(r,t){let o=t.method;se(o),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=ie();let n=Fo(this.id,t.message,t);return o.bind(console,n,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(ar),this._storage.config[this.id]}_updateConfiguration(r){let t=this._storage.config[this.id]||{...ar};this._storage.setConfiguration({[this.id]:{...t,...r}})}};_.VERSION=sr;function Fo(e,r,t){if(typeof r=="string"){let o=t.time?tt(rt(t.total)):"";r=t.time?`${e}: ${o} ${r}`:`${e}: ${r}`,r=nt(r,t.color,t.background)}return r}function Mo(e){for(let r in e)for(let t in e[r])return t||"untitled";return"empty"}globalThis.probe={};var Gs=new _({id:"@probe.gl/log"});var cr="5.0.0-alpha.5",No=cr[0]>="0"&&cr[0]<="9"?`v${cr}`:"";function Uo(){let e=new _({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=No,globalThis.probe||={},globalThis.probe.loaders=e,e}var fr=Uo();var it=e=>typeof e=="boolean",y=e=>typeof e=="function",x=e=>e!==null&&typeof e=="object",k=e=>x(e)&&e.constructor==={}.constructor;var ur=e=>typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer,v=e=>x(e)&&typeof e.byteLength=="number"&&typeof e.slice=="function",we=e=>x(e)&&"then"in e&&y(e.then),D=e=>!!e&&y(e[Symbol.iterator]),X=e=>!!e&&y(e[Symbol.asyncIterator]),ce=e=>!!e&&y(e.next),d=e=>typeof Response<"u"&&e instanceof Response||x(e)&&y(e.arrayBuffer)&&y(e.text)&&y(e.json);var m=e=>typeof Blob<"u"&&e instanceof Blob;var at=e=>x(e)&&y(e.abort)&&y(e.getWriter),ct=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||x(e)&&y(e.tee)&&y(e.cancel)&&y(e.getReader),ft=e=>x(e)&&y(e.end)&&y(e.write)&&it(e.writable),ut=e=>x(e)&&y(e.read)&&y(e.pipe)&&it(e.readable),O=e=>ct(e)||ut(e),lr=e=>at(e)||ft(e);function be(e,r){return lt(e||{},r)}function lt(e,r,t=0){if(t>3)return r;let o={...e};for(let[n,s]of Object.entries(r))k(s)?o[n]=lt(o[n]||{},r[n],t+1):o[n]=r[n];return o}function mr(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}var mt="latest";function $o(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="5.0.0-alpha.5"),globalThis._loadersgl_.version}var xe=$o();function W(e,r){if(!e)throw new Error(r||"loaders.gl assertion failed.")}var R={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ai=R.self||R.window||R.global||{},ci=R.window||R.self||R.global||{},fi=R.global||R.self||R.window||{},ui=R.document||{};var S=typeof process!="object"||String(process)!=="[object process]"||process.browser;var dt=typeof window<"u"&&typeof window.orientation<"u",pt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),li=pt&&parseFloat(pt[1])||0;var Te=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(r,t){this.name=r,this.workerThread=t,this.result=new Promise((o,n)=>{this._resolve=o,this._reject=n})}postMessage(r,t){this.workerThread.postMessage({source:"loaders.gl",type:r,payload:t})}done(r){this.isRunning&&(this.isRunning=!1,this._resolve(r))}error(r){this.isRunning&&(this.isRunning=!1,this._reject(r))}abort(r){if(!this.isRunning)return;let t=r??vo(`Worker job "${this.name}" was aborted`);this.workerThread.destroy(),this.error(t)}};function vo(e){let r=new Error(e);return r.name="AbortError",r}var fe=class{constructor(...r){let o=globalThis.process?.getBuiltinModule?.("node:worker_threads").Worker;if(o)return new o(...r)}terminate(){}};var pr=new Map;function ht(e){W(e.source&&!e.url||!e.source&&e.url);let r=pr.get(e.source||e.url);return r||(e.url&&(r=Do(e.url),pr.set(e.url,r)),e.source&&(r=yt(e.source),pr.set(e.source,r))),W(r),r}function Do(e){if(!e.startsWith("http"))return e;let r=jo(e);return yt(r)}function yt(e){let r=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(r)}function jo(e){return`try {
7
+ "use strict";var __exports__=(()=>{var cr=Object.defineProperty;var qo=Object.getOwnPropertyDescriptor;var Vo=Object.getOwnPropertyNames;var Ho=Object.prototype.hasOwnProperty;var dt=(e,r)=>{for(var t in r)cr(e,t,{get:r[t],enumerable:!0})},Qo=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Vo(r))!Ho.call(e,n)&&n!==t&&cr(e,n,{get:()=>r[n],enumerable:!(o=qo(r,n))||o.enumerable});return e};var Go=e=>Qo(cr({},"__esModule",{value:!0}),e);var Ps={};dt(Ps,{FetchError:()=>be,JSONLoader:()=>Jr,NullLoader:()=>Do,NullWorkerLoader:()=>$o,RequestScheduler:()=>we,_BrowserFileSystem:()=>ir,_fetchProgress:()=>jo,_selectSource:()=>Uo,_unregisterLoaders:()=>ho,assert:()=>fe,concatenateArrayBuffersAsync:()=>J,coreApi:()=>ke,createDataSource:()=>Mo,document:()=>mr,encode:()=>Co,encodeInBatches:()=>Oo,encodeSync:()=>lt,encodeTable:()=>ut,encodeTableAsText:()=>Io,encodeTableInBatches:()=>ft,encodeText:()=>Po,encodeTextSync:()=>Fo,encodeURLtoURL:()=>mt,fetchFile:()=>k,forEach:()=>jr,getLoaderOptions:()=>F,getPathPrefix:()=>Qr,global:()=>lr,isAsyncIterable:()=>se,isBrowser:()=>y,isIterable:()=>Q,isIterator:()=>de,isPromise:()=>Se,isPureObject:()=>S,isReadableStream:()=>N,isResponse:()=>p,isWorker:()=>hr,isWritableStream:()=>xr,load:()=>ue,loadInBatches:()=>te,makeIterator:()=>ae,makeLineIterator:()=>$r,makeNumberedLineIterator:()=>Dr,makeStream:()=>vo,makeTextDecoderIterator:()=>vr,makeTextEncoderIterator:()=>Nr,parse:()=>d,parseFile:()=>X,parseInBatches:()=>x,parseSync:()=>re,preload:()=>Bo,preloadSync:()=>Ro,readArrayBuffer:()=>oo,registerLoaders:()=>lo,resolvePath:()=>K,selectLoader:()=>O,selectLoaderSync:()=>_,self:()=>ur,setLoaderOptions:()=>Xr,setPathPrefix:()=>Hr,window:()=>fr});function fe(e,r){if(!e)throw new Error(r||"loader assertion failed.")}var W={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ur=W.self||W.window||W.global||{},fr=W.window||W.self||W.global||{},lr=W.global||W.self||W.window||{},mr=W.document||{};var y=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),hr=typeof importScripts=="function",pt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Jo=pt&&parseFloat(pt[1])||0;var qe=globalThis,Ko=globalThis.document||{},Ve=globalThis.process||{},Zo=globalThis.console,Us=globalThis.navigator||{};function yt(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let r=typeof navigator<"u"&&navigator.userAgent,t=e||r;return!!(t&&t.indexOf("Electron")>=0)}function oe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||yt()}var dr="4.1.1";function le(e,r){if(!e)throw new Error(r||"Assertion failed")}function pr(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 le(Number.isFinite(r)&&r>=0),r}function gt(e){let{logLevel:r,message:t}=e;e.logLevel=pr(r);let o=e.args?Array.from(e.args):[];for(;o.length&&o.shift()!==t;);switch(typeof r){case"string":case"function":t!==void 0&&o.unshift(t),e.message=r;break;case"object":Object.assign(e,r);break;default:}typeof e.message=="function"&&(e.message=e.message());let n=typeof e.message;return le(n==="string"||n==="object"),Object.assign(e,{args:o},e.opts)}var ne=()=>{},He=class{constructor({level:r=0}={}){this.userData={},this._onceCache=new Set,this._level=r}set level(r){this.setLevel(r)}get level(){return this.getLevel()}setLevel(r){return this._level=r,this}getLevel(){return this._level}warn(r,...t){return this._log("warn",0,r,t,{once:!0})}error(r,...t){return this._log("error",0,r,t)}log(r,t,...o){return this._log("log",r,t,o)}info(r,t,...o){return this._log("info",r,t,o)}once(r,t,...o){return this._log("once",r,t,o,{once:!0})}_log(r,t,o,n,s={}){let a=gt({logLevel:t,message:o,args:this._buildArgs(t,o,n),opts:s});return this._createLogFunction(r,a,s)}_buildArgs(r,t,o){return[r,t,...o]}_createLogFunction(r,t,o){if(!this._shouldLog(t.logLevel))return ne;let n=this._getOnceTag(o.tag??t.tag??t.message);if((o.once||t.once)&&n!==void 0){if(this._onceCache.has(n))return ne;this._onceCache.add(n)}return this._emit(r,t)}_shouldLog(r){return this.getLevel()>=pr(r)}_getOnceTag(r){if(r!==void 0)try{return typeof r=="string"?r:String(r)}catch{return}}};function Xo(e){try{let r=window[e],t="__storage_test__";return r.setItem(t,t),r.removeItem(t),r}catch{return null}}var Qe=class{constructor(r,t,o="sessionStorage"){this.storage=Xo(o),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 wt(e){let r;return e<10?r=`${e.toFixed(2)}ms`:e<100?r=`${e.toFixed(1)}ms`:e<1e3?r=`${e.toFixed(0)}ms`:r=`${(e/1e3).toFixed(2)}s`,r}function bt(e,r=8){let t=Math.max(r-e.length,0);return`${" ".repeat(t)}${e}`}var Ge;(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"})(Ge||(Ge={}));var en=10;function xt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ge[e]||Ge.WHITE)}function Tt(e,r,t){return!oe&&typeof e=="string"&&(r&&(e=`\x1B[${xt(r)}m${e}\x1B[39m`),t&&(e=`\x1B[${xt(t)+en}m${e}\x1B[49m`)),e}function kt(e,r=["constructor"]){let t=Object.getPrototypeOf(e),o=Object.getOwnPropertyNames(t),n=e;for(let s of o){let a=n[s];typeof a=="function"&&(r.find(i=>s===i)||(n[s]=a.bind(e)))}}function me(){let e;if(oe()&&qe.performance)e=qe?.performance?.now?.();else if("hrtime"in Ve){let r=Ve?.hrtime?.();e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}var he={debug:oe()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},yr={enabled:!0,level:0},L=class extends He{constructor({id:r}={id:""}){super({level:0}),this.VERSION=dr,this._startTs=me(),this._deltaTs=me(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=r,this.userData={},this._storage=new Qe(`__probe-${this.id}__`,{[this.id]:yr}),this.timeStamp(`${this.id} started`),kt(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((me()-this._startTs).toPrecision(10))}getDelta(){return Number((me()-this._deltaTs).toPrecision(10))}set priority(r){this.level=r}get priority(){return this.level}getPriority(){return this.level}enable(r=!0){return this._updateConfiguration({enabled:r}),this}setLevel(r){return this._updateConfiguration({level:r}),this}get(r){return this._getConfiguration()[r]}set(r,t){this._updateConfiguration({[r]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(r,t){if(!r)throw new Error(t||"Assertion failed")}warn(r,...t){return this._log("warn",0,r,t,{method:he.warn,once:!0})}error(r,...t){return this._log("error",0,r,t,{method:he.error})}deprecated(r,t){return this.warn(`\`${r}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(r,t){return this.error(`\`${r}\` has been removed. Use \`${t}\` instead`)}probe(r,t,...o){return this._log("log",r,t,o,{method:he.log,time:!0,once:!0})}log(r,t,...o){return this._log("log",r,t,o,{method:he.debug})}info(r,t,...o){return this._log("info",r,t,o,{method:console.info})}once(r,t,...o){return this._log("once",r,t,o,{method:he.debug||he.info,once:!0})}table(r,t,o){return t?this._log("table",r,t,o&&[o]||[],{method:console.table||ne,tag:tn(t)}):ne}time(r,t){return this._log("time",r,t,[],{method:console.time?console.time:console.info})}timeEnd(r,t){return this._log("time",r,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(r,t){return this._log("time",r,t,[],{method:console.timeStamp||ne})}group(r,t,o={collapsed:!1}){let n=(o.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",r,t,[],{method:n})}groupCollapsed(r,t,o={}){return this.group(r,t,Object.assign({},o,{collapsed:!0}))}groupEnd(r){return this._log("groupEnd",r,"",[],{method:console.groupEnd||ne})}withGroup(r,t,o){this.group(r,t)();try{o()}finally{this.groupEnd(r)()}}trace(){console.trace&&console.trace()}_shouldLog(r){return this.isEnabled()&&super._shouldLog(r)}_emit(r,t){let o=t.method;le(o),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=me();let n=rn(this.id,t.message,t);return o.bind(console,n,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(yr),this._storage.config[this.id]}_updateConfiguration(r){let t=this._storage.config[this.id]||{...yr};this._storage.setConfiguration({[this.id]:{...t,...r}})}};L.VERSION=dr;function rn(e,r,t){if(typeof r=="string"){let o=t.time?bt(wt(t.total)):"";r=t.time?`${e}: ${o} ${r}`:`${e}: ${r}`,r=Tt(r,t.color,t.background)}return r}function tn(e){for(let r in e)for(let t in e[r])return t||"untitled";return"empty"}globalThis.probe={};var hi=new L({id:"@probe.gl/log"});var gr="5.0.0-alpha.7",on=gr[0]>="0"&&gr[0]<="9"?`v${gr}`:"";function nn(){let e=new L({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=on,globalThis.probe||={},globalThis.probe.loaders=e,e}var wr=nn();var At=e=>typeof e=="boolean",g=e=>typeof e=="function",T=e=>e!==null&&typeof e=="object",S=e=>T(e)&&e.constructor==={}.constructor;var br=e=>typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer,H=e=>T(e)&&typeof e.byteLength=="number"&&typeof e.slice=="function",Se=e=>T(e)&&"then"in e&&g(e.then),Q=e=>!!e&&g(e[Symbol.iterator]),se=e=>!!e&&g(e[Symbol.asyncIterator]),de=e=>!!e&&g(e.next),p=e=>typeof Response<"u"&&e instanceof Response||T(e)&&g(e.arrayBuffer)&&g(e.text)&&g(e.json);var h=e=>typeof Blob<"u"&&e instanceof Blob;var St=e=>T(e)&&g(e.abort)&&g(e.getWriter),_t=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||T(e)&&g(e.tee)&&g(e.cancel)&&g(e.getReader),Lt=e=>T(e)&&g(e.end)&&g(e.write)&&At(e.writable),Et=e=>T(e)&&g(e.read)&&g(e.pipe)&&At(e.readable),N=e=>_t(e)||Et(e),xr=e=>St(e)||Lt(e);function _e(e,r){return Bt(e||{},r)}function Bt(e,r,t=0){if(t>3)return r;let o={...e};for(let[n,s]of Object.entries(r))S(s)?o[n]=Bt(o[n]||{},r[n],t+1):o[n]=r[n];return o}function Tr(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}var Rt="latest";function sn(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="5.0.0-alpha.7"),globalThis._loadersgl_.version}var Le=sn();function $(e,r){if(!e)throw new Error(r||"loaders.gl assertion failed.")}var C={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Li=C.self||C.window||C.global||{},Ei=C.window||C.self||C.global||{},Bi=C.global||C.self||C.window||{},Ri=C.document||{};var b=typeof process!="object"||String(process)!=="[object process]"||process.browser;var Wt=typeof window<"u"&&typeof window.orientation<"u",It=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ii=It&&parseFloat(It[1])||0;var Ee=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(r,t){this.name=r,this.workerThread=t,this.result=new Promise((o,n)=>{this._resolve=o,this._reject=n})}postMessage(r,t){this.workerThread.postMessage({source:"loaders.gl",type:r,payload:t})}done(r){this.isRunning&&(this.isRunning=!1,this._resolve(r))}error(r){this.isRunning&&(this.isRunning=!1,this._reject(r))}abort(r){if(!this.isRunning)return;let t=r??an(`Worker job "${this.name}" was aborted`);this.workerThread.destroy(),this.error(t)}};function an(e){let r=new Error(e);return r.name="AbortError",r}var pe=class{constructor(...r){let o=globalThis.process?.getBuiltinModule?.("node:worker_threads").Worker;if(o)return new o(...r)}terminate(){}};var kr=new Map;function Ct(e){$(e.source&&!e.url||!e.source&&e.url);let r=kr.get(e.source||e.url);return r||(e.url&&(r=cn(e.url),kr.set(e.url,r)),e.source&&(r=Pt(e.source),kr.set(e.source,r))),$(r),r}function cn(e){if(!e.startsWith("http"))return e;let r=un(e);return Pt(r)}function Pt(e){let r=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(r)}function un(e){return`try {
8
8
  importScripts('${e}');
9
9
  } catch (error) {
10
10
  console.error(error);
11
11
  throw error;
12
- }`}function dr(e,r=!0,t){let o=t||new Set;if(e){if(gt(e))o.add(e);else if(gt(e.buffer))o.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(r&&typeof e=="object")for(let n in e)dr(e[n],r,o)}}return t===void 0?Array.from(o):[]}function gt(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}function De(e){if(e===null)return{};let r=Object.assign({},e);return Object.keys(r).forEach(t=>{typeof e[t]=="object"&&!ArrayBuffer.isView(e[t])&&!(e[t]instanceof Array)?r[t]=De(e[t]):typeof r[t]=="function"||r[t]instanceof RegExp?r[t]={}:r[t]=e[t]}),r}var hr=()=>{},j=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&S||typeof fe<"u"&&!S}constructor(r){let{name:t,source:o,url:n}=r;W(o||n),this.name=t,this.source=o,this.url=n,this.onMessage=hr,this.onError=s=>console.log(s),this.worker=S?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=hr,this.onError=hr,this.worker.terminate(),this.terminated=!0}unref(){!S&&typeof this.worker.unref=="function"&&this.worker.unref()}ref(){!S&&typeof this.worker.ref=="function"&&this.worker.ref()}get isRunning(){return!!this.onMessage}postMessage(r,t){t=t||dr(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=ht({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 o=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,n=o.startsWith("file:")?new URL(o):o,s=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";r=new fe(n,{eval:!1,type:s})}else if(this.source)r=new fe(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 Ae=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return j.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=(n,s,a)=>n.done(a),o=(n,s)=>n.error(s)){let n=new Promise(s=>(this.jobQueue.push({name:r,onMessage:t,onError:o,onStart:s}),this));return this._startQueuedJob(),await n}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 o=new Te(t.name,r);r.ref(),r.onMessage=n=>t.onMessage(o,n.type,n.payload),r.onError=n=>t.onError(o,n),t.onStart(o);try{await o.result}catch{}finally{this.returnWorkerToQueue(r)}}}returnWorkerToQueue(r){r.terminated||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(r.terminated||r.destroy(),this.count--):(r.unref(),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 j({name:r,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return dt?this.maxMobileConcurrency:this.maxConcurrency}};var zo={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},F=class e{props;workerPools=new Map;static _workerFarm;static isSupported(){return j.isSupported()}static getWorkerFarm(r={}){return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(r),e._workerFarm}constructor(r){this.props={...zo},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:o,url:n}=r,s=this.workerPools.get(t);return s||(s=new Ae({name:t,source:o,url:n}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};var wt=new Set;function bt(e){let r=e.version!==xe?` (worker-utils@${xe})`:"";return`${e.name}@${e.version}${r}`}function xt(e,r={}){let t=r[e.id]||{},o=S?`${e.id}-worker.js`:e.workerNode||`${e.id}-worker-node.js`,n=t.workerUrl;if(!n&&typeof e.worker=="string"&&(n=e.worker),!n&&e.id==="compression"&&(n=r.workerUrl),(r._workerType||r?.core?._workerType)==="test"&&(S?n=`modules/${e.module}/dist/${o}`:n=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!n){let a=e.version;a==="latest"&&(a=mt);let i=a?`@${a}`:"";n=`https://unpkg.com/@loaders.gl/${e.module}${i}/dist/${o}`,qo(e,n)}return W(n),n}function qo(e,r){if(e.version!=="latest")return;let t=`${e.module}:${e.id}`;wt.has(t)||(wt.add(t),console.warn(`loaders.gl: ${e.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${r} from CDN.`))}function yr(e,r){if(!F.isSupported())return!1;let t=r?.[e.id];return!!((e.worker||t?.workerUrl)&&r?.worker)}async function ke(e,r,t={},o={},n={}){Vo(t.signal);let s=bt(e),a=F.getWorkerFarm(t),{source:i}=t,c={name:s,source:i};i||(c.url=xt(e,t));let f=a.getWorkerPool(c),u=t.jobName||e.name,l=await f.startJob(u,Qo.bind(null,o)),h=()=>l.abort(Tt(t.signal));t.signal?.addEventListener("abort",h,{once:!0}),t.signal?.aborted&&h();try{let{signal:ge,...oe}=t,Ao=De(oe),ko=De(n);return l.isRunning&&l.postMessage("process",{input:r,options:Ao,context:ko}),(await l.result).result}finally{t.signal?.removeEventListener("abort",h)}}function Vo(e){if(e?.aborted)throw Tt(e)}function Tt(e){return e?.reason??Ho("Worker job was aborted")}function Ho(e){let r=new Error(e);return r.name="AbortError",r}async function Qo(e,r,t,o){switch(t){case"done":r.done(o);break;case"error":r.error(new Error(o.error));break;case"process":let{id:n,input:s,options:a}=o;try{if(!e.process){r.postMessage("error",{id:n,error:"Worker not set up to process on main thread"});return}let i=await e.process(s,a,void 0,o.context||{});r.postMessage("done",{id:n,result:i})}catch(i){let c=i instanceof Error?i.message:"unknown error";r.postMessage("error",{id:n,error:c})}break;default:console.warn(`process-on-worker: unknown message ${t}`)}}function Se(e,r=xe){W(e,"no worker provided");let t=e.version;return!(!r||!t)}function gr(e,r){let t=At(r),o=t._nodeWorkers;return!S&&!o||e.id==="excel"&&r?.excel?.shape==="arrow-table"||e.id==="ply"&&r?.ply?.shape==="arrow-table"||e.id==="csv"&&!Ko(r)?!1:!!yr(e,t)}async function wr(e,r,t,o,n,s){let a=s||Go(t),i=await ke(e,r,{...At(t),signal:a},{process:async(c,f,u,l)=>{if(!n)throw new Error("Worker not set up to parse on main thread");let h=o?{...o,...l||{}}:void 0;return await Jo(n,c,f,h)}},Zo(o));return Yo(e)?e.deserializeWorkerResult(i,t,o):i}function Go(e){let r=e?.parquet?.signal;if(typeof AbortSignal<"u"&&r instanceof AbortSignal)return r}function Jo(e,r,t,o){return e.length<=2?e(r,t):e(r,void 0,t,o)}function At(e={}){let r=JSON.parse(JSON.stringify(e));return{...r.core,...r}}function Zo(e){if(!e)return{};let{fetch:r,loaders:t,coreApi:o,_parse:n,_parseSync:s,_parseInBatches:a,...i}=e;return JSON.parse(JSON.stringify(i))}function Ko(e){let r=e;return(r?.csv?.shape??r?.core?.shape)==="arrow-table"}function Yo(e){return typeof e.deserializeWorkerResult=="function"}function br(e,r){if(!F.isSupported())return!1;let t=r?._nodeWorkers??r?.core?._nodeWorkers,o=r?.worker??r?.core?.worker;return!w&&!t?!1:!!(e.worker&&o)}function xr(e,r,t){if(t=t||e.byteLength,e.byteLength<t||r.byteLength<t)return!1;let o=new Uint8Array(e),n=new Uint8Array(r);for(let s=0;s<o.length;++s)if(o[s]!==n[s])return!1;return!0}function Le(...e){return kt(e)}function kt(e){let r=e.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),t=r.reduce((s,a)=>s+a.byteLength,0),o=new Uint8Array(t),n=0;for(let s of r)o.set(s,n),n+=s.byteLength;return o.buffer}async function*Tr(e,r={}){let t=new TextDecoder(void 0,r);for await(let o of e)yield typeof o=="string"?o:t.decode(o,{stream:!0})}async function*Ar(e){let r=new TextEncoder;for await(let t of e)yield typeof t=="string"?r.encode(t).buffer:t}async function*kr(e){let r="";for await(let t of e){r+=t;let o;for(o=r.indexOf(`
12
+ }`}function Ar(e,r=!0,t){let o=t||new Set;if(e){if(Ft(e))o.add(e);else if(Ft(e.buffer))o.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(r&&typeof e=="object")for(let n in e)Ar(e[n],r,o)}}return t===void 0?Array.from(o):[]}function Ft(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}function ye(e){if(e===null)return{};let r=Object.assign({},e);return Object.keys(r).forEach(t=>{typeof e[t]=="object"&&!ArrayBuffer.isView(e[t])&&!(e[t]instanceof Array)?r[t]=ye(e[t]):typeof r[t]=="function"||r[t]instanceof RegExp?r[t]={}:r[t]=e[t]}),r}var Sr=()=>{},G=class{name;source;url;getUrl;loadWorker;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&b||typeof pe<"u"&&!b}constructor(r){let{name:t,source:o,url:n,getUrl:s,loadWorker:a}=r;$(o||n||s||a),this.name=t,this.source=o,this.url=n,this.getUrl=s,this.loadWorker=a,this.onMessage=Sr,this.onError=i=>console.log(i),this.worker=b?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Sr,this.onError=Sr,this.worker.terminate(),this.terminated=!0}unref(){!b&&typeof this.worker.unref=="function"&&this.worker.unref()}ref(){!b&&typeof this.worker.ref=="function"&&this.worker.ref()}get isRunning(){return!!this.onMessage}postMessage(r,t){t=t||Ar(r),this.worker.postMessage(r,t)}_getErrorFromErrorEvent(r){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url||"built-in worker factory"}. `,r.message&&(t+=`${r.message} in `),r.lineno&&(t+=`:${r.lineno}:${r.colno}`),new Error(t)}_createBrowserWorker(){if(this.loadWorker)try{let o=this.loadWorker();if(o)return this._initializeBrowserWorker(o)}catch(o){if(!this.source&&!this.url&&!this.getUrl)throw o}let r=this.url||this.getUrl?.();this._loadableURL=Ct({source:this.source,url:r});let t=new Worker(this._loadableURL,{name:this.name});return this._initializeBrowserWorker(t)}_initializeBrowserWorker(r){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 o=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,n=o.startsWith("file:")?new URL(o):o,s=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";r=new pe(n,{eval:!1,type:s})}else if(this.source)r=new pe(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 Be=class{name="unnamed";source;url;getUrl;loadWorker;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];activeJobs=new Set;count=0;isDestroyed=!1;static isSupported(){return G.isSupported()}constructor(r){this.source=r.source,this.url=r.url,this.getUrl=r.getUrl,this.loadWorker=r.loadWorker,this.setProps(r)}destroy(r=new Error("Worker pool was destroyed")){this.activeJobs.forEach(o=>o.abort(r)),this.jobQueue.splice(0).forEach(o=>o.onReject(r)),this.idleQueue.forEach(o=>o.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=(n,s,a)=>n.done(a),o=(n,s)=>n.error(s)){if(this.isDestroyed)return Promise.reject(new Error("Worker pool was destroyed"));let n=new Promise((s,a)=>(this.jobQueue.push({name:r,onMessage:t,onError:o,onStart:s,onReject:a}),this));return this._startQueuedJob(),await n}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 o=new Ee(t.name,r);this.activeJobs.add(o),r.ref(),r.onMessage=n=>t.onMessage(o,n.type,n.payload),r.onError=n=>t.onError(o,n),t.onStart(o);try{await o.result}catch{}finally{this.activeJobs.delete(o),this.returnWorkerToQueue(r)}}}returnWorkerToQueue(r){r.terminated||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(r.terminated||r.destroy(),this.count--):(r.unref(),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 G({name:r,source:this.source,url:this.url,getUrl:this.getUrl,loadWorker:this.loadWorker})}return null}_getMaxConcurrency(){return Wt?this.maxMobileConcurrency:this.maxConcurrency}};var fn={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},Ot=new WeakMap,ln=1,P=class e{props;workerPools=new Map;static _workerFarm;static isSupported(){return G.isSupported()}static getWorkerFarm(r={}){return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(r),e._workerFarm}constructor(r){this.props={...fn},this.setProps(r),this.workerPools=new Map}destroy(r){for(let t of this.workerPools.values())t.destroy(r);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:o,url:n,getUrl:s,loadWorker:a}=r,i=mn(r),c=this.workerPools.get(i);return c||(c=new Be({name:t,source:o,url:n,getUrl:s,loadWorker:a}),c.setProps(this._getWorkerPoolProps()),this.workerPools.set(i,c)),c}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};function mn(e){let{name:r,source:t,url:o,urlKey:n,loadWorker:s}=e,a=t?`source:${t}`:"",i=o||n?`url:${o||n}`:"",c=s?`loadWorker:${hn(s)}`:"";return[r,a,i,c].filter(Boolean).join("|")}function hn(e){let r=Ot.get(e);return r||(r=ln++,Ot.set(e,r)),r}var Re=class{_values;_settlers;_closed;constructor(){this._values=[],this._settlers=[],this._closed=!1}[Symbol.asyncIterator](){return this}push(r){return this.enqueue(r)}enqueue(r){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");let t=this._settlers.shift();r instanceof Error?t.reject(r):t.resolve({value:r})}else this._values.push(r)}close(){for(;this._settlers.length>0;)this._settlers.shift().resolve({done:!0});this._closed=!0}next(){if(this._values.length>0){let r=this._values.shift();return r instanceof Error?Promise.reject(r):Promise.resolve({done:!1,value:r})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0,value:void 0})}return new Promise((r,t)=>{this._settlers.push({resolve:r,reject:t})})}};var Mt=new Set;function _r(e){let r=e.version!==Le?` (worker-utils@${Le})`:"";return`${e.name}@${e.version}${r}`}function Lr(e,r={}){let t=r[e.id]||{},o=b?e.workerFile||`${e.id}-worker.js`:e.workerNode||`${e.id}-worker-node.js`,n=t.workerUrl;!n&&e.id==="compression"&&(n=r.workerUrl);let s=r._workerType||r?.core?._workerType;return!n&&s==="test"&&(b?n=`modules/${e.module}/dist/${o}`:n=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),n||null}function Er(e,r={}){let t=Lr(e,r),o=typeof e.worker=="string"?e.worker:null,n=t||o||Br(e,!0);return $(n),n}function Br(e,r=!1){let t=b?e.workerFile||`${e.id}-worker.js`:e.workerNode||`${e.id}-worker-node.js`,o=e.version;o==="latest"&&(o=Rt);let n=o?`@${o}`:"",s=`https://unpkg.com/@loaders.gl/${e.module}${n}/dist/${t}`;return r&&dn(e,s),s}function dn(e,r){if(e.version!=="latest")return;let t=`${e.module}:${e.id}`;Mt.has(t)||(Mt.add(t),console.warn(`loaders.gl: ${e.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${r} from CDN.`))}function Rr(e,r){if(!P.isSupported())return!1;let t=r?.[e.id];return!!((e.worker||e.loadWorker||t?.workerUrl)&&r?.worker)}async function Ie(e,r,t={},o={},n={}){Ut(t.signal);let s=_r(e),i=P.getWorkerFarm(t).getWorkerPool(Nt(e,t,s)),c=t.jobName||e.name,u=await i.startJob(c,$t.bind(null,o)),f=()=>u.abort(Wr(t.signal));t.signal?.addEventListener("abort",f,{once:!0}),t.signal?.aborted&&f();try{let{signal:l,...m}=t,U=ye(m),V=ye(n);return u.isRunning&&u.postMessage("process",{input:r,options:U,context:V}),(await u.result).result}finally{t.signal?.removeEventListener("abort",f)}}function Ir(e,r,t={},o={},n={}){return pn(e,r,t,o,n)}async function*pn(e,r,t,o,n){Ut(t.signal);let s=_r(e),i=P.getWorkerFarm(t).getWorkerPool(Nt(e,t,s)),c=new Re,u=yn(r),f=!1,l=!1,m=Promise.resolve(),U=new Error("Worker batch job failed"),V=()=>{f||(f=!0,c.close())},ze=R=>{f||(f=!0,c.enqueue(U),c.close())},B=await i.startJob(t.jobName||e.name,(R,Ae,v)=>{switch(Ae){case"input-request":m=m.then(async()=>{let I=await u.next();R.isRunning&&(I.done?(l=!0,R.postMessage("input-done",{})):R.postMessage("input-batch",{input:I.value}))}).catch(I=>R.abort(I));break;case"output-batch":c.push(v.result);break;case"done":R.done(v),V();break;case"error":{let I=new Error(v.error||"Worker batch processing failed");R.error(I),ze(I);break}case"process":$t(o,R,Ae,v);break;default:{let I=new Error(`Unexpected worker batch message: ${Ae}`);R.error(I),ze(I);break}}}),ar=()=>B.abort(Wr(t.signal));t.signal?.addEventListener("abort",ar,{once:!0}),t.signal?.aborted&&ar(),B.result.catch(ze);try{let{signal:R,...Ae}=t;B.isRunning&&B.postMessage("process-in-batches",{options:ye(Ae),context:ye(n)});try{for await(let v of c)yield v,B.isRunning&&B.postMessage("output-ack",{})}catch(v){throw v===U&&await B.result,v}await B.result}finally{t.signal?.removeEventListener("abort",ar),B.isRunning&&B.abort(vt("Worker batch iterator was closed")),l||gn(u)}}function Ut(e){if(e?.aborted)throw Wr(e)}function Wr(e){return e?.reason??vt("Worker job was aborted")}function vt(e){let r=new Error(e);return r.name="AbortError",r}function yn(e){return Symbol.asyncIterator in e?e[Symbol.asyncIterator]():(async function*(){yield*e})()}function gn(e){try{Promise.resolve(e.return?.()).catch(()=>{})}catch{}}function Nt(e,r,t){if(r.source)return{name:t,source:r.source};let o=Lr(e,r);return o?{name:t,url:o}:b&&e.loadWorker?{name:t,loadWorker:e.loadWorker,getUrl:()=>Er(e,r),urlKey:Br(e)}:{name:t,url:Er(e,r)}}async function $t(e,r,t,o){switch(t){case"done":r.done(o);break;case"error":r.error(new Error(o.error));break;case"process":let{id:n,input:s,options:a}=o;try{if(!e.process){r.postMessage("error",{id:n,error:"Worker not set up to process on main thread"});return}let i=await e.process(s,a,void 0,o.context||{});r.postMessage("done",{id:n,result:i})}catch(i){let c=i instanceof Error?i.message:"unknown error";r.postMessage("error",{id:n,error:c})}break;default:console.warn(`process-on-worker: unknown message ${t}`)}}function We(e,r=Le){$(e,"no worker provided");let t=e.version;return!(!r||!t)}function Je(e,r){let t=Or(r),o=t._nodeWorkers;return!b&&!o||e.id==="las"&&(r?.las?.shape??"arrow-table")==="arrow-table"||e.id==="csv"&&!wn(r)?!1:!!Rr(e,t)}function Cr(e,r,t,o,n=e){if(!Je(e,t))return!1;if(t?.core?.worker!=="auto"||!n.getWorkerEstimate)return!0;try{let s=n.getWorkerEstimate(r,t,o);return s===void 0||!Number.isFinite(s)||s<0||s>1?!0:s>=(t.core?.workerThreshold??.1)}catch{return!0}}async function Pr(e,r,t,o,n,s){let a=s||Dt(t),i=await Ie(e,r,{...Or(t,e),signal:a},{process:async(c,u,f,l)=>{if(!n)throw new Error("Worker not set up to parse on main thread");let m=o?{...o,...l||{}}:void 0;return await jt(n,c,u,m)}},zt(o));return bn(e)?e.deserializeWorkerResult(i,t,o):i}async function*Fr(e,r,t,o,n,s){let a=s||Dt(t),i=Ir(e,r,{...Or(t),signal:a},{process:async(c,u,f,l)=>{if(!n)throw new Error("Worker not set up to parse on main thread");let m=o?{...o,...l||{}}:void 0;return await jt(n,c,u,m)}},zt(o));for await(let c of i)yield e.deserializeWorkerBatch?e.deserializeWorkerBatch(c,t,o):c}function Dt(e){let r=e?.parquet?.signal;if(typeof AbortSignal<"u"&&r instanceof AbortSignal)return r}function jt(e,r,t,o){return e.length<=2?e(r,t):e(r,void 0,t,o)}function Or(e={},r){let t=JSON.parse(JSON.stringify(e)),o={...t.core,...t};return o.worker==="auto"&&(o.worker=!0),r&&(o._workerLoaderId=r.id),o}function zt(e){if(!e)return{};let{fetch:r,loaders:t,coreApi:o,_parse:n,_parseSync:s,_parseInBatches:a,...i}=e;return JSON.parse(JSON.stringify(i))}function wn(e){let r=e;return(r?.csv?.shape??r?.core?.shape)==="arrow-table"}function bn(e){return typeof e.deserializeWorkerResult=="function"}function Mr(e,r){if(!P.isSupported())return!1;let t=r?._nodeWorkers??r?.core?._nodeWorkers,o=r?.worker??r?.core?.worker;return!y&&!t?!1:!!(e.worker&&o)}function Ur(e,r,t){if(t=t||e.byteLength,e.byteLength<t||r.byteLength<t)return!1;let o=new Uint8Array(e),n=new Uint8Array(r);for(let s=0;s<o.length;++s)if(o[s]!==n[s])return!1;return!0}function Ce(...e){return qt(e)}function qt(e){let r=e.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),t=r.reduce((s,a)=>s+a.byteLength,0),o=new Uint8Array(t),n=0;for(let s of r)o.set(s,n),n+=s.byteLength;return o.buffer}async function*vr(e,r={}){let t=new TextDecoder(void 0,r);for await(let o of e)yield typeof o=="string"?o:t.decode(o,{stream:!0})}async function*Nr(e){let r=new TextEncoder;for await(let t of e)yield typeof t=="string"?r.encode(t).buffer:t}async function*$r(e){let r="";for await(let t of e){r+=t;let o;for(o=r.indexOf(`
13
13
  `);o>=0;){let n=r.slice(0,o+1);r=r.slice(o+1),yield n,o=r.indexOf(`
14
- `)}}r.length>0&&(yield r)}async function*Sr(e){let r=1;for await(let t of e)yield{counter:r,line:t},r++}async function Lr(e,r){let t=en(e);for(;;){let{done:o,value:n}=await t.next();if(o){t.return&&t.return();return}if(r(n))return}}async function z(e){let r=[];for await(let t of e)r.push(Xo(t));return Le(...r)}function Xo(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:t,byteLength:o}=e;return St(r,t,o)}return St(e)}function St(e,r=0,t=e.byteLength-r){let o=new Uint8Array(e,r,t),n=new Uint8Array(o.length);return n.set(o),n.buffer}function en(e){if(typeof e[Symbol.asyncIterator]=="function")return e[Symbol.asyncIterator]();if(typeof e[Symbol.iterator]=="function"){let r=e[Symbol.iterator]();return rn(r)}return e}function rn(e){return{next(r){return Promise.resolve(e.next(r))},return(r){return typeof e.return=="function"?Promise.resolve(e.return(r)):Promise.resolve({done:!0,value:r})},throw(r){return typeof e.throw=="function"?Promise.resolve(e.throw(r)):Promise.reject(r)}}}function _e(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let r=process.hrtime();e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}var ee=class{constructor(r,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=r,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(r){return this.sampleSize=r,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(r){return this._count+=r,this._samples++,this._checkSampling(),this}subtractCount(r){return this._count-=r,this._samples++,this._checkSampling(),this}addTime(r){return this._time+=r,this.lastTiming=r,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=_e(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(_e()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var ue=class{constructor(r){this.stats={},this.id=r.id,this.stats={},this._initializeStats(r.stats),Object.seal(this)}get(r,t="count"){return this._getOrCreate({name:r,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let r of Object.values(this.stats))r.reset();return this}forEach(r){for(let t of Object.values(this.stats))r(t)}getTable(){let r={};return this.forEach(t=>{r[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),r}_initializeStats(r=[]){r.forEach(t=>this._getOrCreate(t))}_getOrCreate(r){let{name:t,type:o}=r,n=this.stats[t];return n||(r instanceof ee?n=r:n=new ee(t,o),this.stats[t]=n),n}};var tn="Queued Requests",on="Active Requests",nn="Cancelled Requests",sn="Queued Requests Ever",an="Active Requests Ever",cn={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},le=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(r={}){this.props={...cn,...r},this.stats=new ue({id:this.props.id}),this.stats.get(tn),this.stats.get(on),this.stats.get(nn),this.stats.get(sn),this.stats.get(an)}setProps(r){r.throttleRequests!==void 0&&(this.props.throttleRequests=r.throttleRequests),r.maxRequests!==void 0&&(this.props.maxRequests=r.maxRequests),r.debounceTime!==void 0&&(this.props.debounceTime=r.debounceTime)}scheduleRequest(r,t=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(r))return this.requestMap.get(r);let o={handle:r,priority:0,getPriority:t},n=new Promise(s=>(o.resolve=s,o));return this.requestQueue.push(o),this.requestMap.set(r,n),this._issueNewRequests(),n}_issueRequest(r){let{handle:t,resolve:o}=r,n=!1,s=()=>{n||(n=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,o?o({done:s}):Promise.resolve({done:s})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let r=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(r!==0){this._updateAllRequests();for(let t=0;t<r;++t){let o=this.requestQueue.shift();o&&this._issueRequest(o)}}}_updateAllRequests(){let r=this.requestQueue;for(let t=0;t<r.length;++t){let o=r[t];this._updateRequest(o)||(r.splice(t,1),this.requestMap.delete(o.handle),t--)}r.sort((t,o)=>t.priority-o.priority)}_updateRequest(r){return r.priority=r.getPriority(r.handle),r.priority<0?(r.resolve(null),!1):!0}};var Lt=Symbol("loaders.gl.authenticated-fetch"),_r=new WeakMap;function Br(e){let r=e.fetch||((n,s)=>fetch(n,s));if(!e.credentials.length||r[Lt]===e.credentials)return r;let o=async(n,s={})=>{let a=ln(n);if(!a)return r(n,s);let i=await _t(a,s,e.credentials),c=await r(i.url,i.options),f=i.credentials.filter(({credential:h})=>typeof h.token=="function"&&h.refreshStatusCodes.includes(c.status));if(!f.length||!mn(s))return c;if(s.signal?.aborted)throw Bt();let u=new Map;if(await Promise.all(f.map(async({credential:h})=>{let ge=await fn(h,n,c);ge&&u.set(h,ge)})),!u.size)return c;if(await c.body?.cancel().catch(()=>{}),s.signal?.aborted)throw Bt();let l=await _t(a,s,e.credentials,u,i.credentials);return r(l.url,l.options)};return Object.defineProperty(o,Lt,{value:e.credentials}),o}async function _t(e,r,t,o=new Map,n=[]){let s=new URL(e),a=new Headers(r.headers),i=[],c=new Map(n.map(({credential:f,token:u})=>[f,u]));for(let f of t){if(!f.origins.includes(s.origin))continue;let u=o.get(f),l=c.get(f),h=f.type==="query-parameter"&&l!==void 0,ge=f.type==="header"&&l!==void 0;if(f.type==="query-parameter"&&s.searchParams.has(f.name)&&!h||f.type==="header"&&a.has(f.name)&&!ge)continue;let oe=u??l??await un(f.token,{url:e.toString(),reason:"request"});oe&&(f.type==="query-parameter"?s.searchParams.set(f.name,oe):a.set(f.name,`${f.prefix||""}${oe}`),i.push({credential:f,token:oe}))}return{url:s.toString(),options:{...r,headers:a},credentials:i}}async function fn(e,r,t){let o=_r.get(e);if(o)return o;let n=e.token,s=Promise.resolve(n({url:r,reason:"refresh",response:{status:t.status,headers:t.headers}})).finally(()=>_r.delete(e));return _r.set(e,s),s}async function un(e,r){return typeof e=="function"?e(r):e}function ln(e){try{let r=new URL(e);return["http:","https:"].includes(r.protocol)?r:null}catch{return null}}function mn(e){let r=(e.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(r)?!(e.body&&typeof ReadableStream<"u"&&e.body instanceof ReadableStream):!1}function Bt(){return new DOMException("The operation was aborted.","AbortError")}var Er="",Et={};function Rr(e){Er=e}function Cr(){return Er}function q(e){for(let r in Et)if(e.startsWith(r)){let t=Et[r];e=e.replace(r,t)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Er}${e}`),e}var M={};Kr(M,{dirname:()=>dn,filename:()=>pn,join:()=>hn,resolve:()=>yn});function Rt(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function pn(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(r+1):e}function dn(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(0,r):""}function hn(...e){return e=e.map((t,o)=>(o&&(t=t.replace(new RegExp("^/"),"")),o!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t)),e.join("/")}function yn(...e){let r=[];for(let s=0;s<e.length;s++)r[s]=e[s];let t="",o=!1,n;for(let s=r.length-1;s>=-1&&!o;s--){let a;s>=0?a=r[s]:(n===void 0&&(n=Rt()),a=n),a.length!==0&&(t=`${a}/${t}`,o=a.charCodeAt(0)===Be)}return t=gn(t,!o),o?`/${t}`:t.length>0?t:"."}var Be=47,Ir=46;function gn(e,r){let t="",o=-1,n=0,s,a=!1;for(let i=0;i<=e.length;++i){if(i<e.length)s=e.charCodeAt(i);else{if(s===Be)break;s=Be}if(s===Be){if(!(o===i-1||n===1))if(o!==i-1&&n===2){if(t.length<2||!a||t.charCodeAt(t.length-1)!==Ir||t.charCodeAt(t.length-2)!==Ir){if(t.length>2){let c=t.length-1,f=c;for(;f>=0&&t.charCodeAt(f)!==Be;--f);if(f!==c){t=f===-1?"":t.slice(0,f),o=i,n=0,a=!1;continue}}else if(t.length===2||t.length===1){t="",o=i,n=0,a=!1;continue}}r&&(t.length>0?t+="/..":t="..",a=!0)}else{let c=e.slice(o+1,i);t.length>0?t+=`/${c}`:t=c,a=!1}o=i,n=0}else s===Ir&&n!==-1?++n:n=-1}return t}var wn="5.0.0-alpha.5",Pr={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:wn,encoding:"json",format:"json",extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:Ct,parse:async e=>Ct(new TextDecoder().decode(e)),options:{}};function Ct(e){return JSON.parse(e)}function ze(e){return e&&typeof e=="object"&&e.isBuffer}function N(e){if(ze(e))return e;if(e instanceof ArrayBuffer)return e;if(ur(e))return je(e);if(ArrayBuffer.isView(e)){let r=e.buffer;return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?r:r.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")}function U(e){if(e instanceof ArrayBuffer)return e;if(ur(e))return je(e);let{buffer:r,byteOffset:t,byteLength:o}=e;return r instanceof ArrayBuffer&&t===0&&o===r.byteLength?r:je(r,t,o)}function je(e,r=0,t=e.byteLength-r){let o=new Uint8Array(e,r,t),n=new Uint8Array(o.length);return n.set(o),n.buffer}function qe(e){return ArrayBuffer.isView(e)?e:new Uint8Array(e)}var Ee=class{handle;size;bigsize;url;constructor(r){this.handle=r instanceof ArrayBuffer?new Blob([r]):r,this.size=r instanceof ArrayBuffer?r.byteLength:r.size,this.bigsize=BigInt(this.size),this.url=r instanceof File?r.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(r,t,o){if(o?.aborted)throw new Error("Request aborted");let n=await this.handle.slice(Number(r),Number(r)+Number(t)).arrayBuffer();if(o?.aborted)throw new Error("Request aborted");return n}};var Re=new Error("Not implemented"),Ce=class{handle;size=0;bigsize=0n;url="";constructor(r,t,o){if(globalThis.loaders?.NodeFile)return new globalThis.loaders.NodeFile(r,t,o);throw w?new Error("Can't instantiate NodeFile in browser."):new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.")}async read(r,t){throw Re}async write(r,t,o){throw Re}async stat(){throw Re}async truncate(r){throw Re}async append(r){throw Re}async close(){}};function g(e){return!!(e&&typeof e=="object"&&"createDataSource"in e)}var me=class extends Error{constructor(r,t){super(r),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response};var bn=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,xn=/^([-\w.]+\/[-\w.+]+)/;function Or(e,r){return e.toLowerCase()===r.toLowerCase()}function It(e){let r=xn.exec(e);return r?r[1]:e}function Wr(e){let r=bn.exec(e);return r?r[1]:""}var Pt=/\?.*/;function Ot(e){let r=e.match(Pt);return r&&r[0]}function V(e){return e.replace(Pt,"")}function Wt(e){if(e.length<50)return e;let r=e.slice(e.length-15);return`${e.substr(0,32)}...${r}`}function B(e){return d(e)?e.url:m(e)?("name"in e?e.name:"")||"":typeof e=="string"?e:""}function pe(e){if(d(e)){let r=e.headers.get("content-type")||"",t=V(e.url);return It(r)||Wr(t)}return m(e)?e.type||"":typeof e=="string"?Wr(e):""}function Ft(e){return d(e)?e.headers["content-length"]||-1:m(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function Ie(e){if(d(e))return e;let r={},t=Ft(e);t>=0&&(r["content-length"]=String(t));let o=B(e),n=pe(e);n&&(r["content-type"]=n);let s=await An(e);s&&(r["x-first-bytes"]=s),typeof e=="string"&&(e=new TextEncoder().encode(e));let a=new Response(e,{headers:r});return Object.defineProperty(a,"url",{value:o}),a}async function Ve(e){if(!e.ok)throw await Tn(e)}async function Tn(e){let r=Wt(e.url),t=`Failed to fetch resource (${e.status}) ${e.statusText}: ${r}`;t=t.length>100?`${t.slice(0,100)}...`:t;let o={reason:e.statusText,url:e.url,response:e};try{let n=e.headers.get("Content-Type");o.reason=!e.bodyUsed&&n?.includes("application/json")?await e.json():await e.text()}catch{}return new me(t,o)}async function An(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(o=>{let n=new FileReader;n.onload=s=>o(s?.target?.result),n.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=e.slice(0,5);return`data:base64,${kn(t)}`}return null}function kn(e){let r="",t=new Uint8Array(e);for(let o=0;o<t.byteLength;o++)r+=String.fromCharCode(t[o]);return btoa(r)}function Sn(e){return!Ln(e)&&!_n(e)}function Ln(e){return e.startsWith("http:")||e.startsWith("https:")}function _n(e){return e.startsWith("data:")}async function T(e,r){if(typeof e=="string"){let t=q(e);return Sn(t)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(t,r):await fetch(t,r)}return await Ie(e)}async function Mt(e,r,t){e instanceof Blob||(e=new Blob([e]));let o=e.slice(r,r+t);return await Bn(o)}async function Bn(e){return await new Promise((r,t)=>{let o=new FileReader;o.onload=n=>r(n?.target?.result),o.onerror=n=>t(n),o.readAsArrayBuffer(e)})}var Pe=new _({id:"loaders.gl"}),He=class{log(){return()=>{}}info(){return()=>{}}once(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Qe=class{console;onceMessages=new Set;constructor(){this.console=console}log(...r){return this.console.log.bind(this.console,...r)}info(...r){return this.console.info.bind(this.console,...r)}once(...r){let t=String(r[0]);return this.onceMessages.has(t)?()=>{}:(this.onceMessages.add(t),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 Ge={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,shape:void 0,log:new Qe,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:w,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},Nt={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",shape:"core.shape",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"core.fetch.keepalive",signal:"core.fetch.signal"};var Fr=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","workerTransferBufferCopy","_nodeWorkers","_workerType","limit","_limitMB","shape","batchSize","batchDebounceMs","metadata","transforms"];function Oe(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function C(){let e=Oe();return e.globalOptions=e.globalOptions||{...Ge,core:{...Ge.core}},$(e.globalOptions)}function Mr(e){let r=Oe(),t=C();r.globalOptions=vt(t,e),mr(e.modules)}function H(e,r,t,o){return t=t||[],t=Array.isArray(t)?t:[t],En(e,t),$(vt(r,e,o))}function $(e){let r=Pn(e);Dt(r);for(let t of Fr)r.core&&r.core[t]!==void 0&&delete r[t];return r.core&&r.core._workerType!==void 0&&delete r._worker,r}function En(e,r){Ut(e,null,Ge,Nt,r);for(let t of r){let o=e&&e[t.id]||{},n=t.options&&t.options[t.id]||{},s=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};Ut(o,t.id,n,s,r)}}function Ut(e,r,t,o,n){let s=r||"Top level",a=r?`${r}.`:"";for(let i in e){let c=!r&&x(e[i]),f=i==="baseUri"&&!r,u=i==="workerUrl"&&r;if(!(i in t)&&!f&&!u){if(i in o)Pe.level>0&&Pe.warn(`${s} loader option '${a}${i}' no longer supported, use '${o[i]}'`)();else if(!c&&Pe.level>0){let l=Rn(i,n);Pe.warn(`${s} loader option '${a}${i}' not recognized. ${l}`)()}}}}function Rn(e,r){let t=e.toLowerCase(),o="";for(let n of r)for(let s in n.options){if(e===s)return`Did you mean '${n.id}.${s}'?`;let a=s.toLowerCase();(t.startsWith(a)||a.startsWith(t))&&(o=o||`Did you mean '${n.id}.${s}'?`)}return o}function vt(e,r,t){let o=e.options||{},n={...o};o.core&&(n.core={...o.core}),Dt(n),n.core?.log===null&&(n.core={...n.core,log:new He}),$t(n,$(C()));let s=$(r);return $t(n,s),Cn(n,s,e),In(n,t),On(n),n}function Cn(e,r,t){let o=e.core?.shape;if(o===void 0)return;let n=t.options?.[t.id];if(!k(n)||!("shape"in n))return;let s=C()[t.id];if(k(s)&&"shape"in s)return;let a=r[t.id];if(k(a)&&"shape"in a)return;let i=e[t.id];e[t.id]={...k(i)?i:{},shape:o}}function $t(e,r){for(let t in r)if(t in r){let o=r[t];k(o)&&k(e[t])?e[t]={...e[t],...r[t]}:e[t]=r[t]}}function In(e,r){if(!r)return;e.core?.baseUrl!==void 0||(e.core||={},e.core.baseUrl=M.dirname(V(r)))}function Pn(e){let r={...e};return e.core&&(r.core={...e.core}),r}function Dt(e){e.baseUri!==void 0&&(e.core||={},e.core.baseUrl===void 0&&(e.core.baseUrl=e.baseUri));for(let t of Fr)if(e[t]!==void 0){e.core||={};let n=e.core;n[t]===void 0&&(n[t]=e[t])}let r=e._worker;r!==void 0&&(e.core||={},e.core._workerType===void 0&&(e.core._workerType=r))}function On(e){let r=e.core;if(r)for(let t of Fr)r[t]!==void 0&&(e[t]=r[t])}function A(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions)):!1}function We(e){ne(e,"null loader"),ne(A(e),"invalid loader");let r;return Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var jt=()=>{let e=Oe();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function zt(e){let r=jt();e=Array.isArray(e)?e:[e];for(let t of e){let o=We(t);r.find(n=>o===n)||r.unshift(o)}}function qt(){return jt()}function Vt(){let e=Oe();e.loaderRegistry=[]}var Wn=/\.([^.]+)$/;async function I(e,r=[],t,o){if(!Gt(e))return null;let n=$(t||{});if(n.core||={},e instanceof Response&&Ht(e)){let a=await e.clone().text(),i=L(a,r,{...n,core:{...n.core,nothrow:!0}},o);if(i)return i}let s=L(e,r,{...n,core:{...n.core,nothrow:!0}},o);if(s)return s;if(m(e)&&(e=await e.slice(0,10).arrayBuffer(),s=L(e,r,n,o)),!s&&e instanceof Response&&Ht(e)){let a=await e.clone().text();s=L(a,r,n,o)}if(!s&&!n.core.nothrow)throw new Error(Jt(e));return s}function Ht(e){let r=pe(e);return!!(r&&(r.startsWith("text/")||r==="application/json"||r.endsWith("+json")))}function L(e,r=[],t,o){if(!Gt(e))return null;let n=$(t||{});if(n.core||={},r&&!Array.isArray(r))return We(r);let s=[];r&&(s=s.concat(r)),n.core.ignoreRegisteredLoaders||s.push(...qt()),Mn(s);let a=Fn(e,s,n,o);if(!a&&!n.core.nothrow)throw new Error(Jt(e));return a}function Fn(e,r,t,o){let n=B(e),s=pe(e),a=V(n)||o?.url,i=null,c="",f=t?.core&&"type"in t.core?t.core.type:void 0;return f&&f!=="auto"&&(i=$n(r,f),c=i?`match forced by supplied source type ${f}`:""),t?.core?.mimeType&&(i=Nr(r,t?.core?.mimeType),c=`match forced by supplied MIME type ${t?.core?.mimeType}`),i=i||vn(r,a),c=c||(i?`matched source url ${a}`:""),i=i||Nn(r,a),c=c||(i?`matched url ${a}`:""),i=i||Nr(r,s),c=c||(i?`matched MIME type ${s}`:""),i=i||jn(r,e),c=c||(i?`matched initial data ${Zt(e)}`:""),!i&&m(e)&&(i=Dn(r,e),c=c||(i?"matched source testData":"")),t?.core?.fallbackMimeType&&(i=i||Nr(r,t?.core?.fallbackMimeType),c=c||(i?`matched fallback MIME type ${s}`:"")),c&&fr.log(1,`selectLoader selected ${i?.name}: ${c}.`),i}function Gt(e){return!(e instanceof Response&&e.status===204)}function Jt(e){let r=B(e),t=pe(e),o="No valid loader found (";o+=r?`${M.filename(r)}, `:"no url provided, ",o+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let n=e?Zt(e):"";return o+=n?` first bytes: "${n}"`:"first bytes: not available",o+=")",o}function Mn(e){for(let r of e)We(r)}function Nn(e,r){let t=r&&Wn.exec(r),o=t&&t[1];return o?Un(e,o):null}function Un(e,r){r=r.toLowerCase();for(let t of e)for(let o of t.extensions)if(o.toLowerCase()===r)return t;return null}function $n(e,r){for(let t of e)if(g(t)&&t.type===r)return t;return null}function vn(e,r){if(!r)return null;for(let t of e)if(g(t)&&t.testURL(r))return t;return null}function Dn(e,r){for(let t of e)if(g(t)&&t.testData?.(r))return t;return null}function Nr(e,r){for(let t of e)if(t.mimeTypes?.some(o=>Or(r,o))||Or(r,`application/x.${t.id}`))return t;return null}function jn(e,r){if(!r)return null;for(let t of e)if(typeof r=="string"){if(zn(r,t))return t}else if(ArrayBuffer.isView(r)){if(Qt(r.buffer,r.byteOffset,t))return t}else if(r instanceof ArrayBuffer&&Qt(r,0,t))return t;return null}function zn(e,r){return r.testText?r.testText(e):(Array.isArray(r.tests)?r.tests:[r.tests]).some(o=>e.startsWith(o))}function Qt(e,r,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>qn(e,r,t,n))}function qn(e,r,t,o){if(v(o))return xr(o,e,o.byteLength);switch(typeof o){case"function":return o(U(e));case"string":let n=Ur(e,r,o.length);return o===n;default:return!1}}function Zt(e,r=5){return typeof e=="string"?e.slice(0,r):ArrayBuffer.isView(e)?Ur(e.buffer,e.byteOffset,r):e instanceof ArrayBuffer?Ur(e,0,r):""}function Ur(e,r,t){if(e.byteLength<r+t)return"";let o=new DataView(e),n="";for(let s=0;s<t;s++)n+=String.fromCharCode(o.getUint8(r+s));return n}var Vn=256*1024;function*Kt(e,r){let t=r?.chunkSize||Vn,o=0,n=new TextEncoder;for(;o<e.length;){let s=Math.min(e.length-o,t),a=e.slice(o,o+s);o+=s,yield U(n.encode(a))}}function*Yt(e,r={}){let{chunkSize:t=262144}=r,o=0;for(;o<e.byteLength;){let n=Math.min(e.byteLength-o,t),s=new ArrayBuffer(n),a=new Uint8Array(e,o,n);new Uint8Array(s).set(a),o+=n,yield s}}async function*Xt(e,r){let t=r?.chunkSize||1048576,o=0;for(;o<e.size;){let n=o+t,s=await e.slice(o,n).arrayBuffer();o=n,yield s}}function $r(e,r){return w?Hn(e,r):Qn(e,r)}async function*Hn(e,r){let t=e.getReader(),o,n=!1,s=!1,a=!1;try{for(;;){let i=o||t.read();o=void 0;let c;try{c=await i}catch(l){throw s=!0,l}let{done:f,value:u}=c;if(f){n=!0;return}r?._streamReadAhead&&(o=t.read(),o.catch(()=>{})),yield N(u)}}catch(i){throw a=!0,i}finally{let i=!1,c;if(!n&&!s)try{await t.cancel()}catch(f){i=!0,c=f}try{t.releaseLock()}catch(f){i||(i=!0,c=f)}if(!a&&i)throw c}}async function*Qn(e,r){for await(let t of e)yield N(t)}function re(e,r){if(typeof e=="string")return Kt(e,r);if(e instanceof ArrayBuffer)return Yt(e,r);if(m(e))return Xt(e,r);if(O(e))return $r(e,r);if(d(e)){let t=e.body;if(!t)throw new Error("Readable stream not available on Response");return $r(t,r)}throw new Error("makeIterator")}var Fe="Cannot convert supplied data type";function vr(e,r,t){if(r.text&&typeof e=="string")return e;if(ze(e)&&(e=e.buffer),v(e)){let o=qe(e);return r.text&&!r.binary?new TextDecoder("utf8").decode(o):N(o)}throw new Error(Fe)}async function eo(e,r,t){if(typeof e=="string"||v(e))return vr(e,r,t);if(m(e)&&(e=await Ie(e)),d(e))return await Ve(e),r.binary?await e.arrayBuffer():await e.text();if(O(e)&&(e=re(e,t)),D(e)||X(e))return z(e);throw new Error(Fe)}async function ro(e,r){if(typeof e=="string")return new TextEncoder().encode(e).buffer;if(v(e))return N(qe(e));if(m(e)&&(e=await Ie(e)),d(e))return await Ve(e),await e.arrayBuffer();if(O(e)&&(e=re(e,r)),D(e)||X(e))return z(e);throw new Error(Fe)}async function to(e,r){if(we(e)&&(e=await e),ce(e))return e;if(d(e)){await Ve(e);let t=await e.body;if(!t)throw new Error(Fe);return re(t,r)}return m(e)||O(e)?re(e,r):X(e)||D(e)?e:Gn(e)}function Gn(e){if(ArrayBuffer.isView(e))return(function*(){yield N(e)})();if(v(e))return(function*(){yield N(e)})();if(ce(e))return e;if(D(e))return e[Symbol.iterator]();throw new Error(Fe)}function de(e,r){let t=C(),o=e||t,n=o.fetch??o.core?.fetch,s;return typeof n=="function"?s=n:x(n)?s=(a,i)=>T(a,Jn(n,i)):r?.fetch?s=r.fetch:s=T,Br({fetch:s,credentials:o.core?.credentials||[]})}function Jn(e,r){let t={...e,...r};if(e.headers||r?.headers){let o=new Headers(e.headers);new Headers(r?.headers).forEach((n,s)=>o.set(s,n)),t.headers=o}return t}var Dr=new Map,Je=new Map;async function P(e,r,t){if(Ke(e))return e;let o=oo(e,r),n=Je.get(e)?.get(o);if(n)return n;let s=Dr.get(e);s||(s=new Map,Dr.set(e,s));let a=s.get(o);return a||(a=Zn(e,r,t).then(i=>{let c=Je.get(e);return c||(c=new Map,Je.set(e,c)),c.set(o,i),i}).catch(i=>{throw s.delete(o),s.size===0&&Dr.delete(e),i}),s.set(o,a)),await a}function Ze(e){if(Ke(e))return e;let r=oo(e);return Je.get(e)?.get(r)||null}function Ke(e){let r=e;return!!(r.parse||r.parseSync||r.parseInBatches||r.parseText||r.parseTextSync||r.parseFile||r.parseFileInBatches)}async function Zn(e,r,t){if(e.preload){let n=await e.preload(t||"",r);if(Ke(n))return n;throw new Error(`${e.id} loader preload() did not return a parser-bearing loader`)}let o=Kn(e,r);return await Yn(o,e.id)}function Kn(e,r){if((r?._workerType||r?.core?._workerType)==="test"){let o=`modules/${e.module}/src/${e.id}-loader.ts`;return typeof window<"u"?`/${o}`:typeof process<"u"&&process.cwd?new URL(o,`file://${process.cwd()}/`).toString():o}throw new Error(`${e.id} loader does not provide a parser implementation. Import a parser-bearing loader directly, or use preload() before parse/load.`)}function oo(e,r){let t=r?.[e.id],o=e.options?.[e.id];return String(t?.backend||o?.backend||"")}async function Yn(e,r){let t=await import(e);for(let o of Object.values(t))if(o&&typeof o=="object"&&o.id===r&&Ke(o))return o;throw new Error(`Could not find parser implementation for ${r} in ${e}`)}async function Q(e,r,t,o){r&&!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),t=t||{};let n=e.url||"",a=he(r,o),i=await I(n,a,t);if(!i)return null;if(g(i))throw new Error(`${i.id} is a SourceLoader. Use load() to create a runtime source object instead of parseFile().`);let c=H(t,i,a,n);return o=G({url:n,_parse:p,loaders:a},c,o||null),await Xn(i,e,c,o)}async function Xn(e,r,t,o){Se(e),t=be(e.options,t);let n=await P(e,t,o.url);if(n.parseFile)return await n.parseFile(r,t,o);if(n.parse){let a=r.bigsize>0n?Number(r.bigsize):r.size;if(!a)throw new Error(`${e.id} loader - cannot fall back to parse without a file size`);let i=await r.read(0n,a);return await p(i,n,t,o)}throw new Error(`${e.id} loader - no file parser found`)}function J(e,r,t,o){!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),t=t||{};let s=he(r,o),a=L(e,s,t);if(!a)return null;if(g(a))throw new Error(`${a.id} is a SourceLoader. Use load() to create a runtime source object instead of parseSync().`);let i=H(t,a,s),c=B(e),f=()=>{throw new Error("parseSync called parse (which is async")};o=G({url:c,_parseSync:f,_parse:f,loaders:r},i,o||null);let u=Ze(a);return es(u||a,e,i,o)}function es(e,r,t,o){if(r=vr(r,e,t),e.parseTextSync&&typeof r=="string")return e.parseTextSync(r,t);if(e.parseSync&&r instanceof ArrayBuffer)return e.parseSync(r,t,o);throw e.preload?new Error(`${e.name} loader: 'parseSync' requires a parser-bearing loader. Import the loader implementation directly, or call preload(loader) before parseSync(). ${o.url||""}`):new Error(`${e.name} loader: 'parseSync' not supported by this loader, use 'parse' instead. ${o.url||""}`)}function jr(e){switch(typeof e=="object"&&e?.shape){case"array-row-table":case"object-row-table":return Array.isArray(e.data);case"geojson-table":return Array.isArray(e.features);case"columnar-table":return!!(e.data&&typeof e.data=="object");case"arrow-table":return e?.data?.numRows!==void 0;default:return!1}}function zr(e){switch(e.shape){case"array-row-table":case"object-row-table":return e.data.length;case"geojson-table":return e.features.length;case"arrow-table":return e.data.numRows;case"columnar-table":for(let t of Object.values(e.data))return t.length||0;return 0;default:throw new Error("table")}}function qr(e){return{...e,length:zr(e),batchType:"data"}}async function b(e,r,t,o){let n=Array.isArray(r)?r:void 0;!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),e=await e,t=t||{};let s=B(e),a=await I(e,r,t);if(!a)return[];let i=H(t,a,n,s);o=G({url:s,_parseInBatches:b,_parse:p,loaders:n},i,o||null);let c=await P(a,i,o.url);return await rs(a,c,e,i,o)}async function rs(e,r,t,o,n){let s=await ts(r,t,o,n);if(!o?.core?.metadata)return s;let a={shape:"metadata",batchType:"metadata",metadata:{_loader:e,_context:n},data:[],bytesUsed:0};async function*i(c){yield a,yield*c}return i(s)}async function ts(e,r,t,o){let n=await to(r,t),s=await ss(n,t?.core?.transforms||[]);return e.parseInBatches?e.parseInBatches(s,t,o):os(s,e,t,o)}async function*os(e,r,t,o){let n=await z(e),s=await p(n,r,{...t,core:{...t?.core,mimeType:r.mimeTypes[0]}},o);yield ns(s,r)}function ns(e,r){let t=jr(e)?qr(e):{shape:"unknown",batchType:"data",data:e,length:Array.isArray(e)?e.length:1};return t.mimeType=r.mimeTypes[0],t}async function ss(e,r=[]){let t=e;for await(let o of r)t=o(t);return t}function Z(e,r,t,o){let n;!Array.isArray(r)&&!A(r)?(o=void 0,t=r,n=void 0):n=r;let s=de(t||{});return Array.isArray(e)?e.map(i=>no(i,n,t||{},s)):no(e,n,t||{},s)}async function no(e,r,t,o){if(typeof e=="string"){let s=await o(e);return Array.isArray(r)?await b(s,r,t):await b(s,r,t)}return Array.isArray(r)?await b(e,r,t):await b(e,r,t)}async function te(e,r,t,o){let n,s;if(!Array.isArray(r)&&!A(r)?(n=[],s=r,o=void 0):(n=r,s=t),!Array.isArray(n)&&g(n)){let c=await Vr(n,e,s),f={fetchFile:T,parse:p,parseFile:Q,parseSync:J,parseInBatches:b,load:te,loadInBatches:Z};return c.createDataSource(e,s||{},f)}if(Array.isArray(n)&&n.length===1&&g(n[0])){let c=await Vr(n[0],e,s),f={fetchFile:T,parse:p,parseFile:Q,parseSync:J,parseInBatches:b,load:te,loadInBatches:Z};return c.createDataSource(e,s||{},f)}if(typeof e=="string"||m(e)){let c=await I(e,n,{...s,core:{...s?.core,nothrow:!0}});if(c&&g(c))return(await Vr(c,e,s)).createDataSource(e,s||{},{fetchFile:T,parse:p,parseFile:Q,parseSync:J,parseInBatches:b,load:te,loadInBatches:Z});if(c&&typeof e=="string"){let u=(await P(c,s,e)).parseUrl;if(u)return await u(e,s,o)}}let a=de(s),i=e;return typeof e=="string"&&(i=await a(e)),m(e)&&(i=await a(e)),typeof e=="string"&&($(s||{}).core?.baseUrl||(s={...s,core:{...s?.core,baseUrl:e}})),Array.isArray(n)?await p(i,n,s,o):await p(i,n,s,o)}async function Vr(e,r,t){if(!e.preload)return e;let o=await e.preload(typeof r=="string"?r:"",t);if(!g(o))throw new Error(`${e.id} source loader preload() did not return a runtime source loader`);return o}var ye=Object.freeze({fetchFile:T,parse:p,parseFile:Q,parseSync:J,parseInBatches:b,load:te,loadInBatches:Z});function G(e,r,t){if(t)return t;let o={...e,fetch:de(r,e),coreApi:e.coreApi||ye};if(o.url){let n=V(o.url);o.baseUrl=n,o.queryString=Ot(o.url),o.filename=M.filename(n),o.baseUrl=M.dirname(n)}return Array.isArray(o.loaders)||(o.loaders=null),o}function he(e,r){if(e&&!Array.isArray(e))return e;let t;if(e&&(t=Array.isArray(e)?e:[e]),r&&r.loaders){let o=Array.isArray(r.loaders)?r.loaders:[r.loaders];t=t?[...t,...o]:o}return t&&t.length?t:void 0}async function p(e,r,t,o){r&&!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),e=await e,t=t||{};let n=B(e),a=he(r,o),i=await I(e,a,t);if(!i)return null;if(g(i))throw new Error(`${i.id} is a SourceLoader. Use load() to create a runtime source object instead of parse().`);let c=H(t,i,a,n);return o=G({url:n,_parse:p,loaders:a},c,o||null),await is(i,e,c,o)}async function is(e,r,t,o){if(Se(e),t=be(e.options,t),d(r)){let{ok:s,redirected:a,status:i,statusText:c,type:f,url:u}=r,l=Object.fromEntries(r.headers.entries());o.response={headers:l,ok:s,redirected:a,status:i,statusText:c,type:f,url:u}}let n=await P(e,t,o.url);return gr(n,t)?(r=await ro(r,t),await wr(n,r,t,o,p)):m(r)&&n.parseBlob?await n.parseBlob(r,t,o):(r=await eo(r,e,t),await as(n,r,t,o))}async function as(e,r,t,o){if(e.parseText&&typeof r=="string")return await e.parseText(r,t,o);if(e.parseTextSync&&typeof r=="string")return e.parseTextSync(r,t,o);if(e.parse)return await e.parse(r,t,o);throw e.parseSync?new Error(`${e.name} loader: 'parse' not available on parser-bearing sync loader. Add an async 'parse' function to this loader, or call preload(loader) before parseSync(). ${o.url||""}`):new Error(`${e.id} loader - no parser found and worker is disabled`)}async function so(e,r,t){return await P(e,r,t)}function io(e){return Ze(e)}async function Hr(e,r,t){if(r.encode)return await r.encode(e,t);if(r.encodeText){let o=await r.encodeText(e,t);return U(new TextEncoder().encode(o))}if(r.encodeInBatches){let o=Qr(e,r,t),n=[];for await(let s of o)n.push(s);return Le(...n)}throw new Error("Writer could not encode data")}async function ao(e,r,t){if(r.text&&r.encodeText)return await r.encodeText(e,t);if(r.text){let o=await Hr(e,r,t);return new TextDecoder().decode(o)}throw new Error(`Writer ${r.name} could not encode data as text`)}function Qr(e,r,t){if(r.encodeInBatches){let o=cs(e);return r.encodeInBatches(o,t)}throw new Error("Writer could not encode data in batches")}function cs(e){return[{...e,start:0,end:e.length}]}async function fo(e,r,t){let n={...C(),...t};return r.encodeURLtoURL?fs(r,e,n):br(r,n)?await ke(r,e,n):await r.encode(e,n)}function Gr(e,r,t){if(r.encodeSync)return r.encodeSync(e,t);if(r.encodeTextSync)return U(new TextEncoder().encode(r.encodeTextSync(e,t)));throw new Error(`Writer ${r.name} could not synchronously encode data`)}async function uo(e,r,t){if(r.encodeText)return await r.encodeText(e,t);if(r.encodeTextSync)return r.encodeTextSync(e,t);if(r.text){let o=await r.encode(e,t);return new TextDecoder().decode(o)}throw new Error(`Writer ${r.name} could not encode data as text`)}function lo(e,r,t){if(r.encodeTextSync)return r.encodeTextSync(e,t);if(r.text&&r.encodeSync){let o=Gr(e,r,t);return new TextDecoder().decode(o)}throw new Error(`Writer ${r.name} could not encode data as text`)}function mo(e,r,t){if(r.encodeInBatches){let o=us(e);return r.encodeInBatches(o,t)}throw new Error(`Writer ${r.name} could not encode in batches`)}async function Jr(e,r,t,o){if(e=q(e),r=q(r),w||!t.encodeURLtoURL)throw new Error;return await t.encodeURLtoURL(e,r,o)}async function fs(e,r,t){if(w)throw new Error(`Writer ${e.name} not supported in browser`);let o=co("input");await new Ce(o,"w").write(r);let s=co("output"),a=await Jr(o,s,e,t);return(await T(a)).arrayBuffer()}function us(e){return[{...e,start:0,end:e.length}]}function co(e){return`/tmp/${e}`}function po(e,r,t){let o=t||{},n=o?.core?.type||o.type||"auto",s=r.length===1?r[0]:n==="auto"?L(e,r,{...o,core:{...o?.core,type:"auto"}}):ls(n,r);if(!s)throw new Error("Not a valid source type");return s.createDataSource(e,o,ye)}function ls(e,r){for(let t of r)if(t.type===e)return t;return null}function ho(e,r,t){let o=t?.type||"auto",n=null;if(o==="auto"?n=L(e,r,{core:{nothrow:!0}}):n=ms(o,r),!n&&!t?.nothrow)throw new Error("Not a valid image source type");return n}function ms(e,r){for(let t of r)if(t.type===e)return t;return null}function yo(e,r){if(globalThis.loaders.makeNodeStream)return globalThis.loaders.makeNodeStream(e,r);let t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new ReadableStream({type:"bytes",async pull(o){try{let{done:n,value:s}=await t.next();n?o.close():o.enqueue(new Uint8Array(s))}catch(n){o.error(n)}},async cancel(){await t?.return?.()}},{highWaterMark:2**24,...r})}var go="5.0.0-alpha.5",wo={dataType:null,batchType:null,name:"Null loader",id:"null",module:"core",version:go,worker:!0,mimeTypes:["application/x.empty"],extensions:["null"],tests:[()=>!1],options:{null:{}}},bo={dataType:null,batchType:null,name:"Null loader",id:"null",module:"core",version:go,mimeTypes:["application/x.empty"],extensions:["null"],parse:async(e,r,t)=>Zr(e,r||{},t),parseSync:Zr,parseInBatches:async function*(r,t,o){for await(let n of r)yield Zr(n,t,o)},tests:[()=>!1],options:{null:{}}};function Zr(e,r,t){return null}async function xo(e,r,t=()=>{},o=()=>{}){if(e=await e,!e.ok)return e;let n=e.body;if(!n)return e;let s=e.headers.get("content-length")||0,a=s?parseInt(s):0;if(!(a>0)||typeof ReadableStream>"u"||!n.getReader)return e;let i=new ReadableStream({async start(c){let f=n.getReader();await To(c,f,0,a,r,t,o)}});return new Response(i)}async function To(e,r,t,o,n,s,a){try{let{done:i,value:c}=await r.read();if(i){s(),e.close();return}t+=c.byteLength;let f=Math.round(t/o*100);n(f,{loadedBytes:t,totalBytes:o}),e.enqueue(c),await To(e,r,t,o,n,s,a)}catch(i){e.error(i),a(i)}}var Ye=class{_fetch;files={};lowerCaseFiles={};usedFiles={};constructor(r,t){this._fetch=t?.fetch||fetch;for(let o=0;o<r.length;++o){let n=r[o];this.files[n.name]=n,this.lowerCaseFiles[n.name.toLowerCase()]=n,this.usedFiles[n.name]=!1}this.fetch=this.fetch.bind(this)}async fetch(r,t){if(r.includes("://"))return this._fetch(r,t);let o=this._getFile(r,!0);if(!o)return new Response(r,{status:400,statusText:"NOT FOUND"});let s=new Headers(t?.headers).get("Range"),a=s&&/bytes=(\d+)-(\d+)/.exec(s);if(a){let c=parseInt(a[1]),f=Math.min(parseInt(a[2]),o.size-1);if(c>f){let h=new Response(null,{status:416,headers:{"Content-Range":`bytes */${o.size}`}});return Object.defineProperty(h,"url",{value:r}),h}let u=await o.slice(c,f+1).arrayBuffer(),l=new Response(u,{status:206,headers:{"Content-Range":`bytes ${c}-${f}/${o.size}`}});return Object.defineProperty(l,"url",{value:r}),l}let i=new Response(o);return Object.defineProperty(i,"url",{value:r}),i}async readdir(r){let t=[];for(let o in this.files)t.push(o);return t}async stat(r,t){let o=this._getFile(r,!1);if(!o)throw new Error(r);return{size:o.size}}async unlink(r){let t=this._getFile(r,!1);t&&(delete this.files[t.name],delete this.lowerCaseFiles[t.name.toLowerCase()],this.usedFiles[t.name]=!0)}async openReadableFile(r,t){return new Ee(this._getFile(r,!0))}_getFile(r,t){let o=this.files[r]||this.lowerCaseFiles[r.toLowerCase()];return o&&t&&(this.usedFiles[r]=!0),o}};return Eo(ps);})();
14
+ `)}}r.length>0&&(yield r)}async function*Dr(e){let r=1;for await(let t of e)yield{counter:r,line:t},r++}async function jr(e,r){let t=Tn(e);for(;;){let{done:o,value:n}=await t.next();if(o){t.return&&t.return();return}if(r(n))return}}async function J(e){let r=[];for await(let t of e)r.push(xn(t));return Ce(...r)}function xn(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:t,byteLength:o}=e;return Vt(r,t,o)}return Vt(e)}function Vt(e,r=0,t=e.byteLength-r){let o=new Uint8Array(e,r,t),n=new Uint8Array(o.length);return n.set(o),n.buffer}function Tn(e){if(typeof e[Symbol.asyncIterator]=="function")return e[Symbol.asyncIterator]();if(typeof e[Symbol.iterator]=="function"){let r=e[Symbol.iterator]();return kn(r)}return e}function kn(e){return{next(r){return Promise.resolve(e.next(r))},return(r){return typeof e.return=="function"?Promise.resolve(e.return(r)):Promise.resolve({done:!0,value:r})},throw(r){return typeof e.throw=="function"?Promise.resolve(e.throw(r)):Promise.reject(r)}}}function Pe(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let r=process.hrtime();e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}var ie=class{constructor(r,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=r,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(r){return this.sampleSize=r,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(r){return this._count+=r,this._samples++,this._checkSampling(),this}subtractCount(r){return this._count-=r,this._samples++,this._checkSampling(),this}addTime(r){return this._time+=r,this.lastTiming=r,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Pe(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Pe()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var ge=class{constructor(r){this.stats={},this.id=r.id,this.stats={},this._initializeStats(r.stats),Object.seal(this)}get(r,t="count"){return this._getOrCreate({name:r,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let r of Object.values(this.stats))r.reset();return this}forEach(r){for(let t of Object.values(this.stats))r(t)}getTable(){let r={};return this.forEach(t=>{r[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),r}_initializeStats(r=[]){r.forEach(t=>this._getOrCreate(t))}_getOrCreate(r){let{name:t,type:o}=r,n=this.stats[t];return n||(r instanceof ie?n=r:n=new ie(t,o),this.stats[t]=n),n}};var An="Queued Requests",Sn="Active Requests",_n="Cancelled Requests",Ln="Queued Requests Ever",En="Active Requests Ever",Bn={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},we=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(r={}){this.props={...Bn,...r},this.stats=new ge({id:this.props.id}),this.stats.get(An),this.stats.get(Sn),this.stats.get(_n),this.stats.get(Ln),this.stats.get(En)}setProps(r){r.throttleRequests!==void 0&&(this.props.throttleRequests=r.throttleRequests),r.maxRequests!==void 0&&(this.props.maxRequests=r.maxRequests),r.debounceTime!==void 0&&(this.props.debounceTime=r.debounceTime)}scheduleRequest(r,t=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(r))return this.requestMap.get(r);let o={handle:r,priority:0,getPriority:t},n=new Promise(s=>(o.resolve=s,o));return this.requestQueue.push(o),this.requestMap.set(r,n),this._issueNewRequests(),n}_issueRequest(r){let{handle:t,resolve:o}=r,n=!1,s=()=>{n||(n=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,o?o({done:s}):Promise.resolve({done:s})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let r=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(r!==0){this._updateAllRequests();for(let t=0;t<r;++t){let o=this.requestQueue.shift();o&&this._issueRequest(o)}}}_updateAllRequests(){let r=this.requestQueue;for(let t=0;t<r.length;++t){let o=r[t];this._updateRequest(o)||(r.splice(t,1),this.requestMap.delete(o.handle),t--)}r.sort((t,o)=>t.priority-o.priority)}_updateRequest(r){return r.priority=r.getPriority(r.handle),r.priority<0?(r.resolve(null),!1):!0}};var Ht=Symbol("loaders.gl.authenticated-fetch"),zr=new WeakMap;function qr(e){let r=e.fetch||((n,s)=>fetch(n,s));if(!e.credentials.length||r[Ht]===e.credentials)return r;let o=async(n,s={})=>{let a=Wn(n);if(!a)return r(n,s);let i=await Qt(a,s,e.credentials),c=await r(i.url,i.options),u=i.credentials.filter(({credential:m})=>typeof m.token=="function"&&m.refreshStatusCodes.includes(c.status));if(!u.length||!Cn(s))return c;if(s.signal?.aborted)throw Gt();let f=new Map;if(await Promise.all(u.map(async({credential:m})=>{let U=await Rn(m,n,c);U&&f.set(m,U)})),!f.size)return c;if(await c.body?.cancel().catch(()=>{}),s.signal?.aborted)throw Gt();let l=await Qt(a,s,e.credentials,f,i.credentials);return r(l.url,l.options)};return Object.defineProperty(o,Ht,{value:e.credentials}),o}async function Qt(e,r,t,o=new Map,n=[]){let s=new URL(e),a=new Headers(r.headers),i=[],c=new Map(n.map(({credential:u,token:f})=>[u,f]));for(let u of t){if(!u.origins.includes(s.origin))continue;let f=o.get(u),l=c.get(u),m=u.type==="query-parameter"&&l!==void 0,U=u.type==="header"&&l!==void 0;if(u.type==="query-parameter"&&s.searchParams.has(u.name)&&!m||u.type==="header"&&a.has(u.name)&&!U)continue;let V=f??l??await In(u.token,{url:e.toString(),reason:"request"});V&&(u.type==="query-parameter"?s.searchParams.set(u.name,V):a.set(u.name,`${u.prefix||""}${V}`),i.push({credential:u,token:V}))}return{url:s.toString(),options:{...r,headers:a},credentials:i}}async function Rn(e,r,t){let o=zr.get(e);if(o)return o;let n=e.token,s=Promise.resolve(n({url:r,reason:"refresh",response:{status:t.status,headers:t.headers}})).finally(()=>zr.delete(e));return zr.set(e,s),s}async function In(e,r){return typeof e=="function"?e(r):e}function Wn(e){try{let r=new URL(e);return["http:","https:"].includes(r.protocol)?r:null}catch{return null}}function Cn(e){let r=(e.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(r)?!(e.body&&typeof ReadableStream<"u"&&e.body instanceof ReadableStream):!1}function Gt(){return new DOMException("The operation was aborted.","AbortError")}var Vr="",Jt={};function Hr(e){Vr=e}function Qr(){return Vr}function K(e){for(let r in Jt)if(e.startsWith(r)){let t=Jt[r];e=e.replace(r,t)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Vr}${e}`),e}var D={};dt(D,{dirname:()=>Fn,filename:()=>Pn,join:()=>On,resolve:()=>Mn});function Kt(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function Pn(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(r+1):e}function Fn(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(0,r):""}function On(...e){return e=e.map((t,o)=>(o&&(t=t.replace(new RegExp("^/"),"")),o!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t)),e.join("/")}function Mn(...e){let r=[];for(let s=0;s<e.length;s++)r[s]=e[s];let t="",o=!1,n;for(let s=r.length-1;s>=-1&&!o;s--){let a;s>=0?a=r[s]:(n===void 0&&(n=Kt()),a=n),a.length!==0&&(t=`${a}/${t}`,o=a.charCodeAt(0)===Fe)}return t=Un(t,!o),o?`/${t}`:t.length>0?t:"."}var Fe=47,Gr=46;function Un(e,r){let t="",o=-1,n=0,s,a=!1;for(let i=0;i<=e.length;++i){if(i<e.length)s=e.charCodeAt(i);else{if(s===Fe)break;s=Fe}if(s===Fe){if(!(o===i-1||n===1))if(o!==i-1&&n===2){if(t.length<2||!a||t.charCodeAt(t.length-1)!==Gr||t.charCodeAt(t.length-2)!==Gr){if(t.length>2){let c=t.length-1,u=c;for(;u>=0&&t.charCodeAt(u)!==Fe;--u);if(u!==c){t=u===-1?"":t.slice(0,u),o=i,n=0,a=!1;continue}}else if(t.length===2||t.length===1){t="",o=i,n=0,a=!1;continue}}r&&(t.length>0?t+="/..":t="..",a=!0)}else{let c=e.slice(o+1,i);t.length>0?t+=`/${c}`:t=c,a=!1}o=i,n=0}else s===Gr&&n!==-1?++n:n=-1}return t}var vn="5.0.0-alpha.7",Jr={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:vn,encoding:"json",format:"json",extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:Zt,parse:async e=>Zt(new TextDecoder().decode(e)),options:{}};function Zt(e){return JSON.parse(e)}function Ze(e){return e&&typeof e=="object"&&e.isBuffer}function j(e){if(Ze(e))return e;if(e instanceof ArrayBuffer)return e;if(br(e))return Ke(e);if(ArrayBuffer.isView(e)){let r=e.buffer;return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?r:r.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")}function z(e){if(e instanceof ArrayBuffer)return e;if(br(e))return Ke(e);let{buffer:r,byteOffset:t,byteLength:o}=e;return r instanceof ArrayBuffer&&t===0&&o===r.byteLength?r:Ke(r,t,o)}function Ke(e,r=0,t=e.byteLength-r){let o=new Uint8Array(e,r,t),n=new Uint8Array(o.length);return n.set(o),n.buffer}function Ye(e){return ArrayBuffer.isView(e)?e:new Uint8Array(e)}var Oe=class{handle;size;bigsize;url;constructor(r){this.handle=r instanceof ArrayBuffer?new Blob([r]):r,this.size=r instanceof ArrayBuffer?r.byteLength:r.size,this.bigsize=BigInt(this.size),this.url=r instanceof File?r.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(r,t,o){if(o?.aborted)throw new Error("Request aborted");let n=await this.handle.slice(Number(r),Number(r)+Number(t)).arrayBuffer();if(o?.aborted)throw new Error("Request aborted");return n}};var Me=new Error("Not implemented"),Ue=class{handle;size=0;bigsize=0n;url="";constructor(r,t,o){if(globalThis.loaders?.NodeFile)return new globalThis.loaders.NodeFile(r,t,o);throw y?new Error("Can't instantiate NodeFile in browser."):new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.")}async read(r,t){throw Me}async write(r,t,o){throw Me}async stat(){throw Me}async truncate(r){throw Me}async append(r){throw Me}async close(){}};function w(e){return!!(e&&typeof e=="object"&&"createDataSource"in e)}var be=class extends Error{constructor(r,t){super(r),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response};var Nn=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,$n=/^([-\w.]+\/[-\w.+]+)/;function Kr(e,r){return e.toLowerCase()===r.toLowerCase()}function Yt(e){let r=$n.exec(e);return r?r[1]:e}function Zr(e){let r=Nn.exec(e);return r?r[1]:""}var Xt=/\?.*/;function eo(e){let r=e.match(Xt);return r&&r[0]}function Z(e){return e.replace(Xt,"")}function ro(e){if(e.length<50)return e;let r=e.slice(e.length-15);return`${e.substr(0,32)}...${r}`}function E(e){return p(e)?e.url:h(e)?("name"in e?e.name:"")||"":typeof e=="string"?e:""}function xe(e){if(p(e)){let r=e.headers.get("content-type")||"",t=Z(e.url);return Yt(r)||Zr(t)}return h(e)?e.type||"":typeof e=="string"?Zr(e):""}function to(e){return p(e)?e.headers["content-length"]||-1:h(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function ve(e){if(p(e))return e;let r={},t=to(e);t>=0&&(r["content-length"]=String(t));let o=E(e),n=xe(e);n&&(r["content-type"]=n);let s=await jn(e);s&&(r["x-first-bytes"]=s),typeof e=="string"&&(e=new TextEncoder().encode(e));let a=new Response(e,{headers:r});return Object.defineProperty(a,"url",{value:o}),a}async function Xe(e){if(!e.ok)throw await Dn(e)}async function Dn(e){let r=ro(e.url),t=`Failed to fetch resource (${e.status}) ${e.statusText}: ${r}`;t=t.length>100?`${t.slice(0,100)}...`:t;let o={reason:e.statusText,url:e.url,response:e};try{let n=e.headers.get("Content-Type");o.reason=!e.bodyUsed&&n?.includes("application/json")?await e.json():await e.text()}catch{}return new be(t,o)}async function jn(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(o=>{let n=new FileReader;n.onload=s=>o(s?.target?.result),n.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=e.slice(0,5);return`data:base64,${zn(t)}`}return null}function zn(e){let r="",t=new Uint8Array(e);for(let o=0;o<t.byteLength;o++)r+=String.fromCharCode(t[o]);return btoa(r)}function qn(e){return!Vn(e)&&!Hn(e)}function Vn(e){return e.startsWith("http:")||e.startsWith("https:")}function Hn(e){return e.startsWith("data:")}async function k(e,r){if(typeof e=="string"){let t=K(e);return qn(t)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(t,r):await fetch(t,r)}return await ve(e)}async function oo(e,r,t){e instanceof Blob||(e=new Blob([e]));let o=e.slice(r,r+t);return await Qn(o)}async function Qn(e){return await new Promise((r,t)=>{let o=new FileReader;o.onload=n=>r(n?.target?.result),o.onerror=n=>t(n),o.readAsArrayBuffer(e)})}var Ne=new L({id:"loaders.gl"}),er=class{log(){return()=>{}}info(){return()=>{}}once(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},rr=class{console;onceMessages=new Set;constructor(){this.console=console}log(...r){return this.console.log.bind(this.console,...r)}info(...r){return this.console.info.bind(this.console,...r)}once(...r){let t=String(r[0]);return this.onceMessages.has(t)?()=>{}:(this.onceMessages.add(t),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 tr={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,shape:void 0,log:new rr,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,workerThreshold:.1,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:y,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},no={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",shape:"core.shape",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"core.fetch.keepalive",signal:"core.fetch.signal"};var Yr=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","workerThreshold","maxConcurrency","maxMobileConcurrency","reuseWorkers","workerTransferBufferCopy","_nodeWorkers","_workerType","limit","_limitMB","shape","batchSize","batchDebounceMs","metadata","transforms"];function $e(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function F(){let e=$e();return e.globalOptions=e.globalOptions||{...tr,core:{...tr.core}},q(e.globalOptions)}function Xr(e){let r=$e(),t=F();r.globalOptions=co(t,e),Tr(e.modules)}function Y(e,r,t,o){t=t||[],t=Array.isArray(t)?t:[t],Gn(e,t),so(e);let n=q(co(r,e,o));return so(n),n}function q(e){let r=Yn(e);uo(r);for(let t of Yr)r.core&&r.core[t]!==void 0&&delete r[t];return r.core&&r.core._workerType!==void 0&&delete r._worker,r}function Gn(e,r){io(e,null,tr,no,r);for(let t of r){let o=e&&e[t.id]||{},n=t.options&&t.options[t.id]||{},s=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};io(o,t.id,n,s,r)}}function so(e){let r=e.core?.workerThreshold;if(r!==void 0&&(!Number.isFinite(r)||r<0||r>1))throw new Error("core.workerThreshold must be a finite number between 0 and 1")}function io(e,r,t,o,n){let s=r||"Top level",a=r?`${r}.`:"";for(let i in e){let c=!r&&T(e[i]),u=i==="baseUri"&&!r,f=i==="workerUrl"&&r;if(!(i in t)&&!u&&!f){if(i in o)Ne.level>0&&Ne.warn(`${s} loader option '${a}${i}' no longer supported, use '${o[i]}'`)();else if(!c&&Ne.level>0){let l=Jn(i,n);Ne.warn(`${s} loader option '${a}${i}' not recognized. ${l}`)()}}}}function Jn(e,r){let t=e.toLowerCase(),o="";for(let n of r)for(let s in n.options){if(e===s)return`Did you mean '${n.id}.${s}'?`;let a=s.toLowerCase();(t.startsWith(a)||a.startsWith(t))&&(o=o||`Did you mean '${n.id}.${s}'?`)}return o}function co(e,r,t){let o=e.options||{},n={...o};o.core&&(n.core={...o.core}),uo(n),n.core?.log===null&&(n.core={...n.core,log:new er}),ao(n,q(F()));let s=q(r);return ao(n,s),Kn(n,s,e),Zn(n,t),Xn(n),n}function Kn(e,r,t){let o=e.core?.shape;if(o===void 0)return;let n=t.options?.[t.id];if(!S(n)||!("shape"in n))return;let s=F()[t.id];if(S(s)&&"shape"in s)return;let a=r[t.id];if(S(a)&&"shape"in a)return;let i=e[t.id];e[t.id]={...S(i)?i:{},shape:o}}function ao(e,r){for(let t in r)if(t in r){let o=r[t];S(o)&&S(e[t])?e[t]={...e[t],...r[t]}:e[t]=r[t]}}function Zn(e,r){if(!r)return;e.core?.baseUrl!==void 0||(e.core||={},e.core.baseUrl=D.dirname(Z(r)))}function Yn(e){let r={...e};return e.core&&(r.core={...e.core}),r}function uo(e){e.baseUri!==void 0&&(e.core||={},e.core.baseUrl===void 0&&(e.core.baseUrl=e.baseUri));for(let t of Yr)if(e[t]!==void 0){e.core||={};let n=e.core;n[t]===void 0&&(n[t]=e[t])}let r=e._worker;r!==void 0&&(e.core||={},e.core._workerType===void 0&&(e.core._workerType=r))}function Xn(e){let r=e.core;if(r)for(let t of Yr)r[t]!==void 0&&(e[t]=r[t])}function A(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions)):!1}function De(e){fe(e,"null loader"),fe(A(e),"invalid loader");let r;return Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var fo=()=>{let e=$e();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function lo(e){let r=fo();e=Array.isArray(e)?e:[e];for(let t of e){let o=De(t);r.find(n=>o===n)||r.unshift(o)}}function mo(){return fo()}function ho(){let e=$e();e.loaderRegistry=[]}var es=/\.([^.]+)$/;async function O(e,r=[],t,o){if(!go(e))return null;let n=q(t||{});if(n.core||={},e instanceof Response&&po(e)){let a=await e.clone().text(),i=_(a,r,{...n,core:{...n.core,nothrow:!0}},o);if(i)return i}let s=_(e,r,{...n,core:{...n.core,nothrow:!0}},o);if(s)return s;if(h(e)&&(e=await e.slice(0,10).arrayBuffer(),s=_(e,r,n,o)),!s&&e instanceof Response&&po(e)){let a=await e.clone().text();s=_(a,r,n,o)}if(!s&&!n.core.nothrow)throw new Error(wo(e));return s}function po(e){let r=xe(e);return!!(r&&(r.startsWith("text/")||r==="application/json"||r.endsWith("+json")))}function _(e,r=[],t,o){if(!go(e))return null;let n=q(t||{});if(n.core||={},r&&!Array.isArray(r))return De(r);let s=[];r&&(s=s.concat(r)),n.core.ignoreRegisteredLoaders||s.push(...mo()),ts(s);let a=rs(e,s,n,o);if(!a&&!n.core.nothrow)throw new Error(wo(e));return a}function rs(e,r,t,o){let n=E(e),s=xe(e),a=Z(n)||o?.url,i=null,c="",u=t?.core&&"type"in t.core?t.core.type:void 0;return u&&u!=="auto"&&(i=ss(r,u),c=i?`match forced by supplied source type ${u}`:""),t?.core?.mimeType&&(i=et(r,t?.core?.mimeType),c=`match forced by supplied MIME type ${t?.core?.mimeType}`),i=i||is(r,a),c=c||(i?`matched source url ${a}`:""),i=i||os(r,a),c=c||(i?`matched url ${a}`:""),i=i||et(r,s),c=c||(i?`matched MIME type ${s}`:""),i=i||cs(r,e),c=c||(i?`matched initial data ${bo(e)}`:""),!i&&h(e)&&(i=as(r,e),c=c||(i?"matched source testData":"")),t?.core?.fallbackMimeType&&(i=i||et(r,t?.core?.fallbackMimeType),c=c||(i?`matched fallback MIME type ${s}`:"")),c&&wr.log(1,`selectLoader selected ${i?.name}: ${c}.`),i}function go(e){return!(e instanceof Response&&e.status===204)}function wo(e){let r=E(e),t=xe(e),o="No valid loader found (";o+=r?`${D.filename(r)}, `:"no url provided, ",o+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let n=e?bo(e):"";return o+=n?` first bytes: "${n}"`:"first bytes: not available",o+=")",o}function ts(e){for(let r of e)De(r)}function os(e,r){let t=r&&es.exec(r),o=t&&t[1];return o?ns(e,o):null}function ns(e,r){r=r.toLowerCase();for(let t of e)for(let o of t.extensions)if(o.toLowerCase()===r)return t;return null}function ss(e,r){for(let t of e)if(w(t)&&t.type===r)return t;return null}function is(e,r){if(!r)return null;for(let t of e)if(w(t)&&t.testURL(r))return t;return null}function as(e,r){for(let t of e)if(w(t)&&t.testData?.(r))return t;return null}function et(e,r){for(let t of e)if(t.mimeTypes?.some(o=>Kr(r,o))||Kr(r,`application/x.${t.id}`))return t;return null}function cs(e,r){if(!r)return null;for(let t of e)if(typeof r=="string"){if(us(r,t))return t}else if(ArrayBuffer.isView(r)){if(yo(r.buffer,r.byteOffset,t))return t}else if(r instanceof ArrayBuffer&&yo(r,0,t))return t;return null}function us(e,r){return r.testText?r.testText(e):(Array.isArray(r.tests)?r.tests:[r.tests]).some(o=>e.startsWith(o))}function yo(e,r,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>fs(e,r,t,n))}function fs(e,r,t,o){if(H(o))return Ur(o,e,o.byteLength);switch(typeof o){case"function":return o(z(e));case"string":let n=rt(e,r,o.length);return o===n;default:return!1}}function bo(e,r=5){return typeof e=="string"?e.slice(0,r):ArrayBuffer.isView(e)?rt(e.buffer,e.byteOffset,r):e instanceof ArrayBuffer?rt(e,0,r):""}function rt(e,r,t){if(e.byteLength<r+t)return"";let o=new DataView(e),n="";for(let s=0;s<t;s++)n+=String.fromCharCode(o.getUint8(r+s));return n}var ls=256*1024;function*xo(e,r){let t=r?.chunkSize||ls,o=0,n=new TextEncoder;for(;o<e.length;){let s=Math.min(e.length-o,t),a=e.slice(o,o+s);o+=s,yield z(n.encode(a))}}function*To(e,r={}){let{chunkSize:t=262144}=r,o=0;for(;o<e.byteLength;){let n=Math.min(e.byteLength-o,t),s=new ArrayBuffer(n),a=new Uint8Array(e,o,n);new Uint8Array(s).set(a),o+=n,yield s}}async function*ko(e,r){let t=r?.chunkSize||1048576,o=0;for(;o<e.size;){let n=o+t,s=await e.slice(o,n).arrayBuffer();o=n,yield s}}function tt(e,r){return y?ms(e,r):hs(e,r)}async function*ms(e,r){let t=e.getReader(),o,n=!1,s=!1,a=!1;try{for(;;){let i=o||t.read();o=void 0;let c;try{c=await i}catch(l){throw s=!0,l}let{done:u,value:f}=c;if(u){n=!0;return}r?._streamReadAhead&&(o=t.read(),o.catch(()=>{})),yield j(f)}}catch(i){throw a=!0,i}finally{let i=!1,c;if(!n&&!s)try{await t.cancel()}catch(u){i=!0,c=u}try{t.releaseLock()}catch(u){i||(i=!0,c=u)}if(!a&&i)throw c}}async function*hs(e,r){for await(let t of e)yield j(t)}function ae(e,r){if(typeof e=="string")return xo(e,r);if(e instanceof ArrayBuffer)return To(e,r);if(h(e))return ko(e,r);if(N(e))return tt(e,r);if(p(e)){let t=e.body;if(!t)throw new Error("Readable stream not available on Response");return tt(t,r)}throw new Error("makeIterator")}var je="Cannot convert supplied data type";function ot(e,r,t){if(r.text&&typeof e=="string")return e;if(Ze(e)&&(e=e.buffer),H(e)){let o=Ye(e);return r.text&&!r.binary?new TextDecoder("utf8").decode(o):j(o)}throw new Error(je)}async function Ao(e,r,t){if(typeof e=="string"||H(e))return ot(e,r,t);if(h(e)&&(e=await ve(e)),p(e))return await Xe(e),r.binary?await e.arrayBuffer():await e.text();if(N(e)&&(e=ae(e,t)),Q(e)||se(e))return J(e);throw new Error(je)}async function So(e,r){if(typeof e=="string")return new TextEncoder().encode(e).buffer;if(H(e))return j(Ye(e));if(h(e)&&(e=await ve(e)),p(e))return await Xe(e),await e.arrayBuffer();if(N(e)&&(e=ae(e,r)),Q(e)||se(e))return J(e);throw new Error(je)}async function _o(e,r){if(Se(e)&&(e=await e),de(e))return e;if(p(e)){await Xe(e);let t=await e.body;if(!t)throw new Error(je);return ae(t,r)}return h(e)||N(e)?ae(e,r):se(e)||Q(e)?e:ds(e)}function ds(e){if(ArrayBuffer.isView(e))return(function*(){yield j(e)})();if(H(e))return(function*(){yield j(e)})();if(de(e))return e;if(Q(e))return e[Symbol.iterator]();throw new Error(je)}function ce(e,r){let t=F(),o=e||t,n=o.fetch??o.core?.fetch,s;if(typeof n=="function")s=n;else if(T(n)){let a=r?.fetch||k;s=(i,c)=>a(i,ps(n,c))}else r?.fetch?s=r.fetch:s=k;return qr({fetch:s,credentials:o.core?.credentials||[]})}function ps(e,r){let t={...e,...r};if(e.headers||r?.headers){let o=new Headers(e.headers);new Headers(r?.headers).forEach((n,s)=>o.set(s,n)),t.headers=o}return t}var nt=new Map,or=new Map;async function M(e,r,t){if(sr(e))return e;let o=Lo(e,r),n=or.get(e)?.get(o);if(n)return n;let s=nt.get(e);s||(s=new Map,nt.set(e,s));let a=s.get(o);return a||(a=ys(e,r,t).then(i=>{let c=or.get(e);return c||(c=new Map,or.set(e,c)),c.set(o,i),i}).catch(i=>{throw s.delete(o),s.size===0&&nt.delete(e),i}),s.set(o,a)),await a}function nr(e){if(sr(e))return e;let r=Lo(e);return or.get(e)?.get(r)||null}function sr(e){let r=e;return!!(r.parse||r.parseSync||r.parseInBatches||r.parseText||r.parseTextSync||r.parseFile||r.parseFileInBatches)}async function ys(e,r,t){if(e.preload){let n=await e.preload(t||"",r);if(sr(n))return n;throw new Error(`${e.id} loader preload() did not return a parser-bearing loader`)}let o=gs(e,r);return await ws(o,e.id)}function gs(e,r){if((r?._workerType||r?.core?._workerType)==="test"){let o=`modules/${e.module}/src/${e.id}-loader.ts`;return typeof window<"u"?`/${o}`:typeof process<"u"&&process.cwd?new URL(o,`file://${process.cwd()}/`).toString():o}throw new Error(`${e.id} loader does not provide a parser implementation. Import a parser-bearing loader directly, or use preload() before parse/load.`)}function Lo(e,r){let t=r?.[e.id],o=e.options?.[e.id];return String(t?.backend||o?.backend||"")}async function ws(e,r){let t=await import(e);for(let o of Object.values(t))if(o&&typeof o=="object"&&o.id===r&&sr(o))return o;throw new Error(`Could not find parser implementation for ${r} in ${e}`)}async function X(e,r,t,o){r&&!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),t=t||{};let n=e.url||"",a=Te(r,o),i=await O(n,a,t);if(!i)return null;if(w(i))throw new Error(`${i.id} is a SourceLoader. Use load() to create a runtime source object instead of parseFile().`);let c=Y(t,i,a,n);return o=ee({url:n,_parse:d,loaders:a},c,o||null),await bs(i,e,c,o)}async function bs(e,r,t,o){We(e),t=_e(e.options,t);let n=await M(e,t,o.url);if(n.parseFile)return await n.parseFile(r,t,o);if(n.parse){let a=r.bigsize>0n?Number(r.bigsize):r.size;if(!a)throw new Error(`${e.id} loader - cannot fall back to parse without a file size`);let i=await r.read(0n,a);return await d(i,n,t,o)}throw new Error(`${e.id} loader - no file parser found`)}function re(e,r,t,o){!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),t=t||{};let s=Te(r,o),a=_(e,s,t);if(!a)return null;if(w(a))throw new Error(`${a.id} is a SourceLoader. Use load() to create a runtime source object instead of parseSync().`);let i=Y(t,a,s),c=E(e),u=()=>{throw new Error("parseSync called parse (which is async")};o=ee({url:c,_parseSync:u,_parse:u,loaders:r},i,o||null);let f=nr(a);return xs(f||a,e,i,o)}function xs(e,r,t,o){if(r=ot(r,e,t),e.parseTextSync&&typeof r=="string")return e.parseTextSync(r,t);if(e.parseSync&&r instanceof ArrayBuffer)return e.parseSync(r,t,o);throw e.preload?new Error(`${e.name} loader: 'parseSync' requires a parser-bearing loader. Import the loader implementation directly, or call preload(loader) before parseSync(). ${o.url||""}`):new Error(`${e.name} loader: 'parseSync' not supported by this loader, use 'parse' instead. ${o.url||""}`)}function st(e){switch(typeof e=="object"&&e?.shape){case"array-row-table":case"object-row-table":return Array.isArray(e.data);case"geojson-table":return Array.isArray(e.features);case"columnar-table":return!!(e.data&&typeof e.data=="object");case"arrow-table":return e?.data?.numRows!==void 0;default:return!1}}function it(e){switch(e.shape){case"array-row-table":case"object-row-table":return e.data.length;case"geojson-table":return e.features.length;case"arrow-table":return e.data.numRows;case"columnar-table":for(let t of Object.values(e.data))return t.length||0;return 0;default:throw new Error("table")}}function at(e){return{...e,length:it(e),batchType:"data"}}async function x(e,r,t,o){let n=Array.isArray(r)?r:void 0;!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),e=await e,t=t||{};let s=E(e),a=await O(e,r,t);if(!a)return[];let i=Y(t,a,n,s);o=ee({url:s,_parseInBatches:x,_parse:d,loaders:n},i,o||null);let c=await M(a,i,o.url);return await Ts(a,c,e,i,o)}async function Ts(e,r,t,o,n){let s=await ks(r,t,o,n);if(!o?.core?.metadata)return s;let a={shape:"metadata",batchType:"metadata",metadata:{_loader:e,_context:n},data:[],bytesUsed:0};async function*i(c){yield a,yield*c}return i(s)}async function ks(e,r,t,o){let n=await _o(r,t),s=await _s(n,t?.core?.transforms||[]);return e.parseInBatches?e.id==="csv"&&y&&Je(e,t)?Fr(e,s,t,o,d):e.parseInBatches(s,t,o):As(s,e,t,o)}async function*As(e,r,t,o){let n=await J(e),s=await d(n,r,{...t,core:{...t?.core,mimeType:r.mimeTypes[0]}},o);yield Ss(s,r)}function Ss(e,r){let t=st(e)?at(e):{shape:"unknown",batchType:"data",data:e,length:Array.isArray(e)?e.length:1};return t.mimeType=r.mimeTypes[0],t}async function _s(e,r=[]){let t=e;for await(let o of r)t=o(t);return t}function te(e,r,t,o){let n;!Array.isArray(r)&&!A(r)?(o=void 0,t=r,n=void 0):n=r;let s=ce(t||{});return Array.isArray(e)?e.map(i=>Eo(i,n,t||{},s)):Eo(e,n,t||{},s)}async function Eo(e,r,t,o){if(typeof e=="string"){let s=await o(e);return Array.isArray(r)?await x(s,r,t):await x(s,r,t)}return Array.isArray(r)?await x(e,r,t):await x(e,r,t)}async function ue(e,r,t,o){let n,s;if(!Array.isArray(r)&&!A(r)?(n=[],s=r,o=void 0):(n=r,s=t),!Array.isArray(n)&&w(n)){let c=await ct(n,e,s),u={fetchFile:k,parse:d,parseFile:X,parseSync:re,parseInBatches:x,load:ue,loadInBatches:te};return c.createDataSource(e,s||{},u)}if(Array.isArray(n)&&n.length===1&&w(n[0])){let c=await ct(n[0],e,s),u={fetchFile:k,parse:d,parseFile:X,parseSync:re,parseInBatches:x,load:ue,loadInBatches:te};return c.createDataSource(e,s||{},u)}if(typeof e=="string"||h(e)){let c=await O(e,n,{...s,core:{...s?.core,nothrow:!0}});if(c&&w(c))return(await ct(c,e,s)).createDataSource(e,s||{},{fetchFile:k,parse:d,parseFile:X,parseSync:re,parseInBatches:x,load:ue,loadInBatches:te});if(c&&typeof e=="string"){let f=(await M(c,s,e)).parseUrl;if(f)return await f(e,s,o)}}let a=ce(s),i=e;return typeof e=="string"&&(i=await a(e)),h(e)&&(i=await a(e)),typeof e=="string"&&(q(s||{}).core?.baseUrl||(s={...s,core:{...s?.core,baseUrl:e}})),Array.isArray(n)?await d(i,n,s,o):await d(i,n,s,o)}async function ct(e,r,t){if(!e.preload)return e;let o=await e.preload(typeof r=="string"?r:"",t);if(!w(o))throw new Error(`${e.id} source loader preload() did not return a runtime source loader`);return o}var ke=Object.freeze({fetchFile:k,parse:d,parseFile:X,parseSync:re,parseInBatches:x,load:ue,loadInBatches:te});function ee(e,r,t){if(t)return{...t,fetch:ce(r,t)};let o={...e,fetch:ce(r,e),coreApi:e.coreApi||ke};if(o.url){let n=Z(o.url);o.baseUrl=n,o.queryString=eo(o.url),o.filename=D.filename(n),o.baseUrl=D.dirname(n)}return Array.isArray(o.loaders)||(o.loaders=null),o}function Te(e,r){if(e&&!Array.isArray(e))return e;let t;if(e&&(t=Array.isArray(e)?e:[e]),r&&r.loaders){let o=Array.isArray(r.loaders)?r.loaders:[r.loaders];t=t?[...t,...o]:o}return t&&t.length?t:void 0}async function d(e,r,t,o){r&&!Array.isArray(r)&&!A(r)&&(o=void 0,t=r,r=void 0),e=await e,t=t||{};let n=E(e),a=Te(r,o),i=await O(e,a,t);if(!i)return null;if(w(i))throw new Error(`${i.id} is a SourceLoader. Use load() to create a runtime source object instead of parse().`);let c=Y(t,i,a,n);return o=ee({url:n,_parse:d,loaders:a},c,o||null),await Ls(i,e,c,o)}async function Ls(e,r,t,o){if(We(e),t=_e(e.options,t),p(r)){let{ok:s,redirected:a,status:i,statusText:c,type:u,url:f}=r,l=Object.fromEntries(r.headers.entries());o.response={headers:l,ok:s,redirected:a,status:i,statusText:c,type:u,url:f}}let n=await M(e,t,o.url);return Cr(n,r,t,o,e)?(r=await So(r,t),await Pr(n,r,t,o,d)):h(r)&&n.parseBlob?await n.parseBlob(r,t,o):(r=await Ao(r,e,t),await Es(n,r,t,o))}async function Es(e,r,t,o){if(e.parseText&&typeof r=="string")return await e.parseText(r,t,o);if(e.parseTextSync&&typeof r=="string")return e.parseTextSync(r,t,o);if(e.parse)return await e.parse(r,t,o);throw e.parseSync?new Error(`${e.name} loader: 'parse' not available on parser-bearing sync loader. Add an async 'parse' function to this loader, or call preload(loader) before parseSync(). ${o.url||""}`):new Error(`${e.id} loader - no parser found and worker is disabled`)}async function Bo(e,r,t){return await M(e,r,t)}function Ro(e){return nr(e)}async function ut(e,r,t){if(r.encode)return await r.encode(e,t);if(r.encodeText){let o=await r.encodeText(e,t);return z(new TextEncoder().encode(o))}if(r.encodeInBatches){let o=ft(e,r,t),n=[];for await(let s of o)n.push(s);return Ce(...n)}throw new Error("Writer could not encode data")}async function Io(e,r,t){if(r.text&&r.encodeText)return await r.encodeText(e,t);if(r.text){let o=await ut(e,r,t);return new TextDecoder().decode(o)}throw new Error(`Writer ${r.name} could not encode data as text`)}function ft(e,r,t){if(r.encodeInBatches){let o=Bs(e);return r.encodeInBatches(o,t)}throw new Error("Writer could not encode data in batches")}function Bs(e){return[{...e,start:0,end:e.length}]}async function Co(e,r,t){let n={...F(),...t};return r.encodeURLtoURL?Rs(r,e,n):Mr(r,n)?await Ie(r,e,n):await r.encode(e,n)}function lt(e,r,t){if(r.encodeSync)return r.encodeSync(e,t);if(r.encodeTextSync)return z(new TextEncoder().encode(r.encodeTextSync(e,t)));throw new Error(`Writer ${r.name} could not synchronously encode data`)}async function Po(e,r,t){if(r.encodeText)return await r.encodeText(e,t);if(r.encodeTextSync)return r.encodeTextSync(e,t);if(r.text){let o=await r.encode(e,t);return new TextDecoder().decode(o)}throw new Error(`Writer ${r.name} could not encode data as text`)}function Fo(e,r,t){if(r.encodeTextSync)return r.encodeTextSync(e,t);if(r.text&&r.encodeSync){let o=lt(e,r,t);return new TextDecoder().decode(o)}throw new Error(`Writer ${r.name} could not encode data as text`)}function Oo(e,r,t){if(r.encodeInBatches){let o=Is(e);return r.encodeInBatches(o,t)}throw new Error(`Writer ${r.name} could not encode in batches`)}async function mt(e,r,t,o){if(e=K(e),r=K(r),y||!t.encodeURLtoURL)throw new Error;return await t.encodeURLtoURL(e,r,o)}async function Rs(e,r,t){if(y)throw new Error(`Writer ${e.name} not supported in browser`);let o=Wo("input");await new Ue(o,"w").write(r);let s=Wo("output"),a=await mt(o,s,e,t);return(await k(a)).arrayBuffer()}function Is(e){return[{...e,start:0,end:e.length}]}function Wo(e){return`/tmp/${e}`}function Mo(e,r,t){let o=t||{},n=o?.core?.type||o.type||"auto",s=r.length===1?r[0]:n==="auto"?_(e,r,{...o,core:{...o?.core,type:"auto"}}):Ws(n,r);if(!s)throw new Error("Not a valid source type");return s.createDataSource(e,o,ke)}function Ws(e,r){for(let t of r)if(t.type===e)return t;return null}function Uo(e,r,t){let o=t?.type||"auto",n=null;if(o==="auto"?n=_(e,r,{core:{nothrow:!0}}):n=Cs(o,r),!n&&!t?.nothrow)throw new Error("Not a valid image source type");return n}function Cs(e,r){for(let t of r)if(t.type===e)return t;return null}function vo(e,r){if(globalThis.loaders.makeNodeStream)return globalThis.loaders.makeNodeStream(e,r);let t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new ReadableStream({type:"bytes",async pull(o){try{let{done:n,value:s}=await t.next();n?o.close():o.enqueue(new Uint8Array(s))}catch(n){o.error(n)}},async cancel(){await t?.return?.()}},{highWaterMark:2**24,...r})}var No="5.0.0-alpha.7",$o={dataType:null,batchType:null,name:"Null loader",id:"null",module:"core",version:No,worker:!0,mimeTypes:["application/x.empty"],extensions:["null"],tests:[()=>!1],options:{null:{}}},Do={dataType:null,batchType:null,name:"Null loader",id:"null",module:"core",version:No,mimeTypes:["application/x.empty"],extensions:["null"],parse:async(e,r,t)=>ht(e,r||{},t),parseSync:ht,parseInBatches:async function*(r,t,o){for await(let n of r)yield ht(n,t,o)},tests:[()=>!1],options:{null:{}}};function ht(e,r,t){return null}async function jo(e,r,t=()=>{},o=()=>{}){if(e=await e,!e.ok)return e;let n=e.body;if(!n)return e;let s=e.headers.get("content-length")||0,a=s?parseInt(s):0;if(!(a>0)||typeof ReadableStream>"u"||!n.getReader)return e;let i=new ReadableStream({async start(c){let u=n.getReader();await zo(c,u,0,a,r,t,o)}});return new Response(i)}async function zo(e,r,t,o,n,s,a){try{let{done:i,value:c}=await r.read();if(i){s(),e.close();return}t+=c.byteLength;let u=Math.round(t/o*100);n(u,{loadedBytes:t,totalBytes:o}),e.enqueue(c),await zo(e,r,t,o,n,s,a)}catch(i){e.error(i),a(i)}}var ir=class{_fetch;files={};lowerCaseFiles={};usedFiles={};constructor(r,t){this._fetch=t?.fetch||fetch;for(let o=0;o<r.length;++o){let n=r[o];this.files[n.name]=n,this.lowerCaseFiles[n.name.toLowerCase()]=n,this.usedFiles[n.name]=!1}this.fetch=this.fetch.bind(this)}async fetch(r,t){if(r.includes("://"))return this._fetch(r,t);let o=this._getFile(r,!0);if(!o)return new Response(r,{status:400,statusText:"NOT FOUND"});let s=new Headers(t?.headers).get("Range"),a=s&&/bytes=(\d+)-(\d+)/.exec(s);if(a){let c=parseInt(a[1]),u=Math.min(parseInt(a[2]),o.size-1);if(c>u){let m=new Response(null,{status:416,headers:{"Content-Range":`bytes */${o.size}`}});return Object.defineProperty(m,"url",{value:r}),m}let f=await o.slice(c,u+1).arrayBuffer(),l=new Response(f,{status:206,headers:{"Content-Range":`bytes ${c}-${u}/${o.size}`}});return Object.defineProperty(l,"url",{value:r}),l}let i=new Response(o);return Object.defineProperty(i,"url",{value:r}),i}async readdir(r){let t=[];for(let o in this.files)t.push(o);return t}async stat(r,t){let o=this._getFile(r,!1);if(!o)throw new Error(r);return{size:o.size}}async unlink(r){let t=this._getFile(r,!1);t&&(delete this.files[t.name],delete this.lowerCaseFiles[t.name.toLowerCase()],this.usedFiles[t.name]=!0)}async openReadableFile(r,t){return new Oe(this._getFile(r,!0))}_getFile(r,t){let o=this.files[r]||this.lowerCaseFiles[r.toLowerCase()];return o&&t&&(this.usedFiles[r]=!0),o}};return Go(Ps);})();
15
15
  return __exports__;
16
16
  });