@loaders.gl/tiles 4.0.0-alpha.6 → 4.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/constants.d.ts +24 -18
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +22 -19
  4. package/dist/dist.min.js +448 -206
  5. package/dist/es5/constants.js +22 -18
  6. package/dist/es5/constants.js.map +1 -1
  7. package/dist/es5/tileset/helpers/3d-tiles-options.js.map +1 -1
  8. package/dist/es5/tileset/tile-3d.js +42 -71
  9. package/dist/es5/tileset/tile-3d.js.map +1 -1
  10. package/dist/es5/tileset/tileset-3d.js +69 -104
  11. package/dist/es5/tileset/tileset-3d.js.map +1 -1
  12. package/dist/es5/tileset/tileset-cache.js +4 -7
  13. package/dist/es5/tileset/tileset-cache.js.map +1 -1
  14. package/dist/es5/tileset/tileset-traverser.js +12 -19
  15. package/dist/es5/tileset/tileset-traverser.js.map +1 -1
  16. package/dist/esm/constants.js +22 -18
  17. package/dist/esm/constants.js.map +1 -1
  18. package/dist/esm/tileset/helpers/3d-tiles-options.js.map +1 -1
  19. package/dist/esm/tileset/tile-3d.js +40 -71
  20. package/dist/esm/tileset/tile-3d.js.map +1 -1
  21. package/dist/esm/tileset/tileset-3d.js +65 -96
  22. package/dist/esm/tileset/tileset-3d.js.map +1 -1
  23. package/dist/esm/tileset/tileset-cache.js +4 -7
  24. package/dist/esm/tileset/tileset-cache.js.map +1 -1
  25. package/dist/esm/tileset/tileset-traverser.js +9 -16
  26. package/dist/esm/tileset/tileset-traverser.js.map +1 -1
  27. package/dist/tileset/helpers/3d-tiles-options.d.ts +3 -2
  28. package/dist/tileset/helpers/3d-tiles-options.d.ts.map +1 -1
  29. package/dist/tileset/tile-3d.d.ts +37 -21
  30. package/dist/tileset/tile-3d.d.ts.map +1 -1
  31. package/dist/tileset/tile-3d.js +57 -43
  32. package/dist/tileset/tileset-3d.d.ts +90 -43
  33. package/dist/tileset/tileset-3d.d.ts.map +1 -1
  34. package/dist/tileset/tileset-3d.js +111 -129
  35. package/dist/tileset/tileset-cache.d.ts +5 -4
  36. package/dist/tileset/tileset-cache.d.ts.map +1 -1
  37. package/dist/tileset/tileset-cache.js +4 -10
  38. package/dist/tileset/tileset-traverser.d.ts +32 -21
  39. package/dist/tileset/tileset-traverser.d.ts.map +1 -1
  40. package/dist/tileset/tileset-traverser.js +23 -32
  41. package/package.json +8 -5
  42. package/src/constants.ts +36 -18
  43. package/src/tileset/helpers/3d-tiles-options.ts +3 -1
  44. package/src/tileset/tile-3d.ts +68 -109
  45. package/src/tileset/tileset-3d.ts +183 -218
  46. package/src/tileset/tileset-cache.ts +20 -15
  47. package/src/tileset/tileset-traverser.ts +52 -65
package/dist/dist.min.js CHANGED
@@ -3394,7 +3394,7 @@
3394
3394
  }
3395
3395
  });
3396
3396
 
