fl-web-component 2.0.17 → 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.
@@ -870,13 +870,6 @@ module.exports = !$assign || __webpack_require__("4b8b")(function () {
870
870
 
871
871
  /***/ }),
872
872
 
873
- /***/ "07e4":
874
- /***/ (function(module, exports, __webpack_require__) {
875
-
876
- // extracted by mini-css-extract-plugin
877
-
878
- /***/ }),
879
-
880
873
  /***/ "0983":
881
874
  /***/ (function(module, exports, __webpack_require__) {
882
875
 
@@ -1450,17 +1443,6 @@ module.exports = function (bitmap, value) {
1450
1443
  };
1451
1444
  };
1452
1445
 
1453
- /***/ }),
1454
-
1455
- /***/ "11c1":
1456
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1457
-
1458
- "use strict";
1459
- /* 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_48280acc_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("618f");
1460
- /* 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_48280acc_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_48280acc_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
1461
- /* unused harmony reexport * */
1462
-
1463
-
1464
1446
  /***/ }),
1465
1447
 
1466
1448
  /***/ "122f":
@@ -13257,17 +13239,6 @@ exports.Konva = Util_1.Util._assign(Global_1.Konva, {
13257
13239
  });
13258
13240
  exports.default = exports.Konva;
13259
13241
 
13260
- /***/ }),
13261
-
13262
- /***/ "3800":
13263
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
13264
-
13265
- "use strict";
13266
- /* 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_48280acc_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("07e4");
13267
- /* 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_48280acc_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_48280acc_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__);
13268
- /* unused harmony reexport * */
13269
-
13270
-
13271
13242
  /***/ }),
13272
13243
 
13273
13244
  /***/ "383f":
@@ -36932,13 +36903,6 @@ var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "sym
36932
36903
 
36933
36904
  /***/ }),
36934
36905
 
36935
- /***/ "618f":
36936
- /***/ (function(module, exports, __webpack_require__) {
36937
-
36938
- // extracted by mini-css-extract-plugin
36939
-
36940
- /***/ }),
36941
-
36942
36906
  /***/ "62e4":
36943
36907
  /***/ (function(module, exports) {
36944
36908
 
@@ -56206,6 +56170,13 @@ Factory_1.Factory.addGetterSetter(Path, 'data');
56206
56170
 
56207
56171
  /***/ }),
56208
56172
 
56173
+ /***/ "8c5c":
56174
+ /***/ (function(module, exports, __webpack_require__) {
56175
+
56176
+ // extracted by mini-css-extract-plugin
56177
+
56178
+ /***/ }),
56179
+
56209
56180
  /***/ "8e84":
56210
56181
  /***/ (function(module, exports, __webpack_require__) {
56211
56182
 
@@ -56525,7 +56496,7 @@ module.exports = document && document.documentElement;
56525
56496
  /***/ "9224":
56526
56497
  /***/ (function(module) {
56527
56498
 
56528
- module.exports = JSON.parse("{\"name\":\"fl-web-component\",\"version\":\"2.0.17\",\"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\"]}");
56529
56500
 
56530
56501
  /***/ }),
56531
56502
 
@@ -59331,6 +59302,13 @@ var isDefined = exports.isDefined = function isDefined(val) {
59331
59302
 
59332
59303
  /***/ }),
59333
59304
 
59305
+ /***/ "a81d":
59306
+ /***/ (function(module, exports, __webpack_require__) {
59307
+
59308
+ // extracted by mini-css-extract-plugin
59309
+
59310
+ /***/ }),
59311
+
59334
59312
  /***/ "ae26":
59335
59313
  /***/ (function(module, exports, __webpack_require__) {
59336
59314
 
@@ -59566,6 +59544,17 @@ module.exports = function () {
59566
59544
  };
59567
59545
  }();
59568
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
+
59569
59558
  /***/ }),
59570
59559
 
59571
59560
  /***/ "b9c7":
@@ -69153,13 +69142,6 @@ module.exports = function (it) {
69153
69142
 
69154
69143
  /***/ }),
69155
69144
 
69156
- /***/ "cbf5":
69157
- /***/ (function(module) {
69158
-
69159
- module.exports = JSON.parse("{}");
69160
-
69161
- /***/ }),
69162
-
69163
69145
  /***/ "cc15":
69164
69146
  /***/ (function(module, exports, __webpack_require__) {
69165
69147
 
@@ -72518,6 +72500,17 @@ Factory_1.Factory.addGetterSetter(Star, 'numPoints', 5, (0, Validators_1.getNumb
72518
72500
  Factory_1.Factory.addGetterSetter(Star, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
72519
72501
  Factory_1.Factory.addGetterSetter(Star, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
72520
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
+
72521
72514
  /***/ }),
72522
72515
 
72523
72516
  /***/ "e444":
@@ -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":"bed71126-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=48280acc&scoped=true
78645
- var com_graphicsvue_type_template_id_48280acc_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_48280acc_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=48280acc&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)); }
@@ -108611,6 +108604,386 @@ measure_height_MeasureHeight.prototype = {
108611
108604
  /* harmony default export */ var measure_height = ({
108612
108605
  MeasureHeight: measure_height_MeasureHeight
108613
108606
  });
108607
+ // CONCATENATED MODULE: ./src/utils/threejs/measure-clear-distance.js
108608
+ function measure_clear_distance_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = measure_clear_distance_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
108609
+ function measure_clear_distance_slicedToArray(r, e) { return measure_clear_distance_arrayWithHoles(r) || measure_clear_distance_iterableToArrayLimit(r, e) || measure_clear_distance_unsupportedIterableToArray(r, e) || measure_clear_distance_nonIterableRest(); }
108610
+ function measure_clear_distance_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
108611
+ function measure_clear_distance_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return measure_clear_distance_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) ? measure_clear_distance_arrayLikeToArray(r, a) : void 0; } }
108612
+ function measure_clear_distance_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
108613
+ function measure_clear_distance_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
108614
+ function measure_clear_distance_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
108615
+
108616
+
108617
+
108618
+ var measure_clear_distance_this = null;
108619
+ var measure_clear_distance_MeasureClearDistance = function MeasureClearDistance(renderer, scene, camera, width, height) {
108620
+ this.renderer = renderer;
108621
+ this.scene = scene;
108622
+ this.camera = camera;
108623
+ this.pointArray = []; // 保存当前操作所添加的点
108624
+ this.raycaster = new Raycaster();
108625
+ this.points = []; // 保存页面中所添加的点
108626
+ this.polyline = []; //保存页面中所添加的直线
108627
+ this.labels = []; // 保存页面中所添加的文本
108628
+ this.timer = null;
108629
+ this.width = width;
108630
+ this.height = height;
108631
+ this.firstTime = 0;
108632
+ this.measureName = 'measureObj';
108633
+ this.selectedObjects = [];
108634
+ };
108635
+ measure_clear_distance_MeasureClearDistance.prototype = {
108636
+ start: function start() {
108637
+ measure_clear_distance_this = this;
108638
+ this.renderer.domElement.style.cursor = 'crosshair';
108639
+ this.renderer.domElement.addEventListener('mouseup', this.click, false);
108640
+ this.renderer.domElement.addEventListener('mousedown', this.mousedown, false);
108641
+ },
108642
+ updateParams: function updateParams(width, height) {
108643
+ this.camera.aspect = width / height;
108644
+ this.camera.updateProjectionMatrix();
108645
+ this.renderer.setSize(width, height, true);
108646
+ this.width = width;
108647
+ this.height = height;
108648
+ },
108649
+ getPosition: function getPosition(e) {
108650
+ var mouse = new Vector2();
108651
+ var elRect = this.renderer.domElement.getBoundingClientRect();
108652
+ var canvasX = e.clientX - elRect.left;
108653
+ var canvasY = e.clientY - elRect.top;
108654
+ mouse.x = canvasX / elRect.width * 2.0 - 1.0;
108655
+ mouse.y = -(canvasY / elRect.height) * 2.0 + 1.0;
108656
+ measure_clear_distance_this.raycaster.setFromCamera(mouse, this.camera);
108657
+ var intersects = measure_clear_distance_this.raycaster.intersectObjects(measure_clear_distance_this.scene.children, true);
108658
+ if (intersects.length > 0) {
108659
+ return intersects[0];
108660
+ }
108661
+ return null;
108662
+ },
108663
+ createLine: function createLine(p1, p2) {
108664
+ var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
108665
+ color: 0xff0000
108666
+ };
108667
+ var lineMaterial = new LineBasicMaterial({
108668
+ color: config.color,
108669
+ linewidth: 15,
108670
+ depthTest: false,
108671
+ depthWrite: false,
108672
+ transparent: true
108673
+ });
108674
+ var lineGeometry = new BufferGeometry().setFromPoints([p1, p2]);
108675
+ var line = new three_core_Line(lineGeometry, lineMaterial);
108676
+ line.name = this.measureName;
108677
+ line.renderOrder = 999;
108678
+ line.frustumCulled = false;
108679
+ return line;
108680
+ },
108681
+ createLabel: function createLabel(name, text, position) {
108682
+ var div = document.createElement('div');
108683
+ div.className = name;
108684
+ div.textContent = text;
108685
+ var divLabel = new CSS2DRenderer_CSS2DObject(div);
108686
+ divLabel.name = this.measureName;
108687
+ divLabel.position.set(position.x, position.y, position.z);
108688
+ return divLabel;
108689
+ },
108690
+ createTipsLabel: function createTipsLabel(label, position) {
108691
+ var div = document.createElement('div');
108692
+ div.className = 'tips-label';
108693
+ div.textContent = label;
108694
+ var tipsLabel = new CSS2DRenderer_CSS2DObject(div);
108695
+ tipsLabel.name = this.measureName;
108696
+ tipsLabel.position.set(position.x + 0.1, position.y, position.z + 0.05);
108697
+ return tipsLabel;
108698
+ },
108699
+ mousedown: function mousedown() {
108700
+ this.firstTime = new Date().getTime();
108701
+ },
108702
+ click: function click(e) {
108703
+ var lastTime = new Date().getTime();
108704
+ if (lastTime - this.firstTime < 300) {
108705
+ var measureObj = measure_clear_distance_this.getPosition(e);
108706
+ if (measureObj) {
108707
+ measure_clear_distance_this.selectedObjects.push(measureObj);
108708
+ if (measure_clear_distance_this.selectedObjects.length % 2 === 0) {
108709
+ measure_clear_distance_this.calculateClearDistance();
108710
+ }
108711
+ } else {
108712
+ element_ui_common["Message"].warning('请点击模型进行测量');
108713
+ }
108714
+ }
108715
+ },
108716
+ calculateClearDistance: function calculateClearDistance() {
108717
+ var l = this.selectedObjects.length;
108718
+ // 每次都取最后两个
108719
+ var obj1 = this.selectedObjects[l - 2];
108720
+ var obj2 = this.selectedObjects[l - 1];
108721
+ var isParallel = this.checkParallelism(obj1.object, obj1.instanceId, obj2.object, obj2.instanceId);
108722
+ console.log(isParallel);
108723
+ var pts1 = this.getInstanceSurfacePoints(obj1.object, obj1.instanceId, 600);
108724
+ var pts2 = this.getInstanceSurfacePoints(obj2.object, obj2.instanceId, 600);
108725
+ if (pts1.length === 0 || pts2.length === 0) {
108726
+ return;
108727
+ }
108728
+ var closestPair = this.findClosestPair(pts1, pts2);
108729
+ var position = new Vector3((closestPair.point1.x + closestPair.point2.x) / 2, (closestPair.point1.y + closestPair.point2.y) / 2, (closestPair.point1.z + closestPair.point2.z) / 2);
108730
+ // 将测量结果显示在页面中
108731
+ var circleTag1 = this.createLabel('circle-tag', '', closestPair.point1);
108732
+ var circleTag2 = this.createLabel('circle-tag', '', closestPair.point2);
108733
+ var line = this.createLine(closestPair.point1, closestPair.point2);
108734
+ var label = this.createLabel('measure-label', "".concat(this.numberToString(closestPair.distance)), position);
108735
+ this.points.push(circleTag1);
108736
+ this.points.push(circleTag1);
108737
+ this.polyline.push(line);
108738
+ this.labels.push(label);
108739
+ this.scene.add(circleTag1);
108740
+ this.scene.add(circleTag2);
108741
+ this.scene.add(line);
108742
+ this.scene.add(label);
108743
+ },
108744
+ getInstanceSurfacePoints: function getInstanceSurfacePoints(instancedMesh, instanceId) {
108745
+ var maxPoints = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
108746
+ var geometry = instancedMesh.geometry;
108747
+ // let localPoints = this.generateGenericLocalPoints(geometry, maxPoints);
108748
+ var localPoints = this.sampleGeometrySurface(geometry, maxPoints);
108749
+ var worldMatrix = this.getInstanceWorldMatrix(instancedMesh, instanceId);
108750
+ var worldPoints = localPoints.map(function (p) {
108751
+ return p.clone().applyMatrix4(worldMatrix);
108752
+ });
108753
+ return worldPoints.slice(0, maxPoints);
108754
+ },
108755
+ sampleGeometrySurface: function sampleGeometrySurface(geometry) {
108756
+ var maxPoints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 600;
108757
+ var positions = geometry.getAttribute('position');
108758
+ if (!positions) return [];
108759
+
108760
+ // 获取三角形(优先使用索引)
108761
+ var triangles = [];
108762
+ if (geometry.index) {
108763
+ var index = geometry.index.array;
108764
+ for (var i = 0; i < index.length; i += 3) {
108765
+ var a = new Vector3(positions.getX(index[i]), positions.getY(index[i]), positions.getZ(index[i]));
108766
+ var b = new Vector3(positions.getX(index[i + 1]), positions.getY(index[i + 1]), positions.getZ(index[i + 1]));
108767
+ var c = new Vector3(positions.getX(index[i + 2]), positions.getY(index[i + 2]), positions.getZ(index[i + 2]));
108768
+ triangles.push([a, b, c]);
108769
+ }
108770
+ } else {
108771
+ // 无索引时,每三个顶点组成一个三角形
108772
+ for (var _i = 0; _i < positions.count; _i += 3) {
108773
+ var _a = new Vector3(positions.getX(_i), positions.getY(_i), positions.getZ(_i));
108774
+ var _b = new Vector3(positions.getX(_i + 1), positions.getY(_i + 1), positions.getZ(_i + 1));
108775
+ var _c = new Vector3(positions.getX(_i + 2), positions.getY(_i + 2), positions.getZ(_i + 2));
108776
+ triangles.push([_a, _b, _c]);
108777
+ }
108778
+ }
108779
+ if (triangles.length === 0) return [];
108780
+
108781
+ // 计算每个三角形的面积
108782
+ var areas = triangles.map(function (_ref) {
108783
+ var _ref2 = measure_clear_distance_slicedToArray(_ref, 3),
108784
+ a = _ref2[0],
108785
+ b = _ref2[1],
108786
+ c = _ref2[2];
108787
+ var ab = new Vector3().subVectors(b, a);
108788
+ var ac = new Vector3().subVectors(c, a);
108789
+ return new Vector3().crossVectors(ab, ac).length() * 0.5;
108790
+ });
108791
+ var totalArea = areas.reduce(function (sum, a) {
108792
+ return sum + a;
108793
+ }, 0);
108794
+
108795
+ // 按面积比例分配采样点数
108796
+ var points = [];
108797
+ for (var _i2 = 0; _i2 < triangles.length; _i2++) {
108798
+ var _triangles$_i = measure_clear_distance_slicedToArray(triangles[_i2], 3),
108799
+ _a2 = _triangles$_i[0],
108800
+ _b2 = _triangles$_i[1],
108801
+ _c2 = _triangles$_i[2];
108802
+ var area = areas[_i2];
108803
+ var samplesForFace = Math.round(area / totalArea * maxPoints);
108804
+ if (samplesForFace < 1 && points.length < maxPoints) samplesForFace = 1; // 确保每个面至少一个点
108805
+
108806
+ for (var j = 0; j < samplesForFace; j++) {
108807
+ // 重心坐标随机采样
108808
+ var u = Math.random();
108809
+ var v = Math.random() * (1 - u);
108810
+ var w = 1 - u - v;
108811
+ var point = new Vector3().addScaledVector(_a2, u).addScaledVector(_b2, v).addScaledVector(_c2, w);
108812
+ points.push(point);
108813
+ }
108814
+ }
108815
+
108816
+ // 如果点数不够,随机补充
108817
+ while (points.length < maxPoints) {
108818
+ var triIdx = Math.floor(Math.random() * triangles.length);
108819
+ var _triangles$triIdx = measure_clear_distance_slicedToArray(triangles[triIdx], 3),
108820
+ _a3 = _triangles$triIdx[0],
108821
+ _b3 = _triangles$triIdx[1],
108822
+ _c3 = _triangles$triIdx[2];
108823
+ var _u = Math.random();
108824
+ var _v = Math.random() * (1 - _u);
108825
+ var _w = 1 - _u - _v;
108826
+ points.push(new Vector3().addScaledVector(_a3, _u).addScaledVector(_b3, _v).addScaledVector(_c3, _w));
108827
+ }
108828
+ return points.slice(0, maxPoints);
108829
+ },
108830
+ generateGenericLocalPoints: function generateGenericLocalPoints(geometry) {
108831
+ var maxPoints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
108832
+ var pos = geometry.getAttribute('position');
108833
+ if (!pos) return [];
108834
+ var allVerts = [];
108835
+ for (var i = 0; i < pos.count; i++) {
108836
+ allVerts.push(new Vector3(pos.getX(i), pos.getY(i), pos.getZ(i)));
108837
+ }
108838
+ var sourceVerts = allVerts;
108839
+ if (geometry.index) {
108840
+ var indexArr = geometry.index.array;
108841
+ var seen = new Set();
108842
+ sourceVerts = [];
108843
+ for (var _i3 = 0; _i3 < indexArr.length; _i3++) {
108844
+ var v = allVerts[indexArr[_i3]];
108845
+ var key = "".concat(v.x.toFixed(4), ",").concat(v.y.toFixed(4), ",").concat(v.z.toFixed(4));
108846
+ if (!seen.has(key)) {
108847
+ seen.add(key);
108848
+ sourceVerts.push(v.clone());
108849
+ }
108850
+ }
108851
+ }
108852
+ if (sourceVerts.length > maxPoints) {
108853
+ var step = Math.ceil(sourceVerts.length / maxPoints);
108854
+ var sampled = [];
108855
+ for (var _i4 = 0; _i4 < sourceVerts.length; _i4 += step) sampled.push(sourceVerts[_i4]);
108856
+ sourceVerts = sampled;
108857
+ }
108858
+ return sourceVerts;
108859
+ },
108860
+ findClosestPair: function findClosestPair(points1, points2) {
108861
+ var minDist = Infinity;
108862
+ var c1 = new Vector3();
108863
+ var c2 = new Vector3();
108864
+ var _iterator = measure_clear_distance_createForOfIteratorHelper(points1),
108865
+ _step;
108866
+ try {
108867
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
108868
+ var p1 = _step.value;
108869
+ var _iterator2 = measure_clear_distance_createForOfIteratorHelper(points2),
108870
+ _step2;
108871
+ try {
108872
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
108873
+ var p2 = _step2.value;
108874
+ var d = p1.distanceTo(p2);
108875
+ if (d < minDist) {
108876
+ minDist = d;
108877
+ c1.copy(p1);
108878
+ c2.copy(p2);
108879
+ }
108880
+ }
108881
+ } catch (err) {
108882
+ _iterator2.e(err);
108883
+ } finally {
108884
+ _iterator2.f();
108885
+ }
108886
+ }
108887
+ } catch (err) {
108888
+ _iterator.e(err);
108889
+ } finally {
108890
+ _iterator.f();
108891
+ }
108892
+ return {
108893
+ point1: c1,
108894
+ point2: c2,
108895
+ distance: minDist
108896
+ };
108897
+ },
108898
+ // 平行判断 (基于包围盒主轴方向)
108899
+ checkParallelism: function checkParallelism(inst1, id1, inst2, id2) {
108900
+ var mat1 = this.getInstanceWorldMatrix(inst1, id1);
108901
+ var mat2 = this.getInstanceWorldMatrix(inst2, id2);
108902
+ var box1 = new Box3();
108903
+ var box2 = new Box3();
108904
+
108905
+ // 确保包围盒存在
108906
+ if (!inst1.geometry.boundingBox) inst1.geometry.computeBoundingBox();
108907
+ if (!inst2.geometry.boundingBox) inst2.geometry.computeBoundingBox();
108908
+ box1.copy(inst1.geometry.boundingBox).applyMatrix4(mat1);
108909
+ box2.copy(inst2.geometry.boundingBox).applyMatrix4(mat2);
108910
+ var size1 = new Vector3();
108911
+ box1.getSize(size1);
108912
+ var size2 = new Vector3();
108913
+ box2.getSize(size2);
108914
+ var getMainDir = function getMainDir(s) {
108915
+ if (s.x >= s.y && s.x >= s.z) return new Vector3(1, 0, 0);
108916
+ if (s.y >= s.x && s.y >= s.z) return new Vector3(0, 1, 0);
108917
+ return new Vector3(0, 0, 1);
108918
+ };
108919
+ var d1 = getMainDir(size1);
108920
+ var d2 = getMainDir(size2);
108921
+ var rot1 = new Quaternion().setFromRotationMatrix(new Matrix4().extractRotation(mat1));
108922
+ var rot2 = new Quaternion().setFromRotationMatrix(new Matrix4().extractRotation(mat2));
108923
+ d1.applyQuaternion(rot1);
108924
+ d2.applyQuaternion(rot2);
108925
+ return Math.abs(d1.dot(d2)) > 0.95;
108926
+ },
108927
+ getInstanceWorldMatrix: function getInstanceWorldMatrix(instancedMesh, instanceId) {
108928
+ var matrix = new Matrix4();
108929
+ var instanceMatrix = new Matrix4();
108930
+ instancedMesh.getMatrixAt(instanceId, instanceMatrix);
108931
+ matrix.multiplyMatrices(instancedMesh.matrixWorld, instanceMatrix);
108932
+ return matrix;
108933
+ },
108934
+ close: function close(isClear) {
108935
+ this.renderer.domElement.removeEventListener('mousedown', this.mousedown);
108936
+ this.renderer.domElement.removeEventListener('mouseup', this.click);
108937
+ if (!isClear) {
108938
+ this.remove(this.points);
108939
+ this.remove(this.polyline);
108940
+ this.remove(this.labels);
108941
+ this.pointArray.splice(0);
108942
+ this.points.splice(0);
108943
+ this.polyline.splice(0);
108944
+ this.labels.splice(0);
108945
+ this.firstTime = 0;
108946
+ }
108947
+ this.renderer.domElement.style.cursor = 'pointer';
108948
+ },
108949
+ clear: function clear() {
108950
+ this.remove(this.points);
108951
+ this.remove(this.polyline);
108952
+ this.remove(this.labels);
108953
+ this.pointArray.splice(0);
108954
+ this.points.splice(0);
108955
+ this.polyline.splice(0);
108956
+ this.labels.splice(0);
108957
+ this.firstTime = 0;
108958
+ },
108959
+ remove: function remove(array) {
108960
+ for (var index = 0; index < array.length; index++) {
108961
+ var element = array[index];
108962
+ if (element.geometry) {
108963
+ element.geometry.dispose();
108964
+ }
108965
+ this.scene.remove(element);
108966
+ }
108967
+ },
108968
+ numberToString: function numberToString(num) {
108969
+ if (num < 0.0001) {
108970
+ return num.toString();
108971
+ }
108972
+ var fractionDigits = 2;
108973
+ if (num < 0.01) {
108974
+ fractionDigits = 4;
108975
+ } else if (num < 0.1) {
108976
+ fractionDigits = 3;
108977
+ }
108978
+ return num.toFixed(fractionDigits);
108979
+ },
108980
+ preventContextMenu: function preventContextMenu(event) {
108981
+ event.preventDefault();
108982
+ }
108983
+ };
108984
+ /* harmony default export */ var measure_clear_distance = ({
108985
+ MeasureClearDistance: measure_clear_distance_MeasureClearDistance
108986
+ });
108614
108987
  // CONCATENATED MODULE: ./src/utils/flgltf-parser.js
