{
  "version": 3,
  "sources": ["../src/index.ts", "../src/lib/utils/version.ts", "../src/lib/parsers/parse-basis.ts", "../src/lib/parsers/basis-module-loader.ts", "../src/lib/gl-extensions.ts", "../src/lib/utils/detect-supported-texture-formats.ts", "../src/lib/parsers/parse-ktx.ts", "../src/lib/utils/texture-format-map.ts", "../src/lib/utils/extract-mipmap-images.ts", "../src/lib/utils/ktx-format-helper.ts", "../src/basis-loader.ts", "../src/lib/parsers/parse-dds.ts", "../src/lib/parsers/parse-pvr.ts", "../src/lib/parsers/parse-compressed-texture.ts", "../src/compressed-texture-loader.ts", "../src/crunch-loader.ts", "../src/lib/parsers/parse-hdr.ts", "../src/radiance-hdr-loader.ts", "../src/lib/parsers/parse-npy.ts", "../src/npy-loader.ts", "../src/lib/composite-image/parse-composite-image.ts", "../src/lib/texture-api/async-deep-map.ts", "../src/lib/composite-image/image-texture-cube.ts", "../src/texture-loader.ts", "../src/texture-array-loader.ts", "../src/texture-cube-loader.ts", "../src/texture-cube-array-loader.ts", "../src/lib/parsers/crunch-module-loader.ts", "../src/lib/encoders/encode-texture.ts", "../src/compressed-texture-writer.ts", "../src/lib/encoders/encode-ktx2-basis-texture.ts", "../src/ktx2-basis-writer.ts", "../src/lib/texture-api/load-image.ts", "../src/lib/texture-api/generate-url.ts", "../src/lib/texture-api/load-image-array.ts", "../src/lib/texture-api/load-image-cube.ts"],
  "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {VERSION} from './lib/utils/version';\n\n// Types\nexport type {GPUTextureFormat, TextureFormat} from '@loaders.gl/schema';\n\n// Loaders\nexport type {BasisLoaderOptions} from './basis-loader';\nexport {BasisLoader, BasisWorkerLoader} from './basis-loader';\n\nexport type {CompressedTextureLoaderOptions} from './compressed-texture-loader';\nexport {CompressedTextureLoader, CompressedTextureWorkerLoader} from './compressed-texture-loader';\n\nexport type {CrunchLoaderOptions} from './crunch-loader';\nexport {CrunchLoader} from './crunch-loader';\n\nexport type {RadianceHDRLoaderOptions} from './radiance-hdr-loader';\nexport type {RadianceHDRMetadata} from './lib/parsers/parse-hdr';\nexport {RadianceHDRLoader} from './radiance-hdr-loader';\n\nexport type {NPYLoaderOptions} from './npy-loader';\nexport {NPYLoader, NPYWorkerLoader} from './npy-loader';\n\nexport type {TextureManifestLoaderOptions, TextureManifest} from './texture-loader';\nexport {TextureLoader} from './texture-loader';\n\nexport type {TextureArrayLoaderOptions, TextureArrayManifest} from './texture-array-loader';\nexport {TextureArrayLoader} from './texture-array-loader';\n\nexport type {TextureCubeLoaderOptions, TextureCubeManifest} from './texture-cube-loader';\nexport {TextureCubeLoader} from './texture-cube-loader';\n\nexport type {\n  TextureCubeArrayLoaderOptions,\n  TextureCubeArrayManifest\n} from './texture-cube-array-loader';\nexport {TextureCubeArrayLoader} from './texture-cube-array-loader';\n\n// Module constants\nexport {BASIS_EXTERNAL_LIBRARIES} from './lib/parsers/basis-module-loader';\nexport {CRUNCH_EXTERNAL_LIBRARIES} from './lib/parsers/crunch-module-loader';\n\n// Writers\nexport {CompressedTextureWriter} from './compressed-texture-writer';\nexport {KTX2BasisWriter} from './ktx2-basis-writer';\n\nexport const KTX2BasisWriterWorker = {\n  name: 'Basis Universal Supercompressed GPU Texture',\n  id: 'ktx2-basis-writer',\n  module: 'textures',\n  version: VERSION,\n  extensions: ['ktx2'],\n  worker: true,\n  options: {\n    useSRGB: false,\n    qualityLevel: 10,\n    encodeUASTC: false,\n    mipmaps: false\n  }\n};\n\n// Texture Loading API\nexport {loadImageTexture} from './lib/texture-api/load-image';\nexport {loadImageTextureArray} from './lib/texture-api/load-image-array';\nexport {loadImageTextureCube} from './lib/texture-api/load-image-cube';\n\n// Utilities\nexport * from './lib/gl-extensions';\n\n// DEPRECATED\n// @deprecated\nexport {CrunchLoader as CrunchWorkerLoader} from './crunch-loader';\n// @deprecated\nexport type {CompressedTextureLoaderOptions as TextureLoaderOptions} from './compressed-texture-loader';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\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", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\n/* eslint-disable indent */\nimport type {TextureFormat, TextureLevel} from '@loaders.gl/schema';\nimport {extractLoadLibraryOptions} from '@loaders.gl/worker-utils';\nimport {loadBasisEncoderModule, loadBasisTranscoderModule} from './basis-module-loader';\nimport type {GLTextureFormat} from '../gl-types';\nimport {\n  GL_COMPRESSED_RED_GREEN_RGTC2_EXT,\n  GL_COMPRESSED_RED_RGTC1_EXT,\n  GL_COMPRESSED_RGB_ATC_WEBGL,\n  GL_COMPRESSED_RGB_ETC1_WEBGL,\n  GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,\n  GL_COMPRESSED_RGB_S3TC_DXT1_EXT,\n  GL_COMPRESSED_RGBA8_ETC2_EAC,\n  GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n  GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,\n  GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,\n  GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,\n  GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,\n  GL_RGB565,\n  GL_RGBA4,\n  GL_RGBA8\n} from '../gl-extensions';\nimport {detectSupportedTextureFormats} from '../utils/detect-supported-texture-formats';\nimport {isKTX} from './parse-ktx';\n\n// TODO - circular type import\nimport type {BasisLoaderOptions} from '../../basis-loader';\n\nexport type BasisFormat =\n  | 'etc1'\n  | 'etc2'\n  | 'bc1'\n  | 'bc3'\n  | 'bc4'\n  | 'bc5'\n  | 'bc7-m6-opaque-only'\n  | 'bc7-m5'\n  | 'pvrtc1-4-rgb'\n  | 'pvrtc1-4-rgba'\n  | 'astc-4x4'\n  | 'atc-rgb'\n  | 'atc-rgba-interpolated-alpha'\n  | 'rgba32'\n  | 'rgb565'\n  | 'bgr565'\n  | 'rgba4444';\n\ntype BasisOutputOptions = {\n  basisFormat: number;\n  compressed: boolean;\n  format?: GLTextureFormat;\n  textureFormat?: TextureFormat;\n};\n\nlet basisTranscodingLock: Promise<void> = Promise.resolve();\n\nexport const BASIS_FORMAT_TO_OUTPUT_OPTIONS: Record<BasisFormat, BasisOutputOptions> = {\n  etc1: {\n    basisFormat: 0,\n    compressed: true,\n    format: GL_COMPRESSED_RGB_ETC1_WEBGL,\n    textureFormat: 'etc1-rgb-unorm-webgl'\n  },\n  etc2: {\n    basisFormat: 1,\n    compressed: true,\n    format: GL_COMPRESSED_RGBA8_ETC2_EAC,\n    textureFormat: 'etc2-rgba8unorm'\n  },\n  bc1: {\n    basisFormat: 2,\n    compressed: true,\n    format: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,\n    textureFormat: 'bc1-rgb-unorm-webgl'\n  },\n  bc3: {\n    basisFormat: 3,\n    compressed: true,\n    format: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,\n    textureFormat: 'bc3-rgba-unorm'\n  },\n  bc4: {\n    basisFormat: 4,\n    compressed: true,\n    format: GL_COMPRESSED_RED_RGTC1_EXT,\n    textureFormat: 'bc4-r-unorm'\n  },\n  bc5: {\n    basisFormat: 5,\n    compressed: true,\n    format: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,\n    textureFormat: 'bc5-rg-unorm'\n  },\n  'bc7-m6-opaque-only': {\n    basisFormat: 6,\n    compressed: true,\n    format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,\n    textureFormat: 'bc7-rgba-unorm'\n  },\n  'bc7-m5': {\n    basisFormat: 7,\n    compressed: true,\n    format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,\n    textureFormat: 'bc7-rgba-unorm'\n  },\n  'pvrtc1-4-rgb': {\n    basisFormat: 8,\n    compressed: true,\n    format: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,\n    textureFormat: 'pvrtc-rgb4unorm-webgl'\n  },\n  'pvrtc1-4-rgba': {\n    basisFormat: 9,\n    compressed: true,\n    format: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,\n    textureFormat: 'pvrtc-rgba4unorm-webgl'\n  },\n  'astc-4x4': {\n    basisFormat: 10,\n    compressed: true,\n    format: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n    textureFormat: 'astc-4x4-unorm'\n  },\n  'atc-rgb': {\n    basisFormat: 11,\n    compressed: true,\n    format: GL_COMPRESSED_RGB_ATC_WEBGL,\n    textureFormat: 'atc-rgb-unorm-webgl'\n  },\n  'atc-rgba-interpolated-alpha': {\n    basisFormat: 12,\n    compressed: true,\n    format: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,\n    textureFormat: 'atc-rgbai-unorm-webgl'\n  },\n  rgba32: {\n    basisFormat: 13,\n    compressed: false,\n    format: GL_RGBA8,\n    textureFormat: 'rgba8unorm'\n  },\n  rgb565: {\n    basisFormat: 14,\n    compressed: false,\n    format: GL_RGB565,\n    textureFormat: 'rgb565unorm-webgl'\n  },\n  bgr565: {\n    basisFormat: 15,\n    compressed: false,\n    format: GL_RGB565,\n    textureFormat: 'rgb565unorm-webgl'\n  },\n  rgba4444: {\n    basisFormat: 16,\n    compressed: false,\n    format: GL_RGBA4,\n    textureFormat: 'rgba4unorm-webgl'\n  }\n};\n\nexport const BASIS_FORMATS = Object.freeze(\n  Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS) as BasisFormat[]\n);\n\nexport type ParseBasisOptions = {\n  format: 'auto' | BasisFormat | {alpha: BasisFormat; noAlpha: BasisFormat};\n  containerFormat: 'auto' | 'ktx2' | 'basis';\n  module: 'transcoder' | 'encoder';\n  supportedTextureFormats?: TextureFormat[];\n};\n\n/**\n * Serializes access to the Basis transcoder so concurrent callers do not enter the non-reentrant\n * decoder path at the same time.\n * @param transcode - Transcode operation to run with exclusive access.\n * @returns The transcode result.\n */\nexport async function withBasisTranscodingLock<T>(transcode: () => Promise<T> | T): Promise<T> {\n  const previousLock = basisTranscodingLock;\n  let releaseLock!: () => void;\n\n  basisTranscodingLock = new Promise((resolve) => {\n    releaseLock = resolve;\n  });\n\n  await previousLock;\n\n  try {\n    return await transcode();\n  } finally {\n    releaseLock();\n  }\n}\n\n/**\n * parse data with a Binomial Basis_Universal module\n * @param data\n * @param options\n * @returns compressed texture data\n */\n// eslint-disable-next-line complexity\nexport async function parseBasis(\n  data: ArrayBuffer,\n  options: BasisLoaderOptions = {}\n): Promise<TextureLevel[][]> {\n  const loadLibraryOptions = extractLoadLibraryOptions(options);\n\n  return await withBasisTranscodingLock(async () => {\n    if (!options.basis?.containerFormat || options.basis.containerFormat === 'auto') {\n      if (isKTX(data)) {\n        const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);\n        return parseKTX2File(fileConstructors.KTX2File, data, options);\n      }\n      const {BasisFile} = await loadBasisTranscoderModule(loadLibraryOptions);\n      return parseBasisFile(BasisFile, data, options);\n    }\n    switch (options.basis.module) {\n      case 'encoder':\n        const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);\n        switch (options.basis.containerFormat) {\n          case 'ktx2':\n            return parseKTX2File(fileConstructors.KTX2File, data, options);\n          case 'basis':\n          default:\n            return parseBasisFile(fileConstructors.BasisFile, data, options);\n        }\n      case 'transcoder':\n      default:\n        const {BasisFile} = await loadBasisTranscoderModule(loadLibraryOptions);\n        return parseBasisFile(BasisFile, data, options);\n    }\n  });\n}\n\n/**\n * Parse *.basis file data\n * @param BasisFile - initialized transcoder module\n * @param data\n * @param options\n * @returns compressed texture data\n */\nfunction parseBasisFile(\n  BasisFile,\n  data: ArrayBuffer,\n  options: BasisLoaderOptions\n): TextureLevel[][] {\n  const basisFile = new BasisFile(new Uint8Array(data));\n\n  try {\n    if (!basisFile.startTranscoding()) {\n      throw new Error('Failed to start basis transcoding');\n    }\n\n    const imageCount = basisFile.getNumImages();\n    const images: TextureLevel[][] = [];\n\n    for (let imageIndex = 0; imageIndex < imageCount; imageIndex++) {\n      const levelsCount = basisFile.getNumLevels(imageIndex);\n      const levels: TextureLevel[] = [];\n\n      for (let levelIndex = 0; levelIndex < levelsCount; levelIndex++) {\n        levels.push(transcodeImage(basisFile, imageIndex, levelIndex, options));\n      }\n\n      images.push(levels);\n    }\n\n    return images;\n  } finally {\n    basisFile.close();\n    basisFile.delete();\n  }\n}\n\n/**\n * Parse the particular level image of a basis file\n * @param basisFile\n * @param imageIndex\n * @param levelIndex\n * @param options\n * @returns compressed texture data\n */\nfunction transcodeImage(\n  basisFile,\n  imageIndex: number,\n  levelIndex: number,\n  options: BasisLoaderOptions\n): TextureLevel {\n  const width = basisFile.getImageWidth(imageIndex, levelIndex);\n  const height = basisFile.getImageHeight(imageIndex, levelIndex);\n\n  // See https://github.com/BinomialLLC/basis_universal/pull/83\n  const hasAlpha = basisFile.getHasAlpha(/* imageIndex, levelIndex */);\n\n  // Check options for output format etc\n  const {compressed, format, basisFormat, textureFormat} = getBasisOptions(options, hasAlpha);\n\n  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);\n  const decodedData = new Uint8Array(decodedSize);\n\n  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {\n    throw new Error('failed to start Basis transcoding');\n  }\n\n  return {\n    // standard loaders.gl image category payload\n    shape: 'texture-level',\n    width,\n    height,\n    data: decodedData,\n    compressed,\n    ...(format !== undefined ? {format} : {}),\n    ...(textureFormat !== undefined ? {textureFormat} : {}),\n\n    // Additional fields\n    // Add levelSize field.\n    hasAlpha\n  };\n}\n\n/**\n * Parse *.ktx2 file data\n * @param KTX2File\n * @param data\n * @param options\n * @returns compressed texture data\n */\nfunction parseKTX2File(KTX2File, data: ArrayBuffer, options: BasisLoaderOptions): TextureLevel[][] {\n  const ktx2File = new KTX2File(new Uint8Array(data));\n\n  try {\n    if (!ktx2File.startTranscoding()) {\n      throw new Error('failed to start KTX2 transcoding');\n    }\n    const levelsCount = ktx2File.getLevels();\n    const levels: TextureLevel[] = [];\n\n    for (let levelIndex = 0; levelIndex < levelsCount; levelIndex++) {\n      levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));\n    }\n\n    return [levels];\n  } finally {\n    ktx2File.close();\n    ktx2File.delete();\n  }\n}\n\n/**\n * Parse the particular level image of a ktx2 file\n * @param ktx2File\n * @param levelIndex\n * @param options\n * @returns\n */\nfunction transcodeKTX2Image(\n  ktx2File,\n  levelIndex: number,\n  options: BasisLoaderOptions\n): TextureLevel {\n  const {alphaFlag, height, width} = ktx2File.getImageLevelInfo(levelIndex, 0, 0);\n\n  // Check options for output format etc\n  const {compressed, format, basisFormat, textureFormat} = getBasisOptions(options, alphaFlag);\n\n  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(\n    levelIndex,\n    0 /* layerIndex */,\n    0 /* faceIndex */,\n    basisFormat\n  );\n  const decodedData = new Uint8Array(decodedSize);\n\n  if (\n    !ktx2File.transcodeImage(\n      decodedData,\n      levelIndex,\n      0 /* layerIndex */,\n      0 /* faceIndex */,\n      basisFormat,\n      0,\n      -1 /* channel0 */,\n      -1 /* channel1 */\n    )\n  ) {\n    throw new Error('Failed to transcode KTX2 image');\n  }\n\n  return {\n    // standard loaders.gl image category payload\n    shape: 'texture-level',\n    width,\n    height,\n    data: decodedData,\n    compressed,\n    ...(format !== undefined ? {format} : {}),\n    ...(textureFormat !== undefined ? {textureFormat} : {}),\n\n    // Additional fields\n    levelSize: decodedSize,\n    hasAlpha: alphaFlag\n  };\n}\n\n/**\n * Get BasisFormat by loader format option\n * @param options\n * @param hasAlpha\n * @returns BasisFormat data\n */\nfunction getBasisOptions(options: BasisLoaderOptions, hasAlpha: boolean): BasisOutputOptions {\n  let format = options.basis?.format || 'auto';\n  if (format === 'auto') {\n    format = options.basis?.supportedTextureFormats\n      ? selectSupportedBasisFormat(options.basis.supportedTextureFormats)\n      : selectSupportedBasisFormat();\n  }\n  if (typeof format === 'object') {\n    format = hasAlpha ? format.alpha : format.noAlpha;\n  }\n  const normalizedFormat = format.toLowerCase() as BasisFormat;\n  const basisOutputOptions = BASIS_FORMAT_TO_OUTPUT_OPTIONS[normalizedFormat];\n  if (!basisOutputOptions) {\n    throw new Error(`Unknown Basis format ${format}`);\n  }\n  return basisOutputOptions;\n}\n\n/**\n * Select transcode format from the list of supported formats\n * @returns key for OutputFormat map\n */\nexport function selectSupportedBasisFormat():\n  | BasisFormat\n  | {\n      alpha: BasisFormat;\n      noAlpha: BasisFormat;\n    };\nexport function selectSupportedBasisFormat(supportedTextureFormats?: Iterable<TextureFormat>):\n  | BasisFormat\n  | {\n      alpha: BasisFormat;\n      noAlpha: BasisFormat;\n    };\nexport function selectSupportedBasisFormat(\n  supportedTextureFormats: Iterable<TextureFormat> = detectSupportedTextureFormats()\n): BasisFormat | {alpha: BasisFormat; noAlpha: BasisFormat} {\n  const textureFormats = new Set(supportedTextureFormats);\n\n  if (hasSupportedTextureFormat(textureFormats, ['astc-4x4-unorm', 'astc-4x4-unorm-srgb'])) {\n    return 'astc-4x4';\n  } else if (hasSupportedTextureFormat(textureFormats, ['bc7-rgba-unorm', 'bc7-rgba-unorm-srgb'])) {\n    return {\n      alpha: 'bc7-m5',\n      noAlpha: 'bc7-m6-opaque-only'\n    };\n  } else if (\n    hasSupportedTextureFormat(textureFormats, [\n      'bc1-rgb-unorm-webgl',\n      'bc1-rgb-unorm-srgb-webgl',\n      'bc1-rgba-unorm',\n      'bc1-rgba-unorm-srgb',\n      'bc2-rgba-unorm',\n      'bc2-rgba-unorm-srgb',\n      'bc3-rgba-unorm',\n      'bc3-rgba-unorm-srgb'\n    ])\n  ) {\n    return {\n      alpha: 'bc3',\n      noAlpha: 'bc1'\n    };\n  } else if (\n    hasSupportedTextureFormat(textureFormats, [\n      'pvrtc-rgb4unorm-webgl',\n      'pvrtc-rgba4unorm-webgl',\n      'pvrtc-rgb2unorm-webgl',\n      'pvrtc-rgba2unorm-webgl'\n    ])\n  ) {\n    return {\n      alpha: 'pvrtc1-4-rgba',\n      noAlpha: 'pvrtc1-4-rgb'\n    };\n  } else if (\n    hasSupportedTextureFormat(textureFormats, [\n      'etc2-rgb8unorm',\n      'etc2-rgb8unorm-srgb',\n      'etc2-rgb8a1unorm',\n      'etc2-rgb8a1unorm-srgb',\n      'etc2-rgba8unorm',\n      'etc2-rgba8unorm-srgb',\n      'eac-r11unorm',\n      'eac-r11snorm',\n      'eac-rg11unorm',\n      'eac-rg11snorm'\n    ])\n  ) {\n    return 'etc2';\n  } else if (textureFormats.has('etc1-rgb-unorm-webgl')) {\n    return 'etc1';\n  } else if (\n    hasSupportedTextureFormat(textureFormats, [\n      'atc-rgb-unorm-webgl',\n      'atc-rgba-unorm-webgl',\n      'atc-rgbai-unorm-webgl'\n    ])\n  ) {\n    return {\n      alpha: 'atc-rgba-interpolated-alpha',\n      noAlpha: 'atc-rgb'\n    };\n  }\n  return 'rgb565';\n}\n\nexport function getSupportedBasisFormats(\n  supportedTextureFormats: Iterable<TextureFormat> = detectSupportedTextureFormats()\n): BasisFormat[] {\n  const textureFormats = new Set(supportedTextureFormats);\n  const basisFormats: BasisFormat[] = [];\n\n  if (hasSupportedTextureFormat(textureFormats, ['astc-4x4-unorm', 'astc-4x4-unorm-srgb'])) {\n    basisFormats.push('astc-4x4');\n  }\n  if (\n    hasSupportedTextureFormat(textureFormats, [\n      'bc1-rgb-unorm-webgl',\n      'bc1-rgb-unorm-srgb-webgl',\n      'bc1-rgba-unorm',\n      'bc1-rgba-unorm-srgb',\n      'bc2-rgba-unorm',\n      'bc2-rgba-unorm-srgb',\n      'bc3-rgba-unorm',\n      'bc3-rgba-unorm-srgb'\n    ])\n  ) {\n    basisFormats.push('bc1', 'bc3');\n  }\n  if (hasSupportedTextureFormat(textureFormats, ['bc4-r-unorm', 'bc4-r-snorm'])) {\n    basisFormats.push('bc4');\n  }\n  if (hasSupportedTextureFormat(textureFormats, ['bc5-rg-unorm', 'bc5-rg-snorm'])) {\n    basisFormats.push('bc5');\n  }\n  if (hasSupportedTextureFormat(textureFormats, ['bc7-rgba-unorm', 'bc7-rgba-unorm-srgb'])) {\n    basisFormats.push('bc7-m5', 'bc7-m6-opaque-only');\n  }\n  if (\n    hasSupportedTextureFormat(textureFormats, [\n      'pvrtc-rgb4unorm-webgl',\n      'pvrtc-rgba4unorm-webgl',\n      'pvrtc-rgb2unorm-webgl',\n      'pvrtc-rgba2unorm-webgl'\n    ])\n  ) {\n    basisFormats.push('pvrtc1-4-rgb', 'pvrtc1-4-rgba');\n  }\n  if (\n    hasSupportedTextureFormat(textureFormats, [\n      'etc2-rgb8unorm',\n      'etc2-rgb8unorm-srgb',\n      'etc2-rgb8a1unorm',\n      'etc2-rgb8a1unorm-srgb',\n      'etc2-rgba8unorm',\n      'etc2-rgba8unorm-srgb',\n      'eac-r11unorm',\n      'eac-r11snorm',\n      'eac-rg11unorm',\n      'eac-rg11snorm'\n    ])\n  ) {\n    basisFormats.push('etc2');\n  }\n  if (textureFormats.has('etc1-rgb-unorm-webgl')) {\n    basisFormats.push('etc1');\n  }\n  if (\n    hasSupportedTextureFormat(textureFormats, [\n      'atc-rgb-unorm-webgl',\n      'atc-rgba-unorm-webgl',\n      'atc-rgbai-unorm-webgl'\n    ])\n  ) {\n    basisFormats.push('atc-rgb', 'atc-rgba-interpolated-alpha');\n  }\n\n  basisFormats.push('rgba32', 'rgb565', 'bgr565', 'rgba4444');\n  return basisFormats;\n}\n\nfunction hasSupportedTextureFormat(\n  supportedTextureFormats: Set<TextureFormat>,\n  candidateTextureFormats: TextureFormat[]\n): boolean {\n  return candidateTextureFormats.some((textureFormat) =>\n    supportedTextureFormats.has(textureFormat)\n  );\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {registerJSModules, getJSModuleOrNull} from '@loaders.gl/loader-utils';\nimport {loadLibrary, LoadLibraryOptions} from '@loaders.gl/worker-utils';\n\nexport const BASIS_EXTERNAL_LIBRARIES = {\n  /** Basis transcoder, javascript wrapper part */\n  TRANSCODER: 'basis_transcoder.js',\n  /** Basis transcoder, compiled web assembly part */\n  TRANSCODER_WASM: 'basis_transcoder.wasm',\n  /** Basis encoder, javascript wrapper part */\n  ENCODER: 'basis_encoder.js',\n  /** Basis encoder, compiled web assembly part */\n  ENCODER_WASM: 'basis_encoder.wasm'\n};\n\nlet loadBasisTranscoderPromise;\n\n/**\n * Loads wasm transcoder module\n * @param options\n * @returns {BasisFile} promise\n */\nexport async function loadBasisTranscoderModule(options: LoadLibraryOptions) {\n  registerJSModules(options.modules);\n  const basis = getJSModuleOrNull('basis');\n  if (basis) {\n    return basis;\n  }\n\n  loadBasisTranscoderPromise ||= loadBasisTranscoder(options);\n  return await loadBasisTranscoderPromise;\n}\n\n/**\n * Loads wasm transcoder module\n * @param options\n * @returns {BasisFile} promise\n */\nasync function loadBasisTranscoder(options: LoadLibraryOptions) {\n  let BASIS = null;\n  let wasmBinary = null;\n\n  [BASIS, wasmBinary] = await Promise.all([\n    await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER, 'textures', options),\n    await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, 'textures', options)\n  ]);\n\n  // Depends on how import happened...\n  // @ts-ignore TS2339: Property does not exist on type\n  BASIS = BASIS || globalThis.BASIS;\n  return await initializeBasisTranscoderModule(BASIS, wasmBinary);\n}\n\n/**\n * Initialize wasm transcoder module\n * @param BasisModule - js part of the module\n * @param wasmBinary - wasm part of the module\n * @returns {BasisFile} promise\n */\nfunction initializeBasisTranscoderModule(BasisModule, wasmBinary) {\n  const options: {wasmBinary?} = {};\n\n  if (wasmBinary) {\n    options.wasmBinary = wasmBinary;\n  }\n\n  return new Promise((resolve) => {\n    // if you try to return BasisModule the browser crashes!\n    BasisModule(options).then((module) => {\n      const {BasisFile, initializeBasis} = module;\n      initializeBasis();\n      resolve({BasisFile});\n    });\n  });\n}\n\nlet loadBasisEncoderPromise;\n\n/**\n * Loads wasm encoder module\n * @param options\n * @returns {BasisFile, KTX2File} promise\n */\nexport async function loadBasisEncoderModule(options: LoadLibraryOptions) {\n  const modules = options.modules || {};\n  if (modules.basisEncoder) {\n    return modules.basisEncoder;\n  }\n\n  loadBasisEncoderPromise = loadBasisEncoderPromise || loadBasisEncoder(options);\n  return await loadBasisEncoderPromise;\n}\n\n/**\n * Loads wasm encoder module\n * @param options\n * @returns {BasisFile, KTX2File} promise\n */\nasync function loadBasisEncoder(options: LoadLibraryOptions) {\n  let BASIS_ENCODER = null;\n  let wasmBinary = null;\n\n  [BASIS_ENCODER, wasmBinary] = await Promise.all([\n    await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER, 'textures', options),\n    await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'textures', options)\n  ]);\n\n  // Depends on how import happened...\n  // @ts-ignore TS2339: Property does not exist on type\n  BASIS_ENCODER = BASIS_ENCODER || globalThis.BASIS;\n  return await initializeBasisEncoderModule(BASIS_ENCODER, wasmBinary);\n}\n\n/**\n * Initialize wasm transcoder module\n * @param BasisEncoderModule - js part of the module\n * @param wasmBinary - wasm part of the module\n * @returns {BasisFile, KTX2File} promise\n */\nfunction initializeBasisEncoderModule(BasisEncoderModule, wasmBinary) {\n  const options: {wasmBinary?} = {};\n\n  if (wasmBinary) {\n    options.wasmBinary = wasmBinary;\n  }\n\n  return new Promise((resolve) => {\n    // if you try to return BasisModule the browser crashes!\n    BasisEncoderModule(options).then((module) => {\n      const {BasisFile, KTX2File, initializeBasis, BasisEncoder} = module;\n      initializeBasis();\n      resolve({BasisFile, KTX2File, BasisEncoder});\n    });\n  });\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\n\n// Core WebGL texture formats\nexport const GL_RGB = 0x1907;\nexport const GL_RGBA = 0x1908;\nexport const GL_RGBA4 = 0x8056;\nexport const GL_RGB5_A1 = 0x8057;\nexport const GL_RGBA8 = 0x8058;\nexport const GL_RGB565 = 0x8d62;\nexport const GL_RGBA32F = 0x8814;\n\n// WEBGL_compressed_texture_s3tc\nexport const GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83f0;\nexport const GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83f1;\nexport const GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83f2;\nexport const GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83f3;\n\n// WEBGL_compressed_texture_es3\nexport const GL_COMPRESSED_R11_EAC = 0x9270;\nexport const GL_COMPRESSED_SIGNED_R11_EAC = 0x9271;\nexport const GL_COMPRESSED_RG11_EAC = 0x9272;\nexport const GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273;\nexport const GL_COMPRESSED_RGB8_ETC2 = 0x9274;\nexport const GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9275;\nexport const GL_COMPRESSED_SRGB8_ETC2 = 0x9276;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9277;\nexport const GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9278;\nexport const GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9279;\n\n// WEBGL_compressed_texture_pvrtc\nexport const GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8c00;\nexport const GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8c01;\nexport const GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8c02;\nexport const GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8c03;\n\n// WEBGL_compressed_texture_etc1\nexport const GL_COMPRESSED_RGB_ETC1_WEBGL = 0x8d64;\n\n// WEBGL_compressed_texture_atc\nexport const GL_COMPRESSED_RGB_ATC_WEBGL = 0x8c92;\nexport const GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8c93;\nexport const GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87ee;\n\n// WEBGL_compressed_texture_astc\nexport const GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93b0;\nexport const GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93b1;\nexport const GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93b2;\nexport const GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93b3;\nexport const GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93b4;\nexport const GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93b5;\nexport const GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93b6;\nexport const GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93b7;\nexport const GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93b8;\nexport const GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93b9;\nexport const GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93ba;\nexport const GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93bb;\nexport const GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93bc;\nexport const GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93bd;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93d0;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93d1;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93d2;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93d3;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93d4;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93d5;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93d6;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93d7;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93d8;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93d9;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93da;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93db;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93dc;\nexport const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93dd;\n\n// EXT_texture_compression_rgtc\nexport const GL_COMPRESSED_RED_RGTC1_EXT = 0x8dbb;\nexport const GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8dbc;\nexport const GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8dbd;\nexport const GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8dbe;\n\n// EXT_texture_compression_bptc\nexport const GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8e8c;\nexport const GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8e8d;\nexport const GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8e8e;\nexport const GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8e8f;\n\n// WEBGL_compressed_texture_s3tc_srgb\nexport const GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8c4c;\nexport const GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8c4d;\nexport const GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8c4e;\nexport const GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8c4f;\n\nexport const GL_EXTENSIONS_CONSTANTS = {\n  RGB: GL_RGB,\n  RGBA: GL_RGBA,\n  RGBA4: GL_RGBA4,\n  RGB5_A1: GL_RGB5_A1,\n  RGBA8: GL_RGBA8,\n  RGB565: GL_RGB565,\n  RGBA32F: GL_RGBA32F,\n  COMPRESSED_RGB_S3TC_DXT1_EXT: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,\n  COMPRESSED_RGBA_S3TC_DXT1_EXT: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,\n  COMPRESSED_RGBA_S3TC_DXT3_EXT: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,\n  COMPRESSED_RGBA_S3TC_DXT5_EXT: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,\n  COMPRESSED_R11_EAC: GL_COMPRESSED_R11_EAC,\n  COMPRESSED_SIGNED_R11_EAC: GL_COMPRESSED_SIGNED_R11_EAC,\n  COMPRESSED_RG11_EAC: GL_COMPRESSED_RG11_EAC,\n  COMPRESSED_SIGNED_RG11_EAC: GL_COMPRESSED_SIGNED_RG11_EAC,\n  COMPRESSED_RGB8_ETC2: GL_COMPRESSED_RGB8_ETC2,\n  COMPRESSED_RGBA8_ETC2_EAC: GL_COMPRESSED_RGBA8_ETC2_EAC,\n  COMPRESSED_SRGB8_ETC2: GL_COMPRESSED_SRGB8_ETC2,\n  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,\n  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  COMPRESSED_RGB_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,\n  COMPRESSED_RGB_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,\n  COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,\n  COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,\n  COMPRESSED_RGB_ETC1_WEBGL: GL_COMPRESSED_RGB_ETC1_WEBGL,\n  COMPRESSED_RGB_ATC_WEBGL: GL_COMPRESSED_RGB_ATC_WEBGL,\n  COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,\n  COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,\n  COMPRESSED_RGBA_ASTC_4x4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n  COMPRESSED_RGBA_ASTC_5x4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,\n  COMPRESSED_RGBA_ASTC_5x5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,\n  COMPRESSED_RGBA_ASTC_6x5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,\n  COMPRESSED_RGBA_ASTC_6x6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,\n  COMPRESSED_RGBA_ASTC_8x5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,\n  COMPRESSED_RGBA_ASTC_8x6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,\n  COMPRESSED_RGBA_ASTC_8x8_KHR: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,\n  COMPRESSED_RGBA_ASTC_10x5_KHR: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,\n  COMPRESSED_RGBA_ASTC_10x6_KHR: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,\n  COMPRESSED_RGBA_ASTC_10x8_KHR: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,\n  COMPRESSED_RGBA_ASTC_10x10_KHR: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,\n  COMPRESSED_RGBA_ASTC_12x10_KHR: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,\n  COMPRESSED_RGBA_ASTC_12x12_KHR: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,\n  COMPRESSED_RED_RGTC1_EXT: GL_COMPRESSED_RED_RGTC1_EXT,\n  COMPRESSED_SIGNED_RED_RGTC1_EXT: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,\n  COMPRESSED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,\n  COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,\n  COMPRESSED_RGBA_BPTC_UNORM_EXT: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,\n  COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,\n  COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,\n  COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,\n  COMPRESSED_SRGB_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,\n  COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,\n  COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,\n  COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,\n  // Deprecated legacy aliases with non-standard ASTC casing.\n  COMPRESSED_RGBA_ASTC_4X4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n  COMPRESSED_RGBA_ASTC_5X4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,\n  COMPRESSED_RGBA_ASTC_5X5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,\n  COMPRESSED_RGBA_ASTC_6X5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,\n  COMPRESSED_RGBA_ASTC_6X6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,\n  COMPRESSED_RGBA_ASTC_8X5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,\n  COMPRESSED_RGBA_ASTC_8X6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,\n  COMPRESSED_RGBA_ASTC_8X8_KHR: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,\n  COMPRESSED_RGBA_ASTC_10X5_KHR: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,\n  COMPRESSED_RGBA_ASTC_10X6_KHR: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,\n  COMPRESSED_RGBA_ASTC_10X8_KHR: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,\n  COMPRESSED_RGBA_ASTC_10X10_KHR: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,\n  COMPRESSED_RGBA_ASTC_12X10_KHR: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,\n  COMPRESSED_RGBA_ASTC_12X12_KHR: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR\n} as const;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {GPUTextureFormat, TextureFormat} from '@loaders.gl/schema';\n\nconst BROWSER_PREFIXES = ['', 'WEBKIT_', 'MOZ_'];\n\nconst WEBGL_TEXTURE_FORMATS: {[key: string]: TextureFormat[]} = {\n  /* eslint-disable camelcase */\n  WEBGL_compressed_texture_s3tc: [\n    'bc1-rgb-unorm-webgl',\n    'bc1-rgba-unorm',\n    'bc2-rgba-unorm',\n    'bc3-rgba-unorm'\n  ],\n  WEBGL_compressed_texture_s3tc_srgb: [\n    'bc1-rgb-unorm-srgb-webgl',\n    'bc1-rgba-unorm-srgb',\n    'bc2-rgba-unorm-srgb',\n    'bc3-rgba-unorm-srgb'\n  ],\n  EXT_texture_compression_rgtc: ['bc4-r-unorm', 'bc4-r-snorm', 'bc5-rg-unorm', 'bc5-rg-snorm'],\n  EXT_texture_compression_bptc: [\n    'bc6h-rgb-ufloat',\n    'bc6h-rgb-float',\n    'bc7-rgba-unorm',\n    'bc7-rgba-unorm-srgb'\n  ],\n  WEBGL_compressed_texture_etc1: ['etc1-rgb-unorm-webgl'],\n  WEBGL_compressed_texture_etc: [\n    'etc2-rgb8unorm',\n    'etc2-rgb8unorm-srgb',\n    'etc2-rgb8a1unorm',\n    'etc2-rgb8a1unorm-srgb',\n    'etc2-rgba8unorm',\n    'etc2-rgba8unorm-srgb',\n    'eac-r11unorm',\n    'eac-r11snorm',\n    'eac-rg11unorm',\n    'eac-rg11snorm'\n  ],\n  WEBGL_compressed_texture_pvrtc: [\n    'pvrtc-rgb4unorm-webgl',\n    'pvrtc-rgba4unorm-webgl',\n    'pvrtc-rgb2unorm-webgl',\n    'pvrtc-rgba2unorm-webgl'\n  ],\n  WEBGL_compressed_texture_atc: [\n    'atc-rgb-unorm-webgl',\n    'atc-rgba-unorm-webgl',\n    'atc-rgbai-unorm-webgl'\n  ],\n  WEBGL_compressed_texture_astc: [\n    'astc-4x4-unorm',\n    'astc-4x4-unorm-srgb',\n    'astc-5x4-unorm',\n    'astc-5x4-unorm-srgb',\n    'astc-5x5-unorm',\n    'astc-5x5-unorm-srgb',\n    'astc-6x5-unorm',\n    'astc-6x5-unorm-srgb',\n    'astc-6x6-unorm',\n    'astc-6x6-unorm-srgb',\n    'astc-8x5-unorm',\n    'astc-8x5-unorm-srgb',\n    'astc-8x6-unorm',\n    'astc-8x6-unorm-srgb',\n    'astc-8x8-unorm',\n    'astc-8x8-unorm-srgb',\n    'astc-10x5-unorm',\n    'astc-10x5-unorm-srgb',\n    'astc-10x6-unorm',\n    'astc-10x6-unorm-srgb',\n    'astc-10x8-unorm',\n    'astc-10x8-unorm-srgb',\n    'astc-10x10-unorm',\n    'astc-10x10-unorm-srgb',\n    'astc-12x10-unorm',\n    'astc-12x10-unorm-srgb',\n    'astc-12x12-unorm',\n    'astc-12x12-unorm-srgb'\n  ]\n  /* eslint-enable camelcase */\n};\n\nconst GPU_TEXTURE_FORMATS: {[key in GPUTextureFormat]: TextureFormat[]} = {\n  dxt: ['bc1-rgb-unorm-webgl', 'bc1-rgba-unorm', 'bc2-rgba-unorm', 'bc3-rgba-unorm'],\n  'dxt-srgb': [\n    'bc1-rgb-unorm-srgb-webgl',\n    'bc1-rgba-unorm-srgb',\n    'bc2-rgba-unorm-srgb',\n    'bc3-rgba-unorm-srgb'\n  ],\n  etc1: ['etc1-rgb-unorm-webgl'],\n  etc2: [\n    'etc2-rgb8unorm',\n    'etc2-rgb8unorm-srgb',\n    'etc2-rgb8a1unorm',\n    'etc2-rgb8a1unorm-srgb',\n    'etc2-rgba8unorm',\n    'etc2-rgba8unorm-srgb',\n    'eac-r11unorm',\n    'eac-r11snorm',\n    'eac-rg11unorm',\n    'eac-rg11snorm'\n  ],\n  pvrtc: [\n    'pvrtc-rgb4unorm-webgl',\n    'pvrtc-rgba4unorm-webgl',\n    'pvrtc-rgb2unorm-webgl',\n    'pvrtc-rgba2unorm-webgl'\n  ],\n  atc: ['atc-rgb-unorm-webgl', 'atc-rgba-unorm-webgl', 'atc-rgbai-unorm-webgl'],\n  astc: [\n    'astc-4x4-unorm',\n    'astc-4x4-unorm-srgb',\n    'astc-5x4-unorm',\n    'astc-5x4-unorm-srgb',\n    'astc-5x5-unorm',\n    'astc-5x5-unorm-srgb',\n    'astc-6x5-unorm',\n    'astc-6x5-unorm-srgb',\n    'astc-6x6-unorm',\n    'astc-6x6-unorm-srgb',\n    'astc-8x5-unorm',\n    'astc-8x5-unorm-srgb',\n    'astc-8x6-unorm',\n    'astc-8x6-unorm-srgb',\n    'astc-8x8-unorm',\n    'astc-8x8-unorm-srgb',\n    'astc-10x5-unorm',\n    'astc-10x5-unorm-srgb',\n    'astc-10x6-unorm',\n    'astc-10x6-unorm-srgb',\n    'astc-10x8-unorm',\n    'astc-10x8-unorm-srgb',\n    'astc-10x10-unorm',\n    'astc-10x10-unorm-srgb',\n    'astc-12x10-unorm',\n    'astc-12x10-unorm-srgb',\n    'astc-12x12-unorm',\n    'astc-12x12-unorm-srgb'\n  ],\n  rgtc: ['bc4-r-unorm', 'bc4-r-snorm', 'bc5-rg-unorm', 'bc5-rg-snorm']\n};\n\nlet formats: Set<GPUTextureFormat> | null = null;\nlet textureFormats: Set<TextureFormat> | null = null;\n\n// DEPRECATED\n/**\n * @deprecated Pass `basis.supportedTextureFormats` to Basis loaders instead of relying on global detection.\n */\nexport function detectSupportedTextureFormats(gl?: WebGLRenderingContext): Set<TextureFormat> {\n  if (!textureFormats) {\n    gl = gl || getWebGLContext() || undefined;\n    textureFormats = new Set<TextureFormat>();\n\n    for (const prefix of BROWSER_PREFIXES) {\n      for (const extension in WEBGL_TEXTURE_FORMATS) {\n        if (gl && gl.getExtension(`${prefix}${extension}`)) {\n          for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {\n            textureFormats.add(textureFormat);\n          }\n        }\n      }\n    }\n  }\n\n  return textureFormats;\n}\n\n// DEPRECATED\n/**\n * Returns a list of formats.\n * Creates a temporary WebGLRenderingContext if none is provided.\n *\n * @deprecated Pass `basis.supportedTextureFormats` to Basis loaders instead of relying on global detection.\n * @param gl - Optional context.\n */\nexport function detectSupportedGPUTextureFormats(gl?: WebGLRenderingContext): Set<string> {\n  if (!formats) {\n    formats = new Set<GPUTextureFormat>();\n    const supportedTextureFormats = detectSupportedTextureFormats(gl);\n\n    for (const gpuTextureFormat in GPU_TEXTURE_FORMATS) {\n      const textureFormatsForGroup = GPU_TEXTURE_FORMATS[gpuTextureFormat as GPUTextureFormat];\n      if (\n        textureFormatsForGroup.some((textureFormat) => supportedTextureFormats.has(textureFormat))\n      ) {\n        formats.add(gpuTextureFormat as GPUTextureFormat);\n      }\n    }\n  }\n\n  return formats;\n}\n\n/**\n * @returns {WebGLRenderingContext?}\n */\nfunction getWebGLContext() {\n  try {\n    const canvas = document.createElement('canvas');\n    return canvas.getContext('webgl');\n  } catch (error) {\n    return null;\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TextureLevel} from '@loaders.gl/schema';\nimport {log} from '@loaders.gl/loader-utils';\nimport {read} from 'ktx-parse';\nimport {extractMipmapImages} from '../utils/extract-mipmap-images';\nimport {mapVkFormatToTextureFormat} from '../utils/ktx-format-helper';\n\nconst KTX2_ID = [\n  // '\u00B4', 'K', 'T', 'X', '2', '0', '\u00AA', '\\r', '\\n', '\\x1A', '\\n'\n  0xab, 0x4b, 0x54, 0x58, 0x20, 0x32, 0x30, 0xbb, 0x0d, 0x0a, 0x1a, 0x0a\n];\n\n// eslint-disable-next-line complexity\nexport function isKTX(data: ArrayBuffer) {\n  // const id = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n  const id = new Uint8Array(data);\n  const notKTX =\n    id.byteLength < KTX2_ID.length ||\n    id[0] !== KTX2_ID[0] || // '\u00B4'\n    id[1] !== KTX2_ID[1] || // 'K'\n    id[2] !== KTX2_ID[2] || // 'T'\n    id[3] !== KTX2_ID[3] || // 'X'\n    id[4] !== KTX2_ID[4] || // ' '\n    id[5] !== KTX2_ID[5] || // '2'\n    id[6] !== KTX2_ID[6] || // '0'\n    id[7] !== KTX2_ID[7] || // '\u00AA'\n    id[8] !== KTX2_ID[8] || // '\\r'\n    id[9] !== KTX2_ID[9] || // '\\n'\n    id[10] !== KTX2_ID[10] || // '\\x1A'\n    id[11] !== KTX2_ID[11]; // '\\n'\n\n  return !notKTX;\n}\n\nexport function parseKTX(arrayBuffer: ArrayBuffer): TextureLevel[] {\n  const uint8Array = new Uint8Array(arrayBuffer);\n  const ktx = read(uint8Array);\n  const mipMapLevels = Math.max(1, ktx.levels.length);\n  const width = ktx.pixelWidth;\n  const height = ktx.pixelHeight;\n  const textureFormat = mapVkFormatToTextureFormat(ktx.vkFormat);\n\n  if (textureFormat === undefined) {\n    // TODO: Basis-backed and otherwise unknown-format KTX2 files should preserve the\n    // legacy CompressedTextureLoader behavior for now. Do not fail here or add implicit\n    // transcoding in this parser path; just return levels without `format` metadata.\n    log.warn(\n      `KTX2 container vkFormat ${ktx.vkFormat} does not map to a known texture format; returning texture levels without format metadata.`\n    )();\n  }\n\n  return extractMipmapImages(ktx.levels, {\n    mipMapLevels,\n    width,\n    height,\n    sizeFunction: (level: any): number => level.uncompressedByteLength,\n    textureFormat\n  });\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\nimport type {TextureFormat} from '@loaders.gl/schema';\nimport type {GLTextureFormat} from '../gl-types';\nimport {\n  GL_RGBA32F,\n  GL_COMPRESSED_R11_EAC,\n  GL_COMPRESSED_RED_GREEN_RGTC2_EXT,\n  GL_COMPRESSED_RED_RGTC1_EXT,\n  GL_COMPRESSED_RG11_EAC,\n  GL_COMPRESSED_RGB8_ETC2,\n  GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  GL_COMPRESSED_RGB_ATC_WEBGL,\n  GL_COMPRESSED_RGB_ETC1_WEBGL,\n  GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,\n  GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,\n  GL_COMPRESSED_RGB_S3TC_DXT1_EXT,\n  GL_COMPRESSED_RGBA8_ETC2_EAC,\n  GL_COMPRESSED_RGBA_ASTC_10x10_KHR,\n  GL_COMPRESSED_RGBA_ASTC_10x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_10x6_KHR,\n  GL_COMPRESSED_RGBA_ASTC_10x8_KHR,\n  GL_COMPRESSED_RGBA_ASTC_12x10_KHR,\n  GL_COMPRESSED_RGBA_ASTC_12x12_KHR,\n  GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n  GL_COMPRESSED_RGBA_ASTC_5x4_KHR,\n  GL_COMPRESSED_RGBA_ASTC_5x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_6x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_6x6_KHR,\n  GL_COMPRESSED_RGBA_ASTC_8x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_8x6_KHR,\n  GL_COMPRESSED_RGBA_ASTC_8x8_KHR,\n  GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,\n  GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,\n  GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,\n  GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,\n  GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,\n  GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,\n  GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,\n  GL_COMPRESSED_SIGNED_R11_EAC,\n  GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,\n  GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,\n  GL_COMPRESSED_SIGNED_RG11_EAC,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,\n  GL_COMPRESSED_SRGB8_ETC2,\n  GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,\n  GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,\n  GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,\n  GL_COMPRESSED_SRGB_S3TC_DXT1_EXT\n} from '../gl-extensions';\n\nconst WEBGL_TO_TEXTURE_FORMAT: Record<number, TextureFormat> = {\n  [GL_RGBA32F]: 'rgba32float',\n  [GL_COMPRESSED_RGB_S3TC_DXT1_EXT]: 'bc1-rgb-unorm-webgl',\n  [GL_COMPRESSED_SRGB_S3TC_DXT1_EXT]: 'bc1-rgb-unorm-srgb-webgl',\n  [GL_COMPRESSED_RGBA_S3TC_DXT1_EXT]: 'bc1-rgba-unorm',\n  [GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]: 'bc1-rgba-unorm-srgb',\n  [GL_COMPRESSED_RGBA_S3TC_DXT3_EXT]: 'bc2-rgba-unorm',\n  [GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]: 'bc2-rgba-unorm-srgb',\n  [GL_COMPRESSED_RGBA_S3TC_DXT5_EXT]: 'bc3-rgba-unorm',\n  [GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]: 'bc3-rgba-unorm-srgb',\n  [GL_COMPRESSED_RED_RGTC1_EXT]: 'bc4-r-unorm',\n  [GL_COMPRESSED_SIGNED_RED_RGTC1_EXT]: 'bc4-r-snorm',\n  [GL_COMPRESSED_RED_GREEN_RGTC2_EXT]: 'bc5-rg-unorm',\n  [GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT]: 'bc5-rg-snorm',\n  [GL_COMPRESSED_RGB8_ETC2]: 'etc2-rgb8unorm',\n  [GL_COMPRESSED_SRGB8_ETC2]: 'etc2-rgb8unorm-srgb',\n  [GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]: 'etc2-rgb8a1unorm',\n  [GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]: 'etc2-rgb8a1unorm-srgb',\n  [GL_COMPRESSED_RGBA8_ETC2_EAC]: 'etc2-rgba8unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]: 'etc2-rgba8unorm-srgb',\n  [GL_COMPRESSED_R11_EAC]: 'eac-r11unorm',\n  [GL_COMPRESSED_SIGNED_R11_EAC]: 'eac-r11snorm',\n  [GL_COMPRESSED_RG11_EAC]: 'eac-rg11unorm',\n  [GL_COMPRESSED_SIGNED_RG11_EAC]: 'eac-rg11snorm',\n  [GL_COMPRESSED_RGBA_ASTC_4x4_KHR]: 'astc-4x4-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR]: 'astc-4x4-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_5x4_KHR]: 'astc-5x4-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR]: 'astc-5x4-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_5x5_KHR]: 'astc-5x5-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR]: 'astc-5x5-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_6x5_KHR]: 'astc-6x5-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR]: 'astc-6x5-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_6x6_KHR]: 'astc-6x6-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR]: 'astc-6x6-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_8x5_KHR]: 'astc-8x5-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR]: 'astc-8x5-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_8x6_KHR]: 'astc-8x6-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR]: 'astc-8x6-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_8x8_KHR]: 'astc-8x8-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR]: 'astc-8x8-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_10x5_KHR]: 'astc-10x5-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR]: 'astc-10x5-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_10x6_KHR]: 'astc-10x6-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR]: 'astc-10x6-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_10x8_KHR]: 'astc-10x8-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR]: 'astc-10x8-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_10x10_KHR]: 'astc-10x10-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR]: 'astc-10x10-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_12x10_KHR]: 'astc-12x10-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR]: 'astc-12x10-unorm-srgb',\n  [GL_COMPRESSED_RGBA_ASTC_12x12_KHR]: 'astc-12x12-unorm',\n  [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR]: 'astc-12x12-unorm-srgb',\n  [GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG]: 'pvrtc-rgb4unorm-webgl',\n  [GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]: 'pvrtc-rgba4unorm-webgl',\n  [GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG]: 'pvrtc-rgb2unorm-webgl',\n  [GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]: 'pvrtc-rgba2unorm-webgl',\n  [GL_COMPRESSED_RGB_ETC1_WEBGL]: 'etc1-rgb-unorm-webgl',\n  [GL_COMPRESSED_RGB_ATC_WEBGL]: 'atc-rgb-unorm-webgl',\n  [GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]: 'atc-rgba-unorm-webgl',\n  [GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]: 'atc-rgbai-unorm-webgl'\n};\n\nconst TEXTURE_FORMAT_TO_WEBGL = Object.fromEntries(\n  Object.entries(WEBGL_TO_TEXTURE_FORMAT).map(([format, textureFormat]) => [\n    textureFormat,\n    Number(format)\n  ])\n) as Partial<Record<TextureFormat, GLTextureFormat>>;\n\nexport function getTextureFormatFromWebGLFormat(\n  format?: GLTextureFormat\n): TextureFormat | undefined {\n  if (format === undefined) {\n    return undefined;\n  }\n\n  return WEBGL_TO_TEXTURE_FORMAT[format];\n}\n\n/**\n * Returns the WebGL/OpenGL compressed texture constant for a canonical loaders.gl texture format.\n * @param textureFormat - Canonical texture format string.\n * @returns Matching WebGL/OpenGL constant, if known.\n */\nexport function getWebGLFormatFromTextureFormat(\n  textureFormat?: TextureFormat\n): GLTextureFormat | undefined {\n  if (textureFormat === undefined) {\n    return undefined;\n  }\n\n  return TEXTURE_FORMAT_TO_WEBGL[textureFormat];\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TextureFormat, TextureLevel} from '@loaders.gl/schema';\nimport type {GLTextureFormat} from '../gl-types';\nimport {\n  getTextureFormatFromWebGLFormat,\n  getWebGLFormatFromTextureFormat\n} from './texture-format-map';\n\nexport type CompressedTextureExtractOptions = {\n  mipMapLevels: number;\n  width: number;\n  height: number;\n  sizeFunction: Function;\n  internalFormat?: GLTextureFormat;\n  /** Canonical loaders.gl texture format for the mip levels being extracted. */\n  textureFormat?: TextureFormat;\n};\n\n/**\n * Extract mipmap images from compressed texture buffer\n * @param data - binary data of compressed texture or Array of level objects\n * @param options.mipMapLevels - number of mipmap level inside image\n * @param options.width - width of 0 - level\n * @param options.height - height of 0 - level\n * @param options.sizeFunction - format-related function to calculate level size in bytes\n * @param options.internalFormat - WebGL compatible format code\n * @param options.textureFormat - canonical loaders.gl texture format\n * @returns Array of the texture levels\n */\nexport function extractMipmapImages(\n  data: Uint8Array | object[],\n  options: CompressedTextureExtractOptions\n): TextureLevel[] {\n  const images = new Array(options.mipMapLevels);\n  const textureFormat =\n    options.textureFormat || getTextureFormatFromWebGLFormat(options.internalFormat);\n  const format = options.internalFormat || getWebGLFormatFromTextureFormat(options.textureFormat);\n\n  let levelWidth = options.width;\n  let levelHeight = options.height;\n  let offset = 0;\n\n  for (let i = 0; i < options.mipMapLevels; ++i) {\n    // @ts-expect-error\n    const levelSize = getLevelSize(options, levelWidth, levelHeight, data, i);\n    // @ts-expect-error\n    const levelData = getLevelData(data, i, offset, levelSize);\n\n    const image: TextureLevel = {\n      shape: 'texture-level',\n      compressed: true,\n      data: levelData,\n      width: levelWidth,\n      height: levelHeight,\n      levelSize\n    };\n\n    if (format !== undefined) {\n      image.format = format;\n    }\n    if (textureFormat) {\n      image.textureFormat = textureFormat;\n    }\n    images[i] = image;\n\n    levelWidth = Math.max(1, levelWidth >> 1);\n    levelHeight = Math.max(1, levelHeight >> 1);\n\n    offset += levelSize;\n  }\n  return images;\n}\n\nfunction getLevelData(\n  data: Uint8Array,\n  index: number,\n  offset: number,\n  levelSize: number\n): Uint8Array {\n  if (!Array.isArray(data)) {\n    return new Uint8Array(data.buffer, data.byteOffset + offset, levelSize);\n  }\n\n  return data[index].levelData;\n}\n\nfunction getLevelSize(\n  options: CompressedTextureExtractOptions,\n  levelWidth: number,\n  levelHeight: number,\n  data: Uint8Array[] | object[],\n  index: number\n): number {\n  if (!Array.isArray(data)) {\n    return options.sizeFunction(levelWidth, levelHeight);\n  }\n  return options.sizeFunction(data[index]);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\nimport type {TextureFormat} from '@loaders.gl/schema';\nimport type {GLTextureFormat} from '../gl-types';\nimport {\n  GL_COMPRESSED_R11_EAC,\n  GL_COMPRESSED_RED_GREEN_RGTC2_EXT,\n  GL_COMPRESSED_RED_RGTC1_EXT,\n  GL_COMPRESSED_RG11_EAC,\n  GL_COMPRESSED_RGB8_ETC2,\n  GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  GL_COMPRESSED_RGBA8_ETC2_EAC,\n  GL_COMPRESSED_RGBA_ASTC_10x10_KHR,\n  GL_COMPRESSED_RGBA_ASTC_10x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_10x6_KHR,\n  GL_COMPRESSED_RGBA_ASTC_10x8_KHR,\n  GL_COMPRESSED_RGBA_ASTC_12x10_KHR,\n  GL_COMPRESSED_RGBA_ASTC_12x12_KHR,\n  GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n  GL_COMPRESSED_RGBA_ASTC_5x4_KHR,\n  GL_COMPRESSED_RGBA_ASTC_5x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_6x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_6x6_KHR,\n  GL_COMPRESSED_RGBA_ASTC_8x5_KHR,\n  GL_COMPRESSED_RGBA_ASTC_8x6_KHR,\n  GL_COMPRESSED_RGBA_ASTC_8x8_KHR,\n  GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,\n  GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,\n  GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,\n  GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,\n  GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,\n  GL_COMPRESSED_RGB_S3TC_DXT1_EXT,\n  GL_COMPRESSED_SIGNED_R11_EAC,\n  GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,\n  GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,\n  GL_COMPRESSED_SIGNED_RG11_EAC,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,\n  GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,\n  GL_COMPRESSED_SRGB8_ETC2,\n  GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,\n  GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,\n  GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,\n  GL_COMPRESSED_SRGB_S3TC_DXT1_EXT\n} from '../gl-extensions';\nimport {getTextureFormatFromWebGLFormat} from './texture-format-map';\n\nconst VULKAN_TO_WEBGL_FORMAT_MAP: Record<number, GLTextureFormat> = {\n  131: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,\n  132: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,\n  133: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,\n  134: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,\n  135: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,\n  136: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,\n  137: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,\n  138: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,\n  139: GL_COMPRESSED_RED_RGTC1_EXT,\n  140: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,\n  141: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,\n  142: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,\n  147: GL_COMPRESSED_RGB8_ETC2,\n  148: GL_COMPRESSED_SRGB8_ETC2,\n  149: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  150: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n  151: GL_COMPRESSED_RGBA8_ETC2_EAC,\n  152: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,\n  153: GL_COMPRESSED_R11_EAC,\n  154: GL_COMPRESSED_SIGNED_R11_EAC,\n  155: GL_COMPRESSED_RG11_EAC,\n  156: GL_COMPRESSED_SIGNED_RG11_EAC,\n  157: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n  158: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,\n  159: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,\n  160: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,\n  161: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,\n  162: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,\n  163: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,\n  164: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,\n  165: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,\n  166: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,\n  167: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,\n  168: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,\n  169: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,\n  170: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,\n  171: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,\n  172: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,\n  173: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,\n  174: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,\n  175: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,\n  176: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,\n  177: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,\n  178: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,\n  179: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,\n  180: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,\n  181: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,\n  182: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,\n  183: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,\n  184: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,\n  1000054000: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,\n  1000054001: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,\n  1000066000: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,\n  1000066001: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,\n  1000066002: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,\n  1000066003: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,\n  1000066004: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,\n  1000066005: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,\n  1000066006: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,\n  1000066007: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,\n  1000066008: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,\n  1000066009: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,\n  1000066010: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,\n  1000066011: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,\n  1000066012: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,\n  1000066013: GL_COMPRESSED_RGBA_ASTC_12x12_KHR\n};\n\n/**\n * Returns WebGl format based on Vulkan format\n * Vulkan to WebGl format mapping provided here http://github.khronos.org/KTX-Specification/#formatMapping\n * Vulkan name to format number mapping provided here: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkFormat.html\n * @param vkFormat\n * @returns WebGL / OpenGL constant\n */\nexport function mapVkFormatToWebGL(vkFormat: number): GLTextureFormat | undefined {\n  return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];\n}\n\n/**\n * Returns the canonical loaders.gl texture format corresponding to a Vulkan `vkFormat` value.\n * @param vkFormat - Vulkan format constant from the KTX container.\n * @returns Canonical texture format string, if known.\n */\nexport function mapVkFormatToTextureFormat(vkFormat: number): TextureFormat | undefined {\n  return getTextureFormatFromWebGLFormat(mapVkFormatToWebGL(vkFormat));\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {TextureFormat, TextureLevel} from '@loaders.gl/schema';\nimport {VERSION} from './lib/utils/version';\nimport {parseBasis} from './lib/parsers/parse-basis';\nimport type {BasisFormat} from './lib/parsers/parse-basis';\n\ntype BasisFormatOption = BasisFormat | Uppercase<BasisFormat>;\ntype BasisTargetFormat =\n  | 'auto'\n  | BasisFormatOption\n  | {\n      alpha: BasisFormatOption;\n      noAlpha: BasisFormatOption;\n    };\n\n/** Options for the BasisLoader */\nexport type BasisLoaderOptions = LoaderOptions & {\n  /** Options for the BasisLoader */\n  basis?: {\n    /** Supported texture formats - app would typically query a WebGPU device or WebGL context to obtain the list of supported formats.*/\n    supportedTextureFormats?: TextureFormat[];\n    /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n    workerUrl?: string;\n\n    /** What container format is used? */\n    containerFormat?: 'auto' | 'ktx2' | 'basis';\n    /** Format for texture data. auto selects based on platform caps (but gl context doesn't exist on a worker thread) */\n    format?: BasisTargetFormat;\n    /** What module to use for transcoding? */\n    module?: 'transcoder' | 'encoder';\n  };\n};\n\n/**\n * Worker loader for Basis super compressed textures\n */\nexport const BasisWorkerLoader = {\n  dataType: null as unknown as TextureLevel[][],\n  batchType: null as never,\n\n  name: 'Basis',\n  id: 'basis',\n  module: 'textures',\n  version: VERSION,\n  worker: true,\n  extensions: ['basis', 'ktx2'],\n  mimeTypes: ['application/octet-stream', 'image/ktx2'],\n  tests: ['sB'],\n  binary: true,\n  options: {\n    basis: {\n      format: 'auto',\n      containerFormat: 'auto',\n      module: 'transcoder'\n    }\n  }\n} as const satisfies Loader<TextureLevel[][], never, BasisLoaderOptions>;\n\n/**\n * Loader for Basis super compressed textures\n */\nexport const BasisLoader = {\n  ...BasisWorkerLoader,\n  parse: parseBasis\n} as const satisfies LoaderWithParser<TextureLevel[][], never, LoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TextureFormat, TextureLevel} from '@loaders.gl/schema';\nimport {assert} from '@loaders.gl/loader-utils';\nimport {extractMipmapImages} from '../utils/extract-mipmap-images';\n\nconst DDS_CONSTANTS = {\n  MAGIC_NUMBER: 0x20534444,\n  HEADER_LENGTH: 31,\n  MAGIC_NUMBER_INDEX: 0,\n  HEADER_SIZE_INDEX: 1,\n  HEADER_FLAGS_INDEX: 2,\n  HEADER_HEIGHT_INDEX: 3,\n  HEADER_WIDTH_INDEX: 4,\n  MIPMAPCOUNT_INDEX: 7,\n  HEADER_PF_FLAGS_INDEX: 20,\n  HEADER_PF_FOURCC_INDEX: 21,\n  DDSD_MIPMAPCOUNT: 0x20000,\n  DDPF_FOURCC: 0x4\n};\n\nconst DDS_TEXTURE_FORMATS: Record<string, TextureFormat> = {\n  DXT1: 'bc1-rgb-unorm-webgl',\n  DXT3: 'bc2-rgba-unorm',\n  DXT5: 'bc3-rgba-unorm',\n  'ATC ': 'atc-rgb-unorm-webgl',\n  ATCA: 'atc-rgba-unorm-webgl',\n  ATCI: 'atc-rgbai-unorm-webgl'\n};\n\nconst getATCLevelSize = getDxt1LevelSize;\nconst getATCALevelSize = getDxtXLevelSize;\nconst getATCILevelSize = getDxtXLevelSize;\n\nconst DDS_SIZE_FUNCTIONS: Record<string, (width: number, height: number) => number> = {\n  DXT1: getDxt1LevelSize,\n  DXT3: getDxtXLevelSize,\n  DXT5: getDxtXLevelSize,\n  'ATC ': getATCLevelSize,\n  ATCA: getATCALevelSize,\n  ATCI: getATCILevelSize\n};\n\n/**\n * Check if data is in \"DDS\" format by its magic number\n * @param data - binary data of compressed texture\n * @returns true - data in \"DDS\" format, else - false\n */\nexport function isDDS(data: ArrayBuffer): boolean {\n  const header = new Uint32Array(data, 0, DDS_CONSTANTS.HEADER_LENGTH);\n  const magic = header[DDS_CONSTANTS.MAGIC_NUMBER_INDEX];\n  return magic === DDS_CONSTANTS.MAGIC_NUMBER;\n}\n\n/**\n * Parse texture data as \"DDS\" format\n * @param data - binary data of compressed texture\n * @returns Array of the texture levels\n */\nexport function parseDDS(data: ArrayBuffer): TextureLevel[] {\n  const header = new Int32Array(data, 0, DDS_CONSTANTS.HEADER_LENGTH);\n  const pixelFormatNumber = header[DDS_CONSTANTS.HEADER_PF_FOURCC_INDEX];\n  assert(\n    Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC),\n    'DDS: Unsupported format, must contain a FourCC code'\n  );\n  const fourCC = int32ToFourCC(pixelFormatNumber);\n  const textureFormat = DDS_TEXTURE_FORMATS[fourCC];\n  const sizeFunction = DDS_SIZE_FUNCTIONS[fourCC];\n  assert(textureFormat && sizeFunction, `DDS: Unknown pixel format ${pixelFormatNumber}`);\n\n  let mipMapLevels = 1;\n  if (header[DDS_CONSTANTS.HEADER_FLAGS_INDEX] & DDS_CONSTANTS.DDSD_MIPMAPCOUNT) {\n    mipMapLevels = Math.max(1, header[DDS_CONSTANTS.MIPMAPCOUNT_INDEX]);\n  }\n  const width = header[DDS_CONSTANTS.HEADER_WIDTH_INDEX];\n  const height = header[DDS_CONSTANTS.HEADER_HEIGHT_INDEX];\n  const dataOffset = header[DDS_CONSTANTS.HEADER_SIZE_INDEX] + 4;\n  const image = new Uint8Array(data, dataOffset);\n\n  return extractMipmapImages(image, {\n    mipMapLevels,\n    width,\n    height,\n    sizeFunction,\n    textureFormat\n  });\n}\n\n/**\n * DXT1 applicable function to calculate level size\n * @param width - level width\n * @param height - level height\n * @returns level size in bytes\n */\nexport function getDxt1LevelSize(width: number, height: number): number {\n  return ((width + 3) >> 2) * ((height + 3) >> 2) * 8;\n}\n\n/**\n * DXT3 & DXT5 applicable function to calculate level size\n * @param width - level width\n * @param height - level height\n * @returns level size in bytes\n */\nexport function getDxtXLevelSize(width: number, height: number): number {\n  return ((width + 3) >> 2) * ((height + 3) >> 2) * 16;\n}\n\n/**\n * Convert every byte of Int32 value to char\n * @param value - Int32 number\n * @returns string of 4 characters\n */\nfunction int32ToFourCC(value: number): string {\n  return String.fromCharCode(\n    value & 0xff,\n    (value >> 8) & 0xff,\n    (value >> 16) & 0xff,\n    (value >> 24) & 0xff\n  );\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\n// Forked from PicoGL: https://github.com/tsherif/picogl.js/blob/master/examples/utils/utils.js\n// Copyright (c) 2017 Tarek Sherif, The MIT License (MIT)\n\nimport type {TextureFormat, TextureLevel} from '@loaders.gl/schema';\nimport {extractMipmapImages} from '../utils/extract-mipmap-images';\n\nconst PVR_CONSTANTS: Record<string, number> = {\n  MAGIC_NUMBER: 0x03525650,\n  MAGIC_NUMBER_EXTRA: 0x50565203,\n  HEADER_LENGTH: 13,\n  HEADER_SIZE: 52,\n  MAGIC_NUMBER_INDEX: 0,\n  PIXEL_FORMAT_INDEX: 2,\n  COLOUR_SPACE_INDEX: 4,\n  HEIGHT_INDEX: 6,\n  WIDTH_INDEX: 7,\n  MIPMAPCOUNT_INDEX: 11,\n  METADATA_SIZE_INDEX: 12\n};\n\nconst PVR_TEXTURE_FORMATS: Record<number, TextureFormat[]> = {\n  0: ['pvrtc-rgb2unorm-webgl'],\n  1: ['pvrtc-rgba2unorm-webgl'],\n  2: ['pvrtc-rgb4unorm-webgl'],\n  3: ['pvrtc-rgba4unorm-webgl'],\n  6: ['etc1-rgb-unorm-webgl'],\n  7: ['bc1-rgb-unorm-webgl'],\n  9: ['bc2-rgba-unorm'],\n  11: ['bc3-rgba-unorm'],\n  22: ['etc2-rgb8unorm'],\n  23: ['etc2-rgba8unorm'],\n  24: ['etc2-rgb8a1unorm'],\n  25: ['eac-r11unorm'],\n  26: ['eac-rg11unorm'],\n  27: ['astc-4x4-unorm', 'astc-4x4-unorm-srgb'],\n  28: ['astc-5x4-unorm', 'astc-5x4-unorm-srgb'],\n  29: ['astc-5x5-unorm', 'astc-5x5-unorm-srgb'],\n  30: ['astc-6x5-unorm', 'astc-6x5-unorm-srgb'],\n  31: ['astc-6x6-unorm', 'astc-6x6-unorm-srgb'],\n  32: ['astc-8x5-unorm', 'astc-8x5-unorm-srgb'],\n  33: ['astc-8x6-unorm', 'astc-8x6-unorm-srgb'],\n  34: ['astc-8x8-unorm', 'astc-8x8-unorm-srgb'],\n  35: ['astc-10x5-unorm', 'astc-10x5-unorm-srgb'],\n  36: ['astc-10x6-unorm', 'astc-10x6-unorm-srgb'],\n  37: ['astc-10x8-unorm', 'astc-10x8-unorm-srgb'],\n  38: ['astc-10x10-unorm', 'astc-10x10-unorm-srgb'],\n  39: ['astc-12x10-unorm', 'astc-12x10-unorm-srgb'],\n  40: ['astc-12x12-unorm', 'astc-12x12-unorm-srgb']\n};\n\nconst PVR_SIZE_FUNCTIONS: Record<number, (width: number, height: number) => number> = {\n  0: pvrtc2bppSize,\n  1: pvrtc2bppSize,\n  2: pvrtc4bppSize,\n  3: pvrtc4bppSize,\n  6: dxtEtcSmallSize,\n  7: dxtEtcSmallSize,\n  9: dxtEtcAstcBigSize,\n  11: dxtEtcAstcBigSize,\n  22: dxtEtcSmallSize,\n  23: dxtEtcAstcBigSize,\n  24: dxtEtcSmallSize,\n  25: dxtEtcSmallSize,\n  26: dxtEtcAstcBigSize,\n  27: dxtEtcAstcBigSize,\n  28: atc5x4Size,\n  29: atc5x5Size,\n  30: atc6x5Size,\n  31: atc6x6Size,\n  32: atc8x5Size,\n  33: atc8x6Size,\n  34: atc8x8Size,\n  35: atc10x5Size,\n  36: atc10x6Size,\n  37: atc10x8Size,\n  38: atc10x10Size,\n  39: atc12x10Size,\n  40: atc12x12Size\n};\n\n/**\n * Check if data is in \"PVR\" format by its magic number\n * @param data - binary data of compressed texture\n * @returns true - data in \"PVR\" format, else - false\n */\nexport function isPVR(data: ArrayBuffer): boolean {\n  const header = new Uint32Array(data, 0, PVR_CONSTANTS.HEADER_LENGTH);\n  const version = header[PVR_CONSTANTS.MAGIC_NUMBER_INDEX];\n\n  return version === PVR_CONSTANTS.MAGIC_NUMBER || version === PVR_CONSTANTS.MAGIC_NUMBER_EXTRA;\n}\n\n/**\n * Parse texture data as \"PVR\" format\n * @param data - binary data of compressed texture\n * @returns Array of the texture levels\n * @see http://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf\n */\nexport function parsePVR(data: ArrayBuffer): TextureLevel[] {\n  const header = new Uint32Array(data, 0, PVR_CONSTANTS.HEADER_LENGTH);\n\n  const pvrFormat = header[PVR_CONSTANTS.PIXEL_FORMAT_INDEX];\n  const colourSpace = header[PVR_CONSTANTS.COLOUR_SPACE_INDEX];\n  const textureFormats = PVR_TEXTURE_FORMATS[pvrFormat] || [];\n  const textureFormat =\n    textureFormats.length > 1 && colourSpace ? textureFormats[1] : textureFormats[0];\n\n  const sizeFunction = PVR_SIZE_FUNCTIONS[pvrFormat];\n\n  const mipMapLevels = header[PVR_CONSTANTS.MIPMAPCOUNT_INDEX];\n\n  const width = header[PVR_CONSTANTS.WIDTH_INDEX];\n  const height = header[PVR_CONSTANTS.HEIGHT_INDEX];\n\n  const dataOffset = PVR_CONSTANTS.HEADER_SIZE + header[PVR_CONSTANTS.METADATA_SIZE_INDEX];\n\n  const image = new Uint8Array(data, dataOffset);\n\n  return extractMipmapImages(image, {\n    mipMapLevels,\n    width,\n    height,\n    sizeFunction,\n    textureFormat\n  });\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/\nfunction pvrtc2bppSize(width: number, height: number): number {\n  width = Math.max(width, 16);\n  height = Math.max(height, 8);\n\n  return (width * height) / 4;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/\nfunction pvrtc4bppSize(width: number, height: number): number {\n  width = Math.max(width, 8);\n  height = Math.max(height, 8);\n\n  return (width * height) / 2;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc/\n// Size for:\n// COMPRESSED_RGB_S3TC_DXT1_EXT\n// COMPRESSED_R11_EAC\n// COMPRESSED_SIGNED_R11_EAC\n// COMPRESSED_RGB8_ETC2\n// COMPRESSED_SRGB8_ETC2\n// COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2\n// COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2\nfunction dxtEtcSmallSize(width: number, height: number): number {\n  return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc/\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\n// Size for:\n// COMPRESSED_RGBA_S3TC_DXT3_EXT\n// COMPRESSED_RGBA_S3TC_DXT5_EXT\n// COMPRESSED_RG11_EAC\n// COMPRESSED_SIGNED_RG11_EAC\n// COMPRESSED_RGBA8_ETC2_EAC\n// COMPRESSED_SRGB8_ALPHA8_ETC2_EAC\n// COMPRESSED_RGBA_ASTC_4x4_KHR\nfunction dxtEtcAstcBigSize(width: number, height: number): number {\n  return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc5x4Size(width: number, height: number): number {\n  return Math.floor((width + 4) / 5) * Math.floor((height + 3) / 4) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc5x5Size(width: number, height: number): number {\n  return Math.floor((width + 4) / 5) * Math.floor((height + 4) / 5) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc6x5Size(width: number, height: number): number {\n  return Math.floor((width + 5) / 6) * Math.floor((height + 4) / 5) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc6x6Size(width: number, height: number): number {\n  return Math.floor((width + 5) / 6) * Math.floor((height + 5) / 6) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc8x5Size(width: number, height: number): number {\n  return Math.floor((width + 7) / 8) * Math.floor((height + 4) / 5) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc8x6Size(width: number, height: number): number {\n  return Math.floor((width + 7) / 8) * Math.floor((height + 5) / 6) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc8x8Size(width: number, height: number): number {\n  return Math.floor((width + 7) / 8) * Math.floor((height + 7) / 8) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc10x5Size(width: number, height: number): number {\n  return Math.floor((width + 9) / 10) * Math.floor((height + 4) / 5) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc10x6Size(width: number, height: number): number {\n  return Math.floor((width + 9) / 10) * Math.floor((height + 5) / 6) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc10x8Size(width: number, height: number): number {\n  return Math.floor((width + 9) / 10) * Math.floor((height + 7) / 8) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc10x10Size(width: number, height: number): number {\n  return Math.floor((width + 9) / 10) * Math.floor((height + 9) / 10) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc12x10Size(width: number, height: number): number {\n  return Math.floor((width + 11) / 12) * Math.floor((height + 9) / 10) * 16;\n}\n\n// https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/\nfunction atc12x12Size(width: number, height: number): number {\n  return Math.floor((width + 11) / 12) * Math.floor((height + 11) / 12) * 16;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TextureLevel} from '@loaders.gl/schema';\nimport {isKTX, parseKTX} from './parse-ktx';\nimport {isDDS, parseDDS} from './parse-dds';\nimport {isPVR, parsePVR} from './parse-pvr';\n\n/**\n * Deduces format and parses compressed texture loaded in ArrayBuffer\n * @param data - binary data of compressed texture\n * @returns Array of the texture levels\n */\nexport function parseCompressedTexture(data: ArrayBuffer): TextureLevel[] {\n  if (isKTX(data)) {\n    // TODO: remove @ts-ignore when `parseKTX` output is normalized to loaders.gl texture format\n    // @ts-ignore\n    return parseKTX(data);\n  }\n  if (isDDS(data)) {\n    return parseDDS(data);\n  }\n  if (isPVR(data)) {\n    return parsePVR(data);\n  }\n  throw new Error('Texture container format not recognized');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport {parseCompressedTexture} from './lib/parsers/parse-compressed-texture';\nimport {parseBasis} from './lib/parsers/parse-basis';\n\n/** Options for the CompressedTextureLoader */\nexport type CompressedTextureLoaderOptions = StrictLoaderOptions & {\n  'compressed-texture'?: {\n    /** Whether to use Basis decoding */\n    useBasis?: boolean;\n    /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n    workerUrl?: string;\n  };\n};\n\n/**\n * Worker Loader for KTX, DDS, and PVR texture container formats\n */\nexport const CompressedTextureWorkerLoader = {\n  dataType: null as unknown as any,\n  batchType: null as never,\n\n  name: 'Texture Containers',\n  id: 'compressed-texture',\n  module: 'textures',\n  version: VERSION,\n  worker: true,\n  extensions: [\n    'ktx',\n    'ktx2',\n    'dds', // WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_atc\n    'pvr' // WEBGL_compressed_texture_pvrtc\n  ],\n  mimeTypes: [\n    'image/ktx2',\n    'image/ktx',\n    'image/vnd-ms.dds',\n    'image/x-dds',\n    'application/octet-stream'\n  ],\n  binary: true,\n  options: {\n    'compressed-texture': {\n      useBasis: false\n    }\n  }\n} as const satisfies Loader<any, never, CompressedTextureLoaderOptions>;\n\n/**\n * Loader for KTX, DDS, and PVR texture container formats\n */\nexport const CompressedTextureLoader = {\n  ...CompressedTextureWorkerLoader,\n  parse: async (arrayBuffer: ArrayBuffer, options?: CompressedTextureLoaderOptions) => {\n    options = {...options};\n    if (options?.['compressed-texture']?.useBasis) {\n      options.basis = {\n        format: {\n          alpha: 'BC3',\n          noAlpha: 'BC1'\n        },\n        ...options.basis,\n        containerFormat: 'ktx2',\n        module: 'encoder'\n      };\n      const result = await parseBasis(arrayBuffer, options);\n      return result[0];\n    }\n    return parseCompressedTexture(arrayBuffer);\n  }\n} as const satisfies LoaderWithParser<any, never, CompressedTextureLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {TextureLevel} from '@loaders.gl/schema';\nimport {VERSION} from './lib/utils/version';\n\n/** CrunchLoader options */\nexport type CrunchLoaderOptions = LoaderOptions & {\n  /** CrunchLoader options */\n  crunch?: {\n    /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n    workerUrl?: string;\n  };\n};\n\n/**\n * Worker loader for the Crunch compressed texture container format\n * @note We avoid bundling crunch - it is a rare format and large lib, so we only offer worker loader\n */\nexport const CrunchLoader = {\n  dataType: null as unknown as TextureLevel[],\n  batchType: null as never,\n\n  id: 'crunch',\n  name: 'Crunch',\n  module: 'textures',\n  version: VERSION,\n  worker: true,\n  extensions: ['crn'],\n  mimeTypes: ['image/crn', 'image/x-crn', 'application/octet-stream'],\n  binary: true,\n  options: {\n    crunch: {}\n  }\n} as const satisfies Loader<TextureLevel[], never, CrunchLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Texture, TextureLevel} from '@loaders.gl/schema';\nimport {GL_RGBA32F} from '../gl-extensions';\n\nconst HDR_MAGIC_HEADERS = ['#?RADIANCE', '#?RGBE'];\nconst HDR_FORMAT = '32-bit_rle_rgbe';\n\n/** Application-facing metadata extracted from Radiance HDR header fields. */\nexport type RadianceHDRMetadata = {\n  /** Per-channel color correction factors from the `COLORCORR` header field. */\n  colorCorrection?: [number, number, number];\n  /** Scene exposure multiplier from the `EXPOSURE` header field. */\n  exposure?: number;\n  /** Display gamma hint from the `GAMMA` header field. */\n  gamma?: number;\n  /** Pixel aspect ratio from the `PIXASPECT` header field. */\n  pixelAspectRatio?: number;\n  /** Chromaticity primaries and white point from the `PRIMARIES` header field. */\n  primaries?: [number, number, number, number, number, number, number, number];\n  /** Producer software identifier from the `SOFTWARE` header field. */\n  software?: string;\n  /** View specification string from the `VIEW` header field. */\n  view?: string;\n};\n\ntype HeaderState = {\n  data: Uint8Array;\n  offset: number;\n};\n\ntype HDRHeader = {\n  width: number;\n  height: number;\n  majorAxis: 'X' | 'Y';\n  majorSign: 1 | -1;\n  minorAxis: 'X' | 'Y';\n  minorSign: 1 | -1;\n  metadata?: RadianceHDRMetadata;\n};\n\nexport function isHDR(arrayBuffer: ArrayBuffer): boolean {\n  const state: HeaderState = {\n    data: new Uint8Array(arrayBuffer),\n    offset: 0\n  };\n\n  const firstLine = readLine(state);\n  return firstLine ? HDR_MAGIC_HEADERS.includes(firstLine) : false;\n}\n\nexport function parseHDR(arrayBuffer: ArrayBuffer): Texture<RadianceHDRMetadata> {\n  const state: HeaderState = {\n    data: new Uint8Array(arrayBuffer),\n    offset: 0\n  };\n  const header = readHeader(state);\n  const {width, height} = header;\n  const rgbeData = readPixels(state, header);\n  const data = convertRGBEToFloat(rgbeData);\n  const level: TextureLevel = {\n    shape: 'texture-level',\n    compressed: false,\n    width,\n    height,\n    data,\n    levelSize: data.byteLength,\n    format: GL_RGBA32F,\n    textureFormat: 'rgba32float'\n  };\n\n  return {\n    shape: 'texture',\n    type: '2d',\n    format: 'rgba32float',\n    ...(header.metadata ? {metadata: header.metadata} : {}),\n    data: [level]\n  };\n}\n\nfunction readHeader(state: HeaderState): HDRHeader {\n  const magicHeader = readLine(state);\n  if (!magicHeader || !HDR_MAGIC_HEADERS.includes(magicHeader)) {\n    throw new Error('RadianceHDRLoader: bad initial token');\n  }\n\n  let hasFormat = false;\n  const metadata: RadianceHDRMetadata = {};\n\n  while (state.offset < state.data.length) {\n    const line = readLine(state);\n\n    if (line === null) {\n      break;\n    }\n\n    if (!line || line.startsWith('#')) {\n      continue;\n    }\n\n    if (line.startsWith('FORMAT=')) {\n      hasFormat = line.slice('FORMAT='.length) === HDR_FORMAT;\n      if (!hasFormat) {\n        throw new Error('RadianceHDRLoader: unsupported format specifier');\n      }\n      continue;\n    }\n\n    parseMetadataLine(metadata, line);\n\n    const dimensions = parseDimensions(line);\n    if (dimensions) {\n      if (!hasFormat) {\n        throw new Error('RadianceHDRLoader: missing format specifier');\n      }\n      return {\n        ...dimensions,\n        ...(hasMetadata(metadata) ? {metadata} : {})\n      };\n    }\n  }\n\n  if (!hasFormat) {\n    throw new Error('RadianceHDRLoader: missing format specifier');\n  }\n\n  throw new Error('RadianceHDRLoader: missing image size specifier');\n}\n\nfunction parseDimensions(line: string): HDRHeader | null {\n  const match = line.match(/^([+-])([YX])\\s+(\\d+)\\s+([+-])([YX])\\s+(\\d+)$/);\n  if (!match) {\n    return null;\n  }\n\n  const majorSign = match[1] === '+' ? 1 : -1;\n  const majorAxis = match[2] as 'X' | 'Y';\n  const majorLength = Number(match[3]);\n  const minorSign = match[4] === '+' ? 1 : -1;\n  const minorAxis = match[5] as 'X' | 'Y';\n  const minorLength = Number(match[6]);\n\n  if (majorAxis === minorAxis) {\n    throw new Error('RadianceHDRLoader: invalid image dimensions');\n  }\n\n  const width = majorAxis === 'X' ? majorLength : minorLength;\n  const height = majorAxis === 'Y' ? majorLength : minorLength;\n  if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {\n    throw new Error('RadianceHDRLoader: invalid image dimensions');\n  }\n\n  return {width, height, majorAxis, majorSign, minorAxis, minorSign};\n}\n\nfunction readPixels(state: HeaderState, header: HDRHeader): Uint8Array {\n  const {width, height} = header;\n  const pixelCount = width * height;\n  const flatByteLength = pixelCount * 4;\n  const scanlineLength = header.minorAxis === 'X' ? width : height;\n  const scanlineCount = header.majorAxis === 'Y' ? height : width;\n\n  if (scanlineLength < 8 || scanlineLength > 0x7fff) {\n    return reorderPixels(readFlatPixels(state, flatByteLength), header);\n  }\n\n  if (state.offset + 4 > state.data.length) {\n    throw new Error('RadianceHDRLoader: unexpected end of file');\n  }\n\n  const data = state.data;\n  const isRunLengthEncoded =\n    data[state.offset] === 2 && data[state.offset + 1] === 2 && !(data[state.offset + 2] & 0x80);\n\n  if (!isRunLengthEncoded) {\n    return reorderPixels(readFlatPixels(state, flatByteLength), header);\n  }\n\n  const scanlineWidth = (data[state.offset + 2] << 8) | data[state.offset + 3];\n  if (scanlineWidth !== scanlineLength) {\n    return reorderPixels(readFlatPixels(state, flatByteLength), header);\n  }\n\n  const pixels = new Uint8Array(flatByteLength);\n  const scanlineBuffer = new Uint8Array(scanlineLength * 4);\n\n  for (let scanlineIndex = 0; scanlineIndex < scanlineCount; scanlineIndex++) {\n    if (state.offset + 4 > data.length) {\n      throw new Error('RadianceHDRLoader: unexpected end of file');\n    }\n\n    const red = data[state.offset++];\n    const green = data[state.offset++];\n    const blue = data[state.offset++];\n    const exponent = data[state.offset++];\n\n    if (red !== 2 || green !== 2 || ((blue << 8) | exponent) !== scanlineLength) {\n      throw new Error('RadianceHDRLoader: bad rgbe scanline format');\n    }\n\n    for (let channelIndex = 0; channelIndex < 4; channelIndex++) {\n      const channelOffset = channelIndex * scanlineLength;\n      const channelEnd = channelOffset + scanlineLength;\n      let pixelOffset = channelOffset;\n\n      while (pixelOffset < channelEnd) {\n        if (state.offset >= data.length) {\n          throw new Error('RadianceHDRLoader: unexpected end of file');\n        }\n\n        let count = data[state.offset++];\n\n        if (count > 128) {\n          count -= 128;\n          if (count === 0 || pixelOffset + count > channelEnd || state.offset >= data.length) {\n            throw new Error('RadianceHDRLoader: bad scanline data');\n          }\n\n          const value = data[state.offset++];\n          scanlineBuffer.fill(value, pixelOffset, pixelOffset + count);\n          pixelOffset += count;\n          continue;\n        }\n\n        if (count === 0 || pixelOffset + count > channelEnd || state.offset + count > data.length) {\n          throw new Error('RadianceHDRLoader: bad scanline data');\n        }\n\n        scanlineBuffer.set(data.subarray(state.offset, state.offset + count), pixelOffset);\n        pixelOffset += count;\n        state.offset += count;\n      }\n    }\n\n    for (let pixelIndex = 0; pixelIndex < scanlineLength; pixelIndex++) {\n      const outputOffset = getOutputOffset(header, scanlineIndex, pixelIndex);\n      pixels[outputOffset] = scanlineBuffer[pixelIndex];\n      pixels[outputOffset + 1] = scanlineBuffer[pixelIndex + scanlineLength];\n      pixels[outputOffset + 2] = scanlineBuffer[pixelIndex + scanlineLength * 2];\n      pixels[outputOffset + 3] = scanlineBuffer[pixelIndex + scanlineLength * 3];\n    }\n  }\n\n  return pixels;\n}\n\nfunction reorderPixels(data: Uint8Array, header: HDRHeader): Uint8Array {\n  const pixels = new Uint8Array(data.length);\n  const scanlineLength = header.minorAxis === 'X' ? header.width : header.height;\n  const scanlineCount = header.majorAxis === 'Y' ? header.height : header.width;\n\n  for (let scanlineIndex = 0; scanlineIndex < scanlineCount; scanlineIndex++) {\n    for (let pixelIndex = 0; pixelIndex < scanlineLength; pixelIndex++) {\n      const sourceOffset = (scanlineIndex * scanlineLength + pixelIndex) * 4;\n      const outputOffset = getOutputOffset(header, scanlineIndex, pixelIndex);\n      pixels[outputOffset] = data[sourceOffset];\n      pixels[outputOffset + 1] = data[sourceOffset + 1];\n      pixels[outputOffset + 2] = data[sourceOffset + 2];\n      pixels[outputOffset + 3] = data[sourceOffset + 3];\n    }\n  }\n\n  return pixels;\n}\n\nfunction getOutputOffset(header: HDRHeader, scanlineIndex: number, pixelIndex: number): number {\n  const majorCoordinate = getCoordinate(\n    header.majorAxis === 'X' ? header.width : header.height,\n    header.majorSign,\n    scanlineIndex\n  );\n  const minorCoordinate = getCoordinate(\n    header.minorAxis === 'X' ? header.width : header.height,\n    header.minorSign,\n    pixelIndex\n  );\n  const x = header.majorAxis === 'X' ? majorCoordinate : minorCoordinate;\n  const y = header.majorAxis === 'Y' ? majorCoordinate : minorCoordinate;\n\n  return ((header.height - 1 - y) * header.width + x) * 4;\n}\n\nfunction getCoordinate(length: number, sign: 1 | -1, index: number): number {\n  return sign === 1 ? index : length - 1 - index;\n}\n\nfunction readFlatPixels(state: HeaderState, byteLength: number): Uint8Array {\n  if (state.offset + byteLength > state.data.length) {\n    throw new Error('RadianceHDRLoader: unexpected end of file');\n  }\n\n  const pixels = state.data.slice(state.offset, state.offset + byteLength);\n  state.offset += byteLength;\n  return pixels;\n}\n\nfunction convertRGBEToFloat(data: Uint8Array): Float32Array {\n  const floatData = new Float32Array(data.length);\n\n  for (let sourceOffset = 0; sourceOffset < data.length; sourceOffset += 4) {\n    const exponent = data[sourceOffset + 3];\n    const destinationOffset = sourceOffset;\n\n    if (exponent > 0) {\n      const scale = Math.pow(2, exponent - 128) / 255;\n      floatData[destinationOffset] = data[sourceOffset] * scale;\n      floatData[destinationOffset + 1] = data[sourceOffset + 1] * scale;\n      floatData[destinationOffset + 2] = data[sourceOffset + 2] * scale;\n    }\n\n    floatData[destinationOffset + 3] = 1;\n  }\n\n  return floatData;\n}\n\nfunction readLine(state: HeaderState): string | null {\n  if (state.offset >= state.data.length) {\n    return null;\n  }\n\n  const lineStart = state.offset;\n\n  while (state.offset < state.data.length) {\n    const byte = state.data[state.offset++];\n    if (byte === 0x0a) {\n      const line = decodeASCII(state.data.subarray(lineStart, state.offset - 1));\n      return line.endsWith('\\r') ? line.slice(0, -1) : line;\n    }\n  }\n\n  const line = decodeASCII(state.data.subarray(lineStart, state.offset));\n  return line.endsWith('\\r') ? line.slice(0, -1) : line;\n}\n\nfunction decodeASCII(data: Uint8Array): string {\n  let line = '';\n  for (const byte of data) {\n    line += String.fromCharCode(byte);\n  }\n  return line;\n}\n\nfunction parseMetadataLine(metadata: RadianceHDRMetadata, line: string): void {\n  if (line.startsWith('COLORCORR=')) {\n    const values = parseNumberList(line.slice('COLORCORR='.length), 3);\n    if (values) {\n      metadata.colorCorrection = values as [number, number, number];\n    }\n    return;\n  }\n\n  if (line.startsWith('EXPOSURE=')) {\n    const value = parseNumber(line.slice('EXPOSURE='.length));\n    if (value !== null) {\n      metadata.exposure = value;\n    }\n    return;\n  }\n\n  if (line.startsWith('GAMMA=')) {\n    const value = parseNumber(line.slice('GAMMA='.length));\n    if (value !== null) {\n      metadata.gamma = value;\n    }\n    return;\n  }\n\n  if (line.startsWith('PIXASPECT=')) {\n    const value = parseNumber(line.slice('PIXASPECT='.length));\n    if (value !== null) {\n      metadata.pixelAspectRatio = value;\n    }\n    return;\n  }\n\n  if (line.startsWith('PRIMARIES=')) {\n    const values = parseNumberList(line.slice('PRIMARIES='.length), 8);\n    if (values) {\n      metadata.primaries = values as [\n        number,\n        number,\n        number,\n        number,\n        number,\n        number,\n        number,\n        number\n      ];\n    }\n    return;\n  }\n\n  if (line.startsWith('SOFTWARE=')) {\n    metadata.software = line.slice('SOFTWARE='.length).trim();\n    return;\n  }\n\n  if (line.startsWith('VIEW=')) {\n    metadata.view = line.slice('VIEW='.length).trim();\n  }\n}\n\nfunction parseNumber(text: string): number | null {\n  const value = Number(text.trim());\n  return Number.isFinite(value) ? value : null;\n}\n\nfunction parseNumberList(text: string, count: number): number[] | null {\n  const values = text\n    .trim()\n    .split(/\\s+/)\n    .map((value) => Number(value));\n\n  if (values.length !== count || values.some((value) => !Number.isFinite(value))) {\n    return null;\n  }\n\n  return values;\n}\n\nfunction hasMetadata(metadata: RadianceHDRMetadata): boolean {\n  return Object.keys(metadata).length > 0;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';\nimport type {Texture} from '@loaders.gl/schema';\nimport {VERSION} from './lib/utils/version';\nimport type {RadianceHDRMetadata} from './lib/parsers/parse-hdr';\nimport {isHDR, parseHDR} from './lib/parsers/parse-hdr';\n\nexport type RadianceHDRLoaderOptions = StrictLoaderOptions & {\n  hdr?: {};\n};\n\nexport const RadianceHDRLoader = {\n  dataType: null as unknown as Texture<RadianceHDRMetadata>,\n  batchType: null as never,\n\n  name: 'Radiance HDR',\n  id: 'hdr',\n  module: 'textures',\n  version: VERSION,\n  extensions: ['hdr'],\n  mimeTypes: ['image/vnd.radiance', 'image/x-hdr', 'application/octet-stream'],\n  binary: true,\n  tests: [isHDR],\n  options: {\n    hdr: {}\n  },\n  parseSync: parseHDR,\n  parse: async (arrayBuffer: ArrayBuffer) => parseHDR(arrayBuffer)\n} as const satisfies LoaderWithParser<\n  Texture<RadianceHDRMetadata>,\n  never,\n  RadianceHDRLoaderOptions\n>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// import type {TextureLevel} from '@loaders.gl/schema';\nimport {TypedArray} from '@math.gl/types';\n// import {TypedArrayConstructor} from \"@math.gl/types\";\n\n// TODO move to math.gl\ntype TypedArrayConstructor =\n  | typeof Int8Array\n  | typeof Uint8Array\n  | typeof Int16Array\n  | typeof Uint16Array\n  | typeof Int32Array\n  | typeof Uint32Array\n  | typeof Float32Array\n  | typeof Float64Array;\n\nconst a = new Uint32Array([0x12345678]);\nconst b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);\nconst isLittleEndian = !(b[0] === 0x12);\n\nconst LITTLE_ENDIAN_OS = isLittleEndian;\n\n/** One numpy \"tile\" */\nexport type NPYTile = {\n  /** tile header */\n  header: NumpyHeader;\n  /** data in tile */\n  data: TypedArray;\n};\n\ntype NumpyHeader = {\n  descr: string;\n  shape: number[];\n};\n\n/**\n * The basic string format consists of 3 characters:\n * 1. a character describing the byteorder of the data (<: little-endian, >: big-endian, |: not-relevant)\n * 2. a character code giving the basic type of the array\n * 3. an integer providing the number of bytes the type uses.\n * https://numpy.org/doc/stable/reference/arrays.interface.html\n *\n * Here I only include the second and third characters, and check endianness separately\n */\nconst DTYPES: Record<string, TypedArrayConstructor> = {\n  u1: Uint8Array,\n  i1: Int8Array,\n  u2: Uint16Array,\n  i2: Int16Array,\n  u4: Uint32Array,\n  i4: Int32Array,\n  f4: Float32Array,\n  f8: Float64Array\n};\n\nexport function parseNPY(arrayBuffer: ArrayBuffer, options?: {}): NPYTile {\n  const view = new DataView(arrayBuffer);\n  const {header, headerEndOffset} = parseHeader(view);\n\n  const numpyType = header.descr;\n  const ArrayType = DTYPES[numpyType.slice(1, 3)];\n  if (!ArrayType) {\n    throw new Error(`Unimplemented type ${numpyType}`);\n  }\n\n  const nArrayElements = header.shape?.reduce((a: number, b: number): number => a * b);\n  const arrayByteLength = nArrayElements * ArrayType.BYTES_PER_ELEMENT;\n\n  if (arrayBuffer.byteLength < headerEndOffset + arrayByteLength) {\n    throw new Error('Buffer overflow');\n  }\n  const data = new ArrayType(arrayBuffer.slice(headerEndOffset, headerEndOffset + arrayByteLength));\n\n  // Swap endianness if needed\n  if ((numpyType[0] === '>' && LITTLE_ENDIAN_OS) || (numpyType[0] === '<' && !LITTLE_ENDIAN_OS)) {\n    throw new Error('Incorrect endianness');\n  }\n\n  return {\n    data,\n    header\n  };\n}\n\n/**\n * Parse NPY header\n *\n * @param  view\n * @return\n */\nfunction parseHeader(view: DataView): {header: NumpyHeader; headerEndOffset: number} {\n  const majorVersion = view.getUint8(6);\n  // const minorVersion = view.getUint8(7);\n\n  let offset = 8;\n  let headerLength: number;\n  if (majorVersion >= 2) {\n    headerLength = view.getUint32(offset, true);\n    offset += 4;\n  } else {\n    headerLength = view.getUint16(offset, true);\n    offset += 2;\n  }\n\n  const encoding = majorVersion <= 2 ? 'latin1' : 'utf-8';\n  const decoder = new TextDecoder(encoding);\n  const headerArray = new Uint8Array(view.buffer, offset, headerLength);\n  const headerText = decoder.decode(headerArray);\n  offset += headerLength;\n\n  const header = JSON.parse(\n    headerText\n      .replace(/'/g, '\"')\n      .replace('False', 'false')\n      .replace('(', '[')\n      .replace(/,*\\),*/g, ']')\n  );\n\n  return {header, headerEndOffset: offset};\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport {parseNPY, NPYTile} from './lib/parsers/parse-npy';\n\n// \\x93NUMPY\nconst NPY_MAGIC_NUMBER = new Uint8Array([147, 78, 85, 77, 80, 89]);\n\n/** NPYLoader for numpy tiles */\nexport type NPYLoaderOptions = LoaderOptions & {\n  /** NPYLoader for numpy tiles */\n  npy?: {\n    /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n    workerUrl?: string;\n  };\n};\n\n/**\n * Worker loader for numpy \"tiles\"\n */\nexport const NPYWorkerLoader = {\n  dataType: null as any as NPYTile,\n  batchType: null as never,\n\n  name: 'NPY',\n  id: 'npy',\n  module: 'textures',\n  version: VERSION,\n  worker: true,\n  extensions: ['npy'],\n  mimeTypes: [],\n  tests: [NPY_MAGIC_NUMBER.buffer],\n  options: {\n    npy: {}\n  }\n} as const satisfies Loader<NPYTile, never, NPYLoaderOptions>;\n\n/**\n * Loader for numpy \"tiles\"\n */\nexport const NPYLoader = {\n  ...NPYWorkerLoader,\n  parseSync: parseNPY,\n  parse: async (arrayBuffer: ArrayBuffer, options?: LoaderOptions) => parseNPY(arrayBuffer, options)\n} as const satisfies LoaderWithParser<any, any, NPYLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderContext} from '@loaders.gl/loader-utils';\nimport {parseFromContext, path, resolvePath} from '@loaders.gl/loader-utils';\nimport type {Texture, TextureFormat, TextureLevel} from '@loaders.gl/schema';\nimport {ImageLoader, getImageSize, isImage, type ImageType} from '@loaders.gl/images';\nimport {asyncDeepMap} from '../texture-api/async-deep-map';\nimport type {TextureLoaderOptions} from '../texture-api/texture-api-types';\nimport {\n  IMAGE_TEXTURE_CUBE_FACES,\n  type ImageCubeTexture,\n  type ImageTextureCubeDirectionAlias,\n  type ImageTextureCubeFace\n} from './image-texture-cube';\n\nexport type ImageTextureTemplateSource = {\n  mipLevels: number | 'auto';\n  template: string;\n};\n\nexport type ImageTextureSource = string | string[] | ImageTextureTemplateSource;\n\nexport type ImageTextureManifest = {\n  shape: 'image-texture';\n  image?: string;\n  mipLevels?: number | 'auto';\n  template?: string;\n  mipmaps?: string[];\n};\n\nexport type ImageTextureArrayManifest = {\n  shape: 'image-texture-array';\n  layers: ImageTextureSource[];\n};\n\nexport type ImageTextureCubeFaces = Partial<\n  Record<ImageTextureCubeFace | ImageTextureCubeDirectionAlias, ImageTextureSource>\n>;\n\nexport type ImageTextureCubeManifest = {\n  shape: 'image-texture-cube';\n  faces: ImageTextureCubeFaces;\n};\n\nexport type ImageTextureCubeArrayLayer = {\n  faces: ImageTextureCubeFaces;\n};\n\nexport type ImageTextureCubeArrayManifest = {\n  shape: 'image-texture-cube-array';\n  layers: ImageTextureCubeArrayLayer[];\n};\n\nexport type CompositeImageManifest =\n  | ImageTextureManifest\n  | ImageTextureArrayManifest\n  | ImageTextureCubeManifest\n  | ImageTextureCubeArrayManifest;\n\nexport type CompositeImageUrlTree =\n  | ImageTextureSource\n  | ImageTextureSource[]\n  | ImageCubeTexture\n  | ImageCubeTexture[];\n\nexport async function parseCompositeImageManifest(\n  text: string,\n  expectedShape: CompositeImageManifest['shape'],\n  options: TextureLoaderOptions = {},\n  context?: LoaderContext\n): Promise<any> {\n  const manifest = parseCompositeImageManifestJSON(text);\n  if (manifest.shape !== expectedShape) {\n    throw new Error(`Expected ${expectedShape} manifest, got ${manifest.shape}`);\n  }\n  return await loadCompositeImageManifest(manifest, options, context);\n}\n\nexport function testCompositeImageManifestShape(\n  text: string,\n  shape: CompositeImageManifest['shape']\n): boolean {\n  try {\n    return parseCompositeImageManifestJSON(text).shape === shape;\n  } catch {\n    return false;\n  }\n}\n\nexport async function loadCompositeImageManifest(\n  manifest: CompositeImageManifest,\n  options: TextureLoaderOptions = {},\n  context?: LoaderContext\n): Promise<Texture> {\n  const normalizedOptions = normalizeCompositeImageManifestOptions(options);\n  const urlTree = await getCompositeImageUrlTree(manifest, normalizedOptions, context);\n  const imageData = await loadCompositeImageUrlTree(urlTree, normalizedOptions, context);\n  return convertCompositeImageToTexture(manifest.shape, imageData);\n}\n\nexport async function loadCompositeImageUrlTree(\n  urlTree: CompositeImageUrlTree,\n  options: TextureLoaderOptions = {},\n  context?: LoaderContext\n): Promise<any> {\n  const normalizedOptions = normalizeCompositeImageOptions(options);\n  return await asyncDeepMap(\n    urlTree,\n    async (url: string) => await loadCompositeImageMember(url, normalizedOptions, context)\n  );\n}\n\nexport async function loadCompositeImageMember(\n  url: string,\n  options: TextureLoaderOptions = {},\n  context?: LoaderContext\n): Promise<any> {\n  const resolvedUrl = resolveCompositeImageUrl(url, options, context);\n  const fetch = getCompositeImageFetch(options, context);\n  const response = await fetch(resolvedUrl);\n  const subloaderOptions = getCompositeImageSubloaderOptions(options);\n  if (context) {\n    const childContext = getCompositeImageMemberContext(resolvedUrl, response, context);\n    return await parseFromContext(\n      response as any,\n      [ImageLoader],\n      subloaderOptions as any,\n      childContext\n    );\n  }\n\n  const arrayBuffer = await response.arrayBuffer();\n  return await ImageLoader.parse(arrayBuffer, subloaderOptions as any);\n}\n\nexport async function getCompositeImageUrlTree(\n  manifest: CompositeImageManifest,\n  options: TextureLoaderOptions = {},\n  context?: LoaderContext\n): Promise<CompositeImageUrlTree> {\n  switch (manifest.shape) {\n    case 'image-texture':\n      return await getImageTextureSource(manifest, options, context);\n\n    case 'image-texture-array':\n      if (!Array.isArray(manifest.layers) || manifest.layers.length === 0) {\n        throw new Error('image-texture-array manifest must define one or more layers');\n      }\n      return await Promise.all(\n        manifest.layers.map(\n          async (layer, index) =>\n            await getNormalizedImageTextureSource(layer, options, context, {index})\n        )\n      );\n\n    case 'image-texture-cube':\n      return await getImageTextureCubeUrls(manifest, options, context);\n\n    case 'image-texture-cube-array':\n      if (!Array.isArray(manifest.layers) || manifest.layers.length === 0) {\n        throw new Error('image-texture-cube-array manifest must define one or more layers');\n      }\n      return await Promise.all(\n        manifest.layers.map(\n          async (layer, index) => await getImageTextureCubeUrls(layer, options, context, {index})\n        )\n      );\n\n    default:\n      throw new Error('Unsupported composite image manifest');\n  }\n}\n\nexport function normalizeCompositeImageOptions(\n  options: TextureLoaderOptions = {}\n): TextureLoaderOptions {\n  if (options.core?.baseUrl) {\n    return options;\n  }\n\n  const fallbackBaseUrl = options.baseUrl;\n  if (!fallbackBaseUrl) {\n    return options;\n  }\n\n  return {\n    ...options,\n    core: {\n      ...options.core,\n      baseUrl: fallbackBaseUrl\n    }\n  };\n}\n\nexport function resolveCompositeImageUrl(\n  url: string,\n  options: TextureLoaderOptions = {},\n  context?: LoaderContext\n): string {\n  const resolvedUrl = resolvePath(url);\n  if (isAbsoluteCompositeImageUrl(url)) {\n    return resolvedUrl;\n  }\n\n  const baseUrl = getCompositeImageBaseUrl(options, context);\n  if (!baseUrl) {\n    if (resolvedUrl !== url || url.startsWith('@')) {\n      return resolvedUrl;\n    }\n    throw new Error(`Unable to resolve relative image URL ${url} without a base URL`);\n  }\n\n  return resolvePath(joinCompositeImageUrl(baseUrl, url));\n}\n\nfunction parseCompositeImageManifestJSON(text: string): CompositeImageManifest {\n  const manifest = JSON.parse(text) as CompositeImageManifest;\n  if (!manifest?.shape) {\n    throw new Error('Composite image manifest must contain a shape field');\n  }\n  return manifest;\n}\n\nasync function getImageTextureSource(\n  manifest: ImageTextureManifest,\n  options: TextureLoaderOptions,\n  context?: LoaderContext\n): Promise<ImageTextureSource> {\n  if ((manifest.image || manifest.mipmaps) && manifest.template) {\n    throw new Error('image-texture manifest must define image, mipmaps, or template source');\n  }\n  if (manifest.image && manifest.mipmaps) {\n    throw new Error('image-texture manifest must define image, mipmaps, or template source');\n  }\n  if (manifest.image) {\n    return manifest.image;\n  }\n  if (manifest.mipmaps?.length) {\n    return manifest.mipmaps;\n  }\n  if (manifest.template) {\n    return await expandImageTextureSource(\n      {mipLevels: manifest.mipLevels ?? 'auto', template: manifest.template},\n      options,\n      context,\n      {}\n    );\n  }\n  throw new Error('image-texture manifest must define image, mipmaps, or template source');\n}\n\nasync function getImageTextureCubeUrls(\n  manifest: Pick<ImageTextureCubeManifest, 'faces'>,\n  options: TextureLoaderOptions,\n  context?: LoaderContext,\n  templateOptions: TemplateOptions = {}\n): Promise<ImageCubeTexture> {\n  const urls: ImageCubeTexture = {};\n\n  for (const {face, name, direction, axis, sign} of IMAGE_TEXTURE_CUBE_FACES) {\n    const source = manifest.faces?.[name] || manifest.faces?.[direction];\n    if (!source) {\n      throw new Error(`image-texture-cube manifest is missing ${name} face`);\n    }\n    urls[face] = await getNormalizedImageTextureSource(source, options, context, {\n      ...templateOptions,\n      face: name,\n      direction,\n      axis,\n      sign\n    });\n  }\n\n  return urls;\n}\n\nasync function getNormalizedImageTextureSource(\n  source: ImageTextureSource,\n  options: TextureLoaderOptions,\n  context: LoaderContext | undefined,\n  templateOptions: TemplateOptions\n): Promise<ImageTextureSource> {\n  if (typeof source === 'string') {\n    return source;\n  }\n  if (Array.isArray(source) && source.length > 0) {\n    return source;\n  }\n  if (isImageTextureTemplateSource(source)) {\n    return await expandImageTextureSource(source, options, context, templateOptions);\n  }\n  throw new Error('Composite image source entries must be strings or non-empty mip arrays');\n}\n\nasync function expandImageTextureSource(\n  source: ImageTextureTemplateSource,\n  options: TextureLoaderOptions,\n  context: LoaderContext | undefined,\n  templateOptions: TemplateOptions\n): Promise<string[]> {\n  const mipLevels =\n    source.mipLevels === 'auto'\n      ? await getAutoMipLevels(source.template, options, context, templateOptions)\n      : source.mipLevels;\n\n  if (!Number.isFinite(mipLevels) || mipLevels <= 0) {\n    throw new Error(`Invalid mipLevels value ${source.mipLevels}`);\n  }\n\n  const urls: string[] = [];\n  for (let lod = 0; lod < mipLevels; lod++) {\n    urls.push(expandTemplate(source.template, {...templateOptions, lod}));\n  }\n  return urls;\n}\n\nasync function getAutoMipLevels(\n  template: string,\n  options: TextureLoaderOptions,\n  context: LoaderContext | undefined,\n  templateOptions: TemplateOptions\n): Promise<number> {\n  if (!template.includes('{lod}')) {\n    throw new Error('Template sources with mipLevels: auto must include a {lod} placeholder');\n  }\n\n  const level0Url = expandTemplate(template, {...templateOptions, lod: 0});\n  const image = await loadCompositeImageMember(\n    level0Url,\n    normalizeCompositeImageOptions(options),\n    context\n  );\n  const {width, height} = getImageSize(image);\n  return 1 + Math.floor(Math.log2(Math.max(width, height)));\n}\n\ntype TemplateOptions = {\n  lod?: number;\n  index?: number;\n  face?: string;\n  direction?: string;\n  axis?: string;\n  sign?: string;\n};\n\nfunction expandTemplate(template: string, templateOptions: TemplateOptions): string {\n  let expanded = '';\n\n  for (let index = 0; index < template.length; index++) {\n    const character = template[index];\n\n    if (character === '\\\\') {\n      const nextCharacter = template[index + 1];\n      if (nextCharacter === '{' || nextCharacter === '}' || nextCharacter === '\\\\') {\n        expanded += nextCharacter;\n        index++;\n        continue;\n      }\n      throw new Error(`Invalid escape sequence \\\\${nextCharacter || ''} in template ${template}`);\n    }\n\n    if (character === '}') {\n      throw new Error(`Unexpected } in template ${template}`);\n    }\n\n    if (character !== '{') {\n      expanded += character;\n      continue;\n    }\n\n    const closingBraceIndex = findClosingBraceIndex(template, index + 1);\n    if (closingBraceIndex < 0) {\n      throw new Error(`Unterminated placeholder in template ${template}`);\n    }\n\n    const placeholder = template.slice(index + 1, closingBraceIndex);\n    if (!/^[a-z][a-zA-Z0-9]*$/.test(placeholder)) {\n      throw new Error(`Invalid placeholder {${placeholder}} in template ${template}`);\n    }\n\n    const value = getTemplateValue(placeholder, templateOptions);\n    if (value === undefined) {\n      throw new Error(\n        `Template ${template} uses unsupported placeholder {${placeholder}} for this source`\n      );\n    }\n\n    expanded += String(value);\n    index = closingBraceIndex;\n  }\n\n  return expanded;\n}\n\nfunction findClosingBraceIndex(template: string, startIndex: number): number {\n  for (let index = startIndex; index < template.length; index++) {\n    const character = template[index];\n    if (character === '\\\\') {\n      index++;\n      continue;\n    }\n    if (character === '{') {\n      throw new Error(`Nested placeholders are not supported in template ${template}`);\n    }\n    if (character === '}') {\n      return index;\n    }\n  }\n  return -1;\n}\n\nfunction getTemplateValue(\n  placeholder: string,\n  templateOptions: TemplateOptions\n): string | number | undefined {\n  switch (placeholder) {\n    case 'lod':\n      return templateOptions.lod;\n    case 'index':\n      return templateOptions.index;\n    case 'face':\n      return templateOptions.face;\n    case 'direction':\n      return templateOptions.direction;\n    case 'axis':\n      return templateOptions.axis;\n    case 'sign':\n      return templateOptions.sign;\n    default:\n      return undefined;\n  }\n}\n\nfunction isImageTextureTemplateSource(\n  source: ImageTextureSource\n): source is ImageTextureTemplateSource {\n  return typeof source === 'object' && source !== null && !Array.isArray(source);\n}\n\nfunction getCompositeImageBaseUrl(\n  options: TextureLoaderOptions,\n  context?: LoaderContext\n): string | null {\n  if (context?.baseUrl) {\n    return context.baseUrl;\n  }\n\n  if (options.baseUrl) {\n    return stripTrailingSlash(options.baseUrl);\n  }\n\n  if (options.core?.baseUrl) {\n    return getSourceUrlDirectory(options.core.baseUrl);\n  }\n\n  return null;\n}\n\nfunction stripTrailingSlash(baseUrl: string): string {\n  if (baseUrl.endsWith('/')) {\n    return baseUrl.slice(0, -1);\n  }\n\n  return baseUrl;\n}\n\nfunction getSourceUrlDirectory(baseUrl: string): string {\n  return stripTrailingSlash(path.dirname(baseUrl));\n}\n\nfunction joinCompositeImageUrl(baseUrl: string, url: string): string {\n  if (isRequestLikeUrl(baseUrl)) {\n    return new URL(url, `${stripTrailingSlash(baseUrl)}/`).toString();\n  }\n\n  const normalizedBaseUrl = baseUrl.startsWith('/') ? baseUrl : `/${baseUrl}`;\n  const normalizedUrl = path.resolve(normalizedBaseUrl, url);\n  return baseUrl.startsWith('/') ? normalizedUrl : normalizedUrl.slice(1);\n}\n\nfunction isRequestLikeUrl(url: string): boolean {\n  return (\n    url.startsWith('http:') ||\n    url.startsWith('https:') ||\n    url.startsWith('file:') ||\n    url.startsWith('blob:')\n  );\n}\n\nfunction getCompositeImageFetch(\n  options: TextureLoaderOptions,\n  context?: LoaderContext\n): typeof fetch {\n  const fetchOption = options.fetch ?? options.core?.fetch;\n\n  if (context?.fetch) {\n    return context.fetch as typeof fetch;\n  }\n\n  if (typeof fetchOption === 'function') {\n    return fetchOption as typeof fetch;\n  }\n\n  if (fetchOption && typeof fetchOption === 'object') {\n    return (url) => fetch(url, fetchOption);\n  }\n\n  return fetch;\n}\n\nfunction getCompositeImageSubloaderOptions(options: TextureLoaderOptions): TextureLoaderOptions {\n  const core = options.core;\n  const rest = {...options};\n  delete rest.baseUrl;\n  if (!core?.baseUrl) {\n    return rest;\n  }\n\n  const restCore = {...core};\n  delete restCore.baseUrl;\n  return {\n    ...rest,\n    core: restCore\n  };\n}\n\nfunction normalizeCompositeImageManifestOptions(\n  options: TextureLoaderOptions\n): TextureLoaderOptions {\n  if (options.image?.type || typeof ImageBitmap === 'undefined') {\n    return options;\n  }\n\n  return {\n    ...options,\n    image: {\n      ...options.image,\n      type: 'imagebitmap'\n    }\n  };\n}\n\nfunction getCompositeImageMemberContext(\n  resolvedUrl: string,\n  response: Response,\n  context: LoaderContext\n): LoaderContext {\n  const url = response.url || resolvedUrl;\n  const [urlWithoutQueryString, queryString = ''] = url.split('?');\n\n  return {\n    ...context,\n    url,\n    response,\n    filename: path.filename(urlWithoutQueryString),\n    baseUrl: path.dirname(urlWithoutQueryString),\n    queryString\n  };\n}\n\nfunction convertCompositeImageToTexture(\n  shape: CompositeImageManifest['shape'],\n  imageData: any\n): Texture {\n  switch (shape) {\n    case 'image-texture': {\n      const data = normalizeCompositeImageMember(imageData);\n      return {\n        shape: 'texture',\n        type: '2d',\n        format: getCompositeTextureFormat(data),\n        data\n      };\n    }\n\n    case 'image-texture-array': {\n      const data = imageData.map((layer) => normalizeCompositeImageMember(layer));\n      return {\n        shape: 'texture',\n        type: '2d-array',\n        format: getCompositeTextureFormat(data[0]),\n        data\n      };\n    }\n\n    case 'image-texture-cube': {\n      const data = IMAGE_TEXTURE_CUBE_FACES.map(({face}) =>\n        normalizeCompositeImageMember(imageData[face])\n      );\n      return {\n        shape: 'texture',\n        type: 'cube',\n        format: getCompositeTextureFormat(data[0]),\n        data\n      };\n    }\n\n    case 'image-texture-cube-array': {\n      const data = imageData.map((layer) =>\n        IMAGE_TEXTURE_CUBE_FACES.map(({face}) => normalizeCompositeImageMember(layer[face]))\n      );\n      return {\n        shape: 'texture',\n        type: 'cube-array',\n        format: getCompositeTextureFormat(data[0][0]),\n        data\n      };\n    }\n\n    default:\n      throw new Error(`Unsupported composite image shape ${shape}`);\n  }\n}\n\nfunction normalizeCompositeImageMember(imageData: any): TextureLevel[] {\n  if (Array.isArray(imageData)) {\n    if (imageData.length === 0) {\n      throw new Error('Composite image members must not be empty');\n    }\n\n    if (imageData.every(isTextureLevel)) {\n      return imageData;\n    }\n\n    if (imageData.every(isImage)) {\n      return imageData.map((image) => getTextureLevelFromImage(image));\n    }\n\n    if (imageData.every((entry) => Array.isArray(entry) && entry.every(isTextureLevel))) {\n      if (imageData.length !== 1) {\n        throw new Error('Composite image members must resolve to a single image or mip chain');\n      }\n      return imageData[0];\n    }\n  }\n\n  if (isTexture(imageData)) {\n    if (imageData.type !== '2d') {\n      throw new Error(`Composite image members must resolve to 2d textures, got ${imageData.type}`);\n    }\n    return imageData.data;\n  }\n\n  if (isTextureLevel(imageData)) {\n    return [imageData];\n  }\n\n  if (isImage(imageData)) {\n    return [getTextureLevelFromImage(imageData)];\n  }\n\n  throw new Error('Composite image members must resolve to an image, mip chain, or texture');\n}\n\nfunction getTextureLevelFromImage(image: ImageType): TextureLevel {\n  const {width, height} = getImageSize(image);\n  return {\n    shape: 'texture-level',\n    compressed: false,\n    width,\n    height,\n    imageBitmap:\n      typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ? image : undefined,\n    data: new Uint8Array(0),\n    textureFormat: 'rgba8unorm'\n  };\n}\n\nfunction getCompositeTextureFormat(textureLevels: TextureLevel[]): TextureFormat {\n  return textureLevels[0]?.textureFormat || 'rgba8unorm';\n}\n\nfunction isTextureLevel(textureLevel: unknown): textureLevel is TextureLevel {\n  return Boolean(\n    textureLevel &&\n    typeof textureLevel === 'object' &&\n    'shape' in textureLevel &&\n    textureLevel.shape === 'texture-level'\n  );\n}\n\nfunction isTexture(texture: unknown): texture is Texture {\n  return Boolean(\n    texture && typeof texture === 'object' && 'shape' in texture && texture.shape === 'texture'\n  );\n}\n\nfunction isAbsoluteCompositeImageUrl(url: string): boolean {\n  return (\n    url.startsWith('data:') ||\n    url.startsWith('blob:') ||\n    url.startsWith('file:') ||\n    url.startsWith('http:') ||\n    url.startsWith('https:') ||\n    url.startsWith('/')\n  );\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/*\nAsynchronously maps a deep structure of values (e.g. objects and arrays of urls).\n\nE.g. a mipmapped cubemap\n{\n  [CUBE_FACE_FRONT]: [\n    \"image-front-0.jpg\",\n    \"image-front-1.jpg\",\n    \"image-front-2.jpg\",\n  ],\n  [CUBE_MAP_BACK]: [\n    ...\n  ]\n}\n*/\nexport type Options = Record<string, any>;\nexport type Func = (url: string, options: Options) => unknown;\n\nconst isObject = (value: any): boolean => value && typeof value === 'object';\n\n// Loads a deep structure of urls (objects and arrays of urls)\n// Returns an object with six key-value pairs containing the images (or image mip arrays)\n// for each cube face\nexport async function asyncDeepMap(tree: unknown, func: Func, options: Options = {}) {\n  return await mapSubtree(tree, func, options);\n}\n\nexport async function mapSubtree(object: unknown, func: Func, options: Options) {\n  if (Array.isArray(object)) {\n    return await mapArray(object, func, options);\n  }\n\n  if (isObject(object)) {\n    return await mapObject(object as object, func, options);\n  }\n\n  // TODO - ignore non-urls, non-arraybuffers?\n  const url = object as string;\n  return await func(url, options);\n}\n\n// HELPERS\n\nasync function mapObject(\n  object: Record<string, any>,\n  func: Func,\n  options: Options\n): Promise<Record<string, any>> {\n  const promises: Promise<any>[] = [];\n  const values: Record<string, any> = {};\n\n  for (const key in object) {\n    const url = object[key];\n    const promise = mapSubtree(url, func, options).then((value) => {\n      values[key] = value;\n    });\n    promises.push(promise);\n  }\n\n  await Promise.all(promises);\n\n  return values;\n}\n\nasync function mapArray(urlArray: string[], func: Func, options = {}): Promise<any[]> {\n  const promises = urlArray.map((url) => mapSubtree(url, func, options));\n  return await Promise.all(promises);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport const GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;\nexport const GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;\nexport const GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;\nexport const GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;\nexport const GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;\nexport const GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851a;\n\nexport type ImageTextureCubeFace = '+X' | '-X' | '+Y' | '-Y' | '+Z' | '-Z';\n\nexport type ImageTextureCubeDirectionAlias = 'right' | 'left' | 'top' | 'bottom' | 'front' | 'back';\n\nexport const IMAGE_TEXTURE_CUBE_FACES = [\n  {\n    face: GL_TEXTURE_CUBE_MAP_POSITIVE_X,\n    name: '+X',\n    direction: 'right',\n    axis: 'x',\n    sign: 'positive'\n  },\n  {\n    face: GL_TEXTURE_CUBE_MAP_NEGATIVE_X,\n    name: '-X',\n    direction: 'left',\n    axis: 'x',\n    sign: 'negative'\n  },\n  {face: GL_TEXTURE_CUBE_MAP_POSITIVE_Y, name: '+Y', direction: 'top', axis: 'y', sign: 'positive'},\n  {\n    face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,\n    name: '-Y',\n    direction: 'bottom',\n    axis: 'y',\n    sign: 'negative'\n  },\n  {\n    face: GL_TEXTURE_CUBE_MAP_POSITIVE_Z,\n    name: '+Z',\n    direction: 'front',\n    axis: 'z',\n    sign: 'positive'\n  },\n  {face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, name: '-Z', direction: 'back', axis: 'z', sign: 'negative'}\n] as const;\n\nexport type ImageCubeTexture = Record<number, any>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderContext, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {Texture} from '@loaders.gl/schema';\nimport type {TextureLoaderOptions as TextureApiLoaderOptions} from './lib/texture-api/texture-api-types';\nimport {VERSION} from './lib/utils/version';\nimport {\n  parseCompositeImageManifest,\n  testCompositeImageManifestShape,\n  type ImageTextureManifest\n} from './lib/composite-image/parse-composite-image';\n\nexport type TextureManifestLoaderOptions = TextureApiLoaderOptions;\nexport type {ImageTextureManifest as TextureManifest};\n\nexport const TextureLoader = {\n  dataType: null as unknown as Texture,\n  batchType: null as never,\n  id: 'texture',\n  name: 'Texture',\n  module: 'textures',\n  version: VERSION,\n  extensions: [],\n  mimeTypes: [],\n  text: true,\n  worker: false,\n  testText: (text: string) => testCompositeImageManifestShape(text, 'image-texture'),\n  options: {\n    image: {}\n  },\n  parse: async (\n    arrayBuffer: ArrayBuffer,\n    options?: TextureManifestLoaderOptions,\n    context?: LoaderContext\n  ) =>\n    await parseCompositeImageManifest(\n      new TextDecoder().decode(arrayBuffer),\n      'image-texture',\n      options,\n      context\n    ),\n  parseText: async (\n    text: string,\n    options?: TextureManifestLoaderOptions,\n    context?: LoaderContext\n  ) => await parseCompositeImageManifest(text, 'image-texture', options, context)\n} as const satisfies LoaderWithParser<Texture, never, TextureManifestLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderContext, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {Texture} from '@loaders.gl/schema';\nimport type {TextureLoaderOptions as TextureApiLoaderOptions} from './lib/texture-api/texture-api-types';\nimport {VERSION} from './lib/utils/version';\nimport {\n  parseCompositeImageManifest,\n  testCompositeImageManifestShape,\n  type ImageTextureArrayManifest\n} from './lib/composite-image/parse-composite-image';\n\nexport type TextureArrayLoaderOptions = TextureApiLoaderOptions;\nexport type {ImageTextureArrayManifest as TextureArrayManifest};\n\nexport const TextureArrayLoader = {\n  dataType: null as unknown as Texture,\n  batchType: null as never,\n  id: 'texture-array',\n  name: 'Texture Array',\n  module: 'textures',\n  version: VERSION,\n  extensions: [],\n  mimeTypes: [],\n  text: true,\n  worker: false,\n  testText: (text: string) => testCompositeImageManifestShape(text, 'image-texture-array'),\n  options: {\n    image: {}\n  },\n  parse: async (\n    arrayBuffer: ArrayBuffer,\n    options?: TextureArrayLoaderOptions,\n    context?: LoaderContext\n  ) =>\n    await parseCompositeImageManifest(\n      new TextDecoder().decode(arrayBuffer),\n      'image-texture-array',\n      options,\n      context\n    ),\n  parseText: async (text: string, options?: TextureArrayLoaderOptions, context?: LoaderContext) =>\n    await parseCompositeImageManifest(text, 'image-texture-array', options, context)\n} as const satisfies LoaderWithParser<Texture, never, TextureArrayLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderContext, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {Texture} from '@loaders.gl/schema';\nimport type {TextureLoaderOptions as TextureApiLoaderOptions} from './lib/texture-api/texture-api-types';\nimport {VERSION} from './lib/utils/version';\nimport {\n  parseCompositeImageManifest,\n  testCompositeImageManifestShape,\n  type ImageTextureCubeManifest\n} from './lib/composite-image/parse-composite-image';\n\nexport type TextureCubeLoaderOptions = TextureApiLoaderOptions;\nexport type {ImageTextureCubeManifest as TextureCubeManifest};\n\nexport const TextureCubeLoader = {\n  dataType: null as unknown as Texture,\n  batchType: null as never,\n  id: 'texture-cube',\n  name: 'Texture Cube',\n  module: 'textures',\n  version: VERSION,\n  extensions: [],\n  mimeTypes: [],\n  text: true,\n  worker: false,\n  testText: (text: string) => testCompositeImageManifestShape(text, 'image-texture-cube'),\n  options: {\n    image: {}\n  },\n  parse: async (\n    arrayBuffer: ArrayBuffer,\n    options?: TextureCubeLoaderOptions,\n    context?: LoaderContext\n  ) =>\n    await parseCompositeImageManifest(\n      new TextDecoder().decode(arrayBuffer),\n      'image-texture-cube',\n      options,\n      context\n    ),\n  parseText: async (text: string, options?: TextureCubeLoaderOptions, context?: LoaderContext) =>\n    await parseCompositeImageManifest(text, 'image-texture-cube', options, context)\n} as const satisfies LoaderWithParser<Texture, never, TextureCubeLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderContext, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {Texture} from '@loaders.gl/schema';\nimport type {TextureLoaderOptions as TextureApiLoaderOptions} from './lib/texture-api/texture-api-types';\nimport {VERSION} from './lib/utils/version';\nimport {\n  parseCompositeImageManifest,\n  testCompositeImageManifestShape,\n  type ImageTextureCubeArrayManifest\n} from './lib/composite-image/parse-composite-image';\n\nexport type TextureCubeArrayLoaderOptions = TextureApiLoaderOptions;\nexport type {ImageTextureCubeArrayManifest as TextureCubeArrayManifest};\n\nexport const TextureCubeArrayLoader = {\n  dataType: null as unknown as Texture,\n  batchType: null as never,\n  id: 'texture-cube-array',\n  name: 'Texture Cube Array',\n  module: 'textures',\n  version: VERSION,\n  extensions: [],\n  mimeTypes: [],\n  text: true,\n  worker: false,\n  testText: (text: string) => testCompositeImageManifestShape(text, 'image-texture-cube-array'),\n  options: {\n    image: {}\n  },\n  parse: async (\n    arrayBuffer: ArrayBuffer,\n    options?: TextureCubeArrayLoaderOptions,\n    context?: LoaderContext\n  ) =>\n    await parseCompositeImageManifest(\n      new TextDecoder().decode(arrayBuffer),\n      'image-texture-cube-array',\n      options,\n      context\n    ),\n  parseText: async (\n    text: string,\n    options?: TextureCubeArrayLoaderOptions,\n    context?: LoaderContext\n  ) => await parseCompositeImageManifest(text, 'image-texture-cube-array', options, context)\n} as const satisfies LoaderWithParser<Texture, never, TextureCubeArrayLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// @ts-nocheck\nimport {getJSModuleOrNull, registerJSModules} from '@loaders.gl/loader-utils';\nimport {loadLibrary, type LoadLibraryOptions} from '@loaders.gl/worker-utils';\n\nexport const CRUNCH_EXTERNAL_LIBRARIES = {\n  /** Crunch decoder library. It is used as dynamically imported script */\n  DECODER: 'crunch.js'\n};\n\n/**\n * Load crunch decoder module\n * @param options - loader options\n * @returns Promise of module object\n */\nexport async function loadCrunchModule(options: LoadLibraryOptions): Promise<any> {\n  registerJSModules(options.modules);\n  const crunch = getJSModuleOrNull('crunch');\n  if (crunch) {\n    return crunch;\n  }\n\n  return loadCrunch(options);\n}\n\nlet crunchModule;\n\n/**\n * Load crunch decoder module\n * @param {any} options - Loader options\n * @returns {Promise<any>} Promise of Module object\n */\nasync function loadCrunch(options: LoadLibraryOptions): Promise<any> {\n  if (crunchModule) {\n    return crunchModule;\n  }\n\n  let loadCrunchDecoder = await loadLibrary(CRUNCH_EXTERNAL_LIBRARIES.DECODER, 'textures', options);\n\n  // Depends on how import happened...\n  // @ts-ignore TS2339: Property does not exist on type\n  loadCrunchDecoder ||= globalThis.LoadCrunchDecoder;\n  crunchModule = loadCrunchDecoder();\n  return crunchModule;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ChildProcessProxy} from '@loaders.gl/worker-utils';\nimport {CompressedTextureWriterOptions} from '../../compressed-texture-writer';\n\n/*\n * @see https://github.com/TimvanScherpenzeel/texture-compressor\n */\nexport async function encodeImageURLToCompressedTextureURL(\n  inputUrl: string,\n  outputUrl: string,\n  options?: CompressedTextureWriterOptions\n): Promise<string> {\n  // prettier-ignore\n  const args = [\n    // Note: our actual executable is `npx`, so `texture-compressor` is an argument\n    'texture-compressor',\n    '--type', 's3tc',\n    '--compression', 'DXT1',\n    '--quality', 'normal',\n    '--input', inputUrl,\n    '--output', outputUrl\n  ];\n  const childProcess = new ChildProcessProxy();\n  await childProcess.start({\n    command: 'npx',\n    arguments: args,\n    spawn: options\n  });\n  return outputUrl;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WriterWithEncoder, WriterOptions} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport {encodeImageURLToCompressedTextureURL} from './lib/encoders/encode-texture';\n\n/** Compressed Texture writer options */\nexport type CompressedTextureWriterOptions = WriterOptions & {\n  /** @deprecated current working directory */\n  cwd?: string;\n  /** Compressed Texture writer options */\n  texture?: {\n    format: string;\n    compression: string;\n    quality: string;\n    mipmap: boolean;\n    flipY: boolean;\n    toolFlags: string;\n  };\n};\n\n/**\n * DDS Texture Container Exporter\n */\nexport const CompressedTextureWriter = {\n  name: 'DDS Texture Container',\n  id: 'dds',\n  module: 'textures',\n  version: VERSION,\n\n  extensions: ['dds'],\n  mimeTypes: ['image/vnd-ms.dds', 'image/x-dds', 'application/octet-stream'],\n\n  options: {\n    texture: {\n      format: 'auto',\n      compression: 'auto',\n      quality: 'auto',\n      mipmap: false,\n      flipY: false,\n      toolFlags: ''\n    }\n  },\n\n  encodeURLtoURL: encodeImageURLToCompressedTextureURL,\n  encode() {\n    throw new Error('Not implemented');\n  }\n} as const satisfies WriterWithEncoder<unknown, unknown, CompressedTextureWriterOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ImageDataType} from '@loaders.gl/images';\nimport {extractLoadLibraryOptions} from '@loaders.gl/worker-utils';\nimport {loadBasisEncoderModule} from '../parsers/basis-module-loader';\nimport {type KTX2BasisWriterOptions} from '../../ktx2-basis-writer';\n\n/**\n * Encodes image to Basis Universal Supercompressed GPU Texture.\n * Code example is taken from here - https://github.com/BinomialLLC/basis_universal/blob/master/webgl/ktx2_encode_test/index.html#L279\n * BasisEncoder API - https://github.com/BinomialLLC/basis_universal/blob/master/webgl/transcoder/basis_wrappers.cpp#L1712\n * @param image\n * @param options\n */\nexport async function encodeKTX2BasisTexture(\n  image: ImageDataType,\n  options: KTX2BasisWriterOptions = {}\n): Promise<ArrayBuffer> {\n  // TODO remove default values after writer options will be normalized like it done in load module.\n  const {\n    useSRGB = false,\n    qualityLevel = 10,\n    encodeUASTC = false,\n    mipmaps = false\n  } = options?.['ktx2-basis-writer'] || {};\n  const {BasisEncoder} = await loadBasisEncoderModule(extractLoadLibraryOptions(options));\n  const basisEncoder = new BasisEncoder();\n\n  try {\n    const basisFileData = new Uint8Array(image.width * image.height * 4);\n    basisEncoder.setCreateKTX2File(true);\n    basisEncoder.setKTX2UASTCSupercompression(true);\n    basisEncoder.setKTX2SRGBTransferFunc(true);\n\n    basisEncoder.setSliceSourceImage(0, image.data, image.width, image.height, false);\n    basisEncoder.setPerceptual(useSRGB);\n    basisEncoder.setMipSRGB(useSRGB);\n    basisEncoder.setQualityLevel(qualityLevel);\n    basisEncoder.setUASTC(encodeUASTC);\n    basisEncoder.setMipGen(mipmaps);\n\n    const numOutputBytes = basisEncoder.encode(basisFileData);\n\n    const actualKTX2FileData = basisFileData.subarray(0, numOutputBytes).buffer;\n    return actualKTX2FileData;\n  } catch (error) {\n    // eslint-disable-next-line no-console\n    console.error('Basis Universal Supercompressed GPU Texture encoder Error: ', error);\n    throw error;\n  } finally {\n    basisEncoder.delete();\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WriterWithEncoder, WriterOptions} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport type {ImageDataType} from '@loaders.gl/images';\nimport {encodeKTX2BasisTexture} from './lib/encoders/encode-ktx2-basis-texture';\n\n/** @todo should be in basis sub-object */\nexport type KTX2BasisWriterOptions = WriterOptions & {\n  ['ktx2-basis-writer']?: {\n    useSRGB?: boolean;\n    qualityLevel?: number;\n    encodeUASTC?: boolean;\n    mipmaps?: boolean;\n  };\n};\n\n/**\n *  Basis Universal Supercompressed GPU Texture.\n *  Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureSetDefinitionFormat.cmn.md\n */\nexport const KTX2BasisWriter = {\n  name: 'Basis Universal Supercompressed GPU Texture',\n  id: 'ktx2-basis-writer',\n  module: 'textures',\n  version: VERSION,\n\n  extensions: ['ktx2'],\n  mimeTypes: ['image/ktx2'],\n  options: {\n    ['ktx2-basis-writer']: {\n      useSRGB: false,\n      qualityLevel: 10,\n      encodeUASTC: false,\n      mipmaps: false\n    }\n  },\n\n  encode: encodeKTX2BasisTexture\n} as const satisfies WriterWithEncoder<ImageDataType, unknown, KTX2BasisWriterOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {assert} from '@loaders.gl/loader-utils';\nimport {getImageSize} from '@loaders.gl/images';\nimport {\n  loadCompositeImageMember,\n  loadCompositeImageUrlTree,\n  normalizeCompositeImageOptions\n} from '../composite-image/parse-composite-image';\nimport type {GetUrl, TextureLoaderOptions, UrlOptions} from './texture-api-types';\nimport {generateUrl} from './generate-url';\n\n/**\n * @deprecated Use `load(url, TextureLoader)` for manifest-driven loading.\n */\nexport async function loadImageTexture(\n  getUrl: string | GetUrl,\n  options: TextureLoaderOptions = {}\n): Promise<any> {\n  const imageUrls = await getImageUrls(getUrl, options);\n  return await loadCompositeImageUrlTree(imageUrls, normalizeCompositeImageOptions(options));\n}\n\nexport async function getImageUrls(\n  getUrl: string | GetUrl,\n  options: TextureLoaderOptions,\n  urlOptions: UrlOptions = {}\n): Promise<any> {\n  const mipLevels = (options && options.image && options.image.mipLevels) || 0;\n  return mipLevels !== 0\n    ? await getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions)\n    : generateUrl(getUrl, options, urlOptions);\n}\n\nasync function getMipmappedImageUrls(\n  getUrl: string | GetUrl,\n  mipLevels: number | 'auto',\n  options: TextureLoaderOptions,\n  urlOptions: UrlOptions\n): Promise<string[]> {\n  const urls: string[] = [];\n  const normalizedOptions = normalizeCompositeImageOptions(options);\n\n  // If no mip levels supplied, we need to load the level 0 image and calculate based on size\n  if (mipLevels === 'auto') {\n    const url = generateUrl(getUrl, options, {...urlOptions, lod: 0});\n    const image = await loadCompositeImageMember(url, normalizedOptions);\n\n    const {width, height} = getImageSize(image);\n    mipLevels = getMipLevels({width, height});\n\n    // TODO - push image and make `deepLoad` pass through non-url values, avoid loading twice?\n    urls.push(url);\n  }\n\n  // We now know how many mipLevels we need, remaining image urls can now be constructed\n  assert(mipLevels > 0);\n\n  for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {\n    const url = generateUrl(getUrl, options, {...urlOptions, lod: mipLevel});\n    urls.push(url);\n  }\n\n  return urls;\n}\n\n// Calculates number of mipmaps based on texture size (log2)\nexport function getMipLevels(size: {width: number; height: number}): number {\n  return 1 + Math.floor(Math.log2(Math.max(size.width, size.height)));\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {GetUrl, UrlOptions} from './texture-api-types';\n\n// Generate a member url by calling getUrl with merged options.\nexport function generateUrl(\n  getUrl: string | GetUrl,\n  options: UrlOptions,\n  urlOptions: Record<string, any>\n): string {\n  return typeof getUrl === 'function' ? getUrl({...options, ...urlOptions}) : getUrl;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  loadCompositeImageUrlTree,\n  normalizeCompositeImageOptions\n} from '../composite-image/parse-composite-image';\nimport type {GetUrl, TextureLoaderOptions} from './texture-api-types';\nimport {getImageUrls} from './load-image';\n\n/**\n * @deprecated Use `load(url, TextureArrayLoader)` for manifest-driven loading.\n */\nexport async function loadImageTextureArray(\n  count: number,\n  getUrl: GetUrl,\n  options: TextureLoaderOptions = {}\n): Promise<any> {\n  const imageUrls = await getImageArrayUrls(count, getUrl, options);\n  return await loadCompositeImageUrlTree(imageUrls, normalizeCompositeImageOptions(options));\n}\n\nexport async function getImageArrayUrls(\n  count: number,\n  getUrl: GetUrl,\n  options: TextureLoaderOptions = {}\n): Promise<any> {\n  const promises: Promise<any>[] = [];\n  for (let index = 0; index < count; index++) {\n    const promise = getImageUrls(getUrl, options, {index});\n    promises.push(promise);\n  }\n  return await Promise.all(promises);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  loadCompositeImageUrlTree,\n  normalizeCompositeImageOptions\n} from '../composite-image/parse-composite-image';\nimport {\n  IMAGE_TEXTURE_CUBE_FACES,\n  type ImageCubeTexture\n} from '../composite-image/image-texture-cube';\nimport type {GetUrl, TextureLoaderOptions} from './texture-api-types';\nimport {getImageUrls} from './load-image';\n\n// Returns an object with six key-value pairs containing the urls (or url mip arrays)\n// for each cube face\nexport async function getImageCubeUrls(getUrl: GetUrl, options: TextureLoaderOptions) {\n  // Calculate URLs\n  const urls: Record<number, string | string[]> = {};\n  const promises: Promise<any>[] = [];\n\n  let index = 0;\n  for (let i = 0; i < IMAGE_TEXTURE_CUBE_FACES.length; ++i) {\n    const face = IMAGE_TEXTURE_CUBE_FACES[index];\n    const promise = getImageUrls(getUrl, options, {...face, index: index++}).then((url) => {\n      urls[face.face] = url;\n    });\n    promises.push(promise);\n  }\n\n  await Promise.all(promises);\n\n  return urls;\n}\n\n// Returns an object with six key-value pairs containing the images (or image mip arrays)\n// for each cube face\n/**\n * @deprecated Use `load(url, TextureCubeLoader)` for manifest-driven loading.\n */\nexport async function loadImageTextureCube(\n  getUrl: GetUrl,\n  options: TextureLoaderOptions = {}\n): Promise<ImageCubeTexture> {\n  const urls = await getImageCubeUrls(getUrl, options);\n  return (await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AAA,GAAE;AAElC,QAAM,OAAO,MAAM,iBAAiB,QAAQ,OAAO;AACnD,SAAQ,MAAM,0BACZ,MACA,+BAA+B,OAAO,CAAC;AAE3C;;;AnCDO,IAAM,wBAAwB;EACnC,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,SAAS;EACT,YAAY,CAAC,MAAM;EACnB,QAAQ;EACR,SAAS;IACP,SAAS;IACT,cAAc;IACd,aAAa;IACb,SAAS;;;",
  "names": ["import_worker_utils", "module", "import_loader_utils", "textureFormats", "import_loader_utils", "textureFormats", "line", "a", "b", "import_loader_utils", "fetch", "import_loader_utils", "import_worker_utils", "import_worker_utils", "import_worker_utils", "import_loader_utils", "import_images"]
}
