@loaders.gl/i3s 4.0.0-beta.6 → 4.0.0-beta.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 (36) hide show
  1. package/LICENSE +7 -7
  2. package/dist/dist.dev.js +864 -1460
  3. package/dist/i3s-content-worker-node.js +55 -55
  4. package/dist/i3s-content-worker-node.js.map +4 -4
  5. package/dist/i3s-content-worker.js +33 -796
  6. package/dist/i3s-loader.d.ts.map +1 -1
  7. package/dist/i3s-loader.js +1 -2
  8. package/dist/i3s-loader.js.map +1 -1
  9. package/dist/index.cjs +293 -316
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/parsers/constants.d.ts.map +1 -1
  15. package/dist/lib/parsers/constants.js +1 -1
  16. package/dist/lib/parsers/constants.js.map +1 -1
  17. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
  18. package/dist/lib/parsers/parse-i3s-attribute.js.map +1 -1
  19. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  20. package/dist/lib/parsers/parse-i3s-tile-content.js +2 -4
  21. package/dist/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  22. package/dist/lib/utils/customize-colors.d.ts +30 -0
  23. package/dist/lib/utils/customize-colors.d.ts.map +1 -0
  24. package/dist/lib/utils/customize-colors.js +92 -0
  25. package/dist/lib/utils/customize-colors.js.map +1 -0
  26. package/package.json +11 -12
  27. package/src/i3s-loader.ts +1 -2
  28. package/src/index.ts +2 -0
  29. package/src/lib/parsers/constants.ts +4 -1
  30. package/src/lib/parsers/parse-i3s-attribute.ts +1 -0
  31. package/src/lib/parsers/parse-i3s-tile-content.ts +2 -11
  32. package/src/lib/utils/{customize-/321/201olors.ts → customize-colors.ts} +66 -41
  33. package/dist/lib/utils/customize-/321/201olors.d.ts +0 -14
  34. package/dist/lib/utils/customize-/321/201olors.d.ts.map +0 -1
  35. package/dist/lib/utils/customize-/321/201olors.js +0 -98
  36. package/dist/lib/utils/customize-/321/201olors.js.map +0 -1
package/dist/dist.dev.js CHANGED
@@ -37,13 +37,6 @@ var __exports__ = (() => {
37
37
  ));
38
38
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
39
39
 
40
- // external-global-plugin:@loaders.gl/core
41
- var require_core = __commonJS({
42
- "external-global-plugin:@loaders.gl/core"(exports, module) {
43
- module.exports = globalThis.loaders;
44
- }
45
- });
46
-
47
40
  // (disabled):../worker-utils/src/lib/node/require-utils.node
