@loaders.gl/tile-converter 4.0.0-alpha.13 → 4.0.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/bin/i3s-server.js +4 -0
  2. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -1
  3. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  4. package/dist/3d-tiles-converter/3d-tiles-converter.js +8 -19
  5. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +4 -1
  6. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  7. package/dist/converter.min.js +65 -65
  8. package/dist/dist.min.js +881 -261
  9. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +34 -67
  10. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  11. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  12. package/dist/es5/deps-installer/deps-installer.js +1 -1
  13. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  14. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  15. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  16. package/dist/es5/i3s-converter/i3s-converter.js +36 -43
  17. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  18. package/dist/es5/i3s-converter/types.js.map +1 -1
  19. package/dist/es5/i3s-server/README.md +46 -2
  20. package/dist/es5/i3s-server/app.js +3 -3
  21. package/dist/es5/i3s-server/app.js.map +1 -1
  22. package/dist/es5/i3s-server/bin/www.js +61 -0
  23. package/dist/es5/i3s-server/bin/www.js.map +1 -0
  24. package/dist/es5/i3s-server/controllers/slpk-controller.js +14 -18
  25. package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -1
  26. package/dist/es5/index.js +7 -0
  27. package/dist/es5/index.js.map +1 -1
  28. package/dist/es5/pgm-loader.js +1 -1
  29. package/dist/es5/slpk-extractor/helpers/file-handle-provider.js +59 -26
  30. package/dist/es5/slpk-extractor/helpers/file-handle-provider.js.map +1 -1
  31. package/dist/es5/slpk-extractor/helpers/fs-promises.js +77 -0
  32. package/dist/es5/slpk-extractor/helpers/fs-promises.js.map +1 -0
  33. package/dist/es5/slpk-extractor/slpk-extractor.js +7 -7
  34. package/dist/es5/slpk-extractor/slpk-extractor.js.map +1 -1
  35. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +8 -18
  36. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  37. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  38. package/dist/esm/deps-installer/deps-installer.js +1 -1
  39. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  40. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  41. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  42. package/dist/esm/i3s-converter/i3s-converter.js +5 -8
  43. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  44. package/dist/esm/i3s-converter/types.js.map +1 -1
  45. package/dist/esm/i3s-server/README.md +46 -2
  46. package/dist/esm/i3s-server/app.js +4 -4
  47. package/dist/esm/i3s-server/app.js.map +1 -1
  48. package/dist/esm/i3s-server/bin/i3s-server.min.js +614 -0
  49. package/{src/i3s-server/bin/www → dist/esm/i3s-server/bin/www.js} +12 -55
  50. package/dist/esm/i3s-server/bin/www.js.map +1 -0
  51. package/dist/esm/i3s-server/controllers/slpk-controller.js +6 -12
  52. package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -1
  53. package/dist/esm/index.js +1 -0
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/pgm-loader.js +1 -1
  56. package/dist/esm/slpk-extractor/helpers/file-handle-provider.js +17 -6
  57. package/dist/esm/slpk-extractor/helpers/file-handle-provider.js.map +1 -1
  58. package/dist/esm/slpk-extractor/helpers/fs-promises.js +32 -0
  59. package/dist/esm/slpk-extractor/helpers/fs-promises.js.map +1 -0
  60. package/dist/esm/slpk-extractor/slpk-extractor.js +2 -2
  61. package/dist/esm/slpk-extractor/slpk-extractor.js.map +1 -1
  62. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
  63. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
  64. package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -3
  65. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  66. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +2 -2
  67. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  68. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  69. package/dist/i3s-converter/i3s-converter.js +5 -6
  70. package/dist/i3s-converter/types.d.ts +32 -1
  71. package/dist/i3s-converter/types.d.ts.map +1 -1
  72. package/dist/i3s-server/app.d.ts.map +1 -1
  73. package/dist/i3s-server/app.js +1 -1
  74. package/dist/i3s-server/bin/www.d.ts +3 -0
  75. package/dist/i3s-server/bin/www.d.ts.map +1 -0
  76. package/dist/i3s-server/bin/www.js +83 -0
  77. package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
  78. package/dist/i3s-server/controllers/slpk-controller.js +4 -9
  79. package/dist/index.d.ts +1 -0
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +3 -1
  82. package/dist/slpk-extractor/helpers/file-handle-provider.d.ts +15 -12
  83. package/dist/slpk-extractor/helpers/file-handle-provider.d.ts.map +1 -1
  84. package/dist/slpk-extractor/helpers/file-handle-provider.js +25 -10
  85. package/dist/slpk-extractor/helpers/fs-promises.d.ts +38 -0
  86. package/dist/slpk-extractor/helpers/fs-promises.d.ts.map +1 -0
  87. package/dist/slpk-extractor/helpers/fs-promises.js +51 -0
  88. package/dist/slpk-extractor/slpk-extractor.d.ts +2 -2
  89. package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
  90. package/dist/slpk-extractor/slpk-extractor.js +4 -7
  91. package/dist/slpk-extractor.min.js +44 -44
  92. package/package.json +20 -21
  93. package/src/3d-tiles-converter/3d-tiles-converter.ts +10 -28
  94. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +5 -2
  95. package/src/i3s-converter/helpers/batch-ids-extensions.ts +1 -1
  96. package/src/i3s-converter/helpers/geometry-converter.ts +2 -7
  97. package/src/i3s-converter/helpers/gltf-attributes.ts +2 -2
  98. package/src/i3s-converter/i3s-converter.ts +5 -6
  99. package/src/i3s-converter/types.ts +32 -1
  100. package/src/i3s-server/README.md +46 -2
  101. package/src/i3s-server/app.js +1 -1
  102. package/{dist/es5/i3s-server/bin/www → src/i3s-server/bin/www.js} +7 -7
  103. package/src/i3s-server/controllers/slpk-controller.js +4 -11
  104. package/src/index.ts +1 -0
  105. package/src/slpk-extractor/helpers/file-handle-provider.ts +36 -18
  106. package/src/slpk-extractor/helpers/fs-promises.ts +66 -0
  107. package/src/slpk-extractor/slpk-extractor.ts +5 -6
  108. package/dist/3d-tiles-attributes-worker.d.ts +0 -28
  109. package/dist/3d-tiles-attributes-worker.d.ts.map +0 -1
  110. package/dist/3d-tiles-attributes-worker.js +0 -3
  111. package/dist/3d-tiles-attributes-worker.js.map +0 -7
  112. package/dist/es5/3d-tiles-attributes-worker.js +0 -25
  113. package/dist/es5/3d-tiles-attributes-worker.js.map +0 -1
  114. package/dist/es5/i3s-attributes-worker.js +0 -25
  115. package/dist/es5/i3s-attributes-worker.js.map +0 -1
  116. package/dist/es5/workers/3d-tiles-attributes-worker.js +0 -28
  117. package/dist/es5/workers/3d-tiles-attributes-worker.js.map +0 -1
  118. package/dist/es5/workers/i3s-attributes-worker.js +0 -30
  119. package/dist/es5/workers/i3s-attributes-worker.js.map +0 -1
  120. package/dist/esm/3d-tiles-attributes-worker.js +0 -16
  121. package/dist/esm/3d-tiles-attributes-worker.js.map +0 -1
  122. package/dist/esm/i3s-attributes-worker.js +0 -16
  123. package/dist/esm/i3s-attributes-worker.js.map +0 -1
  124. package/dist/esm/i3s-server/bin/www +0 -102
  125. package/dist/esm/workers/3d-tiles-attributes-worker.js +0 -8
  126. package/dist/esm/workers/3d-tiles-attributes-worker.js.map +0 -1
  127. package/dist/esm/workers/i3s-attributes-worker.js +0 -7
  128. package/dist/esm/workers/i3s-attributes-worker.js.map +0 -1
  129. package/dist/i3s-attributes-worker.d.ts +0 -45
  130. package/dist/i3s-attributes-worker.d.ts.map +0 -1
  131. package/dist/i3s-attributes-worker.js +0 -9
  132. package/dist/i3s-attributes-worker.js.map +0 -7
  133. package/dist/workers/3d-tiles-attributes-worker.d.ts +0 -2
  134. package/dist/workers/3d-tiles-attributes-worker.d.ts.map +0 -1
  135. package/dist/workers/3d-tiles-attributes-worker.js +0 -9
  136. package/dist/workers/i3s-attributes-worker.d.ts +0 -2
  137. package/dist/workers/i3s-attributes-worker.d.ts.map +0 -1
  138. package/dist/workers/i3s-attributes-worker.js +0 -5
  139. package/src/3d-tiles-attributes-worker.ts +0 -43
  140. package/src/i3s-attributes-worker.ts +0 -59
  141. package/src/workers/3d-tiles-attributes-worker.ts +0 -6
  142. package/src/workers/i3s-attributes-worker.ts +0 -7
