@loaders.gl/i3s 4.0.0-beta.7 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -7
- package/dist/dist.dev.js +281 -284
- package/dist/i3s-content-worker-node.js +48 -48
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +7 -185
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +1 -2
- package/dist/i3s-loader.js.map +1 -1
- package/dist/index.cjs +285 -298
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/parsers/constants.d.ts.map +1 -1
- package/dist/lib/parsers/constants.js.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +0 -2
- package/dist/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/lib/utils/customize-colors.d.ts +30 -0
- package/dist/lib/utils/customize-colors.d.ts.map +1 -0
- package/dist/lib/utils/customize-colors.js +92 -0
- package/dist/lib/utils/customize-colors.js.map +1 -0
- package/package.json +10 -10
- package/src/i3s-loader.ts +1 -2
- package/src/index.ts +2 -0
- package/src/lib/parsers/constants.ts +1 -0
- package/src/lib/parsers/parse-i3s-attribute.ts +1 -0
- package/src/lib/parsers/parse-i3s-tile-content.ts +0 -9
- package/src/lib/utils/{customize-/321/201olors.ts → customize-colors.ts} +66 -41
- package/dist/lib/utils/customize-/321/201olors.d.ts +0 -14
- package/dist/lib/utils/customize-/321/201olors.d.ts.map +0 -1
- package/dist/lib/utils/customize-/321/201olors.js +0 -98
- package/dist/lib/utils/customize-/321/201olors.js.map +0 -1
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
);
|
|
103
103
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
104
104
|
} else {
|
|
105
|
-
globalThis._loadersgl_.version = "4.0.0
|
|
105
|
+
globalThis._loadersgl_.version = "4.0.0";
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
return globalThis._loadersgl_.version;
|
|
@@ -1435,7 +1435,7 @@
|
|
|
1435
1435
|
var navigator_ = globalThis.navigator || {};
|
|
1436
1436
|
|
|
1437
1437
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
1438
|
-
var VERSION2 = true ? "4.0.0
|
|
1438
|
+
var VERSION2 = true ? "4.0.0" : "untranspiled source";
|
|
1439
1439
|
var isBrowser4 = isBrowser3();
|
|
1440
1440
|
|
|
1441
1441
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
@@ -5226,7 +5226,7 @@
|
|
|
5226
5226
|
_defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
|
|
5227
5227
|
|
|
5228
5228
|
// ../images/src/lib/utils/version.ts
|
|
5229
|
-
var VERSION3 = true ? "4.0.0
|
|
5229
|
+
var VERSION3 = true ? "4.0.0" : "latest";
|
|
5230
5230
|
|
|
5231
5231
|
// ../images/src/lib/category-api/image-type.ts
|
|
5232
5232
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -5629,7 +5629,7 @@
|
|
|
5629
5629
|
};
|
|
5630
5630
|
|
|
5631
5631
|
// ../draco/src/lib/utils/version.ts
|
|
5632
|
-
var VERSION4 = true ? "4.0.0
|
|
5632
|
+
var VERSION4 = true ? "4.0.0" : "latest";
|
|
5633
5633
|
|
|
5634
5634
|
// ../draco/src/draco-loader.ts
|
|
5635
5635
|
var DEFAULT_DRACO_OPTIONS = {
|
|
@@ -6310,7 +6310,7 @@
|
|
|
6310
6310
|
}
|
|
6311
6311
|
|
|
6312
6312
|
// ../textures/src/lib/utils/version.ts
|
|
6313
|
-
var VERSION5 = true ? "4.0.0
|
|
6313
|
+
var VERSION5 = true ? "4.0.0" : "beta";
|
|
6314
6314
|
|
|
6315
6315
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
6316
6316
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -7443,177 +7443,6 @@
|
|
|
7443
7443
|
throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
|
|
7444
7444
|
}
|
|
7445
7445
|
}
|
|
7446
|
-
var STRING_ATTRIBUTE_TYPE = "String";
|
|
7447
|
-
var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
|
|
7448
|
-
var FLOAT_64_TYPE = "Float64";
|
|
7449
|
-
var INT_16_ATTRIBUTE_TYPE = "Int16";
|
|
7450
|
-
|
|
7451
|
-
// src/lib/parsers/parse-i3s-attribute.ts
|
|
7452
|
-
function parseI3STileAttribute(arrayBuffer, options) {
|
|
7453
|
-
const { attributeName, attributeType } = options;
|
|
7454
|
-
if (!attributeName) {
|
|
7455
|
-
return {};
|
|
7456
|
-
}
|
|
7457
|
-
return {
|
|
7458
|
-
[attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
|
|
7459
|
-
};
|
|
7460
|
-
}
|
|
7461
|
-
function parseAttribute(attributeType, arrayBuffer) {
|
|
7462
|
-
switch (attributeType) {
|
|
7463
|
-
case STRING_ATTRIBUTE_TYPE:
|
|
7464
|
-
return parseStringsAttribute(arrayBuffer);
|
|
7465
|
-
case OBJECT_ID_ATTRIBUTE_TYPE:
|
|
7466
|
-
return parseShortNumberAttribute(arrayBuffer);
|
|
7467
|
-
case FLOAT_64_TYPE:
|
|
7468
|
-
return parseFloatAttribute(arrayBuffer);
|
|
7469
|
-
case INT_16_ATTRIBUTE_TYPE:
|
|
7470
|
-
return parseInt16ShortNumberAttribute(arrayBuffer);
|
|
7471
|
-
default:
|
|
7472
|
-
return parseShortNumberAttribute(arrayBuffer);
|
|
7473
|
-
}
|
|
7474
|
-
}
|
|
7475
|
-
function parseShortNumberAttribute(arrayBuffer) {
|
|
7476
|
-
const countOffset = 4;
|
|
7477
|
-
return new Uint32Array(arrayBuffer, countOffset);
|
|
7478
|
-
}
|
|
7479
|
-
function parseInt16ShortNumberAttribute(arrayBuffer) {
|
|
7480
|
-
const countOffset = 4;
|
|
7481
|
-
return new Int16Array(arrayBuffer, countOffset);
|
|
7482
|
-
}
|
|
7483
|
-
function parseFloatAttribute(arrayBuffer) {
|
|
7484
|
-
const countOffset = 8;
|
|
7485
|
-
return new Float64Array(arrayBuffer, countOffset);
|
|
7486
|
-
}
|
|
7487
|
-
function parseStringsAttribute(arrayBuffer) {
|
|
7488
|
-
const stringsCountOffset = 0;
|
|
7489
|
-
const dataOffset = 8;
|
|
7490
|
-
const bytesPerStringSize = 4;
|
|
7491
|
-
const stringsArray = [];
|
|
7492
|
-
try {
|
|
7493
|
-
const stringsCount = new DataView(
|
|
7494
|
-
arrayBuffer,
|
|
7495
|
-
stringsCountOffset,
|
|
7496
|
-
bytesPerStringSize
|
|
7497
|
-
).getUint32(stringsCountOffset, true);
|
|
7498
|
-
const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
|
|
7499
|
-
let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
|
|
7500
|
-
for (const stringByteSize of stringSizes) {
|
|
7501
|
-
const textDecoder = new TextDecoder("utf-8");
|
|
7502
|
-
const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
|
|
7503
|
-
stringsArray.push(textDecoder.decode(stringAttribute));
|
|
7504
|
-
stringOffset += stringByteSize;
|
|
7505
|
-
}
|
|
7506
|
-
} catch (error) {
|
|
7507
|
-
console.error("Parse string attribute error: ", error.message);
|
|
7508
|
-
}
|
|
7509
|
-
return stringsArray;
|
|
7510
|
-
}
|
|
7511
|
-
|
|
7512
|
-
// src/i3s-attribute-loader.ts
|
|
7513
|
-
var VERSION6 = true ? "4.0.0-beta.7" : "latest";
|
|
7514
|
-
var I3SAttributeLoader = {
|
|
7515
|
-
name: "I3S Attribute",
|
|
7516
|
-
id: "i3s-attribute",
|
|
7517
|
-
module: "i3s",
|
|
7518
|
-
version: VERSION6,
|
|
7519
|
-
mimeTypes: ["application/binary"],
|
|
7520
|
-
parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
|
|
7521
|
-
extensions: ["bin"],
|
|
7522
|
-
options: {},
|
|
7523
|
-
binary: true
|
|
7524
|
-
};
|
|
7525
|
-
function getAttributeValueType(attribute) {
|
|
7526
|
-
if (attribute.hasOwnProperty("objectIds")) {
|
|
7527
|
-
return "Oid32";
|
|
7528
|
-
} else if (attribute.hasOwnProperty("attributeValues")) {
|
|
7529
|
-
return attribute.attributeValues.valueType;
|
|
7530
|
-
}
|
|
7531
|
-
return "";
|
|
7532
|
-
}
|
|
7533
|
-
|
|
7534
|
-
// src/lib/utils/customize-сolors.ts
|
|
7535
|
-
async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
|
|
7536
|
-
if (!options?.i3s?.colorsByAttribute) {
|
|
7537
|
-
return colors;
|
|
7538
|
-
}
|
|
7539
|
-
const colorizeAttributeField = tilesetOptions.fields.find(
|
|
7540
|
-
({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName
|
|
7541
|
-
);
|
|
7542
|
-
if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(
|
|
7543
|
-
colorizeAttributeField.type
|
|
7544
|
-
)) {
|
|
7545
|
-
return colors;
|
|
7546
|
-
}
|
|
7547
|
-
const colorizeAttributeData = await loadFeatureAttributeData(
|
|
7548
|
-
colorizeAttributeField.name,
|
|
7549
|
-
tileOptions,
|
|
7550
|
-
tilesetOptions,
|
|
7551
|
-
options
|
|
7552
|
-
);
|
|
7553
|
-
if (!colorizeAttributeData) {
|
|
7554
|
-
return colors;
|
|
7555
|
-
}
|
|
7556
|
-
const objectIdField = tilesetOptions.fields.find(({ type }) => type === "esriFieldTypeOID");
|
|
7557
|
-
if (!objectIdField) {
|
|
7558
|
-
return colors;
|
|
7559
|
-
}
|
|
7560
|
-
const objectIdAttributeData = await loadFeatureAttributeData(
|
|
7561
|
-
objectIdField.name,
|
|
7562
|
-
tileOptions,
|
|
7563
|
-
tilesetOptions,
|
|
7564
|
-
options
|
|
7565
|
-
);
|
|
7566
|
-
if (!objectIdAttributeData) {
|
|
7567
|
-
return colors;
|
|
7568
|
-
}
|
|
7569
|
-
const attributeValuesMap = {};
|
|
7570
|
-
for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
|
|
7571
|
-
attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(
|
|
7572
|
-
// @ts-expect-error
|
|
7573
|
-
colorizeAttributeData[colorizeAttributeField.name][i2],
|
|
7574
|
-
options
|
|
7575
|
-
);
|
|
7576
|
-
}
|
|
7577
|
-
for (let i2 = 0; i2 < featureIds.value.length; i2++) {
|
|
7578
|
-
const color = attributeValuesMap[featureIds.value[i2]];
|
|
7579
|
-
if (!color) {
|
|
7580
|
-
continue;
|
|
7581
|
-
}
|
|
7582
|
-
if (options.i3s.colorsByAttribute.mode === "multiply") {
|
|
7583
|
-
color.forEach((colorItem, index) => {
|
|
7584
|
-
colors.value[i2 * 4 + index] = colors.value[i2 * 4 + index] * colorItem / 255;
|
|
7585
|
-
});
|
|
7586
|
-
} else {
|
|
7587
|
-
colors.value.set(color, i2 * 4);
|
|
7588
|
-
}
|
|
7589
|
-
}
|
|
7590
|
-
return colors;
|
|
7591
|
-
}
|
|
7592
|
-
function calculateColorForAttribute(attributeValue, options) {
|
|
7593
|
-
if (!options?.i3s?.colorsByAttribute) {
|
|
7594
|
-
return [255, 255, 255, 255];
|
|
7595
|
-
}
|
|
7596
|
-
const { minValue, maxValue, minColor, maxColor } = options.i3s.colorsByAttribute;
|
|
7597
|
-
const rate = (attributeValue - minValue) / (maxValue - minValue);
|
|
7598
|
-
const color = [255, 255, 255, 255];
|
|
7599
|
-
for (let i2 = 0; i2 < minColor.length; i2++) {
|
|
7600
|
-
color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
|
|
7601
|
-
}
|
|
7602
|
-
return color;
|
|
7603
|
-
}
|
|
7604
|
-
async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attributeStorageInfo }, options) {
|
|
7605
|
-
const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);
|
|
7606
|
-
if (attributeIndex === -1) {
|
|
7607
|
-
return null;
|
|
7608
|
-
}
|
|
7609
|
-
const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);
|
|
7610
|
-
const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
|
|
7611
|
-
const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {
|
|
7612
|
-
attributeName,
|
|
7613
|
-
attributeType
|
|
7614
|
-
});
|
|
7615
|
-
return objectIdAttributeData;
|
|
7616
|
-
}
|
|
7617
7446
|
|
|
7618
7447
|
// src/lib/parsers/parse-i3s-tile-content.ts
|
|
7619
7448
|
var scratchVector6 = new Vector3([0, 0, 0]);
|
|
@@ -7753,13 +7582,6 @@
|
|
|
7753
7582
|
content.modelMatrix = getModelMatrix(attributes.position);
|
|
7754
7583
|
content.coordinateSystem = 3 /* LNGLAT_OFFSETS */;
|
|
7755
7584
|
}
|
|
7756
|
-
attributes.color = await customizeColors(
|
|
7757
|
-
attributes.color,
|
|
7758
|
-
attributes.id,
|
|
7759
|
-
tileOptions,
|
|
7760
|
-
tilesetOptions,
|
|
7761
|
-
options
|
|
7762
|
-
);
|
|
7763
7585
|
content.attributes = {
|
|
7764
7586
|
positions: attributes.position,
|
|
7765
7587
|
normals: attributes.normal,
|
|
@@ -8016,13 +7838,13 @@
|
|
|
8016
7838
|
}
|
|
8017
7839
|
|
|
8018
7840
|
// src/i3s-content-loader.ts
|
|
8019
|
-
var
|
|
7841
|
+
var VERSION6 = true ? "4.0.0" : "beta";
|
|
8020
7842
|
var I3SContentLoader = {
|
|
8021
7843
|
name: "I3S Content (Indexed Scene Layers)",
|
|
8022
7844
|
id: "i3s-content",
|
|
8023
7845
|
module: "i3s",
|
|
8024
7846
|
worker: true,
|
|
8025
|
-
version:
|
|
7847
|
+
version: VERSION6,
|
|
8026
7848
|
mimeTypes: ["application/octet-stream"],
|
|
8027
7849
|
parse: parse3,
|
|
8028
7850
|
extensions: ["bin"],
|
package/dist/i3s-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-loader.d.ts","sourceRoot":"","sources":["../src/i3s-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAI9C,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAYxC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"i3s-loader.d.ts","sourceRoot":"","sources":["../src/i3s-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAI9C,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAYxC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,CAuB9E,CAAC"}
|
package/dist/i3s-loader.js
CHANGED
|
@@ -28,8 +28,7 @@ export const I3SLoader = {
|
|
|
28
28
|
useDracoGeometry: true,
|
|
29
29
|
useCompressedTextures: true,
|
|
30
30
|
decodeTextures: true,
|
|
31
|
-
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
32
|
-
colorsByAttribute: null
|
|
31
|
+
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
};
|
package/dist/i3s-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-loader.js","names":["parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","COORDINATE_SYSTEM","getUrlWithoutParams","VERSION","__VERSION__","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","METER_OFFSETS","
|
|
1
|
+
{"version":3,"file":"i3s-loader.js","names":["parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","COORDINATE_SYSTEM","getUrlWithoutParams","VERSION","__VERSION__","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","METER_OFFSETS","data","arguments","length","undefined","context","url","magicNumber","getMagicNumber","Error","urlWithoutParams","test","parseTileset","parseTile","parseTileContent","arrayBuffer","tilesetJson","JSON","TextDecoder","decode","layerType","tilesetPostprocessed","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"sources":["../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport type {I3STilesetHeader} from './types';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {getUrlWithoutParams} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser<I3STilesetHeader, never, LoaderOptions> = {\n name: 'I3S (Indexed Scene Layers)',\n id: 'i3s',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseI3S,\n extensions: ['bin'],\n options: {\n i3s: {\n token: null,\n isTileset: 'auto',\n isTileHeader: 'auto',\n tile: null,\n tileset: null,\n _tileOptions: null,\n _tilesetOptions: null,\n useDracoGeometry: true,\n useCompressedTextures: true,\n decodeTextures: true,\n coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context): Promise<I3STilesetHeader> {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n const urlWithoutParams = getUrlWithoutParams(url);\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(urlWithoutParams);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(urlWithoutParams);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n\n const tilesetPostprocessed = await normalizeTilesetData(tilesetJson, options, context);\n return tilesetPostprocessed;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":"AACA,SAAQA,KAAK,QAAO,kBAAkB;AAAC,SAE/BC,gBAAgB;AAAA,SAChBC,iBAAiB,EAAEC,oBAAoB;AAAA,SACvCC,iBAAiB;AAAA,SAEjBC,mBAAmB;AAI3B,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAE3E,MAAMC,aAAa,GAAG,iBAAiB;AACvC,MAAMC,iBAAiB,GAAG,wBAAwB;AAClD,MAAMC,QAAQ,GAAG,UAAU;AAC3B,MAAMC,WAAW,GAAG,YAAY;AAShC,OAAO,MAAMC,SAAmE,GAAG;EACjFC,IAAI,EAAE,4BAA4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