108615
108988
  function flgltf_parser_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = flgltf_parser_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
108616
108989
  function flgltf_parser_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return flgltf_parser_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) ? flgltf_parser_arrayLikeToArray(r, a) : void 0; } }
@@ -108637,8 +109010,12 @@ function processMeshData(input, options) {
108637
109010
  mergeMaterialByMeshId.set(String(it.id), it);
108638
109011
  }
108639
109012
  }
109013
+ var identity = new Matrix4().identity();
109014
+ var identityElements = identity.elements;
108640
109015
  input.mesh.forEach(function (meshItem) {
109016
+ var _meshItem$matrix;
108641
109017
  var geomList = [];
109018
+ var meshMatrix = (_meshItem$matrix = meshItem.matrix) !== null && _meshItem$matrix !== void 0 && _meshItem$matrix.length ? meshItem.matrix : identityElements;
108642
109019
  meshItem.primitives.forEach(function (primitive) {
108643
109020
  var primitiveData = input.primitive.find(function (g) {
108644
109021
  return g.id === primitive.prmid;
@@ -108651,26 +109028,24 @@ function processMeshData(input, options) {
108651
109028
  var mergedMaterial = mergeMaterialByMeshId.get(String(meshItem.id));
108652
109029
  var material = mergedMaterial || baseMaterial;
108653
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];
108654
109032
  var prop = {
108655
- 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,
108656
109034
  fontsize: (material === null || material === void 0 ? void 0 : material.fontsize) !== undefined ? material === null || material === void 0 ? void 0 : material.fontsize : 20,
108657
109035
  frontname: (material === null || material === void 0 ? void 0 : material.frontname) !== undefined ? material === null || material === void 0 ? void 0 : material.frontname : '',
108658
109036
  italic: material === null || material === void 0 ? void 0 : material.italic,
108659
109037
  linepacing: 1,
108660
109038
  // 默认值
108661
- 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,
108662
109040
  // 默认值
108663
109041
  visible: sourceVisible,
108664
109042
  sourceVisible: sourceVisible,
108665
109043
  transparent: (material === null || material === void 0 ? void 0 : material.transp) !== undefined ? material === null || material === void 0 ? void 0 : material.transp : 0
108666
109044
  };
108667
- var identity = new Matrix4().identity();
108668
109045
  geomList.push({
108669
109046
  matrix: {
108670
- val: (_primitive$matrix = primitive.matrix) !== null && _primitive$matrix !== void 0 && _primitive$matrix.length ? primitive.matrix : identity.elements
108671
- // val: identity.elements,
109047
+ val: (_primitive$matrix = primitive.matrix) !== null && _primitive$matrix !== void 0 && _primitive$matrix.length ? primitive.matrix : identityElements
108672
109048
  },
108673
- // originMatrix: meshItem.id == primitive.prmid ? [] : identity.elements,
108674
109049
  prmid: primitive.prmid,
108675
109050
  geomId: primitiveData.id,
108676
109051
  type: primitiveData.geomType,
@@ -108687,6 +109062,9 @@ function processMeshData(input, options) {
108687
109062
  });
108688
109063
  drawObjMap.set(meshItem.id, {
108689
109064
  drawObjId: meshItem.id,
109065
+ matrix: {
109066
+ val: meshMatrix
109067
+ },
108690
109068
  geoms: geomList
108691
109069
  // lodLevel: meshItem.type || 2,
108692
109070
  });
@@ -108766,12 +109144,12 @@ function processNodeData(input, options) {
108766
109144
 
108767
109145
  // 处理一个primitive,生成多个drawObj
108768
109146
  function processOnePrimtiveToMultiMesh(primitive) {
108769
- var _primitive$geoms$, _primitive$geoms$2;
109147
+ var _primitive$geoms$;
108770
109148
  return {
108771
109149
  instanceId: primitive.drawObjId,
108772
109150
  // 实例与drawObj一对多关系
108773
109151
  drawObject: ((_primitive$geoms$ = primitive.geoms[0]) === null || _primitive$geoms$ === void 0 ? void 0 : _primitive$geoms$.prmid) || '',
108774
- matrix: ((_primitive$geoms$2 = primitive.geoms[0]) === null || _primitive$geoms$2 === void 0 ? void 0 : _primitive$geoms$2.matrix) || []
109152
+ matrix: primitive.matrix || {}
108775
109153
  };
108776
109154
  }
108777
109155
 
@@ -108857,14 +109235,19 @@ function parseNode(node, isFlatNode) {
108857
109235
  // 生成默认node节点
108858
109236
  function generateNode(mesh) {
108859
109237
  var nodes = [];
109238
+ var identity = new Matrix4().identity();
109239
+ var identityElements = identity.elements;
108860
109240
  mesh.forEach(function (item) {
108861
109241
  if (item.primitives.length) {
109242
+ var _item$matrix;
108862
109243
  var tempNode = {
108863
109244
  id: item.id,
108864
109245
  _batchId: item.id,
108865
109246
  name: item.id,
108866
109247
  mesh: item.id,
108867
- matrix: {},
109248
+ matrix: {
109249
+ val: (_item$matrix = item.matrix) !== null && _item$matrix !== void 0 && _item$matrix.length ? item.matrix : identityElements
109250
+ },
108868
109251
  nodeType: 3
108869
109252
  };
108870
109253
  nodes.push(tempNode);
@@ -111048,7 +111431,7 @@ var inline_default = /*#__PURE__*/__webpack_require__.n(inline);
111048
111431
 
111049
111432
 
111050
111433
  function Worker_fn() {
111051
- 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);
111052
111435
  }
111053
111436
 
111054
111437
  // CONCATENATED MODULE: ./src/utils/instance-parser.js
@@ -111169,9 +111552,37 @@ function getInstanceNormalSign(matrix) {
111169
111552
  if (!matrix || typeof matrix.determinant !== 'function') return 1;
111170
111553
  return matrix.determinant() < 0 ? -1 : 1;
111171
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
+ }
111172
111583
 
111173
- /**
111174
- * 重置处理状态,用于新的批量加载会话
111584
+ /**
111585
+ * 重置处理状态,用于新的批量加载会话
111175
111586
  */
111176
111587
  function resetProcessingState() {
111177
111588
  drawObjMapInstance = {};
@@ -111481,7 +111892,6 @@ function setInstanceMatricesAndColors(model, drawObj, mesh, meshName, customColo
111481
111892
 
111482
111893
  // 批量处理实例
111483
111894
  instances.forEach(function (item, index) {
111484
- var _item$matrix;
111485
111895
  // 设置用户数据
111486
111896
  model.userData.instanceIndex = index;
111487
111897
  model.userData.instanceId = item.instanceId;
@@ -111510,38 +111920,19 @@ function setInstanceMatricesAndColors(model, drawObj, mesh, meshName, customColo
111510
111920
 
111511
111921
  // const instancedMesh = instanceToInstancedMeshMap.get(item.instanceId);
111512
111922
 
111513
- // 处理矩阵变换
111514
- var matrixVal = (_item$matrix = item.matrix) === null || _item$matrix === void 0 ? void 0 : _item$matrix.val;
111515
- if (matrixVal) {
111516
- var m4 = new Matrix4();
111517
- var meshMatrix = new Matrix4();
111518
- var geomMatrix = new Matrix4();
111519
- meshMatrix.fromArray(matrixVal);
111520
- geomMatrix.fromArray(new Matrix4().identity().elements);
111521
-
111522
- // 处理文本居中对齐
111523
- var points = mesh.points,
111524
- alignType = mesh.alignType;
111525
- if (isTextType(mesh.type)) {
111526
- var positionMatrix = new Matrix4();
111527
- var alignMatrix = createAlignedText(alignType, model.geometry);
111528
- positionMatrix.identity().makeTranslation(points[0], points[1], points[2]);
111529
- geomMatrix.multiply(alignMatrix).multiply(positionMatrix);
111530
- }
111531
- m4.multiplyMatrices(meshMatrix, geomMatrix);
111532
- model.setMatrixAt(index, m4);
111533
- var _normalSignAttr = model.geometry && model.geometry.getAttribute('instanceNormalSign');
111534
- if (_normalSignAttr && _normalSignAttr.array && index < _normalSignAttr.array.length) {
111535
- _normalSignAttr.array[index] = getInstanceNormalSign(m4);
111536
- }
111537
- var copyMatrix = new Matrix4().copy(m4);
111538
- model.userData.copyMatrix = copyMatrix;
111539
- var temp = model.userData.instancesMap.get(item.instanceId);
111540
- temp.copyMatrix = copyMatrix;
111541
- if (sourceVisible === false) {
111542
- var offsetMatrix = new Matrix4().copy(copyMatrix).makeTranslation(9999999, 9999999, 9999999);
111543
- model.setMatrixAt(index, offsetMatrix);
111544
- }
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);
111545
111936
  }
111546
111937
 
111547
111938
  // 设置颜色
@@ -111587,7 +111978,6 @@ function appendInstanceToInstancedGroup(group, drawObj, instance, customColor) {
111587
111978
  }
111588
111979
  }
111589
111980
  function appendInstanceToInstancedMesh(model, drawObj, mesh, instance, customColor) {
111590
- var _instance$matrix;
111591
111981
  if (!model || !model.isInstancedMesh) return;
111592
111982
  if (!instance || !instance.instanceId) return;
111593
111983
  var capacity = model.instanceMatrix && typeof model.instanceMatrix.count === 'number' ? model.instanceMatrix.count : model.count;
@@ -111600,22 +111990,8 @@ function appendInstanceToInstancedMesh(model, drawObj, mesh, instance, customCol
111600
111990
  var sourceVisible = mesh && mesh.prop && mesh.prop.sourceVisible === false ? false : true;
111601
111991
  var colorArr = Array.isArray(rawColor) ? rawColor : typeof rawColor === 'string' ? rawColor.split(',') : [255, 255, 255];
111602
111992
  var meshColor = customColor ? new Color(customColor) : new Color("rgb(".concat(colorArr[0], ", ").concat(colorArr[1], ", ").concat(colorArr[2], ")"));
111603
- var matrixVal = (_instance$matrix = instance.matrix) === null || _instance$matrix === void 0 ? void 0 : _instance$matrix.val;
111604
- if (!matrixVal || !mesh || !mesh.matrix || !mesh.matrix.val) return;
111605
- var m4 = new Matrix4();
111606
- var meshMatrix = new Matrix4();
111607
- var geomMatrix = new Matrix4();
111608
- meshMatrix.fromArray(instance.matrix.val);
111609
- geomMatrix.fromArray(new Matrix4().identity().elements);
111610
- var points = mesh.points,
111611
- alignType = mesh.alignType;
111612
- if (isTextType(mesh.type)) {
111613
- var positionMatrix = new Matrix4();
111614
- var alignMatrix = createAlignedText(alignType, model.geometry);
111615
- positionMatrix.identity().makeTranslation(points[0], points[1], points[2]);
111616
- geomMatrix.multiply(alignMatrix).multiply(positionMatrix);
111617
- }
111618
- m4.multiplyMatrices(meshMatrix, geomMatrix);
111993
+ if (!mesh) return;
111994
+ var m4 = composeInstanceMatrix(instance, mesh, model.geometry);
111619
111995
  var renderMatrix = sourceVisible === false ? new Matrix4().copy(m4).makeTranslation(9999999, 9999999, 9999999) : m4;
111620
111996
  model.setMatrixAt(currentCount, renderMatrix);
111621
111997
  if (model.instanceMatrix) model.instanceMatrix.needsUpdate = true;
@@ -111719,13 +112095,13 @@ function drawModel(geom, instanceName, instanceCount, nColor, nOpacity) {
111719
112095
  var model;
111720
112096
  // 处理二维几何体(普通2D图形和特殊2D图形)
111721
112097
  if (geom.type == GEOM_TYPES.geom_2d || geom.type == GEOM_TYPES.geom_2d_others) {
111722
- model = draw2Dmodel(geom, instanceName, instanceCount, options); // TODO 该类型调试中
112098
+ model = draw2Dmodel(geom, instanceName, instanceCount, nColor, nOpacity, options); // TODO 该类型调试中
111723
112099
  // 处理二维文本类型
111724
112100
  } else if (isTextType(geom.type)) {
111725
112101
  model = drawText(geom, instanceName, instanceCount, options);
111726
112102
  // 处理各种曲线类型(圆形、圆弧、椭圆、椭圆弧)
111727
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) {
111728
- model = drawCurves(geom, instanceName, instanceCount, options); // TODO 该类型调试中
112104
+ model = drawCurves(geom, instanceName, instanceCount, nColor, nOpacity, options); // TODO 该类型调试中
111729
112105
  // 处理三维几何体(普通3D模型和OBJ模型)
111730
112106
  } else if (geom.type == GEOM_TYPES.geom_3d || geom.type == GEOM_TYPES.geom_3d_obj) {
111731
112107
  model = draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity, options);
@@ -111749,8 +112125,8 @@ function isTextType(type) {
111749
112125
  * @param {String} instanceName- 曲线实例的名称
111750
112126
  * @return {Object}- 包含曲线模型和曲线信息的对象
111751
112127
  */
111752
- function drawCurves(geom, instanceName, instanceCount) {
111753
- 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] : {};
111754
112130
  var points = geom.points,
111755
112131
  normals = geom.normals;
111756
112132
  var aX = points[0];
@@ -111780,7 +112156,7 @@ function drawCurves(geom, instanceName, instanceCount) {
111780
112156
  var model = draw2Dmodel(instance_parser_objectSpread(instance_parser_objectSpread({}, geom), {}, {
111781
112157
  points: list,
111782
112158
  normals: normals
111783
- }), instanceName, instanceCount, options);
112159
+ }), instanceName, instanceCount, nColor, nOpacity, options);
111784
112160
  // model.rotation.x = -Math.PI / 2;
111785
112161
  // model.position.set(aX, aY, aZ);
111786
112162
  var matrix = new Matrix4();
@@ -111953,7 +112329,7 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
111953
112329
 
111954
112330
  // 处理transparent透明度
111955
112331
  opacity = 1 - transparent;
111956
- var finalOpacity = nOpacity !== '' ? nOpacity : opacity;
112332
+ var finalOpacity = nOpacity !== undefined && nOpacity !== null && nOpacity !== '' ? nOpacity : opacity;
111957
112333
 
111958
112334
  // 判断是否全透明
111959
112335
  var isTransparent = finalOpacity < 1.0;
@@ -112030,8 +112406,8 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
112030
112406
  * @param {String} instanceName - 模型实例的名称
112031
112407
  * @returns {Object} - 包含所有 2D 模型的组对象
112032
112408
  */
112033
- function draw2Dmodel(geom, instanceName, instanceCount) {
112034
- 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] : {};
112035
112411
  var points = geom.points;
112036
112412
  var normals = geom.normals;
112037
112413
  var geometry = new BufferGeometry();
@@ -112057,7 +112433,7 @@ function draw2Dmodel(geom, instanceName, instanceCount) {
112057
112433
  prop: geom.prop,
112058
112434
  geometry: lineGeometry,
112059
112435
  material: material
112060
- }, instanceName, instanceCount, options);
112436
+ }, instanceName, instanceCount, nColor, nOpacity, options);
112061
112437
  // mesh.raycast = raycast;
112062
112438
 
112063
112439
  model.userData.instanceName = instanceName;
@@ -114148,17 +114524,14 @@ _Stats.Panel = function (name, fg, bg) {
114148
114524
  };
114149
114525
  };
114150
114526
  /* harmony default export */ var stats_module = (_Stats);
114151
- // EXTERNAL MODULE: ./packages/components/com-graphics/box.json
114152
- var com_graphics_box = __webpack_require__("cbf5");
114153
-
114154
114527
  // EXTERNAL MODULE: ./node_modules/fflate/esm/browser.js
114155
114528
  var browser = __webpack_require__("72ba");
114156
114529
 
114157
114530
  // CONCATENATED MODULE: ./packages/utils/StreamLoader.js
114158
- 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); }
114159
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; }
114160
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; }
114161
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); }
114162
114535
  function StreamLoader_toConsumableArray(r) { return StreamLoader_arrayWithoutHoles(r) || StreamLoader_iterableToArray(r) || StreamLoader_unsupportedIterableToArray(r) || StreamLoader_nonIterableSpread(); }
114163
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."); }
114164
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; } }
@@ -114349,15 +114722,16 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114349
114722
  }, {
114350
114723
  key: "parseStreamImmediate",
114351
114724
  value: function () {
114352
- 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) {
114353
114726
  var _this4 = this;
114354
114727
  var abortSignal,
114355
114728
  streamId,
114356
114729
  batchMeshes,
114357
- batchPrimitives,
114730
+ batchPrimitiveGroups,
114358
114731
  batchSize,
114359
114732
  batchStart,
114360
114733
  streamStats,
114734
+ flattenPrimitiveGroups,
114361
114735
  processStreamBatch,
114362
114736
  ensureNotAborted,
114363
114737
  localStreamId,
@@ -114375,63 +114749,52 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114375
114749
  abortPromiseInBatch,
114376
114750
  interactionPromiseInBatch,
114377
114751
  meshesToProcess,
114378
- primitivesToProcess,
114752
+ primitiveGroupsToProcess,
114379
114753
  _abortPromiseInBatch,
114380
114754
  _interactionPromiseInBatch,
114381
114755
  _meshesToProcess,
114382
- _primitivesToProcess,
114756
+ _primitiveGroupsToProcess,
114383
114757
  transferable,
114384
114758
  parsed,
114385
114759
  _abortPromiseInBatch2,
114386
114760
  _interactionPromiseInBatch2,
114387
114761
  _meshesToProcess2,
114388
- _primitivesToProcess2,
114762
+ _primitiveGroupsToProcess2,
114389
114763
  decoder,
114390
114764
  buffer,
114391
- pendingPrimitives,
114392
- expectingPrimitive,
114765
+ expectingMesh,
114766
+ pendingMesh,
114767
+ pendingPrimitiveIds,
114768
+ pendingPrimitiveGroups,
114769
+ pendingMatchedPrimitiveIds,
114393
114770
  isFullProps,
114771
+ normalizeMesh,
114772
+ collectMeshPrimitiveIds,
114773
+ isValidStreamMesh,
114774
+ tryParseMeshFromBuffer,
114775
+ parsePrimitiveFromBuffer,
114776
+ commitPendingMesh,
114394
114777
  _content2,
114395
114778
  _content3,
114396
114779
  _done,
114397
114780
  _value,
114398
114781
  newBuf,
114399
- dataView,
114782
+ meshResult,
114783
+ nextMeshResult,
114400
114784
  primitiveResult,
114401
114785
  primitiveData,
114402
- consumedBytes,
114403
- _this$parsePrimitiveD,
114404
- position,
114405
- normal,
114406
- posindex,
114407
- nolindex,
114408
- indices,
114409
- formatted,
114410
- docId,
114411
- length,
114412
- totalLen,
114413
- data,
114414
- mesh,
114415
- jsonStr,
114416
- _docId,
114417
- meshToPrimId,
114418
- hasPendingPrimitive,
114419
- hasPendingMesh,
114420
- _primitiveData,
114421
- primId,
114422
- _args3 = arguments,
114786
+ _args4 = arguments,
114423
114787
  _t,
114424
114788
  _t2,
114425
114789
  _t3,
114426
- _t4,
114427
- _t5;
114428
- return StreamLoader_regenerator().w(function (_context3) {
114429
- while (1) switch (_context3.p = _context3.n) {
114790
+ _t4;
114791
+ return StreamLoader_regenerator().w(function (_context4) {
114792
+ while (1) switch (_context4.p = _context4.n) {
114430
114793
  case 0:
114431
- abortSignal = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : null;
114432
- 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;
114433
114796
  batchMeshes = [];
114434
- batchPrimitives = [];
114797
+ batchPrimitiveGroups = [];
114435
114798
  batchSize = this.batchSize;
114436
114799
  batchStart = 0;
114437
114800
  streamStats = {
@@ -114439,8 +114802,28 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114439
114802
  totalMeshes: 0,
114440
114803
  totalPrimitives: 0
114441
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
+ };
114442
114824
  processStreamBatch = /*#__PURE__*/function () {
114443
- 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;
114444
114827
  return StreamLoader_regenerator().w(function (_context2) {
114445
114828
  while (1) switch (_context2.n) {
114446
114829
  case 0:
@@ -114450,6 +114833,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114450
114833
  }
114451
114834
  return _context2.a(2);
114452
114835
  case 1:
114836
+ primitivesToProcess = flattenPrimitiveGroups(primitiveGroupsToProcess);
114453
114837
  _context2.n = 2;
114454
114838
  return _this4.processBatchData(meshesToProcess, primitivesToProcess, list, range, abortSignal);
114455
114839
  case 2:
@@ -114473,7 +114857,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114473
114857
  return null;
114474
114858
  };
114475
114859
  if (!this.worker) {
114476
- _context3.n = 33;
114860
+ _context4.n = 33;
114477
114861
  break;
114478
114862
  }
114479
114863
  localStreamId = streamId || this.createStreamRequestId();
@@ -114481,45 +114865,45 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114481
114865
  if (!_this4.externalEnsureNotInteracting && !_this4.isUserInteracting) return null;
114482
114866
  return _this4.ensureNotInteracting(abortSignal);
114483
114867
  };
114484
- _context3.n = 1;
114868
+ _context4.n = 1;
114485
114869
  return this.workerRequest('streamInit', {
114486
114870
  streamId: localStreamId,
114487
114871
  prefixIdKey: this.prefixIdKey
114488
114872
  });
114489
114873
  case 1:
114490
- _context3.p = 1;
114874
+ _context4.p = 1;
114491
114875
  if (this.debug) performance.mark('while-start');
114492
114876
  case 2:
114493
114877
  if (false) {}
114494
114878
  abortPromise = ensureNotAborted();
114495
114879
  if (!abortPromise) {
114496
- _context3.n = 3;
114880
+ _context4.n = 3;
114497
114881
  break;
114498
114882
  }
114499
- _context3.n = 3;
114883
+ _context4.n = 3;
114500
114884
  return abortPromise;
114501
114885
  case 3:
114502
114886
  interactionPromise = ensureNotInteracting();
114503
114887
  if (!interactionPromise) {
114504
- _context3.n = 4;
114888
+ _context4.n = 4;
114505
114889
  break;
114506
114890
  }
114507
- _context3.n = 4;
114891
+ _context4.n = 4;
114508
114892
  return interactionPromise;
114509
114893
  case 4:
114510
114894
  content = void 0;
114511
- _context3.p = 5;
114512
- _context3.n = 6;
114895
+ _context4.p = 5;
114896
+ _context4.n = 6;
114513
114897
  return reader.read();
114514
114898
  case 6:
114515
- content = _context3.v;
114516
- _context3.n = 9;
114899
+ content = _context4.v;
114900
+ _context4.n = 9;
114517
114901
  break;
114518
114902
  case 7:
114519
- _context3.p = 7;
114520
- _t = _context3.v;
114903
+ _context4.p = 7;
114904
+ _t = _context4.v;
114521
114905
  if (!(_t && _t.name === 'AbortError')) {
114522
- _context3.n = 8;
114906
+ _context4.n = 8;
114523
114907
  break;
114524
114908
  }
114525
114909
  throw _t;
@@ -114528,91 +114912,91 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114528
114912
  case 9:
114529
114913
  _content = content, done = _content.done, value = _content.value;
114530
114914
  if (!done) {
114531
- _context3.n = 20;
114915
+ _context4.n = 20;
114532
114916
  break;
114533
114917
  }
114534
114918
  abortPromiseOnDone = ensureNotAborted();
114535
114919
  if (!abortPromiseOnDone) {
114536
- _context3.n = 10;
114920
+ _context4.n = 10;
114537
114921
  break;
114538
114922
  }
114539
- _context3.n = 10;
114923
+ _context4.n = 10;
114540
114924
  return abortPromiseOnDone;
114541
114925
  case 10:
114542
114926
  if (this.debug) {
114543
114927
  performance.mark('while-end');
114544
114928
  performance.measure('while', 'while-start', 'while-end');
114545
114929
  }
114546
- _context3.n = 11;
114930
+ _context4.n = 11;
114547
114931
  return this.workerRequest('streamFlush', {
114548
114932
  streamId: localStreamId
114549
114933
  });
114550
114934
  case 11:
114551
- flushed = _context3.v;
114935
+ flushed = _context4.v;
114552
114936
  if (flushed !== null && flushed !== void 0 && (_flushed$meshes = flushed.meshes) !== null && _flushed$meshes !== void 0 && _flushed$meshes.length) {
114553
114937
  batchMeshes.push.apply(batchMeshes, StreamLoader_toConsumableArray(flushed.meshes));
114554
- batchPrimitives.push.apply(batchPrimitives, StreamLoader_toConsumableArray(flushed.primitives));
114938
+ batchPrimitiveGroups.push.apply(batchPrimitiveGroups, StreamLoader_toConsumableArray(flushed.primitives));
114555
114939
  }
114556
114940
  case 12:
114557
114941
  if (!(batchMeshes.length - batchStart >= batchSize)) {
114558
- _context3.n = 16;
114942
+ _context4.n = 16;
114559
114943
  break;
114560
114944
  }
114561
114945
  abortPromiseInBatch = ensureNotAborted();
114562
114946
  if (!abortPromiseInBatch) {
114563
- _context3.n = 13;
114947
+ _context4.n = 13;
114564
114948
  break;
114565
114949
  }
114566
- _context3.n = 13;
114950
+ _context4.n = 13;
114567
114951
  return abortPromiseInBatch;
114568
114952
  case 13:
114569
114953
  interactionPromiseInBatch = ensureNotInteracting();
114570
114954
  if (!interactionPromiseInBatch) {
114571
- _context3.n = 14;
114955
+ _context4.n = 14;
114572
114956
  break;
114573
114957
  }
114574
- _context3.n = 14;
114958
+ _context4.n = 14;
114575
114959
  return interactionPromiseInBatch;
114576
114960
  case 14:
114577
114961
  meshesToProcess = batchMeshes.slice(batchStart, batchStart + batchSize);
114578
- primitivesToProcess = batchPrimitives.slice(batchStart, batchStart + batchSize);
114962
+ primitiveGroupsToProcess = batchPrimitiveGroups.slice(batchStart, batchStart + batchSize);
114579
114963
  batchStart += batchSize;
114580
- _context3.n = 15;
114581
- return processStreamBatch(meshesToProcess, primitivesToProcess);
114964
+ _context4.n = 15;
114965
+ return processStreamBatch(meshesToProcess, primitiveGroupsToProcess);
114582
114966
  case 15:
114583
- _context3.n = 12;
114967
+ _context4.n = 12;
114584
114968
  break;
114585
114969
  case 16:
114586
114970
  if (!(batchMeshes.length - batchStart > 0)) {
114587
- _context3.n = 19;
114971
+ _context4.n = 19;
114588
114972
  break;
114589
114973
  }
114590
114974
  _abortPromiseInBatch = ensureNotAborted();
114591
114975
  if (!_abortPromiseInBatch) {
114592
- _context3.n = 17;
114976
+ _context4.n = 17;
114593
114977
  break;
114594
114978
  }
114595
- _context3.n = 17;
114979
+ _context4.n = 17;
114596
114980
  return _abortPromiseInBatch;
114597
114981
  case 17:
114598
114982
  _interactionPromiseInBatch = ensureNotInteracting();
114599
114983
  if (!_interactionPromiseInBatch) {
114600
- _context3.n = 18;
114984
+ _context4.n = 18;
114601
114985
  break;
114602
114986
  }
114603
- _context3.n = 18;
114987
+ _context4.n = 18;
114604
114988
  return _interactionPromiseInBatch;
114605
114989
  case 18:
114606
114990
  _meshesToProcess = batchMeshes.slice(batchStart);
114607
- _primitivesToProcess = batchPrimitives.slice(batchStart);
114991
+ _primitiveGroupsToProcess = batchPrimitiveGroups.slice(batchStart);
114608
114992
  batchStart = batchMeshes.length;
114609
- _context3.n = 19;
114610
- return processStreamBatch(_meshesToProcess, _primitivesToProcess);
114993
+ _context4.n = 19;
114994
+ return processStreamBatch(_meshesToProcess, _primitiveGroupsToProcess);
114611
114995
  case 19:
114612
- return _context3.a(3, 27);
114996
+ return _context4.a(3, 27);
114613
114997
  case 20:
114614
114998
  transferable = (value === null || value === void 0 ? void 0 : value.buffer) instanceof ArrayBuffer ? [value.buffer] : [];
114615
- _context3.n = 21;
114999
+ _context4.n = 21;
114616
115000
  return this.workerRequest('streamPush', {
114617
115001
  streamId: localStreamId,
114618
115002
  chunk: value.buffer,
@@ -114620,92 +115004,240 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114620
115004
  byteLength: value.byteLength
114621
115005
  }, transferable);
114622
115006
  case 21:
114623
- parsed = _context3.v;
115007
+ parsed = _context4.v;
114624
115008
  if (parsed !== null && parsed !== void 0 && (_parsed$meshes = parsed.meshes) !== null && _parsed$meshes !== void 0 && _parsed$meshes.length) {
114625
115009
  batchMeshes.push.apply(batchMeshes, StreamLoader_toConsumableArray(parsed.meshes));
114626
- batchPrimitives.push.apply(batchPrimitives, StreamLoader_toConsumableArray(parsed.primitives));
115010
+ batchPrimitiveGroups.push.apply(batchPrimitiveGroups, StreamLoader_toConsumableArray(parsed.primitives));
114627
115011
  }
114628
115012
  case 22:
114629
115013
  if (!(batchMeshes.length - batchStart >= batchSize)) {
114630
- _context3.n = 26;
115014
+ _context4.n = 26;
114631
115015
  break;
114632
115016
  }
114633
115017
  _abortPromiseInBatch2 = ensureNotAborted();
114634
115018
  if (!_abortPromiseInBatch2) {
114635
- _context3.n = 23;
115019
+ _context4.n = 23;
114636
115020
  break;
114637
115021
  }
114638
- _context3.n = 23;
115022
+ _context4.n = 23;
114639
115023
  return _abortPromiseInBatch2;
114640
115024
  case 23:
114641
115025
  _interactionPromiseInBatch2 = ensureNotInteracting();
114642
115026
  if (!_interactionPromiseInBatch2) {
114643
- _context3.n = 24;
115027
+ _context4.n = 24;
114644
115028
  break;
114645
115029
  }
114646
- _context3.n = 24;
115030
+ _context4.n = 24;
114647
115031
  return _interactionPromiseInBatch2;
114648
115032
  case 24:
114649
115033
  _meshesToProcess2 = batchMeshes.slice(batchStart, batchStart + batchSize);
114650
- _primitivesToProcess2 = batchPrimitives.slice(batchStart, batchStart + batchSize);
115034
+ _primitiveGroupsToProcess2 = batchPrimitiveGroups.slice(batchStart, batchStart + batchSize);
114651
115035
  batchStart += batchSize;
114652
- _context3.n = 25;
114653
- return processStreamBatch(_meshesToProcess2, _primitivesToProcess2);
115036
+ _context4.n = 25;
115037
+ return processStreamBatch(_meshesToProcess2, _primitiveGroupsToProcess2);
114654
115038
  case 25:
114655
- _context3.n = 22;
115039
+ _context4.n = 22;
114656
115040
  break;
114657
115041
  case 26:
114658
115042
  if (batchStart >= batchSize * 4) {
114659
115043
  batchMeshes.splice(0, batchStart);
114660
- batchPrimitives.splice(0, batchStart);
115044
+ batchPrimitiveGroups.splice(0, batchStart);
114661
115045
  batchStart = 0;
114662
115046
  }
114663
- _context3.n = 2;
115047
+ _context4.n = 2;
114664
115048
  break;
114665
115049
  case 27:
114666
- _context3.p = 27;
114667
- _context3.p = 28;
114668
- _context3.n = 29;
115050
+ _context4.p = 27;
115051
+ _context4.p = 28;
115052
+ _context4.n = 29;
114669
115053
  return this.workerRequest('streamDispose', {
114670
115054
  streamId: localStreamId
114671
115055
  });
114672
115056
  case 29:
114673
- _context3.n = 31;
115057
+ _context4.n = 31;
114674
115058
  break;
114675
115059
  case 30:
114676
- _context3.p = 30;
114677
- _t2 = _context3.v;
115060
+ _context4.p = 30;
115061
+ _t2 = _context4.v;
114678
115062
  case 31:
114679
- return _context3.f(27);
115063
+ return _context4.f(27);
114680
115064
  case 32:
114681
- return _context3.a(2, streamStats);
115065
+ return _context4.a(2, streamStats);
114682
115066
  case 33:
114683
115067
  decoder = new TextDecoder('utf-8');
114684
115068
  buffer = new Uint8Array();
114685
- pendingPrimitives = new Map();
114686
- expectingPrimitive = true;
115069
+ expectingMesh = true;
115070
+ pendingMesh = null;
115071
+ pendingPrimitiveIds = new Set();
115072
+ pendingPrimitiveGroups = [];
115073
+ pendingMatchedPrimitiveIds = new Set();
114687
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
+ }();
114688
115220
  case 34:
114689
115221
  if (false) {}
114690
- _context3.n = 35;
115222
+ _context4.n = 35;
114691
115223
  return ensureNotAborted();
114692
115224
  case 35:
114693
- _context3.n = 36;
115225
+ _context4.n = 36;
114694
115226
  return this.ensureNotInteracting(abortSignal);
114695
115227
  case 36:
114696
115228
  _content2 = void 0;
114697
- _context3.p = 37;
114698
- _context3.n = 38;
115229
+ _context4.p = 37;
115230
+ _context4.n = 38;
114699
115231
  return reader.read();
114700
115232
  case 38:
114701
- _content2 = _context3.v;
114702
- _context3.n = 41;
115233
+ _content2 = _context4.v;
115234
+ _context4.n = 41;
114703
115235
  break;
114704
115236
  case 39:
114705
- _context3.p = 39;
114706
- _t3 = _context3.v;
115237
+ _context4.p = 39;
115238
+ _t3 = _context4.v;
114707
115239
  if (!(_t3 && _t3.name === 'AbortError')) {
114708
- _context3.n = 40;
115240
+ _context4.n = 40;
114709
115241
  break;
114710
115242
  }
114711
115243
  throw _t3;
@@ -114714,178 +115246,125 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114714
115246
  case 41:
114715
115247
  _content3 = _content2, _done = _content3.done, _value = _content3.value;
114716
115248
  if (!_done) {
114717
- _context3.n = 46;
115249
+ _context4.n = 47;
114718
115250
  break;
114719
115251
  }
114720
- _context3.n = 42;
115252
+ _context4.n = 42;
114721
115253
  return ensureNotAborted();
114722
115254
  case 42:
115255
+ _context4.n = 43;
115256
+ return commitPendingMesh();
115257
+ case 43:
114723
115258
  if (!(batchMeshes.length > 0)) {
114724
- _context3.n = 45;
115259
+ _context4.n = 46;
114725
115260
  break;
114726
115261
  }
114727
- _context3.n = 43;
115262
+ _context4.n = 44;
114728
115263
  return ensureNotAborted();
114729
- case 43:
114730
- _context3.n = 44;
114731
- return this.ensureNotInteracting(abortSignal);
114732
115264
  case 44:
114733
- _context3.n = 45;
114734
- return processStreamBatch(batchMeshes, batchPrimitives);
115265
+ _context4.n = 45;
115266
+ return this.ensureNotInteracting(abortSignal);
114735
115267
  case 45:
114736
- return _context3.a(3, 65);
115268
+ _context4.n = 46;
115269
+ return processStreamBatch(batchMeshes, batchPrimitiveGroups);
114737
115270
  case 46:
115271
+ return _context4.a(3, 63);
115272
+ case 47:
114738
115273
  newBuf = new Uint8Array(buffer.length + _value.length);
114739
115274
  newBuf.set(buffer);
114740
115275
  newBuf.set(_value, buffer.length);
114741
115276
  buffer = newBuf;
114742
- case 47:
115277
+ case 48:
114743
115278
  if (!(buffer.length > 0)) {
114744
- _context3.n = 64;
115279
+ _context4.n = 62;
114745
115280
  break;
114746
115281
  }
114747
- _context3.n = 48;
115282
+ _context4.n = 49;
114748
115283
  return ensureNotAborted();
114749
- case 48:
114750
- if (!expectingPrimitive) {
114751
- _context3.n = 52;
115284
+ case 49:
115285
+ if (!expectingMesh) {
115286
+ _context4.n = 53;
114752
115287
  break;
114753
115288
  }
114754
- if (!(buffer.length < 12)) {
114755
- _context3.n = 49;
115289
+ meshResult = tryParseMeshFromBuffer();
115290
+ if (!(meshResult.status === 'incomplete')) {
115291
+ _context4.n = 50;
114756
115292
  break;
114757
115293
  }
114758
- return _context3.a(3, 64);
114759
- case 49:
114760
- _context3.p = 49;
114761
- dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
114762
- primitiveResult = this.parsePrimitive(dataView, buffer, 0, isFullProps);
114763
- primitiveData = primitiveResult.primitive;
114764
- this._applyPrefixId(primitiveData, 'id');
114765
- this._applyPrefixId(primitiveData, 'material');
114766
- consumedBytes = primitiveResult.offset;
114767
- if (isFullProps) {
114768
- _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;
114769
- formatted = this.formatPrimitiveData({
114770
- position: position,
114771
- normal: normal,
114772
- posindex: posindex,
114773
- nolindex: nolindex
114774
- });
114775
- delete primitiveData.nolindex;
114776
- delete primitiveData.posindex;
114777
- primitiveData.position = formatted.position;
114778
- primitiveData.normal = formatted.normal;
114779
- primitiveData.indices = indices;
114780
- }
114781
- docId = primitiveData.id;
114782
- pendingPrimitives.set(docId, primitiveData);
114783
- expectingPrimitive = false;
114784
- buffer = buffer.slice(consumedBytes);
114785
- _context3.n = 51;
114786
- break;
115294
+ return _context4.a(3, 62);
114787
115295
  case 50:
114788
- _context3.p = 50;
114789
- _t4 = _context3.v;
114790
- return _context3.a(3, 64);
114791
- case 51:
114792
- _context3.n = 63;
114793
- break;
114794
- case 52:
114795
- if (!(buffer.length < 4)) {
114796
- _context3.n = 53;
115296
+ if (!(meshResult.status === 'invalid')) {
115297
+ _context4.n = 51;
114797
115298
  break;
114798
115299
  }
114799
- 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;
114800
115313
  case 53:
114801
- length = new DataView(buffer.buffer, buffer.byteOffset).getUint32(0, false);
114802
- if (!(length > 10 * 1024 * 1024)) {
114803
- _context3.n = 54;
115314
+ nextMeshResult = tryParseMeshFromBuffer();
115315
+ if (!(nextMeshResult.status === 'success')) {
115316
+ _context4.n = 55;
114804
115317
  break;
114805
115318
  }
114806
- expectingPrimitive = true;
114807
- return _context3.a(3, 47);
115319
+ _context4.n = 54;
115320
+ return commitPendingMesh();
114808
115321
  case 54:
114809
- totalLen = 4 + length;
114810
- if (!(buffer.length < totalLen)) {
114811
- _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;
114812
115330
  break;
114813
115331
  }
114814
- return _context3.a(3, 64);
114815
- case 55:
114816
- data = buffer.slice(4, totalLen);
114817
- mesh = null;
114818
- _context3.p = 56;
114819
- jsonStr = decoder.decode(data);
114820
- mesh = JSON.parse(jsonStr);
114821
- _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;
114822
115338
  break;
114823
- case 57:
114824
- _context3.p = 57;
114825
- _t5 = _context3.v;
114826
- expectingPrimitive = true;
114827
- return _context3.a(3, 47);
114828
115339
  case 58:
114829
- if (!mesh) {
114830
- _context3.n = 63;
114831
- break;
114832
- }
114833
- isFullProps = true;
114834
- this._applyPrefixId(mesh, 'id');
114835
- if (Array.isArray(mesh)) {
114836
- mesh.forEach(function (item) {
114837
- _this4._applyPrefixId(item.primitives, 'prmid', item.documentId);
114838
- });
114839
- } else {
114840
- this._applyPrefixId(mesh.primitives, 'prmid', mesh.documentId);
114841
- }
114842
- _docId = mesh.id;
114843
- meshToPrimId = mesh.primitives.map(function (item) {
114844
- return item.prmid;
114845
- });
114846
- hasPendingPrimitive = meshToPrimId.some(function (item) {
114847
- return pendingPrimitives.has(item);
114848
- });
114849
- hasPendingMesh = pendingPrimitives.has(_docId);
114850
- if (!(hasPendingMesh || hasPendingPrimitive)) {
114851
- _context3.n = 62;
114852
- break;
114853
- }
114854
- _primitiveData = pendingPrimitives.get(_docId);
114855
- if (!hasPendingMesh && hasPendingPrimitive) {
114856
- primId = meshToPrimId[0];
114857
- _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);
114858
115348
  }
114859
- batchMeshes.push(mesh);
114860
- batchPrimitives.push(_primitiveData);
114861
- if (!(batchMeshes.length >= this.batchSize)) {
114862
- _context3.n = 62;
115349
+ buffer = buffer.slice(primitiveResult.consumedBytes);
115350
+ if (!(pendingPrimitiveIds.size > 0 && pendingMatchedPrimitiveIds.size >= pendingPrimitiveIds.size)) {
115351
+ _context4.n = 61;
114863
115352
  break;
114864
115353
  }
114865
- _context3.n = 59;
114866
- return ensureNotAborted();
114867
- case 59:
114868
- _context3.n = 60;
114869
- return this.ensureNotInteracting(abortSignal);
115354
+ _context4.n = 60;
115355
+ return commitPendingMesh();
114870
115356
  case 60:
114871
- _context3.n = 61;
114872
- return processStreamBatch(batchMeshes, batchPrimitives);
115357
+ expectingMesh = true;
114873
115358
  case 61:
114874
- batchMeshes.length = 0;
114875
- batchPrimitives.length = 0;
114876
- case 62:
114877
- expectingPrimitive = false;
114878
- buffer = buffer.slice(totalLen);
114879
- case 63:
114880
- _context3.n = 47;
115359
+ _context4.n = 48;
114881
115360
  break;
114882
- case 64:
114883
- _context3.n = 34;
115361
+ case 62:
115362
+ _context4.n = 34;
114884
115363
  break;
114885
- case 65:
114886
- return _context3.a(2, streamStats);
115364
+ case 63:
115365
+ return _context4.a(2, streamStats);
114887
115366
  }
114888
- }, _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]]);
114889
115368
  }));
114890
115369
  function parseStreamImmediate(_x, _x2, _x3) {
114891
115370
  return _parseStreamImmediate.apply(this, arguments);
@@ -114897,57 +115376,57 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114897
115376
  }, {
114898
115377
  key: "processBatchData",
114899
115378
  value: function () {
114900
- 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) {
114901
115380
  var abortSignal,
114902
115381
  renderResult,
114903
- _args4 = arguments,
114904
- _t6;
114905
- return StreamLoader_regenerator().w(function (_context4) {
114906
- 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) {
114907
115386
  case 0:
114908
- abortSignal = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : null;
114909
- _context4.p = 1;
115387
+ abortSignal = _args5.length > 4 && _args5[4] !== undefined ? _args5[4] : null;
115388
+ _context5.p = 1;
114910
115389
  if (!(abortSignal && abortSignal.aborted)) {
114911
- _context4.n = 2;
115390
+ _context5.n = 2;
114912
115391
  break;
114913
115392
  }
114914
115393
  throw new DOMException('Request was aborted', 'AbortError');
114915
115394
  case 2:
114916
- _context4.n = 3;
115395
+ _context5.n = 3;
114917
115396
  return this.renderModelData(meshes, primitives, list, range, null, undefined, {
114918
115397
  suppressLoadComplete: true,
114919
115398
  source: 'inRangeDis2'
114920
115399
  });
114921
115400
  case 3:
114922
- renderResult = _context4.v;
115401
+ renderResult = _context5.v;
114923
115402
  if (!(renderResult && renderResult.canceled)) {
114924
- _context4.n = 4;
115403
+ _context5.n = 4;
114925
115404
  break;
114926
115405
  }
114927
115406
  throw new DOMException('Batch loading was canceled', 'AbortError');
114928
115407
  case 4:
114929
115408
  if (!(abortSignal && abortSignal.aborted)) {
114930
- _context4.n = 5;
115409
+ _context5.n = 5;
114931
115410
  break;
114932
115411
  }
114933
115412
  throw new DOMException('Request was aborted', 'AbortError');
114934
115413
  case 5:
114935
- return _context4.a(2, renderResult);
115414
+ return _context5.a(2, renderResult);
114936
115415
  case 6:
114937
- _context4.p = 6;
114938
- _t6 = _context4.v;
114939
- if (!(_t6 && _t6.name === 'AbortError')) {
114940
- _context4.n = 7;
115416
+ _context5.p = 6;
115417
+ _t5 = _context5.v;
115418
+ if (!(_t5 && _t5.name === 'AbortError')) {
115419
+ _context5.n = 7;
114941
115420
  break;
114942
115421
  }
114943
- throw _t6;
115422
+ throw _t5;
114944
115423
  case 7:
114945
- console.error('Failed to render batch data:', _t6);
114946
- throw _t6;
115424
+ console.error('Failed to render batch data:', _t5);
115425
+ throw _t5;
114947
115426
  case 8:
114948
- return _context4.a(2);
115427
+ return _context5.a(2);
114949
115428
  }
114950
- }, _callee4, this, [[1, 6]]);
115429
+ }, _callee5, this, [[1, 6]]);
114951
115430
  }));
114952
115431
  function processBatchData(_x6, _x7, _x8, _x9) {
114953
115432
  return _processBatchData.apply(this, arguments);
@@ -114959,26 +115438,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114959
115438
  }, {
114960
115439
  key: "getPrimitivesByRangeStream",
114961
115440
  value: function () {
114962
- 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) {
114963
115442
  var abortSignal,
114964
115443
  requestId,
114965
115444
  internalController,
114966
115445
  reader,
114967
115446
  res,
114968
115447
  streamStats,
114969
- _args5 = arguments,
114970
- _t7;
114971
- return StreamLoader_regenerator().w(function (_context5) {
114972
- 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) {
114973
115452
  case 0:
114974
- abortSignal = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : null;
114975
- _context5.n = 1;
115453
+ abortSignal = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : null;
115454
+ _context6.n = 1;
114976
115455
  return this.abortAllStreamRequests();
114977
115456
  case 1:
114978
115457
  requestId = this.createStreamRequestId();
114979
115458
  internalController = null;
114980
115459
  reader = null;
114981
- _context5.p = 2;
115460
+ _context6.p = 2;
114982
115461
  internalController = new AbortController();
114983
115462
  this.currentAbortController = internalController;
114984
115463
  this.activeStreamControllers.add(internalController);
@@ -114995,7 +115474,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
114995
115474
  }
114996
115475
  }
114997
115476
  if (!internalController.signal.aborted) {
114998
- _context5.n = 3;
115477
+ _context6.n = 3;
114999
115478
  break;
115000
115479
  }
115001
115480
  throw new DOMException('Request was aborted', 'AbortError');
@@ -115003,14 +115482,14 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115003
115482
  params.requestId = requestId;
115004
115483
  params.projectId = this.projectId;
115005
115484
  if (!(this.modelApi && typeof this.modelApi.getPrimitivesByRangeStream === 'function')) {
115006
- _context5.n = 5;
115485
+ _context6.n = 5;
115007
115486
  break;
115008
115487
  }
115009
- _context5.n = 4;
115488
+ _context6.n = 4;
115010
115489
  return this.modelApi.getPrimitivesByRangeStream(params, internalController.signal);
115011
115490
  case 4:
115012
- res = _context5.v;
115013
- _context5.n = 6;
115491
+ res = _context6.v;
115492
+ _context6.n = 6;
115014
115493
  break;
115015
115494
  case 5:
115016
115495
  throw new Error('modelApi.getPrimitivesByRangeStream is not available');
@@ -115018,49 +115497,49 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115018
115497
  reader = res.getReader();
115019
115498
  this.currentStreamReader = reader;
115020
115499
  this.activeStreamReaders.add(reader);
115021
- _context5.n = 7;
115500
+ _context6.n = 7;
115022
115501
  return this.parseStreamImmediate(reader, list, range, internalController.signal, requestId);
115023
115502
  case 7:
115024
- streamStats = _context5.v;
115503
+ streamStats = _context6.v;
115025
115504
  if (!internalController.signal.aborted) {
115026
- _context5.n = 8;
115505
+ _context6.n = 8;
115027
115506
  break;
115028
115507
  }
115029
115508
  throw new DOMException('Request was aborted', 'AbortError');
115030
115509
  case 8:
115031
115510
  if (!res) {
115032
- _context5.n = 9;
115511
+ _context6.n = 9;
115033
115512
  break;
115034
115513
  }
115035
- return _context5.a(2, StreamLoader_objectSpread({
115514
+ return _context6.a(2, StreamLoader_objectSpread({
115036
115515
  stream: res,
115037
115516
  requestId: requestId
115038
115517
  }, streamStats || {}));
115039
115518
  case 9:
115040
- return _context5.a(2, null);
115519
+ return _context6.a(2, null);
115041
115520
  case 10:
115042
- _context5.p = 10;
115043
- _t7 = _context5.v;
115044
- if (!(_t7.name === 'AbortError')) {
115045
- _context5.n = 11;
115521
+ _context6.p = 10;
115522
+ _t6 = _context6.v;
115523
+ if (!(_t6.name === 'AbortError')) {
115524
+ _context6.n = 11;
115046
115525
  break;
115047
115526
  }
115048
- throw _t7;
115527
+ throw _t6;
115049
115528
  case 11:
115050
- console.error(_t7);
115051
- throw _t7;
115529
+ console.error(_t6);
115530
+ throw _t6;
115052
115531
  case 12:
115053
- _context5.p = 12;
115532
+ _context6.p = 12;
115054
115533
  if (reader) this.activeStreamReaders.delete(reader);
115055
115534
  if (internalController) this.activeStreamControllers.delete(internalController);
115056
115535
  if (requestId) this.activeRequestIds.delete(requestId);
115057
115536
  this.currentStreamReader = null;
115058
115537
  this.currentAbortController = null;
115059
- return _context5.f(12);
115538
+ return _context6.f(12);
115060
115539
  case 13:
115061
- return _context5.a(2);
115540
+ return _context6.a(2);
115062
115541
  }
115063
- }, _callee5, this, [[2, 10, 12, 13]]);
115542
+ }, _callee6, this, [[2, 10, 12, 13]]);
115064
115543
  }));
115065
115544
  function getPrimitivesByRangeStream(_x0, _x1, _x10) {
115066
115545
  return _getPrimitivesByRangeStream.apply(this, arguments);
@@ -115070,56 +115549,56 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115070
115549
  }, {
115071
115550
  key: "getPrimitivesByRange",
115072
115551
  value: function () {
115073
- var _getPrimitivesByRange = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee6(params) {
115552
+ var _getPrimitivesByRange = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee7(params) {
115074
115553
  var abortSignal,
115075
115554
  res,
115076
- _args6 = arguments,
115077
- _t8;
115078
- return StreamLoader_regenerator().w(function (_context6) {
115079
- 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) {
115080
115559
  case 0:
115081
- abortSignal = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;
115082
- _context6.p = 1;
115560
+ abortSignal = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : null;
115561
+ _context7.p = 1;
115083
115562
  if (!(abortSignal && abortSignal.aborted)) {
115084
- _context6.n = 2;
115563
+ _context7.n = 2;
115085
115564
  break;
115086
115565
  }
115087
115566
  throw new DOMException('Request was aborted', 'AbortError');
115088
115567
  case 2:
115089
- _context6.n = 3;
115568
+ _context7.n = 3;
115090
115569
  return this.modelApi.getPrimitivesByRange(params, abortSignal);
115091
115570
  case 3:
115092
- res = _context6.v;
115571
+ res = _context7.v;
115093
115572
  if (!(abortSignal && abortSignal.aborted)) {
115094
- _context6.n = 4;
115573
+ _context7.n = 4;
115095
115574
  break;
115096
115575
  }
115097
115576
  throw new DOMException('Request was aborted', 'AbortError');
115098
115577
  case 4:
115099
115578
  if (!res) {
115100
- _context6.n = 5;
115579
+ _context7.n = 5;
115101
115580
  break;
115102
115581
  }
115103
- return _context6.a(2, res);
115582
+ return _context7.a(2, res);
115104
115583
  case 5:
115105
115584
  throw new Error('Failed to get primitives');
115106
115585
  case 6:
115107
- _context6.n = 9;
115586
+ _context7.n = 9;
115108
115587
  break;
115109
115588
  case 7:
115110
- _context6.p = 7;
115111
- _t8 = _context6.v;
115112
- if (!(_t8.name === 'AbortError')) {
115113
- _context6.n = 8;
115589
+ _context7.p = 7;
115590
+ _t7 = _context7.v;
115591
+ if (!(_t7.name === 'AbortError')) {
115592
+ _context7.n = 8;
115114
115593
  break;
115115
115594
  }
115116
- throw _t8;
115595
+ throw _t7;
115117
115596
  case 8:
115118
- throw _t8;
115597
+ throw _t7;
115119
115598
  case 9:
115120
- return _context6.a(2);
115599
+ return _context7.a(2);
115121
115600
  }
115122
- }, _callee6, this, [[1, 7]]);
115601
+ }, _callee7, this, [[1, 7]]);
115123
115602
  }));
115124
115603
  function getPrimitivesByRange(_x11) {
115125
115604
  return _getPrimitivesByRange.apply(this, arguments);
@@ -115129,31 +115608,31 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115129
115608
  }, {
115130
115609
  key: "getPrimitivesByMaterial",
115131
115610
  value: function () {
115132
- var _getPrimitivesByMaterial = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee7(params) {
115133
- var res, _t9;
115134
- return StreamLoader_regenerator().w(function (_context7) {
115135
- 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) {
115136
115615
  case 0:
115137
- _context7.p = 0;
115138
- _context7.n = 1;
115616
+ _context8.p = 0;
115617
+ _context8.n = 1;
115139
115618
  return this.modelApi.getPrimitivesByMaterial(params);
115140
115619
  case 1:
115141
- res = _context7.v;
115620
+ res = _context8.v;
115142
115621
  if (!res) {
115143
- _context7.n = 2;
115622
+ _context8.n = 2;
115144
115623
  break;
115145
115624
  }
115146
- return _context7.a(2, res);
115625
+ return _context8.a(2, res);
115147
115626
  case 2:
115148
115627
  throw new Error('Failed to get Material');
115149
115628
  case 3:
115150
- _context7.p = 3;
115151
- _t9 = _context7.v;
115152
- throw _t9;
115629
+ _context8.p = 3;
115630
+ _t8 = _context8.v;
115631
+ throw _t8;
115153
115632
  case 4:
115154
- return _context7.a(2);
115633
+ return _context8.a(2);
115155
115634
  }
115156
- }, _callee7, this, [[0, 3]]);
115635
+ }, _callee8, this, [[0, 3]]);
115157
115636
  }));
