fl-web-component 2.0.18 → 2.0.19-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1445,13 +1445,6 @@ module.exports = function (bitmap, value) {
1445
1445
 
1446
1446
  /***/ }),
1447
1447
 
1448
- /***/ "117e":
1449
- /***/ (function(module, exports, __webpack_require__) {
1450
-
1451
- // extracted by mini-css-extract-plugin
1452
-
1453
- /***/ }),
1454
-
1455
1448
  /***/ "122f":
1456
1449
  /***/ (function(module, exports, __webpack_require__) {
1457
1450
 
@@ -19673,17 +19666,6 @@ module.exports = Array.isArray || function isArray(arg) {
19673
19666
  return cof(arg) == 'Array';
19674
19667
  };
19675
19668
 
19676
- /***/ }),
19677
-
19678
- /***/ "4edc":
19679
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
19680
-
19681
- "use strict";
19682
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_7fad0c6c_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("117e");
19683
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_7fad0c6c_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_7fad0c6c_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
19684
- /* unused harmony reexport * */
19685
-
19686
-
19687
19669
  /***/ }),
19688
19670
 
19689
19671
  /***/ "511f":
@@ -56188,6 +56170,13 @@ Factory_1.Factory.addGetterSetter(Path, 'data');
56188
56170
 
56189
56171
  /***/ }),
56190
56172
 
56173
+ /***/ "8c5c":
56174
+ /***/ (function(module, exports, __webpack_require__) {
56175
+
56176
+ // extracted by mini-css-extract-plugin
56177
+
56178
+ /***/ }),
56179
+
56191
56180
  /***/ "8e84":
56192
56181
  /***/ (function(module, exports, __webpack_require__) {
56193
56182
 
@@ -56507,7 +56496,7 @@ module.exports = document && document.documentElement;
56507
56496
  /***/ "9224":
56508
56497
  /***/ (function(module) {
56509
56498
 
56510
- module.exports = JSON.parse("{\"name\":\"fl-web-component\",\"version\":\"2.0.18\",\"scripts\":{\"postinstall\":\"patch-package\",\"tip1\":\"仅调试本组件不涉及业务组件,请执行dev\",\"dev\":\"vue-cli-service serve\",\"lint\":\"eslint \\\"{src,packages}/**/*.{vue,js}\\\" --fix\",\"prettier\":\"prettier --write \\\"packages/**/*.{js,css,less,scss,vue,html}\\\"\",\"=\":\"=============================================================\",\"tip2\":\"同时调试本组件与业务组件,请执行watch\",\"watch\":\"vue-cli-service build --watch --mode production --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"build\":\"npm run lint && vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"build:test\":\"vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"publish:base\":\"npm run build && npm publish --registry https://registry.npmjs.org/\",\"publish:beta:base\":\"npm run build && npm publish --tag beta --registry https://registry.npmjs.org/\",\"==\":\"=============================================================\",\"tip3\":\"发版注意: 【测试版执行publish:beta】【修改bug执行publish:fix】【新增功能执行publish:feat】【新特性执行publish:perf】\",\"publish:beta\":\"npm version prerelease --preid=beta && npm run publish:beta:base\",\"publish:fix\":\"npm version patch && npm run publish:base\",\"publish:feat\":\"npm version minor && npm run publish:base\",\"publish:perf\":\"npm version major && npm run publish:base\"},\"files\":[\"dist\",\"packages\",\"src\"],\"main\":\"dist/fl-web-component.common.js\",\"dependencies\":{\"camera-controls\":\"2.9.0\",\"core-js\":\"^3.42.0\",\"dxf-parser\":\"^1.1.2\",\"element-ui\":\"2.15.14\",\"fflate\":\"^0.8.2\",\"html2canvas\":\"^1.4.1\",\"jspdf\":\"^3.0.1\",\"konva\":\"^9.3.12\",\"lodash\":\"^4.17.21\",\"meshline\":\"^3.3.1\",\"regenerator-runtime\":\"^0.14.1\",\"svg-pan-zoom\":\"^3.6.2\",\"three\":\"^0.176.0\",\"three.path\":\"^1.0.1\",\"vue\":\"^2.6.11\"},\"devDependencies\":{\"@babel/core\":\"^7.12.16\",\"@babel/plugin-proposal-nullish-coalescing-operator\":\"^7.18.6\",\"@babel/plugin-proposal-optional-chaining\":\"^7.21.0\",\"@babel/preset-env\":\"^7.0.0\",\"@babel/runtime-corejs3\":\"^7.27.1\",\"@vue/cli-plugin-babel\":\"~4.4.0\",\"@vue/cli-plugin-eslint\":\"~4.4.0\",\"@vue/cli-service\":\"~4.4.0\",\"babel-eslint\":\"^10.1.0\",\"babel-loader\":\"^8.0.0\",\"copy-webpack-plugin\":\"^4.0.1\",\"eslint\":\"^6.7.2\",\"eslint-config-prettier\":\"^6.15.0\",\"eslint-plugin-prettier\":\"^3.4.1\",\"eslint-plugin-vue\":\"^6.2.2\",\"patch-package\":\"^6.4.7\",\"prettier\":\"^2.8.8\",\"sass\":\"1.32.13\",\"sass-loader\":\"10.1.1\",\"vue-template-compiler\":\"^2.6.11\",\"worker-loader\":\"^3.0.8\"},\"browserslist\":[\"> 1%\",\"last 2 versions\"]}");
56499
+ module.exports = JSON.parse("{\"name\":\"fl-web-component\",\"version\":\"2.0.19-beta.0\",\"scripts\":{\"postinstall\":\"patch-package\",\"tip1\":\"仅调试本组件不涉及业务组件,请执行dev\",\"dev\":\"vue-cli-service serve\",\"lint\":\"eslint \\\"{src,packages}/**/*.{vue,js}\\\" --fix\",\"prettier\":\"prettier --write \\\"packages/**/*.{js,css,less,scss,vue,html}\\\"\",\"=\":\"=============================================================\",\"tip2\":\"同时调试本组件与业务组件,请执行watch,生产模式监听请执行watch:prod\",\"watch\":\"vue-cli-service build --watch --mode development --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"watch:prod\":\"vue-cli-service build --watch --mode production --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"build\":\"npm run lint && vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"build:test\":\"vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"publish:base\":\"npm run build && npm publish --registry https://registry.npmjs.org/\",\"publish:beta:base\":\"npm run build && npm publish --tag beta --registry https://registry.npmjs.org/\",\"==\":\"=============================================================\",\"tip3\":\"发版注意: 【测试版执行publish:beta】【修改bug执行publish:fix】【新增功能执行publish:feat】【新特性执行publish:perf】\",\"publish:beta\":\"npm version prerelease --preid=beta && npm run publish:beta:base\",\"publish:fix\":\"npm version patch && npm run publish:base\",\"publish:feat\":\"npm version minor && npm run publish:base\",\"publish:perf\":\"npm version major && npm run publish:base\"},\"files\":[\"dist\",\"packages\",\"src\"],\"main\":\"dist/fl-web-component.common.js\",\"dependencies\":{\"camera-controls\":\"2.9.0\",\"core-js\":\"^3.42.0\",\"dxf-parser\":\"^1.1.2\",\"element-ui\":\"2.15.14\",\"fflate\":\"^0.8.2\",\"html2canvas\":\"^1.4.1\",\"jspdf\":\"^3.0.1\",\"konva\":\"^9.3.12\",\"lodash\":\"^4.17.21\",\"meshline\":\"^3.3.1\",\"regenerator-runtime\":\"^0.14.1\",\"svg-pan-zoom\":\"^3.6.2\",\"three\":\"^0.176.0\",\"three.path\":\"^1.0.1\",\"vue\":\"^2.6.11\"},\"devDependencies\":{\"@babel/core\":\"^7.12.16\",\"@babel/plugin-proposal-nullish-coalescing-operator\":\"^7.18.6\",\"@babel/plugin-proposal-optional-chaining\":\"^7.21.0\",\"@babel/preset-env\":\"^7.0.0\",\"@babel/runtime-corejs3\":\"^7.27.1\",\"@vue/cli-plugin-babel\":\"~4.4.0\",\"@vue/cli-plugin-eslint\":\"~4.4.0\",\"@vue/cli-service\":\"~4.4.0\",\"babel-eslint\":\"^10.1.0\",\"babel-loader\":\"^8.0.0\",\"copy-webpack-plugin\":\"^4.0.1\",\"eslint\":\"^6.7.2\",\"eslint-config-prettier\":\"^6.15.0\",\"eslint-plugin-prettier\":\"^3.4.1\",\"eslint-plugin-vue\":\"^6.2.2\",\"patch-package\":\"^6.4.7\",\"prettier\":\"^2.8.8\",\"sass\":\"1.32.13\",\"sass-loader\":\"10.1.1\",\"vue-template-compiler\":\"^2.6.11\",\"worker-loader\":\"^3.0.8\"},\"browserslist\":[\"> 1%\",\"last 2 versions\"]}");
56511
56500
 
56512
56501
  /***/ }),
56513
56502
 
@@ -57866,17 +57855,6 @@ var RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
57866
57855
  * https://github.com/Matt-Esch/string-template/index.js
57867
57856
  */
57868
57857
 
57869
- /***/ }),
57870
-
57871
- /***/ "9f61":
57872
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
57873
-
57874
- "use strict";
57875
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_7fad0c6c_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ed7b");
57876
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_7fad0c6c_prod_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_7fad0c6c_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__);
57877
- /* unused harmony reexport * */
57878
-
57879
-
57880
57858
  /***/ }),
57881
57859
 
57882
57860
  /***/ "9fbb":
@@ -59324,6 +59302,13 @@ var isDefined = exports.isDefined = function isDefined(val) {
59324
59302
 
59325
59303
  /***/ }),
59326
59304
 
59305
+ /***/ "a81d":
59306
+ /***/ (function(module, exports, __webpack_require__) {
59307
+
59308
+ // extracted by mini-css-extract-plugin
59309
+
59310
+ /***/ }),
59311
+
59327
59312
  /***/ "ae26":
59328
59313
  /***/ (function(module, exports, __webpack_require__) {
59329
59314
 
@@ -59559,6 +59544,17 @@ module.exports = function () {
59559
59544
  };
59560
59545
  }();
59561
59546
 
59547
+ /***/ }),
59548
+
59549
+ /***/ "b606":
59550
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
59551
+
59552
+ "use strict";
59553
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_a4813dca_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a81d");
59554
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_a4813dca_prod_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_a4813dca_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__);
59555
+ /* unused harmony reexport * */
59556
+
59557
+
59562
59558
  /***/ }),
59563
59559
 
59564
59560
  /***/ "b9c7":
@@ -69146,13 +69142,6 @@ module.exports = function (it) {
69146
69142
 
69147
69143
  /***/ }),
69148
69144
 
69149
- /***/ "cbf5":
69150
- /***/ (function(module) {
69151
-
69152
- module.exports = JSON.parse("{}");
69153
-
69154
- /***/ }),
69155
-
69156
69145
  /***/ "cc15":
69157
69146
  /***/ (function(module, exports, __webpack_require__) {
69158
69147
 
@@ -72511,6 +72500,17 @@ Factory_1.Factory.addGetterSetter(Star, 'numPoints', 5, (0, Validators_1.getNumb
72511
72500
  Factory_1.Factory.addGetterSetter(Star, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
72512
72501
  Factory_1.Factory.addGetterSetter(Star, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
72513
72502
 
72503
+ /***/ }),
72504
+
72505
+ /***/ "e426":
72506
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
72507
+
72508
+ "use strict";
72509
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_a4813dca_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8c5c");
72510
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_a4813dca_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_a4813dca_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
72511
+ /* unused harmony reexport * */
72512
+
72513
+
72514
72514
  /***/ }),
72515
72515
 
72516
72516
  /***/ "e444":
@@ -75693,13 +75693,6 @@ Animation.animRunning = false;
75693
75693
 
75694
75694
  /***/ }),
75695
75695
 
75696
- /***/ "ed7b":
75697
- /***/ (function(module, exports, __webpack_require__) {
75698
-
75699
- // extracted by mini-css-extract-plugin
75700
-
75701
- /***/ }),
75702
-
75703
75696
  /***/ "eedf":