3397
- // ../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
3397
+ // node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
3398
3398
  function getHiResTimestamp() {
3399
3399
  let timestamp;
3400
3400
  if (typeof window !== "undefined" && window.performance) {
@@ -3408,14 +3408,14 @@
3408
3408
  return timestamp;
3409
3409
  }
3410
3410
  var init_hi_res_timestamp = __esm({
3411
- "../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js"() {
3411
+ "node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js"() {
3412
3412
  }
3413
3413
  });
3414
3414
 
3415
- // ../../node_modules/@probe.gl/stats/dist/lib/stat.js
3415
+ // node_modules/@probe.gl/stats/dist/lib/stat.js
3416
3416
  var Stat;
3417
3417
  var init_stat = __esm({
3418
- "../../node_modules/@probe.gl/stats/dist/lib/stat.js"() {
3418
+ "node_modules/@probe.gl/stats/dist/lib/stat.js"() {
3419
3419
  init_defineProperty();
3420
3420
  init_hi_res_timestamp();
3421
3421
  Stat = class {
@@ -3531,10 +3531,10 @@
3531
3531
  }
3532
3532
  });
3533
3533
 
3534
- // ../../node_modules/@probe.gl/stats/dist/lib/stats.js
3534
+ // node_modules/@probe.gl/stats/dist/lib/stats.js
3535
3535
  var Stats;
3536
3536
  var init_stats = __esm({
3537
- "../../node_modules/@probe.gl/stats/dist/lib/stats.js"() {
3537
+ "node_modules/@probe.gl/stats/dist/lib/stats.js"() {
3538
3538
  init_defineProperty();
3539
3539
  init_stat();
3540
3540
  Stats = class {
@@ -3603,9 +3603,9 @@
3603
3603
  }
3604
3604
  });
3605
3605
 
3606
- // ../../node_modules/@probe.gl/stats/dist/index.js
3606
+ // node_modules/@probe.gl/stats/dist/index.js
3607
3607
  var init_dist = __esm({
3608
- "../../node_modules/@probe.gl/stats/dist/index.js"() {
3608
+ "node_modules/@probe.gl/stats/dist/index.js"() {
3609
3609
  init_stats();
3610
3610
  init_stat();
3611
3611
  init_hi_res_timestamp();
@@ -3999,7 +3999,7 @@
3999
3999
  }
4000
4000
  }
4001
4001
  returnWorkerToQueue(worker) {
4002
- const shouldDestroyWorker = this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
4002
+ const shouldDestroyWorker = !isBrowser2 || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
4003
4003
  if (shouldDestroyWorker) {
4004
4004
  worker.destroy();
4005
4005
  this.count--;
@@ -4097,7 +4097,7 @@
4097
4097
  // ../worker-utils/src/lib/worker-api/get-worker-url.ts
4098
4098
  function getWorkerURL(worker, options = {}) {
4099
4099
  const workerOptions = options[worker.id] || {};
4100
- const workerFile = `${worker.id}-worker.js`;
4100
+ const workerFile = isBrowser2 ? `${worker.id}-worker.js` : `${worker.id}-worker-node.js`;
4101
4101
  let url = workerOptions.workerUrl;
4102
4102
  if (!url && worker.id === "compression") {
4103
4103
  url = options.workerUrl;
@@ -4120,6 +4120,7 @@
4120
4120
  var init_get_worker_url = __esm({
4121
4121
  "../worker-utils/src/lib/worker-api/get-worker-url.ts"() {
4122
4122
  init_assert3();
4123
+ init_globals2();
4123
4124
  NPM_TAG = "beta";
4124
4125
  }
4125
4126
  });
@@ -4251,11 +4252,229 @@
4251
4252
  }
4252
4253
  });
4253
4254
 
4255
+ // ../loader-utils/node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
4256
+ function getHiResTimestamp2() {
4257
+ let timestamp;
4258
+ if (typeof window !== "undefined" && window.performance) {
4259
+ timestamp = window.performance.now();
4260
+ } else if (typeof process !== "undefined" && process.hrtime) {
4261
+ const timeParts = process.hrtime();
4262
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
4263
+ } else {
4264
+ timestamp = Date.now();
4265
+ }
4266
+ return timestamp;
4267
+ }
4268
+ var init_hi_res_timestamp2 = __esm({
4269
+ "../loader-utils/node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js"() {
4270
+ }
4271
+ });
4272
+
4273
+ // ../loader-utils/node_modules/@probe.gl/stats/dist/lib/stat.js
4274
+ var Stat2;
4275
+ var init_stat2 = __esm({
4276
+ "../loader-utils/node_modules/@probe.gl/stats/dist/lib/stat.js"() {
4277
+ init_defineProperty();
4278
+ init_hi_res_timestamp2();
4279
+ Stat2 = class {
4280
+ constructor(name, type) {
4281
+ _defineProperty(this, "name", void 0);
4282
+ _defineProperty(this, "type", void 0);
4283
+ _defineProperty(this, "sampleSize", 1);
4284
+ _defineProperty(this, "time", 0);
4285
+ _defineProperty(this, "count", 0);
4286
+ _defineProperty(this, "samples", 0);
4287
+ _defineProperty(this, "lastTiming", 0);
4288
+ _defineProperty(this, "lastSampleTime", 0);
4289
+ _defineProperty(this, "lastSampleCount", 0);
4290
+ _defineProperty(this, "_count", 0);
4291
+ _defineProperty(this, "_time", 0);
4292
+ _defineProperty(this, "_samples", 0);
4293
+ _defineProperty(this, "_startTime", 0);
4294
+ _defineProperty(this, "_timerPending", false);
4295
+ this.name = name;
4296
+ this.type = type;
4297
+ this.reset();
4298
+ }
4299
+ reset() {
4300
+ this.time = 0;
4301
+ this.count = 0;
4302
+ this.samples = 0;
4303
+ this.lastTiming = 0;
4304
+ this.lastSampleTime = 0;
4305
+ this.lastSampleCount = 0;
4306
+ this._count = 0;
4307
+ this._time = 0;
4308
+ this._samples = 0;
4309
+ this._startTime = 0;
4310
+ this._timerPending = false;
4311
+ return this;
4312
+ }
4313
+ setSampleSize(samples) {
4314
+ this.sampleSize = samples;
4315
+ return this;
4316
+ }
4317
+ incrementCount() {
4318
+ this.addCount(1);
4319
+ return this;
4320
+ }
4321
+ decrementCount() {
4322
+ this.subtractCount(1);
4323
+ return this;
4324
+ }
4325
+ addCount(value) {
4326
+ this._count += value;
4327
+ this._samples++;
4328
+ this._checkSampling();
4329
+ return this;
4330
+ }
4331
+ subtractCount(value) {
4332
+ this._count -= value;
4333
+ this._samples++;
4334
+ this._checkSampling();
4335
+ return this;
4336
+ }
4337
+ addTime(time) {
4338
+ this._time += time;
4339
+ this.lastTiming = time;
4340
+ this._samples++;
4341
+ this._checkSampling();
4342
+ return this;
4343
+ }
4344
+ timeStart() {
4345
+ this._startTime = getHiResTimestamp2();
4346
+ this._timerPending = true;
4347
+ return this;
4348
+ }
4349
+ timeEnd() {
4350
+ if (!this._timerPending) {
4351
+ return this;
4352
+ }
4353
+ this.addTime(getHiResTimestamp2() - this._startTime);
4354
+ this._timerPending = false;
4355
+ this._checkSampling();
4356
+ return this;
4357
+ }
4358
+ getSampleAverageCount() {
4359
+ return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
4360
+ }
4361
+ getSampleAverageTime() {
4362
+ return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
4363
+ }
4364
+ getSampleHz() {
4365
+ return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
4366
+ }
4367
+ getAverageCount() {
4368
+ return this.samples > 0 ? this.count / this.samples : 0;
4369
+ }
4370
+ getAverageTime() {
4371
+ return this.samples > 0 ? this.time / this.samples : 0;
4372
+ }
4373
+ getHz() {
4374
+ return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
4375
+ }
4376
+ _checkSampling() {
4377
+ if (this._samples === this.sampleSize) {
4378
+ this.lastSampleTime = this._time;
4379
+ this.lastSampleCount = this._count;
4380
+ this.count += this._count;
4381
+ this.time += this._time;
4382
+ this.samples += this._samples;
4383
+ this._time = 0;
4384
+ this._count = 0;
4385
+ this._samples = 0;
4386
+ }
4387
+ }
4388
+ };
4389
+ }
4390
+ });
4391
+
4392
+ // ../loader-utils/node_modules/@probe.gl/stats/dist/lib/stats.js
4393
+ var Stats2;
4394
+ var init_stats2 = __esm({
4395
+ "../loader-utils/node_modules/@probe.gl/stats/dist/lib/stats.js"() {
4396
+ init_defineProperty();
4397
+ init_stat2();
4398
+ Stats2 = class {
4399
+ constructor(options) {
4400
+ _defineProperty(this, "id", void 0);
4401
+ _defineProperty(this, "stats", {});
4402
+ this.id = options.id;
4403
+ this.stats = {};
4404
+ this._initializeStats(options.stats);
4405
+ Object.seal(this);
4406
+ }
4407
+ get(name) {
4408
+ let type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "count";
4409
+ return this._getOrCreate({
4410
+ name,
4411
+ type
4412
+ });
4413
+ }
4414
+ get size() {
4415
+ return Object.keys(this.stats).length;
4416
+ }
4417
+ reset() {
4418
+ for (const stat of Object.values(this.stats)) {
4419
+ stat.reset();
4420
+ }
4421
+ return this;
4422
+ }
4423
+ forEach(fn) {
4424
+ for (const stat of Object.values(this.stats)) {
4425
+ fn(stat);
4426
+ }
4427
+ }
4428
+ getTable() {
4429
+ const table = {};
4430
+ this.forEach((stat) => {
4431
+ table[stat.name] = {
4432
+ time: stat.time || 0,
4433
+ count: stat.count || 0,
4434
+ average: stat.getAverageTime() || 0,
4435
+ hz: stat.getHz() || 0
4436
+ };
4437
+ });
4438
+ return table;
4439
+ }
4440
+ _initializeStats() {
4441
+ let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
4442
+ stats.forEach((stat) => this._getOrCreate(stat));
4443
+ }
4444
+ _getOrCreate(stat) {
4445
+ const {
4446
+ name,
4447
+ type
4448
+ } = stat;
4449
+ let result = this.stats[name];
4450
+ if (!result) {
4451
+ if (stat instanceof Stat2) {
4452
+ result = stat;
4453
+ } else {
4454
+ result = new Stat2(name, type);
4455
+ }
4456
+ this.stats[name] = result;
4457
+ }
4458
+ return result;
4459
+ }
4460
+ };
4461
+ }
4462
+ });
4463
+
4464
+ // ../loader-utils/node_modules/@probe.gl/stats/dist/index.js
4465
+ var init_dist2 = __esm({
4466
+ "../loader-utils/node_modules/@probe.gl/stats/dist/index.js"() {
4467
+ init_stats2();
4468
+ init_stat2();
4469
+ init_hi_res_timestamp2();
4470
+ }
4471
+ });
4472
+
4254
4473
  // ../loader-utils/src/lib/request-utils/request-scheduler.ts
4255
4474
  var STAT_QUEUED_REQUESTS, STAT_ACTIVE_REQUESTS, STAT_CANCELLED_REQUESTS, STAT_QUEUED_REQUESTS_EVER, STAT_ACTIVE_REQUESTS_EVER, DEFAULT_PROPS2, RequestScheduler;
4256
4475
  var init_request_scheduler = __esm({
4257
4476
  "../loader-utils/src/lib/request-utils/request-scheduler.ts"() {
4258
- init_dist();
4477
+ init_dist2();
4259
4478
  STAT_QUEUED_REQUESTS = "Queued Requests";
4260
4479
  STAT_ACTIVE_REQUESTS = "Active Requests";
4261
4480
  STAT_CANCELLED_REQUESTS = "Cancelled Requests";
@@ -4273,7 +4492,7 @@
4273
4492
  this.requestMap = new Map();
4274
4493
  this.deferredUpdate = null;
4275
4494
  this.props = { ...DEFAULT_PROPS2, ...props };
4276
- this.stats = new Stats({ id: this.props.id });
4495
+ this.stats = new Stats2({ id: this.props.id });
4277
4496
  this.stats.get(STAT_QUEUED_REQUESTS);
4278
4497
  this.stats.get(STAT_ACTIVE_REQUESTS);
4279
4498
  this.stats.get(STAT_CANCELLED_REQUESTS);
@@ -4669,9 +4888,6 @@
4669
4888
  });
4670
4889
 
4671
4890
  // src/tileset/tileset-cache.ts
4672
- function defined(x) {
4673
- return x !== void 0 && x !== null;
4674
- }
4675
4891
  var TilesetCache;
4676
4892
  var init_tileset_cache = __esm({
4677
4893
  "src/tileset/tileset-cache.ts"() {
@@ -4687,12 +4903,12 @@
4687
4903
  }
4688
4904
  touch(tile) {
4689
4905
  const node2 = tile._cacheNode;
4690
- if (defined(node2)) {
4906
+ if (node2) {
4691
4907
  this._list.splice(this._sentinel, node2);
4692
4908
  }
4693
4909
  }
4694
4910
  add(tileset, tile, addCallback) {
4695
- if (!defined(tile._cacheNode)) {
4911
+ if (!tile._cacheNode) {
4696
4912
  tile._cacheNode = this._list.add(tile);
4697
4913
  if (addCallback) {
4698
4914
  addCallback(tileset, tile);
@@ -4701,11 +4917,11 @@
4701
4917
  }
4702
4918
  unloadTile(tileset, tile, unloadCallback) {
4703
4919
  const node2 = tile._cacheNode;
4704
- if (!defined(node2)) {
4920
+ if (!node2) {
4705
4921
  return;
4706
4922
  }
4707
4923
  this._list.remove(node2);
4708
- tile._cacheNode = void 0;
4924
+ tile._cacheNode = null;
4709
4925
  if (unloadCallback) {
4710
4926
  unloadCallback(tileset, tile);
4711
4927
  }
@@ -5531,39 +5747,60 @@
5531
5747
  }
5532
5748
  });
5533
5749
 
5750
+ // ../core/src/lib/utils/url-utils.ts
5751
+ function extractQueryString(url) {
5752
+ const matches3 = url.match(QUERY_STRING_PATTERN);
5753
+ return matches3 && matches3[0];
5754
+ }
5755
+ function stripQueryString(url) {
5756
+ return url.replace(QUERY_STRING_PATTERN, "");
5757
+ }
5758
+ var QUERY_STRING_PATTERN;
5759
+ var init_url_utils = __esm({
5760
+ "../core/src/lib/utils/url-utils.ts"() {
5761
+ QUERY_STRING_PATTERN = /\?.*/;
5762
+ }
5763
+ });
5764
+
5534
5765
  // ../core/src/lib/utils/resource-utils.ts
5535
- function getResourceUrlAndType(resource) {
5766
+ function getResourceUrl(resource) {
5536
5767
  if (isResponse(resource)) {
5537
- const url = stripQueryString(resource.url || "");
5538
- const contentTypeHeader = resource.headers.get("content-type") || "";
5539
- return {
5540
- url,
5541
- type: parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(url)
5542
- };
5768
+ const response = resource;
5769
+ return response.url;
5543
5770
  }
5544
5771
  if (isBlob(resource)) {
5545
- return {
5546
- url: stripQueryString(resource.name || ""),
5547
- type: resource.type || ""
5548
- };
5772
+ const blob = resource;
5773
+ return blob.name || "";
5549
5774
  }
5550
5775
  if (typeof resource === "string") {
5551
- return {
5552
- url: stripQueryString(resource),
5553
- type: parseMIMETypeFromURL(resource)
5554
- };
5776
+ return resource;
5555
5777
  }
5556
- return {
5557
- url: "",
5558
- type: ""
5559
- };
5778
+ return "";
5779
+ }
5780
+ function getResourceMIMEType(resource) {
5781
+ if (isResponse(resource)) {
5782
+ const response = resource;
5783
+ const contentTypeHeader = response.headers.get("content-type") || "";
5784
+ const noQueryUrl = stripQueryString(response.url);
5785
+ return parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(noQueryUrl);
5786
+ }
5787
+ if (isBlob(resource)) {
5788
+ const blob = resource;
5789
+ return blob.type || "";
5790
+ }
5791
+ if (typeof resource === "string") {
5792
+ return parseMIMETypeFromURL(resource);
5793
+ }
5794
+ return "";
5560
5795
  }
5561
5796
  function getResourceContentLength(resource) {
5562
5797
  if (isResponse(resource)) {
5563
- return resource.headers["content-length"] || -1;
5798
+ const response = resource;
5799
+ return response.headers["content-length"] || -1;
5564
5800
  }
5565
5801
  if (isBlob(resource)) {
5566
- return resource.size;
5802
+ const blob = resource;
5803
+ return blob.size;
5567
5804
  }
5568
5805
  if (typeof resource === "string") {
5569
5806
  return resource.length;
@@ -5576,15 +5813,11 @@
5576
5813
  }
5577
5814
  return -1;
5578
5815
  }
5579
- function stripQueryString(url) {
5580
- return url.replace(QUERY_STRING_PATTERN, "");
5581
- }
5582
- var QUERY_STRING_PATTERN;
5583
5816
  var init_resource_utils = __esm({
5584
5817
  "../core/src/lib/utils/resource-utils.ts"() {
5585
5818
  init_is_type();
5586
5819
  init_mime_type_utils();
5587
- QUERY_STRING_PATTERN = /\?.*/;
5820
+ init_url_utils();
5588
5821
  }
5589
5822
  });
5590
5823
 
@@ -5598,7 +5831,8 @@
5598
5831
  if (contentLength >= 0) {
5599
5832
  headers["content-length"] = String(contentLength);
5600
5833
  }
5601
- const { url, type } = getResourceUrlAndType(resource);
5834
+ const url = getResourceUrl(resource);
5835
+ const type = getResourceMIMEType(resource);
5602
5836
  if (type) {
5603
5837
  headers["content-type"] = type;
5604
5838
  }
@@ -5687,7 +5921,7 @@
5687
5921
  }
5688
5922
  });
5689
5923
 
5690
- // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
5924
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
5691
5925
  function isElectron(mockUserAgent) {
5692
5926
  if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
5693
5927
  return true;
@@ -5703,25 +5937,25 @@
5703
5937
  return false;
5704
5938
  }
5705
5939
  var init_is_electron = __esm({
5706
- "../../node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
5940
+ "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
5707
5941
  }
5708
5942
  });
5709
5943
 
5710
- // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
5944
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
5711
5945
  function isBrowser3() {
5712
5946
  const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
5713
5947
  return !isNode || isElectron();
5714
5948
  }
5715
5949
  var init_is_browser = __esm({
5716
- "../../node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
5950
+ "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
5717
5951
  init_is_electron();
5718
5952
  }
5719
5953
  });
5720
5954
 
5721
- // ../../node_modules/@probe.gl/env/dist/lib/globals.js
5955
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
5722
5956
  var self_3, window_3, document_3, process_, console_, navigator_;
5723
5957
  var init_globals3 = __esm({
5724
- "../../node_modules/@probe.gl/env/dist/lib/globals.js"() {
5958
+ "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js"() {
5725
5959
  self_3 = globalThis.self || globalThis.window || globalThis.global;
5726
5960
  window_3 = globalThis.window || globalThis.self || globalThis.global;
5727
5961
  document_3 = globalThis.document || {};
@@ -5731,19 +5965,19 @@
5731
5965
  }
5732
5966
  });
5733
5967
 
5734
- // ../../node_modules/@probe.gl/env/dist/utils/globals.js
5968
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
5735
5969
  var VERSION2, isBrowser4;
5736
5970
  var init_globals4 = __esm({
5737
- "../../node_modules/@probe.gl/env/dist/utils/globals.js"() {
5971
+ "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js"() {
5738
5972
  init_is_browser();
5739
5973
  VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
5740
5974
  isBrowser4 = isBrowser3();
5741
5975
  }
5742
5976
  });
5743
5977
 
5744
- // ../../node_modules/@probe.gl/env/dist/index.js
5745
- var init_dist2 = __esm({
5746
- "../../node_modules/@probe.gl/env/dist/index.js"() {
5978
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
5979
+ var init_dist3 = __esm({
5980
+ "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js"() {
5747
5981
  init_globals4();
5748
5982
  init_globals3();
5749
5983
  init_is_browser();
@@ -5859,7 +6093,7 @@
5859
6093
  var COLOR, BACKGROUND_INCREMENT;
5860
6094
  var init_color = __esm({
5861
6095
  "../../node_modules/@probe.gl/log/dist/utils/color.js"() {
5862
- init_dist2();
6096
+ init_dist3();
5863
6097
  (function(COLOR2) {
5864
6098
  COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
5865
6099
  COLOR2[COLOR2["RED"] = 31] = "RED";
@@ -5914,7 +6148,7 @@
5914
6148
  });
5915
6149
 
5916
6150
  // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
5917
- function getHiResTimestamp2() {
6151
+ function getHiResTimestamp3() {
5918
6152
  let timestamp;
5919
6153
  if (isBrowser3() && window_3.performance) {
5920
6154
  var _window$performance, _window$performance$n;
@@ -5928,9 +6162,9 @@
5928
6162
  }
5929
6163
  return timestamp;
5930
6164
  }
5931
- var init_hi_res_timestamp2 = __esm({
6165
+ var init_hi_res_timestamp3 = __esm({
5932
6166
  "../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js"() {
5933
- init_dist2();
6167
+ init_dist3();
5934
6168
  }
5935
6169
  });
5936
6170
 
@@ -6043,13 +6277,13 @@
6043
6277
  var init_log = __esm({
6044
6278
  "../../node_modules/@probe.gl/log/dist/log.js"() {
6045
6279
  init_defineProperty();
6046
- init_dist2();
6280
+ init_dist3();
6047
6281
  init_local_storage();
6048
6282
  init_formatters();
6049
6283
  init_color();
6050
6284
  init_autobind();
6051
6285
  init_assert4();
6052
- init_hi_res_timestamp2();
6286
+ init_hi_res_timestamp3();
6053
6287
  originalConsole = {
6054
6288
  debug: isBrowser3() ? console.debug || console.log : console.log,
6055
6289
  log: console.log,
@@ -6074,8 +6308,8 @@
6074
6308
  };
6075
6309
  _defineProperty(this, "id", void 0);
6076
6310
  _defineProperty(this, "VERSION", VERSION2);
6077
- _defineProperty(this, "_startTs", getHiResTimestamp2());
6078
- _defineProperty(this, "_deltaTs", getHiResTimestamp2());
6311
+ _defineProperty(this, "_startTs", getHiResTimestamp3());
6312
+ _defineProperty(this, "_deltaTs", getHiResTimestamp3());
6079
6313
  _defineProperty(this, "_storage", void 0);
6080
6314
  _defineProperty(this, "userData", {});
6081
6315
  _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
@@ -6099,10 +6333,10 @@
6099
6333
  return this._storage.config.level;
6100
6334
  }
6101
6335
  getTotal() {
6102
- return Number((getHiResTimestamp2() - this._startTs).toPrecision(10));
6336
+ return Number((getHiResTimestamp3() - this._startTs).toPrecision(10));
6103
6337
  }
6104
6338
  getDelta() {
6105
- return Number((getHiResTimestamp2() - this._deltaTs).toPrecision(10));
6339
+ return Number((getHiResTimestamp3() - this._deltaTs).toPrecision(10));
6106
6340
  }
6107
6341
  set priority(newPriority) {
6108
6342
  this.level = newPriority;
@@ -6261,11 +6495,11 @@
6261
6495
  assert4(method);
6262
6496
  opts.total = this.getTotal();
6263
6497
  opts.delta = this.getDelta();
6264
- this._deltaTs = getHiResTimestamp2();
6498
+ this._deltaTs = getHiResTimestamp3();
6265
6499
  const tag = opts.tag || opts.message;
6266
6500
  if (opts.once && tag) {
6267
6501
  if (!cache[tag]) {
6268
- cache[tag] = getHiResTimestamp2();
6502
+ cache[tag] = getHiResTimestamp3();
6269
6503
  } else {
6270
6504
  return noop;
6271
6505
  }
@@ -6282,7 +6516,7 @@
6282
6516
 
6283
6517
  // ../../node_modules/@probe.gl/log/dist/index.js
6284
6518
  var dist_default;
6285
- var init_dist3 = __esm({
6519
+ var init_dist4 = __esm({
6286
6520
  "../../node_modules/@probe.gl/log/dist/index.js"() {
6287
6521
  init_log();
6288
6522
  init_log();
@@ -6296,7 +6530,7 @@
6296
6530
  var probeLog, NullLog, ConsoleLog;
6297
6531
  var init_loggers = __esm({
6298
6532
  "../core/src/lib/loader-utils/loggers.ts"() {
6299
- init_dist3();
6533
+ init_dist4();
6300
6534
  probeLog = new Log({ id: "loaders.gl" });
6301
6535
  NullLog = class {
6302
6536
  log() {
@@ -6539,7 +6773,7 @@
6539
6773
  var log;
6540
6774
  var init_log2 = __esm({
6541
6775
  "../core/src/lib/utils/log.ts"() {
6542
- init_dist3();
6776
+ init_dist4();
6543
6777
  log = new Log({ id: "loaders.gl" });
6544
6778
  }
6545
6779
  });
@@ -6584,8 +6818,9 @@
6584
6818
  return loader;
6585
6819
  }
6586
6820
  function selectLoaderInternal(data, loaders, options, context) {
6587
- const { url, type } = getResourceUrlAndType(data);
6588
- const testUrl = url || context?.url;
6821
+ const url = getResourceUrl(data);
6822
+ const type = getResourceMIMEType(data);
6823
+ const testUrl = stripQueryString(url) || context?.url;
6589
6824
  let loader = null;
6590
6825
  let reason = "";
6591
6826
  if (options?.mimeType) {
@@ -6614,7 +6849,8 @@
6614
6849
  return true;
6615
6850
  }
6616
6851
  function getNoValidLoaderMessage(data) {
6617
- const { url, type } = getResourceUrlAndType(data);
6852
+ const url = getResourceUrl(data);
6853
+ const type = getResourceMIMEType(data);
6618
6854
  let message = "No valid loader found (";
6619
6855
  message += url ? `${path_exports.filename(url)}, ` : "no url provided, ";
6620
6856
  message += `MIME type: ${type ? `"${type}"` : "not provided"}, `;
@@ -6733,6 +6969,7 @@
6733
6969
  init_resource_utils();
6734
6970
  init_register_loaders();
6735
6971
  init_is_type();
6972
+ init_url_utils();
6736
6973
  EXT_PATTERN = /\.([^.]+)$/;
6737
6974
  }
6738
6975
  });
@@ -6945,18 +7182,25 @@
6945
7182
  });
6946
7183
 
6947
7184
  // ../core/src/lib/loader-utils/loader-context.ts
6948
- function getLoaderContext(context, options, previousContext = null) {
6949
- if (previousContext) {
6950
- return previousContext;
7185
+ function getLoaderContext(context, options, parentContext) {
7186
+ if (parentContext) {
7187
+ return parentContext;
6951
7188
  }
6952
- const resolvedContext = {
7189
+ const newContext = {
6953
7190
  fetch: getFetchFunction(options, context),
6954
7191
  ...context
6955
7192
  };
6956
- if (!Array.isArray(resolvedContext.loaders)) {
6957
- resolvedContext.loaders = null;
7193
+ if (newContext.url) {
7194
+ const baseUrl = stripQueryString(newContext.url);
7195
+ newContext.baseUrl = baseUrl;
7196
+ newContext.queryString = extractQueryString(newContext.url);
7197
+ newContext.filename = path_exports.filename(baseUrl);
7198
+ newContext.baseUrl = path_exports.dirname(baseUrl);
6958
7199
  }
6959
- return resolvedContext;
7200
+ if (!Array.isArray(newContext.loaders)) {
7201
+ newContext.loaders = null;
7202
+ }
7203
+ return newContext;
6960
7204
  }
6961
7205
  function getLoadersFromContext(loaders, context) {
6962
7206
  if (!context && loaders && !Array.isArray(loaders)) {
@@ -6975,6 +7219,8 @@
6975
7219
  var init_loader_context = __esm({
6976
7220
  "../core/src/lib/loader-utils/loader-context.ts"() {
6977
7221
  init_get_fetch_function();
7222
+ init_url_utils();
7223
+ init_src2();
6978
7224
  }
6979
7225
  });
6980
7226
 
@@ -6988,7 +7234,7 @@
6988
7234
  }
6989
7235
  data = await data;
6990
7236
  options = options || {};
6991
- const { url } = getResourceUrlAndType(data);
7237
+ const url = getResourceUrl(data);
6992
7238
  const typedLoaders = loaders;
6993
7239
  const candidateLoaders = getLoadersFromContext(typedLoaders, context);
6994
7240
  const loader = await selectLoader(data, candidateLoaders, options);
@@ -6996,7 +7242,7 @@
6996
7242
  return null;
6997
7243
  }
6998
7244
  options = normalizeOptions(options, loader, candidateLoaders, url);
6999
- context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context);
7245
+ context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context || null);
7000
7246
  return await parseWithLoader(loader, data, options, context);
7001
7247
  }
7002
7248
  async function parseWithLoader(loader, data, options, context) {
@@ -7088,24 +7334,24 @@
7088
7334
  EXPIRED: 4,
7089
7335
  FAILED: 5
7090
7336
  };
7091
- TILE_REFINEMENT = {
7092
- ADD: 1,
7093
- REPLACE: 2
7094
- };
7095
- TILE_TYPE = {
7096
- EMPTY: "empty",
7097
- SCENEGRAPH: "scenegraph",
7098
- POINTCLOUD: "pointcloud",
7099
- MESH: "mesh"
7100
- };
7101
- TILESET_TYPE = {
7102
- I3S: "I3S",
7103
- TILES3D: "TILES3D"
7104
- };
7105
- LOD_METRIC_TYPE = {
7106
- GEOMETRIC_ERROR: "geometricError",
7107
- MAX_SCREEN_THRESHOLD: "maxScreenThreshold"
7108
- };
7337
+ (function(TILE_REFINEMENT2) {
7338
+ TILE_REFINEMENT2[TILE_REFINEMENT2["ADD"] = 1] = "ADD";
7339
+ TILE_REFINEMENT2[TILE_REFINEMENT2["REPLACE"] = 2] = "REPLACE";
7340
+ })(TILE_REFINEMENT || (TILE_REFINEMENT = {}));
7341
+ (function(TILE_TYPE2) {
7342
+ TILE_TYPE2["EMPTY"] = "empty";
7343
+ TILE_TYPE2["SCENEGRAPH"] = "scenegraph";
7344
+ TILE_TYPE2["POINTCLOUD"] = "pointcloud";
7345
+ TILE_TYPE2["MESH"] = "mesh";
7346
+ })(TILE_TYPE || (TILE_TYPE = {}));
7347
+ (function(TILESET_TYPE2) {
7348
+ TILESET_TYPE2["I3S"] = "I3S";
7349
+ TILESET_TYPE2["TILES3D"] = "TILES3D";
7350
+ })(TILESET_TYPE || (TILESET_TYPE = {}));
7351
+ (function(LOD_METRIC_TYPE2) {
7352
+ LOD_METRIC_TYPE2["GEOMETRIC_ERROR"] = "geometricError";
7353
+ LOD_METRIC_TYPE2["MAX_SCREEN_THRESHOLD"] = "maxScreenThreshold";
7354
+ })(LOD_METRIC_TYPE || (LOD_METRIC_TYPE = {}));
7109
7355
  TILE3D_OPTIMIZATION_HINT = {
7110
7356
  NOT_COMPUTED: -1,
7111
7357
  USE_OPTIMIZATION: 1,
@@ -7115,7 +7361,7 @@
7115
7361
  });
7116
7362
 
7117
7363
  // src/tileset/helpers/bounding-volume.ts
7118
- function defined2(x) {
7364
+ function defined(x) {
7119
7365
  return x !== void 0 && x !== null;
7120
7366
  }
7121
7367
  function createBoundingVolume(boundingVolumeHeader, transform, result) {
@@ -7187,7 +7433,7 @@
7187
7433
  zAxis[1],
7188
7434
  zAxis[2]
7189
7435
  ]);
7190
- if (defined2(result)) {
7436
+ if (defined(result)) {
7191
7437
  result.center = center;
7192
7438
  result.halfAxes = halfAxes;
7193
7439
  return result;
@@ -7200,7 +7446,7 @@
7200
7446
  const scale5 = transform.getScale(scratchScale);
7201
7447
  const uniformScale = Math.max(Math.max(scale5[0], scale5[1]), scale5[2]);
7202
7448
  const radius = sphere[3] * uniformScale;
7203
- if (defined2(result)) {
7449
+ if (defined(result)) {
7204
7450
  result.center = center;
7205
7451
  result.radius = radius;
7206
7452
  return result;
@@ -7502,16 +7748,16 @@
7502
7748
  };
7503
7749
  TilesetTraverser = class {
7504
7750
  constructor(options) {
7751
+ this.root = null;
7752
+ this.selectedTiles = {};
7753
+ this.requestedTiles = {};
7754
+ this.emptyTiles = {};
7505
7755
  this.lastUpdate = new Date().getTime();
7506
7756
  this.updateDebounceTime = 1e3;
7507
- this.options = { ...DEFAULT_PROPS3, ...options };
7508
7757
  this._traversalStack = new ManagedArray();
7509
7758
  this._emptyTraversalStack = new ManagedArray();
7510
7759
  this._frameNumber = null;
7511
- this.root = null;
7512
- this.selectedTiles = {};
7513
- this.requestedTiles = {};
7514
- this.emptyTiles = {};
7760
+ this.options = { ...DEFAULT_PROPS3, ...options };
7515
7761
  }
7516
7762
  traversalFinished(frameState) {
7517
7763
  return true;
@@ -7574,7 +7820,6 @@
7574
7820
  for (const child of children) {
7575
7821
  this.updateTile(child, frameState);
7576
7822
  }
7577
- return true;
7578
7823
  }
7579
7824
  updateAndPushChildren(tile, frameState, stack, depth) {
7580
7825
  const { loadSiblings, skipLevelOfDetail } = this.options;
@@ -7653,7 +7898,7 @@
7653
7898
  shouldSelectTile(tile) {
7654
7899
  return tile.contentAvailable && !this.options.skipLevelOfDetail;
7655
7900
  }
7656
- shouldRefine(tile, frameState, useParentMetric) {
7901
+ shouldRefine(tile, frameState, useParentMetric = false) {
7657
7902
  let screenSpaceError = tile._screenSpaceError;
7658
7903
  if (useParentMetric) {
7659
7904
  screenSpaceError = tile.getScreenSpaceError(frameState, true);
@@ -7716,7 +7961,7 @@
7716
7961
  });
7717
7962
 
7718
7963
  // src/tileset/tile-3d.ts
7719
- function defined3(x) {
7964
+ function defined2(x) {
7720
7965
  return x !== void 0 && x !== null;
7721
7966
  }
7722
7967
  var scratchVector9, Tile3D;
@@ -7734,14 +7979,6 @@
7734
7979
  scratchVector9 = new Vector3();
7735
7980
  Tile3D = class {
7736
7981
  constructor(tileset, header, parentHeader, extendedId = "") {
7737
- this.header = header;
7738
- this.tileset = tileset;
7739
- this.id = extendedId || header.id;
7740
- this.url = header.url;
7741
- this.parent = parentHeader;
7742
- this.refine = this._getRefine(header.refine);
7743
- this.type = header.type;
7744
- this.contentUrl = header.contentUrl;
7745
7982
  this.lodMetricType = "geometricError";
7746
7983
  this.lodMetricValue = 0;
7747
7984
  this.boundingVolume = null;
@@ -7749,40 +7986,47 @@
7749
7986
  this.contentState = TILE_CONTENT_STATE.UNLOADED;
7750
7987
  this.gpuMemoryUsageInBytes = 0;
7751
7988
  this.children = [];
7752
- this.hasEmptyContent = false;
7753
- this.hasTilesetContent = false;
7754
7989
  this.depth = 0;
7755
7990
  this.viewportIds = [];
7756
- this.userData = {};
7991
+ this.transform = new Matrix4();
7757
7992
  this.extensions = null;
7758
- this._priority = 0;
7759
- this._touchedFrame = 0;
7760
- this._visitedFrame = 0;
7761
- this._selectedFrame = 0;
7762
- this._requestedFrame = 0;
7763
- this._screenSpaceError = 0;
7993
+ this.implicitTiling = null;
7994
+ this.userData = {};
7995
+ this.hasEmptyContent = false;
7996
+ this.hasTilesetContent = false;
7997
+ this.traverser = new TilesetTraverser({});
7764
7998
  this._cacheNode = null;
7765
7999
  this._frameNumber = null;
7766
- this._cacheNode = null;
7767
- this.traverser = new TilesetTraverser({});
7768
- this._shouldRefine = false;
8000
+ this._expireDate = null;
8001
+ this._expiredContent = null;
7769
8002
  this._distanceToCamera = 0;
7770
- this._centerZDepth = 0;
8003
+ this._screenSpaceError = 0;
7771
8004
  this._visible = void 0;
7772
- this._inRequestVolume = false;
7773
- this._stackLength = 0;
7774
- this._selectionDepth = 0;
7775
8005
  this._initialTransform = new Matrix4();
7776
- this.transform = new Matrix4();
8006
+ this._priority = 0;
8007
+ this._selectedFrame = 0;
8008
+ this._requestedFrame = 0;
8009
+ this._selectionDepth = 0;
8010
+ this._touchedFrame = 0;
8011
+ this._centerZDepth = 0;
8012
+ this._shouldRefine = false;
8013
+ this._stackLength = 0;
8014
+ this._visitedFrame = 0;
8015
+ this._inRequestVolume = false;
8016
+ this._lodJudge = null;
8017
+ this.header = header;
8018
+ this.tileset = tileset;
8019
+ this.id = extendedId || header.id;
8020
+ this.url = header.url;
8021
+ this.parent = parentHeader;
8022
+ this.refine = this._getRefine(header.refine);
8023
+ this.type = header.type;
8024
+ this.contentUrl = header.contentUrl;
7777
8025
  this._initializeLodMetric(header);
7778
8026
  this._initializeTransforms(header);
7779
8027
  this._initializeBoundingVolumes(header);
7780
8028
  this._initializeContent(header);
7781
8029
  this._initializeRenderingState(header);
7782
- this._lodJudge = null;
7783
- this._expireDate = null;
7784
- this._expiredContent = null;
7785
- this.implicitTiling = null;
7786
8030
  Object.seal(this);
7787
8031
  }
7788
8032
  destroy() {
@@ -7849,6 +8093,9 @@
7849
8093
  unselect() {
7850
8094
  this._selectedFrame = 0;
7851
8095
  }
8096
+ _getGpuMemoryUsageInBytes() {
8097
+ return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;
8098
+ }
7852
8099
  _getPriority() {
7853
8100
  const traverser = this.tileset._traverser;
7854
8101
  const { skipLevelOfDetail } = traverser.options;
@@ -7965,7 +8212,7 @@
7965
8212
  return !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0;
7966
8213
  }
7967
8214
  updateExpiration() {
7968
- if (defined3(this._expireDate) && this.contentReady && !this.hasEmptyContent) {
8215
+ if (defined2(this._expireDate) && this.contentReady && !this.hasEmptyContent) {
7969
8216
  const now = Date.now();
7970
8217
  if (Date.lessThan(this._expireDate, now)) {
7971
8218
  this.contentState = TILE_CONTENT_STATE.EXPIRED;
@@ -8048,6 +8295,8 @@
8048
8295
  }
8049
8296
  if (this._isTileset()) {
8050
8297
  this.hasTilesetContent = true;
8298
+ } else {
8299
+ this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();
8051
8300
  }
8052
8301
  }
8053
8302
  _updateBoundingVolume(header) {
@@ -8317,20 +8566,6 @@
8317
8566
  });
8318
8567
 
8319
8568
  // src/tileset/tileset-3d.ts
8320
- function getQueryParamString(queryParams) {
8321
- const queryParamStrings = [];
8322
- for (const key of Object.keys(queryParams)) {
8323
- queryParamStrings.push(`${key}=${queryParams[key]}`);
8324
- }
8325
- switch (queryParamStrings.length) {
8326
- case 0:
8327
- return "";
8328
- case 1:
8329
- return `?${queryParamStrings[0]}`;
8330
- default:
8331
- return `?${queryParamStrings.join("&")}`;
8332
- }
8333
- }
8334
8569
  var DEFAULT_PROPS4, TILES_TOTAL, TILES_IN_MEMORY, TILES_IN_VIEW, TILES_RENDERABLE, TILES_LOADED, TILES_LOADING, TILES_UNLOADED, TILES_LOAD_FAILED, POINTS_COUNT, TILES_GPU_MEMORY, Tileset3D;
8335
8570
  var init_tileset_3d = __esm({
8336
8571
  "src/tileset/tileset-3d.ts"() {
@@ -8385,57 +8620,56 @@
8385
8620
  POINTS_COUNT = "Points/Vertices";
8386
8621
  TILES_GPU_MEMORY = "Tile Memory Use";
8387
8622
  Tileset3D = class {
8388
- constructor(json, options) {
8389
- this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
8390
- this.updatePromise = null;
8391
- assert2(json);
8392
- this.options = { ...DEFAULT_PROPS4, ...options };
8393
- this.tileset = json;
8394
- this.loader = json.loader;
8395
- this.type = json.type;
8396
- this.url = json.url;
8397
- this.basePath = json.basePath || path_exports.dirname(this.url);
8398
- this.modelMatrix = this.options.modelMatrix;
8399
- this.ellipsoid = this.options.ellipsoid;
8400
- this.lodMetricType = json.lodMetricType;
8401
- this.lodMetricValue = json.lodMetricValue;
8402
- this.refine = json.root.refine;
8403
- this.loadOptions = this.options.loadOptions || {};
8623
+ constructor(tileset, options) {
8404
8624
  this.root = null;
8405
8625
  this.roots = {};
8626
+ this.asset = {};
8627
+ this.description = "";
8628
+ this.extras = null;
8629
+ this.attributions = {};
8630
+ this.credits = {};
8631
+ this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
8406
8632
  this.cartographicCenter = null;
8407
8633
  this.cartesianCenter = null;
8408
8634
  this.zoom = 1;
8409
8635
  this.boundingVolume = null;
8636
+ this.dynamicScreenSpaceErrorComputedDensity = 0;
8637
+ this.maximumMemoryUsage = 32;
8638
+ this.gpuMemoryUsageInBytes = 0;
8639
+ this._frameNumber = 0;
8640
+ this._queryParams = {};
8641
+ this._extensionsUsed = [];
8642
+ this._tiles = {};
8643
+ this._pendingCount = 0;
8644
+ this.selectedTiles = [];
8410
8645
  this.traverseCounter = 0;
8411
8646
  this.geometricError = 0;
8412
- this._traverser = this._initializeTraverser();
8647
+ this.lastUpdatedVieports = null;
8648
+ this._requestedTiles = [];
8649
+ this._emptyTiles = [];
8650
+ this.frameStateData = {};
8413
8651
  this._cache = new TilesetCache();
8652
+ this.updatePromise = null;
8653
+ this.options = { ...DEFAULT_PROPS4, ...options };
8654
+ this.tileset = tileset;
8655
+ this.loader = tileset.loader;
8656
+ this.type = tileset.type;
8657
+ this.url = tileset.url;
8658
+ this.basePath = tileset.basePath || path_exports.dirname(this.url);
8659
+ this.modelMatrix = this.options.modelMatrix;
8660
+ this.ellipsoid = this.options.ellipsoid;
8661
+ this.lodMetricType = tileset.lodMetricType;
8662
+ this.lodMetricValue = tileset.lodMetricValue;
8663
+ this.refine = tileset.root.refine;
8664
+ this.loadOptions = this.options.loadOptions || {};
8665
+ this._traverser = this._initializeTraverser();
8414
8666
  this._requestScheduler = new RequestScheduler({
8415
8667
  throttleRequests: this.options.throttleRequests,
8416
8668
  maxRequests: this.options.maxRequests
8417
8669
  });
8418
- this._frameNumber = 0;
8419
- this._pendingCount = 0;
8420
- this._tiles = {};
8421
- this.selectedTiles = [];
8422
- this._emptyTiles = [];
8423
- this._requestedTiles = [];
8424
- this.frameStateData = {};
8425
- this.lastUpdatedVieports = null;
8426
- this._queryParams = {};
8427
- this._queryParamsString = "";
8428
- this.maximumMemoryUsage = this.options.maximumMemoryUsage || 32;
8429
- this.gpuMemoryUsageInBytes = 0;
8430
8670
  this.stats = new Stats({ id: this.url });
8431
8671
  this._initializeStats();
8432
- this._extensionsUsed = void 0;
8433
- this.dynamicScreenSpaceErrorComputedDensity = 0;
8434
- this.extras = null;
8435
- this.asset = {};
8436
- this.credits = {};
8437
- this.description = this.options.description || "";
8438
- this.tilesetInitializationPromise = this._initializeTileSet(json);
8672
+ this.tilesetInitializationPromise = this._initializeTileSet(tileset);
8439
8673
  }
8440
8674
  destroy() {
8441
8675
  this._destroy();
@@ -8450,10 +8684,7 @@
8450
8684
  return this._frameNumber;
8451
8685
  }
8452
8686
  get queryParams() {
8453
- if (!this._queryParamsString) {
8454
- this._queryParamsString = getQueryParamString(this._queryParams);
8455
- }
8456
- return this._queryParamsString;
8687
+ return new URLSearchParams(this._queryParams).toString();
8457
8688
  }
8458
8689
  setProps(props) {
8459
8690
  this.options = { ...this.options, ...props };
@@ -8466,10 +8697,10 @@
8466
8697
  if (isDataUrl) {
8467
8698
  return tilePath;
8468
8699
  }
8469
- return `${tilePath}${this.queryParams}`;
8700
+ return `${tilePath}${tilePath.includes("?") ? "&" : "?"}${this.queryParams}`;
8470
8701
  }
8471
8702
  hasExtension(extensionName) {
8472
- return Boolean(this._extensionsUsed && this._extensionsUsed.indexOf(extensionName) > -1);
8703
+ return Boolean(this._extensionsUsed.indexOf(extensionName) > -1);
8473
8704
  }
8474
8705
  update(viewports = null) {
8475
8706
  this.tilesetInitializationPromise.then(() => {
@@ -8656,7 +8887,6 @@
8656
8887
  }
8657
8888
  calculateViewPropsTiles3D() {
8658
8889
  const root = this.root;
8659
- assert2(root);
8660
8890
  const { center } = root.boundingVolume;
8661
8891
  if (!center) {
8662
8892
  console.warn("center was not pre-calculated for the root tile");
@@ -8699,6 +8929,13 @@
8699
8929
  const children = tile.header.children || [];
8700
8930
  for (const childHeader of children) {
8701
8931
  const childTile = new Tile3D(this, childHeader, tile);
8932
+ if (childTile.contentUrl?.includes("?session=")) {
8933
+ const url = new URL(childTile.contentUrl);
8934
+ const session = url.searchParams.get("session");
8935
+ if (session) {
8936
+ this._queryParams.session = session;
8937
+ }
8938
+ }
8702
8939
  tile.children.push(childTile);
8703
8940
  childTile.depth = tile.depth + 1;
8704
8941
  stack.push(childTile);
@@ -8734,7 +8971,7 @@
8734
8971
  this._onStartTileLoading();
8735
8972
  loaded = await tile.loadContent();
8736
8973
  } catch (error) {
8737
- this._onTileLoadError(tile, error);
8974
+ this._onTileLoadError(tile, error instanceof Error ? error : new Error("load failed"));
8738
8975
  } finally {
8739
8976
  this._onEndTileLoading();
8740
8977
  this._onTileLoad(tile, loaded);
@@ -8804,11 +9041,11 @@
8804
9041
  _updateCacheStats(tile) {
8805
9042
  this.stats.get(TILES_LOADED).incrementCount();
8806
9043
  this.stats.get(TILES_IN_MEMORY).incrementCount();
8807
- this.gpuMemoryUsageInBytes += tile.content.byteLength || 0;
9044
+ this.gpuMemoryUsageInBytes += tile.gpuMemoryUsageInBytes || 0;
8808
9045
  this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
8809
9046
  }
8810
9047
  _unloadTile(tile) {
8811
- this.gpuMemoryUsageInBytes -= tile.content && tile.content.byteLength || 0;
9048
+ this.gpuMemoryUsageInBytes -= tile.gpuMemoryUsageInBytes || 0;
8812
9049
  this.stats.get(TILES_IN_MEMORY).decrementCount();
8813
9050
  this.stats.get(TILES_UNLOADED).incrementCount();
8814
9051
  this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
@@ -8850,12 +9087,17 @@
8850
9087
  tile.destroy();
8851
9088
  }
8852
9089
  _initializeTiles3DTileset(tilesetJson) {
9090
+ if (tilesetJson.queryString) {
9091
+ const searchParams = new URLSearchParams(tilesetJson.queryString);
9092
+ const queryParams = Object.fromEntries(searchParams.entries());
9093
+ this._queryParams = { ...this._queryParams, ...queryParams };
9094
+ }
8853
9095
  this.asset = tilesetJson.asset;
8854
9096
  if (!this.asset) {
8855
9097
  throw new Error("Tileset must have an asset property.");
8856
9098
  }
8857
- if (this.asset.version !== "0.0" && this.asset.version !== "1.0") {
8858
- throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");
9099
+ if (this.asset.version !== "0.0" && this.asset.version !== "1.0" && this.asset.version !== "1.1") {
9100
+ throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");
8859
9101
  }
8860
9102
  if ("tilesetVersion" in this.asset) {
8861
9103
  this._queryParams.v = this.asset.tilesetVersion;
@@ -8866,7 +9108,7 @@
8866
9108
  this.description = this.options.description || "";
8867
9109
  this.properties = tilesetJson.properties;
8868
9110
  this.geometricError = tilesetJson.geometricError;
8869
- this._extensionsUsed = tilesetJson.extensionsUsed;
9111
+ this._extensionsUsed = tilesetJson.extensionsUsed || [];
8870
9112
  this.extras = tilesetJson.extras;
8871
9113
  }
8872
9114
  _initializeI3STileset() {