115158
115637
  function getPrimitivesByMaterial(_x12) {
115159
115638
  return _getPrimitivesByMaterial.apply(this, arguments);
@@ -115163,29 +115642,29 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115163
115642
  }, {
115164
115643
  key: "getPrimitivesByMergeMaterial",
115165
115644
  value: function () {
115166
- var _getPrimitivesByMergeMaterial = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee8(params) {
115167
- var res, _t0;
115168
- return StreamLoader_regenerator().w(function (_context8) {
115169
- 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) {
115170
115649
  case 0:
115171
- _context8.p = 0;
115650
+ _context9.p = 0;
115172
115651
  if (!(!this.modelApi || typeof this.modelApi.getPrimitivesByMergeMaterial !== 'function')) {
115173
- _context8.n = 1;
115652
+ _context9.n = 1;
115174
115653
  break;
115175
115654
  }
115176
- return _context8.a(2, null);
115655
+ return _context9.a(2, null);
115177
115656
  case 1:
115178
- _context8.n = 2;
115657
+ _context9.n = 2;
115179
115658
  return this.modelApi.getPrimitivesByMergeMaterial(params);
115180
115659
  case 2:
115181
- res = _context8.v;
115182
- return _context8.a(2, res || null);
115660
+ res = _context9.v;
115661
+ return _context9.a(2, res || null);
115183
115662
  case 3:
115184
- _context8.p = 3;
115185
- _t0 = _context8.v;
115186
- return _context8.a(2, null);
115663
+ _context9.p = 3;
115664
+ _t9 = _context9.v;
115665
+ return _context9.a(2, null);
115187
115666
  }
115188
- }, _callee8, this, [[0, 3]]);
115667
+ }, _callee9, this, [[0, 3]]);
115189
115668
  }));
