@loaders.gl/tiles-3d 5.0.0-beta.4 → 5.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  3. package/dist/3d-tiles/dist.dev.js +891 -620
  4. package/dist/3d-tiles/dist.min.js +37 -37
  5. package/dist/3d-tiles/index.cjs +821 -943
  6. package/dist/3d-tiles/index.cjs.map +3 -3
  7. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +5 -1
  8. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  9. package/dist/3d-tiles/lib/utils/version.js +1 -1
  10. package/dist/3d-tiles-archive-writer.cjs +1 -1
  11. package/dist/cesium-ion-loader-with-parser.cjs +820 -942
  12. package/dist/cesium-ion-loader-with-parser.cjs.map +3 -3
  13. package/dist/copc/copc-source-loader.js +2 -2
  14. package/dist/copc/copc-source-loader.js.map +1 -1
  15. package/dist/copc/copc-writer.js +1 -1
  16. package/dist/copc/index.cjs +24 -178
  17. package/dist/copc/index.cjs.map +3 -3
  18. package/dist/dist.dev.js +231 -38
  19. package/dist/dist.min.js +10 -10
  20. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  21. package/dist/i3s/dist.dev.js +3080 -710
  22. package/dist/i3s/dist.min.js +47 -47
  23. package/dist/i3s/i3s-attribute-loader.js +1 -1
  24. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  25. package/dist/i3s/i3s-content-loader.js +1 -1
  26. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  27. package/dist/i3s/i3s-loader.js +1 -1
  28. package/dist/i3s/i3s-node-page-loader.js +1 -1
  29. package/dist/i3s/i3s-slpk-loader.js +1 -1
  30. package/dist/i3s/i3s-slpk-writer.js +1 -1
  31. package/dist/i3s/index.cjs +1999 -541
  32. package/dist/i3s/index.cjs.map +3 -3
  33. package/dist/i3s-content-worker-node.js +11 -11
  34. package/dist/i3s-content-worker-node.js.map +4 -4
  35. package/dist/i3s-content-worker.js +767 -346
  36. package/dist/i3s-lepcc-worker-node.js +245 -12
  37. package/dist/i3s-lepcc-worker-node.js.map +4 -4
  38. package/dist/i3s-lepcc-worker.js +240 -12
  39. package/dist/i3s-mesh-writer.cjs +1748 -290
  40. package/dist/i3s-mesh-writer.cjs.map +3 -3
  41. package/dist/i3s-slpk-writer.cjs +1 -1
  42. package/dist/index.cjs +1 -1
  43. package/dist/point-cloud-tile-source-loader-types.js +1 -1
  44. package/dist/point-cloud-tile-source-loader.cjs +1 -1
  45. package/dist/potree/dist.dev.js +226 -82
  46. package/dist/potree/dist.min.js +30 -30
  47. package/dist/potree/index.cjs +13 -165
  48. package/dist/potree/index.cjs.map +3 -3
  49. package/dist/potree/potree-bin-loader.js +1 -1
  50. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  51. package/dist/potree/potree-loader-types.js +1 -1
  52. package/dist/potree/potree-source-loader.js +1 -1
  53. package/dist/potree/potree-writer.js +1 -1
  54. package/dist/potree-loader.cjs +1 -1
  55. package/package.json +13 -13
  56. package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +4 -1
  57. package/src/copc/copc-source-loader.ts +1 -1
@@ -827,12 +827,10 @@ var init_library_utils = __esm({
827
827
  });
828
828
 
829
829
  // ../core/src/worker-utils/index.ts
830
- var import_tasks;
831
830
  var init_worker_utils = __esm({
832
831
  "../core/src/worker-utils/index.ts"() {
833
832
  "use strict";
834
833
  init_globals2();
835
- import_tasks = require("@math.gl/core/tasks");
836
834
  init_library_utils();
837
835
  }
838
836
  });
@@ -6956,7 +6954,7 @@ __export(KHR_gaussian_splatting_exports, {
6956
6954
  name: () => name6
6957
6955
  });