48
41
  var require_require_utils = __commonJS({
49
42
  "(disabled):../worker-utils/src/lib/node/require-utils.node"() {
@@ -51,6 +44,13 @@ var __exports__ = (() => {
51
44
  }
52
45
  });
53
46
 
47
+ // external-global-plugin:@loaders.gl/core
48
+ var require_core = __commonJS({
49
+ "external-global-plugin:@loaders.gl/core"(exports, module) {
50
+ module.exports = globalThis.loaders;
51
+ }
52
+ });
53
+
54
54
  // ../../node_modules/pako/lib/utils/common.js
55
55
  var require_common = __commonJS({
56
56
  "../../node_modules/pako/lib/utils/common.js"(exports) {
@@ -4270,142 +4270,22 @@ var __exports__ = (() => {
4270
4270
  I3SLoader: () => I3SLoader,
4271
4271
  I3SNodePageLoader: () => I3SNodePageLoader,
4272
4272
  SLPKLoader: () => SLPKLoader,
4273
+ customizeColors: () => customizeColors,
4273
4274
  loadFeatureAttributes: () => loadFeatureAttributes,
4274
4275
  parseSLPKArchive: () => parseSLPKArchive
4275
4276
  });
4276
4277
 
4277
- // ../../node_modules/@luma.gl/constants/dist/esm/index.js
4278
- var esm_default = {
4279
- DEPTH_BUFFER_BIT: 256,
4280
- STENCIL_BUFFER_BIT: 1024,
4281
- COLOR_BUFFER_BIT: 16384,
4278
+ // ../math/src/geometry/constants.ts
4279
+ var GL_PRIMITIVE_MODE = {
4282
4280
  POINTS: 0,
4283
4281
  LINES: 1,
4284
4282
  LINE_LOOP: 2,
4285
4283
  LINE_STRIP: 3,
4286
4284
  TRIANGLES: 4,
4287
4285
  TRIANGLE_STRIP: 5,
4288
- TRIANGLE_FAN: 6,
4289
- ZERO: 0,
4290
- ONE: 1,
4291
- SRC_COLOR: 768,
4292
- ONE_MINUS_SRC_COLOR: 769,
4293
- SRC_ALPHA: 770,
4294
- ONE_MINUS_SRC_ALPHA: 771,
4295
- DST_ALPHA: 772,
4296
- ONE_MINUS_DST_ALPHA: 773,
4297
- DST_COLOR: 774,
4298
- ONE_MINUS_DST_COLOR: 775,
4299
- SRC_ALPHA_SATURATE: 776,
4300
- CONSTANT_COLOR: 32769,
4301
- ONE_MINUS_CONSTANT_COLOR: 32770,
4302
- CONSTANT_ALPHA: 32771,
4303
- ONE_MINUS_CONSTANT_ALPHA: 32772,
4304
- FUNC_ADD: 32774,
4305
- FUNC_SUBTRACT: 32778,
4306
- FUNC_REVERSE_SUBTRACT: 32779,
4307
- BLEND_EQUATION: 32777,
4308
- BLEND_EQUATION_RGB: 32777,
4309
- BLEND_EQUATION_ALPHA: 34877,
4310
- BLEND_DST_RGB: 32968,
4311
- BLEND_SRC_RGB: 32969,
4312
- BLEND_DST_ALPHA: 32970,
4313
- BLEND_SRC_ALPHA: 32971,
4314
- BLEND_COLOR: 32773,
4315
- ARRAY_BUFFER_BINDING: 34964,
4316
- ELEMENT_ARRAY_BUFFER_BINDING: 34965,
4317
- LINE_WIDTH: 2849,
4318
- ALIASED_POINT_SIZE_RANGE: 33901,
4319
- ALIASED_LINE_WIDTH_RANGE: 33902,
4320
- CULL_FACE_MODE: 2885,
4321
- FRONT_FACE: 2886,
4322
- DEPTH_RANGE: 2928,
4323
- DEPTH_WRITEMASK: 2930,
4324
- DEPTH_CLEAR_VALUE: 2931,
4325
- DEPTH_FUNC: 2932,
4326
- STENCIL_CLEAR_VALUE: 2961,
4327
- STENCIL_FUNC: 2962,
4328
- STENCIL_FAIL: 2964,
4329
- STENCIL_PASS_DEPTH_FAIL: 2965,
4330
- STENCIL_PASS_DEPTH_PASS: 2966,
4331
- STENCIL_REF: 2967,
4332
- STENCIL_VALUE_MASK: 2963,
4333
- STENCIL_WRITEMASK: 2968,
4334
- STENCIL_BACK_FUNC: 34816,
4335
- STENCIL_BACK_FAIL: 34817,
4336
- STENCIL_BACK_PASS_DEPTH_FAIL: 34818,
4337
- STENCIL_BACK_PASS_DEPTH_PASS: 34819,
4338
- STENCIL_BACK_REF: 36003,
4339
- STENCIL_BACK_VALUE_MASK: 36004,
4340
- STENCIL_BACK_WRITEMASK: 36005,
4341
- VIEWPORT: 2978,
4342
- SCISSOR_BOX: 3088,
4343
- COLOR_CLEAR_VALUE: 3106,
4344
- COLOR_WRITEMASK: 3107,
4345
- UNPACK_ALIGNMENT: 3317,
4346
- PACK_ALIGNMENT: 3333,
4347
- MAX_TEXTURE_SIZE: 3379,
4348
- MAX_VIEWPORT_DIMS: 3386,
4349
- SUBPIXEL_BITS: 3408,
4350
- RED_BITS: 3410,
4351
- GREEN_BITS: 3411,
4352
- BLUE_BITS: 3412,
4353
- ALPHA_BITS: 3413,
4354
- DEPTH_BITS: 3414,
4355
- STENCIL_BITS: 3415,
4356
- POLYGON_OFFSET_UNITS: 10752,
4357
- POLYGON_OFFSET_FACTOR: 32824,
4358
- TEXTURE_BINDING_2D: 32873,
4359
- SAMPLE_BUFFERS: 32936,
4360
- SAMPLES: 32937,
4361
- SAMPLE_COVERAGE_VALUE: 32938,
4362
- SAMPLE_COVERAGE_INVERT: 32939,
4363
- COMPRESSED_TEXTURE_FORMATS: 34467,
4364
- VENDOR: 7936,
4365
- RENDERER: 7937,
4366
- VERSION: 7938,
4367
- IMPLEMENTATION_COLOR_READ_TYPE: 35738,
4368
- IMPLEMENTATION_COLOR_READ_FORMAT: 35739,
4369
- BROWSER_DEFAULT_WEBGL: 37444,
4370
- STATIC_DRAW: 35044,
4371
- STREAM_DRAW: 35040,
4372
- DYNAMIC_DRAW: 35048,
4373
- ARRAY_BUFFER: 34962,
4374
- ELEMENT_ARRAY_BUFFER: 34963,
4375
- BUFFER_SIZE: 34660,
4376
- BUFFER_USAGE: 34661,
4377
- CURRENT_VERTEX_ATTRIB: 34342,
4378
- VERTEX_ATTRIB_ARRAY_ENABLED: 34338,
4379
- VERTEX_ATTRIB_ARRAY_SIZE: 34339,
4380
- VERTEX_ATTRIB_ARRAY_STRIDE: 34340,
4381
- VERTEX_ATTRIB_ARRAY_TYPE: 34341,
4382
- VERTEX_ATTRIB_ARRAY_NORMALIZED: 34922,
4383
- VERTEX_ATTRIB_ARRAY_POINTER: 34373,
4384
- VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 34975,
4385
- CULL_FACE: 2884,
4386
- FRONT: 1028,
4387
- BACK: 1029,
4388
- FRONT_AND_BACK: 1032,
4389
- BLEND: 3042,
4390
- DEPTH_TEST: 2929,
4391
- DITHER: 3024,
4392
- POLYGON_OFFSET_FILL: 32823,
4393
- SAMPLE_ALPHA_TO_COVERAGE: 32926,
4394
- SAMPLE_COVERAGE: 32928,
4395
- SCISSOR_TEST: 3089,
4396
- STENCIL_TEST: 2960,
4397
- NO_ERROR: 0,
4398
- INVALID_ENUM: 1280,
4399
- INVALID_VALUE: 1281,
4400
- INVALID_OPERATION: 1282,
4401
- OUT_OF_MEMORY: 1285,
4402
- CONTEXT_LOST_WEBGL: 37442,
4403
- CW: 2304,
4404
- CCW: 2305,
4405
- DONT_CARE: 4352,
4406
- FASTEST: 4353,
4407
- NICEST: 4354,
4408
- GENERATE_MIPMAP_HINT: 33170,
4286
+ TRIANGLE_FAN: 6
4287
+ };
4288
+ var GL_TYPE = {
4409
4289
  BYTE: 5120,
4410
4290
  UNSIGNED_BYTE: 5121,
4411
4291
  SHORT: 5122,
@@ -4413,749 +4293,517 @@ var __exports__ = (() => {
4413
4293
  INT: 5124,
4414
4294
  UNSIGNED_INT: 5125,
4415
4295
  FLOAT: 5126,
4416
- DOUBLE: 5130,
4417
- DEPTH_COMPONENT: 6402,
4418
- ALPHA: 6406,
4419
- RGB: 6407,
4420
- RGBA: 6408,
4421
- LUMINANCE: 6409,
4422
- LUMINANCE_ALPHA: 6410,
4423
- UNSIGNED_SHORT_4_4_4_4: 32819,
4424
- UNSIGNED_SHORT_5_5_5_1: 32820,
4425
- UNSIGNED_SHORT_5_6_5: 33635,
4426
- FRAGMENT_SHADER: 35632,
4427
- VERTEX_SHADER: 35633,
4428
- COMPILE_STATUS: 35713,
4429
- DELETE_STATUS: 35712,
4430
- LINK_STATUS: 35714,
4431
- VALIDATE_STATUS: 35715,
4432
- ATTACHED_SHADERS: 35717,
4433
- ACTIVE_ATTRIBUTES: 35721,
4434
- ACTIVE_UNIFORMS: 35718,
4435
- MAX_VERTEX_ATTRIBS: 34921,
4436
- MAX_VERTEX_UNIFORM_VECTORS: 36347,
4437
- MAX_VARYING_VECTORS: 36348,
4438
- MAX_COMBINED_TEXTURE_IMAGE_UNITS: 35661,
4439
- MAX_VERTEX_TEXTURE_IMAGE_UNITS: 35660,
4440
- MAX_TEXTURE_IMAGE_UNITS: 34930,
4441
- MAX_FRAGMENT_UNIFORM_VECTORS: 36349,
4442
- SHADER_TYPE: 35663,
4443
- SHADING_LANGUAGE_VERSION: 35724,
4444
- CURRENT_PROGRAM: 35725,
4445
- NEVER: 512,
4446
- ALWAYS: 519,
4447
- LESS: 513,
4448
- EQUAL: 514,
4449
- LEQUAL: 515,
4450
- GREATER: 516,
4451
- GEQUAL: 518,
4452
- NOTEQUAL: 517,
4453
- KEEP: 7680,
4454
- REPLACE: 7681,
4455
- INCR: 7682,
4456
- DECR: 7683,
4457
- INVERT: 5386,
4458
- INCR_WRAP: 34055,
4459
- DECR_WRAP: 34056,
4460
- NEAREST: 9728,
4461
- LINEAR: 9729,
4462
- NEAREST_MIPMAP_NEAREST: 9984,
4463
- LINEAR_MIPMAP_NEAREST: 9985,
4464
- NEAREST_MIPMAP_LINEAR: 9986,
4465
- LINEAR_MIPMAP_LINEAR: 9987,
4466
- TEXTURE_MAG_FILTER: 10240,
4467
- TEXTURE_MIN_FILTER: 10241,
4468
- TEXTURE_WRAP_S: 10242,
4469
- TEXTURE_WRAP_T: 10243,
4470
- TEXTURE_2D: 3553,
4471
- TEXTURE: 5890,
4472
- TEXTURE_CUBE_MAP: 34067,
4473
- TEXTURE_BINDING_CUBE_MAP: 34068,
4474
- TEXTURE_CUBE_MAP_POSITIVE_X: 34069,
4475
- TEXTURE_CUBE_MAP_NEGATIVE_X: 34070,
4476
- TEXTURE_CUBE_MAP_POSITIVE_Y: 34071,
4477
- TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072,
4478
- TEXTURE_CUBE_MAP_POSITIVE_Z: 34073,
4479
- TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074,
4480
- MAX_CUBE_MAP_TEXTURE_SIZE: 34076,
4481
- TEXTURE0: 33984,
4482
- ACTIVE_TEXTURE: 34016,
4483
- REPEAT: 10497,
4484
- CLAMP_TO_EDGE: 33071,
4485
- MIRRORED_REPEAT: 33648,
4486
- TEXTURE_WIDTH: 4096,
4487
- TEXTURE_HEIGHT: 4097,
4488
- FLOAT_VEC2: 35664,
4489
- FLOAT_VEC3: 35665,
4490
- FLOAT_VEC4: 35666,
4491
- INT_VEC2: 35667,
4492
- INT_VEC3: 35668,
4493
- INT_VEC4: 35669,
4494
- BOOL: 35670,
4495
- BOOL_VEC2: 35671,
4496
- BOOL_VEC3: 35672,
4497
- BOOL_VEC4: 35673,
4498
- FLOAT_MAT2: 35674,
4499
- FLOAT_MAT3: 35675,
4500
- FLOAT_MAT4: 35676,
4501
- SAMPLER_2D: 35678,
4502
- SAMPLER_CUBE: 35680,
4503
- LOW_FLOAT: 36336,
4504
- MEDIUM_FLOAT: 36337,
4505
- HIGH_FLOAT: 36338,
4506
- LOW_INT: 36339,
4507
- MEDIUM_INT: 36340,
4508
- HIGH_INT: 36341,
4509
- FRAMEBUFFER: 36160,
4510
- RENDERBUFFER: 36161,
4511
- RGBA4: 32854,
4512
- RGB5_A1: 32855,
4513
- RGB565: 36194,
4514
- DEPTH_COMPONENT16: 33189,
4515
- STENCIL_INDEX: 6401,
4516
- STENCIL_INDEX8: 36168,
4517
- DEPTH_STENCIL: 34041,
4518
- RENDERBUFFER_WIDTH: 36162,
4519
- RENDERBUFFER_HEIGHT: 36163,
4520
- RENDERBUFFER_INTERNAL_FORMAT: 36164,
4521
- RENDERBUFFER_RED_SIZE: 36176,
4522
- RENDERBUFFER_GREEN_SIZE: 36177,
4523
- RENDERBUFFER_BLUE_SIZE: 36178,
4524
- RENDERBUFFER_ALPHA_SIZE: 36179,
4525
- RENDERBUFFER_DEPTH_SIZE: 36180,
4526
- RENDERBUFFER_STENCIL_SIZE: 36181,
4527
- FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 36048,
4528
- FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 36049,
4529
- FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 36050,
4530
- FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 36051,
4531
- COLOR_ATTACHMENT0: 36064,
4532
- DEPTH_ATTACHMENT: 36096,
4533
- STENCIL_ATTACHMENT: 36128,
4534
- DEPTH_STENCIL_ATTACHMENT: 33306,
4535
- NONE: 0,
4536
- FRAMEBUFFER_COMPLETE: 36053,
4537
- FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 36054,
4538
- FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 36055,
4539
- FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 36057,
4540
- FRAMEBUFFER_UNSUPPORTED: 36061,
4541
- FRAMEBUFFER_BINDING: 36006,
4542
- RENDERBUFFER_BINDING: 36007,
4543
- READ_FRAMEBUFFER: 36008,
4544
- DRAW_FRAMEBUFFER: 36009,
4545
- MAX_RENDERBUFFER_SIZE: 34024,
4546
- INVALID_FRAMEBUFFER_OPERATION: 1286,
4547
- UNPACK_FLIP_Y_WEBGL: 37440,
4548
- UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441,
4549
- UNPACK_COLORSPACE_CONVERSION_WEBGL: 37443,
4550
- READ_BUFFER: 3074,
4551
- UNPACK_ROW_LENGTH: 3314,
4552
- UNPACK_SKIP_ROWS: 3315,
4553
- UNPACK_SKIP_PIXELS: 3316,
4554
- PACK_ROW_LENGTH: 3330,
4555
- PACK_SKIP_ROWS: 3331,
4556
- PACK_SKIP_PIXELS: 3332,
4557
- TEXTURE_BINDING_3D: 32874,
4558
- UNPACK_SKIP_IMAGES: 32877,
4559
- UNPACK_IMAGE_HEIGHT: 32878,
4560
- MAX_3D_TEXTURE_SIZE: 32883,
4561
- MAX_ELEMENTS_VERTICES: 33e3,
4562
- MAX_ELEMENTS_INDICES: 33001,
4563
- MAX_TEXTURE_LOD_BIAS: 34045,
4564
- MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657,
4565
- MAX_VERTEX_UNIFORM_COMPONENTS: 35658,
4566
- MAX_ARRAY_TEXTURE_LAYERS: 35071,
4567
- MIN_PROGRAM_TEXEL_OFFSET: 35076,
4568
- MAX_PROGRAM_TEXEL_OFFSET: 35077,
4569
- MAX_VARYING_COMPONENTS: 35659,
4570
- FRAGMENT_SHADER_DERIVATIVE_HINT: 35723,
4571
- RASTERIZER_DISCARD: 35977,
4572
- VERTEX_ARRAY_BINDING: 34229,
4573
- MAX_VERTEX_OUTPUT_COMPONENTS: 37154,
4574
- MAX_FRAGMENT_INPUT_COMPONENTS: 37157,
4575
- MAX_SERVER_WAIT_TIMEOUT: 37137,
4576
- MAX_ELEMENT_INDEX: 36203,
4577
- RED: 6403,
4578
- RGB8: 32849,
4579
- RGBA8: 32856,
4580
- RGB10_A2: 32857,
4581
- TEXTURE_3D: 32879,
4582
- TEXTURE_WRAP_R: 32882,
4583
- TEXTURE_MIN_LOD: 33082,
4584
- TEXTURE_MAX_LOD: 33083,
4585
- TEXTURE_BASE_LEVEL: 33084,
4586
- TEXTURE_MAX_LEVEL: 33085,
4587
- TEXTURE_COMPARE_MODE: 34892,
4588
- TEXTURE_COMPARE_FUNC: 34893,
4589
- SRGB: 35904,
4590
- SRGB8: 35905,
4591
- SRGB8_ALPHA8: 35907,
4592
- COMPARE_REF_TO_TEXTURE: 34894,
4593
- RGBA32F: 34836,
4594
- RGB32F: 34837,
4595
- RGBA16F: 34842,
4596
- RGB16F: 34843,
4597
- TEXTURE_2D_ARRAY: 35866,
4598
- TEXTURE_BINDING_2D_ARRAY: 35869,
4599
- R11F_G11F_B10F: 35898,
4600
- RGB9_E5: 35901,
4601
- RGBA32UI: 36208,
4602
- RGB32UI: 36209,
4603
- RGBA16UI: 36214,
4604
- RGB16UI: 36215,
4605
- RGBA8UI: 36220,
4606
- RGB8UI: 36221,
4607
- RGBA32I: 36226,
4608
- RGB32I: 36227,
4609
- RGBA16I: 36232,
4610
- RGB16I: 36233,
4611
- RGBA8I: 36238,
4612
- RGB8I: 36239,
4613
- RED_INTEGER: 36244,
4614
- RGB_INTEGER: 36248,
4615
- RGBA_INTEGER: 36249,
4616
- R8: 33321,
4617
- RG8: 33323,
4618
- R16F: 33325,
4619
- R32F: 33326,
4620
- RG16F: 33327,
4621
- RG32F: 33328,
4622
- R8I: 33329,
4623
- R8UI: 33330,
4624
- R16I: 33331,
4625
- R16UI: 33332,
4626
- R32I: 33333,
4627
- R32UI: 33334,
4628
- RG8I: 33335,
4629
- RG8UI: 33336,
4630
- RG16I: 33337,
4631
- RG16UI: 33338,
4632
- RG32I: 33339,
4633
- RG32UI: 33340,
4634
- R8_SNORM: 36756,
4635
- RG8_SNORM: 36757,
4636
- RGB8_SNORM: 36758,
4637
- RGBA8_SNORM: 36759,
4638
- RGB10_A2UI: 36975,
4639
- TEXTURE_IMMUTABLE_FORMAT: 37167,
4640
- TEXTURE_IMMUTABLE_LEVELS: 33503,
4641
- UNSIGNED_INT_2_10_10_10_REV: 33640,
4642
- UNSIGNED_INT_10F_11F_11F_REV: 35899,
4643
- UNSIGNED_INT_5_9_9_9_REV: 35902,
4644
- FLOAT_32_UNSIGNED_INT_24_8_REV: 36269,
4645
- UNSIGNED_INT_24_8: 34042,
4646
- HALF_FLOAT: 5131,
4647
- RG: 33319,
4648
- RG_INTEGER: 33320,
4649
- INT_2_10_10_10_REV: 36255,
4650
- CURRENT_QUERY: 34917,
4651
- QUERY_RESULT: 34918,
4652
- QUERY_RESULT_AVAILABLE: 34919,
4653
- ANY_SAMPLES_PASSED: 35887,
4654
- ANY_SAMPLES_PASSED_CONSERVATIVE: 36202,
4655
- MAX_DRAW_BUFFERS: 34852,
4656
- DRAW_BUFFER0: 34853,
4657
- DRAW_BUFFER1: 34854,
4658
- DRAW_BUFFER2: 34855,
4659
- DRAW_BUFFER3: 34856,
4660
- DRAW_BUFFER4: 34857,
4661
- DRAW_BUFFER5: 34858,
4662
- DRAW_BUFFER6: 34859,
4663
- DRAW_BUFFER7: 34860,
4664
- DRAW_BUFFER8: 34861,
4665
- DRAW_BUFFER9: 34862,
4666
- DRAW_BUFFER10: 34863,
4667
- DRAW_BUFFER11: 34864,
4668
- DRAW_BUFFER12: 34865,
4669
- DRAW_BUFFER13: 34866,
4670
- DRAW_BUFFER14: 34867,
4671
- DRAW_BUFFER15: 34868,
4672
- MAX_COLOR_ATTACHMENTS: 36063,
4673
- COLOR_ATTACHMENT1: 36065,
4674
- COLOR_ATTACHMENT2: 36066,
4675
- COLOR_ATTACHMENT3: 36067,
4676
- COLOR_ATTACHMENT4: 36068,
4677
- COLOR_ATTACHMENT5: 36069,
4678
- COLOR_ATTACHMENT6: 36070,
4679
- COLOR_ATTACHMENT7: 36071,
4680
- COLOR_ATTACHMENT8: 36072,
4681
- COLOR_ATTACHMENT9: 36073,
4682
- COLOR_ATTACHMENT10: 36074,
4683
- COLOR_ATTACHMENT11: 36075,
4684
- COLOR_ATTACHMENT12: 36076,
4685
- COLOR_ATTACHMENT13: 36077,
4686
- COLOR_ATTACHMENT14: 36078,
4687
- COLOR_ATTACHMENT15: 36079,
4688
- SAMPLER_3D: 35679,
4689
- SAMPLER_2D_SHADOW: 35682,
4690
- SAMPLER_2D_ARRAY: 36289,
4691
- SAMPLER_2D_ARRAY_SHADOW: 36292,
4692
- SAMPLER_CUBE_SHADOW: 36293,
4693
- INT_SAMPLER_2D: 36298,
4694
- INT_SAMPLER_3D: 36299,
4695
- INT_SAMPLER_CUBE: 36300,
4696
- INT_SAMPLER_2D_ARRAY: 36303,
4697
- UNSIGNED_INT_SAMPLER_2D: 36306,
4698
- UNSIGNED_INT_SAMPLER_3D: 36307,
4699
- UNSIGNED_INT_SAMPLER_CUBE: 36308,
4700
- UNSIGNED_INT_SAMPLER_2D_ARRAY: 36311,
4701
- MAX_SAMPLES: 36183,
4702
- SAMPLER_BINDING: 35097,
4703
- PIXEL_PACK_BUFFER: 35051,
4704
- PIXEL_UNPACK_BUFFER: 35052,
4705
- PIXEL_PACK_BUFFER_BINDING: 35053,
4706
- PIXEL_UNPACK_BUFFER_BINDING: 35055,
4707
- COPY_READ_BUFFER: 36662,
4708
- COPY_WRITE_BUFFER: 36663,
4709
- COPY_READ_BUFFER_BINDING: 36662,
4710
- COPY_WRITE_BUFFER_BINDING: 36663,
4711
- FLOAT_MAT2x3: 35685,
4712
- FLOAT_MAT2x4: 35686,
4713
- FLOAT_MAT3x2: 35687,
4714
- FLOAT_MAT3x4: 35688,
4715
- FLOAT_MAT4x2: 35689,
4716
- FLOAT_MAT4x3: 35690,
4717
- UNSIGNED_INT_VEC2: 36294,
4718
- UNSIGNED_INT_VEC3: 36295,
4719
- UNSIGNED_INT_VEC4: 36296,
4720
- UNSIGNED_NORMALIZED: 35863,
4721
- SIGNED_NORMALIZED: 36764,
4722
- VERTEX_ATTRIB_ARRAY_INTEGER: 35069,
4723
- VERTEX_ATTRIB_ARRAY_DIVISOR: 35070,
4724
- TRANSFORM_FEEDBACK_BUFFER_MODE: 35967,
4725
- MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968,
4726
- TRANSFORM_FEEDBACK_VARYINGS: 35971,
4727
- TRANSFORM_FEEDBACK_BUFFER_START: 35972,
4728
- TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973,
4729
- TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976,
4730
- MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978,
4731
- MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979,
4732
- INTERLEAVED_ATTRIBS: 35980,
4733
- SEPARATE_ATTRIBS: 35981,
4734
- TRANSFORM_FEEDBACK_BUFFER: 35982,
4735
- TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983,
4736
- TRANSFORM_FEEDBACK: 36386,
4737
- TRANSFORM_FEEDBACK_PAUSED: 36387,
4738
- TRANSFORM_FEEDBACK_ACTIVE: 36388,
4739
- TRANSFORM_FEEDBACK_BINDING: 36389,
4740
- FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296,
4741
- FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297,
4742
- FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298,
4743
- FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299,
4744
- FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300,
4745
- FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301,
4746
- FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302,
4747
- FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303,
4748
- FRAMEBUFFER_DEFAULT: 33304,
4749
- DEPTH24_STENCIL8: 35056,
4750
- DRAW_FRAMEBUFFER_BINDING: 36006,
4751
- READ_FRAMEBUFFER_BINDING: 36010,
4752
- RENDERBUFFER_SAMPLES: 36011,
4753
- FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052,
4754
- FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182,
4755
- UNIFORM_BUFFER: 35345,
4756
- UNIFORM_BUFFER_BINDING: 35368,
4757
- UNIFORM_BUFFER_START: 35369,
4758
- UNIFORM_BUFFER_SIZE: 35370,
4759
- MAX_VERTEX_UNIFORM_BLOCKS: 35371,
4760
- MAX_FRAGMENT_UNIFORM_BLOCKS: 35373,
4761
- MAX_COMBINED_UNIFORM_BLOCKS: 35374,
4762
- MAX_UNIFORM_BUFFER_BINDINGS: 35375,
4763
- MAX_UNIFORM_BLOCK_SIZE: 35376,
4764
- MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377,
4765
- MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379,
4766
- UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380,
4767
- ACTIVE_UNIFORM_BLOCKS: 35382,
4768
- UNIFORM_TYPE: 35383,
4769
- UNIFORM_SIZE: 35384,
4770
- UNIFORM_BLOCK_INDEX: 35386,
4771
- UNIFORM_OFFSET: 35387,
4772
- UNIFORM_ARRAY_STRIDE: 35388,
4773
- UNIFORM_MATRIX_STRIDE: 35389,
4774
- UNIFORM_IS_ROW_MAJOR: 35390,
4775
- UNIFORM_BLOCK_BINDING: 35391,
4776
- UNIFORM_BLOCK_DATA_SIZE: 35392,
4777
- UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394,
4778
- UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395,
4779
- UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396,
4780
- UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398,
4781
- OBJECT_TYPE: 37138,
4782
- SYNC_CONDITION: 37139,
4783
- SYNC_STATUS: 37140,
4784
- SYNC_FLAGS: 37141,
4785
- SYNC_FENCE: 37142,
4786
- SYNC_GPU_COMMANDS_COMPLETE: 37143,
4787
- UNSIGNALED: 37144,
4788
- SIGNALED: 37145,
4789
- ALREADY_SIGNALED: 37146,
4790
- TIMEOUT_EXPIRED: 37147,
4791
- CONDITION_SATISFIED: 37148,
4792
- WAIT_FAILED: 37149,
4793
- SYNC_FLUSH_COMMANDS_BIT: 1,
4794
- COLOR: 6144,
4795
- DEPTH: 6145,
4796
- STENCIL: 6146,
4797
- MIN: 32775,
4798
- MAX: 32776,
4799
- DEPTH_COMPONENT24: 33190,
4800
- STREAM_READ: 35041,
4801
- STREAM_COPY: 35042,
4802
- STATIC_READ: 35045,
4803
- STATIC_COPY: 35046,
4804
- DYNAMIC_READ: 35049,
4805
- DYNAMIC_COPY: 35050,
4806
- DEPTH_COMPONENT32F: 36012,
4807
- DEPTH32F_STENCIL8: 36013,
4808
- INVALID_INDEX: 4294967295,
4809
- TIMEOUT_IGNORED: -1,
4810
- MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 37447,
4811
- VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 35070,
4812
- UNMASKED_VENDOR_WEBGL: 37445,
4813
- UNMASKED_RENDERER_WEBGL: 37446,
4814
- MAX_TEXTURE_MAX_ANISOTROPY_EXT: 34047,
4815
- TEXTURE_MAX_ANISOTROPY_EXT: 34046,
4816
- COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
4817
- COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
4818
- COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
4819
- COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
4820
- COMPRESSED_R11_EAC: 37488,
4821
- COMPRESSED_SIGNED_R11_EAC: 37489,
4822
- COMPRESSED_RG11_EAC: 37490,
4823
- COMPRESSED_SIGNED_RG11_EAC: 37491,
4824
- COMPRESSED_RGB8_ETC2: 37492,
4825
- COMPRESSED_RGBA8_ETC2_EAC: 37493,
4826
- COMPRESSED_SRGB8_ETC2: 37494,
4827
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
4828
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
4829
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
4830
- COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
4831
- COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
4832
- COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
4833
- COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
4834
- COMPRESSED_RGB_ETC1_WEBGL: 36196,
4835
- COMPRESSED_RGB_ATC_WEBGL: 35986,
4836
- COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35986,
4837
- COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
4838
- UNSIGNED_INT_24_8_WEBGL: 34042,
4839
- HALF_FLOAT_OES: 36193,
4840
- RGBA32F_EXT: 34836,
4841
- RGB32F_EXT: 34837,
4842
- FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 33297,
4843
- UNSIGNED_NORMALIZED_EXT: 35863,
4844
- MIN_EXT: 32775,
4845
- MAX_EXT: 32776,
4846
- SRGB_EXT: 35904,
4847
- SRGB_ALPHA_EXT: 35906,
4848
- SRGB8_ALPHA8_EXT: 35907,
4849
- FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 33296,
4850
- FRAGMENT_SHADER_DERIVATIVE_HINT_OES: 35723,
4851
- COLOR_ATTACHMENT0_WEBGL: 36064,
4852
- COLOR_ATTACHMENT1_WEBGL: 36065,
4853
- COLOR_ATTACHMENT2_WEBGL: 36066,
4854
- COLOR_ATTACHMENT3_WEBGL: 36067,
4855
- COLOR_ATTACHMENT4_WEBGL: 36068,
4856
- COLOR_ATTACHMENT5_WEBGL: 36069,
4857
- COLOR_ATTACHMENT6_WEBGL: 36070,
4858
- COLOR_ATTACHMENT7_WEBGL: 36071,
4859
- COLOR_ATTACHMENT8_WEBGL: 36072,
4860
- COLOR_ATTACHMENT9_WEBGL: 36073,
4861
- COLOR_ATTACHMENT10_WEBGL: 36074,
4862
- COLOR_ATTACHMENT11_WEBGL: 36075,
4863
- COLOR_ATTACHMENT12_WEBGL: 36076,
4864
- COLOR_ATTACHMENT13_WEBGL: 36077,
4865
- COLOR_ATTACHMENT14_WEBGL: 36078,
4866
- COLOR_ATTACHMENT15_WEBGL: 36079,
4867
- DRAW_BUFFER0_WEBGL: 34853,
4868
- DRAW_BUFFER1_WEBGL: 34854,
4869
- DRAW_BUFFER2_WEBGL: 34855,
4870
- DRAW_BUFFER3_WEBGL: 34856,
4871
- DRAW_BUFFER4_WEBGL: 34857,
4872
- DRAW_BUFFER5_WEBGL: 34858,
4873
- DRAW_BUFFER6_WEBGL: 34859,
4874
- DRAW_BUFFER7_WEBGL: 34860,
4875
- DRAW_BUFFER8_WEBGL: 34861,
4876
- DRAW_BUFFER9_WEBGL: 34862,
4877
- DRAW_BUFFER10_WEBGL: 34863,
4878
- DRAW_BUFFER11_WEBGL: 34864,
4879
- DRAW_BUFFER12_WEBGL: 34865,
4880
- DRAW_BUFFER13_WEBGL: 34866,
4881
- DRAW_BUFFER14_WEBGL: 34867,
4882
- DRAW_BUFFER15_WEBGL: 34868,
4883
- MAX_COLOR_ATTACHMENTS_WEBGL: 36063,
4884
- MAX_DRAW_BUFFERS_WEBGL: 34852,
4885
- VERTEX_ARRAY_BINDING_OES: 34229,
4886
- QUERY_COUNTER_BITS_EXT: 34916,
4887
- CURRENT_QUERY_EXT: 34917,
4888
- QUERY_RESULT_EXT: 34918,
4889
- QUERY_RESULT_AVAILABLE_EXT: 34919,
4890
- TIME_ELAPSED_EXT: 35007,
4891
- TIMESTAMP_EXT: 36392,
4892
- GPU_DISJOINT_EXT: 36795
4296
+ DOUBLE: 5130
4297
+ };
4298
+ var GL = {
4299
+ ...GL_PRIMITIVE_MODE,
4300
+ ...GL_TYPE
4893
4301
  };
4894
4302
 
4895
- // src/lib/parsers/constants.ts
4896
- function getConstructorForDataFormat(dataType) {
4897
- switch (dataType) {
4898
- case "UInt8":
4899
- return Uint8Array;
4900
- case "UInt16":
4901
- return Uint16Array;
4902
- case "UInt32":
4903
- return Uint32Array;
4904
- case "Float32":
4905
- return Float32Array;
4906
- case "UInt64":
4907
- return Float64Array;
4908
- default:
4909
- throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);
4303
+ // ../loader-utils/src/loader-types.ts
4304
+ async function parseFromContext(data, loaders, options, context) {
4305
+ return context._parse(data, loaders, options, context);
4306
+ }
4307
+
4308
+ // ../loader-utils/src/lib/env-utils/assert.ts
4309
+ function assert(condition, message) {
4310
+ if (!condition) {
4311
+ throw new Error(message || "loader assertion failed.");
4910
4312
  }
4911
4313
  }
4912
- var GL_TYPE_MAP = {
4913
- UInt8: esm_default.UNSIGNED_BYTE,
4914
- UInt16: esm_default.UNSIGNED_SHORT,
4915
- Float32: esm_default.FLOAT,
4916
- UInt32: esm_default.UNSIGNED_INT,
4917
- UInt64: esm_default.DOUBLE
4314
+
4315
+ // ../loader-utils/src/lib/env-utils/globals.ts
4316
+ var globals = {
4317
+ self: typeof self !== "undefined" && self,
4318
+ window: typeof window !== "undefined" && window,
4319
+ global: typeof global !== "undefined" && global,
4320
+ document: typeof document !== "undefined" && document
4918
4321
  };
4919
- function sizeOf(dataType) {
4920
- switch (dataType) {
4921
- case "UInt8":
4922
- return 1;
4923
- case "UInt16":
4924
- case "Int16":
4925
- return 2;
4926
- case "UInt32":
4927
- case "Int32":
4928
- case "Float32":
4929
- return 4;
4930
- case "UInt64":
4931
- case "Int64":
4932
- case "Float64":
4933
- return 8;
4934
- default:
4935
- throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
4322
+ var self_ = globals.self || globals.window || globals.global || {};
4323
+ var window_ = globals.window || globals.self || globals.global || {};
4324
+ var global_ = globals.global || globals.self || globals.window || {};
4325
+ var document_ = globals.document || {};
4326
+ var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
4327
+ var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
4328
+ var nodeVersion = matches && parseFloat(matches[1]) || 0;
4329
+
4330
+ // ../worker-utils/src/lib/env-utils/version.ts
4331
+ var NPM_TAG = "beta";
4332
+ function getVersion() {
4333
+ if (!globalThis._loadersgl_?.version) {
4334
+ globalThis._loadersgl_ = globalThis._loadersgl_ || {};
4335
+ if (typeof __VERSION__ === "undefined") {
4336
+ console.warn("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
4337
+ globalThis._loadersgl_.version = NPM_TAG;
4338
+ } else {
4339
+ globalThis._loadersgl_.version = __VERSION__;
4340
+ }
4936
4341
  }
4342
+ return globalThis._loadersgl_.version;
4937
4343
  }
4938
- var STRING_ATTRIBUTE_TYPE = "String";
4939
- var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
4940
- var FLOAT_64_TYPE = "Float64";
4941
- var INT_16_ATTRIBUTE_TYPE = "Int16";
4942
- var COORDINATE_SYSTEM = function(COORDINATE_SYSTEM2) {
4943
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
4944
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT"] = 1] = "LNGLAT";
4945
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["METER_OFFSETS"] = 2] = "METER_OFFSETS";
4946
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT_OFFSETS"] = 3] = "LNGLAT_OFFSETS";
4947
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
4948
- return COORDINATE_SYSTEM2;
4949
- }({});
4950
-
4951
- // src/i3s-loader.ts
4952
- var import_core20 = __toESM(require_core(), 1);
4344
+ var VERSION = getVersion();
4953
4345
 
4954
- // src/lib/parsers/parse-i3s-tile-content.ts
4955
- var import_core7 = __toESM(require_core(), 1);
4346
+ // ../worker-utils/src/lib/env-utils/assert.ts
4347
+ function assert2(condition, message) {
4348
+ if (!condition) {
4349
+ throw new Error(message || "loaders.gl assertion failed.");
4350
+ }
4351
+ }
4956
4352
 
4957
- // ../../node_modules/@math.gl/core/dist/lib/common.js
4958
- var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
4959
- var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
4960
- var DEFAULT_CONFIG = {
4961
- EPSILON: 1e-12,
4962
- debug: false,
4963
- precision: 4,
4964
- printTypes: false,
4965
- printDegrees: false,
4966
- printRowMajor: true,
4967
- _cartographicRadians: false
4353
+ // ../worker-utils/src/lib/env-utils/globals.ts
4354
+ var globals2 = {
4355
+ self: typeof self !== "undefined" && self,
4356
+ window: typeof window !== "undefined" && window,
4357
+ global: typeof global !== "undefined" && global,
4358
+ document: typeof document !== "undefined" && document
4968
4359
  };
4969
- globalThis.mathgl = globalThis.mathgl || {
4970
- config: {
4971
- ...DEFAULT_CONFIG
4360
+ var self_2 = globals2.self || globals2.window || globals2.global || {};
4361
+ var window_2 = globals2.window || globals2.self || globals2.global || {};
4362
+ var global_2 = globals2.global || globals2.self || globals2.window || {};
4363
+ var document_2 = globals2.document || {};
4364
+ var isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
4365
+ var isWorker = typeof importScripts === "function";
4366
+ var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
4367
+ var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
4368
+ var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
4369
+
4370
+ // ../worker-utils/src/lib/library-utils/library-utils.ts
4371
+ var node = __toESM(require_require_utils(), 1);
4372
+ var loadLibraryPromises = {};
4373
+ async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
4374
+ if (moduleName) {
4375
+ libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
4972
4376
  }
4973
- };
4974
- var config = globalThis.mathgl.config;
4975
- function formatValue(value, {
4976
- precision = config.precision
4977
- } = {}) {
4978
- value = round(value);
4979
- return "".concat(parseFloat(value.toPrecision(precision)));
4980
- }
4981
- function isArray(value) {
4982
- return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
4983
- }
4984
- function toRadians(degrees2) {
4985
- return radians(degrees2);
4986
- }
4987
- function toDegrees(radians2) {
4988
- return degrees(radians2);
4989
- }
4990
- function radians(degrees2, result) {
4991
- return map(degrees2, (degrees3) => degrees3 * DEGREES_TO_RADIANS, result);
4377
+ loadLibraryPromises[libraryUrl] = loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
4378
+ return await loadLibraryPromises[libraryUrl];
4992
4379
  }
4993
- function degrees(radians2, result) {
4994
- return map(radians2, (radians3) => radians3 * RADIANS_TO_DEGREES, result);
4380
+ function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
4381
+ if (!options.useLocalLibraries && library.startsWith("http")) {
4382
+ return library;
4383
+ }
4384
+ libraryName = libraryName || library;
4385
+ const modules = options.modules || {};
4386
+ if (modules[libraryName]) {
4387
+ return modules[libraryName];
4388
+ }
4389
+ if (!isBrowser2) {
4390
+ return `modules/${moduleName}/dist/libs/${libraryName}`;
4391
+ }
4392
+ if (options.CDN) {
4393
+ assert2(options.CDN.startsWith("http"));
4394
+ return `${options.CDN}/${moduleName}@${VERSION}/dist/libs/${libraryName}`;
4395
+ }
4396
+ if (isWorker) {
4397
+ return `../src/libs/${libraryName}`;
4398
+ }
4399
+ return `modules/${moduleName}/src/libs/${libraryName}`;
4995
4400
  }
4996
- function equals(a2, b, epsilon) {
4997
- const oldEpsilon = config.EPSILON;
4998
- if (epsilon) {
4999
- config.EPSILON = epsilon;
4401
+ async function loadLibraryFromFile(libraryUrl) {
4402
+ if (libraryUrl.endsWith("wasm")) {
4403
+ return await loadAsArrayBuffer(libraryUrl);
5000
4404
  }
5001
- try {
5002
- if (a2 === b) {
5003
- return true;
5004
- }
5005
- if (isArray(a2) && isArray(b)) {
5006
- if (a2.length !== b.length) {
5007
- return false;
5008
- }
5009
- for (let i2 = 0; i2 < a2.length; ++i2) {
5010
- if (!equals(a2[i2], b[i2])) {
5011
- return false;
5012
- }
5013
- }
5014
- return true;
5015
- }
5016
- if (a2 && a2.equals) {
5017
- return a2.equals(b);
5018
- }
5019
- if (b && b.equals) {
5020
- return b.equals(a2);
5021
- }
5022
- if (typeof a2 === "number" && typeof b === "number") {
5023
- return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
4405
+ if (!isBrowser2) {
4406
+ try {
4407
+ return node && void 0 && await (void 0)(libraryUrl);
4408
+ } catch (error) {
4409
+ console.error(error);
4410
+ return null;
5024
4411
  }
5025
- return false;
5026
- } finally {
5027
- config.EPSILON = oldEpsilon;
5028
4412
  }
4413
+ if (isWorker) {
4414
+ return importScripts(libraryUrl);
4415
+ }
4416
+ const scriptSource = await loadAsText(libraryUrl);
4417
+ return loadLibraryFromString(scriptSource, libraryUrl);
5029
4418
  }
5030
- function round(value) {
5031
- return Math.round(value / config.EPSILON) * config.EPSILON;
5032
- }
5033
- function duplicateArray(array) {
5034
- return array.clone ? array.clone() : new Array(array.length);
5035
- }
5036
- function map(value, func, result) {
5037
- if (isArray(value)) {
5038
- const array = value;
5039
- result = result || duplicateArray(array);
5040
- for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
5041
- const val = typeof value === "number" ? value : value[i2];
5042
- result[i2] = func(val, i2, result);
5043
- }
5044
- return result;
4419
+ function loadLibraryFromString(scriptSource, id) {
4420
+ if (!isBrowser2) {
4421
+ return void 0 && (void 0)(scriptSource, id);
5045
4422
  }
5046
- return func(value);
4423
+ if (isWorker) {
4424
+ eval.call(globalThis, scriptSource);
4425
+ return null;
4426
+ }
4427
+ const script = document.createElement("script");
4428
+ script.id = id;
4429
+ try {
4430
+ script.appendChild(document.createTextNode(scriptSource));
4431
+ } catch (e2) {
4432
+ script.text = scriptSource;
4433
+ }
4434
+ document.body.appendChild(script);
4435
+ return null;
4436
+ }
4437
+ async function loadAsArrayBuffer(url) {
4438
+ if (!void 0 || url.startsWith("http")) {
4439
+ const response = await fetch(url);
4440
+ return await response.arrayBuffer();
4441
+ }
4442
+ return await (void 0)(url);
4443
+ }
4444
+ async function loadAsText(url) {
4445
+ if (!void 0 || url.startsWith("http")) {
4446
+ const response = await fetch(url);
4447
+ return await response.text();
4448
+ }
4449
+ return await (void 0)(url);
5047
4450
  }
5048
4451
 
5049
- // ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
5050
- function _extendableBuiltin(cls) {
5051
- function ExtendableBuiltin() {
5052
- var instance = Reflect.construct(cls, Array.from(arguments));
5053
- Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
5054
- return instance;
4452
+ // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
4453
+ function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
4454
+ byteLength = byteLength || arrayBuffer1.byteLength;
4455
+ if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
4456
+ return false;
5055
4457
  }
5056
- ExtendableBuiltin.prototype = Object.create(cls.prototype, {
5057
- constructor: {
5058
- value: cls,
5059
- enumerable: false,
5060
- writable: true,
5061
- configurable: true
4458
+ const array1 = new Uint8Array(arrayBuffer1);
4459
+ const array2 = new Uint8Array(arrayBuffer2);
4460
+ for (let i2 = 0; i2 < array1.length; ++i2) {
4461
+ if (array1[i2] !== array2[i2]) {
4462
+ return false;
5062
4463
  }
5063
- });
5064
- if (Object.setPrototypeOf) {
5065
- Object.setPrototypeOf(ExtendableBuiltin, cls);
5066
- } else {
5067
- ExtendableBuiltin.__proto__ = cls;
5068
4464
  }
5069
- return ExtendableBuiltin;
4465
+ return true;
5070
4466
  }
5071
- var MathArray = class extends _extendableBuiltin(Array) {
5072
- clone() {
5073
- return new this.constructor().copy(this);
4467
+ function concatenateArrayBuffers(...sources) {
4468
+ const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
4469
+ const byteLength = sourceArrays.reduce((length4, typedArray) => length4 + typedArray.byteLength, 0);
4470
+ const result = new Uint8Array(byteLength);
4471
+ let offset = 0;
4472
+ for (const sourceArray of sourceArrays) {
4473
+ result.set(sourceArray, offset);
4474
+ offset += sourceArray.byteLength;
5074
4475
  }
5075
- fromArray(array, offset = 0) {
5076
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5077
- this[i2] = array[i2 + offset];
5078
- }
5079
- return this.check();
4476
+ return result.buffer;
4477
+ }
4478
+
4479
+ // ../loader-utils/src/lib/iterators/async-iteration.ts
4480
+ async function concatenateArrayBuffersAsync(asyncIterator) {
4481
+ const arrayBuffers = [];
4482
+ for await (const chunk of asyncIterator) {
4483
+ arrayBuffers.push(chunk);
5080
4484
  }
5081
- toArray(targetArray = [], offset = 0) {
5082
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5083
- targetArray[offset + i2] = this[i2];
5084
- }
5085
- return targetArray;
4485
+ return concatenateArrayBuffers(...arrayBuffers);
4486
+ }
4487
+
4488
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
4489
+ function _typeof(obj) {
4490
+ "@babel/helpers - typeof";
4491
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
4492
+ return typeof obj2;
4493
+ } : function(obj2) {
4494
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
4495
+ }, _typeof(obj);
4496
+ }
4497
+
4498
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
4499
+ function _toPrimitive(input, hint) {
4500
+ if (_typeof(input) !== "object" || input === null)
4501
+ return input;
4502
+ var prim = input[Symbol.toPrimitive];
4503
+ if (prim !== void 0) {
4504
+ var res = prim.call(input, hint || "default");
4505
+ if (_typeof(res) !== "object")
4506
+ return res;
4507
+ throw new TypeError("@@toPrimitive must return a primitive value.");
5086
4508
  }
5087
- toObject(targetObject) {
5088
- return targetObject;
4509
+ return (hint === "string" ? String : Number)(input);
4510
+ }
4511
+
4512
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
4513
+ function _toPropertyKey(arg) {
4514
+ var key = _toPrimitive(arg, "string");
4515
+ return _typeof(key) === "symbol" ? key : String(key);
4516
+ }
4517
+
4518
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
4519
+ function _defineProperty(obj, key, value) {
4520
+ key = _toPropertyKey(key);
4521
+ if (key in obj) {
4522
+ Object.defineProperty(obj, key, {
4523
+ value,
4524
+ enumerable: true,
4525
+ configurable: true,
4526
+ writable: true
4527
+ });
4528
+ } else {
4529
+ obj[key] = value;
5089
4530
  }
5090
- from(arrayOrObject) {
5091
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
4531
+ return obj;
4532
+ }
4533
+
4534
+ // ../loader-utils/src/lib/node/buffer.browser.ts
4535
+ function toArrayBuffer(buffer) {
4536
+ return buffer;
4537
+ }
4538
+
4539
+ // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
4540
+ function isBuffer(value) {
4541
+ return value && typeof value === "object" && value.isBuffer;
4542
+ }
4543
+ function toArrayBuffer2(data) {
4544
+ if (isBuffer(data)) {
4545
+ return toArrayBuffer(data);
5092
4546
  }
5093
- to(arrayOrObject) {
5094
- if (arrayOrObject === this) {
5095
- return this;
4547
+ if (data instanceof ArrayBuffer) {
4548
+ return data;
4549
+ }
4550
+ if (ArrayBuffer.isView(data)) {
4551
+ if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
4552
+ return data.buffer;
5096
4553
  }
5097
- return isArray(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
4554
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
5098
4555
  }
5099
- toTarget(target) {
5100
- return target ? this.to(target) : this;
4556
+ if (typeof data === "string") {
4557
+ const text = data;
4558
+ const uint8Array = new TextEncoder().encode(text);
4559
+ return uint8Array.buffer;
5101
4560
  }
5102
- toFloat32Array() {
5103
- return new Float32Array(this);
4561
+ if (data && typeof data === "object" && data._toArrayBuffer) {
4562
+ return data._toArrayBuffer();
5104
4563
  }
5105
- toString() {
5106
- return this.formatString(config);
4564
+ throw new Error("toArrayBuffer");
4565
+ }
4566
+
4567
+ // ../loader-utils/src/lib/node/promisify.ts
4568
+ function promisify1(fn) {
4569
+ return (args) => new Promise((resolve, reject) => fn(args, (error, callbackArgs) => error ? reject(error) : resolve(callbackArgs)));
4570
+ }
4571
+
4572
+ // ../loader-utils/src/lib/file-provider/data-view-file.ts
4573
+ var toNumber = (bigint) => {
4574
+ if (bigint > Number.MAX_SAFE_INTEGER) {
4575
+ throw new Error("Offset is out of bounds");
5107
4576
  }
5108
- formatString(opts) {
5109
- let string = "";
5110
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5111
- string += (i2 > 0 ? ", " : "") + formatValue(this[i2], opts);
5112
- }
5113
- return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
4577
+ return Number(bigint);
4578
+ };
4579
+ var DataViewFile = class {
4580
+ constructor(file) {
4581
+ this.file = file;
5114
4582
  }
5115
- equals(array) {
5116
- if (!array || this.length !== array.length) {
5117
- return false;
5118
- }
5119
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5120
- if (!equals(this[i2], array[i2])) {
5121
- return false;
5122
- }
5123
- }
5124
- return true;
4583
+ async destroy() {
5125
4584
  }
5126
- exactEquals(array) {
5127
- if (!array || this.length !== array.length) {
5128
- return false;
5129
- }
5130
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5131
- if (this[i2] !== array[i2]) {
5132
- return false;
5133
- }
5134
- }
5135
- return true;
4585
+ async getUint8(offset) {
4586
+ return this.file.getUint8(toNumber(offset));
5136
4587
  }
5137
- negate() {
5138
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5139
- this[i2] = -this[i2];
5140
- }
5141
- return this.check();
4588
+ async getUint16(offset) {
4589
+ return this.file.getUint16(toNumber(offset), true);
5142
4590
  }
5143
- lerp(a2, b, t2) {
5144
- if (t2 === void 0) {
5145
- return this.lerp(this, a2, b);
5146
- }
5147
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5148
- const ai = a2[i2];
5149
- const endValue = typeof b === "number" ? b : b[i2];
5150
- this[i2] = ai + t2 * (endValue - ai);
5151
- }
5152
- return this.check();
4591
+ async getUint32(offset) {
4592
+ return this.file.getUint32(toNumber(offset), true);
5153
4593
  }
5154
- min(vector) {
5155
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
5156
- this[i2] = Math.min(vector[i2], this[i2]);
5157
- }
5158
- return this.check();
4594
+ async getBigUint64(offset) {
4595
+ return this.file.getBigUint64(toNumber(offset), true);
4596
+ }
4597
+ async slice(startOffset, endOffset) {
4598
+ return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));
4599
+ }
4600
+ get length() {
4601
+ return BigInt(this.file.byteLength);
4602
+ }
4603
+ };
4604
+
4605
+ // ../../node_modules/@math.gl/core/dist/lib/common.js
4606
+ var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
4607
+ var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
4608
+ var DEFAULT_CONFIG = {
4609
+ EPSILON: 1e-12,
4610
+ debug: false,
4611
+ precision: 4,
4612
+ printTypes: false,
4613
+ printDegrees: false,
4614
+ printRowMajor: true,
4615
+ _cartographicRadians: false
4616
+ };
4617
+ globalThis.mathgl = globalThis.mathgl || {
4618
+ config: {
4619
+ ...DEFAULT_CONFIG
4620
+ }
4621
+ };
4622
+ var config = globalThis.mathgl.config;
4623
+ function formatValue(value, {
4624
+ precision = config.precision
4625
+ } = {}) {
4626
+ value = round(value);
4627
+ return "".concat(parseFloat(value.toPrecision(precision)));
4628
+ }
4629
+ function isArray(value) {
4630
+ return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
4631
+ }
4632
+ function toRadians(degrees2) {
4633
+ return radians(degrees2);
4634
+ }
4635
+ function toDegrees(radians2) {
4636
+ return degrees(radians2);
4637
+ }
4638
+ function radians(degrees2, result) {
4639
+ return map(degrees2, (degrees3) => degrees3 * DEGREES_TO_RADIANS, result);
4640
+ }
4641
+ function degrees(radians2, result) {
4642
+ return map(radians2, (radians3) => radians3 * RADIANS_TO_DEGREES, result);
4643
+ }
4644
+ function equals(a2, b, epsilon) {
4645
+ const oldEpsilon = config.EPSILON;
4646
+ if (epsilon) {
4647
+ config.EPSILON = epsilon;
4648
+ }
4649
+ try {
4650
+ if (a2 === b) {
4651
+ return true;
4652
+ }
4653
+ if (isArray(a2) && isArray(b)) {
4654
+ if (a2.length !== b.length) {
4655
+ return false;
4656
+ }
4657
+ for (let i2 = 0; i2 < a2.length; ++i2) {
4658
+ if (!equals(a2[i2], b[i2])) {
4659
+ return false;
4660
+ }
4661
+ }
4662
+ return true;
4663
+ }
4664
+ if (a2 && a2.equals) {
4665
+ return a2.equals(b);
4666
+ }
4667
+ if (b && b.equals) {
4668
+ return b.equals(a2);
4669
+ }
4670
+ if (typeof a2 === "number" && typeof b === "number") {
4671
+ return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
4672
+ }
4673
+ return false;
4674
+ } finally {
4675
+ config.EPSILON = oldEpsilon;
4676
+ }
4677
+ }
4678
+ function round(value) {
4679
+ return Math.round(value / config.EPSILON) * config.EPSILON;
4680
+ }
4681
+ function duplicateArray(array) {
4682
+ return array.clone ? array.clone() : new Array(array.length);
4683
+ }
4684
+ function map(value, func, result) {
4685
+ if (isArray(value)) {
4686
+ const array = value;
4687
+ result = result || duplicateArray(array);
4688
+ for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
4689
+ const val = typeof value === "number" ? value : value[i2];
4690
+ result[i2] = func(val, i2, result);
4691
+ }
4692
+ return result;
4693
+ }
4694
+ return func(value);
4695
+ }
4696
+
4697
+ // ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
4698
+ function _extendableBuiltin(cls) {
4699
+ function ExtendableBuiltin() {
4700
+ var instance = Reflect.construct(cls, Array.from(arguments));
4701
+ Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
4702
+ return instance;
4703
+ }
4704
+ ExtendableBuiltin.prototype = Object.create(cls.prototype, {
4705
+ constructor: {
4706
+ value: cls,
4707
+ enumerable: false,
4708
+ writable: true,
4709
+ configurable: true
4710
+ }
4711
+ });
4712
+ if (Object.setPrototypeOf) {
4713
+ Object.setPrototypeOf(ExtendableBuiltin, cls);
4714
+ } else {
4715
+ ExtendableBuiltin.__proto__ = cls;
4716
+ }
4717
+ return ExtendableBuiltin;
4718
+ }
4719
+ var MathArray = class extends _extendableBuiltin(Array) {
4720
+ clone() {
4721
+ return new this.constructor().copy(this);
4722
+ }
4723
+ fromArray(array, offset = 0) {
4724
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4725
+ this[i2] = array[i2 + offset];
4726
+ }
4727
+ return this.check();
4728
+ }
4729
+ toArray(targetArray = [], offset = 0) {
4730
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4731
+ targetArray[offset + i2] = this[i2];
4732
+ }
4733
+ return targetArray;
4734
+ }
4735
+ toObject(targetObject) {
4736
+ return targetObject;
4737
+ }
4738
+ from(arrayOrObject) {
4739
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
4740
+ }
4741
+ to(arrayOrObject) {
4742
+ if (arrayOrObject === this) {
4743
+ return this;
4744
+ }
4745
+ return isArray(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
4746
+ }
4747
+ toTarget(target) {
4748
+ return target ? this.to(target) : this;
4749
+ }
4750
+ toFloat32Array() {
4751
+ return new Float32Array(this);
4752
+ }
4753
+ toString() {
4754
+ return this.formatString(config);
4755
+ }
4756
+ formatString(opts) {
4757
+ let string = "";
4758
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4759
+ string += (i2 > 0 ? ", " : "") + formatValue(this[i2], opts);
4760
+ }
4761
+ return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
4762
+ }
4763
+ equals(array) {
4764
+ if (!array || this.length !== array.length) {
4765
+ return false;
4766
+ }
4767
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4768
+ if (!equals(this[i2], array[i2])) {
4769
+ return false;
4770
+ }
4771
+ }
4772
+ return true;
4773
+ }
4774
+ exactEquals(array) {
4775
+ if (!array || this.length !== array.length) {
4776
+ return false;
4777
+ }
4778
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4779
+ if (this[i2] !== array[i2]) {
4780
+ return false;
4781
+ }
4782
+ }
4783
+ return true;
4784
+ }
4785
+ negate() {
4786
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4787
+ this[i2] = -this[i2];
4788
+ }
4789
+ return this.check();
4790
+ }
4791
+ lerp(a2, b, t2) {
4792
+ if (t2 === void 0) {
4793
+ return this.lerp(this, a2, b);
4794
+ }
4795
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4796
+ const ai = a2[i2];
4797
+ const endValue = typeof b === "number" ? b : b[i2];
4798
+ this[i2] = ai + t2 * (endValue - ai);
4799
+ }
4800
+ return this.check();
4801
+ }
4802
+ min(vector) {
4803
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
4804
+ this[i2] = Math.min(vector[i2], this[i2]);
4805
+ }
4806
+ return this.check();
5159
4807
  }
5160
4808
  max(vector) {
5161
4809
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
@@ -5280,7 +4928,7 @@ var __exports__ = (() => {
5280
4928
  }
5281
4929
 
5282
4930
  // ../../node_modules/@math.gl/core/dist/lib/assert.js
5283
- function assert(condition, message) {
4931
+ function assert3(condition, message) {
5284
4932
  if (!condition) {
5285
4933
  throw new Error("math.gl assertion ".concat(message));
5286
4934
  }
@@ -5369,11 +5017,11 @@ var __exports__ = (() => {
5369
5017
  return this.distanceSquared(vector);
5370
5018
  }
5371
5019
  getComponent(i2) {
5372
- assert(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
5020
+ assert3(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
5373
5021
  return checkNumber(this[i2]);
5374
5022
  }
5375
5023
  setComponent(i2, value) {
5376
- assert(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
5024
+ assert3(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
5377
5025
  this[i2] = value;
5378
5026
  return this.check();
5379
5027
  }
@@ -5425,7 +5073,7 @@ var __exports__ = (() => {
5425
5073
  out[1] = m[1] * x + m[5] * y + m[13];
5426
5074
  return out;
5427
5075
  }
5428
- var forEach = function() {
5076
+ var forEach2 = function() {
5429
5077
  const vec = create();
5430
5078
  return function(a2, stride, offset, count, fn, arg) {
5431
5079
  let i2;
@@ -5518,7 +5166,7 @@ var __exports__ = (() => {
5518
5166
  equals: () => equals2,
5519
5167
  exactEquals: () => exactEquals,
5520
5168
  floor: () => floor,
5521
- forEach: () => forEach2,
5169
+ forEach: () => forEach3,
5522
5170
  fromValues: () => fromValues,
5523
5171
  hermite: () => hermite,
5524
5172
  inverse: () => inverse,
@@ -5897,7 +5545,7 @@ var __exports__ = (() => {
5897
5545
  var sqrDist = squaredDistance;
5898
5546
  var len = length;
5899
5547
  var sqrLen = squaredLength;
5900
- var forEach2 = function() {
5548
+ var forEach3 = function() {
5901
5549
  const vec = create2();
5902
5550
  return function(a2, stride, offset, count, fn, arg) {
5903
5551
  let i2;
@@ -8121,7 +7769,7 @@ var __exports__ = (() => {
8121
7769
  out[3] = a2[3];
8122
7770
  return out;
8123
7771
  }
8124
- var forEach3 = function() {
7772
+ var forEach4 = function() {
8125
7773
  const vec = create5();
8126
7774
  return function(a2, stride, offset, count, fn, arg) {
8127
7775
  let i2;
@@ -8990,52 +8638,6 @@ var __exports__ = (() => {
8990
8638
  }
8991
8639
  };
8992
8640
 
8993
- // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
8994
- function _typeof(obj) {
8995
- "@babel/helpers - typeof";
8996
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
8997
- return typeof obj2;
8998
- } : function(obj2) {
8999
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
9000
- }, _typeof(obj);
9001
- }
9002
-
9003
- // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
9004
- function _toPrimitive(input, hint) {
9005
- if (_typeof(input) !== "object" || input === null)
9006
- return input;
9007
- var prim = input[Symbol.toPrimitive];
9008
- if (prim !== void 0) {
9009
- var res = prim.call(input, hint || "default");
9010
- if (_typeof(res) !== "object")
9011
- return res;
9012
- throw new TypeError("@@toPrimitive must return a primitive value.");
9013
- }
9014
- return (hint === "string" ? String : Number)(input);
9015
- }
9016
-
9017
- // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
9018
- function _toPropertyKey(arg) {
9019
- var key = _toPrimitive(arg, "string");
9020
- return _typeof(key) === "symbol" ? key : String(key);
9021
- }
9022
-
9023
- // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
9024
- function _defineProperty(obj, key, value) {
9025
- key = _toPropertyKey(key);
9026
- if (key in obj) {
9027
- Object.defineProperty(obj, key, {
9028
- value,
9029
- enumerable: true,
9030
- configurable: true,
9031
- writable: true
9032
- });
9033
- } else {
9034
- obj[key] = value;
9035
- }
9036
- return obj;
9037
- }
9038
-
9039
8641
  // ../../node_modules/@math.gl/core/dist/lib/math-utils.js
9040
8642
  var math_utils_exports = {};
9041
8643
  __export(math_utils_exports, {
@@ -9089,6 +8691,68 @@ var __exports__ = (() => {
9089
8691
  var PI_OVER_SIX = Math.PI / 6;
9090
8692
  var TWO_PI = Math.PI * 2;
9091
8693
 
8694
+ // src/lib/parsers/constants.ts
8695
+ function getConstructorForDataFormat(dataType) {
8696
+ switch (dataType) {
8697
+ case "UInt8":
8698
+ return Uint8Array;
8699
+ case "UInt16":
8700
+ return Uint16Array;
8701
+ case "UInt32":
8702
+ return Uint32Array;
8703
+ case "Float32":
8704
+ return Float32Array;
8705
+ case "UInt64":
8706
+ return Float64Array;
8707
+ default:
8708
+ throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);
8709
+ }
8710
+ }
8711
+ var GL_TYPE_MAP = {
8712
+ UInt8: GL.UNSIGNED_BYTE,
8713
+ UInt16: GL.UNSIGNED_SHORT,
8714
+ Float32: GL.FLOAT,
8715
+ UInt32: GL.UNSIGNED_INT,
8716
+ UInt64: GL.DOUBLE
8717
+ };
8718
+ function sizeOf(dataType) {
8719
+ switch (dataType) {
8720
+ case "UInt8":
8721
+ return 1;
8722
+ case "UInt16":
8723
+ case "Int16":
8724
+ return 2;
8725
+ case "UInt32":
8726
+ case "Int32":
8727
+ case "Float32":
8728
+ return 4;
8729
+ case "UInt64":
8730
+ case "Int64":
8731
+ case "Float64":
8732
+ return 8;
8733
+ default:
8734
+ throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
8735
+ }
8736
+ }
8737
+ var STRING_ATTRIBUTE_TYPE = "String";
8738
+ var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
8739
+ var FLOAT_64_TYPE = "Float64";
8740
+ var INT_16_ATTRIBUTE_TYPE = "Int16";
8741
+ var COORDINATE_SYSTEM = function(COORDINATE_SYSTEM2) {
8742
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
8743
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT"] = 1] = "LNGLAT";
8744
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["METER_OFFSETS"] = 2] = "METER_OFFSETS";
8745
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT_OFFSETS"] = 3] = "LNGLAT_OFFSETS";
8746
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
8747
+ return COORDINATE_SYSTEM2;
8748
+ }({});
8749
+
8750
+ // src/i3s-loader.ts
8751
+ var import_core18 = __toESM(require_core(), 1);
8752
+
8753
+ // src/lib/parsers/parse-i3s-tile-content.ts
8754
+ var import_core5 = __toESM(require_core(), 1);
8755
+
9092
8756
  // ../../node_modules/@math.gl/geospatial/dist/constants.js
9093
8757
  var WGS84_RADIUS_X = 6378137;
9094
8758
  var WGS84_RADIUS_Y = 6378137;
@@ -9208,7 +8872,7 @@ var __exports__ = (() => {
9208
8872
  var scratchVector3 = new Vector3();
9209
8873
  function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
9210
8874
  const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
9211
- assert(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
8875
+ assert3(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
9212
8876
  let firstAxisVector;
9213
8877
  let secondAxisVector;
9214
8878
  let thirdAxisVector;
@@ -9346,9 +9010,9 @@ var __exports__ = (() => {
9346
9010
  _defineProperty(this, "maximumRadius", void 0);
9347
9011
  _defineProperty(this, "centerToleranceSquared", math_utils_exports.EPSILON1);
9348
9012
  _defineProperty(this, "squaredXOverSquaredZ", void 0);
9349
- assert(x >= 0);
9350
- assert(y >= 0);
9351
- assert(z >= 0);
9013
+ assert3(x >= 0);
9014
+ assert3(y >= 0);
9015
+ assert3(z >= 0);
9352
9016
  this.radii = new Vector3(x, y, z);
9353
9017
  this.radiiSquared = new Vector3(x * x, y * y, z * z);
9354
9018
  this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);
@@ -9425,280 +9089,24 @@ var __exports__ = (() => {
9425
9089
  const beta = 1 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
9426
9090
  return scratchPosition.multiplyScalar(beta).to(result);
9427
9091
  }
9428
- transformPositionToScaledSpace(position, result = [0, 0, 0]) {
9429
- return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
9430
- }
9431
- transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
9432
- return scratchPosition.from(position).scale(this.radii).to(result);
9433
- }
9434
- getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
9435
- assert(equals(this.radii.x, this.radii.y, math_utils_exports.EPSILON15));
9436
- assert(this.radii.z > 0);
9437
- scratchPosition.from(position);
9438
- const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
9439
- if (Math.abs(z) >= this.radii.z - buffer) {
9440
- return void 0;
9441
- }
9442
- return scratchPosition.set(0, 0, z).to(result);
9443
- }
9444
- };
9445
- _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
9446
-
9447
- // ../loader-utils/src/loader-types.ts
9448
- async function parseFromContext(data, loaders, options, context) {
9449
- return context._parse(data, loaders, options, context);
9450
- }
9451
-
9452
- // ../loader-utils/src/lib/env-utils/assert.ts
9453
- function assert2(condition, message) {
9454
- if (!condition) {
9455
- throw new Error(message || "loader assertion failed.");
9456
- }
9457
- }
9458
-
9459
- // ../loader-utils/src/lib/env-utils/globals.ts
9460
- var globals = {
9461
- self: typeof self !== "undefined" && self,
9462
- window: typeof window !== "undefined" && window,
9463
- global: typeof global !== "undefined" && global,
9464
- document: typeof document !== "undefined" && document
9465
- };
9466
- var self_ = globals.self || globals.window || globals.global || {};
9467
- var window_ = globals.window || globals.self || globals.global || {};
9468
- var global_ = globals.global || globals.self || globals.window || {};
9469
- var document_ = globals.document || {};
9470
- var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
9471
- var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
9472
- var nodeVersion = matches && parseFloat(matches[1]) || 0;
9473
-
9474
- // ../worker-utils/src/lib/env-utils/version.ts
9475
- var NPM_TAG = "beta";
9476
- function getVersion() {
9477
- if (!globalThis._loadersgl_?.version) {
9478
- globalThis._loadersgl_ = globalThis._loadersgl_ || {};
9479
- if (typeof __VERSION__ === "undefined") {
9480
- console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
9481
- globalThis._loadersgl_.version = NPM_TAG;
9482
- } else {
9483
- globalThis._loadersgl_.version = __VERSION__;
9484
- }
9485
- }
9486
- return globalThis._loadersgl_.version;
9487
- }
9488
- var VERSION = getVersion();
9489
-
9490
- // ../worker-utils/src/lib/env-utils/assert.ts
9491
- function assert3(condition, message) {
9492
- if (!condition) {
9493
- throw new Error(message || "loaders.gl assertion failed.");
9494
- }
9495
- }
9496
-
9497
- // ../worker-utils/src/lib/env-utils/globals.ts
9498
- var globals2 = {
9499
- self: typeof self !== "undefined" && self,
9500
- window: typeof window !== "undefined" && window,
9501
- global: typeof global !== "undefined" && global,
9502
- document: typeof document !== "undefined" && document
9503
- };
9504
- var self_2 = globals2.self || globals2.window || globals2.global || {};
9505
- var window_2 = globals2.window || globals2.self || globals2.global || {};
9506
- var global_2 = globals2.global || globals2.self || globals2.window || {};
9507
- var document_2 = globals2.document || {};
9508
- var isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
9509
- var isWorker = typeof importScripts === "function";
9510
- var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
9511
- var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
9512
- var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
9513
-
9514
- // ../worker-utils/src/lib/library-utils/library-utils.ts
9515
- var node = __toESM(require_require_utils(), 1);
9516
- var loadLibraryPromises = {};
9517
- async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
9518
- if (moduleName) {
9519
- libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
9520
- }
9521
- loadLibraryPromises[libraryUrl] = loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
9522
- return await loadLibraryPromises[libraryUrl];
9523
- }
9524
- function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
9525
- if (!options.useLocalLibraries && library.startsWith("http")) {
9526
- return library;
9527
- }
9528
- libraryName = libraryName || library;
9529
- const modules = options.modules || {};
9530
- if (modules[libraryName]) {
9531
- return modules[libraryName];
9532
- }
9533
- if (!isBrowser2) {
9534
- return `modules/${moduleName}/dist/libs/${libraryName}`;
9535
- }
9536
- if (options.CDN) {
9537
- assert3(options.CDN.startsWith("http"));
9538
- return `${options.CDN}/${moduleName}@${VERSION}/dist/libs/${libraryName}`;
9539
- }
9540
- if (isWorker) {
9541
- return `../src/libs/${libraryName}`;
9542
- }
9543
- return `modules/${moduleName}/src/libs/${libraryName}`;
9544
- }
9545
- async function loadLibraryFromFile(libraryUrl) {
9546
- if (libraryUrl.endsWith("wasm")) {
9547
- return await loadAsArrayBuffer(libraryUrl);
9548
- }
9549
- if (!isBrowser2) {
9550
- try {
9551
- return node && void 0 && await (void 0)(libraryUrl);
9552
- } catch (error) {
9553
- console.error(error);
9554
- return null;
9555
- }
9556
- }
9557
- if (isWorker) {
9558
- return importScripts(libraryUrl);
9559
- }
9560
- const scriptSource = await loadAsText(libraryUrl);
9561
- return loadLibraryFromString(scriptSource, libraryUrl);
9562
- }
9563
- function loadLibraryFromString(scriptSource, id) {
9564
- if (!isBrowser2) {
9565
- return void 0 && (void 0)(scriptSource, id);
9566
- }
9567
- if (isWorker) {
9568
- eval.call(globalThis, scriptSource);
9569
- return null;
9570
- }
9571
- const script = document.createElement("script");
9572
- script.id = id;
9573
- try {
9574
- script.appendChild(document.createTextNode(scriptSource));
9575
- } catch (e2) {
9576
- script.text = scriptSource;
9577
- }
9578
- document.body.appendChild(script);
9579
- return null;
9580
- }
9581
- async function loadAsArrayBuffer(url) {
9582
- if (!void 0 || url.startsWith("http")) {
9583
- const response = await fetch(url);
9584
- return await response.arrayBuffer();
9585
- }
9586
- return await (void 0)(url);
9587
- }
9588
- async function loadAsText(url) {
9589
- if (!void 0 || url.startsWith("http")) {
9590
- const response = await fetch(url);
9591
- return await response.text();
9592
- }
9593
- return await (void 0)(url);
9594
- }
9595
-
9596
- // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
9597
- function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
9598
- byteLength = byteLength || arrayBuffer1.byteLength;
9599
- if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
9600
- return false;
9601
- }
9602
- const array1 = new Uint8Array(arrayBuffer1);
9603
- const array2 = new Uint8Array(arrayBuffer2);
9604
- for (let i2 = 0; i2 < array1.length; ++i2) {
9605
- if (array1[i2] !== array2[i2]) {
9606
- return false;
9607
- }
9608
- }
9609
- return true;
9610
- }
9611
- function concatenateArrayBuffers(...sources) {
9612
- const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
9613
- const byteLength = sourceArrays.reduce((length4, typedArray) => length4 + typedArray.byteLength, 0);
9614
- const result = new Uint8Array(byteLength);
9615
- let offset = 0;
9616
- for (const sourceArray of sourceArrays) {
9617
- result.set(sourceArray, offset);
9618
- offset += sourceArray.byteLength;
9619
- }
9620
- return result.buffer;
9621
- }
9622
-
9623
- // ../loader-utils/src/lib/iterators/async-iteration.ts
9624
- async function concatenateArrayBuffersAsync(asyncIterator) {
9625
- const arrayBuffers = [];
9626
- for await (const chunk of asyncIterator) {
9627
- arrayBuffers.push(chunk);
9628
- }
9629
- return concatenateArrayBuffers(...arrayBuffers);
9630
- }
9631
-
9632
- // ../loader-utils/src/lib/node/buffer.browser.ts
9633
- function toArrayBuffer(buffer) {
9634
- return buffer;
9635
- }
9636
-
9637
- // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
9638
- function isBuffer(value) {
9639
- return value && typeof value === "object" && value.isBuffer;
9640
- }
9641
- function toArrayBuffer2(data) {
9642
- if (isBuffer(data)) {
9643
- return toArrayBuffer(data);
9644
- }
9645
- if (data instanceof ArrayBuffer) {
9646
- return data;
9647
- }
9648
- if (ArrayBuffer.isView(data)) {
9649
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
9650
- return data.buffer;
9651
- }
9652
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
9653
- }
9654
- if (typeof data === "string") {
9655
- const text = data;
9656
- const uint8Array = new TextEncoder().encode(text);
9657
- return uint8Array.buffer;
9658
- }
9659
- if (data && typeof data === "object" && data._toArrayBuffer) {
9660
- return data._toArrayBuffer();
9661
- }
9662
- throw new Error("toArrayBuffer");
9663
- }
9664
-
9665
- // ../loader-utils/src/lib/node/promisify.ts
9666
- function promisify1(fn) {
9667
- return (args) => new Promise((resolve, reject) => fn(args, (error, callbackArgs) => error ? reject(error) : resolve(callbackArgs)));
9668
- }
9669
-
9670
- // ../loader-utils/src/lib/file-provider/data-view-file.ts
9671
- var toNumber = (bigint) => {
9672
- if (bigint > Number.MAX_SAFE_INTEGER) {
9673
- throw new Error("Offset is out of bounds");
9674
- }
9675
- return Number(bigint);
9676
- };
9677
- var DataViewFile = class {
9678
- constructor(file) {
9679
- this.file = file;
9680
- }
9681
- async destroy() {
9682
- }
9683
- async getUint8(offset) {
9684
- return this.file.getUint8(toNumber(offset));
9685
- }
9686
- async getUint16(offset) {
9687
- return this.file.getUint16(toNumber(offset), true);
9688
- }
9689
- async getUint32(offset) {
9690
- return this.file.getUint32(toNumber(offset), true);
9691
- }
9692
- async getBigUint64(offset) {
9693
- return this.file.getBigUint64(toNumber(offset), true);
9092
+ transformPositionToScaledSpace(position, result = [0, 0, 0]) {
9093
+ return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
9694
9094
  }
9695
- async slice(startOffset, endOffset) {
9696
- return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));
9095
+ transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
9096
+ return scratchPosition.from(position).scale(this.radii).to(result);
9697
9097
  }
9698
- get length() {
9699
- return BigInt(this.file.byteLength);
9098
+ getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
9099
+ assert3(equals(this.radii.x, this.radii.y, math_utils_exports.EPSILON15));
9100
+ assert3(this.radii.z > 0);
9101
+ scratchPosition.from(position);
9102
+ const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
9103
+ if (Math.abs(z) >= this.radii.z - buffer) {
9104
+ return void 0;
9105
+ }
9106
+ return scratchPosition.set(0, 0, z).to(result);
9700
9107
  }
9701
9108
  };
9109
+ _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
9702
9110
 
9703
9111
  // ../images/src/lib/utils/version.ts
9704
9112
  var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
@@ -10022,7 +9430,7 @@ var __exports__ = (() => {
10022
9430
  mimeType
10023
9431
  } = getBinaryImageMetadata(arrayBuffer) || {};
10024
9432
  const parseImageNode2 = globalThis.loaders?.parseImageNode;
10025
- assert2(parseImageNode2);
9433
+ assert(parseImageNode2);
10026
9434
  return await parseImageNode2(arrayBuffer, mimeType);
10027
9435
  }
10028
9436
 
@@ -10047,7 +9455,7 @@ var __exports__ = (() => {
10047
9455
  image = await parseToNodeImage(arrayBuffer, options);
10048
9456
  break;
10049
9457
  default:
10050
- assert2(false);
9458
+ assert(false);
10051
9459
  }
10052
9460
  if (imageType === "data") {
10053
9461
  image = getImageData(image);
@@ -11367,11 +10775,11 @@ var __exports__ = (() => {
11367
10775
  function parseDDS(data) {
11368
10776
  const header = new Int32Array(data, 0, DDS_CONSTANTS.HEADER_LENGTH);
11369
10777
  const pixelFormatNumber = header[DDS_CONSTANTS.HEADER_PF_FOURCC_INDEX];
11370
- assert2(Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC), "DDS: Unsupported format, must contain a FourCC code");
10778
+ assert(Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC), "DDS: Unsupported format, must contain a FourCC code");
11371
10779
  const fourCC = int32ToFourCC(pixelFormatNumber);
11372
10780
  const internalFormat = DDS_PIXEL_FORMATS[fourCC];
11373
10781
  const sizeFunction = DDS_SIZE_FUNCTIONS[fourCC];
11374
- assert2(internalFormat && sizeFunction, `DDS: Unknown pixel format ${pixelFormatNumber}`);
10782
+ assert(internalFormat && sizeFunction, `DDS: Unknown pixel format ${pixelFormatNumber}`);
11375
10783
  let mipMapLevels = 1;
11376
10784
  if (header[DDS_CONSTANTS.HEADER_FLAGS_INDEX] & DDS_CONSTANTS.DDSD_MIPMAPCOUNT) {
11377
10785
  mipMapLevels = Math.max(1, header[DDS_CONSTANTS.MIPMAPCOUNT_INDEX]);
@@ -11638,272 +11046,11 @@ var __exports__ = (() => {
11638
11046
  const {
11639
11047
  attributeStorageInfo = []
11640
11048
  } = tileset;
11641
- for (let index = 0; index < attributeStorageInfo.length; index++) {
11642
- const fileName = attributeStorageInfo[index].key;
11643
- attributeUrls.push(`${url}/nodes/${resource}/attributes/${fileName}/0`);
11644
- }
11645
- return attributeUrls;
11646
- }
11647
-
11648
- // src/lib/utils/customize-сolors.ts
11649
- var import_core6 = __toESM(require_core(), 1);
11650
-
11651
- // src/i3s-attribute-loader.ts
11652
- var import_core5 = __toESM(require_core(), 1);
11653
-
11654
- // src/lib/parsers/parse-i3s-attribute.ts
11655
- function parseI3STileAttribute(arrayBuffer, options) {
11656
- const {
11657
- attributeName,
11658
- attributeType
11659
- } = options;
11660
- if (!attributeName) {
11661
- return {};
11662
- }
11663
- return {
11664
- [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
11665
- };
11666
- }
11667
- function parseAttribute(attributeType, arrayBuffer) {
11668
- switch (attributeType) {
11669
- case STRING_ATTRIBUTE_TYPE:
11670
- return parseStringsAttribute(arrayBuffer);
11671
- case OBJECT_ID_ATTRIBUTE_TYPE:
11672
- return parseShortNumberAttribute(arrayBuffer);
11673
- case FLOAT_64_TYPE:
11674
- return parseFloatAttribute(arrayBuffer);
11675
- case INT_16_ATTRIBUTE_TYPE:
11676
- return parseInt16ShortNumberAttribute(arrayBuffer);
11677
- default:
11678
- return parseShortNumberAttribute(arrayBuffer);
11679
- }
11680
- }
11681
- function parseShortNumberAttribute(arrayBuffer) {
11682
- const countOffset = 4;
11683
- return new Uint32Array(arrayBuffer, countOffset);
11684
- }
11685
- function parseInt16ShortNumberAttribute(arrayBuffer) {
11686
- const countOffset = 4;
11687
- return new Int16Array(arrayBuffer, countOffset);
11688
- }
11689
- function parseFloatAttribute(arrayBuffer) {
11690
- const countOffset = 8;
11691
- return new Float64Array(arrayBuffer, countOffset);
11692
- }
11693
- function parseStringsAttribute(arrayBuffer) {
11694
- const stringsCountOffset = 0;
11695
- const dataOffset = 8;
11696
- const bytesPerStringSize = 4;
11697
- const stringsArray = [];
11698
- try {
11699
- const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
11700
- const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
11701
- let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
11702
- for (const stringByteSize of stringSizes) {
11703
- const textDecoder = new TextDecoder("utf-8");
11704
- const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
11705
- stringsArray.push(textDecoder.decode(stringAttribute));
11706
- stringOffset += stringByteSize;
11707
- }
11708
- } catch (error) {
11709
- console.error("Parse string attribute error: ", error.message);
11710
- }
11711
- return stringsArray;
11712
- }
11713
-
11714
- // src/i3s-attribute-loader.ts
11715
- var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
11716
- var EMPTY_VALUE = "";
11717
- var REJECTED_STATUS = "rejected";
11718
- var I3SAttributeLoader = {
11719
- name: "I3S Attribute",
11720
- id: "i3s-attribute",
11721
- module: "i3s",
11722
- version: VERSION5,
11723
- mimeTypes: ["application/binary"],
11724
- parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
11725
- extensions: ["bin"],
11726
- options: {},
11727
- binary: true
11728
- };
11729
- async function loadFeatureAttributes(tile, featureId, options = {}) {
11730
- const {
11731
- attributeStorageInfo,
11732
- attributeUrls,
11733
- tilesetFields
11734
- } = getAttributesData(tile);
11735
- if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
11736
- return null;
11737
- }
11738
- let attributes = [];
11739
- const attributeLoadPromises = [];
11740
- for (let index = 0; index < attributeStorageInfo.length; index++) {
11741
- const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);
11742
- const attributeName = attributeStorageInfo[index].name;
11743
- const attributeType = getAttributeValueType(attributeStorageInfo[index]);
11744
- const loadOptions = {
11745
- ...options,
11746
- attributeName,
11747
- attributeType
11748
- };
11749
- const promise = (0, import_core5.load)(url, I3SAttributeLoader, loadOptions);
11750
- attributeLoadPromises.push(promise);
11751
- }
11752
- try {
11753
- attributes = await Promise.allSettled(attributeLoadPromises);
11754
- } catch (error) {
11755
- }
11756
- if (!attributes.length) {
11757
- return null;
11758
- }
11759
- return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
11760
- }
11761
- function getAttributesData(tile) {
11762
- const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
11763
- const attributeUrls = tile.header?.attributeUrls;
11764
- const tilesetFields = tile.tileset?.tileset?.fields || [];
11765
- return {
11766
- attributeStorageInfo,
11767
- attributeUrls,
11768
- tilesetFields
11769
- };
11770
- }
11771
- function getAttributeValueType(attribute) {
11772
- if (attribute.hasOwnProperty("objectIds")) {
11773
- return "Oid32";
11774
- } else if (attribute.hasOwnProperty("attributeValues")) {
11775
- return attribute.attributeValues.valueType;
11776
- }
11777
- return "";
11778
- }
11779
- function getFeatureIdsAttributeName(attributeStorageInfo) {
11780
- const objectIdsAttribute = attributeStorageInfo.find((attribute) => attribute.name.includes("OBJECTID"));
11781
- return objectIdsAttribute?.name;
11782
- }
11783
- function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
11784
- const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
11785
- const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
11786
- if (!objectIds) {
11787
- return null;
11788
- }
11789
- const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
11790
- if (attributeIndex < 0) {
11791
- return null;
11792
- }
11793
- return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
11794
- }
11795
- function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
11796
- const attributesObject = {};
11797
- for (let index = 0; index < attributeStorageInfo.length; index++) {
11798
- const attributeName = attributeStorageInfo[index].name;
11799
- const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
11800
- const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
11801
- attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
11802
- }
11803
- return attributesObject;
11804
- }
11805
- function getAttributeCodedValues(attributeName, tilesetFields) {
11806
- const attributeField = tilesetFields.find((field) => field.name === attributeName || field.alias === attributeName);
11807
- return attributeField?.domain?.codedValues || [];
11808
- }
11809
- function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
11810
- const attributeObject = attributes[index];
11811
- if (attributeObject.status === REJECTED_STATUS) {
11812
- return null;
11813
- }
11814
- return attributeObject.value[attributesName];
11815
- }
11816
- function formatAttributeValue(attribute, featureIdIndex, codedValues) {
11817
- let value = EMPTY_VALUE;
11818
- if (attribute && featureIdIndex in attribute) {
11819
- value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, "").trim();
11820
- }
11821
- if (codedValues.length) {
11822
- const codeValue = codedValues.find((codedValue) => codedValue.code === Number(value));
11823
- value = codeValue?.name || EMPTY_VALUE;
11824
- }
11825
- return value;
11826
- }
11827
-
11828
- // src/lib/utils/customize-сolors.ts
11829
- async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
11830
- if (!options?.i3s?.colorsByAttribute) {
11831
- return colors;
11832
- }
11833
- const colorizeAttributeField = tilesetOptions.fields.find(({
11834
- name
11835
- }) => name === options?.i3s?.colorsByAttribute?.attributeName);
11836
- if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
11837
- return colors;
11838
- }
11839
- const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
11840
- if (!colorizeAttributeData) {
11841
- return colors;
11842
- }
11843
- const objectIdField = tilesetOptions.fields.find(({
11844
- type
11845
- }) => type === "esriFieldTypeOID");
11846
- if (!objectIdField) {
11847
- return colors;
11848
- }
11849
- const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
11850
- if (!objectIdAttributeData) {
11851
- return colors;
11852
- }
11853
- const attributeValuesMap = {};
11854
- for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
11855
- attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
11856
- }
11857
- for (let i2 = 0; i2 < featureIds.value.length; i2++) {
11858
- const color = attributeValuesMap[featureIds.value[i2]];
11859
- if (!color) {
11860
- continue;
11861
- }
11862
- if (options.i3s.colorsByAttribute.mode === "multiply") {
11863
- color.forEach((colorItem, index) => {
11864
- colors.value[i2 * 4 + index] = colors.value[i2 * 4 + index] * colorItem / 255;
11865
- });
11866
- } else {
11867
- colors.value.set(color, i2 * 4);
11868
- }
11869
- }
11870
- return colors;
11871
- }
11872
- function calculateColorForAttribute(attributeValue, options) {
11873
- if (!options?.i3s?.colorsByAttribute) {
11874
- return [255, 255, 255, 255];
11875
- }
11876
- const {
11877
- minValue,
11878
- maxValue,
11879
- minColor,
11880
- maxColor
11881
- } = options.i3s.colorsByAttribute;
11882
- const rate = (attributeValue - minValue) / (maxValue - minValue);
11883
- const color = [255, 255, 255, 255];
11884
- for (let i2 = 0; i2 < minColor.length; i2++) {
11885
- color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
11886
- }
11887
- return color;
11888
- }
11889
- async function loadFeatureAttributeData(attributeName, {
11890
- attributeUrls
11891
- }, {
11892
- attributeStorageInfo
11893
- }, options) {
11894
- const attributeIndex = attributeStorageInfo.findIndex(({
11895
- name
11896
- }) => attributeName === name);
11897
- if (attributeIndex === -1) {
11898
- return null;
11899
- }
11900
- const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);
11901
- const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
11902
- const objectIdAttributeData = await (0, import_core6.load)(objectIdAttributeUrl, I3SAttributeLoader, {
11903
- attributeName,
11904
- attributeType
11905
- });
11906
- return objectIdAttributeData;
11049
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
11050
+ const fileName = attributeStorageInfo[index].key;
11051
+ attributeUrls.push(`${url}/nodes/${resource}/attributes/${fileName}/0`);
11052
+ }
11053
+ return attributeUrls;
11907
11054
  }
11908
11055
 
11909
11056
  // src/lib/parsers/parse-i3s-tile-content.ts
@@ -11936,8 +11083,8 @@ var __exports__ = (() => {
11936
11083
  if (tileOptions.textureUrl) {
11937
11084
  const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
11938
11085
  const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
11939
- const fetch2 = context?.fetch;
11940
- const response = await fetch2(url);
11086
+ const fetchFunc = context?.fetch || fetch;
11087
+ const response = await fetchFunc(url);
11941
11088
  const arrayBuffer2 = await response.arrayBuffer();
11942
11089
  if (options?.i3s.decodeTextures) {
11943
11090
  if (loader === ImageLoader) {
@@ -11951,11 +11098,11 @@ var __exports__ = (() => {
11951
11098
  const texture = await parseFromContext(arrayBuffer2, [], options2, context);
11952
11099
  content.texture = texture;
11953
11100
  } catch (e2) {
11954
- const texture = await (0, import_core7.parse)(arrayBuffer2, loader, options2, context);
11101
+ const texture = await (0, import_core5.parse)(arrayBuffer2, loader, options2, context);
11955
11102
  content.texture = texture;
11956
11103
  }
11957
11104
  } else if (loader === CompressedTextureLoader || loader === BasisLoader) {
11958
- let texture = await (0, import_core7.load)(arrayBuffer2, loader, tileOptions.textureLoaderOptions);
11105
+ let texture = await (0, import_core5.load)(arrayBuffer2, loader, tileOptions.textureLoaderOptions);
11959
11106
  if (loader === BasisLoader) {
11960
11107
  texture = texture[0];
11961
11108
  }
@@ -11985,7 +11132,7 @@ var __exports__ = (() => {
11985
11132
  let featureCount = 0;
11986
11133
  let indices;
11987
11134
  if (tileOptions.isDracoGeometry) {
11988
- const decompressedGeometry = await (0, import_core7.parse)(arrayBuffer, DracoLoader2, {
11135
+ const decompressedGeometry = await (0, import_core5.parse)(arrayBuffer, DracoLoader2, {
11989
11136
  draco: {
11990
11137
  attributeNameEntry: I3S_ATTRIBUTE_TYPE
11991
11138
  }
@@ -12042,7 +11189,6 @@ var __exports__ = (() => {
12042
11189
  content.modelMatrix = getModelMatrix(attributes.position);
12043
11190
  content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
12044
11191
  }
12045
- attributes.color = await customizeColors(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
12046
11192
  content.attributes = {
12047
11193
  positions: attributes.position,
12048
11194
  normals: attributes.normal,
@@ -12329,13 +11475,13 @@ var __exports__ = (() => {
12329
11475
  }
12330
11476
 
12331
11477
  // src/i3s-content-loader.ts
12332
- var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
11478
+ var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
12333
11479
  var I3SContentLoader = {
12334
11480
  name: "I3S Content (Indexed Scene Layers)",
12335
11481
  id: "i3s-content",
12336
11482
  module: "i3s",
12337
11483
  worker: true,
12338
- version: VERSION6,
11484
+ version: VERSION5,
12339
11485
  mimeTypes: ["application/octet-stream"],
12340
11486
  parse: parse3,
12341
11487
  extensions: ["bin"],
@@ -12654,7 +11800,7 @@ var __exports__ = (() => {
12654
11800
  this.fromNormalDistance(normal, distance2);
12655
11801
  }
12656
11802
  fromNormalDistance(normal, distance2) {
12657
- assert(Number.isFinite(distance2));
11803
+ assert3(Number.isFinite(distance2));
12658
11804
  this.normal.from(normal).normalize();
12659
11805
  this.distance = distance2;
12660
11806
  return this;
@@ -12668,7 +11814,7 @@ var __exports__ = (() => {
12668
11814
  }
12669
11815
  fromCoefficients(a2, b, c2, d) {
12670
11816
  this.normal.set(a2, b, c2);
12671
- assert(equals(this.normal.len(), 1));
11817
+ assert3(equals(this.normal.len(), 1));
12672
11818
  this.distance = d;
12673
11819
  return this;
12674
11820
  }
@@ -12742,7 +11888,7 @@ var __exports__ = (() => {
12742
11888
  return intersect;
12743
11889
  }
12744
11890
  computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
12745
- assert(Number.isFinite(parentPlaneMask), "parentPlaneMask is required.");
11891
+ assert3(Number.isFinite(parentPlaneMask), "parentPlaneMask is required.");
12746
11892
  if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
12747
11893
  return parentPlaneMask;
12748
11894
  }
@@ -12809,7 +11955,7 @@ var __exports__ = (() => {
12809
11955
  };
12810
11956
 
12811
11957
  // src/lib/parsers/parse-i3s.ts
12812
- var import_core19 = __toESM(require_core(), 1);
11958
+ var import_core17 = __toESM(require_core(), 1);
12813
11959
 
12814
11960
  // ../tiles/src/constants.ts
12815
11961
  var TILE_REFINEMENT = function(TILE_REFINEMENT2) {
@@ -12836,15 +11982,15 @@ var __exports__ = (() => {
12836
11982
  }({});
12837
11983
 
12838
11984
  // src/lib/helpers/i3s-nodepages-tiles.ts
12839
- var import_core18 = __toESM(require_core(), 1);
11985
+ var import_core16 = __toESM(require_core(), 1);
12840
11986
 
12841
11987
  // src/i3s-node-page-loader.ts
12842
- var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
11988
+ var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12843
11989
  var I3SNodePageLoader = {
12844
11990
  name: "I3S Node Page",
12845
11991
  id: "i3s-node-page",
12846
11992
  module: "i3s",
12847
- version: VERSION7,
11993
+ version: VERSION6,
12848
11994
  mimeTypes: ["application/json"],
12849
11995
  parse: parseNodePage,
12850
11996
  extensions: ["json"],
@@ -12879,7 +12025,7 @@ var __exports__ = (() => {
12879
12025
  const nodePageUrl = getUrlWithToken(`${this.url}/nodepages/${pageIndex}`, this.options.i3s?.token);
12880
12026
  this.pendingNodePages[pageIndex] = {
12881
12027
  status: "Pending",
12882
- promise: (0, import_core18.load)(nodePageUrl, I3SNodePageLoader, this.options)
12028
+ promise: (0, import_core16.load)(nodePageUrl, I3SNodePageLoader, this.options)
12883
12029
  };
12884
12030
  this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;
12885
12031
  this.nodesInNodePages += this.nodePages[pageIndex].nodes.length;
@@ -13105,7 +12251,7 @@ var __exports__ = (() => {
13105
12251
  } else {
13106
12252
  const parseOptions = options.i3s;
13107
12253
  const rootNodeUrl = getUrlWithToken(`${url}/nodes/root`, parseOptions.token);
13108
- root = await (0, import_core19.load)(rootNodeUrl, I3SLoader, {
12254
+ root = await (0, import_core17.load)(rootNodeUrl, I3SLoader, {
13109
12255
  ...options,
13110
12256
  i3s: {
13111
12257
  ...options.i3s,
@@ -13129,7 +12275,7 @@ var __exports__ = (() => {
13129
12275
  }
13130
12276
 
13131
12277
  // src/i3s-loader.ts
13132
- var VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12278
+ var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
13133
12279
  var TILESET_REGEX = /layers\/[0-9]+$/;
13134
12280
  var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
13135
12281
  var SLPK_HEX = "504b0304";
@@ -13138,7 +12284,7 @@ var __exports__ = (() => {
13138
12284
  name: "I3S (Indexed Scene Layers)",
13139
12285
  id: "i3s",
13140
12286
  module: "i3s",
13141
- version: VERSION8,
12287
+ version: VERSION7,
13142
12288
  mimeTypes: ["application/octet-stream"],
13143
12289
  parse: parseI3S,
13144
12290
  extensions: ["bin"],
@@ -13154,8 +12300,7 @@ var __exports__ = (() => {
13154
12300
  useDracoGeometry: true,
13155
12301
  useCompressedTextures: true,
13156
12302
  decodeTextures: true,
13157
- coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,
13158
- colorsByAttribute: null
12303
+ coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
13159
12304
  }
13160
12305
  }
13161
12306
  };
@@ -13189,7 +12334,7 @@ var __exports__ = (() => {
13189
12334
  return data;
13190
12335
  }
13191
12336
  async function parseTileContent(arrayBuffer, options) {
13192
- return await (0, import_core20.parse)(arrayBuffer, I3SContentLoader, options);
12337
+ return await (0, import_core18.parse)(arrayBuffer, I3SContentLoader, options);
13193
12338
  }
13194
12339
  async function parseTileset(data, options, context) {
13195
12340
  const tilesetJson = JSON.parse(new TextDecoder().decode(data));
@@ -14183,12 +13328,12 @@ var __exports__ = (() => {
14183
13328
  }
14184
13329
 
14185
13330
  // src/i3s-slpk-loader.ts
14186
- var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
13331
+ var VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
14187
13332
  var SLPKLoader = {
14188
13333
  name: "I3S SLPK (Scene Layer Package)",
14189
13334
  id: "slpk",
14190
13335
  module: "i3s",
14191
- version: VERSION9,
13336
+ version: VERSION8,
14192
13337
  mimeTypes: ["application/octet-stream"],
14193
13338
  extensions: ["slpk"],
14194
13339
  options: {},
@@ -14198,6 +13343,183 @@ var __exports__ = (() => {
14198
13343
  }
14199
13344
  };
14200
13345
 
13346
+ // src/i3s-attribute-loader.ts
13347
+ var import_core19 = __toESM(require_core(), 1);
13348
+
13349
+ // src/lib/parsers/parse-i3s-attribute.ts
13350
+ function parseI3STileAttribute(arrayBuffer, options) {
13351
+ const {
13352
+ attributeName,
13353
+ attributeType
13354
+ } = options;
13355
+ if (!attributeName) {
13356
+ return {};
13357
+ }
13358
+ return {
13359
+ [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
13360
+ };
13361
+ }
13362
+ function parseAttribute(attributeType, arrayBuffer) {
13363
+ switch (attributeType) {
13364
+ case STRING_ATTRIBUTE_TYPE:
13365
+ return parseStringsAttribute(arrayBuffer);
13366
+ case OBJECT_ID_ATTRIBUTE_TYPE:
13367
+ return parseShortNumberAttribute(arrayBuffer);
13368
+ case FLOAT_64_TYPE:
13369
+ return parseFloatAttribute(arrayBuffer);
13370
+ case INT_16_ATTRIBUTE_TYPE:
13371
+ return parseInt16ShortNumberAttribute(arrayBuffer);
13372
+ default:
13373
+ return parseShortNumberAttribute(arrayBuffer);
13374
+ }
13375
+ }
13376
+ function parseShortNumberAttribute(arrayBuffer) {
13377
+ const countOffset = 4;
13378
+ return new Uint32Array(arrayBuffer, countOffset);
13379
+ }
13380
+ function parseInt16ShortNumberAttribute(arrayBuffer) {
13381
+ const countOffset = 4;
13382
+ return new Int16Array(arrayBuffer, countOffset);
13383
+ }
13384
+ function parseFloatAttribute(arrayBuffer) {
13385
+ const countOffset = 8;
13386
+ return new Float64Array(arrayBuffer, countOffset);
13387
+ }
13388
+ function parseStringsAttribute(arrayBuffer) {
13389
+ const stringsCountOffset = 0;
13390
+ const dataOffset = 8;
13391
+ const bytesPerStringSize = 4;
13392
+ const stringsArray = [];
13393
+ try {
13394
+ const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
13395
+ const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
13396
+ let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
13397
+ for (const stringByteSize of stringSizes) {
13398
+ const textDecoder = new TextDecoder("utf-8");
13399
+ const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
13400
+ stringsArray.push(textDecoder.decode(stringAttribute));
13401
+ stringOffset += stringByteSize;
13402
+ }
13403
+ } catch (error) {
13404
+ console.error("Parse string attribute error: ", error.message);
13405
+ }
13406
+ return stringsArray;
13407
+ }
13408
+
13409
+ // src/i3s-attribute-loader.ts
13410
+ var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
13411
+ var EMPTY_VALUE = "";
13412
+ var REJECTED_STATUS = "rejected";
13413
+ var I3SAttributeLoader = {
13414
+ name: "I3S Attribute",
13415
+ id: "i3s-attribute",
13416
+ module: "i3s",
13417
+ version: VERSION9,
13418
+ mimeTypes: ["application/binary"],
13419
+ parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
13420
+ extensions: ["bin"],
13421
+ options: {},
13422
+ binary: true
13423
+ };
13424
+ async function loadFeatureAttributes(tile, featureId, options = {}) {
13425
+ const {
13426
+ attributeStorageInfo,
13427
+ attributeUrls,
13428
+ tilesetFields
13429
+ } = getAttributesData(tile);
13430
+ if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
13431
+ return null;
13432
+ }
13433
+ let attributes = [];
13434
+ const attributeLoadPromises = [];
13435
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
13436
+ const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);
13437
+ const attributeName = attributeStorageInfo[index].name;
13438
+ const attributeType = getAttributeValueType(attributeStorageInfo[index]);
13439
+ const loadOptions = {
13440
+ ...options,
13441
+ attributeName,
13442
+ attributeType
13443
+ };
13444
+ const promise = (0, import_core19.load)(url, I3SAttributeLoader, loadOptions);
13445
+ attributeLoadPromises.push(promise);
13446
+ }
13447
+ try {
13448
+ attributes = await Promise.allSettled(attributeLoadPromises);
13449
+ } catch (error) {
13450
+ }
13451
+ if (!attributes.length) {
13452
+ return null;
13453
+ }
13454
+ return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
13455
+ }
13456
+ function getAttributesData(tile) {
13457
+ const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
13458
+ const attributeUrls = tile.header?.attributeUrls;
13459
+ const tilesetFields = tile.tileset?.tileset?.fields || [];
13460
+ return {
13461
+ attributeStorageInfo,
13462
+ attributeUrls,
13463
+ tilesetFields
13464
+ };
13465
+ }
13466
+ function getAttributeValueType(attribute) {
13467
+ if (attribute.hasOwnProperty("objectIds")) {
13468
+ return "Oid32";
13469
+ } else if (attribute.hasOwnProperty("attributeValues")) {
13470
+ return attribute.attributeValues.valueType;
13471
+ }
13472
+ return "";
13473
+ }
13474
+ function getFeatureIdsAttributeName(attributeStorageInfo) {
13475
+ const objectIdsAttribute = attributeStorageInfo.find((attribute) => attribute.name.includes("OBJECTID"));
13476
+ return objectIdsAttribute?.name;
13477
+ }
13478
+ function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
13479
+ const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
13480
+ const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
13481
+ if (!objectIds) {
13482
+ return null;
13483
+ }
13484
+ const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
13485
+ if (attributeIndex < 0) {
13486
+ return null;
13487
+ }
13488
+ return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
13489
+ }
13490
+ function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
13491
+ const attributesObject = {};
13492
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
13493
+ const attributeName = attributeStorageInfo[index].name;
13494
+ const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
13495
+ const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
13496
+ attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
13497
+ }
13498
+ return attributesObject;
13499
+ }
13500
+ function getAttributeCodedValues(attributeName, tilesetFields) {
13501
+ const attributeField = tilesetFields.find((field) => field.name === attributeName || field.alias === attributeName);
13502
+ return attributeField?.domain?.codedValues || [];
13503
+ }
13504
+ function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
13505
+ const attributeObject = attributes[index];
13506
+ if (attributeObject.status === REJECTED_STATUS) {
13507
+ return null;
13508
+ }
13509
+ return attributeObject.value[attributesName];
13510
+ }
13511
+ function formatAttributeValue(attribute, featureIdIndex, codedValues) {
13512
+ let value = EMPTY_VALUE;
13513
+ if (attribute && featureIdIndex in attribute) {
13514
+ value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, "").trim();
13515
+ }
13516
+ if (codedValues.length) {
13517
+ const codeValue = codedValues.find((codedValue) => codedValue.code === Number(value));
13518
+ value = codeValue?.name || EMPTY_VALUE;
13519
+ }
13520
+ return value;
13521
+ }
13522
+
14201
13523
  // src/lib/parsers/parse-i3s-building-scene-layer.ts
14202
13524
  var OBJECT_3D_LAYER_TYPE = "3DObject";
14203
13525
  async function parseBuildingSceneLayer(data, url) {
@@ -14257,7 +13579,7 @@ var __exports__ = (() => {
14257
13579
  }
14258
13580
 
14259
13581
  // src/lib/parsers/parse-arcgis-webscene.ts
14260
- var import_core21 = __toESM(require_core(), 1);
13582
+ var import_core20 = __toESM(require_core(), 1);
14261
13583
  var SUPPORTED_WKID = 4326;
14262
13584
  var ARCGIS_SCENE_SERVER_LAYER_TYPE = "ArcGISSceneServiceLayer";
14263
13585
  var BUILDING_SCENE_LAYER = "BuildingSceneLayer";
@@ -14315,7 +13637,7 @@ var __exports__ = (() => {
14315
13637
  }
14316
13638
  async function checkSupportedIndexCRS(layer) {
14317
13639
  try {
14318
- const layerJson = await (0, import_core21.load)(layer.url, import_core21.JSONLoader);
13640
+ const layerJson = await (0, import_core20.load)(layer.url, import_core20.JSONLoader);
14319
13641
  const wkid = layerJson?.spatialReference?.wkid;
14320
13642
  if (wkid !== SUPPORTED_WKID) {
14321
13643
  throw new Error(NOT_SUPPORTED_CRS_ERROR);
@@ -14340,6 +13662,88 @@ var __exports__ = (() => {
14340
13662
  async function parse6(data) {
14341
13663
  return parseWebscene(data);
14342
13664
  }
13665
+
13666
+ // src/lib/utils/customize-colors.ts
13667
+ var import_core21 = __toESM(require_core(), 1);
13668
+ async function customizeColors(colors, featureIds, attributeUrls, fields, attributeStorageInfo, colorsByAttribute, token) {
13669
+ if (!colorsByAttribute) {
13670
+ return colors;
13671
+ }
13672
+ const resultColors = {
13673
+ ...colors,
13674
+ value: new Uint8Array(colors.value)
13675
+ };
13676
+ const colorizeAttributeField = fields.find(({
13677
+ name
13678
+ }) => name === colorsByAttribute?.attributeName);
13679
+ if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
13680
+ return colors;
13681
+ }
13682
+ const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, attributeUrls, attributeStorageInfo, token);
13683
+ if (!colorizeAttributeData) {
13684
+ return colors;
13685
+ }
13686
+ const objectIdField = fields.find(({
13687
+ type
13688
+ }) => type === "esriFieldTypeOID");
13689
+ if (!objectIdField) {
13690
+ return colors;
13691
+ }
13692
+ const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, attributeUrls, attributeStorageInfo, token);
13693
+ if (!objectIdAttributeData) {
13694
+ return colors;
13695
+ }
13696
+ const attributeValuesMap = {};
13697
+ for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
13698
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], colorsByAttribute);
13699
+ }
13700
+ for (let i2 = 0; i2 < featureIds.length; i2++) {
13701
+ const color = attributeValuesMap[featureIds[i2]];
13702
+ if (!color) {
13703
+ continue;
13704
+ }
13705
+ if (colorsByAttribute.mode === "multiply") {
13706
+ color.forEach((colorItem, index) => {
13707
+ resultColors.value[i2 * 4 + index] = resultColors.value[i2 * 4 + index] * colorItem / 255;
13708
+ });
13709
+ } else {
13710
+ resultColors.value.set(color, i2 * 4);
13711
+ }
13712
+ }
13713
+ return resultColors;
13714
+ }
13715
+ function calculateColorForAttribute(attributeValue, colorsByAttribute) {
13716
+ if (!colorsByAttribute) {
13717
+ return [255, 255, 255, 255];
13718
+ }
13719
+ const {
13720
+ minValue,
13721
+ maxValue,
13722
+ minColor,
13723
+ maxColor
13724
+ } = colorsByAttribute;
13725
+ const rate = (attributeValue - minValue) / (maxValue - minValue);
13726
+ const color = [255, 255, 255, 255];
13727
+ for (let i2 = 0; i2 < minColor.length; i2++) {
13728
+ color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
13729
+ }
13730
+ return color;
13731
+ }
13732
+ async function loadFeatureAttributeData(attributeName, attributeUrls, attributeStorageInfo, token) {
13733
+ const attributeIndex = attributeStorageInfo.findIndex(({
13734
+ name
13735
+ }) => attributeName === name);
13736
+ if (attributeIndex === -1) {
13737
+ return null;
13738
+ }
13739
+ const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], token);
13740
+ const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
13741
+ const objectIdAttributeData = await (0, import_core21.load)(objectIdAttributeUrl, I3SAttributeLoader, {
13742
+ attributeName,
13743
+ attributeType
13744
+ });
13745
+ return objectIdAttributeData;
13746
+ }
14343
13747
  return __toCommonJS(src_exports);
14344
13748
  })();
14345
13749
  return __exports__;