115190
115669
  function getPrimitivesByMergeMaterial(_x13) {
115191
115670
  return _getPrimitivesByMergeMaterial.apply(this, arguments);
@@ -115223,36 +115702,36 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115223
115702
  }, {
115224
115703
  key: "abortAllStreamRequests",
115225
115704
  value: function () {
115226
- var _abortAllStreamRequests = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee9() {
115227
- var requestIds, _i2, _requestIds, requestId, readers, _i3, _readers, reader, _t1, _t10, _t11;
115228
- return StreamLoader_regenerator().w(function (_context9) {
115229
- 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) {
115230
115709
  case 0:
115231
- _context9.p = 0;
115710
+ _context0.p = 0;
115232
115711
  requestIds = Array.from(this.activeRequestIds);
115233
115712
  _i2 = 0, _requestIds = requestIds;
115234
115713
  case 1:
115235
115714
  if (!(_i2 < _requestIds.length)) {
115236
- _context9.n = 6;
115715
+ _context0.n = 6;
115237
115716
  break;
115238
115717
  }
115239
115718
  requestId = _requestIds[_i2];
115240
115719
  if (!(typeof this.onCancelRequestId === 'function')) {
115241
- _context9.n = 5;
115720
+ _context0.n = 5;
115242
115721
  break;
115243
115722
  }
115244
- _context9.p = 2;
115245
- _context9.n = 3;
115723
+ _context0.p = 2;
115724
+ _context0.n = 3;
115246
115725
  return this.onCancelRequestId(requestId);
115247
115726
  case 3:
115248
- _context9.n = 5;
115727
+ _context0.n = 5;
115249
115728
  break;
115250
115729
  case 4:
115251
- _context9.p = 4;
115252
- _t1 = _context9.v;
115730
+ _context0.p = 4;
115731
+ _t0 = _context0.v;
115253
115732
  case 5:
115254
115733
  _i2++;
115255
- _context9.n = 1;
115734
+ _context0.n = 1;
115256
115735
  break;
115257
115736
  case 6:
115258
115737
  this.activeRequestIds.clear();
@@ -115267,25 +115746,25 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115267
115746
  _i3 = 0, _readers = readers;
115268
115747
  case 7:
115269
115748
  if (!(_i3 < _readers.length)) {
115270
- _context9.n = 12;
115749
+ _context0.n = 12;
115271
115750
  break;
115272
115751
  }
115273
115752
  reader = _readers[_i3];
115274
- _context9.p = 8;
115275
- _context9.n = 9;
115753
+ _context0.p = 8;
115754
+ _context0.n = 9;
115276
115755
  return reader.cancel();
115277
115756
  case 9:
115278
- _context9.n = 11;
115757
+ _context0.n = 11;
115279
115758
  break;
115280
115759
  case 10:
115281
- _context9.p = 10;
115282
- _t10 = _context9.v;
115760
+ _context0.p = 10;
115761
+ _t1 = _context0.v;
115283
115762
  case 11:
115284
115763
  _i3++;
115285
- _context9.n = 7;
115764
+ _context0.n = 7;
115286
115765
  break;
115287
115766
  case 12:
115288
- _context9.p = 12;
115767
+ _context0.p = 12;
115289
115768
  if (this.currentAbortController) {
115290
115769
  try {
115291
115770
  this.currentAbortController.abort();
@@ -115293,26 +115772,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115293
115772
  this.currentAbortController = null;
115294
115773
  }
115295
115774
  if (!this.currentStreamReader) {
115296
- _context9.n = 17;
115775
+ _context0.n = 17;
115297
115776
  break;
115298
115777
  }
115299
- _context9.p = 13;
115300
- _context9.n = 14;
115778
+ _context0.p = 13;
115779
+ _context0.n = 14;
115301
115780
  return this.currentStreamReader.cancel();
115302
115781
  case 14:
115303
- _context9.n = 16;
115782
+ _context0.n = 16;
115304
115783
  break;
115305
115784
  case 15:
115306
- _context9.p = 15;
115307
- _t11 = _context9.v;
115785
+ _context0.p = 15;
115786
+ _t10 = _context0.v;
115308
115787
  case 16:
115309
115788
  this.currentStreamReader = null;
115310
115789
  case 17:
115311
- return _context9.f(12);
115790
+ return _context0.f(12);
115312
115791
  case 18:
115313
- return _context9.a(2);
115792
+ return _context0.a(2);
115314
115793
  }
115315
- }, _callee9, this, [[13, 15], [8, 10], [2, 4], [0,, 12, 18]]);
115794
+ }, _callee0, this, [[13, 15], [8, 10], [2, 4], [0,, 12, 18]]);
115316
115795
  }));