package/dist/dist.min.js CHANGED
@@ -2173,15 +2173,15 @@ var require_vector3 = __commonJS({
2173
2173
  }
2174
2174
  var ORIGIN = [0, 0, 0];
2175
2175
  var ZERO2;
2176
- var Vector323 = function(_Vector) {
2177
- (0, _inherits2.default)(Vector324, _Vector);
2178
- var _super = _createSuper(Vector324);
2179
- function Vector324() {
2176
+ var Vector324 = function(_Vector) {
2177
+ (0, _inherits2.default)(Vector325, _Vector);
2178
+ var _super = _createSuper(Vector325);
2179
+ function Vector325() {
2180
2180
  var _this;
2181
2181
  var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
2182
2182
  var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
2183
2183
  var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
2184
- (0, _classCallCheck2.default)(this, Vector324);
2184
+ (0, _classCallCheck2.default)(this, Vector325);
2185
2185
  _this = _super.call(this, -0, -0, -0);
2186
2186
  if (arguments.length === 1 && (0, _common.isArray)(x)) {
2187
2187
  _this.copy(x);
@@ -2197,7 +2197,7 @@ var require_vector3 = __commonJS({
2197
2197
  }
2198
2198
  return _this;
2199
2199
  }
2200
- (0, _createClass2.default)(Vector324, [{
2200
+ (0, _createClass2.default)(Vector325, [{
2201
2201
  key: "set",
2202
2202
  value: function set(x, y, z) {
2203
2203
  this[0] = x;
@@ -2318,15 +2318,15 @@ var require_vector3 = __commonJS({
2318
2318
  key: "ZERO",
2319
2319
  get: function get() {
2320
2320
  if (!ZERO2) {
2321
- ZERO2 = new Vector324(0, 0, 0);
2321
+ ZERO2 = new Vector325(0, 0, 0);
2322
2322
  Object.freeze(ZERO2);
2323
2323
  }
2324
2324
  return ZERO2;
2325
2325
  }
2326
2326
  }]);
2327
- return Vector324;
2327
+ return Vector325;
2328
2328
  }(_vector.default);
2329
- exports.default = Vector323;
2329
+ exports.default = Vector324;
2330
2330
  }
2331
2331
  });
2332
2332
 
@@ -5290,12 +5290,12 @@ var require_matrix4 = __commonJS({
5290
5290
  var DEFAULT_NEAR = 0.1;
5291
5291
  var DEFAULT_FAR = 500;
5292
5292
  var IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
5293
- var Matrix412 = function(_Matrix) {
5294
- (0, _inherits2.default)(Matrix413, _Matrix);
5295
- var _super = _createSuper(Matrix413);
5296
- function Matrix413(array) {
5293
+ var Matrix413 = function(_Matrix) {
5294
+ (0, _inherits2.default)(Matrix414, _Matrix);
5295
+ var _super = _createSuper(Matrix414);
5296
+ function Matrix414(array) {
5297
5297
  var _this;
5298
- (0, _classCallCheck2.default)(this, Matrix413);
5298
+ (0, _classCallCheck2.default)(this, Matrix414);
5299
5299
  _this = _super.call(this, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
5300
5300
  if (arguments.length === 1 && Array.isArray(array)) {
5301
5301
  _this.copy(array);
@@ -5304,7 +5304,7 @@ var require_matrix4 = __commonJS({
5304
5304
  }
5305
5305
  return _this;
5306
5306
  }
5307
- (0, _createClass2.default)(Matrix413, [{
5307
+ (0, _createClass2.default)(Matrix414, [{
5308
5308
  key: "ELEMENTS",
5309
5309
  get: function get() {
5310
5310
  return 16;
@@ -5685,21 +5685,21 @@ var require_matrix4 = __commonJS({
5685
5685
  return getZeroMatrix();
5686
5686
  }
5687
5687
  }]);
5688
- return Matrix413;
5688
+ return Matrix414;
5689
5689
  }(_matrix.default);
5690
- exports.default = Matrix412;
5690
+ exports.default = Matrix413;
5691
5691
  var ZERO2;
5692
5692
  var IDENTITY;
5693
5693
  function getZeroMatrix() {
5694
5694
  if (!ZERO2) {
5695
- ZERO2 = new Matrix412([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
5695
+ ZERO2 = new Matrix413([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
5696
5696
  Object.freeze(ZERO2);
5697
5697
  }
5698
5698
  return ZERO2;
5699
5699
  }
5700
5700
  function getIdentityMatrix() {
5701
5701
  if (!IDENTITY) {
5702
- IDENTITY = new Matrix412();
5702
+ IDENTITY = new Matrix413();
5703
5703
  Object.freeze(IDENTITY);
5704
5704
  }
5705
5705
  return IDENTITY;
@@ -7848,7 +7848,7 @@ var require_type_utils = __commonJS({
7848
7848
  function identity(x) {
7849
7849
  return x;
7850
7850
  }
7851
- var scratchVector7 = new _core.Vector3();
7851
+ var scratchVector8 = new _core.Vector3();
7852
7852
  function fromCartographic(cartographic) {
7853
7853
  var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
7854
7854
  var map = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : identity;
@@ -7902,7 +7902,7 @@ var require_type_utils = __commonJS({
7902
7902
  if (!vector) {
7903
7903
  return false;
7904
7904
  }
7905
- scratchVector7.from(vector);
7905
+ scratchVector8.from(vector);
7906
7906
  var oneOverRadiiSquared = _constants.WGS84_CONSTANTS.oneOverRadiiSquared, centerToleranceSquared = _constants.WGS84_CONSTANTS.centerToleranceSquared;
7907
7907
  var x2 = vector[0] * vector[0] * oneOverRadiiSquared[0];
7908
7908
  var y2 = vector[1] * vector[1] * oneOverRadiiSquared[1];
@@ -7921,16 +7921,16 @@ var require_scale_to_geodetic_surface = __commonJS({
7921
7921
  });
7922
7922
  exports.default = scaleToGeodeticSurface;
7923
7923
  var _core = require_es5();
7924
- var scratchVector7 = new _core.Vector3();
7924
+ var scratchVector8 = new _core.Vector3();
7925
7925
  var scaleToGeodeticSurfaceIntersection = new _core.Vector3();
7926
7926
  var scaleToGeodeticSurfaceGradient = new _core.Vector3();
7927
7927
  function scaleToGeodeticSurface(cartesian, ellipsoid) {
7928
7928
  var result = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
7929
7929
  var oneOverRadii = ellipsoid.oneOverRadii, oneOverRadiiSquared = ellipsoid.oneOverRadiiSquared, centerToleranceSquared = ellipsoid.centerToleranceSquared;
7930
- scratchVector7.from(cartesian);
7931
- var positionX = scratchVector7.x;
7932
- var positionY = scratchVector7.y;
7933
- var positionZ = scratchVector7.z;
7930
+ scratchVector8.from(cartesian);
7931
+ var positionX = scratchVector8.x;
7932
+ var positionY = scratchVector8.y;
7933
+ var positionZ = scratchVector8.z;
7934
7934
  var oneOverRadiiX = oneOverRadii.x;
7935
7935
  var oneOverRadiiY = oneOverRadii.y;
7936
7936
  var oneOverRadiiZ = oneOverRadii.z;
@@ -7952,7 +7952,7 @@ var require_scale_to_geodetic_surface = __commonJS({
7952
7952
  var oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
7953
7953
  var gradient = scaleToGeodeticSurfaceGradient;
7954
7954
  gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
7955
- var lambda = (1 - ratio) * scratchVector7.len() / (0.5 * gradient.len());
7955
+ var lambda = (1 - ratio) * scratchVector8.len() / (0.5 * gradient.len());
7956
7956
  var correction = 0;
7957
7957
  var xMultiplier;
7958
7958
  var yMultiplier;
@@ -7974,7 +7974,7 @@ var require_scale_to_geodetic_surface = __commonJS({
7974
7974
  var derivative = -2 * denominator;
7975
7975
  correction = func / derivative;
7976
7976
  } while (Math.abs(func) > _core._MathUtils.EPSILON12);
7977
- return scratchVector7.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
7977
+ return scratchVector8.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
7978
7978
  }
7979
7979
  }
7980
7980
  });
@@ -8161,18 +8161,18 @@ var require_ellipsoid = __commonJS({
8161
8161
  }
8162
8162
  return newObj;
8163
8163
  }
8164
- var scratchVector7 = new _core.Vector3();
8164
+ var scratchVector8 = new _core.Vector3();
8165
8165
  var scratchNormal2 = new _core.Vector3();
8166
8166
  var scratchK = new _core.Vector3();
8167
8167
  var scratchPosition3 = new _core.Vector3();
8168
8168
  var scratchHeight = new _core.Vector3();
8169
8169
  var scratchCartesian = new _core.Vector3();
8170
- var Ellipsoid16 = function() {
8171
- function Ellipsoid17() {
8170
+ var Ellipsoid17 = function() {
8171
+ function Ellipsoid18() {
8172
8172
  var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
8173
8173
  var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
8174
8174
  var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
8175
- (0, _classCallCheck2.default)(this, Ellipsoid17);
8175
+ (0, _classCallCheck2.default)(this, Ellipsoid18);
8176
8176
  (0, _defineProperty2.default)(this, "radii", void 0);
8177
8177
  (0, _defineProperty2.default)(this, "radiiSquared", void 0);
8178
8178
  (0, _defineProperty2.default)(this, "radiiToTheFourth", void 0);
@@ -8197,7 +8197,7 @@ var require_ellipsoid = __commonJS({
8197
8197
  }
8198
8198
  Object.freeze(this);
8199
8199
  }
8200
- (0, _createClass2.default)(Ellipsoid17, [{
8200
+ (0, _createClass2.default)(Ellipsoid18, [{
8201
8201
  key: "equals",
8202
8202
  value: function equals2(right) {
8203
8203
  return this === right || Boolean(right && this.radii.equals(right.radii));
@@ -8255,7 +8255,7 @@ var require_ellipsoid = __commonJS({
8255
8255
  key: "geocentricSurfaceNormal",
8256
8256
  value: function geocentricSurfaceNormal(cartesian) {
8257
8257
  var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];
8258
- return scratchVector7.from(cartesian).normalize().to(result);
8258
+ return scratchVector8.from(cartesian).normalize().to(result);
8259
8259
  }
8260
8260
  }, {
8261
8261
  key: "geodeticSurfaceNormalCartographic",
@@ -8265,14 +8265,14 @@ var require_ellipsoid = __commonJS({
8265
8265
  var longitude = cartographicVectorRadians[0];
8266
8266
  var latitude = cartographicVectorRadians[1];
8267
8267
  var cosLatitude = Math.cos(latitude);
8268
- scratchVector7.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
8269
- return scratchVector7.to(result);
8268
+ scratchVector8.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
8269
+ return scratchVector8.to(result);
8270
8270
  }
8271
8271
  }, {
8272
8272
  key: "geodeticSurfaceNormal",
8273
8273
  value: function geodeticSurfaceNormal(cartesian) {
8274
8274
  var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];
8275
- return scratchVector7.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
8275
+ return scratchVector8.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
8276
8276
  }
8277
8277
  }, {
8278
8278
  key: "scaleToGeodeticSurface",
@@ -8318,10 +8318,10 @@ var require_ellipsoid = __commonJS({
8318
8318
  return scratchPosition3.set(0, 0, z).to(result);
8319
8319
  }
8320
8320
  }]);
8321
- return Ellipsoid17;
8321
+ return Ellipsoid18;
8322
8322
  }();
8323
- exports.default = Ellipsoid16;
8324
- (0, _defineProperty2.default)(Ellipsoid16, "WGS84", new Ellipsoid16(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z));
8323
+ exports.default = Ellipsoid17;
8324
+ (0, _defineProperty2.default)(Ellipsoid17, "WGS84", new Ellipsoid17(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z));
8325
8325
  }
8326
8326
  });
8327
8327
 
@@ -8381,7 +8381,7 @@ var require_axis_aligned_bounding_box = __commonJS({
8381
8381
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
8382
8382
  var _core = require_es5();
8383
8383
  var _constants = require_constants2();
8384
- var scratchVector7 = new _core.Vector3();
8384
+ var scratchVector8 = new _core.Vector3();
8385
8385
  var scratchNormal2 = new _core.Vector3();
8386
8386
  var AxisAlignedBoundingBox = function() {
8387
8387
  function AxisAlignedBoundingBox2() {
@@ -8393,7 +8393,7 @@ var require_axis_aligned_bounding_box = __commonJS({
8393
8393
  (0, _defineProperty2.default)(this, "halfDiagonal", void 0);
8394
8394
  (0, _defineProperty2.default)(this, "minimum", void 0);
8395
8395
  (0, _defineProperty2.default)(this, "maximum", void 0);
8396
- center = center || scratchVector7.copy(minimum).add(maximum).scale(0.5);
8396
+ center = center || scratchVector8.copy(minimum).add(maximum).scale(0.5);
8397
8397
  this.center = new _core.Vector3(center);
8398
8398
  this.halfDiagonal = new _core.Vector3(maximum).subtract(this.center);
8399
8399
  this.minimum = new _core.Vector3(minimum);
@@ -8441,7 +8441,7 @@ var require_axis_aligned_bounding_box = __commonJS({
8441
8441
  }, {
8442
8442
  key: "distanceSquaredTo",
8443
8443
  value: function distanceSquaredTo(point) {
8444
- var offset = scratchVector7.from(point).subtract(this.center);
8444
+ var offset = scratchVector8.from(point).subtract(this.center);
8445
8445
  var halfDiagonal = this.halfDiagonal;
8446
8446
  var distanceSquared = 0;
8447
8447
  var d;
@@ -8520,7 +8520,7 @@ var require_bounding_sphere = __commonJS({
8520
8520
  }
8521
8521
  return newObj;
8522
8522
  }
8523
- var scratchVector7 = new _core.Vector3();
8523
+ var scratchVector8 = new _core.Vector3();
8524
8524
  var scratchVector23 = new _core.Vector3();
8525
8525
  var BoundingSphere5 = function() {
8526
8526
  function BoundingSphere6() {
@@ -8543,7 +8543,7 @@ var require_bounding_sphere = __commonJS({
8543
8543
  }, {
8544
8544
  key: "fromCornerPoints",
8545
8545
  value: function fromCornerPoints(corner, oppositeCorner) {
8546
- oppositeCorner = scratchVector7.from(oppositeCorner);
8546
+ oppositeCorner = scratchVector8.from(oppositeCorner);
8547
8547
  this.center = new _core.Vector3().from(corner).add(oppositeCorner).scale(0.5);
8548
8548
  this.radius = this.center.distance(oppositeCorner);
8549
8549
  return this;
@@ -8565,7 +8565,7 @@ var require_bounding_sphere = __commonJS({
8565
8565
  var leftRadius = this.radius;
8566
8566
  var rightCenter = boundingSphere.center;
8567
8567
  var rightRadius = boundingSphere.radius;
8568
- var toRightCenter = scratchVector7.copy(rightCenter).subtract(leftCenter);
8568
+ var toRightCenter = scratchVector8.copy(rightCenter).subtract(leftCenter);
8569
8569
  var centerSeparation = toRightCenter.magnitude();
8570
8570
  if (leftRadius >= centerSeparation + rightRadius) {
8571
8571
  return this.clone();
@@ -8582,7 +8582,7 @@ var require_bounding_sphere = __commonJS({
8582
8582
  }, {
8583
8583
  key: "expand",
8584
8584
  value: function expand(point) {
8585
- var scratchPoint2 = scratchVector7.from(point);
8585
+ var scratchPoint2 = scratchVector8.from(point);
8586
8586
  var radius = scratchPoint2.subtract(this.center).magnitude();
8587
8587
  if (radius > this.radius) {
8588
8588
  this.radius = radius;
@@ -8593,7 +8593,7 @@ var require_bounding_sphere = __commonJS({
8593
8593
  key: "transform",
8594
8594
  value: function transform11(_transform) {
8595
8595
  this.center.transform(_transform);
8596
- var scale = mat4.getScaling(scratchVector7, _transform);
8596
+ var scale = mat4.getScaling(scratchVector8, _transform);
8597
8597
  this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;
8598
8598
  return this;
8599
8599
  }
@@ -8606,7 +8606,7 @@ var require_bounding_sphere = __commonJS({
8606
8606
  }, {
8607
8607
  key: "distanceTo",
8608
8608
  value: function distanceTo(point) {
8609
- var scratchPoint2 = scratchVector7.from(point);
8609
+ var scratchPoint2 = scratchVector8.from(point);
8610
8610
  var delta = scratchPoint2.subtract(this.center);
8611
8611
  return Math.max(0, delta.len() - this.radius);
8612
8612
  }
@@ -10337,16 +10337,20 @@ var require_stringify = __commonJS({
10337
10337
  value: true
10338
10338
  });
10339
10339
  exports.default = void 0;
10340
+ exports.unsafeStringify = unsafeStringify;
10340
10341
  var _validate = _interopRequireDefault(require_validate());
10341
10342
  function _interopRequireDefault(obj) {
10342
10343
  return obj && obj.__esModule ? obj : { default: obj };
10343
10344
  }
10344
10345
  var byteToHex = [];
10345
10346
  for (let i = 0; i < 256; ++i) {
10346
- byteToHex.push((i + 256).toString(16).substr(1));
10347
+ byteToHex.push((i + 256).toString(16).slice(1));
10348
+ }
10349
+ function unsafeStringify(arr, offset = 0) {
10350
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
10347
10351
  }
10348
10352
  function stringify2(arr, offset = 0) {
10349
- const uuid2 = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
10353
+ const uuid2 = unsafeStringify(arr, offset);
10350
10354
  if (!(0, _validate.default)(uuid2)) {
10351
10355
  throw TypeError("Stringified UUID is invalid");
10352
10356
  }
@@ -10366,7 +10370,7 @@ var require_v1 = __commonJS({
10366
10370
  });
10367
10371
  exports.default = void 0;
10368
10372
  var _rng = _interopRequireDefault(require_rng());
10369
- var _stringify = _interopRequireDefault(require_stringify());
10373
+ var _stringify = require_stringify();
10370
10374
  function _interopRequireDefault(obj) {
10371
10375
  return obj && obj.__esModule ? obj : { default: obj };
10372
10376
  }
@@ -10420,7 +10424,7 @@ var require_v1 = __commonJS({
10420
10424
  for (let n = 0; n < 6; ++n) {
10421
10425
  b[i + n] = node2[n];
10422
10426
  }
10423
- return buf || (0, _stringify.default)(b);
10427
+ return buf || (0, _stringify.unsafeStringify)(b);
10424
10428
  }
10425
10429
  var _default = v12;
10426
10430
  exports.default = _default;
@@ -10475,9 +10479,9 @@ var require_v35 = __commonJS({
10475
10479
  Object.defineProperty(exports, "__esModule", {
10476
10480
  value: true
10477
10481
  });
10478
- exports.default = _default;
10479
10482
  exports.URL = exports.DNS = void 0;
10480
- var _stringify = _interopRequireDefault(require_stringify());
10483
+ exports.default = v35;
10484
+ var _stringify = require_stringify();
10481
10485
  var _parse = _interopRequireDefault(require_parse());
10482
10486
  function _interopRequireDefault(obj) {
10483
10487
  return obj && obj.__esModule ? obj : { default: obj };
@@ -10494,15 +10498,16 @@ var require_v35 = __commonJS({
10494
10498
  exports.DNS = DNS;
10495
10499
  var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
10496
10500
  exports.URL = URL2;
10497
- function _default(name10, version2, hashfunc) {
10501
+ function v35(name10, version2, hashfunc) {
10498
10502
  function generateUUID(value, namespace, buf, offset) {
10503
+ var _namespace;
10499
10504
  if (typeof value === "string") {
10500
10505
  value = stringToBytes2(value);
10501
10506
  }
10502
10507
  if (typeof namespace === "string") {
10503
10508
  namespace = (0, _parse.default)(namespace);
10504
10509
  }
10505
- if (namespace.length !== 16) {
10510
+ if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
10506
10511
  throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
10507
10512
  }
10508
10513
  let bytes = new Uint8Array(16 + value.length);
@@ -10518,7 +10523,7 @@ var require_v35 = __commonJS({
10518
10523
  }
10519
10524
  return buf;
10520
10525
  }
10521
- return (0, _stringify.default)(bytes);
10526
+ return (0, _stringify.unsafeStringify)(bytes);
10522
10527
  }
10523
10528
  try {
10524
10529
  generateUUID.name = name10;
@@ -10575,6 +10580,25 @@ var require_v3 = __commonJS({
10575
10580
  }
10576
10581
  });
10577
10582
 
10583
+ // node_modules/uuid/dist/native.js
10584
+ var require_native = __commonJS({
10585
+ "node_modules/uuid/dist/native.js"(exports) {
10586
+ "use strict";
10587
+ Object.defineProperty(exports, "__esModule", {
10588
+ value: true
10589
+ });
10590
+ exports.default = void 0;
10591
+ var _crypto = _interopRequireDefault(require("crypto"));
10592
+ function _interopRequireDefault(obj) {
10593
+ return obj && obj.__esModule ? obj : { default: obj };
10594
+ }
10595
+ var _default = {
10596
+ randomUUID: _crypto.default.randomUUID
10597
+ };
10598
+ exports.default = _default;
10599
+ }
10600
+ });
10601
+
10578
10602
  // node_modules/uuid/dist/v4.js
10579
10603
  var require_v4 = __commonJS({
10580
10604
  "node_modules/uuid/dist/v4.js"(exports) {
@@ -10583,12 +10607,16 @@ var require_v4 = __commonJS({
10583
10607
  value: true
10584
10608
  });
10585
10609
  exports.default = void 0;
10610
+ var _native = _interopRequireDefault(require_native());
10586
10611
  var _rng = _interopRequireDefault(require_rng());
10587
- var _stringify = _interopRequireDefault(require_stringify());
10612
+ var _stringify = require_stringify();
10588
10613
  function _interopRequireDefault(obj) {
10589
10614
  return obj && obj.__esModule ? obj : { default: obj };
10590
10615
  }
10591
10616
  function v42(options, buf, offset) {
10617
+ if (_native.default.randomUUID && !buf && !options) {
10618
+ return _native.default.randomUUID();
10619
+ }
10592
10620
  options = options || {};
10593
10621
  const rnds = options.random || (options.rng || _rng.default)();
10594
10622
  rnds[6] = rnds[6] & 15 | 64;
@@ -10600,7 +10628,7 @@ var require_v4 = __commonJS({
10600
10628
  }
10601
10629
  return buf;
10602
10630
  }
10603
- return (0, _stringify.default)(rnds);
10631
+ return (0, _stringify.unsafeStringify)(rnds);
10604
10632
  }
10605
10633
  var _default = v42;
10606
10634
  exports.default = _default;
@@ -10680,7 +10708,7 @@ var require_version = __commonJS({
10680
10708
  if (!(0, _validate.default)(uuid2)) {
10681
10709
  throw TypeError("Invalid UUID");
10682
10710
  }
10683
- return parseInt(uuid2.substr(14, 1), 16);
10711
+ return parseInt(uuid2.slice(14, 15), 16);
10684
10712
  }
10685
10713
  var _default = version2;
10686
10714
  exports.default = _default;
@@ -10694,58 +10722,58 @@ var require_dist = __commonJS({
10694
10722
  Object.defineProperty(exports, "__esModule", {
10695
10723
  value: true
10696
10724
  });
10697
- Object.defineProperty(exports, "v1", {
10725
+ Object.defineProperty(exports, "NIL", {
10698
10726
  enumerable: true,
10699
10727
  get: function() {
10700
- return _v.default;
10728
+ return _nil.default;
10701
10729
  }
10702
10730
  });
10703
- Object.defineProperty(exports, "v3", {
10731
+ Object.defineProperty(exports, "parse", {
10704
10732
  enumerable: true,
10705
10733
  get: function() {
10706
- return _v2.default;
10734
+ return _parse.default;
10707
10735
  }
10708
10736
  });
10709
- Object.defineProperty(exports, "v4", {
10737
+ Object.defineProperty(exports, "stringify", {
10710
10738
  enumerable: true,
10711
10739
  get: function() {
10712
- return _v3.default;
10740
+ return _stringify.default;
10713
10741
  }
10714
10742
  });
10715
- Object.defineProperty(exports, "v5", {
10743
+ Object.defineProperty(exports, "v1", {
10716
10744
  enumerable: true,
10717
10745
  get: function() {
10718
- return _v4.default;
10746
+ return _v.default;
10719
10747
  }
10720
10748
  });
10721
- Object.defineProperty(exports, "NIL", {
10749
+ Object.defineProperty(exports, "v3", {
10722
10750
  enumerable: true,
10723
10751
  get: function() {
10724
- return _nil.default;
10752
+ return _v2.default;
10725
10753
  }
10726
10754
  });
10727
- Object.defineProperty(exports, "version", {
10755
+ Object.defineProperty(exports, "v4", {
10728
10756
  enumerable: true,
10729
10757
  get: function() {
10730
- return _version.default;
10758
+ return _v3.default;
10731
10759
  }
10732
10760
  });
10733
- Object.defineProperty(exports, "validate", {
10761
+ Object.defineProperty(exports, "v5", {
10734
10762
  enumerable: true,
10735
10763
  get: function() {
10736
- return _validate.default;
10764
+ return _v4.default;
10737
10765
  }
10738
10766
  });
10739
- Object.defineProperty(exports, "stringify", {
10767
+ Object.defineProperty(exports, "validate", {
10740
10768
  enumerable: true,
10741
10769
  get: function() {
10742
- return _stringify.default;
10770
+ return _validate.default;
10743
10771
  }
10744
10772
  });
10745
- Object.defineProperty(exports, "parse", {
10773
+ Object.defineProperty(exports, "version", {
10746
10774
  enumerable: true,
10747
10775
  get: function() {
10748
- return _parse.default;
10776
+ return _version.default;
10749
10777
  }
10750
10778
  });
10751
10779
  var _v = _interopRequireDefault(require_v1());
@@ -11905,7 +11933,7 @@ var require_readdir_glob = __commonJS({
11905
11933
  });
11906
11934
  });
11907
11935
  }
11908
- function stat2(file, followSymlinks) {
11936
+ function stat3(file, followSymlinks) {
11909
11937
  return new Promise((resolve3, reject) => {
11910
11938
  const statFunc = followSymlinks ? fs5.stat : fs5.lstat;
11911
11939
  statFunc(file, (err, stats) => {
@@ -11913,7 +11941,7 @@ var require_readdir_glob = __commonJS({
11913
11941
  switch (err.code) {
11914
11942
  case "ENOENT":
11915
11943
  if (followSymlinks) {
11916
- resolve3(stat2(file, false));
11944
+ resolve3(stat3(file, false));
11917
11945
  } else {
11918
11946
  resolve3(null);
11919
11947
  }
@@ -11941,7 +11969,7 @@ var require_readdir_glob = __commonJS({
11941
11969
  const absolute = path2 + "/" + relative;
11942
11970
  let stats = null;
11943
11971
  if (useStat || followSymlinks) {
11944
- stats = await stat2(absolute, followSymlinks);
11972
+ stats = await stat3(absolute, followSymlinks);
11945
11973
  }
11946
11974
  if (!stats && file.name !== void 0) {
11947
11975
  stats = file;
@@ -14099,7 +14127,7 @@ var require_polyfills = __commonJS({
14099
14127
  }(fs5.rename);
14100
14128
  }
14101
14129
  fs5.read = typeof fs5.read !== "function" ? fs5.read : function(fs$read) {
14102
- function read3(fd, buffer, offset, length, position, callback_) {
14130
+ function read4(fd, buffer, offset, length, position, callback_) {
14103
14131
  var callback;
14104
14132
  if (callback_ && typeof callback_ === "function") {
14105
14133
  var eagCounter = 0;
@@ -14114,8 +14142,8 @@ var require_polyfills = __commonJS({
14114
14142
  return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
14115
14143
  }
14116
14144
  if (Object.setPrototypeOf)
14117
- Object.setPrototypeOf(read3, fs$read);
14118
- return read3;
14145
+ Object.setPrototypeOf(read4, fs$read);
14146
+ return read4;
14119
14147
  }(fs5.read);
14120
14148
  fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : function(fs$readSync) {
14121
14149
  return function(fd, buffer, offset, length, position) {
@@ -14687,7 +14715,7 @@ var require_graceful_fs = __commonJS({
14687
14715
  }
14688
14716
  function ReadStream$open() {
14689
14717
  var that = this;
14690
- open2(that.path, that.flags, that.mode, function(err, fd) {
14718
+ open3(that.path, that.flags, that.mode, function(err, fd) {
14691
14719
  if (err) {
14692
14720
  if (that.autoClose)
14693
14721
  that.destroy();
@@ -14707,7 +14735,7 @@ var require_graceful_fs = __commonJS({
14707
14735
  }
14708
14736
  function WriteStream$open() {
14709
14737
  var that = this;
14710
- open2(that.path, that.flags, that.mode, function(err, fd) {
14738
+ open3(that.path, that.flags, that.mode, function(err, fd) {
14711
14739
  if (err) {
14712
14740
  that.destroy();
14713
14741
  that.emit("error", err);
@@ -14724,8 +14752,8 @@ var require_graceful_fs = __commonJS({
14724
14752
  return new fs6.WriteStream(path2, options);
14725
14753
  }
14726
14754
  var fs$open = fs6.open;
14727
- fs6.open = open2;
14728
- function open2(path2, flags, mode, cb) {
14755
+ fs6.open = open3;
14756
+ function open3(path2, flags, mode, cb) {
14729
14757
  if (typeof mode === "function")
14730
14758
  cb = mode, mode = null;
14731
14759
  return go$open(path2, flags, mode, cb);
@@ -18174,8 +18202,8 @@ var require_old = __commonJS({
18174
18202
  if (cache3 && Object.prototype.hasOwnProperty.call(cache3, base)) {
18175
18203
  resolvedLink = cache3[base];
18176
18204
  } else {
18177
- var stat2 = fs5.lstatSync(base);
18178
- if (!stat2.isSymbolicLink()) {
18205
+ var stat3 = fs5.lstatSync(base);
18206
+ if (!stat3.isSymbolicLink()) {
18179
18207
  knownHard[base] = true;
18180
18208
  if (cache3)
18181
18209
  cache3[base] = base;
@@ -18183,7 +18211,7 @@ var require_old = __commonJS({
18183
18211
  }
18184
18212
  var linkTarget = null;
18185
18213
  if (!isWindows) {
18186
- var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
18214
+ var id = stat3.dev.toString(32) + ":" + stat3.ino.toString(32);
18187
18215
  if (seenLinks.hasOwnProperty(id)) {
18188
18216
  linkTarget = seenLinks[id];
18189
18217
  }
@@ -18257,17 +18285,17 @@ var require_old = __commonJS({
18257
18285
  }
18258
18286
  return fs5.lstat(base, gotStat);
18259
18287
  }
18260
- function gotStat(err, stat2) {
18288
+ function gotStat(err, stat3) {
18261
18289
  if (err)
18262
18290
  return cb(err);
18263
- if (!stat2.isSymbolicLink()) {
18291
+ if (!stat3.isSymbolicLink()) {
18264
18292
  knownHard[base] = true;
18265
18293
  if (cache3)
18266
18294
  cache3[base] = base;
18267
18295
  return process.nextTick(LOOP);
18268
18296
  }
18269
18297
  if (!isWindows) {
18270
- var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
18298
+ var id = stat3.dev.toString(32) + ":" + stat3.ino.toString(32);
18271
18299
  if (seenLinks.hasOwnProperty(id)) {
18272
18300
  return gotTarget(null, seenLinks[id], base);
18273
18301
  }
@@ -19404,27 +19432,27 @@ var require_sync = __commonJS({
19404
19432
  break;
19405
19433
  }
19406
19434
  var remain = pattern.slice(n);
19407
- var read3;
19435
+ var read4;
19408
19436
  if (prefix === null)
19409
- read3 = ".";
19437
+ read4 = ".";
19410
19438
  else if (isAbsolute2(prefix) || isAbsolute2(pattern.map(function(p) {
19411
19439
  return typeof p === "string" ? p : "[*]";
19412
19440
  }).join("/"))) {
19413
19441
  if (!prefix || !isAbsolute2(prefix))
19414
19442
  prefix = "/" + prefix;
19415
- read3 = prefix;
19443
+ read4 = prefix;
19416
19444
  } else
19417
- read3 = prefix;
19418
- var abs = this._makeAbs(read3);
19419
- if (childrenIgnored(this, read3))
19445
+ read4 = prefix;
19446
+ var abs = this._makeAbs(read4);
19447
+ if (childrenIgnored(this, read4))
19420
19448
  return;
19421
19449
  var isGlobStar = remain[0] === minimatch.GLOBSTAR;
19422
19450
  if (isGlobStar)
19423
- this._processGlobStar(prefix, read3, abs, remain, index, inGlobStar);
19451
+ this._processGlobStar(prefix, read4, abs, remain, index, inGlobStar);
19424
19452
  else
19425
- this._processReaddir(prefix, read3, abs, remain, index, inGlobStar);
19453
+ this._processReaddir(prefix, read4, abs, remain, index, inGlobStar);
19426
19454
  };
19427
- GlobSync.prototype._processReaddir = function(prefix, read3, abs, remain, index, inGlobStar) {
19455
+ GlobSync.prototype._processReaddir = function(prefix, read4, abs, remain, index, inGlobStar) {
19428
19456
  var entries = this._readdir(abs, inGlobStar);
19429
19457
  if (!entries)
19430
19458
  return;
@@ -19503,7 +19531,7 @@ var require_sync = __commonJS({
19503
19531
  return this._readdir(abs, false);
19504
19532
  var entries;
19505
19533
  var lstat;
19506
- var stat2;
19534
+ var stat3;
19507
19535
  try {
19508
19536
  lstat = this.fs.lstatSync(abs);
19509
19537
  } catch (er) {
@@ -19579,7 +19607,7 @@ var require_sync = __commonJS({
19579
19607
  break;
19580
19608
  }
19581
19609
  };
19582
- GlobSync.prototype._processGlobStar = function(prefix, read3, abs, remain, index, inGlobStar) {
19610
+ GlobSync.prototype._processGlobStar = function(prefix, read4, abs, remain, index, inGlobStar) {
19583
19611
  var entries = this._readdir(abs, inGlobStar);
19584
19612
  if (!entries)
19585
19613
  return;
@@ -19636,8 +19664,8 @@ var require_sync = __commonJS({
19636
19664
  return false;
19637
19665
  }
19638
19666
  var exists;
19639
- var stat2 = this.statCache[abs];
19640
- if (!stat2) {
19667
+ var stat3 = this.statCache[abs];
19668
+ if (!stat3) {
19641
19669
  var lstat;
19642
19670
  try {
19643
19671
  lstat = this.fs.lstatSync(abs);
@@ -19649,18 +19677,18 @@ var require_sync = __commonJS({
19649
19677
  }
19650
19678
  if (lstat && lstat.isSymbolicLink()) {
19651
19679
  try {
19652
- stat2 = this.fs.statSync(abs);
19680
+ stat3 = this.fs.statSync(abs);
19653
19681
  } catch (er) {
19654
- stat2 = lstat;
19682
+ stat3 = lstat;
19655
19683
  }
19656
19684
  } else {
19657
- stat2 = lstat;
19685
+ stat3 = lstat;
19658
19686
  }
19659
19687
  }
19660
- this.statCache[abs] = stat2;
19688
+ this.statCache[abs] = stat3;
19661
19689
  var c = true;
19662
- if (stat2)
19663
- c = stat2.isDirectory() ? "DIR" : "FILE";
19690
+ if (stat3)
19691
+ c = stat3.isDirectory() ? "DIR" : "FILE";
19664
19692
  this.cache[abs] = this.cache[abs] || c;
19665
19693
  if (needDir && c === "FILE")
19666
19694
  return false;
@@ -20028,33 +20056,33 @@ var require_glob = __commonJS({
20028
20056
  break;
20029
20057
  }
20030
20058
  var remain = pattern.slice(n);
20031
- var read3;
20059
+ var read4;
20032
20060
  if (prefix === null)
20033
- read3 = ".";
20061
+ read4 = ".";
20034
20062
  else if (isAbsolute2(prefix) || isAbsolute2(pattern.map(function(p) {
20035
20063
  return typeof p === "string" ? p : "[*]";
20036
20064
  }).join("/"))) {
20037
20065
  if (!prefix || !isAbsolute2(prefix))
20038
20066
  prefix = "/" + prefix;
20039
- read3 = prefix;
20067
+ read4 = prefix;
20040
20068
  } else
20041
- read3 = prefix;
20042
- var abs = this._makeAbs(read3);
20043
- if (childrenIgnored(this, read3))
20069
+ read4 = prefix;
20070
+ var abs = this._makeAbs(read4);
20071
+ if (childrenIgnored(this, read4))
20044
20072
  return cb();
20045
20073
  var isGlobStar = remain[0] === minimatch.GLOBSTAR;
20046
20074
  if (isGlobStar)
20047
- this._processGlobStar(prefix, read3, abs, remain, index, inGlobStar, cb);
20075
+ this._processGlobStar(prefix, read4, abs, remain, index, inGlobStar, cb);
20048
20076
  else
20049
- this._processReaddir(prefix, read3, abs, remain, index, inGlobStar, cb);
20077
+ this._processReaddir(prefix, read4, abs, remain, index, inGlobStar, cb);
20050
20078
  };
20051
- Glob.prototype._processReaddir = function(prefix, read3, abs, remain, index, inGlobStar, cb) {
20079
+ Glob.prototype._processReaddir = function(prefix, read4, abs, remain, index, inGlobStar, cb) {
20052
20080
  var self2 = this;
20053
20081
  this._readdir(abs, inGlobStar, function(er, entries) {
20054
- return self2._processReaddir2(prefix, read3, abs, remain, index, inGlobStar, entries, cb);
20082
+ return self2._processReaddir2(prefix, read4, abs, remain, index, inGlobStar, entries, cb);
20055
20083
  });
20056
20084
  };
20057
- Glob.prototype._processReaddir2 = function(prefix, read3, abs, remain, index, inGlobStar, entries, cb) {
20085
+ Glob.prototype._processReaddir2 = function(prefix, read4, abs, remain, index, inGlobStar, entries, cb) {
20058
20086
  if (!entries)
20059
20087
  return cb();
20060
20088
  var pn = remain[0];
@@ -20235,13 +20263,13 @@ var require_glob = __commonJS({
20235
20263
  }
20236
20264
  return cb();
20237
20265
  };
20238
- Glob.prototype._processGlobStar = function(prefix, read3, abs, remain, index, inGlobStar, cb) {
20266
+ Glob.prototype._processGlobStar = function(prefix, read4, abs, remain, index, inGlobStar, cb) {
20239
20267
  var self2 = this;
20240
20268
  this._readdir(abs, inGlobStar, function(er, entries) {
20241
- self2._processGlobStar2(prefix, read3, abs, remain, index, inGlobStar, entries, cb);
20269
+ self2._processGlobStar2(prefix, read4, abs, remain, index, inGlobStar, entries, cb);
20242
20270
  });
20243
20271
  };
20244
- Glob.prototype._processGlobStar2 = function(prefix, read3, abs, remain, index, inGlobStar, entries, cb) {
20272
+ Glob.prototype._processGlobStar2 = function(prefix, read4, abs, remain, index, inGlobStar, entries, cb) {
20245
20273
  if (!entries)
20246
20274
  return cb();
20247
20275
  var remainWithoutGlobStar = remain.slice(1);
@@ -20304,16 +20332,16 @@ var require_glob = __commonJS({
20304
20332
  return cb();
20305
20333
  }
20306
20334
  var exists;
20307
- var stat2 = this.statCache[abs];
20308
- if (stat2 !== void 0) {
20309
- if (stat2 === false)
20310
- return cb(null, stat2);
20335
+ var stat3 = this.statCache[abs];
20336
+ if (stat3 !== void 0) {
20337
+ if (stat3 === false)
20338
+ return cb(null, stat3);
20311
20339
  else {
20312
- var type = stat2.isDirectory() ? "DIR" : "FILE";
20340
+ var type = stat3.isDirectory() ? "DIR" : "FILE";
20313
20341
  if (needDir && type === "FILE")
20314
20342
  return cb();
20315
20343
  else
20316
- return cb(null, type, stat2);
20344
+ return cb(null, type, stat3);
20317
20345
  }
20318
20346
  }
20319
20347
  var self2 = this;
@@ -20322,33 +20350,33 @@ var require_glob = __commonJS({
20322
20350
  self2.fs.lstat(abs, statcb);
20323
20351
  function lstatcb_(er, lstat) {
20324
20352
  if (lstat && lstat.isSymbolicLink()) {
20325
- return self2.fs.stat(abs, function(er2, stat3) {
20353
+ return self2.fs.stat(abs, function(er2, stat4) {
20326
20354
  if (er2)
20327
20355
  self2._stat2(f, abs, null, lstat, cb);
20328
20356
  else
20329
- self2._stat2(f, abs, er2, stat3, cb);
20357
+ self2._stat2(f, abs, er2, stat4, cb);
20330
20358
  });
20331
20359
  } else {
20332
20360
  self2._stat2(f, abs, er, lstat, cb);
20333
20361
  }
20334
20362
  }
20335
20363
  };
20336
- Glob.prototype._stat2 = function(f, abs, er, stat2, cb) {
20364
+ Glob.prototype._stat2 = function(f, abs, er, stat3, cb) {
20337
20365
  if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
20338
20366
  this.statCache[abs] = false;
20339
20367
  return cb();
20340
20368
  }
20341
20369
  var needDir = f.slice(-1) === "/";
20342
- this.statCache[abs] = stat2;
20343
- if (abs.slice(-1) === "/" && stat2 && !stat2.isDirectory())
20344
- return cb(null, false, stat2);
20370
+ this.statCache[abs] = stat3;
20371
+ if (abs.slice(-1) === "/" && stat3 && !stat3.isDirectory())
20372
+ return cb(null, false, stat3);
20345
20373
  var c = true;
20346
- if (stat2)
20347
- c = stat2.isDirectory() ? "DIR" : "FILE";
20374
+ if (stat3)
20375
+ c = stat3.isDirectory() ? "DIR" : "FILE";
20348
20376
  this.cache[abs] = this.cache[abs] || c;
20349
20377
  if (needDir && c === "FILE")
20350
20378
  return cb();
20351
- return cb(null, c, stat2);
20379
+ return cb(null, c, stat3);
20352
20380
  };
20353
20381
  }
20354
20382
  });
@@ -46523,6 +46551,7 @@ var require_es55 = __commonJS({
46523
46551
 
46524
46552
  // src/index.ts
46525
46553
  __export(exports, {
46554
+ FileHandleProvider: () => FileHandleProvider,
46526
46555
  I3SConverter: () => I3SConverter,
46527
46556
  Tiles3DConverter: () => Tiles3DConverter
46528
46557
  });
@@ -47432,6 +47461,54 @@ function copyToArray(source, target, targetOffset) {
47432
47461
  return targetOffset + padToNBytes(sourceArray.byteLength, 4);
47433
47462
  }
47434
47463
 
47464
+ // ../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts
47465
+ function padStringToByteAlignment(string, byteAlignment) {
47466
+ const length = string.length;
47467
+ const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
47468
+ const padding = paddedLength - length;
47469
+ let whitespace = "";
47470
+ for (let i = 0; i < padding; ++i) {
47471
+ whitespace += " ";
47472
+ }
47473
+ return string + whitespace;
47474
+ }
47475
+ function copyStringToDataView(dataView, byteOffset, string, byteLength) {
47476
+ if (dataView) {
47477
+ for (let i = 0; i < byteLength; i++) {
47478
+ dataView.setUint8(byteOffset + i, string.charCodeAt(i));
47479
+ }
47480
+ }
47481
+ return byteOffset + byteLength;
47482
+ }
47483
+ function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
47484
+ if (dataView) {
47485
+ for (let i = 0; i < byteLength; i++) {
47486
+ dataView.setUint8(byteOffset + i, binary[i]);
47487
+ }
47488
+ }
47489
+ return byteOffset + byteLength;
47490
+ }
47491
+ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
47492
+ const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
47493
+ const padLength = paddedLength - sourceBuffer.byteLength;
47494
+ if (dataView) {
47495
+ const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
47496
+ const sourceArray = new Uint8Array(sourceBuffer);
47497
+ targetArray.set(sourceArray);
47498
+ for (let i = 0; i < padLength; ++i) {
47499
+ dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 32);
47500
+ }
47501
+ }
47502
+ byteOffset += paddedLength;
47503
+ return byteOffset;
47504
+ }
47505
+ function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
47506
+ const textEncoder = new TextEncoder();
47507
+ const stringBuffer = textEncoder.encode(string);
47508
+ byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
47509
+ return byteOffset;
47510
+ }
47511
+
47435
47512
  // ../loader-utils/src/lib/iterators/async-iteration.ts
47436
47513
  async function concatenateArrayBuffersAsync(asyncIterator) {
47437
47514
  const arrayBuffers = [];
@@ -47634,41 +47711,41 @@ var Stats = class {
47634
47711
  return Object.keys(this.stats).length;
47635
47712
  }
47636
47713
  reset() {
47637
- for (const stat2 of Object.values(this.stats)) {
47638
- stat2.reset();
47714
+ for (const stat3 of Object.values(this.stats)) {
47715
+ stat3.reset();
47639
47716
  }
47640
47717
  return this;
47641
47718
  }
47642
47719
  forEach(fn) {
47643
- for (const stat2 of Object.values(this.stats)) {
47644
- fn(stat2);
47720
+ for (const stat3 of Object.values(this.stats)) {
47721
+ fn(stat3);
47645
47722
  }
47646
47723
  }
47647
47724
  getTable() {
47648
47725
  const table = {};
47649
- this.forEach((stat2) => {
47650
- table[stat2.name] = {
47651
- time: stat2.time || 0,
47652
- count: stat2.count || 0,
47653
- average: stat2.getAverageTime() || 0,
47654
- hz: stat2.getHz() || 0
47726
+ this.forEach((stat3) => {
47727
+ table[stat3.name] = {
47728
+ time: stat3.time || 0,
47729
+ count: stat3.count || 0,
47730
+ average: stat3.getAverageTime() || 0,
47731
+ hz: stat3.getHz() || 0
47655
47732
  };
47656
47733
  });
47657
47734
  return table;
47658
47735
  }
47659
47736
  _initializeStats() {
47660
47737
  let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
47661
- stats.forEach((stat2) => this._getOrCreate(stat2));
47738
+ stats.forEach((stat3) => this._getOrCreate(stat3));
47662
47739
  }
47663
- _getOrCreate(stat2) {
47740
+ _getOrCreate(stat3) {
47664
47741
  const {
47665
47742
  name: name10,
47666
47743
  type
47667
- } = stat2;
47744
+ } = stat3;
47668
47745
  let result = this.stats[name10];
47669
47746
  if (!result) {
47670
- if (stat2 instanceof Stat) {
47671
- result = stat2;
47747
+ if (stat3 instanceof Stat) {
47748
+ result = stat3;
47672
47749
  } else {
47673
47750
  result = new Stat(name10, type);
47674
47751
  }
@@ -49487,6 +49564,12 @@ async function encode(data, writer, options) {
49487
49564
  }
49488
49565
  throw new Error("Writer could not encode data");
49489
49566
  }
49567
+ function encodeSync(data, writer, options) {
49568
+ if (writer.encodeSync) {
49569
+ return writer.encodeSync(data, options);
49570
+ }
49571
+ throw new Error("Writer could not synchronously encode data");
49572
+ }
49490
49573
  function encodeInBatches(data, writer, options) {
49491
49574
  if (writer.encodeInBatches) {
49492
49575
  const dataIterator = getIterator(data);
@@ -49662,41 +49745,41 @@ var Stats2 = class {
49662
49745
  return Object.keys(this.stats).length;
49663
49746
  }
49664
49747
  reset() {
49665
- for (const stat2 of Object.values(this.stats)) {
49666
- stat2.reset();
49748
+ for (const stat3 of Object.values(this.stats)) {
49749
+ stat3.reset();
49667
49750
  }
49668
49751
  return this;
49669
49752
  }
49670
49753
  forEach(fn) {
49671
- for (const stat2 of Object.values(this.stats)) {
49672
- fn(stat2);
49754
+ for (const stat3 of Object.values(this.stats)) {
49755
+ fn(stat3);
49673
49756
  }
49674
49757
  }
49675
49758
  getTable() {
49676
49759
  const table = {};
49677
- this.forEach((stat2) => {
49678
- table[stat2.name] = {
49679
- time: stat2.time || 0,
49680
- count: stat2.count || 0,
49681
- average: stat2.getAverageTime() || 0,
49682
- hz: stat2.getHz() || 0
49760
+ this.forEach((stat3) => {
49761
+ table[stat3.name] = {
49762
+ time: stat3.time || 0,
49763
+ count: stat3.count || 0,
49764
+ average: stat3.getAverageTime() || 0,
49765
+ hz: stat3.getHz() || 0
49683
49766
  };
49684
49767
  });
49685
49768
  return table;
49686
49769
  }
49687
49770
  _initializeStats() {
49688
49771
  let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
49689
- stats.forEach((stat2) => this._getOrCreate(stat2));
49772
+ stats.forEach((stat3) => this._getOrCreate(stat3));
49690
49773
  }
49691
- _getOrCreate(stat2) {
49774
+ _getOrCreate(stat3) {
49692
49775
  const {
49693
49776
  name: name10,
49694
49777
  type
49695
- } = stat2;
49778
+ } = stat3;
49696
49779
  let result = this.stats[name10];
49697
49780
  if (!result) {
49698
- if (stat2 instanceof Stat2) {
49699
- result = stat2;
49781
+ if (stat3 instanceof Stat2) {
49782
+ result = stat3;
49700
49783
  } else {
49701
49784
  result = new Stat2(name10, type);
49702
49785
  }
@@ -51741,6 +51824,12 @@ var TILE3D_TYPE = {
51741
51824
  GLTF: "glTF"
51742
51825
  };
51743
51826
  var TILE3D_TYPES = Object.keys(TILE3D_TYPE);
51827
+ var MAGIC_ARRAY = {
51828
+ BATCHED_MODEL: [98, 51, 100, 109],
51829
+ INSTANCED_MODEL: [105, 51, 100, 109],
51830
+ POINT_CLOUD: [112, 110, 116, 115],
51831
+ COMPOSITE: [99, 109, 112, 116]
51832
+ };
51744
51833
 
51745
51834
  // ../3d-tiles/src/lib/parsers/helpers/parse-utils.ts
51746
51835
  function getStringFromArrayBuffer(arrayBuffer, byteOffset, byteLength) {
@@ -56798,6 +56887,87 @@ async function parse3(arrayBuffer, options = {}, context) {
56798
56887
  return await parseGLTF(gltf, arrayBuffer, byteOffset, options, context);
56799
56888
  }
56800
56889
 
56890
+ // ../gltf/src/lib/encoders/encode-glb.ts
56891
+ var MAGIC_glTF2 = 1179937895;
56892
+ var MAGIC_JSON = 1313821514;
56893
+ var MAGIC_BIN = 5130562;
56894
+ var LE = true;
56895
+ function encodeGLBSync(glb, dataView, byteOffset = 0, options = {}) {
56896
+ const { magic = MAGIC_glTF2, version: version2 = 2, json = {}, binary } = glb;
56897
+ const byteOffsetStart = byteOffset;
56898
+ if (dataView) {
56899
+ dataView.setUint32(byteOffset + 0, magic, LE);
56900
+ dataView.setUint32(byteOffset + 4, version2, LE);
56901
+ dataView.setUint32(byteOffset + 8, 0, LE);
56902
+ }
56903
+ const byteOffsetFileLength = byteOffset + 8;
56904
+ byteOffset += 12;
56905
+ const byteOffsetJsonHeader = byteOffset;
56906
+ if (dataView) {
56907
+ dataView.setUint32(byteOffset + 0, 0, LE);
56908
+ dataView.setUint32(byteOffset + 4, MAGIC_JSON, LE);
56909
+ }
56910
+ byteOffset += 8;
56911
+ const jsonString = JSON.stringify(json);
56912
+ byteOffset = copyPaddedStringToDataView(dataView, byteOffset, jsonString, 4);
56913
+ if (dataView) {
56914
+ const jsonByteLength = byteOffset - byteOffsetJsonHeader - 8;
56915
+ dataView.setUint32(byteOffsetJsonHeader + 0, jsonByteLength, LE);
56916
+ }
56917
+ if (binary) {
56918
+ const byteOffsetBinHeader = byteOffset;
56919
+ if (dataView) {
56920
+ dataView.setUint32(byteOffset + 0, 0, LE);
56921
+ dataView.setUint32(byteOffset + 4, MAGIC_BIN, LE);
56922
+ }
56923
+ byteOffset += 8;
56924
+ byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, binary, 4);
56925
+ if (dataView) {
56926
+ const binByteLength = byteOffset - byteOffsetBinHeader - 8;
56927
+ dataView.setUint32(byteOffsetBinHeader + 0, binByteLength, LE);
56928
+ }
56929
+ }
56930
+ if (dataView) {
56931
+ const fileByteLength = byteOffset - byteOffsetStart;
56932
+ dataView.setUint32(byteOffsetFileLength, fileByteLength, LE);
56933
+ }
56934
+ return byteOffset;
56935
+ }
56936
+
56937
+ // ../gltf/src/lib/encoders/encode-gltf.ts
56938
+ function encodeGLTFSync(gltf, arrayBuffer, byteOffset, options) {
56939
+ convertBuffersToBase64(gltf);
56940
+ return encodeGLBSync(gltf, arrayBuffer, byteOffset, options);
56941
+ }
56942
+ function convertBuffersToBase64(gltf, { firstBuffer = 0 } = {}) {
56943
+ if (gltf.buffers && gltf.buffers.length > firstBuffer) {
56944
+ throw new Error("encodeGLTF: multiple buffers not yet implemented");
56945
+ }
56946
+ }
56947
+
56948
+ // ../gltf/src/gltf-writer.ts
56949
+ var GLTFWriter = {
56950
+ name: "glTF",
56951
+ id: "gltf",
56952
+ module: "gltf",
56953
+ version: VERSION8,
56954
+ extensions: ["glb"],
56955
+ mimeTypes: ["model/gltf-binary"],
56956
+ binary: true,
56957
+ encodeSync: encodeSync2,
56958
+ options: {
56959
+ gltf: {}
56960
+ }
56961
+ };
56962
+ function encodeSync2(gltf, options = {}) {
56963
+ const { byteOffset = 0 } = options;
56964
+ const byteLength = encodeGLTFSync(gltf, null, byteOffset, options);
56965
+ const arrayBuffer = new ArrayBuffer(byteLength);
56966
+ const dataView = new DataView(arrayBuffer);
56967
+ encodeGLTFSync(gltf, dataView, byteOffset, options);
56968
+ return arrayBuffer;
56969
+ }
56970
+
56801
56971
  // ../gltf/src/lib/api/post-process-gltf.ts
56802
56972
  var COMPONENTS2 = {
56803
56973
  SCALAR: 1,
@@ -59236,7 +59406,7 @@ function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
59236
59406
  }
59237
59407
  async function parseImplicitTiles(params) {
59238
59408
  const {
59239
- options,
59409
+ implicitOptions,
59240
59410
  parentData = {
59241
59411
  mortonIndex: 0,
59242
59412
  x: 0,
@@ -59251,7 +59421,8 @@ async function parseImplicitTiles(params) {
59251
59421
  y: 0,
59252
59422
  z: 0
59253
59423
  },
59254
- s2VolumeBox
59424
+ s2VolumeBox,
59425
+ loaderOptions
59255
59426
  } = params;
59256
59427
  let { subtree, level = 0 } = params;
59257
59428
  const {
@@ -59261,30 +59432,38 @@ async function parseImplicitTiles(params) {
59261
59432
  contentUrlTemplate,
59262
59433
  subtreesUriTemplate,
59263
59434
  basePath
59264
- } = options;
59435
+ } = implicitOptions;
59265
59436
  const tile = { children: [], lodMetricValue: 0, contentUrl: "" };
59437
+ if (!maximumLevel) {
59438
+ dist_default2.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);
59439
+ return tile;
59440
+ }
59441
+ const lev = level + globalData.level;
59442
+ if (lev > maximumLevel) {
59443
+ return tile;
59444
+ }
59266
59445
  const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];
59446
+ const bitsPerTile = Math.log2(childrenPerTile);
59267
59447
  const childX = childIndex & 1;
59268
59448
  const childY = childIndex >> 1 & 1;
59269
59449
  const childZ = childIndex >> 2 & 1;
59270
59450
  const levelOffset = (childrenPerTile ** level - 1) / (childrenPerTile - 1);
59271
- let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex);
59451
+ let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex, bitsPerTile);
59272
59452
  let tileAvailabilityIndex = levelOffset + childTileMortonIndex;
59273
- let childTileX = concatBits(parentData.x, childX);
59274
- let childTileY = concatBits(parentData.y, childY);
59275
- let childTileZ = concatBits(parentData.z, childZ);
59453
+ let childTileX = concatBits(parentData.x, childX, 1);
59454
+ let childTileY = concatBits(parentData.y, childY, 1);
59455
+ let childTileZ = concatBits(parentData.z, childZ, 1);
59276
59456
  let isChildSubtreeAvailable = false;
59277
- if (level + 1 > subtreeLevels) {
59457
+ if (level >= subtreeLevels) {
59278
59458
  isChildSubtreeAvailable = getAvailabilityResult(subtree.childSubtreeAvailability, childTileMortonIndex);
59279
59459
  }
59280
- const x = concatBits(globalData.x, childTileX);
59281
- const y = concatBits(globalData.y, childTileY);
59282
- const z = concatBits(globalData.z, childTileZ);
59283
- const lev = level + globalData.level;
59460
+ const x = concatBits(globalData.x, childTileX, level * bitsPerTile);
59461
+ const y = concatBits(globalData.y, childTileY, level * bitsPerTile);
59462
+ const z = concatBits(globalData.z, childTileZ, level * bitsPerTile);
59284
59463
  if (isChildSubtreeAvailable) {
59285
59464
  const subtreePath = `${basePath}/${subtreesUriTemplate}`;
59286
59465
  const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x, y, z);
59287
- const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);
59466
+ const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
59288
59467
  subtree = childSubtree;
59289
59468
  globalData.mortonIndex = childTileMortonIndex;
59290
59469
  globalData.x = childTileX;
@@ -59299,7 +59478,7 @@ async function parseImplicitTiles(params) {
59299
59478
  level = 0;
59300
59479
  }
59301
59480
  const isTileAvailable = getAvailabilityResult(subtree.tileAvailability, tileAvailabilityIndex);
59302
- if (!isTileAvailable || level > maximumLevel) {
59481
+ if (!isTileAvailable) {
59303
59482
  return tile;
59304
59483
  }
59305
59484
  const isContentAvailable = getAvailabilityResult(subtree.contentAvailability, tileAvailabilityIndex);
@@ -59312,17 +59491,18 @@ async function parseImplicitTiles(params) {
59312
59491
  const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
59313
59492
  const childTileParsed = await parseImplicitTiles({
59314
59493
  subtree,
59315
- options,
59494
+ implicitOptions,
59495
+ loaderOptions,
59316
59496
  parentData: pData,
59317
59497
  childIndex: index,
59318
59498
  level: childTileLevel,
59319
- globalData,
59499
+ globalData: { ...globalData },
59320
59500
  s2VolumeBox: childS2VolumeBox
59321
59501
  });
59322
59502
  if (childTileParsed.contentUrl || childTileParsed.children.length) {
59323
59503
  const globalLevel = lev + 1;
59324
59504
  const childCoordinates = { childTileX, childTileY, childTileZ };
59325
- const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, options, s2VolumeBox);
59505
+ const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, implicitOptions, s2VolumeBox);
59326
59506
  tile.children.push(formattedTile);
59327
59507
  }
59328
59508
  }
@@ -59397,8 +59577,8 @@ function calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoo
59397
59577
  }
59398
59578
  throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);
59399
59579
  }
59400
- function concatBits(first, second) {
59401
- return parseInt(first.toString(2) + second.toString(2), 2);
59580
+ function concatBits(higher, lower, shift) {
59581
+ return (higher << shift) + lower;
59402
59582
  }
59403
59583
  function replaceContentUrlTemplate(templateUrl, level, x, y, z) {
59404
59584
  const mapUrl = generateMapUrl({ level, x, y, z });
@@ -59515,6 +59695,7 @@ async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTil
59515
59695
  const {
59516
59696
  subdivisionScheme,
59517
59697
  maximumLevel,
59698
+ availableLevels,
59518
59699
  subtreeLevels,
59519
59700
  subtrees: { uri: subtreesUriTemplate }
59520
59701
  } = implicitTilingExtension;
@@ -59536,7 +59717,7 @@ async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTil
59536
59717
  subtreesUriTemplate,
59537
59718
  subdivisionScheme,
59538
59719
  subtreeLevels,
59539
- maximumLevel,
59720
+ maximumLevel: Number.isFinite(availableLevels) ? availableLevels - 1 : maximumLevel,
59540
59721
  refine,
59541
59722
  basePath,
59542
59723
  lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
@@ -59545,15 +59726,16 @@ async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTil
59545
59726
  getTileType,
59546
59727
  getRefine
59547
59728
  };
59548
- return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
59729
+ return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions, options);
59549
59730
  }
59550
- async function normalizeImplicitTileData(tile, basePath, rootSubtree, options) {
59731
+ async function normalizeImplicitTileData(tile, basePath, rootSubtree, implicitOptions, loaderOptions) {
59551
59732
  if (!tile) {
59552
59733
  return null;
59553
59734
  }
59554
59735
  const { children, contentUrl } = await parseImplicitTiles({
59555
59736
  subtree: rootSubtree,
59556
- options
59737
+ implicitOptions,
59738
+ loaderOptions
59557
59739
  });
59558
59740
  let tileContentUrl;
59559
59741
  let tileContent = null;
@@ -59720,6 +59902,177 @@ var CesiumIonLoader = {
59720
59902
  }
59721
59903
  };
59722
59904
 
59905
+ // ../3d-tiles/src/lib/encoders/helpers/encode-3d-tile-header.ts
59906
+ function encode3DTileHeader(tile, dataView, byteOffset) {
59907
+ const HEADER_SIZE = 12;
59908
+ if (!dataView) {
59909
+ return byteOffset + HEADER_SIZE;
59910
+ }
59911
+ const { magic, version: version2 = 1, byteLength = 12 } = tile;
59912
+ assert2(Array.isArray(magic) && Number.isFinite(version2) && Number.isFinite(byteLength));
59913
+ dataView.setUint8(byteOffset + 0, magic[0]);
59914
+ dataView.setUint8(byteOffset + 1, magic[1]);
59915
+ dataView.setUint8(byteOffset + 2, magic[2]);
59916
+ dataView.setUint8(byteOffset + 3, magic[3]);
59917
+ dataView.setUint32(byteOffset + 4, version2, true);
59918
+ dataView.setUint32(byteOffset + 8, byteLength, true);
59919
+ byteOffset += HEADER_SIZE;
59920
+ return byteOffset;
59921
+ }
59922
+ function encode3DTileByteLength(dataView, byteOffsetTileStart, byteLength) {
59923
+ if (!dataView) {
59924
+ return;
59925
+ }
59926
+ dataView.setUint32(byteOffsetTileStart + 8, byteLength, true);
59927
+ }
59928
+
59929
+ // ../3d-tiles/src/lib/encoders/encode-3d-tile-composite.ts
59930
+ function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile2) {
59931
+ tile = { magic: MAGIC_ARRAY.COMPOSITE, tiles: [], ...tile };
59932
+ const byteOffsetStart = byteOffset;
59933
+ byteOffset += encode3DTileHeader(tile, dataView, byteOffset);
59934
+ if (dataView) {
59935
+ dataView.setUint32(byteOffset, tile.tiles.length, true);
59936
+ }
59937
+ byteOffset += 4;
59938
+ for (let i = 0; i < tile.tiles.length; ++i) {
59939
+ byteOffset += encode3DTile2(tile.tiles[i], dataView, byteOffset, options);
59940
+ }
59941
+ encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
59942
+ return byteOffset;
59943
+ }
59944
+
59945
+ // ../3d-tiles/src/lib/encoders/encode-3d-tile-batched-model.ts
59946
+ function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {
59947
+ const { featuresLength = 0, batchTable } = tile;
59948
+ const featureTableJson = {
59949
+ BATCH_LENGTH: featuresLength
59950
+ };
59951
+ const featureTableJsonString = JSON.stringify(featureTableJson);
59952
+ const batchTableJsonString = batchTable ? JSON.stringify(batchTable) : "";
59953
+ const featureTableJsonByteLength = padToNBytes(featureTableJsonString.length, 8);
59954
+ const batchTableJsonByteLength = batchTableJsonString ? padToNBytes(batchTableJsonString.length, 8) : 0;
59955
+ tile = { magic: MAGIC_ARRAY.BATCHED_MODEL, ...tile };
59956
+ const byteOffsetStart = byteOffset;
59957
+ byteOffset = encode3DTileHeader(tile, dataView, byteOffset);
59958
+ if (dataView) {
59959
+ dataView.setUint32(12, featureTableJsonByteLength, true);
59960
+ dataView.setUint32(16, 0, true);
59961
+ dataView.setUint32(20, batchTableJsonByteLength, true);
59962
+ dataView.setUint32(24, 0, true);
59963
+ }
59964
+ byteOffset += 16;
59965
+ byteOffset = copyPaddedStringToDataView(dataView, byteOffset, featureTableJsonString, 8);
59966
+ if (batchTable) {
59967
+ byteOffset = copyPaddedStringToDataView(dataView, byteOffset, batchTableJsonString, 8);
59968
+ }
59969
+ const gltfEncoded = tile.gltfEncoded;
59970
+ if (gltfEncoded) {
59971
+ byteOffset = copyBinaryToDataView(dataView, byteOffset, gltfEncoded, gltfEncoded.byteLength);
59972
+ }
59973
+ encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
59974
+ return byteOffset;
59975
+ }
59976
+
59977
+ // ../3d-tiles/src/lib/encoders/encode-3d-tile-instanced-model.ts
59978
+ function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {
59979
+ const { featuresLength = 1, gltfFormat = 1, gltfUri = "" } = tile;
59980
+ const gltfUriByteLength = gltfUri.length;
59981
+ const featureTableJson = {
59982
+ INSTANCES_LENGTH: featuresLength,
59983
+ POSITION: new Array(featuresLength * 3).fill(0)
59984
+ };
59985
+ const featureTableJsonString = JSON.stringify(featureTableJson);
59986
+ const featureTableJsonByteLength = featureTableJsonString.length;
59987
+ tile = { magic: MAGIC_ARRAY.INSTANCED_MODEL, ...tile };
59988
+ const byteOffsetStart = byteOffset;
59989
+ byteOffset = encode3DTileHeader(tile, dataView, 0);
59990
+ if (dataView) {
59991
+ dataView.setUint32(12, featureTableJsonByteLength, true);
59992
+ dataView.setUint32(16, 0, true);
59993
+ dataView.setUint32(20, 0, true);
59994
+ dataView.setUint32(24, 0, true);
59995
+ dataView.setUint32(28, gltfFormat, true);
59996
+ }
59997
+ byteOffset += 20;
59998
+ byteOffset += copyStringToDataView(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
59999
+ byteOffset += copyStringToDataView(dataView, byteOffset, gltfUri, gltfUriByteLength);
60000
+ encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
60001
+ return byteOffset;
60002
+ }
60003
+
60004
+ // ../3d-tiles/src/lib/encoders/encode-3d-tile-point-cloud.ts
60005
+ var DEFAULT_FEATURE_TABLE_JSON = {
60006
+ POINTS_LENGTH: 1,
60007
+ POSITIONS: {
60008
+ byteOffset: 0
60009
+ }
60010
+ };
60011
+ function encodePointCloud3DTile(tile, dataView, byteOffset, options) {
60012
+ const { featureTableJson = DEFAULT_FEATURE_TABLE_JSON } = tile;
60013
+ let featureTableJsonString = JSON.stringify(featureTableJson);
60014
+ featureTableJsonString = padStringToByteAlignment(featureTableJsonString, 4);
60015
+ const { featureTableJsonByteLength = featureTableJsonString.length } = tile;
60016
+ const featureTableBinary = new ArrayBuffer(12);
60017
+ const featureTableBinaryByteLength = featureTableBinary.byteLength;
60018
+ tile = { magic: MAGIC_ARRAY.POINT_CLOUD, ...tile };
60019
+ const byteOffsetStart = byteOffset;
60020
+ byteOffset += encode3DTileHeader(tile, dataView, 0);
60021
+ if (dataView) {
60022
+ dataView.setUint32(byteOffset + 0, featureTableJsonByteLength, true);
60023
+ dataView.setUint32(byteOffset + 4, featureTableBinaryByteLength, true);
60024
+ dataView.setUint32(byteOffset + 8, 0, true);
60025
+ dataView.setUint32(byteOffset + 12, 0, true);
60026
+ }
60027
+ byteOffset += 16;
60028
+ byteOffset += copyStringToDataView(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
60029
+ byteOffset += copyBinaryToDataView(dataView, byteOffset, featureTableBinary, featureTableBinaryByteLength);
60030
+ encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
60031
+ return byteOffset;
60032
+ }
60033
+
60034
+ // ../3d-tiles/src/lib/encoders/encode-3d-tile.ts
60035
+ function encode3DTile(tile, options) {
60036
+ const byteLength = encode3DTileToDataView(tile, null, 0, options);
60037
+ const arrayBuffer = new ArrayBuffer(byteLength);
60038
+ const dataView = new DataView(arrayBuffer);
60039
+ encode3DTileToDataView(tile, dataView, 0, options);
60040
+ return arrayBuffer;
60041
+ }
60042
+ function encode3DTileToDataView(tile, dataView, byteOffset, options) {
60043
+ assert2(typeof tile.type === "string");
60044
+ switch (tile.type) {
60045
+ case TILE3D_TYPE.COMPOSITE:
60046
+ return encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTileToDataView);
60047
+ case TILE3D_TYPE.POINT_CLOUD:
60048
+ return encodePointCloud3DTile(tile, dataView, byteOffset, options);
60049
+ case TILE3D_TYPE.BATCHED_3D_MODEL:
60050
+ return encodeBatchedModel3DTile(tile, dataView, byteOffset, options);
60051
+ case TILE3D_TYPE.INSTANCED_3D_MODEL:
60052
+ return encodeInstancedModel3DTile(tile, dataView, byteOffset, options);
60053
+ default:
60054
+ throw new Error("3D Tiles: unknown tile type");
60055
+ }
60056
+ }
60057
+
60058
+ // ../3d-tiles/src/tile-3d-writer.ts
60059
+ var Tile3DWriter = {
60060
+ name: "3D Tile",
60061
+ id: "3d-tiles",
60062
+ module: "3d-tiles",
60063
+ version: VERSION6,
60064
+ extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
60065
+ mimeTypes: ["application/octet-stream"],
60066
+ encodeSync: encodeSync3,
60067
+ binary: true,
60068
+ options: {
60069
+ ["3d-tiles"]: {}
60070
+ }
60071
+ };
60072
+ function encodeSync3(tile, options) {
60073
+ return encode3DTile(tile, options);
60074
+ }
60075
+
59723
60076
  // src/i3s-converter/i3s-converter.ts
59724
60077
  var import_path8 = __toModule(require("path"));
59725
60078
 
@@ -60119,8 +60472,8 @@ async function calculateFilesSize(params) {
60119
60472
  try {
60120
60473
  if (slpk) {
60121
60474
  const slpkPath = (0, import_path5.join)(fullOutputPath, `${tilesetName}.slpk`);
60122
- const stat2 = await import_fs4.promises.stat(slpkPath);
60123
- return stat2.size;
60475
+ const stat3 = await import_fs4.promises.stat(slpkPath);
60476
+ return stat3.size;
60124
60477
  }
60125
60478
  const directoryPath = (0, import_path5.join)(fullOutputPath, tilesetName);
60126
60479
  const totalSize = await getTotalFilesSize(directoryPath);
@@ -62300,18 +62653,6 @@ var WriteQueue = class extends Queue {
62300
62653
  }
62301
62654
  };
62302
62655
 
62303
- // src/i3s-attributes-worker.ts
62304
- var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
62305
- var I3SAttributesWorker = {
62306
- id: "i3s-attributes",
62307
- name: "I3S Attributes Worker",
62308
- module: "tile-converter",
62309
- version: VERSION14,
62310
- options: {
62311
- useCartesianPositions: false
62312
- }
62313
- };
62314
-
62315
62656
  // src/constants.ts
62316
62657
  var BROWSER_ERROR_MESSAGE = "Tile converter does not work in browser, only in node js environment";
62317
62658
 
@@ -62778,10 +63119,14 @@ var I3SConverter = class {
62778
63119
  await this.loadWorkers();
62779
63120
  try {
62780
63121
  const preloadOptions = await this._fetchPreloadOptions();
63122
+ let tilesetUrl = inputUrl;
63123
+ if (preloadOptions.url) {
63124
+ tilesetUrl = preloadOptions.url;
63125
+ }
62781
63126
  if (preloadOptions.headers) {
62782
63127
  this.loadOptions.fetch = { headers: preloadOptions.headers };
62783
63128
  }
62784
- this.sourceTileset = await load(inputUrl, this.Loader, this.loadOptions);
63129
+ this.sourceTileset = await load(tilesetUrl, this.Loader, this.loadOptions);
62785
63130
  const preprocessResult = await this.preprocessConversion();
62786
63131
  if (preprocessResult) {
62787
63132
  await this._createAndSaveTileset(outputPath, tilesetName);
@@ -63322,20 +63667,16 @@ var I3SConverter = class {
63322
63667
  console.log(`Loading workers source...`);
63323
63668
  if (this.options.draco) {
63324
63669
  const url = getWorkerURL(DracoWriterWorker, { ...getGlobalLoaderOptions() });
63325
- const sourceResponse2 = await fetchFile(url);
63326
- const source2 = await sourceResponse2.text();
63327
- this.workerSource.draco = source2;
63670
+ const sourceResponse = await fetchFile(url);
63671
+ const source = await sourceResponse.text();
63672
+ this.workerSource.draco = source;
63328
63673
  }
63329
63674
  if (this.generateTextures) {
63330
63675
  const url = getWorkerURL(KTX2BasisWriterWorker, { ...getGlobalLoaderOptions() });
63331
- const sourceResponse2 = await fetchFile(url);
63332
- const source2 = await sourceResponse2.text();
63333
- this.workerSource.ktx2 = source2;
63334
- }
63335
- const i3sAttributesWorkerUrl = getWorkerURL(I3SAttributesWorker, { ...getGlobalLoaderOptions() });
63336
- const sourceResponse = await fetchFile(i3sAttributesWorkerUrl);
63337
- const source = await sourceResponse.text();
63338
- this.workerSource.I3SAttributes = source;
63676
+ const sourceResponse = await fetchFile(url);
63677
+ const source = await sourceResponse.text();
63678
+ this.workerSource.ktx2 = source;
63679
+ }
63339
63680
  console.log(`Loading workers source completed!`);
63340
63681
  }
63341
63682
  };
@@ -63346,7 +63687,7 @@ var import_process3 = __toModule(require("process"));
63346
63687
  var import_json_map_transform10 = __toModule(require_json_map_transform());
63347
63688
 
63348
63689
  // ../i3s/src/lib/parsers/constants.ts
63349
- var import_constants10 = __toModule(require_es55());
63690
+ var import_constants15 = __toModule(require_es55());
63350
63691
 
63351
63692
  // ../i3s/src/types.ts
63352
63693
  var DATA_TYPE;
@@ -63385,11 +63726,11 @@ function getConstructorForDataFormat(dataType) {
63385
63726
  }
63386
63727
  }
63387
63728
  var GL_TYPE_MAP = {
63388
- UInt8: import_constants10.default.UNSIGNED_BYTE,
63389
- UInt16: import_constants10.default.UNSIGNED_SHORT,
63390
- Float32: import_constants10.default.FLOAT,
63391
- UInt32: import_constants10.default.UNSIGNED_INT,
63392
- UInt64: import_constants10.default.DOUBLE
63729
+ UInt8: import_constants15.default.UNSIGNED_BYTE,
63730
+ UInt16: import_constants15.default.UNSIGNED_SHORT,
63731
+ Float32: import_constants15.default.FLOAT,
63732
+ UInt32: import_constants15.default.UNSIGNED_INT,
63733
+ UInt64: import_constants15.default.DOUBLE
63393
63734
  };
63394
63735
  function sizeOf(dataType) {
63395
63736
  switch (dataType) {
@@ -63508,12 +63849,12 @@ function parseStringsAttribute(arrayBuffer) {
63508
63849
  }
63509
63850
 
63510
63851
  // ../i3s/src/i3s-attribute-loader.ts
63511
- var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
63852
+ var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
63512
63853
  var I3SAttributeLoader = {
63513
63854
  name: "I3S Attribute",
63514
63855
  id: "i3s-attribute",
63515
63856
  module: "i3s",
63516
- version: VERSION15,
63857
+ version: VERSION14,
63517
63858
  mimeTypes: ["application/binary"],
63518
63859
  parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
63519
63860
  extensions: ["bin"],
@@ -63971,13 +64312,13 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
63971
64312
  }
63972
64313
 
63973
64314
  // ../i3s/src/i3s-content-loader.ts
63974
- var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
64315
+ var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
63975
64316
  var I3SContentLoader = {
63976
64317
  name: "I3S Content (Indexed Scene Layers)",
63977
64318
  id: "i3s-content",
63978
64319
  module: "i3s",
63979
64320
  worker: true,
63980
- version: VERSION16,
64321
+ version: VERSION15,
63981
64322
  mimeTypes: ["application/octet-stream"],
63982
64323
  parse: parse6,
63983
64324
  extensions: ["bin"],
@@ -64000,7 +64341,7 @@ var import_culling8 = __toModule(require_es53());
64000
64341
  var import_geospatial14 = __toModule(require_es52());
64001
64342
 
64002
64343
  // ../i3s/src/i3s-node-page-loader.ts
64003
- var VERSION17 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
64344
+ var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
64004
64345
  async function parseNodePage(data, options) {
64005
64346
  return JSON.parse(new TextDecoder().decode(data));
64006
64347
  }
@@ -64008,7 +64349,7 @@ var I3SNodePageLoader = {
64008
64349
  name: "I3S Node Page",
64009
64350
  id: "i3s-node-page",
64010
64351
  module: "i3s",
64011
- version: VERSION17,
64352
+ version: VERSION16,
64012
64353
  mimeTypes: ["application/json"],
64013
64354
  parse: parseNodePage,
64014
64355
  extensions: ["json"],
@@ -64260,7 +64601,7 @@ async function normalizeTilesetData(tileset, options, context) {
64260
64601
  }
64261
64602
 
64262
64603
  // ../i3s/src/i3s-loader.ts
64263
- var VERSION18 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
64604
+ var VERSION17 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
64264
64605
  var TILESET_REGEX = /layers\/[0-9]+$/;
64265
64606
  var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
64266
64607
  var SLPK_HEX = "504b0304";
@@ -64269,7 +64610,7 @@ var I3SLoader = {
64269
64610
  name: "I3S (Indexed Scene Layers)",
64270
64611
  id: "i3s",
64271
64612
  module: "i3s",
64272
- version: VERSION18,
64613
+ version: VERSION17,
64273
64614
  mimeTypes: ["application/octet-stream"],
64274
64615
  parse: parseI3S,
64275
64616
  extensions: ["bin"],
@@ -64394,20 +64735,226 @@ var TILESET = () => ({
64394
64735
  }
64395
64736
  });
64396
64737
 
64397
- // src/3d-tiles-attributes-worker.ts
64398
- var VERSION19 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
64399
- var Tile3dAttributesWorker = {
64400
- id: "3d-tiles-attributes",
64401
- name: "3DTiles Attributes Worker",
64402
- module: "tile-converter",
64403
- version: VERSION19,
64404
- options: {
64405
- featureAttributes: null
64738
+ // src/3d-tiles-converter/helpers/b3dm-converter.ts
64739
+ var import_core40 = __toModule(require_es5());
64740
+ var import_geospatial16 = __toModule(require_es52());
64741
+
64742
+ // src/3d-tiles-converter/helpers/texture-atlas.ts
64743
+ function convertTextureAtlas(texCoords, uvRegions) {
64744
+ const convertedTexCoords = new Float32Array(texCoords.length);
64745
+ const normalisedRegions = normalizeRegions(uvRegions);
64746
+ for (let index = 0; index < texCoords.length; index += 2) {
64747
+ const uv = texCoords.subarray(index, index + 2);
64748
+ const regions = normalisedRegions.slice(index * 2, index * 2 + 4);
64749
+ const fractatedUV = fract([uv[0], uv[1]]);
64750
+ const subtracted = [regions[2] - regions[0], regions[3] - regions[1]];
64751
+ const multiplicationResult = [fractatedUV[0] * subtracted[0], fractatedUV[1] * subtracted[1]];
64752
+ const convertedUV = [
64753
+ multiplicationResult[0] + regions[0],
64754
+ multiplicationResult[1] + regions[1]
64755
+ ];
64756
+ convertedTexCoords[index] = convertedUV[0];
64757
+ convertedTexCoords[index + 1] = convertedUV[1];
64758
+ }
64759
+ return convertedTexCoords;
64760
+ }
64761
+ function fract(uv) {
64762
+ return [uv[0] - Math.floor(uv[0]), uv[1] - Math.floor(uv[1])];
64763
+ }
64764
+ function normalizeRegions(regions) {
64765
+ const MAX_UINT_16_VALUE = 65535;
64766
+ const normalizedRegions = [];
64767
+ for (let index = 0; index < regions.length; index++) {
64768
+ normalizedRegions[index] = regions[index] / MAX_UINT_16_VALUE;
64769
+ }
64770
+ return normalizedRegions;
64771
+ }
64772
+
64773
+ // src/3d-tiles-converter/helpers/b3dm-converter.ts
64774
+ var Z_UP_TO_Y_UP_MATRIX = new import_core40.Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
64775
+ var scratchVector7 = new import_core40.Vector3();
64776
+ var B3dmConverter = class {
64777
+ async convert(i3sAttributesData, featureAttributes = null) {
64778
+ const gltf = await this.buildGltf(i3sAttributesData, featureAttributes);
64779
+ const b3dm = encodeSync({
64780
+ gltfEncoded: new Uint8Array(gltf),
64781
+ type: "b3dm",
64782
+ featuresLength: this._getFeaturesLength(featureAttributes),
64783
+ batchTable: featureAttributes
64784
+ }, Tile3DWriter);
64785
+ return b3dm;
64786
+ }
64787
+ async buildGltf(i3sAttributesData, featureAttributes) {
64788
+ const { tileContent, textureFormat } = i3sAttributesData;
64789
+ const {
64790
+ material,
64791
+ attributes,
64792
+ indices: originalIndices,
64793
+ cartesianOrigin,
64794
+ cartographicOrigin,
64795
+ modelMatrix
64796
+ } = tileContent;
64797
+ const gltfBuilder = new GLTFScenegraph();
64798
+ const textureIndex = await this._addI3sTextureToGltf(tileContent, textureFormat, gltfBuilder);
64799
+ const pbrMaterialInfo = this._convertI3sMaterialToGltfMaterial(material, textureIndex);
64800
+ const materialIndex = gltfBuilder.addMaterial(pbrMaterialInfo);
64801
+ const positions = attributes.positions;
64802
+ const positionsValue = positions.value;
64803
+ if (attributes.uvRegions && attributes.texCoords) {
64804
+ attributes.texCoords.value = convertTextureAtlas(attributes.texCoords.value, attributes.uvRegions.value);
64805
+ }
64806
+ attributes.positions.value = this._normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix);
64807
+ this._createBatchIds(tileContent, featureAttributes);
64808
+ if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
64809
+ delete attributes.normals;
64810
+ }
64811
+ const indices = originalIndices || generateSyntheticIndices(positionsValue.length / positions.size);
64812
+ const meshIndex = gltfBuilder.addMesh({
64813
+ attributes,
64814
+ indices,
64815
+ material: materialIndex,
64816
+ mode: 4
64817
+ });
64818
+ const transformMatrix = this._generateTransformMatrix(cartesianOrigin);
64819
+ const nodeIndex = gltfBuilder.addNode({ meshIndex, matrix: transformMatrix });
64820
+ const sceneIndex = gltfBuilder.addScene({ nodeIndices: [nodeIndex] });
64821
+ gltfBuilder.setDefaultScene(sceneIndex);
64822
+ gltfBuilder.createBinaryChunk();
64823
+ const gltfBuffer = encodeSync(gltfBuilder.gltf, GLTFWriter);
64824
+ return gltfBuffer;
64825
+ }
64826
+ async _addI3sTextureToGltf(tileContent, textureFormat, gltfBuilder) {
64827
+ const { texture, material, attributes } = tileContent;
64828
+ let textureIndex = null;
64829
+ let selectedTexture = texture;
64830
+ if (!texture && material) {
64831
+ selectedTexture = material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture && material.pbrMetallicRoughness.baseColorTexture.texture.source.image;
64832
+ }
64833
+ if (selectedTexture) {
64834
+ const mimeType = this._deduceMimeTypeFromFormat(textureFormat);
64835
+ const imageIndex = gltfBuilder.addImage(selectedTexture, mimeType);
64836
+ textureIndex = gltfBuilder.addTexture({ imageIndex });
64837
+ delete attributes.colors;
64838
+ }
64839
+ return textureIndex;
64840
+ }
64841
+ _normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix) {
64842
+ const newPositionsValue = new Float32Array(positionsValue.length);
64843
+ for (let index = 0; index < positionsValue.length; index += 3) {
64844
+ const vertex = positionsValue.subarray(index, index + 3);
64845
+ const cartesianOriginVector = new import_core40.Vector3(cartesianOrigin);
64846
+ let vertexVector = new import_core40.Vector3(Array.from(vertex)).transform(modelMatrix).add(cartographicOrigin);
64847
+ import_geospatial16.Ellipsoid.WGS84.cartographicToCartesian(vertexVector, scratchVector7);
64848
+ vertexVector = scratchVector7.subtract(cartesianOriginVector);
64849
+ newPositionsValue.set(vertexVector, index);
64850
+ }
64851
+ return newPositionsValue;
64852
+ }
64853
+ _generateTransformMatrix(cartesianOrigin) {
64854
+ const translateOriginMatrix = new import_core40.Matrix4().translate(cartesianOrigin);
64855
+ const result = translateOriginMatrix.multiplyLeft(Z_UP_TO_Y_UP_MATRIX);
64856
+ return result;
64857
+ }
64858
+ _createBatchIds(i3sContent, featureAttributes) {
64859
+ const { featureIds } = i3sContent;
64860
+ const { OBJECTID: objectIds } = featureAttributes || {};
64861
+ if (!featureIds || !objectIds) {
64862
+ return;
64863
+ }
64864
+ for (let i = 0; i < featureIds.length; i++) {
64865
+ const featureId = featureIds[i];
64866
+ const batchId = objectIds.indexOf(featureId);
64867
+ featureIds[i] = batchId;
64868
+ }
64869
+ i3sContent.attributes._BATCHID = {
64870
+ size: 1,
64871
+ byteOffset: 0,
64872
+ value: featureIds
64873
+ };
64874
+ }
64875
+ _deduceMimeTypeFromFormat(format) {
64876
+ switch (format) {
64877
+ case "jpg":
64878
+ return "image/jpeg";
64879
+ case "png":
64880
+ return "image/png";
64881
+ case "ktx2":
64882
+ return "image/ktx2";
64883
+ default:
64884
+ console.warn(`Unexpected texture format in I3S: ${format}`);
64885
+ return "image/jpeg";
64886
+ }
64887
+ }
64888
+ _convertI3sMaterialToGltfMaterial(material, textureIndex) {
64889
+ const isTextureIndexExists = textureIndex !== null;
64890
+ if (!material) {
64891
+ material = {
64892
+ alphaMode: "OPAQUE",
64893
+ doubleSided: false,
64894
+ pbrMetallicRoughness: {
64895
+ metallicFactor: 0,
64896
+ roughnessFactor: 1
64897
+ }
64898
+ };
64899
+ if (isTextureIndexExists) {
64900
+ material.pbrMetallicRoughness.baseColorTexture = {
64901
+ index: textureIndex,
64902
+ texCoord: 0
64903
+ };
64904
+ } else {
64905
+ material.pbrMetallicRoughness.baseColorFactor = [1, 1, 1, 1];
64906
+ }
64907
+ return material;
64908
+ }
64909
+ if (textureIndex !== null) {
64910
+ material = this._setGltfTexture(material, textureIndex);
64911
+ }
64912
+ return material;
64913
+ }
64914
+ _setGltfTexture(materialDefinition, textureIndex) {
64915
+ const material = {
64916
+ ...materialDefinition,
64917
+ pbrMetallicRoughness: { ...materialDefinition.pbrMetallicRoughness }
64918
+ };
64919
+ if (materialDefinition.pbrMetallicRoughness && materialDefinition.pbrMetallicRoughness.baseColorTexture) {
64920
+ material.pbrMetallicRoughness.baseColorTexture = {
64921
+ index: textureIndex,
64922
+ texCoord: 0
64923
+ };
64924
+ } else if (materialDefinition.emissiveTexture) {
64925
+ material.emissiveTexture = {
64926
+ index: textureIndex,
64927
+ texCoord: 0
64928
+ };
64929
+ } else if (materialDefinition.pbrMetallicRoughness && materialDefinition.pbrMetallicRoughness.metallicRoughnessTexture) {
64930
+ material.pbrMetallicRoughness.metallicRoughnessTexture = {
64931
+ index: textureIndex,
64932
+ texCoord: 0
64933
+ };
64934
+ } else if (materialDefinition.normalTexture) {
64935
+ material.normalTexture = {
64936
+ index: textureIndex,
64937
+ texCoord: 0
64938
+ };
64939
+ } else if (materialDefinition.occlusionTexture) {
64940
+ material.occlusionTexture = {
64941
+ index: textureIndex,
64942
+ texCoord: 0
64943
+ };
64944
+ }
64945
+ return material;
64946
+ }
64947
+ _getFeaturesLength(attributes) {
64948
+ if (!attributes) {
64949
+ return 0;
64950
+ }
64951
+ const firstKey = Object.keys(attributes)[0];
64952
+ return firstKey ? attributes[firstKey].length : 0;
64953
+ }
64954
+ _checkNormals(normals) {
64955
+ return normals.find((value) => value);
64406
64956
  }
64407
64957
  };
64408
- function transform3DTilesAttributesOnWorker(i3sAttributesData, options) {
64409
- return processOnWorker(Tile3dAttributesWorker, i3sAttributesData, options);
64410
- }
64411
64958
 
64412
64959
  // src/3d-tiles-converter/3d-tiles-converter.ts
64413
64960
  var I3S = "I3S";
@@ -64434,13 +64981,15 @@ var Tiles3DConverter = class {
64434
64981
  console.log("Loading egm file...");
64435
64982
  this.geoidHeightModel = await load(egmFilePath, PGMLoader);
64436
64983
  console.log("Loading egm file completed!");
64437
- await this.loadWorkers();
64438
64984
  const sourceTilesetJson = await load(inputUrl, I3SLoader, {});
64439
64985
  this.sourceTileset = new Tileset3D(sourceTilesetJson, {
64440
64986
  loadOptions: {
64441
64987
  _nodeWorkers: true,
64442
64988
  reuseWorkers: true,
64443
- i3s: { coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false }
64989
+ i3s: { coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false },
64990
+ "i3s-content": {
64991
+ workerUrl: "./modules/i3s/dist/i3s-content-worker-node.js"
64992
+ }
64444
64993
  }
64445
64994
  });
64446
64995
  await this.sourceTileset.tilesetInitializationPromise;
@@ -64493,10 +65042,8 @@ var Tiles3DConverter = class {
64493
65042
  tileContent: sourceChild.content,
64494
65043
  textureFormat: sourceChild?.header?.textureFormat
64495
65044
  };
64496
- const b3dm = await transform3DTilesAttributesOnWorker(i3sAttributesData, {
64497
- source: this.workerSource.tile3dWorkerSource,
64498
- featureAttributes
64499
- });
65045
+ const b3dmConverter = new B3dmConverter();
65046
+ const b3dm = await b3dmConverter.convert(i3sAttributesData, featureAttributes);
64500
65047
  child.content = {
64501
65048
  uri: `${sourceChild.id}.b3dm`,
64502
65049
  boundingVolume
@@ -64598,17 +65145,90 @@ var Tiles3DConverter = class {
64598
65145
  console.log(`File(s) size: `, filesSize, " bytes");
64599
65146
  console.log(`------------------------------------------------`);
64600
65147
  }
64601
- async loadWorkers() {
64602
- console.log(`Loading workers source...`);
64603
- const tile3dAttributesWorkerUrl = getWorkerURL(Tile3dAttributesWorker, { ...getGlobalLoaderOptions() });
64604
- const sourceResponse = await fetchFile(tile3dAttributesWorkerUrl);
64605
- const source = await sourceResponse.text();
64606
- this.workerSource.tile3dWorkerSource = source;
64607
- console.log(`Loading workers source completed!`);
65148
+ };
65149
+
65150
+ // src/slpk-extractor/helpers/fs-promises.ts
65151
+ var import_fs5 = __toModule(require("fs"));
65152
+ var _FileHandle = class {
65153
+ constructor(fileDescriptor, stats) {
65154
+ this.read = (buffer, offset, length, position) => {
65155
+ return new Promise((s) => {
65156
+ (0, import_fs5.read)(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer2) => s({ bytesRead, buffer: buffer2 }));
65157
+ });
65158
+ };
65159
+ this.fileDescriptor = fileDescriptor;
65160
+ this.stats = stats;
65161
+ }
65162
+ get stat() {
65163
+ return this.stats;
65164
+ }
65165
+ };
65166
+ var FileHandle = _FileHandle;
65167
+ FileHandle.open = async (path2) => {
65168
+ const [fd, stats] = await Promise.all([
65169
+ new Promise((s) => {
65170
+ (0, import_fs5.open)(path2, void 0, void 0, (_err, fd2) => s(fd2));
65171
+ }),
65172
+ new Promise((s) => {
65173
+ (0, import_fs5.stat)(path2, { bigint: true }, (_err, stats2) => s(stats2));
65174
+ })
65175
+ ]);
65176
+ return new _FileHandle(fd, stats);
65177
+ };
65178
+
65179
+ // src/slpk-extractor/helpers/file-handle-provider.ts
65180
+ var FileHandleProvider = class {
65181
+ static async from(path2) {
65182
+ const fileDescriptor = await FileHandle.open(path2);
65183
+ return new FileHandleProvider(fileDescriptor, fileDescriptor.stat.size);
65184
+ }
65185
+ constructor(fileDescriptor, size) {
65186
+ this.fileDescriptor = fileDescriptor;
65187
+ this.size = size;
65188
+ }
65189
+ async getUint8(offset) {
65190
+ const val = new Uint8Array((await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer).at(0);
65191
+ if (val === void 0) {
65192
+ throw new Error("something went wrong");
65193
+ }
65194
+ return val;
65195
+ }
65196
+ async getUint16(offset) {
65197
+ const val = new Uint16Array((await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer).at(0);
65198
+ if (val === void 0) {
65199
+ throw new Error("something went wrong");
65200
+ }
65201
+ return val;
65202
+ }
65203
+ async getUint32(offset) {
65204
+ const val = new Uint32Array((await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer).at(0);
65205
+ if (val === void 0) {
65206
+ throw new Error("something went wrong");
65207
+ }
65208
+ return val;
65209
+ }
65210
+ async getBigUint64(offset) {
65211
+ const val = new BigInt64Array((await this.fileDescriptor.read(Buffer.alloc(8), 0, 4, offset)).buffer.buffer).at(0);
65212
+ if (val === void 0) {
65213
+ throw new Error("something went wrong");
65214
+ }
65215
+ return val;
65216
+ }
65217
+ async slice(startOffsset, endOffset) {
65218
+ const bigLength = endOffset - startOffsset;
65219
+ if (bigLength > Number.MAX_SAFE_INTEGER) {
65220
+ throw new Error("too big slice");
65221
+ }
65222
+ const length = Number(bigLength);
65223
+ return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer.buffer;
65224
+ }
65225
+ get length() {
65226
+ return this.size;
64608
65227
  }
64609
65228
  };
64610
65229
  // Annotate the CommonJS export names for ESM import in node:
64611
65230
  0 && (module.exports = {
65231
+ FileHandleProvider,
64612
65232
  I3SConverter,
64613
65233
  Tiles3DConverter
64614
65234
  });