@loaders.gl/tile-converter 4.0.0-alpha.21 → 4.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/converter.min.js +112 -112
- package/dist/dist.min.js +856 -195
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js +70 -4
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +34 -32
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js +33 -4
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +7 -5
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-server/bin/i3s-server.min.js +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +15 -0
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js +51 -5
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +6 -4
- package/dist/slpk-extractor.min.js +1 -1
- package/package.json +14 -14
- package/src/i3s-converter/helpers/load-3d-tiles.ts +61 -5
- package/src/i3s-converter/i3s-converter.ts +12 -5
package/dist/dist.min.js
CHANGED
|
@@ -18286,9 +18286,9 @@ var require_pako = __commonJS({
|
|
|
18286
18286
|
var deflate = require_deflate2();
|
|
18287
18287
|
var inflate = require_inflate2();
|
|
18288
18288
|
var constants = require_constants3();
|
|
18289
|
-
var
|
|
18290
|
-
assign(
|
|
18291
|
-
module2.exports =
|
|
18289
|
+
var pako2 = {};
|
|
18290
|
+
assign(pako2, deflate, inflate, constants);
|
|
18291
|
+
module2.exports = pako2;
|
|
18292
18292
|
}
|
|
18293
18293
|
});
|
|
18294
18294
|
|
|
@@ -18297,7 +18297,7 @@ var require_flate = __commonJS({
|
|
|
18297
18297
|
"../../node_modules/jszip/lib/flate.js"(exports) {
|
|
18298
18298
|
"use strict";
|
|
18299
18299
|
var USE_TYPEDARRAY = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Uint32Array !== "undefined";
|
|
18300
|
-
var
|
|
18300
|
+
var pako2 = require_pako();
|
|
18301
18301
|
var utils = require_utils();
|
|
18302
18302
|
var GenericWorker = require_GenericWorker();
|
|
18303
18303
|
var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array";
|
|
@@ -18329,7 +18329,7 @@ var require_flate = __commonJS({
|
|
|
18329
18329
|
this._pako = null;
|
|
18330
18330
|
};
|
|
18331
18331
|
FlateWorker.prototype._createPako = function() {
|
|
18332
|
-
this._pako = new
|
|
18332
|
+
this._pako = new pako2[this._pakoAction]({
|
|
18333
18333
|
raw: true,
|
|
18334
18334
|
level: this._pakoOptions.level || -1
|
|
18335
18335
|
});
|
|
@@ -18389,7 +18389,7 @@ var require_ZipFileWorker = __commonJS({
|
|
|
18389
18389
|
var GenericWorker = require_GenericWorker();
|
|
18390
18390
|
var utf8 = require_utf8();
|
|
18391
18391
|
var crc32 = require_crc32();
|
|
18392
|
-
var
|
|
18392
|
+
var signature3 = require_signature();
|
|
18393
18393
|
var decToHex = function(dec, bytes) {
|
|
18394
18394
|
var hex = "", i;
|
|
18395
18395
|
for (i = 0; i < bytes; i++) {
|
|
@@ -18468,8 +18468,8 @@ var require_ZipFileWorker = __commonJS({
|
|
|
18468
18468
|
header += decToHex(dataInfo.uncompressedSize, 4);
|
|
18469
18469
|
header += decToHex(encodedFileName.length, 2);
|
|
18470
18470
|
header += decToHex(extraFields.length, 2);
|
|
18471
|
-
var fileRecord =
|
|
18472
|
-
var dirRecord =
|
|
18471
|
+
var fileRecord = signature3.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;
|
|
18472
|
+
var dirRecord = signature3.CENTRAL_FILE_HEADER + decToHex(versionMadeBy, 2) + header + decToHex(encodedComment.length, 2) + "\0\0\0\0" + decToHex(extFileAttr, 4) + decToHex(offset, 4) + encodedFileName + extraFields + encodedComment;
|
|
18473
18473
|
return {
|
|
18474
18474
|
fileRecord,
|
|
18475
18475
|
dirRecord
|
|
@@ -18478,12 +18478,12 @@ var require_ZipFileWorker = __commonJS({
|
|
|
18478
18478
|
var generateCentralDirectoryEnd = function(entriesCount, centralDirLength, localDirLength, comment, encodeFileName) {
|
|
18479
18479
|
var dirEnd = "";
|
|
18480
18480
|
var encodedComment = utils.transformTo("string", encodeFileName(comment));
|
|
18481
|
-
dirEnd =
|
|
18481
|
+
dirEnd = signature3.CENTRAL_DIRECTORY_END + "\0\0\0\0" + decToHex(entriesCount, 2) + decToHex(entriesCount, 2) + decToHex(centralDirLength, 4) + decToHex(localDirLength, 4) + decToHex(encodedComment.length, 2) + encodedComment;
|
|
18482
18482
|
return dirEnd;
|
|
18483
18483
|
};
|
|
18484
18484
|
var generateDataDescriptors = function(streamInfo) {
|
|
18485
18485
|
var descriptor = "";
|
|
18486
|
-
descriptor =
|
|
18486
|
+
descriptor = signature3.DATA_DESCRIPTOR + decToHex(streamInfo["crc32"], 4) + decToHex(streamInfo["compressedSize"], 4) + decToHex(streamInfo["uncompressedSize"], 4);
|
|
18487
18487
|
return descriptor;
|
|
18488
18488
|
};
|
|
18489
18489
|
function ZipFileWorker(streamFiles, comment, platform, encodeFileName) {
|
|
@@ -19349,15 +19349,15 @@ var require_zipEntries = __commonJS({
|
|
|
19349
19349
|
checkSignature: function(expectedSignature) {
|
|
19350
19350
|
if (!this.reader.readAndCheckSignature(expectedSignature)) {
|
|
19351
19351
|
this.reader.index -= 4;
|
|
19352
|
-
var
|
|
19353
|
-
throw new Error("Corrupted zip or bug: unexpected signature (" + utils.pretty(
|
|
19352
|
+
var signature3 = this.reader.readString(4);
|
|
19353
|
+
throw new Error("Corrupted zip or bug: unexpected signature (" + utils.pretty(signature3) + ", expected " + utils.pretty(expectedSignature) + ")");
|
|
19354
19354
|
}
|
|
19355
19355
|
},
|
|
19356
19356
|
isSignature: function(askedIndex, expectedSignature) {
|
|
19357
19357
|
var currentIndex = this.reader.index;
|
|
19358
19358
|
this.reader.setIndex(askedIndex);
|
|
19359
|
-
var
|
|
19360
|
-
var result =
|
|
19359
|
+
var signature3 = this.reader.readString(4);
|
|
19360
|
+
var result = signature3 === expectedSignature;
|
|
19361
19361
|
this.reader.setIndex(currentIndex);
|
|
19362
19362
|
return result;
|
|
19363
19363
|
},
|
|
@@ -19730,7 +19730,7 @@ var require_is_buffer = __commonJS({
|
|
|
19730
19730
|
var require_md5 = __commonJS({
|
|
19731
19731
|
"../../node_modules/md5/md5.js"(exports, module2) {
|
|
19732
19732
|
(function() {
|
|
19733
|
-
var crypt2 = require_crypt(), utf8 = require_charenc().utf8, isBuffer3 = require_is_buffer(), bin = require_charenc().bin,
|
|
19733
|
+
var crypt2 = require_crypt(), utf8 = require_charenc().utf8, isBuffer3 = require_is_buffer(), bin = require_charenc().bin, md55 = function(message, options) {
|
|
19734
19734
|
if (message.constructor == String)
|
|
19735
19735
|
if (options && options.encoding === "binary")
|
|
19736
19736
|
message = bin.stringToBytes(message);
|
|
@@ -19746,7 +19746,7 @@ var require_md5 = __commonJS({
|
|
|
19746
19746
|
}
|
|
19747
19747
|
m[l >>> 5] |= 128 << l % 32;
|
|
19748
19748
|
m[(l + 64 >>> 9 << 4) + 14] = l;
|
|
19749
|
-
var FF =
|
|
19749
|
+
var FF = md55._ff, GG = md55._gg, HH = md55._hh, II = md55._ii;
|
|
19750
19750
|
for (var i = 0; i < m.length; i += 16) {
|
|
19751
19751
|
var aa = a, bb = b, cc = c, dd = d;
|
|
19752
19752
|
a = FF(a, b, c, d, m[i + 0], 7, -680876936);
|
|
@@ -19820,28 +19820,28 @@ var require_md5 = __commonJS({
|
|
|
19820
19820
|
}
|
|
19821
19821
|
return crypt2.endian([a, b, c, d]);
|
|
19822
19822
|
};
|
|
19823
|
-
|
|
19823
|
+
md55._ff = function(a, b, c, d, x, s, t) {
|
|
19824
19824
|
var n = a + (b & c | ~b & d) + (x >>> 0) + t;
|
|
19825
19825
|
return (n << s | n >>> 32 - s) + b;
|
|
19826
19826
|
};
|
|
19827
|
-
|
|
19827
|
+
md55._gg = function(a, b, c, d, x, s, t) {
|
|
19828
19828
|
var n = a + (b & d | c & ~d) + (x >>> 0) + t;
|
|
19829
19829
|
return (n << s | n >>> 32 - s) + b;
|
|
19830
19830
|
};
|
|
19831
|
-
|
|
19831
|
+
md55._hh = function(a, b, c, d, x, s, t) {
|
|
19832
19832
|
var n = a + (b ^ c ^ d) + (x >>> 0) + t;
|
|
19833
19833
|
return (n << s | n >>> 32 - s) + b;
|
|
19834
19834
|
};
|
|
19835
|
-
|
|
19835
|
+
md55._ii = function(a, b, c, d, x, s, t) {
|
|
19836
19836
|
var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
|
|
19837
19837
|
return (n << s | n >>> 32 - s) + b;
|
|
19838
19838
|
};
|
|
19839
|
-
|
|
19840
|
-
|
|
19839
|
+
md55._blocksize = 16;
|
|
19840
|
+
md55._digestsize = 16;
|
|
19841
19841
|
module2.exports = function(message, options) {
|
|
19842
19842
|
if (message === void 0 || message === null)
|
|
19843
19843
|
throw new Error("Illegal argument " + message);
|
|
19844
|
-
var digestbytes = crypt2.wordsToBytes(
|
|
19844
|
+
var digestbytes = crypt2.wordsToBytes(md55(message, options));
|
|
19845
19845
|
return options && options.asBytes ? digestbytes : options && options.asString ? bin.bytesToString(digestbytes) : crypt2.bytesToHex(digestbytes);
|
|
19846
19846
|
};
|
|
19847
19847
|
})();
|
|
@@ -20124,7 +20124,7 @@ var require_md52 = __commonJS({
|
|
|
20124
20124
|
function _interopRequireDefault(obj) {
|
|
20125
20125
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
20126
20126
|
}
|
|
20127
|
-
function
|
|
20127
|
+
function md55(bytes) {
|
|
20128
20128
|
if (Array.isArray(bytes)) {
|
|
20129
20129
|
bytes = Buffer.from(bytes);
|
|
20130
20130
|
} else if (typeof bytes === "string") {
|
|
@@ -20132,7 +20132,7 @@ var require_md52 = __commonJS({
|
|
|
20132
20132
|
}
|
|
20133
20133
|
return _crypto.default.createHash("md5").update(bytes).digest();
|
|
20134
20134
|
}
|
|
20135
|
-
var _default =
|
|
20135
|
+
var _default = md55;
|
|
20136
20136
|
exports.default = _default;
|
|
20137
20137
|
}
|
|
20138
20138
|
});
|
|
@@ -21271,7 +21271,7 @@ var require_readdir_glob = __commonJS({
|
|
|
21271
21271
|
});
|
|
21272
21272
|
});
|
|
21273
21273
|
}
|
|
21274
|
-
function
|
|
21274
|
+
function stat3(file, followSymlinks) {
|
|
21275
21275
|
return new Promise((resolve3, reject) => {
|
|
21276
21276
|
const statFunc = followSymlinks ? fs6.stat : fs6.lstat;
|
|
21277
21277
|
statFunc(file, (err, stats) => {
|
|
@@ -21279,7 +21279,7 @@ var require_readdir_glob = __commonJS({
|
|
|
21279
21279
|
switch (err.code) {
|
|
21280
21280
|
case "ENOENT":
|
|
21281
21281
|
if (followSymlinks) {
|
|
21282
|
-
resolve3(
|
|
21282
|
+
resolve3(stat3(file, false));
|
|
21283
21283
|
} else {
|
|
21284
21284
|
resolve3(null);
|
|
21285
21285
|
}
|
|
@@ -21307,7 +21307,7 @@ var require_readdir_glob = __commonJS({
|
|
|
21307
21307
|
const absolute = path2 + "/" + relative;
|
|
21308
21308
|
let stats = null;
|
|
21309
21309
|
if (useStat || followSymlinks) {
|
|
21310
|
-
stats = await
|
|
21310
|
+
stats = await stat3(absolute, followSymlinks);
|
|
21311
21311
|
}
|
|
21312
21312
|
if (!stats && file.name !== void 0) {
|
|
21313
21313
|
stats = file;
|
|
@@ -23465,7 +23465,7 @@ var require_polyfills = __commonJS({
|
|
|
23465
23465
|
}(fs6.rename);
|
|
23466
23466
|
}
|
|
23467
23467
|
fs6.read = typeof fs6.read !== "function" ? fs6.read : function(fs$read) {
|
|
23468
|
-
function
|
|
23468
|
+
function read4(fd, buffer, offset, length, position, callback_) {
|
|
23469
23469
|
var callback;
|
|
23470
23470
|
if (callback_ && typeof callback_ === "function") {
|
|
23471
23471
|
var eagCounter = 0;
|
|
@@ -23480,8 +23480,8 @@ var require_polyfills = __commonJS({
|
|
|
23480
23480
|
return fs$read.call(fs6, fd, buffer, offset, length, position, callback);
|
|
23481
23481
|
}
|
|
23482
23482
|
if (Object.setPrototypeOf)
|
|
23483
|
-
Object.setPrototypeOf(
|
|
23484
|
-
return
|
|
23483
|
+
Object.setPrototypeOf(read4, fs$read);
|
|
23484
|
+
return read4;
|
|
23485
23485
|
}(fs6.read);
|
|
23486
23486
|
fs6.readSync = typeof fs6.readSync !== "function" ? fs6.readSync : function(fs$readSync) {
|
|
23487
23487
|
return function(fd, buffer, offset, length, position) {
|
|
@@ -23840,7 +23840,7 @@ var require_graceful_fs = __commonJS({
|
|
|
23840
23840
|
queue = global[gracefulQueue] || [];
|
|
23841
23841
|
publishQueue(fs6, queue);
|
|
23842
23842
|
fs6.close = function(fs$close) {
|
|
23843
|
-
function
|
|
23843
|
+
function close3(fd, cb) {
|
|
23844
23844
|
return fs$close.call(fs6, fd, function(err) {
|
|
23845
23845
|
if (!err) {
|
|
23846
23846
|
resetQueue();
|
|
@@ -23849,10 +23849,10 @@ var require_graceful_fs = __commonJS({
|
|
|
23849
23849
|
cb.apply(this, arguments);
|
|
23850
23850
|
});
|
|
23851
23851
|
}
|
|
23852
|
-
Object.defineProperty(
|
|
23852
|
+
Object.defineProperty(close3, previousSymbol, {
|
|
23853
23853
|
value: fs$close
|
|
23854
23854
|
});
|
|
23855
|
-
return
|
|
23855
|
+
return close3;
|
|
23856
23856
|
}(fs6.close);
|
|
23857
23857
|
fs6.closeSync = function(fs$closeSync) {
|
|
23858
23858
|
function closeSync(fd) {
|
|
@@ -24053,7 +24053,7 @@ var require_graceful_fs = __commonJS({
|
|
|
24053
24053
|
}
|
|
24054
24054
|
function ReadStream$open() {
|
|
24055
24055
|
var that = this;
|
|
24056
|
-
|
|
24056
|
+
open3(that.path, that.flags, that.mode, function(err, fd) {
|
|
24057
24057
|
if (err) {
|
|
24058
24058
|
if (that.autoClose)
|
|
24059
24059
|
that.destroy();
|
|
@@ -24073,7 +24073,7 @@ var require_graceful_fs = __commonJS({
|
|
|
24073
24073
|
}
|
|
24074
24074
|
function WriteStream$open() {
|
|
24075
24075
|
var that = this;
|
|
24076
|
-
|
|
24076
|
+
open3(that.path, that.flags, that.mode, function(err, fd) {
|
|
24077
24077
|
if (err) {
|
|
24078
24078
|
that.destroy();
|
|
24079
24079
|
that.emit("error", err);
|
|
@@ -24090,8 +24090,8 @@ var require_graceful_fs = __commonJS({
|
|
|
24090
24090
|
return new fs7.WriteStream(path2, options);
|
|
24091
24091
|
}
|
|
24092
24092
|
var fs$open = fs7.open;
|
|
24093
|
-
fs7.open =
|
|
24094
|
-
function
|
|
24093
|
+
fs7.open = open3;
|
|
24094
|
+
function open3(path2, flags, mode, cb) {
|
|
24095
24095
|
if (typeof mode === "function")
|
|
24096
24096
|
cb = mode, mode = null;
|
|
24097
24097
|
return go$open(path2, flags, mode, cb);
|
|
@@ -25431,8 +25431,8 @@ var require_old = __commonJS({
|
|
|
25431
25431
|
if (cache3 && Object.prototype.hasOwnProperty.call(cache3, base)) {
|
|
25432
25432
|
resolvedLink = cache3[base];
|
|
25433
25433
|
} else {
|
|
25434
|
-
var
|
|
25435
|
-
if (!
|
|
25434
|
+
var stat3 = fs6.lstatSync(base);
|
|
25435
|
+
if (!stat3.isSymbolicLink()) {
|
|
25436
25436
|
knownHard[base] = true;
|
|
25437
25437
|
if (cache3)
|
|
25438
25438
|
cache3[base] = base;
|
|
@@ -25440,7 +25440,7 @@ var require_old = __commonJS({
|
|
|
25440
25440
|
}
|
|
25441
25441
|
var linkTarget = null;
|
|
25442
25442
|
if (!isWindows) {
|
|
25443
|
-
var id =
|
|
25443
|
+
var id = stat3.dev.toString(32) + ":" + stat3.ino.toString(32);
|
|
25444
25444
|
if (seenLinks.hasOwnProperty(id)) {
|
|
25445
25445
|
linkTarget = seenLinks[id];
|
|
25446
25446
|
}
|
|
@@ -25514,17 +25514,17 @@ var require_old = __commonJS({
|
|
|
25514
25514
|
}
|
|
25515
25515
|
return fs6.lstat(base, gotStat);
|
|
25516
25516
|
}
|
|
25517
|
-
function gotStat(err,
|
|
25517
|
+
function gotStat(err, stat3) {
|
|
25518
25518
|
if (err)
|
|
25519
25519
|
return cb(err);
|
|
25520
|
-
if (!
|
|
25520
|
+
if (!stat3.isSymbolicLink()) {
|
|
25521
25521
|
knownHard[base] = true;
|
|
25522
25522
|
if (cache3)
|
|
25523
25523
|
cache3[base] = base;
|
|
25524
25524
|
return process.nextTick(LOOP);
|
|
25525
25525
|
}
|
|
25526
25526
|
if (!isWindows) {
|
|
25527
|
-
var id =
|
|
25527
|
+
var id = stat3.dev.toString(32) + ":" + stat3.ino.toString(32);
|
|
25528
25528
|
if (seenLinks.hasOwnProperty(id)) {
|
|
25529
25529
|
return gotTarget(null, seenLinks[id], base);
|
|
25530
25530
|
}
|
|
@@ -26661,27 +26661,27 @@ var require_sync = __commonJS({
|
|
|
26661
26661
|
break;
|
|
26662
26662
|
}
|
|
26663
26663
|
var remain = pattern.slice(n);
|
|
26664
|
-
var
|
|
26664
|
+
var read4;
|
|
26665
26665
|
if (prefix === null)
|
|
26666
|
-
|
|
26666
|
+
read4 = ".";
|
|
26667
26667
|
else if (isAbsolute2(prefix) || isAbsolute2(pattern.map(function(p) {
|
|
26668
26668
|
return typeof p === "string" ? p : "[*]";
|
|
26669
26669
|
}).join("/"))) {
|
|
26670
26670
|
if (!prefix || !isAbsolute2(prefix))
|
|
26671
26671
|
prefix = "/" + prefix;
|
|
26672
|
-
|
|
26672
|
+
read4 = prefix;
|
|
26673
26673
|
} else
|
|
26674
|
-
|
|
26675
|
-
var abs = this._makeAbs(
|
|
26676
|
-
if (childrenIgnored(this,
|
|
26674
|
+
read4 = prefix;
|
|
26675
|
+
var abs = this._makeAbs(read4);
|
|
26676
|
+
if (childrenIgnored(this, read4))
|
|
26677
26677
|
return;
|
|
26678
26678
|
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
26679
26679
|
if (isGlobStar)
|
|
26680
|
-
this._processGlobStar(prefix,
|
|
26680
|
+
this._processGlobStar(prefix, read4, abs, remain, index, inGlobStar);
|
|
26681
26681
|
else
|
|
26682
|
-
this._processReaddir(prefix,
|
|
26682
|
+
this._processReaddir(prefix, read4, abs, remain, index, inGlobStar);
|
|
26683
26683
|
};
|
|
26684
|
-
GlobSync.prototype._processReaddir = function(prefix,
|
|
26684
|
+
GlobSync.prototype._processReaddir = function(prefix, read4, abs, remain, index, inGlobStar) {
|
|
26685
26685
|
var entries = this._readdir(abs, inGlobStar);
|
|
26686
26686
|
if (!entries)
|
|
26687
26687
|
return;
|
|
@@ -26760,7 +26760,7 @@ var require_sync = __commonJS({
|
|
|
26760
26760
|
return this._readdir(abs, false);
|
|
26761
26761
|
var entries;
|
|
26762
26762
|
var lstat;
|
|
26763
|
-
var
|
|
26763
|
+
var stat3;
|
|
26764
26764
|
try {
|
|
26765
26765
|
lstat = this.fs.lstatSync(abs);
|
|
26766
26766
|
} catch (er) {
|
|
@@ -26836,7 +26836,7 @@ var require_sync = __commonJS({
|
|
|
26836
26836
|
break;
|
|
26837
26837
|
}
|
|
26838
26838
|
};
|
|
26839
|
-
GlobSync.prototype._processGlobStar = function(prefix,
|
|
26839
|
+
GlobSync.prototype._processGlobStar = function(prefix, read4, abs, remain, index, inGlobStar) {
|
|
26840
26840
|
var entries = this._readdir(abs, inGlobStar);
|
|
26841
26841
|
if (!entries)
|
|
26842
26842
|
return;
|
|
@@ -26893,8 +26893,8 @@ var require_sync = __commonJS({
|
|
|
26893
26893
|
return false;
|
|
26894
26894
|
}
|
|
26895
26895
|
var exists;
|
|
26896
|
-
var
|
|
26897
|
-
if (!
|
|
26896
|
+
var stat3 = this.statCache[abs];
|
|
26897
|
+
if (!stat3) {
|
|
26898
26898
|
var lstat;
|
|
26899
26899
|
try {
|
|
26900
26900
|
lstat = this.fs.lstatSync(abs);
|
|
@@ -26906,18 +26906,18 @@ var require_sync = __commonJS({
|
|
|
26906
26906
|
}
|
|
26907
26907
|
if (lstat && lstat.isSymbolicLink()) {
|
|
26908
26908
|
try {
|
|
26909
|
-
|
|
26909
|
+
stat3 = this.fs.statSync(abs);
|
|
26910
26910
|
} catch (er) {
|
|
26911
|
-
|
|
26911
|
+
stat3 = lstat;
|
|
26912
26912
|
}
|
|
26913
26913
|
} else {
|
|
26914
|
-
|
|
26914
|
+
stat3 = lstat;
|
|
26915
26915
|
}
|
|
26916
26916
|
}
|
|
26917
|
-
this.statCache[abs] =
|
|
26917
|
+
this.statCache[abs] = stat3;
|
|
26918
26918
|
var c = true;
|
|
26919
|
-
if (
|
|
26920
|
-
c =
|
|
26919
|
+
if (stat3)
|
|
26920
|
+
c = stat3.isDirectory() ? "DIR" : "FILE";
|
|
26921
26921
|
this.cache[abs] = this.cache[abs] || c;
|
|
26922
26922
|
if (needDir && c === "FILE")
|
|
26923
26923
|
return false;
|
|
@@ -27285,33 +27285,33 @@ var require_glob = __commonJS({
|
|
|
27285
27285
|
break;
|
|
27286
27286
|
}
|
|
27287
27287
|
var remain = pattern.slice(n);
|
|
27288
|
-
var
|
|
27288
|
+
var read4;
|
|
27289
27289
|
if (prefix === null)
|
|
27290
|
-
|
|
27290
|
+
read4 = ".";
|
|
27291
27291
|
else if (isAbsolute2(prefix) || isAbsolute2(pattern.map(function(p) {
|
|
27292
27292
|
return typeof p === "string" ? p : "[*]";
|
|
27293
27293
|
}).join("/"))) {
|
|
27294
27294
|
if (!prefix || !isAbsolute2(prefix))
|
|
27295
27295
|
prefix = "/" + prefix;
|
|
27296
|
-
|
|
27296
|
+
read4 = prefix;
|
|
27297
27297
|
} else
|
|
27298
|
-
|
|
27299
|
-
var abs = this._makeAbs(
|
|
27300
|
-
if (childrenIgnored(this,
|
|
27298
|
+
read4 = prefix;
|
|
27299
|
+
var abs = this._makeAbs(read4);
|
|
27300
|
+
if (childrenIgnored(this, read4))
|
|
27301
27301
|
return cb();
|
|
27302
27302
|
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
27303
27303
|
if (isGlobStar)
|
|
27304
|
-
this._processGlobStar(prefix,
|
|
27304
|
+
this._processGlobStar(prefix, read4, abs, remain, index, inGlobStar, cb);
|
|
27305
27305
|
else
|
|
27306
|
-
this._processReaddir(prefix,
|
|
27306
|
+
this._processReaddir(prefix, read4, abs, remain, index, inGlobStar, cb);
|
|
27307
27307
|
};
|
|
27308
|
-
Glob.prototype._processReaddir = function(prefix,
|
|
27308
|
+
Glob.prototype._processReaddir = function(prefix, read4, abs, remain, index, inGlobStar, cb) {
|
|
27309
27309
|
var self2 = this;
|
|
27310
27310
|
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
27311
|
-
return self2._processReaddir2(prefix,
|
|
27311
|
+
return self2._processReaddir2(prefix, read4, abs, remain, index, inGlobStar, entries, cb);
|
|
27312
27312
|
});
|
|
27313
27313
|
};
|
|
27314
|
-
Glob.prototype._processReaddir2 = function(prefix,
|
|
27314
|
+
Glob.prototype._processReaddir2 = function(prefix, read4, abs, remain, index, inGlobStar, entries, cb) {
|
|
27315
27315
|
if (!entries)
|
|
27316
27316
|
return cb();
|
|
27317
27317
|
var pn = remain[0];
|
|
@@ -27492,13 +27492,13 @@ var require_glob = __commonJS({
|
|
|
27492
27492
|
}
|
|
27493
27493
|
return cb();
|
|
27494
27494
|
};
|
|
27495
|
-
Glob.prototype._processGlobStar = function(prefix,
|
|
27495
|
+
Glob.prototype._processGlobStar = function(prefix, read4, abs, remain, index, inGlobStar, cb) {
|
|
27496
27496
|
var self2 = this;
|
|
27497
27497
|
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
27498
|
-
self2._processGlobStar2(prefix,
|
|
27498
|
+
self2._processGlobStar2(prefix, read4, abs, remain, index, inGlobStar, entries, cb);
|
|
27499
27499
|
});
|
|
27500
27500
|
};
|
|
27501
|
-
Glob.prototype._processGlobStar2 = function(prefix,
|
|
27501
|
+
Glob.prototype._processGlobStar2 = function(prefix, read4, abs, remain, index, inGlobStar, entries, cb) {
|
|
27502
27502
|
if (!entries)
|
|
27503
27503
|
return cb();
|
|
27504
27504
|
var remainWithoutGlobStar = remain.slice(1);
|
|
@@ -27561,16 +27561,16 @@ var require_glob = __commonJS({
|
|
|
27561
27561
|
return cb();
|
|
27562
27562
|
}
|
|
27563
27563
|
var exists;
|
|
27564
|
-
var
|
|
27565
|
-
if (
|
|
27566
|
-
if (
|
|
27567
|
-
return cb(null,
|
|
27564
|
+
var stat3 = this.statCache[abs];
|
|
27565
|
+
if (stat3 !== void 0) {
|
|
27566
|
+
if (stat3 === false)
|
|
27567
|
+
return cb(null, stat3);
|
|
27568
27568
|
else {
|
|
27569
|
-
var type =
|
|
27569
|
+
var type = stat3.isDirectory() ? "DIR" : "FILE";
|
|
27570
27570
|
if (needDir && type === "FILE")
|
|
27571
27571
|
return cb();
|
|
27572
27572
|
else
|
|
27573
|
-
return cb(null, type,
|
|
27573
|
+
return cb(null, type, stat3);
|
|
27574
27574
|
}
|
|
27575
27575
|
}
|
|
27576
27576
|
var self2 = this;
|
|
@@ -27579,33 +27579,33 @@ var require_glob = __commonJS({
|
|
|
27579
27579
|
self2.fs.lstat(abs, statcb);
|
|
27580
27580
|
function lstatcb_(er, lstat) {
|
|
27581
27581
|
if (lstat && lstat.isSymbolicLink()) {
|
|
27582
|
-
return self2.fs.stat(abs, function(er2,
|
|
27582
|
+
return self2.fs.stat(abs, function(er2, stat4) {
|
|
27583
27583
|
if (er2)
|
|
27584
27584
|
self2._stat2(f, abs, null, lstat, cb);
|
|
27585
27585
|
else
|
|
27586
|
-
self2._stat2(f, abs, er2,
|
|
27586
|
+
self2._stat2(f, abs, er2, stat4, cb);
|
|
27587
27587
|
});
|
|
27588
27588
|
} else {
|
|
27589
27589
|
self2._stat2(f, abs, er, lstat, cb);
|
|
27590
27590
|
}
|
|
27591
27591
|
}
|
|
27592
27592
|
};
|
|
27593
|
-
Glob.prototype._stat2 = function(f, abs, er,
|
|
27593
|
+
Glob.prototype._stat2 = function(f, abs, er, stat3, cb) {
|
|
27594
27594
|
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
27595
27595
|
this.statCache[abs] = false;
|
|
27596
27596
|
return cb();
|
|
27597
27597
|
}
|
|
27598
27598
|
var needDir = f.slice(-1) === "/";
|
|
27599
|
-
this.statCache[abs] =
|
|
27600
|
-
if (abs.slice(-1) === "/" &&
|
|
27601
|
-
return cb(null, false,
|
|
27599
|
+
this.statCache[abs] = stat3;
|
|
27600
|
+
if (abs.slice(-1) === "/" && stat3 && !stat3.isDirectory())
|
|
27601
|
+
return cb(null, false, stat3);
|
|
27602
27602
|
var c = true;
|
|
27603
|
-
if (
|
|
27604
|
-
c =
|
|
27603
|
+
if (stat3)
|
|
27604
|
+
c = stat3.isDirectory() ? "DIR" : "FILE";
|
|
27605
27605
|
this.cache[abs] = this.cache[abs] || c;
|
|
27606
27606
|
if (needDir && c === "FILE")
|
|
27607
27607
|
return cb();
|
|
27608
|
-
return cb(null, c,
|
|
27608
|
+
return cb(null, c, stat3);
|
|
27609
27609
|
};
|
|
27610
27610
|
}
|
|
27611
27611
|
});
|
|
@@ -44982,7 +44982,7 @@ var require_tar_stream = __commonJS({
|
|
|
44982
44982
|
// ../../node_modules/archiver/lib/plugins/tar.js
|
|
44983
44983
|
var require_tar = __commonJS({
|
|
44984
44984
|
"../../node_modules/archiver/lib/plugins/tar.js"(exports, module2) {
|
|
44985
|
-
var
|
|
44985
|
+
var zlib2 = require("zlib");
|
|
44986
44986
|
var engine = require_tar_stream();
|
|
44987
44987
|
var util = require_archiver_utils();
|
|
44988
44988
|
var Tar = function(options) {
|
|
@@ -45002,7 +45002,7 @@ var require_tar = __commonJS({
|
|
|
45002
45002
|
this.engine = engine.pack(options);
|
|
45003
45003
|
this.compressor = false;
|
|
45004
45004
|
if (options.gzip) {
|
|
45005
|
-
this.compressor =
|
|
45005
|
+
this.compressor = zlib2.createGzip(options.gzipOptions);
|
|
45006
45006
|
this.compressor.on("error", this._onCompressorError.bind(this));
|
|
45007
45007
|
}
|
|
45008
45008
|
};
|
|
@@ -46555,6 +46555,11 @@ __export(exports, {
|
|
|
46555
46555
|
Tiles3DConverter: () => Tiles3DConverter
|
|
46556
46556
|
});
|
|
46557
46557
|
|
|
46558
|
+
// ../loader-utils/src/loader-types.ts
|
|
46559
|
+
async function parseFromContext(data, loaders, options, context) {
|
|
46560
|
+
return context._parse(data, loaders, options, context);
|
|
46561
|
+
}
|
|
46562
|
+
|
|
46558
46563
|
// ../loader-utils/src/lib/env-utils/assert.ts
|
|
46559
46564
|
function assert2(condition, message) {
|
|
46560
46565
|
if (!condition) {
|
|
@@ -47683,6 +47688,9 @@ function toArrayBuffer2(data) {
|
|
|
47683
47688
|
}
|
|
47684
47689
|
|
|
47685
47690
|
// ../loader-utils/src/lib/node/promisify.ts
|
|
47691
|
+
function promisify1(fn) {
|
|
47692
|
+
return (args) => new Promise((resolve2, reject) => fn(args, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs)));
|
|
47693
|
+
}
|
|
47686
47694
|
function promisify2(fn) {
|
|
47687
47695
|
return (arg1, arg2) => new Promise((resolve2, reject) => fn(arg1, arg2, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs)));
|
|
47688
47696
|
}
|
|
@@ -48748,11 +48756,11 @@ function getGlobalLoaderState() {
|
|
|
48748
48756
|
loaders._state = loaders._state || {};
|
|
48749
48757
|
return loaders._state;
|
|
48750
48758
|
}
|
|
48751
|
-
|
|
48759
|
+
function getGlobalLoaderOptions() {
|
|
48752
48760
|
const state = getGlobalLoaderState();
|
|
48753
48761
|
state.globalOptions = state.globalOptions || { ...DEFAULT_LOADER_OPTIONS };
|
|
48754
48762
|
return state.globalOptions;
|
|
48755
|
-
}
|
|
48763
|
+
}
|
|
48756
48764
|
function normalizeOptions(options, loader, loaders, url) {
|
|
48757
48765
|
loaders = loaders || [];
|
|
48758
48766
|
loaders = Array.isArray(loaders) ? loaders : [loaders];
|
|
@@ -48935,8 +48943,10 @@ function selectLoaderInternal(data, loaders, options, context) {
|
|
|
48935
48943
|
reason = reason || (loader ? `matched MIME type ${type}` : "");
|
|
48936
48944
|
loader = loader || findLoaderByInitialBytes(loaders, data);
|
|
48937
48945
|
reason = reason || (loader ? `matched initial data ${getFirstCharacters2(data)}` : "");
|
|
48938
|
-
|
|
48939
|
-
|
|
48946
|
+
if (options?.fallbackMimeType) {
|
|
48947
|
+
loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
|
|
48948
|
+
reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
|
|
48949
|
+
}
|
|
48940
48950
|
if (reason) {
|
|
48941
48951
|
log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
|
|
48942
48952
|
}
|
|
@@ -49032,7 +49042,7 @@ function testBinary(data, byteOffset, loader, test) {
|
|
|
49032
49042
|
}
|
|
49033
49043
|
switch (typeof test) {
|
|
49034
49044
|
case "function":
|
|
49035
|
-
return test(data
|
|
49045
|
+
return test(data);
|
|
49036
49046
|
case "string":
|
|
49037
49047
|
const magic = getMagicString2(data, byteOffset, test.length);
|
|
49038
49048
|
return test === magic;
|
|
@@ -49247,7 +49257,7 @@ function getLoaderContext(context, options, parentContext) {
|
|
|
49247
49257
|
return newContext;
|
|
49248
49258
|
}
|
|
49249
49259
|
function getLoadersFromContext(loaders, context) {
|
|
49250
|
-
if (
|
|
49260
|
+
if (loaders && !Array.isArray(loaders)) {
|
|
49251
49261
|
return loaders;
|
|
49252
49262
|
}
|
|
49253
49263
|
let candidateLoaders;
|
|
@@ -49258,12 +49268,11 @@ function getLoadersFromContext(loaders, context) {
|
|
|
49258
49268
|
const contextLoaders = Array.isArray(context.loaders) ? context.loaders : [context.loaders];
|
|
49259
49269
|
candidateLoaders = candidateLoaders ? [...candidateLoaders, ...contextLoaders] : contextLoaders;
|
|
49260
49270
|
}
|
|
49261
|
-
return candidateLoaders && candidateLoaders.length ? candidateLoaders :
|
|
49271
|
+
return candidateLoaders && candidateLoaders.length ? candidateLoaders : void 0;
|
|
49262
49272
|
}
|
|
49263
49273
|
|
|
49264
49274
|
// ../core/src/lib/api/parse.ts
|
|
49265
49275
|
async function parse(data, loaders, options, context) {
|
|
49266
|
-
assert3(!context || typeof context === "object");
|
|
49267
49276
|
if (loaders && !Array.isArray(loaders) && !isLoaderObject(loaders)) {
|
|
49268
49277
|
context = void 0;
|
|
49269
49278
|
options = loaders;
|
|
@@ -49279,7 +49288,7 @@ async function parse(data, loaders, options, context) {
|
|
|
49279
49288
|
return null;
|
|
49280
49289
|
}
|
|
49281
49290
|
options = normalizeOptions(options, loader, candidateLoaders, url);
|
|
49282
|
-
context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context || null);
|
|
49291
|
+
context = getLoaderContext({ url, _parse: parse, loaders: candidateLoaders }, options, context || null);
|
|
49283
49292
|
return await parseWithLoader(loader, data, options, context);
|
|
49284
49293
|
}
|
|
49285
49294
|
async function parseWithLoader(loader, data, options, context) {
|
|
@@ -51191,7 +51200,6 @@ async function loadDraco(tile, dracoData, options, context) {
|
|
|
51191
51200
|
if (!context) {
|
|
51192
51201
|
return;
|
|
51193
51202
|
}
|
|
51194
|
-
const { parse: parse7 } = context;
|
|
51195
51203
|
const dracoOptions = {
|
|
51196
51204
|
...options,
|
|
51197
51205
|
draco: {
|
|
@@ -51200,7 +51208,7 @@ async function loadDraco(tile, dracoData, options, context) {
|
|
|
51200
51208
|
}
|
|
51201
51209
|
};
|
|
51202
51210
|
delete dracoOptions["3d-tiles"];
|
|
51203
|
-
const data = await
|
|
51211
|
+
const data = await parseFromContext(dracoData.buffer, DracoLoader2, dracoOptions, context);
|
|
51204
51212
|
const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
|
|
51205
51213
|
const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
|
|
51206
51214
|
const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
|
|
@@ -53610,10 +53618,9 @@ async function decompressPrimitive(scenegraph, primitive, options, context) {
|
|
|
53610
53618
|
}
|
|
53611
53619
|
const buffer = scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);
|
|
53612
53620
|
const bufferCopy = sliceArrayBuffer(buffer.buffer, buffer.byteOffset);
|
|
53613
|
-
const { parse: parse7 } = context;
|
|
53614
53621
|
const dracoOptions = { ...options };
|
|
53615
53622
|
delete dracoOptions["3d-tiles"];
|
|
53616
|
-
const decodedData = await
|
|
53623
|
+
const decodedData = await parseFromContext(bufferCopy, DracoLoader2, dracoOptions, context);
|
|
53617
53624
|
const decodedAttributes = getGLTFAccessors(decodedData.attributes);
|
|
53618
53625
|
for (const [attributeName, decodedAttribute] of Object.entries(decodedAttributes)) {
|
|
53619
53626
|
if (attributeName in primitive.attributes) {
|
|
@@ -54523,10 +54530,10 @@ function getReferencesImageIndices(gltf) {
|
|
|
54523
54530
|
return Array.from(imageIndices).sort();
|
|
54524
54531
|
}
|
|
54525
54532
|
async function loadImage(gltf, image, index, options, context) {
|
|
54526
|
-
const { fetch: fetch2, parse: parse7 } = context;
|
|
54527
54533
|
let arrayBuffer;
|
|
54528
54534
|
if (image.uri && !image.hasOwnProperty("bufferView")) {
|
|
54529
54535
|
const uri = resolveUrl(image.uri, options);
|
|
54536
|
+
const { fetch: fetch2 } = context;
|
|
54530
54537
|
const response = await fetch2(uri);
|
|
54531
54538
|
arrayBuffer = await response.arrayBuffer();
|
|
54532
54539
|
image.bufferView = {
|
|
@@ -54538,7 +54545,7 @@ async function loadImage(gltf, image, index, options, context) {
|
|
|
54538
54545
|
arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);
|
|
54539
54546
|
}
|
|
54540
54547
|
assert6(arrayBuffer, "glTF image has no data");
|
|
54541
|
-
let parsedImage = await
|
|
54548
|
+
let parsedImage = await parseFromContext(arrayBuffer, [ImageLoader, BasisLoader], {
|
|
54542
54549
|
...options,
|
|
54543
54550
|
mimeType: image.mimeType,
|
|
54544
54551
|
basis: options.basis || { format: selectSupportedBasisFormat() }
|
|
@@ -55072,14 +55079,14 @@ async function extractGLTF(tile, gltfFormat, options, context) {
|
|
|
55072
55079
|
if (!context) {
|
|
55073
55080
|
return;
|
|
55074
55081
|
}
|
|
55075
|
-
const { parse: parse7, fetch: fetch2 } = context;
|
|
55076
55082
|
if (tile.gltfUrl) {
|
|
55083
|
+
const { fetch: fetch2 } = context;
|
|
55077
55084
|
const response = await fetch2(tile.gltfUrl, options);
|
|
55078
55085
|
tile.gltfArrayBuffer = await response.arrayBuffer();
|
|
55079
55086
|
tile.gltfByteOffset = 0;
|
|
55080
55087
|
}
|
|
55081
55088
|
if (tile.gltfArrayBuffer) {
|
|
55082
|
-
const gltfWithBuffers = await
|
|
55089
|
+
const gltfWithBuffers = await parseFromContext(tile.gltfArrayBuffer, GLTFLoader, options, context);
|
|
55083
55090
|
tile.gltf = postProcessGLTF(gltfWithBuffers);
|
|
55084
55091
|
tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
|
|
55085
55092
|
delete tile.gltfArrayBuffer;
|
|
@@ -55278,13 +55285,12 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
|
|
|
55278
55285
|
// ../3d-tiles/src/lib/parsers/parse-3d-tile-gltf.ts
|
|
55279
55286
|
async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
55280
55287
|
tile.rotateYtoZ = true;
|
|
55281
|
-
tile.gltfUpAxis = options?.["3d-tiles"]
|
|
55288
|
+
tile.gltfUpAxis = options?.["3d-tiles"]?.assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
|
|
55282
55289
|
if (options?.["3d-tiles"]?.loadGLTF) {
|
|
55283
55290
|
if (!context) {
|
|
55284
55291
|
return;
|
|
55285
55292
|
}
|
|
55286
|
-
const
|
|
55287
|
-
const gltfWithBuffers = await parse7(arrayBuffer, GLTFLoader, options, context);
|
|
55293
|
+
const gltfWithBuffers = await parseFromContext(arrayBuffer, GLTFLoader, options, context);
|
|
55288
55294
|
tile.gltf = postProcessGLTF(gltfWithBuffers);
|
|
55289
55295
|
tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
|
|
55290
55296
|
} else {
|
|
@@ -57346,7 +57352,7 @@ function resolveUri(uri = "", basePath) {
|
|
|
57346
57352
|
} else if (uri.startsWith("/")) {
|
|
57347
57353
|
return uri;
|
|
57348
57354
|
}
|
|
57349
|
-
return
|
|
57355
|
+
return path_exports.resolve(basePath, uri);
|
|
57350
57356
|
}
|
|
57351
57357
|
function normalizeTileData(tile, basePath) {
|
|
57352
57358
|
if (!tile) {
|
|
@@ -57611,6 +57617,629 @@ var CesiumIonLoader = {
|
|
|
57611
57617
|
}
|
|
57612
57618
|
};
|
|
57613
57619
|
|
|
57620
|
+
// ../zip/src/file-provider/file-handle.ts
|
|
57621
|
+
var import_fs3 = __toModule(require("fs"));
|
|
57622
|
+
var _FileHandle = class {
|
|
57623
|
+
constructor(fileDescriptor, stats) {
|
|
57624
|
+
this.read = (buffer, offset, length, position) => {
|
|
57625
|
+
return new Promise((s) => {
|
|
57626
|
+
(0, import_fs3.read)(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer2) => s({ bytesRead, buffer: buffer2 }));
|
|
57627
|
+
});
|
|
57628
|
+
};
|
|
57629
|
+
this.fileDescriptor = fileDescriptor;
|
|
57630
|
+
this.stats = stats;
|
|
57631
|
+
}
|
|
57632
|
+
async close() {
|
|
57633
|
+
return new Promise((resolve2) => {
|
|
57634
|
+
(0, import_fs3.close)(this.fileDescriptor, (_err) => resolve2());
|
|
57635
|
+
});
|
|
57636
|
+
}
|
|
57637
|
+
get stat() {
|
|
57638
|
+
return this.stats;
|
|
57639
|
+
}
|
|
57640
|
+
};
|
|
57641
|
+
var FileHandle = _FileHandle;
|
|
57642
|
+
FileHandle.open = async (path2) => {
|
|
57643
|
+
const [fd, stats] = await Promise.all([
|
|
57644
|
+
new Promise((s) => {
|
|
57645
|
+
(0, import_fs3.open)(path2, void 0, void 0, (_err, fd2) => s(fd2));
|
|
57646
|
+
}),
|
|
57647
|
+
new Promise((s) => {
|
|
57648
|
+
(0, import_fs3.stat)(path2, { bigint: true }, (_err, stats2) => s(stats2));
|
|
57649
|
+
})
|
|
57650
|
+
]);
|
|
57651
|
+
return new _FileHandle(fd, stats);
|
|
57652
|
+
};
|
|
57653
|
+
|
|
57654
|
+
// ../zip/src/file-provider/file-handle-file.ts
|
|
57655
|
+
var FileHandleFile = class {
|
|
57656
|
+
static async from(path2) {
|
|
57657
|
+
const fileDescriptor = await FileHandle.open(path2);
|
|
57658
|
+
return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);
|
|
57659
|
+
}
|
|
57660
|
+
constructor(fileDescriptor, size) {
|
|
57661
|
+
this.fileDescriptor = fileDescriptor;
|
|
57662
|
+
this.size = size;
|
|
57663
|
+
}
|
|
57664
|
+
async destroy() {
|
|
57665
|
+
await this.fileDescriptor.close();
|
|
57666
|
+
}
|
|
57667
|
+
async getUint8(offset) {
|
|
57668
|
+
const val = new Uint8Array((await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer).at(0);
|
|
57669
|
+
if (val === void 0) {
|
|
57670
|
+
throw new Error("something went wrong");
|
|
57671
|
+
}
|
|
57672
|
+
return val;
|
|
57673
|
+
}
|
|
57674
|
+
async getUint16(offset) {
|
|
57675
|
+
const val = new Uint16Array((await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer).at(0);
|
|
57676
|
+
if (val === void 0) {
|
|
57677
|
+
throw new Error("something went wrong");
|
|
57678
|
+
}
|
|
57679
|
+
return val;
|
|
57680
|
+
}
|
|
57681
|
+
async getUint32(offset) {
|
|
57682
|
+
const val = new Uint32Array((await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer).at(0);
|
|
57683
|
+
if (val === void 0) {
|
|
57684
|
+
throw new Error("something went wrong");
|
|
57685
|
+
}
|
|
57686
|
+
return val;
|
|
57687
|
+
}
|
|
57688
|
+
async getBigUint64(offset) {
|
|
57689
|
+
const val = new BigInt64Array((await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer).at(0);
|
|
57690
|
+
if (val === void 0) {
|
|
57691
|
+
throw new Error("something went wrong");
|
|
57692
|
+
}
|
|
57693
|
+
return val;
|
|
57694
|
+
}
|
|
57695
|
+
async slice(startOffsset, endOffset) {
|
|
57696
|
+
const bigLength = endOffset - startOffsset;
|
|
57697
|
+
if (bigLength > Number.MAX_SAFE_INTEGER) {
|
|
57698
|
+
throw new Error("too big slice");
|
|
57699
|
+
}
|
|
57700
|
+
const length = Number(bigLength);
|
|
57701
|
+
return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer.buffer;
|
|
57702
|
+
}
|
|
57703
|
+
get length() {
|
|
57704
|
+
return this.size;
|
|
57705
|
+
}
|
|
57706
|
+
};
|
|
57707
|
+
|
|
57708
|
+
// ../zip/src/parse-zip/search-from-the-end.ts
|
|
57709
|
+
var searchFromTheEnd = async (file, target) => {
|
|
57710
|
+
const searchWindow = [
|
|
57711
|
+
await file.getUint8(file.length - 1n),
|
|
57712
|
+
await file.getUint8(file.length - 2n),
|
|
57713
|
+
await file.getUint8(file.length - 3n),
|
|
57714
|
+
void 0
|
|
57715
|
+
];
|
|
57716
|
+
let targetOffset = 0n;
|
|
57717
|
+
for (let i = file.length - 4n; i > -1; i--) {
|
|
57718
|
+
searchWindow[3] = searchWindow[2];
|
|
57719
|
+
searchWindow[2] = searchWindow[1];
|
|
57720
|
+
searchWindow[1] = searchWindow[0];
|
|
57721
|
+
searchWindow[0] = await file.getUint8(i);
|
|
57722
|
+
if (searchWindow.every((val, index) => val === target[index])) {
|
|
57723
|
+
targetOffset = i;
|
|
57724
|
+
break;
|
|
57725
|
+
}
|
|
57726
|
+
}
|
|
57727
|
+
return targetOffset;
|
|
57728
|
+
};
|
|
57729
|
+
|
|
57730
|
+
// ../zip/src/parse-zip/end-of-central-directory.ts
|
|
57731
|
+
var eoCDSignature = [80, 75, 5, 6];
|
|
57732
|
+
var zip64EoCDLocatorSignature = Buffer.from([80, 75, 6, 7]);
|
|
57733
|
+
var zip64EoCDSignature = Buffer.from([80, 75, 6, 6]);
|
|
57734
|
+
var CD_RECORDS_NUMBER_OFFSET = 8n;
|
|
57735
|
+
var CD_START_OFFSET_OFFSET = 16n;
|
|
57736
|
+
var ZIP64_EOCD_START_OFFSET_OFFSET = 8n;
|
|
57737
|
+
var ZIP64_CD_RECORDS_NUMBER_OFFSET = 24n;
|
|
57738
|
+
var ZIP64_CD_START_OFFSET_OFFSET = 48n;
|
|
57739
|
+
var parseEoCDRecord = async (fileProvider) => {
|
|
57740
|
+
const zipEoCDOffset = await searchFromTheEnd(fileProvider, eoCDSignature);
|
|
57741
|
+
let cdRecordsNumber = BigInt(await fileProvider.getUint16(zipEoCDOffset + CD_RECORDS_NUMBER_OFFSET));
|
|
57742
|
+
let cdStartOffset = BigInt(await fileProvider.getUint32(zipEoCDOffset + CD_START_OFFSET_OFFSET));
|
|
57743
|
+
if (cdStartOffset === BigInt(4294967295) || cdRecordsNumber === BigInt(4294967295)) {
|
|
57744
|
+
const zip64EoCDLocatorOffset = zipEoCDOffset - 20n;
|
|
57745
|
+
if (Buffer.from(await fileProvider.slice(zip64EoCDLocatorOffset, zip64EoCDLocatorOffset + 4n)).compare(zip64EoCDLocatorSignature) !== 0) {
|
|
57746
|
+
throw new Error("zip64 EoCD locator not found");
|
|
57747
|
+
}
|
|
57748
|
+
const zip64EoCDOffset = await fileProvider.getBigUint64(zip64EoCDLocatorOffset + ZIP64_EOCD_START_OFFSET_OFFSET);
|
|
57749
|
+
if (Buffer.from(await fileProvider.slice(zip64EoCDOffset, zip64EoCDOffset + 4n)).compare(zip64EoCDSignature) !== 0) {
|
|
57750
|
+
throw new Error("zip64 EoCD not found");
|
|
57751
|
+
}
|
|
57752
|
+
cdRecordsNumber = await fileProvider.getBigUint64(zip64EoCDOffset + ZIP64_CD_RECORDS_NUMBER_OFFSET);
|
|
57753
|
+
cdStartOffset = await fileProvider.getBigUint64(zip64EoCDOffset + ZIP64_CD_START_OFFSET_OFFSET);
|
|
57754
|
+
}
|
|
57755
|
+
return {
|
|
57756
|
+
cdRecordsNumber,
|
|
57757
|
+
cdStartOffset
|
|
57758
|
+
};
|
|
57759
|
+
};
|
|
57760
|
+
|
|
57761
|
+
// ../zip/src/parse-zip/cd-file-header.ts
|
|
57762
|
+
var CD_COMPRESSED_SIZE_OFFSET = 20n;
|
|
57763
|
+
var CD_UNCOMPRESSED_SIZE_OFFSET = 24n;
|
|
57764
|
+
var CD_FILE_NAME_LENGTH_OFFSET = 28n;
|
|
57765
|
+
var CD_EXTRA_FIELD_LENGTH_OFFSET = 30n;
|
|
57766
|
+
var CD_LOCAL_HEADER_OFFSET_OFFSET = 42n;
|
|
57767
|
+
var CD_FILE_NAME_OFFSET = 46n;
|
|
57768
|
+
var signature = [80, 75, 1, 2];
|
|
57769
|
+
var parseZipCDFileHeader = async (headerOffset, buffer) => {
|
|
57770
|
+
if (Buffer.from(await buffer.slice(headerOffset, headerOffset + 4n)).compare(Buffer.from(signature)) !== 0) {
|
|
57771
|
+
return null;
|
|
57772
|
+
}
|
|
57773
|
+
let compressedSize = BigInt(await buffer.getUint32(headerOffset + CD_COMPRESSED_SIZE_OFFSET));
|
|
57774
|
+
let uncompressedSize = BigInt(await buffer.getUint32(headerOffset + CD_UNCOMPRESSED_SIZE_OFFSET));
|
|
57775
|
+
const extraFieldLength = await buffer.getUint16(headerOffset + CD_EXTRA_FIELD_LENGTH_OFFSET);
|
|
57776
|
+
const fileNameLength = await buffer.getUint16(headerOffset + CD_FILE_NAME_LENGTH_OFFSET);
|
|
57777
|
+
const fileName = new TextDecoder().decode(await buffer.slice(headerOffset + CD_FILE_NAME_OFFSET, headerOffset + CD_FILE_NAME_OFFSET + BigInt(fileNameLength)));
|
|
57778
|
+
const extraOffset = headerOffset + CD_FILE_NAME_OFFSET + BigInt(fileNameLength);
|
|
57779
|
+
const oldFormatOffset = await buffer.getUint32(headerOffset + CD_LOCAL_HEADER_OFFSET_OFFSET);
|
|
57780
|
+
let fileDataOffset = BigInt(oldFormatOffset);
|
|
57781
|
+
let offsetInZip64Data = 4n;
|
|
57782
|
+
if (uncompressedSize === BigInt(4294967295)) {
|
|
57783
|
+
uncompressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
57784
|
+
offsetInZip64Data += 8n;
|
|
57785
|
+
}
|
|
57786
|
+
if (compressedSize === BigInt(4294967295)) {
|
|
57787
|
+
compressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
57788
|
+
offsetInZip64Data += 8n;
|
|
57789
|
+
}
|
|
57790
|
+
if (fileDataOffset === BigInt(4294967295)) {
|
|
57791
|
+
fileDataOffset = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
57792
|
+
}
|
|
57793
|
+
const localHeaderOffset = fileDataOffset;
|
|
57794
|
+
return {
|
|
57795
|
+
compressedSize,
|
|
57796
|
+
uncompressedSize,
|
|
57797
|
+
extraFieldLength,
|
|
57798
|
+
fileNameLength,
|
|
57799
|
+
fileName,
|
|
57800
|
+
extraOffset,
|
|
57801
|
+
localHeaderOffset
|
|
57802
|
+
};
|
|
57803
|
+
};
|
|
57804
|
+
async function* zipCDFileHeaderGenerator(fileProvider) {
|
|
57805
|
+
const { cdStartOffset } = await parseEoCDRecord(fileProvider);
|
|
57806
|
+
let cdHeader = await parseZipCDFileHeader(cdStartOffset, fileProvider);
|
|
57807
|
+
while (cdHeader) {
|
|
57808
|
+
yield cdHeader;
|
|
57809
|
+
cdHeader = await parseZipCDFileHeader(cdHeader.extraOffset + BigInt(cdHeader.extraFieldLength), fileProvider);
|
|
57810
|
+
}
|
|
57811
|
+
}
|
|
57812
|
+
|
|
57813
|
+
// ../zip/src/parse-zip/local-file-header.ts
|
|
57814
|
+
var COMPRESSION_METHOD_OFFSET = 8n;
|
|
57815
|
+
var COMPRESSED_SIZE_OFFSET = 18n;
|
|
57816
|
+
var UNCOMPRESSED_SIZE_OFFSET = 22n;
|
|
57817
|
+
var FILE_NAME_LENGTH_OFFSET = 26n;
|
|
57818
|
+
var EXTRA_FIELD_LENGTH_OFFSET = 28n;
|
|
57819
|
+
var FILE_NAME_OFFSET = 30n;
|
|
57820
|
+
var signature2 = Buffer.from([80, 75, 3, 4]);
|
|
57821
|
+
var parseZipLocalFileHeader = async (headerOffset, buffer) => {
|
|
57822
|
+
if (Buffer.from(await buffer.slice(headerOffset, headerOffset + 4n)).compare(signature2) !== 0) {
|
|
57823
|
+
return null;
|
|
57824
|
+
}
|
|
57825
|
+
const fileNameLength = await buffer.getUint16(headerOffset + FILE_NAME_LENGTH_OFFSET);
|
|
57826
|
+
const fileName = new TextDecoder().decode(await buffer.slice(headerOffset + FILE_NAME_OFFSET, headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength))).split("\\").join("/");
|
|
57827
|
+
const extraFieldLength = await buffer.getUint16(headerOffset + EXTRA_FIELD_LENGTH_OFFSET);
|
|
57828
|
+
let fileDataOffset = headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength + extraFieldLength);
|
|
57829
|
+
const compressionMethod = await buffer.getUint16(headerOffset + COMPRESSION_METHOD_OFFSET);
|
|
57830
|
+
let compressedSize = BigInt(await buffer.getUint32(headerOffset + COMPRESSED_SIZE_OFFSET));
|
|
57831
|
+
let uncompressedSize = BigInt(await buffer.getUint32(headerOffset + UNCOMPRESSED_SIZE_OFFSET));
|
|
57832
|
+
const extraOffset = headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength);
|
|
57833
|
+
let offsetInZip64Data = 4n;
|
|
57834
|
+
if (uncompressedSize === BigInt(4294967295)) {
|
|
57835
|
+
uncompressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
57836
|
+
offsetInZip64Data += 8n;
|
|
57837
|
+
}
|
|
57838
|
+
if (compressedSize === BigInt(4294967295)) {
|
|
57839
|
+
compressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
57840
|
+
offsetInZip64Data += 8n;
|
|
57841
|
+
}
|
|
57842
|
+
if (fileDataOffset === BigInt(4294967295)) {
|
|
57843
|
+
fileDataOffset = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
57844
|
+
}
|
|
57845
|
+
return {
|
|
57846
|
+
fileNameLength,
|
|
57847
|
+
fileName,
|
|
57848
|
+
extraFieldLength,
|
|
57849
|
+
fileDataOffset,
|
|
57850
|
+
compressedSize,
|
|
57851
|
+
compressionMethod
|
|
57852
|
+
};
|
|
57853
|
+
};
|
|
57854
|
+
|
|
57855
|
+
// ../zip/src/hash-file-utility.ts
|
|
57856
|
+
var import_md5 = __toModule(require_md5());
|
|
57857
|
+
var compareHashes = (hash1, hash2) => {
|
|
57858
|
+
const h1 = new BigUint64Array(hash1.buffer, hash1.byteOffset, 2);
|
|
57859
|
+
const h2 = new BigUint64Array(hash2.buffer, hash2.byteOffset, 2);
|
|
57860
|
+
const diff = h1[0] === h2[0] ? h1[1] - h2[1] : h1[0] - h2[0];
|
|
57861
|
+
if (diff < 0n) {
|
|
57862
|
+
return -1;
|
|
57863
|
+
} else if (diff === 0n) {
|
|
57864
|
+
return 0;
|
|
57865
|
+
}
|
|
57866
|
+
return 1;
|
|
57867
|
+
};
|
|
57868
|
+
var parseHashFile = (hashFile) => {
|
|
57869
|
+
const hashFileBuffer = Buffer.from(hashFile);
|
|
57870
|
+
const hashArray = [];
|
|
57871
|
+
for (let i = 0; i < hashFileBuffer.buffer.byteLength; i = i + 24) {
|
|
57872
|
+
const offsetBuffer = new DataView(hashFileBuffer.buffer.slice(hashFileBuffer.byteOffset + i + 16, hashFileBuffer.byteOffset + i + 24));
|
|
57873
|
+
const offset = offsetBuffer.getBigUint64(offsetBuffer.byteOffset, true);
|
|
57874
|
+
hashArray.push({
|
|
57875
|
+
hash: Buffer.from(hashFileBuffer.subarray(hashFileBuffer.byteOffset + i, hashFileBuffer.byteOffset + i + 16)),
|
|
57876
|
+
offset
|
|
57877
|
+
});
|
|
57878
|
+
}
|
|
57879
|
+
return hashArray;
|
|
57880
|
+
};
|
|
57881
|
+
var findBin = (hashToSearch, hashArray) => {
|
|
57882
|
+
let lowerBorder = 0;
|
|
57883
|
+
let upperBorder = hashArray.length;
|
|
57884
|
+
while (upperBorder - lowerBorder > 1) {
|
|
57885
|
+
const middle = lowerBorder + Math.floor((upperBorder - lowerBorder) / 2);
|
|
57886
|
+
const value = compareHashes(hashArray[middle].hash, hashToSearch);
|
|
57887
|
+
if (value === 0) {
|
|
57888
|
+
return hashArray[middle];
|
|
57889
|
+
} else if (value < 0) {
|
|
57890
|
+
lowerBorder = middle;
|
|
57891
|
+
} else {
|
|
57892
|
+
upperBorder = middle;
|
|
57893
|
+
}
|
|
57894
|
+
}
|
|
57895
|
+
return void 0;
|
|
57896
|
+
};
|
|
57897
|
+
|
|
57898
|
+
// ../zip/src/file-provider/file-provider.ts
|
|
57899
|
+
var isFileProvider = (fileProvider) => {
|
|
57900
|
+
return fileProvider?.getUint8 && fileProvider?.slice && fileProvider?.length;
|
|
57901
|
+
};
|
|
57902
|
+
|
|
57903
|
+
// ../compression/src/lib/compression.ts
|
|
57904
|
+
var Compression = class {
|
|
57905
|
+
constructor(options) {
|
|
57906
|
+
this.compressBatches = this.compressBatches.bind(this);
|
|
57907
|
+
this.decompressBatches = this.decompressBatches.bind(this);
|
|
57908
|
+
}
|
|
57909
|
+
async preload() {
|
|
57910
|
+
return;
|
|
57911
|
+
}
|
|
57912
|
+
async compress(input) {
|
|
57913
|
+
await this.preload();
|
|
57914
|
+
return this.compressSync(input);
|
|
57915
|
+
}
|
|
57916
|
+
async decompress(input, size) {
|
|
57917
|
+
await this.preload();
|
|
57918
|
+
return this.decompressSync(input, size);
|
|
57919
|
+
}
|
|
57920
|
+
compressSync(input) {
|
|
57921
|
+
throw new Error(`${this.name}: sync compression not supported`);
|
|
57922
|
+
}
|
|
57923
|
+
decompressSync(input, size) {
|
|
57924
|
+
throw new Error(`${this.name}: sync decompression not supported`);
|
|
57925
|
+
}
|
|
57926
|
+
async *compressBatches(asyncIterator) {
|
|
57927
|
+
const input = await this.concatenate(asyncIterator);
|
|
57928
|
+
yield this.compress(input);
|
|
57929
|
+
}
|
|
57930
|
+
async *decompressBatches(asyncIterator) {
|
|
57931
|
+
const input = await this.concatenate(asyncIterator);
|
|
57932
|
+
yield this.decompress(input);
|
|
57933
|
+
}
|
|
57934
|
+
concatenate(asyncIterator) {
|
|
57935
|
+
return concatenateArrayBuffersAsync(asyncIterator);
|
|
57936
|
+
}
|
|
57937
|
+
improveError(error) {
|
|
57938
|
+
if (!error.message.includes(this.name)) {
|
|
57939
|
+
error.message = `${this.name} ${error.message}`;
|
|
57940
|
+
}
|
|
57941
|
+
return error;
|
|
57942
|
+
}
|
|
57943
|
+
};
|
|
57944
|
+
|
|
57945
|
+
// ../compression/src/lib/no-compression.ts
|
|
57946
|
+
var NoCompression = class extends Compression {
|
|
57947
|
+
constructor(options) {
|
|
57948
|
+
super(options);
|
|
57949
|
+
this.name = "uncompressed";
|
|
57950
|
+
this.extensions = [];
|
|
57951
|
+
this.contentEncodings = [];
|
|
57952
|
+
this.isSupported = true;
|
|
57953
|
+
this.options = options || {};
|
|
57954
|
+
}
|
|
57955
|
+
compressSync(input) {
|
|
57956
|
+
return input;
|
|
57957
|
+
}
|
|
57958
|
+
decompressSync(input) {
|
|
57959
|
+
return input;
|
|
57960
|
+
}
|
|
57961
|
+
async *compressBatches(asyncIterator) {
|
|
57962
|
+
return yield* asyncIterator;
|
|
57963
|
+
}
|
|
57964
|
+
async *decompressBatches(asyncIterator) {
|
|
57965
|
+
return yield* asyncIterator;
|
|
57966
|
+
}
|
|
57967
|
+
};
|
|
57968
|
+
|
|
57969
|
+
// ../compression/src/lib/deflate-compression.ts
|
|
57970
|
+
var import_pako = __toModule(require_pako());
|
|
57971
|
+
var import_zlib = __toModule(require("zlib"));
|
|
57972
|
+
var DeflateCompression = class extends Compression {
|
|
57973
|
+
constructor(options = {}) {
|
|
57974
|
+
super(options);
|
|
57975
|
+
this.name = "deflate";
|
|
57976
|
+
this.extensions = [];
|
|
57977
|
+
this.contentEncodings = ["deflate"];
|
|
57978
|
+
this.isSupported = true;
|
|
57979
|
+
this._chunks = [];
|
|
57980
|
+
this.options = options;
|
|
57981
|
+
}
|
|
57982
|
+
async compress(input) {
|
|
57983
|
+
if (!isBrowser && this.options.deflate?.useZlib) {
|
|
57984
|
+
const buffer = this.options.deflate?.gzip ? await promisify1(import_zlib.default.gzip)(input) : await promisify1(import_zlib.default.deflate)(input);
|
|
57985
|
+
return toArrayBuffer2(buffer);
|
|
57986
|
+
}
|
|
57987
|
+
return this.compressSync(input);
|
|
57988
|
+
}
|
|
57989
|
+
async decompress(input) {
|
|
57990
|
+
if (!isBrowser && this.options.deflate?.useZlib) {
|
|
57991
|
+
const buffer = this.options.deflate?.gzip ? await promisify1(import_zlib.default.gunzip)(input) : await promisify1(import_zlib.default.inflate)(input);
|
|
57992
|
+
return toArrayBuffer2(buffer);
|
|
57993
|
+
}
|
|
57994
|
+
return this.decompressSync(input);
|
|
57995
|
+
}
|
|
57996
|
+
compressSync(input) {
|
|
57997
|
+
if (!isBrowser && this.options.deflate?.useZlib) {
|
|
57998
|
+
const buffer = this.options.deflate?.gzip ? import_zlib.default.gzipSync(input) : import_zlib.default.deflateSync(input);
|
|
57999
|
+
return toArrayBuffer2(buffer);
|
|
58000
|
+
}
|
|
58001
|
+
const pakoOptions = this.options?.deflate || {};
|
|
58002
|
+
const inputArray = new Uint8Array(input);
|
|
58003
|
+
const deflate = this.options?.raw ? import_pako.default.deflateRaw : import_pako.default.deflate;
|
|
58004
|
+
return deflate(inputArray, pakoOptions).buffer;
|
|
58005
|
+
}
|
|
58006
|
+
decompressSync(input) {
|
|
58007
|
+
if (!isBrowser && this.options.deflate?.useZlib) {
|
|
58008
|
+
const buffer = this.options.deflate?.gzip ? import_zlib.default.gunzipSync(input) : import_zlib.default.inflateSync(input);
|
|
58009
|
+
return toArrayBuffer2(buffer);
|
|
58010
|
+
}
|
|
58011
|
+
const pakoOptions = this.options?.deflate || {};
|
|
58012
|
+
const inputArray = new Uint8Array(input);
|
|
58013
|
+
const inflate = this.options?.raw ? import_pako.default.inflateRaw : import_pako.default.inflate;
|
|
58014
|
+
return inflate(inputArray, pakoOptions).buffer;
|
|
58015
|
+
}
|
|
58016
|
+
async *compressBatches(asyncIterator) {
|
|
58017
|
+
const pakoOptions = this.options?.deflate || {};
|
|
58018
|
+
const pakoProcessor = new import_pako.default.Deflate(pakoOptions);
|
|
58019
|
+
yield* this.transformBatches(pakoProcessor, asyncIterator);
|
|
58020
|
+
}
|
|
58021
|
+
async *decompressBatches(asyncIterator) {
|
|
58022
|
+
const pakoOptions = this.options?.deflate || {};
|
|
58023
|
+
const pakoProcessor = new import_pako.default.Inflate(pakoOptions);
|
|
58024
|
+
yield* this.transformBatches(pakoProcessor, asyncIterator);
|
|
58025
|
+
}
|
|
58026
|
+
async *transformBatches(pakoProcessor, asyncIterator) {
|
|
58027
|
+
pakoProcessor.onData = this._onData.bind(this);
|
|
58028
|
+
pakoProcessor.onEnd = this._onEnd.bind(this);
|
|
58029
|
+
for await (const chunk of asyncIterator) {
|
|
58030
|
+
const uint8Array = new Uint8Array(chunk);
|
|
58031
|
+
const ok2 = pakoProcessor.push(uint8Array, false);
|
|
58032
|
+
if (!ok2) {
|
|
58033
|
+
throw new Error(`${this._getError()}write`);
|
|
58034
|
+
}
|
|
58035
|
+
const chunks2 = this._getChunks();
|
|
58036
|
+
yield* chunks2;
|
|
58037
|
+
}
|
|
58038
|
+
const emptyChunk = new Uint8Array(0);
|
|
58039
|
+
const ok = pakoProcessor.push(emptyChunk, true);
|
|
58040
|
+
if (!ok) {
|
|
58041
|
+
}
|
|
58042
|
+
const chunks = this._getChunks();
|
|
58043
|
+
yield* chunks;
|
|
58044
|
+
}
|
|
58045
|
+
_onData(chunk) {
|
|
58046
|
+
this._chunks.push(chunk);
|
|
58047
|
+
}
|
|
58048
|
+
_onEnd(status) {
|
|
58049
|
+
if (status !== 0) {
|
|
58050
|
+
throw new Error(this._getError(status) + this._chunks.length);
|
|
58051
|
+
}
|
|
58052
|
+
}
|
|
58053
|
+
_getChunks() {
|
|
58054
|
+
const chunks = this._chunks;
|
|
58055
|
+
this._chunks = [];
|
|
58056
|
+
return chunks;
|
|
58057
|
+
}
|
|
58058
|
+
_getError(code = 0) {
|
|
58059
|
+
const MESSAGES = {
|
|
58060
|
+
2: "need dictionary",
|
|
58061
|
+
1: "stream end",
|
|
58062
|
+
0: "",
|
|
58063
|
+
"-1": "file error",
|
|
58064
|
+
"-2": "stream error",
|
|
58065
|
+
"-3": "data error",
|
|
58066
|
+
"-4": "insufficient memory",
|
|
58067
|
+
"-5": "buffer error",
|
|
58068
|
+
"-6": "incompatible version"
|
|
58069
|
+
};
|
|
58070
|
+
return `${this.name}: ${MESSAGES[code]}`;
|
|
58071
|
+
}
|
|
58072
|
+
};
|
|
58073
|
+
|
|
58074
|
+
// ../zip/src/filesystems/zip-filesystem.ts
|
|
58075
|
+
var COMPRESSION_METHODS = {
|
|
58076
|
+
0: async (compressedFile) => compressedFile,
|
|
58077
|
+
8: async (compressedFile) => {
|
|
58078
|
+
const compression = new DeflateCompression({ raw: true });
|
|
58079
|
+
const decompressedData = await compression.decompress(compressedFile);
|
|
58080
|
+
return decompressedData;
|
|
58081
|
+
}
|
|
58082
|
+
};
|
|
58083
|
+
var ZipFileSystem = class {
|
|
58084
|
+
constructor(file) {
|
|
58085
|
+
this.fileProvider = Promise.resolve(null);
|
|
58086
|
+
if (typeof file === "string") {
|
|
58087
|
+
this.fileName = file;
|
|
58088
|
+
if (!isBrowser) {
|
|
58089
|
+
this.fileProvider = FileHandleFile.from(file);
|
|
58090
|
+
} else {
|
|
58091
|
+
throw new Error("Cannot open file for random access in a WEB browser");
|
|
58092
|
+
}
|
|
58093
|
+
} else if (isFileProvider(file)) {
|
|
58094
|
+
this.fileProvider = Promise.resolve(file);
|
|
58095
|
+
}
|
|
58096
|
+
}
|
|
58097
|
+
async destroy() {
|
|
58098
|
+
const fileProvider = await this.fileProvider;
|
|
58099
|
+
if (fileProvider) {
|
|
58100
|
+
await fileProvider.destroy();
|
|
58101
|
+
}
|
|
58102
|
+
}
|
|
58103
|
+
async readdir() {
|
|
58104
|
+
const fileProvider = await this.fileProvider;
|
|
58105
|
+
if (!fileProvider) {
|
|
58106
|
+
throw new Error("No data detected in the zip archive");
|
|
58107
|
+
}
|
|
58108
|
+
const fileNames = [];
|
|
58109
|
+
const zipCDIterator = zipCDFileHeaderGenerator(fileProvider);
|
|
58110
|
+
for await (const cdHeader of zipCDIterator) {
|
|
58111
|
+
fileNames.push(cdHeader.fileName);
|
|
58112
|
+
}
|
|
58113
|
+
return fileNames;
|
|
58114
|
+
}
|
|
58115
|
+
async stat(filename2) {
|
|
58116
|
+
const cdFileHeader = await this.getCDFileHeader(filename2);
|
|
58117
|
+
return { ...cdFileHeader, size: Number(cdFileHeader.uncompressedSize) };
|
|
58118
|
+
}
|
|
58119
|
+
async fetch(filename2) {
|
|
58120
|
+
const fileProvider = await this.fileProvider;
|
|
58121
|
+
if (!fileProvider) {
|
|
58122
|
+
throw new Error("No data detected in the zip archive");
|
|
58123
|
+
}
|
|
58124
|
+
const cdFileHeader = await this.getCDFileHeader(filename2);
|
|
58125
|
+
const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
|
|
58126
|
+
if (!localFileHeader) {
|
|
58127
|
+
throw new Error("Local file header has not been found in the zip archive`");
|
|
58128
|
+
}
|
|
58129
|
+
const compressionHandler = COMPRESSION_METHODS[localFileHeader.compressionMethod.toString()];
|
|
58130
|
+
if (!compressionHandler) {
|
|
58131
|
+
throw Error("Only Deflation compression is supported");
|
|
58132
|
+
}
|
|
58133
|
+
const compressedFile = await fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
|
|
58134
|
+
const uncompressedFile = await compressionHandler(compressedFile);
|
|
58135
|
+
const response = new Response(uncompressedFile);
|
|
58136
|
+
Object.defineProperty(response, "url", { value: `${this.fileName || ""}/${filename2}` });
|
|
58137
|
+
return response;
|
|
58138
|
+
}
|
|
58139
|
+
async getCDFileHeader(filename2) {
|
|
58140
|
+
const fileProvider = await this.fileProvider;
|
|
58141
|
+
if (!fileProvider) {
|
|
58142
|
+
throw new Error("No data detected in the zip archive");
|
|
58143
|
+
}
|
|
58144
|
+
const zipCDIterator = zipCDFileHeaderGenerator(fileProvider);
|
|
58145
|
+
let result = null;
|
|
58146
|
+
for await (const cdHeader of zipCDIterator) {
|
|
58147
|
+
if (cdHeader.fileName === filename2) {
|
|
58148
|
+
result = cdHeader;
|
|
58149
|
+
break;
|
|
58150
|
+
}
|
|
58151
|
+
}
|
|
58152
|
+
if (!result) {
|
|
58153
|
+
throw new Error("File has not been found in the zip archive");
|
|
58154
|
+
}
|
|
58155
|
+
return result;
|
|
58156
|
+
}
|
|
58157
|
+
};
|
|
58158
|
+
|
|
58159
|
+
// ../3d-tiles/src/3d-tiles-archive/3d-tiles-archive-archive.ts
|
|
58160
|
+
var import_md52 = __toModule(require_md5());
|
|
58161
|
+
var COMPRESSION_METHODS2 = {
|
|
58162
|
+
0: (data) => new NoCompression().decompress(data),
|
|
58163
|
+
8: (data) => new DeflateCompression({ raw: true }).decompress(data)
|
|
58164
|
+
};
|
|
58165
|
+
var Tiles3DArchive = class {
|
|
58166
|
+
constructor(fileProvider, hashFile) {
|
|
58167
|
+
this.fileProvider = fileProvider;
|
|
58168
|
+
this.hashArray = hashFile;
|
|
58169
|
+
}
|
|
58170
|
+
async getFile(path2) {
|
|
58171
|
+
let data = await this.getFileBytes(path2.toLocaleLowerCase());
|
|
58172
|
+
if (!data) {
|
|
58173
|
+
data = await this.getFileBytes(path2);
|
|
58174
|
+
}
|
|
58175
|
+
if (!data) {
|
|
58176
|
+
throw new Error("No such file in the archive");
|
|
58177
|
+
}
|
|
58178
|
+
return data;
|
|
58179
|
+
}
|
|
58180
|
+
async getFileBytes(path2) {
|
|
58181
|
+
const nameHash = Buffer.from((0, import_md52.default)(path2), "hex");
|
|
58182
|
+
const fileInfo = findBin(nameHash, this.hashArray);
|
|
58183
|
+
if (!fileInfo) {
|
|
58184
|
+
return null;
|
|
58185
|
+
}
|
|
58186
|
+
const localFileHeader = await parseZipLocalFileHeader(fileInfo.offset, this.fileProvider);
|
|
58187
|
+
if (!localFileHeader) {
|
|
58188
|
+
return null;
|
|
58189
|
+
}
|
|
58190
|
+
const compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
|
|
58191
|
+
const compressionMethod = COMPRESSION_METHODS2[localFileHeader.compressionMethod];
|
|
58192
|
+
if (!compressionMethod) {
|
|
58193
|
+
throw Error("Only Deflation compression is supported");
|
|
58194
|
+
}
|
|
58195
|
+
return compressionMethod(compressedFile);
|
|
58196
|
+
}
|
|
58197
|
+
};
|
|
58198
|
+
|
|
58199
|
+
// ../3d-tiles/src/lib/filesystems/tiles-3d-archive-file-system.ts
|
|
58200
|
+
var Tiles3DArchiveFileSystem = class extends ZipFileSystem {
|
|
58201
|
+
constructor(file) {
|
|
58202
|
+
super(file);
|
|
58203
|
+
}
|
|
58204
|
+
async fetch(filename2) {
|
|
58205
|
+
const fileProvider = await this.fileProvider;
|
|
58206
|
+
if (!fileProvider) {
|
|
58207
|
+
throw new Error("No data detected in the zip archive");
|
|
58208
|
+
}
|
|
58209
|
+
await this.parseHashFile();
|
|
58210
|
+
if (this.hashData) {
|
|
58211
|
+
const archive = new Tiles3DArchive(fileProvider, this.hashData);
|
|
58212
|
+
const fileData = await archive.getFile(filename2);
|
|
58213
|
+
const response = new Response(fileData);
|
|
58214
|
+
Object.defineProperty(response, "url", { value: `${this.fileName || ""}/${filename2}` });
|
|
58215
|
+
return response;
|
|
58216
|
+
}
|
|
58217
|
+
return super.fetch(filename2);
|
|
58218
|
+
}
|
|
58219
|
+
async parseHashFile() {
|
|
58220
|
+
if (this.hashData !== void 0) {
|
|
58221
|
+
return;
|
|
58222
|
+
}
|
|
58223
|
+
const fileProvider = await this.fileProvider;
|
|
58224
|
+
if (!fileProvider) {
|
|
58225
|
+
throw new Error("No data detected in the zip archive");
|
|
58226
|
+
}
|
|
58227
|
+
const hashCDOffset = await searchFromTheEnd(fileProvider, signature);
|
|
58228
|
+
const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
|
|
58229
|
+
if (cdFileHeader?.fileName === "@3dtilesIndex1@") {
|
|
58230
|
+
const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
|
|
58231
|
+
if (!localFileHeader) {
|
|
58232
|
+
throw new Error("corrupted 3tz");
|
|
58233
|
+
}
|
|
58234
|
+
const fileDataOffset = localFileHeader.fileDataOffset;
|
|
58235
|
+
const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
|
|
58236
|
+
this.hashData = parseHashFile(hashFile);
|
|
58237
|
+
} else {
|
|
58238
|
+
this.hashData = null;
|
|
58239
|
+
}
|
|
58240
|
+
}
|
|
58241
|
+
};
|
|
58242
|
+
|
|
57614
58243
|
// ../3d-tiles/src/lib/encoders/helpers/encode-3d-tile-header.ts
|
|
57615
58244
|
function encode3DTileHeader(tile, dataView, byteOffset) {
|
|
57616
58245
|
const HEADER_SIZE = 12;
|
|
@@ -57800,7 +58429,7 @@ var parse5 = import_dist.default.parse;
|
|
|
57800
58429
|
// src/i3s-converter/i3s-converter.ts
|
|
57801
58430
|
var import_process2 = __toModule(require("process"));
|
|
57802
58431
|
var import_json_map_transform8 = __toModule(require_json_map_transform());
|
|
57803
|
-
var
|
|
58432
|
+
var import_md54 = __toModule(require_md5());
|
|
57804
58433
|
|
|
57805
58434
|
// src/i3s-converter/helpers/node-pages.ts
|
|
57806
58435
|
var import_path4 = __toModule(require("path"));
|
|
@@ -57830,21 +58459,21 @@ var METADATA = () => ({
|
|
|
57830
58459
|
});
|
|
57831
58460
|
|
|
57832
58461
|
// src/lib/utils/file-utils.ts
|
|
57833
|
-
var
|
|
58462
|
+
var import_fs5 = __toModule(require("fs"));
|
|
57834
58463
|
var import_path3 = __toModule(require("path"));
|
|
57835
58464
|
|
|
57836
58465
|
// src/lib/utils/compress-util.ts
|
|
57837
|
-
var
|
|
58466
|
+
var import_zlib2 = __toModule(require("zlib"));
|
|
57838
58467
|
var import_path2 = __toModule(require("path"));
|
|
57839
|
-
var
|
|
58468
|
+
var import_fs4 = __toModule(require("fs"));
|
|
57840
58469
|
var import_archiver = __toModule(require_archiver());
|
|
57841
58470
|
var import_jszip = __toModule(require_lib3());
|
|
57842
58471
|
var import_crypt = __toModule(require_crypt());
|
|
57843
58472
|
function compressFileWithGzip(pathFile) {
|
|
57844
58473
|
const compressedPathFile = `${pathFile}.gz`;
|
|
57845
|
-
const gzip = (0,
|
|
57846
|
-
const input = (0,
|
|
57847
|
-
const output = (0,
|
|
58474
|
+
const gzip = (0, import_zlib2.createGzip)();
|
|
58475
|
+
const input = (0, import_fs4.createReadStream)(pathFile);
|
|
58476
|
+
const output = (0, import_fs4.createWriteStream)(compressedPathFile);
|
|
57848
58477
|
return new Promise((resolve2, reject) => {
|
|
57849
58478
|
input.on("end", () => {
|
|
57850
58479
|
console.log(`${compressedPathFile} compressed and saved.`);
|
|
@@ -57904,10 +58533,10 @@ async function writeFile3(path2, data, fileName = "index.json") {
|
|
|
57904
58533
|
} else {
|
|
57905
58534
|
toWriteData = data;
|
|
57906
58535
|
}
|
|
57907
|
-
await
|
|
58536
|
+
await import_fs5.promises.mkdir(path2, { recursive: true });
|
|
57908
58537
|
const pathFile = (0, import_path3.join)(path2, fileName);
|
|
57909
58538
|
try {
|
|
57910
|
-
await
|
|
58539
|
+
await import_fs5.promises.writeFile(pathFile, toWriteData);
|
|
57911
58540
|
} catch (err) {
|
|
57912
58541
|
throw err;
|
|
57913
58542
|
}
|
|
@@ -57953,17 +58582,17 @@ async function openJson(path2, fileName) {
|
|
|
57953
58582
|
}
|
|
57954
58583
|
async function isFileExists(fileName) {
|
|
57955
58584
|
try {
|
|
57956
|
-
await
|
|
58585
|
+
await import_fs5.promises.stat(fileName);
|
|
57957
58586
|
return true;
|
|
57958
58587
|
} catch {
|
|
57959
58588
|
return false;
|
|
57960
58589
|
}
|
|
57961
58590
|
}
|
|
57962
58591
|
function removeDir(path2) {
|
|
57963
|
-
return
|
|
58592
|
+
return import_fs5.promises.rm(path2, { recursive: true });
|
|
57964
58593
|
}
|
|
57965
58594
|
function removeFile(path2) {
|
|
57966
|
-
return
|
|
58595
|
+
return import_fs5.promises.unlink(path2);
|
|
57967
58596
|
}
|
|
57968
58597
|
function getAbsoluteFilePath(filePath) {
|
|
57969
58598
|
return (0, import_path3.isAbsolute)(filePath) ? filePath : (0, import_path3.join)(process.cwd(), filePath);
|
|
@@ -58150,7 +58779,7 @@ var NodePages = class {
|
|
|
58150
58779
|
|
|
58151
58780
|
// src/lib/utils/statistic-utills.ts
|
|
58152
58781
|
var import_path5 = __toModule(require("path"));
|
|
58153
|
-
var
|
|
58782
|
+
var import_fs6 = __toModule(require("fs"));
|
|
58154
58783
|
function timeConverter(time) {
|
|
58155
58784
|
const nanoSecondsInMillisecond = 1e6;
|
|
58156
58785
|
let timeInSeconds = time[0];
|
|
@@ -58181,8 +58810,8 @@ async function calculateFilesSize(params) {
|
|
|
58181
58810
|
try {
|
|
58182
58811
|
if (slpk) {
|
|
58183
58812
|
const slpkPath = (0, import_path5.join)(fullOutputPath, `${tilesetName}.slpk`);
|
|
58184
|
-
const
|
|
58185
|
-
return
|
|
58813
|
+
const stat3 = await import_fs6.promises.stat(slpkPath);
|
|
58814
|
+
return stat3.size;
|
|
58186
58815
|
}
|
|
58187
58816
|
const directoryPath = (0, import_path5.join)(fullOutputPath, tilesetName);
|
|
58188
58817
|
const totalSize = await getTotalFilesSize(directoryPath);
|
|
@@ -58194,9 +58823,9 @@ async function calculateFilesSize(params) {
|
|
|
58194
58823
|
}
|
|
58195
58824
|
async function getTotalFilesSize(dirPath) {
|
|
58196
58825
|
let totalFileSize = 0;
|
|
58197
|
-
const files = await
|
|
58826
|
+
const files = await import_fs6.promises.readdir(dirPath);
|
|
58198
58827
|
for (const file of files) {
|
|
58199
|
-
const fileStat = await
|
|
58828
|
+
const fileStat = await import_fs6.promises.stat((0, import_path5.join)(dirPath, file));
|
|
58200
58829
|
if (fileStat.isDirectory()) {
|
|
58201
58830
|
totalFileSize += await getTotalFilesSize((0, import_path5.join)(dirPath, file));
|
|
58202
58831
|
} else {
|
|
@@ -58207,9 +58836,9 @@ async function getTotalFilesSize(dirPath) {
|
|
|
58207
58836
|
}
|
|
58208
58837
|
|
|
58209
58838
|
// src/i3s-converter/helpers/geometry-converter.ts
|
|
58210
|
-
var
|
|
58839
|
+
var import_core17 = __toModule(require_es5());
|
|
58211
58840
|
var import_geospatial6 = __toModule(require_es52());
|
|
58212
|
-
var
|
|
58841
|
+
var import_md53 = __toModule(require_md5());
|
|
58213
58842
|
|
|
58214
58843
|
// src/i3s-converter/helpers/geometry-attributes.ts
|
|
58215
58844
|
var VALUES_PER_VERTEX = 3;
|
|
@@ -58380,23 +59009,23 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
|
|
|
58380
59009
|
}
|
|
58381
59010
|
|
|
58382
59011
|
// src/i3s-converter/helpers/coordinate-converter.ts
|
|
58383
|
-
var
|
|
59012
|
+
var import_core15 = __toModule(require_es5());
|
|
58384
59013
|
var import_geospatial4 = __toModule(require_es52());
|
|
58385
59014
|
var import_culling3 = __toModule(require_es53());
|
|
58386
59015
|
function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
58387
59016
|
let radius;
|
|
58388
59017
|
let halfSize;
|
|
58389
59018
|
let quaternion;
|
|
58390
|
-
const cartographicCenter = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new
|
|
59019
|
+
const cartographicCenter = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new import_core15.Vector3());
|
|
58391
59020
|
cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
58392
59021
|
if (sourceBoundingVolume instanceof import_culling3.OrientedBoundingBox) {
|
|
58393
59022
|
halfSize = sourceBoundingVolume.halfSize;
|
|
58394
|
-
radius = new
|
|
59023
|
+
radius = new import_core15.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
58395
59024
|
quaternion = sourceBoundingVolume.quaternion;
|
|
58396
59025
|
} else {
|
|
58397
59026
|
radius = sourceBoundingVolume.radius;
|
|
58398
59027
|
halfSize = [radius, radius, radius];
|
|
58399
|
-
quaternion = new
|
|
59028
|
+
quaternion = new import_core15.Quaternion().fromMatrix3(new import_core15.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
|
|
58400
59029
|
}
|
|
58401
59030
|
return {
|
|
58402
59031
|
mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
|
|
@@ -58411,8 +59040,8 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
|
|
|
58411
59040
|
const positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
58412
59041
|
const geometryObb = (0, import_culling3.makeOrientedBoundingBoxFromPoints)(positionVectors);
|
|
58413
59042
|
const geometryMbs = (0, import_culling3.makeBoundingSphereFromPoints)(positionVectors);
|
|
58414
|
-
let mbsCenter = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new
|
|
58415
|
-
let obbCenter = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new
|
|
59043
|
+
let mbsCenter = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core15.Vector3());
|
|
59044
|
+
let obbCenter = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core15.Vector3());
|
|
58416
59045
|
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
58417
59046
|
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
58418
59047
|
return {
|
|
@@ -58427,7 +59056,7 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
|
|
|
58427
59056
|
function convertPositionsToVectors(positions) {
|
|
58428
59057
|
const result = [];
|
|
58429
59058
|
for (let i = 0; i < positions.length; i += 3) {
|
|
58430
|
-
const positionVector = new
|
|
59059
|
+
const positionVector = new import_core15.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
|
|
58431
59060
|
result.push(positionVector);
|
|
58432
59061
|
}
|
|
58433
59062
|
return result;
|
|
@@ -58441,8 +59070,8 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
|
58441
59070
|
}
|
|
58442
59071
|
const center = sphere.center;
|
|
58443
59072
|
const radius = sphere.radius;
|
|
58444
|
-
const vertexMax = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(new
|
|
58445
|
-
const vertexMin = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(new
|
|
59073
|
+
const vertexMax = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(new import_core15.Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new import_core15.Vector3());
|
|
59074
|
+
const vertexMin = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(new import_core15.Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new import_core15.Vector3());
|
|
58446
59075
|
return {
|
|
58447
59076
|
xmin: Math.min(vertexMin[0], vertexMax[0]),
|
|
58448
59077
|
xmax: Math.max(vertexMin[0], vertexMax[0]),
|
|
@@ -58454,13 +59083,13 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
|
58454
59083
|
}
|
|
58455
59084
|
function createObbFromMbs(mbs) {
|
|
58456
59085
|
const radius = mbs[3];
|
|
58457
|
-
const center = new
|
|
58458
|
-
const halfAxex = new
|
|
59086
|
+
const center = new import_core15.Vector3(mbs[0], mbs[1], mbs[2]);
|
|
59087
|
+
const halfAxex = new import_core15.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
|
|
58459
59088
|
return new import_culling3.OrientedBoundingBox(center, halfAxex);
|
|
58460
59089
|
}
|
|
58461
59090
|
|
|
58462
59091
|
// src/i3s-converter/helpers/gltf-attributes.ts
|
|
58463
|
-
var
|
|
59092
|
+
var import_core16 = __toModule(require_es5());
|
|
58464
59093
|
var import_geospatial5 = __toModule(require_es52());
|
|
58465
59094
|
function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
|
|
58466
59095
|
let nodes = tileContent.gltf?.scene?.nodes || tileContent.gltf?.scenes?.[0]?.nodes || tileContent.gltf?.nodes || [];
|
|
@@ -58502,7 +59131,7 @@ function getB3DMAttributesWithoutBufferView(attributes) {
|
|
|
58502
59131
|
function calculateTransformProps(tileContent, tileTransform, boundingVolume) {
|
|
58503
59132
|
const { rtcCenter, gltfUpAxis } = tileContent;
|
|
58504
59133
|
const { center } = boundingVolume;
|
|
58505
|
-
let modelMatrix = new
|
|
59134
|
+
let modelMatrix = new import_core16.Matrix4(tileTransform);
|
|
58506
59135
|
if (rtcCenter) {
|
|
58507
59136
|
modelMatrix.translate(rtcCenter);
|
|
58508
59137
|
}
|
|
@@ -58510,18 +59139,18 @@ function calculateTransformProps(tileContent, tileTransform, boundingVolume) {
|
|
|
58510
59139
|
case "Z":
|
|
58511
59140
|
break;
|
|
58512
59141
|
case "Y":
|
|
58513
|
-
const rotationY = new
|
|
59142
|
+
const rotationY = new import_core16.Matrix4().rotateX(Math.PI / 2);
|
|
58514
59143
|
modelMatrix = modelMatrix.multiplyRight(rotationY);
|
|
58515
59144
|
break;
|
|
58516
59145
|
case "X":
|
|
58517
|
-
const rotationX = new
|
|
59146
|
+
const rotationX = new import_core16.Matrix4().rotateY(-Math.PI / 2);
|
|
58518
59147
|
modelMatrix = modelMatrix.multiplyRight(rotationX);
|
|
58519
59148
|
break;
|
|
58520
59149
|
default:
|
|
58521
59150
|
break;
|
|
58522
59151
|
}
|
|
58523
|
-
const cartesianOrigin = new
|
|
58524
|
-
const cartographicOrigin = import_geospatial5.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new
|
|
59152
|
+
const cartesianOrigin = new import_core16.Vector3(center);
|
|
59153
|
+
const cartographicOrigin = import_geospatial5.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core16.Vector3());
|
|
58525
59154
|
return { modelMatrix, cartographicOrigin };
|
|
58526
59155
|
}
|
|
58527
59156
|
function prepareNodes(nodes) {
|
|
@@ -58824,7 +59453,7 @@ var SHORT_INT_TYPE2 = "Int32";
|
|
|
58824
59453
|
var DOUBLE_TYPE2 = "Float64";
|
|
58825
59454
|
var OBJECT_ID_TYPE2 = "Oid32";
|
|
58826
59455
|
var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ["CUSTOM_ATTRIBUTE_2", "_BATCHID", "BATCHID"];
|
|
58827
|
-
var scratchVector4 = new
|
|
59456
|
+
var scratchVector4 = new import_core17.Vector3();
|
|
58828
59457
|
async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, libraries, metadataClass) {
|
|
58829
59458
|
const useCartesianPositions = generateBoundingVolumes;
|
|
58830
59459
|
const materialAndTextureList = await convertMaterials(tileContent.gltf?.materials, shouldMergeMaterials);
|
|
@@ -58963,7 +59592,7 @@ async function convertAttributes(attributesData, materialAndTextureList, useCart
|
|
|
58963
59592
|
}
|
|
58964
59593
|
return attributesMap;
|
|
58965
59594
|
}
|
|
58966
|
-
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new
|
|
59595
|
+
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core17.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture) {
|
|
58967
59596
|
if (nodes) {
|
|
58968
59597
|
for (const node2 of nodes) {
|
|
58969
59598
|
convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix, featureTexture);
|
|
@@ -58987,7 +59616,7 @@ function getCompositeTransformationMatrix(node2, matrix) {
|
|
|
58987
59616
|
}
|
|
58988
59617
|
return transformationMatrix;
|
|
58989
59618
|
}
|
|
58990
|
-
function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new
|
|
59619
|
+
function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core17.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture) {
|
|
58991
59620
|
const transformationMatrix = getCompositeTransformationMatrix(node2, matrix);
|
|
58992
59621
|
const mesh = node2.mesh;
|
|
58993
59622
|
if (mesh) {
|
|
@@ -58995,7 +59624,7 @@ function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, at
|
|
|
58995
59624
|
}
|
|
58996
59625
|
convertNodes(node2.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix, featureTexture);
|
|
58997
59626
|
}
|
|
58998
|
-
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new
|
|
59627
|
+
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new import_core17.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture) {
|
|
58999
59628
|
for (const primitive of mesh.primitives) {
|
|
59000
59629
|
let outputAttributes = null;
|
|
59001
59630
|
let materialUvRegion;
|
|
@@ -59073,7 +59702,7 @@ function transformVertexArray(args) {
|
|
|
59073
59702
|
for (let i = 0; i < indices.length; i++) {
|
|
59074
59703
|
const coordIndex = indices[i] * VALUES_PER_VERTEX2;
|
|
59075
59704
|
const vertex = vertices.subarray(coordIndex, coordIndex + VALUES_PER_VERTEX2);
|
|
59076
|
-
let vertexVector = new
|
|
59705
|
+
let vertexVector = new import_core17.Vector3(Array.from(vertex));
|
|
59077
59706
|
vertexVector = attributeSpecificTransformation(vertexVector, args);
|
|
59078
59707
|
newVertices[i * VALUES_PER_VERTEX2] = vertexVector.x;
|
|
59079
59708
|
newVertices[i * VALUES_PER_VERTEX2 + 1] = vertexVector.y;
|
|
@@ -59325,10 +59954,10 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
|
|
|
59325
59954
|
}
|
|
59326
59955
|
function extractSharedResourcesMaterialInfo(baseColorFactor, metallicFactor = 1) {
|
|
59327
59956
|
const matDielectricColorComponent = 0.04 / 255;
|
|
59328
|
-
const black = new
|
|
59329
|
-
const unitVector = new
|
|
59330
|
-
const dielectricSpecular = new
|
|
59331
|
-
const baseColorVector = new
|
|
59957
|
+
const black = new import_core17.Vector4(0, 0, 0, 1);
|
|
59958
|
+
const unitVector = new import_core17.Vector4(1, 1, 1, 1);
|
|
59959
|
+
const dielectricSpecular = new import_core17.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
|
|
59960
|
+
const baseColorVector = new import_core17.Vector4(baseColorFactor);
|
|
59332
59961
|
const firstOperand = unitVector.subtract(dielectricSpecular).multiply(baseColorVector);
|
|
59333
59962
|
const diffuse = firstOperand.lerp(firstOperand, black, metallicFactor);
|
|
59334
59963
|
dielectricSpecular[3] = 1;
|
|
@@ -59394,7 +60023,7 @@ function generateStringFromBatchTableByIndex(batchTable, index) {
|
|
|
59394
60023
|
}
|
|
59395
60024
|
function getOrCreateUniqueFeatureId(index, batchTable, featuresHashArray) {
|
|
59396
60025
|
const batchTableStr = generateStringFromBatchTableByIndex(batchTable, index);
|
|
59397
|
-
const hash = (0,
|
|
60026
|
+
const hash = (0, import_md53.default)(batchTableStr);
|
|
59398
60027
|
if (featuresHashArray.includes(hash)) {
|
|
59399
60028
|
return featuresHashArray.indexOf(hash);
|
|
59400
60029
|
}
|
|
@@ -60150,7 +60779,7 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
|
|
|
60150
60779
|
|
|
60151
60780
|
// src/i3s-converter/helpers/node-debug.ts
|
|
60152
60781
|
var import_culling4 = __toModule(require_es53());
|
|
60153
|
-
var
|
|
60782
|
+
var import_core19 = __toModule(require_es5());
|
|
60154
60783
|
var import_geospatial7 = __toModule(require_es52());
|
|
60155
60784
|
var CUBE_POSITIONS = new Float32Array([
|
|
60156
60785
|
-1,
|
|
@@ -60267,7 +60896,7 @@ function getTileObbVertices(node2) {
|
|
|
60267
60896
|
const obbCenterCartesian = import_geospatial7.Ellipsoid.WGS84.cartographicToCartesian(node2.obb.center);
|
|
60268
60897
|
let vertices = [];
|
|
60269
60898
|
for (let i = 0; i < positions.length; i += 3) {
|
|
60270
|
-
const positionsVector = new
|
|
60899
|
+
const positionsVector = new import_core19.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
|
|
60271
60900
|
const rotatedPositions = positionsVector.transformByQuaternion(node2.obb.quaternion).add(obbCenterCartesian);
|
|
60272
60901
|
vertices = vertices.concat(rotatedPositions);
|
|
60273
60902
|
}
|
|
@@ -60653,7 +61282,7 @@ var NodeIndexDocument = class {
|
|
|
60653
61282
|
|
|
60654
61283
|
// src/i3s-converter/helpers/load-3d-tiles.ts
|
|
60655
61284
|
var loadNestedTileset = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
|
|
60656
|
-
const isTileset = sourceTile
|
|
61285
|
+
const isTileset = isNestedTileset(sourceTile);
|
|
60657
61286
|
if (!sourceTileset || !sourceTile.contentUrl || !isTileset) {
|
|
60658
61287
|
return;
|
|
60659
61288
|
}
|
|
@@ -60664,13 +61293,13 @@ var loadNestedTileset = async (sourceTileset, sourceTile, tilesetLoadOptions) =>
|
|
|
60664
61293
|
assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
|
|
60665
61294
|
}
|
|
60666
61295
|
};
|
|
60667
|
-
const tileContent = await
|
|
61296
|
+
const tileContent = await loadFromArchive(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
|
|
60668
61297
|
if (tileContent.root) {
|
|
60669
61298
|
sourceTile.children = [tileContent.root];
|
|
60670
61299
|
}
|
|
60671
61300
|
};
|
|
60672
61301
|
var loadTile3DContent = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
|
|
60673
|
-
const isTileset = sourceTile
|
|
61302
|
+
const isTileset = isNestedTileset(sourceTile);
|
|
60674
61303
|
if (!sourceTileset || !sourceTile.contentUrl || isTileset) {
|
|
60675
61304
|
return null;
|
|
60676
61305
|
}
|
|
@@ -60682,12 +61311,40 @@ var loadTile3DContent = async (sourceTileset, sourceTile, tilesetLoadOptions) =>
|
|
|
60682
61311
|
assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
|
|
60683
61312
|
}
|
|
60684
61313
|
};
|
|
60685
|
-
const tileContent = await
|
|
61314
|
+
const tileContent = await loadFromArchive(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
|
|
60686
61315
|
return tileContent;
|
|
60687
61316
|
};
|
|
61317
|
+
async function loadFromArchive(url, loader, loadOptions) {
|
|
61318
|
+
const tz3UrlParts = url.split(".3tz");
|
|
61319
|
+
let filename2;
|
|
61320
|
+
if (tz3UrlParts.length === 1) {
|
|
61321
|
+
filename2 = null;
|
|
61322
|
+
} else if (tz3UrlParts.length === 2) {
|
|
61323
|
+
filename2 = tz3UrlParts[1].slice(1);
|
|
61324
|
+
if (filename2 === "") {
|
|
61325
|
+
filename2 = "tileset.json";
|
|
61326
|
+
}
|
|
61327
|
+
} else {
|
|
61328
|
+
throw new Error("Unexpected URL format");
|
|
61329
|
+
}
|
|
61330
|
+
if (filename2) {
|
|
61331
|
+
const tz3Path = `${tz3UrlParts[0]}.3tz`;
|
|
61332
|
+
const fileSystem = new Tiles3DArchiveFileSystem(tz3Path);
|
|
61333
|
+
const content = await load(filename2, loader, {
|
|
61334
|
+
...loadOptions,
|
|
61335
|
+
fetch: fileSystem.fetch.bind(fileSystem)
|
|
61336
|
+
});
|
|
61337
|
+
await fileSystem.destroy();
|
|
61338
|
+
return content;
|
|
61339
|
+
}
|
|
61340
|
+
return await load(url, loader, loadOptions);
|
|
61341
|
+
}
|
|
61342
|
+
function isNestedTileset(tile) {
|
|
61343
|
+
return tile?.type === "json" || tile?.type === "3tz";
|
|
61344
|
+
}
|
|
60688
61345
|
|
|
60689
61346
|
// src/i3s-converter/i3s-converter.ts
|
|
60690
|
-
var
|
|
61347
|
+
var import_core23 = __toModule(require_es5());
|
|
60691
61348
|
|
|
60692
61349
|
// src/i3s-converter/helpers/tileset-traversal.ts
|
|
60693
61350
|
var traverseDatasetWith = async (tile, traversalProps, processTile, postprocessTile, maxDepth, level = 0) => {
|
|
@@ -60880,7 +61537,7 @@ var I3SConverter = class {
|
|
|
60880
61537
|
if (preloadOptions.headers) {
|
|
60881
61538
|
this.loadOptions.fetch = { headers: preloadOptions.headers };
|
|
60882
61539
|
}
|
|
60883
|
-
this.sourceTileset = await
|
|
61540
|
+
this.sourceTileset = await loadFromArchive(tilesetUrl, this.Loader, this.loadOptions);
|
|
60884
61541
|
const preprocessResult = await this.preprocessConversion();
|
|
60885
61542
|
if (preprocessResult) {
|
|
60886
61543
|
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
@@ -60937,7 +61594,8 @@ var I3SConverter = class {
|
|
|
60937
61594
|
return true;
|
|
60938
61595
|
}
|
|
60939
61596
|
async analyzeTile(sourceTile, traversalProps) {
|
|
60940
|
-
|
|
61597
|
+
const isTileset = isNestedTileset(sourceTile);
|
|
61598
|
+
if (isTileset) {
|
|
60941
61599
|
await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);
|
|
60942
61600
|
return null;
|
|
60943
61601
|
}
|
|
@@ -60967,7 +61625,7 @@ var I3SConverter = class {
|
|
|
60967
61625
|
this.materialDefinitions = [];
|
|
60968
61626
|
this.materialMap = new Map();
|
|
60969
61627
|
const sourceRootTile = this.sourceTileset.root;
|
|
60970
|
-
const sourceBoundingVolume = createBoundingVolume(sourceRootTile.boundingVolume, new
|
|
61628
|
+
const sourceBoundingVolume = createBoundingVolume(sourceRootTile.boundingVolume, new import_core23.Matrix4(sourceRootTile.transform), null);
|
|
60971
61629
|
this._formLayers0(tilesetName, sourceBoundingVolume, this.sourceTileset?.root?.boundingVolume?.region);
|
|
60972
61630
|
const boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
|
|
60973
61631
|
await this.nodePages.push({
|
|
@@ -60978,7 +61636,7 @@ var I3SConverter = class {
|
|
|
60978
61636
|
});
|
|
60979
61637
|
const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);
|
|
60980
61638
|
await traverseDatasetWith(sourceRootTile, {
|
|
60981
|
-
transform: new
|
|
61639
|
+
transform: new import_core23.Matrix4(sourceRootTile.transform),
|
|
60982
61640
|
parentNodes: [rootNode]
|
|
60983
61641
|
}, this.convertTile.bind(this), this.finalizeTile.bind(this), this.options.maxDepth);
|
|
60984
61642
|
this.layers0.materialDefinitions = this.materialDefinitions;
|
|
@@ -61049,8 +61707,9 @@ var I3SConverter = class {
|
|
|
61049
61707
|
}
|
|
61050
61708
|
}
|
|
61051
61709
|
async convertTile(sourceTile, traversalProps) {
|
|
61052
|
-
|
|
61053
|
-
|
|
61710
|
+
const isTileset = isNestedTileset(sourceTile);
|
|
61711
|
+
if (isTileset || sourceTile.type === "empty") {
|
|
61712
|
+
if (isTileset) {
|
|
61054
61713
|
if (sourceTile.id) {
|
|
61055
61714
|
console.log(`[load]: ${sourceTile.id}`);
|
|
61056
61715
|
}
|
|
@@ -61356,7 +62015,7 @@ var I3SConverter = class {
|
|
|
61356
62015
|
}
|
|
61357
62016
|
}
|
|
61358
62017
|
_findOrCreateMaterial(material) {
|
|
61359
|
-
const hash = (0,
|
|
62018
|
+
const hash = (0, import_md54.default)(JSON.stringify(material));
|
|
61360
62019
|
if (this.materialMap.has(hash)) {
|
|
61361
62020
|
return this.materialMap.get(hash) || 0;
|
|
61362
62021
|
}
|
|
@@ -61366,7 +62025,7 @@ var I3SConverter = class {
|
|
|
61366
62025
|
}
|
|
61367
62026
|
findOrCreateGeometryDefinition(hasTexture, hasUvRegions) {
|
|
61368
62027
|
const geometryConfig = { hasTexture, hasUvRegions };
|
|
61369
|
-
const hash = (0,
|
|
62028
|
+
const hash = (0, import_md54.default)(JSON.stringify(geometryConfig));
|
|
61370
62029
|
if (this.geometryMap.has(hash)) {
|
|
61371
62030
|
return this.geometryMap.get(hash) || 0;
|
|
61372
62031
|
}
|
|
@@ -61510,7 +62169,7 @@ var COORDINATE_SYSTEM;
|
|
|
61510
62169
|
})(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
|
|
61511
62170
|
|
|
61512
62171
|
// ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
|
|
61513
|
-
var
|
|
62172
|
+
var import_core26 = __toModule(require_es5());
|
|
61514
62173
|
var import_geospatial8 = __toModule(require_es52());
|
|
61515
62174
|
|
|
61516
62175
|
// ../i3s/src/types.ts
|
|
@@ -61689,7 +62348,7 @@ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attr
|
|
|
61689
62348
|
}
|
|
61690
62349
|
|
|
61691
62350
|
// ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
|
|
61692
|
-
var scratchVector5 = new
|
|
62351
|
+
var scratchVector5 = new import_core26.Vector3([0, 0, 0]);
|
|
61693
62352
|
function getLoaderForTextureFormat(textureFormat) {
|
|
61694
62353
|
switch (textureFormat) {
|
|
61695
62354
|
case "ktx-etc2":
|
|
@@ -61710,7 +62369,7 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
|
|
|
61710
62369
|
indices: null,
|
|
61711
62370
|
featureIds: [],
|
|
61712
62371
|
vertexCount: 0,
|
|
61713
|
-
modelMatrix: new
|
|
62372
|
+
modelMatrix: new import_core26.Matrix4(),
|
|
61714
62373
|
coordinateSystem: 0,
|
|
61715
62374
|
byteLength: 0,
|
|
61716
62375
|
texture: null
|
|
@@ -61724,9 +62383,11 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
|
|
|
61724
62383
|
if (loader === ImageLoader) {
|
|
61725
62384
|
const options2 = { ...tileOptions.textureLoaderOptions, image: { type: "data" } };
|
|
61726
62385
|
try {
|
|
61727
|
-
|
|
62386
|
+
const texture = await parseFromContext(arrayBuffer2, [], options2, context);
|
|
62387
|
+
content.texture = texture;
|
|
61728
62388
|
} catch (e) {
|
|
61729
|
-
|
|
62389
|
+
const texture = await parse(arrayBuffer2, loader, options2, context);
|
|
62390
|
+
content.texture = texture;
|
|
61730
62391
|
}
|
|
61731
62392
|
} else if (loader === CompressedTextureLoader || loader === BasisLoader) {
|
|
61732
62393
|
let texture = await load(arrayBuffer2, loader, tileOptions.textureLoaderOptions);
|
|
@@ -61935,9 +62596,9 @@ function parsePositions2(attribute, options) {
|
|
|
61935
62596
|
const mbs = options.mbs;
|
|
61936
62597
|
const value = attribute.value;
|
|
61937
62598
|
const metadata = attribute.metadata;
|
|
61938
|
-
const enuMatrix = new
|
|
61939
|
-
const cartographicOrigin = new
|
|
61940
|
-
const cartesianOrigin = new
|
|
62599
|
+
const enuMatrix = new import_core26.Matrix4();
|
|
62600
|
+
const cartographicOrigin = new import_core26.Vector3(mbs[0], mbs[1], mbs[2]);
|
|
62601
|
+
const cartesianOrigin = new import_core26.Vector3();
|
|
61941
62602
|
import_geospatial8.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
|
|
61942
62603
|
import_geospatial8.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
|
|
61943
62604
|
attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
|
|
@@ -61964,7 +62625,7 @@ function getModelMatrix(positions) {
|
|
|
61964
62625
|
const metadata = positions.metadata;
|
|
61965
62626
|
const scaleX = metadata?.["i3s-scale_x"]?.double || 1;
|
|
61966
62627
|
const scaleY = metadata?.["i3s-scale_y"]?.double || 1;
|
|
61967
|
-
const modelMatrix = new
|
|
62628
|
+
const modelMatrix = new import_core26.Matrix4();
|
|
61968
62629
|
modelMatrix[0] = scaleX;
|
|
61969
62630
|
modelMatrix[5] = scaleY;
|
|
61970
62631
|
return modelMatrix;
|
|
@@ -62446,7 +63107,7 @@ function getMagicNumber(data) {
|
|
|
62446
63107
|
}
|
|
62447
63108
|
|
|
62448
63109
|
// src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
|
|
62449
|
-
var
|
|
63110
|
+
var import_core30 = __toModule(require_es5());
|
|
62450
63111
|
var import_geospatial10 = __toModule(require_es52());
|
|
62451
63112
|
var import_culling6 = __toModule(require_es53());
|
|
62452
63113
|
function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
@@ -62455,7 +63116,7 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
|
62455
63116
|
i3SObb.center[1],
|
|
62456
63117
|
i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
|
|
62457
63118
|
];
|
|
62458
|
-
const cartesianCenter = import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new
|
|
63119
|
+
const cartesianCenter = import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core30.Vector3());
|
|
62459
63120
|
const tiles3DObb = new import_culling6.OrientedBoundingBox().fromCenterHalfSizeQuaternion(cartesianCenter, i3SObb.halfSize, i3SObb.quaternion);
|
|
62460
63121
|
return [...tiles3DObb.center, ...tiles3DObb.halfAxes.toArray()];
|
|
62461
63122
|
}
|
|
@@ -62499,7 +63160,7 @@ var TILESET = () => ({
|
|
|
62499
63160
|
});
|
|
62500
63161
|
|
|
62501
63162
|
// src/3d-tiles-converter/helpers/b3dm-converter.ts
|
|
62502
|
-
var
|
|
63163
|
+
var import_core32 = __toModule(require_es5());
|
|
62503
63164
|
var import_geospatial11 = __toModule(require_es52());
|
|
62504
63165
|
|
|
62505
63166
|
// src/3d-tiles-converter/helpers/texture-atlas.ts
|
|
@@ -62534,8 +63195,8 @@ function normalizeRegions(regions) {
|
|
|
62534
63195
|
}
|
|
62535
63196
|
|
|
62536
63197
|
// src/3d-tiles-converter/helpers/b3dm-converter.ts
|
|
62537
|
-
var Z_UP_TO_Y_UP_MATRIX = new
|
|
62538
|
-
var scratchVector6 = new
|
|
63198
|
+
var Z_UP_TO_Y_UP_MATRIX = new import_core32.Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
|
|
63199
|
+
var scratchVector6 = new import_core32.Vector3();
|
|
62539
63200
|
var B3dmConverter = class {
|
|
62540
63201
|
async convert(i3sAttributesData, featureAttributes = null) {
|
|
62541
63202
|
const gltf = await this.buildGltf(i3sAttributesData, featureAttributes);
|
|
@@ -62559,8 +63220,8 @@ var B3dmConverter = class {
|
|
|
62559
63220
|
if (attributes.uvRegions && attributes.texCoords) {
|
|
62560
63221
|
attributes.texCoords.value = convertTextureAtlas(attributes.texCoords.value, attributes.uvRegions.value);
|
|
62561
63222
|
}
|
|
62562
|
-
const cartesianOrigin = new
|
|
62563
|
-
const cartographicOrigin = import_geospatial11.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new
|
|
63223
|
+
const cartesianOrigin = new import_core32.Vector3(box);
|
|
63224
|
+
const cartographicOrigin = import_geospatial11.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core32.Vector3());
|
|
62564
63225
|
attributes.positions.value = this._normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix);
|
|
62565
63226
|
this._createBatchIds(tileContent, featureAttributes);
|
|
62566
63227
|
if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
|
|
@@ -62600,8 +63261,8 @@ var B3dmConverter = class {
|
|
|
62600
63261
|
const newPositionsValue = new Float32Array(positionsValue.length);
|
|
62601
63262
|
for (let index = 0; index < positionsValue.length; index += 3) {
|
|
62602
63263
|
const vertex = positionsValue.subarray(index, index + 3);
|
|
62603
|
-
const cartesianOriginVector = new
|
|
62604
|
-
let vertexVector = new
|
|
63264
|
+
const cartesianOriginVector = new import_core32.Vector3(cartesianOrigin);
|
|
63265
|
+
let vertexVector = new import_core32.Vector3(Array.from(vertex)).transform(modelMatrix).add(cartographicOrigin);
|
|
62605
63266
|
import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(vertexVector, scratchVector6);
|
|
62606
63267
|
vertexVector = scratchVector6.subtract(cartesianOriginVector);
|
|
62607
63268
|
newPositionsValue.set(vertexVector, index);
|
|
@@ -62609,7 +63270,7 @@ var B3dmConverter = class {
|
|
|
62609
63270
|
return newPositionsValue;
|
|
62610
63271
|
}
|
|
62611
63272
|
_generateTransformMatrix(cartesianOrigin) {
|
|
62612
|
-
const translateOriginMatrix = new
|
|
63273
|
+
const translateOriginMatrix = new import_core32.Matrix4().translate(cartesianOrigin);
|
|
62613
63274
|
const result = translateOriginMatrix.multiplyLeft(Z_UP_TO_Y_UP_MATRIX);
|
|
62614
63275
|
return result;
|
|
62615
63276
|
}
|