115317
115796
  function abortAllStreamRequests() {
115318
115797
  return _abortAllStreamRequests.apply(this, arguments);
@@ -115324,52 +115803,52 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115324
115803
  }, {
115325
115804
  key: "fetchPrimitiveBufferByStream",
115326
115805
  value: function () {
115327
- 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) {
115328
115807
  var abortSignal,
115329
115808
  requestId,
115330
115809
  request,
115331
115810
  streamResult,
115332
- _args0 = arguments,
115333
- _t12;
115334
- return StreamLoader_regenerator().w(function (_context0) {
115335
- 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) {
115336
115815
  case 0:
115337
- abortSignal = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : null;
115338
- requestId = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : null;
115339
- _context0.p = 1;
115340
- _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;
115341
115820
  return this.abortAllStreamRequests();
115342
115821
  case 2:
115343
115822
  request = this.createAbortableRequest(requestId); // Use requestId if provided as key? Logic slightly different in utils
115344
115823
  // Adaptation: utils used getPrimitivesByRangeStreamWithAutoAbort which calls getPrimitivesByRangeStream
115345
115824
  // Here I simplify by calling getPrimitivesByRangeStream directly but managing request key
115346
- _context0.n = 3;
115825
+ _context1.n = 3;
115347
115826
  return this.getPrimitivesByRangeStream(range, list, range, abortSignal || request.signal);
115348
115827
  case 3:
115349
- streamResult = _context0.v;
115828
+ streamResult = _context1.v;
115350
115829
  this.cleanupRequest(request.requestId);
115351
115830
  if (streamResult) {
115352
- _context0.n = 4;
115831
+ _context1.n = 4;
115353
115832
  break;
115354
115833
  }
115355
- return _context0.a(2, null);
115834
+ return _context1.a(2, null);
115356
115835
  case 4:
115357
- return _context0.a(2, streamResult);
115836
+ return _context1.a(2, streamResult);
115358
115837
  case 5:
115359
- _context0.p = 5;
115360
- _t12 = _context0.v;
115361
- if (_t12.name === 'AbortError') {
115838
+ _context1.p = 5;
115839
+ _t11 = _context1.v;
115840
+ if (_t11.name === 'AbortError') {
115362
115841
  // throw error;
115363
115842
  }
115364
115843
  if (!(requestId && this.currentRequestId !== requestId)) {
115365
- _context0.n = 6;
115844
+ _context1.n = 6;
115366
115845
  break;
115367
115846
  }
115368
- return _context0.a(2, null);
115847
+ return _context1.a(2, null);
115369
115848
  case 6:
115370
- return _context0.a(2);
115849
+ return _context1.a(2);
115371
115850
  }
115372
- }, _callee0, this, [[1, 5]]);
115851
+ }, _callee1, this, [[1, 5]]);
115373
115852
  }));
