web3dlink 2.1.17 → 2.1.19

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.
@@ -1,34 +1,30 @@
1
1
  //#endregion
2
- //#region version.js
2
+ //#region baseConfig/version.js
3
3
  var e = {
4
4
  name: "web3dlink",
5
- version: "2.1.17",
5
+ version: "2.1.19",
6
6
  description: "LarkSR / ZS 推流 GameAPI SDK",
7
+ releaseNotes: { "2.1.19": ["新增 videoFusion 视频融合", "更新 zs-stream-parent(配合推流平台,修复第一人称 WASD 控制)"] },
7
8
  type: "module",
8
9
  main: "./dist/web3dlink.js",
9
10
  module: "./dist/web3dlink.js",
10
- types: "./dist/web3dlink.d.ts",
11
11
  exports: {
12
12
  ".": {
13
- types: "./dist/web3dlink.d.ts",
14
13
  import: "./dist/web3dlink.js",
15
14
  default: "./dist/web3dlink.js"
16
15
  },
17
16
  "./larksr": {
18
- types: "./dist/web3dlink.d.ts",
19
17
  import: "./dist/web3dlink-larksr.js",
20
18
  default: "./dist/web3dlink-larksr.js"
21
19
  },
22
20
  "./zs": {
23
- types: "./dist/web3dlink.d.ts",
24
21
  import: "./dist/web3dlink-zs.js",
25
22
  default: "./dist/web3dlink-zs.js"
26
23
  }
27
24
  },
28
25
  files: ["dist"],
29
26
  scripts: {
30
- build: "node ./scripts/build.mjs",
31
- "sync:dts": "node ./scripts/sync-dts.mjs",
27
+ build: "vite build",
32
28
  prepublishOnly: "npm run build"
33
29
  },
34
30
  keywords: [
@@ -39,14 +35,14 @@ var e = {
39
35
  "web3dlink"
40
36
  ],
41
37
  license: "MIT",
42
- peerDependencies: { larksr_websdk: "^3.3.119" },
43
- peerDependenciesMeta: { larksr_websdk: { optional: !0 } },
38
+ dependencies: { larksr_websdk: "^3.3.119" },
39
+ devDependencies: { vite: "^8.0.12" },
44
40
  sideEffects: [
45
41
  "./dist/web3dlink.js",
46
42
  "./dist/web3dlink-larksr.js",
47
43
  "./dist/web3dlink-zs.js",
48
- "./zs-stream-parent.js",
49
- "./version.js"
44
+ "./stream/zs-stream-parent.js",
45
+ "./baseConfig/version.js"
50
46
  ]
51
47
  }.version, t = "background: #22c55e; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 600;";
52
48
  function n() {
@@ -56,7 +52,7 @@ function n() {
56
52
  } catch {}
57
53
  return !0;
58
54
  }
59
- n() && (console.log(`%c [web3dlink] version: ${e} `, t), console.log("%c [larksr_websdk] peer: ^3.3.119 ", t));
55
+ n() && (console.log(`%c [web3dlink] version: ${e}`, t), console.log("%c [larksr_websdk] bundled ^3.3.119 ", t));
60
56
  //#endregion
61
57
  //#region api/createNamespaceApi.js
62
58
  function r(e, t = {}, n = {}) {
@@ -250,7 +246,7 @@ function c(e) {
250
246
  return c < 0 || c > 1 ? !1 : `#${(u << 16 | d << 8 | f).toString(16).padStart(6, "0").toUpperCase()}${Math.round(c * 255).toString(16).padStart(2, "0").toUpperCase()}`;
251
247
  }
252
248
  //#endregion
253
- //#region baseConfig/validateHelpers.js
249
+ //#region baseConfig/validators.js
254
250
  function l(e, t, n) {
255
251
  if (!e || typeof e != "object") return;
256
252
  let r = t.split("."), i = r.pop(), a = e;
@@ -261,8 +257,6 @@ function u(e, t) {
261
257
  let { normalized: n, field: r, assign: i } = e || {};
262
258
  n && r ? r.includes(".") ? l(n, r, t) : n[r] = t : typeof i == "function" && i(t);
263
259
  }
264
- //#endregion
265
- //#region baseConfig/validators.js
266
260
  function d(e, t = null, n = null) {
267
261
  return !(e == null || typeof e != "number" || isNaN(e) || t !== null && e < t || n !== null && e > n);
268
262
  }
@@ -293,7 +287,7 @@ function p(...e) {
293
287
  normalized: o
294
288
  };
295
289
  }
296
- let { value: n, field: r, label: i, required: a = !0, min: o = null, max: s = null, normalized: c, defaultValue: l, assign: f } = t, p = r || i || "field", m = i || p, h = [], g = !(n == null || n === ""), _ = (e) => {
290
+ let { value: n, field: r, label: i, required: a = !0, min: o = null, max: s = null, normalized: c, defaultValue: l, assign: f } = t, p = r || i || "field", m = i || p, h = [], g = n != null && n !== "", _ = (e) => {
297
291
  u({
298
292
  normalized: c,
299
293
  field: p,
@@ -322,7 +316,7 @@ function m(...e) {
322
316
  max: a
323
317
  };
324
318
  }
325
- let { value: n, field: r, label: i, min: a = null, max: o = null, normalized: s, defaultValue: c, assign: l } = t, f = r || i || "field", p = i || f, m = [], h = !(n == null || n === ""), g = (e) => {
319
+ let { value: n, field: r, label: i, min: a = null, max: o = null, normalized: s, defaultValue: c, assign: l } = t, f = r || i || "field", p = i || f, m = [], h = n != null && n !== "", g = (e) => {
326
320
  u({
327
321
  normalized: s,
328
322
  field: f,
@@ -348,7 +342,7 @@ function h(...e) {
348
342
  value: r
349
343
  };
350
344
  }
351
- let { field: n, label: r, value: i, normalized: a, defaultValue: o, assign: s } = t, c = n || r || "field", l = r || c, d = [], f = !(i == null || i === ""), p = (e) => {
345
+ let { field: n, label: r, value: i, normalized: a, defaultValue: o, assign: s } = t, c = n || r || "field", l = r || c, d = [], f = i != null && i !== "", p = (e) => {
352
346
  u({
353
347
  normalized: a,
354
348
  field: c,
@@ -367,7 +361,7 @@ function g(...e) {
367
361
  value: r
368
362
  };
369
363
  }
370
- let { field: n, label: r, value: i, normalized: a, defaultValue: o, assign: s } = t, c = n || r || "field", l = r || c, d = [], f = !(i == null || i === ""), p = (e) => {
364
+ let { field: n, label: r, value: i, normalized: a, defaultValue: o, assign: s } = t, c = n || r || "field", l = r || c, d = [], f = i != null && i !== "", p = (e) => {
371
365
  u({
372
366
  normalized: a,
373
367
  field: c,
@@ -420,7 +414,7 @@ function v(...e) {
420
414
  0,
421
415
  0,
422
416
  0
423
- ], assign: s } = t, c = n || r || "field", l = r || c, d = [], f = !(i == null || i === ""), p = (e) => {
417
+ ], assign: s } = t, c = n || r || "field", l = r || c, d = [], f = i != null && i !== "", p = (e) => {
424
418
  let t = [...e];
425
419
  u({
426
420
  normalized: a,
@@ -445,7 +439,7 @@ function y(...e) {
445
439
  ...i
446
440
  };
447
441
  }
448
- let { label: n, field: r, value: i, required: o = !1, normalized: s, defaultValue: c, assign: l } = t, d = r || n || "field", f = n || d, p = [], m = !(i == null || i === ""), h = (e) => {
442
+ let { label: n, field: r, value: i, required: o = !1, normalized: s, defaultValue: c, assign: l } = t, d = r || n || "field", f = n || d, p = [], m = i != null && i !== "", h = (e) => {
449
443
  u({
450
444
  normalized: s,
451
445
  field: d,
@@ -675,7 +669,7 @@ function x(e, t, n, r, i) {
675
669
  //#endregion
676
670
  //#region api/camera/aroundMode.js
677
671
  function oe(e = {}) {
678
- let t = [], n = { ...e }, r = !(e.id === void 0 || e.id === null || e.id === ""), i = !(e.coordinates === void 0 || e.coordinates === null || e.coordinates === "");
672
+ let t = [], n = { ...e }, r = e.id !== void 0 && e.id !== null && e.id !== "", i = e.coordinates !== void 0 && e.coordinates !== null && e.coordinates !== "";
679
673
  return r && i ? t.push("[id]与[coordinates]只能二选一,不能同时提供") : !r && !i ? t.push("[id]与[coordinates]必须二选一,至少提供一个") : r ? (t.push(...h({
680
674
  normalized: n,
681
675
  field: "id",
@@ -1338,10 +1332,10 @@ function Te(e, t) {
1338
1332
  field: "dataTexts",
1339
1333
  value: e.dataTexts,
1340
1334
  defaultValue: []
1341
- })), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1335
+ })), e.dataTexts = Array.isArray(e.dataTexts) ? e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1342
1336
  key: e.key ?? "",
1343
1337
  value: e.value ?? ""
1344
- })) : e.dataTexts = [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1338
+ })) : [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1345
1339
  }
1346
1340
  function Ee(e, t) {
1347
1341
  t.push(..._({
@@ -1370,10 +1364,10 @@ function Ee(e, t) {
1370
1364
  field: "dataTexts",
1371
1365
  value: e.dataTexts,
1372
1366
  defaultValue: []
1373
- })), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1367
+ })), e.dataTexts = Array.isArray(e.dataTexts) ? e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1374
1368
  key: e.key ?? "",
1375
1369
  value: e.value ?? ""
1376
- })) : e.dataTexts = [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1370
+ })) : [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1377
1371
  }
1378
1372
  function De(e, t) {
1379
1373
  t.push(...m({
@@ -1661,10 +1655,10 @@ function Ne(e, t) {
1661
1655
  field: "detailBtnText",
1662
1656
  value: e.detailBtnText,
1663
1657
  defaultValue: ""
1664
- })), O(e, "textStyle", t), O(e, "titleStyle", t), O(e, "detailStyle", t), O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1658
+ })), O(e, "textStyle", t), O(e, "titleStyle", t), O(e, "detailStyle", t), O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t), e.dataTexts = Array.isArray(e.dataTexts) ? e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1665
1659
  key: e.key ?? "",
1666
1660
  value: e.value ?? ""
1667
- })) : e.dataTexts = [];
1661
+ })) : [];
1668
1662
  }