75704
75697
  /***/ (function(module, exports, __webpack_require__) {
75705
75698
 
@@ -78641,8 +78634,8 @@ if (typeof window !== 'undefined') {
78641
78634
  // Indicate to webpack that this file can be concatenated
78642
78635
  /* harmony default export */ var setPublicPath = (null);
78643
78636
 
78644
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e203256c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/index.vue?vue&type=template&id=7fad0c6c&scoped=true
78645
- var com_graphicsvue_type_template_id_7fad0c6c_scoped_true_render = function render() {
78637
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5851e511-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/index.vue?vue&type=template&id=a4813dca&scoped=true
78638
+ var com_graphicsvue_type_template_id_a4813dca_scoped_true_render = function render() {
78646
78639
  var _vm = this,
78647
78640
  _c = _vm._self._c;
78648
78641
  return _c('div', {
@@ -78654,7 +78647,7 @@ var com_graphicsvue_type_template_id_7fad0c6c_scoped_true_render = function rend
78654
78647
  };
78655
78648
  var staticRenderFns = [];
78656
78649
 
78657
- // CONCATENATED MODULE: ./packages/components/com-graphics/index.vue?vue&type=template&id=7fad0c6c&scoped=true
78650
+ // CONCATENATED MODULE: ./packages/components/com-graphics/index.vue?vue&type=template&id=a4813dca&scoped=true
78658
78651
 
78659
78652
  // CONCATENATED MODULE: ./node_modules/camera-controls/dist/camera-controls.module.js
78660
78653
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
@@ -109017,8 +109010,12 @@ function processMeshData(input, options) {
109017
109010
  mergeMaterialByMeshId.set(String(it.id), it);
109018
109011
  }
109019
109012
  }
109013
+ var identity = new Matrix4().identity();
109014
+ var identityElements = identity.elements;
109020
109015
  input.mesh.forEach(function (meshItem) {
109016
+ var _meshItem$matrix;
109021
109017
  var geomList = [];
109018
+ var meshMatrix = (_meshItem$matrix = meshItem.matrix) !== null && _meshItem$matrix !== void 0 && _meshItem$matrix.length ? meshItem.matrix : identityElements;
109022
109019
  meshItem.primitives.forEach(function (primitive) {
109023
109020
  var primitiveData = input.primitive.find(function (g) {
109024
109021
  return g.id === primitive.prmid;
@@ -109031,26 +109028,24 @@ function processMeshData(input, options) {
109031
109028
  var mergedMaterial = mergeMaterialByMeshId.get(String(meshItem.id));
109032
109029
  var material = mergedMaterial || baseMaterial;
109033
109030
  var sourceVisible = (mergedMaterial === null || mergedMaterial === void 0 ? void 0 : mergedMaterial.visible) === false || (baseMaterial === null || baseMaterial === void 0 ? void 0 : baseMaterial.visible) === false ? false : true;
109031
+ var baseColor = [255, 255, 255, 1];
109034
109032
  var prop = {
109035
- color: (material === null || material === void 0 ? void 0 : material.color) || [255, 255, 255, 1],
109033
+ color: material !== null && material !== void 0 && material.color ? material !== null && material !== void 0 && material.color.length ? material.color : baseColor : baseColor,
109036
109034
  fontsize: (material === null || material === void 0 ? void 0 : material.fontsize) !== undefined ? material === null || material === void 0 ? void 0 : material.fontsize : 20,
109037
109035
  frontname: (material === null || material === void 0 ? void 0 : material.frontname) !== undefined ? material === null || material === void 0 ? void 0 : material.frontname : '',
109038
109036
  italic: material === null || material === void 0 ? void 0 : material.italic,
109039
109037
  linepacing: 1,
109040
109038
  // 默认值
109041
- linewidth: (material === null || material === void 0 ? void 0 : material.linewidth) !== undefined ? material === null || material === void 0 ? void 0 : material.linewidth : 1,
109039
+ linewidth: (material === null || material === void 0 ? void 0 : material.linewidth) !== undefined ? material === null || material === void 0 ? void 0 : material.linewidth : 10,
109042
109040
  // 默认值
109043
109041
  visible: sourceVisible,
109044
109042
  sourceVisible: sourceVisible,
109045
109043
  transparent: (material === null || material === void 0 ? void 0 : material.transp) !== undefined ? material === null || material === void 0 ? void 0 : material.transp : 0
109046
109044
  };
109047
- var identity = new Matrix4().identity();
109048
109045
  geomList.push({
109049
109046
  matrix: {
109050
- val: (_primitive$matrix = primitive.matrix) !== null && _primitive$matrix !== void 0 && _primitive$matrix.length ? primitive.matrix : identity.elements
109051
- // val: identity.elements,
109047
+ val: (_primitive$matrix = primitive.matrix) !== null && _primitive$matrix !== void 0 && _primitive$matrix.length ? primitive.matrix : identityElements
109052
109048
  },
109053
- // originMatrix: meshItem.id == primitive.prmid ? [] : identity.elements,
109054
109049
  prmid: primitive.prmid,
109055
109050
  geomId: primitiveData.id,
109056
109051
  type: primitiveData.geomType,
@@ -109067,6 +109062,9 @@ function processMeshData(input, options) {
109067
109062
  });
109068
109063
  drawObjMap.set(meshItem.id, {
109069
109064
  drawObjId: meshItem.id,
109065
+ matrix: {
109066
+ val: meshMatrix
109067
+ },
109070
109068
  geoms: geomList
109071
109069
  // lodLevel: meshItem.type || 2,
109072
109070
  });
@@ -109146,12 +109144,12 @@ function processNodeData(input, options) {
109146
109144
 
109147
109145
  // 处理一个primitive,生成多个drawObj
109148
109146
  function processOnePrimtiveToMultiMesh(primitive) {
109149
- var _primitive$geoms$, _primitive$geoms$2;
109147
+ var _primitive$geoms$;
109150
109148
  return {
109151
109149
  instanceId: primitive.drawObjId,
109152
109150
  // 实例与drawObj一对多关系
109153
109151
  drawObject: ((_primitive$geoms$ = primitive.geoms[0]) === null || _primitive$geoms$ === void 0 ? void 0 : _primitive$geoms$.prmid) || '',
109154
- matrix: ((_primitive$geoms$2 = primitive.geoms[0]) === null || _primitive$geoms$2 === void 0 ? void 0 : _primitive$geoms$2.matrix) || []
109152
+ matrix: primitive.matrix || {}
109155
109153
  };
109156
109154
  }
109157
109155
 
@@ -109237,14 +109235,19 @@ function parseNode(node, isFlatNode) {
109237
109235
  // 生成默认node节点
109238
109236
  function generateNode(mesh) {
109239
109237
  var nodes = [];
109238
+ var identity = new Matrix4().identity();
109239
+ var identityElements = identity.elements;
109240
109240
  mesh.forEach(function (item) {
109241
109241
  if (item.primitives.length) {
109242
+ var _item$matrix;
109242
109243
  var tempNode = {
109243
109244
  id: item.id,
109244
109245
  _batchId: item.id,
109245
109246
  name: item.id,
109246
109247
  mesh: item.id,
109247
- matrix: {},
109248
+ matrix: {
109249
+ val: (_item$matrix = item.matrix) !== null && _item$matrix !== void 0 && _item$matrix.length ? item.matrix : identityElements
109250
+ },
109248
109251
  nodeType: 3
109249
109252
  };
109250
109253
  nodes.push(tempNode);
@@ -111428,7 +111431,7 @@ var inline_default = /*#__PURE__*/__webpack_require__.n(inline);
111428
111431
 
111429
111432
 
111430
111433
  function Worker_fn() {
111431
- return inline_default()("/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"f538\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"f538\":\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// CONCATENATED MODULE: ./node_modules/fflate/esm/browser.js\n// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = function wk(c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'], {\n type: 'text/javascript'\n }))));\n w.onmessage = function (e) {\n var d = e.data,\n ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n } else cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n};\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array,\n u16 = Uint16Array,\n i32 = Int32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */0, 0, /* impossible */0]);\n// fixed distance extra bits\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function freb(eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new i32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = j - b[i] << 5 | i;\n }\n }\n return {\n b: b,\n r: r\n };\n};\nvar _a = freb(fleb, 2),\n fl = _a.b,\n revfl = _a.r;\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0),\n fd = _b.b,\n revfd = _b.r;\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var browser_i = 0; browser_i < 32768; ++browser_i) {\n // reverse table algorithm from SO\n var x = (browser_i & 0xAAAA) >> 1 | (browser_i & 0x5555) << 1;\n x = (x & 0xCCCC) >> 2 | (x & 0x3333) << 2;\n x = (x & 0xF0F0) >> 4 | (x & 0x0F0F) << 4;\n rev[browser_i] = ((x & 0xFF00) >> 8 | (x & 0x00FF) << 8) >> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = function hMap(cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i]) ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 1; i < mb; ++i) {\n le[i] = le[i - 1] + l[i - 1] << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = i << 4 | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | (1 << r_1) - 1; v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >> rvb] = sv;\n }\n }\n }\n } else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];\n }\n }\n }\n return co;\n};\n// fixed length tree\nvar flt = new u8(288);\nfor (var browser_i = 0; browser_i < 144; ++browser_i) flt[browser_i] = 8;\nfor (var browser_i = 144; browser_i < 256; ++browser_i) flt[browser_i] = 9;\nfor (var browser_i = 256; browser_i < 280; ++browser_i) flt[browser_i] = 7;\nfor (var browser_i = 280; browser_i < 288; ++browser_i) flt[browser_i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var browser_i = 0; browser_i < 32; ++browser_i) fdt[browser_i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/hMap(flt, 9, 0),\n flrm = /*#__PURE__*/hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/hMap(fdt, 5, 0),\n fdrm = /*#__PURE__*/hMap(fdt, 5, 1);\n// find max of array\nvar max = function max(a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m) m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function bits(d, p, m) {\n var o = p / 8 | 0;\n return (d[o] | d[o + 1] << 8) >> (p & 7) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function bits16(d, p) {\n var o = p / 8 | 0;\n return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);\n};\n// get end of byte\nvar shft = function shft(p) {\n return (p + 7) / 8 | 0;\n};\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function slc(v, s, e) {\n if (s == null || s < 0) s = 0;\n if (e == null || e > v.length) e = v.length;\n // can't use .constructor in case user-supplied\n return new u8(v.subarray(s, e));\n};\n/**\n * Codes for errors generated within this library\n */\nvar FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = ['unexpected EOF', 'invalid block type', 'invalid length/literal', 'invalid distance', 'stream finished', 'no stream handler',, 'no callback', 'invalid UTF-8 data', 'extra field too long', 'date not in range 1980-2099', 'filename too long', 'stream finishing', 'invalid zip data'\n// determined by unknown compression method\n];\n;\nvar _err = function err(ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace) Error.captureStackTrace(e, _err);\n if (!nt) throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function inflt(dat, st, buf, dict) {\n // source length dict length\n var sl = dat.length,\n dl = dict ? dict.length : 0;\n if (!sl || st.f && !st.l) return buf || new u8(0);\n var noBuf = !buf;\n // have to estimate size\n var resize = noBuf || st.i != 2;\n // no state\n var noSt = st.i;\n // Assumes roughly 33% compression ratio average\n if (noBuf) buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function cbuf(l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0,\n pos = st.p || 0,\n bt = st.b || 0,\n lm = st.l,\n dm = st.d,\n lbt = st.m,\n dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4,\n l = dat[s - 4] | dat[s - 3] << 8,\n t = s + l;\n if (t > sl) {\n if (noSt) _err(0);\n break;\n }\n // ensure size\n if (resize) cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n } else if (type == 1) lm = flrm, dm = fdrm, lbt = 9, dbt = 5;else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257,\n hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt),\n clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n } else {\n // copy count\n var c = 0,\n n = 0;\n if (s == 16) n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];else if (s == 17) n = 3 + bits(dat, pos, 7), pos += 3;else if (s == 18) n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--) ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit),\n dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n } else _err(1);\n if (pos > tbts) {\n if (noSt) _err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17\n if (resize) cbuf(bt + 131072);\n var lms = (1 << lbt) - 1,\n dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms],\n sym = c >> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt) _err(0);\n break;\n }\n if (!c) _err(2);\n if (sym < 256) buf[bt++] = sym;else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n } else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257,\n b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms],\n dsym = d >> 4;\n if (!d) _err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & (1 << b) - 1, pos += b;\n }\n if (pos > tbts) {\n if (noSt) _err(0);\n break;\n }\n if (resize) cbuf(bt + 131072);\n var end = bt + add;\n if (bt < dt) {\n var shift = dl - dt,\n dend = Math.min(dt, end);\n if (shift + bt < 0) _err(3);\n for (; bt < dend; ++bt) buf[bt] = dict[shift + bt];\n }\n for (; bt < end; ++bt) buf[bt] = buf[bt - dt];\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n // don't reallocate for streams or user buffers\n return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function wbits(d, p, v) {\n v <<= p & 7;\n var o = p / 8 | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function wbits16(d, p, v) {\n v <<= p & 7;\n var o = p / 8 | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n d[o + 2] |= v >> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function hTree(d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i]) t.push({\n s: i,\n f: d[i]\n });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s) return {\n t: et,\n l: 0\n };\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return {\n t: v,\n l: 1\n };\n }\n t.sort(function (a, b) {\n return a.f - b.f;\n });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({\n s: -1,\n f: 25001\n });\n var l = t[0],\n r = t[1],\n i0 = 0,\n i1 = 1,\n i2 = 2;\n t[0] = {\n s: -1,\n f: l.f + r.f,\n l: l,\n r: r\n };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = {\n s: -1,\n f: l.f + r.f,\n l: l,\n r: r\n };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym) maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = _ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0,\n dt = 0;\n // left cost\n var lft = mbt - mb,\n cst = 1 << lft;\n t2.sort(function (a, b) {\n return tr[b.s] - tr[a.s] || a.f - b.f;\n });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << mbt - tr[i2_1]);\n tr[i2_1] = mb;\n } else break;\n }\n dt >>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb) dt -= 1 << mb - tr[i2_2]++ - 1;else ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return {\n t: new u8(tr),\n l: mbt\n };\n};\n// get the max length and assign length codes\nvar _ln = function ln(n, l, d) {\n return n.s == -1 ? Math.max(_ln(n.l, l, d + 1), _ln(n.r, l, d + 1)) : l[n.s] = d;\n};\n// length codes generation\nvar lc = function lc(c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s]);\n var cl = new u16(++s);\n // ind num streak\n var cli = 0,\n cln = c[0],\n cls = 1;\n var w = function w(v) {\n cl[cli++] = v;\n };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s) ++cls;else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138) w(32754);\n if (cls > 2) {\n w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);\n cls = 0;\n }\n } else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6) w(8304);\n if (cls > 2) w(cls - 3 << 5 | 8208), cls = 0;\n }\n while (cls--) w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return {\n c: cl.subarray(0, cli),\n n: s\n };\n};\n// calculate the length of output from tree, code lengths\nvar clen = function clen(cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i) l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function wfblk(out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i) out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function wblk(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15),\n dlt = _a.t,\n mlb = _a.l;\n var _b = hTree(df, 15),\n ddt = _b.t,\n mdb = _b.l;\n var _c = lc(dlt),\n lclt = _c.c,\n nlc = _c.n;\n var _d = lc(ddt),\n lcdt = _d.c,\n ndc = _d.n;\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i) ++lcfreq[lclt[i] & 31];\n for (var i = 0; i < lcdt.length; ++i) ++lcfreq[lcdt[i] & 31];\n var _e = hTree(lcfreq, 7),\n lct = _e.t,\n mlcb = _e.l;\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc);\n var flen = bl + 5 << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];\n if (bs >= 0 && flen <= ftlen && flen <= dtlen) return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i) wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15) wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;\n }\n }\n } else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n var sym = syms[i];\n if (sym > 255) {\n var len = sym >> 18 & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7) wbits(out, p, sym >> 23 & 31), p += fleb[len];\n var dst = sym & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3) wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];\n } else {\n wbits16(out, p, lm[sym]), p += ll[sym];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function dflt(dat, lvl, plvl, pre, post, st) {\n var s = st.z || dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var lst = st.l;\n var pos = (st.r || 0) & 7;\n if (lvl) {\n if (pos) w[0] = st.r >> 3;\n var opt = deo[lvl - 1];\n var n = opt >> 13,\n c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = st.p || new u16(32768),\n head = st.h || new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3),\n bs2_1 = 2 * bs1_1;\n var hsh = function hsh(i) {\n return (dat[i] ^ dat[i + 1] << bs1_1 ^ dat[i + 2] << bs2_1) & msk_1;\n };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new i32(25000);\n // length/literal freq distance freq\n var lf = new u16(288),\n df = new u16(32);\n // l/lcnt exbits index l/lind waitdx blkpos\n var lc_1 = 0,\n eb = 0,\n i = st.i || 0,\n li = 0,\n wi = st.w || 0,\n bs = 0;\n for (; i + 2 < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767,\n pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j) lf[j] = 0;\n for (var j = 0; j < 30; ++j) df[j] = 0;\n }\n // len dist chain\n var l = 2,\n d = 0,\n ch_1 = c,\n dif = imod - pimod & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl);\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn) break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = i - dif + j & 32767;\n var pti = prev[ti];\n var cd = ti - pti & 32767;\n if (cd > md) md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += imod - pimod & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one int32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];\n var lin = revfl[l] & 31,\n din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n } else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n for (i = Math.max(i, wi); i < s; ++i) {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n if (!lst) {\n st.r = pos & 7 | w[pos / 8 | 0] << 3;\n // shft(pos) now 1 less if pos & 7 != 0\n pos -= 7;\n st.h = head, st.p = prev, st.i = i, st.w = wi;\n }\n } else {\n for (var i = st.w || 0; i < s + lst; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[pos / 8 | 0] = lst;\n e = s;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n st.i = s;\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i,\n k = 9;\n while (--k) c = (c & 1 && -306674912) ^ c >>> 1;\n t[i] = c;\n }\n return t;\n}();\n// CRC32\nvar crc = function crc() {\n var c = -1;\n return {\n p: function p(d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i) cr = crct[cr & 255 ^ d[i]] ^ cr >>> 8;\n c = cr;\n },\n d: function d() {\n return ~c;\n }\n };\n};\n// Adler32\nvar adler = function adler() {\n var a = 1,\n b = 0;\n return {\n p: function p(d) {\n // closures have awful performance\n var n = a,\n m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i) m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function d() {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | b >> 8;\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function dopt(dat, opt, pre, post, st) {\n if (!st) {\n st = {\n l: 1\n };\n if (opt.dictionary) {\n var dict = opt.dictionary.subarray(-32768);\n var newDat = new u8(dict.length + dat.length);\n newDat.set(dict);\n newDat.set(dat, dict.length);\n dat = newDat;\n st.w = dict.length;\n }\n }\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);\n};\n// Walmart object spread\nvar mrg = function mrg(a, b) {\n var o = {};\n for (var k in a) o[k] = a[k];\n for (var k in b) o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function wcln(fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i],\n k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n } else {\n fnStr += st_1;\n for (var t in v.prototype) fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n } else fnStr += st_1;\n } else td[k] = v;\n }\n return fnStr;\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function cbfs(v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function wrkr(fns, init, id, cb) {\n if (!ch[id]) {\n var fnStr = '',\n td_1 = {},\n m = fns.length - 1;\n for (var i = 0; i < m; ++i) fnStr = wcln(fns[i], fnStr, td_1);\n ch[id] = {\n c: wcln(fns[m], fnStr, td_1),\n e: td_1\n };\n }\n var td = mrg({}, ch[id].e);\n return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function bInflt() {\n return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, _err, inflt, inflateSync, pbf, gopt];\n};\nvar bDflt = function bDflt() {\n return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, _ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf];\n};\n// gzip extra\nvar gze = function gze() {\n return [gzh, gzhl, wbytes, crc, crct];\n};\n// gunzip extra\nvar guze = function guze() {\n return [gzs, gzl];\n};\n// zlib extra\nvar zle = function zle() {\n return [zlh, wbytes, adler];\n};\n// unzlib extra\nvar zule = function zule() {\n return [zls];\n};\n// post buf\nvar pbf = function pbf(msg) {\n return postMessage(msg, [msg.buffer]);\n};\n// get opts\nvar gopt = function gopt(o) {\n return o && {\n out: o.size && new u8(o.size),\n dictionary: o.dictionary\n };\n};\n// async helper\nvar cbify = function cbify(dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () {\n w.terminate();\n };\n};\n// auto stream\nvar astrm = function astrm(strm) {\n strm.ondata = function (dat, final) {\n return postMessage([dat, final], [dat.buffer]);\n };\n return function (ev) {\n if (ev.data.length) {\n strm.push(ev.data[0], ev.data[1]);\n postMessage([ev.data[0].length]);\n } else strm.flush();\n };\n};\n// async stream attach\nvar astrmify = function astrmify(fns, strm, opts, init, id, flush, ext) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err) w.terminate(), strm.ondata.call(strm, err);else if (!Array.isArray(dat)) ext(dat);else if (dat.length == 1) {\n strm.queuedSize -= dat[0];\n if (strm.ondrain) strm.ondrain(dat[0]);\n } else {\n if (dat[1]) w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.queuedSize = 0;\n strm.push = function (d, f) {\n if (!strm.ondata) _err(5);\n if (t) strm.ondata(_err(4, 0, 1), null, !!f);\n strm.queuedSize += d.length;\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () {\n w.terminate();\n };\n if (flush) {\n strm.flush = function () {\n w.postMessage([]);\n };\n }\n};\n// read 2 bytes\nvar b2 = function b2(d, b) {\n return d[b] | d[b + 1] << 8;\n};\n// read 4 bytes\nvar b4 = function b4(d, b) {\n return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;\n};\nvar b8 = function b8(d, b) {\n return b4(d, b) + b4(d, b + 4) * 4294967296;\n};\n// write bytes\nvar wbytes = function wbytes(d, b, v) {\n for (; v; ++b) d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function gzh(c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0) wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i) c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function gzs(d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8) _err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4) st += (d[10] | d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]);\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function gzl(d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;\n};\n// gzip header length\nvar gzhl = function gzhl(o) {\n return 10 + (o.filename ? o.filename.length + 1 : 0);\n};\n// zlib header\nvar zlh = function zlh(c, o) {\n var lv = o.level,\n fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = fl << 6 | (o.dictionary && 32);\n c[1] |= 31 - (c[0] << 8 | c[1]) % 31;\n if (o.dictionary) {\n var h = adler();\n h.p(o.dictionary);\n wbytes(c, 2, h.d());\n }\n};\n// zlib start\nvar zls = function zls(d, dict) {\n if ((d[0] & 15) != 8 || d[0] >> 4 > 7 || (d[0] << 8 | d[1]) % 31) _err(6, 'invalid zlib data');\n if ((d[1] >> 5 & 1) == +!dict) _err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');\n return (d[1] >> 3 & 4) + 2;\n};\nfunction StrmOpt(opts, cb) {\n if (typeof opts == 'function') cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/function () {\n function Deflate(opts, cb) {\n if (typeof opts == 'function') cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n this.s = {\n l: 0,\n i: 32768,\n w: 32768,\n z: 32768\n };\n // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev\n // 98304 = 32768 (lookback) + 65536 (common chunk size)\n this.b = new u8(98304);\n if (this.o.dictionary) {\n var dict = this.o.dictionary.subarray(-32768);\n this.b.set(dict, 32768 - dict.length);\n this.s.i = 32768 - dict.length;\n }\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, this.s), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n if (this.s.l) _err(4);\n var endLen = chunk.length + this.s.z;\n if (endLen > this.b.length) {\n if (endLen > 2 * this.b.length - 32768) {\n var newBuf = new u8(endLen & -32768);\n newBuf.set(this.b.subarray(0, this.s.z));\n this.b = newBuf;\n }\n var split = this.b.length - this.s.z;\n this.b.set(chunk.subarray(0, split), this.s.z);\n this.s.z = this.b.length;\n this.p(this.b, false);\n this.b.set(this.b.subarray(-32768));\n this.b.set(chunk.subarray(split), 32768);\n this.s.z = chunk.length - split + 32768;\n this.s.i = 32766, this.s.w = 32768;\n } else {\n this.b.set(chunk, this.s.z);\n this.s.z += chunk.length;\n }\n this.s.l = final & 1;\n if (this.s.z > this.s.w + 8191 || final) {\n this.p(this.b, final || false);\n this.s.w = this.s.i, this.s.i -= 2;\n }\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * deflated output for small inputs.\n */\n Deflate.prototype.flush = function () {\n if (!this.ondata) _err(5);\n if (this.s.l) _err(4);\n this.p(this.b, false);\n this.s.w = this.s.i, this.s.i -= 2;\n };\n return Deflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/function () {\n function AsyncDeflate(opts, cb) {\n astrmify([bDflt, function () {\n return [astrm, Deflate];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6, 1);\n }\n return AsyncDeflate;\n}();\n\nfunction deflate(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bDflt], function (ev) {\n return pbf(deflateSync(ev.data[0], ev.data[1]));\n }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nfunction deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/function () {\n function Inflate(opts, cb) {\n // no StrmOpt here to avoid adding to workerizer\n if (typeof opts == 'function') cb = opts, opts = {};\n this.ondata = cb;\n var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);\n this.s = {\n i: 0,\n b: dict ? dict.length : 0\n };\n this.o = new u8(32768);\n this.p = new u8(0);\n if (dict) this.o.set(dict);\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata) _err(5);\n if (this.d) _err(4);\n if (!this.p.length) this.p = c;else if (c.length) {\n var n = new u8(this.p.length + c.length);\n n.set(this.p), n.set(c, this.p.length), this.p = n;\n }\n };\n Inflate.prototype.c = function (final) {\n this.s.i = +(this.d = final || false);\n var bts = this.s.b;\n var dt = inflt(this.p, this.s, this.o);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/function () {\n function AsyncInflate(opts, cb) {\n astrmify([bInflt, function () {\n return [astrm, Inflate];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Inflate(ev.data);\n onmessage = astrm(strm);\n }, 7, 0);\n }\n return AsyncInflate;\n}();\n\nfunction inflate(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bInflt], function (ev) {\n return pbf(inflateSync(ev.data[0], gopt(ev.data[1])));\n }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction inflateSync(data, opts) {\n return inflt(data, {\n i: 2\n }, opts && opts.out, opts && opts.dictionary);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n this.l += chunk.length;\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s);\n if (this.v) gzh(raw, this.o), this.v = 0;\n if (f) wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * GZIPped output for small inputs.\n */\n Gzip.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Gzip;\n}();\n\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/function () {\n function AsyncGzip(opts, cb) {\n astrmify([bDflt, gze, function () {\n return [astrm, Deflate, Gzip];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8, 1);\n }\n return AsyncGzip;\n}();\n\nfunction gzip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bDflt, gze, function () {\n return [gzipSync];\n }], function (ev) {\n return pbf(gzipSync(ev.data[0], ev.data[1]));\n }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nfunction gzipSync(data, opts) {\n if (!opts) opts = {};\n var c = crc(),\n l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8),\n s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming single or multi-member GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/function () {\n function Gunzip(opts, cb) {\n this.v = 1;\n this.r = 0;\n Inflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n this.r += chunk.length;\n if (this.v) {\n var p = this.p.subarray(this.v - 1);\n var s = p.length > 3 ? gzs(p) : 4;\n if (s > p.length) {\n if (!final) return;\n } else if (this.v > 1 && this.onmember) {\n this.onmember(this.r - p.length);\n }\n this.p = p.subarray(s), this.v = 0;\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n // process concatenated GZIP\n if (this.s.f && !this.s.l && !final) {\n this.v = shft(this.s.p) + 9;\n this.s = {\n i: 0\n };\n this.o = new u8(0);\n this.push(new u8(0), final);\n }\n };\n return Gunzip;\n}();\n\n/**\n * Asynchronous streaming single or multi-member GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/function () {\n function AsyncGunzip(opts, cb) {\n var _this = this;\n astrmify([bInflt, guze, function () {\n return [astrm, Inflate, Gunzip];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gunzip(ev.data);\n strm.onmember = function (offset) {\n return postMessage(offset);\n };\n onmessage = astrm(strm);\n }, 9, 0, function (offset) {\n return _this.onmember && _this.onmember(offset);\n });\n }\n return AsyncGunzip;\n}();\n\nfunction gunzip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bInflt, guze, function () {\n return [gunzipSync];\n }], function (ev) {\n return pbf(gunzipSync(ev.data[0], ev.data[1]));\n }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction gunzipSync(data, opts) {\n var st = gzs(data);\n if (st + 8 > data.length) _err(6, 'invalid gzip data');\n return inflt(data.subarray(st, -8), {\n i: 2\n }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s);\n if (this.v) zlh(raw, this.o), this.v = 0;\n if (f) wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * zlibbed output for small inputs.\n */\n Zlib.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Zlib;\n}();\n\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/function () {\n function AsyncZlib(opts, cb) {\n astrmify([bDflt, zle, function () {\n return [astrm, Deflate, Zlib];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10, 1);\n }\n return AsyncZlib;\n}();\n\nfunction zlib(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bDflt, zle, function () {\n return [zlibSync];\n }], function (ev) {\n return pbf(zlibSync(ev.data[0], ev.data[1]));\n }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nfunction zlibSync(data, opts) {\n if (!opts) opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/function () {\n function Unzlib(opts, cb) {\n Inflate.call(this, opts, cb);\n this.v = opts && opts.dictionary ? 2 : 1;\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 6 && !final) return;\n this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4) _err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}();\n\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/function () {\n function AsyncUnzlib(opts, cb) {\n astrmify([bInflt, zule, function () {\n return [astrm, Inflate, Unzlib];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Unzlib(ev.data);\n onmessage = astrm(strm);\n }, 11, 0);\n }\n return AsyncUnzlib;\n}();\n\nfunction unzlib(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bInflt, zule, function () {\n return [unzlibSync];\n }], function (ev) {\n return pbf(unzlibSync(ev.data[0], gopt(ev.data[1])));\n }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction unzlibSync(data, opts) {\n return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), {\n i: 2\n }, opts && opts.out, opts && opts.dictionary);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\n\n\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/function () {\n function Decompress(opts, cb) {\n this.o = StrmOpt.call(this, opts, cb) || {};\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n }\n // init substream\n // overriden by AsyncDecompress\n Decompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (dat, final) {\n _this.ondata(dat, final);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n } else this.p = chunk;\n if (this.p.length > 2) {\n this.s = this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8 ? new this.G(this.o) : (this.p[0] & 15) != 8 || this.p[0] >> 4 > 7 || (this.p[0] << 8 | this.p[1]) % 31 ? new this.I(this.o) : new this.Z(this.o);\n this.i();\n this.s.push(this.p, final);\n this.p = null;\n }\n } else this.s.push(chunk, final);\n };\n return Decompress;\n}();\n\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/function () {\n function AsyncDecompress(opts, cb) {\n Decompress.call(this, opts, cb);\n this.queuedSize = 0;\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n }\n AsyncDecompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (err, dat, final) {\n _this.ondata(err, dat, final);\n };\n this.s.ondrain = function (size) {\n _this.queuedSize -= size;\n if (_this.ondrain) _this.ondrain(size);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n this.queuedSize += chunk.length;\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}();\n\nfunction decompress(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return data[0] == 31 && data[1] == 139 && data[2] == 8 ? gunzip(data, opts, cb) : (data[0] & 15) != 8 || data[0] >> 4 > 7 || (data[0] << 8 | data[1]) % 31 ? inflate(data, opts, cb) : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction decompressSync(data, opts) {\n return data[0] == 31 && data[1] == 139 && data[2] == 8 ? gunzipSync(data, opts) : (data[0] & 15) != 8 || data[0] >> 4 > 7 || (data[0] << 8 | data[1]) % 31 ? inflateSync(data, opts) : unzlibSync(data, opts);\n}\n// flatten a directory structure\nvar _fltn = function fltn(d, p, t, o) {\n for (var k in d) {\n var val = d[k],\n n = p + k,\n op = o;\n if (Array.isArray(val)) op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8) t[n] = [val, op];else {\n t[n += '/'] = [new u8(0), op];\n _fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, {\n stream: true\n });\n tds = 1;\n} catch (e) {}\n// decode UTF8\nvar dutf8 = function dutf8(d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length) return {\n s: r,\n r: slc(d, i - 1)\n };\n if (!eb) r += String.fromCharCode(c);else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);\n } else if (eb & 1) r += String.fromCharCode((c & 31) << 6 | d[i++] & 63);else r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63);\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds) this.t = new TextDecoder();else this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, {\n stream: true\n }), final);\n if (final) {\n if (this.t.decode().length) _err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p) _err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat),\n s = _a.s,\n r = _a.r;\n if (final) {\n if (r.length) _err(8);\n this.p = null;\n } else this.p = r;\n this.ondata(s, final);\n };\n return DecodeUTF8;\n}();\n\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n if (this.d) _err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}();\n\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nfunction strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i) ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te) return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function w(v) {\n ar[ai++] = v;\n };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + (l - i << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1) w(c);else if (c < 2048) w(192 | c >> 6), w(128 | c & 63);else if (c > 55295 && c < 57344) c = 65536 + (c & 1023 << 10) | str.charCodeAt(++i) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63);else w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nfunction strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384) r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n } else if (td) {\n return td.decode(dat);\n } else {\n var _a = dutf8(dat),\n s = _a.s,\n r = _a.r;\n if (r.length) _err(8);\n return s;\n }\n}\n;\n// deflate bit flag\nvar dbf = function dbf(l) {\n return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0;\n};\n// skip local zip header\nvar slzh = function slzh(d, b) {\n return b + 30 + b2(d, b + 26) + b2(d, b + 28);\n};\n// read zip header\nvar zh = function zh(d, b, z) {\n var fnl = b2(d, b + 28),\n fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)),\n es = b + 46 + fnl,\n bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)],\n sc = _a[0],\n su = _a[1],\n off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function z64e(d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2));\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function exfl(ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535) _err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function wzh(d, b, f, fn, u, c, ce, co) {\n var fl = fn.length,\n ex = f.extra,\n col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null) d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime),\n y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119) _err(10);\n wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k],\n l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col) d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function wzf(o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final) this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}();\n\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this = this;\n if (!opts) opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n } catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/function () {\n /**\n * Creates an asynchronous DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this = this;\n if (!opts) opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}();\n\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this = this;\n if (!this.ondata) _err(5);\n // finishing or finished\n if (this.d & 2) this.ondata(_err(4 + (this.d & 1) * 8, 0, 1), null, false);else {\n var f = strToU8(file.filename),\n fl_1 = f.length;\n var com = file.comment,\n o = com && strToU8(com);\n var u = fl_1 != file.filename.length || o && com.length != o.length;\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535) this.ondata(_err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function pAll_1() {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function t() {\n if (file.terminate) file.terminate();\n },\n r: function r() {\n pAll_1();\n if (tr_1) {\n var nxt = _this.u[ind_1 + 1];\n if (nxt) nxt.r();else _this.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this.ondata(err, dat, final);\n _this.terminate();\n } else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1) uf_1.r();\n tr_1 = 1;\n } else if (tr_1) pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this = this;\n if (this.d & 2) {\n this.ondata(_err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d) this.e();else this.u.push({\n r: function r() {\n if (!(_this.d & 1)) return;\n _this.u.splice(-1, 1);\n _this.e();\n },\n t: function t() {}\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0,\n l = 0,\n tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}();\n\nfunction zip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n var r = {};\n _fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length,\n o = 0,\n tot = 0;\n var slft = lft,\n files = new Array(lft);\n var term = [];\n var tAll = function tAll() {\n for (var i = 0; i < term.length; ++i) term[i]();\n };\n var cbd = function cbd(a, b) {\n mt(function () {\n cb(a, b);\n });\n };\n mt(function () {\n cbd = cb;\n });\n var cbf = function cbf() {\n var out = new u8(tot + 22),\n oe = o,\n cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n } catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft) cbf();\n var _loop_1 = function _loop_1(i) {\n var fn = k[i];\n var _a = r[fn],\n file = _a[0],\n p = _a[1];\n var c = crc(),\n size = file.length;\n c.p(file);\n var f = strToU8(fn),\n s = f.length;\n var com = p.comment,\n m = com && strToU8(com),\n ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function cbl(e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n } else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || m && com.length != ms,\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (! --lft) cbf();\n }\n };\n if (s > 65535) cbl(_err(11, 0, 1), null);\n if (!compression) cbl(null, file);else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n } catch (e) {\n cbl(e, null);\n }\n } else term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nfunction zipSync(data, opts) {\n if (!opts) opts = {};\n var r = {};\n var files = [];\n _fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn],\n file = _a[0],\n p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn),\n s = f.length;\n var com = p.comment,\n m = com && strToU8(com),\n ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535) _err(11);\n var d = compression ? deflateSync(file, p) : file,\n l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || m && com.length != ms,\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22),\n oe = o,\n cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/function () {\n function UnzipPassThrough() {}\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}();\n\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this = this;\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n } catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n } else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate) data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}();\n\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this = this;\n if (!this.onfile) _err(5);\n if (!this.p) _err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d) this.d.push(toAdd, !this.c);else this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length) return this.push(chunk, final);\n } else {\n var f = 0,\n i = 0,\n is = void 0,\n buf = void 0;\n if (!this.p.length) buf = chunk;else if (!chunk.length) buf = this.p;else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length,\n oc = this.c,\n add = oc && this.d;\n var _loop_2 = function _loop_2() {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6),\n cmp_1 = b2(buf, i + 8),\n u = bf & 2048,\n dd = bf & 8,\n fnl = b2(buf, i + 26),\n es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18),\n su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n } else if (dd) sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function start() {\n if (!file_1.ondata) _err(5);\n if (!sc_1) file_1.ondata(null, et, true);else {\n var ctr = _this.o[cmp_1];\n if (!ctr) file_1.ondata(_err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) {\n file_1.ondata(err, dat, final);\n };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this.k[0] == chks_3 && _this.c) _this.d = d_1;else d_1.push(et, true);\n }\n },\n terminate: function terminate() {\n if (d_1 && d_1.terminate) d_1.terminate();\n }\n };\n if (sc_1 >= 0) file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n } else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n } else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\") break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add) add.push(dat, !!f);else this.k[+(f == 2)].push(dat);\n }\n if (f & 2) return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c) _err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}();\n\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) {\n fn();\n};\nfunction unzip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n var term = [];\n var tAll = function tAll() {\n for (var i = 0; i < term.length; ++i) term[i]();\n };\n var files = {};\n var cbd = function cbd(a, b) {\n mt(function () {\n cb(a, b);\n });\n };\n mt(function () {\n cbd = cb;\n });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(_err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function _loop_3(i) {\n var _a = zh(data, o, z),\n c_1 = _a[0],\n sc = _a[1],\n su = _a[2],\n fn = _a[3],\n no = _a[4],\n off = _a[5],\n b = slzh(data, off);\n o = no;\n var cbl = function cbl(e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n } else {\n if (d) files[fn] = d;\n if (! --lft) cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1) cbl(null, slc(data, b, b + sc));else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n // Synchronously decompress under 512KB, or barely-compressed data\n if (su < 524288 || sc > 0.8 * su) {\n try {\n cbl(null, inflateSync(infl, {\n out: new u8(su)\n }));\n } catch (e) {\n cbl(e, null);\n }\n } else term.push(inflate(infl, {\n size: su\n }, cbl));\n } else cbl(_err(14, 'unknown compression type ' + c_1, 1), null);\n } else cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n } else cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nfunction unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) _err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c) return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z),\n c_2 = _a[0],\n sc = _a[1],\n su = _a[2],\n fn = _a[3],\n no = _a[4],\n off = _a[5],\n b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2) files[fn] = slc(data, b, b + sc);else if (c_2 == 8) files[fn] = inflateSync(data.subarray(b, b + sc), {\n out: new u8(su)\n });else _err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/eslint-loader??ref--13-0!./packages/utils/StreamLoaderParser.worker.js\n\nself.__streamLoaderStates = self.__streamLoaderStates || new Map();\nvar utf8Decoder = new TextDecoder('utf-8');\nself.onmessage = function (e) {\n var _e$data = e.data,\n id = _e$data.id,\n type = _e$data.type,\n data = _e$data.data;\n if (type === 'parseBufferData') {\n try {\n var buffer = data.buffer,\n prefixIdKey = data.prefixIdKey;\n var result = parseBufferData(buffer, prefixIdKey);\n // Transfer the buffer back if possible, but we constructed new arrays.\n // We rely on structured cloning.\n self.postMessage({\n id: id,\n type: 'success',\n result: result\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamInit') {\n try {\n var _ref = data || {},\n streamId = _ref.streamId,\n _prefixIdKey = _ref.prefixIdKey;\n if (!streamId) throw new Error('Missing streamId');\n var state = createStreamState(_prefixIdKey);\n self.__streamLoaderStates.set(streamId, state);\n self.postMessage({\n id: id,\n type: 'success',\n result: true\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamPush') {\n try {\n var _ref2 = data || {},\n _streamId = _ref2.streamId,\n chunk = _ref2.chunk,\n _ref2$byteOffset = _ref2.byteOffset,\n byteOffset = _ref2$byteOffset === void 0 ? 0 : _ref2$byteOffset,\n byteLength = _ref2.byteLength,\n _prefixIdKey2 = _ref2.prefixIdKey;\n if (!_streamId) throw new Error('Missing streamId');\n var _state = self.__streamLoaderStates.get(_streamId);\n if (!_state) {\n _state = createStreamState(_prefixIdKey2);\n self.__streamLoaderStates.set(_streamId, _state);\n }\n var view = new Uint8Array(chunk, byteOffset, byteLength !== null && byteLength !== void 0 ? byteLength : chunk.byteLength - byteOffset);\n var _result = parseStreamChunk(_state, view);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamFlush') {\n try {\n var _ref3 = data || {},\n _streamId2 = _ref3.streamId;\n if (!_streamId2) throw new Error('Missing streamId');\n var _state2 = self.__streamLoaderStates.get(_streamId2);\n if (!_state2) {\n self.postMessage({\n id: id,\n type: 'success',\n result: {\n meshes: [],\n primitives: []\n }\n });\n return;\n }\n var _result2 = parseStreamChunk(_state2, null, true);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result2\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamDispose') {\n try {\n var _ref4 = data || {},\n _streamId3 = _ref4.streamId;\n if (_streamId3) self.__streamLoaderStates.delete(_streamId3);\n self.postMessage({\n id: id,\n type: 'success',\n result: true\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'buildInstancedMapping') {\n try {\n var _ref5 = data || {},\n instances = _ref5.instances,\n drawObjs = _ref5.drawObjs;\n var _result3 = buildInstancedMapping(instances || [], drawObjs || []);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result3\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'occlusionScan') {\n var transfer = data && data.buffer ? [data.buffer] : [];\n try {\n var _ref6 = data || {},\n _buffer = _ref6.buffer,\n sw = _ref6.sw,\n sh = _ref6.sh,\n stride = _ref6.stride,\n maxIdx = _ref6.maxIdx,\n minSampleCount = _ref6.minSampleCount;\n var _result4 = scanOcclusionBuffer(_buffer, sw, sh, stride, maxIdx, minSampleCount);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result4,\n buffer: _buffer\n }, transfer);\n } catch (error) {\n var _buffer2 = data && data.buffer ? data.buffer : null;\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message,\n buffer: _buffer2\n }, transfer);\n }\n }\n};\nfunction createStreamState(prefixIdKey) {\n return {\n prefixIdKey: prefixIdKey || '',\n buffer: new Uint8Array(),\n pendingPrimitives: new Map(),\n expectingPrimitive: true,\n isFullProps: true\n };\n}\nfunction parseStreamChunk(state, chunkView) {\n var flushing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n if (chunkView && chunkView.length > 0) {\n var merged = new Uint8Array(state.buffer.length + chunkView.length);\n merged.set(state.buffer);\n merged.set(chunkView, state.buffer.length);\n state.buffer = merged;\n }\n var meshes = [];\n var primitives = [];\n while (state.buffer.length > 0) {\n if (state.expectingPrimitive) {\n if (state.buffer.length < 12) break;\n try {\n var dataView = new DataView(state.buffer.buffer, state.buffer.byteOffset, state.buffer.byteLength);\n var primitiveResult = parsePrimitive(dataView, state.buffer, 0, state.isFullProps);\n var primitiveData = primitiveResult.primitive;\n _applyPrefixId(primitiveData, 'id', null, state.prefixIdKey);\n _applyPrefixId(primitiveData, 'material', null, state.prefixIdKey);\n if (state.isFullProps) {\n var _parsePrimitiveData = parsePrimitiveData(primitiveData),\n position = _parsePrimitiveData.position,\n normal = _parsePrimitiveData.normal,\n posindex = _parsePrimitiveData.posindex,\n nolindex = _parsePrimitiveData.nolindex,\n indices = _parsePrimitiveData.indices;\n var formatted = formatPrimitiveData({\n position: position,\n normal: normal,\n posindex: posindex,\n nolindex: nolindex\n });\n delete primitiveData.nolindex;\n delete primitiveData.posindex;\n primitiveData.position = formatted.position;\n primitiveData.normal = formatted.normal;\n primitiveData.indices = indices;\n }\n state.pendingPrimitives.set(primitiveData.id, primitiveData);\n state.expectingPrimitive = false;\n state.buffer = state.buffer.slice(primitiveResult.offset);\n } catch (e) {\n break;\n }\n } else {\n if (state.buffer.length < 4) break;\n var length = new DataView(state.buffer.buffer, state.buffer.byteOffset).getUint32(0, false);\n if (length > 10 * 1024 * 1024) {\n state.expectingPrimitive = true;\n continue;\n }\n var totalLen = 4 + length;\n if (state.buffer.length < totalLen) break;\n var data = state.buffer.slice(4, totalLen);\n var mesh = null;\n try {\n var jsonStr = utf8Decoder.decode(data);\n mesh = JSON.parse(jsonStr);\n } catch (e) {\n state.expectingPrimitive = true;\n continue;\n }\n if (mesh) {\n state.isFullProps = true;\n _applyPrefixId(mesh, 'id', null, state.prefixIdKey);\n if (Array.isArray(mesh)) {\n mesh.forEach(function (item) {\n _applyPrefixId(item.primitives, 'prmid', item.documentId, state.prefixIdKey);\n });\n } else {\n _applyPrefixId(mesh.primitives, 'prmid', mesh.documentId, state.prefixIdKey);\n }\n var docId = mesh.id;\n var meshToPrimId = mesh.primitives.map(function (item) {\n return item.prmid;\n });\n var hasPendingPrimitive = meshToPrimId.some(function (item) {\n return state.pendingPrimitives.has(item);\n });\n var hasPendingMesh = state.pendingPrimitives.has(docId);\n if (hasPendingMesh || hasPendingPrimitive) {\n var _primitiveData = state.pendingPrimitives.get(docId);\n if (!hasPendingMesh && hasPendingPrimitive) {\n _primitiveData = state.pendingPrimitives.get(meshToPrimId[0]);\n }\n meshes.push(mesh);\n primitives.push(_primitiveData);\n }\n state.expectingPrimitive = false;\n state.buffer = state.buffer.slice(totalLen);\n }\n }\n }\n if (flushing) {\n state.buffer = new Uint8Array();\n }\n return {\n meshes: meshes,\n primitives: primitives\n };\n}\nfunction parseBufferData(buffer, prefixIdKey) {\n var uint8Array = null;\n var dataView = null;\n var meshJsonBytes = null;\n var primitives = [];\n var mesh = null;\n try {\n uint8Array = new Uint8Array(buffer);\n dataView = new DataView(buffer);\n var offset = 0;\n var meshJsonLength = dataView.getInt32(offset, false);\n offset += 4;\n meshJsonBytes = new Uint8Array(uint8Array.buffer.slice(offset, offset + meshJsonLength));\n offset += meshJsonLength;\n var meshJsonStr = utf8Decoder.decode(meshJsonBytes);\n meshJsonBytes = null;\n try {\n mesh = JSON.parse(meshJsonStr);\n _applyPrefixId(mesh, 'id', null, prefixIdKey);\n if (Array.isArray(mesh)) {\n mesh.forEach(function (item) {\n _applyPrefixId(item.primitives, 'prmid', item.documentId, prefixIdKey);\n });\n } else {\n _applyPrefixId(mesh.primitives, 'prmid', mesh.documentId, prefixIdKey);\n }\n } catch (e) {\n console.error('JSON 解析失败:', e, meshJsonStr);\n throw new Error('JSON解析失败');\n }\n while (offset < uint8Array.length) {\n try {\n var result = parsePrimitive(dataView, uint8Array, offset);\n if (!result) break;\n primitives.push(result.primitive);\n offset = result.offset;\n } catch (e) {\n console.error('解析失败,偏移:', offset, e);\n break;\n }\n }\n for (var i = 0; i < primitives.length; i++) {\n var primitive = primitives[i];\n _applyPrefixId(primitive, 'id', null, prefixIdKey);\n _applyPrefixId(primitive, 'material', null, prefixIdKey);\n var _parsePrimitiveData2 = parsePrimitiveData(primitive),\n position = _parsePrimitiveData2.position,\n normal = _parsePrimitiveData2.normal,\n posindex = _parsePrimitiveData2.posindex,\n nolindex = _parsePrimitiveData2.nolindex,\n indices = _parsePrimitiveData2.indices;\n var formatted = formatPrimitiveData({\n position: position,\n normal: normal,\n posindex: posindex,\n nolindex: nolindex\n });\n delete primitive.nolindex;\n delete primitive.posindex;\n primitive.position = formatted.position;\n primitive.normal = formatted.normal;\n primitive.indices = indices;\n }\n return {\n mesh: mesh,\n primitives: primitives\n };\n } catch (error) {\n throw error;\n }\n}\nfunction _applyPrefixId(target, propKey, customPrefixId, prefixIdKey) {\n if (!prefixIdKey || !target) return;\n if (Array.isArray(target)) {\n target.forEach(function (item) {\n var prefixId = customPrefixId || item[prefixIdKey];\n if (item && prefixId && item[propKey] != null) {\n item[propKey] = \"\".concat(item[propKey], \":\").concat(prefixId);\n }\n });\n } else if ((customPrefixId || target[prefixIdKey]) && target[propKey] != null) {\n var prefixId = customPrefixId || target[prefixIdKey];\n target[propKey] = \"\".concat(target[propKey], \":\").concat(prefixId);\n }\n}\nfunction parsePrimitive(dataView, uint8Array, offset) {\n var isFullProps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n var primitive = {};\n if (dataView.byteLength < offset + 12) {\n throw new Error('Insufficient data for primitive header');\n }\n primitive.id = dataView.getInt32(offset, false);\n offset += 4;\n if (dataView.byteLength < offset + 4) {\n throw new Error('Insufficient data for GeomText length');\n }\n var documentTextLen = dataView.getUint32(offset, false);\n offset += 4;\n if (documentTextLen === 0xffffffff) {\n primitive.documentId = null;\n } else if (documentTextLen > 0) {\n if (dataView.byteLength < offset + documentTextLen) {\n throw new Error('Insufficient data for GeomText content');\n }\n var textBytes = uint8Array.subarray(offset, offset + documentTextLen);\n primitive.documentId = utf8Decoder.decode(textBytes);\n offset += documentTextLen;\n } else {\n primitive.documentId = '';\n }\n primitive.material = dataView.getInt32(offset, false);\n offset += 4;\n if (dataView.byteLength < offset + 4) {\n throw new Error('Insufficient data for GeomText length');\n }\n var geomTextLen = dataView.getUint32(offset, false);\n offset += 4;\n if (geomTextLen === 0xffffffff) {\n primitive.geomText = null;\n } else if (geomTextLen > 0) {\n if (dataView.byteLength < offset + geomTextLen) {\n throw new Error('Insufficient data for GeomText content');\n }\n var _textBytes = uint8Array.subarray(offset, offset + geomTextLen);\n primitive.geomText = utf8Decoder.decode(_textBytes);\n offset += geomTextLen;\n } else {\n primitive.geomText = '';\n }\n primitive.isCompressed = dataView.getInt32(offset, false);\n offset += 4;\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Position length');\n var positionLen = dataView.getUint32(offset, false);\n offset += 4;\n if (positionLen === 0xffffffff) {\n primitive.position = null;\n } else {\n if (dataView.byteLength < offset + positionLen) throw new Error('Insufficient data for Position content');\n primitive.position = uint8Array.subarray(offset, offset + positionLen);\n offset += positionLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Normal length');\n var normalLen = dataView.getUint32(offset, false);\n offset += 4;\n if (normalLen === 0xffffffff) {\n primitive.normal = null;\n } else {\n if (dataView.byteLength < offset + normalLen) throw new Error('Insufficient data for Normal content');\n primitive.normal = uint8Array.subarray(offset, offset + normalLen);\n offset += normalLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Indices length');\n var indicesLen = dataView.getUint32(offset, false);\n offset += 4;\n if (indicesLen === 0xffffffff) {\n primitive.indices = null;\n } else {\n if (dataView.byteLength < offset + indicesLen) throw new Error('Insufficient data for Indices content');\n primitive.indices = uint8Array.subarray(offset, offset + indicesLen);\n offset += indicesLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Posindex length');\n var posindexLen = dataView.getUint32(offset, false);\n offset += 4;\n if (posindexLen === 0xffffffff) {\n primitive.posindex = null;\n } else {\n if (dataView.byteLength < offset + posindexLen) throw new Error('Insufficient data for Posindex content');\n primitive.posindex = uint8Array.subarray(offset, offset + posindexLen);\n offset += posindexLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Nolindex length');\n var nolindexLen = dataView.getUint32(offset, false);\n offset += 4;\n if (nolindexLen === 0xffffffff) {\n primitive.nolindex = null;\n } else {\n if (dataView.byteLength < offset + nolindexLen) throw new Error('Insufficient data for Nolindex content');\n primitive.nolindex = uint8Array.subarray(offset, offset + nolindexLen);\n offset += nolindexLen;\n }\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for DataType length');\n var dataTypeLen = dataView.getUint32(offset, false);\n offset += 4;\n if (dataTypeLen === 0xffffffff) {\n primitive.dataType = null;\n } else if (dataTypeLen > 0) {\n if (dataView.byteLength < offset + dataTypeLen) throw new Error('Insufficient data for DataType content');\n var _textBytes2 = uint8Array.subarray(offset, offset + dataTypeLen);\n primitive.dataType = utf8Decoder.decode(_textBytes2);\n offset += dataTypeLen;\n } else {\n primitive.dataType = '';\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Min count');\n var minCount = dataView.getUint32(offset, false);\n offset += 4;\n if (minCount === 0xffffffff) {\n primitive.min = null;\n } else {\n if (dataView.byteLength < offset + minCount * 8) throw new Error('Insufficient data for Min values');\n primitive.min = [];\n for (var i = 0; i < minCount; i++) {\n primitive.min.push(dataView.getFloat64(offset, false));\n offset += 8;\n }\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Max count');\n var maxCount = dataView.getUint32(offset, false);\n offset += 4;\n if (maxCount === 0xffffffff) {\n primitive.max = null;\n } else {\n if (dataView.byteLength < offset + maxCount * 8) throw new Error('Insufficient data for Max values');\n primitive.max = [];\n for (var _i = 0; _i < maxCount; _i++) {\n primitive.max.push(dataView.getFloat64(offset, false));\n offset += 8;\n }\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for GeomType');\n primitive.geomType = dataView.getInt32(offset, false);\n offset += 4;\n return {\n primitive: primitive,\n offset: offset\n };\n}\nfunction parsePrimitiveData(primitive) {\n var keyOrder = ['position', 'normal', 'indices', 'posindex', 'nolindex'];\n var typeMap = {\n 0: {\n bytes: 4,\n getter: 'getFloat32'\n },\n 1: {\n bytes: 4,\n getter: 'getInt32'\n },\n 2: {\n bytes: 2,\n getter: 'getInt16'\n }\n };\n var parsedResult = {};\n var dataTypeString = primitive.dataType;\n for (var i = 0; i < keyOrder.length; i++) {\n var key = keyOrder[i];\n var typeCode = dataTypeString[i];\n var typeInfo = typeMap[typeCode];\n var uint8Array = primitive.isCompressed === 1 || primitive.isCompressed === undefined ? gunzipSync(primitive[key]) : primitive[key];\n if (!typeInfo || !uint8Array) {\n // console.warn(`无法找到键 \"${key}\" 或其类型定义,已跳过。`);\n parsedResult[key] = [];\n continue;\n }\n var result_array = [];\n var dataView = new DataView(uint8Array.buffer, uint8Array.byteOffset, uint8Array.byteLength);\n var littleEndian = true;\n for (var byteOffset = 0; byteOffset < dataView.byteLength; byteOffset += typeInfo.bytes) {\n if (byteOffset + typeInfo.bytes > dataView.byteLength) {\n console.warn(\"\\u952E \\\"\".concat(key, \"\\\" \\u7684\\u6570\\u636E\\u957F\\u5EA6 (\").concat(dataView.byteLength, \") \\u4E0D\\u662F\\u5176\\u7C7B\\u578B (\").concat(typeInfo.bytes, \"\\u5B57\\u8282) \\u7684\\u6574\\u6570\\u500D\\uFF0C\\u672B\\u5C3E\\u6570\\u636E\\u53EF\\u80FD\\u4E0D\\u5B8C\\u6574\\u3002\"));\n break;\n }\n var value = dataView[typeInfo.getter](byteOffset, littleEndian);\n result_array.push(value);\n }\n parsedResult[key] = result_array;\n }\n return parsedResult;\n}\nfunction formatPrimitiveData(primitive) {\n var position = primitive.position,\n normal = primitive.normal,\n posindex = primitive.posindex,\n nolindex = primitive.nolindex;\n var restoredPosition = new Array(posindex.length);\n var restoredNormal = new Array(nolindex.length);\n for (var i = 0; i < posindex.length; i++) {\n var posIndex = posindex[i];\n restoredPosition[i] = position[posIndex];\n }\n for (var _i2 = 0; _i2 < nolindex.length; _i2++) {\n var normalIndex = nolindex[_i2];\n restoredNormal[_i2] = normal[normalIndex];\n }\n primitive.position = null;\n primitive.normal = null;\n primitive.posindex = null;\n primitive.nolindex = null;\n return {\n position: restoredPosition,\n normal: restoredNormal\n };\n}\nfunction buildInstancedMapping(instances, drawObjs) {\n var drawObjMapInstance = {};\n var instanceToDrawObject = [];\n var meshByPrimId = new Map();\n for (var i = 0; i < drawObjs.length; i++) {\n var item = drawObjs[i];\n if (!item || !Array.isArray(item.geoms)) continue;\n var geoms = item.geoms;\n for (var j = 0; j < geoms.length; j++) {\n var geom = geoms[j];\n if (geom && geom.prmid !== undefined && geom.prmid !== null) {\n meshByPrimId.set(geom.prmid, geoms);\n }\n }\n }\n var seenByDrawObject = new Map();\n for (var _i3 = 0; _i3 < instances.length; _i3++) {\n var instance = instances[_i3];\n if (!instance) continue;\n var drawObject = instance.drawObject;\n if (!drawObject) continue;\n instanceToDrawObject.push({\n instanceId: instance.instanceId,\n drawObjectId: drawObject\n });\n var record = drawObjMapInstance[drawObject];\n if (!record) {\n record = {\n MapInstance: [],\n MapMesh: meshByPrimId.get(drawObject)\n };\n drawObjMapInstance[drawObject] = record;\n seenByDrawObject.set(drawObject, new Set());\n }\n var seen = seenByDrawObject.get(drawObject);\n if (!seen.has(instance.instanceId)) {\n record.MapInstance.push(instance);\n seen.add(instance.instanceId);\n }\n }\n return {\n drawObjMapInstance: drawObjMapInstance,\n instanceToDrawObject: instanceToDrawObject\n };\n}\nfunction scanOcclusionBuffer(buffer, sw, sh, stride, maxIdx, minSampleCount) {\n var indices = [];\n if (!buffer || !sw || !sh || !maxIdx) return {\n indices: indices\n };\n var view = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n var step = Math.max(1, stride || 1);\n var minCount = Math.max(1, minSampleCount || 1);\n var counts = new Uint32Array(maxIdx + 1);\n for (var y = 0; y < sh; y += step) {\n var row = y * sw * 4;\n for (var x = 0; x < sw; x += step) {\n var p = row + x * 4;\n var idxColor = view[p] + (view[p + 1] << 8) + (view[p + 2] << 16);\n if (idxColor > 0 && idxColor <= maxIdx) {\n var next = counts[idxColor] + 1;\n counts[idxColor] = next;\n if (next === minCount) {\n indices.push(idxColor);\n }\n }\n }\n }\n return {\n indices: indices\n };\n}\n\n/***/ })\n\n/******/ });\n", "Worker", undefined, undefined);
111434
+ return inline_default()("/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"f538\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"f538\":\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// CONCATENATED MODULE: ./node_modules/fflate/esm/browser.js\n// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = function wk(c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'], {\n type: 'text/javascript'\n }))));\n w.onmessage = function (e) {\n var d = e.data,\n ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n } else cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n};\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array,\n u16 = Uint16Array,\n i32 = Int32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */0, 0, /* impossible */0]);\n// fixed distance extra bits\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function freb(eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new i32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = j - b[i] << 5 | i;\n }\n }\n return {\n b: b,\n r: r\n };\n};\nvar _a = freb(fleb, 2),\n fl = _a.b,\n revfl = _a.r;\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0),\n fd = _b.b,\n revfd = _b.r;\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var browser_i = 0; browser_i < 32768; ++browser_i) {\n // reverse table algorithm from SO\n var x = (browser_i & 0xAAAA) >> 1 | (browser_i & 0x5555) << 1;\n x = (x & 0xCCCC) >> 2 | (x & 0x3333) << 2;\n x = (x & 0xF0F0) >> 4 | (x & 0x0F0F) << 4;\n rev[browser_i] = ((x & 0xFF00) >> 8 | (x & 0x00FF) << 8) >> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = function hMap(cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i]) ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 1; i < mb; ++i) {\n le[i] = le[i - 1] + l[i - 1] << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = i << 4 | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | (1 << r_1) - 1; v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >> rvb] = sv;\n }\n }\n }\n } else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];\n }\n }\n }\n return co;\n};\n// fixed length tree\nvar flt = new u8(288);\nfor (var browser_i = 0; browser_i < 144; ++browser_i) flt[browser_i] = 8;\nfor (var browser_i = 144; browser_i < 256; ++browser_i) flt[browser_i] = 9;\nfor (var browser_i = 256; browser_i < 280; ++browser_i) flt[browser_i] = 7;\nfor (var browser_i = 280; browser_i < 288; ++browser_i) flt[browser_i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var browser_i = 0; browser_i < 32; ++browser_i) fdt[browser_i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/hMap(flt, 9, 0),\n flrm = /*#__PURE__*/hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/hMap(fdt, 5, 0),\n fdrm = /*#__PURE__*/hMap(fdt, 5, 1);\n// find max of array\nvar max = function max(a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m) m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function bits(d, p, m) {\n var o = p / 8 | 0;\n return (d[o] | d[o + 1] << 8) >> (p & 7) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function bits16(d, p) {\n var o = p / 8 | 0;\n return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);\n};\n// get end of byte\nvar shft = function shft(p) {\n return (p + 7) / 8 | 0;\n};\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function slc(v, s, e) {\n if (s == null || s < 0) s = 0;\n if (e == null || e > v.length) e = v.length;\n // can't use .constructor in case user-supplied\n return new u8(v.subarray(s, e));\n};\n/**\n * Codes for errors generated within this library\n */\nvar FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = ['unexpected EOF', 'invalid block type', 'invalid length/literal', 'invalid distance', 'stream finished', 'no stream handler',, 'no callback', 'invalid UTF-8 data', 'extra field too long', 'date not in range 1980-2099', 'filename too long', 'stream finishing', 'invalid zip data'\n// determined by unknown compression method\n];\n;\nvar _err = function err(ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace) Error.captureStackTrace(e, _err);\n if (!nt) throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function inflt(dat, st, buf, dict) {\n // source length dict length\n var sl = dat.length,\n dl = dict ? dict.length : 0;\n if (!sl || st.f && !st.l) return buf || new u8(0);\n var noBuf = !buf;\n // have to estimate size\n var resize = noBuf || st.i != 2;\n // no state\n var noSt = st.i;\n // Assumes roughly 33% compression ratio average\n if (noBuf) buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function cbuf(l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0,\n pos = st.p || 0,\n bt = st.b || 0,\n lm = st.l,\n dm = st.d,\n lbt = st.m,\n dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4,\n l = dat[s - 4] | dat[s - 3] << 8,\n t = s + l;\n if (t > sl) {\n if (noSt) _err(0);\n break;\n }\n // ensure size\n if (resize) cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n } else if (type == 1) lm = flrm, dm = fdrm, lbt = 9, dbt = 5;else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257,\n hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt),\n clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n } else {\n // copy count\n var c = 0,\n n = 0;\n if (s == 16) n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];else if (s == 17) n = 3 + bits(dat, pos, 7), pos += 3;else if (s == 18) n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--) ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit),\n dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n } else _err(1);\n if (pos > tbts) {\n if (noSt) _err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17\n if (resize) cbuf(bt + 131072);\n var lms = (1 << lbt) - 1,\n dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms],\n sym = c >> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt) _err(0);\n break;\n }\n if (!c) _err(2);\n if (sym < 256) buf[bt++] = sym;else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n } else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257,\n b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms],\n dsym = d >> 4;\n if (!d) _err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & (1 << b) - 1, pos += b;\n }\n if (pos > tbts) {\n if (noSt) _err(0);\n break;\n }\n if (resize) cbuf(bt + 131072);\n var end = bt + add;\n if (bt < dt) {\n var shift = dl - dt,\n dend = Math.min(dt, end);\n if (shift + bt < 0) _err(3);\n for (; bt < dend; ++bt) buf[bt] = dict[shift + bt];\n }\n for (; bt < end; ++bt) buf[bt] = buf[bt - dt];\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n // don't reallocate for streams or user buffers\n return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function wbits(d, p, v) {\n v <<= p & 7;\n var o = p / 8 | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function wbits16(d, p, v) {\n v <<= p & 7;\n var o = p / 8 | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n d[o + 2] |= v >> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function hTree(d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i]) t.push({\n s: i,\n f: d[i]\n });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s) return {\n t: et,\n l: 0\n };\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return {\n t: v,\n l: 1\n };\n }\n t.sort(function (a, b) {\n return a.f - b.f;\n });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({\n s: -1,\n f: 25001\n });\n var l = t[0],\n r = t[1],\n i0 = 0,\n i1 = 1,\n i2 = 2;\n t[0] = {\n s: -1,\n f: l.f + r.f,\n l: l,\n r: r\n };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = {\n s: -1,\n f: l.f + r.f,\n l: l,\n r: r\n };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym) maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = _ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0,\n dt = 0;\n // left cost\n var lft = mbt - mb,\n cst = 1 << lft;\n t2.sort(function (a, b) {\n return tr[b.s] - tr[a.s] || a.f - b.f;\n });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << mbt - tr[i2_1]);\n tr[i2_1] = mb;\n } else break;\n }\n dt >>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb) dt -= 1 << mb - tr[i2_2]++ - 1;else ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return {\n t: new u8(tr),\n l: mbt\n };\n};\n// get the max length and assign length codes\nvar _ln = function ln(n, l, d) {\n return n.s == -1 ? Math.max(_ln(n.l, l, d + 1), _ln(n.r, l, d + 1)) : l[n.s] = d;\n};\n// length codes generation\nvar lc = function lc(c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s]);\n var cl = new u16(++s);\n // ind num streak\n var cli = 0,\n cln = c[0],\n cls = 1;\n var w = function w(v) {\n cl[cli++] = v;\n };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s) ++cls;else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138) w(32754);\n if (cls > 2) {\n w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);\n cls = 0;\n }\n } else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6) w(8304);\n if (cls > 2) w(cls - 3 << 5 | 8208), cls = 0;\n }\n while (cls--) w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return {\n c: cl.subarray(0, cli),\n n: s\n };\n};\n// calculate the length of output from tree, code lengths\nvar clen = function clen(cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i) l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function wfblk(out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i) out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function wblk(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15),\n dlt = _a.t,\n mlb = _a.l;\n var _b = hTree(df, 15),\n ddt = _b.t,\n mdb = _b.l;\n var _c = lc(dlt),\n lclt = _c.c,\n nlc = _c.n;\n var _d = lc(ddt),\n lcdt = _d.c,\n ndc = _d.n;\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i) ++lcfreq[lclt[i] & 31];\n for (var i = 0; i < lcdt.length; ++i) ++lcfreq[lcdt[i] & 31];\n var _e = hTree(lcfreq, 7),\n lct = _e.t,\n mlcb = _e.l;\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc);\n var flen = bl + 5 << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];\n if (bs >= 0 && flen <= ftlen && flen <= dtlen) return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i) wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15) wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;\n }\n }\n } else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n var sym = syms[i];\n if (sym > 255) {\n var len = sym >> 18 & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7) wbits(out, p, sym >> 23 & 31), p += fleb[len];\n var dst = sym & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3) wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];\n } else {\n wbits16(out, p, lm[sym]), p += ll[sym];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function dflt(dat, lvl, plvl, pre, post, st) {\n var s = st.z || dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var lst = st.l;\n var pos = (st.r || 0) & 7;\n if (lvl) {\n if (pos) w[0] = st.r >> 3;\n var opt = deo[lvl - 1];\n var n = opt >> 13,\n c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = st.p || new u16(32768),\n head = st.h || new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3),\n bs2_1 = 2 * bs1_1;\n var hsh = function hsh(i) {\n return (dat[i] ^ dat[i + 1] << bs1_1 ^ dat[i + 2] << bs2_1) & msk_1;\n };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new i32(25000);\n // length/literal freq distance freq\n var lf = new u16(288),\n df = new u16(32);\n // l/lcnt exbits index l/lind waitdx blkpos\n var lc_1 = 0,\n eb = 0,\n i = st.i || 0,\n li = 0,\n wi = st.w || 0,\n bs = 0;\n for (; i + 2 < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767,\n pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j) lf[j] = 0;\n for (var j = 0; j < 30; ++j) df[j] = 0;\n }\n // len dist chain\n var l = 2,\n d = 0,\n ch_1 = c,\n dif = imod - pimod & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl);\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn) break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = i - dif + j & 32767;\n var pti = prev[ti];\n var cd = ti - pti & 32767;\n if (cd > md) md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += imod - pimod & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one int32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];\n var lin = revfl[l] & 31,\n din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n } else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n for (i = Math.max(i, wi); i < s; ++i) {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n if (!lst) {\n st.r = pos & 7 | w[pos / 8 | 0] << 3;\n // shft(pos) now 1 less if pos & 7 != 0\n pos -= 7;\n st.h = head, st.p = prev, st.i = i, st.w = wi;\n }\n } else {\n for (var i = st.w || 0; i < s + lst; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[pos / 8 | 0] = lst;\n e = s;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n st.i = s;\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i,\n k = 9;\n while (--k) c = (c & 1 && -306674912) ^ c >>> 1;\n t[i] = c;\n }\n return t;\n}();\n// CRC32\nvar crc = function crc() {\n var c = -1;\n return {\n p: function p(d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i) cr = crct[cr & 255 ^ d[i]] ^ cr >>> 8;\n c = cr;\n },\n d: function d() {\n return ~c;\n }\n };\n};\n// Adler32\nvar adler = function adler() {\n var a = 1,\n b = 0;\n return {\n p: function p(d) {\n // closures have awful performance\n var n = a,\n m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i) m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function d() {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | b >> 8;\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function dopt(dat, opt, pre, post, st) {\n if (!st) {\n st = {\n l: 1\n };\n if (opt.dictionary) {\n var dict = opt.dictionary.subarray(-32768);\n var newDat = new u8(dict.length + dat.length);\n newDat.set(dict);\n newDat.set(dat, dict.length);\n dat = newDat;\n st.w = dict.length;\n }\n }\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);\n};\n// Walmart object spread\nvar mrg = function mrg(a, b) {\n var o = {};\n for (var k in a) o[k] = a[k];\n for (var k in b) o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function wcln(fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i],\n k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n } else {\n fnStr += st_1;\n for (var t in v.prototype) fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n } else fnStr += st_1;\n } else td[k] = v;\n }\n return fnStr;\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function cbfs(v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function wrkr(fns, init, id, cb) {\n if (!ch[id]) {\n var fnStr = '',\n td_1 = {},\n m = fns.length - 1;\n for (var i = 0; i < m; ++i) fnStr = wcln(fns[i], fnStr, td_1);\n ch[id] = {\n c: wcln(fns[m], fnStr, td_1),\n e: td_1\n };\n }\n var td = mrg({}, ch[id].e);\n return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function bInflt() {\n return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, _err, inflt, inflateSync, pbf, gopt];\n};\nvar bDflt = function bDflt() {\n return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, _ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf];\n};\n// gzip extra\nvar gze = function gze() {\n return [gzh, gzhl, wbytes, crc, crct];\n};\n// gunzip extra\nvar guze = function guze() {\n return [gzs, gzl];\n};\n// zlib extra\nvar zle = function zle() {\n return [zlh, wbytes, adler];\n};\n// unzlib extra\nvar zule = function zule() {\n return [zls];\n};\n// post buf\nvar pbf = function pbf(msg) {\n return postMessage(msg, [msg.buffer]);\n};\n// get opts\nvar gopt = function gopt(o) {\n return o && {\n out: o.size && new u8(o.size),\n dictionary: o.dictionary\n };\n};\n// async helper\nvar cbify = function cbify(dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () {\n w.terminate();\n };\n};\n// auto stream\nvar astrm = function astrm(strm) {\n strm.ondata = function (dat, final) {\n return postMessage([dat, final], [dat.buffer]);\n };\n return function (ev) {\n if (ev.data.length) {\n strm.push(ev.data[0], ev.data[1]);\n postMessage([ev.data[0].length]);\n } else strm.flush();\n };\n};\n// async stream attach\nvar astrmify = function astrmify(fns, strm, opts, init, id, flush, ext) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err) w.terminate(), strm.ondata.call(strm, err);else if (!Array.isArray(dat)) ext(dat);else if (dat.length == 1) {\n strm.queuedSize -= dat[0];\n if (strm.ondrain) strm.ondrain(dat[0]);\n } else {\n if (dat[1]) w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.queuedSize = 0;\n strm.push = function (d, f) {\n if (!strm.ondata) _err(5);\n if (t) strm.ondata(_err(4, 0, 1), null, !!f);\n strm.queuedSize += d.length;\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () {\n w.terminate();\n };\n if (flush) {\n strm.flush = function () {\n w.postMessage([]);\n };\n }\n};\n// read 2 bytes\nvar b2 = function b2(d, b) {\n return d[b] | d[b + 1] << 8;\n};\n// read 4 bytes\nvar b4 = function b4(d, b) {\n return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;\n};\nvar b8 = function b8(d, b) {\n return b4(d, b) + b4(d, b + 4) * 4294967296;\n};\n// write bytes\nvar wbytes = function wbytes(d, b, v) {\n for (; v; ++b) d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function gzh(c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0) wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i) c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function gzs(d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8) _err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4) st += (d[10] | d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]);\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function gzl(d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;\n};\n// gzip header length\nvar gzhl = function gzhl(o) {\n return 10 + (o.filename ? o.filename.length + 1 : 0);\n};\n// zlib header\nvar zlh = function zlh(c, o) {\n var lv = o.level,\n fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = fl << 6 | (o.dictionary && 32);\n c[1] |= 31 - (c[0] << 8 | c[1]) % 31;\n if (o.dictionary) {\n var h = adler();\n h.p(o.dictionary);\n wbytes(c, 2, h.d());\n }\n};\n// zlib start\nvar zls = function zls(d, dict) {\n if ((d[0] & 15) != 8 || d[0] >> 4 > 7 || (d[0] << 8 | d[1]) % 31) _err(6, 'invalid zlib data');\n if ((d[1] >> 5 & 1) == +!dict) _err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');\n return (d[1] >> 3 & 4) + 2;\n};\nfunction StrmOpt(opts, cb) {\n if (typeof opts == 'function') cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/function () {\n function Deflate(opts, cb) {\n if (typeof opts == 'function') cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n this.s = {\n l: 0,\n i: 32768,\n w: 32768,\n z: 32768\n };\n // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev\n // 98304 = 32768 (lookback) + 65536 (common chunk size)\n this.b = new u8(98304);\n if (this.o.dictionary) {\n var dict = this.o.dictionary.subarray(-32768);\n this.b.set(dict, 32768 - dict.length);\n this.s.i = 32768 - dict.length;\n }\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, this.s), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n if (this.s.l) _err(4);\n var endLen = chunk.length + this.s.z;\n if (endLen > this.b.length) {\n if (endLen > 2 * this.b.length - 32768) {\n var newBuf = new u8(endLen & -32768);\n newBuf.set(this.b.subarray(0, this.s.z));\n this.b = newBuf;\n }\n var split = this.b.length - this.s.z;\n this.b.set(chunk.subarray(0, split), this.s.z);\n this.s.z = this.b.length;\n this.p(this.b, false);\n this.b.set(this.b.subarray(-32768));\n this.b.set(chunk.subarray(split), 32768);\n this.s.z = chunk.length - split + 32768;\n this.s.i = 32766, this.s.w = 32768;\n } else {\n this.b.set(chunk, this.s.z);\n this.s.z += chunk.length;\n }\n this.s.l = final & 1;\n if (this.s.z > this.s.w + 8191 || final) {\n this.p(this.b, final || false);\n this.s.w = this.s.i, this.s.i -= 2;\n }\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * deflated output for small inputs.\n */\n Deflate.prototype.flush = function () {\n if (!this.ondata) _err(5);\n if (this.s.l) _err(4);\n this.p(this.b, false);\n this.s.w = this.s.i, this.s.i -= 2;\n };\n return Deflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/function () {\n function AsyncDeflate(opts, cb) {\n astrmify([bDflt, function () {\n return [astrm, Deflate];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6, 1);\n }\n return AsyncDeflate;\n}();\n\nfunction deflate(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bDflt], function (ev) {\n return pbf(deflateSync(ev.data[0], ev.data[1]));\n }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nfunction deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/function () {\n function Inflate(opts, cb) {\n // no StrmOpt here to avoid adding to workerizer\n if (typeof opts == 'function') cb = opts, opts = {};\n this.ondata = cb;\n var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);\n this.s = {\n i: 0,\n b: dict ? dict.length : 0\n };\n this.o = new u8(32768);\n this.p = new u8(0);\n if (dict) this.o.set(dict);\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata) _err(5);\n if (this.d) _err(4);\n if (!this.p.length) this.p = c;else if (c.length) {\n var n = new u8(this.p.length + c.length);\n n.set(this.p), n.set(c, this.p.length), this.p = n;\n }\n };\n Inflate.prototype.c = function (final) {\n this.s.i = +(this.d = final || false);\n var bts = this.s.b;\n var dt = inflt(this.p, this.s, this.o);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/function () {\n function AsyncInflate(opts, cb) {\n astrmify([bInflt, function () {\n return [astrm, Inflate];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Inflate(ev.data);\n onmessage = astrm(strm);\n }, 7, 0);\n }\n return AsyncInflate;\n}();\n\nfunction inflate(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bInflt], function (ev) {\n return pbf(inflateSync(ev.data[0], gopt(ev.data[1])));\n }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction inflateSync(data, opts) {\n return inflt(data, {\n i: 2\n }, opts && opts.out, opts && opts.dictionary);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n this.l += chunk.length;\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s);\n if (this.v) gzh(raw, this.o), this.v = 0;\n if (f) wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * GZIPped output for small inputs.\n */\n Gzip.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Gzip;\n}();\n\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/function () {\n function AsyncGzip(opts, cb) {\n astrmify([bDflt, gze, function () {\n return [astrm, Deflate, Gzip];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8, 1);\n }\n return AsyncGzip;\n}();\n\nfunction gzip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bDflt, gze, function () {\n return [gzipSync];\n }], function (ev) {\n return pbf(gzipSync(ev.data[0], ev.data[1]));\n }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nfunction gzipSync(data, opts) {\n if (!opts) opts = {};\n var c = crc(),\n l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8),\n s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming single or multi-member GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/function () {\n function Gunzip(opts, cb) {\n this.v = 1;\n this.r = 0;\n Inflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n this.r += chunk.length;\n if (this.v) {\n var p = this.p.subarray(this.v - 1);\n var s = p.length > 3 ? gzs(p) : 4;\n if (s > p.length) {\n if (!final) return;\n } else if (this.v > 1 && this.onmember) {\n this.onmember(this.r - p.length);\n }\n this.p = p.subarray(s), this.v = 0;\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n // process concatenated GZIP\n if (this.s.f && !this.s.l && !final) {\n this.v = shft(this.s.p) + 9;\n this.s = {\n i: 0\n };\n this.o = new u8(0);\n this.push(new u8(0), final);\n }\n };\n return Gunzip;\n}();\n\n/**\n * Asynchronous streaming single or multi-member GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/function () {\n function AsyncGunzip(opts, cb) {\n var _this = this;\n astrmify([bInflt, guze, function () {\n return [astrm, Inflate, Gunzip];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gunzip(ev.data);\n strm.onmember = function (offset) {\n return postMessage(offset);\n };\n onmessage = astrm(strm);\n }, 9, 0, function (offset) {\n return _this.onmember && _this.onmember(offset);\n });\n }\n return AsyncGunzip;\n}();\n\nfunction gunzip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bInflt, guze, function () {\n return [gunzipSync];\n }], function (ev) {\n return pbf(gunzipSync(ev.data[0], ev.data[1]));\n }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction gunzipSync(data, opts) {\n var st = gzs(data);\n if (st + 8 > data.length) _err(6, 'invalid gzip data');\n return inflt(data.subarray(st, -8), {\n i: 2\n }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s);\n if (this.v) zlh(raw, this.o), this.v = 0;\n if (f) wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * zlibbed output for small inputs.\n */\n Zlib.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Zlib;\n}();\n\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/function () {\n function AsyncZlib(opts, cb) {\n astrmify([bDflt, zle, function () {\n return [astrm, Deflate, Zlib];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10, 1);\n }\n return AsyncZlib;\n}();\n\nfunction zlib(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bDflt, zle, function () {\n return [zlibSync];\n }], function (ev) {\n return pbf(zlibSync(ev.data[0], ev.data[1]));\n }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nfunction zlibSync(data, opts) {\n if (!opts) opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/function () {\n function Unzlib(opts, cb) {\n Inflate.call(this, opts, cb);\n this.v = opts && opts.dictionary ? 2 : 1;\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 6 && !final) return;\n this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4) _err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}();\n\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/function () {\n function AsyncUnzlib(opts, cb) {\n astrmify([bInflt, zule, function () {\n return [astrm, Inflate, Unzlib];\n }], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Unzlib(ev.data);\n onmessage = astrm(strm);\n }, 11, 0);\n }\n return AsyncUnzlib;\n}();\n\nfunction unzlib(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return cbify(data, opts, [bInflt, zule, function () {\n return [unzlibSync];\n }], function (ev) {\n return pbf(unzlibSync(ev.data[0], gopt(ev.data[1])));\n }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction unzlibSync(data, opts) {\n return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), {\n i: 2\n }, opts && opts.out, opts && opts.dictionary);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\n\n\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/function () {\n function Decompress(opts, cb) {\n this.o = StrmOpt.call(this, opts, cb) || {};\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n }\n // init substream\n // overriden by AsyncDecompress\n Decompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (dat, final) {\n _this.ondata(dat, final);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n } else this.p = chunk;\n if (this.p.length > 2) {\n this.s = this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8 ? new this.G(this.o) : (this.p[0] & 15) != 8 || this.p[0] >> 4 > 7 || (this.p[0] << 8 | this.p[1]) % 31 ? new this.I(this.o) : new this.Z(this.o);\n this.i();\n this.s.push(this.p, final);\n this.p = null;\n }\n } else this.s.push(chunk, final);\n };\n return Decompress;\n}();\n\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/function () {\n function AsyncDecompress(opts, cb) {\n Decompress.call(this, opts, cb);\n this.queuedSize = 0;\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n }\n AsyncDecompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (err, dat, final) {\n _this.ondata(err, dat, final);\n };\n this.s.ondrain = function (size) {\n _this.queuedSize -= size;\n if (_this.ondrain) _this.ondrain(size);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n this.queuedSize += chunk.length;\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}();\n\nfunction decompress(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n return data[0] == 31 && data[1] == 139 && data[2] == 8 ? gunzip(data, opts, cb) : (data[0] & 15) != 8 || data[0] >> 4 > 7 || (data[0] << 8 | data[1]) % 31 ? inflate(data, opts, cb) : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nfunction decompressSync(data, opts) {\n return data[0] == 31 && data[1] == 139 && data[2] == 8 ? gunzipSync(data, opts) : (data[0] & 15) != 8 || data[0] >> 4 > 7 || (data[0] << 8 | data[1]) % 31 ? inflateSync(data, opts) : unzlibSync(data, opts);\n}\n// flatten a directory structure\nvar _fltn = function fltn(d, p, t, o) {\n for (var k in d) {\n var val = d[k],\n n = p + k,\n op = o;\n if (Array.isArray(val)) op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8) t[n] = [val, op];else {\n t[n += '/'] = [new u8(0), op];\n _fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, {\n stream: true\n });\n tds = 1;\n} catch (e) {}\n// decode UTF8\nvar dutf8 = function dutf8(d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length) return {\n s: r,\n r: slc(d, i - 1)\n };\n if (!eb) r += String.fromCharCode(c);else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);\n } else if (eb & 1) r += String.fromCharCode((c & 31) << 6 | d[i++] & 63);else r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63);\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds) this.t = new TextDecoder();else this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, {\n stream: true\n }), final);\n if (final) {\n if (this.t.decode().length) _err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p) _err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat),\n s = _a.s,\n r = _a.r;\n if (final) {\n if (r.length) _err(8);\n this.p = null;\n } else this.p = r;\n this.ondata(s, final);\n };\n return DecodeUTF8;\n}();\n\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n if (this.d) _err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}();\n\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nfunction strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i) ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te) return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function w(v) {\n ar[ai++] = v;\n };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + (l - i << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1) w(c);else if (c < 2048) w(192 | c >> 6), w(128 | c & 63);else if (c > 55295 && c < 57344) c = 65536 + (c & 1023 << 10) | str.charCodeAt(++i) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63);else w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nfunction strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384) r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n } else if (td) {\n return td.decode(dat);\n } else {\n var _a = dutf8(dat),\n s = _a.s,\n r = _a.r;\n if (r.length) _err(8);\n return s;\n }\n}\n;\n// deflate bit flag\nvar dbf = function dbf(l) {\n return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0;\n};\n// skip local zip header\nvar slzh = function slzh(d, b) {\n return b + 30 + b2(d, b + 26) + b2(d, b + 28);\n};\n// read zip header\nvar zh = function zh(d, b, z) {\n var fnl = b2(d, b + 28),\n fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)),\n es = b + 46 + fnl,\n bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)],\n sc = _a[0],\n su = _a[1],\n off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function z64e(d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2));\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function exfl(ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535) _err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function wzh(d, b, f, fn, u, c, ce, co) {\n var fl = fn.length,\n ex = f.extra,\n col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null) d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime),\n y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119) _err(10);\n wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k],\n l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col) d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function wzf(o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata) _err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final) this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}();\n\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this = this;\n if (!opts) opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n } catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/function () {\n /**\n * Creates an asynchronous DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this = this;\n if (!opts) opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}();\n\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this = this;\n if (!this.ondata) _err(5);\n // finishing or finished\n if (this.d & 2) this.ondata(_err(4 + (this.d & 1) * 8, 0, 1), null, false);else {\n var f = strToU8(file.filename),\n fl_1 = f.length;\n var com = file.comment,\n o = com && strToU8(com);\n var u = fl_1 != file.filename.length || o && com.length != o.length;\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535) this.ondata(_err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function pAll_1() {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function t() {\n if (file.terminate) file.terminate();\n },\n r: function r() {\n pAll_1();\n if (tr_1) {\n var nxt = _this.u[ind_1 + 1];\n if (nxt) nxt.r();else _this.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this.ondata(err, dat, final);\n _this.terminate();\n } else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1) uf_1.r();\n tr_1 = 1;\n } else if (tr_1) pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this = this;\n if (this.d & 2) {\n this.ondata(_err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d) this.e();else this.u.push({\n r: function r() {\n if (!(_this.d & 1)) return;\n _this.u.splice(-1, 1);\n _this.e();\n },\n t: function t() {}\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0,\n l = 0,\n tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}();\n\nfunction zip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n var r = {};\n _fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length,\n o = 0,\n tot = 0;\n var slft = lft,\n files = new Array(lft);\n var term = [];\n var tAll = function tAll() {\n for (var i = 0; i < term.length; ++i) term[i]();\n };\n var cbd = function cbd(a, b) {\n mt(function () {\n cb(a, b);\n });\n };\n mt(function () {\n cbd = cb;\n });\n var cbf = function cbf() {\n var out = new u8(tot + 22),\n oe = o,\n cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n } catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft) cbf();\n var _loop_1 = function _loop_1(i) {\n var fn = k[i];\n var _a = r[fn],\n file = _a[0],\n p = _a[1];\n var c = crc(),\n size = file.length;\n c.p(file);\n var f = strToU8(fn),\n s = f.length;\n var com = p.comment,\n m = com && strToU8(com),\n ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function cbl(e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n } else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || m && com.length != ms,\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (! --lft) cbf();\n }\n };\n if (s > 65535) cbl(_err(11, 0, 1), null);\n if (!compression) cbl(null, file);else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n } catch (e) {\n cbl(e, null);\n }\n } else term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nfunction zipSync(data, opts) {\n if (!opts) opts = {};\n var r = {};\n var files = [];\n _fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn],\n file = _a[0],\n p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn),\n s = f.length;\n var com = p.comment,\n m = com && strToU8(com),\n ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535) _err(11);\n var d = compression ? deflateSync(file, p) : file,\n l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || m && com.length != ms,\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22),\n oe = o,\n cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/function () {\n function UnzipPassThrough() {}\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}();\n\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this = this;\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n } catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}();\n\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n } else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate) data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}();\n\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this = this;\n if (!this.onfile) _err(5);\n if (!this.p) _err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d) this.d.push(toAdd, !this.c);else this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length) return this.push(chunk, final);\n } else {\n var f = 0,\n i = 0,\n is = void 0,\n buf = void 0;\n if (!this.p.length) buf = chunk;else if (!chunk.length) buf = this.p;else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length,\n oc = this.c,\n add = oc && this.d;\n var _loop_2 = function _loop_2() {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6),\n cmp_1 = b2(buf, i + 8),\n u = bf & 2048,\n dd = bf & 8,\n fnl = b2(buf, i + 26),\n es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18),\n su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n } else if (dd) sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function start() {\n if (!file_1.ondata) _err(5);\n if (!sc_1) file_1.ondata(null, et, true);else {\n var ctr = _this.o[cmp_1];\n if (!ctr) file_1.ondata(_err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) {\n file_1.ondata(err, dat, final);\n };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this.k[0] == chks_3 && _this.c) _this.d = d_1;else d_1.push(et, true);\n }\n },\n terminate: function terminate() {\n if (d_1 && d_1.terminate) d_1.terminate();\n }\n };\n if (sc_1 >= 0) file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n } else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n } else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\") break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add) add.push(dat, !!f);else this.k[+(f == 2)].push(dat);\n }\n if (f & 2) return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c) _err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}();\n\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) {\n fn();\n};\nfunction unzip(data, opts, cb) {\n if (!cb) cb = opts, opts = {};\n if (typeof cb != 'function') _err(7);\n var term = [];\n var tAll = function tAll() {\n for (var i = 0; i < term.length; ++i) term[i]();\n };\n var files = {};\n var cbd = function cbd(a, b) {\n mt(function () {\n cb(a, b);\n });\n };\n mt(function () {\n cbd = cb;\n });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(_err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function _loop_3(i) {\n var _a = zh(data, o, z),\n c_1 = _a[0],\n sc = _a[1],\n su = _a[2],\n fn = _a[3],\n no = _a[4],\n off = _a[5],\n b = slzh(data, off);\n o = no;\n var cbl = function cbl(e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n } else {\n if (d) files[fn] = d;\n if (! --lft) cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1) cbl(null, slc(data, b, b + sc));else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n // Synchronously decompress under 512KB, or barely-compressed data\n if (su < 524288 || sc > 0.8 * su) {\n try {\n cbl(null, inflateSync(infl, {\n out: new u8(su)\n }));\n } catch (e) {\n cbl(e, null);\n }\n } else term.push(inflate(infl, {\n size: su\n }, cbl));\n } else cbl(_err(14, 'unknown compression type ' + c_1, 1), null);\n } else cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n } else cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nfunction unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) _err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c) return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z),\n c_2 = _a[0],\n sc = _a[1],\n su = _a[2],\n fn = _a[3],\n no = _a[4],\n off = _a[5],\n b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2) files[fn] = slc(data, b, b + sc);else if (c_2 == 8) files[fn] = inflateSync(data.subarray(b, b + sc), {\n out: new u8(su)\n });else _err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/eslint-loader??ref--13-0!./packages/utils/StreamLoaderParser.worker.js\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n\nself.__streamLoaderStates = self.__streamLoaderStates || new Map();\nvar utf8Decoder = new TextDecoder('utf-8');\nself.onmessage = function (e) {\n var _e$data = e.data,\n id = _e$data.id,\n type = _e$data.type,\n data = _e$data.data;\n if (type === 'parseBufferData') {\n try {\n var buffer = data.buffer,\n prefixIdKey = data.prefixIdKey;\n var result = parseBufferData(buffer, prefixIdKey);\n // Transfer the buffer back if possible, but we constructed new arrays.\n // We rely on structured cloning.\n self.postMessage({\n id: id,\n type: 'success',\n result: result\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamInit') {\n try {\n var _ref = data || {},\n streamId = _ref.streamId,\n _prefixIdKey = _ref.prefixIdKey;\n if (!streamId) throw new Error('Missing streamId');\n var state = createStreamState(_prefixIdKey);\n self.__streamLoaderStates.set(streamId, state);\n self.postMessage({\n id: id,\n type: 'success',\n result: true\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamPush') {\n try {\n var _ref2 = data || {},\n _streamId = _ref2.streamId,\n chunk = _ref2.chunk,\n _ref2$byteOffset = _ref2.byteOffset,\n byteOffset = _ref2$byteOffset === void 0 ? 0 : _ref2$byteOffset,\n byteLength = _ref2.byteLength,\n _prefixIdKey2 = _ref2.prefixIdKey;\n if (!_streamId) throw new Error('Missing streamId');\n var _state = self.__streamLoaderStates.get(_streamId);\n if (!_state) {\n _state = createStreamState(_prefixIdKey2);\n self.__streamLoaderStates.set(_streamId, _state);\n }\n var view = new Uint8Array(chunk, byteOffset, byteLength !== null && byteLength !== void 0 ? byteLength : chunk.byteLength - byteOffset);\n var _result = parseStreamChunk(_state, view);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamFlush') {\n try {\n var _ref3 = data || {},\n _streamId2 = _ref3.streamId;\n if (!_streamId2) throw new Error('Missing streamId');\n var _state2 = self.__streamLoaderStates.get(_streamId2);\n if (!_state2) {\n self.postMessage({\n id: id,\n type: 'success',\n result: {\n meshes: [],\n primitives: []\n }\n });\n return;\n }\n var _result2 = parseStreamChunk(_state2, null, true);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result2\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'streamDispose') {\n try {\n var _ref4 = data || {},\n _streamId3 = _ref4.streamId;\n if (_streamId3) self.__streamLoaderStates.delete(_streamId3);\n self.postMessage({\n id: id,\n type: 'success',\n result: true\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'buildInstancedMapping') {\n try {\n var _ref5 = data || {},\n instances = _ref5.instances,\n drawObjs = _ref5.drawObjs;\n var _result3 = buildInstancedMapping(instances || [], drawObjs || []);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result3\n });\n } catch (error) {\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message\n });\n }\n } else if (type === 'occlusionScan') {\n var transfer = data && data.buffer ? [data.buffer] : [];\n try {\n var _ref6 = data || {},\n _buffer = _ref6.buffer,\n sw = _ref6.sw,\n sh = _ref6.sh,\n stride = _ref6.stride,\n maxIdx = _ref6.maxIdx,\n minSampleCount = _ref6.minSampleCount;\n var _result4 = scanOcclusionBuffer(_buffer, sw, sh, stride, maxIdx, minSampleCount);\n self.postMessage({\n id: id,\n type: 'success',\n result: _result4,\n buffer: _buffer\n }, transfer);\n } catch (error) {\n var _buffer2 = data && data.buffer ? data.buffer : null;\n self.postMessage({\n id: id,\n type: 'error',\n error: error.message,\n buffer: _buffer2\n }, transfer);\n }\n }\n};\nfunction createStreamState(prefixIdKey) {\n return {\n prefixIdKey: prefixIdKey || '',\n buffer: new Uint8Array(),\n pendingMesh: null,\n pendingPrimitiveIds: new Set(),\n pendingPrimitiveGroups: [],\n pendingMatchedPrimitiveIds: new Set(),\n expectingMesh: true,\n isFullProps: true\n };\n}\nfunction parseStreamChunk(state, chunkView) {\n var flushing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n if (chunkView && chunkView.length > 0) {\n var merged = new Uint8Array(state.buffer.length + chunkView.length);\n merged.set(state.buffer);\n merged.set(chunkView, state.buffer.length);\n state.buffer = merged;\n }\n var meshes = [];\n var primitives = [];\n var commitPendingMesh = function commitPendingMesh() {\n if (!state.pendingMesh) return;\n var meshList = Array.isArray(state.pendingMesh) ? state.pendingMesh : [state.pendingMesh];\n meshList.forEach(function (mesh) {\n meshes.push(mesh);\n primitives.push(state.pendingPrimitiveGroups);\n });\n state.pendingMesh = null;\n state.pendingPrimitiveIds = new Set();\n state.pendingPrimitiveGroups = [];\n state.pendingMatchedPrimitiveIds = new Set();\n };\n while (state.buffer.length > 0) {\n if (state.expectingMesh) {\n var meshResult = tryParseMeshFromState(state);\n if (meshResult.status === 'incomplete') break;\n if (meshResult.status === 'invalid') {\n break;\n }\n commitPendingMesh();\n state.pendingMesh = meshResult.mesh;\n state.pendingPrimitiveIds = new Set(collectMeshPrimitiveIds(meshResult.mesh));\n state.pendingPrimitiveGroups = [];\n state.pendingMatchedPrimitiveIds = new Set();\n state.expectingMesh = false;\n state.buffer = state.buffer.slice(meshResult.totalLen);\n } else {\n var nextMeshResult = tryParseMeshFromState(state);\n if (nextMeshResult.status === 'success') {\n commitPendingMesh();\n state.pendingMesh = nextMeshResult.mesh;\n state.pendingPrimitiveIds = new Set(collectMeshPrimitiveIds(nextMeshResult.mesh));\n state.pendingPrimitiveGroups = [];\n state.pendingMatchedPrimitiveIds = new Set();\n state.expectingMesh = false;\n state.buffer = state.buffer.slice(nextMeshResult.totalLen);\n continue;\n }\n if (state.buffer.length < 12) break;\n var primitiveResult = null;\n try {\n primitiveResult = parsePrimitiveFromState(state);\n } catch (e) {\n break;\n }\n var primitiveData = primitiveResult.primitive;\n if (state.pendingPrimitiveIds.has(primitiveData.id)) {\n state.pendingPrimitiveGroups.push(primitiveData);\n state.pendingMatchedPrimitiveIds.add(primitiveData.id);\n }\n state.buffer = state.buffer.slice(primitiveResult.consumedBytes);\n if (state.pendingPrimitiveIds.size > 0 && state.pendingMatchedPrimitiveIds.size >= state.pendingPrimitiveIds.size) {\n commitPendingMesh();\n state.expectingMesh = true;\n }\n }\n }\n if (flushing) {\n commitPendingMesh();\n state.buffer = new Uint8Array();\n }\n return {\n meshes: meshes,\n primitives: primitives\n };\n}\nfunction normalizeStreamMesh(mesh, prefixIdKey) {\n _applyPrefixId(mesh, 'id', null, prefixIdKey);\n var meshList = Array.isArray(mesh) ? mesh : [mesh];\n meshList.forEach(function (item) {\n if (!item) return;\n if (!Array.isArray(item.primitives)) {\n item.primitives = [];\n }\n _applyPrefixId(item.primitives, 'prmid', item.documentId, prefixIdKey);\n });\n return mesh;\n}\nfunction collectMeshPrimitiveIds(mesh) {\n var ids = [];\n var meshList = Array.isArray(mesh) ? mesh : [mesh];\n meshList.forEach(function (item) {\n if (!item || !Array.isArray(item.primitives)) return;\n item.primitives.forEach(function (primitive) {\n if (primitive && primitive.prmid != null) {\n ids.push(primitive.prmid);\n }\n });\n });\n return ids;\n}\nfunction isValidStreamMesh(mesh) {\n var meshList = Array.isArray(mesh) ? mesh : [mesh];\n if (meshList.length === 0) return false;\n return meshList.every(function (item) {\n return item && _typeof(item) === 'object' && Array.isArray(item.primitives);\n });\n}\nfunction tryParseMeshFromState(state) {\n if (state.buffer.length < 4) {\n return {\n status: 'incomplete'\n };\n }\n var length = new DataView(state.buffer.buffer, state.buffer.byteOffset).getUint32(0, false);\n if (length <= 0 || length > 10 * 1024 * 1024) {\n return {\n status: 'invalid'\n };\n }\n var totalLen = 4 + length;\n if (state.buffer.length < totalLen) {\n return {\n status: 'incomplete'\n };\n }\n try {\n var data = state.buffer.slice(4, totalLen);\n var parsedMesh = JSON.parse(utf8Decoder.decode(data));\n if (!isValidStreamMesh(parsedMesh)) {\n return {\n status: 'invalid'\n };\n }\n var mesh = normalizeStreamMesh(parsedMesh, state.prefixIdKey);\n return {\n status: 'success',\n mesh: mesh,\n totalLen: totalLen\n };\n } catch (e) {\n return {\n status: 'invalid'\n };\n }\n}\nfunction parsePrimitiveFromState(state) {\n var dataView = new DataView(state.buffer.buffer, state.buffer.byteOffset, state.buffer.byteLength);\n var primitiveResult = parsePrimitive(dataView, state.buffer, 0, state.isFullProps);\n var primitiveData = primitiveResult.primitive;\n _applyPrefixId(primitiveData, 'id', null, state.prefixIdKey);\n _applyPrefixId(primitiveData, 'material', null, state.prefixIdKey);\n if (state.isFullProps) {\n var _parsePrimitiveData = parsePrimitiveData(primitiveData),\n position = _parsePrimitiveData.position,\n normal = _parsePrimitiveData.normal,\n posindex = _parsePrimitiveData.posindex,\n nolindex = _parsePrimitiveData.nolindex,\n indices = _parsePrimitiveData.indices;\n var formatted = formatPrimitiveData({\n position: position,\n normal: normal,\n posindex: posindex,\n nolindex: nolindex\n });\n delete primitiveData.nolindex;\n delete primitiveData.posindex;\n primitiveData.position = formatted.position;\n primitiveData.normal = formatted.normal;\n primitiveData.indices = indices;\n }\n return {\n primitive: primitiveData,\n consumedBytes: primitiveResult.offset\n };\n}\nfunction parseBufferData(buffer, prefixIdKey) {\n var uint8Array = null;\n var dataView = null;\n var meshJsonBytes = null;\n var primitives = [];\n var mesh = null;\n try {\n uint8Array = new Uint8Array(buffer);\n dataView = new DataView(buffer);\n var offset = 0;\n var meshJsonLength = dataView.getInt32(offset, false);\n offset += 4;\n meshJsonBytes = new Uint8Array(uint8Array.buffer.slice(offset, offset + meshJsonLength));\n offset += meshJsonLength;\n var meshJsonStr = utf8Decoder.decode(meshJsonBytes);\n meshJsonBytes = null;\n try {\n mesh = JSON.parse(meshJsonStr);\n _applyPrefixId(mesh, 'id', null, prefixIdKey);\n if (Array.isArray(mesh)) {\n mesh.forEach(function (item) {\n _applyPrefixId(item.primitives, 'prmid', item.documentId, prefixIdKey);\n });\n } else {\n _applyPrefixId(mesh.primitives, 'prmid', mesh.documentId, prefixIdKey);\n }\n } catch (e) {\n console.error('JSON 解析失败:', e, meshJsonStr);\n throw new Error('JSON解析失败');\n }\n while (offset < uint8Array.length) {\n try {\n var result = parsePrimitive(dataView, uint8Array, offset);\n if (!result) break;\n primitives.push(result.primitive);\n offset = result.offset;\n } catch (e) {\n console.error('解析失败,偏移:', offset, e);\n break;\n }\n }\n for (var i = 0; i < primitives.length; i++) {\n var primitive = primitives[i];\n _applyPrefixId(primitive, 'id', null, prefixIdKey);\n _applyPrefixId(primitive, 'material', null, prefixIdKey);\n var _parsePrimitiveData2 = parsePrimitiveData(primitive),\n position = _parsePrimitiveData2.position,\n normal = _parsePrimitiveData2.normal,\n posindex = _parsePrimitiveData2.posindex,\n nolindex = _parsePrimitiveData2.nolindex,\n indices = _parsePrimitiveData2.indices;\n var formatted = formatPrimitiveData({\n position: position,\n normal: normal,\n posindex: posindex,\n nolindex: nolindex\n });\n delete primitive.nolindex;\n delete primitive.posindex;\n primitive.position = formatted.position;\n primitive.normal = formatted.normal;\n primitive.indices = indices;\n }\n return {\n mesh: mesh,\n primitives: primitives\n };\n } catch (error) {\n throw error;\n }\n}\nfunction _applyPrefixId(target, propKey, customPrefixId, prefixIdKey) {\n if (!prefixIdKey || !target) return;\n if (Array.isArray(target)) {\n target.forEach(function (item) {\n var prefixId = customPrefixId || item[prefixIdKey];\n if (item && prefixId && item[propKey] != null) {\n item[propKey] = \"\".concat(item[propKey], \":\").concat(prefixId);\n }\n });\n } else if ((customPrefixId || target[prefixIdKey]) && target[propKey] != null) {\n var prefixId = customPrefixId || target[prefixIdKey];\n target[propKey] = \"\".concat(target[propKey], \":\").concat(prefixId);\n }\n}\nfunction parsePrimitive(dataView, uint8Array, offset) {\n var isFullProps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n var primitive = {};\n if (dataView.byteLength < offset + 12) {\n throw new Error('Insufficient data for primitive header');\n }\n var primitiveIdTextLen = dataView.getUint32(offset, false);\n offset += 4;\n if (primitiveIdTextLen === 0xffffffff) {\n primitive.id = null;\n } else if (primitiveIdTextLen > 0) {\n if (dataView.byteLength < offset + primitiveIdTextLen) {\n throw new Error('Insufficient data for primitive id content');\n }\n var textBytes = uint8Array.subarray(offset, offset + primitiveIdTextLen);\n primitive.id = utf8Decoder.decode(textBytes);\n offset += primitiveIdTextLen;\n } else {\n primitive.id = '';\n }\n if (dataView.byteLength < offset + 4) {\n throw new Error('Insufficient data for GeomText length');\n }\n var documentTextLen = dataView.getUint32(offset, false);\n offset += 4;\n if (documentTextLen === 0xffffffff) {\n primitive.documentId = null;\n } else if (documentTextLen > 0) {\n if (dataView.byteLength < offset + documentTextLen) {\n throw new Error('Insufficient data for GeomText content');\n }\n var _textBytes = uint8Array.subarray(offset, offset + documentTextLen);\n primitive.documentId = utf8Decoder.decode(_textBytes);\n offset += documentTextLen;\n } else {\n primitive.documentId = '';\n }\n if (dataView.byteLength < offset + 4) {\n throw new Error('Insufficient data for Material length');\n }\n var materialTextLen = dataView.getUint32(offset, false);\n offset += 4;\n if (materialTextLen === 0xffffffff) {\n primitive.material = null;\n } else if (materialTextLen > 0) {\n if (dataView.byteLength < offset + materialTextLen) {\n throw new Error('Insufficient data for Material content');\n }\n var _textBytes2 = uint8Array.subarray(offset, offset + materialTextLen);\n primitive.material = utf8Decoder.decode(_textBytes2);\n offset += materialTextLen;\n } else {\n primitive.material = '';\n }\n if (dataView.byteLength < offset + 4) {\n throw new Error('Insufficient data for GeomText length');\n }\n var geomTextLen = dataView.getUint32(offset, false);\n offset += 4;\n if (geomTextLen === 0xffffffff) {\n primitive.geomText = null;\n } else if (geomTextLen > 0) {\n if (dataView.byteLength < offset + geomTextLen) {\n throw new Error('Insufficient data for GeomText content');\n }\n var _textBytes3 = uint8Array.subarray(offset, offset + geomTextLen);\n primitive.geomText = utf8Decoder.decode(_textBytes3);\n offset += geomTextLen;\n } else {\n primitive.geomText = '';\n }\n primitive.isCompressed = dataView.getInt32(offset, false);\n offset += 4;\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Position length');\n var positionLen = dataView.getUint32(offset, false);\n offset += 4;\n if (positionLen === 0xffffffff) {\n primitive.position = null;\n } else {\n if (dataView.byteLength < offset + positionLen) throw new Error('Insufficient data for Position content');\n primitive.position = uint8Array.subarray(offset, offset + positionLen);\n offset += positionLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Normal length');\n var normalLen = dataView.getUint32(offset, false);\n offset += 4;\n if (normalLen === 0xffffffff) {\n primitive.normal = null;\n } else {\n if (dataView.byteLength < offset + normalLen) throw new Error('Insufficient data for Normal content');\n primitive.normal = uint8Array.subarray(offset, offset + normalLen);\n offset += normalLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Indices length');\n var indicesLen = dataView.getUint32(offset, false);\n offset += 4;\n if (indicesLen === 0xffffffff) {\n primitive.indices = null;\n } else {\n if (dataView.byteLength < offset + indicesLen) throw new Error('Insufficient data for Indices content');\n primitive.indices = uint8Array.subarray(offset, offset + indicesLen);\n offset += indicesLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Posindex length');\n var posindexLen = dataView.getUint32(offset, false);\n offset += 4;\n if (posindexLen === 0xffffffff) {\n primitive.posindex = null;\n } else {\n if (dataView.byteLength < offset + posindexLen) throw new Error('Insufficient data for Posindex content');\n primitive.posindex = uint8Array.subarray(offset, offset + posindexLen);\n offset += posindexLen;\n }\n }\n if (isFullProps) {\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Nolindex length');\n var nolindexLen = dataView.getUint32(offset, false);\n offset += 4;\n if (nolindexLen === 0xffffffff) {\n primitive.nolindex = null;\n } else {\n if (dataView.byteLength < offset + nolindexLen) throw new Error('Insufficient data for Nolindex content');\n primitive.nolindex = uint8Array.subarray(offset, offset + nolindexLen);\n offset += nolindexLen;\n }\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for DataType length');\n var dataTypeLen = dataView.getUint32(offset, false);\n offset += 4;\n if (dataTypeLen === 0xffffffff) {\n primitive.dataType = null;\n } else if (dataTypeLen > 0) {\n if (dataView.byteLength < offset + dataTypeLen) throw new Error('Insufficient data for DataType content');\n var _textBytes4 = uint8Array.subarray(offset, offset + dataTypeLen);\n primitive.dataType = utf8Decoder.decode(_textBytes4);\n offset += dataTypeLen;\n } else {\n primitive.dataType = '';\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Min count');\n var minCount = dataView.getUint32(offset, false);\n offset += 4;\n if (minCount === 0xffffffff) {\n primitive.min = null;\n } else {\n if (dataView.byteLength < offset + minCount * 8) throw new Error('Insufficient data for Min values');\n primitive.min = [];\n for (var i = 0; i < minCount; i++) {\n primitive.min.push(dataView.getFloat64(offset, false));\n offset += 8;\n }\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for Max count');\n var maxCount = dataView.getUint32(offset, false);\n offset += 4;\n if (maxCount === 0xffffffff) {\n primitive.max = null;\n } else {\n if (dataView.byteLength < offset + maxCount * 8) throw new Error('Insufficient data for Max values');\n primitive.max = [];\n for (var _i = 0; _i < maxCount; _i++) {\n primitive.max.push(dataView.getFloat64(offset, false));\n offset += 8;\n }\n }\n if (dataView.byteLength < offset + 4) throw new Error('Insufficient data for GeomType');\n primitive.geomType = dataView.getInt32(offset, false);\n offset += 4;\n return {\n primitive: primitive,\n offset: offset\n };\n}\nfunction parsePrimitiveData(primitive) {\n var keyOrder = ['position', 'normal', 'indices', 'posindex', 'nolindex'];\n var typeMap = {\n 0: {\n bytes: 4,\n getter: 'getFloat32'\n },\n 1: {\n bytes: 4,\n getter: 'getInt32'\n },\n 2: {\n bytes: 2,\n getter: 'getInt16'\n }\n };\n var parsedResult = {};\n var dataTypeString = primitive.dataType;\n for (var i = 0; i < keyOrder.length; i++) {\n var key = keyOrder[i];\n var typeCode = dataTypeString[i];\n var typeInfo = typeMap[typeCode];\n var uint8Array = primitive.isCompressed === 1 || primitive.isCompressed === undefined ? gunzipSync(primitive[key]) : primitive[key];\n if (!typeInfo || !uint8Array) {\n // console.warn(`无法找到键 \"${key}\" 或其类型定义,已跳过。`);\n parsedResult[key] = [];\n continue;\n }\n var result_array = [];\n var dataView = new DataView(uint8Array.buffer, uint8Array.byteOffset, uint8Array.byteLength);\n var littleEndian = true;\n for (var byteOffset = 0; byteOffset < dataView.byteLength; byteOffset += typeInfo.bytes) {\n if (byteOffset + typeInfo.bytes > dataView.byteLength) {\n console.warn(\"\\u952E \\\"\".concat(key, \"\\\" \\u7684\\u6570\\u636E\\u957F\\u5EA6 (\").concat(dataView.byteLength, \") \\u4E0D\\u662F\\u5176\\u7C7B\\u578B (\").concat(typeInfo.bytes, \"\\u5B57\\u8282) \\u7684\\u6574\\u6570\\u500D\\uFF0C\\u672B\\u5C3E\\u6570\\u636E\\u53EF\\u80FD\\u4E0D\\u5B8C\\u6574\\u3002\"));\n break;\n }\n var value = dataView[typeInfo.getter](byteOffset, littleEndian);\n result_array.push(value);\n }\n parsedResult[key] = result_array;\n }\n return parsedResult;\n}\nfunction formatPrimitiveData(primitive) {\n var position = primitive.position,\n normal = primitive.normal,\n posindex = primitive.posindex,\n nolindex = primitive.nolindex;\n var restoredPosition = new Array(posindex.length);\n var restoredNormal = new Array(nolindex.length);\n for (var i = 0; i < posindex.length; i++) {\n var posIndex = posindex[i];\n restoredPosition[i] = position[posIndex];\n }\n for (var _i2 = 0; _i2 < nolindex.length; _i2++) {\n var normalIndex = nolindex[_i2];\n restoredNormal[_i2] = normal[normalIndex];\n }\n primitive.position = null;\n primitive.normal = null;\n primitive.posindex = null;\n primitive.nolindex = null;\n return {\n position: restoredPosition,\n normal: restoredNormal\n };\n}\nfunction buildInstancedMapping(instances, drawObjs) {\n var drawObjMapInstance = {};\n var instanceToDrawObject = [];\n var meshByPrimId = new Map();\n for (var i = 0; i < drawObjs.length; i++) {\n var item = drawObjs[i];\n if (!item || !Array.isArray(item.geoms)) continue;\n var geoms = item.geoms;\n for (var j = 0; j < geoms.length; j++) {\n var geom = geoms[j];\n if (geom && geom.prmid !== undefined && geom.prmid !== null) {\n meshByPrimId.set(geom.prmid, geoms);\n }\n }\n }\n var seenByDrawObject = new Map();\n for (var _i3 = 0; _i3 < instances.length; _i3++) {\n var instance = instances[_i3];\n if (!instance) continue;\n var drawObject = instance.drawObject;\n if (!drawObject) continue;\n instanceToDrawObject.push({\n instanceId: instance.instanceId,\n drawObjectId: drawObject\n });\n var record = drawObjMapInstance[drawObject];\n if (!record) {\n record = {\n MapInstance: [],\n MapMesh: meshByPrimId.get(drawObject)\n };\n drawObjMapInstance[drawObject] = record;\n seenByDrawObject.set(drawObject, new Set());\n }\n var seen = seenByDrawObject.get(drawObject);\n if (!seen.has(instance.instanceId)) {\n record.MapInstance.push(instance);\n seen.add(instance.instanceId);\n }\n }\n return {\n drawObjMapInstance: drawObjMapInstance,\n instanceToDrawObject: instanceToDrawObject\n };\n}\nfunction scanOcclusionBuffer(buffer, sw, sh, stride, maxIdx, minSampleCount) {\n var indices = [];\n if (!buffer || !sw || !sh || !maxIdx) return {\n indices: indices\n };\n var view = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n var step = Math.max(1, stride || 1);\n var minCount = Math.max(1, minSampleCount || 1);\n var counts = new Uint32Array(maxIdx + 1);\n for (var y = 0; y < sh; y += step) {\n var row = y * sw * 4;\n for (var x = 0; x < sw; x += step) {\n var p = row + x * 4;\n var idxColor = view[p] + (view[p + 1] << 8) + (view[p + 2] << 16);\n if (idxColor > 0 && idxColor <= maxIdx) {\n var next = counts[idxColor] + 1;\n counts[idxColor] = next;\n if (next === minCount) {\n indices.push(idxColor);\n }\n }\n }\n }\n return {\n indices: indices\n };\n}\n\n/***/ })\n\n/******/ });\n", "Worker", undefined, undefined);
111432
111435
  }
111433
111436
 
111434
111437
  // CONCATENATED MODULE: ./src/utils/instance-parser.js
@@ -111549,9 +111552,37 @@ function getInstanceNormalSign(matrix) {
111549
111552
  if (!matrix || typeof matrix.determinant !== 'function') return 1;
111550
111553
  return matrix.determinant() < 0 ? -1 : 1;
111551
111554
  }
111555
+ function getMatrixVal(matrix) {
111556
+ var val = matrix && matrix.val ? matrix.val : matrix;
111557
+ return val && val.length >= 16 ? val : null;
111558
+ }
111559
+ function composeInstanceMatrix(instance, mesh, geometry) {
111560
+ var resultMatrix = new Matrix4();
111561
+ var meshMatrix = new Matrix4();
111562
+ var primitiveMatrix = new Matrix4();
111563
+ var meshMatrixVal = getMatrixVal(instance && instance.matrix);
111564
+ var primitiveMatrixVal = getMatrixVal(mesh && mesh.matrix);
111565
+ if (meshMatrixVal) {
111566
+ meshMatrix.fromArray(meshMatrixVal);
111567
+ }
111568
+ if (primitiveMatrixVal) {
111569
+ primitiveMatrix.fromArray(primitiveMatrixVal);
111570
+ }
111571
+ var _ref = mesh || {},
111572
+ points = _ref.points,
111573
+ alignType = _ref.alignType;
111574
+ if (mesh && isTextType(mesh.type) && points && points.length >= 3) {
111575
+ var positionMatrix = new Matrix4();
111576
+ var alignMatrix = createAlignedText(alignType, geometry);
111577
+ positionMatrix.identity().makeTranslation(points[0], points[1], points[2]);
111578
+ primitiveMatrix.multiply(alignMatrix).multiply(positionMatrix);
111579
+ }
111580
+ resultMatrix.multiplyMatrices(meshMatrix, primitiveMatrix);
111581
+ return resultMatrix;
111582
+ }
111552
111583
 
111553
- /**
111554
- * 重置处理状态,用于新的批量加载会话
111584
+ /**
111585
+ * 重置处理状态,用于新的批量加载会话
111555
111586
  */
111556
111587
  function resetProcessingState() {
111557
111588
  drawObjMapInstance = {};
@@ -111861,7 +111892,6 @@ function setInstanceMatricesAndColors(model, drawObj, mesh, meshName, customColo
111861
111892
 
111862
111893
  // 批量处理实例
111863
111894
  instances.forEach(function (item, index) {
111864
- var _item$matrix;
111865
111895
  // 设置用户数据
111866
111896
  model.userData.instanceIndex = index;
111867
111897
  model.userData.instanceId = item.instanceId;
@@ -111890,38 +111920,19 @@ function setInstanceMatricesAndColors(model, drawObj, mesh, meshName, customColo
111890
111920
 
111891
111921
  // const instancedMesh = instanceToInstancedMeshMap.get(item.instanceId);
111892
111922
 
111893
- // 处理矩阵变换
111894
- var matrixVal = (_item$matrix = item.matrix) === null || _item$matrix === void 0 ? void 0 : _item$matrix.val;
111895
- if (matrixVal) {
111896
- var m4 = new Matrix4();
111897
- var meshMatrix = new Matrix4();
111898
- var geomMatrix = new Matrix4();
111899
- meshMatrix.fromArray(matrixVal);
111900
- geomMatrix.fromArray(new Matrix4().identity().elements);
111901
-
111902
- // 处理文本居中对齐
111903
- var points = mesh.points,
111904
- alignType = mesh.alignType;
111905
- if (isTextType(mesh.type)) {
111906
- var positionMatrix = new Matrix4();
111907
- var alignMatrix = createAlignedText(alignType, model.geometry);
111908
- positionMatrix.identity().makeTranslation(points[0], points[1], points[2]);
111909
- geomMatrix.multiply(alignMatrix).multiply(positionMatrix);
111910
- }
111911
- m4.multiplyMatrices(meshMatrix, geomMatrix);
111912
- model.setMatrixAt(index, m4);
111913
- var _normalSignAttr = model.geometry && model.geometry.getAttribute('instanceNormalSign');
111914
- if (_normalSignAttr && _normalSignAttr.array && index < _normalSignAttr.array.length) {
111915
- _normalSignAttr.array[index] = getInstanceNormalSign(m4);
111916
- }
111917
- var copyMatrix = new Matrix4().copy(m4);
111918
- model.userData.copyMatrix = copyMatrix;
111919
- var temp = model.userData.instancesMap.get(item.instanceId);
111920
- temp.copyMatrix = copyMatrix;
111921
- if (sourceVisible === false) {
111922
- var offsetMatrix = new Matrix4().copy(copyMatrix).makeTranslation(9999999, 9999999, 9999999);
111923
- model.setMatrixAt(index, offsetMatrix);
111924
- }
111923
+ var m4 = composeInstanceMatrix(item, mesh, model.geometry);
111924
+ model.setMatrixAt(index, m4);
111925
+ var normalSignAttr = model.geometry && model.geometry.getAttribute('instanceNormalSign');
111926
+ if (normalSignAttr && normalSignAttr.array && index < normalSignAttr.array.length) {
111927
+ normalSignAttr.array[index] = getInstanceNormalSign(m4);
111928
+ }
111929
+ var copyMatrix = new Matrix4().copy(m4);
111930
+ model.userData.copyMatrix = copyMatrix;
111931
+ var temp = model.userData.instancesMap.get(item.instanceId);
111932
+ temp.copyMatrix = copyMatrix;
111933
+ if (sourceVisible === false) {
111934
+ var offsetMatrix = new Matrix4().copy(copyMatrix).makeTranslation(9999999, 9999999, 9999999);
111935
+ model.setMatrixAt(index, offsetMatrix);
111925
111936
  }
111926
111937
 
111927
111938
  // 设置颜色
@@ -111967,7 +111978,6 @@ function appendInstanceToInstancedGroup(group, drawObj, instance, customColor) {
111967
111978
  }
111968
111979
  }
111969
111980
  function appendInstanceToInstancedMesh(model, drawObj, mesh, instance, customColor) {
111970
- var _instance$matrix;
111971
111981
  if (!model || !model.isInstancedMesh) return;
111972
111982
  if (!instance || !instance.instanceId) return;
111973
111983
  var capacity = model.instanceMatrix && typeof model.instanceMatrix.count === 'number' ? model.instanceMatrix.count : model.count;
@@ -111980,22 +111990,8 @@ function appendInstanceToInstancedMesh(model, drawObj, mesh, instance, customCol
111980
111990
  var sourceVisible = mesh && mesh.prop && mesh.prop.sourceVisible === false ? false : true;
111981
111991
  var colorArr = Array.isArray(rawColor) ? rawColor : typeof rawColor === 'string' ? rawColor.split(',') : [255, 255, 255];
111982
111992
  var meshColor = customColor ? new Color(customColor) : new Color("rgb(".concat(colorArr[0], ", ").concat(colorArr[1], ", ").concat(colorArr[2], ")"));
111983
- var matrixVal = (_instance$matrix = instance.matrix) === null || _instance$matrix === void 0 ? void 0 : _instance$matrix.val;
111984
- if (!matrixVal || !mesh || !mesh.matrix || !mesh.matrix.val) return;
111985
- var m4 = new Matrix4();
111986
- var meshMatrix = new Matrix4();
111987
- var geomMatrix = new Matrix4();
111988
- meshMatrix.fromArray(instance.matrix.val);
111989
- geomMatrix.fromArray(new Matrix4().identity().elements);
111990
- var points = mesh.points,
111991
- alignType = mesh.alignType;
111992
- if (isTextType(mesh.type)) {
111993
- var positionMatrix = new Matrix4();
111994
- var alignMatrix = createAlignedText(alignType, model.geometry);
111995
- positionMatrix.identity().makeTranslation(points[0], points[1], points[2]);
111996
- geomMatrix.multiply(alignMatrix).multiply(positionMatrix);
111997
- }
111998
- m4.multiplyMatrices(meshMatrix, geomMatrix);
111993
+ if (!mesh) return;
111994
+ var m4 = composeInstanceMatrix(instance, mesh, model.geometry);
111999
111995
  var renderMatrix = sourceVisible === false ? new Matrix4().copy(m4).makeTranslation(9999999, 9999999, 9999999) : m4;
112000
111996
  model.setMatrixAt(currentCount, renderMatrix);
112001
111997
  if (model.instanceMatrix) model.instanceMatrix.needsUpdate = true;
@@ -112099,13 +112095,13 @@ function drawModel(geom, instanceName, instanceCount, nColor, nOpacity) {
112099
112095
  var model;
112100
112096
  // 处理二维几何体(普通2D图形和特殊2D图形)
112101
112097
  if (geom.type == GEOM_TYPES.geom_2d || geom.type == GEOM_TYPES.geom_2d_others) {
112102
- model = draw2Dmodel(geom, instanceName, instanceCount, options); // TODO 该类型调试中
112098
+ model = draw2Dmodel(geom, instanceName, instanceCount, nColor, nOpacity, options); // TODO 该类型调试中
112103
112099
  // 处理二维文本类型
112104
112100
  } else if (isTextType(geom.type)) {
112105
112101
  model = drawText(geom, instanceName, instanceCount, options);
112106
112102
  // 处理各种曲线类型(圆形、圆弧、椭圆、椭圆弧)
112107
112103
  } else if (geom.type == GEOM_TYPES.geom_2d_circle || geom.type == GEOM_TYPES.geom_2d_arc || geom.type == GEOM_TYPES.geom_2d_ellipse || geom.type == GEOM_TYPES.geom_2d_ellipseArc) {
112108
- model = drawCurves(geom, instanceName, instanceCount, options); // TODO 该类型调试中
112104
+ model = drawCurves(geom, instanceName, instanceCount, nColor, nOpacity, options); // TODO 该类型调试中
112109
112105
  // 处理三维几何体(普通3D模型和OBJ模型)
112110
112106
  } else if (geom.type == GEOM_TYPES.geom_3d || geom.type == GEOM_TYPES.geom_3d_obj) {
112111
112107
  model = draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity, options);
@@ -112129,8 +112125,8 @@ function isTextType(type) {
112129
112125
  * @param {String} instanceName- 曲线实例的名称
112130
112126
  * @return {Object}- 包含曲线模型和曲线信息的对象
112131
112127
  */
112132
- function drawCurves(geom, instanceName, instanceCount) {
112133
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
112128
+ function drawCurves(geom, instanceName, instanceCount, nColor, nOpacity) {
112129
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
112134
112130
  var points = geom.points,
112135
112131
  normals = geom.normals;
112136
112132
  var aX = points[0];
@@ -112160,7 +112156,7 @@ function drawCurves(geom, instanceName, instanceCount) {
112160
112156
  var model = draw2Dmodel(instance_parser_objectSpread(instance_parser_objectSpread({}, geom), {}, {
112161
112157
  points: list,
112162
112158
  normals: normals
112163
- }), instanceName, instanceCount, options);
112159
+ }), instanceName, instanceCount, nColor, nOpacity, options);
112164
112160
  // model.rotation.x = -Math.PI / 2;
112165
112161
  // model.position.set(aX, aY, aZ);
112166
112162
  var matrix = new Matrix4();
@@ -112333,7 +112329,7 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
112333
112329
 
112334
112330
  // 处理transparent透明度
112335
112331
  opacity = 1 - transparent;
112336
- var finalOpacity = nOpacity !== '' ? nOpacity : opacity;
112332
+ var finalOpacity = nOpacity !== undefined && nOpacity !== null && nOpacity !== '' ? nOpacity : opacity;
112337
112333
 
112338
112334
  // 判断是否全透明
112339
112335
  var isTransparent = finalOpacity < 1.0;
@@ -112410,8 +112406,8 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
112410
112406
  * @param {String} instanceName - 模型实例的名称
112411
112407
  * @returns {Object} - 包含所有 2D 模型的组对象
112412
112408
  */
112413
- function draw2Dmodel(geom, instanceName, instanceCount) {
112414
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
112409
+ function draw2Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
112410
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
112415
112411
  var points = geom.points;
112416
112412
  var normals = geom.normals;
112417
112413
  var geometry = new BufferGeometry();
@@ -112437,7 +112433,7 @@ function draw2Dmodel(geom, instanceName, instanceCount) {
112437
112433
  prop: geom.prop,
112438
112434
  geometry: lineGeometry,
112439
112435
  material: material
112440
- }, instanceName, instanceCount, options);
112436
+ }, instanceName, instanceCount, nColor, nOpacity, options);
112441
112437
  // mesh.raycast = raycast;
112442
112438
 
112443
112439
  model.userData.instanceName = instanceName;
@@ -114528,17 +114524,14 @@ _Stats.Panel = function (name, fg, bg) {
114528
114524
  };
114529
114525
  };
114530
114526
  /* harmony default export */ var stats_module = (_Stats);
114531
- // EXTERNAL MODULE: ./packages/components/com-graphics/box.json
114532
- var com_graphics_box = __webpack_require__("cbf5");
114533
-
114534
114527
  // EXTERNAL MODULE: ./node_modules/fflate/esm/browser.js
114535
114528
  var browser = __webpack_require__("72ba");
114536
114529
 
114537
114530
  // CONCATENATED MODULE: ./packages/utils/StreamLoader.js
114538
- function StreamLoader_typeof(o) { "@babel/helpers - typeof"; return StreamLoader_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, StreamLoader_typeof(o); }
114539
114531
  function StreamLoader_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
114540
114532
  function StreamLoader_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? StreamLoader_ownKeys(Object(t), !0).forEach(function (r) { StreamLoader_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : StreamLoader_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
114541
114533
  function StreamLoader_defineProperty(e, r, t) { return (r = StreamLoader_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
114534
+ function StreamLoader_typeof(o) { "@babel/helpers - typeof"; return StreamLoader_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, StreamLoader_typeof(o); }
114542
114535
  function StreamLoader_toConsumableArray(r) { return StreamLoader_arrayWithoutHoles(r) || StreamLoader_iterableToArray(r) || StreamLoader_unsupportedIterableToArray(r) || StreamLoader_nonIterableSpread(); }
114543
114536
  function StreamLoader_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
114544
114537
  function StreamLoader_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return StreamLoader_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? StreamLoader_arrayLikeToArray(r, a) : void 0; } }
@@ -114729,15 +114722,16 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114729
114722
  }, {
114730
114723
  key: "parseStreamImmediate",
114731
114724
  value: function () {
114732
- var _parseStreamImmediate = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee3(reader, list, range) {
114725
+ var _parseStreamImmediate = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee4(reader, list, range) {
114733
114726
  var _this4 = this;
114734
114727
  var abortSignal,
114735
114728
  streamId,
114736
114729
  batchMeshes,
114737
- batchPrimitives,
114730
+ batchPrimitiveGroups,
114738
114731
  batchSize,
114739
114732
  batchStart,
114740
114733
  streamStats,
114734
+ flattenPrimitiveGroups,
114741
114735
  processStreamBatch,
114742
114736
  ensureNotAborted,
114743
114737
  localStreamId,
@@ -114755,63 +114749,52 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114755
114749
  abortPromiseInBatch,
114756
114750
  interactionPromiseInBatch,
114757
114751
  meshesToProcess,
114758
- primitivesToProcess,
114752
+ primitiveGroupsToProcess,
114759
114753
  _abortPromiseInBatch,
114760
114754
  _interactionPromiseInBatch,
114761
114755
  _meshesToProcess,
114762
- _primitivesToProcess,
114756
+ _primitiveGroupsToProcess,
114763
114757
  transferable,
114764
114758
  parsed,
114765
114759
  _abortPromiseInBatch2,
114766
114760
  _interactionPromiseInBatch2,
114767
114761
  _meshesToProcess2,
114768
- _primitivesToProcess2,
114762
+ _primitiveGroupsToProcess2,
114769
114763
  decoder,
114770
114764
  buffer,
114771
- pendingPrimitives,
114772
- expectingPrimitive,
114765
+ expectingMesh,
114766
+ pendingMesh,
114767
+ pendingPrimitiveIds,
114768
+ pendingPrimitiveGroups,
114769
+ pendingMatchedPrimitiveIds,
114773
114770
  isFullProps,
114771
+ normalizeMesh,
114772
+ collectMeshPrimitiveIds,
114773
+ isValidStreamMesh,
114774
+ tryParseMeshFromBuffer,
114775
+ parsePrimitiveFromBuffer,
114776
+ commitPendingMesh,
114774
114777
  _content2,
114775
114778
  _content3,
114776
114779
  _done,
114777
114780
  _value,
114778
114781
  newBuf,
114779
- dataView,
114782
+ meshResult,
114783
+ nextMeshResult,
114780
114784
  primitiveResult,
114781
114785
  primitiveData,
114782
- consumedBytes,
114783
- _this$parsePrimitiveD,
114784
- position,
114785
- normal,
114786
- posindex,
114787
- nolindex,
114788
- indices,
114789
- formatted,
114790
- docId,
114791
- length,
114792
- totalLen,
114793
- data,
114794
- mesh,
114795
- jsonStr,
114796
- _docId,
114797
- meshToPrimId,
114798
- hasPendingPrimitive,
114799
- hasPendingMesh,
114800
- _primitiveData,
114801
- primId,
114802
- _args3 = arguments,
114786
+ _args4 = arguments,
114803
114787
  _t,
114804
114788
  _t2,
114805
114789
  _t3,
114806
- _t4,
114807
- _t5;
114808
- return StreamLoader_regenerator().w(function (_context3) {
114809
- while (1) switch (_context3.p = _context3.n) {
114790
+ _t4;
114791
+ return StreamLoader_regenerator().w(function (_context4) {
114792
+ while (1) switch (_context4.p = _context4.n) {
114810
114793
  case 0:
114811
- abortSignal = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : null;
114812
- streamId = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
114794
+ abortSignal = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : null;
114795
+ streamId = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : null;
114813
114796
  batchMeshes = [];
114814
- batchPrimitives = [];
114797
+ batchPrimitiveGroups = [];
114815
114798
  batchSize = this.batchSize;
114816
114799
  batchStart = 0;
114817
114800
  streamStats = {
@@ -114819,8 +114802,28 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114819
114802
  totalMeshes: 0,
114820
114803
  totalPrimitives: 0
114821
114804
  };
114805
+ flattenPrimitiveGroups = function flattenPrimitiveGroups(primitiveGroups) {
114806
+ if (!primitiveGroups || primitiveGroups.length === 0) return [];
114807
+ var primitivesToProcess = [];
114808
+ var usedIds = new Set();
114809
+ primitiveGroups.forEach(function (group) {
114810
+ var primitives = Array.isArray(group) ? group : [group];
114811
+ primitives.forEach(function (primitive) {
114812
+ if (!primitive) return;
114813
+ if (primitive.id == null) {
114814
+ primitivesToProcess.push(primitive);
114815
+ return;
114816
+ }
114817
+ if (usedIds.has(primitive.id)) return;
114818
+ usedIds.add(primitive.id);
114819
+ primitivesToProcess.push(primitive);
114820
+ });
114821
+ });
114822
+ return primitivesToProcess;
114823
+ };
114822
114824
  processStreamBatch = /*#__PURE__*/function () {
114823
- var _ref2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee2(meshesToProcess, primitivesToProcess) {
114825
+ var _ref2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee2(meshesToProcess, primitiveGroupsToProcess) {
114826
+ var primitivesToProcess;
114824
114827
  return StreamLoader_regenerator().w(function (_context2) {
114825
114828
  while (1) switch (_context2.n) {
114826
114829
  case 0:
@@ -114830,6 +114833,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114830
114833
  }
114831
114834
  return _context2.a(2);
114832
114835
  case 1:
114836
+ primitivesToProcess = flattenPrimitiveGroups(primitiveGroupsToProcess);
114833
114837
  _context2.n = 2;
114834
114838
  return _this4.processBatchData(meshesToProcess, primitivesToProcess, list, range, abortSignal);
114835
114839
  case 2:
@@ -114853,7 +114857,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114853
114857
  return null;
114854
114858
  };
114855
114859
  if (!this.worker) {
114856
- _context3.n = 33;
114860
+ _context4.n = 33;
114857
114861
  break;
114858
114862
  }
114859
114863
  localStreamId = streamId || this.createStreamRequestId();
@@ -114861,45 +114865,45 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114861
114865
  if (!_this4.externalEnsureNotInteracting && !_this4.isUserInteracting) return null;
114862
114866
  return _this4.ensureNotInteracting(abortSignal);
114863
114867
  };
114864
- _context3.n = 1;
114868
+ _context4.n = 1;
114865
114869
  return this.workerRequest('streamInit', {
114866
114870
  streamId: localStreamId,
114867
114871
  prefixIdKey: this.prefixIdKey
114868
114872
  });
114869
114873
  case 1:
114870
- _context3.p = 1;
114874
+ _context4.p = 1;
114871
114875
  if (this.debug) performance.mark('while-start');
114872
114876
  case 2:
114873
114877
  if (false) {}
114874
114878
  abortPromise = ensureNotAborted();
114875
114879
  if (!abortPromise) {
114876
- _context3.n = 3;
114880
+ _context4.n = 3;
114877
114881
  break;
114878
114882
  }
114879
- _context3.n = 3;
114883
+ _context4.n = 3;
114880
114884
  return abortPromise;
114881
114885
  case 3:
114882
114886
  interactionPromise = ensureNotInteracting();
114883
114887
  if (!interactionPromise) {
114884
- _context3.n = 4;
114888
+ _context4.n = 4;
114885
114889
  break;
114886
114890
  }
114887
- _context3.n = 4;
114891
+ _context4.n = 4;
114888
114892
  return interactionPromise;
114889
114893
  case 4:
114890
114894
  content = void 0;
114891
- _context3.p = 5;
114892
- _context3.n = 6;
114895
+ _context4.p = 5;
114896
+ _context4.n = 6;
114893
114897
  return reader.read();
114894
114898
  case 6:
114895
- content = _context3.v;
114896
- _context3.n = 9;
114899
+ content = _context4.v;
114900
+ _context4.n = 9;
114897
114901
  break;
114898
114902
  case 7:
114899
- _context3.p = 7;
114900
- _t = _context3.v;
114903
+ _context4.p = 7;
114904
+ _t = _context4.v;
114901
114905
  if (!(_t && _t.name === 'AbortError')) {
114902
- _context3.n = 8;
114906
+ _context4.n = 8;
114903
114907
  break;
114904
114908
  }
114905
114909
  throw _t;
@@ -114908,91 +114912,91 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114908
114912
  case 9:
114909
114913
  _content = content, done = _content.done, value = _content.value;
114910
114914
  if (!done) {
114911
- _context3.n = 20;
114915
+ _context4.n = 20;
114912
114916
  break;
114913
114917
  }
114914
114918
  abortPromiseOnDone = ensureNotAborted();
114915
114919
  if (!abortPromiseOnDone) {
114916
- _context3.n = 10;
114920
+ _context4.n = 10;
114917
114921
  break;
114918
114922
  }
114919
- _context3.n = 10;
114923
+ _context4.n = 10;
114920
114924
  return abortPromiseOnDone;
114921
114925
  case 10:
114922
114926
  if (this.debug) {
114923
114927
  performance.mark('while-end');
114924
114928
  performance.measure('while', 'while-start', 'while-end');
114925
114929
  }
114926
- _context3.n = 11;
114930
+ _context4.n = 11;
114927
114931
  return this.workerRequest('streamFlush', {
114928
114932
  streamId: localStreamId
114929
114933
  });
114930
114934
  case 11:
114931
- flushed = _context3.v;
114935
+ flushed = _context4.v;
114932
114936
  if (flushed !== null && flushed !== void 0 && (_flushed$meshes = flushed.meshes) !== null && _flushed$meshes !== void 0 && _flushed$meshes.length) {
114933
114937
  batchMeshes.push.apply(batchMeshes, StreamLoader_toConsumableArray(flushed.meshes));
114934
- batchPrimitives.push.apply(batchPrimitives, StreamLoader_toConsumableArray(flushed.primitives));
114938
+ batchPrimitiveGroups.push.apply(batchPrimitiveGroups, StreamLoader_toConsumableArray(flushed.primitives));
114935
114939
  }
114936
114940
  case 12:
114937
114941
  if (!(batchMeshes.length - batchStart >= batchSize)) {
114938
- _context3.n = 16;
114942
+ _context4.n = 16;
114939
114943
  break;
114940
114944
  }
114941
114945
  abortPromiseInBatch = ensureNotAborted();
114942
114946
  if (!abortPromiseInBatch) {
114943
- _context3.n = 13;
114947
+ _context4.n = 13;
114944
114948
  break;
114945
114949
  }
114946
- _context3.n = 13;
114950
+ _context4.n = 13;
114947
114951
  return abortPromiseInBatch;
114948
114952
  case 13:
114949
114953
  interactionPromiseInBatch = ensureNotInteracting();
114950
114954
  if (!interactionPromiseInBatch) {
114951
- _context3.n = 14;
114955
+ _context4.n = 14;
114952
114956
  break;
114953
114957
  }
114954
- _context3.n = 14;
114958
+ _context4.n = 14;
114955
114959
  return interactionPromiseInBatch;
114956
114960
  case 14:
114957
114961
  meshesToProcess = batchMeshes.slice(batchStart, batchStart + batchSize);
114958
- primitivesToProcess = batchPrimitives.slice(batchStart, batchStart + batchSize);
114962
+ primitiveGroupsToProcess = batchPrimitiveGroups.slice(batchStart, batchStart + batchSize);
114959
114963
  batchStart += batchSize;
114960
- _context3.n = 15;
114961
- return processStreamBatch(meshesToProcess, primitivesToProcess);
114964
+ _context4.n = 15;
114965
+ return processStreamBatch(meshesToProcess, primitiveGroupsToProcess);
114962
114966
  case 15:
114963
- _context3.n = 12;
114967
+ _context4.n = 12;
114964
114968
  break;
114965
114969
  case 16:
114966
114970
  if (!(batchMeshes.length - batchStart > 0)) {
114967
- _context3.n = 19;
114971
+ _context4.n = 19;
114968
114972
  break;
114969
114973
  }
114970
114974
  _abortPromiseInBatch = ensureNotAborted();
114971
114975
  if (!_abortPromiseInBatch) {
114972
- _context3.n = 17;
114976
+ _context4.n = 17;
114973
114977
  break;
114974
114978
  }
114975
- _context3.n = 17;
114979
+ _context4.n = 17;
114976
114980
  return _abortPromiseInBatch;
114977
114981
  case 17:
114978
114982
  _interactionPromiseInBatch = ensureNotInteracting();
114979
114983
  if (!_interactionPromiseInBatch) {
114980
- _context3.n = 18;
114984
+ _context4.n = 18;
114981
114985
  break;
114982
114986
  }
114983
- _context3.n = 18;
114987
+ _context4.n = 18;
114984
114988
  return _interactionPromiseInBatch;
114985
114989
  case 18:
114986
114990
  _meshesToProcess = batchMeshes.slice(batchStart);
114987
- _primitivesToProcess = batchPrimitives.slice(batchStart);
114991
+ _primitiveGroupsToProcess = batchPrimitiveGroups.slice(batchStart);
114988
114992
  batchStart = batchMeshes.length;
114989
- _context3.n = 19;
114990
- return processStreamBatch(_meshesToProcess, _primitivesToProcess);
114993
+ _context4.n = 19;
114994
+ return processStreamBatch(_meshesToProcess, _primitiveGroupsToProcess);
114991
114995
  case 19:
114992
- return _context3.a(3, 27);
114996
+ return _context4.a(3, 27);
114993
114997
  case 20:
114994
114998
  transferable = (value === null || value === void 0 ? void 0 : value.buffer) instanceof ArrayBuffer ? [value.buffer] : [];
114995
- _context3.n = 21;
114999
+ _context4.n = 21;
114996
115000
  return this.workerRequest('streamPush', {
114997
115001
  streamId: localStreamId,
114998
115002
  chunk: value.buffer,
@@ -115000,92 +115004,240 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115000
115004
  byteLength: value.byteLength
115001
115005
  }, transferable);
115002
115006
  case 21:
115003
- parsed = _context3.v;
115007
+ parsed = _context4.v;
115004
115008
  if (parsed !== null && parsed !== void 0 && (_parsed$meshes = parsed.meshes) !== null && _parsed$meshes !== void 0 && _parsed$meshes.length) {
115005
115009
  batchMeshes.push.apply(batchMeshes, StreamLoader_toConsumableArray(parsed.meshes));
115006
- batchPrimitives.push.apply(batchPrimitives, StreamLoader_toConsumableArray(parsed.primitives));
115010
+ batchPrimitiveGroups.push.apply(batchPrimitiveGroups, StreamLoader_toConsumableArray(parsed.primitives));
115007
115011
  }
115008
115012
  case 22:
115009
115013
  if (!(batchMeshes.length - batchStart >= batchSize)) {
115010
- _context3.n = 26;
115014
+ _context4.n = 26;
115011
115015
  break;
115012
115016
  }
115013
115017
  _abortPromiseInBatch2 = ensureNotAborted();
115014
115018
  if (!_abortPromiseInBatch2) {
115015
- _context3.n = 23;
115019
+ _context4.n = 23;
115016
115020
  break;
115017
115021
  }
115018
- _context3.n = 23;
115022
+ _context4.n = 23;
115019
115023
  return _abortPromiseInBatch2;
115020
115024
  case 23:
115021
115025
  _interactionPromiseInBatch2 = ensureNotInteracting();
115022
115026
  if (!_interactionPromiseInBatch2) {
115023
- _context3.n = 24;
115027
+ _context4.n = 24;
115024
115028
  break;
115025
115029
  }
115026
- _context3.n = 24;
115030
+ _context4.n = 24;
115027
115031
  return _interactionPromiseInBatch2;
115028
115032
  case 24:
115029
115033
  _meshesToProcess2 = batchMeshes.slice(batchStart, batchStart + batchSize);
115030
- _primitivesToProcess2 = batchPrimitives.slice(batchStart, batchStart + batchSize);
115034
+ _primitiveGroupsToProcess2 = batchPrimitiveGroups.slice(batchStart, batchStart + batchSize);
115031
115035
  batchStart += batchSize;
115032
- _context3.n = 25;
115033
- return processStreamBatch(_meshesToProcess2, _primitivesToProcess2);
115036
+ _context4.n = 25;
115037
+ return processStreamBatch(_meshesToProcess2, _primitiveGroupsToProcess2);
115034
115038
  case 25:
115035
- _context3.n = 22;
115039
+ _context4.n = 22;
115036
115040
  break;
115037
115041
  case 26:
115038
115042
  if (batchStart >= batchSize * 4) {
115039
115043
  batchMeshes.splice(0, batchStart);
115040
- batchPrimitives.splice(0, batchStart);
115044
+ batchPrimitiveGroups.splice(0, batchStart);
115041
115045
  batchStart = 0;
115042
115046
  }
115043
- _context3.n = 2;
115047
+ _context4.n = 2;
115044
115048
  break;
115045
115049
  case 27:
115046
- _context3.p = 27;
115047
- _context3.p = 28;
115048
- _context3.n = 29;
115050
+ _context4.p = 27;
115051
+ _context4.p = 28;
115052
+ _context4.n = 29;
115049
115053
  return this.workerRequest('streamDispose', {
115050
115054
  streamId: localStreamId
115051
115055
  });
115052
115056
  case 29:
115053
- _context3.n = 31;
115057
+ _context4.n = 31;
115054
115058
  break;
115055
115059
  case 30:
115056
- _context3.p = 30;
115057
- _t2 = _context3.v;
115060
+ _context4.p = 30;
115061
+ _t2 = _context4.v;
115058
115062
  case 31:
115059
- return _context3.f(27);
115063
+ return _context4.f(27);
115060
115064
  case 32:
115061
- return _context3.a(2, streamStats);
115065
+ return _context4.a(2, streamStats);
115062
115066
  case 33:
115063
115067
  decoder = new TextDecoder('utf-8');
115064
115068
  buffer = new Uint8Array();
115065
- pendingPrimitives = new Map();
115066
- expectingPrimitive = true;
115069
+ expectingMesh = true;
115070
+ pendingMesh = null;
115071
+ pendingPrimitiveIds = new Set();
115072
+ pendingPrimitiveGroups = [];
115073
+ pendingMatchedPrimitiveIds = new Set();
115067
115074
  isFullProps = true;
115075
+ normalizeMesh = function normalizeMesh(mesh) {
115076
+ _this4._applyPrefixId(mesh, 'id');
115077
+ var meshList = Array.isArray(mesh) ? mesh : [mesh];
115078
+ meshList.forEach(function (item) {
115079
+ if (!item) return;
115080
+ if (!Array.isArray(item.primitives)) {
115081
+ item.primitives = [];
115082
+ }
115083
+ _this4._applyPrefixId(item.primitives, 'prmid', item.documentId);
115084
+ });
115085
+ return mesh;
115086
+ };
115087
+ collectMeshPrimitiveIds = function collectMeshPrimitiveIds(mesh) {
115088
+ var ids = [];
115089
+ var meshList = Array.isArray(mesh) ? mesh : [mesh];
115090
+ meshList.forEach(function (item) {
115091
+ if (!item || !Array.isArray(item.primitives)) return;
115092
+ item.primitives.forEach(function (primitive) {
115093
+ if (primitive && primitive.prmid != null) {
115094
+ ids.push(primitive.prmid);
115095
+ }
115096
+ });
115097
+ });
115098
+ return ids;
115099
+ };
115100
+ isValidStreamMesh = function isValidStreamMesh(mesh) {
115101
+ var meshList = Array.isArray(mesh) ? mesh : [mesh];
115102
+ if (meshList.length === 0) return false;
115103
+ return meshList.every(function (item) {
115104
+ return item && StreamLoader_typeof(item) === 'object' && Array.isArray(item.primitives);
115105
+ });
115106
+ };
115107
+ tryParseMeshFromBuffer = function tryParseMeshFromBuffer() {
115108
+ if (buffer.length < 4) {
115109
+ return {
115110
+ status: 'incomplete'
115111
+ };
115112
+ }
115113
+ var length = new DataView(buffer.buffer, buffer.byteOffset).getUint32(0, false);
115114
+ if (length <= 0 || length > 10 * 1024 * 1024) {
115115
+ return {
115116
+ status: 'invalid'
115117
+ };
115118
+ }
115119
+ var totalLen = 4 + length;
115120
+ if (buffer.length < totalLen) {
115121
+ return {
115122
+ status: 'incomplete'
115123
+ };
115124
+ }
115125
+ try {
115126
+ var data = buffer.slice(4, totalLen);
115127
+ var parsedMesh = JSON.parse(decoder.decode(data));
115128
+ if (!isValidStreamMesh(parsedMesh)) {
115129
+ return {
115130
+ status: 'invalid'
115131
+ };
115132
+ }
115133
+ var mesh = normalizeMesh(parsedMesh);
115134
+ return {
115135
+ status: 'success',
115136
+ mesh: mesh,
115137
+ totalLen: totalLen
115138
+ };
115139
+ } catch (e) {
115140
+ return {
115141
+ status: 'invalid'
115142
+ };
115143
+ }
115144
+ };
115145
+ parsePrimitiveFromBuffer = function parsePrimitiveFromBuffer() {
115146
+ var dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
115147
+ var primitiveResult = _this4.parsePrimitive(dataView, buffer, 0, isFullProps);
115148
+ var primitiveData = primitiveResult.primitive;
115149
+ _this4._applyPrefixId(primitiveData, 'id');
115150
+ _this4._applyPrefixId(primitiveData, 'material');
115151
+ if (isFullProps) {
115152
+ var _this4$parsePrimitive = _this4.parsePrimitiveData(primitiveData),
115153
+ position = _this4$parsePrimitive.position,
115154
+ normal = _this4$parsePrimitive.normal,
115155
+ posindex = _this4$parsePrimitive.posindex,
115156
+ nolindex = _this4$parsePrimitive.nolindex,
115157
+ indices = _this4$parsePrimitive.indices;
115158
+ var formatted = _this4.formatPrimitiveData({
115159
+ position: position,
115160
+ normal: normal,
115161
+ posindex: posindex,
115162
+ nolindex: nolindex
115163
+ });
115164
+ delete primitiveData.nolindex;
115165
+ delete primitiveData.posindex;
115166
+ primitiveData.position = formatted.position;
115167
+ primitiveData.normal = formatted.normal;
115168
+ primitiveData.indices = indices;
115169
+ }
115170
+ return {
115171
+ primitive: primitiveData,
115172
+ consumedBytes: primitiveResult.offset
115173
+ };
115174
+ };
115175
+ commitPendingMesh = /*#__PURE__*/function () {
115176
+ var _ref3 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee3() {
115177
+ var meshList;
115178
+ return StreamLoader_regenerator().w(function (_context3) {
115179
+ while (1) switch (_context3.n) {
115180
+ case 0:
115181
+ if (pendingMesh) {
115182
+ _context3.n = 1;
115183
+ break;
115184
+ }
115185
+ return _context3.a(2);
115186
+ case 1:
115187
+ meshList = Array.isArray(pendingMesh) ? pendingMesh : [pendingMesh];
115188
+ meshList.forEach(function (mesh) {
115189
+ batchMeshes.push(mesh);
115190
+ batchPrimitiveGroups.push(pendingPrimitiveGroups);
115191
+ });
115192
+ pendingMesh = null;
115193
+ pendingPrimitiveIds = new Set();
115194
+ pendingPrimitiveGroups = [];
115195
+ pendingMatchedPrimitiveIds = new Set();
115196
+ if (!(batchMeshes.length >= _this4.batchSize)) {
115197
+ _context3.n = 5;
115198
+ break;
115199
+ }
115200
+ _context3.n = 2;
115201
+ return ensureNotAborted();
115202
+ case 2:
115203
+ _context3.n = 3;
115204
+ return _this4.ensureNotInteracting(abortSignal);
115205
+ case 3:
115206
+ _context3.n = 4;
115207
+ return processStreamBatch(batchMeshes, batchPrimitiveGroups);
115208
+ case 4:
115209
+ batchMeshes.length = 0;
115210
+ batchPrimitiveGroups.length = 0;
115211
+ case 5:
115212
+ return _context3.a(2);
115213
+ }
115214
+ }, _callee3);
115215
+ }));
115216
+ return function commitPendingMesh() {
115217
+ return _ref3.apply(this, arguments);
115218
+ };
115219
+ }();
115068
115220
  case 34:
115069
115221
  if (false) {}
115070
- _context3.n = 35;
115222
+ _context4.n = 35;
115071
115223
  return ensureNotAborted();
115072
115224
  case 35:
115073
- _context3.n = 36;
115225
+ _context4.n = 36;
115074
115226
  return this.ensureNotInteracting(abortSignal);
115075
115227
  case 36:
115076
115228
  _content2 = void 0;
115077
- _context3.p = 37;
115078
- _context3.n = 38;
115229
+ _context4.p = 37;
115230
+ _context4.n = 38;
115079
115231
  return reader.read();
115080
115232
  case 38:
115081
- _content2 = _context3.v;
115082
- _context3.n = 41;
115233
+ _content2 = _context4.v;
115234
+ _context4.n = 41;
115083
115235
  break;
115084
115236
  case 39:
115085
- _context3.p = 39;
115086
- _t3 = _context3.v;
115237
+ _context4.p = 39;
115238
+ _t3 = _context4.v;
115087
115239
  if (!(_t3 && _t3.name === 'AbortError')) {
115088
- _context3.n = 40;
115240
+ _context4.n = 40;
115089
115241
  break;
115090
115242
  }
115091
115243
  throw _t3;
@@ -115094,178 +115246,125 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115094
115246
  case 41:
115095
115247
  _content3 = _content2, _done = _content3.done, _value = _content3.value;
115096
115248
  if (!_done) {
115097
- _context3.n = 46;
115249
+ _context4.n = 47;
115098
115250
  break;
115099
115251
  }
115100
- _context3.n = 42;
115252
+ _context4.n = 42;
115101
115253
  return ensureNotAborted();
115102
115254
  case 42:
115255
+ _context4.n = 43;
115256
+ return commitPendingMesh();
115257
+ case 43:
115103
115258
  if (!(batchMeshes.length > 0)) {
115104
- _context3.n = 45;
115259
+ _context4.n = 46;
115105
115260
  break;
115106
115261
  }
115107
- _context3.n = 43;
115262
+ _context4.n = 44;
115108
115263
  return ensureNotAborted();
115109
- case 43:
115110
- _context3.n = 44;
115111
- return this.ensureNotInteracting(abortSignal);
115112
115264
  case 44:
115113
- _context3.n = 45;
115114
- return processStreamBatch(batchMeshes, batchPrimitives);
115265
+ _context4.n = 45;
115266
+ return this.ensureNotInteracting(abortSignal);
115115
115267
  case 45:
115116
- return _context3.a(3, 65);
115268
+ _context4.n = 46;
115269
+ return processStreamBatch(batchMeshes, batchPrimitiveGroups);
115117
115270
  case 46:
115271
+ return _context4.a(3, 63);
115272
+ case 47:
115118
115273
  newBuf = new Uint8Array(buffer.length + _value.length);
115119
115274
  newBuf.set(buffer);
115120
115275
  newBuf.set(_value, buffer.length);
115121
115276
  buffer = newBuf;
115122
- case 47:
115277
+ case 48:
115123
115278
  if (!(buffer.length > 0)) {
115124
- _context3.n = 64;
115279
+ _context4.n = 62;
115125
115280
  break;
115126
115281
  }
115127
- _context3.n = 48;
115282
+ _context4.n = 49;
115128
115283
  return ensureNotAborted();
115129
- case 48:
115130
- if (!expectingPrimitive) {
115131
- _context3.n = 52;
115284
+ case 49:
115285
+ if (!expectingMesh) {
115286
+ _context4.n = 53;
115132
115287
  break;
115133
115288
  }
115134
- if (!(buffer.length < 12)) {
115135
- _context3.n = 49;
115289
+ meshResult = tryParseMeshFromBuffer();
115290
+ if (!(meshResult.status === 'incomplete')) {
115291
+ _context4.n = 50;
115136
115292
  break;
115137
115293
  }
115138
- return _context3.a(3, 64);
115139
- case 49:
115140
- _context3.p = 49;
115141
- dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
115142
- primitiveResult = this.parsePrimitive(dataView, buffer, 0, isFullProps);
115143
- primitiveData = primitiveResult.primitive;
115144
- this._applyPrefixId(primitiveData, 'id');
115145
- this._applyPrefixId(primitiveData, 'material');
115146
- consumedBytes = primitiveResult.offset;
115147
- if (isFullProps) {
115148
- _this$parsePrimitiveD = this.parsePrimitiveData(primitiveData), position = _this$parsePrimitiveD.position, normal = _this$parsePrimitiveD.normal, posindex = _this$parsePrimitiveD.posindex, nolindex = _this$parsePrimitiveD.nolindex, indices = _this$parsePrimitiveD.indices;
115149
- formatted = this.formatPrimitiveData({
115150
- position: position,
115151
- normal: normal,
115152
- posindex: posindex,
115153
- nolindex: nolindex
115154
- });
115155
- delete primitiveData.nolindex;
115156
- delete primitiveData.posindex;
115157
- primitiveData.position = formatted.position;
115158
- primitiveData.normal = formatted.normal;
115159
- primitiveData.indices = indices;
115160
- }
115161
- docId = primitiveData.id;
115162
- pendingPrimitives.set(docId, primitiveData);
115163
- expectingPrimitive = false;
115164
- buffer = buffer.slice(consumedBytes);
115165
- _context3.n = 51;
115166
- break;
115294
+ return _context4.a(3, 62);
115167
115295
  case 50:
115168
- _context3.p = 50;
115169
- _t4 = _context3.v;
115170
- return _context3.a(3, 64);
115171
- case 51:
115172
- _context3.n = 63;
115173
- break;
115174
- case 52:
115175
- if (!(buffer.length < 4)) {
115176
- _context3.n = 53;
115296
+ if (!(meshResult.status === 'invalid')) {
115297
+ _context4.n = 51;
115177
115298
  break;
115178
115299
  }
115179
- return _context3.a(3, 64);
115300
+ return _context4.a(3, 62);
115301
+ case 51:
115302
+ _context4.n = 52;
115303
+ return commitPendingMesh();
115304
+ case 52:
115305
+ pendingMesh = meshResult.mesh;
115306
+ pendingPrimitiveIds = new Set(collectMeshPrimitiveIds(pendingMesh));
115307
+ pendingPrimitiveGroups = [];
115308
+ pendingMatchedPrimitiveIds = new Set();
115309
+ expectingMesh = false;
115310
+ buffer = buffer.slice(meshResult.totalLen);
115311
+ _context4.n = 61;
115312
+ break;
115180
115313
  case 53:
115181
- length = new DataView(buffer.buffer, buffer.byteOffset).getUint32(0, false);
115182
- if (!(length > 10 * 1024 * 1024)) {
115183
- _context3.n = 54;
115314
+ nextMeshResult = tryParseMeshFromBuffer();
115315
+ if (!(nextMeshResult.status === 'success')) {
115316
+ _context4.n = 55;
115184
115317
  break;
115185
115318
  }
115186
- expectingPrimitive = true;
115187
- return _context3.a(3, 47);
115319
+ _context4.n = 54;
115320
+ return commitPendingMesh();
115188
115321
  case 54:
115189
- totalLen = 4 + length;
115190
- if (!(buffer.length < totalLen)) {
115191
- _context3.n = 55;
115322
+ pendingMesh = nextMeshResult.mesh;
115323
+ pendingPrimitiveIds = new Set(collectMeshPrimitiveIds(pendingMesh));
115324
+ expectingMesh = false;
115325
+ buffer = buffer.slice(nextMeshResult.totalLen);
115326
+ return _context4.a(3, 48);
115327
+ case 55:
115328
+ if (!(buffer.length < 12)) {
115329
+ _context4.n = 56;
115192
115330
  break;
115193
115331
  }
115194
- return _context3.a(3, 64);
115195
- case 55:
115196
- data = buffer.slice(4, totalLen);
115197
- mesh = null;
115198
- _context3.p = 56;
115199
- jsonStr = decoder.decode(data);
115200
- mesh = JSON.parse(jsonStr);
115201
- _context3.n = 58;
115332
+ return _context4.a(3, 62);
115333
+ case 56:
115334
+ primitiveResult = null;
115335
+ _context4.p = 57;
115336
+ primitiveResult = parsePrimitiveFromBuffer();
115337
+ _context4.n = 59;
115202
115338
  break;
115203
- case 57:
115204
- _context3.p = 57;
115205
- _t5 = _context3.v;
115206
- expectingPrimitive = true;
115207
- return _context3.a(3, 47);
115208
115339
  case 58:
115209
- if (!mesh) {
115210
- _context3.n = 63;
115211
- break;
115212
- }
115213
- isFullProps = true;
115214
- this._applyPrefixId(mesh, 'id');
115215
- if (Array.isArray(mesh)) {
115216
- mesh.forEach(function (item) {
115217
- _this4._applyPrefixId(item.primitives, 'prmid', item.documentId);
115218
- });
115219
- } else {
115220
- this._applyPrefixId(mesh.primitives, 'prmid', mesh.documentId);
115221
- }
115222
- _docId = mesh.id;
115223
- meshToPrimId = mesh.primitives.map(function (item) {
115224
- return item.prmid;
115225
- });
115226
- hasPendingPrimitive = meshToPrimId.some(function (item) {
115227
- return pendingPrimitives.has(item);
115228
- });
115229
- hasPendingMesh = pendingPrimitives.has(_docId);
115230
- if (!(hasPendingMesh || hasPendingPrimitive)) {
115231
- _context3.n = 62;
115232
- break;
115233
- }
115234
- _primitiveData = pendingPrimitives.get(_docId);
115235
- if (!hasPendingMesh && hasPendingPrimitive) {
115236
- primId = meshToPrimId[0];
115237
- _primitiveData = pendingPrimitives.get(primId);
115340
+ _context4.p = 58;
115341
+ _t4 = _context4.v;
115342
+ return _context4.a(3, 62);
115343
+ case 59:
115344
+ primitiveData = primitiveResult.primitive;
115345
+ if (pendingPrimitiveIds.has(primitiveData.id)) {
115346
+ pendingPrimitiveGroups.push(primitiveData);
115347
+ pendingMatchedPrimitiveIds.add(primitiveData.id);
115238
115348
  }
115239
- batchMeshes.push(mesh);
115240
- batchPrimitives.push(_primitiveData);
115241
- if (!(batchMeshes.length >= this.batchSize)) {
115242
- _context3.n = 62;
115349
+ buffer = buffer.slice(primitiveResult.consumedBytes);
115350
+ if (!(pendingPrimitiveIds.size > 0 && pendingMatchedPrimitiveIds.size >= pendingPrimitiveIds.size)) {
115351
+ _context4.n = 61;
115243
115352
  break;
115244
115353
  }
115245
- _context3.n = 59;
115246
- return ensureNotAborted();
115247
- case 59:
115248
- _context3.n = 60;
115249
- return this.ensureNotInteracting(abortSignal);
115354
+ _context4.n = 60;
115355
+ return commitPendingMesh();
115250
115356
  case 60:
115251
- _context3.n = 61;
115252
- return processStreamBatch(batchMeshes, batchPrimitives);
115357
+ expectingMesh = true;
115253
115358
  case 61:
115254
- batchMeshes.length = 0;
115255
- batchPrimitives.length = 0;
115256
- case 62:
115257
- expectingPrimitive = false;
115258
- buffer = buffer.slice(totalLen);
115259
- case 63:
115260
- _context3.n = 47;
115359
+ _context4.n = 48;
115261
115360
  break;
115262
- case 64:
115263
- _context3.n = 34;
115361
+ case 62:
115362
+ _context4.n = 34;
115264
115363
  break;
115265
- case 65:
115266
- return _context3.a(2, streamStats);
115364
+ case 63:
115365
+ return _context4.a(2, streamStats);
115267
115366
  }
115268
- }, _callee3, this, [[56, 57], [49, 50], [37, 39], [28, 30], [5, 7], [1,, 27, 32]]);
115367
+ }, _callee4, this, [[57, 58], [37, 39], [28, 30], [5, 7], [1,, 27, 32]]);
115269
115368
  }));
115270
115369
  function parseStreamImmediate(_x, _x2, _x3) {
115271
115370
  return _parseStreamImmediate.apply(this, arguments);
@@ -115277,57 +115376,57 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115277
115376
  }, {
115278
115377
  key: "processBatchData",
115279
115378
  value: function () {
115280
- var _processBatchData = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee4(meshes, primitives, list, range) {
115379
+ var _processBatchData = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee5(meshes, primitives, list, range) {
115281
115380
  var abortSignal,
115282
115381
  renderResult,
115283
- _args4 = arguments,
115284
- _t6;
115285
- return StreamLoader_regenerator().w(function (_context4) {
115286
- while (1) switch (_context4.p = _context4.n) {
115382
+ _args5 = arguments,
115383
+ _t5;
115384
+ return StreamLoader_regenerator().w(function (_context5) {
115385
+ while (1) switch (_context5.p = _context5.n) {
115287
115386
  case 0:
115288
- abortSignal = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : null;
115289
- _context4.p = 1;
115387
+ abortSignal = _args5.length > 4 && _args5[4] !== undefined ? _args5[4] : null;
115388
+ _context5.p = 1;
115290
115389
  if (!(abortSignal && abortSignal.aborted)) {
115291
- _context4.n = 2;
115390
+ _context5.n = 2;
115292
115391
  break;
115293
115392
  }
115294
115393
  throw new DOMException('Request was aborted', 'AbortError');
115295
115394
  case 2:
115296
- _context4.n = 3;
115395
+ _context5.n = 3;
115297
115396
  return this.renderModelData(meshes, primitives, list, range, null, undefined, {
115298
115397
  suppressLoadComplete: true,
115299
115398
  source: 'inRangeDis2'
115300
115399
  });
115301
115400
  case 3:
115302
- renderResult = _context4.v;
115401
+ renderResult = _context5.v;
115303
115402
  if (!(renderResult && renderResult.canceled)) {
115304
- _context4.n = 4;
115403
+ _context5.n = 4;
115305
115404
  break;
115306
115405
  }
115307
115406
  throw new DOMException('Batch loading was canceled', 'AbortError');
115308
115407
  case 4:
115309
115408
  if (!(abortSignal && abortSignal.aborted)) {
115310
- _context4.n = 5;
115409
+ _context5.n = 5;
115311
115410
  break;
115312
115411
  }
115313
115412
  throw new DOMException('Request was aborted', 'AbortError');
115314
115413
  case 5:
115315
- return _context4.a(2, renderResult);
115414
+ return _context5.a(2, renderResult);
115316
115415
  case 6:
115317
- _context4.p = 6;
115318
- _t6 = _context4.v;
115319
- if (!(_t6 && _t6.name === 'AbortError')) {
115320
- _context4.n = 7;
115416
+ _context5.p = 6;
115417
+ _t5 = _context5.v;
115418
+ if (!(_t5 && _t5.name === 'AbortError')) {
115419
+ _context5.n = 7;
115321
115420
  break;
115322
115421
  }
115323
- throw _t6;
115422
+ throw _t5;
115324
115423
  case 7:
115325
- console.error('Failed to render batch data:', _t6);
115326
- throw _t6;
115424
+ console.error('Failed to render batch data:', _t5);
115425
+ throw _t5;
115327
115426
  case 8:
115328
- return _context4.a(2);
115427
+ return _context5.a(2);
115329
115428
  }
115330
- }, _callee4, this, [[1, 6]]);
115429
+ }, _callee5, this, [[1, 6]]);
115331
115430
  }));
115332
115431
  function processBatchData(_x6, _x7, _x8, _x9) {
115333
115432
  return _processBatchData.apply(this, arguments);
@@ -115339,26 +115438,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115339
115438
  }, {
115340
115439
  key: "getPrimitivesByRangeStream",
115341
115440
  value: function () {
115342
- var _getPrimitivesByRangeStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee5(params, list, range) {
115441
+ var _getPrimitivesByRangeStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee6(params, list, range) {
115343
115442
  var abortSignal,
115344
115443
  requestId,
115345
115444
  internalController,
115346
115445
  reader,
115347
115446
  res,
115348
115447
  streamStats,
115349
- _args5 = arguments,
115350
- _t7;
115351
- return StreamLoader_regenerator().w(function (_context5) {
115352
- while (1) switch (_context5.p = _context5.n) {
115448
+ _args6 = arguments,
115449
+ _t6;
115450
+ return StreamLoader_regenerator().w(function (_context6) {
115451
+ while (1) switch (_context6.p = _context6.n) {
115353
115452
  case 0:
115354
- abortSignal = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : null;
115355
- _context5.n = 1;
115453
+ abortSignal = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : null;
115454
+ _context6.n = 1;
115356
115455
  return this.abortAllStreamRequests();
115357
115456
  case 1:
115358
115457
  requestId = this.createStreamRequestId();
115359
115458
  internalController = null;
115360
115459
  reader = null;
115361
- _context5.p = 2;
115460
+ _context6.p = 2;
115362
115461
  internalController = new AbortController();
115363
115462
  this.currentAbortController = internalController;
115364
115463
  this.activeStreamControllers.add(internalController);
@@ -115375,7 +115474,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115375
115474
  }
115376
115475
  }
115377
115476
  if (!internalController.signal.aborted) {
115378
- _context5.n = 3;
115477
+ _context6.n = 3;
115379
115478
  break;
115380
115479
  }
115381
115480
  throw new DOMException('Request was aborted', 'AbortError');
@@ -115383,14 +115482,14 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115383
115482
  params.requestId = requestId;
115384
115483
  params.projectId = this.projectId;
115385
115484
  if (!(this.modelApi && typeof this.modelApi.getPrimitivesByRangeStream === 'function')) {
115386
- _context5.n = 5;
115485
+ _context6.n = 5;
115387
115486
  break;
115388
115487
  }
115389
- _context5.n = 4;
115488
+ _context6.n = 4;
115390
115489
  return this.modelApi.getPrimitivesByRangeStream(params, internalController.signal);
115391
115490
  case 4:
115392
- res = _context5.v;
115393
- _context5.n = 6;
115491
+ res = _context6.v;
115492
+ _context6.n = 6;
115394
115493
  break;
115395
115494
  case 5:
115396
115495
  throw new Error('modelApi.getPrimitivesByRangeStream is not available');
@@ -115398,49 +115497,49 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115398
115497
  reader = res.getReader();
115399
115498
  this.currentStreamReader = reader;
115400
115499
  this.activeStreamReaders.add(reader);
115401
- _context5.n = 7;
115500
+ _context6.n = 7;
115402
115501
  return this.parseStreamImmediate(reader, list, range, internalController.signal, requestId);
115403
115502
  case 7:
115404
- streamStats = _context5.v;
115503
+ streamStats = _context6.v;
115405
115504
  if (!internalController.signal.aborted) {
115406
- _context5.n = 8;
115505
+ _context6.n = 8;
115407
115506
  break;
115408
115507
  }
115409
115508
  throw new DOMException('Request was aborted', 'AbortError');
115410
115509
  case 8:
115411
115510
  if (!res) {
115412
- _context5.n = 9;
115511
+ _context6.n = 9;
115413
115512
  break;
115414
115513
  }
115415
- return _context5.a(2, StreamLoader_objectSpread({
115514
+ return _context6.a(2, StreamLoader_objectSpread({
115416
115515
  stream: res,
115417
115516
  requestId: requestId
115418
115517
  }, streamStats || {}));
115419
115518
  case 9:
115420
- return _context5.a(2, null);
115519
+ return _context6.a(2, null);
115421
115520
  case 10:
115422
- _context5.p = 10;
115423
- _t7 = _context5.v;
115424
- if (!(_t7.name === 'AbortError')) {
115425
- _context5.n = 11;
115521
+ _context6.p = 10;
115522
+ _t6 = _context6.v;
115523
+ if (!(_t6.name === 'AbortError')) {
115524
+ _context6.n = 11;
115426
115525
  break;
115427
115526
  }
115428
- throw _t7;
115527
+ throw _t6;
115429
115528
  case 11:
115430
- console.error(_t7);
115431
- throw _t7;
115529
+ console.error(_t6);
115530
+ throw _t6;
115432
115531
  case 12:
115433
- _context5.p = 12;
115532
+ _context6.p = 12;
115434
115533
  if (reader) this.activeStreamReaders.delete(reader);
115435
115534
  if (internalController) this.activeStreamControllers.delete(internalController);
115436
115535
  if (requestId) this.activeRequestIds.delete(requestId);
115437
115536
  this.currentStreamReader = null;
115438
115537
  this.currentAbortController = null;
115439
- return _context5.f(12);
115538
+ return _context6.f(12);
115440
115539
  case 13:
115441
- return _context5.a(2);
115540
+ return _context6.a(2);
115442
115541
  }
115443
- }, _callee5, this, [[2, 10, 12, 13]]);
115542
+ }, _callee6, this, [[2, 10, 12, 13]]);
115444
115543
  }));
115445
115544
  function getPrimitivesByRangeStream(_x0, _x1, _x10) {
115446
115545
  return _getPrimitivesByRangeStream.apply(this, arguments);
@@ -115450,56 +115549,56 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115450
115549
  }, {
115451
115550
  key: "getPrimitivesByRange",
115452
115551
  value: function () {
115453
- var _getPrimitivesByRange = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee6(params) {
115552
+ var _getPrimitivesByRange = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee7(params) {
115454
115553
  var abortSignal,
115455
115554
  res,
115456
- _args6 = arguments,
115457
- _t8;
115458
- return StreamLoader_regenerator().w(function (_context6) {
115459
- while (1) switch (_context6.p = _context6.n) {
115555
+ _args7 = arguments,
115556
+ _t7;
115557
+ return StreamLoader_regenerator().w(function (_context7) {
115558
+ while (1) switch (_context7.p = _context7.n) {
115460
115559
  case 0:
115461
- abortSignal = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;
115462
- _context6.p = 1;
115560
+ abortSignal = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : null;
115561
+ _context7.p = 1;
115463
115562
  if (!(abortSignal && abortSignal.aborted)) {
115464
- _context6.n = 2;
115563
+ _context7.n = 2;
115465
115564
  break;
115466
115565
  }
115467
115566
  throw new DOMException('Request was aborted', 'AbortError');
115468
115567
  case 2:
115469
- _context6.n = 3;
115568
+ _context7.n = 3;
115470
115569
  return this.modelApi.getPrimitivesByRange(params, abortSignal);
115471
115570
  case 3:
115472
- res = _context6.v;
115571
+ res = _context7.v;
115473
115572
  if (!(abortSignal && abortSignal.aborted)) {
115474
- _context6.n = 4;
115573
+ _context7.n = 4;
115475
115574
  break;
115476
115575
  }
115477
115576
  throw new DOMException('Request was aborted', 'AbortError');
115478
115577
  case 4:
115479
115578
  if (!res) {
115480
- _context6.n = 5;
115579
+ _context7.n = 5;
115481
115580
  break;
115482
115581
  }
115483
- return _context6.a(2, res);
115582
+ return _context7.a(2, res);
115484
115583
  case 5:
115485
115584
  throw new Error('Failed to get primitives');
115486
115585
  case 6:
115487
- _context6.n = 9;
115586
+ _context7.n = 9;
115488
115587
  break;
115489
115588
  case 7:
115490
- _context6.p = 7;
115491
- _t8 = _context6.v;
115492
- if (!(_t8.name === 'AbortError')) {
115493
- _context6.n = 8;
115589
+ _context7.p = 7;
115590
+ _t7 = _context7.v;
115591
+ if (!(_t7.name === 'AbortError')) {
115592
+ _context7.n = 8;
115494
115593
  break;
115495
115594
  }
115496
- throw _t8;
115595
+ throw _t7;
115497
115596
  case 8:
115498
- throw _t8;
115597
+ throw _t7;
115499
115598
  case 9:
115500
- return _context6.a(2);
115599
+ return _context7.a(2);
115501
115600
  }
115502
- }, _callee6, this, [[1, 7]]);
115601
+ }, _callee7, this, [[1, 7]]);
115503
115602
  }));
115504
115603
  function getPrimitivesByRange(_x11) {
115505
115604
  return _getPrimitivesByRange.apply(this, arguments);
@@ -115509,31 +115608,31 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115509
115608
  }, {
115510
115609
  key: "getPrimitivesByMaterial",
115511
115610
  value: function () {
115512
- var _getPrimitivesByMaterial = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee7(params) {
115513
- var res, _t9;
115514
- return StreamLoader_regenerator().w(function (_context7) {
115515
- while (1) switch (_context7.p = _context7.n) {
115611
+ var _getPrimitivesByMaterial = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee8(params) {
115612
+ var res, _t8;
115613
+ return StreamLoader_regenerator().w(function (_context8) {
115614
+ while (1) switch (_context8.p = _context8.n) {
115516
115615
  case 0:
115517
- _context7.p = 0;
115518
- _context7.n = 1;
115616
+ _context8.p = 0;
115617
+ _context8.n = 1;
115519
115618
  return this.modelApi.getPrimitivesByMaterial(params);
115520
115619
  case 1:
115521
- res = _context7.v;
115620
+ res = _context8.v;
115522
115621
  if (!res) {
115523
- _context7.n = 2;
115622
+ _context8.n = 2;
115524
115623
  break;
115525
115624
  }
115526
- return _context7.a(2, res);
115625
+ return _context8.a(2, res);
115527
115626
  case 2:
115528
115627
  throw new Error('Failed to get Material');
115529
115628
  case 3:
115530
- _context7.p = 3;
115531
- _t9 = _context7.v;
115532
- throw _t9;
115629
+ _context8.p = 3;
115630
+ _t8 = _context8.v;
115631
+ throw _t8;
115533
115632
  case 4:
115534
- return _context7.a(2);
115633
+ return _context8.a(2);
115535
115634
  }
115536
- }, _callee7, this, [[0, 3]]);
115635
+ }, _callee8, this, [[0, 3]]);
115537
115636
  }));
115538
115637
  function getPrimitivesByMaterial(_x12) {
115539
115638
  return _getPrimitivesByMaterial.apply(this, arguments);
@@ -115543,29 +115642,29 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115543
115642
  }, {
115544
115643
  key: "getPrimitivesByMergeMaterial",
115545
115644
  value: function () {
115546
- var _getPrimitivesByMergeMaterial = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee8(params) {
115547
- var res, _t0;
115548
- return StreamLoader_regenerator().w(function (_context8) {
115549
- while (1) switch (_context8.p = _context8.n) {
115645
+ var _getPrimitivesByMergeMaterial = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee9(params) {
115646
+ var res, _t9;
115647
+ return StreamLoader_regenerator().w(function (_context9) {
115648
+ while (1) switch (_context9.p = _context9.n) {
115550
115649
  case 0:
115551
- _context8.p = 0;
115650
+ _context9.p = 0;
115552
115651
  if (!(!this.modelApi || typeof this.modelApi.getPrimitivesByMergeMaterial !== 'function')) {
115553
- _context8.n = 1;
115652
+ _context9.n = 1;
115554
115653
  break;
115555
115654
  }
115556
- return _context8.a(2, null);
115655
+ return _context9.a(2, null);
115557
115656
  case 1:
115558
- _context8.n = 2;
115657
+ _context9.n = 2;
115559
115658
  return this.modelApi.getPrimitivesByMergeMaterial(params);
115560
115659
  case 2:
115561
- res = _context8.v;
115562
- return _context8.a(2, res || null);
115660
+ res = _context9.v;
115661
+ return _context9.a(2, res || null);
115563
115662
  case 3:
115564
- _context8.p = 3;
115565
- _t0 = _context8.v;
115566
- return _context8.a(2, null);
115663
+ _context9.p = 3;
115664
+ _t9 = _context9.v;
115665
+ return _context9.a(2, null);
115567
115666
  }
115568
- }, _callee8, this, [[0, 3]]);
115667
+ }, _callee9, this, [[0, 3]]);
115569
115668
  }));
115570
115669
  function getPrimitivesByMergeMaterial(_x13) {
115571
115670
  return _getPrimitivesByMergeMaterial.apply(this, arguments);
@@ -115603,36 +115702,36 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115603
115702
  }, {
115604
115703
  key: "abortAllStreamRequests",
115605
115704
  value: function () {
115606
- var _abortAllStreamRequests = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee9() {
115607
- var requestIds, _i2, _requestIds, requestId, readers, _i3, _readers, reader, _t1, _t10, _t11;
115608
- return StreamLoader_regenerator().w(function (_context9) {
115609
- while (1) switch (_context9.p = _context9.n) {
115705
+ var _abortAllStreamRequests = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee0() {
115706
+ var requestIds, _i2, _requestIds, requestId, readers, _i3, _readers, reader, _t0, _t1, _t10;
115707
+ return StreamLoader_regenerator().w(function (_context0) {
115708
+ while (1) switch (_context0.p = _context0.n) {
115610
115709
  case 0:
115611
- _context9.p = 0;
115710
+ _context0.p = 0;
115612
115711
  requestIds = Array.from(this.activeRequestIds);
115613
115712
  _i2 = 0, _requestIds = requestIds;
115614
115713
  case 1:
115615
115714
  if (!(_i2 < _requestIds.length)) {
115616
- _context9.n = 6;
115715
+ _context0.n = 6;
115617
115716
  break;
115618
115717
  }
115619
115718
  requestId = _requestIds[_i2];
115620
115719
  if (!(typeof this.onCancelRequestId === 'function')) {
115621
- _context9.n = 5;
115720
+ _context0.n = 5;
115622
115721
  break;
115623
115722
  }
115624
- _context9.p = 2;
115625
- _context9.n = 3;
115723
+ _context0.p = 2;
115724
+ _context0.n = 3;
115626
115725
  return this.onCancelRequestId(requestId);
115627
115726
  case 3:
115628
- _context9.n = 5;
115727
+ _context0.n = 5;
115629
115728
  break;
115630
115729
  case 4:
115631
- _context9.p = 4;
115632
- _t1 = _context9.v;
115730
+ _context0.p = 4;
115731
+ _t0 = _context0.v;
115633
115732
  case 5:
115634
115733
  _i2++;
115635
- _context9.n = 1;
115734
+ _context0.n = 1;
115636
115735
  break;
115637
115736
  case 6:
115638
115737
  this.activeRequestIds.clear();
@@ -115647,25 +115746,25 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115647
115746
  _i3 = 0, _readers = readers;
115648
115747
  case 7:
115649
115748
  if (!(_i3 < _readers.length)) {
115650
- _context9.n = 12;
115749
+ _context0.n = 12;
115651
115750
  break;
115652
115751
  }
115653
115752
  reader = _readers[_i3];
115654
- _context9.p = 8;
115655
- _context9.n = 9;
115753
+ _context0.p = 8;
115754
+ _context0.n = 9;
115656
115755
  return reader.cancel();
115657
115756
  case 9:
115658
- _context9.n = 11;
115757
+ _context0.n = 11;
115659
115758
  break;
115660
115759
  case 10:
115661
- _context9.p = 10;
115662
- _t10 = _context9.v;
115760
+ _context0.p = 10;
115761
+ _t1 = _context0.v;
115663
115762
  case 11:
115664
115763
  _i3++;
115665
- _context9.n = 7;
115764
+ _context0.n = 7;
115666
115765
  break;
115667
115766
  case 12:
115668
- _context9.p = 12;
115767
+ _context0.p = 12;
115669
115768
  if (this.currentAbortController) {
115670
115769
  try {
115671
115770
  this.currentAbortController.abort();
@@ -115673,26 +115772,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115673
115772
  this.currentAbortController = null;
115674
115773
  }
115675
115774
  if (!this.currentStreamReader) {
115676
- _context9.n = 17;
115775
+ _context0.n = 17;
115677
115776
  break;
115678
115777
  }
115679
- _context9.p = 13;
115680
- _context9.n = 14;
115778
+ _context0.p = 13;
115779
+ _context0.n = 14;
115681
115780
  return this.currentStreamReader.cancel();
115682
115781
  case 14:
115683
- _context9.n = 16;
115782
+ _context0.n = 16;
115684
115783
  break;
115685
115784
  case 15:
115686
- _context9.p = 15;
115687
- _t11 = _context9.v;
115785
+ _context0.p = 15;
115786
+ _t10 = _context0.v;
115688
115787
  case 16:
115689
115788
  this.currentStreamReader = null;
115690
115789
  case 17:
115691
- return _context9.f(12);
115790
+ return _context0.f(12);
115692
115791
  case 18:
115693
- return _context9.a(2);
115792
+ return _context0.a(2);
115694
115793
  }
115695
- }, _callee9, this, [[13, 15], [8, 10], [2, 4], [0,, 12, 18]]);
115794
+ }, _callee0, this, [[13, 15], [8, 10], [2, 4], [0,, 12, 18]]);
115696
115795
  }));
115697
115796
  function abortAllStreamRequests() {
115698
115797
  return _abortAllStreamRequests.apply(this, arguments);
@@ -115704,52 +115803,52 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115704
115803
  }, {
115705
115804
  key: "fetchPrimitiveBufferByStream",
115706
115805
  value: function () {
115707
- var _fetchPrimitiveBufferByStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee0(range, list) {
115806
+ var _fetchPrimitiveBufferByStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee1(range, list) {
115708
115807
  var abortSignal,
115709
115808
  requestId,
115710
115809
  request,
115711
115810
  streamResult,
115712
- _args0 = arguments,
115713
- _t12;
115714
- return StreamLoader_regenerator().w(function (_context0) {
115715
- while (1) switch (_context0.p = _context0.n) {
115811
+ _args1 = arguments,
115812
+ _t11;
115813
+ return StreamLoader_regenerator().w(function (_context1) {
115814
+ while (1) switch (_context1.p = _context1.n) {
115716
115815
  case 0:
115717
- abortSignal = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : null;
115718
- requestId = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : null;
115719
- _context0.p = 1;
115720
- _context0.n = 2;
115816
+ abortSignal = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
115817
+ requestId = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : null;
115818
+ _context1.p = 1;
115819
+ _context1.n = 2;
115721
115820
  return this.abortAllStreamRequests();
115722
115821
  case 2:
115723
115822
  request = this.createAbortableRequest(requestId); // Use requestId if provided as key? Logic slightly different in utils
115724
115823
  // Adaptation: utils used getPrimitivesByRangeStreamWithAutoAbort which calls getPrimitivesByRangeStream
115725
115824
  // Here I simplify by calling getPrimitivesByRangeStream directly but managing request key
115726
- _context0.n = 3;
115825
+ _context1.n = 3;
115727
115826
  return this.getPrimitivesByRangeStream(range, list, range, abortSignal || request.signal);
115728
115827
  case 3:
115729
- streamResult = _context0.v;
115828
+ streamResult = _context1.v;
115730
115829
  this.cleanupRequest(request.requestId);
115731
115830
  if (streamResult) {
115732
- _context0.n = 4;
115831
+ _context1.n = 4;
115733
115832
  break;
115734
115833
  }
115735
- return _context0.a(2, null);
115834
+ return _context1.a(2, null);
115736
115835
  case 4:
115737
- return _context0.a(2, streamResult);
115836
+ return _context1.a(2, streamResult);
115738
115837
  case 5:
115739
- _context0.p = 5;
115740
- _t12 = _context0.v;
115741
- if (_t12.name === 'AbortError') {
115838
+ _context1.p = 5;
115839
+ _t11 = _context1.v;
115840
+ if (_t11.name === 'AbortError') {
115742
115841
  // throw error;
115743
115842
  }
115744
115843
  if (!(requestId && this.currentRequestId !== requestId)) {
115745
- _context0.n = 6;
115844
+ _context1.n = 6;
115746
115845
  break;
115747
115846
  }
115748
- return _context0.a(2, null);
115847
+ return _context1.a(2, null);
115749
115848
  case 6:
115750
- return _context0.a(2);
115849
+ return _context1.a(2);
115751
115850
  }
115752
- }, _callee0, this, [[1, 5]]);
115851
+ }, _callee1, this, [[1, 5]]);
115753
115852
  }));
115754
115853
  function fetchPrimitiveBufferByStream(_x14, _x15) {
115755
115854
  return _fetchPrimitiveBufferByStream.apply(this, arguments);
@@ -115759,58 +115858,58 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115759
115858
  }, {
115760
115859
  key: "fetchPrimitiveBuffer",
115761
115860
  value: function () {
115762
- var _fetchPrimitiveBuffer = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee1(range) {
115861
+ var _fetchPrimitiveBuffer = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee10(range) {
115763
115862
  var abortSignal,
115764
115863
  requestId,
115765
115864
  request,
115766
- buffer,
115767
- _args1 = arguments,
115768
- _t13;
115769
- return StreamLoader_regenerator().w(function (_context1) {
115770
- while (1) switch (_context1.p = _context1.n) {
115865
+ _buffer,
115866
+ _args10 = arguments,
115867
+ _t12;
115868
+ return StreamLoader_regenerator().w(function (_context10) {
115869
+ while (1) switch (_context10.p = _context10.n) {
115771
115870
  case 0:
115772
- abortSignal = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : null;
115773
- requestId = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
115774
- _context1.p = 1;
115871
+ abortSignal = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : null;
115872
+ requestId = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : null;
115873
+ _context10.p = 1;
115775
115874
  request = this.createAbortableRequest(requestId || 'default');
115776
- _context1.n = 2;
115875
+ _context10.n = 2;
115777
115876
  return this.getPrimitivesByRange(range, abortSignal || request.signal);
115778
115877
  case 2:
115779
- buffer = _context1.v;
115878
+ _buffer = _context10.v;
115780
115879
  this.cleanupRequest(request.requestId);
115781
- if (!(!buffer || buffer.byteLength === 0)) {
115782
- _context1.n = 3;
115880
+ if (!(!_buffer || _buffer.byteLength === 0)) {
115881
+ _context10.n = 3;
115783
115882
  break;
115784
115883
  }
115785
- return _context1.a(2, null);
115884
+ return _context10.a(2, null);
115786
115885
  case 3:
115787
- if (!(buffer.byteLength < 4)) {
115788
- _context1.n = 4;
115886
+ if (!(_buffer.byteLength < 4)) {
115887
+ _context10.n = 4;
115789
115888
  break;
115790
115889
  }
115791
- return _context1.a(2, null);
115890
+ return _context10.a(2, null);
115792
115891
  case 4:
115793
- return _context1.a(2, buffer);
115892
+ return _context10.a(2, _buffer);
115794
115893
  case 5:
115795
- _context1.p = 5;
115796
- _t13 = _context1.v;
115797
- if (!(_t13.name === 'AbortError')) {
115798
- _context1.n = 6;
115894
+ _context10.p = 5;
115895
+ _t12 = _context10.v;
115896
+ if (!(_t12.name === 'AbortError')) {
115897
+ _context10.n = 6;
115799
115898
  break;
115800
115899
  }
115801
- throw _t13;
115900
+ throw _t12;
115802
115901
  case 6:
115803
115902
  if (!(requestId && this.currentRequestId !== requestId)) {
115804
- _context1.n = 7;
115903
+ _context10.n = 7;
115805
115904
  break;
115806
115905
  }
115807
- return _context1.a(2, null);
115906
+ return _context10.a(2, null);
115808
115907
  case 7:
115809
- throw _t13;
115908
+ throw _t12;
115810
115909
  case 8:
115811
- return _context1.a(2);
115910
+ return _context10.a(2);
115812
115911
  }
115813
- }, _callee1, this, [[1, 5]]);
115912
+ }, _callee10, this, [[1, 5]]);
115814
115913
  }));
115815
115914
  function fetchPrimitiveBuffer(_x16) {
115816
115915
  return _fetchPrimitiveBuffer.apply(this, arguments);
@@ -115820,13 +115919,13 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115820
115919
  }, {
115821
115920
  key: "parseBufferData",
115822
115921
  value: function () {
115823
- var _parseBufferData = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee10(buffer) {
115922
+ var _parseBufferData = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee11(buffer) {
115824
115923
  var transferable;
115825
- return StreamLoader_regenerator().w(function (_context10) {
115826
- while (1) switch (_context10.n) {
115924
+ return StreamLoader_regenerator().w(function (_context11) {
115925
+ while (1) switch (_context11.n) {
115827
115926
  case 0:
115828
115927
  if (!this.worker) {
115829
- _context10.n = 1;
115928
+ _context11.n = 1;
115830
115929
  break;
115831
115930
  }
115832
115931
  transferable = [];
@@ -115835,16 +115934,16 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115835
115934
  } else if (buffer.buffer instanceof ArrayBuffer) {
115836
115935
  transferable.push(buffer.buffer);
115837
115936
  }
115838
- return _context10.a(2, this.workerRequest('parseBufferData', {
115937
+ return _context11.a(2, this.workerRequest('parseBufferData', {
115839
115938
  buffer: buffer,
115840
115939
  prefixIdKey: this.prefixIdKey
115841
115940
  }, transferable));
115842
115941
  case 1:
115843
- return _context10.a(2, this._parseBufferDataSync(buffer));
115942
+ return _context11.a(2, this._parseBufferDataSync(buffer));
115844
115943
  case 2:
115845
- return _context10.a(2);
115944
+ return _context11.a(2);
115846
115945
  }
115847
- }, _callee10, this);
115946
+ }, _callee11, this);
115848
115947
  }));
115849
115948
  function parseBufferData(_x17) {
115850
115949
  return _parseBufferData.apply(this, arguments);
@@ -115854,17 +115953,17 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115854
115953
  }, {
115855
115954
  key: "_parseBufferDataSync",
115856
115955
  value: function () {
115857
- var _parseBufferDataSync2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee11(buffer) {
115956
+ var _parseBufferDataSync2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee12(buffer) {
115858
115957
  var _this6 = this;
115859
- var uint8Array, dataView, meshJsonBytes, primitives, offset, meshJsonLength, decoder, meshJsonStr, mesh, result, i, primitive, _this$parsePrimitiveD2, position, normal, posindex, nolindex, indices, formatted, _t14, _t15, _t16;
115860
- return StreamLoader_regenerator().w(function (_context11) {
115861
- while (1) switch (_context11.p = _context11.n) {
115958
+ var uint8Array, dataView, meshJsonBytes, primitives, offset, meshJsonLength, _decoder, meshJsonStr, mesh, result, i, primitive, _this$parsePrimitiveD, position, normal, posindex, nolindex, indices, formatted, _t13, _t14, _t15;
115959
+ return StreamLoader_regenerator().w(function (_context12) {
115960
+ while (1) switch (_context12.p = _context12.n) {
115862
115961
  case 0:
115863
115962
  uint8Array = null;
115864
115963
  dataView = null;
115865
115964
  meshJsonBytes = null;
115866
115965
  primitives = [];
115867
- _context11.p = 1;
115966
+ _context12.p = 1;
115868
115967
  uint8Array = new Uint8Array(buffer);
115869
115968
  dataView = new DataView(buffer);
115870
115969
  offset = 0;
@@ -115872,10 +115971,10 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115872
115971
  offset += 4;
115873
115972
  meshJsonBytes = new Uint8Array(uint8Array.buffer.slice(offset, offset + meshJsonLength));
115874
115973
  offset += meshJsonLength;
115875
- decoder = new TextDecoder('utf-8');
115876
- meshJsonStr = decoder.decode(meshJsonBytes);
115974
+ _decoder = new TextDecoder('utf-8');
115975
+ meshJsonStr = _decoder.decode(meshJsonBytes);
115877
115976
  meshJsonBytes = null;
115878
- _context11.p = 2;
115977
+ _context12.p = 2;
115879
115978
  mesh = JSON.parse(meshJsonStr);
115880
115979
  this._applyPrefixId(mesh, 'id');
115881
115980
  if (Array.isArray(mesh)) {
@@ -115885,45 +115984,45 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115885
115984
  } else {
115886
115985
  this._applyPrefixId(mesh.primitives, 'prmid', mesh.documentId);
115887
115986
  }
115888
- _context11.n = 4;
115987
+ _context12.n = 4;
115889
115988
  break;
115890
115989
  case 3:
115891
- _context11.p = 3;
115892
- _t14 = _context11.v;
115893
- console.error('JSON 解析失败:', _t14, meshJsonStr);
115990
+ _context12.p = 3;
115991
+ _t13 = _context12.v;
115992
+ console.error('JSON 解析失败:', _t13, meshJsonStr);
115894
115993
  throw new Error('JSON解析失败');
115895
115994
  case 4:
115896
115995
  if (!(offset < uint8Array.length)) {
115897
- _context11.n = 9;
115996
+ _context12.n = 9;
115898
115997
  break;
115899
115998
  }
115900
- _context11.p = 5;
115999
+ _context12.p = 5;
115901
116000
  result = this.parsePrimitive(dataView, uint8Array, offset);
115902
116001
  console.log('result', result);
115903
116002
  if (result) {
115904
- _context11.n = 6;
116003
+ _context12.n = 6;
115905
116004
  break;
115906
116005
  }
115907
- return _context11.a(3, 9);
116006
+ return _context12.a(3, 9);
115908
116007
  case 6:
115909
116008
  primitives.push(result.primitive);
115910
116009
  offset = result.offset;
115911
- _context11.n = 8;
116010
+ _context12.n = 8;
115912
116011
  break;
115913
116012
  case 7:
115914
- _context11.p = 7;
115915
- _t15 = _context11.v;
115916
- console.error('解析失败,偏移:', offset, _t15);
115917
- return _context11.a(3, 9);
116013
+ _context12.p = 7;
116014
+ _t14 = _context12.v;
116015
+ console.error('解析失败,偏移:', offset, _t14);
116016
+ return _context12.a(3, 9);
115918
116017
  case 8:
115919
- _context11.n = 4;
116018
+ _context12.n = 4;
115920
116019
  break;
115921
116020
  case 9:
115922
116021
  for (i = 0; i < primitives.length; i++) {
115923
116022
  primitive = primitives[i];
115924
116023
  this._applyPrefixId(primitive, 'id');
115925
116024
  this._applyPrefixId(primitive, 'material');
115926
- _this$parsePrimitiveD2 = this.parsePrimitiveData(primitive), position = _this$parsePrimitiveD2.position, normal = _this$parsePrimitiveD2.normal, posindex = _this$parsePrimitiveD2.posindex, nolindex = _this$parsePrimitiveD2.nolindex, indices = _this$parsePrimitiveD2.indices;
116025
+ _this$parsePrimitiveD = this.parsePrimitiveData(primitive), position = _this$parsePrimitiveD.position, normal = _this$parsePrimitiveD.normal, posindex = _this$parsePrimitiveD.posindex, nolindex = _this$parsePrimitiveD.nolindex, indices = _this$parsePrimitiveD.indices;
115927
116026
  formatted = this.formatPrimitiveData({
115928
116027
  position: position,
115929
116028
  normal: normal,
@@ -115936,24 +116035,24 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115936
116035
  primitive.normal = formatted.normal;
115937
116036
  primitive.indices = indices;
115938
116037
  }
115939
- return _context11.a(2, {
116038
+ return _context12.a(2, {
115940
116039
  mesh: mesh,
115941
116040
  primitives: primitives
115942
116041
  });
115943
116042
  case 10:
115944
- _context11.p = 10;
115945
- _t16 = _context11.v;
115946
- throw _t16;
116043
+ _context12.p = 10;
116044
+ _t15 = _context12.v;
116045
+ throw _t15;
115947
116046
  case 11:
115948
- _context11.p = 11;
116047
+ _context12.p = 11;
115949
116048
  uint8Array = null;
115950
116049
  dataView = null;
115951
116050
  meshJsonBytes = null;
115952
- return _context11.f(11);
116051
+ return _context12.f(11);
115953
116052
  case 12:
115954
- return _context11.a(2);
116053
+ return _context12.a(2);
115955
116054
  }
115956
- }, _callee11, this, [[5, 7], [2, 3], [1, 10, 11, 12]]);
116055
+ }, _callee12, this, [[5, 7], [2, 3], [1, 10, 11, 12]]);
115957
116056
  }));
115958
116057
  function _parseBufferDataSync(_x18) {
115959
116058
  return _parseBufferDataSync2.apply(this, arguments);
@@ -115963,7 +116062,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115963
116062
  }, {
115964
116063
  key: "fetchJsonSync",
115965
116064
  value: function () {
115966
- var _fetchJsonSync = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee12(list, range) {
116065
+ var _fetchJsonSync = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee13(list, range) {
115967
116066
  var abortSignal,
115968
116067
  requestId,
115969
116068
  buffer,
@@ -115972,65 +116071,65 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115972
116071
  _yield$this$parseBuff,
115973
116072
  mesh,
115974
116073
  parsed,
115975
- _args12 = arguments,
115976
- _t17;
115977
- return StreamLoader_regenerator().w(function (_context12) {
115978
- while (1) switch (_context12.p = _context12.n) {
116074
+ _args13 = arguments,
116075
+ _t16;
116076
+ return StreamLoader_regenerator().w(function (_context13) {
116077
+ while (1) switch (_context13.p = _context13.n) {
115979
116078
  case 0:
115980
- abortSignal = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : null;
115981
- requestId = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : null;
116079
+ abortSignal = _args13.length > 2 && _args13[2] !== undefined ? _args13[2] : null;
116080
+ requestId = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : null;
115982
116081
  buffer = null;
115983
116082
  primitives = [];
115984
- _context12.p = 1;
116083
+ _context13.p = 1;
115985
116084
  loadStartTime = Date.now();
115986
- _context12.n = 2;
116085
+ _context13.n = 2;
115987
116086
  return this.fetchPrimitiveBuffer(range, abortSignal, requestId);
115988
116087
  case 2:
115989
- buffer = _context12.v;
116088
+ buffer = _context13.v;
115990
116089
  if (buffer) {
115991
- _context12.n = 3;
116090
+ _context13.n = 3;
115992
116091
  break;
115993
116092
  }
115994
- return _context12.a(2, {
116093
+ return _context13.a(2, {
115995
116094
  primitives: []
115996
116095
  });
115997
116096
  case 3:
115998
- _context12.n = 4;
116097
+ _context13.n = 4;
115999
116098
  return this.parseBufferData(buffer);
116000
116099
  case 4:
116001
- _yield$this$parseBuff = _context12.v;
116100
+ _yield$this$parseBuff = _context13.v;
116002
116101
  mesh = _yield$this$parseBuff.mesh;
116003
116102
  parsed = _yield$this$parseBuff.primitives;
116004
116103
  primitives = parsed;
116005
116104
  if (!(typeof this.renderModelData === 'function')) {
116006
- _context12.n = 5;
116105
+ _context13.n = 5;
116007
116106
  break;
116008
116107
  }
116009
- _context12.n = 5;
116108
+ _context13.n = 5;
116010
116109
  return this.renderModelData(mesh, primitives, list, range);
116011
116110
  case 5:
116012
- return _context12.a(2, {
116111
+ return _context13.a(2, {
116013
116112
  primitives: primitives,
116014
116113
  mesh: mesh
116015
116114
  });
116016
116115
  case 6:
116017
- _context12.p = 6;
116018
- _t17 = _context12.v;
116019
- if (!(_t17.name === 'AbortError')) {
116020
- _context12.n = 7;
116116
+ _context13.p = 6;
116117
+ _t16 = _context13.v;
116118
+ if (!(_t16.name === 'AbortError')) {
116119
+ _context13.n = 7;
116021
116120
  break;
116022
116121
  }
116023
- throw _t17;
116122
+ throw _t16;
116024
116123
  case 7:
116025
116124
  if (!(requestId && this.currentRequestId !== requestId)) {
116026
- _context12.n = 8;
116125
+ _context13.n = 8;
116027
116126
  break;
116028
116127
  }
116029
- return _context12.a(2);
116128
+ return _context13.a(2);
116030
116129
  case 8:
116031
- throw _t17;
116130
+ throw _t16;
116032
116131
  case 9:
116033
- _context12.p = 9;
116132
+ _context13.p = 9;
116034
116133
  try {
116035
116134
  buffer = null;
116036
116135
  primitives = null;
@@ -116040,11 +116139,11 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116040
116139
  } catch (cleanupErr) {
116041
116140
  console.warn('内存清理时发生错误:', cleanupErr);
116042
116141
  }
116043
- return _context12.f(9);
116142
+ return _context13.f(9);
116044
116143
  case 10:
116045
- return _context12.a(2);
116144
+ return _context13.a(2);
116046
116145
  }
116047
- }, _callee12, this, [[1, 6, 9, 10]]);
116146
+ }, _callee13, this, [[1, 6, 9, 10]]);
116048
116147
  }));
116049
116148
  function fetchJsonSync(_x19, _x20) {
116050
116149
  return _fetchJsonSync.apply(this, arguments);
@@ -116054,47 +116153,47 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116054
116153
  }, {
116055
116154
  key: "fetchJsonStream",
116056
116155
  value: function () {
116057
- var _fetchJsonStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee13(list, range) {
116156
+ var _fetchJsonStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee14(list, range) {
116058
116157
  var abortSignal,
116059
116158
  requestId,
116060
116159
  loadStartTime,
116061
116160
  streamResult,
116062
- _args13 = arguments,
116063
- _t18;
116064
- return StreamLoader_regenerator().w(function (_context13) {
116065
- while (1) switch (_context13.p = _context13.n) {
116161
+ _args14 = arguments,
116162
+ _t17;
116163
+ return StreamLoader_regenerator().w(function (_context14) {
116164
+ while (1) switch (_context14.p = _context14.n) {
116066
116165
  case 0:
116067
- abortSignal = _args13.length > 2 && _args13[2] !== undefined ? _args13[2] : null;
116068
- requestId = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : null;
116069
- _context13.p = 1;
116166
+ abortSignal = _args14.length > 2 && _args14[2] !== undefined ? _args14[2] : null;
116167
+ requestId = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : null;
116168
+ _context14.p = 1;
116070
116169
  loadStartTime = Date.now();
116071
- _context13.n = 2;
116170
+ _context14.n = 2;
116072
116171
  return this.fetchPrimitiveBufferByStream(range, list, abortSignal, requestId);
116073
116172
  case 2:
116074
- streamResult = _context13.v;
116075
- return _context13.a(2, StreamLoader_objectSpread(StreamLoader_objectSpread({}, streamResult || {}), {}, {
116173
+ streamResult = _context14.v;
116174
+ return _context14.a(2, StreamLoader_objectSpread(StreamLoader_objectSpread({}, streamResult || {}), {}, {
116076
116175
  duration: Date.now() - loadStartTime
116077
116176
  }));
116078
116177
  case 3:
116079
- _context13.p = 3;
116080
- _t18 = _context13.v;
116081
- if (!(_t18.name === 'AbortError')) {
116082
- _context13.n = 4;
116178
+ _context14.p = 3;
116179
+ _t17 = _context14.v;
116180
+ if (!(_t17.name === 'AbortError')) {
116181
+ _context14.n = 4;
116083
116182
  break;
116084
116183
  }
116085
- throw _t18;
116184
+ throw _t17;
116086
116185
  case 4:
116087
116186
  if (!(requestId && this.currentRequestId !== requestId)) {
116088
- _context13.n = 5;
116187
+ _context14.n = 5;
116089
116188
  break;
116090
116189
  }
116091
- return _context13.a(2);
116190
+ return _context14.a(2);
116092
116191
  case 5:
116093
- throw _t18;
116192
+ throw _t17;
116094
116193
  case 6:
116095
- return _context13.a(2);
116194
+ return _context14.a(2);
116096
116195
  }
116097
- }, _callee13, this, [[1, 3]]);
116196
+ }, _callee14, this, [[1, 3]]);
116098
116197
  }));
116099
116198
  function fetchJsonStream(_x21, _x22) {
116100
116199
  return _fetchJsonStream.apply(this, arguments);
@@ -116182,8 +116281,20 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116182
116281
  if (dataView.byteLength < offset + 12) {
116183
116282
  throw new Error('Insufficient data for primitive header');
116184
116283
  }
116185
- primitive.id = dataView.getInt32(offset, false);
116284
+ var primitiveIdTextLen = dataView.getUint32(offset, false);
116186
116285
  offset += 4;
116286
+ if (primitiveIdTextLen === 0xffffffff) {
116287
+ primitive.id = null;
116288
+ } else if (primitiveIdTextLen > 0) {
116289
+ if (dataView.byteLength < offset + primitiveIdTextLen) {
116290
+ throw new Error('Insufficient data for primitive id content');
116291
+ }
116292
+ var textBytes = uint8Array.subarray(offset, offset + primitiveIdTextLen);
116293
+ primitive.id = new TextDecoder('utf-8').decode(textBytes);
116294
+ offset += primitiveIdTextLen;
116295
+ } else {
116296
+ primitive.id = '';
116297
+ }
116187
116298
  if (dataView.byteLength < offset + 4) {
116188
116299
  throw new Error('Insufficient data for GeomText length');
116189
116300
  }
@@ -116195,14 +116306,29 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116195
116306
  if (dataView.byteLength < offset + documentTextLen) {
116196
116307
  throw new Error('Insufficient data for GeomText content');
116197
116308
  }
116198
- var textBytes = uint8Array.subarray(offset, offset + documentTextLen);
116199
- primitive.documentId = new TextDecoder('utf-8').decode(textBytes);
116309
+ var _textBytes = uint8Array.subarray(offset, offset + documentTextLen);
116310
+ primitive.documentId = new TextDecoder('utf-8').decode(_textBytes);
116200
116311
  offset += documentTextLen;
116201
116312
  } else {
116202
116313
  primitive.documentId = '';
116203
116314
  }
116204
- primitive.material = dataView.getInt32(offset, false);
116315
+ if (dataView.byteLength < offset + 4) {
116316
+ throw new Error('Insufficient data for Material length');
116317
+ }
116318
+ var materialTextLen = dataView.getUint32(offset, false);
116205
116319
  offset += 4;
116320
+ if (materialTextLen === 0xffffffff) {
116321
+ primitive.material = null;
116322
+ } else if (materialTextLen > 0) {
116323
+ if (dataView.byteLength < offset + materialTextLen) {
116324
+ throw new Error('Insufficient data for Material content');
116325
+ }
116326
+ var _textBytes2 = uint8Array.subarray(offset, offset + materialTextLen);
116327
+ primitive.material = new TextDecoder('utf-8').decode(_textBytes2);
116328
+ offset += materialTextLen;
116329
+ } else {
116330
+ primitive.material = '';
116331
+ }
116206
116332
  if (dataView.byteLength < offset + 4) {
116207
116333
  throw new Error('Insufficient data for GeomText length');
116208
116334
  }
@@ -116214,8 +116340,8 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116214
116340
  if (dataView.byteLength < offset + geomTextLen) {
116215
116341
  throw new Error('Insufficient data for GeomText content');
116216
116342
  }
116217
- var _textBytes = uint8Array.subarray(offset, offset + geomTextLen);
116218
- primitive.geomText = new TextDecoder('utf-8').decode(_textBytes);
116343
+ var _textBytes3 = uint8Array.subarray(offset, offset + geomTextLen);
116344
+ primitive.geomText = new TextDecoder('utf-8').decode(_textBytes3);
116219
116345
  offset += geomTextLen;
116220
116346
  } else {
116221
116347
  primitive.geomText = '';
@@ -116295,8 +116421,8 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116295
116421
  primitive.dataType = null;
116296
116422
  } else if (dataTypeLen > 0) {
116297
116423
  if (dataView.byteLength < offset + dataTypeLen) throw new Error('Insufficient data for DataType content');
116298
- var _textBytes2 = uint8Array.subarray(offset, offset + dataTypeLen);
116299
- primitive.dataType = new TextDecoder('utf-8').decode(_textBytes2);
116424
+ var _textBytes4 = uint8Array.subarray(offset, offset + dataTypeLen);
116425
+ primitive.dataType = new TextDecoder('utf-8').decode(_textBytes4);
116300
116426
  offset += dataTypeLen;
116301
116427
  } else {
116302
116428
  primitive.dataType = '';
@@ -116347,43 +116473,43 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116347
116473
  }, {
116348
116474
  key: "ensureNotInteracting",
116349
116475
  value: function () {
116350
- var _ensureNotInteracting = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee14(abortSignal) {
116476
+ var _ensureNotInteracting = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee15(abortSignal) {
116351
116477
  var _this7 = this;
116352
- return StreamLoader_regenerator().w(function (_context14) {
116353
- while (1) switch (_context14.n) {
116478
+ return StreamLoader_regenerator().w(function (_context15) {
116479
+ while (1) switch (_context15.n) {
116354
116480
  case 0:
116355
116481
  if (!(abortSignal && abortSignal.aborted)) {
116356
- _context14.n = 1;
116482
+ _context15.n = 1;
116357
116483
  break;
116358
116484
  }
116359
- return _context14.a(2);
116485
+ return _context15.a(2);
116360
116486
  case 1:
116361
116487
  if (!this.externalEnsureNotInteracting) {
116362
- _context14.n = 3;
116488
+ _context15.n = 3;
116363
116489
  break;
116364
116490
  }
116365
- _context14.n = 2;
116491
+ _context15.n = 2;
116366
116492
  return this.externalEnsureNotInteracting(abortSignal);
116367
116493
  case 2:
116368
- return _context14.a(2);
116494
+ return _context15.a(2);
116369
116495
  case 3:
116370
116496
  if (this.isUserInteracting) {
116371
- _context14.n = 4;
116497
+ _context15.n = 4;
116372
116498
  break;
116373
116499
  }
116374
- return _context14.a(2);
116500
+ return _context15.a(2);
116375
116501
  case 4:
116376
116502
  if (!this.parsePausePromise) {
116377
116503
  this.parsePausePromise = new Promise(function (resolve) {
116378
116504
  _this7.parsePauseResolver = resolve;
116379
116505
  });
116380
116506
  }
116381
- _context14.n = 5;
116507
+ _context15.n = 5;
116382
116508
  return this.parsePausePromise;
116383
116509
  case 5:
116384
- return _context14.a(2);
116510
+ return _context15.a(2);
116385
116511
  }
116386
- }, _callee14, this);
116512
+ }, _callee15, this);
116387
116513
  }));
116388
116514
  function ensureNotInteracting(_x23) {
116389
116515
  return _ensureNotInteracting.apply(this, arguments);
@@ -116408,10 +116534,10 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116408
116534
  }, {
116409
116535
  key: "handleControlEnd",
116410
116536
  value: function () {
116411
- var _handleControlEnd = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee15() {
116537
+ var _handleControlEnd = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee16() {
116412
116538
  var pressDuration;
116413
- return StreamLoader_regenerator().w(function (_context15) {
116414
- while (1) switch (_context15.n) {
116539
+ return StreamLoader_regenerator().w(function (_context16) {
116540
+ while (1) switch (_context16.n) {
116415
116541
  case 0:
116416
116542
  pressDuration = Date.now() - (this.controlPressStartAt || 0);
116417
116543
  if (pressDuration >= this.longPressAbortThresholdMs) {
@@ -116423,9 +116549,9 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116423
116549
  this.isUserInteracting = false;
116424
116550
  this.resumeParsing();
116425
116551
  case 1:
116426
- return _context15.a(2);
116552
+ return _context16.a(2);
116427
116553
  }
116428
- }, _callee15, this);
116554
+ }, _callee16, this);
116429
116555
  }));
116430
116556
  function handleControlEnd() {
116431
116557
  return _handleControlEnd.apply(this, arguments);
@@ -116435,18 +116561,18 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116435
116561
  }, {
116436
116562
  key: "handleWheelStart",
116437
116563
  value: function () {
116438
- var _handleWheelStart = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee16() {
116439
- return StreamLoader_regenerator().w(function (_context16) {
116440
- while (1) switch (_context16.n) {
116564
+ var _handleWheelStart = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee17() {
116565
+ return StreamLoader_regenerator().w(function (_context17) {
116566
+ while (1) switch (_context17.n) {
116441
116567
  case 0:
116442
116568
  try {
116443
116569
  // await this.abortAllStreamRequests();
116444
116570
  } catch (_) {}
116445
116571
  this.isUserInteracting = true;
116446
116572
  case 1:
116447
- return _context16.a(2);
116573
+ return _context17.a(2);
116448
116574
  }
116449
- }, _callee16, this);
116575
+ }, _callee17, this);
116450
116576
  }));
116451
116577
  function handleWheelStart() {
116452
116578
  return _handleWheelStart.apply(this, arguments);
@@ -116466,18 +116592,18 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116466
116592
  }, {
116467
116593
  key: "batchLoadRegions",
116468
116594
  value: function () {
116469
- var _batchLoadRegions = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee17(item, divideData) {
116470
- var priorityRegions, level0Regions, level1Regions, level2Regions, level3Regions, level4Regions, i, regionData, range, _t19, _t20;
116471
- return StreamLoader_regenerator().w(function (_context17) {
116472
- while (1) switch (_context17.p = _context17.n) {
116595
+ var _batchLoadRegions = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee18(item, divideData) {
116596
+ var priorityRegions, level0Regions, level1Regions, level2Regions, level3Regions, level4Regions, i, regionData, range, _t18, _t19;
116597
+ return StreamLoader_regenerator().w(function (_context18) {
116598
+ while (1) switch (_context18.p = _context18.n) {
116473
116599
  case 0:
116474
116600
  if (!(!divideData || divideData.length === 0)) {
116475
- _context17.n = 1;
116601
+ _context18.n = 1;
116476
116602
  break;
116477
116603
  }
116478
- return _context17.a(2);
116604
+ return _context18.a(2);
116479
116605
  case 1:
116480
- _context17.p = 1;
116606
+ _context18.p = 1;
116481
116607
  priorityRegions = [];
116482
116608
  level0Regions = divideData.filter(function (region) {
116483
116609
  return region.lodLevel && region.lodLevel.includes(0);
@@ -116496,15 +116622,15 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116496
116622
  });
116497
116623
  priorityRegions.push.apply(priorityRegions, StreamLoader_toConsumableArray(level0Regions).concat(StreamLoader_toConsumableArray(level1Regions), StreamLoader_toConsumableArray(level2Regions), StreamLoader_toConsumableArray(level3Regions), StreamLoader_toConsumableArray(level4Regions)));
116498
116624
  if (!(priorityRegions.length === 0)) {
116499
- _context17.n = 2;
116625
+ _context18.n = 2;
116500
116626
  break;
116501
116627
  }
116502
- return _context17.a(2);
116628
+ return _context18.a(2);
116503
116629
  case 2:
116504
116630
  i = 0;
116505
116631
  case 3:
116506
116632
  if (!(i < priorityRegions.length && i < 1)) {
116507
- _context17.n = 8;
116633
+ _context18.n = 8;
116508
116634
  break;
116509
116635
  }
116510
116636
  regionData = priorityRegions[i];
@@ -116512,30 +116638,30 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116512
116638
  regionIndex: regionData.index,
116513
116639
  documentId: item.id
116514
116640
  };
116515
- _context17.p = 4;
116516
- _context17.n = 5;
116641
+ _context18.p = 4;
116642
+ _context18.n = 5;
116517
116643
  return this.fetchJsonSync(item, range);
116518
116644
  case 5:
116519
- _context17.n = 7;
116645
+ _context18.n = 7;
116520
116646
  break;
116521
116647
  case 6:
116522
- _context17.p = 6;
116523
- _t19 = _context17.v;
116648
+ _context18.p = 6;
116649
+ _t18 = _context18.v;
116524
116650
  case 7:
116525
116651
  i++;
116526
- _context17.n = 3;
116652
+ _context18.n = 3;
116527
116653
  break;
116528
116654
  case 8:
116529
- _context17.n = 10;
116655
+ _context18.n = 10;
116530
116656
  break;
116531
116657
  case 9:
116532
- _context17.p = 9;
116533
- _t20 = _context17.v;
116534
- throw _t20;
116658
+ _context18.p = 9;
116659
+ _t19 = _context18.v;
116660
+ throw _t19;
116535
116661
  case 10:
116536
- return _context17.a(2);
116662
+ return _context18.a(2);
116537
116663
  }
116538
- }, _callee17, this, [[4, 6], [1, 9]]);
116664
+ }, _callee18, this, [[4, 6], [1, 9]]);
116539
116665
  }));
116540
116666
  function batchLoadRegions(_x24, _x25) {
116541
116667
  return _batchLoadRegions.apply(this, arguments);
@@ -116545,59 +116671,59 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116545
116671
  }, {
116546
116672
  key: "loadModelByIds",
116547
116673
  value: function () {
116548
- var _loadModelByIds = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee18(options) {
116549
- var params, onComplete, buffer, primitives, _params$immediateUpda, loadStartTime, _ref3, ids, documentIdToIds, _yield$this$parseBuff2, mesh, parsed, _t21;
116550
- return StreamLoader_regenerator().w(function (_context18) {
116551
- while (1) switch (_context18.p = _context18.n) {
116674
+ var _loadModelByIds = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee19(options) {
116675
+ var params, onComplete, buffer, primitives, _params$immediateUpda, loadStartTime, _ref4, ids, documentIdToIds, _yield$this$parseBuff2, mesh, parsed, _t20;
116676
+ return StreamLoader_regenerator().w(function (_context19) {
116677
+ while (1) switch (_context19.p = _context19.n) {
116552
116678
  case 0:
116553
116679
  params = options.params, onComplete = options.onComplete;
116554
116680
  buffer = null;
116555
116681
  primitives = [];
116556
- _context18.p = 1;
116682
+ _context19.p = 1;
116557
116683
  loadStartTime = Date.now(); // 构建 documentIdToIds 映射 多个documentid->modelid
116558
- _ref3 = options.params || {}, ids = _ref3.ids;
116684
+ _ref4 = options.params || {}, ids = _ref4.ids;
116559
116685
  documentIdToIds = this.parseModelDocumentMappings(ids);
116560
116686
  delete params.ids;
116561
116687
  params.documentIdToIds = documentIdToIds;
116562
116688
  params.projectId = this.projectId;
116563
- _context18.n = 2;
116689
+ _context19.n = 2;
116564
116690
  return this.getPrimitivesByRangeDetail(params);
116565
116691
  case 2:
116566
- buffer = _context18.v;
116692
+ buffer = _context19.v;
116567
116693
  if (buffer) {
116568
- _context18.n = 3;
116694
+ _context19.n = 3;
116569
116695
  break;
116570
116696
  }
116571
- return _context18.a(2, {
116697
+ return _context19.a(2, {
116572
116698
  primitives: []
116573
116699
  });
116574
116700
  case 3:
116575
- _context18.n = 4;
116701
+ _context19.n = 4;
116576
116702
  return this.parseBufferData(buffer);
116577
116703
  case 4:
116578
- _yield$this$parseBuff2 = _context18.v;
116704
+ _yield$this$parseBuff2 = _context19.v;
116579
116705
  mesh = _yield$this$parseBuff2.mesh;
116580
116706
  parsed = _yield$this$parseBuff2.primitives;
116581
116707
  primitives = parsed;
116582
- _context18.n = 5;
116708
+ _context19.n = 5;
116583
116709
  return this.renderModelData(mesh, primitives, params.folderInfo, null, onComplete, (_params$immediateUpda = params.immediateUpdate) !== null && _params$immediateUpda !== void 0 ? _params$immediateUpda : true);
116584
116710
  case 5:
116585
- return _context18.a(2, {
116711
+ return _context19.a(2, {
116586
116712
  primitives: primitives,
116587
116713
  mesh: mesh
116588
116714
  });
116589
116715
  case 6:
116590
- _context18.p = 6;
116591
- _t21 = _context18.v;
116592
- if (!(_t21.name === 'AbortError')) {
116593
- _context18.n = 7;
116716
+ _context19.p = 6;
116717
+ _t20 = _context19.v;
116718
+ if (!(_t20.name === 'AbortError')) {
116719
+ _context19.n = 7;
116594
116720
  break;
116595
116721
  }
116596
- throw _t21;
116722
+ throw _t20;
116597
116723
  case 7:
116598
- throw _t21;
116724
+ throw _t20;
116599
116725
  case 8:
116600
- _context18.p = 8;
116726
+ _context19.p = 8;
116601
116727
  try {
116602
116728
  buffer = null;
116603
116729
  if (primitives && primitives.length > 0) {
@@ -116616,11 +116742,11 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116616
116742
  window.gc();
116617
116743
  }
116618
116744
  } catch (cleanupErr) {}
116619
- return _context18.f(8);
116745
+ return _context19.f(8);
116620
116746
  case 9:
116621
- return _context18.a(2);
116747
+ return _context19.a(2);
116622
116748
  }
116623
- }, _callee18, this, [[1, 6, 8, 9]]);
116749
+ }, _callee19, this, [[1, 6, 8, 9]]);
116624
116750
  }));
116625
116751
  function loadModelByIds(_x26) {
116626
116752
  return _loadModelByIds.apply(this, arguments);
@@ -116632,26 +116758,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116632
116758
  }, {
116633
116759
  key: "getPrimitivesByDivide",
116634
116760
  value: function () {
116635
- var _getPrimitivesByDivide = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee19(params) {
116761
+ var _getPrimitivesByDivide = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee20(params) {
116636
116762
  var res;
116637
- return StreamLoader_regenerator().w(function (_context19) {
116638
- while (1) switch (_context19.n) {
116763
+ return StreamLoader_regenerator().w(function (_context20) {
116764
+ while (1) switch (_context20.n) {
116639
116765
  case 0:
116640
- _context19.n = 1;
116766
+ _context20.n = 1;
116641
116767
  return this.modelApi.getPrimitivesByDivide(params);
116642
116768
  case 1:
116643
- res = _context19.v;
116769
+ res = _context20.v;
116644
116770
  if (!res) {
116645
- _context19.n = 2;
116771
+ _context20.n = 2;
116646
116772
  break;
116647
116773
  }
116648
- return _context19.a(2, res);
116774
+ return _context20.a(2, res);
116649
116775
  case 2:
116650
116776
  throw new Error('Failed to get primitives');
116651
116777
  case 3:
116652
- return _context19.a(2);
116778
+ return _context20.a(2);
116653
116779
  }
116654
- }, _callee19, this);
116780
+ }, _callee20, this);
116655
116781
  }));
116656
116782
  function getPrimitivesByDivide(_x27) {
116657
116783
  return _getPrimitivesByDivide.apply(this, arguments);
@@ -116661,26 +116787,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116661
116787
  }, {
116662
116788
  key: "getPrimitivesByRangeDetail",
116663
116789
  value: function () {
116664
- var _getPrimitivesByRangeDetail = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee20(params) {
116790
+ var _getPrimitivesByRangeDetail = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee21(params) {
116665
116791
  var res;
116666
- return StreamLoader_regenerator().w(function (_context20) {
116667
- while (1) switch (_context20.n) {
116792
+ return StreamLoader_regenerator().w(function (_context21) {
116793
+ while (1) switch (_context21.n) {
116668
116794
  case 0:
116669
- _context20.n = 1;
116795
+ _context21.n = 1;
116670
116796
  return this.modelApi.getPrimitivesByRangeDetail(params);
116671
116797
  case 1:
116672
- res = _context20.v;
116798
+ res = _context21.v;
116673
116799
  if (!res) {
116674
- _context20.n = 2;
116800
+ _context21.n = 2;
116675
116801
  break;
116676
116802
  }
116677
- return _context20.a(2, res);
116803
+ return _context21.a(2, res);
116678
116804
  case 2:
116679
116805
  throw new Error('Failed to get batch model');
116680
116806
  case 3:
116681
- return _context20.a(2);
116807
+ return _context21.a(2);
116682
116808
  }
116683
- }, _callee20, this);
116809
+ }, _callee21, this);
116684
116810
  }));
116685
116811
  function getPrimitivesByRangeDetail(_x28) {
116686
116812
  return _getPrimitivesByRangeDetail.apply(this, arguments);
@@ -116692,31 +116818,31 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116692
116818
  }, {
116693
116819
  key: "getSceneBox",
116694
116820
  value: function () {
116695
- var _getSceneBox = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee21(_ref4) {
116696
- var id, _ref4$projectId, projectId, res;
116697
- return StreamLoader_regenerator().w(function (_context21) {
116698
- while (1) switch (_context21.n) {
116821
+ var _getSceneBox = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee22(_ref5) {
116822
+ var id, _ref5$projectId, projectId, res;
116823
+ return StreamLoader_regenerator().w(function (_context22) {
116824
+ while (1) switch (_context22.n) {
116699
116825
  case 0:
116700
- id = _ref4.id, _ref4$projectId = _ref4.projectId, projectId = _ref4$projectId === void 0 ? this.projectId : _ref4$projectId;
116701
- _context21.n = 1;
116826
+ id = _ref5.id, _ref5$projectId = _ref5.projectId, projectId = _ref5$projectId === void 0 ? this.projectId : _ref5$projectId;
116827
+ _context22.n = 1;
116702
116828
  return this.modelApi.getSceneBox({
116703
116829
  id: id,
116704
116830
  projectId: projectId
116705
116831
  });
116706
116832
  case 1:
116707
- res = _context21.v;
116833
+ res = _context22.v;
116708
116834
  if (!(res && res[0])) {
116709
- _context21.n = 2;
116835
+ _context22.n = 2;
116710
116836
  break;
116711
116837
  }
116712
116838
  this.sceneBox = res[0];
116713
- return _context21.a(2, res[0]);
116839
+ return _context22.a(2, res[0]);
116714
116840
  case 2:
116715
- return _context21.a(2, null);
116841
+ return _context22.a(2, null);
116716
116842
  case 3:
116717
- return _context21.a(2);
116843
+ return _context22.a(2);
116718
116844
  }
116719
- }, _callee21, this);
116845
+ }, _callee22, this);
116720
116846
  }));
116721
116847
  function getSceneBox(_x29) {
116722
116848
  return _getSceneBox.apply(this, arguments);
@@ -116726,43 +116852,43 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116726
116852
  }, {
116727
116853
  key: "getBox",
116728
116854
  value: function () {
116729
- var _getBox = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee22(_ref5) {
116730
- var id, _ref5$projectId, projectId, cached, res;
116731
- return StreamLoader_regenerator().w(function (_context22) {
116732
- while (1) switch (_context22.n) {
116855
+ var _getBox = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee23(_ref6) {
116856
+ var id, _ref6$projectId, projectId, isDebug, cached, res;
116857
+ return StreamLoader_regenerator().w(function (_context23) {
116858
+ while (1) switch (_context23.n) {
116733
116859
  case 0:
116734
- id = _ref5.id, _ref5$projectId = _ref5.projectId, projectId = _ref5$projectId === void 0 ? this.projectId || 0 : _ref5$projectId;
116735
- _context22.n = 1;
116860
+ id = _ref6.id, _ref6$projectId = _ref6.projectId, projectId = _ref6$projectId === void 0 ? this.projectId || 0 : _ref6$projectId, isDebug = _ref6.isDebug;
116861
+ _context23.n = 1;
116736
116862
  return this._getFromDB(id, projectId);
116737
116863
  case 1:
116738
- cached = _context22.v;
116739
- if (!cached) {
116740
- _context22.n = 2;
116864
+ cached = _context23.v;
116865
+ if (!(cached && !isDebug)) {
116866
+ _context23.n = 2;
116741
116867
  break;
116742
116868
  }
116743
- return _context22.a(2, cached);
116869
+ return _context23.a(2, cached);
116744
116870
  case 2:
116745
- _context22.n = 3;
116871
+ _context23.n = 3;
116746
116872
  return this.modelApi.getBox({
116747
116873
  id: id,
116748
116874
  projectId: projectId
116749
116875
  });
116750
116876
  case 3:
116751
- res = _context22.v;
116877
+ res = _context23.v;
116752
116878
  if (!res) {
116753
- _context22.n = 4;
116879
+ _context23.n = 4;
116754
116880
  break;
116755
116881
  }
116756
116882
  // 3. 存入 IndexedDB (存储原始数据)
116757
116883
  this._applyPrefixId(res, 'id', id);
116758
116884
  this._saveToDB(id, res, projectId);
116759
- return _context22.a(2, res);
116885
+ return _context23.a(2, res);
116760
116886
  case 4:
116761
- return _context22.a(2, null);
116887
+ return _context23.a(2, null);
116762
116888
  case 5:
116763
- return _context22.a(2);
116889
+ return _context23.a(2);
116764
116890
  }
116765
- }, _callee22, this);
116891
+ }, _callee23, this);
116766
116892
  }));
116767
116893
  function getBox(_x30) {
116768
116894
  return _getBox.apply(this, arguments);
@@ -116772,11 +116898,11 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116772
116898
  }, {
116773
116899
  key: "handleCameraControlForStream",
116774
116900
  value: function () {
116775
- var _handleCameraControlForStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee23(args) {
116901
+ var _handleCameraControlForStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee24(args) {
116776
116902
  var _this8 = this;
116777
- var chainRequest, loadedModels, documentIdToIds, activeItems, primaryItem, requestId, range, streamResult, _t22;
116778
- return StreamLoader_regenerator().w(function (_context23) {
116779
- while (1) switch (_context23.p = _context23.n) {
116903
+ var chainRequest, loadedModels, documentIdToIds, activeItems, primaryItem, requestId, range, streamResult, _t21;
116904
+ return StreamLoader_regenerator().w(function (_context24) {
116905
+ while (1) switch (_context24.p = _context24.n) {
116780
116906
  case 0:
116781
116907
  // 性能优化注释:禁用 range 被注释字段的解构声明与初始化
116782
116908
  chainRequest = args.chainRequest, loadedModels = args.loadedModels; // 构建 documentIdToIds 映射 多个documentid->modelid
@@ -116800,10 +116926,10 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116800
116926
  }
116801
116927
  });
116802
116928
  if (!(activeItems.length === 0)) {
116803
- _context23.n = 1;
116929
+ _context24.n = 1;
116804
116930
  break;
116805
116931
  }
116806
- return _context23.a(2);
116932
+ return _context24.a(2);
116807
116933
  case 1:
116808
116934
  primaryItem = activeItems[0]; // 使用第一个item作为主上下文
116809
116935
  requestId = Date.now() + '_' + Math.random().toString(36).substr(2, 9);
@@ -116852,20 +116978,20 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116852
116978
  // range.minZ = Math.max(range.minZ, boxToUse.min_z);
116853
116979
  // range.maxZ = Math.min(range.maxZ, boxToUse.max_z);
116854
116980
  // }
116855
- _context23.p = 2;
116856
- _context23.n = 3;
116981
+ _context24.p = 2;
116982
+ _context24.n = 3;
116857
116983
  return this.fetchJsonStream(primaryItem, range, this.currentAbortController.signal, requestId);
116858
116984
  case 3:
116859
- streamResult = _context23.v;
116985
+ streamResult = _context24.v;
116860
116986
  if (!(this.currentRequestId === requestId)) {
116861
- _context23.n = 5;
116987
+ _context24.n = 5;
116862
116988
  break;
116863
116989
  }
116864
116990
  if (!(typeof this.onRangeStreamComplete === 'function')) {
116865
- _context23.n = 4;
116991
+ _context24.n = 4;
116866
116992
  break;
116867
116993
  }
116868
- _context23.n = 4;
116994
+ _context24.n = 4;
116869
116995
  return this.onRangeStreamComplete(StreamLoader_objectSpread({
116870
116996
  source: 'inRangeDis2',
116871
116997
  requestId: requestId,
@@ -116875,28 +117001,28 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116875
117001
  case 4:
116876
117002
  this.currentAbortController = null;
116877
117003
  this.currentRequestId = null;
116878
- _context23.n = 5;
117004
+ _context24.n = 5;
116879
117005
  break;
116880
117006
  case 5:
116881
- _context23.n = 8;
117007
+ _context24.n = 8;
116882
117008
  break;
116883
117009
  case 6:
116884
- _context23.p = 6;
116885
- _t22 = _context23.v;
116886
- if (!(_t22.name === 'AbortError')) {
116887
- _context23.n = 7;
117010
+ _context24.p = 6;
117011
+ _t21 = _context24.v;
117012
+ if (!(_t21.name === 'AbortError')) {
117013
+ _context24.n = 7;
116888
117014
  break;
116889
117015
  }
116890
- return _context23.a(2);
117016
+ return _context24.a(2);
116891
117017
  case 7:
116892
117018
  if (this.currentRequestId === requestId) {
116893
117019
  this.currentAbortController = null;
116894
117020
  this.currentRequestId = null;
116895
117021
  }
116896
117022
  case 8:
116897
- return _context23.a(2);
117023
+ return _context24.a(2);
116898
117024
  }
116899
- }, _callee23, this, [[2, 6]]);
117025
+ }, _callee24, this, [[2, 6]]);
116900
117026
  }));
116901
117027
  function handleCameraControlForStream(_x31) {
116902
117028
  return _handleCameraControlForStream.apply(this, arguments);
@@ -116955,60 +117081,61 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116955
117081
  }, {
116956
117082
  key: "processModelItem",
116957
117083
  value: function () {
116958
- var _processModelItem = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee24(item) {
117084
+ var _processModelItem = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee25(item) {
116959
117085
  var options,
116960
117086
  materialData,
116961
117087
  mergeMaterialData,
116962
117088
  sceneBox,
116963
117089
  boxIndex,
116964
117090
  modelResourceMapObj,
116965
- _args24 = arguments,
116966
- _t23;
116967
- return StreamLoader_regenerator().w(function (_context24) {
116968
- while (1) switch (_context24.p = _context24.n) {
117091
+ _args25 = arguments,
117092
+ _t22;
117093
+ return StreamLoader_regenerator().w(function (_context25) {
117094
+ while (1) switch (_context25.p = _context25.n) {
116969
117095
  case 0:
116970
- options = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {};
116971
- _context24.p = 1;
117096
+ options = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {};
117097
+ _context25.p = 1;
116972
117098
  if (typeof item.id !== 'string') {
116973
117099
  item.id = '' + item.id;
116974
117100
  }
116975
117101
 
116976
117102
  // 获取材质数据
116977
- _context24.n = 2;
117103
+ _context25.n = 2;
116978
117104
  return this.getPrimitivesByMaterial({
116979
117105
  id: item.id,
116980
117106
  projectId: this.projectId
116981
117107
  });
116982
117108
  case 2:
116983
- materialData = _context24.v;
116984
- _context24.n = 3;
117109
+ materialData = _context25.v;
117110
+ _context25.n = 3;
116985
117111
  return this.getPrimitivesByMergeMaterial({
116986
117112
  id: item.id,
116987
117113
  projectId: this.projectId
116988
117114
  });
116989
117115
  case 3:
116990
- mergeMaterialData = _context24.v;
117116
+ mergeMaterialData = _context25.v;
116991
117117
  this._applyPrefixId(mergeMaterialData, 'id');
116992
117118
  this._applyPrefixId(materialData, 'id');
116993
117119
 
116994
117120
  // 获取场景包围盒
116995
- _context24.n = 4;
117121
+ _context25.n = 4;
116996
117122
  return this.getSceneBox({
116997
117123
  id: item.id,
116998
117124
  projectId: this.projectId
116999
117125
  });
117000
117126
  case 4:
117001
- sceneBox = _context24.v;
117127
+ sceneBox = _context25.v;
117002
117128
  this.sceneBox = sceneBox;
117003
117129
 
117004
117130
  // 获取BoxIndex
117005
- _context24.n = 5;
117131
+ _context25.n = 5;
117006
117132
  return this.getBox({
117007
117133
  id: item.id,
117008
- projectId: this.projectId
117134
+ projectId: this.projectId,
117135
+ isDebug: this.debug
117009
117136
  });
117010
117137
  case 5:
117011
- boxIndex = _context24.v;
117138
+ boxIndex = _context25.v;
117012
117139
  this.boxIndex = boxIndex;
117013
117140
 
117014
117141
  // 将 mergeMaterialData 覆盖到 materialData(按 id 覆盖 color/transp)
@@ -117020,18 +117147,18 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
117020
117147
  }; // 设置当前模型到注册表
117021
117148
  this.updateModelRegistry(item, materialData, mergeMaterialData, sceneBox, boxIndex);
117022
117149
  console.log('modelRegistry', this.modelRegistry);
117023
- return _context24.a(2, {
117150
+ return _context25.a(2, {
117024
117151
  modelResourceMap: modelResourceMapObj,
117025
117152
  sceneBox: sceneBox,
117026
117153
  boxIndex: boxIndex,
117027
117154
  item: item
117028
117155
  });
117029
117156
  case 6:
117030
- _context24.p = 6;
117031
- _t23 = _context24.v;
117032
- return _context24.a(2, null);
117157
+ _context25.p = 6;
117158
+ _t22 = _context25.v;
117159
+ return _context25.a(2, null);
117033
117160
  }
117034
- }, _callee24, this, [[1, 6]]);
117161
+ }, _callee25, this, [[1, 6]]);
117035
117162
  }));
117036
117163
  function processModelItem(_x32) {
117037
117164
  return _processModelItem.apply(this, arguments);
@@ -117070,27 +117197,27 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
117070
117197
  }, {
117071
117198
  key: "_getFromDB",
117072
117199
  value: function () {
117073
- var _getFromDB2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee25(id) {
117200
+ var _getFromDB2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee26(id) {
117074
117201
  var projectId,
117075
117202
  db,
117076
- _args25 = arguments,
117077
- _t24;
117078
- return StreamLoader_regenerator().w(function (_context25) {
117079
- while (1) switch (_context25.p = _context25.n) {
117203
+ _args26 = arguments,
117204
+ _t23;
117205
+ return StreamLoader_regenerator().w(function (_context26) {
117206
+ while (1) switch (_context26.p = _context26.n) {
117080
117207
  case 0:
117081
- projectId = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : this.projectId || 0;
117082
- _context25.p = 1;
117083
- _context25.n = 2;
117208
+ projectId = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : this.projectId || 0;
117209
+ _context26.p = 1;
117210
+ _context26.n = 2;
117084
117211
  return this._initDB();
117085
117212
  case 2:
117086
- db = _context25.v;
117213
+ db = _context26.v;
117087
117214
  if (db) {
117088
- _context25.n = 3;
117215
+ _context26.n = 3;
117089
117216
  break;
117090
117217
  }
117091
- return _context25.a(2, null);
117218
+ return _context26.a(2, null);
117092
117219
  case 3:
117093
- return _context25.a(2, new Promise(function (resolve) {
117220
+ return _context26.a(2, new Promise(function (resolve) {
117094
117221
  var transaction = db.transaction(['boxCache'], 'readonly');
117095
117222
  var store = transaction.objectStore('boxCache');
117096
117223
  var request = store.get("".concat(projectId, ":").concat(id));
@@ -117102,12 +117229,12 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
117102
117229
  };
117103
117230
  }));
117104
117231
  case 4:
117105
- _context25.p = 4;
117106
- _t24 = _context25.v;
117107
- console.warn('Error reading from IndexedDB:', _t24);
117108
- return _context25.a(2, null);
117232
+ _context26.p = 4;
117233
+ _t23 = _context26.v;
117234
+ console.warn('Error reading from IndexedDB:', _t23);
117235
+ return _context26.a(2, null);
117109
117236
  }
117110
- }, _callee25, this, [[1, 4]]);
117237
+ }, _callee26, this, [[1, 4]]);
117111
117238
  }));
117112
117239
  function _getFromDB(_x33) {
117113
117240
  return _getFromDB2.apply(this, arguments);
@@ -117117,41 +117244,41 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
117117
117244
  }, {
117118
117245
  key: "_saveToDB",
117119
117246
  value: function () {
117120
- var _saveToDB2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee26(id, data) {
117247
+ var _saveToDB2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee27(id, data) {
117121
117248
  var projectId,
117122
117249
  db,
117123
117250
  transaction,
117124
117251
  store,
117125
- _args26 = arguments,
117126
- _t25;
117127
- return StreamLoader_regenerator().w(function (_context26) {
117128
- while (1) switch (_context26.p = _context26.n) {
117252
+ _args27 = arguments,
117253
+ _t24;
117254
+ return StreamLoader_regenerator().w(function (_context27) {
117255
+ while (1) switch (_context27.p = _context27.n) {
117129
117256
  case 0:
117130
- projectId = _args26.length > 2 && _args26[2] !== undefined ? _args26[2] : this.projectId || 0;
117131
- _context26.p = 1;
117132
- _context26.n = 2;
117257
+ projectId = _args27.length > 2 && _args27[2] !== undefined ? _args27[2] : this.projectId || 0;
117258
+ _context27.p = 1;
117259
+ _context27.n = 2;
117133
117260
  return this._initDB();
117134
117261
  case 2:
117135
- db = _context26.v;
117262
+ db = _context27.v;
117136
117263
  if (db) {
117137
- _context26.n = 3;
117264
+ _context27.n = 3;
117138
117265
  break;
117139
117266
  }
117140
- return _context26.a(2);
117267
+ return _context27.a(2);
117141
117268
  case 3:
117142
117269
  transaction = db.transaction(['boxCache'], 'readwrite');
117143
117270
  store = transaction.objectStore('boxCache');
117144
117271
  store.put(data, "".concat(projectId, ":").concat(id));
117145
- _context26.n = 5;
117272
+ _context27.n = 5;
117146
117273
  break;
117147
117274
  case 4:
117148
- _context26.p = 4;
117149
- _t25 = _context26.v;
117150
- console.warn('Error saving to IndexedDB:', _t25);
117275
+ _context27.p = 4;
117276
+ _t24 = _context27.v;
117277
+ console.warn('Error saving to IndexedDB:', _t24);
117151
117278
  case 5:
117152
- return _context26.a(2);
117279
+ return _context27.a(2);
117153
117280
  }
117154
- }, _callee26, this, [[1, 4]]);
117281
+ }, _callee27, this, [[1, 4]]);
117155
117282
  }));
117156
117283
  function _saveToDB(_x34, _x35) {
117157
117284
  return _saveToDB2.apply(this, arguments);
@@ -120794,7 +120921,7 @@ var LOG_INTERVAL = 30;
120794
120921
 
120795
120922
 
120796
120923
 
120797
-
120924
+ // import boxJson from './box.json';
120798
120925
 
120799
120926
 
120800
120927
 
@@ -122125,8 +122252,12 @@ var isDebug = false || false === true;
122125
122252
  if (isAdd && boxJson) {
122126
122253
  var arr = boxJson ? boxJson : [];
122127
122254
  var modelIds = new Set();
122255
+ var validGeomTypes = new Set(Object.values(GEOM_TYPES));
122128
122256
  for (var i = 0; i < arr.length; i++) {
122129
122257
  var it = arr[i];
122258
+ if (!validGeomTypes.has(it.geomType)) {
122259
+ continue;
122260
+ }
122130
122261
  if (it.obb.length == 0) {
122131
122262
  continue;
122132
122263
  }
@@ -122137,10 +122268,21 @@ var isDebug = false || false === true;
122137
122268
 
122138
122269
  // 构造 AABB
122139
122270
  var boxThree = new this.THREE.Box3(min, max);
122140
- var hasMatrix = Array.isArray(it.matrix);
122141
- if (hasMatrix && it.matrix.length >= 16) {
122142
- var matrix = new this.THREE.Matrix4().fromArray(it.matrix);
122143
- var worldMatrix = matrix.clone();
122271
+ var hasMatrix = Array.isArray(it.matrix) && it.matrix.length >= 16;
122272
+ var hasMeshMatrix = Array.isArray(it.meshMatrix) && it.meshMatrix.length >= 16;
122273
+ var localMatrix = null;
122274
+ if (hasMatrix || hasMeshMatrix) {
122275
+ localMatrix = new this.THREE.Matrix4();
122276
+ if (hasMeshMatrix) {
122277
+ localMatrix.fromArray(it.meshMatrix);
122278
+ } else {
122279
+ localMatrix.identity();
122280
+ }
122281
+ if (hasMatrix) {
122282
+ var matrix = new this.THREE.Matrix4().fromArray(it.matrix);
122283
+ localMatrix.multiply(matrix);
122284
+ }
122285
+ var worldMatrix = localMatrix.clone();
122144
122286
  if (this.bizToThreeMatrix) {
122145
122287
  worldMatrix.premultiply(this.bizToThreeMatrix);
122146
122288
  }
@@ -122152,15 +122294,19 @@ var isDebug = false || false === true;
122152
122294
  var userData = {
122153
122295
  flag: it.flag || 1,
122154
122296
  // 默认为 1
122297
+ geomType: it.geomType,
122155
122298
  obbData: it.obb,
122156
122299
  // 存储原始 OBB 数据
122157
122300
  transparent: it.transp > 0,
122158
122301
  sourceVisible: it.visible === false ? false : true,
122159
- visible: it.visible === false ? false : true // 默认显示
122302
+ visible: it.visible === false ? false : true,
122303
+ // 默认显示
122304
+ occlusionEnabled: it.geomType === GEOM_TYPES.geom_3d || it.geomType === GEOM_TYPES.geom_3d_obj
122160
122305
  };
122161
122306
  if (it.flag === 1) {
122162
122307
  userData.indices = it.indices;
122163
- userData.matrix = it.matrix;
122308
+ userData.matrix = localMatrix ? localMatrix.toArray() : it.matrix;
122309
+ userData.meshMatrix = it.meshMatrix;
122164
122310
  // userData.matrix = new this.THREE.Matrix4().identity();
122165
122311
  }
122166
122312
  // 如果是 flag=3,解析并存储中心点、半轴长、旋转矩阵
@@ -122174,6 +122320,9 @@ var isDebug = false || false === true;
122174
122320
  var rotationMatrix4 = new this.THREE.Matrix4().setFromMatrix3(rotation);
122175
122321
  var obbMatrix = new this.THREE.Matrix4().makeTranslation(center.x, center.y, center.z);
122176
122322
  obbMatrix.multiply(rotationMatrix4);
122323
+ if (localMatrix) {
122324
+ obbMatrix.premultiply(localMatrix);
122325
+ }
122177
122326
  userData.obb = {
122178
122327
  matrix: obbMatrix,
122179
122328
  center: center,
@@ -122218,6 +122367,9 @@ var isDebug = false || false === true;
122218
122367
  this.buildOctreeFromBoxIndex();
122219
122368
  console.log('time end', Date.now());
122220
122369
  },
122370
+ shouldApplyOcclusionByBox: function shouldApplyOcclusionByBox(box) {
122371
+ return !!(box && box.userData && box.userData.occlusionEnabled);
122372
+ },
122221
122373
  tryInitialCenterAfterBoundsReady: function tryInitialCenterAfterBoundsReady() {
122222
122374
  if (this.hasExecutedCentering || this.userInteracting) return;
122223
122375
  if (!this.sceneBoundingBox || !this.sceneBoundingBox.isBox3 || this.sceneBoundingBox.isEmpty()) return;
@@ -122772,7 +122924,7 @@ var isDebug = false || false === true;
122772
122924
  }
122773
122925
  visibleIdSet = new Set(visibleIds);
122774
122926
  if (!_this11._octree) {
122775
- _context3.n = 7;
122927
+ _context3.n = 8;
122776
122928
  break;
122777
122929
  }
122778
122930
  frustum = _this11._getCurrentFrustum();
@@ -122781,29 +122933,40 @@ var isDebug = false || false === true;
122781
122933
  i = 0;
122782
122934
  case 3:
122783
122935
  if (!(i < hits.length)) {
122784
- _context3.n = 6;
122936
+ _context3.n = 7;
122785
122937
  break;
122786
122938
  }
122787
122939
  if (!(hits[i].box && hits[i].box.userData && hits[i].box.userData.visible === false)) {
122788
122940
  _context3.n = 4;
122789
122941
  break;
122790
122942
  }
122791
- return _context3.a(3, 5);
122943
+ return _context3.a(3, 6);
122792
122944
  case 4:
122793
- candidates.push(hits[i]);
122945
+ if (_this11.shouldApplyOcclusionByBox(hits[i].box)) {
122946
+ _context3.n = 5;
122947
+ break;
122948
+ }
122949
+ visibleIdSet.add(_this11.formatModelId(hits[i].modelId));
122950
+ return _context3.a(3, 6);
122794
122951
  case 5:
122952
+ candidates.push(hits[i]);
122953
+ case 6:
122795
122954
  i++;
122796
122955
  _context3.n = 3;
122797
122956
  break;
122798
- case 6:
122799
- _context3.n = 8;
122800
- break;
122801
122957
  case 7:
122958
+ _context3.n = 9;
122959
+ break;
122960
+ case 8:
122802
122961
  if (_this11._boxIndex && _this11._boxIndex.size > 0) {
122803
122962
  _this11._boxIndex.forEach(function (box, modelId) {
122804
122963
  if (bypassList && bypassList.size > 0 && bypassList.has(modelId)) return;
122805
122964
  if (box.userData && box.userData.visible === false) return;
122806
122965
  if (_this11.isBoxInFrustum(box)) {
122966
+ if (!_this11.shouldApplyOcclusionByBox(box)) {
122967
+ visibleIdSet.add(_this11.formatModelId(modelId));
122968
+ return;
122969
+ }
122807
122970
  candidates.push({
122808
122971
  modelId: modelId,
122809
122972
  box: box
@@ -122811,11 +122974,11 @@ var isDebug = false || false === true;
122811
122974
  }
122812
122975
  });
122813
122976
  }
122814
- case 8:
122977
+ case 9:
122815
122978
  occlusionState = _this11.noObserver ? _this11.noObserver.occlusionState : _this11.occlusionState; // 从响应式对象获取开关状态
122816
122979
  occlusionEnabled = _this11.occlusionState && _this11.occlusionState.enabled;
122817
122980
  if (!occlusionEnabled) {
122818
- _context3.n = 15;
122981
+ _context3.n = 16;
122819
122982
  break;
122820
122983
  }
122821
122984
  state = occlusionState;
@@ -122829,7 +122992,7 @@ var isDebug = false || false === true;
122829
122992
  sh = Math.max(1, sh);
122830
122993
  rt = state._colorRT;
122831
122994
  t0 = performance.now();
122832
- _context3.p = 9;
122995
+ _context3.p = 10;
122833
122996
  if (!rt || state._rtW !== sw || state._rtH !== sh) {
122834
122997
  if (rt && typeof rt.dispose === 'function') rt.dispose();
122835
122998
  rt = new _this11.THREE.WebGLRenderTarget(sw, sh, {
@@ -123326,9 +123489,9 @@ var isDebug = false || false === true;
123326
123489
  extraStride = _this11.occlusionState && _this11.occlusionState.sampleStride ? _this11.occlusionState.sampleStride : 1;
123327
123490
  stride = Math.max(1, baseStride * Math.max(1, extraStride));
123328
123491
  minSampleCount = _this11.occlusionState && _this11.occlusionState.minSampleCount ? _this11.occlusionState.minSampleCount : 1;
123329
- _context3.n = 10;
123492
+ _context3.n = 11;
123330
123493
  return _this11.scanOcclusionIndices(state._colorBuffer, sw, sh, stride, maxIdx, minSampleCount);
123331
- case 10:
123494
+ case 11:
123332
123495
  scanResult = _context3.v;
123333
123496
  if (scanResult && scanResult.buffer) {
123334
123497
  state._colorBuffer = new Uint8Array(scanResult.buffer);
@@ -123342,7 +123505,7 @@ var isDebug = false || false === true;
123342
123505
  }
123343
123506
  transparentMaxIdx = typeof state._occTransparentMaxIdx === 'number' ? state._occTransparentMaxIdx : 0;
123344
123507
  if (!(transparentMaxIdx > 0 && transparentMesh && transparentMesh.visible)) {
123345
- _context3.n = 12;
123508
+ _context3.n = 13;
123346
123509
  break;
123347
123510
  }
123348
123511
  _this11.renderer.setClearColor(new _this11.THREE.Color(0, 0, 0), 0);
@@ -123350,9 +123513,9 @@ var isDebug = false || false === true;
123350
123513
  _this11.renderer.render(state._occTransparentScene, _this11.camera);
123351
123514
  _this11.renderer.readRenderTargetPixels(rt, 0, 0, sw, sh, state._colorBuffer);
123352
123515
  tIdIndexArr = transparentIdIndexArr;
123353
- _context3.n = 11;
123516
+ _context3.n = 12;
123354
123517
  return _this11.scanOcclusionIndices(state._colorBuffer, sw, sh, stride, transparentMaxIdx, minSampleCount);
123355
- case 11:
123518
+ case 12:
123356
123519
  tScanResult = _context3.v;
123357
123520
  if (tScanResult && tScanResult.buffer) {
123358
123521
  state._colorBuffer = new Uint8Array(tScanResult.buffer);
@@ -123364,26 +123527,26 @@ var isDebug = false || false === true;
123364
123527
  visibleIdSet.add(_id);
123365
123528
  }
123366
123529
  }
123367
- case 12:
123530
+ case 13:
123368
123531
  _this11.renderer.setRenderTarget(prevTarget);
123369
123532
  _this11.renderer.setClearColor(prevClearColorHex, prevClearAlpha);
123370
123533
  _this11.renderer.toneMapping = prevToneMapping;
123371
- _context3.n = 14;
123534
+ _context3.n = 15;
123372
123535
  break;
123373
- case 13:
123374
- _context3.p = 13;
123536
+ case 14:
123537
+ _context3.p = 14;
123375
123538
  _t2 = _context3.v;
123376
123539
  for (_i1 = 0; _i1 < candidates.length; _i1++) {
123377
123540
  visibleIdSet.add(candidates[_i1].modelId);
123378
123541
  }
123379
- case 14:
123380
- _context3.n = 16;
123381
- break;
123382
123542
  case 15:
123543
+ _context3.n = 17;
123544
+ break;
123545
+ case 16:
123383
123546
  for (_i10 = 0; _i10 < candidates.length; _i10++) {
123384
123547
  visibleIdSet.add(candidates[_i10].modelId);
123385
123548
  }
123386
- case 16:
123549
+ case 17:
123387
123550
  visibleIds.length = 0;
123388
123551
  visibleIdSet.forEach(function (id) {
123389
123552
  return visibleIds.push(id);
@@ -123414,6 +123577,11 @@ var isDebug = false || false === true;
123414
123577
  if (bypassList && bypassList.size > 0 && bypassList.has(_modelId)) return;
123415
123578
  var instanceInfo = instancesMap.get(_modelId);
123416
123579
  var instanceIndex = instanceInfo && typeof instanceInfo.instanceIndex === 'number' ? instanceInfo.instanceIndex : null;
123580
+ var _box = _this11._boxIndex && _this11._boxIndex.has(String(_modelId)) ? _this11._boxIndex.get(String(_modelId)) : _this11._boxIndex && _this11._boxIndex.has(_modelId) ? _this11._boxIndex.get(_modelId) : null;
123581
+ if (!_this11.shouldApplyOcclusionByBox(_box)) {
123582
+ allInactive = false;
123583
+ continue;
123584
+ }
123417
123585
  var _inFrustum = _this11.isModelInFrustum(child, instanceIndex, globalFrustum);
123418
123586
  var _modelInVisible = toLoadSet.has(_modelId);
123419
123587
  // console.log('modelId', modelId, 'inFrustum', inFrustum, 'modelInVisible', modelInVisible)
@@ -123427,6 +123595,13 @@ var isDebug = false || false === true;
123427
123595
  // 第二遍遍历:同步状态并决定是否卸载
123428
123596
  for (var _i12 = 0, _modelIds3 = modelIds; _i12 < _modelIds3.length; _i12++) {
123429
123597
  var _modelId2 = _modelIds3[_i12];
123598
+ var _box2 = _this11._boxIndex && _this11._boxIndex.has(String(_modelId2)) ? _this11._boxIndex.get(String(_modelId2)) : _this11._boxIndex && _this11._boxIndex.has(_modelId2) ? _this11._boxIndex.get(_modelId2) : null;
123599
+ if (!_this11.shouldApplyOcclusionByBox(_box2)) {
123600
+ if (toLoadSet.has(_modelId2)) {
123601
+ toLoadSet.delete(_modelId2);
123602
+ }
123603
+ continue;
123604
+ }
123430
123605
  // 无论是否卸载,只要模型已在场景中,就从待加载集合中移除
123431
123606
  if (toLoadSet.has(_modelId2)) {
123432
123607
  toLoadSet.delete(_modelId2);
@@ -123448,6 +123623,13 @@ var isDebug = false || false === true;
123448
123623
  }
123449
123624
  var modelId = child.parent && child.parent.userData && child.parent.userData.instanceId ? child.parent.userData.instanceId : child.uuid;
123450
123625
  if (bypassList && bypassList.size > 0 && bypassList.has(modelId)) return;
123626
+ var box = _this11._boxIndex && _this11._boxIndex.has(String(modelId)) ? _this11._boxIndex.get(String(modelId)) : _this11._boxIndex && _this11._boxIndex.has(modelId) ? _this11._boxIndex.get(modelId) : null;
123627
+ if (!_this11.shouldApplyOcclusionByBox(box)) {
123628
+ if (toLoadSet.has(modelId)) {
123629
+ toLoadSet.delete(modelId);
123630
+ }
123631
+ return;
123632
+ }
123451
123633
  var inFrustum = _this11.isModelInFrustum(child, null, globalFrustum);
123452
123634
  var modelInVisible = toLoadSet.has(modelId);
123453
123635
  if (modelInVisible) {
@@ -123473,10 +123655,10 @@ var isDebug = false || false === true;
123473
123655
  });
123474
123656
  }
123475
123657
  _this11.modelStateManager.isloadedModelsIds = Object.freeze(Array.from(toLoadSet));
123476
- case 17:
123658
+ case 18:
123477
123659
  return _context3.a(2);
123478
123660
  }
123479
- }, _callee3, null, [[9, 13]]);
123661
+ }, _callee3, null, [[10, 14]]);
123480
123662
  }))();
123481
123663
  },
123482
123664
  isBoxInFrustum: function isBoxInFrustum(box) {
@@ -127301,11 +127483,11 @@ var isDebug = false || false === true;
127301
127483
  });
127302
127484
  // CONCATENATED MODULE: ./packages/components/com-graphics/index.vue?vue&type=script&lang=js
127303
127485
  /* harmony default export */ var components_com_graphicsvue_type_script_lang_js = (com_graphicsvue_type_script_lang_js);
127304
- // EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=0&id=7fad0c6c&prod&lang=scss&scoped=true
127305
- var com_graphicsvue_type_style_index_0_id_7fad0c6c_prod_lang_scss_scoped_true = __webpack_require__("4edc");
127486
+ // EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=0&id=a4813dca&prod&lang=scss&scoped=true
127487
+ var com_graphicsvue_type_style_index_0_id_a4813dca_prod_lang_scss_scoped_true = __webpack_require__("e426");
127306
127488
 
127307
- // EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=1&id=7fad0c6c&prod&lang=css
127308
- var com_graphicsvue_type_style_index_1_id_7fad0c6c_prod_lang_css = __webpack_require__("9f61");
127489
+ // EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=1&id=a4813dca&prod&lang=css
127490
+ var com_graphicsvue_type_style_index_1_id_a4813dca_prod_lang_css = __webpack_require__("b606");
127309
127491
 
127310
127492
  // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
127311
127493
  /* globals __VUE_SSR_CONTEXT__ */
@@ -127417,17 +127599,17 @@ function normalizeComponent(
127417
127599
 
127418
127600
  var component = normalizeComponent(
127419
127601
  components_com_graphicsvue_type_script_lang_js,
127420
- com_graphicsvue_type_template_id_7fad0c6c_scoped_true_render,
127602
+ com_graphicsvue_type_template_id_a4813dca_scoped_true_render,
127421
127603
  staticRenderFns,
127422
127604
  false,
127423
127605
  null,
127424
- "7fad0c6c",
127606
+ "a4813dca",
127425
127607
  null
127426
127608
 
127427
127609
  )
127428
127610
 
127429
127611
  /* harmony default export */ var com_graphics = (component.exports);
127430
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e203256c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-flcanvas/index.vue?vue&type=template&id=b313ab6c&scoped=true
127612
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5851e511-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-flcanvas/index.vue?vue&type=template&id=b313ab6c&scoped=true
127431
127613
  var com_flcanvasvue_type_template_id_b313ab6c_scoped_true_render = function render() {
127432
127614
  var _vm = this,
127433
127615
  _c = _vm._self._c;
@@ -131480,7 +131662,7 @@ var com_flcanvas_component = normalizeComponent(
131480
131662
  )
131481
131663
 
131482
131664
  /* harmony default export */ var com_flcanvas = (com_flcanvas_component.exports);
131483
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e203256c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/per-control.vue?vue&type=template&id=f547d5c6&scoped=true
131665
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5851e511-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/per-control.vue?vue&type=template&id=f547d5c6&scoped=true
131484
131666
  var per_controlvue_type_template_id_f547d5c6_scoped_true_render = function render() {
131485
131667
  var _vm = this,
131486
131668
  _c = _vm._self._c;
@@ -131588,7 +131770,7 @@ var per_control_component = normalizeComponent(
131588
131770
  )
131589
131771
 
131590
131772
  /* harmony default export */ var per_control = (per_control_component.exports);
131591
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e203256c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/pid.vue?vue&type=template&id=2572c0e2&scoped=true
131773
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5851e511-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/pid.vue?vue&type=template&id=2572c0e2&scoped=true
131592
131774
  var pidvue_type_template_id_2572c0e2_scoped_true_render = function render() {
131593
131775
  var _vm = this,
131594
131776
  _c = _vm._self._c;
@@ -131635,7 +131817,7 @@ var browserify_default = /*#__PURE__*/__webpack_require__.n(browserify);
131635
131817
  var html2canvas = __webpack_require__("c0e9");
131636
131818
  var html2canvas_default = /*#__PURE__*/__webpack_require__.n(html2canvas);
131637
131819
 
131638
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e203256c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/component/ann-tool.vue?vue&type=template&id=4b17bce0&scoped=true
131820
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5851e511-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/component/ann-tool.vue?vue&type=template&id=4b17bce0&scoped=true
131639
131821
  var ann_toolvue_type_template_id_4b17bce0_scoped_true_render = function render() {
131640
131822
  var _vm = this,
131641
131823
  _c = _vm._self._c;