115374
115853
  function fetchPrimitiveBufferByStream(_x14, _x15) {
115375
115854
  return _fetchPrimitiveBufferByStream.apply(this, arguments);
@@ -115379,58 +115858,58 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115379
115858
  }, {
115380
115859
  key: "fetchPrimitiveBuffer",
115381
115860
  value: function () {
115382
- var _fetchPrimitiveBuffer = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee1(range) {
115861
+ var _fetchPrimitiveBuffer = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee10(range) {
115383
115862
  var abortSignal,
115384
115863
  requestId,
115385
115864
  request,
115386
- buffer,
115387
- _args1 = arguments,
115388
- _t13;
115389
- return StreamLoader_regenerator().w(function (_context1) {
115390
- 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) {
115391
115870
  case 0:
115392
- abortSignal = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : null;
115393
- requestId = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
115394
- _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;
115395
115874
  request = this.createAbortableRequest(requestId || 'default');
115396
- _context1.n = 2;
115875
+ _context10.n = 2;
115397
115876
  return this.getPrimitivesByRange(range, abortSignal || request.signal);
115398
115877
  case 2:
115399
- buffer = _context1.v;
115878
+ _buffer = _context10.v;
115400
115879
  this.cleanupRequest(request.requestId);
115401
- if (!(!buffer || buffer.byteLength === 0)) {
115402
- _context1.n = 3;
115880
+ if (!(!_buffer || _buffer.byteLength === 0)) {
115881
+ _context10.n = 3;
115403
115882
  break;
115404
115883
  }
115405
- return _context1.a(2, null);
115884
+ return _context10.a(2, null);
115406
115885
  case 3:
115407
- if (!(buffer.byteLength < 4)) {
115408
- _context1.n = 4;
115886
+ if (!(_buffer.byteLength < 4)) {
115887
+ _context10.n = 4;
115409
115888
  break;
115410
115889
  }
115411
- return _context1.a(2, null);
115890
+ return _context10.a(2, null);
115412
115891
  case 4:
115413
- return _context1.a(2, buffer);
115892
+ return _context10.a(2, _buffer);
115414
115893
  case 5:
115415
- _context1.p = 5;
115416
- _t13 = _context1.v;
115417
- if (!(_t13.name === 'AbortError')) {
115418
- _context1.n = 6;
115894
+ _context10.p = 5;
115895
+ _t12 = _context10.v;
115896
+ if (!(_t12.name === 'AbortError')) {
115897
+ _context10.n = 6;
115419
115898
  break;
115420
115899
  }
115421
- throw _t13;
115900
+ throw _t12;
115422
115901
  case 6:
115423
115902
  if (!(requestId && this.currentRequestId !== requestId)) {
115424
- _context1.n = 7;
115903
+ _context10.n = 7;
115425
115904
  break;
115426
115905
  }
115427
- return _context1.a(2, null);
115906
+ return _context10.a(2, null);
115428
115907
  case 7:
115429
- throw _t13;
115908
+ throw _t12;
115430
115909
  case 8:
115431
- return _context1.a(2);
115910
+ return _context10.a(2);
115432
115911
  }
115433
- }, _callee1, this, [[1, 5]]);
115912
+ }, _callee10, this, [[1, 5]]);
115434
115913
  }));
115435
115914
  function fetchPrimitiveBuffer(_x16) {
115436
115915
  return _fetchPrimitiveBuffer.apply(this, arguments);
@@ -115440,13 +115919,13 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115440
115919
  }, {
115441
115920
  key: "parseBufferData",
115442
115921
  value: function () {
115443
- var _parseBufferData = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee10(buffer) {
115922
+ var _parseBufferData = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee11(buffer) {
115444
115923
  var transferable;
115445
- return StreamLoader_regenerator().w(function (_context10) {
115446
- while (1) switch (_context10.n) {
115924
+ return StreamLoader_regenerator().w(function (_context11) {
115925
+ while (1) switch (_context11.n) {
115447
115926
  case 0:
115448
115927
  if (!this.worker) {
115449
- _context10.n = 1;
115928
+ _context11.n = 1;
115450
115929
  break;
115451
115930
  }
115452
115931
  transferable = [];
@@ -115455,16 +115934,16 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115455
115934
  } else if (buffer.buffer instanceof ArrayBuffer) {
115456
115935
  transferable.push(buffer.buffer);
115457
115936
  }
115458
- return _context10.a(2, this.workerRequest('parseBufferData', {
115937
+ return _context11.a(2, this.workerRequest('parseBufferData', {
115459
115938
  buffer: buffer,
115460
115939
  prefixIdKey: this.prefixIdKey
115461
115940
  }, transferable));
115462
115941
  case 1:
115463
- return _context10.a(2, this._parseBufferDataSync(buffer));
115942
+ return _context11.a(2, this._parseBufferDataSync(buffer));
115464
115943
  case 2:
115465
- return _context10.a(2);
115944
+ return _context11.a(2);
115466
115945
  }
115467
- }, _callee10, this);
115946
+ }, _callee11, this);
115468
115947
  }));
115469
115948
  function parseBufferData(_x17) {
115470
115949
  return _parseBufferData.apply(this, arguments);
@@ -115474,17 +115953,17 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115474
115953
  }, {
115475
115954
  key: "_parseBufferDataSync",
115476
115955
  value: function () {
115477
- var _parseBufferDataSync2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee11(buffer) {
115956
+ var _parseBufferDataSync2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee12(buffer) {
115478
115957
  var _this6 = this;
115479
- var uint8Array, dataView, meshJsonBytes, primitives, offset, meshJsonLength, decoder, meshJsonStr, mesh, result, i, primitive, _this$parsePrimitiveD2, position, normal, posindex, nolindex, indices, formatted, _t14, _t15, _t16;
115480
- return StreamLoader_regenerator().w(function (_context11) {
115481
- 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) {
115482
115961
  case 0:
115483
115962
  uint8Array = null;
115484
115963
  dataView = null;
115485
115964
  meshJsonBytes = null;
115486
115965
  primitives = [];
115487
- _context11.p = 1;
115966
+ _context12.p = 1;
115488
115967
  uint8Array = new Uint8Array(buffer);
115489
115968
  dataView = new DataView(buffer);
115490
115969
  offset = 0;
@@ -115492,10 +115971,10 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115492
115971
  offset += 4;
115493
115972
  meshJsonBytes = new Uint8Array(uint8Array.buffer.slice(offset, offset + meshJsonLength));
115494
115973
  offset += meshJsonLength;
115495
- decoder = new TextDecoder('utf-8');
115496
- meshJsonStr = decoder.decode(meshJsonBytes);
115974
+ _decoder = new TextDecoder('utf-8');
115975
+ meshJsonStr = _decoder.decode(meshJsonBytes);
115497
115976
  meshJsonBytes = null;
115498
- _context11.p = 2;
115977
+ _context12.p = 2;
115499
115978
  mesh = JSON.parse(meshJsonStr);
115500
115979
  this._applyPrefixId(mesh, 'id');
115501
115980
  if (Array.isArray(mesh)) {
@@ -115505,45 +115984,45 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115505
115984
  } else {
115506
115985
  this._applyPrefixId(mesh.primitives, 'prmid', mesh.documentId);
115507
115986
  }
115508
- _context11.n = 4;
115987
+ _context12.n = 4;
115509
115988
  break;
115510
115989
  case 3:
115511
- _context11.p = 3;
115512
- _t14 = _context11.v;
115513
- console.error('JSON 解析失败:', _t14, meshJsonStr);
115990
+ _context12.p = 3;
115991
+ _t13 = _context12.v;
115992
+ console.error('JSON 解析失败:', _t13, meshJsonStr);
115514
115993
  throw new Error('JSON解析失败');
115515
115994
  case 4:
115516
115995
  if (!(offset < uint8Array.length)) {
115517
- _context11.n = 9;
115996
+ _context12.n = 9;
115518
115997
  break;
115519
115998
  }
115520
- _context11.p = 5;
115999
+ _context12.p = 5;
115521
116000
  result = this.parsePrimitive(dataView, uint8Array, offset);
115522
116001
  console.log('result', result);
115523
116002
  if (result) {
115524
- _context11.n = 6;
116003
+ _context12.n = 6;
115525
116004
  break;
115526
116005
  }
115527
- return _context11.a(3, 9);
116006
+ return _context12.a(3, 9);
115528
116007
  case 6:
115529
116008
  primitives.push(result.primitive);
115530
116009
  offset = result.offset;
115531
- _context11.n = 8;
116010
+ _context12.n = 8;
115532
116011
  break;
115533
116012
  case 7:
115534
- _context11.p = 7;
115535
- _t15 = _context11.v;
115536
- console.error('解析失败,偏移:', offset, _t15);
115537
- return _context11.a(3, 9);
116013
+ _context12.p = 7;
116014
+ _t14 = _context12.v;
116015
+ console.error('解析失败,偏移:', offset, _t14);
116016
+ return _context12.a(3, 9);
115538
116017
  case 8:
115539
- _context11.n = 4;
116018
+ _context12.n = 4;
115540
116019
  break;
115541
116020
  case 9:
115542
116021
  for (i = 0; i < primitives.length; i++) {
115543
116022
  primitive = primitives[i];
115544
116023
  this._applyPrefixId(primitive, 'id');
115545
116024
  this._applyPrefixId(primitive, 'material');
115546
- _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;
115547
116026
  formatted = this.formatPrimitiveData({
115548
116027
  position: position,
115549
116028
  normal: normal,
@@ -115556,24 +116035,24 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115556
116035
  primitive.normal = formatted.normal;
115557
116036
  primitive.indices = indices;
115558
116037
  }
115559
- return _context11.a(2, {
116038
+ return _context12.a(2, {
115560
116039
  mesh: mesh,
115561
116040
  primitives: primitives
115562
116041
  });
115563
116042
  case 10:
115564
- _context11.p = 10;
115565
- _t16 = _context11.v;
115566
- throw _t16;
116043
+ _context12.p = 10;
116044
+ _t15 = _context12.v;
116045
+ throw _t15;
115567
116046
  case 11:
115568
- _context11.p = 11;
116047
+ _context12.p = 11;
115569
116048
  uint8Array = null;
115570
116049
  dataView = null;
115571
116050
  meshJsonBytes = null;
115572
- return _context11.f(11);
116051
+ return _context12.f(11);
115573
116052
  case 12:
115574
- return _context11.a(2);
116053
+ return _context12.a(2);
115575
116054
  }
115576
- }, _callee11, this, [[5, 7], [2, 3], [1, 10, 11, 12]]);
116055
+ }, _callee12, this, [[5, 7], [2, 3], [1, 10, 11, 12]]);
115577
116056
  }));
115578
116057
  function _parseBufferDataSync(_x18) {
115579
116058
  return _parseBufferDataSync2.apply(this, arguments);
@@ -115583,7 +116062,7 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115583
116062
  }, {
115584
116063
  key: "fetchJsonSync",
115585
116064
  value: function () {
115586
- 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) {
115587
116066
  var abortSignal,
115588
116067
  requestId,
115589
116068
  buffer,
@@ -115592,65 +116071,65 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115592
116071
  _yield$this$parseBuff,
115593
116072
  mesh,
115594
116073
  parsed,
115595
- _args12 = arguments,
115596
- _t17;
115597
- return StreamLoader_regenerator().w(function (_context12) {
115598
- 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) {
115599
116078
  case 0:
115600
- abortSignal = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : null;
115601
- 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;
115602
116081
  buffer = null;
115603
116082
  primitives = [];
115604
- _context12.p = 1;
116083
+ _context13.p = 1;
115605
116084
  loadStartTime = Date.now();
115606
- _context12.n = 2;
116085
+ _context13.n = 2;
115607
116086
  return this.fetchPrimitiveBuffer(range, abortSignal, requestId);
115608
116087
  case 2:
115609
- buffer = _context12.v;
116088
+ buffer = _context13.v;
115610
116089
  if (buffer) {
115611
- _context12.n = 3;
116090
+ _context13.n = 3;
115612
116091
  break;
115613
116092
  }
115614
- return _context12.a(2, {
116093
+ return _context13.a(2, {
115615
116094
  primitives: []
115616
116095
  });
115617
116096
  case 3:
115618
- _context12.n = 4;
116097
+ _context13.n = 4;
115619
116098
  return this.parseBufferData(buffer);
115620
116099
  case 4:
115621
- _yield$this$parseBuff = _context12.v;
116100
+ _yield$this$parseBuff = _context13.v;
115622
116101
  mesh = _yield$this$parseBuff.mesh;
115623
116102
  parsed = _yield$this$parseBuff.primitives;
115624
116103
  primitives = parsed;
115625
116104
  if (!(typeof this.renderModelData === 'function')) {
115626
- _context12.n = 5;
116105
+ _context13.n = 5;
115627
116106
  break;
115628
116107
  }
115629
- _context12.n = 5;
116108
+ _context13.n = 5;
115630
116109
  return this.renderModelData(mesh, primitives, list, range);
115631
116110
  case 5:
115632
- return _context12.a(2, {
116111
+ return _context13.a(2, {
115633
116112
  primitives: primitives,
115634
116113
  mesh: mesh
115635
116114
  });
115636
116115
  case 6:
115637
- _context12.p = 6;
115638
- _t17 = _context12.v;
115639
- if (!(_t17.name === 'AbortError')) {
115640
- _context12.n = 7;
116116
+ _context13.p = 6;
116117
+ _t16 = _context13.v;
116118
+ if (!(_t16.name === 'AbortError')) {
116119
+ _context13.n = 7;
115641
116120
  break;
115642
116121
  }
115643
- throw _t17;
116122
+ throw _t16;
115644
116123
  case 7:
115645
116124
  if (!(requestId && this.currentRequestId !== requestId)) {
115646
- _context12.n = 8;
116125
+ _context13.n = 8;
115647
116126
  break;
115648
116127
  }
115649
- return _context12.a(2);
116128
+ return _context13.a(2);
115650
116129
  case 8:
115651
- throw _t17;
116130
+ throw _t16;
115652
116131
  case 9:
115653
- _context12.p = 9;
116132
+ _context13.p = 9;
115654
116133
  try {
115655
116134
  buffer = null;
115656
116135
  primitives = null;
@@ -115660,11 +116139,11 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115660
116139
  } catch (cleanupErr) {
115661
116140
  console.warn('内存清理时发生错误:', cleanupErr);
115662
116141
  }
115663
- return _context12.f(9);
116142
+ return _context13.f(9);
115664
116143
  case 10:
115665
- return _context12.a(2);
116144
+ return _context13.a(2);
115666
116145
  }
115667
- }, _callee12, this, [[1, 6, 9, 10]]);
116146
+ }, _callee13, this, [[1, 6, 9, 10]]);
115668
116147
  }));
115669
116148
  function fetchJsonSync(_x19, _x20) {
115670
116149
  return _fetchJsonSync.apply(this, arguments);
@@ -115674,47 +116153,47 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115674
116153
  }, {
115675
116154
  key: "fetchJsonStream",
115676
116155
  value: function () {
115677
- 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) {
115678
116157
  var abortSignal,
115679
116158
  requestId,
115680
116159
  loadStartTime,
115681
116160
  streamResult,
115682
- _args13 = arguments,
115683
- _t18;
115684
- return StreamLoader_regenerator().w(function (_context13) {
115685
- 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) {
115686
116165
  case 0:
115687
- abortSignal = _args13.length > 2 && _args13[2] !== undefined ? _args13[2] : null;
115688
- requestId = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : null;
115689
- _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;
115690
116169
  loadStartTime = Date.now();
115691
- _context13.n = 2;
116170
+ _context14.n = 2;
115692
116171
  return this.fetchPrimitiveBufferByStream(range, list, abortSignal, requestId);
115693
116172
  case 2:
115694
- streamResult = _context13.v;
115695
- return _context13.a(2, StreamLoader_objectSpread(StreamLoader_objectSpread({}, streamResult || {}), {}, {
116173
+ streamResult = _context14.v;
116174
+ return _context14.a(2, StreamLoader_objectSpread(StreamLoader_objectSpread({}, streamResult || {}), {}, {
115696
116175
  duration: Date.now() - loadStartTime
115697
116176
  }));
115698
116177
  case 3:
115699
- _context13.p = 3;
115700
- _t18 = _context13.v;
115701
- if (!(_t18.name === 'AbortError')) {
115702
- _context13.n = 4;
116178
+ _context14.p = 3;
116179
+ _t17 = _context14.v;
116180
+ if (!(_t17.name === 'AbortError')) {
116181
+ _context14.n = 4;
115703
116182
  break;
115704
116183
  }
115705
- throw _t18;
116184
+ throw _t17;
115706
116185
  case 4:
115707
116186
  if (!(requestId && this.currentRequestId !== requestId)) {
115708
- _context13.n = 5;
116187
+ _context14.n = 5;
115709
116188
  break;
115710
116189
  }
115711
- return _context13.a(2);
116190
+ return _context14.a(2);
115712
116191
  case 5:
115713
- throw _t18;
116192
+ throw _t17;
115714
116193
  case 6:
115715
- return _context13.a(2);
116194
+ return _context14.a(2);
115716
116195
  }
115717
- }, _callee13, this, [[1, 3]]);
116196
+ }, _callee14, this, [[1, 3]]);
115718
116197
  }));
115719
116198
  function fetchJsonStream(_x21, _x22) {
115720
116199
  return _fetchJsonStream.apply(this, arguments);
@@ -115802,8 +116281,20 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115802
116281
  if (dataView.byteLength < offset + 12) {
115803
116282
  throw new Error('Insufficient data for primitive header');
115804
116283
  }
115805
- primitive.id = dataView.getInt32(offset, false);
116284
+ var primitiveIdTextLen = dataView.getUint32(offset, false);
115806
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
+ }
115807
116298
  if (dataView.byteLength < offset + 4) {
115808
116299
  throw new Error('Insufficient data for GeomText length');
115809
116300
  }
@@ -115815,14 +116306,29 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115815
116306
  if (dataView.byteLength < offset + documentTextLen) {
115816
116307
  throw new Error('Insufficient data for GeomText content');
115817
116308
  }
115818
- var textBytes = uint8Array.subarray(offset, offset + documentTextLen);
115819
- 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);
115820
116311
  offset += documentTextLen;
115821
116312
  } else {
115822
116313
  primitive.documentId = '';
115823
116314
  }
115824
- 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);
115825
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
+ }
115826
116332
  if (dataView.byteLength < offset + 4) {
115827
116333
  throw new Error('Insufficient data for GeomText length');
115828
116334
  }
@@ -115834,8 +116340,8 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115834
116340
  if (dataView.byteLength < offset + geomTextLen) {
115835
116341
  throw new Error('Insufficient data for GeomText content');
115836
116342
  }
115837
- var _textBytes = uint8Array.subarray(offset, offset + geomTextLen);
115838
- 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);
115839
116345
  offset += geomTextLen;
115840
116346
  } else {
115841
116347
  primitive.geomText = '';
@@ -115915,8 +116421,8 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115915
116421
  primitive.dataType = null;
115916
116422
  } else if (dataTypeLen > 0) {
115917
116423
  if (dataView.byteLength < offset + dataTypeLen) throw new Error('Insufficient data for DataType content');
115918
- var _textBytes2 = uint8Array.subarray(offset, offset + dataTypeLen);
115919
- 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);
115920
116426
  offset += dataTypeLen;
115921
116427
  } else {
115922
116428
  primitive.dataType = '';
@@ -115967,43 +116473,43 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
115967
116473
  }, {
115968
116474
  key: "ensureNotInteracting",
115969
116475
  value: function () {
115970
- var _ensureNotInteracting = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee14(abortSignal) {
116476
+ var _ensureNotInteracting = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee15(abortSignal) {
115971
116477
  var _this7 = this;
115972
- return StreamLoader_regenerator().w(function (_context14) {
115973
- while (1) switch (_context14.n) {
116478
+ return StreamLoader_regenerator().w(function (_context15) {
116479
+ while (1) switch (_context15.n) {
115974
116480
  case 0:
115975
116481
  if (!(abortSignal && abortSignal.aborted)) {
115976
- _context14.n = 1;
116482
+ _context15.n = 1;
115977
116483
  break;
115978
116484
  }
115979
- return _context14.a(2);
116485
+ return _context15.a(2);
115980
116486
  case 1:
115981
116487
  if (!this.externalEnsureNotInteracting) {
115982
- _context14.n = 3;
116488
+ _context15.n = 3;
115983
116489
  break;
115984
116490
  }
115985
- _context14.n = 2;
116491
+ _context15.n = 2;
115986
116492
  return this.externalEnsureNotInteracting(abortSignal);
115987
116493
  case 2:
115988
- return _context14.a(2);
116494
+ return _context15.a(2);
115989
116495
  case 3:
115990
116496
  if (this.isUserInteracting) {
115991
- _context14.n = 4;
116497
+ _context15.n = 4;
115992
116498
  break;
115993
116499
  }
115994
- return _context14.a(2);
116500
+ return _context15.a(2);
115995
116501
  case 4:
115996
116502
  if (!this.parsePausePromise) {
115997
116503
  this.parsePausePromise = new Promise(function (resolve) {
115998
116504
  _this7.parsePauseResolver = resolve;
115999
116505
  });
116000
116506
  }
116001
- _context14.n = 5;
116507
+ _context15.n = 5;
116002
116508
  return this.parsePausePromise;
116003
116509
  case 5:
116004
- return _context14.a(2);
116510
+ return _context15.a(2);
116005
116511
  }
116006
- }, _callee14, this);
116512
+ }, _callee15, this);
116007
116513
  }));
116008
116514
  function ensureNotInteracting(_x23) {
116009
116515
  return _ensureNotInteracting.apply(this, arguments);
@@ -116028,10 +116534,10 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116028
116534
  }, {
116029
116535
  key: "handleControlEnd",
116030
116536
  value: function () {
116031
- var _handleControlEnd = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee15() {
116537
+ var _handleControlEnd = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee16() {
116032
116538
  var pressDuration;
116033
- return StreamLoader_regenerator().w(function (_context15) {
116034
- while (1) switch (_context15.n) {
116539
+ return StreamLoader_regenerator().w(function (_context16) {
116540
+ while (1) switch (_context16.n) {
116035
116541
  case 0:
116036
116542
  pressDuration = Date.now() - (this.controlPressStartAt || 0);
116037
116543
  if (pressDuration >= this.longPressAbortThresholdMs) {
@@ -116043,9 +116549,9 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116043
116549
  this.isUserInteracting = false;
116044
116550
  this.resumeParsing();
116045
116551
  case 1:
116046
- return _context15.a(2);
116552
+ return _context16.a(2);
116047
116553
  }
116048
- }, _callee15, this);
116554
+ }, _callee16, this);
116049
116555
  }));
116050
116556
  function handleControlEnd() {
116051
116557
  return _handleControlEnd.apply(this, arguments);
@@ -116055,18 +116561,18 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116055
116561
  }, {
116056
116562
  key: "handleWheelStart",
116057
116563
  value: function () {
116058
- var _handleWheelStart = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee16() {
116059
- return StreamLoader_regenerator().w(function (_context16) {
116060
- 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) {
116061
116567
  case 0:
116062
116568
  try {
116063
116569
  // await this.abortAllStreamRequests();
116064
116570
  } catch (_) {}
116065
116571
  this.isUserInteracting = true;
116066
116572
  case 1:
116067
- return _context16.a(2);
116573
+ return _context17.a(2);
116068
116574
  }
116069
- }, _callee16, this);
116575
+ }, _callee17, this);
116070
116576
  }));
116071
116577
  function handleWheelStart() {
116072
116578
  return _handleWheelStart.apply(this, arguments);
@@ -116086,18 +116592,18 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116086
116592
  }, {
116087
116593
  key: "batchLoadRegions",
116088
116594
  value: function () {
116089
- var _batchLoadRegions = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee17(item, divideData) {
116090
- var priorityRegions, level0Regions, level1Regions, level2Regions, level3Regions, level4Regions, i, regionData, range, _t19, _t20;
116091
- return StreamLoader_regenerator().w(function (_context17) {
116092
- 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) {
116093
116599
  case 0:
116094
116600
  if (!(!divideData || divideData.length === 0)) {
116095
- _context17.n = 1;
116601
+ _context18.n = 1;
116096
116602
  break;
116097
116603
  }
116098
- return _context17.a(2);
116604
+ return _context18.a(2);
116099
116605
  case 1:
116100
- _context17.p = 1;
116606
+ _context18.p = 1;
116101
116607
  priorityRegions = [];
116102
116608
  level0Regions = divideData.filter(function (region) {
116103
116609
  return region.lodLevel && region.lodLevel.includes(0);
@@ -116116,15 +116622,15 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116116
116622
  });
116117
116623
  priorityRegions.push.apply(priorityRegions, StreamLoader_toConsumableArray(level0Regions).concat(StreamLoader_toConsumableArray(level1Regions), StreamLoader_toConsumableArray(level2Regions), StreamLoader_toConsumableArray(level3Regions), StreamLoader_toConsumableArray(level4Regions)));
116118
116624
  if (!(priorityRegions.length === 0)) {
116119
- _context17.n = 2;
116625
+ _context18.n = 2;
116120
116626
  break;
116121
116627
  }
116122
- return _context17.a(2);
116628
+ return _context18.a(2);
116123
116629
  case 2:
116124
116630
  i = 0;
116125
116631
  case 3:
116126
116632
  if (!(i < priorityRegions.length && i < 1)) {
116127
- _context17.n = 8;
116633
+ _context18.n = 8;
116128
116634
  break;
116129
116635
  }
116130
116636
  regionData = priorityRegions[i];
@@ -116132,30 +116638,30 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116132
116638
  regionIndex: regionData.index,
116133
116639
  documentId: item.id
116134
116640
  };
116135
- _context17.p = 4;
116136
- _context17.n = 5;
116641
+ _context18.p = 4;
116642
+ _context18.n = 5;
116137
116643
  return this.fetchJsonSync(item, range);
116138
116644
  case 5:
116139
- _context17.n = 7;
116645
+ _context18.n = 7;
116140
116646
  break;
116141
116647
  case 6:
116142
- _context17.p = 6;
116143
- _t19 = _context17.v;
116648
+ _context18.p = 6;
116649
+ _t18 = _context18.v;
116144
116650
  case 7:
116145
116651
  i++;
116146
- _context17.n = 3;
116652
+ _context18.n = 3;
116147
116653
  break;
116148
116654
  case 8:
116149
- _context17.n = 10;
116655
+ _context18.n = 10;
116150
116656
  break;
116151
116657
  case 9:
116152
- _context17.p = 9;
116153
- _t20 = _context17.v;
116154
- throw _t20;
116658
+ _context18.p = 9;
116659
+ _t19 = _context18.v;
116660
+ throw _t19;
116155
116661
  case 10:
116156
- return _context17.a(2);
116662
+ return _context18.a(2);
116157
116663
  }
116158
- }, _callee17, this, [[4, 6], [1, 9]]);
116664
+ }, _callee18, this, [[4, 6], [1, 9]]);
116159
116665
  }));