6958
6956
  async function decode6(gltfData, options, context) {
6959
- var _a, _b, _c, _d, _e;
6957
+ var _a, _b, _c, _d, _e, _f, _g;
6960
6958
  const loader = (_a = context == null ? void 0 : context.loaders) == null ? void 0 : _a.find((candidate) => {
6961
6959
  var _a2;
6962
6960
  return (_a2 = candidate.extensions) == null ? void 0 : _a2.includes("spz");
@@ -6967,22 +6965,29 @@ async function decode6(gltfData, options, context) {
6967
6965
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
6968
6966
  const extension = (_b = primitive.extensions) == null ? void 0 : _b[name6];
6969
6967
  if (!extension) continue;
6968
+ const descriptor = descriptors.find(
6969
+ (item) => item.meshIndex === meshIndex && item.primitiveIndex === primitiveIndex
6970
+ );
6971
+ const legacyColorSpace = (_c = options == null ? void 0 : options.gltf) == null ? void 0 : _c.legacyGaussianSplatColorSpace;
6972
+ const normalizedExtension = legacyColorSpace && ((_d = extension.extensions) == null ? void 0 : _d[SPZ_COMPRESSION_EXTENSION_NAME]) ? {
6973
+ ...extension,
6974
+ kernel: extension.kernel ?? "ellipse",
6975
+ colorSpace: extension.colorSpace ?? legacyColorSpace
6976
+ } : extension;
6977
+ if (descriptor) descriptor.extension = normalizedExtension;
6970
6978
  validateGaussianSplatPrimitive(
6971
6979
  gltfData.json,
6972
6980
  primitive,
6973
- extension,
6981
+ normalizedExtension,
6974
6982
  meshIndex,
6975
6983
  primitiveIndex,
6976
6984
  iterator
6977
6985
  );
6978
- const compression = (_c = extension.extensions) == null ? void 0 : _c[SPZ_COMPRESSION_EXTENSION_NAME];
6986
+ const compression = (_e = extension.extensions) == null ? void 0 : _e[SPZ_COMPRESSION_EXTENSION_NAME];
6979
6987
  if (compression) {
6980
- const descriptor = descriptors.find(
6981
- (item) => item.meshIndex === meshIndex && item.primitiveIndex === primitiveIndex
6982
- );
6983
6988
  if (descriptor) {
6984
- const decoder = (_d = options == null ? void 0 : options.gltf) == null ? void 0 : _d.splatDecoder;
6985
- const bufferView = (_e = gltfData.json.bufferViews) == null ? void 0 : _e[compression.bufferView];
6989
+ const decoder = (_f = options == null ? void 0 : options.gltf) == null ? void 0 : _f.splatDecoder;
6990
+ const bufferView = (_g = gltfData.json.bufferViews) == null ? void 0 : _g[compression.bufferView];
6986
6991
  if (bufferView && gltfData.buffers[bufferView.buffer]) {
6987
6992
  descriptor.compressedBytes = getBufferViewBytes(gltfData, compression.bufferView);
6988
6993
  } else if (decoder || loader) {
@@ -8153,7 +8158,7 @@ var init_EXT_feature_metadata = __esm({
8153
8158
  });
8154
8159
 
8155
8160
  // ../scene/src/gltf/lib/types/gltf-additional-extension-schemas.ts
8156
- var import_zod, indexSchema, propertyShape, GLTFKHRMaterialVariantSchema, GLTFKHRMaterialsVariantsSchema, GLTFKHRMaterialVariantMappingSchema, GLTFKHRMaterialsVariantsPrimitiveSchema, GLTFEXTMeshGPUInstancingSchema, GLTFKHRAnimationPointerSchema, GLTFKHRNodeVisibilitySchema, GLTFKHRNodeSelectabilitySchema, GLTFKHRNodeHoverabilitySchema, GLTFKHRXMPPacketSchema, GLTFKHRXMPJSONLDSchema, GLTFKHRXMPJSONLDReferenceSchema;
8161
+ var import_zod, indexSchema, propertyShape, GLTFKHRMaterialVariantSchema, GLTFKHRMaterialsVariantsSchema, GLTFKHRMaterialVariantMappingSchema, GLTFKHRMaterialsVariantsPrimitiveSchema, GLTFEXTMeshGPUInstancingSchema, GLTFKHRAnimationPointerSchema, GLTFKHRNodeVisibilitySchema, GLTFKHRNodeSelectabilitySchema, GLTFKHRNodeHoverabilitySchema, GLTFKHRXMPPacketSchema, GLTFKHRXMPJSONLDSchema, GLTFKHRXMPJSONLDReferenceSchema, GLTFKHRMaterialsEmissiveStrengthSchema, GLTFFBGeometryMetadataSchema;
8157
8162
  var init_gltf_additional_extension_schemas = __esm({
8158
8163
  "../scene/src/gltf/lib/types/gltf-additional-extension-schemas.ts"() {
8159
8164
  "use strict";
@@ -8228,6 +8233,24 @@ var init_gltf_additional_extension_schemas = __esm({
8228
8233
  /** Index into the document-level packets array. */
8229
8234
  packet: indexSchema
8230
8235
  });
8236
+ GLTFKHRMaterialsEmissiveStrengthSchema = import_zod.z.looseObject({
8237
+ ...propertyShape,
8238
+ /** Unitless multiplier; defaults to one when omitted. */
8239
+ emissiveStrength: import_zod.z.number().nonnegative().optional()
8240
+ });
8241
+ GLTFFBGeometryMetadataSchema = import_zod.z.looseObject({
8242
+ ...propertyShape,
8243
+ /** Authored count of vertices. */
8244
+ vertexCount: import_zod.z.number().nonnegative().optional(),
8245
+ /** Authored count of primitives. */
8246
+ primitiveCount: import_zod.z.number().nonnegative().optional(),
8247
+ /** Static scene-space bounding box. */
8248
+ sceneBounds: import_zod.z.looseObject({
8249
+ ...propertyShape,
8250
+ min: import_zod.z.array(import_zod.z.number()).length(3),
8251
+ max: import_zod.z.array(import_zod.z.number()).length(3)
8252
+ }).optional()
8253
+ });
8231
8254
  }
8232
8255
  });
8233
8256
 
@@ -8379,7 +8402,7 @@ var init_gltf_audio_extension_schemas = __esm({
8379
8402
  });
8380
8403
 
8381
8404
  // ../scene/src/gltf/lib/types/gltf-extension-schemas.ts
8382
- var import_zod3, GLTFPropertyExtensionsSchema, GLTFRootExtensionsSchema, GLTFNodeExtensionsSchema, GLTFSceneExtensionsSchema, GLTFMeshPrimitiveExtensionsSchema, GLTFAnimationTargetExtensionsSchema;
8405
+ var import_zod3, GLTFPropertyExtensionsSchema, GLTFMaterialExtensionsSchema, GLTFRootExtensionsSchema, GLTFNodeExtensionsSchema, GLTFSceneExtensionsSchema, GLTFMeshPrimitiveExtensionsSchema, GLTFAnimationTargetExtensionsSchema;
8383
8406
  var init_gltf_extension_schemas = __esm({
8384
8407
  "../scene/src/gltf/lib/types/gltf-extension-schemas.ts"() {
8385
8408
  "use strict";
@@ -8390,6 +8413,10 @@ var init_gltf_extension_schemas = __esm({
8390
8413
  /** Shared XMP packet reference. */
8391
8414
  KHR_xmp_json_ld: GLTFKHRXMPJSONLDReferenceSchema.optional()
8392
8415
  });
8416
+ GLTFMaterialExtensionsSchema = GLTFPropertyExtensionsSchema.extend({
8417
+ /** Emissive intensity multiplier. */
8418
+ KHR_materials_emissive_strength: GLTFKHRMaterialsEmissiveStrengthSchema.optional()
8419
+ });
8393
8420
  GLTFRootExtensionsSchema = import_zod3.z.looseObject({
8394
8421
  /** Shared material variant declarations. */
8395
8422
  KHR_materials_variants: GLTFKHRMaterialsVariantsSchema.optional(),
@@ -8415,6 +8442,8 @@ var init_gltf_extension_schemas = __esm({
8415
8442
  MPEG_audio_spatial: GLTFMPEGAudioSpatialSchema.optional()
8416
8443
  });
8417
8444
  GLTFSceneExtensionsSchema = GLTFPropertyExtensionsSchema.extend({
8445
+ /** Authored static geometry summary. */
8446
+ FB_geometry_metadata: GLTFFBGeometryMetadataSchema.optional(),
8418
8447
  /** Attached global KHR audio emitters. */
8419
8448
  KHR_audio_emitter: GLTFKHRAudioAttachmentSchema.optional()
8420
8449
  });
@@ -9319,985 +9348,827 @@ var init_KHR_texture_basisu = __esm({
9319
9348
  }
9320
9349
  });
9321
9350
 
9322
- // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
9323
- function serializeArrowSchema(arrowSchema) {
9351
+ // ../core/src/arrow-worker-transport.ts
9352
+ function serializeArrowWorkerResult(result, options) {
9353
+ var _a;
9354
+ if (!isArrowTableWrapper(result)) {
9355
+ return result;
9356
+ }
9357
+ const workerOptions = options;
9358
+ const bufferCopyMode = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
9324
9359
  return {
9325
- fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
9326
- metadata: serializeArrowMetadata(arrowSchema.metadata)
9360
+ ...result,
9361
+ data: (0, import_arrow.dehydrateArrowTable)(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
9327
9362
  };
9328
9363
  }
9329
- function deserializeArrowSchema(schema, options) {
9330
- return new arrow.Schema(
9331
- schema.fields.map((field) => deserializeArrowField(field, options)),
9332
- deserializeArrowMetadata(schema.metadata)
9333
- );
9334
- }
9335
- function serializeArrowMetadata(arrowMetadata) {
9336
- return Object.fromEntries(arrowMetadata);
9337
- }
9338
- function deserializeArrowMetadata(metadata) {
9339
- return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
9364
+ function deserializeArrowWorkerResult(result) {
9365
+ if (!isDehydratedArrowTableWrapper(result)) {
9366
+ return result;
9367
+ }
9368
+ return { ...result, data: (0, import_arrow.hydrateArrowTable)(result.data) };
9340
9369
  }
9341
- function serializeArrowField(field) {
9342
- return {
9343
- name: field.name,
9344
- type: serializeArrowType(field.type),
9345
- nullable: field.nullable,
9346
- metadata: serializeArrowMetadata(field.metadata)
9347
- };
9370
+ function isArrowTableWrapper(value) {
9371
+ const table = value;
9372
+ return Boolean(
9373
+ table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
9374
+ );
9348
9375
  }
9349
- function deserializeArrowField(field, options) {
9350
- return new arrow.Field(
9351
- field.name,
9352
- deserializeArrowType(field.type, options),
9353
- field.nullable,
9354
- deserializeArrowMetadata(field.metadata)
9376
+ function isDehydratedArrowTableWrapper(value) {
9377
+ const table = value;
9378
+ return Boolean(
9379
+ table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
9355
9380
  );
9356
9381
  }
9357
- function serializeArrowType(arrowType) {
9358
- if (isArrowViewType(arrowType, "BinaryView")) {
9359
- return "binary-view";
9382
+ var import_arrow;
9383
+ var init_arrow_worker_transport = __esm({
9384
+ "../core/src/arrow-worker-transport.ts"() {
9385
+ "use strict";
9386
+ import_arrow = require("@math.gl/arrow");
9360
9387
  }
9361
- if (isArrowViewType(arrowType, "Utf8View")) {
9362
- return "utf8-view";
9388
+ });
9389
+
9390
+ // ../scene/src/draco/lib/utils/version.ts
9391
+ var VERSION4;
9392
+ var init_version4 = __esm({
9393
+ "../scene/src/draco/lib/utils/version.ts"() {
9394
+ "use strict";
9395
+ VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9363
9396
  }
9364
- if (isOptionalArrowType(arrowType, "LargeList")) {
9365
- const largeListType = arrowType;
9366
- return {
9367
- type: "large-list",
9368
- children: [serializeArrowField(largeListType.valueField)]
9397
+ });
9398
+
9399
+ // ../scene/src/draco/draco-format.ts
9400
+ var DracoFormat;
9401
+ var init_draco_format = __esm({
9402
+ "../scene/src/draco/draco-format.ts"() {
9403
+ "use strict";
9404
+ DracoFormat = {
9405
+ name: "Draco",
9406
+ id: "draco",
9407
+ module: "scene",
9408
+ encoding: "binary",
9409
+ format: "draco",
9410
+ extensions: ["drc"],
9411
+ mimeTypes: ["application/octet-stream"],
9412
+ binary: true,
9413
+ tests: ["DRACO"]
9369
9414
  };
9370
9415
  }
9371
- switch (arrowType.constructor) {
9372
- case arrow.Null:
9373
- return "null";
9374
- case arrow.Binary:
9375
- return "binary";
9376
- case arrow.FixedSizeBinary:
9377
- return {
9378
- type: "fixed-size-binary",
9379
- byteWidth: arrowType.byteWidth
9380
- };
9381
- case arrow.Bool:
9382
- return "bool";
9383
- case arrow.Int:
9384
- const intType = arrowType;
9385
- return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
9386
- case arrow.Int8:
9387
- return "int8";
9388
- case arrow.Int16:
9389
- return "int16";
9390
- case arrow.Int32:
9391
- return "int32";
9392
- case arrow.Int64:
9393
- return "int64";
9394
- case arrow.Uint8:
9395
- return "uint8";
9396
- case arrow.Uint16:
9397
- return "uint16";
9398
- case arrow.Uint32:
9399
- return "uint32";
9400
- case arrow.Uint64:
9401
- return "uint64";
9402
- case arrow.Float:
9403
- const precision = arrowType.precision;
9404
- switch (precision) {
9405
- case arrow.Precision.HALF:
9406
- return "float16";
9407
- case arrow.Precision.SINGLE:
9408
- return "float32";
9409
- case arrow.Precision.DOUBLE:
9410
- return "float64";
9411
- default:
9412
- return "float16";
9413
- }
9414
- case arrow.Float16:
9415
- return "float16";
9416
- case arrow.Float32:
9417
- return "float32";
9418
- case arrow.Float64:
9419
- return "float64";
9420
- case arrow.Utf8:
9421
- return "utf8";
9422
- case arrow.Decimal:
9423
- const decimal = arrowType;
9424
- return {
9425
- type: "decimal",
9426
- bitWidth: decimal.bitWidth,
9427
- precision: decimal.precision,
9428
- scale: decimal.scale
9429
- };
9430
- case arrow.Date_:
9431
- const dateUnit = arrowType.unit;
9432
- return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
9433
- case arrow.DateDay:
9434
- return "date-day";
9435
- case arrow.DateMillisecond:
9436
- return "date-millisecond";
9437
- case arrow.Time:
9438
- const timeUnit = arrowType.unit;
9439
- switch (timeUnit) {
9440
- case arrow.TimeUnit.SECOND:
9441
- return "time-second";
9442
- case arrow.TimeUnit.MILLISECOND:
9443
- return "time-millisecond";
9444
- case arrow.TimeUnit.MICROSECOND:
9445
- return "time-microsecond";
9446
- case arrow.TimeUnit.NANOSECOND:
9447
- return "time-nanosecond";
9448
- default:
9449
- return "time-second";
9450
- }
9451
- case arrow.TimeMillisecond:
9452
- return "time-millisecond";
9453
- case arrow.TimeSecond:
9454
- return "time-second";
9455
- case arrow.TimeMicrosecond:
9456
- return "time-microsecond";
9457
- case arrow.TimeNanosecond:
9458
- return "time-nanosecond";
9459
- case arrow.Timestamp:
9460
- const timeStampUnit = arrowType.unit;
9461
- switch (timeStampUnit) {
9462
- case arrow.TimeUnit.SECOND:
9463
- return "timestamp-second";
9464
- case arrow.TimeUnit.MILLISECOND:
9465
- return "timestamp-millisecond";
9466
- case arrow.TimeUnit.MICROSECOND:
9467
- return "timestamp-microsecond";
9468
- case arrow.TimeUnit.NANOSECOND:
9469
- return "timestamp-nanosecond";
9470
- default:
9471
- return "timestamp-second";
9472
- }
9473
- case arrow.TimestampSecond:
9474
- return "timestamp-second";
9475
- case arrow.TimestampMillisecond:
9476
- return "timestamp-millisecond";
9477
- case arrow.TimestampMicrosecond:
9478
- return "timestamp-microsecond";
9479
- case arrow.TimestampNanosecond:
9480
- return "timestamp-nanosecond";
9481
- case arrow.Interval:
9482
- const intervalUnit = arrowType.unit;
9483
- switch (intervalUnit) {
9484
- case arrow.IntervalUnit.DAY_TIME:
9485
- return "interval-daytime";
9486
- case arrow.IntervalUnit.YEAR_MONTH:
9487
- return "interval-yearmonth";
9488
- default:
9489
- return "interval-daytime";
9416
+ });
9417
+
9418
+ // ../scene/src/draco/draco-loader-options.ts
9419
+ var DRACO_LOADER_DEFAULT_OPTIONS;
9420
+ var init_draco_loader_options = __esm({
9421
+ "../scene/src/draco/draco-loader-options.ts"() {
9422
+ "use strict";
9423
+ DRACO_LOADER_DEFAULT_OPTIONS = {
9424
+ backend: typeof WebAssembly === "object" ? "wasm" : "javascript",
9425
+ extraAttributes: {},
9426
+ attributeNameEntry: void 0,
9427
+ shape: "arrow-table",
9428
+ decoderProfile: "full"
9429
+ };
9430
+ }
9431
+ });
9432
+
9433
+ // ../scene/src/draco/lib/draco-library-loader.ts
9434
+ async function loadLibrary2(libraryUrl, moduleName = null, options = {}, libraryName = null, moduleLibraryName = null) {
9435
+ var _a;
9436
+ if (isBrowser2 && options.useLocalLibraries && !options.CDN && libraryName && ((_a = options.modules) == null ? void 0 : _a[libraryName]) === void 0) {
9437
+ const directory = isWorker ? "./libs" : `modules/${moduleName}/dist/libs`;
9438
+ options = {
9439
+ ...options,
9440
+ modules: {
9441
+ [libraryName]: `${directory}/${libraryName}`,
9442
+ ...moduleLibraryName ? { [moduleLibraryName]: `${directory}/${moduleLibraryName}` } : {},
9443
+ ...options.modules
9490
9444
  }
9491
- case arrow.IntervalDayTime:
9492
- return "interval-daytime";
9493
- case arrow.IntervalYearMonth:
9494
- return "interval-yearmonth";
9495
- case arrow.Map_:
9496
- const mapType = arrowType;
9497
- return {
9498
- type: "map",
9499
- keysSorted: mapType.keysSorted,
9500
- children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
9501
- };
9502
- case arrow.List:
9503
- const listType = arrowType;
9504
- const listField = listType.valueField;
9505
- return {
9506
- type: "list",
9507
- children: [serializeArrowField(listField)]
9508
- };
9509
- case arrow.FixedSizeList:
9510
- const fixedSizeList = arrowType;
9511
- return {
9512
- type: "fixed-size-list",
9513
- listSize: fixedSizeList.listSize,
9514
- children: [serializeArrowField(fixedSizeList.children[0])]
9515
- };
9516
- case arrow.Struct:
9517
- const structType = arrowType;
9518
- return {
9519
- type: "struct",
9520
- children: structType.children.map((arrowField) => serializeArrowField(arrowField))
9521
- };
9522
- case arrow.SparseUnion:
9523
- case arrow.DenseUnion:
9524
- const unionType = arrowType;
9525
- return {
9526
- type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
9527
- typeIds: unionType.typeIds,
9528
- children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
9529
- typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
9530
- };
9531
- case arrow.Dictionary:
9532
- const dictionaryType = arrowType;
9533
- return {
9534
- type: "dictionary",
9535
- id: dictionaryType.id,
9536
- indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
9537
- dictionary: serializeArrowType(dictionaryType.dictionary),
9538
- isOrdered: dictionaryType.isOrdered
9539
- };
9540
- default:
9541
- throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
9445
+ };
9542
9446
  }
9447
+ return await loadLibrary(libraryUrl, moduleName, options, libraryName, moduleLibraryName);
9543
9448
  }
9544
- function deserializeArrowType(dataType, options) {
9545
- if (typeof dataType === "object") {
9546
- switch (dataType.type) {
9547
- case "decimal":
9548
- return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
9549
- case "map": {
9550
- const children = dataType.children.map(
9551
- (arrowField) => deserializeArrowField(arrowField, options)
9552
- );
9553
- return new arrow.Map_(children[0], dataType.keysSorted);
9554
- }
9555
- case "list": {
9556
- const field = deserializeArrowField(dataType.children[0], options);
9557
- return new arrow.List(field);
9558
- }
9559
- case "large-list": {
9560
- const field = deserializeArrowField(dataType.children[0], options);
9561
- const LargeList = getOptionalArrowConstructor("LargeList");
9562
- if (!LargeList) {
9563
- throw new Error(
9564
- "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
9565
- );
9566
- }
9567
- return new LargeList(field);
9568
- }
9569
- case "fixed-size-list": {
9570
- const child = deserializeArrowField(dataType.children[0], options);
9571
- return new arrow.FixedSizeList(dataType.listSize, child);
9572
- }
9573
- case "fixed-size-binary":
9574
- return new arrow.FixedSizeBinary(dataType.byteWidth);
9575
- case "struct": {
9576
- const children = dataType.children.map(
9577
- (arrowField) => deserializeArrowField(arrowField, options)
9578
- );
9579
- return new arrow.Struct(children);
9580
- }
9581
- case "sparse-union":
9582
- case "dense-union": {
9583
- const children = dataType.children.map(
9584
- (arrowField) => deserializeArrowField(arrowField, options)
9585
- );
9586
- return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
9587
- }
9588
- case "dictionary": {
9589
- return new arrow.Dictionary(
9590
- deserializeArrowType(dataType.dictionary, options),
9591
- deserializeArrowDictionaryKeyType(dataType.indices),
9592
- dataType.id,
9593
- dataType.isOrdered
9594
- );
9595
- }
9596
- default:
9597
- throw new Error("array type not supported");
9598
- }
9449
+ var init_draco_library_loader = __esm({
9450
+ "../scene/src/draco/lib/draco-library-loader.ts"() {
9451
+ "use strict";
9452
+ init_worker_utils();
9599
9453
  }
9600
- switch (dataType) {
9601
- case "null":
9602
- return new arrow.Null();
9603
- case "binary":
9604
- return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
9605
- case "binary-view":
9606
- return makeRequiredArrowViewType("BinaryView");
9607
- case "bool":
9608
- return new arrow.Bool();
9609
- case "int8":
9610
- return new arrow.Int8();
9611
- case "int16":
9612
- return new arrow.Int16();
9613
- case "int32":
9614
- return new arrow.Int32();
9615
- case "int64":
9616
- return new arrow.Int64();
9617
- case "uint8":
9618
- return new arrow.Uint8();
9619
- case "uint16":
9620
- return new arrow.Uint16();
9621
- case "uint32":
9622
- return new arrow.Uint32();
9623
- case "uint64":
9624
- return new arrow.Uint64();
9625
- case "float16":
9626
- return new arrow.Float16();
9627
- case "float32":
9628
- return new arrow.Float32();
9629
- case "float64":
9630
- return new arrow.Float64();
9631
- case "utf8":
9632
- return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
9633
- case "utf8-view":
9634
- return makeRequiredArrowViewType("Utf8View");
9635
- case "date-day":
9636
- return new arrow.DateDay();
9637
- case "date-millisecond":
9638
- return new arrow.DateMillisecond();
9639
- case "time-second":
9640
- return new arrow.TimeSecond();
9641
- case "time-millisecond":
9642
- return new arrow.TimeMillisecond();
9643
- case "time-microsecond":
9644
- return new arrow.TimeMicrosecond();
9645
- case "time-nanosecond":
9646
- return new arrow.TimeNanosecond();
9647
- case "timestamp-second":
9648
- return new arrow.TimestampSecond();
9649
- case "timestamp-millisecond":
9650
- return new arrow.TimestampMillisecond();
9651
- case "timestamp-microsecond":
9652
- return new arrow.TimestampMicrosecond();
9653
- case "timestamp-nanosecond":
9654
- return new arrow.TimestampNanosecond();
9655
- case "interval-daytime":
9656
- return new arrow.IntervalDayTime();
9657
- case "interval-yearmonth":
9658
- return new arrow.IntervalYearMonth();
9659
- default:
9660
- throw new Error("array type not supported");
9454
+ });
9455
+
9456
+ // ../scene/src/draco/draco-libraries.ts
9457
+ var DRACO_VERSION, DRACO_RELEASE_COMMIT, STATIC_DECODER_URL, STATIC_ENCODER_URL, DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS;
9458
+ var init_draco_libraries = __esm({
9459
+ "../scene/src/draco/draco-libraries.ts"() {
9460
+ "use strict";
9461
+ DRACO_VERSION = "1.5.7";
9462
+ DRACO_RELEASE_COMMIT = "8786740086a9f4d83f44aa83badfbea4dce7a1b5";
9463
+ STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}`;
9464
+ STATIC_ENCODER_URL = `https://cdn.jsdelivr.net/gh/google/draco@${DRACO_RELEASE_COMMIT}/javascript`;
9465
+ DRACO_EXTERNAL_LIBRARIES = {
9466
+ /** WebAssembly decoder JavaScript wrapper. */
9467
+ DECODER: "draco_wasm_wrapper.js",
9468
+ /** WebAssembly decoder binary. */
9469
+ DECODER_WASM: "draco_decoder.wasm",
9470
+ /** glTF-profile WebAssembly decoder JavaScript wrapper. */
9471
+ GLTF_DECODER: "draco_wasm_wrapper_gltf.js",
9472
+ /** glTF-profile WebAssembly decoder binary. */
9473
+ GLTF_DECODER_WASM: "draco_decoder_gltf.wasm",
9474
+ /** JavaScript decoder fallback. */
9475
+ FALLBACK_DECODER: "draco_decoder.js",
9476
+ /** WebAssembly encoder JavaScript wrapper. */
9477
+ ENCODER: "draco_encoder.js",
9478
+ /** WebAssembly encoder binary. */
9479
+ ENCODER_WASM: "draco_encoder.wasm"
9480
+ };
9481
+ DRACO_EXTERNAL_LIBRARY_URLS = {
9482
+ [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
9483
+ [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
9484
+ [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER}`,
9485
+ [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM}`,
9486
+ [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
9487
+ [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`,
9488
+ [DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM}`
9489
+ };
9661
9490
  }
9662
- }
9663
- function getOptionalArrowConstructor(typeName) {
9664
- return arrow[typeName];
9665
- }
9666
- function isArrowViewType(arrowType, viewTypeName) {
9667
- const constructor = getOptionalArrowConstructor(viewTypeName);
9668
- if (constructor && arrowType instanceof constructor) {
9669
- return true;
9491
+ });
9492
+
9493
+ // ../scene/src/draco/lib/draco-module-loader.ts
9494
+ async function loadDracoDecoderModule(options = {}, type, profile = "full") {
9495
+ const draco3DModule = getInjectedDraco3DModule(options);
9496
+ if (draco3DModule) {
9497
+ return await loadDracoDecoderModuleFromDraco3D(draco3DModule);
9670
9498
  }
9671
- const guards = arrow.DataType;
9672
- const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
9673
- return Boolean(guard == null ? void 0 : guard(arrowType));
9674
- }
9675
- function isOptionalArrowType(arrowType, typeName) {
9676
- const constructor = getOptionalArrowConstructor(typeName);
9677
- return Boolean(constructor && arrowType instanceof constructor);
9499
+ return await loadDracoDecoderModuleFromLibrary(
9500
+ options,
9501
+ type === "js" ? "javascript" : type,
9502
+ profile
9503
+ );
9678
9504
  }
9679
- function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
9680
- const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
9681
- if (viewTypeMode === "never") {
9682
- return fallbackType;
9683
- }
9684
- const constructor = getOptionalArrowConstructor(viewTypeName);
9685
- if (constructor) {
9686
- return new constructor();
9687
- }
9688
- if (viewTypeMode === "require") {
9689
- throw new Error(
9690
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
9691
- );
9505
+ async function loadDracoDecoderModuleFromLibrary(options = {}, type, profile = "full") {
9506
+ const cacheKey = getLibraryCacheKey2(`${type}:${profile}`, options);
9507
+ let decoderPromise2 = libraryDecoderPromises.get(cacheKey);
9508
+ if (!decoderPromise2) {
9509
+ decoderPromise2 = loadDracoDecoderWithFallback(options, type, profile);
9510
+ libraryDecoderPromises.set(cacheKey, decoderPromise2);
9692
9511
  }
9693
- return fallbackType;
9512
+ return await decoderPromise2;
9694
9513
  }
9695
- function makeRequiredArrowViewType(viewTypeName) {
9696
- const constructor = getOptionalArrowConstructor(viewTypeName);
9697
- if (!constructor) {
9698
- throw new Error(
9699
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
9514
+ async function loadDracoDecoderModuleFromDraco3D(draco3DModule) {
9515
+ const typedDraco3DModule = validateDracoDecoderModule(draco3DModule);
9516
+ let decoderPromise2 = injectedDecoderPromises.get(typedDraco3DModule);
9517
+ if (!decoderPromise2) {
9518
+ decoderPromise2 = initializeWasmModule(
9519
+ () => typedDraco3DModule.createDecoderModule({}),
9520
+ (draco) => ({ draco })
9700
9521
  );
9522
+ injectedDecoderPromises.set(typedDraco3DModule, decoderPromise2);
9701
9523
  }
9702
- return new constructor();
9524
+ return await decoderPromise2;
9703
9525
  }
9704
- function serializeArrowDictionaryKeyType(arrowType) {
9705
- if (arrowType instanceof arrow.Int) {
9706
- const prefix = arrowType.isSigned ? "int" : "uint";
9707
- const keyType = `${prefix}${arrowType.bitWidth}`;
9708
- if (isSchemaDictionaryKeyType(keyType)) {
9709
- return keyType;
9526
+ async function loadDracoDecoderWithFallback(options, type, profile) {
9527
+ try {
9528
+ return await loadDracoDecoder(options, type, profile);
9529
+ } catch (wasmError) {
9530
+ if (type === "javascript") {
9531
+ throw wasmError;
9532
+ }
9533
+ try {
9534
+ return await loadDracoDecoder(options, "javascript", "full");
9535
+ } catch (javascriptError) {
9536
+ throw new AggregateError(
9537
+ [wasmError, javascriptError],
9538
+ "Draco decoder could not load either the WebAssembly or JavaScript backend"
9539
+ );
9710
9540
  }
9711
9541
  }
9712
- switch (arrowType.constructor) {
9713
- case arrow.Int8:
9714
- return "int8";
9715
- case arrow.Int16:
9716
- return "int16";
9717
- case arrow.Int32:
9718
- return "int32";
9719
- case arrow.Uint8:
9720
- return "uint8";
9721
- case arrow.Uint16:
9722
- return "uint16";
9723
- case arrow.Uint32:
9724
- return "uint32";
9725
- default:
9726
- throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
9542
+ }
9543
+ async function loadDracoDecoder(options, type, profile) {
9544
+ const initialization = decoderInitializationQueue.then(
9545
+ () => loadDracoDecoderInternal(options, type, profile)
9546
+ );
9547
+ decoderInitializationQueue = initialization.then(
9548
+ () => void 0,
9549
+ () => void 0
9550
+ );
9551
+ return await initialization;
9552
+ }
9553
+ async function loadDracoDecoderInternal(options, type, profile) {
9554
+ if (type === "javascript") {
9555
+ let decoderLibrary2;
9556
+ try {
9557
+ decoderLibrary2 = await loadLibrary2(
9558
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
9559
+ "scene",
9560
+ options,
9561
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
9562
+ "draco_decoder.mjs"
9563
+ );
9564
+ } catch (error) {
9565
+ if (isBrowser2 || options.useLocalLibraries) {
9566
+ throw error;
9567
+ }
9568
+ decoderLibrary2 = await loadLibrary2(
9569
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
9570
+ "scene",
9571
+ { ...options, useLocalLibraries: true },
9572
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
9573
+ "draco_decoder.mjs"
9574
+ );
9575
+ }
9576
+ const decoderInitializer2 = getLibraryExport(decoderLibrary2, "DracoDecoderModule") || globalThis.DracoDecoderModule;
9577
+ return await initializeDracoModule(decoderInitializer2);
9578
+ }
9579
+ let decoderLibrary;
9580
+ let wasmBinary;
9581
+ try {
9582
+ [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(options, profile);
9583
+ } catch (error) {
9584
+ if (isBrowser2 || options.useLocalLibraries) {
9585
+ throw error;
9586
+ }
9587
+ [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(
9588
+ { ...options, useLocalLibraries: true },
9589
+ profile
9590
+ );
9727
9591
  }
9592
+ const decoderInitializer = getLibraryExport(decoderLibrary, "DracoDecoderModule") || globalThis.DracoDecoderModule;
9593
+ return await initializeDracoModule(decoderInitializer, wasmBinary);
9728
9594
  }
9729
- function isSchemaDictionaryKeyType(keyType) {
9730
- return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
9595
+ async function loadDecoderWasmAssets(options, profile) {
9596
+ const decoderLibrary = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER : DRACO_EXTERNAL_LIBRARIES.DECODER;
9597
+ const decoderWasm = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM : DRACO_EXTERNAL_LIBRARIES.DECODER_WASM;
9598
+ return await Promise.all([
9599
+ loadLibrary2(
9600
+ DRACO_EXTERNAL_LIBRARY_URLS[decoderLibrary],
9601
+ "scene",
9602
+ options,
9603
+ decoderLibrary,
9604
+ profile === "gltf" ? "draco_wasm_wrapper_gltf.mjs" : "draco_wasm_wrapper.mjs"
9605
+ ),
9606
+ loadLibrary2(
9607
+ DRACO_EXTERNAL_LIBRARY_URLS[decoderWasm],
9608
+ "scene",
9609
+ options,
9610
+ decoderWasm
9611
+ )
9612
+ ]);
9731
9613
  }
9732
- function deserializeArrowDictionaryKeyType(keyType) {
9733
- switch (keyType) {
9734
- case "int8":
9735
- return new arrow.Int8();
9736
- case "int16":
9737
- return new arrow.Int16();
9738
- case "int32":
9739
- return new arrow.Int32();
9740
- case "uint8":
9741
- return new arrow.Uint8();
9742
- case "uint16":
9743
- return new arrow.Uint16();
9744
- case "uint32":
9745
- return new arrow.Uint32();
9746
- default:
9747
- throw new Error(`schema dictionary index type not supported: ${keyType}`);
9614
+ function initializeDracoModule(initializer, wasmBinary) {
9615
+ if (typeof initializer !== "function") {
9616
+ throw new Error("Draco module initializer could not be loaded");
9617
+ }
9618
+ return initializeWasmModule(
9619
+ (onInitialized) => initializer({
9620
+ ...wasmBinary ? { wasmBinary } : {},
9621
+ onModuleLoaded: onInitialized
9622
+ }),
9623
+ (draco) => ({ draco })
9624
+ );
9625
+ }
9626
+ function getLibraryExport(library, exportName) {
9627
+ if (typeof library === "function") {
9628
+ return library;
9629
+ }
9630
+ if (library && typeof library === "object") {
9631
+ const exports = library;
9632
+ const exportedInitializer = exports[exportName] || exports.default;
9633
+ return typeof exportedInitializer === "function" ? exportedInitializer : void 0;
9748
9634
  }
9635
+ return void 0;
9749
9636
  }
9750
- var arrow;
9751
- var init_convert_arrow_schema = __esm({
9752
- "../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
9637
+ function getInjectedDraco3DModule(options) {
9638
+ var _a;
9639
+ const module2 = (_a = options.modules) == null ? void 0 : _a.draco3d;
9640
+ if (!module2) {
9641
+ return void 0;
9642
+ }
9643
+ if (typeof module2 !== "object" && typeof module2 !== "function") {
9644
+ throw new Error("Invalid draco3d module");
9645
+ }
9646
+ return module2;
9647
+ }
9648
+ function validateDracoDecoderModule(module2) {
9649
+ const typedModule = module2;
9650
+ if (typeof (typedModule == null ? void 0 : typedModule.createDecoderModule) !== "function") {
9651
+ throw new Error("Invalid draco3d decoder module");
9652
+ }
9653
+ return typedModule;
9654
+ }
9655
+ function getLibraryCacheKey2(type, options) {
9656
+ const libraryOverrides = Object.entries(options.modules || {}).filter(([name22]) => name22 !== "draco3d").map(([name22, value]) => `${name22}:${String(value)}`).sort().join("|");
9657
+ return [
9658
+ type,
9659
+ options.useLocalLibraries ? "local" : "remote",
9660
+ options.CDN || "",
9661
+ libraryOverrides
9662
+ ].join("|");
9663
+ }
9664
+ var libraryDecoderPromises, injectedDecoderPromises, decoderInitializationQueue;
9665
+ var init_draco_module_loader = __esm({
9666
+ "../scene/src/draco/lib/draco-module-loader.ts"() {
9753
9667
  "use strict";
9754
- arrow = __toESM(require("apache-arrow"), 1);
9668
+ init_loader_utils();
9669
+ init_draco_library_loader();
9670
+ init_draco_libraries();
9671
+ libraryDecoderPromises = /* @__PURE__ */ new Map();
9672
+ injectedDecoderPromises = /* @__PURE__ */ new WeakMap();
9673
+ decoderInitializationQueue = Promise.resolve();
9755
9674
  }
9756
9675
  });
9757
9676
 
9758
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
9759
- function splitArrowBuffers(input, options = {}) {
9760
- const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
9761
- if (isArrowTable(input)) {
9762
- return splitArrowTableBuffersInternal(input, context);
9677
+ // ../core/src/schema-utils/lib/schema/data-type.ts
9678
+ function getDataTypeFromValue(value, defaultNumberType = "float32") {
9679
+ if (value instanceof Date) {
9680
+ return "date-millisecond";
9763
9681
  }
9764
- if (isArrowRecordBatch(input)) {
9765
- return splitArrowRecordBatchBuffers(input, context);
9682
+ if (typeof value === "number") {
9683
+ return defaultNumberType;
9766
9684
  }
9767
- if (isArrowVector(input)) {
9768
- return splitArrowVectorBuffers(input, context);
9685
+ if (typeof value === "boolean") {
9686
+ return "bool";
9769
9687
  }
9770
- return splitArrowDataBuffers(input, context);
9771
- }
9772
- function isArrowTable(input) {
9773
- return "batches" in input;
9774
- }
9775
- function isArrowRecordBatch(input) {
9776
- return "schema" in input && "data" in input && !Array.isArray(input.data);
9777
- }
9778
- function isArrowVector(input) {
9779
- return "data" in input && Array.isArray(input.data);
9780
- }
9781
- function splitArrowTableBuffersInternal(table, options) {
9782
- const recordBatches = table.batches.map(
9783
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
9784
- );
9785
- return new arrow2.Table(table.schema, recordBatches);
9786
- }
9787
- function splitArrowRecordBatchBuffers(recordBatch, options) {
9788
- return new arrow2.RecordBatch(
9789
- recordBatch.schema,
9790
- splitArrowDataBuffers(recordBatch.data, options)
9791
- );
9792
- }
9793
- function splitArrowDataBuffers(data, options) {
9794
- const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
9795
- const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
9796
- const buffers = {
9797
- [arrow2.BufferType.OFFSET]: splitArrowBuffer(data.buffers[arrow2.BufferType.OFFSET], options),
9798
- [arrow2.BufferType.DATA]: splitArrowBuffer(data.buffers[arrow2.BufferType.DATA], options),
9799
- [arrow2.BufferType.VALIDITY]: splitArrowBuffer(data.buffers[arrow2.BufferType.VALIDITY], options),
9800
- [arrow2.BufferType.TYPE]: splitArrowBuffer(data.buffers[arrow2.BufferType.TYPE], options)
9801
- };
9802
- return new arrow2.Data(
9803
- data.type,
9804
- data.offset,
9805
- data.length,
9806
- // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
9807
- data._nullCount,
9808
- buffers,
9809
- children,
9810
- dictionary
9811
- );
9812
- }
9813
- function splitArrowVectorBuffers(vector, options) {
9814
- return new arrow2.Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
9815
- }
9816
- function splitArrowBuffer(array, options) {
9817
- if (!isArrowTypedArray(array)) {
9818
- return array;
9688
+ if (typeof value === "string") {
9689
+ return "utf8";
9819
9690
  }
9820
- if (options.copy === "none") {
9821
- return array;
9691
+ if (value === null || value === "undefined") {
9692
+ return "null";
9822
9693
  }
9823
- if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
9824
- return array;
9694
+ return "null";
9695
+ }
9696
+ function getDataTypeFromArray(array) {
9697
+ let type = getDataTypeFromTypedArray(array);
9698
+ if (type !== "null") {
9699
+ return { type, nullable: false };
9825
9700
  }
9826
- let copy = options.copies.get(array);
9827
- if (!copy) {
9828
- copy = array.slice();
9829
- options.copies.set(array, copy);
9701
+ if (array.length > 0) {
9702
+ type = getDataTypeFromValue(array[0]);
9703
+ return { type, nullable: true };
9830
9704
  }
9831
- return copy;
9705
+ return { type: "null", nullable: true };
9832
9706
  }
9833
- function isArrowTypedArray(value) {
9834
- return ArrayBuffer.isView(value) && !(value instanceof DataView);
9707
+ function getDataTypeFromTypedArray(array) {
9708
+ if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
9709
+ return "float16";
9710
+ }
9711
+ switch (array.constructor) {
9712
+ case Int8Array:
9713
+ return "int8";
9714
+ case Uint8Array:
9715
+ case Uint8ClampedArray:
9716
+ return "uint8";
9717
+ case Int16Array:
9718
+ return "int16";
9719
+ case Uint16Array:
9720
+ return "uint16";
9721
+ case Int32Array:
9722
+ return "int32";
9723
+ case Uint32Array:
9724
+ return "uint32";
9725
+ case BigInt64Array:
9726
+ return "int64";
9727
+ case BigUint64Array:
9728
+ return "uint64";
9729
+ case Float32Array:
9730
+ return "float32";
9731
+ case Float64Array:
9732
+ return "float64";
9733
+ default:
9734
+ return "null";
9735
+ }
9835
9736
  }
9836
- var arrow2;
9837
- var init_split_arrow_buffers = __esm({
9838
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
9737
+ var import_core;
9738
+ var init_data_type = __esm({
9739
+ "../core/src/schema-utils/lib/schema/data-type.ts"() {
9839
9740
  "use strict";
9840
- arrow2 = __toESM(require("apache-arrow"), 1);
9741
+ import_core = require("@math.gl/core");
9841
9742
  }
9842
9743
  });
9843
9744
 
9844
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
9845
- function dehydrateArrowTable(table, options) {
9846
- const splitTable = splitArrowBuffers(table, options);
9745
+ // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
9746
+ function serializeArrowSchema(arrowSchema) {
9847
9747
  return {
9848
- shape: "arrow-table",
9849
- transport: "arrow-js",
9850
- schema: serializeArrowSchema(splitTable.schema),
9851
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
9748
+ fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
9749
+ metadata: serializeArrowMetadata(arrowSchema.metadata)
9852
9750
  };
9853
9751
  }
9854
- function hydrateArrowTable(table) {
9855
- const schema = deserializeArrowSchema(table.schema);
9856
- const recordBatches = table.batches.map(
9857
- (recordBatch) => new arrow3.RecordBatch(schema, hydrateArrowData(recordBatch.data))
9858
- );
9859
- return new arrow3.Table(schema, recordBatches);
9860
- }
9861
- function serializeArrowWorkerResult(result, options) {
9862
- var _a;
9863
- if (!isArrowTableWrapper(result)) {
9864
- return result;
9865
- }
9866
- const workerOptions = options;
9867
- const bufferCopyMode = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
9868
- return {
9869
- ...result,
9870
- data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
9871
- };
9872
- }
9873
- function deserializeArrowWorkerResult(result) {
9874
- if (!isDehydratedArrowTableWrapper(result)) {
9875
- return result;
9876
- }
9877
- return { ...result, data: hydrateArrowTable(result.data) };
9878
- }
9879
- function isArrowTableWrapper(value) {
9880
- const table = value;
9881
- return Boolean(
9882
- table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
9883
- );
9884
- }
9885
- function isDehydratedArrowTableWrapper(value) {
9886
- const table = value;
9887
- return Boolean(
9888
- table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
9889
- );
9752
+ function serializeArrowMetadata(arrowMetadata) {
9753
+ return Object.fromEntries(arrowMetadata);
9890
9754
  }
9891
- function dehydrateArrowRecordBatch(recordBatch) {
9892
- return { data: dehydrateArrowData(recordBatch.data) };
9755
+ function deserializeArrowMetadata(metadata) {
9756
+ return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
9893
9757
  }
9894
- function dehydrateArrowData(data) {
9758
+ function serializeArrowField(field) {
9895
9759
  return {
9896
- type: serializeArrowType(data.type),
9897
- offset: data.offset,
9898
- length: data.length,
9899
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
9900
- nullCount: data._nullCount,
9901
- buffers: {
9902
- [arrow3.BufferType.OFFSET]: data.buffers[arrow3.BufferType.OFFSET],
9903
- [arrow3.BufferType.DATA]: data.buffers[arrow3.BufferType.DATA],
9904
- [arrow3.BufferType.VALIDITY]: data.buffers[arrow3.BufferType.VALIDITY],
9905
- [arrow3.BufferType.TYPE]: data.buffers[arrow3.BufferType.TYPE]
9906
- },
9907
- children: data.children.map((childData) => dehydrateArrowData(childData)),
9908
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
9760
+ name: field.name,
9761
+ type: serializeArrowType(field.type),
9762
+ nullable: field.nullable,
9763
+ metadata: serializeArrowMetadata(field.metadata)
9909
9764
  };
9910
9765
  }
9911
- function dehydrateArrowVector(vector) {
9912
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
9913
- }
9914
- function hydrateArrowData(data) {
9915
- const children = data.children.map((childData) => hydrateArrowData(childData));
9916
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
9917
- return new arrow3.Data(
9918
- deserializeArrowType(data.type),
9919
- data.offset,
9920
- data.length,
9921
- data.nullCount,
9922
- data.buffers,
9923
- children,
9924
- dictionary
9766
+ function deserializeArrowField(field, options) {
9767
+ return new arrow.Field(
9768
+ field.name,
9769
+ deserializeArrowType(field.type, options),
9770
+ field.nullable,
9771
+ deserializeArrowMetadata(field.metadata)
9925
9772
  );
9926
9773
  }
9927
- function hydrateArrowVector(vector) {
9928
- return new arrow3.Vector(vector.data.map((data) => hydrateArrowData(data)));
9929
- }
9930
- var arrow3;
9931
- var init_arrow_table_transport = __esm({
9932
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
9933
- "use strict";
9934
- arrow3 = __toESM(require("apache-arrow"), 1);
9935
- init_convert_arrow_schema();
9936
- init_split_arrow_buffers();
9937
- }
9938
- });
9939
-
9940
- // ../core/src/schema-utils/arrow-transport.ts
9941
- var init_arrow_transport = __esm({
9942
- "../core/src/schema-utils/arrow-transport.ts"() {
9943
- "use strict";
9944
- init_arrow_table_transport();
9945
- init_split_arrow_buffers();
9946
- }
9947
- });
9948
-
9949
- // ../scene/src/draco/lib/utils/version.ts
9950
- var VERSION4;
9951
- var init_version4 = __esm({
9952
- "../scene/src/draco/lib/utils/version.ts"() {
9953
- "use strict";
9954
- VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9774
+ function serializeArrowType(arrowType) {
9775
+ if (isArrowViewType(arrowType, "BinaryView")) {
9776
+ return "binary-view";
9955
9777
  }
9956
- });
9957
-
9958
- // ../scene/src/draco/draco-format.ts
9959
- var DracoFormat;
9960
- var init_draco_format = __esm({
9961
- "../scene/src/draco/draco-format.ts"() {
9962
- "use strict";
9963
- DracoFormat = {
9964
- name: "Draco",
9965
- id: "draco",
9966
- module: "scene",
9967
- encoding: "binary",
9968
- format: "draco",
9969
- extensions: ["drc"],
9970
- mimeTypes: ["application/octet-stream"],
9971
- binary: true,
9972
- tests: ["DRACO"]
9973
- };
9778
+ if (isArrowViewType(arrowType, "Utf8View")) {
9779
+ return "utf8-view";
9974
9780
  }
9975
- });
9976
-
9977
- // ../scene/src/draco/draco-loader-options.ts
9978
- var DRACO_LOADER_DEFAULT_OPTIONS;
9979
- var init_draco_loader_options = __esm({
9980
- "../scene/src/draco/draco-loader-options.ts"() {
9981
- "use strict";
9982
- DRACO_LOADER_DEFAULT_OPTIONS = {
9983
- backend: typeof WebAssembly === "object" ? "wasm" : "javascript",
9984
- extraAttributes: {},
9985
- attributeNameEntry: void 0,
9986
- shape: "arrow-table",
9987
- decoderProfile: "full"
9781
+ if (isOptionalArrowType(arrowType, "LargeList")) {
9782
+ const largeListType = arrowType;
9783
+ return {
9784
+ type: "large-list",
9785
+ children: [serializeArrowField(largeListType.valueField)]
9988
9786
  };
9989
9787
  }
9990
- });
9991
-
9992
- // ../scene/src/draco/lib/draco-library-loader.ts
9993
- async function loadLibrary2(libraryUrl, moduleName = null, options = {}, libraryName = null, moduleLibraryName = null) {
9994
- var _a;
9995
- if (isBrowser2 && options.useLocalLibraries && !options.CDN && libraryName && ((_a = options.modules) == null ? void 0 : _a[libraryName]) === void 0) {
9996
- const directory = isWorker ? "./libs" : `modules/${moduleName}/dist/libs`;
9997
- options = {
9998
- ...options,
9999
- modules: {
10000
- [libraryName]: `${directory}/${libraryName}`,
10001
- ...moduleLibraryName ? { [moduleLibraryName]: `${directory}/${moduleLibraryName}` } : {},
10002
- ...options.modules
9788
+ switch (arrowType.constructor) {
9789
+ case arrow.Null:
9790
+ return "null";
9791
+ case arrow.Binary:
9792
+ return "binary";
9793
+ case arrow.FixedSizeBinary:
9794
+ return {
9795
+ type: "fixed-size-binary",
9796
+ byteWidth: arrowType.byteWidth
9797
+ };
9798
+ case arrow.Bool:
9799
+ return "bool";
9800
+ case arrow.Int:
9801
+ const intType = arrowType;
9802
+ return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
9803
+ case arrow.Int8:
9804
+ return "int8";
9805
+ case arrow.Int16:
9806
+ return "int16";
9807
+ case arrow.Int32:
9808
+ return "int32";
9809
+ case arrow.Int64:
9810
+ return "int64";
9811
+ case arrow.Uint8:
9812
+ return "uint8";
9813
+ case arrow.Uint16:
9814
+ return "uint16";
9815
+ case arrow.Uint32:
9816
+ return "uint32";
9817
+ case arrow.Uint64:
9818
+ return "uint64";
9819
+ case arrow.Float:
9820
+ const precision = arrowType.precision;
9821
+ switch (precision) {
9822
+ case arrow.Precision.HALF:
9823
+ return "float16";
9824
+ case arrow.Precision.SINGLE:
9825
+ return "float32";
9826
+ case arrow.Precision.DOUBLE:
9827
+ return "float64";
9828
+ default:
9829
+ return "float16";
10003
9830
  }
10004
- };
10005
- }
10006
- return await loadLibrary(libraryUrl, moduleName, options, libraryName, moduleLibraryName);
10007
- }
10008
- var init_draco_library_loader = __esm({
10009
- "../scene/src/draco/lib/draco-library-loader.ts"() {
10010
- "use strict";
10011
- init_worker_utils();
10012
- }
10013
- });
10014
-
10015
- // ../scene/src/draco/draco-libraries.ts
10016
- var DRACO_VERSION, DRACO_RELEASE_COMMIT, STATIC_DECODER_URL, STATIC_ENCODER_URL, DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS;
10017
- var init_draco_libraries = __esm({
10018
- "../scene/src/draco/draco-libraries.ts"() {
10019
- "use strict";
10020
- DRACO_VERSION = "1.5.7";
10021
- DRACO_RELEASE_COMMIT = "8786740086a9f4d83f44aa83badfbea4dce7a1b5";
10022
- STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}`;
10023
- STATIC_ENCODER_URL = `https://cdn.jsdelivr.net/gh/google/draco@${DRACO_RELEASE_COMMIT}/javascript`;
10024
- DRACO_EXTERNAL_LIBRARIES = {
10025
- /** WebAssembly decoder JavaScript wrapper. */
10026
- DECODER: "draco_wasm_wrapper.js",
10027
- /** WebAssembly decoder binary. */
10028
- DECODER_WASM: "draco_decoder.wasm",
10029
- /** glTF-profile WebAssembly decoder JavaScript wrapper. */
10030
- GLTF_DECODER: "draco_wasm_wrapper_gltf.js",
10031
- /** glTF-profile WebAssembly decoder binary. */
10032
- GLTF_DECODER_WASM: "draco_decoder_gltf.wasm",
10033
- /** JavaScript decoder fallback. */
10034
- FALLBACK_DECODER: "draco_decoder.js",
10035
- /** WebAssembly encoder JavaScript wrapper. */
10036
- ENCODER: "draco_encoder.js",
10037
- /** WebAssembly encoder binary. */
10038
- ENCODER_WASM: "draco_encoder.wasm"
10039
- };
10040
- DRACO_EXTERNAL_LIBRARY_URLS = {
10041
- [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
10042
- [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
10043
- [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER}`,
10044
- [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM}`,
10045
- [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
10046
- [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`,
10047
- [DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM}`
10048
- };
10049
- }
10050
- });
10051
-
10052
- // ../scene/src/draco/lib/draco-module-loader.ts
10053
- async function loadDracoDecoderModule(options = {}, type, profile = "full") {
10054
- const draco3DModule = getInjectedDraco3DModule(options);
10055
- if (draco3DModule) {
10056
- return await loadDracoDecoderModuleFromDraco3D(draco3DModule);
10057
- }
10058
- return await loadDracoDecoderModuleFromLibrary(
10059
- options,
10060
- type === "js" ? "javascript" : type,
10061
- profile
10062
- );
10063
- }
10064
- async function loadDracoDecoderModuleFromLibrary(options = {}, type, profile = "full") {
10065
- const cacheKey = getLibraryCacheKey2(`${type}:${profile}`, options);
10066
- let decoderPromise2 = libraryDecoderPromises.get(cacheKey);
10067
- if (!decoderPromise2) {
10068
- decoderPromise2 = loadDracoDecoderWithFallback(options, type, profile);
10069
- libraryDecoderPromises.set(cacheKey, decoderPromise2);
10070
- }
10071
- return await decoderPromise2;
10072
- }
10073
- async function loadDracoDecoderModuleFromDraco3D(draco3DModule) {
10074
- const typedDraco3DModule = validateDracoDecoderModule(draco3DModule);
10075
- let decoderPromise2 = injectedDecoderPromises.get(typedDraco3DModule);
10076
- if (!decoderPromise2) {
10077
- decoderPromise2 = initializeWasmModule(
10078
- () => typedDraco3DModule.createDecoderModule({}),
10079
- (draco) => ({ draco })
10080
- );
10081
- injectedDecoderPromises.set(typedDraco3DModule, decoderPromise2);
10082
- }
10083
- return await decoderPromise2;
10084
- }
10085
- async function loadDracoDecoderWithFallback(options, type, profile) {
10086
- try {
10087
- return await loadDracoDecoder(options, type, profile);
10088
- } catch (wasmError) {
10089
- if (type === "javascript") {
10090
- throw wasmError;
10091
- }
10092
- try {
10093
- return await loadDracoDecoder(options, "javascript", "full");
10094
- } catch (javascriptError) {
10095
- throw new AggregateError(
10096
- [wasmError, javascriptError],
10097
- "Draco decoder could not load either the WebAssembly or JavaScript backend"
10098
- );
10099
- }
10100
- }
10101
- }
10102
- async function loadDracoDecoder(options, type, profile) {
10103
- const initialization = decoderInitializationQueue.then(
10104
- () => loadDracoDecoderInternal(options, type, profile)
10105
- );
10106
- decoderInitializationQueue = initialization.then(
10107
- () => void 0,
10108
- () => void 0
10109
- );
10110
- return await initialization;
10111
- }
10112
- async function loadDracoDecoderInternal(options, type, profile) {
10113
- if (type === "javascript") {
10114
- let decoderLibrary2;
10115
- try {
10116
- decoderLibrary2 = await loadLibrary2(
10117
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
10118
- "scene",
10119
- options,
10120
- DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
10121
- "draco_decoder.mjs"
10122
- );
10123
- } catch (error) {
10124
- if (isBrowser2 || options.useLocalLibraries) {
10125
- throw error;
9831
+ case arrow.Float16:
9832
+ return "float16";
9833
+ case arrow.Float32:
9834
+ return "float32";
9835
+ case arrow.Float64:
9836
+ return "float64";
9837
+ case arrow.Utf8:
9838
+ return "utf8";
9839
+ case arrow.Decimal:
9840
+ const decimal = arrowType;
9841
+ return {
9842
+ type: "decimal",
9843
+ bitWidth: decimal.bitWidth,
9844
+ precision: decimal.precision,
9845
+ scale: decimal.scale
9846
+ };
9847
+ case arrow.Date_:
9848
+ const dateUnit = arrowType.unit;
9849
+ return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
9850
+ case arrow.DateDay:
9851
+ return "date-day";
9852
+ case arrow.DateMillisecond:
9853
+ return "date-millisecond";
9854
+ case arrow.Time:
9855
+ const timeUnit = arrowType.unit;
9856
+ switch (timeUnit) {
9857
+ case arrow.TimeUnit.SECOND:
9858
+ return "time-second";
9859
+ case arrow.TimeUnit.MILLISECOND:
9860
+ return "time-millisecond";
9861
+ case arrow.TimeUnit.MICROSECOND:
9862
+ return "time-microsecond";
9863
+ case arrow.TimeUnit.NANOSECOND:
9864
+ return "time-nanosecond";
9865
+ default:
9866
+ return "time-second";
10126
9867
  }
10127
- decoderLibrary2 = await loadLibrary2(
10128
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
10129
- "scene",
10130
- { ...options, useLocalLibraries: true },
10131
- DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
10132
- "draco_decoder.mjs"
10133
- );
10134
- }
10135
- const decoderInitializer2 = getLibraryExport(decoderLibrary2, "DracoDecoderModule") || globalThis.DracoDecoderModule;
10136
- return await initializeDracoModule(decoderInitializer2);
10137
- }
10138
- let decoderLibrary;
10139
- let wasmBinary;
10140
- try {
10141
- [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(options, profile);
10142
- } catch (error) {
10143
- if (isBrowser2 || options.useLocalLibraries) {
10144
- throw error;
10145
- }
10146
- [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(
10147
- { ...options, useLocalLibraries: true },
10148
- profile
10149
- );
10150
- }
10151
- const decoderInitializer = getLibraryExport(decoderLibrary, "DracoDecoderModule") || globalThis.DracoDecoderModule;
10152
- return await initializeDracoModule(decoderInitializer, wasmBinary);
10153
- }
10154
- async function loadDecoderWasmAssets(options, profile) {
10155
- const decoderLibrary = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER : DRACO_EXTERNAL_LIBRARIES.DECODER;
10156
- const decoderWasm = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM : DRACO_EXTERNAL_LIBRARIES.DECODER_WASM;
10157
- return await Promise.all([
10158
- loadLibrary2(
10159
- DRACO_EXTERNAL_LIBRARY_URLS[decoderLibrary],
10160
- "scene",
10161
- options,
10162
- decoderLibrary,
10163
- profile === "gltf" ? "draco_wasm_wrapper_gltf.mjs" : "draco_wasm_wrapper.mjs"
10164
- ),
10165
- loadLibrary2(
10166
- DRACO_EXTERNAL_LIBRARY_URLS[decoderWasm],
10167
- "scene",
10168
- options,
10169
- decoderWasm
10170
- )
10171
- ]);
10172
- }
10173
- function initializeDracoModule(initializer, wasmBinary) {
10174
- if (typeof initializer !== "function") {
10175
- throw new Error("Draco module initializer could not be loaded");
9868
+ case arrow.TimeMillisecond:
9869
+ return "time-millisecond";
9870
+ case arrow.TimeSecond:
9871
+ return "time-second";
9872
+ case arrow.TimeMicrosecond:
9873
+ return "time-microsecond";
9874
+ case arrow.TimeNanosecond:
9875
+ return "time-nanosecond";
9876
+ case arrow.Timestamp:
9877
+ const timeStampUnit = arrowType.unit;
9878
+ switch (timeStampUnit) {
9879
+ case arrow.TimeUnit.SECOND:
9880
+ return "timestamp-second";
9881
+ case arrow.TimeUnit.MILLISECOND:
9882
+ return "timestamp-millisecond";
9883
+ case arrow.TimeUnit.MICROSECOND:
9884
+ return "timestamp-microsecond";
9885
+ case arrow.TimeUnit.NANOSECOND:
9886
+ return "timestamp-nanosecond";
9887
+ default:
9888
+ return "timestamp-second";
9889
+ }
9890
+ case arrow.TimestampSecond:
9891
+ return "timestamp-second";
9892
+ case arrow.TimestampMillisecond:
9893
+ return "timestamp-millisecond";
9894
+ case arrow.TimestampMicrosecond:
9895
+ return "timestamp-microsecond";
9896
+ case arrow.TimestampNanosecond:
9897
+ return "timestamp-nanosecond";
9898
+ case arrow.Interval:
9899
+ const intervalUnit = arrowType.unit;
9900
+ switch (intervalUnit) {
9901
+ case arrow.IntervalUnit.DAY_TIME:
9902
+ return "interval-daytime";
9903
+ case arrow.IntervalUnit.YEAR_MONTH:
9904
+ return "interval-yearmonth";
9905
+ default:
9906
+ return "interval-daytime";
9907
+ }
9908
+ case arrow.IntervalDayTime:
9909
+ return "interval-daytime";
9910
+ case arrow.IntervalYearMonth:
9911
+ return "interval-yearmonth";
9912
+ case arrow.Map_:
9913
+ const mapType = arrowType;
9914
+ return {
9915
+ type: "map",
9916
+ keysSorted: mapType.keysSorted,
9917
+ children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
9918
+ };
9919
+ case arrow.List:
9920
+ const listType = arrowType;
9921
+ const listField = listType.valueField;
9922
+ return {
9923
+ type: "list",
9924
+ children: [serializeArrowField(listField)]
9925
+ };
9926
+ case arrow.FixedSizeList:
9927
+ const fixedSizeList = arrowType;
9928
+ return {
9929
+ type: "fixed-size-list",
9930
+ listSize: fixedSizeList.listSize,
9931
+ children: [serializeArrowField(fixedSizeList.children[0])]
9932
+ };
9933
+ case arrow.Struct:
9934
+ const structType = arrowType;
9935
+ return {
9936
+ type: "struct",
9937
+ children: structType.children.map((arrowField) => serializeArrowField(arrowField))
9938
+ };
9939
+ case arrow.SparseUnion:
9940
+ case arrow.DenseUnion:
9941
+ const unionType = arrowType;
9942
+ return {
9943
+ type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
9944
+ typeIds: unionType.typeIds,
9945
+ children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
9946
+ typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
9947
+ };
9948
+ case arrow.Dictionary:
9949
+ const dictionaryType = arrowType;
9950
+ return {
9951
+ type: "dictionary",
9952
+ id: dictionaryType.id,
9953
+ indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
9954
+ dictionary: serializeArrowType(dictionaryType.dictionary),
9955
+ isOrdered: dictionaryType.isOrdered
9956
+ };
9957
+ default:
9958
+ throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
10176
9959
  }
10177
- return initializeWasmModule(
10178
- (onInitialized) => initializer({
10179
- ...wasmBinary ? { wasmBinary } : {},
10180
- onModuleLoaded: onInitialized
10181
- }),
10182
- (draco) => ({ draco })
10183
- );
10184
9960
  }
10185
- function getLibraryExport(library, exportName) {
10186
- if (typeof library === "function") {
10187
- return library;
9961
+ function deserializeArrowType(dataType, options) {
9962
+ if (typeof dataType === "object") {
9963
+ switch (dataType.type) {
9964
+ case "decimal":
9965
+ return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
9966
+ case "map": {
9967
+ const children = dataType.children.map(
9968
+ (arrowField) => deserializeArrowField(arrowField, options)
9969
+ );
9970
+ return new arrow.Map_(children[0], dataType.keysSorted);
9971
+ }
9972
+ case "list": {
9973
+ const field = deserializeArrowField(dataType.children[0], options);
9974
+ return new arrow.List(field);
9975
+ }
9976
+ case "large-list": {
9977
+ const field = deserializeArrowField(dataType.children[0], options);
9978
+ const LargeList = getOptionalArrowConstructor("LargeList");
9979
+ if (!LargeList) {
9980
+ throw new Error(
9981
+ "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
9982
+ );
9983
+ }
9984
+ return new LargeList(field);
9985
+ }
9986
+ case "fixed-size-list": {
9987
+ const child = deserializeArrowField(dataType.children[0], options);
9988
+ return new arrow.FixedSizeList(dataType.listSize, child);
9989
+ }
9990
+ case "fixed-size-binary":
9991
+ return new arrow.FixedSizeBinary(dataType.byteWidth);
9992
+ case "struct": {
9993
+ const children = dataType.children.map(
9994
+ (arrowField) => deserializeArrowField(arrowField, options)
9995
+ );
9996
+ return new arrow.Struct(children);
9997
+ }
9998
+ case "sparse-union":
9999
+ case "dense-union": {
10000
+ const children = dataType.children.map(
10001
+ (arrowField) => deserializeArrowField(arrowField, options)
10002
+ );
10003
+ return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
10004
+ }
10005
+ case "dictionary": {
10006
+ return new arrow.Dictionary(
10007
+ deserializeArrowType(dataType.dictionary, options),
10008
+ deserializeArrowDictionaryKeyType(dataType.indices),
10009
+ dataType.id,
10010
+ dataType.isOrdered
10011
+ );
10012
+ }
10013
+ default:
10014
+ throw new Error("array type not supported");
10015
+ }
10188
10016
  }
10189
- if (library && typeof library === "object") {
10190
- const exports = library;
10191
- const exportedInitializer = exports[exportName] || exports.default;
10192
- return typeof exportedInitializer === "function" ? exportedInitializer : void 0;
10017
+ switch (dataType) {
10018
+ case "null":
10019
+ return new arrow.Null();
10020
+ case "binary":
10021
+ return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
10022
+ case "binary-view":
10023
+ return makeRequiredArrowViewType("BinaryView");
10024
+ case "bool":
10025
+ return new arrow.Bool();
10026
+ case "int8":
10027
+ return new arrow.Int8();
10028
+ case "int16":
10029
+ return new arrow.Int16();
10030
+ case "int32":
10031
+ return new arrow.Int32();
10032
+ case "int64":
10033
+ return new arrow.Int64();
10034
+ case "uint8":
10035
+ return new arrow.Uint8();
10036
+ case "uint16":
10037
+ return new arrow.Uint16();
10038
+ case "uint32":
10039
+ return new arrow.Uint32();
10040
+ case "uint64":
10041
+ return new arrow.Uint64();
10042
+ case "float16":
10043
+ return new arrow.Float16();
10044
+ case "float32":
10045
+ return new arrow.Float32();
10046
+ case "float64":
10047
+ return new arrow.Float64();
10048
+ case "utf8":
10049
+ return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
10050
+ case "utf8-view":
10051
+ return makeRequiredArrowViewType("Utf8View");
10052
+ case "date-day":
10053
+ return new arrow.DateDay();
10054
+ case "date-millisecond":
10055
+ return new arrow.DateMillisecond();
10056
+ case "time-second":
10057
+ return new arrow.TimeSecond();
10058
+ case "time-millisecond":
10059
+ return new arrow.TimeMillisecond();
10060
+ case "time-microsecond":
10061
+ return new arrow.TimeMicrosecond();
10062
+ case "time-nanosecond":
10063
+ return new arrow.TimeNanosecond();
10064
+ case "timestamp-second":
10065
+ return new arrow.TimestampSecond();
10066
+ case "timestamp-millisecond":
10067
+ return new arrow.TimestampMillisecond();
10068
+ case "timestamp-microsecond":
10069
+ return new arrow.TimestampMicrosecond();
10070
+ case "timestamp-nanosecond":
10071
+ return new arrow.TimestampNanosecond();
10072
+ case "interval-daytime":
10073
+ return new arrow.IntervalDayTime();
10074
+ case "interval-yearmonth":
10075
+ return new arrow.IntervalYearMonth();
10076
+ default:
10077
+ throw new Error("array type not supported");
10193
10078
  }
10194
- return void 0;
10195
10079
  }
10196
- function getInjectedDraco3DModule(options) {
10197
- var _a;
10198
- const module2 = (_a = options.modules) == null ? void 0 : _a.draco3d;
10199
- if (!module2) {
10200
- return void 0;
10201
- }
10202
- if (typeof module2 !== "object" && typeof module2 !== "function") {
10203
- throw new Error("Invalid draco3d module");
10204
- }
10205
- return module2;
10080
+ function getOptionalArrowConstructor(typeName) {
10081
+ return arrow[typeName];
10206
10082
  }
10207
- function validateDracoDecoderModule(module2) {
10208
- const typedModule = module2;
10209
- if (typeof (typedModule == null ? void 0 : typedModule.createDecoderModule) !== "function") {
10210
- throw new Error("Invalid draco3d decoder module");
10083
+ function isArrowViewType(arrowType, viewTypeName) {
10084
+ const constructor = getOptionalArrowConstructor(viewTypeName);
10085
+ if (constructor && arrowType instanceof constructor) {
10086
+ return true;
10211
10087
  }
10212
- return typedModule;
10088
+ const guards = arrow.DataType;
10089
+ const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
10090
+ return Boolean(guard == null ? void 0 : guard(arrowType));
10213
10091
  }
10214
- function getLibraryCacheKey2(type, options) {
10215
- const libraryOverrides = Object.entries(options.modules || {}).filter(([name22]) => name22 !== "draco3d").map(([name22, value]) => `${name22}:${String(value)}`).sort().join("|");
10216
- return [
10217
- type,
10218
- options.useLocalLibraries ? "local" : "remote",
10219
- options.CDN || "",
10220
- libraryOverrides
10221
- ].join("|");
10092
+ function isOptionalArrowType(arrowType, typeName) {
10093
+ const constructor = getOptionalArrowConstructor(typeName);
10094
+ return Boolean(constructor && arrowType instanceof constructor);
10222
10095
  }
10223
- var libraryDecoderPromises, injectedDecoderPromises, decoderInitializationQueue;
10224
- var init_draco_module_loader = __esm({
10225
- "../scene/src/draco/lib/draco-module-loader.ts"() {
10226
- "use strict";
10227
- init_loader_utils();
10228
- init_draco_library_loader();
10229
- init_draco_libraries();
10230
- libraryDecoderPromises = /* @__PURE__ */ new Map();
10231
- injectedDecoderPromises = /* @__PURE__ */ new WeakMap();
10232
- decoderInitializationQueue = Promise.resolve();
10233
- }
10234
- });
10235
-
10236
- // ../core/src/schema-utils/lib/schema/data-type.ts
10237
- function getDataTypeFromValue(value, defaultNumberType = "float32") {
10238
- if (value instanceof Date) {
10239
- return "date-millisecond";
10240
- }
10241
- if (typeof value === "number") {
10242
- return defaultNumberType;
10243
- }
10244
- if (typeof value === "boolean") {
10245
- return "bool";
10096
+ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
10097
+ const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
10098
+ if (viewTypeMode === "never") {
10099
+ return fallbackType;
10246
10100
  }
10247
- if (typeof value === "string") {
10248
- return "utf8";
10101
+ const constructor = getOptionalArrowConstructor(viewTypeName);
10102
+ if (constructor) {
10103
+ return new constructor();
10249
10104
  }
10250
- if (value === null || value === "undefined") {
10251
- return "null";
10105
+ if (viewTypeMode === "require") {
10106
+ throw new Error(
10107
+ `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
10108
+ );
10252
10109
  }
10253
- return "null";
10110
+ return fallbackType;
10254
10111
  }
10255
- function getDataTypeFromArray(array) {
10256
- let type = getDataTypeFromTypedArray(array);
10257
- if (type !== "null") {
10258
- return { type, nullable: false };
10259
- }
10260
- if (array.length > 0) {
10261
- type = getDataTypeFromValue(array[0]);
10262
- return { type, nullable: true };
10112
+ function makeRequiredArrowViewType(viewTypeName) {
10113
+ const constructor = getOptionalArrowConstructor(viewTypeName);
10114
+ if (!constructor) {
10115
+ throw new Error(
10116
+ `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
10117
+ );
10263
10118
  }
10264
- return { type: "null", nullable: true };
10119
+ return new constructor();
10265
10120
  }
10266
- function getDataTypeFromTypedArray(array) {
10267
- if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
10268
- return "float16";
10121
+ function serializeArrowDictionaryKeyType(arrowType) {
10122
+ if (arrowType instanceof arrow.Int) {
10123
+ const prefix = arrowType.isSigned ? "int" : "uint";
10124
+ const keyType = `${prefix}${arrowType.bitWidth}`;
10125
+ if (isSchemaDictionaryKeyType(keyType)) {
10126
+ return keyType;
10127
+ }
10269
10128
  }
10270
- switch (array.constructor) {
10271
- case Int8Array:
10129
+ switch (arrowType.constructor) {
10130
+ case arrow.Int8:
10272
10131
  return "int8";
10273
- case Uint8Array:
10274
- case Uint8ClampedArray:
10275
- return "uint8";
10276
- case Int16Array:
10132
+ case arrow.Int16:
10277
10133
  return "int16";
10278
- case Uint16Array:
10279
- return "uint16";
10280
- case Int32Array:
10134
+ case arrow.Int32:
10281
10135
  return "int32";
10282
- case Uint32Array:
10136
+ case arrow.Uint8:
10137
+ return "uint8";
10138
+ case arrow.Uint16:
10139
+ return "uint16";
10140
+ case arrow.Uint32:
10283
10141
  return "uint32";
10284
- case BigInt64Array:
10285
- return "int64";
10286
- case BigUint64Array:
10287
- return "uint64";
10288
- case Float32Array:
10289
- return "float32";
10290
- case Float64Array:
10291
- return "float64";
10292
10142
  default:
10293
- return "null";
10143
+ throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
10294
10144
  }
10295
10145
  }
10296
- var import_core;
10297
- var init_data_type = __esm({
10298
- "../core/src/schema-utils/lib/schema/data-type.ts"() {
10146
+ function isSchemaDictionaryKeyType(keyType) {
10147
+ return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
10148
+ }
10149
+ function deserializeArrowDictionaryKeyType(keyType) {
10150
+ switch (keyType) {
10151
+ case "int8":
10152
+ return new arrow.Int8();
10153
+ case "int16":
10154
+ return new arrow.Int16();
10155
+ case "int32":
10156
+ return new arrow.Int32();
10157
+ case "uint8":
10158
+ return new arrow.Uint8();
10159
+ case "uint16":
10160
+ return new arrow.Uint16();
10161
+ case "uint32":
10162
+ return new arrow.Uint32();
10163
+ default:
10164
+ throw new Error(`schema dictionary index type not supported: ${keyType}`);
10165
+ }
10166
+ }
10167
+ var arrow;
10168
+ var init_convert_arrow_schema = __esm({
10169
+ "../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
10299
10170
  "use strict";
10300
- import_core = require("@math.gl/core");
10171
+ arrow = __toESM(require("apache-arrow"), 1);
10301
10172
  }
10302
10173
  });
10303
10174
 
@@ -10397,23 +10268,23 @@ var init_float16 = __esm({
10397
10268
  });
10398
10269
 
10399
10270
  // ../core/src/schema/categories/category-mesh.ts
10400
- var arrow4, meshArrowSchema, indexedMeshArrowSchema;
10271
+ var arrow2, meshArrowSchema, indexedMeshArrowSchema;
10401
10272
  var init_category_mesh = __esm({
10402
10273
  "../core/src/schema/categories/category-mesh.ts"() {
10403
10274
  "use strict";
10404
- arrow4 = __toESM(require("apache-arrow"), 1);
10405
- meshArrowSchema = new arrow4.Schema([
10406
- new arrow4.Field(
10275
+ arrow2 = __toESM(require("apache-arrow"), 1);
10276
+ meshArrowSchema = new arrow2.Schema([
10277
+ new arrow2.Field(
10407
10278
  "POSITION",
10408
- new arrow4.FixedSizeList(3, new arrow4.Field("value", new arrow4.Float32(), false)),
10279
+ new arrow2.FixedSizeList(3, new arrow2.Field("value", new arrow2.Float32(), false)),
10409
10280
  false
10410
10281
  )
10411
10282
  ]);
10412
- indexedMeshArrowSchema = new arrow4.Schema([
10283
+ indexedMeshArrowSchema = new arrow2.Schema([
10413
10284
  ...meshArrowSchema.fields,
10414
- new arrow4.Field(
10285
+ new arrow2.Field(
10415
10286
  "indices",
10416
- new arrow4.List(new arrow4.Field("item", new arrow4.Uint32(), false)),
10287
+ new arrow2.List(new arrow2.Field("item", new arrow2.Uint32(), false)),
10417
10288
  true
10418
10289
  )
10419
10290
  ]);
@@ -10432,7 +10303,7 @@ var init_schema = __esm({
10432
10303
  // ../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts
10433
10304
  function getFixedSizeListVector(typedArray, stride, logicalType) {
10434
10305
  const data = getFixedSizeListData(typedArray, stride, logicalType);
10435
- return new arrow5.Vector([data]);
10306
+ return new arrow3.Vector([data]);
10436
10307
  }
10437
10308
  function getFixedSizeListData(typedArray, stride, logicalType) {
10438
10309
  const listType = getFixedSizeListType(typedArray, stride, logicalType);
@@ -10440,13 +10311,13 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
10440
10311
  const storage = logicalType === "float16" && isNativeFloat16Array(typedArray) ? getFloat16Storage(typedArray) : typedArray;
10441
10312
  const buffers = {
10442
10313
  // valueOffsets: undefined,
10443
- [arrow5.BufferType.DATA]: storage
10314
+ [arrow3.BufferType.DATA]: storage
10444
10315
  // values
10445
10316
  // nullBitmap: undefined,
10446
10317
  // typeIds: undefined
10447
10318
  };
10448
- const nestedData = new arrow5.Data(nestedType, 0, storage.length, 0, buffers);
10449
- const data = new arrow5.Data(
10319
+ const nestedData = new arrow3.Data(nestedType, 0, storage.length, 0, buffers);
10320
+ const data = new arrow3.Data(
10450
10321
  listType,
10451
10322
  0,
10452
10323
  storage.length / stride,
@@ -10459,15 +10330,15 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
10459
10330
  function getFixedSizeListType(typedArray, stride, logicalType) {
10460
10331
  const type = logicalType || getDataTypeFromArray(typedArray).type;
10461
10332
  const arrowType = deserializeArrowType(type);
10462
- const listType = new arrow5.FixedSizeList(stride, new arrow5.Field("value", arrowType, false));
10333
+ const listType = new arrow3.FixedSizeList(stride, new arrow3.Field("value", arrowType, false));
10463
10334
  return listType;
10464
10335
  }
10465
- var arrow5;
10336
+ var arrow3;
10466
10337
  var init_arrow_fixed_size_list_utils = __esm({
10467
10338
  "../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts"() {
10468
10339
  "use strict";
10469
10340
  init_schema();
10470
- arrow5 = __toESM(require("apache-arrow"), 1);
10341
+ arrow3 = __toESM(require("apache-arrow"), 1);
10471
10342
  init_data_type();
10472
10343
  init_convert_arrow_schema();
10473
10344
  }
@@ -10527,8 +10398,8 @@ function makeMeshArrowTable(attributes, options = {}) {
10527
10398
  fields.push(indicesField);
10528
10399
  }
10529
10400
  }
10530
- const arrowSchema = new arrow6.Schema(fields, getMeshArrowMetadata(options));
10531
- const table = ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow6.Table(arrowSchema) : new arrow6.Table(arrowSchema, columns);
10401
+ const arrowSchema = new arrow4.Schema(fields, getMeshArrowMetadata(options));
10402
+ const table = ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow4.Table(arrowSchema) : new arrow4.Table(arrowSchema, columns);
10532
10403
  const schema = serializeArrowSchema(table.schema);
10533
10404
  return {
10534
10405
  shape: "arrow-table",
@@ -10542,14 +10413,14 @@ function getAttributeArrowVector(value, size, componentType) {
10542
10413
  if (componentType === "float16") {
10543
10414
  const storage = isNativeFloat16Array(value) ? getFloat16Storage(value) : value;
10544
10415
  if (size === 1) {
10545
- const data = new arrow6.Data(new arrow6.Float16(), 0, storage.length, 0, {
10546
- [arrow6.BufferType.DATA]: storage
10416
+ const data = new arrow4.Data(new arrow4.Float16(), 0, storage.length, 0, {
10417
+ [arrow4.BufferType.DATA]: storage
10547
10418
  });
10548
- return new arrow6.Vector([data]);
10419
+ return new arrow4.Vector([data]);
10549
10420
  }
10550
10421
  return getFixedSizeListVector(value, size, componentType);
10551
10422
  }
10552
- return size === 1 ? arrow6.makeVector(value) : getFixedSizeListVector(value, size);
10423
+ return size === 1 ? arrow4.makeVector(value) : getFixedSizeListVector(value, size);
10553
10424
  }
10554
10425
  function getOrderedAttributeNames(attributes) {
10555
10426
  const attributeNames = Object.keys(attributes);
@@ -10576,7 +10447,7 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
10576
10447
  for (const [key, value] of Object.entries(suppliedField.metadata)) {
10577
10448
  metadata.set(key, value);
10578
10449
  }
10579
- return new arrow6.Field(
10450
+ return new arrow4.Field(
10580
10451
  canonicalField.name,
10581
10452
  canonicalField.type,
10582
10453
  canonicalField.nullable,
@@ -10587,21 +10458,21 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
10587
10458
  if (componentType === "float16") {
10588
10459
  const metadata = new Map(Object.entries((field == null ? void 0 : field.metadata) || {}));
10589
10460
  metadata.set("componentType", "float16");
10590
- return new arrow6.Field(attributeName, column.type, false, metadata);
10461
+ return new arrow4.Field(attributeName, column.type, false, metadata);
10591
10462
  }
10592
10463
  if (field && field.type.toString() !== column.type.toString()) {
10593
10464
  const deserializedField = deserializeArrowField(field);
10594
- return new arrow6.Field(
10465
+ return new arrow4.Field(
10595
10466
  attributeName,
10596
10467
  column.type,
10597
10468
  deserializedField.nullable,
10598
10469
  deserializedField.metadata
10599
10470
  );
10600
10471
  }
10601
- return field ? deserializeArrowField(field) : new arrow6.Field(attributeName, column.type, false);
10472
+ return field ? deserializeArrowField(field) : new arrow4.Field(attributeName, column.type, false);
10602
10473
  }
10603
10474
  function isMeshPositionColumn(column) {
10604
- return column.type instanceof arrow6.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow6.Float32;
10475
+ return column.type instanceof arrow4.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow4.Float32;
10605
10476
  }
10606
10477
  function getIndicesVector(indices, vertexCount, type) {
10607
10478
  const indicesType = type;
@@ -10614,25 +10485,25 @@ function getIndicesVector(indices, vertexCount, type) {
10614
10485
  if (vertexCount > 0) {
10615
10486
  nullBitmap[0] = 1;
10616
10487
  }
10617
- const valuesData = new arrow6.Data(
10488
+ const valuesData = new arrow4.Data(
10618
10489
  indicesType.children[0].type,
10619
10490
  0,
10620
10491
  values.length,
10621
10492
  0,
10622
- { [arrow6.BufferType.DATA]: values }
10493
+ { [arrow4.BufferType.DATA]: values }
10623
10494
  );
10624
- const indicesData = new arrow6.Data(
10495
+ const indicesData = new arrow4.Data(
10625
10496
  indicesType,
10626
10497
  0,
10627
10498
  vertexCount,
10628
10499
  Math.max(0, vertexCount - 1),
10629
10500
  {
10630
- [arrow6.BufferType.OFFSET]: valueOffsets,
10631
- [arrow6.BufferType.VALIDITY]: nullBitmap
10501
+ [arrow4.BufferType.OFFSET]: valueOffsets,
10502
+ [arrow4.BufferType.VALIDITY]: nullBitmap
10632
10503
  },
10633
10504
  [valuesData]
10634
10505
  );
10635
- return new arrow6.Vector([indicesData]);
10506
+ return new arrow4.Vector([indicesData]);
10636
10507
  }
10637
10508
  function getMeshArrowMetadata(options) {
10638
10509
  var _a;
@@ -10648,13 +10519,13 @@ function getMeshArrowMetadata(options) {
10648
10519
  }
10649
10520
  return deserializeArrowMetadata(metadata);
10650
10521
  }
10651
- var arrow6, MESH_ARROW_ATTRIBUTE_ORDER;
10522
+ var arrow4, MESH_ARROW_ATTRIBUTE_ORDER;
10652
10523
  var init_convert_mesh_to_table = __esm({
10653
10524
  "../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts"() {
10654
10525
  "use strict";
10655
10526
  init_schema();
10656
10527
  init_schema();
10657
- arrow6 = __toESM(require("apache-arrow"), 1);
10528
+ arrow4 = __toESM(require("apache-arrow"), 1);
10658
10529
  init_arrow_fixed_size_list_utils();
10659
10530
  init_convert_arrow_schema();
10660
10531
  MESH_ARROW_ATTRIBUTE_ORDER = ["POSITION"];
@@ -11518,7 +11389,7 @@ var DracoLoader;
11518
11389
  var init_draco_loader_types = __esm({
11519
11390
  "../scene/src/draco/draco-loader-types.ts"() {
11520
11391
  "use strict";
11521
- init_arrow_transport();
11392
+ init_arrow_worker_transport();
11522
11393
  init_version4();
11523
11394
  init_draco_format();
11524
11395
  init_draco_loader_options();
@@ -15014,7 +14885,7 @@ var VERSION5;
15014
14885
  var init_version5 = __esm({
15015
14886
  "dist/3d-tiles/lib/utils/version.js"() {
15016
14887
  "use strict";
15017
- VERSION5 = true ? "5.0.0-beta.4" : "latest";
14888
+ VERSION5 = true ? "5.0.0-beta.5" : "latest";
15018
14889
  }
15019
14890
  });
15020
14891
 
@@ -21080,6 +20951,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
21080
20951
  function extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {
21081
20952
  const instances = new Array(instancesLength);
21082
20953
  const instancePosition = new import_core17.Vector3();
20954
+ const instanceFramePosition = new import_core17.Vector3();
21083
20955
  const instanceNormalRight = new import_core17.Vector3();
21084
20956
  const instanceNormalUp = new import_core17.Vector3();
21085
20957
  const instanceNormalForward = new import_core17.Vector3();
@@ -21142,7 +21014,10 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
21142
21014
  tile.hasCustomOrientation = true;
21143
21015
  hasCustomOrientation = true;
21144
21016
  } else if (tile.eastNorthUp) {
21145
- (0, import_geospatial9.eastNorthUpToFixedFrame)(import_geospatial8.Ellipsoid.WGS84, instancePosition, instanceTransform);
21017
+ instanceFramePosition.copy(instancePosition);
21018
+ if (tile.rtcCenter)
21019
+ instanceFramePosition.add(tile.rtcCenter);
21020
+ (0, import_geospatial9.eastNorthUpToFixedFrame)(import_geospatial8.Ellipsoid.WGS84, instanceFramePosition, instanceTransform);
21146
21021
  instanceTransform.getRotationMatrix3(instanceRotation);
21147
21022
  } else {
21148
21023
  instanceRotation.identity();
@@ -24437,6 +24312,7 @@ function parseInstancedModel2(tile, arrayBuffer, byteOffset, options, context) {
24437
24312
  function extractInstancedAttributes2(tile, featureTable, batchTable, instancesLength) {
24438
24313
  const instances = new Array(instancesLength);
24439
24314
  const instancePosition = new import_core23.Vector3();
24315
+ const instanceFramePosition = new import_core23.Vector3();
24440
24316
  const instanceNormalRight = new import_core23.Vector3();
24441
24317
  const instanceNormalUp = new import_core23.Vector3();
24442
24318
  const instanceNormalForward = new import_core23.Vector3();
@@ -24531,7 +24407,9 @@ function extractInstancedAttributes2(tile, featureTable, batchTable, instancesLe
24531
24407
  tile.hasCustomOrientation = true;
24532
24408
  hasCustomOrientation = true;
24533
24409
  } else if (tile.eastNorthUp) {
24534
- (0, import_geospatial12.eastNorthUpToFixedFrame)(import_geospatial11.Ellipsoid.WGS84, instancePosition, instanceTransform);
24410
+ instanceFramePosition.copy(instancePosition);
24411
+ if (tile.rtcCenter) instanceFramePosition.add(tile.rtcCenter);
24412
+ (0, import_geospatial12.eastNorthUpToFixedFrame)(import_geospatial11.Ellipsoid.WGS84, instanceFramePosition, instanceTransform);
24535
24413
  instanceTransform.getRotationMatrix3(instanceRotation);
24536
24414
  } else {
24537
24415
  instanceRotation.identity();
@@ -29472,7 +29350,7 @@ var init_d_tiles_archive_loader = __esm({
29472
29350
  "dist/3d-tiles/3d-tiles-archive-loader.js"() {
29473
29351
  "use strict";
29474
29352
  init_tiles_3d_format();
29475
- VERSION7 = true ? "5.0.0-beta.4" : "latest";
29353
+ VERSION7 = true ? "5.0.0-beta.5" : "latest";
29476
29354
  Tiles3DArchiveFileLoader = {
29477
29355
  dataType: null,
29478
29356
  batchType: null,