1669
1663
  var Pe = [0, 2147483647];
1670
1664
  function j(e, t, n, r = "visibleRange") {
@@ -1713,7 +1707,7 @@ var M = [
1713
1707
  //#region api/marker/iconMarker.js
1714
1708
  function Fe(e) {
1715
1709
  let t = [], n = { ...e };
1716
- if (e.id === void 0 || e.id === null || e.id === "" ? n.id = E() : n.id = e.id, t.push(...f(e.coordinates)), t.push(...g({
1710
+ if (n.id = e.id === void 0 || e.id === null || e.id === "" ? E() : e.id, t.push(...f(e.coordinates)), t.push(...g({
1717
1711
  normalized: n,
1718
1712
  field: "groupId",
1719
1713
  value: e.groupId
@@ -1749,7 +1743,7 @@ function Fe(e) {
1749
1743
  //#region api/marker/followMarker.js
1750
1744
  function Ie(e) {
1751
1745
  let t = [], n = { ...e };
1752
- if (e.id === void 0 || e.id === null || e.id === "" ? n.id = E() : n.id = e.id, t.push(...h({
1746
+ if (n.id = e.id === void 0 || e.id === null || e.id === "" ? E() : e.id, t.push(...h({
1753
1747
  normalized: n,
1754
1748
  field: "modelId",
1755
1749
  value: e.modelId
@@ -1940,7 +1934,7 @@ function Ge(e) {
1940
1934
  //#region api/marker/secondMarker.js
1941
1935
  function Ke(e) {
1942
1936
  let t = [], n = { ...e };
1943
- e.id === void 0 || e.id === null || e.id === "" ? n.id = E() : n.id = e.id, t.push(...f(e.coordinates)), t.push(...g({
1937
+ n.id = e.id === void 0 || e.id === null || e.id === "" ? E() : e.id, t.push(...f(e.coordinates)), t.push(...g({
1944
1938
  normalized: n,
1945
1939
  field: "groupId",
1946
1940
  value: e.groupId
@@ -1981,10 +1975,10 @@ function Ke(e) {
1981
1975
  field: "title",
1982
1976
  value: r.title,
1983
1977
  defaultValue: ""
1984
- })), n.markerType === "popupCustom1" ? Ne(r, t) : (O(r, "titleStyle", t), O(r, "dataKeyStyle", t), O(r, "dataValueStyle", t), Array.isArray(r.dataTexts) ? r.dataTexts = r.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1978
+ })), n.markerType === "popupCustom1" ? Ne(r, t) : (O(r, "titleStyle", t), O(r, "dataKeyStyle", t), O(r, "dataValueStyle", t), r.dataTexts = Array.isArray(r.dataTexts) ? r.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1985
1979
  key: e.key ?? "",
1986
1980
  value: e.value ?? ""
1987
- })) : r.dataTexts = []), e.recordData !== void 0) {
1981
+ })) : []), e.recordData !== void 0) {
1988
1982
  let r = e.recordData;
1989
1983
  if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
1990
1984
  else try {
@@ -2610,7 +2604,7 @@ function yt(e) {
2610
2604
  }
2611
2605
  //#endregion
2612
2606
  //#region api/sceneModel/helpers.js
2613
- var N = (e) => !(e == null || e === "");
2607
+ var N = (e) => e != null && e !== "";
2614
2608
  function P(e, { id: t, tag: n }) {
2615
2609
  let r = N(t), i = N(n);
2616
2610
  if (!r && !i) {
@@ -2659,7 +2653,7 @@ function F(e, t, n) {
2659
2653
  }
2660
2654
  }
2661
2655
  function I(e, t, n) {
2662
- let r = (t, n) => N(n) ? Array.isArray(n) ? n.length === 0 ? (e.push(`[${t}]不能为空数组`), !1) : !0 : (e.push(`[${t}]必须是数组类型`), !1) : !1, i = r("ids", t), a = r("tags", n);
2656
+ let r = (t, n) => N(n) ? Array.isArray(n) ? n.length !== 0 || (e.push(`[${t}]不能为空数组`), !1) : (e.push(`[${t}]必须是数组类型`), !1) : !1, i = r("ids", t), a = r("tags", n);
2663
2657
  !i && !a ? e.push("[ids]和[tags]必须提供其中一个") : i && a && e.push("[ids]和[tags]不能同时提供");
2664
2658
  }
2665
2659
  var bt = [
@@ -2771,7 +2765,7 @@ function Et(e) {
2771
2765
  //#region api/sceneModel/showOnly.js
2772
2766
  function Dt(e) {
2773
2767
  let t = [], n = { ...e };
2774
- return I(t, e.ids, e.tags), e.isIgnoreMarker !== void 0 && typeof e.isIgnoreMarker != "boolean" ? t.push("[isIgnoreMarker]必须是布尔类型") : e.isIgnoreMarker === void 0 ? n.isIgnoreMarker = !0 : n.isIgnoreMarker = e.isIgnoreMarker, e.isIgnoreSky !== void 0 && typeof e.isIgnoreSky != "boolean" ? t.push("[isIgnoreSky]必须是布尔类型") : e.isIgnoreSky === void 0 ? n.isIgnoreSky = !1 : n.isIgnoreSky = e.isIgnoreSky, {
2768
+ return I(t, e.ids, e.tags), e.isIgnoreMarker !== void 0 && typeof e.isIgnoreMarker != "boolean" ? t.push("[isIgnoreMarker]必须是布尔类型") : n.isIgnoreMarker = e.isIgnoreMarker === void 0 || e.isIgnoreMarker, e.isIgnoreSky !== void 0 && typeof e.isIgnoreSky != "boolean" ? t.push("[isIgnoreSky]必须是布尔类型") : n.isIgnoreSky = e.isIgnoreSky !== void 0 && e.isIgnoreSky, {
2775
2769
  errors: t,
2776
2770
  normalized: n
2777
2771
  };
@@ -2911,7 +2905,7 @@ function Nt(e) {
2911
2905
  }
2912
2906
  //#endregion
2913
2907
  //#region api/sceneModel/openSlice.js
2914
- function R(e = {}) {
2908
+ function Pt(e = {}) {
2915
2909
  let t = [], n = { ...e };
2916
2910
  return t.push(...h({
2917
2911
  normalized: n,
@@ -2975,7 +2969,7 @@ function R(e = {}) {
2975
2969
  }
2976
2970
  //#endregion
2977
2971
  //#region api/sceneModel/closeSlice.js
2978
- function Pt(e = {}) {
2972
+ function Ft(e = {}) {
2979
2973
  let t = [], n = { ...e };
2980
2974
  return t.push(...h({
2981
2975
  normalized: n,
@@ -2988,7 +2982,7 @@ function Pt(e = {}) {
2988
2982
  }
2989
2983
  //#endregion
2990
2984
  //#region api/sceneModel/closeAllSlice.js
2991
- function Ft(e = {}) {
2985
+ function It(e = {}) {
2992
2986
  return {
2993
2987
  errors: [],
2994
2988
  normalized: { ...e }
@@ -2996,7 +2990,7 @@ function Ft(e = {}) {
2996
2990
  }
2997
2991
  //#endregion
2998
2992
  //#region api/sceneModel/sceneModelApi.js
2999
- var It = r("sceneModel", {
2993
+ var Lt = r("sceneModel", {
3000
2994
  getById: vt,
3001
2995
  getByTag: yt,
3002
2996
  setTransform: xt,
@@ -3012,13 +3006,13 @@ var It = r("sceneModel", {
3012
3006
  outline: jt,
3013
3007
  removeOutline: Mt,
3014
3008
  removeAllOutline: Nt,
3015
- openSlice: R,
3016
- closeSlice: Pt,
3017
- closeAllSlice: Ft
3009
+ openSlice: Pt,
3010
+ closeSlice: Ft,
3011
+ closeAllSlice: It
3018
3012
  });
3019
3013
  //#endregion
3020
3014
  //#region api/atmosphericEffects/time.js
3021
- function Lt(e) {
3015
+ function Rt(e) {
3022
3016
  let t = [], n = { ...e };
3023
3017
  return t.push(...p({
3024
3018
  normalized: n,
@@ -3033,7 +3027,7 @@ function Lt(e) {
3033
3027
  }
3034
3028
  //#endregion
3035
3029
  //#region api/atmosphericEffects/weather.js
3036
- function Rt(e) {
3030
+ function R(e) {
3037
3031
  let t = [], n = { ...e };
3038
3032
  return !e.type || typeof e.type != "string" ? t.push("[type]为必填项,且必须是字符串类型") : n.type = e.type, {
3039
3033
  errors: t,
@@ -3043,8 +3037,8 @@ function Rt(e) {
3043
3037
  //#endregion
3044
3038
  //#region api/atmosphericEffects/atmosphericEffectsApi.js
3045
3039
  var zt = r("atmosphericEffects", {
3046
- time: Lt,
3047
- weather: Rt
3040
+ time: Rt,
3041
+ weather: R
3048
3042
  });
3049
3043
  //#endregion
3050
3044
  //#region api/tool/onMouseClick.js
@@ -3813,22 +3807,254 @@ var On = r("VTK", {
3813
3807
  setPlaybackSpeed: Tn,
3814
3808
  clearSequence: En,
3815
3809
  clearAllSequence: Dn
3816
- }, { getOptions: () => ({ timeout: 0 }) }), B = !0;
3817
- function kn(e) {
3818
- B = !!e;
3810
+ }, { getOptions: () => ({ timeout: 0 }) });
3811
+ //#endregion
3812
+ //#region api/videoFusion/open.js
3813
+ function kn(e, t) {
3814
+ if (t === "Geographic") return f(e);
3815
+ let n = [];
3816
+ if (!e || !Array.isArray(e)) n.push("[coordinates] 为必填项,且必须是数组类型");
3817
+ else if (e.length < 3) n.push("[coordinates]包含:[x, y, z]");
3818
+ else {
3819
+ let [t, r, i] = e;
3820
+ d(t) || n.push("[coordinates[0]]必须是数字类型"), d(r) || n.push("[coordinates[1]]必须是数字类型"), d(i) || n.push("[coordinates[2]]必须是数字类型");
3821
+ }
3822
+ return n;
3823
+ }
3824
+ function An(e = {}) {
3825
+ let t = { ...e }, n = [];
3826
+ return e.instanceId !== void 0 && e.instanceId !== null && e.instanceId !== "" ? typeof e.instanceId == "string" ? t.instanceId = e.instanceId : n.push("[instanceId]必须是字符串类型") : delete t.instanceId, n.push(...b({
3827
+ normalized: t,
3828
+ field: "poseMode",
3829
+ value: e.poseMode,
3830
+ defaultValue: "Geographic",
3831
+ type: "string",
3832
+ list: ["UnrealWorld", "Geographic"]
3833
+ })), n.push(...kn(e.coordinates, t.poseMode)), n.push(...h({
3834
+ normalized: t,
3835
+ field: "url",
3836
+ value: e.url
3837
+ })), n.push(...p({
3838
+ normalized: t,
3839
+ field: "horizontalFov",
3840
+ value: e.horizontalFov,
3841
+ required: !0
3842
+ })), n.push(...p({
3843
+ normalized: t,
3844
+ field: "verticalFov",
3845
+ value: e.verticalFov,
3846
+ required: !0
3847
+ })), n.push(...p({
3848
+ normalized: t,
3849
+ field: "yaw",
3850
+ value: e.yaw,
3851
+ required: !0
3852
+ })), n.push(...p({
3853
+ normalized: t,
3854
+ field: "pitch",
3855
+ value: e.pitch,
3856
+ required: !0
3857
+ })), n.push(...p({
3858
+ normalized: t,
3859
+ field: "roll",
3860
+ value: e.roll,
3861
+ required: !0
3862
+ })), n.push(...m({
3863
+ normalized: t,
3864
+ field: "distanceMeters",
3865
+ value: e.distanceMeters,
3866
+ min: 0
3867
+ })), n.push(...m({
3868
+ normalized: t,
3869
+ field: "opacity",
3870
+ value: e.opacity,
3871
+ defaultValue: 1,
3872
+ min: 0,
3873
+ max: 1
3874
+ })), n.push(...m({
3875
+ normalized: t,
3876
+ field: "edgeFade",
3877
+ value: e.edgeFade,
3878
+ defaultValue: .1,
3879
+ min: 0,
3880
+ max: 1
3881
+ })), x(t, "bFlipX", e.bFlipX, n, !1), x(t, "bFlipY", e.bFlipY, n, !0), n.push(...m({
3882
+ normalized: t,
3883
+ field: "distortion",
3884
+ value: e.distortion,
3885
+ defaultValue: 0
3886
+ })), n.push(...m({
3887
+ normalized: t,
3888
+ field: "distortionCenterU",
3889
+ value: e.distortionCenterU,
3890
+ defaultValue: .5,
3891
+ min: 0,
3892
+ max: 1
3893
+ })), n.push(...m({
3894
+ normalized: t,
3895
+ field: "distortionCenterV",
3896
+ value: e.distortionCenterV,
3897
+ defaultValue: .5,
3898
+ min: 0,
3899
+ max: 1
3900
+ })), {
3901
+ errors: n,
3902
+ normalized: t
3903
+ };
3904
+ }
3905
+ //#endregion
3906
+ //#region api/videoFusion/close.js
3907
+ function jn(e = {}) {
3908
+ let t = { ...e };
3909
+ return {
3910
+ errors: [...h({
3911
+ normalized: t,
3912
+ field: "instanceId",
3913
+ value: e.instanceId
3914
+ })],
3915
+ normalized: t
3916
+ };
3917
+ }
3918
+ //#endregion
3919
+ //#region api/videoFusion/closeAll.js
3920
+ function Mn(e = {}) {
3921
+ return {
3922
+ errors: [],
3923
+ normalized: { ...e }
3924
+ };
3925
+ }
3926
+ //#endregion
3927
+ //#region api/videoFusion/pause.js
3928
+ function Nn(e = {}) {
3929
+ let t = { ...e };
3930
+ return {
3931
+ errors: [...h({
3932
+ normalized: t,
3933
+ field: "instanceId",
3934
+ value: e.instanceId
3935
+ })],
3936
+ normalized: t
3937
+ };
3819
3938
  }
3820
- function V(...e) {
3821
- B && console.log(...e);
3939
+ //#endregion
3940
+ //#region api/videoFusion/resume.js
3941
+ function Pn(e = {}) {
3942
+ let t = { ...e };
3943
+ return {
3944
+ errors: [...h({
3945
+ normalized: t,
3946
+ field: "instanceId",
3947
+ value: e.instanceId
3948
+ })],
3949
+ normalized: t
3950
+ };
3822
3951
  }
3823
- function H(...e) {
3824
- B && console.warn(...e);
3952
+ //#endregion
3953
+ //#region api/videoFusion/setPlaybackRate.js
3954
+ function Fn(e = {}) {
3955
+ let t = { ...e }, n = [];
3956
+ return n.push(...h({
3957
+ normalized: t,
3958
+ field: "instanceId",
3959
+ value: e.instanceId
3960
+ })), n.push(...m({
3961
+ normalized: t,
3962
+ field: "rate",
3963
+ value: e.rate,
3964
+ defaultValue: 1,
3965
+ min: 0
3966
+ })), {
3967
+ errors: n,
3968
+ normalized: t
3969
+ };
3970
+ }
3971
+ //#endregion
3972
+ //#region api/videoFusion/seekToTime.js
3973
+ function In(e = {}) {
3974
+ let t = { ...e }, n = [];
3975
+ return n.push(...h({
3976
+ normalized: t,
3977
+ field: "instanceId",
3978
+ value: e.instanceId
3979
+ })), n.push(...m({
3980
+ normalized: t,
3981
+ field: "seconds",
3982
+ value: e.seconds,
3983
+ defaultValue: 0,
3984
+ min: 0
3985
+ })), {
3986
+ errors: n,
3987
+ normalized: t
3988
+ };
3989
+ }
3990
+ //#endregion
3991
+ //#region api/videoFusion/videoFusionApi.js
3992
+ var Ln = r("videoFusion", {
3993
+ open: An,
3994
+ close: jn,
3995
+ closeAll: Mn,
3996
+ pause: Nn,
3997
+ resume: Pn,
3998
+ setPlaybackRate: Fn,
3999
+ seekToTime: In
4000
+ });
4001
+ //#endregion
4002
+ //#region api/other/otherApi.js
4003
+ function B(e) {
4004
+ return class {
4005
+ constructor(t) {
4006
+ this.commandManager = t, this.domain = e;
4007
+ }
4008
+ _handleSend(t, n = {}, r = {}) {
4009
+ return this.commandManager.sendWithDefault({
4010
+ errors: [],
4011
+ normalized: n
4012
+ }, `${e}.${t}`, r);
4013
+ }
4014
+ };
4015
+ }
4016
+ //#endregion
4017
+ //#region api/index.js
4018
+ var Rn = {
4019
+ camera: ue,
4020
+ cesium: Se,
4021
+ marker: qe,
4022
+ floodPeak: nt,
4023
+ animation: ut,
4024
+ hydrodynamicForce: _t,
4025
+ sceneModel: Lt,
4026
+ atmosphericEffects: zt,
4027
+ tool: Gt,
4028
+ line: Xt,
4029
+ level: Qt,
4030
+ VTK: On,
4031
+ videoFusion: Ln,
4032
+ oneDimensionalHydrodynamics: B("oneDimensionalHydrodynamics"),
4033
+ customDomain: B("customDomain"),
4034
+ arrow: B("arrow"),
4035
+ NC: B("NC"),
4036
+ gateOperation: B("gateOperation")
4037
+ }, V = class {
4038
+ constructor(e) {
4039
+ this._apis = {};
4040
+ for (let [t, n] of Object.entries(Rn)) this._apis[t] = new n(e), this[t] = (e, n, r) => this._apis[t]._handleSend(e, n, r);
4041
+ }
4042
+ }, H = !0;
4043
+ function zn(e) {
4044
+ H = !!e;
3825
4045
  }
3826
4046
  function U(...e) {
3827
- B && console.error(...e);
4047
+ H && console.log(...e);
4048
+ }
4049
+ function W(...e) {
4050
+ H && console.warn(...e);
4051
+ }
4052
+ function G(...e) {
4053
+ H && console.error(...e);
3828
4054
  }
3829
4055
  //#endregion
3830
- //#region baseConfig/responses.js
3831
- function W(e) {
4056
+ //#region commFlow/streamResponses.js
4057
+ function K(e) {
3832
4058
  return (Array.isArray(e) ? e : [e]).map((e) => {
3833
4059
  if (typeof e == "string") return e;
3834
4060
  if (e && typeof e == "object") {
@@ -3842,7 +4068,7 @@ function W(e) {
3842
4068
  return e == null ? "" : String(e);
3843
4069
  }).filter((e) => e !== "");
3844
4070
  }
3845
- function An(e, t, n) {
4071
+ function Bn(e, t, n) {
3846
4072
  return {
3847
4073
  success: !0,
3848
4074
  message: e,
@@ -3850,66 +4076,26 @@ function An(e, t, n) {
3850
4076
  command: n
3851
4077
  };
3852
4078
  }
3853
- function G(e, t, n) {
4079
+ function q(e, t, n) {
3854
4080
  let r = {
3855
4081
  success: !1,
3856
- message: W(e),
4082
+ message: K(e),
3857
4083
  params: t,
3858
4084
  command: n
3859
4085
  };
3860
- return U("三维场景报错:", r), r;
4086
+ return G("三维场景报错:", r), r;
3861
4087
  }
3862
- function K(e, t, n) {
4088
+ function J(e, t, n) {
3863
4089
  let r = {
3864
4090
  success: !1,
3865
- message: W(e),
4091
+ message: K(e),
3866
4092
  params: t,
3867
4093
  command: n
3868
4094
  };
3869
- return H("三维场景警告:", r), r;
4095
+ return W("三维场景警告:", r), r;
3870
4096
  }
3871
4097
  //#endregion
3872
- //#region api/other/otherApi.js
3873
- var jn = class {
3874
- constructor(e) {
3875
- this.commandManager = e;
3876
- }
3877
- _handleSend(e, t = {}, n = {}) {
3878
- return !e || typeof e != "string" ? G("命令不能为空", t, e || "unknown") : (V("自定义域命令下发:", e), this.commandManager.sendWithDefault({
3879
- errors: [],
3880
- normalized: t
3881
- }, e, n));
3882
- }
3883
- }, q = {
3884
- camera: ue,
3885
- cesium: Se,
3886
- marker: qe,
3887
- floodPeak: nt,
3888
- animation: ut,
3889
- hydrodynamicForce: _t,
3890
- sceneModel: It,
3891
- atmosphericEffects: zt,
3892
- tool: Gt,
3893
- line: Xt,
3894
- level: Qt,
3895
- VTK: On
3896
- }, Mn = [
3897
- "oneDimensionalHydrodynamics",
3898
- "customDomain",
3899
- "arrow",
3900
- "NC",
3901
- "gateOperation"
3902
- ], J = class {
3903
- constructor(e) {
3904
- this._apis = {};
3905
- for (let [t, n] of Object.entries(q)) this._apis[t] = new n(e);
3906
- this._otherApi = new jn(e);
3907
- for (let e of Object.keys(q)) this[e] = (t, n) => this._apis[e]._handleSend(t, n);
3908
- for (let e of Mn) this[e] = (t, n, r) => this._otherApi._handleSend(`${e}.${t}`, n, r);
3909
- }
3910
- };
3911
- //#endregion
3912
- //#region commFlow.js
4098
+ //#region commFlow/commFlow.js
3913
4099
  function Y() {
3914
4100
  return {
3915
4101
  Hovered: {},
@@ -3994,8 +4180,8 @@ var Q = {
3994
4180
  }
3995
4181
  sendWithDefault(e, t, n = {}) {
3996
4182
  let r = this._sendPreparePayload(t, e.normalized || {});
3997
- if (e.errors.length > 0) return G(e.errors, r, t);
3998
- if (this._destroyed || !this.transport) return G("连接已关闭,无法发送命令", r, t);
4183
+ if (e.errors.length > 0) return q(e.errors, r, t);
4184
+ if (this._destroyed || !this.transport) return q("连接已关闭,无法发送命令", r, t);
3999
4185
  let i = (++this.requestId).toString(), a = n?.timeout === 0 ? 0 : n?.timeout ?? this.timeout, o = new Promise((e, t) => {
4000
4186
  let n = null;
4001
4187
  a !== 0 && (n = setTimeout(() => {
@@ -4010,18 +4196,18 @@ var Q = {
4010
4196
  requestId: i,
4011
4197
  params: r
4012
4198
  };
4013
- return V("消息下发成功:", s), this.transport.sendTextToDataChannel(JSON.stringify(s)), o.then((e) => {
4199
+ return U("消息下发成功:", s), this.transport.sendTextToDataChannel(JSON.stringify(s)), o.then((e) => {
4014
4200
  if (e && e.command && e.command === t) switch (e.status) {
4015
- case "info": return An("操作执行成功", e.data, t);
4016
- case "warn": return K(e.message, e.data, t);
4017
- default: return G(e.message, e.data, t);
4201
+ case "info": return Bn("操作执行成功", e.data, t);
4202
+ case "warn": return J(e.message, e.data, t);
4203
+ default: return q(e.message, e.data, t);
4018
4204
  }
4019
- return G("返回数据格式错乱【请注意command参数】", e?.command, t);
4020
- }).catch((e) => e && e.message ? e.message === "Command timeout with no results" ? K(e.message, r, t) : G(e.message, r, t) : G("数据返回发生错误", r, t));
4205
+ return q("返回数据格式错乱【请注意command参数】", e?.command, t);
4206
+ }).catch((e) => e && e.message ? e.message === "Command timeout with no results" ? J(e.message, r, t) : q(e.message, r, t) : q("数据返回发生错误", r, t));
4021
4207
  }
4022
4208
  _handleRawResponse(e) {
4023
4209
  if (this._destroyed) return null;
4024
- if (!e) return U("数据第一步解析失败:", e), null;
4210
+ if (!e) return G("数据第一步解析失败:", e), null;
4025
4211
  let t;
4026
4212
  try {
4027
4213
  let n = JSON.parse(String(e).trim());
@@ -4033,7 +4219,7 @@ var Q = {
4033
4219
  requestId: n.requestId || ""
4034
4220
  }, t.message === "The data channel has been connected." || t.message === "The level has been initialized") return null;
4035
4221
  } catch {
4036
- return U("数据第二步解析失败:", e), null;
4222
+ return G("数据第二步解析失败:", e), null;
4037
4223
  }
4038
4224
  if (this._processEventResponse(t)) return;
4039
4225
  let { command: n, message: r, data: i, status: a, requestId: o } = t;
@@ -4047,7 +4233,7 @@ var Q = {
4047
4233
  });
4048
4234
  return;
4049
4235
  }
4050
- H("注意:非常规响应", t);
4236
+ W("注意:非常规响应", t);
4051
4237
  }
4052
4238
  _registerMarkerCallbacks(e, t) {
4053
4239
  let { onMarkerClick: n, onMarkerDoubleClick: r, onMarkerDblClick: i, onMouseHover: a, onMouseLeave: o, ...s } = t || {}, c = r || i, l = s?.id, u = l != null && l !== "" ? l : "__default";
@@ -4072,18 +4258,18 @@ var Q = {
4072
4258
  return r?.dispatch ? r.dispatch(this, t, n) : !1;
4073
4259
  }
4074
4260
  _executeCallback(e, t, n) {
4075
- if (typeof e != "function") return V(`${t}未监听:${n.eventType}`), !0;
4261
+ if (typeof e != "function") return U(`${t}未监听:${n.eventType}`), !0;
4076
4262
  try {
4077
4263
  return e(n), !0;
4078
4264
  } catch (e) {
4079
- return U(`执行${t}回调出错:`, e, n), !0;
4265
+ return G(`执行${t}回调出错:`, e, n), !0;
4080
4266
  }
4081
4267
  }
4082
4268
  _executeCallbacks(e, t, n) {
4083
4269
  return e ? Array.isArray(e) ? (e.forEach((e) => this._executeCallback(e, t, n)), !0) : this._executeCallback(e, t, n) : !1;
4084
4270
  }
4085
4271
  };
4086
- function Nn(e) {
4272
+ function Vn(e) {
4087
4273
  if (!e) return "";
4088
4274
  try {
4089
4275
  return JSON.parse(String(e).trim())?.message || "";
@@ -4091,7 +4277,7 @@ function Nn(e) {
4091
4277
  return "";
4092
4278
  }
4093
4279
  }
4094
- function Pn(t = {}) {
4280
+ function Hn(t = {}) {
4095
4281
  let { sendText: n, commandTimeout: r = 3e3, onSceneInit: i } = t;
4096
4282
  if (typeof n != "function") throw Error("createGameSession: sendText 必须是函数");
4097
4283
  let a = null, o = !1, s = new $({
@@ -4101,11 +4287,11 @@ function Pn(t = {}) {
4101
4287
  bindMessageHandler(e) {
4102
4288
  a = e;
4103
4289
  }
4104
- }, { timeout: r }), c = new J(s);
4290
+ }, { timeout: r }), c = new V(s);
4105
4291
  function l(e, t) {
4106
- e && a && a(e), !o && Nn(e) === "The level has been initialized" && (o = !0, i ? i(t === void 0 ? e : t) : V("场景初始化加载成功", t === void 0 ? e : t));
4292
+ e && a && a(e), !o && Vn(e) === "The level has been initialized" && (o = !0, i ? i(t === void 0 ? e : t) : U("场景初始化加载成功", t === void 0 ? e : t));
4107
4293
  }
4108
- return V(`插件初始化成功 [web3dlink@${e}]`), {
4294
+ return U(`插件初始化成功 [web3dlink@${e}]`), {
4109
4295
  gameAPI: c,
4110
4296
  commandManager: s,
4111
4297
  handleIncoming: l,
@@ -4114,7 +4300,7 @@ function Pn(t = {}) {
4114
4300
  }
4115
4301
  };
4116
4302
  }
4117
- function Fn(e, t, n) {
4303
+ function Un(e, t, n) {
4118
4304
  if (!(!e || !n)) {
4119
4305
  if (typeof e.off == "function") {
4120
4306
  e.off(t, n);
@@ -4123,10 +4309,10 @@ function Fn(e, t, n) {
4123
4309
  typeof e.removeListener == "function" && e.removeListener(t, n);
4124
4310
  }
4125
4311
  }
4126
- function In(e = []) {
4127
- for (let { target: t, event: n, handler: r } of e) Fn(t, n, r);
4312
+ function Wn(e = []) {
4313
+ for (let { target: t, event: n, handler: r } of e) Un(t, n, r);
4128
4314
  }
4129
4315
  //#endregion
4130
- export { V as a, e as c, J as i, In as n, U as o, $ as r, kn as s, Pn as t };
4316
+ export { G as a, e as c, U as i, Wn as n, zn as o, $ as r, V as s, Hn as t };
4131
4317
 
4132
- //# sourceMappingURL=createGameSession-Ce1m5HFi.js.map
4318
+ //# sourceMappingURL=createGameSession-KuOYqQBS.js.map