116160
116666
  function batchLoadRegions(_x24, _x25) {
116161
116667
  return _batchLoadRegions.apply(this, arguments);
@@ -116165,59 +116671,59 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116165
116671
  }, {
116166
116672
  key: "loadModelByIds",
116167
116673
  value: function () {
116168
- var _loadModelByIds = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee18(options) {
116169
- var params, onComplete, buffer, primitives, _params$immediateUpda, loadStartTime, _ref3, ids, documentIdToIds, _yield$this$parseBuff2, mesh, parsed, _t21;
116170
- return StreamLoader_regenerator().w(function (_context18) {
116171
- 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) {
116172
116678
  case 0:
116173
116679
  params = options.params, onComplete = options.onComplete;
116174
116680
  buffer = null;
116175
116681
  primitives = [];
116176
- _context18.p = 1;
116682
+ _context19.p = 1;
116177
116683
  loadStartTime = Date.now(); // 构建 documentIdToIds 映射 多个documentid->modelid
116178
- _ref3 = options.params || {}, ids = _ref3.ids;
116684
+ _ref4 = options.params || {}, ids = _ref4.ids;
116179
116685
  documentIdToIds = this.parseModelDocumentMappings(ids);
116180
116686
  delete params.ids;
116181
116687
  params.documentIdToIds = documentIdToIds;
116182
116688
  params.projectId = this.projectId;
116183
- _context18.n = 2;
116689
+ _context19.n = 2;
116184
116690
  return this.getPrimitivesByRangeDetail(params);
116185
116691
  case 2:
116186
- buffer = _context18.v;
116692
+ buffer = _context19.v;
116187
116693
  if (buffer) {
116188
- _context18.n = 3;
116694
+ _context19.n = 3;
116189
116695
  break;
116190
116696
  }
116191
- return _context18.a(2, {
116697
+ return _context19.a(2, {
116192
116698
  primitives: []
116193
116699
  });
116194
116700
  case 3:
116195
- _context18.n = 4;
116701
+ _context19.n = 4;
116196
116702
  return this.parseBufferData(buffer);
116197
116703
  case 4:
116198
- _yield$this$parseBuff2 = _context18.v;
116704
+ _yield$this$parseBuff2 = _context19.v;
116199
116705
  mesh = _yield$this$parseBuff2.mesh;
116200
116706
  parsed = _yield$this$parseBuff2.primitives;
116201
116707
  primitives = parsed;
116202
- _context18.n = 5;
116708
+ _context19.n = 5;
116203
116709
  return this.renderModelData(mesh, primitives, params.folderInfo, null, onComplete, (_params$immediateUpda = params.immediateUpdate) !== null && _params$immediateUpda !== void 0 ? _params$immediateUpda : true);
116204
116710
  case 5:
116205
- return _context18.a(2, {
116711
+ return _context19.a(2, {
116206
116712
  primitives: primitives,
116207
116713
  mesh: mesh
116208
116714
  });
116209
116715
  case 6:
116210
- _context18.p = 6;
116211
- _t21 = _context18.v;
116212
- if (!(_t21.name === 'AbortError')) {
116213
- _context18.n = 7;
116716
+ _context19.p = 6;
116717
+ _t20 = _context19.v;
116718
+ if (!(_t20.name === 'AbortError')) {
116719
+ _context19.n = 7;
116214
116720
  break;
116215
116721
  }
116216
- throw _t21;
116722
+ throw _t20;
116217
116723
  case 7:
116218
- throw _t21;
116724
+ throw _t20;
116219
116725
  case 8:
116220
- _context18.p = 8;
116726
+ _context19.p = 8;
116221
116727
  try {
116222
116728
  buffer = null;
116223
116729
  if (primitives && primitives.length > 0) {
@@ -116236,11 +116742,11 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116236
116742
  window.gc();
116237
116743
  }
116238
116744
  } catch (cleanupErr) {}
116239
- return _context18.f(8);
116745
+ return _context19.f(8);
116240
116746
  case 9:
116241
- return _context18.a(2);
116747
+ return _context19.a(2);
116242
116748
  }
116243
- }, _callee18, this, [[1, 6, 8, 9]]);
116749
+ }, _callee19, this, [[1, 6, 8, 9]]);
116244
116750
  }));
116245
116751
  function loadModelByIds(_x26) {
116246
116752
  return _loadModelByIds.apply(this, arguments);
@@ -116252,26 +116758,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116252
116758
  }, {
116253
116759
  key: "getPrimitivesByDivide",
116254
116760
  value: function () {
116255
- var _getPrimitivesByDivide = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee19(params) {
116761
+ var _getPrimitivesByDivide = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee20(params) {
116256
116762
  var res;
116257
- return StreamLoader_regenerator().w(function (_context19) {
116258
- while (1) switch (_context19.n) {
116763
+ return StreamLoader_regenerator().w(function (_context20) {
116764
+ while (1) switch (_context20.n) {
116259
116765
  case 0:
116260
- _context19.n = 1;
116766
+ _context20.n = 1;
116261
116767
  return this.modelApi.getPrimitivesByDivide(params);
116262
116768
  case 1:
116263
- res = _context19.v;
116769
+ res = _context20.v;
116264
116770
  if (!res) {
116265
- _context19.n = 2;
116771
+ _context20.n = 2;
116266
116772
  break;
116267
116773
  }
116268
- return _context19.a(2, res);
116774
+ return _context20.a(2, res);
116269
116775
  case 2:
116270
116776
  throw new Error('Failed to get primitives');
116271
116777
  case 3:
116272
- return _context19.a(2);
116778
+ return _context20.a(2);
116273
116779
  }
116274
- }, _callee19, this);
116780
+ }, _callee20, this);
116275
116781
  }));
116276
116782
  function getPrimitivesByDivide(_x27) {
116277
116783
  return _getPrimitivesByDivide.apply(this, arguments);
@@ -116281,26 +116787,26 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116281
116787
  }, {
116282
116788
  key: "getPrimitivesByRangeDetail",
116283
116789
  value: function () {
116284
- var _getPrimitivesByRangeDetail = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee20(params) {
116790
+ var _getPrimitivesByRangeDetail = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee21(params) {
116285
116791
  var res;
116286
- return StreamLoader_regenerator().w(function (_context20) {
116287
- while (1) switch (_context20.n) {
116792
+ return StreamLoader_regenerator().w(function (_context21) {
116793
+ while (1) switch (_context21.n) {
116288
116794
  case 0:
116289
- _context20.n = 1;
116795
+ _context21.n = 1;
116290
116796
  return this.modelApi.getPrimitivesByRangeDetail(params);
116291
116797
  case 1:
116292
- res = _context20.v;
116798
+ res = _context21.v;
116293
116799
  if (!res) {
116294
- _context20.n = 2;
116800
+ _context21.n = 2;
116295
116801
  break;
116296
116802
  }
116297
- return _context20.a(2, res);
116803
+ return _context21.a(2, res);
116298
116804
  case 2:
116299
116805
  throw new Error('Failed to get batch model');
116300
116806
  case 3:
116301
- return _context20.a(2);
116807
+ return _context21.a(2);
116302
116808
  }
116303
- }, _callee20, this);
116809
+ }, _callee21, this);
116304
116810
  }));
116305
116811
  function getPrimitivesByRangeDetail(_x28) {
116306
116812
  return _getPrimitivesByRangeDetail.apply(this, arguments);
@@ -116312,31 +116818,31 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116312
116818
  }, {
116313
116819
  key: "getSceneBox",
116314
116820
  value: function () {
116315
- var _getSceneBox = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee21(_ref4) {
116316
- var id, _ref4$projectId, projectId, res;
116317
- return StreamLoader_regenerator().w(function (_context21) {
116318
- 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) {
116319
116825
  case 0:
116320
- id = _ref4.id, _ref4$projectId = _ref4.projectId, projectId = _ref4$projectId === void 0 ? this.projectId : _ref4$projectId;
116321
- _context21.n = 1;
116826
+ id = _ref5.id, _ref5$projectId = _ref5.projectId, projectId = _ref5$projectId === void 0 ? this.projectId : _ref5$projectId;
116827
+ _context22.n = 1;
116322
116828
  return this.modelApi.getSceneBox({
116323
116829
  id: id,
116324
116830
  projectId: projectId
116325
116831
  });
116326
116832
  case 1:
116327
- res = _context21.v;
116833
+ res = _context22.v;
116328
116834
  if (!(res && res[0])) {
116329
- _context21.n = 2;
116835
+ _context22.n = 2;
116330
116836
  break;
116331
116837
  }
116332
116838
  this.sceneBox = res[0];
116333
- return _context21.a(2, res[0]);
116839
+ return _context22.a(2, res[0]);
116334
116840
  case 2:
116335
- return _context21.a(2, null);
116841
+ return _context22.a(2, null);
116336
116842
  case 3:
116337
- return _context21.a(2);
116843
+ return _context22.a(2);
116338
116844
  }
116339
- }, _callee21, this);
116845
+ }, _callee22, this);
116340
116846
  }));
116341
116847
  function getSceneBox(_x29) {
116342
116848
  return _getSceneBox.apply(this, arguments);
@@ -116346,43 +116852,43 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116346
116852
  }, {
116347
116853
  key: "getBox",
116348
116854
  value: function () {
116349
- var _getBox = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee22(_ref5) {
116350
- var id, _ref5$projectId, projectId, cached, res;
116351
- return StreamLoader_regenerator().w(function (_context22) {
116352
- 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) {
116353
116859
  case 0:
116354
- id = _ref5.id, _ref5$projectId = _ref5.projectId, projectId = _ref5$projectId === void 0 ? this.projectId || 0 : _ref5$projectId;
116355
- _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;
116356
116862
  return this._getFromDB(id, projectId);
116357
116863
  case 1:
116358
- cached = _context22.v;
116359
- if (!cached) {
116360
- _context22.n = 2;
116864
+ cached = _context23.v;
116865
+ if (!(cached && !isDebug)) {
116866
+ _context23.n = 2;
116361
116867
  break;
116362
116868
  }
116363
- return _context22.a(2, cached);
116869
+ return _context23.a(2, cached);
116364
116870
  case 2:
116365
- _context22.n = 3;
116871
+ _context23.n = 3;
116366
116872
  return this.modelApi.getBox({
116367
116873
  id: id,
116368
116874
  projectId: projectId
116369
116875
  });
116370
116876
  case 3:
116371
- res = _context22.v;
116877
+ res = _context23.v;
116372
116878
  if (!res) {
116373
- _context22.n = 4;
116879
+ _context23.n = 4;
116374
116880
  break;
116375
116881
  }
116376
116882
  // 3. 存入 IndexedDB (存储原始数据)
116377
116883
  this._applyPrefixId(res, 'id', id);
116378
116884
  this._saveToDB(id, res, projectId);
116379
- return _context22.a(2, res);
116885
+ return _context23.a(2, res);
116380
116886
  case 4:
116381
- return _context22.a(2, null);
116887
+ return _context23.a(2, null);
116382
116888
  case 5:
116383
- return _context22.a(2);
116889
+ return _context23.a(2);
116384
116890
  }
116385
- }, _callee22, this);
116891
+ }, _callee23, this);
116386
116892
  }));
116387
116893
  function getBox(_x30) {
116388
116894
  return _getBox.apply(this, arguments);
@@ -116392,11 +116898,11 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116392
116898
  }, {
116393
116899
  key: "handleCameraControlForStream",
116394
116900
  value: function () {
116395
- var _handleCameraControlForStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee23(args) {
116901
+ var _handleCameraControlForStream = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee24(args) {
116396
116902
  var _this8 = this;
116397
- var chainRequest, loadedModels, documentIdToIds, activeItems, primaryItem, requestId, range, streamResult, _t22;
116398
- return StreamLoader_regenerator().w(function (_context23) {
116399
- 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) {
116400
116906
  case 0:
116401
116907
  // 性能优化注释:禁用 range 被注释字段的解构声明与初始化
116402
116908
  chainRequest = args.chainRequest, loadedModels = args.loadedModels; // 构建 documentIdToIds 映射 多个documentid->modelid
@@ -116420,10 +116926,10 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116420
116926
  }
116421
116927
  });
116422
116928
  if (!(activeItems.length === 0)) {
116423
- _context23.n = 1;
116929
+ _context24.n = 1;
116424
116930
  break;
116425
116931
  }
116426
- return _context23.a(2);
116932
+ return _context24.a(2);
116427
116933
  case 1:
116428
116934
  primaryItem = activeItems[0]; // 使用第一个item作为主上下文
116429
116935
  requestId = Date.now() + '_' + Math.random().toString(36).substr(2, 9);
@@ -116472,20 +116978,20 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116472
116978
  // range.minZ = Math.max(range.minZ, boxToUse.min_z);
116473
116979
  // range.maxZ = Math.min(range.maxZ, boxToUse.max_z);
116474
116980
  // }
116475
- _context23.p = 2;
116476
- _context23.n = 3;
116981
+ _context24.p = 2;
116982
+ _context24.n = 3;
116477
116983
  return this.fetchJsonStream(primaryItem, range, this.currentAbortController.signal, requestId);
116478
116984
  case 3:
116479
- streamResult = _context23.v;
116985
+ streamResult = _context24.v;
116480
116986
  if (!(this.currentRequestId === requestId)) {
116481
- _context23.n = 5;
116987
+ _context24.n = 5;
116482
116988
  break;
116483
116989
  }
116484
116990
  if (!(typeof this.onRangeStreamComplete === 'function')) {
116485
- _context23.n = 4;
116991
+ _context24.n = 4;
116486
116992
  break;
116487
116993
  }
116488
- _context23.n = 4;
116994
+ _context24.n = 4;
116489
116995
  return this.onRangeStreamComplete(StreamLoader_objectSpread({
116490
116996
  source: 'inRangeDis2',
116491
116997
  requestId: requestId,
@@ -116495,28 +117001,28 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116495
117001
  case 4:
116496
117002
  this.currentAbortController = null;
116497
117003
  this.currentRequestId = null;
116498
- _context23.n = 5;
117004
+ _context24.n = 5;
116499
117005
  break;
116500
117006
  case 5:
116501
- _context23.n = 8;
117007
+ _context24.n = 8;
116502
117008
  break;
116503
117009
  case 6:
116504
- _context23.p = 6;
116505
- _t22 = _context23.v;
116506
- if (!(_t22.name === 'AbortError')) {
116507
- _context23.n = 7;
117010
+ _context24.p = 6;
117011
+ _t21 = _context24.v;
117012
+ if (!(_t21.name === 'AbortError')) {
117013
+ _context24.n = 7;
116508
117014
  break;
116509
117015
  }
116510
- return _context23.a(2);
117016
+ return _context24.a(2);
116511
117017
  case 7:
116512
117018
  if (this.currentRequestId === requestId) {
116513
117019
  this.currentAbortController = null;
116514
117020
  this.currentRequestId = null;
116515
117021
  }
116516
117022
  case 8:
116517
- return _context23.a(2);
117023
+ return _context24.a(2);
116518
117024
  }
116519
- }, _callee23, this, [[2, 6]]);
117025
+ }, _callee24, this, [[2, 6]]);
116520
117026
  }));
116521
117027
  function handleCameraControlForStream(_x31) {
116522
117028
  return _handleCameraControlForStream.apply(this, arguments);
@@ -116575,60 +117081,61 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116575
117081
  }, {
116576
117082
  key: "processModelItem",
116577
117083
  value: function () {
116578
- var _processModelItem = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee24(item) {
117084
+ var _processModelItem = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee25(item) {
116579
117085
  var options,
116580
117086
  materialData,
116581
117087
  mergeMaterialData,
116582
117088
  sceneBox,
116583
117089
  boxIndex,
116584
117090
  modelResourceMapObj,
116585
- _args24 = arguments,
116586
- _t23;
116587
- return StreamLoader_regenerator().w(function (_context24) {
116588
- 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) {
116589
117095
  case 0:
116590
- options = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {};
116591
- _context24.p = 1;
117096
+ options = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {};
117097
+ _context25.p = 1;
116592
117098
  if (typeof item.id !== 'string') {
116593
117099
  item.id = '' + item.id;
116594
117100
  }
116595
117101
 
116596
117102
  // 获取材质数据
116597
- _context24.n = 2;
117103
+ _context25.n = 2;
116598
117104
  return this.getPrimitivesByMaterial({
116599
117105
  id: item.id,
116600
117106
  projectId: this.projectId
116601
117107
  });
116602
117108
  case 2:
116603
- materialData = _context24.v;
116604
- _context24.n = 3;
117109
+ materialData = _context25.v;
117110
+ _context25.n = 3;
116605
117111
  return this.getPrimitivesByMergeMaterial({
116606
117112
  id: item.id,
116607
117113
  projectId: this.projectId
116608
117114
  });
116609
117115
  case 3:
116610
- mergeMaterialData = _context24.v;
117116
+ mergeMaterialData = _context25.v;
116611
117117
  this._applyPrefixId(mergeMaterialData, 'id');
116612
117118
  this._applyPrefixId(materialData, 'id');
116613
117119
 
116614
117120
  // 获取场景包围盒
116615
- _context24.n = 4;
117121
+ _context25.n = 4;
116616
117122
  return this.getSceneBox({
116617
117123
  id: item.id,
116618
117124
  projectId: this.projectId
116619
117125
  });
116620
117126
  case 4:
116621
- sceneBox = _context24.v;
117127
+ sceneBox = _context25.v;
116622
117128
  this.sceneBox = sceneBox;
116623
117129
 
116624
117130
  // 获取BoxIndex
116625
- _context24.n = 5;
117131
+ _context25.n = 5;
116626
117132
  return this.getBox({
116627
117133
  id: item.id,
116628
- projectId: this.projectId
117134
+ projectId: this.projectId,
117135
+ isDebug: this.debug
116629
117136
  });
116630
117137
  case 5:
116631
- boxIndex = _context24.v;
117138
+ boxIndex = _context25.v;
116632
117139
  this.boxIndex = boxIndex;
116633
117140
 
116634
117141
  // 将 mergeMaterialData 覆盖到 materialData(按 id 覆盖 color/transp)
@@ -116640,18 +117147,18 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116640
117147
  }; // 设置当前模型到注册表
116641
117148
  this.updateModelRegistry(item, materialData, mergeMaterialData, sceneBox, boxIndex);
116642
117149
  console.log('modelRegistry', this.modelRegistry);
116643
- return _context24.a(2, {
117150
+ return _context25.a(2, {
116644
117151
  modelResourceMap: modelResourceMapObj,
116645
117152
  sceneBox: sceneBox,
116646
117153
  boxIndex: boxIndex,
116647
117154
  item: item
116648
117155
  });
116649
117156
  case 6:
116650
- _context24.p = 6;
116651
- _t23 = _context24.v;
116652
- return _context24.a(2, null);
117157
+ _context25.p = 6;
117158
+ _t22 = _context25.v;
117159
+ return _context25.a(2, null);
116653
117160
  }
116654
- }, _callee24, this, [[1, 6]]);
117161
+ }, _callee25, this, [[1, 6]]);
116655
117162
  }));
