{
  "version": 3,
  "sources": ["../src/index.ts", "../src/loader-types.ts", "../src/lib/env-utils/assert.ts", "../src/lib/env-utils/globals.ts", "../src/lib/log-utils/log.ts", "../src/lib/javascript-utils/is-type.ts", "../src/lib/option-utils/merge-options.ts", "../src/lib/module-utils/js-module-utils.ts", "../src/lib/worker-loader-utils/create-loader-worker.ts", "../src/lib/worker-loader-utils/parse-with-worker.ts", "../src/lib/worker-loader-utils/encode-with-worker.ts", "../src/lib/binary-utils/get-first-characters.ts", "../src/lib/parser-utils/parse-json.ts", "../src/lib/binary-utils/array-buffer-utils.ts", "../src/lib/binary-utils/memory-copy-utils.ts", "../src/lib/binary-utils/dataview-copy-utils.ts", "../src/lib/iterators/text-iterators.ts", "../src/lib/iterators/async-iteration.ts", "../src/lib/request-utils/request-scheduler.ts", "../src/lib/path-utils/file-aliases.ts", "../src/json-loader.ts", "../src/lib/node/buffer.browser.ts", "../src/lib/binary-utils/memory-conversion-utils.ts", "../src/lib/node/promisify.ts", "../src/lib/path-utils/path.ts", "../src/lib/path-utils/get-cwd.ts", "../src/lib/node/stream.browser.ts", "../src/lib/files/blob-file.ts", "../src/lib/files/http-file.ts", "../src/lib/files/node-file-facade.ts", "../src/lib/filesystems/node-filesystem-facade.ts", "../src/lib/sources/data-source.ts", "../src/lib/sources/image-source.ts"],
  "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// TYPES\n\nexport type {\n  // misc\n  DataType,\n  SyncDataType,\n  BatchableDataType,\n  TransformBatches,\n  // numeric array types\n  TypedArray,\n  BigTypedArray,\n  TypedArrayConstructor,\n  BigTypedArrayConstructor,\n  NumberArray,\n  NumericArray,\n  // fetch\n  FetchLike\n} from './types';\n\n// formats\n\nexport type {Format} from './format-types';\n\n// loaders\n\nexport type {\n  Loader,\n  LoaderWithParser,\n  LoaderContext,\n  StrictLoaderOptions,\n  LoaderOptions,\n  LoaderOptionsType,\n  LoaderReturnType,\n  LoaderBatchType,\n  LoaderArrayOptionsType,\n  LoaderArrayReturnType,\n  LoaderArrayBatchType\n} from './loader-types';\n\nexport {parseFromContext, parseSyncFromContext, parseInBatchesFromContext} from './loader-types';\n\n// writers\n\nexport type {\n  Writer,\n  WriterWithEncoder,\n  WriterOptions,\n  WriterOptionsType,\n  WriterDataType,\n  WriterBatchType\n} from './writer-types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n  isBrowser,\n  isWorker,\n  nodeVersion,\n  self,\n  window,\n  global,\n  document\n} from './lib/env-utils/globals';\n\nexport {log} from './lib/log-utils/log';\n\nexport type {ReadableStreamType} from './lib/javascript-utils/is-type';\nexport {\n  isObject,\n  isPureObject,\n  isArrayBuffer,\n  isArrayBufferLike,\n  isPromise,\n  isIterable,\n  isAsyncIterable,\n  isIterator,\n  isResponse,\n  isFile,\n  isBlob,\n  isWritableDOMStream,\n  isReadableDOMStream,\n  isWritableNodeStream,\n  isReadableNodeStream,\n  isReadableStream,\n  isWritableStream\n} from './lib/javascript-utils/is-type';\n\n// Options and modules\nexport type {RequiredOptions} from './lib/option-utils/merge-options';\nexport {mergeOptions, getRequiredOptions} from './lib/option-utils/merge-options';\n\n// Modules (external libraries)\nexport {registerJSModules} from './lib/module-utils/js-module-utils';\nexport {checkJSModule, getJSModule, getJSModuleOrNull} from './lib/module-utils/js-module-utils';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\nexport {canEncodeWithWorker} from './lib/worker-loader-utils/encode-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n  sliceArrayBuffer,\n  concatenateArrayBuffers,\n  concatenateArrayBuffersFromArray,\n  concatenateTypedArrays,\n  compareArrayBuffers\n} from './lib/binary-utils/array-buffer-utils';\nexport {padToNBytes, copyToArray, copyArrayBuffer} from './lib/binary-utils/memory-copy-utils';\nexport {\n  padStringToByteAlignment,\n  copyStringToDataView,\n  copyBinaryToDataView,\n  copyPaddedArrayBufferToDataView,\n  copyPaddedStringToDataView\n} from './lib/binary-utils/dataview-copy-utils';\nexport {getFirstCharacters, getMagicString} from './lib/binary-utils/get-first-characters';\n\n// ITERATOR UTILS\nexport {\n  makeTextEncoderIterator,\n  makeTextDecoderIterator,\n  makeLineIterator,\n  makeNumberedLineIterator\n} from './lib/iterators/text-iterators';\nexport {\n  forEach,\n  concatenateArrayBuffersAsync,\n  toArrayBufferIterator\n} from './lib/iterators/async-iteration';\n\n// REQUEST UTILS\nexport {default as RequestScheduler} from './lib/request-utils/request-scheduler';\n\n// PATH HELPERS\nexport {setPathPrefix, getPathPrefix, resolvePath} from './lib/path-utils/file-aliases';\nexport {addAliases as _addAliases} from './lib/path-utils/file-aliases';\n\n// MICRO LOADERS\nexport {JSONLoader} from './json-loader';\n\n// NODE support\n\n// Node.js emulation (can be used in browser)\n\n// Avoid direct use of `Buffer` which pulls in 50KB polyfill\nexport {\n  isBuffer,\n  toBuffer,\n  toArrayBuffer,\n  toArrayBufferView,\n  copyToArrayBuffer,\n  ensureArrayBuffer\n} from './lib/binary-utils/memory-conversion-utils';\n\n// Note.js wrappers (can be safely imported, but not used in browser)\n\n// Use instead of importing 'util' to avoid node dependencies\nexport {promisify1, promisify2} from './lib/node/promisify';\n\n// `path` replacement (avoids bundling big path polyfill)\nimport * as path from './lib/path-utils/path';\nexport {path};\n\n// Use instead of importing 'stream' to avoid node dependencies`\nimport * as stream from './lib/node/stream';\nexport {stream};\n\n// EXPERIMENTAL: FILE SYSTEMS\n\nexport type {ReadableFile, WritableFile, Stat} from './lib/files/file';\nexport {BlobFile} from './lib/files/blob-file';\nexport {HttpFile} from './lib/files/http-file';\nexport {NodeFileFacade as NodeFile} from './lib/files/node-file-facade';\n\nexport type {FileSystem, RandomAccessFileSystem} from './lib/filesystems/filesystem';\nexport {NodeFileSystemFacade as NodeFilesystem} from './lib/filesystems/node-filesystem-facade';\n\n// EXPERIMENTAL: DATA SOURCES\nexport type {Source, SourceArrayOptionsType, SourceArrayDataSourceType} from './source-types';\n\nexport type {DataSourceOptions} from './lib/sources/data-source';\nexport {DataSource} from './lib/sources/data-source';\n\nexport {ImageSource} from './lib/sources/image-source';\nexport type {ImageType} from './lib/sources/utils/image-type';\nexport type {ImageSourceMetadata} from './lib/sources/image-source';\nexport type {GetImageParameters} from './lib/sources/image-source';\n\nexport type {VectorSource} from './lib/sources/vector-source';\nexport type {VectorSourceMetadata} from './lib/sources/vector-source';\nexport type {GetFeaturesParameters} from './lib/sources/vector-source';\n\nexport type {TileSource} from './lib/sources/tile-source';\nexport type {TileSourceMetadata, GetTileParameters} from './lib/sources/tile-source';\nexport type {GetTileDataParameters} from './lib/sources/tile-source';\n\nexport type {ImageTileSource} from './lib/sources/image-tile-source';\n\nexport type {VectorTileSource} from './lib/sources/vector-tile-source';\nexport type {VectorTile} from './lib/sources/vector-tile-source';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from './format-types';\nimport {FetchLike, TransformBatches} from './types';\nimport {ReadableFile} from './lib/files/file';\n\n// LOADERS\n\n/**\n * Core Loader Options\n */\nexport type StrictLoaderOptions = {\n  core?: {\n    /** Base URL for resolving relative paths */\n    baseUrl?: string;\n    /** fetch options or a custom fetch function */\n    fetch?: typeof fetch | FetchLike | RequestInit | null;\n    /** Do not throw on errors */\n    nothrow?: boolean;\n\n    /** loader selection, search first for supplied mimeType */\n    mimeType?: string;\n    /** loader selection, provide fallback mimeType is server does not provide */\n    fallbackMimeType?: string;\n    /** loader selection, avoid searching registered loaders */\n    ignoreRegisteredLoaders?: boolean;\n\n    // general\n    /** Experimental: Supply a logger to the parser */\n    log?: any;\n\n    // batched parsing\n\n    /** Size of each batch. `auto` matches batches to size of incoming chunks */\n    batchSize?: number | 'auto';\n    /** Minimal amount of time between batches */\n    batchDebounceMs?: number;\n    /** Stop loading after a given number of rows (compare SQL limit clause) */\n    limit?: 0;\n    /** Experimental: Stop loading after reaching */\n    _limitMB?: 0;\n    /** Generate metadata batches */\n    metadata?: boolean;\n    /** Transforms to run on incoming batches */\n    transforms?: TransformBatches[];\n\n    // module loading\n\n    /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n    useLocalLibraries?: boolean;\n\n    // workers\n\n    /** CDN load workers from */\n    CDN?: string | null;\n    /** Set to `false` to disable workers */\n    worker?: boolean;\n    /** Number of concurrent workers (per loader) on desktop browser */\n    maxConcurrency?: number;\n    /** Number of concurrent workers (per loader) on mobile browsers */\n    maxMobileConcurrency?: number;\n    /** Set to `false` to prevent reuse workers */\n    reuseWorkers?: boolean;\n    /** Whether to use workers under Node.js (experimental) */\n    _nodeWorkers?: boolean;\n    /** set to 'test' to run local worker */\n    _workerType?: string;\n  };\n\n  /** Any additional JS libraries */\n  modules?: Record<string, unknown>;\n\n  // Accept other keys (loader options objects, e.g. `options.csv`, `options.json` ...)\n  [loaderId: string]: Record<string, unknown> | undefined;\n};\n\n/**\n * Core Loader Options\n */\nexport type LoaderOptions = {\n  core?: StrictLoaderOptions['core'];\n  modules?: StrictLoaderOptions['modules'];\n\n  // Deprecated top-level aliases for core options\n  /** @deprecated Use options.core.baseUrl */\n  baseUri?: string;\n  /** @deprecated Use options.core.fetch */\n  fetch?: typeof fetch | FetchLike | RequestInit | null;\n  /** @deprecated Use options.core.mimeType */\n  mimeType?: string;\n  /** @deprecated Use options.core.fallbackMimeType */\n  fallbackMimeType?: string;\n  /** @deprecated Use options.core.ignoreRegisteredLoaders */\n  ignoreRegisteredLoaders?: boolean;\n  /** @deprecated Use options.core.nothrow */\n  nothrow?: boolean;\n  /** @deprecated Use options.core.log */\n  log?: any;\n  /** @deprecated Use options.core.useLocalLibraries */\n  useLocalLibraries?: boolean;\n  /** @deprecated Use options.core.CDN */\n  CDN?: string | null;\n  /** @deprecated Use options.core.worker */\n  worker?: boolean;\n  /** @deprecated Use options.core.maxConcurrency */\n  maxConcurrency?: number;\n  /** @deprecated Use options.core.maxMobileConcurrency */\n  maxMobileConcurrency?: number;\n  /** @deprecated Use options.core.reuseWorkers */\n  reuseWorkers?: boolean;\n  /** @deprecated Use options.core._nodeWorkers */\n  _nodeWorkers?: boolean;\n  /** @deprecated Use options.core._workerType */\n  _workerType?: string;\n  /** @deprecated Use options.core._workerType */\n  _worker?: string;\n  /** @deprecated Use options.core.limit */\n  limit?: 0;\n  /** @deprecated Use options.core._limitMB */\n  _limitMB?: 0;\n  /** @deprecated Use options.core.batchSize */\n  batchSize?: number | 'auto';\n  /** @deprecated Use options.core.batchDebounceMs */\n  batchDebounceMs?: number;\n  /** @deprecated Use options.core.metadata */\n  metadata?: boolean;\n  /** @deprecated Use options.core.transforms */\n  transforms?: TransformBatches[];\n\n  // Accept other keys (loader options objects, e.g. `options.csv`, `options.json` ...)\n  [loaderId: string]: unknown;\n};\n\ntype PreloadOptions = {\n  [key: string]: unknown;\n};\n\n/**\n * A worker loader definition that can be used with `@loaders.gl/core` functions\n */\nexport type Loader<DataT = any, BatchT = any, LoaderOptionsT = StrictLoaderOptions> = Format & {\n  /** The result type of this loader  */\n  dataType?: DataT;\n  /** The batched result type of this loader  */\n  batchType?: BatchT;\n\n  /** Default Options */\n  options: LoaderOptionsT;\n  /** Deprecated Options */\n  deprecatedOptions?: Record<string, string | Record<string, string>>;\n  /** Version should be injected by build tools */\n  version: string;\n  /** A boolean, or a URL */\n  worker?: string | boolean;\n  // end Worker\n\n  /** Human readable name */\n  name: string;\n  /** id should be the same as the field used in LoaderOptions */\n  id: string;\n  /** module is used to generate worker threads, need to be the module directory name */\n  module: string;\n  /** Which category does this loader belong to */\n  category?: string;\n  /** File extensions that are potential matches with this loader. */\n  extensions: string[];\n  /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */\n  mimeTypes: string[];\n  /** Is the input of this loader binary */\n  binary?: boolean;\n  /** Is the input of this loader text */\n  text?: boolean;\n\n  /** Test some initial bytes of content to see if this loader might be a match */\n  tests?: (((ArrayBuffer: ArrayBuffer) => boolean) | ArrayBuffer | string)[];\n\n  /** @deprecated */\n  supported?: boolean;\n  /** @deprecated */\n  testText?: (string: string) => boolean;\n};\n\n/**\n * A \"bundled\" loader definition that can be used with `@loaders.gl/core` functions\n * If a worker loader is supported it will also be supported.\n */\nexport type LoaderWithParser<\n  DataT = any,\n  BatchT = any,\n  LoaderOptionsT = StrictLoaderOptions\n> = Loader<DataT, BatchT, LoaderOptionsT> & {\n  /** Perform actions before load. @deprecated Not officially supported. */\n  preload?: Preload;\n  /** Parse asynchronously and atomically from an arraybuffer */\n  parse: (\n    arrayBuffer: ArrayBuffer,\n    options?: LoaderOptionsT,\n    context?: LoaderContext\n  ) => Promise<DataT>;\n  /** Parse asynchronously and atomically from a random access \"file like\" input */\n  parseFile?: (\n    file: ReadableFile,\n    options?: LoaderOptionsT,\n    context?: LoaderContext\n  ) => Promise<DataT>;\n  /** Parse synchronously and atomically from an arraybuffer */\n  parseSync?: (\n    arrayBuffer: ArrayBuffer,\n    options?: LoaderOptionsT,\n    context?: LoaderContext\n  ) => DataT;\n  /** Parse batches of data from an iterator (e.g. fetch stream), return an iterator that yield parsed batches. */\n  parseInBatches?: (\n    iterator:\n      | AsyncIterable<ArrayBufferLike | ArrayBufferView>\n      | Iterable<ArrayBufferLike | ArrayBufferView>,\n    options?: LoaderOptionsT,\n    context?: LoaderContext\n  ) => AsyncIterable<BatchT>;\n  /** For random access, file like sources, source that don't integrate with fetch. */\n  parseFileInBatches?: (\n    file: ReadableFile,\n    options?: LoaderOptionsT,\n    context?: LoaderContext\n  ) => AsyncIterable<BatchT>;\n\n  /** Parse atomically from a string asynchronously */\n  parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;\n  /** Parse atomically from a string synchronously */\n  parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;\n};\n\n/**\n * A Loader context is provided as a third parameters to a loader object's\n * parse functions when that loader is called by other loaders rather then\n * directly by the application.\n *\n * - The context object allows the subloaders to be aware of the parameters and\n *   options that the application provided in the top level call.\n * - The context also providedsaccess to parse functions so that the subloader\n *   does not need to include the core module.\n * - In addition, the context's parse functions may also redirect loads from worker\n *   threads back to main thread.\n */\nexport type LoaderContext = {\n  /** Loader list provided to top-level loader call plus any sub loaders */\n  loaders?: Loader[] | null;\n  /** If URL is available.  */\n  url?: string;\n  /** the file name component of the URL (leading path and query string removed) */\n  filename?: string;\n  /** the directory name component of the URL (leading path excluding file name and query string) */\n  baseUrl?: string;\n  /** Query string (characters after `?`) */\n  queryString?: string;\n\n  /** Provides access to any application overrides of fetch() */\n  fetch: typeof fetch | FetchLike;\n\n  /** TBD */\n  response?: Response;\n\n  /**\n   * Parse function for subloaders. Avoids importing `core`. In workers, may redirect to main thread\n   */\n  _parse: (\n    arrayBuffer: ArrayBuffer,\n    loaders?: Loader | Loader[] | LoaderOptions,\n    options?: LoaderOptions,\n    context?: LoaderContext\n  ) => Promise<any>;\n\n  /**\n   * ParseSync function. Avoids importing `core`. In workers, may redirect to main thread\n   * @deprecated Do not call directly, use `parseSyncFromContext` instead\n   */\n  _parseSync?: (\n    arrayBuffer: ArrayBuffer,\n    loaders?: Loader | Loader[] | LoaderOptions,\n    options?: LoaderOptions,\n    context?: LoaderContext\n  ) => any;\n\n  /**\n   * ParseInBatches function. Avoids importing `core`.\n   * @deprecated Do not call directly, use `parseInBatchesFromContext` instead\n   */\n  _parseInBatches?: (\n    iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer> | Response,\n    loaders?: Loader | Loader[] | LoaderOptions,\n    options?: LoaderOptions,\n    context?: LoaderContext\n  ) => AsyncIterable<any> | Promise<AsyncIterable<any>>;\n};\n\n// type Parse = (\n//   arrayBuffer: ArrayBuffer,\n//   options?: LoaderOptions,\n//   context?: LoaderContext\n// ) => Promise<any>;\n// type ParseSync = (\n//   arrayBuffer: ArrayBuffer,\n//   options?: LoaderOptions,\n//   context?: LoaderContext\n// ) => any;\n// type ParseText = (text: string, options?: LoaderOptions) => Promise<any>;\n// type ParseTextSync = (text: string, options?: LoaderOptions) => any;\n// type ParseInBatches = (\n//   iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n//   options?: LoaderOptions,\n//   context?: LoaderContext\n// ) => AsyncIterable<any>;\n// type ParseFileInBatches = (\n//   file: Blob,\n//   options?: LoaderOptions,\n//   context?: LoaderContext\n// ) => AsyncIterable<any>;\n\ntype Preload = (url: string, options?: PreloadOptions) => any;\n\n/** Typescript helper to extract options type from a loader type */\nexport type LoaderOptionsType<T = Loader> =\n  T extends Loader<unknown, unknown, infer Options> ? Options : never;\n/** Typescript helper to extract data type from a loader type */\nexport type LoaderReturnType<T = Loader> =\n  T extends Loader<infer Return, unknown, unknown> ? Return : never;\n/** Typescript helper to extract batch type from a loader type */\nexport type LoaderBatchType<T = Loader> =\n  T extends Loader<unknown, infer Batch, unknown> ? Batch : never;\n\n/** Typescript helper to extract options type from an array of loader types */\nexport type LoaderArrayOptionsType<LoadersT extends Loader[] = Loader[]> =\n  LoadersT[number]['options'];\n/** Typescript helper to extract data type from a loader type */\nexport type LoaderArrayReturnType<LoadersT extends Loader[] = Loader[]> =\n  LoadersT[number]['dataType'];\n/** Typescript helper to extract batch type from a loader type */\nexport type LoaderArrayBatchType<LoadersT extends Loader[] = Loader[]> =\n  LoadersT[number]['batchType'];\n\n/**\n * Parses `data` asynchronously using the supplied loader, parse function provided via the loader context\n */\nexport async function parseFromContext<\n  LoaderT extends Loader,\n  OptionsT extends StrictLoaderOptions = LoaderOptionsType<LoaderT>\n>(\n  data: ArrayBuffer,\n  loader: LoaderT,\n  options: OptionsT | undefined,\n  context: LoaderContext\n): Promise<LoaderReturnType<LoaderT>>;\n\n/**\n * Parses `data` asynchronously by matching one of the supplied loader\n */\nexport async function parseFromContext(\n  data: ArrayBuffer,\n  loaders: Loader[],\n  options: LoaderOptions | undefined,\n  context: LoaderContext\n): Promise<unknown>;\n\n/**\n * Parses `data` using a specified loader\n * @param data\n * @param loaders\n * @param options\n * @param context\n */\n// implementation signature\nexport async function parseFromContext(\n  data: ArrayBuffer,\n  loaders: Loader | Loader[],\n  options: LoaderOptions | undefined,\n  context: LoaderContext\n): Promise<unknown> {\n  return context._parse(data, loaders, options, context);\n}\n\n/**\n * Parses `data` synchronously using the specified loader, parse function provided via the loader context\n */\nexport function parseSyncFromContext<\n  LoaderT extends Loader,\n  OptionsT extends StrictLoaderOptions = LoaderOptionsType<LoaderT>\n>(\n  data: ArrayBuffer,\n  loader: LoaderT,\n  options: OptionsT | undefined,\n  context: LoaderContext\n): LoaderReturnType<LoaderT> {\n  if (!context._parseSync) {\n    throw new Error('parseSync');\n  }\n  return context._parseSync(data, loader, options, context);\n}\n\n/**\n * Parses `data` synchronously using a specified loader, parse function provided via the loader context\n */\nexport async function parseInBatchesFromContext<\n  LoaderT extends Loader,\n  OptionsT extends StrictLoaderOptions = LoaderOptionsType<LoaderT>\n>(\n  data: Iterable<ArrayBuffer> | AsyncIterable<ArrayBuffer> | Response,\n  loader: LoaderT,\n  options: OptionsT | undefined,\n  context: LoaderContext\n): Promise<AsyncIterable<LoaderBatchType<LoaderT>>> {\n  if (!context._parseInBatches) {\n    throw new Error('parseInBatches');\n  }\n  return context._parseInBatches(data, loader, options, context);\n}\n", "/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n  if (!condition) {\n    throw new Error(message || 'loader assertion failed.');\n  }\n}\n", "// Purpose: include this in your module to avoid\n// dependencies on micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n  self: typeof self !== 'undefined' && self,\n  window: typeof window !== 'undefined' && window,\n  global: typeof global !== 'undefined' && global,\n  document: typeof document !== 'undefined' && document\n};\n\ntype obj = {[key: string]: any};\nconst self_: obj = globals.self || globals.window || globals.global || {};\nconst window_: obj = globals.window || globals.self || globals.global || {};\nconst global_: obj = globals.global || globals.self || globals.window || {};\nconst document_: obj = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in a browser */\nexport const isBrowser: boolean =\n  // @ts-ignore process does not exist on browser\n  Boolean(typeof process !== 'object' || String(process) !== '[object process]' || process.browser);\n\n/** true if running in a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n  typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n/** Major Node version (as a number) */\nexport const nodeVersion: number = (matches && parseFloat(matches[1])) || 0;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Log} from '@probe.gl/log';\n\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst version = VERSION[0] >= '0' && VERSION[0] <= '9' ? `v${VERSION}` : '';\n\n// Make sure we set the global variable\nfunction createLog() {\n  const log = new Log({id: 'loaders.gl'});\n\n  globalThis.loaders ||= {};\n  globalThis.loaders.log = log;\n  globalThis.loaders.version = version;\n\n  globalThis.probe ||= {};\n  globalThis.probe.loaders = log;\n\n  return log;\n}\n\nexport const log = createLog();\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport type {Readable} from 'stream';\n\n/** Minimal shape for Node.js Buffer-like values */\ntype NodeBufferLike = {buffer: ArrayBufferLike; isBuffer: true};\n\n/** Minimal shape for Node.js writable streams */\ntype NodeWritableStream = {\n  end: (...args: unknown[]) => unknown;\n  write: (...args: unknown[]) => unknown;\n  writable: boolean;\n};\n\n/** Minimal shape for WritableStream-like DOM implementations */\ntype WritableDOMStreamLike = WritableStream | {abort: () => unknown; getWriter: () => unknown};\n\n/** A DOM or Node readable stream */\nexport type ReadableStreamType = ReadableStream | Readable;\n\n/** Checks whether a value is a boolean */\nconst isBoolean = (value: unknown): value is boolean => typeof value === 'boolean';\n\n/** Checks whether a value is a function */\nconst isFunction = (value: unknown): value is (...args: unknown[]) => unknown =>\n  typeof value === 'function';\n\n/** Checks whether a value is a non-null object */\nexport const isObject = (value: unknown): value is object =>\n  value !== null && typeof value === 'object';\n\n/** Checks whether a value is a plain object (created by the Object constructor) */\nexport const isPureObject = (value: unknown): value is Record<string, unknown> =>\n  isObject(value) && value.constructor === {}.constructor;\n\n/** Checks whether a value is an ArrayBuffer */\nexport const isArrayBuffer = (value: unknown): value is ArrayBuffer =>\n  typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n\n/** Checks whether a value is an ArrayBuffer */\nexport const isSharedArrayBuffer = (value: unknown): value is SharedArrayBuffer =>\n  typeof SharedArrayBuffer !== 'undefined' && value instanceof SharedArrayBuffer;\n\n/** Checks whether a value is ArrayBuffer-like */\nexport const isArrayBufferLike = (value: unknown): value is ArrayBufferLike =>\n  isObject(value) &&\n  typeof (value as ArrayBufferLike).byteLength === 'number' &&\n  typeof (value as ArrayBufferLike).slice === 'function';\n\n/** Checks whether a value behaves like a promise */\nexport const isPromise = (value: unknown): value is Promise<unknown> =>\n  isObject(value) && 'then' in value && isFunction((value as {then: unknown}).then);\n\n/** Checks whether a value implements the iterable protocol */\nexport const isIterable = (value: unknown): value is Iterable<unknown> =>\n  Boolean(value) && isFunction((value as Iterable<unknown>)[Symbol.iterator]);\n\n/** Checks whether a value implements the async iterable protocol */\nexport const isAsyncIterable = (value: unknown): value is AsyncIterable<unknown> =>\n  Boolean(value) && isFunction((value as AsyncIterable<unknown>)[Symbol.asyncIterator]);\n\n/** Checks whether a value is an iterator (has a next function) */\nexport const isIterator = (value: unknown): value is Iterator<unknown> =>\n  Boolean(value) && isFunction((value as Iterator<unknown>).next);\n\n/** Checks whether a value is a fetch Response or a duck-typed equivalent */\nexport const isResponse = (value: unknown): value is Response =>\n  (typeof Response !== 'undefined' && value instanceof Response) ||\n  (isObject(value) &&\n    isFunction((value as {arrayBuffer?: unknown}).arrayBuffer) &&\n    isFunction((value as {text?: unknown}).text) &&\n    isFunction((value as {json?: unknown}).json));\n\n/** Checks whether a value is a File */\nexport const isFile = (value: unknown): value is File =>\n  typeof File !== 'undefined' && value instanceof File;\n\n/** Checks whether a value is a Blob */\nexport const isBlob = (value: unknown): value is Blob =>\n  typeof Blob !== 'undefined' && value instanceof Blob;\n\n/** Checks for Node.js Buffers without triggering bundlers to include the Buffer polyfill */\nexport const isBuffer = (value: unknown): value is NodeBufferLike =>\n  Boolean(\n    value &&\n    typeof value === 'object' &&\n    (value as Partial<NodeBufferLike>).isBuffer &&\n    'buffer' in (value as NodeBufferLike)\n  );\n\n/** Checks whether a value looks like a DOM WritableStream */\nexport const isWritableDOMStream = (value: unknown): value is WritableDOMStreamLike =>\n  isObject(value) &&\n  isFunction((value as WritableDOMStreamLike).abort) &&\n  isFunction((value as WritableDOMStreamLike).getWriter);\n\n/** Checks whether a value looks like a DOM ReadableStream */\nexport const isReadableDOMStream = (value: unknown): value is ReadableStream =>\n  (typeof ReadableStream !== 'undefined' && value instanceof ReadableStream) ||\n  (isObject(value) &&\n    isFunction((value as ReadableStream).tee) &&\n    isFunction((value as ReadableStream).cancel) &&\n    isFunction((value as ReadableStream).getReader));\n// Not implemented in Firefox: && isFunction(x.pipeTo)\n\n/** Checks whether a value looks like a Node.js writable stream */\nexport const isWritableNodeStream = (value: unknown): value is NodeWritableStream =>\n  isObject(value) &&\n  isFunction((value as NodeWritableStream).end) &&\n  isFunction((value as NodeWritableStream).write) &&\n  isBoolean((value as NodeWritableStream).writable);\n\n/** Checks whether a value looks like a Node.js readable stream */\nexport const isReadableNodeStream = (value: unknown): value is Readable =>\n  isObject(value) &&\n  isFunction((value as Readable).read) &&\n  isFunction((value as Readable).pipe) &&\n  isBoolean((value as Readable).readable);\n\n/** Checks whether a value is any readable stream (DOM or Node.js) */\nexport const isReadableStream = (value: unknown): value is ReadableStreamType =>\n  isReadableDOMStream(value) || isReadableNodeStream(value);\n\n/** Checks whether a value is any writable stream (DOM or Node.js) */\nexport const isWritableStream = (value: unknown): value is WritableStream | NodeWritableStream =>\n  isWritableDOMStream(value) || isWritableNodeStream(value);\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport type RequiredOptions<T> = Required<{[K in keyof T]: Required<T[K]>}>;\n\nexport function getRequiredOptions<T>(options: T): RequiredOptions<T> {\n  return options as RequiredOptions<T>;\n}\n\n/**\n *\n * @param baseOptions Can be undefined, in which case a fresh options object will be minted\n * @param newOptions\n * @returns\n */\nexport function mergeOptions<OptionsT extends Record<string, unknown>>(\n  baseOptions: OptionsT | undefined,\n  newOptions: OptionsT\n): OptionsT {\n  return mergeOptionsRecursively(baseOptions || {}, newOptions) as OptionsT;\n}\n\nfunction mergeOptionsRecursively(\n  baseOptions: Record<string, unknown>,\n  newOptions: Record<string, unknown>,\n  level = 0\n): Record<string, unknown> {\n  // Sanity check (jest test runner overwrites the console object which can lead to infinite recursion)\n  if (level > 3) {\n    return newOptions;\n  }\n\n  const options = {...baseOptions};\n  for (const [key, newValue] of Object.entries(newOptions)) {\n    if (newValue && typeof newValue === 'object' && !Array.isArray(newValue)) {\n      options[key] = mergeOptionsRecursively(\n        (options[key] as Record<string, unknown>) || {},\n        newOptions[key] as Record<string, unknown>,\n        level + 1\n      );\n      // Object.assign(options[key] as object, newOptions[key]);\n    } else {\n      options[key] = newOptions[key];\n    }\n  }\n  return options as Record<string, unknown>;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {log} from '../log-utils/log';\n\n/**\n * Register application-imported modules\n * These modules are typically to big to bundle, or may have issues on some bundlers/environments\n */\nexport function registerJSModules(modules?: Record<string, any>): void {\n  globalThis.loaders ||= {};\n  globalThis.loaders.modules ||= {};\n  Object.assign(globalThis.loaders.modules, modules);\n}\n\n/**\n * Get a pre-registered application-imported module, warn if not present\n */\nexport function checkJSModule(name: string, caller: string): void {\n  const module = globalThis.loaders?.modules?.[name];\n  if (!module) {\n    log.warn(`${caller}: ${name} library not installed`)();\n  }\n}\n\n/**\n * Get a pre-registered application-imported module, throw if not present\n */\nexport function getJSModule<ModuleT = any>(name: string, caller: string): ModuleT {\n  const module = globalThis.loaders?.modules?.[name];\n  if (!module) {\n    throw new Error(`${caller}: ${name} library not installed`);\n  }\n  return module;\n}\n\n/**\n * Get a pre-registered application-imported module, return null if not present\n */\nexport function getJSModuleOrNull<ModuleT = any>(name: string): ModuleT | null {\n  const module = globalThis.loaders?.modules?.[name];\n  return module || null;\n}\n", "/* eslint-disable no-restricted-globals */\nimport type {LoaderWithParser, LoaderOptions, LoaderContext} from '../../loader-types';\nimport {WorkerBody} from '@loaders.gl/worker-utils';\n// import {validateLoaderVersion} from './validate-loader-version';\n\nlet requestId = 0;\n\n/**\n * Set up a WebWorkerGlobalScope to talk with the main thread\n * @param loader\n */\nexport async function createLoaderWorker(loader: LoaderWithParser) {\n  // Check that we are actually in a worker thread\n  if (!(await WorkerBody.inWorkerThread())) {\n    return;\n  }\n\n  WorkerBody.onmessage = async (type, payload) => {\n    switch (type) {\n      case 'process':\n        try {\n          // validateLoaderVersion(loader, data.source.split('@')[1]);\n\n          const {input, options = {}, context = {}} = payload;\n\n          const result = await parseData({\n            loader,\n            arrayBuffer: input,\n            options,\n            // @ts-expect-error fetch missing\n            context: {\n              ...context,\n              _parse: parseOnMainThread\n            }\n          });\n          WorkerBody.postMessage('done', {result});\n        } catch (error) {\n          const message = error instanceof Error ? error.message : '';\n          WorkerBody.postMessage('error', {error: message});\n        }\n        break;\n      default:\n    }\n  };\n}\n\nfunction parseOnMainThread(\n  arrayBuffer: ArrayBuffer,\n  loader: any,\n  options?: LoaderOptions,\n  context?: LoaderContext\n): Promise<void> {\n  return new Promise((resolve, reject) => {\n    const id = requestId++;\n\n    /**\n     */\n    const onMessage = (type, payload) => {\n      if (payload.id !== id) {\n        // not ours\n        return;\n      }\n\n      switch (type) {\n        case 'done':\n          WorkerBody.removeEventListener(onMessage);\n          resolve(payload.result);\n          break;\n\n        case 'error':\n          WorkerBody.removeEventListener(onMessage);\n          reject(payload.error);\n          break;\n\n        default:\n        // ignore\n      }\n    };\n\n    WorkerBody.addEventListener(onMessage);\n\n    // Ask the main thread to decode data\n    const payload = {id, input: arrayBuffer, options};\n    WorkerBody.postMessage('process', payload);\n  });\n}\n\n// TODO - Support byteOffset and byteLength (enabling parsing of embedded binaries without copies)\n// TODO - Why not support async loader.parse* funcs here?\n// TODO - Why not reuse a common function instead of reimplementing loader.parse* selection logic? Keeping loader small?\n// TODO - Lack of appropriate parser functions can be detected when we create worker, no need to wait until parse\nasync function parseData({\n  loader,\n  arrayBuffer,\n  options,\n  context\n}: {\n  loader: LoaderWithParser;\n  arrayBuffer: ArrayBuffer;\n  options: LoaderOptions;\n  context: LoaderContext;\n}) {\n  let data;\n  let parser;\n  if (loader.parseSync || loader.parse) {\n    data = arrayBuffer;\n    parser = loader.parseSync || loader.parse;\n  } else if (loader.parseTextSync) {\n    const textDecoder = new TextDecoder();\n    data = textDecoder.decode(arrayBuffer);\n    parser = loader.parseTextSync;\n  } else {\n    throw new Error(`Could not load data with ${loader.name} loader`);\n  }\n\n  // TODO - proper merge in of loader options...\n  options = {\n    ...options,\n    modules: (loader && loader.options && loader.options.modules) || {},\n    core: {\n      ...options.core,\n      worker: false\n    }\n  };\n\n  return await parser(data, {...options}, context, loader);\n}\n", "import {\n  WorkerJob,\n  WorkerMessageType,\n  WorkerMessagePayload,\n  isBrowser,\n  WorkerFarm,\n  getWorkerURL\n} from '@loaders.gl/worker-utils';\nimport type {Loader, LoaderOptions, LoaderContext} from '../../loader-types';\n\n/**\n * Determines if a loader can parse with worker\n * @param loader\n * @param options\n */\nexport function canParseWithWorker(loader: Loader, options?: LoaderOptions) {\n  if (!WorkerFarm.isSupported()) {\n    return false;\n  }\n\n  // Node workers are still experimental\n  const nodeWorkers = options?._nodeWorkers ?? options?.core?._nodeWorkers;\n  if (!isBrowser && !nodeWorkers) {\n    return false;\n  }\n\n  const useWorkers = options?.worker ?? options?.core?.worker;\n  return Boolean(loader.worker && useWorkers);\n}\n\n/**\n * this function expects that the worker function sends certain messages,\n * this can be automated if the worker is wrapper by a call to createLoaderWorker in @loaders.gl/loader-utils.\n */\nexport async function parseWithWorker(\n  loader: Loader,\n  data: any,\n  options?: LoaderOptions,\n  context?: LoaderContext,\n  parseOnMainThread?: (arrayBuffer: ArrayBuffer, options: {[key: string]: any}) => Promise<unknown>\n) {\n  const name = loader.id; // TODO\n  const url = getWorkerURL(loader, options);\n\n  const workerFarm = WorkerFarm.getWorkerFarm(options?.core);\n  const workerPool = workerFarm.getWorkerPool({name, url});\n\n  // options.log object contains functions which cannot be transferred\n  // context.fetch & context.parse functions cannot be transferred\n  // TODO - decide how to handle logging on workers\n  options = JSON.parse(JSON.stringify(options));\n  context = JSON.parse(JSON.stringify(context || {}));\n\n  const job = await workerPool.startJob(\n    'process-on-worker',\n    // @ts-expect-error\n    onMessage.bind(null, parseOnMainThread) // eslint-disable-line @typescript-eslint/no-misused-promises\n  );\n\n  job.postMessage('process', {\n    // @ts-ignore\n    input: data,\n    options,\n    context\n  });\n\n  const result = await job.result;\n  // TODO - what is going on here?\n  return await result.result;\n}\n\n/**\n * Handle worker's responses to the main thread\n * @param job\n * @param type\n * @param payload\n */\nasync function onMessage(\n  parseOnMainThread: (arrayBuffer: ArrayBuffer, options?: {[key: string]: any}) => Promise<void>,\n  job: WorkerJob,\n  type: WorkerMessageType,\n  payload: WorkerMessagePayload\n) {\n  switch (type) {\n    case 'done':\n      job.done(payload);\n      break;\n\n    case 'error':\n      job.error(new Error(payload.error));\n      break;\n\n    case 'process':\n      // Worker is asking for main thread to parseO\n      const {id, input, options} = payload;\n      try {\n        const result = await parseOnMainThread(input, options);\n        job.postMessage('done', {id, result});\n      } catch (error) {\n        const message = error instanceof Error ? error.message : 'unknown error';\n        job.postMessage('error', {id, error: message});\n      }\n      break;\n\n    default:\n      // eslint-disable-next-line\n      console.warn(`parse-with-worker unknown message ${type}`);\n  }\n}\n", "import {WorkerFarm} from '@loaders.gl/worker-utils';\nimport {Writer, WriterOptions} from '../../writer-types';\nimport {isBrowser} from '../env-utils/globals';\n\n/**\n * Determines if a loader can parse with worker\n * @param loader\n * @param options\n */\nexport function canEncodeWithWorker(writer: Writer, options?: WriterOptions) {\n  if (!WorkerFarm.isSupported()) {\n    return false;\n  }\n\n  const nodeWorkers = options?._nodeWorkers ?? options?.core?._nodeWorkers;\n  const useWorkers = options?.worker ?? options?.core?.worker;\n\n  // Node workers are still experimental\n  if (!isBrowser && !nodeWorkers) {\n    return false;\n  }\n\n  return Boolean(writer.worker && useWorkers);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/**\n * Get the first characters from a binary file (interpret the first bytes as an ASCII string)\n * @param data\n * @param length\n * @returns\n */\nexport function getFirstCharacters(data: string | ArrayBuffer, length: number = 5): string {\n  if (typeof data === 'string') {\n    return data.slice(0, length);\n  } else if (ArrayBuffer.isView(data)) {\n    // Typed Arrays can have offsets into underlying buffer\n    return getMagicString(data.buffer, data.byteOffset, length);\n  } else if (data instanceof ArrayBuffer) {\n    const byteOffset = 0;\n    return getMagicString(data, byteOffset, length);\n  }\n  return '';\n}\n\n/**\n * Gets a magic string from a \"file\"\n * Typically used to check or detect file format\n * @param arrayBuffer\n * @param byteOffset\n * @param length\n * @returns\n */\nexport function getMagicString(\n  arrayBuffer: ArrayBufferLike,\n  byteOffset: number,\n  length: number\n): string {\n  if (arrayBuffer.byteLength <= byteOffset + length) {\n    return '';\n  }\n  const dataView = new DataView(arrayBuffer);\n  let magic = '';\n  for (let i = 0; i < length; i++) {\n    magic += String.fromCharCode(dataView.getUint8(byteOffset + i));\n  }\n  return magic;\n}\n", "import {getFirstCharacters} from '../binary-utils/get-first-characters';\n\n/**\n * Minimal JSON parser that throws more meaningful error messages\n */\nexport function parseJSON(string: string): any {\n  try {\n    return JSON.parse(string);\n  } catch (_) {\n    throw new Error(`Failed to parse JSON from data starting with \"${getFirstCharacters(string)}\"`);\n  }\n}\n", "import {TypedArray} from '../../types';\n\n/**\n * compare two binary arrays for equality\n * @param a\n * @param b\n * @param byteLength\n */\nexport function compareArrayBuffers(\n  arrayBuffer1: ArrayBufferLike,\n  arrayBuffer2: ArrayBufferLike,\n  byteLength?: number\n): boolean {\n  byteLength = byteLength || arrayBuffer1.byteLength;\n  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {\n    return false;\n  }\n  const array1 = new Uint8Array(arrayBuffer1);\n  const array2 = new Uint8Array(arrayBuffer2);\n  for (let i = 0; i < array1.length; ++i) {\n    if (array1[i] !== array2[i]) {\n      return false;\n    }\n  }\n  return true;\n}\n\n/**\n * Concatenate a sequence of ArrayBuffers from arguments\n * @return A concatenated ArrayBuffer\n */\nexport function concatenateArrayBuffers(...sources: (ArrayBuffer | Uint8Array)[]): ArrayBuffer {\n  return concatenateArrayBuffersFromArray(sources);\n}\n\n/**\n * Concatenate a sequence of ArrayBuffers from array\n * @return A concatenated ArrayBuffer\n */\nexport function concatenateArrayBuffersFromArray(\n  sources: (ArrayBuffer | Uint8Array)[]\n): ArrayBuffer {\n  // Make sure all inputs are wrapped in typed arrays\n  const sourceArrays = sources.map((source2) =>\n    source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2\n  );\n\n  // Get length of all inputs\n  const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);\n\n  // Allocate array with space for all inputs\n  const result = new Uint8Array(byteLength);\n\n  // Copy the subarrays\n  let offset = 0;\n  for (const sourceArray of sourceArrays) {\n    result.set(sourceArray, offset);\n    offset += sourceArray.byteLength;\n  }\n\n  // We work with ArrayBuffers, discard the typed array wrapper\n  return result.buffer;\n}\n\n/**\n * Concatenate arbitrary count of typed arrays\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays\n * @param - list of arrays. All arrays should be the same type\n * @return A concatenated TypedArray\n */\nexport function concatenateTypedArrays<T>(...typedArrays: T[]): T {\n  // @ts-ignore\n  const arrays = typedArrays as TypedArray[];\n  // @ts-ignore\n  const TypedArrayConstructor = (arrays && arrays.length > 1 && arrays[0].constructor) || null;\n  if (!TypedArrayConstructor) {\n    throw new Error(\n      '\"concatenateTypedArrays\" - incorrect quantity of arguments or arguments have incompatible data types'\n    );\n  }\n\n  const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);\n  // @ts-ignore typescript does not like dynamic constructors\n  const result = new TypedArrayConstructor(sumLength);\n  let offset = 0;\n  for (const array of arrays) {\n    result.set(array, offset);\n    offset += array.length;\n  }\n  return result;\n}\n\n/**\n * Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0\n * @param arrayBuffer\n * @param byteOffset\n * @param byteLength\n */\nexport function sliceArrayBuffer(\n  arrayBuffer: ArrayBufferLike,\n  byteOffset: number,\n  byteLength?: number\n): ArrayBuffer {\n  const subArray =\n    byteLength !== undefined\n      ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength)\n      : new Uint8Array(arrayBuffer).subarray(byteOffset);\n  const arrayCopy = new Uint8Array(subArray);\n  return arrayCopy.buffer;\n}\n", "import {assert} from '../env-utils/assert';\n\n/**\n * Calculate new size of an arrayBuffer to be aligned to an n-byte boundary\n * This function increases `byteLength` by the minimum delta,\n * allowing the total length to be divided by `padding`\n * @param byteLength\n * @param padding\n */\nexport function padToNBytes(byteLength: number, padding: number): number {\n  assert(byteLength >= 0); // `Incorrect 'byteLength' value: ${byteLength}`\n  assert(padding > 0); // `Incorrect 'padding' value: ${padding}`\n  return (byteLength + (padding - 1)) & ~(padding - 1);\n}\n\n/**\n * Creates a new Uint8Array based on two different ArrayBuffers\n * @param targetBuffer The first buffer.\n * @param sourceBuffer The second buffer.\n * @return The new ArrayBuffer created out of the two.\n */\nexport function copyArrayBuffer(\n  targetBuffer: ArrayBuffer,\n  sourceBuffer: ArrayBuffer,\n  byteOffset: number,\n  byteLength: number = sourceBuffer.byteLength\n): ArrayBuffer {\n  const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);\n  const sourceArray = new Uint8Array(sourceBuffer);\n  targetArray.set(sourceArray);\n  return targetBuffer;\n}\n\n/**\n * Copy from source to target at the targetOffset\n *\n * @param source - The data to copy\n * @param target - The destination to copy data into\n * @param targetOffset - The start offset into target to place the copied data\n * @returns the new offset taking into account proper padding\n */\nexport function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number {\n  let sourceArray;\n\n  if (source instanceof ArrayBuffer) {\n    sourceArray = new Uint8Array(source);\n  } else {\n    // Pack buffer onto the big target array\n    //\n    // 'source.data.buffer' could be a view onto a larger buffer.\n    // We MUST use this constructor to ensure the byteOffset and byteLength is\n    // set to correct values from 'source.data' and not the underlying\n    // buffer for target.set() to work properly.\n    const srcByteOffset = source.byteOffset;\n    const srcByteLength = source.byteLength;\n    // In gltf parser it is set as \"arrayBuffer\" instead of \"buffer\"\n    // https://github.com/visgl/loaders.gl/blob/1e3a82a0a65d7b6a67b1e60633453e5edda2960a/modules/gltf/src/lib/parse-gltf.js#L85\n    sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);\n  }\n\n  // Pack buffer onto the big target array\n  target.set(sourceArray, targetOffset);\n\n  return targetOffset + padToNBytes(sourceArray.byteLength, 4);\n}\n", "// loaders./gl, MIT license\n\nimport {TypedArray} from '../../types';\nimport {padToNBytes} from './memory-copy-utils';\n\n/**\n * Helper function that pads a string with spaces to fit a certain byte alignment\n * @param string\n * @param byteAlignment\n * @returns\n *\n * @todo PERFORMANCE IDEA: No need to copy string twice...\n */\nexport function padStringToByteAlignment(string: string, byteAlignment: number): string {\n  const length = string.length;\n  const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment\n  const padding = paddedLength - length;\n  let whitespace = '';\n  for (let i = 0; i < padding; ++i) {\n    whitespace += ' ';\n  }\n  return string + whitespace;\n}\n\n/**\n *\n * @param dataView\n * @param byteOffset\n * @param string\n * @param byteLength\n * @returns\n */\nexport function copyStringToDataView(\n  dataView: DataView,\n  byteOffset: number,\n  string: string,\n  byteLength: number\n): number {\n  if (dataView) {\n    for (let i = 0; i < byteLength; i++) {\n      dataView.setUint8(byteOffset + i, string.charCodeAt(i));\n    }\n  }\n  return byteOffset + byteLength;\n}\n\nexport function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {\n  if (dataView) {\n    for (let i = 0; i < byteLength; i++) {\n      dataView.setUint8(byteOffset + i, binary[i]);\n    }\n  }\n  return byteOffset + byteLength;\n}\n\n/**\n * Copy sourceBuffer to dataView with some padding\n *\n * @param dataView - destination data container. If null - only new offset is calculated\n * @param byteOffset - destination byte offset to copy to\n * @param sourceBuffer - source data buffer\n * @param padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedArrayBufferToDataView(\n  dataView: DataView | null,\n  byteOffset: number,\n  sourceBuffer: TypedArray,\n  padding: number\n): number {\n  const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);\n  const padLength = paddedLength - sourceBuffer.byteLength;\n\n  if (dataView) {\n    // Copy array\n    const targetArray = new Uint8Array(\n      dataView.buffer,\n      dataView.byteOffset + byteOffset,\n      sourceBuffer.byteLength\n    );\n    const sourceArray = new Uint8Array(sourceBuffer);\n    targetArray.set(sourceArray);\n\n    // Add PADDING\n    for (let i = 0; i < padLength; ++i) {\n      // json chunk is padded with spaces (ASCII 0x20)\n      dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);\n    }\n  }\n  byteOffset += paddedLength;\n  return byteOffset;\n}\n\n/**\n * Copy string to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {string} string - source string\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedStringToDataView(\n  dataView: DataView | null,\n  byteOffset: number,\n  string: string,\n  padding: number\n): number {\n  const textEncoder = new TextEncoder();\n  // PERFORMANCE IDEA: We encode twice, once to get size and once to store\n  // PERFORMANCE IDEA: Use TextEncoder.encodeInto() to avoid temporary copy\n  const stringBuffer = textEncoder.encode(string);\n\n  byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);\n\n  return byteOffset;\n}\n", "// TextDecoder iterators\n// TextDecoder will keep any partial undecoded bytes between calls to `decode`\n\nexport async function* makeTextDecoderIterator(\n  arrayBufferIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n  options: TextDecoderOptions = {}\n): AsyncIterable<string> {\n  const textDecoder = new TextDecoder(undefined, options);\n  for await (const arrayBuffer of arrayBufferIterator) {\n    yield typeof arrayBuffer === 'string'\n      ? arrayBuffer\n      : textDecoder.decode(arrayBuffer, {stream: true});\n  }\n}\n\n// TextEncoder iterator\n// TODO - this is not useful unless min chunk size is given\n// TextEncoder will keep any partial undecoded bytes between calls to `encode`\n// If iterator does not yield strings, assume arrayBuffer and return unencoded\n\nexport async function* makeTextEncoderIterator(\n  textIterator: AsyncIterable<string> | Iterable<ArrayBuffer>\n): AsyncIterable<ArrayBuffer> {\n  const textEncoder = new TextEncoder();\n  for await (const text of textIterator) {\n    yield typeof text === 'string' ? textEncoder.encode(text).buffer : text;\n  }\n}\n\n/**\n * @param textIterator async iterable yielding strings\n * @returns an async iterable over lines\n * See http://2ality.com/2018/04/async-iter-nodejs.html\n */\n\nexport async function* makeLineIterator(\n  textIterator: AsyncIterable<string>\n): AsyncIterable<string> {\n  let previous = '';\n  for await (const textChunk of textIterator) {\n    previous += textChunk;\n    let eolIndex;\n    while ((eolIndex = previous.indexOf('\\n')) >= 0) {\n      // line includes the EOL\n      const line = previous.slice(0, eolIndex + 1);\n      previous = previous.slice(eolIndex + 1);\n      yield line;\n    }\n  }\n\n  if (previous.length > 0) {\n    yield previous;\n  }\n}\n\n/**\n * @param lineIterator async iterable yielding lines\n * @returns async iterable yielding numbered lines\n *\n * See http://2ality.com/2018/04/async-iter-nodejs.html\n */\nexport async function* makeNumberedLineIterator(\n  lineIterator: AsyncIterable<string>\n): AsyncIterable<{counter: number; line: string}> {\n  let counter = 1;\n  for await (const line of lineIterator) {\n    yield {counter, line};\n    counter++;\n  }\n}\n", "import {concatenateArrayBuffers} from '../binary-utils/array-buffer-utils';\n\n// GENERAL UTILITIES\n\n/**\n * Iterates over an {@link AsyncIterable} or {@link Iterable}, invoking `visitor` for each yielded\n * value without rewinding the iterator when exiting early. This enables the caller to continue\n * iterating in another loop after `visitor` signals cancellation.\n */\nexport async function forEach<TValue>(\n  iterable: AsyncIterable<TValue> | Iterable<TValue> | AsyncIterator<TValue>,\n  visitor: (value: TValue) => any\n) {\n  const iterator = toAsyncIterator(iterable);\n  // eslint-disable-next-line\n  while (true) {\n    const {done, value} = await iterator.next();\n    if (done) {\n      if (iterator.return) {\n        iterator.return();\n      }\n      return;\n    }\n    const cancel = visitor(value);\n    if (cancel) {\n      return;\n    }\n  }\n}\n\n/**\n * Concatenates all binary chunks yielded by an async or sync iterator.\n * Supports `ArrayBuffer`, typed array views, and `ArrayBufferLike` sources (e.g. `SharedArrayBuffer`).\n * This allows atomic parsers to operate on iterator inputs by materializing them into a single buffer.\n */\nexport async function concatenateArrayBuffersAsync(\n  asyncIterator:\n    | AsyncIterable<ArrayBufferLike | ArrayBufferView>\n    | Iterable<ArrayBufferLike | ArrayBufferView>\n): Promise<ArrayBuffer> {\n  const arrayBuffers: ArrayBuffer[] = [];\n  for await (const chunk of asyncIterator) {\n    arrayBuffers.push(copyToArrayBuffer(chunk));\n  }\n  return concatenateArrayBuffers(...arrayBuffers);\n}\n\nexport async function concatenateStringsAsync(\n  asyncIterator: AsyncIterable<string> | Iterable<string>\n): Promise<string> {\n  const strings: string[] = [];\n  for await (const chunk of asyncIterator) {\n    strings.push(chunk);\n  }\n  return strings.join('');\n}\n\n/**\n * Normalizes binary chunk iterators to yield `ArrayBuffer` instances.\n * Accepts `ArrayBuffer`, `ArrayBufferView`, and `ArrayBufferLike` sources\n * (e.g. `SharedArrayBuffer`) and returns a copied `ArrayBuffer` for each chunk.\n */\nexport async function* toArrayBufferIterator(\n  asyncIterator:\n    | AsyncIterable<ArrayBufferLike | ArrayBufferView>\n    | Iterable<ArrayBufferLike | ArrayBufferView>\n): AsyncIterable<ArrayBuffer> {\n  for await (const chunk of asyncIterator) {\n    yield copyToArrayBuffer(chunk);\n  }\n}\n\nfunction copyToArrayBuffer(chunk: ArrayBufferLike | ArrayBufferView | ArrayBuffer): ArrayBuffer {\n  if (chunk instanceof ArrayBuffer) {\n    return chunk;\n  }\n\n  if (ArrayBuffer.isView(chunk)) {\n    const {buffer, byteOffset, byteLength} = chunk;\n    return copyFromBuffer(buffer, byteOffset, byteLength);\n  }\n\n  return copyFromBuffer(chunk as ArrayBufferLike);\n}\n\nfunction copyFromBuffer(\n  buffer: ArrayBufferLike,\n  byteOffset = 0,\n  byteLength = buffer.byteLength - byteOffset\n): ArrayBuffer {\n  const view = new Uint8Array(buffer, byteOffset, byteLength);\n  const copy = new Uint8Array(view.length);\n  copy.set(view);\n  return copy.buffer;\n}\n\nfunction toAsyncIterator<TValue>(\n  iterable: AsyncIterable<TValue> | Iterable<TValue> | AsyncIterator<TValue>\n): AsyncIterator<TValue> {\n  if (typeof iterable[Symbol.asyncIterator] === 'function') {\n    return iterable[Symbol.asyncIterator]();\n  }\n\n  if (typeof iterable[Symbol.iterator] === 'function') {\n    const iterator = iterable[Symbol.iterator]();\n    return iteratorToAsyncIterator(iterator);\n  }\n\n  return iterable as AsyncIterator<TValue>;\n}\n\nfunction iteratorToAsyncIterator<T>(iterator: Iterator<T>): AsyncIterator<T> {\n  return {\n    next(value?: any) {\n      return Promise.resolve(iterator.next(value));\n    },\n\n    return(value?: any) {\n      if (typeof iterator.return === 'function') {\n        return Promise.resolve(iterator.return(value));\n      }\n      return Promise.resolve({done: true, value});\n    },\n\n    throw(error?: any) {\n      if (typeof iterator.throw === 'function') {\n        return Promise.resolve(iterator.throw(error));\n      }\n      return Promise.reject(error);\n    }\n  };\n}\n", "import {Stats} from '@probe.gl/stats';\n\ntype Handle = any;\ntype DoneFunction = () => any;\ntype GetPriorityFunction = () => number;\ntype RequestResult = {\n  done: DoneFunction;\n} | null;\n\n/** RequestScheduler Options */\nexport type RequestSchedulerProps = {\n  id?: string;\n  throttleRequests?: boolean;\n  maxRequests?: number;\n  debounceTime?: number;\n};\n\nconst STAT_QUEUED_REQUESTS = 'Queued Requests';\nconst STAT_ACTIVE_REQUESTS = 'Active Requests';\nconst STAT_CANCELLED_REQUESTS = 'Cancelled Requests';\nconst STAT_QUEUED_REQUESTS_EVER = 'Queued Requests Ever';\nconst STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';\n\nconst DEFAULT_PROPS: Required<RequestSchedulerProps> = {\n  id: 'request-scheduler',\n  /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */\n  throttleRequests: true,\n  /** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */\n  maxRequests: 6,\n  /**\n   * Specifies a debounce time, in milliseconds. All requests are queued, until no new requests have\n   * been added to the queue for this amount of time.\n   */\n  debounceTime: 0\n};\n\n/** Tracks one request */\ntype Request = {\n  handle: Handle;\n  priority: number;\n  getPriority: GetPriorityFunction;\n  resolve?: (value: any) => any;\n};\n\n/**\n * Used to issue a request, without having them \"deeply queued\" by the browser.\n * @todo - Track requests globally, across multiple servers\n */\nexport default class RequestScheduler {\n  readonly props: Required<RequestSchedulerProps>;\n  readonly stats: Stats;\n  activeRequestCount: number = 0;\n\n  /** Tracks the number of active requests and prioritizes/cancels queued requests. */\n  private requestQueue: Request[] = [];\n  private requestMap: Map<Handle, Promise<RequestResult>> = new Map();\n  private updateTimer: ReturnType<typeof setTimeout> | null = null;\n\n  constructor(props: RequestSchedulerProps = {}) {\n    this.props = {...DEFAULT_PROPS, ...props};\n\n    // Returns the statistics used by the request scheduler.\n    this.stats = new Stats({id: this.props.id});\n    this.stats.get(STAT_QUEUED_REQUESTS);\n    this.stats.get(STAT_ACTIVE_REQUESTS);\n    this.stats.get(STAT_CANCELLED_REQUESTS);\n    this.stats.get(STAT_QUEUED_REQUESTS_EVER);\n    this.stats.get(STAT_ACTIVE_REQUESTS_EVER);\n  }\n\n  /**\n   * Update scheduler props. Preserves active and queued requests.\n   */\n  setProps(props: Omit<RequestSchedulerProps, 'id'>): void {\n    if (props.throttleRequests !== undefined) {\n      this.props.throttleRequests = props.throttleRequests;\n    }\n    if (props.maxRequests !== undefined) {\n      this.props.maxRequests = props.maxRequests;\n    }\n    if (props.debounceTime !== undefined) {\n      this.props.debounceTime = props.debounceTime;\n    }\n  }\n\n  /**\n   * Called by an application that wants to issue a request, without having it deeply queued by the browser\n   *\n   * When the returned promise resolved, it is OK for the application to issue a request.\n   * The promise resolves to an object that contains a `done` method.\n   * When the application's request has completed (or failed), the application must call the `done` function\n   *\n   * @param handle\n   * @param getPriority will be called when request \"slots\" open up,\n   *    allowing the caller to update priority or cancel the request\n   *    Highest priority executes first, priority < 0 cancels the request\n   * @returns a promise\n   *   - resolves to a object (with a `done` field) when the request can be issued without queueing,\n   *   - resolves to `null` if the request has been cancelled (by the callback return < 0).\n   *     In this case the application should not issue the request\n   */\n  scheduleRequest(\n    handle: Handle,\n    getPriority: GetPriorityFunction = () => 0\n  ): Promise<RequestResult> {\n    // Allows throttling to be disabled\n    if (!this.props.throttleRequests) {\n      return Promise.resolve({done: () => {}});\n    }\n\n    // dedupe\n    if (this.requestMap.has(handle)) {\n      return this.requestMap.get(handle) as Promise<any>;\n    }\n\n    const request: Request = {handle, priority: 0, getPriority};\n    const promise = new Promise<RequestResult>((resolve) => {\n      // @ts-ignore\n      request.resolve = resolve;\n      return request;\n    });\n\n    this.requestQueue.push(request);\n    this.requestMap.set(handle, promise);\n    this._issueNewRequests();\n    return promise;\n  }\n\n  // PRIVATE\n\n  _issueRequest(request: Request): Promise<any> {\n    const {handle, resolve} = request;\n    let isDone = false;\n\n    const done = () => {\n      // can only be called once\n      if (!isDone) {\n        isDone = true;\n\n        // Stop tracking a request - it has completed, failed, cancelled etc\n        this.requestMap.delete(handle);\n        this.activeRequestCount--;\n        // A slot just freed up, see if any queued requests are waiting\n        this._issueNewRequests();\n      }\n    };\n\n    // Track this request\n    this.activeRequestCount++;\n\n    return resolve ? resolve({done}) : Promise.resolve({done});\n  }\n\n  /** We check requests asynchronously, to prevent multiple updates */\n  _issueNewRequests(): void {\n    if (this.updateTimer !== null) {\n      clearTimeout(this.updateTimer);\n    }\n    this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime);\n  }\n\n  /** Refresh all requests  */\n  _issueNewRequestsAsync() {\n    if (this.updateTimer !== null) {\n      clearTimeout(this.updateTimer);\n    }\n    this.updateTimer = null;\n\n    const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n\n    if (freeSlots === 0) {\n      return;\n    }\n\n    this._updateAllRequests();\n\n    // Resolve pending promises for the top-priority requests\n    for (let i = 0; i < freeSlots; ++i) {\n      const request = this.requestQueue.shift();\n      if (request) {\n        this._issueRequest(request); // eslint-disable-line @typescript-eslint/no-floating-promises\n      }\n    }\n\n    // Uncomment to debug\n    // console.log(`${freeSlots} free slots, ${this.requestQueue.length} queued requests`);\n  }\n\n  /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */\n  _updateAllRequests() {\n    const requestQueue = this.requestQueue;\n    for (let i = 0; i < requestQueue.length; ++i) {\n      const request = requestQueue[i];\n      if (!this._updateRequest(request)) {\n        // Remove the element and make sure to adjust the counter to account for shortened array\n        requestQueue.splice(i, 1);\n        this.requestMap.delete(request.handle);\n        i--;\n      }\n    }\n\n    // Sort the remaining requests based on priority\n    requestQueue.sort((a, b) => a.priority - b.priority);\n  }\n\n  /** Update a single request by calling the callback */\n  _updateRequest(request) {\n    request.priority = request.getPriority(request.handle); // eslint-disable-line callback-return\n\n    // by returning a negative priority, the callback cancels the request\n    if (request.priority < 0) {\n      request.resolve(null);\n      return false;\n    }\n    return true;\n  }\n}\n", "// Simple file alias mechanisms for tests.\n\nlet pathPrefix = '';\nconst fileAliases: {[aliasPath: string]: string} = {};\n\n/*\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string): void {\n  pathPrefix = prefix;\n}\n\n/*\n * Get the relative path prefix\n */\nexport function getPathPrefix(): string {\n  return pathPrefix;\n}\n\n/**\n *\n * @param aliases\n *\n * Note: addAliases are an experimental export, they are only for testing of loaders.gl loaders\n * not intended as a generic aliasing mechanism\n */\nexport function addAliases(aliases: {[aliasPath: string]: string}): void {\n  Object.assign(fileAliases, aliases);\n}\n\n/**\n * Resolves aliases and adds path-prefix to paths\n */\nexport function resolvePath(filename: string): string {\n  for (const alias in fileAliases) {\n    if (filename.startsWith(alias)) {\n      const replacement = fileAliases[alias];\n      filename = filename.replace(alias, replacement);\n    }\n  }\n  if (!filename.startsWith('http://') && !filename.startsWith('https://')) {\n    filename = `${pathPrefix}${filename}`;\n  }\n  return filename;\n}\n", "import type {LoaderWithParser, LoaderOptions} from './loader-types';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type JSONLoaderOptions = LoaderOptions;\n\n/**\n * A JSON Micro loader (minimal bundle size)\n * Alternative to `@loaders.gl/json`\n */\nexport const JSONLoader = {\n  dataType: null as unknown as Table,\n  batchType: null as unknown as TableBatch,\n  name: 'JSON',\n  id: 'json',\n  module: 'json',\n  version: VERSION,\n  extensions: ['json', 'geojson'],\n  mimeTypes: ['application/json'],\n  category: 'json',\n  text: true,\n  parseTextSync,\n  parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),\n  options: {}\n} as const satisfies LoaderWithParser<Table, TableBatch, JSONLoaderOptions>;\n\n// TODO - Better error handling!\nfunction parseTextSync(text) {\n  return JSON.parse(text);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Isolates Buffer references to ensure they are only bundled under Node.js (avoids big webpack polyfill)\n// this file is selected by the package.json \"browser\" field).\n\n/**\n * Convert Buffer to ArrayBuffer\n * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toArrayBuffer(buffer) {\n  return buffer;\n}\n\n/**\n * Convert (copy) ArrayBuffer to Buffer\n */\nexport function toBuffer(binaryData: ArrayBuffer | Buffer): Buffer {\n  throw new Error('Buffer not supported in browser');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {isSharedArrayBuffer} from '../javascript-utils/is-type';\nimport * as node from '../node/buffer';\n\n/**\n * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n */\nexport function isBuffer(value: any): value is Buffer {\n  return value && typeof value === 'object' && value.isBuffer;\n}\n\n/**\n * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toBuffer(data: unknown): Buffer {\n  return node.toBuffer ? node.toBuffer(data as any) : (data as Buffer);\n}\n\n/**\n * Convert an object to an array buffer. Handles SharedArrayBuffers.\n */\nexport function toArrayBuffer(\n  data: Buffer | ArrayBufferLike | ArrayBufferView | string | Blob\n): ArrayBuffer {\n  // Note: Should be called first, Buffers can trigger other detections below\n  if (isBuffer(data)) {\n    return node.toArrayBuffer(data);\n  }\n\n  if (data instanceof ArrayBuffer) {\n    return data;\n  }\n\n  if (isSharedArrayBuffer(data)) {\n    return copyToArrayBuffer(data);\n  }\n\n  // Node Buffers look like Uint8Arrays (Check isBuffer first)\n  if (ArrayBuffer.isView(data)) {\n    // TODO - ArrayBufferLike type mess\n    const buffer = data.buffer as ArrayBuffer;\n    if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {\n      return buffer;\n    }\n    return buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n  }\n\n  if (typeof data === 'string') {\n    const text = data;\n    const uint8Array = new TextEncoder().encode(text);\n    return uint8Array.buffer;\n  }\n\n  // HACK to support Blob polyfill\n  if (data && typeof data === 'object' && (data as any)._toArrayBuffer) {\n    return (data as any)._toArrayBuffer();\n  }\n\n  throw new Error('toArrayBuffer');\n}\n\n/** Ensure that SharedArrayBuffers are copied into ArrayBuffers */\nexport function ensureArrayBuffer(bufferSource: ArrayBufferLike | ArrayBufferView): ArrayBuffer {\n  if (bufferSource instanceof ArrayBuffer) {\n    return bufferSource;\n  }\n\n  if (isSharedArrayBuffer(bufferSource)) {\n    return copyToArrayBuffer(bufferSource);\n  }\n\n  const {buffer, byteOffset, byteLength} = bufferSource;\n  if (buffer instanceof ArrayBuffer && byteOffset === 0 && byteLength === buffer.byteLength) {\n    return buffer;\n  }\n  return copyToArrayBuffer(buffer, byteOffset, byteLength);\n}\n\n/** Copies an ArrayBuffer or a section of an ArrayBuffer to a new ArrayBuffer, handles SharedArrayBuffers */\nexport function copyToArrayBuffer(\n  buffer: ArrayBufferLike,\n  byteOffset = 0,\n  byteLength = buffer.byteLength - byteOffset\n): ArrayBuffer {\n  const view = new Uint8Array(buffer, byteOffset, byteLength);\n  const copy = new Uint8Array(view.length);\n  copy.set(view);\n  return copy.buffer;\n}\n\n/** Convert an object to an ArrayBufferView, handles SharedArrayBuffers */\nexport function toArrayBufferView(\n  data: ArrayBufferLike | ArrayBufferView\n): ArrayBuffer | ArrayBufferView {\n  if (ArrayBuffer.isView(data)) {\n    return data;\n  }\n\n  // Create a view to support ArrayBufferLike sources such as SharedArrayBuffer\n  return new Uint8Array(data);\n}\n", "// @loaders.gl, MIT license\n\n// type Parameter1<T extends (arg1: any, ...args: unknown[]) => unknown> = T extends (\n//   arg1: infer P,\n//   ...args: unknown[]\n// ) => unknown\n//   ? P\n//   : never;\n\n//   type Parameter2<T extends (arg1: unknown, arg2: any, ...args: unknown[]) => unknown> = T extends (\n//   arg1: unknown,\n//   arg2: infer P,\n//   ...args: unknown[]\n// ) => unknown\n//   ? P\n//   : never;\n\n// type CallbackParameter2<\n//   T extends (arg: unknown, cb: (error: any, value: any) => void) => unknown\n// > = T extends (arg: unknown, cb: (error: any, value: infer P) => void) => unknown ? P : never;\n\n// type CallbackParameter3<\n//   T extends (arg: unknown, arg2: unknown, cb: (error: any, value: any) => void) => unknown\n// > = T extends (arg: unknown, arg2: unknown, cb: (error: any, value: infer P) => void) => unknown\n//   ? P\n//   : never;\n\n// /** Extract the parameters of a function type in a tuple */\n// export type Promisified<F extends (arg1, cb: (error: unknown, value: any) => void) => any> = (\n//   arg1: Parameter1<F>\n// ) => Promise<CallbackParameter2<F>>;\n// /** Extract the parameters of a function type in a tuple */\n// export type Promisified2<F extends (arg1, arg2, cb: (error: unknown, value: any) => void) => any> = (\n//   arg1: Parameter1<F>,\n//   arg2: Parameter2<F>\n// ) => Promise<CallbackParameter3<F>>;\n\n/** Wrapper for Node.js promisify */\ntype Callback<A> = (error: unknown, args: A) => void;\n\n/**\n * Typesafe promisify implementation\n * @link https://dev.to/_gdelgado/implement-a-type-safe-version-of-node-s-promisify-in-7-lines-of-code-in-typescript-2j34\n * @param fn\n * @returns\n */\nexport function promisify1<T, A>(fn: (args: T, cb: Callback<A>) => void): (args: T) => Promise<A> {\n  return (args: T) =>\n    new Promise((resolve, reject) =>\n      fn(args, (error, callbackArgs) => (error ? reject(error) : resolve(callbackArgs)))\n    );\n}\n\nexport function promisify2<T1, T2, A>(\n  fn: (arg1: T1, arg2: T2, cb: Callback<A>) => void\n): (arg1: T1, arg2: T2) => Promise<A> {\n  return (arg1: T1, arg2: T2) =>\n    new Promise((resolve, reject) =>\n      fn(arg1, arg2, (error, callbackArgs) => (error ? reject(error) : resolve(callbackArgs)))\n    );\n}\n\nexport function promisify3<T1, T2, T3, A>(\n  fn: (arg1: T1, arg2: T2, arg3: T3, cb: Callback<A>) => void\n): (arg1: T1, arg2: T2, arg3: T3) => Promise<A> {\n  return (arg1: T1, arg2: T2, arg3: T3) =>\n    new Promise((resolve, reject) =>\n      fn(arg1, arg2, arg3, (error, callbackArgs) => (error ? reject(error) : resolve(callbackArgs)))\n    );\n}\n", "// Beginning of a minimal implementation of the Node.js path API, that doesn't pull in big polyfills.\n\nimport {getCWD} from './get-cwd';\n\n/**\n * Replacement for Node.js path.filename\n * @param url\n */\nexport function filename(url: string): string {\n  const slashIndex = url ? url.lastIndexOf('/') : -1;\n  return slashIndex >= 0 ? url.substr(slashIndex + 1) : url;\n}\n\n/**\n * Replacement for Node.js path.dirname\n * @param url\n */\nexport function dirname(url: string): string {\n  const slashIndex = url ? url.lastIndexOf('/') : -1;\n  return slashIndex >= 0 ? url.substr(0, slashIndex) : '';\n}\n\n/**\n * Replacement for Node.js path.join\n * @param parts\n */\nexport function join(...parts: string[]): string {\n  const separator = '/';\n  parts = parts.map((part, index) => {\n    if (index) {\n      part = part.replace(new RegExp(`^${separator}`), '');\n    }\n    if (index !== parts.length - 1) {\n      part = part.replace(new RegExp(`${separator}$`), '');\n    }\n    return part;\n  });\n  return parts.join(separator);\n}\n\n/* eslint-disable no-continue */\n\n/**\n * https://nodejs.org/api/path.html#path_path_resolve_paths\n * @param paths A sequence of paths or path segments.\n * @return resolved path\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\nexport function resolve(...components: string[]): string {\n  const paths: string[] = [];\n  for (let _i = 0; _i < components.length; _i++) {\n    paths[_i] = components[_i];\n  }\n  let resolvedPath = '';\n  let resolvedAbsolute = false;\n  let cwd: string | undefined;\n  for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n    let path: string | undefined;\n    if (i >= 0) {\n      path = paths[i];\n    } else {\n      if (cwd === undefined) {\n        cwd = getCWD();\n      }\n      path = cwd;\n    }\n    // Skip empty entries\n    if (path.length === 0) {\n      continue;\n    }\n    resolvedPath = `${path}/${resolvedPath}`;\n    resolvedAbsolute = path.charCodeAt(0) === SLASH;\n  }\n  // At this point the path should be resolved to a full absolute path, but\n  // handle relative paths to be safe (might happen when process.cwd() fails)\n  // Normalize the path (removes leading slash)\n  resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n  if (resolvedAbsolute) {\n    return `/${resolvedPath}`;\n  } else if (resolvedPath.length > 0) {\n    return resolvedPath;\n  }\n  return '.';\n}\n\nconst SLASH = 47;\nconst DOT = 46;\n\n/**\n * Resolves . and .. elements in a path with directory names\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\n/* eslint-disable max-depth */\n// eslint-disable-next-line complexity, max-statements\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean): string {\n  let res = '';\n  let lastSlash = -1;\n  let dots = 0;\n  let code: number | undefined;\n  let isAboveRoot = false;\n\n  for (let i = 0; i <= path.length; ++i) {\n    if (i < path.length) {\n      code = path.charCodeAt(i);\n    } else if (code === SLASH) {\n      break;\n    } else {\n      code = SLASH;\n    }\n    if (code === SLASH) {\n      if (lastSlash === i - 1 || dots === 1) {\n        // NOOP\n      } else if (lastSlash !== i - 1 && dots === 2) {\n        if (\n          res.length < 2 ||\n          !isAboveRoot ||\n          res.charCodeAt(res.length - 1) !== DOT ||\n          res.charCodeAt(res.length - 2) !== DOT\n        ) {\n          if (res.length > 2) {\n            const start = res.length - 1;\n            let j = start;\n            for (; j >= 0; --j) {\n              if (res.charCodeAt(j) === SLASH) {\n                break;\n              }\n            }\n            if (j !== start) {\n              res = j === -1 ? '' : res.slice(0, j);\n              lastSlash = i;\n              dots = 0;\n              isAboveRoot = false;\n              continue;\n            }\n          } else if (res.length === 2 || res.length === 1) {\n            res = '';\n            lastSlash = i;\n            dots = 0;\n            isAboveRoot = false;\n            continue;\n          }\n        }\n        if (allowAboveRoot) {\n          if (res.length > 0) {\n            res += '/..';\n          } else {\n            res = '..';\n          }\n          isAboveRoot = true;\n        }\n      } else {\n        const slice = path.slice(lastSlash + 1, i);\n        if (res.length > 0) {\n          res += `/${slice}`;\n        } else {\n          res = slice;\n        }\n        isAboveRoot = false;\n      }\n      lastSlash = i;\n      dots = 0;\n    } else if (code === DOT && dots !== -1) {\n      ++dots;\n    } else {\n      dots = -1;\n    }\n  }\n  return res;\n}\n", "// loaders.gl MIT license\n\nexport function getCWD() {\n  if (typeof process !== 'undefined' && typeof process.cwd !== 'undefined') {\n    return process.cwd();\n  }\n  const pathname = window.location?.pathname;\n  return pathname?.slice(0, pathname.lastIndexOf('/') + 1) || '';\n}\n", "export const isSupported = false;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ReadableFile} from './file';\n\n/**\n * BlobFile provides a \"file like interface\" to the data in a Blob or File object\n */\nexport class BlobFile implements ReadableFile {\n  readonly handle: Blob;\n  readonly size: number;\n  readonly bigsize: bigint;\n  readonly url: string;\n\n  constructor(blob: Blob | File | ArrayBuffer) {\n    this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;\n    this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;\n    this.bigsize = BigInt(this.size);\n    this.url = blob instanceof File ? blob.name : '';\n  }\n\n  async close() {}\n\n  async stat() {\n    return {\n      size: this.handle.size,\n      bigsize: BigInt(this.handle.size),\n      isDirectory: false\n    };\n  }\n\n  async read(start?: number | bigint, length?: number): Promise<ArrayBuffer> {\n    const arrayBuffer = await this.handle\n      .slice(Number(start), Number(start) + Number(length))\n      .arrayBuffer();\n    return arrayBuffer;\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ReadableFile, Stat} from './file';\n\nexport class HttpFile implements ReadableFile {\n  readonly handle: string;\n  readonly size: number = 0;\n  readonly bigsize: bigint = 0n;\n  readonly url: string;\n\n  constructor(url: string) {\n    this.handle = url;\n    this.url = url;\n  }\n\n  async close(): Promise<void> {}\n\n  async stat(): Promise<Stat> {\n    const response = await fetch(this.handle, {method: 'HEAD'});\n    if (!response.ok) {\n      throw new Error(`Failed to fetch HEAD ${this.handle}`);\n    }\n    const size = parseInt(response.headers.get('Content-Length') || '0');\n    return {\n      size,\n      bigsize: BigInt(size),\n      isDirectory: false\n    };\n  }\n\n  async read(offset: number | bigint = 0, length: number = 0): Promise<ArrayBuffer> {\n    const response = await this.fetchRange(offset, length);\n    const arrayBuffer = await response.arrayBuffer();\n    return arrayBuffer;\n  }\n\n  /**\n   *\n   * @param offset\n   * @param length\n   * @param signal\n   * @returns\n   * @see https://github.com/protomaps/PMTiles\n   */\n  // eslint-disable-next-line complexity\n  async fetchRange(\n    offset: number | bigint,\n    length: number,\n    signal?: AbortSignal\n  ): Promise<Response> {\n    const nOffset = Number(offset);\n    const nLength = Number(length);\n\n    let controller: AbortController | undefined;\n    if (!signal) {\n      // ToDO why is it so important to abort in case 200?\n      // TODO check this works or assert 206\n      controller = new AbortController();\n      signal = controller.signal;\n    }\n\n    const url = this.handle;\n    let response = await fetch(url, {\n      signal,\n      headers: {Range: `bytes=${nOffset}-${nOffset + nLength - 1}`}\n    });\n\n    switch (response.status) {\n      case 206: // Partial Content success\n        // This is the expected success code for a range request\n        break;\n\n      case 200:\n        // some well-behaved backends, e.g. DigitalOcean CDN, respond with 200 instead of 206\n        // but we also need to detect no support for Byte Serving which is returning the whole file\n        const contentLength = response.headers.get('Content-Length');\n        if (!contentLength || Number(contentLength) > length) {\n          if (controller) {\n            controller.abort();\n          }\n          throw Error(\n            'content-length header missing or exceeding request. Server must support HTTP Byte Serving.'\n          );\n        }\n\n      // @eslint-disable-next-line no-fallthrough\n      case 416: // \"Range Not Satisfiable\"\n        // some HTTP servers don't accept ranges beyond the end of the resource.\n        // Retry with the exact length\n        // TODO: can return 416 with offset > 0 if content changed, which will have a blank etag.\n        // See https://github.com/protomaps/PMTiles/issues/90\n        if (offset === 0) {\n          const contentRange = response.headers.get('Content-Range');\n          if (!contentRange || !contentRange.startsWith('bytes *')) {\n            throw Error('Missing content-length on 416 response');\n          }\n          const actualLength = Number(contentRange.substr(8));\n          response = await fetch(this.url, {\n            signal,\n            headers: {Range: `bytes=0-${actualLength - 1}`}\n          });\n        }\n        break;\n\n      default:\n        if (response.status >= 300) {\n          throw Error(`Bad response code: ${response.status}`);\n        }\n    }\n\n    return response;\n    // const data = await response.arrayBuffer();\n    // return {\n    //   data,\n    //   etag: response.headers.get('ETag') || undefined,\n    //   cacheControl: response.headers.get('Cache-Control') || undefined,\n    //   expires: response.headers.get('Expires') || undefined\n    // };\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {isBrowser} from '../env-utils/globals';\nimport {ReadableFile, WritableFile, Stat} from './file';\n\nconst NOT_IMPLEMENTED = new Error('Not implemented');\n\n/** This class is a facade that gets replaced with an actual NodeFile instance  */\nexport class NodeFileFacade implements ReadableFile, WritableFile {\n  handle: unknown;\n  size: number = 0;\n  bigsize: bigint = 0n;\n  url: string = '';\n\n  constructor(url: string, flags?: 'r' | 'w' | 'wx' | 'a+', mode?: number) {\n    // Return the actual implementation instance\n    if (globalThis.loaders?.NodeFile) {\n      return new globalThis.loaders.NodeFile(url, flags, mode);\n    }\n    if (isBrowser) {\n      throw new Error('Can\\'t instantiate NodeFile in browser.');\n    }\n    throw new Error('Can\\'t instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.');\n  }\n  /** Read data */\n  async read(start?: number | bigint, length?: number): Promise<ArrayBuffer> {\n    throw NOT_IMPLEMENTED;\n  }\n  /** Write to file. The number of bytes written will be returned */\n  async write(arrayBuffer: ArrayBuffer, offset?: number | bigint, length?: number | bigint): Promise<number> {\n    throw NOT_IMPLEMENTED;\n  }\n  /** Get information about file */\n  async stat(): Promise<Stat> {\n    throw NOT_IMPLEMENTED;\n  }\n\n  /** Truncates the file descriptor. Only available on NodeFile. */\n  async truncate(length: number): Promise<void> {\n    throw NOT_IMPLEMENTED;\n  }\n\n  /** Append data to a file. Only available on NodeFile. */\n  async append(data: Uint8Array): Promise<void> {\n    throw NOT_IMPLEMENTED;\n  }\n  /** Close the file */\n  async close(): Promise<void> {}\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {isBrowser} from '../env-utils/globals';\nimport {Stat} from '../files/file';\nimport {NodeFileFacade as NodeFile} from '../files/node-file-facade';\nimport {RandomAccessFileSystem} from './filesystem';\n\nconst NOT_IMPLEMENTED = new Error('Not implemented');\n\n/**\n * FileSystem pass-through for Node.js\n * Compatible with BrowserFileSystem.\n * @note Dummy implementation, not used (constructor returns a real NodeFileSystem instance)\n * @param options\n */\nexport class NodeFileSystemFacade implements RandomAccessFileSystem {\n  // implements FileSystem\n  constructor(options: {[key: string]: any}) {\n    if (globalThis.loaders?.NodeFileSystem) {\n      return new globalThis.loaders.NodeFileSystem(options);\n    }\n    if (isBrowser) {\n      throw new Error('Can\\'t instantiate NodeFileSystem in browser.');\n    }\n    throw new Error(\n      'Can\\'t instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first.'\n    );\n  }\n\n  // DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)\n\n  // implements RandomAccessReadFileSystem\n\n  readonly readable = true;\n  readonly writable = true;\n\n  async openReadableFile(path: string, flags): Promise<NodeFile> {\n    throw NOT_IMPLEMENTED;\n  }\n\n  // implements RandomAccessWriteFileSystem\n  async openWritableFile(path: string, flags, mode): Promise<NodeFile> {\n    throw NOT_IMPLEMENTED;\n  }\n\n  // Implements file system\n\n  async readdir(dirname = '.', options?: {}): Promise<string[]> {\n    throw NOT_IMPLEMENTED;\n  }\n\n  async stat(path: string, options?: {}): Promise<Stat> {\n    throw NOT_IMPLEMENTED;\n  }\n\n  async unlink(path: string): Promise<void> {\n    throw NOT_IMPLEMENTED;\n  }\n\n  async fetch(path: RequestInfo, options?: RequestInit): Promise<Response> {\n    throw NOT_IMPLEMENTED;\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, StrictLoaderOptions} from '../../loader-types';\nimport type {RequiredOptions} from '../option-utils/merge-options';\nimport {mergeOptions} from '../option-utils/merge-options';\nimport {resolvePath} from '../path-utils/file-aliases';\n\n/** Common properties for all data sources */\nexport type DataSourceOptions = Partial<{\n  core: {\n    /** Allows application to specify which source should be selected. Matches `Source.type`. Defaults to 'auto' */\n    type?: string;\n    /** Any dataset attributions (in case underlying metadata does not include attributions) */\n    attributions?: string[];\n    /** LoaderOptions provide an option to override `fetch`. Will also be passed to any sub loaders */\n    loadOptions?: StrictLoaderOptions;\n    /** Make additional loaders available to the data source */\n    loaders?: Loader[];\n  };\n  [key: string]: Record<string, unknown>;\n}>;\n\n/** base class of all data sources */\nexport abstract class DataSource<DataT, OptionsT extends DataSourceOptions> {\n  static defaultOptions: Required<DataSourceOptions> = {\n    core: {\n      type: 'auto',\n      attributions: [],\n      loadOptions: {},\n      loaders: []\n    }\n  };\n\n  optionsType?: OptionsT & DataSourceOptions;\n  options: Required<OptionsT & DataSourceOptions>;\n  readonly data: DataT;\n  readonly url: string;\n\n  /** The actual load options, if calling a loaders.gl loader */\n  loadOptions: StrictLoaderOptions;\n  /** A resolved fetch function extracted from loadOptions prop */\n  fetch: (url: string, options?: RequestInit) => Promise<Response>;\n  _needsRefresh: boolean = true;\n\n  constructor(\n    data: DataT,\n    options: OptionsT,\n    defaultOptions?: Omit<RequiredOptions<OptionsT>, 'core'>\n  ) {\n    if (defaultOptions) {\n      // @ts-expect-error Typescript gets confused\n      this.options = mergeOptions({...defaultOptions, core: DataSource.defaultOptions}, options);\n    } else {\n      // @ts-expect-error\n      this.options = {...options};\n    }\n    this.data = data;\n    this.url = typeof data === 'string' ? resolvePath(data) : '';\n    this.loadOptions = normalizeDirectLoaderOptions(this.options.core?.loadOptions);\n    this.fetch = getFetchFunction(this.loadOptions);\n  }\n\n  setProps(options: OptionsT) {\n    this.options = Object.assign(this.options, options);\n    // TODO - add a shallow compare to avoid setting refresh if no change?\n    this.setNeedsRefresh();\n  }\n\n  /** Mark this data source as needing a refresh (redraw) */\n  setNeedsRefresh(): void {\n    this._needsRefresh = true;\n  }\n\n  /**\n   * Does this data source need refreshing?\n   * @note The specifics of the refresh mechanism depends on type of data source\n   */\n  getNeedsRefresh(clear: boolean = true) {\n    const needsRefresh = this._needsRefresh;\n    if (clear) {\n      this._needsRefresh = false;\n    }\n    return needsRefresh;\n  }\n}\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: StrictLoaderOptions) {\n  const fetchFunction = options?.core?.fetch;\n\n  // options.fetch can be a function\n  if (fetchFunction && typeof fetchFunction === 'function') {\n    return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n  }\n\n  // options.fetch can be an options object, use global fetch with those options\n  const fetchOptions = options?.fetch;\n  if (fetchOptions && typeof fetchOptions !== 'function') {\n    return (url) => fetch(url, fetchOptions);\n  }\n\n  // else return the global fetch function\n  return (url) => fetch(url);\n}\n\nfunction normalizeDirectLoaderOptions(options?: StrictLoaderOptions): StrictLoaderOptions {\n  const loadOptions = {...options};\n  if (options?.core) {\n    loadOptions.core = {...options.core};\n  }\n\n  const topLevelBaseUri = typeof loadOptions.baseUri === 'string' ? loadOptions.baseUri : undefined;\n  const topLevelBaseUrl = typeof loadOptions.baseUrl === 'string' ? loadOptions.baseUrl : undefined;\n\n  if (topLevelBaseUri !== undefined || topLevelBaseUrl !== undefined) {\n    loadOptions.core ||= {};\n    if (loadOptions.core.baseUrl === undefined) {\n      loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;\n    }\n    delete loadOptions.baseUri;\n    delete loadOptions.baseUrl;\n  }\n\n  return loadOptions;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// TODO - can we import from schema?\nimport {ImageType} from './utils/image-type';\n// TODO - remove (this breaks WMS layer)\n\n/**\n * ImageSource - data sources that allow images to be queried by (geospatial) extents\n */\nexport abstract class ImageSource {\n  static type: string = 'template';\n  static testURL = (url: string): boolean => false;\n\n  abstract getMetadata(): Promise<ImageSourceMetadata>;\n  abstract getImage(parameters: GetImageParameters): Promise<ImageType>;\n}\n\n// PARAMETER TYPES\n\n/**\n * Normalized capabilities of an Image service\n * @example\n *  The WMSSourceLoader will normalize the response to the WMS `GetCapabilities`\n *  data structure extracted from WMS XML response into an ImageSourceMetadata.\n */\nexport type ImageSourceMetadata = {\n  name: string;\n  title?: string;\n  abstract?: string;\n  keywords: string[];\n  layers: ImageSourceLayer[];\n};\n\n/** Description of one data layer in the image source */\nexport type ImageSourceLayer = {\n  /** Name of this layer */\n  name?: string;\n  /** Human readable title of this layer */\n  title?: string;\n  /** Coordinate systems supported by this layer */\n  crs?: string[];\n  /** layer limits in unspecified CRS:84-like lng/lat, for quick access w/o CRS calculations. */\n  boundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n  /** Sub layers of this layer */\n  layers?: ImageSourceLayer[];\n};\n\n/** Generic parameters for requesting an image from an image source */\nexport type GetImageParameters = {\n  /** Layers to render */\n  layers: string | string[];\n  /** Styling */\n  styles?: unknown;\n  /** bounding box of the requested map image */\n  boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];\n  /** @deprecated use boundingBox */\n  bbox?: [number, number, number, number];\n  /** pixel width of returned image */\n  width: number;\n  /** pixels */\n  height: number;\n  /** crs for the image (not the bounding box) */\n  crs?: string;\n  /** requested format for the return image */\n  format?: 'image/png';\n};\n"],
  "mappings": ";;;;;;;;;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QAAM,cAAc,EAAC,GAAG,QAAO;AAC/B,MAAI,mCAAS,MAAM;AACjB,gBAAY,OAAO,EAAC,GAAG,QAAQ,KAAI;EACrC;AAEA,QAAM,kBAAkB,OAAO,YAAY,YAAY,WAAW,YAAY,UAAU;AACxF,QAAM,kBAAkB,OAAO,YAAY,YAAY,WAAW,YAAY,UAAU;AAExF,MAAI,oBAAoB,UAAa,oBAAoB,QAAW;AAClE,gBAAY,SAAS,CAAA;AACrB,QAAI,YAAY,KAAK,YAAY,QAAW;AAC1C,kBAAY,KAAK,UAAU,mBAAmB;IAChD;AACA,WAAO,YAAY;AACnB,WAAO,YAAY;EACrB;AAEA,SAAO;AACT;;;ACzHM,IAAgB,cAAhB,MAA2B;;AAC/B,cADoB,aACb,QAAe;AACtB,cAFoB,aAEb,WAAU,CAAC,QAAyB;",
  "names": ["copyToArrayBuffer", "toArrayBuffer", "toBuffer", "log", "module", "resolve", "onMessage", "payload", "import_worker_utils", "parseOnMainThread", "import_worker_utils", "resolve", "filename", "VERSION", "toBuffer", "toArrayBuffer", "copyToArrayBuffer", "resolve", "NOT_IMPLEMENTED", "dirname", "fetchOptions"]
}
