@loaders.gl/i3s 4.0.0-beta.3 → 4.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -4939,7 +4939,7 @@ var __exports__ = (() => {
4939
4939
  var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
4940
4940
  var FLOAT_64_TYPE = "Float64";
4941
4941
  var INT_16_ATTRIBUTE_TYPE = "Int16";
4942
- var COORDINATE_SYSTEM = /* @__PURE__ */ function(COORDINATE_SYSTEM2) {
4942
+ var COORDINATE_SYSTEM = function(COORDINATE_SYSTEM2) {
4943
4943
  COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
4944
4944
  COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT"] = 1] = "LNGLAT";
4945
4945
  COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["METER_OFFSETS"] = 2] = "METER_OFFSETS";
@@ -9467,10 +9467,7 @@ var __exports__ = (() => {
9467
9467
  var window_ = globals.window || globals.self || globals.global || {};
9468
9468
  var global_ = globals.global || globals.self || globals.window || {};
9469
9469
  var document_ = globals.document || {};
9470
- var isBrowser = (
9471
- // @ts-ignore process does not exist on browser
9472
- Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
9473
- );
9470
+ var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
9474
9471
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
9475
9472
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
9476
9473
 
@@ -9508,10 +9505,7 @@ var __exports__ = (() => {
9508
9505
  var window_2 = globals2.window || globals2.self || globals2.global || {};
9509
9506
  var global_2 = globals2.global || globals2.self || globals2.window || {};
9510
9507
  var document_2 = globals2.document || {};
9511
- var isBrowser2 = (
9512
- // @ts-ignore process.browser
9513
- typeof process !== "object" || String(process) !== "[object process]" || process.browser
9514
- );
9508
+ var isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
9515
9509
  var isWorker = typeof importScripts === "function";
9516
9510
  var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
9517
9511
  var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
@@ -9524,8 +9518,7 @@ var __exports__ = (() => {
9524
9518
  if (moduleName) {
9525
9519
  libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
9526
9520
  }
9527
- loadLibraryPromises[libraryUrl] = // eslint-disable-next-line @typescript-eslint/no-misused-promises
9528
- loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
9521
+ loadLibraryPromises[libraryUrl] = loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
9529
9522
  return await loadLibraryPromises[libraryUrl];
9530
9523
  }
9531
9524
  function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
@@ -9572,7 +9565,7 @@ var __exports__ = (() => {
9572
9565
  return void 0 && (void 0)(scriptSource, id);
9573
9566
  }
9574
9567
  if (isWorker) {
9575
- eval.call(global_2, scriptSource);
9568
+ eval.call(globalThis, scriptSource);
9576
9569
  return null;
9577
9570
  }
9578
9571
  const script = document.createElement("script");
@@ -9682,49 +9675,26 @@ var __exports__ = (() => {
9682
9675
  return Number(bigint);
9683
9676
  };
9684
9677
  var DataViewFile = class {
9685
- /** The DataView from which data is provided */
9686
9678
  constructor(file) {
9687
9679
  this.file = file;
9688
9680
  }
9689
9681
  async destroy() {
9690
9682
  }
9691
- /**
9692
- * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
9693
- * @param offset The offset, in bytes, from the start of the file where to read the data.
9694
- */
9695
9683
  async getUint8(offset) {
9696
9684
  return this.file.getUint8(toNumber(offset));
9697
9685
  }
9698
- /**
9699
- * Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.
9700
- * @param offset The offset, in bytes, from the start of the file where to read the data.
9701
- */
9702
9686
  async getUint16(offset) {
9703
9687
  return this.file.getUint16(toNumber(offset), true);
9704
9688
  }
9705
- /**
9706
- * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
9707
- * @param offset The offset, in bytes, from the start of the file where to read the data.
9708
- */
9709
9689
  async getUint32(offset) {
9710
9690
  return this.file.getUint32(toNumber(offset), true);
9711
9691
  }
9712
- /**
9713
- * Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.
9714
- * @param offset The offset, in bytes, from the start of the file where to read the data.
9715
- */
9716
9692
  async getBigUint64(offset) {
9717
9693
  return this.file.getBigUint64(toNumber(offset), true);
9718
9694
  }
9719
- /**
9720
- * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
9721
- * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
9722
- * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
9723
- */
9724
9695
  async slice(startOffset, endOffset) {
9725
9696
  return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));
9726
9697
  }
9727
- /** the length (in bytes) of the data. */
9728
9698
  get length() {
9729
9699
  return BigInt(this.file.byteLength);
9730
9700
  }
@@ -9734,12 +9704,10 @@ var __exports__ = (() => {
9734
9704
  var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9735
9705
 
9736
9706
  // ../images/src/lib/category-api/image-type.ts
9737
- var {
9738
- _parseImageNode
9739
- } = globalThis;
9707
+ var parseImageNode = globalThis.loaders?.parseImageNode;
9740
9708
  var IMAGE_SUPPORTED = typeof Image !== "undefined";
9741
9709
  var IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== "undefined";
9742
- var NODE_IMAGE_SUPPORTED = Boolean(_parseImageNode);
9710
+ var NODE_IMAGE_SUPPORTED = Boolean(parseImageNode);
9743
9711
  var DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;
9744
9712
  function isImageTypeSupported(type) {
9745
9713
  switch (type) {
@@ -9840,13 +9808,13 @@ var __exports__ = (() => {
9840
9808
  // ../images/src/lib/parsers/parse-to-image.ts
9841
9809
  async function parseToImage(arrayBuffer, options, url) {
9842
9810
  const blobOrDataUrl = getBlobOrSVGDataUrl(arrayBuffer, url);
9843
- const URL = self.URL || self.webkitURL;
9844
- const objectUrl = typeof blobOrDataUrl !== "string" && URL.createObjectURL(blobOrDataUrl);
9811
+ const URL2 = self.URL || self.webkitURL;
9812
+ const objectUrl = typeof blobOrDataUrl !== "string" && URL2.createObjectURL(blobOrDataUrl);
9845
9813
  try {
9846
9814
  return await loadToImage(objectUrl || blobOrDataUrl, options);
9847
9815
  } finally {
9848
9816
  if (objectUrl) {
9849
- URL.revokeObjectURL(objectUrl);
9817
+ URL2.revokeObjectURL(objectUrl);
9850
9818
  }
9851
9819
  }
9852
9820
  }
@@ -9956,7 +9924,6 @@ var __exports__ = (() => {
9956
9924
  }
9957
9925
  return {
9958
9926
  mimeType: mediaType.mimeType,
9959
- // TODO - decode width and height
9960
9927
  width: 0,
9961
9928
  height: 0
9962
9929
  };
@@ -10014,9 +9981,7 @@ var __exports__ = (() => {
10014
9981
  return {
10015
9982
  mimeType: "image/jpeg",
10016
9983
  height: dataView.getUint16(i2 + 5, BIG_ENDIAN),
10017
- // Number of lines
10018
9984
  width: dataView.getUint16(i2 + 7, BIG_ENDIAN)
10019
- // Number of pixels per line
10020
9985
  };
10021
9986
  }
10022
9987
  if (!tableMarkers.has(marker)) {
@@ -10056,9 +10021,9 @@ var __exports__ = (() => {
10056
10021
  const {
10057
10022
  mimeType
10058
10023
  } = getBinaryImageMetadata(arrayBuffer) || {};
10059
- const _parseImageNode2 = globalThis._parseImageNode;
10060
- assert2(_parseImageNode2);
10061
- return await _parseImageNode2(arrayBuffer, mimeType);
10024
+ const parseImageNode2 = globalThis.loaders?.parseImageNode;
10025
+ assert2(parseImageNode2);
10026
+ return await parseImageNode2(arrayBuffer, mimeType);
10062
10027
  }
10063
10028
 
10064
10029
  // ../images/src/lib/parsers/parse-image.ts
@@ -10107,9 +10072,7 @@ var __exports__ = (() => {
10107
10072
  image: {
10108
10073
  type: "auto",
10109
10074
  decode: true
10110
- // if format is HTML
10111
10075
  }
10112
- // imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
10113
10076
  };
10114
10077
  var ImageLoader = {
10115
10078
  id: "image",
@@ -10119,7 +10082,6 @@ var __exports__ = (() => {
10119
10082
  mimeTypes: MIME_TYPES,
10120
10083
  extensions: EXTENSIONS,
10121
10084
  parse: parseImage,
10122
- // TODO: byteOffset, byteLength;
10123
10085
  tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
10124
10086
  options: DEFAULT_IMAGE_LOADER_OPTIONS
10125
10087
  };
@@ -10131,7 +10093,6 @@ var __exports__ = (() => {
10131
10093
  var DEFAULT_DRACO_OPTIONS = {
10132
10094
  draco: {
10133
10095
  decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
10134
- // 'js' for IE11
10135
10096
  libraryPath: "libs/",
10136
10097
  extraAttributes: {},
10137
10098
  attributeNameEntry: void 0
@@ -10141,7 +10102,6 @@ var __exports__ = (() => {
10141
10102
  name: "Draco",
10142
10103
  id: "draco",
10143
10104
  module: "draco",
10144
- // shapes: ['mesh'],
10145
10105
  version: VERSION3,
10146
10106
  worker: true,
10147
10107
  extensions: ["drc"],
@@ -10291,24 +10251,15 @@ var __exports__ = (() => {
10291
10251
  };
10292
10252
  var INDEX_ITEM_SIZE = 4;
10293
10253
  var DracoParser = class {
10294
- // draco - the draco decoder, either import `draco3d` or load dynamically
10295
10254
  constructor(draco) {
10296
10255
  this.draco = draco;
10297
10256
  this.decoder = new this.draco.Decoder();
10298
10257
  this.metadataQuerier = new this.draco.MetadataQuerier();
10299
10258
  }
10300
- /**
10301
- * Destroy draco resources
10302
- */
10303
10259
  destroy() {
10304
10260
  this.draco.destroy(this.decoder);
10305
10261
  this.draco.destroy(this.metadataQuerier);
10306
10262
  }
10307
- /**
10308
- * NOTE: caller must call `destroyGeometry` on the return value after using it
10309
- * @param arrayBuffer
10310
- * @param options
10311
- */
10312
10263
  parseSync(arrayBuffer, options = {}) {
10313
10264
  const buffer = new this.draco.DecoderBuffer();
10314
10265
  buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);
@@ -10353,14 +10304,6 @@ var __exports__ = (() => {
10353
10304
  }
10354
10305
  }
10355
10306
  }
10356
- // Draco specific "loader data"
10357
- /**
10358
- * Extract
10359
- * @param dracoGeometry
10360
- * @param geometry_type
10361
- * @param options
10362
- * @returns
10363
- */
10364
10307
  _getDracoLoaderData(dracoGeometry, geometry_type, options) {
10365
10308
  const metadata = this._getTopLevelMetadata(dracoGeometry);
10366
10309
  const attributes = this._getDracoAttributes(dracoGeometry, options);
@@ -10373,12 +10316,6 @@ var __exports__ = (() => {
10373
10316
  attributes
10374
10317
  };
10375
10318
  }
10376
- /**
10377
- * Extract all draco provided information and metadata for each attribute
10378
- * @param dracoGeometry
10379
- * @param options
10380
- * @returns
10381
- */
10382
10319
  _getDracoAttributes(dracoGeometry, options) {
10383
10320
  const dracoAttributes = {};
10384
10321
  for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
@@ -10406,12 +10343,6 @@ var __exports__ = (() => {
10406
10343
  }
10407
10344
  return dracoAttributes;
10408
10345
  }
10409
- /**
10410
- * Get standard loaders.gl mesh category data
10411
- * Extracts the geometry from draco
10412
- * @param dracoGeometry
10413
- * @param options
10414
- */
10415
10346
  _getMeshData(dracoGeometry, loaderData, options) {
10416
10347
  const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);
10417
10348
  const positionAttribute = attributes.POSITION;
@@ -10424,7 +10355,6 @@ var __exports__ = (() => {
10424
10355
  return {
10425
10356
  topology: "triangle-strip",
10426
10357
  mode: 4,
10427
- // GL.TRIANGLES
10428
10358
  attributes,
10429
10359
  indices: {
10430
10360
  value: this._getTriangleStripIndices(dracoGeometry),
@@ -10436,7 +10366,6 @@ var __exports__ = (() => {
10436
10366
  return {
10437
10367
  topology: "triangle-list",
10438
10368
  mode: 5,
10439
- // GL.TRIANGLE_STRIP
10440
10369
  attributes,
10441
10370
  indices: {
10442
10371
  value: this._getTriangleListIndices(dracoGeometry),
@@ -10448,7 +10377,6 @@ var __exports__ = (() => {
10448
10377
  return {
10449
10378
  topology: "point-list",
10450
10379
  mode: 0,
10451
- // GL.POINTS
10452
10380
  attributes
10453
10381
  };
10454
10382
  }
@@ -10471,11 +10399,6 @@ var __exports__ = (() => {
10471
10399
  }
10472
10400
  return attributes;
10473
10401
  }
10474
- // MESH INDICES EXTRACTION
10475
- /**
10476
- * For meshes, we need indices to define the faces.
10477
- * @param dracoGeometry
10478
- */
10479
10402
  _getTriangleListIndices(dracoGeometry) {
10480
10403
  const numFaces = dracoGeometry.num_faces();
10481
10404
  const numIndices = numFaces * 3;
@@ -10488,10 +10411,6 @@ var __exports__ = (() => {
10488
10411
  this.draco._free(ptr);
10489
10412
  }
10490
10413
  }
10491
- /**
10492
- * For meshes, we need indices to define the faces.
10493
- * @param dracoGeometry
10494
- */
10495
10414
  _getTriangleStripIndices(dracoGeometry) {
10496
10415
  const dracoArray = new this.draco.DracoInt32Array();
10497
10416
  try {
@@ -10501,12 +10420,6 @@ var __exports__ = (() => {
10501
10420
  this.draco.destroy(dracoArray);
10502
10421
  }
10503
10422
  }
10504
- /**
10505
- *
10506
- * @param dracoGeometry
10507
- * @param dracoAttribute
10508
- * @param attributeName
10509
- */
10510
10423
  _getAttributeValues(dracoGeometry, attribute) {
10511
10424
  const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];
10512
10425
  const numComponents = attribute.num_components;
@@ -10528,30 +10441,6 @@ var __exports__ = (() => {
10528
10441
  size: numComponents
10529
10442
  };
10530
10443
  }
10531
- // Attribute names
10532
- /**
10533
- * DRACO does not store attribute names - We need to deduce an attribute name
10534
- * for each attribute
10535
- _getAttributeNames(
10536
- dracoGeometry: Mesh | PointCloud,
10537
- options: DracoParseOptions
10538
- ): {[unique_id: number]: string} {
10539
- const attributeNames: {[unique_id: number]: string} = {};
10540
- for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
10541
- const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);
10542
- const attributeName = this._deduceAttributeName(dracoAttribute, options);
10543
- attributeNames[attributeName] = attributeName;
10544
- }
10545
- return attributeNames;
10546
- }
10547
- */
10548
- /**
10549
- * Deduce an attribute name.
10550
- * @note DRACO does not save attribute names, just general type (POSITION, COLOR)
10551
- * to help optimize compression. We generate GLTF compatible names for the Draco-recognized
10552
- * types
10553
- * @param attributeData
10554
- */
10555
10444
  _deduceAttributeName(attribute, options) {
10556
10445
  const uniqueId = attribute.unique_id;
10557
10446
  for (const [attributeName, attributeUniqueId] of Object.entries(options.extraAttributes || {})) {
@@ -10572,22 +10461,14 @@ var __exports__ = (() => {
10572
10461
  }
10573
10462
  return `CUSTOM_ATTRIBUTE_${uniqueId}`;
10574
10463
  }
10575
- // METADATA EXTRACTION
10576
- /** Get top level metadata */
10577
10464
  _getTopLevelMetadata(dracoGeometry) {
10578
10465
  const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);
10579
10466
  return this._getDracoMetadata(dracoMetadata);
10580
10467
  }
10581
- /** Get per attribute metadata */
10582
10468
  _getAttributeMetadata(dracoGeometry, attributeId) {
10583
10469
  const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);
10584
10470
  return this._getDracoMetadata(dracoMetadata);
10585
10471
  }
10586
- /**
10587
- * Extract metadata field values
10588
- * @param dracoMetadata
10589
- * @returns
10590
- */
10591
10472
  _getDracoMetadata(dracoMetadata) {
10592
10473
  if (!dracoMetadata || !dracoMetadata.ptr) {
10593
10474
  return {};
@@ -10600,11 +10481,6 @@ var __exports__ = (() => {
10600
10481
  }
10601
10482
  return result;
10602
10483
  }
10603
- /**
10604
- * Extracts possible values for one metadata entry by name
10605
- * @param dracoMetadata
10606
- * @param entryName
10607
- */
10608
10484
  _getDracoMetadataField(dracoMetadata, entryName) {
10609
10485
  const dracoArray = new this.draco.DracoInt32Array();
10610
10486
  try {
@@ -10620,8 +10496,6 @@ var __exports__ = (() => {
10620
10496
  this.draco.destroy(dracoArray);
10621
10497
  }
10622
10498
  }
10623
- // QUANTIZED ATTRIBUTE SUPPORT (NO DECOMPRESSION)
10624
- /** Skip transforms for specific attribute types */
10625
10499
  _disableAttributeTransforms(options) {
10626
10500
  const {
10627
10501
  quantizedAttributes = [],
@@ -10632,10 +10506,6 @@ var __exports__ = (() => {
10632
10506
  this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);
10633
10507
  }
10634
10508
  }
10635
- /**
10636
- * Extract (and apply?) Position Transform
10637
- * @todo not used
10638
- */
10639
10509
  _getQuantizationTransform(dracoAttribute, options) {
10640
10510
  const {
10641
10511
  quantizedAttributes = []
@@ -10678,7 +10548,6 @@ var __exports__ = (() => {
10678
10548
  }
10679
10549
  return null;
10680
10550
  }
10681
- // HELPERS
10682
10551
  };
10683
10552
  function getDracoDataType(draco, attributeType) {
10684
10553
  switch (attributeType) {
@@ -10722,13 +10591,9 @@ var __exports__ = (() => {
10722
10591
  var DRACO_ENCODER_VERSION = "1.4.1";
10723
10592
  var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
10724
10593
  var DRACO_EXTERNAL_LIBRARIES = {
10725
- /** The primary Draco3D encoder, javascript wrapper part */
10726
10594
  DECODER: "draco_wasm_wrapper.js",
10727
- /** The primary draco decoder, compiled web assembly part */
10728
10595
  DECODER_WASM: "draco_decoder.wasm",
10729
- /** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
10730
10596
  FALLBACK_DECODER: "draco_decoder.js",
10731
- /** Draco encoder */
10732
10597
  ENCODER: "draco_encoder.js"
10733
10598
  };
10734
10599
  var DRACO_EXTERNAL_LIBRARY_URLS = {
@@ -10776,7 +10641,6 @@ var __exports__ = (() => {
10776
10641
  onModuleLoaded: (draco) => resolve({
10777
10642
  draco
10778
10643
  })
10779
- // Module is Promise-like. Wrap in object to avoid loop.
10780
10644
  });
10781
10645
  });
10782
10646
  }
@@ -10803,13 +10667,9 @@ var __exports__ = (() => {
10803
10667
 
10804
10668
  // ../textures/src/lib/parsers/basis-module-loader.ts
10805
10669
  var BASIS_EXTERNAL_LIBRARIES = {
10806
- /** Basis transcoder, javascript wrapper part */
10807
10670
  TRANSCODER: "basis_transcoder.js",
10808
- /** Basis transcoder, compiled web assembly part */
10809
10671
  TRANSCODER_WASM: "basis_transcoder.wasm",
10810
- /** Basis encoder, javascript wrapper part */
10811
10672
  ENCODER: "basis_encoder.js",
10812
- /** Basis encoder, compiled web assembly part */
10813
10673
  ENCODER_WASM: "basis_encoder.wasm"
10814
10674
  };
10815
10675
  var loadBasisTranscoderPromise;
@@ -10887,12 +10747,10 @@ var __exports__ = (() => {
10887
10747
 
10888
10748
  // ../textures/src/lib/gl-extensions.ts
10889
10749
  var GL_EXTENSIONS_CONSTANTS = {
10890
- // WEBGL_compressed_texture_s3tc
10891
10750
  COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
10892
10751
  COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
10893
10752
  COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
10894
10753
  COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
10895
- // WEBGL_compressed_texture_es3
10896
10754
  COMPRESSED_R11_EAC: 37488,
10897
10755
  COMPRESSED_SIGNED_R11_EAC: 37489,
10898
10756
  COMPRESSED_RG11_EAC: 37490,
@@ -10903,18 +10761,14 @@ var __exports__ = (() => {
10903
10761
  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
10904
10762
  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
10905
10763
  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
10906
- // WEBGL_compressed_texture_pvrtc
10907
10764
  COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
10908
10765
  COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
10909
10766
  COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
10910
10767
  COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
10911
- // WEBGL_compressed_texture_etc1
10912
10768
  COMPRESSED_RGB_ETC1_WEBGL: 36196,
10913
- // WEBGL_compressed_texture_atc
10914
10769
  COMPRESSED_RGB_ATC_WEBGL: 35986,
10915
10770
  COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
10916
10771
  COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
10917
- // WEBGL_compressed_texture_astc
10918
10772
  COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
10919
10773
  COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
10920
10774
  COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
@@ -10943,12 +10797,10 @@ var __exports__ = (() => {
10943
10797
  COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
10944
10798
  COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
10945
10799
  COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
10946
- // EXT_texture_compression_rgtc
10947
10800
  COMPRESSED_RED_RGTC1_EXT: 36283,
10948
10801
  COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
10949
10802
  COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
10950
10803
  COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
10951
- // WEBGL_compressed_texture_s3tc_srgb
10952
10804
  COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
10953
10805
  COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
10954
10806
  COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
@@ -10958,7 +10810,6 @@ var __exports__ = (() => {
10958
10810
  // ../textures/src/lib/utils/texture-formats.ts
10959
10811
  var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
10960
10812
  var WEBGL_EXTENSIONS = {
10961
- /* eslint-disable camelcase */
10962
10813
  WEBGL_compressed_texture_s3tc: "dxt",
10963
10814
  WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
10964
10815
  WEBGL_compressed_texture_etc1: "etc1",
@@ -10967,7 +10818,6 @@ var __exports__ = (() => {
10967
10818
  WEBGL_compressed_texture_atc: "atc",
10968
10819
  WEBGL_compressed_texture_astc: "astc",
10969
10820
  EXT_texture_compression_rgtc: "rgtc"
10970
- /* eslint-enable camelcase */
10971
10821
  };
10972
10822
  var formats = null;
10973
10823
  function getSupportedGPUTextureFormats(gl) {
@@ -11150,91 +11000,49 @@ var __exports__ = (() => {
11150
11000
  154: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_R11_EAC,
11151
11001
  155: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC,
11152
11002
  156: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RG11_EAC,
11153
- // @ts-ignore
11154
11003
  157: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
11155
- // @ts-ignore
11156
11004
  158: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
11157
- // @ts-ignore
11158
11005
  159: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
11159
- // @ts-ignore
11160
11006
  160: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
11161
- // @ts-ignore
11162
11007
  161: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
11163
- // @ts-ignore
11164
11008
  162: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
11165
- // @ts-ignore
11166
11009
  163: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
11167
- // @ts-ignore
11168
11010
  164: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
11169
- // @ts-ignore
11170
11011
  165: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
11171
- // @ts-ignore
11172
11012
  166: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
11173
- // @ts-ignore
11174
11013
  167: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
11175
- // @ts-ignore
11176
11014
  168: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
11177
- // @ts-ignore
11178
11015
  169: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
11179
- // @ts-ignore
11180
11016
  170: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
11181
- // @ts-ignore
11182
11017
  171: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
11183
- // @ts-ignore
11184
11018
  172: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
11185
- // @ts-ignore
11186
11019
  173: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
11187
- // @ts-ignore
11188
11020
  174: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
11189
- // @ts-ignore
11190
11021
  175: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
11191
- // @ts-ignore
11192
11022
  176: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
11193
- // @ts-ignore
11194
11023
  177: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
11195
- // @ts-ignore
11196
11024
  178: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
11197
- // @ts-ignore
11198
11025
  179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
11199
- // @ts-ignore
11200
11026
  180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
11201
- // @ts-ignore
11202
11027
  181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
11203
- // @ts-ignore
11204
11028
  182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
11205
- // @ts-ignore
11206
11029
  183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
11207
- // @ts-ignore
11208
11030
  184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
11209
11031
  1000054e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
11210
11032
  1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
11211
- // @ts-ignore
11212
11033
  1000066e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
11213
- // @ts-ignore
11214
11034
  1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
11215
- // @ts-ignore
11216
11035
  1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
11217
- // @ts-ignore
11218
11036
  1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
11219
- // @ts-ignore
11220
11037
  1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
11221
- // @ts-ignore
11222
11038
  1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
11223
- // @ts-ignore
11224
11039
  1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
11225
- // @ts-ignore
11226
11040
  1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
11227
- // @ts-ignore
11228
11041
  1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
11229
- // @ts-ignore
11230
11042
  1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
11231
- // @ts-ignore
11232
11043
  1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
11233
- // @ts-ignore
11234
11044
  1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
11235
- // @ts-ignore
11236
11045
  1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
11237
- // @ts-ignore
11238
11046
  1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
11239
11047
  };
11240
11048
  function mapVkFormatToWebGL(vkFormat) {
@@ -11242,35 +11050,10 @@ var __exports__ = (() => {
11242
11050
  }
11243
11051
 
11244
11052
  // ../textures/src/lib/parsers/parse-ktx.ts
11245
- var KTX2_ID = [
11246
- // '´', 'K', 'T', 'X', '2', '0', 'ª', '\r', '\n', '\x1A', '\n'
11247
- 171,
11248
- 75,
11249
- 84,
11250
- 88,
11251
- 32,
11252
- 50,
11253
- 48,
11254
- 187,
11255
- 13,
11256
- 10,
11257
- 26,
11258
- 10
11259
- ];
11053
+ var KTX2_ID = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
11260
11054
  function isKTX(data) {
11261
11055
  const id = new Uint8Array(data);
11262
- const notKTX = id.byteLength < KTX2_ID.length || id[0] !== KTX2_ID[0] || // '´'
11263
- id[1] !== KTX2_ID[1] || // 'K'
11264
- id[2] !== KTX2_ID[2] || // 'T'
11265
- id[3] !== KTX2_ID[3] || // 'X'
11266
- id[4] !== KTX2_ID[4] || // ' '
11267
- id[5] !== KTX2_ID[5] || // '2'
11268
- id[6] !== KTX2_ID[6] || // '0'
11269
- id[7] !== KTX2_ID[7] || // 'ª'
11270
- id[8] !== KTX2_ID[8] || // '\r'
11271
- id[9] !== KTX2_ID[9] || // '\n'
11272
- id[10] !== KTX2_ID[10] || // '\x1A'
11273
- id[11] !== KTX2_ID[11];
11056
+ const notKTX = id.byteLength < KTX2_ID.length || id[0] !== KTX2_ID[0] || id[1] !== KTX2_ID[1] || id[2] !== KTX2_ID[2] || id[3] !== KTX2_ID[3] || id[4] !== KTX2_ID[4] || id[5] !== KTX2_ID[5] || id[6] !== KTX2_ID[6] || id[7] !== KTX2_ID[7] || id[8] !== KTX2_ID[8] || id[9] !== KTX2_ID[9] || id[10] !== KTX2_ID[10] || id[11] !== KTX2_ID[11];
11274
11057
  return !notKTX;
11275
11058
  }
11276
11059
  function parseKTX(arrayBuffer) {
@@ -11420,9 +11203,7 @@ var __exports__ = (() => {
11420
11203
  function transcodeImage(basisFile, imageIndex, levelIndex, options) {
11421
11204
  const width = basisFile.getImageWidth(imageIndex, levelIndex);
11422
11205
  const height = basisFile.getImageHeight(imageIndex, levelIndex);
11423
- const hasAlpha = basisFile.getHasAlpha(
11424
- /* imageIndex, levelIndex */
11425
- );
11206
+ const hasAlpha = basisFile.getHasAlpha();
11426
11207
  const {
11427
11208
  compressed,
11428
11209
  format,
@@ -11434,14 +11215,11 @@ var __exports__ = (() => {
11434
11215
  throw new Error("failed to start Basis transcoding");
11435
11216
  }
11436
11217
  return {
11437
- // standard loaders.gl image category payload
11438
11218
  width,
11439
11219
  height,
11440
11220
  data: decodedData,
11441
11221
  compressed,
11442
11222
  format,
11443
- // Additional fields
11444
- // Add levelSize field.
11445
11223
  hasAlpha
11446
11224
  };
11447
11225
  }
@@ -11476,26 +11254,14 @@ var __exports__ = (() => {
11476
11254
  } = getBasisOptions(options, alphaFlag);
11477
11255
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
11478
11256
  const decodedData = new Uint8Array(decodedSize);
11479
- if (!ktx2File.transcodeImage(
11480
- decodedData,
11481
- levelIndex,
11482
- 0,
11483
- 0,
11484
- basisFormat,
11485
- 0,
11486
- -1,
11487
- -1
11488
- /* channel1 */
11489
- )) {
11257
+ if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
11490
11258
  throw new Error("Failed to transcode KTX2 image");
11491
11259
  }
11492
11260
  return {
11493
- // standard loaders.gl image category payload
11494
11261
  width,
11495
11262
  height,
11496
11263
  data: decodedData,
11497
11264
  compressed,
11498
- // Additional fields
11499
11265
  levelSize: decodedSize,
11500
11266
  hasAlpha: alphaFlag,
11501
11267
  format
@@ -11548,12 +11314,9 @@ var __exports__ = (() => {
11548
11314
  options: {
11549
11315
  basis: {
11550
11316
  format: "auto",
11551
- // gl context doesn't exist on a worker thread
11552
11317
  libraryPath: "libs/",
11553
11318
  containerFormat: "auto",
11554
- // 'basis' || 'ktx2' || 'auto'
11555
11319
  module: "transcoder"
11556
- // 'transcoder' || 'encoder'
11557
11320
  }
11558
11321
  }
11559
11322
  };
@@ -11809,14 +11572,7 @@ var __exports__ = (() => {
11809
11572
  module: "textures",
11810
11573
  version: VERSION4,
11811
11574
  worker: true,
11812
- extensions: [
11813
- "ktx",
11814
- "ktx2",
11815
- "dds",
11816
- // WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_atc
11817
- "pvr"
11818
- // WEBGL_compressed_texture_pvrtc
11819
- ],
11575
+ extensions: ["ktx", "ktx2", "dds", "pvr"],
11820
11576
  mimeTypes: ["image/ktx2", "image/ktx", "image/vnd-ms.dds", "image/x-dds", "application/octet-stream"],
11821
11577
  binary: true,
11822
11578
  options: {
@@ -11835,7 +11591,6 @@ var __exports__ = (() => {
11835
11591
  alpha: "BC3",
11836
11592
  noAlpha: "BC1"
11837
11593
  },
11838
- // @ts-expect-error TODO not allowed to modify inputs
11839
11594
  ...options.basis,
11840
11595
  containerFormat: "ktx2",
11841
11596
  module: "encoder"
@@ -11848,13 +11603,22 @@ var __exports__ = (() => {
11848
11603
  };
11849
11604
 
11850
11605
  // src/types.ts
11851
- var HeaderAttributeProperty = /* @__PURE__ */ function(HeaderAttributeProperty2) {
11606
+ var HeaderAttributeProperty = function(HeaderAttributeProperty2) {
11852
11607
  HeaderAttributeProperty2["vertexCount"] = "vertexCount";
11853
11608
  HeaderAttributeProperty2["featureCount"] = "featureCount";
11854
11609
  return HeaderAttributeProperty2;
11855
11610
  }({});
11856
11611
 
11857
11612
  // src/lib/utils/url-utils.ts
11613
+ function getUrlWithoutParams(url) {
11614
+ let urlWithoutParams;
11615
+ try {
11616
+ const urlObj = new URL(url);
11617
+ urlWithoutParams = `${urlObj.origin}${urlObj.pathname}`;
11618
+ } catch (e2) {
11619
+ }
11620
+ return urlWithoutParams || url;
11621
+ }
11858
11622
  function getUrlWithToken(url, token = null) {
11859
11623
  return token ? `${url}?token=${token}` : url;
11860
11624
  }
@@ -12088,11 +11852,7 @@ var __exports__ = (() => {
12088
11852
  }
12089
11853
  const attributeValuesMap = {};
12090
11854
  for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
12091
- attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(
12092
- // @ts-expect-error
12093
- colorizeAttributeData[colorizeAttributeField.name][i2],
12094
- options
12095
- );
11855
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
12096
11856
  }
12097
11857
  for (let i2 = 0; i2 < featureIds.value.length; i2++) {
12098
11858
  const color = attributeValuesMap[featureIds.value[i2]];
@@ -12287,10 +12047,8 @@ var __exports__ = (() => {
12287
12047
  positions: attributes.position,
12288
12048
  normals: attributes.normal,
12289
12049
  colors: normalizeAttribute(attributes.color),
12290
- // Normalize from UInt8
12291
12050
  texCoords: attributes.uv0,
12292
12051
  uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
12293
- // Normalize from UInt16
12294
12052
  };
12295
12053
  content.indices = indices || null;
12296
12054
  if (attributes.id && attributes.id.value) {
@@ -13054,23 +12812,28 @@ var __exports__ = (() => {
13054
12812
  var import_core19 = __toESM(require_core(), 1);
13055
12813
 
13056
12814
  // ../tiles/src/constants.ts
13057
- var TILE_REFINEMENT = /* @__PURE__ */ function(TILE_REFINEMENT2) {
12815
+ var TILE_REFINEMENT = function(TILE_REFINEMENT2) {
13058
12816
  TILE_REFINEMENT2[TILE_REFINEMENT2["ADD"] = 1] = "ADD";
13059
12817
  TILE_REFINEMENT2[TILE_REFINEMENT2["REPLACE"] = 2] = "REPLACE";
13060
12818
  return TILE_REFINEMENT2;
13061
12819
  }({});
13062
- var TILE_TYPE = /* @__PURE__ */ function(TILE_TYPE2) {
12820
+ var TILE_TYPE = function(TILE_TYPE2) {
13063
12821
  TILE_TYPE2["EMPTY"] = "empty";
13064
12822
  TILE_TYPE2["SCENEGRAPH"] = "scenegraph";
13065
12823
  TILE_TYPE2["POINTCLOUD"] = "pointcloud";
13066
12824
  TILE_TYPE2["MESH"] = "mesh";
13067
12825
  return TILE_TYPE2;
13068
12826
  }({});
13069
- var TILESET_TYPE = /* @__PURE__ */ function(TILESET_TYPE2) {
12827
+ var TILESET_TYPE = function(TILESET_TYPE2) {
13070
12828
  TILESET_TYPE2["I3S"] = "I3S";
13071
12829
  TILESET_TYPE2["TILES3D"] = "TILES3D";
13072
12830
  return TILESET_TYPE2;
13073
12831
  }({});
12832
+ var LOD_METRIC_TYPE = function(LOD_METRIC_TYPE2) {
12833
+ LOD_METRIC_TYPE2["GEOMETRIC_ERROR"] = "geometricError";
12834
+ LOD_METRIC_TYPE2["MAX_SCREEN_THRESHOLD"] = "maxScreenThreshold";
12835
+ return LOD_METRIC_TYPE2;
12836
+ }({});
13074
12837
 
13075
12838
  // src/lib/helpers/i3s-nodepages-tiles.ts
13076
12839
  var import_core18 = __toESM(require_core(), 1);
@@ -13099,13 +12862,6 @@ var __exports__ = (() => {
13099
12862
  pendingNodePages = [];
13100
12863
  textureDefinitionsSelectedFormats = [];
13101
12864
  textureLoaderOptions = {};
13102
- /**
13103
- * @constructs
13104
- * Create a I3SNodePagesTiles instance.
13105
- * @param tileset - i3s tileset header ('layers/0')
13106
- * @param url - tileset url
13107
- * @param options - i3s loader options
13108
- */
13109
12865
  constructor(tileset, url = "", options) {
13110
12866
  this.tileset = {
13111
12867
  ...tileset
@@ -13117,18 +12873,10 @@ var __exports__ = (() => {
13117
12873
  this.nodesInNodePages = 0;
13118
12874
  this.initSelectedFormatsForTextureDefinitions(tileset);
13119
12875
  }
13120
- /**
13121
- * Loads some nodePage and return a particular node from it
13122
- * @param id - id of node through all node pages
13123
- */
13124
12876
  async getNodeById(id) {
13125
12877
  const pageIndex = Math.floor(id / this.nodesPerPage);
13126
12878
  if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {
13127
- const nodePageUrl = getUrlWithToken(
13128
- `${this.url}/nodepages/${pageIndex}`,
13129
- // @ts-expect-error this.options is not properly typed
13130
- this.options.i3s?.token
13131
- );
12879
+ const nodePageUrl = getUrlWithToken(`${this.url}/nodepages/${pageIndex}`, this.options.i3s?.token);
13132
12880
  this.pendingNodePages[pageIndex] = {
13133
12881
  status: "Pending",
13134
12882
  promise: (0, import_core18.load)(nodePageUrl, I3SNodePageLoader, this.options)
@@ -13143,11 +12891,6 @@ var __exports__ = (() => {
13143
12891
  const nodeIndex = id % this.nodesPerPage;
13144
12892
  return this.nodePages[pageIndex].nodes[nodeIndex];
13145
12893
  }
13146
- /**
13147
- * Forms tile header using node and tileset data
13148
- * @param id - id of node through all node pages
13149
- */
13150
- // eslint-disable-next-line complexity, max-statements
13151
12894
  async formTileFromNodePages(id) {
13152
12895
  const node2 = await this.getNodeById(id);
13153
12896
  const children = [];
@@ -13205,13 +12948,6 @@ var __exports__ = (() => {
13205
12948
  isDracoGeometry
13206
12949
  });
13207
12950
  }
13208
- /**
13209
- * Forms url and type of geometry resource by nodepage's data and `geometryDefinitions` in the tileset
13210
- * @param - data about the node's mesh from the nodepage
13211
- * @returns -
13212
- * {string} url - url to the geometry resource
13213
- * {boolean} isDracoGeometry - whether the geometry resource contain DRACO compressed geometry
13214
- */
13215
12951
  getContentUrl(meshGeometryData) {
13216
12952
  let result = null;
13217
12953
  const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];
@@ -13231,35 +12967,20 @@ var __exports__ = (() => {
13231
12967
  }
13232
12968
  return result;
13233
12969
  }
13234
- /**
13235
- * Forms 1.6 compatible LOD selection object from a nodepage's node data
13236
- * @param node - a node from nodepage
13237
- * @returns- Array of LodSelection
13238
- */
13239
12970
  getLodSelection(node2) {
13240
12971
  const lodSelection = [];
13241
12972
  if (this.lodSelectionMetricType === "maxScreenThresholdSQ") {
13242
12973
  lodSelection.push({
13243
12974
  metricType: "maxScreenThreshold",
13244
- // @ts-ignore
13245
12975
  maxError: Math.sqrt(node2.lodThreshold / (Math.PI * 0.25))
13246
12976
  });
13247
12977
  }
13248
12978
  lodSelection.push({
13249
12979
  metricType: this.lodSelectionMetricType,
13250
- // @ts-ignore
13251
12980
  maxError: node2.lodThreshold
13252
12981
  });
13253
12982
  return lodSelection;
13254
12983
  }
13255
- /**
13256
- * Returns information about texture and material from `materialDefinitions`
13257
- * @param material - material data from nodepage
13258
- * @returns - Couple {textureData, materialDefinition}
13259
- * {string} textureData.name - path name of the texture
13260
- * {string} textureData.format - format of the texture
13261
- * materialDefinition - PBR-like material definition from `materialDefinitions`
13262
- */
13263
12984
  getInformationFromMaterial(material) {
13264
12985
  const informationFromMaterial = {
13265
12986
  textureData: {
@@ -13278,11 +12999,6 @@ var __exports__ = (() => {
13278
12999
  }
13279
13000
  return informationFromMaterial;
13280
13001
  }
13281
- /**
13282
- * Sets preferable and supported format for each textureDefinition of the tileset
13283
- * @param tileset - I3S layer data
13284
- * @returns
13285
- */
13286
13002
  initSelectedFormatsForTextureDefinitions(tileset) {
13287
13003
  this.textureDefinitionsSelectedFormats = [];
13288
13004
  const possibleI3sFormats = this.getSupportedTextureFormats();
@@ -13307,10 +13023,6 @@ var __exports__ = (() => {
13307
13023
  this.textureDefinitionsSelectedFormats.push(selectedFormat);
13308
13024
  }
13309
13025
  }
13310
- /**
13311
- * Returns the array of supported texture format
13312
- * @returns list of format strings
13313
- */
13314
13026
  getSupportedTextureFormats() {
13315
13027
  const formats2 = [];
13316
13028
  if (!this.options.i3s || this.options.i3s.useCompressedTextures) {
@@ -13352,7 +13064,6 @@ var __exports__ = (() => {
13352
13064
  contentUrl,
13353
13065
  textureUrl,
13354
13066
  textureFormat: "jpg",
13355
- // `jpg` format will cause `ImageLoader` usage that will be able to handle `png` as well
13356
13067
  attributeUrls,
13357
13068
  isDracoGeometry: false
13358
13069
  });
@@ -13362,21 +13073,9 @@ var __exports__ = (() => {
13362
13073
  let mbs = [0, 0, 0, 1];
13363
13074
  if (tile.mbs) {
13364
13075
  mbs = tile.mbs;
13365
- boundingVolume.sphere = [
13366
- ...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)),
13367
- // cartesian center of sphere
13368
- tile.mbs[3]
13369
- // radius of sphere
13370
- ];
13076
+ boundingVolume.sphere = [...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), tile.mbs[3]];
13371
13077
  } else if (tile.obb) {
13372
- boundingVolume.box = [
13373
- ...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center),
13374
- // cartesian center of box
13375
- ...tile.obb.halfSize,
13376
- // halfSize
13377
- ...tile.obb.quaternion
13378
- // quaternion
13379
- ];
13078
+ boundingVolume.box = [...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), ...tile.obb.halfSize, ...tile.obb.quaternion];
13380
13079
  const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(boundingVolume.box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);
13381
13080
  const boundingSphere = obb.getBoundingSphere();
13382
13081
  boundingVolume.sphere = [...boundingSphere.center, boundingSphere.radius];
@@ -13397,7 +13096,7 @@ var __exports__ = (() => {
13397
13096
  };
13398
13097
  }
13399
13098
  async function normalizeTilesetData(tileset, options, context) {
13400
- const url = context.url;
13099
+ const url = getUrlWithoutParams(context.url || "");
13401
13100
  let nodePagesTile;
13402
13101
  let root;
13403
13102
  if (tileset.nodePages) {
@@ -13409,7 +13108,6 @@ var __exports__ = (() => {
13409
13108
  root = await (0, import_core19.load)(rootNodeUrl, I3SLoader, {
13410
13109
  ...options,
13411
13110
  i3s: {
13412
- // @ts-expect-error options is not properly typed
13413
13111
  ...options.i3s,
13414
13112
  loadContent: false,
13415
13113
  isTileHeader: true,
@@ -13424,7 +13122,6 @@ var __exports__ = (() => {
13424
13122
  basePath: url,
13425
13123
  type: TILESET_TYPE.I3S,
13426
13124
  nodePagesTile,
13427
- // @ts-expect-error
13428
13125
  root,
13429
13126
  lodMetricType: root.lodMetricType,
13430
13127
  lodMetricValue: root.lodMetricValue
@@ -13469,15 +13166,16 @@ var __exports__ = (() => {
13469
13166
  if (magicNumber === SLPK_HEX) {
13470
13167
  throw new Error("Files with .slpk extention currently are not supported by I3SLoader");
13471
13168
  }
13169
+ const urlWithoutParams = getUrlWithoutParams(url);
13472
13170
  let isTileset;
13473
13171
  if (options.i3s.isTileset === "auto") {
13474
- isTileset = TILESET_REGEX.test(url);
13172
+ isTileset = TILESET_REGEX.test(urlWithoutParams);
13475
13173
  } else {
13476
13174
  isTileset = options.i3s.isTileset;
13477
13175
  }
13478
13176
  let isTileHeader;
13479
13177
  if (options.isTileHeader === "auto") {
13480
- isTileHeader = TILE_HEADER_REGEX.test(url);
13178
+ isTileHeader = TILE_HEADER_REGEX.test(urlWithoutParams);
13481
13179
  } else {
13482
13180
  isTileHeader = options.i3s.isTileHeader;
13483
13181
  }
@@ -13681,7 +13379,6 @@ var __exports__ = (() => {
13681
13379
  hash
13682
13380
  });
13683
13381
  }
13684
- // HELPERS
13685
13382
  async concatenate(asyncIterator) {
13686
13383
  return await concatenateArrayBuffersAsync(asyncIterator);
13687
13384
  }
@@ -14173,15 +13870,8 @@ var __exports__ = (() => {
14173
13870
  super();
14174
13871
  this.options = options;
14175
13872
  }
14176
- /**
14177
- * Atomic hash calculation
14178
- * @returns base64 encoded hash
14179
- */
14180
13873
  async hash(input, encoding) {
14181
- const md5Promise = new Promise((resolve, reject) => (
14182
- // @ts-expect-error
14183
- md5WASM(input).then(resolve).catch(reject)
14184
- ));
13874
+ const md5Promise = new Promise((resolve, reject) => md5WASM(input).then(resolve).catch(reject));
14185
13875
  const hex = await md5Promise;
14186
13876
  return encodeHex(hex, encoding);
14187
13877
  }
@@ -14221,39 +13911,31 @@ var __exports__ = (() => {
14221
13911
  this.compressBatches = this.compressBatches.bind(this);
14222
13912
  this.decompressBatches = this.decompressBatches.bind(this);
14223
13913
  }
14224
- /** Preloads any dynamic libraries. May enable sync functions */
14225
13914
  async preload() {
14226
13915
  return;
14227
13916
  }
14228
- /** Asynchronously compress data */
14229
13917
  async compress(input) {
14230
13918
  await this.preload();
14231
13919
  return this.compressSync(input);
14232
13920
  }
14233
- /** Asynchronously decompress data */
14234
13921
  async decompress(input, size) {
14235
13922
  await this.preload();
14236
13923
  return this.decompressSync(input, size);
14237
13924
  }
14238
- /** Synchronously compress data */
14239
13925
  compressSync(input) {
14240
13926
  throw new Error(`${this.name}: sync compression not supported`);
14241
13927
  }
14242
- /** Synchronously compress data */
14243
13928
  decompressSync(input, size) {
14244
13929
  throw new Error(`${this.name}: sync decompression not supported`);
14245
13930
  }
14246
- /** Compress batches */
14247
13931
  async *compressBatches(asyncIterator) {
14248
13932
  const input = await this.concatenate(asyncIterator);
14249
13933
  yield this.compress(input);
14250
13934
  }
14251
- /** Decompress batches */
14252
13935
  async *decompressBatches(asyncIterator) {
14253
13936
  const input = await this.concatenate(asyncIterator);
14254
13937
  yield this.decompress(input);
14255
13938
  }
14256
- // HELPERS
14257
13939
  concatenate(asyncIterator) {
14258
13940
  return concatenateArrayBuffersAsync(asyncIterator);
14259
13941
  }
@@ -14354,26 +14036,16 @@ var __exports__ = (() => {
14354
14036
  this._chunks = [];
14355
14037
  return chunks;
14356
14038
  }
14357
- // TODO - For some reason we don't get the error message from pako in _onEnd?
14358
14039
  _getError(code = 0) {
14359
14040
  const MESSAGES = {
14360
- /* Z_NEED_DICT 2 */
14361
14041
  2: "need dictionary",
14362
- /* Z_STREAM_END 1 */
14363
14042
  1: "stream end",
14364
- /* Z_OK 0 */
14365
14043
  0: "",
14366
- /* Z_ERRNO (-1) */
14367
14044
  "-1": "file error",
14368
- /* Z_STREAM_ERROR (-2) */
14369
14045
  "-2": "stream error",
14370
- /* Z_DATA_ERROR (-3) */
14371
14046
  "-3": "data error",
14372
- /* Z_MEM_ERROR (-4) */
14373
14047
  "-4": "insufficient memory",
14374
- /* Z_BUF_ERROR (-5) */
14375
14048
  "-5": "buffer error",
14376
- /* Z_VERSION_ERROR (-6) */
14377
14049
  "-6": "incompatible version"
14378
14050
  };
14379
14051
  return `${this.name}: ${MESSAGES[code]}`;
@@ -14424,10 +14096,6 @@ var __exports__ = (() => {
14424
14096
  extensions: ["/sharedResource.json.gz"]
14425
14097
  }];
14426
14098
  var SLPKArchive = class {
14427
- /** A DataView representation of the archive */
14428
- // Maps hex-encoded md5 filename hashes to bigint offsets into the archive
14429
- /** Array of hashes and offsets into archive */
14430
- // hashToOffsetMap: Record<string, number>;
14431
14099
  _textEncoder = new TextEncoder();
14432
14100
  _textDecoder = new TextDecoder();
14433
14101
  _md5Hash = new MD5Hash();
@@ -14435,12 +14103,6 @@ var __exports__ = (() => {
14435
14103
  this.slpkArchive = slpkArchive;
14436
14104
  this.hashTable = hashTable;
14437
14105
  }
14438
- /**
14439
- * Returns file with the given path from slpk archive
14440
- * @param path - path inside the slpk
14441
- * @param mode - currently only raw mode supported
14442
- * @returns buffer with ready to use file
14443
- */
14444
14106
  async getFile(path, mode = "raw") {
14445
14107
  if (mode === "http") {
14446
14108
  const extensions = PATH_DESCRIPTIONS.find((val) => val.test.test(path))?.extensions;
@@ -14469,11 +14131,6 @@ var __exports__ = (() => {
14469
14131
  }
14470
14132
  throw new Error(`No such file in the archive: ${path}`);
14471
14133
  }
14472
- /**
14473
- * returning uncompressed data for paths that ends with .gz and raw data for all other paths
14474
- * @param path - path inside the archive
14475
- * @returns buffer with the file data
14476
- */
14477
14134
  async getDataByPath(path) {
14478
14135
  let data = await this.getFileBytes(path.toLocaleLowerCase());
14479
14136
  if (!data) {
@@ -14489,11 +14146,6 @@ var __exports__ = (() => {
14489
14146
  }
14490
14147
  return data;
14491
14148
  }
14492
- /**
14493
- * Trying to get raw file data by address
14494
- * @param path - path inside the archive
14495
- * @returns buffer with the raw file data
14496
- */
14497
14149
  async getFileBytes(path) {
14498
14150
  const binaryPath = this._textEncoder.encode(path);
14499
14151
  const nameHash = await this._md5Hash.hash(binaryPath.buffer, "hex");