116656
117163
  function processModelItem(_x32) {
116657
117164
  return _processModelItem.apply(this, arguments);
@@ -116690,27 +117197,27 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116690
117197
  }, {
116691
117198
  key: "_getFromDB",
116692
117199
  value: function () {
116693
- var _getFromDB2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee25(id) {
117200
+ var _getFromDB2 = StreamLoader_asyncToGenerator(/*#__PURE__*/StreamLoader_regenerator().m(function _callee26(id) {
116694
117201
  var projectId,
116695
117202
  db,
116696
- _args25 = arguments,
116697
- _t24;
116698
- return StreamLoader_regenerator().w(function (_context25) {
116699
- 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) {
116700
117207
  case 0:
116701
- projectId = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : this.projectId || 0;
116702
- _context25.p = 1;
116703
- _context25.n = 2;
117208
+ projectId = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : this.projectId || 0;
117209
+ _context26.p = 1;
117210
+ _context26.n = 2;
116704
117211
  return this._initDB();
116705
117212
  case 2:
116706
- db = _context25.v;
117213
+ db = _context26.v;
116707
117214
  if (db) {
116708
- _context25.n = 3;
117215
+ _context26.n = 3;
116709
117216
  break;
116710
117217
  }
116711
- return _context25.a(2, null);
117218
+ return _context26.a(2, null);
116712
117219
  case 3:
116713
- return _context25.a(2, new Promise(function (resolve) {
117220
+ return _context26.a(2, new Promise(function (resolve) {
116714
117221
  var transaction = db.transaction(['boxCache'], 'readonly');
116715
117222
  var store = transaction.objectStore('boxCache');
116716
117223
  var request = store.get("".concat(projectId, ":").concat(id));
@@ -116722,12 +117229,12 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116722
117229
  };
116723
117230
  }));
116724
117231
  case 4:
116725
- _context25.p = 4;
116726
- _t24 = _context25.v;
116727
- console.warn('Error reading from IndexedDB:', _t24);
116728
- 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);
116729
117236
  }
116730
- }, _callee25, this, [[1, 4]]);
117237
+ }, _callee26, this, [[1, 4]]);
116731
117238
  }));
116732
117239
  function _getFromDB(_x33) {
116733
117240
  return _getFromDB2.apply(this, arguments);
@@ -116737,41 +117244,41 @@ var StreamLoader_StreamLoader = /*#__PURE__*/function () {
116737
117244
  }, {
116738
117245
  key: "_saveToDB",
116739
117246
  value: function () {
116740
- 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) {
116741
117248
  var projectId,
116742
117249
  db,
116743
117250
  transaction,
116744
117251
  store,
116745
- _args26 = arguments,
116746
- _t25;
116747
- return StreamLoader_regenerator().w(function (_context26) {
116748
- 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) {
116749
117256
  case 0:
116750
- projectId = _args26.length > 2 && _args26[2] !== undefined ? _args26[2] : this.projectId || 0;
116751
- _context26.p = 1;
116752
- _context26.n = 2;
117257
+ projectId = _args27.length > 2 && _args27[2] !== undefined ? _args27[2] : this.projectId || 0;
117258
+ _context27.p = 1;
117259
+ _context27.n = 2;
116753
117260
  return this._initDB();
116754
117261
  case 2:
116755
- db = _context26.v;
117262
+ db = _context27.v;
116756
117263
  if (db) {
116757
- _context26.n = 3;
117264
+ _context27.n = 3;
116758
117265
  break;
116759
117266
  }
116760
- return _context26.a(2);
117267
+ return _context27.a(2);
116761
117268
  case 3:
116762
117269
  transaction = db.transaction(['boxCache'], 'readwrite');
116763
117270
  store = transaction.objectStore('boxCache');
116764
117271
  store.put(data, "".concat(projectId, ":").concat(id));
116765
- _context26.n = 5;
117272
+ _context27.n = 5;
116766
117273
  break;
116767
117274
  case 4:
116768
- _context26.p = 4;
116769
- _t25 = _context26.v;
116770
- console.warn('Error saving to IndexedDB:', _t25);
117275
+ _context27.p = 4;
117276
+ _t24 = _context27.v;
117277
+ console.warn('Error saving to IndexedDB:', _t24);
116771
117278
  case 5:
116772
- return _context26.a(2);
117279
+ return _context27.a(2);
116773
117280
  }
116774
- }, _callee26, this, [[1, 4]]);
117281
+ }, _callee27, this, [[1, 4]]);
116775
117282
  }));
116776
117283
  function _saveToDB(_x34, _x35) {
116777
117284
  return _saveToDB2.apply(this, arguments);
@@ -120414,6 +120921,7 @@ var LOG_INTERVAL = 30;
120414
120921
 
120415
120922
 
120416
120923
 
120924
+ // import boxJson from './box.json';
120417
120925
 
120418
120926
 
120419
120927
 
@@ -121744,8 +122252,12 @@ var isDebug = false || false === true;
121744
122252
  if (isAdd && boxJson) {
121745
122253
  var arr = boxJson ? boxJson : [];
121746
122254
  var modelIds = new Set();
122255
+ var validGeomTypes = new Set(Object.values(GEOM_TYPES));
121747
122256
  for (var i = 0; i < arr.length; i++) {
121748
122257
  var it = arr[i];
122258
+ if (!validGeomTypes.has(it.geomType)) {
122259
+ continue;
122260
+ }
121749
122261
  if (it.obb.length == 0) {
121750
122262
  continue;
121751
122263
  }
@@ -121756,10 +122268,21 @@ var isDebug = false || false === true;
121756
122268
 
121757
122269
  // 构造 AABB
121758
122270
  var boxThree = new this.THREE.Box3(min, max);
121759
- var hasMatrix = Array.isArray(it.matrix);
121760
- if (hasMatrix && it.matrix.length >= 16) {
121761
- var matrix = new this.THREE.Matrix4().fromArray(it.matrix);
121762
- 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();
121763
122286
  if (this.bizToThreeMatrix) {
121764
122287
  worldMatrix.premultiply(this.bizToThreeMatrix);
121765
122288
  }
@@ -121771,15 +122294,19 @@ var isDebug = false || false === true;
121771
122294
  var userData = {
121772
122295
  flag: it.flag || 1,
121773
122296
  // 默认为 1
122297
+ geomType: it.geomType,
121774
122298
  obbData: it.obb,
121775
122299
  // 存储原始 OBB 数据
121776
122300
  transparent: it.transp > 0,
121777
122301
  sourceVisible: it.visible === false ? false : true,
121778
- 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
121779
122305
  };
121780
122306
  if (it.flag === 1) {
121781
122307
  userData.indices = it.indices;
121782
- userData.matrix = it.matrix;
122308
+ userData.matrix = localMatrix ? localMatrix.toArray() : it.matrix;
122309
+ userData.meshMatrix = it.meshMatrix;
121783
122310
  // userData.matrix = new this.THREE.Matrix4().identity();
121784
122311
  }
121785
122312
  // 如果是 flag=3,解析并存储中心点、半轴长、旋转矩阵
@@ -121793,6 +122320,9 @@ var isDebug = false || false === true;
121793
122320
  var rotationMatrix4 = new this.THREE.Matrix4().setFromMatrix3(rotation);
121794
122321
  var obbMatrix = new this.THREE.Matrix4().makeTranslation(center.x, center.y, center.z);
121795
122322
  obbMatrix.multiply(rotationMatrix4);
122323
+ if (localMatrix) {
122324
+ obbMatrix.premultiply(localMatrix);
122325
+ }
121796
122326
  userData.obb = {
121797
122327
  matrix: obbMatrix,
121798
122328
  center: center,
@@ -121837,6 +122367,9 @@ var isDebug = false || false === true;
121837
122367
  this.buildOctreeFromBoxIndex();
121838
122368
  console.log('time end', Date.now());
121839
122369
  },
122370
+ shouldApplyOcclusionByBox: function shouldApplyOcclusionByBox(box) {
122371
+ return !!(box && box.userData && box.userData.occlusionEnabled);
122372
+ },
121840
122373
  tryInitialCenterAfterBoundsReady: function tryInitialCenterAfterBoundsReady() {
121841
122374
  if (this.hasExecutedCentering || this.userInteracting) return;
121842
122375
  if (!this.sceneBoundingBox || !this.sceneBoundingBox.isBox3 || this.sceneBoundingBox.isEmpty()) return;
@@ -122391,7 +122924,7 @@ var isDebug = false || false === true;
122391
122924
  }
122392
122925
  visibleIdSet = new Set(visibleIds);
122393
122926
  if (!_this11._octree) {
122394
- _context3.n = 7;
122927
+ _context3.n = 8;
122395
122928
  break;
122396
122929
  }
122397
122930
  frustum = _this11._getCurrentFrustum();
@@ -122400,29 +122933,40 @@ var isDebug = false || false === true;
122400
122933
  i = 0;
122401
122934
  case 3:
122402
122935
  if (!(i < hits.length)) {
122403
- _context3.n = 6;
122936
+ _context3.n = 7;
122404
122937
  break;
122405
122938
  }
122406
122939
  if (!(hits[i].box && hits[i].box.userData && hits[i].box.userData.visible === false)) {
122407
122940
  _context3.n = 4;
122408
122941
  break;
122409
122942
  }
122410
- return _context3.a(3, 5);
122943
+ return _context3.a(3, 6);
122411
122944
  case 4:
122412
- 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);
122413
122951
  case 5:
122952
+ candidates.push(hits[i]);
122953
+ case 6:
122414
122954
  i++;
122415
122955
  _context3.n = 3;
122416
122956
  break;
122417
- case 6:
122418
- _context3.n = 8;
122419
- break;
122420
122957
  case 7:
122958
+ _context3.n = 9;
122959
+ break;
122960
+ case 8:
122421
122961
  if (_this11._boxIndex && _this11._boxIndex.size > 0) {
122422
122962
  _this11._boxIndex.forEach(function (box, modelId) {
122423
122963
  if (bypassList && bypassList.size > 0 && bypassList.has(modelId)) return;
122424
122964
  if (box.userData && box.userData.visible === false) return;
122425
122965
  if (_this11.isBoxInFrustum(box)) {
122966
+ if (!_this11.shouldApplyOcclusionByBox(box)) {
122967
+ visibleIdSet.add(_this11.formatModelId(modelId));
122968
+ return;
122969
+ }
122426
122970
  candidates.push({
122427
122971
  modelId: modelId,
122428
122972
  box: box
@@ -122430,11 +122974,11 @@ var isDebug = false || false === true;
122430
122974
  }
122431
122975
  });
122432
122976
  }
122433
- case 8:
122977
+ case 9:
122434
122978
  occlusionState = _this11.noObserver ? _this11.noObserver.occlusionState : _this11.occlusionState; // 从响应式对象获取开关状态
122435
122979
  occlusionEnabled = _this11.occlusionState && _this11.occlusionState.enabled;
122436
122980
  if (!occlusionEnabled) {
122437
- _context3.n = 15;
122981
+ _context3.n = 16;
122438
122982
  break;
122439
122983
  }
122440
122984
  state = occlusionState;
@@ -122448,7 +122992,7 @@ var isDebug = false || false === true;
122448
122992
  sh = Math.max(1, sh);
122449
122993
  rt = state._colorRT;
122450
122994
  t0 = performance.now();
122451
- _context3.p = 9;
122995
+ _context3.p = 10;
122452
122996
  if (!rt || state._rtW !== sw || state._rtH !== sh) {
122453
122997
  if (rt && typeof rt.dispose === 'function') rt.dispose();
122454
122998
  rt = new _this11.THREE.WebGLRenderTarget(sw, sh, {
@@ -122945,9 +123489,9 @@ var isDebug = false || false === true;
122945
123489
  extraStride = _this11.occlusionState && _this11.occlusionState.sampleStride ? _this11.occlusionState.sampleStride : 1;
122946
123490
  stride = Math.max(1, baseStride * Math.max(1, extraStride));
122947
123491
  minSampleCount = _this11.occlusionState && _this11.occlusionState.minSampleCount ? _this11.occlusionState.minSampleCount : 1;
122948
- _context3.n = 10;
123492
+ _context3.n = 11;
122949
123493
  return _this11.scanOcclusionIndices(state._colorBuffer, sw, sh, stride, maxIdx, minSampleCount);
122950
- case 10:
123494
+ case 11:
122951
123495
  scanResult = _context3.v;
122952
123496
  if (scanResult && scanResult.buffer) {
122953
123497
  state._colorBuffer = new Uint8Array(scanResult.buffer);
@@ -122961,7 +123505,7 @@ var isDebug = false || false === true;
122961
123505
  }
122962
123506
  transparentMaxIdx = typeof state._occTransparentMaxIdx === 'number' ? state._occTransparentMaxIdx : 0;
122963
123507
  if (!(transparentMaxIdx > 0 && transparentMesh && transparentMesh.visible)) {
122964
- _context3.n = 12;
123508
+ _context3.n = 13;
122965
123509
  break;
122966
123510
  }
122967
123511
  _this11.renderer.setClearColor(new _this11.THREE.Color(0, 0, 0), 0);
@@ -122969,9 +123513,9 @@ var isDebug = false || false === true;
122969
123513
  _this11.renderer.render(state._occTransparentScene, _this11.camera);
122970
123514
  _this11.renderer.readRenderTargetPixels(rt, 0, 0, sw, sh, state._colorBuffer);
122971
123515
  tIdIndexArr = transparentIdIndexArr;
122972
- _context3.n = 11;
123516
+ _context3.n = 12;
122973
123517
  return _this11.scanOcclusionIndices(state._colorBuffer, sw, sh, stride, transparentMaxIdx, minSampleCount);
122974
- case 11:
123518
+ case 12:
122975
123519
  tScanResult = _context3.v;
122976
123520
  if (tScanResult && tScanResult.buffer) {
122977
123521
  state._colorBuffer = new Uint8Array(tScanResult.buffer);
@@ -122983,26 +123527,26 @@ var isDebug = false || false === true;
122983
123527
  visibleIdSet.add(_id);
122984
123528
  }
122985
123529
  }
122986
- case 12:
123530
+ case 13:
122987
123531
  _this11.renderer.setRenderTarget(prevTarget);
122988
123532
  _this11.renderer.setClearColor(prevClearColorHex, prevClearAlpha);
122989
123533
  _this11.renderer.toneMapping = prevToneMapping;
122990
- _context3.n = 14;
123534
+ _context3.n = 15;
122991
123535
  break;
122992
- case 13:
122993
- _context3.p = 13;
123536
+ case 14:
123537
+ _context3.p = 14;
122994
123538
  _t2 = _context3.v;
122995
123539
  for (_i1 = 0; _i1 < candidates.length; _i1++) {
122996
123540
  visibleIdSet.add(candidates[_i1].modelId);
122997
123541
  }
122998
- case 14:
122999
- _context3.n = 16;
123000
- break;
123001
123542
  case 15:
123543
+ _context3.n = 17;
123544
+ break;
123545
+ case 16:
123002
123546
  for (_i10 = 0; _i10 < candidates.length; _i10++) {
123003
123547
  visibleIdSet.add(candidates[_i10].modelId);
123004
123548
  }
123005
- case 16:
123549
+ case 17:
123006
123550
  visibleIds.length = 0;
123007
123551
  visibleIdSet.forEach(function (id) {
123008
123552
  return visibleIds.push(id);
@@ -123033,6 +123577,11 @@ var isDebug = false || false === true;
123033
123577
  if (bypassList && bypassList.size > 0 && bypassList.has(_modelId)) return;
123034
123578
  var instanceInfo = instancesMap.get(_modelId);
123035
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
+ }
123036
123585
  var _inFrustum = _this11.isModelInFrustum(child, instanceIndex, globalFrustum);
123037
123586
  var _modelInVisible = toLoadSet.has(_modelId);
123038
123587
  // console.log('modelId', modelId, 'inFrustum', inFrustum, 'modelInVisible', modelInVisible)
@@ -123046,6 +123595,13 @@ var isDebug = false || false === true;
123046
123595
  // 第二遍遍历:同步状态并决定是否卸载
123047
123596
  for (var _i12 = 0, _modelIds3 = modelIds; _i12 < _modelIds3.length; _i12++) {
123048
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
+ }
123049
123605
  // 无论是否卸载,只要模型已在场景中,就从待加载集合中移除
123050
123606
  if (toLoadSet.has(_modelId2)) {
123051
123607
  toLoadSet.delete(_modelId2);
@@ -123067,6 +123623,13 @@ var isDebug = false || false === true;
123067
123623
  }
123068
123624
  var modelId = child.parent && child.parent.userData && child.parent.userData.instanceId ? child.parent.userData.instanceId : child.uuid;
123069
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
+ }
123070
123633
  var inFrustum = _this11.isModelInFrustum(child, null, globalFrustum);
123071
123634
  var modelInVisible = toLoadSet.has(modelId);
123072
123635
  if (modelInVisible) {
@@ -123092,10 +123655,10 @@ var isDebug = false || false === true;
123092
123655
  });
123093
123656
  }
123094
123657
  _this11.modelStateManager.isloadedModelsIds = Object.freeze(Array.from(toLoadSet));
123095
- case 17:
123658
+ case 18:
123096
123659
  return _context3.a(2);
123097
123660
  }
123098
- }, _callee3, null, [[9, 13]]);
123661
+ }, _callee3, null, [[10, 14]]);
123099
123662
  }))();
123100
123663
  },
123101
123664
  isBoxInFrustum: function isBoxInFrustum(box) {
@@ -125784,6 +126347,10 @@ var isDebug = false || false === true;
125784
126347
  });
125785
126348
  this.threeMeasure.start();
125786
126349
  break;
126350
+ case 'clearDistance':
126351
+ this.threeMeasure = new measure_clear_distance.MeasureClearDistance(this.renderer, this.scene, this.camera, this.instructions.offsetWidth, this.instructions.offsetHeight);
126352
+ this.threeMeasure.start();
126353
+ break;
125787
126354
  }
125788
126355
  // 添加键盘事件监听器
125789
126356
  document.addEventListener('keydown', this.handleMeasureKeyDown, false);
@@ -125844,7 +126411,7 @@ var isDebug = false || false === true;
125844
126411
  this.threeMeasure.clear();
125845
126412
  }
125846
126413
  this.removeMeasureObjectsFromScene();
125847
- this.measureFlag = false;
126414
+ // this.measureFlag = false;
125848
126415
  document.removeEventListener('keydown', this.handleMeasureKeyDown, false);
125849
126416
  },
125850
126417
  handleMeasureKeyDown: function handleMeasureKeyDown(event) {
@@ -126916,11 +127483,11 @@ var isDebug = false || false === true;
126916
127483
  });
126917
127484
  // CONCATENATED MODULE: ./packages/components/com-graphics/index.vue?vue&type=script&lang=js
126918
127485
  /* harmony default export */ var components_com_graphicsvue_type_script_lang_js = (com_graphicsvue_type_script_lang_js);
126919
- // EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=0&id=48280acc&prod&lang=scss&scoped=true
126920
- var com_graphicsvue_type_style_index_0_id_48280acc_prod_lang_scss_scoped_true = __webpack_require__("11c1");
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");
126921
127488
 
126922
- // EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=1&id=48280acc&prod&lang=css
126923
- var com_graphicsvue_type_style_index_1_id_48280acc_prod_lang_css = __webpack_require__("3800");
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");
126924
127491
 
126925
127492
  // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
126926
127493
  /* globals __VUE_SSR_CONTEXT__ */
@@ -127032,17 +127599,17 @@ function normalizeComponent(
127032
127599
 
127033
127600
  var component = normalizeComponent(
127034
127601
  components_com_graphicsvue_type_script_lang_js,
127035
- com_graphicsvue_type_template_id_48280acc_scoped_true_render,
127602
+ com_graphicsvue_type_template_id_a4813dca_scoped_true_render,
127036
127603
  staticRenderFns,
127037
127604
  false,
127038
127605
  null,
127039
- "48280acc",
127606
+ "a4813dca",
127040
127607
  null
127041
127608
 
127042
127609
  )
127043
127610
 
127044
127611
  /* harmony default export */ var com_graphics = (component.exports);
127045
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"bed71126-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
127046
127613
  var com_flcanvasvue_type_template_id_b313ab6c_scoped_true_render = function render() {
127047
127614
  var _vm = this,
127048
127615
  _c = _vm._self._c;
@@ -131095,7 +131662,7 @@ var com_flcanvas_component = normalizeComponent(
131095
131662
  )
131096
131663
 
131097
131664
  /* harmony default export */ var com_flcanvas = (com_flcanvas_component.exports);
131098
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"bed71126-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
131099
131666
  var per_controlvue_type_template_id_f547d5c6_scoped_true_render = function render() {
131100
131667
  var _vm = this,
131101
131668
  _c = _vm._self._c;
@@ -131203,7 +131770,7 @@ var per_control_component = normalizeComponent(
131203
131770
  )
131204
131771
 
131205
131772
  /* harmony default export */ var per_control = (per_control_component.exports);
131206
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"bed71126-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
131207
131774
  var pidvue_type_template_id_2572c0e2_scoped_true_render = function render() {
131208
131775
  var _vm = this,
131209
131776
  _c = _vm._self._c;
@@ -131250,7 +131817,7 @@ var browserify_default = /*#__PURE__*/__webpack_require__.n(browserify);
131250
131817
  var html2canvas = __webpack_require__("c0e9");
131251
131818
  var html2canvas_default = /*#__PURE__*/__webpack_require__.n(html2canvas);
131252
131819
 
131253
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"bed71126-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
131254
131821
  var ann_toolvue_type_template_id_4b17bce0_scoped_true_render = function render() {
131255
131822
  var _vm = this,
131256
131823
  _c = _vm._self._c;