@realsee/vreo 3.0.0-webgpu.10 → 4.0.0-react19.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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -119
- package/README.md +6 -0
- package/lib/PlayController/index.js +74 -75
- package/lib/PlayController/index.js.map +1 -1
- package/lib/Player/App.d.ts +2 -1
- package/lib/Player/App.d.ts.map +1 -1
- package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -1
- package/lib/Player/custom/SpatialScenePanel/index.d.ts.map +1 -1
- package/lib/Player/hooks.d.ts.map +1 -1
- package/lib/Player/index.js +1 -1808
- package/lib/Player/modules/Drawer/index.d.ts +2 -1
- package/lib/Player/modules/Drawer/index.d.ts.map +1 -1
- package/lib/Player/modules/PopUp/index.d.ts +2 -1
- package/lib/Player/modules/PopUp/index.d.ts.map +1 -1
- package/lib/Player/modules/ResizeObserver/index.d.ts +2 -1
- package/lib/Player/modules/ResizeObserver/index.d.ts.map +1 -1
- package/lib/Player/modules/VideoAgent/index.d.ts +2 -2
- package/lib/Player/modules/Wave/index.d.ts +2 -1
- package/lib/Player/modules/Wave/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/BgMusic/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/CameraMovement/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/CameraMovement/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/ModelVideo/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/ModelVideo/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/PanoEffect/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/PanoEffect/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/Prompter/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/Prompter/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts.map +1 -1
- package/lib/Player/modules/keyframes/VideoEffect/index.d.ts +2 -1
- package/lib/Player/modules/keyframes/VideoEffect/index.d.ts.map +1 -1
- package/lib/chunks/CSS3DRenderPlugin-CtnLUnu7.js +128 -0
- package/lib/chunks/CSS3DRenderPlugin-CtnLUnu7.js.map +1 -0
- package/lib/chunks/CameraMovementPlugin-YCaScSFU.js +77 -0
- package/lib/chunks/CameraMovementPlugin-YCaScSFU.js.map +1 -0
- package/lib/chunks/Player-BzRqdH4q.js +1581 -0
- package/lib/chunks/Player-BzRqdH4q.js.map +1 -0
- package/lib/chunks/VreoUnit-NhH1hdF1.js +17 -0
- package/lib/chunks/VreoUnit-NhH1hdF1.js.map +1 -0
- package/lib/chunks/timeline-DZs_svT3.js +37 -0
- package/lib/chunks/timeline-DZs_svT3.js.map +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts.map +1 -1
- package/lib/index.js +4 -12
- package/lib/plugins/CSS3DRenderPlugin.js +1 -115
- package/lib/plugins/CameraMovementPlugin.js +1 -6
- package/lib/plugins/ModelTVVideoPlugin.js +133 -161
- package/lib/plugins/ModelTVVideoPlugin.js.map +1 -1
- package/lib/react/index.js +40 -38
- package/lib/react/index.js.map +1 -1
- package/lib/shared-utils/animationFrame/BetterTween.d.ts.map +1 -1
- package/lib/shared-utils/createTransMatrix.d.ts.map +1 -1
- package/lib/types/index.js +1 -10
- package/package.json +8 -8
- package/LICENSE-UPDATE.txt +0 -5
- package/lib/Player/index.js.map +0 -1
- package/lib/chunks/index-BgPSzRSs.js +0 -93
- package/lib/chunks/index-BgPSzRSs.js.map +0 -1
- package/lib/chunks/index-CunyJn6H.js +0 -51
- package/lib/chunks/index-CunyJn6H.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/plugins/CSS3DRenderPlugin.js.map +0 -1
- package/lib/plugins/CameraMovementPlugin.js.map +0 -1
- package/lib/types/index.js.map +0 -1
|
@@ -0,0 +1,1581 @@
|
|
|
1
|
+
import { n as e, t } from "./timeline-DZs_svT3.js";
|
|
2
|
+
import { n, t as r } from "./CameraMovementPlugin-YCaScSFU.js";
|
|
3
|
+
import { n as i, o as a, t as o } from "./VreoUnit-NhH1hdF1.js";
|
|
4
|
+
import { ModelTVVideoPlugin as s } from "../plugins/ModelTVVideoPlugin.js";
|
|
5
|
+
import { t as c } from "./CSS3DRenderPlugin-CtnLUnu7.js";
|
|
6
|
+
import * as l from "react";
|
|
7
|
+
import u, { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
|
|
8
|
+
import { createRoot as h } from "react-dom/client";
|
|
9
|
+
import { Subscribe as g, parseWork as _ } from "@realsee/five-webgpu";
|
|
10
|
+
import v from "classnames";
|
|
11
|
+
import { observer as y } from "mobx-react-lite";
|
|
12
|
+
import { action as b, makeObservable as x, observable as S, observableRef as C, reaction as w, runInAction as T } from "mobx";
|
|
13
|
+
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
14
|
+
import * as k from "three/webgpu";
|
|
15
|
+
import { OrthographicCamera as ee, Quaternion as te, Raycaster as ne, Scene as re, Vector3 as A, WebGPURenderer as ie } from "three/webgpu";
|
|
16
|
+
import { Line2 as ae } from "three/addons/lines/webgpu/Line2.js";
|
|
17
|
+
import { LineGeometry as oe } from "three/addons/lines/LineGeometry.js";
|
|
18
|
+
import * as j from "@tweenjs/tween.js";
|
|
19
|
+
import { PanoTagPlugin as se } from "@realsee/dnalogel/plugins/pano-tag";
|
|
20
|
+
import { float as ce, max as le, smoothstep as ue, texture as de, uniform as fe, uv as pe } from "three/tsl";
|
|
21
|
+
// resources/Player/PlaybackLifecycle.ts
|
|
22
|
+
var me = class {
|
|
23
|
+
onStop;
|
|
24
|
+
controller;
|
|
25
|
+
run;
|
|
26
|
+
generation = 0;
|
|
27
|
+
disposed = !1;
|
|
28
|
+
members = /* @__PURE__ */ new Set();
|
|
29
|
+
constructor(e, t) {
|
|
30
|
+
this.onStop = t, this.controller = e?.createController({
|
|
31
|
+
label: "vreo",
|
|
32
|
+
onCancel: () => this.stop()
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
get active() {
|
|
36
|
+
return !!this.run?.valid();
|
|
37
|
+
}
|
|
38
|
+
capture() {
|
|
39
|
+
return this.run;
|
|
40
|
+
}
|
|
41
|
+
begin(e) {
|
|
42
|
+
if (this.disposed) return !1;
|
|
43
|
+
if (this.active) return !0;
|
|
44
|
+
let t = this.controller?.begin({
|
|
45
|
+
userAction: e,
|
|
46
|
+
audible: !0
|
|
47
|
+
}) ?? void 0;
|
|
48
|
+
if (this.controller && !t) return !1;
|
|
49
|
+
let n = ++this.generation, r = t?.mediaManager;
|
|
50
|
+
return this.run = {
|
|
51
|
+
session: t,
|
|
52
|
+
mediaManager: r,
|
|
53
|
+
valid: () => n === this.generation && !this.disposed && !t?.signal.aborted,
|
|
54
|
+
bind: (e) => t ? t.bind(e) : e
|
|
55
|
+
}, !0;
|
|
56
|
+
}
|
|
57
|
+
add(e) {
|
|
58
|
+
return this.members.add(e), () => {
|
|
59
|
+
this.members.delete(e);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
stop() {
|
|
63
|
+
++this.generation, this.run = void 0;
|
|
64
|
+
let e = [];
|
|
65
|
+
try {
|
|
66
|
+
this.onStop();
|
|
67
|
+
} catch (t) {
|
|
68
|
+
e.push(t);
|
|
69
|
+
}
|
|
70
|
+
for (let t of [...this.members]) try {
|
|
71
|
+
t();
|
|
72
|
+
} catch (t) {
|
|
73
|
+
e.push(t);
|
|
74
|
+
}
|
|
75
|
+
if (e.length) throw e[0];
|
|
76
|
+
}
|
|
77
|
+
cancel() {
|
|
78
|
+
let e = this.generation;
|
|
79
|
+
this.controller?.cancel(), e === this.generation && this.stop();
|
|
80
|
+
}
|
|
81
|
+
finish() {
|
|
82
|
+
let e = this.run?.session;
|
|
83
|
+
this.stop(), e?.finish();
|
|
84
|
+
}
|
|
85
|
+
dispose() {
|
|
86
|
+
if (this.disposed) return;
|
|
87
|
+
this.disposed = !0;
|
|
88
|
+
let e = this.generation;
|
|
89
|
+
this.controller?.dispose(), e === this.generation && this.stop(), this.members.clear();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
// resources/shared-utils/setElementDataset.ts
|
|
93
|
+
function M(e, t) {
|
|
94
|
+
e && Object.keys(t).forEach((n) => {
|
|
95
|
+
let r = t[n].toString();
|
|
96
|
+
e instanceof Element ? e.setAttribute(`data-${n}`, r) : e instanceof Document ? e.documentElement.setAttribute(`data-${n}`, r) : e instanceof HTMLElement ? e.dataset[n] = r : e.setAttribute(`data-${n}`, r);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// resources/shared-utils/getFileExpandedName.ts
|
|
100
|
+
function he(e) {
|
|
101
|
+
if (!e) return "";
|
|
102
|
+
let t = e.lastIndexOf(".");
|
|
103
|
+
return e.substring(t + 1).toLowerCase();
|
|
104
|
+
}
|
|
105
|
+
// resources/shared-utils/getMediaInfo.ts
|
|
106
|
+
function N(e) {
|
|
107
|
+
return ge(he(e));
|
|
108
|
+
}
|
|
109
|
+
function ge(e) {
|
|
110
|
+
return e ? /jpg|jpeg|png$/.test(e) ? "image" : /mp3|wav$/.test(e) ? "audio" : /avi|wmv|mpeg|mp4|m4v|mov|asf|flv|f4v|rmvb|rm|3gp|vob$/.test(e) ? "video" : "unknown" : "unknown";
|
|
111
|
+
}
|
|
112
|
+
// resources/Player/Controller.ts
|
|
113
|
+
var _e = class extends g {
|
|
114
|
+
five;
|
|
115
|
+
configs;
|
|
116
|
+
videoAgentScene;
|
|
117
|
+
vreoUnit;
|
|
118
|
+
stopInterval;
|
|
119
|
+
playing = !1;
|
|
120
|
+
ended = !1;
|
|
121
|
+
loading = !1;
|
|
122
|
+
containerSize = {
|
|
123
|
+
width: 0,
|
|
124
|
+
height: 0
|
|
125
|
+
};
|
|
126
|
+
appSize;
|
|
127
|
+
container;
|
|
128
|
+
waveAppearance = null;
|
|
129
|
+
appearance = { waveStyle: "wave" };
|
|
130
|
+
avatar = {};
|
|
131
|
+
waitingForBgMusic = !1;
|
|
132
|
+
visible = !1;
|
|
133
|
+
get agentType() {
|
|
134
|
+
let e = N(this.videoAgentScene?.videoAgentMesh.videoUrl);
|
|
135
|
+
return this.avatar?.force ? "avatar" : e === "video" ? "video" : "none";
|
|
136
|
+
}
|
|
137
|
+
popUp = null;
|
|
138
|
+
openPopUp(e) {
|
|
139
|
+
this.popUp = e || null;
|
|
140
|
+
}
|
|
141
|
+
setLoading(e) {
|
|
142
|
+
this.loading = e;
|
|
143
|
+
}
|
|
144
|
+
drawerConfig = null;
|
|
145
|
+
setAvatar(e) {
|
|
146
|
+
this.avatar = e;
|
|
147
|
+
}
|
|
148
|
+
setContainerSize(e, t) {
|
|
149
|
+
this.containerSize = {
|
|
150
|
+
width: e,
|
|
151
|
+
height: t
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
setVisible(e) {
|
|
155
|
+
this.visible = e;
|
|
156
|
+
}
|
|
157
|
+
setPlaying(e) {
|
|
158
|
+
(!e || this.playback.active) && (this.playing = e, e && this.resumeMedia());
|
|
159
|
+
}
|
|
160
|
+
setEnded(e) {
|
|
161
|
+
this.ended = e;
|
|
162
|
+
}
|
|
163
|
+
setWaitingForBgMusic(e) {
|
|
164
|
+
this.waitingForBgMusic = e;
|
|
165
|
+
}
|
|
166
|
+
setAppearance(e) {
|
|
167
|
+
this.appearance = {
|
|
168
|
+
...this.appearance,
|
|
169
|
+
...e
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
openDrawer(e) {
|
|
173
|
+
this.drawerConfig = e || {
|
|
174
|
+
content: "",
|
|
175
|
+
height: this.drawerConfig?.height
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
resumeGeneration = 0;
|
|
179
|
+
resuming;
|
|
180
|
+
disposers = [];
|
|
181
|
+
playback;
|
|
182
|
+
timeline = new t();
|
|
183
|
+
constructor({ five: e, container: t, configs: n }) {
|
|
184
|
+
super(), this.playback = new me(n.mediaManager, () => {
|
|
185
|
+
this.resuming = void 0, ++this.resumeGeneration, this.setPlaying(!1), this.videoAgentScene?.videoAgentMesh.stop(), this.setWaitingForBgMusic(!1);
|
|
186
|
+
}), this.configs = n, this.container = t, this.five = e, this.appSize = n.appSize, this.appearance = {
|
|
187
|
+
...this.appearance,
|
|
188
|
+
...n.appearance
|
|
189
|
+
}, x(this, {
|
|
190
|
+
visible: S,
|
|
191
|
+
setVisible: b,
|
|
192
|
+
playing: S,
|
|
193
|
+
setPlaying: b,
|
|
194
|
+
loading: S,
|
|
195
|
+
videoAgentScene: C,
|
|
196
|
+
setLoading: b,
|
|
197
|
+
popUp: C,
|
|
198
|
+
openPopUp: b,
|
|
199
|
+
drawerConfig: C,
|
|
200
|
+
openDrawer: b,
|
|
201
|
+
ended: S,
|
|
202
|
+
waveAppearance: S,
|
|
203
|
+
avatar: S,
|
|
204
|
+
containerSize: S,
|
|
205
|
+
setContainerSize: b,
|
|
206
|
+
appearance: S,
|
|
207
|
+
setAppearance: b,
|
|
208
|
+
configs: C,
|
|
209
|
+
setEnded: b,
|
|
210
|
+
setAvatar: b,
|
|
211
|
+
waitingForBgMusic: S,
|
|
212
|
+
setWaitingForBgMusic: b
|
|
213
|
+
}), this.disposers.push(w(() => [this.appearance.waveStyle, this.loading], ([e, t]) => {
|
|
214
|
+
if (t === null) this.waveAppearance = null;
|
|
215
|
+
else if (e === "wave") switch (t) {
|
|
216
|
+
case !0:
|
|
217
|
+
this.waveAppearance = "double";
|
|
218
|
+
break;
|
|
219
|
+
case !1: this.waveAppearance = "solid";
|
|
220
|
+
}
|
|
221
|
+
else if (e === "solid") switch (t) {
|
|
222
|
+
case !0:
|
|
223
|
+
this.waveAppearance = "swap";
|
|
224
|
+
break;
|
|
225
|
+
case !1: this.waveAppearance = "expand";
|
|
226
|
+
}
|
|
227
|
+
}, { fireImmediately: !0 })), this.appSize ? M(this.container, { size: this.appSize }) : this.disposers.push(w(() => this.containerSize, (e) => {
|
|
228
|
+
if (!e?.width) return;
|
|
229
|
+
let t = e.width, n = e.height, r = t <= 500 ? "S" : t <= 1024 ? "M" : t <= 2048 ? "L" : "XL", i = n > t ? "portrait" : "landscape";
|
|
230
|
+
M(this.container, { size: r }), M(this.container, { orientation: i });
|
|
231
|
+
}, { fireImmediately: !0 })), this.disposers.push(w(() => this.ended, (e) => {
|
|
232
|
+
e && this.emit("paused", !0);
|
|
233
|
+
})), this.disposers.push(w(() => this.playing, (e) => {
|
|
234
|
+
this.ended || this.emit(e ? "playing" : "paused");
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
get ready() {
|
|
238
|
+
return !!this.videoAgentScene;
|
|
239
|
+
}
|
|
240
|
+
get currentTime() {
|
|
241
|
+
return this.videoAgentScene?.videoAgentMesh.currentTime || 0;
|
|
242
|
+
}
|
|
243
|
+
loadTimeline(e) {
|
|
244
|
+
this.timeline.load(e);
|
|
245
|
+
}
|
|
246
|
+
seekTimeline(e) {
|
|
247
|
+
this.timeline.seek(e);
|
|
248
|
+
}
|
|
249
|
+
resetTimeline(e) {
|
|
250
|
+
this.timeline.reset(e);
|
|
251
|
+
}
|
|
252
|
+
get currentKeyframes() {
|
|
253
|
+
return this.timeline.pendingAt(this.currentTime);
|
|
254
|
+
}
|
|
255
|
+
get mediaInstance() {
|
|
256
|
+
return this.videoAgentScene?.videoAgentMesh.mediaInstance;
|
|
257
|
+
}
|
|
258
|
+
requestAnimationFrameLoop(e) {
|
|
259
|
+
if (this.waitingForBgMusic) {
|
|
260
|
+
this.mediaInstance?.paused || this.videoAgentScene?.videoAgentMesh.mediaOperations?.pause();
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (this.mediaInstance?.ended && this.mediaInstance.currentTime !== 0) {
|
|
264
|
+
if (this.ended) return;
|
|
265
|
+
this.timeline.reset();
|
|
266
|
+
let e = this.videoAgentScene?.videoAgentMesh.mediaOperations;
|
|
267
|
+
e?.pause(), e && (e.currentTime = 0), this.playback.finish(), this.setEnded(!0), this.setPlaying(!1);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (!this.playing) {
|
|
271
|
+
this.mediaInstance?.paused || this.videoAgentScene?.videoAgentMesh.mediaOperations?.pause();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
this.resumeMedia();
|
|
275
|
+
let t = this.playback.capture();
|
|
276
|
+
if (!t?.valid()) return;
|
|
277
|
+
let n = this.currentTime;
|
|
278
|
+
this.timeline.take(n).forEach((r) => {
|
|
279
|
+
this.emit(r.type, r, n), t.valid() && e(r.type, r, n);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
resumeMedia() {
|
|
283
|
+
if (!this.waitingForBgMusic && this.mediaInstance?.paused && this.playing && !this.resuming) {
|
|
284
|
+
let e = ++this.resumeGeneration;
|
|
285
|
+
this.resuming = e;
|
|
286
|
+
let t = this.playback.capture(), n = () => !!t?.valid();
|
|
287
|
+
this.videoAgentScene?.videoAgentMesh.play().catch((e) => {
|
|
288
|
+
n() && (this.playback.cancel(), console.error(e));
|
|
289
|
+
}).finally(() => {
|
|
290
|
+
this.resuming === e && (this.resuming = void 0);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
run(t) {
|
|
295
|
+
this.stopInterval ||= e(() => this.requestAnimationFrameLoop(t));
|
|
296
|
+
}
|
|
297
|
+
clear() {
|
|
298
|
+
this.setPlaying(!1), this.timeline.reset(), this.vreoUnit = void 0, this.timeline.clear(), this.mediaInstance && (this.videoAgentScene?.videoAgentMesh.mediaOperations?.pause(), this.videoAgentScene?.videoAgentMesh.mediaOperations && (this.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = 0)), this.stopInterval?.(), this.stopInterval = void 0;
|
|
299
|
+
}
|
|
300
|
+
dispose() {
|
|
301
|
+
this.disposers.splice(0).forEach((e) => e()), this.playback.dispose(), this.clear();
|
|
302
|
+
}
|
|
303
|
+
}, P = l.createContext(null);
|
|
304
|
+
// resources/Player/hooks.ts
|
|
305
|
+
function F() {
|
|
306
|
+
let e = u.useContext(P);
|
|
307
|
+
if (!e) throw Error("没有找到 \"ControllerContext\"");
|
|
308
|
+
return e;
|
|
309
|
+
}
|
|
310
|
+
function I() {
|
|
311
|
+
let e = F();
|
|
312
|
+
if (!e.five) throw Error("没有找到 \"five\" 实例");
|
|
313
|
+
return e.five;
|
|
314
|
+
}
|
|
315
|
+
function ve() {
|
|
316
|
+
let e = I();
|
|
317
|
+
return (t) => e.project2d(t, !1);
|
|
318
|
+
}
|
|
319
|
+
// resources/Player/modules/keyframes/CameraMovement/index.tsx
|
|
320
|
+
function ye() {
|
|
321
|
+
let e = F(), t = I(), i = l.useRef(void 0);
|
|
322
|
+
return l.useEffect(() => {
|
|
323
|
+
let o = async (e) => {
|
|
324
|
+
i.current ||= r(t, {});
|
|
325
|
+
let { start: a, end: o, data: s } = e, c = s, l = c.effect;
|
|
326
|
+
l === n.Rotate ? await i.current.rotate(s, o - a) : l === n.Move || c.panoIndex !== void 0 && c.panoIndex !== t.panoIndex ? await i.current.move(s, o - a) : await i.current.rotate(s, o - a);
|
|
327
|
+
};
|
|
328
|
+
return e.on(a.CameraMovement, o), () => {
|
|
329
|
+
e.off(a.CameraMovement, o);
|
|
330
|
+
};
|
|
331
|
+
}, [e]), /* @__PURE__ */ D(E, {});
|
|
332
|
+
}
|
|
333
|
+
// resources/shared-utils/addResizeListener.ts
|
|
334
|
+
var L = /* @__PURE__ */ new Map();
|
|
335
|
+
function R(e) {
|
|
336
|
+
L.set(e, (L.get(e) ?? 0) + 1);
|
|
337
|
+
}
|
|
338
|
+
function z(e) {
|
|
339
|
+
let t = (L.get(e) ?? 1) - 1;
|
|
340
|
+
t > 0 ? L.set(e, t) : L.delete(e);
|
|
341
|
+
}
|
|
342
|
+
function B(e, t, n = !0) {
|
|
343
|
+
if (!e) return () => {};
|
|
344
|
+
n && t(e.clientWidth, e.clientHeight);
|
|
345
|
+
let r = !1;
|
|
346
|
+
if (typeof ResizeObserver < "u") {
|
|
347
|
+
let n = new ResizeObserver(() => t(e.clientWidth, e.clientHeight));
|
|
348
|
+
return n.observe(e), R(e), () => {
|
|
349
|
+
r || (r = !0, n.disconnect(), z(e));
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
let i = document.createElement("iframe");
|
|
353
|
+
i.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;opacity:0;visibility:hidden;margin:0;border:0;padding:0;z-index:-1;", i.classList.add("resize-sensor-iframe"), e.appendChild(i);
|
|
354
|
+
let a = i.contentWindow;
|
|
355
|
+
if (!a) return i.remove(), () => {};
|
|
356
|
+
let o = () => t(i.clientWidth, i.clientHeight);
|
|
357
|
+
return a.addEventListener("resize", o), R(e), () => {
|
|
358
|
+
r || (r = !0, a.removeEventListener("resize", o), i.remove(), z(e));
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function be(e) {
|
|
362
|
+
return !!e && (L.get(e) ?? 0) > 0;
|
|
363
|
+
}
|
|
364
|
+
// resources/Player/modules/ResizeObserver/index.tsx
|
|
365
|
+
function xe() {
|
|
366
|
+
let e = u.useRef(null), t = F();
|
|
367
|
+
return u.useEffect(() => {
|
|
368
|
+
if (!e.current) return;
|
|
369
|
+
let n = t.container.parentElement;
|
|
370
|
+
if (be(n)) return;
|
|
371
|
+
let r = B(n, (e, n) => {
|
|
372
|
+
t.setContainerSize(e, n);
|
|
373
|
+
});
|
|
374
|
+
return () => {
|
|
375
|
+
r();
|
|
376
|
+
};
|
|
377
|
+
}, []), /* @__PURE__ */ D("div", {
|
|
378
|
+
className: "resizeObserver-element",
|
|
379
|
+
ref: e
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
// resources/Player/modules/keyframes/InfoPanel/index.tsx
|
|
383
|
+
function V({ url: e, children: t }) {
|
|
384
|
+
return /* @__PURE__ */ D("div", {
|
|
385
|
+
className: "vreo-infoPanel-container",
|
|
386
|
+
children: /* @__PURE__ */ O("div", {
|
|
387
|
+
className: "vreo-infoPanel",
|
|
388
|
+
children: [t, /* @__PURE__ */ D("img", { src: e })]
|
|
389
|
+
})
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function H({ url: e, children: t }) {
|
|
393
|
+
let n = l.useRef(null), r = F();
|
|
394
|
+
return l.useEffect(() => {
|
|
395
|
+
let t = r.configs?.videos?.videoPanel || document.createElement("video"), i = r.playback.capture(), a = () => !!i?.valid();
|
|
396
|
+
if (!i?.valid()) return;
|
|
397
|
+
let o = i.bind(t), s = !1;
|
|
398
|
+
t.playsInline = !0, o.muted = !0;
|
|
399
|
+
let c = () => {
|
|
400
|
+
s = !0, o.muted = !0, o.pause(), t.removeEventListener("canplaythrough", u);
|
|
401
|
+
};
|
|
402
|
+
if (!n.current) return;
|
|
403
|
+
let l = r.playback.add(c);
|
|
404
|
+
o.src = e, n.current.contains(t) || n.current.appendChild(t);
|
|
405
|
+
let u = () => {
|
|
406
|
+
t.removeEventListener("canplaythrough", u), !s && a() && (o.muted = !1, o.play().catch((e) => {
|
|
407
|
+
a() && !s && (c(), r.playback.cancel(), console.error(e));
|
|
408
|
+
}));
|
|
409
|
+
};
|
|
410
|
+
return t.addEventListener("canplaythrough", u), o.load(), () => {
|
|
411
|
+
c(), l(), n.current?.contains(t) && n.current.removeChild(t);
|
|
412
|
+
};
|
|
413
|
+
}, [r, e]), /* @__PURE__ */ D("div", {
|
|
414
|
+
className: "vreo-infoPanel-container",
|
|
415
|
+
children: /* @__PURE__ */ O("div", {
|
|
416
|
+
className: "vreo-infoPanel",
|
|
417
|
+
children: [t, /* @__PURE__ */ D("div", {
|
|
418
|
+
className: "vreo-infoPanel-inner",
|
|
419
|
+
ref: n
|
|
420
|
+
})]
|
|
421
|
+
})
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
var U = (e) => !e.title && !e.subTitle ? null : /* @__PURE__ */ D(E, { children: /* @__PURE__ */ O("div", {
|
|
425
|
+
className: "vreo-infoPanel-title",
|
|
426
|
+
children: [/* @__PURE__ */ D("div", {
|
|
427
|
+
className: "vreo-infoPanel-t1",
|
|
428
|
+
children: e.title
|
|
429
|
+
}), /* @__PURE__ */ D("div", {
|
|
430
|
+
className: "vreo-infoPanel-t2",
|
|
431
|
+
children: e.subTitle
|
|
432
|
+
})]
|
|
433
|
+
}) });
|
|
434
|
+
function Se() {
|
|
435
|
+
let e = l.useRef(null), t = F();
|
|
436
|
+
return l.useEffect(() => {
|
|
437
|
+
if (t.configs?.keyframeMap.InfoPanel === !1) return;
|
|
438
|
+
let n = (n) => {
|
|
439
|
+
let { start: r, end: a, data: s } = n, c = s, { title: l, subTitle: u, style: d } = c;
|
|
440
|
+
do
|
|
441
|
+
d === o.PopUp ? c.type === i.Image ? t.openPopUp(/* @__PURE__ */ D(V, {
|
|
442
|
+
url: c.url,
|
|
443
|
+
children: /* @__PURE__ */ D(U, {
|
|
444
|
+
title: l,
|
|
445
|
+
subTitle: u
|
|
446
|
+
})
|
|
447
|
+
})) : c.type === i.Video && t.openPopUp(/* @__PURE__ */ D(H, {
|
|
448
|
+
url: c.url,
|
|
449
|
+
children: /* @__PURE__ */ D(U, {
|
|
450
|
+
title: l,
|
|
451
|
+
subTitle: u
|
|
452
|
+
})
|
|
453
|
+
})) : c.type === i.Image ? t.openDrawer({
|
|
454
|
+
content: /* @__PURE__ */ D(V, {
|
|
455
|
+
url: c.url,
|
|
456
|
+
children: /* @__PURE__ */ D(U, {
|
|
457
|
+
title: l,
|
|
458
|
+
subTitle: u
|
|
459
|
+
})
|
|
460
|
+
}),
|
|
461
|
+
height: "60vh"
|
|
462
|
+
}) : c.type === i.Video && t.openDrawer({
|
|
463
|
+
content: /* @__PURE__ */ D(H, {
|
|
464
|
+
url: c.url,
|
|
465
|
+
children: /* @__PURE__ */ D(U, {
|
|
466
|
+
title: l,
|
|
467
|
+
subTitle: u
|
|
468
|
+
})
|
|
469
|
+
}),
|
|
470
|
+
height: "60vh"
|
|
471
|
+
});
|
|
472
|
+
while (0);
|
|
473
|
+
e.current = setTimeout(() => {
|
|
474
|
+
t.openDrawer(!1), t.openPopUp(!1);
|
|
475
|
+
}, a - r);
|
|
476
|
+
};
|
|
477
|
+
t.on(a.InfoPanel, n);
|
|
478
|
+
let r = () => {
|
|
479
|
+
e.current && clearTimeout(e.current), t.openDrawer(!1), t.openPopUp(!1);
|
|
480
|
+
}, s = t.playback.add(r);
|
|
481
|
+
return () => {
|
|
482
|
+
s(), r(), t.off(a.InfoPanel, n), e.current && clearTimeout(e.current);
|
|
483
|
+
};
|
|
484
|
+
}, [t]), /* @__PURE__ */ D(E, {});
|
|
485
|
+
}
|
|
486
|
+
// resources/shared-utils/createTransMatrix.ts
|
|
487
|
+
function Ce(e) {
|
|
488
|
+
let t = new k.Matrix4();
|
|
489
|
+
return t.fromArray(e), (e) => {
|
|
490
|
+
let n = new k.Vector3(...e);
|
|
491
|
+
return n.applyMatrix4(t), n.toArray();
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
// resources/Player/modules/keyframes/ModelVideo/index.tsx
|
|
495
|
+
function we() {
|
|
496
|
+
let e = F(), t = I(), n = l.useRef(void 0), r = l.useRef(null);
|
|
497
|
+
return l.useEffect(() => {
|
|
498
|
+
let i = 0, o = () => {
|
|
499
|
+
++i, r.current && clearTimeout(r.current), n.current?.dispose(), n.current = void 0;
|
|
500
|
+
}, c = e.playback.add(o), l = async (a) => {
|
|
501
|
+
o();
|
|
502
|
+
let c = i, l = e.playback.capture(), u = () => !!l?.valid();
|
|
503
|
+
if (!u()) return;
|
|
504
|
+
let d = n.current = s(t, { mediaManager: l?.mediaManager }), { start: f, end: p } = a, { videoSrc: m, videoPosterSrc: h, vertexs: g, matrixWorld: _ } = a.data, v = (() => {
|
|
505
|
+
if (g.length < 4) throw Error("ModelVideo: 顶点数据集合不够,无法组成矩形 ....");
|
|
506
|
+
if (g.length === 4) return g;
|
|
507
|
+
let e = new k.Box3();
|
|
508
|
+
return g.forEach((t) => e.expandByPoint(new k.Vector3(t.x, t.y, t.z))), [
|
|
509
|
+
new k.Vector3(e.min.x, e.max.y, e.max.z),
|
|
510
|
+
new k.Vector3(e.min.x, e.min.y, e.max.z),
|
|
511
|
+
new k.Vector3(e.max.x, e.min.y, e.max.z),
|
|
512
|
+
new k.Vector3(e.max.x, e.max.y, e.max.z)
|
|
513
|
+
];
|
|
514
|
+
})(), y = (() => {
|
|
515
|
+
if (_) {
|
|
516
|
+
let e = Ce(_);
|
|
517
|
+
return [v.map((t) => {
|
|
518
|
+
let n = e([
|
|
519
|
+
t.x,
|
|
520
|
+
t.y,
|
|
521
|
+
t.z
|
|
522
|
+
]);
|
|
523
|
+
return {
|
|
524
|
+
x: n[0],
|
|
525
|
+
y: n[1],
|
|
526
|
+
z: n[2]
|
|
527
|
+
};
|
|
528
|
+
})];
|
|
529
|
+
}
|
|
530
|
+
return [v];
|
|
531
|
+
})();
|
|
532
|
+
d.disable();
|
|
533
|
+
try {
|
|
534
|
+
await d.load({
|
|
535
|
+
video_src: m,
|
|
536
|
+
video_poster_src: h,
|
|
537
|
+
points: y
|
|
538
|
+
}, e.configs?.videos?.modelTVVideo);
|
|
539
|
+
} catch (t) {
|
|
540
|
+
c === i && u() && (e.playback.cancel(), console.error(t));
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
c === i && u() && (d.enable(), r.current = setTimeout(o, p - f));
|
|
544
|
+
};
|
|
545
|
+
return e.on(a.ModelVideo, l), () => {
|
|
546
|
+
o(), c(), n.current?.dispose(), n.current = void 0, e.off(a.ModelVideo, l), r.current && clearTimeout(r.current);
|
|
547
|
+
};
|
|
548
|
+
}, [e]), /* @__PURE__ */ D(E, {});
|
|
549
|
+
}
|
|
550
|
+
// resources/shared-utils/animationFrame/BetterTween.ts
|
|
551
|
+
var Te = class extends j.Tween {
|
|
552
|
+
disposeMethods = [];
|
|
553
|
+
animationFrameDisposer;
|
|
554
|
+
onDispose = (e) => (this.disposeMethods.push(e), this);
|
|
555
|
+
play = () => (this.start(), this.animationFrameDisposer = e(() => this.update()), this);
|
|
556
|
+
dispose = () => {
|
|
557
|
+
this.stop(), this.animationFrameDisposer?.(), this.disposeMethods.forEach((e) => e()), this.disposeMethods = [], j.remove(this);
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
function W(e, t = j.Easing.Linear.None) {
|
|
561
|
+
let n = new Te({ progress: 0 }).to({ progress: 1 });
|
|
562
|
+
return e !== void 0 && n.duration(e), t !== void 0 && n.easing(t), n;
|
|
563
|
+
}
|
|
564
|
+
// resources/Player/modules/keyframes/PanoEffect/lineAnime.ts
|
|
565
|
+
function Ee(e, t, n) {
|
|
566
|
+
let r = new k.TextureLoader().load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg=="), i = new oe(), a = new k.Line2NodeMaterial({
|
|
567
|
+
color: 16777215,
|
|
568
|
+
linewidth: 2,
|
|
569
|
+
depthTest: !1
|
|
570
|
+
}), o = new ae(i, a), s = new k.BufferGeometry(), c = new k.PointsNodeMaterial({
|
|
571
|
+
color: 16777215,
|
|
572
|
+
map: r,
|
|
573
|
+
transparent: !0
|
|
574
|
+
}), l = new k.Points(s, c), u = new k.Group();
|
|
575
|
+
u.add(o, l);
|
|
576
|
+
let d = (e, t) => {
|
|
577
|
+
let n = [...e.toArray(), ...t.toArray()];
|
|
578
|
+
i.setPositions(n), s.setAttribute("position", new k.Float32BufferAttribute(n, 3));
|
|
579
|
+
};
|
|
580
|
+
return d(t, n), W().onUpdate(({ progress: r }) => {
|
|
581
|
+
d(t.clone().lerp(n, .5 - r / 2), t.clone().lerp(n, .5 + r / 2)), e.needsRender = !0;
|
|
582
|
+
}).onStart(() => e.scene.add(u)).onDispose(() => {
|
|
583
|
+
e.scene.remove(u), i.dispose(), a.dispose(), s.dispose(), c.dispose(), r.dispose(), e.needsRender = !0;
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
// resources/Player/modules/keyframes/PanoEffect/index.tsx
|
|
587
|
+
function De() {
|
|
588
|
+
let [e, t] = l.useState(null), n = I(), r = l.useRef(null), [i, o] = l.useState(null), s = l.useRef(null), c = F(), u = ve(), d = () => {
|
|
589
|
+
r.current && r.current.dispose();
|
|
590
|
+
};
|
|
591
|
+
return l.useEffect(() => {
|
|
592
|
+
let e = (e) => {
|
|
593
|
+
let { start: i, end: a, data: c } = e, [l, f] = c.twoVertexs, p = new A(l.x, l.y, l.z), m = new A(f.x, f.y, f.z);
|
|
594
|
+
r.current = Ee(n, p.clone(), m.clone()), r.current.play();
|
|
595
|
+
let h = p.lerp(m, .5), g = p.distanceTo(m), _ = u(h);
|
|
596
|
+
if (!_) return;
|
|
597
|
+
let { x: v, y } = _;
|
|
598
|
+
t({
|
|
599
|
+
center: h,
|
|
600
|
+
distance: g
|
|
601
|
+
}), o({
|
|
602
|
+
left: v,
|
|
603
|
+
top: y
|
|
604
|
+
}), s.current = setTimeout(() => {
|
|
605
|
+
t(null), o(null), d();
|
|
606
|
+
}, a - i);
|
|
607
|
+
};
|
|
608
|
+
return c.on(a.PanoEffect, e), () => {
|
|
609
|
+
c.off(a.PanoEffect, e), s.current && clearTimeout(s.current), d();
|
|
610
|
+
};
|
|
611
|
+
}, [c]), l.useEffect(() => {
|
|
612
|
+
let t = () => {
|
|
613
|
+
if (!e?.center) return;
|
|
614
|
+
let { x: t, y: n, z: r } = e.center, i = u(new A(t, n, r));
|
|
615
|
+
if (!i) return;
|
|
616
|
+
let { x: a, y: s } = i;
|
|
617
|
+
o({
|
|
618
|
+
left: a,
|
|
619
|
+
top: s
|
|
620
|
+
});
|
|
621
|
+
};
|
|
622
|
+
return n.on("currentStateChange", t), () => {
|
|
623
|
+
n.off("currentStateChange", t);
|
|
624
|
+
};
|
|
625
|
+
}, [e?.center]), /* @__PURE__ */ D(E, { children: /* @__PURE__ */ D("div", {
|
|
626
|
+
className: v("PanoEffect", { "PanoEffect--notHidden": e }),
|
|
627
|
+
style: {
|
|
628
|
+
left: (i?.left || 0) + "px",
|
|
629
|
+
top: (i?.top || 0) + "px"
|
|
630
|
+
},
|
|
631
|
+
children: e?.distance.toFixed(4) + "m"
|
|
632
|
+
}) });
|
|
633
|
+
}
|
|
634
|
+
// resources/Player/modules/keyframes/PanoTag/index.tsx
|
|
635
|
+
function Oe() {
|
|
636
|
+
let e = F(), t = I();
|
|
637
|
+
return l.useEffect(() => {
|
|
638
|
+
if (e.configs?.keyframeMap.PanoTag === !1) return;
|
|
639
|
+
let n = se(t, { config: { globalConfig: {
|
|
640
|
+
visibleConfig: { keep: "visible" },
|
|
641
|
+
unfoldedConfig: {
|
|
642
|
+
autoUnfold: !1,
|
|
643
|
+
unfoldDistance: { max: 100 }
|
|
644
|
+
}
|
|
645
|
+
} } }), r, i = !1, o = 0, s = (e) => {
|
|
646
|
+
e.released || (e.released = !0, e.timer !== void 0 && clearTimeout(e.timer), r === e && (r = void 0), n.destroyTagById(e.id));
|
|
647
|
+
}, c = () => {
|
|
648
|
+
r && s(r);
|
|
649
|
+
}, l = e.playback.add(c), u = (t, a = t.start) => {
|
|
650
|
+
let l = e.playback.capture();
|
|
651
|
+
if (i || !l?.valid()) return;
|
|
652
|
+
c();
|
|
653
|
+
let { end: u, data: d } = t, f = d;
|
|
654
|
+
o = Math.max(Date.now(), o + 1);
|
|
655
|
+
let p = o.toString(), m = [
|
|
656
|
+
f.vertex.x,
|
|
657
|
+
f.vertex.y,
|
|
658
|
+
f.vertex.z
|
|
659
|
+
], h = f.imgUrl ? {
|
|
660
|
+
id: p,
|
|
661
|
+
position: m,
|
|
662
|
+
contentType: "ImageText",
|
|
663
|
+
stickType: "2DPoint",
|
|
664
|
+
data: {
|
|
665
|
+
title: f.text,
|
|
666
|
+
mediaData: [{
|
|
667
|
+
type: "Image",
|
|
668
|
+
url: f.imgUrl
|
|
669
|
+
}]
|
|
670
|
+
}
|
|
671
|
+
} : {
|
|
672
|
+
id: p,
|
|
673
|
+
position: m,
|
|
674
|
+
contentType: "Text",
|
|
675
|
+
stickType: "2DPoint",
|
|
676
|
+
data: { title: f.text }
|
|
677
|
+
}, g = {
|
|
678
|
+
id: p,
|
|
679
|
+
released: !1,
|
|
680
|
+
expired: !1
|
|
681
|
+
};
|
|
682
|
+
r = g, g.timer = setTimeout(() => {
|
|
683
|
+
if (!g.released) {
|
|
684
|
+
if (i || !l.valid()) return s(g);
|
|
685
|
+
g.expired = !0, n.getTagById(p)?.fold(), g.timer = setTimeout(() => s(g), 1500);
|
|
686
|
+
}
|
|
687
|
+
}, Math.max(0, u - a)), n.load({ tagList: [h] }).then(() => {
|
|
688
|
+
if (i || g.released || g.expired || r !== g || !l.valid()) {
|
|
689
|
+
s(g);
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
let e = n.getTagById(p);
|
|
693
|
+
if (!e) return s(g);
|
|
694
|
+
e.setMediaManager(l.mediaManager), e.unfold();
|
|
695
|
+
}).catch((e) => {
|
|
696
|
+
s(g), console.error("Vreo PanoTag failed to load", e);
|
|
697
|
+
});
|
|
698
|
+
};
|
|
699
|
+
return e.on(a.PanoTag, u), () => {
|
|
700
|
+
i = !0, e.off(a.PanoTag, u), l(), c(), n.dispose();
|
|
701
|
+
};
|
|
702
|
+
}, [e]), null;
|
|
703
|
+
}
|
|
704
|
+
// resources/Player/modules/keyframes/PanoTextLabel/index.tsx
|
|
705
|
+
var ke = (e, t, n, r) => {
|
|
706
|
+
let i = n / 375, a = r / 375, o = new k.PlaneGeometry(i, a);
|
|
707
|
+
if (t) {
|
|
708
|
+
let n = new k.Vector3(t.x + e.x, t.y + e.y, t.z + e.z);
|
|
709
|
+
o.lookAt(n);
|
|
710
|
+
}
|
|
711
|
+
let s = o.getAttribute("position"), c = (t) => e.clone().add(new k.Vector3().fromBufferAttribute(s, t));
|
|
712
|
+
return [
|
|
713
|
+
c(2),
|
|
714
|
+
c(3),
|
|
715
|
+
c(1),
|
|
716
|
+
c(0)
|
|
717
|
+
];
|
|
718
|
+
};
|
|
719
|
+
function Ae() {
|
|
720
|
+
let e = F(), t = I(), n = l.useRef(void 0);
|
|
721
|
+
return l.useEffect(() => {
|
|
722
|
+
if (e.configs?.keyframeMap.PanoTextLabel === !1) return;
|
|
723
|
+
let r = /* @__PURE__ */ new Set(), i = () => {
|
|
724
|
+
for (let e of [...r]) e();
|
|
725
|
+
}, o = e.playback.add(i), s = (e, i = e.start) => {
|
|
726
|
+
let { end: a, data: o } = e, s = o;
|
|
727
|
+
if (o.text === "") return;
|
|
728
|
+
let { x: l, y: u, z: d } = s.vertex, f = new A(l, u, d), p = new A(s.normal?.x, s.normal?.y, s.normal?.z), m = ke(f, s.normal && p, 200, 30);
|
|
729
|
+
n.current ||= c(t);
|
|
730
|
+
let g = n.current.create3DDomContainer(m), _ = g?.css3DObject;
|
|
731
|
+
if (o.quaternion) {
|
|
732
|
+
let e = new te(o.quaternion.x, o.quaternion.y, o.quaternion.z, o.quaternion.w);
|
|
733
|
+
_?.quaternion.copy(e);
|
|
734
|
+
}
|
|
735
|
+
if (!g?.container) return;
|
|
736
|
+
let v = h(g.container), y, b = !1, x = () => {
|
|
737
|
+
b || (b = !0, y !== void 0 && clearTimeout(y), r.delete(x), g.dispose(), queueMicrotask(() => v.unmount()));
|
|
738
|
+
};
|
|
739
|
+
r.add(x), v.render(/* @__PURE__ */ D("div", {
|
|
740
|
+
className: "PanoTextLabel PanoTextLabel--notHidden",
|
|
741
|
+
children: /* @__PURE__ */ D("div", {
|
|
742
|
+
className: "PanoTextLabel-wrapper",
|
|
743
|
+
children: /* @__PURE__ */ D("div", {
|
|
744
|
+
style: { fontSize: `${o.fontSize || 16}px` },
|
|
745
|
+
className: "PanoText-innerText",
|
|
746
|
+
children: o.text || ""
|
|
747
|
+
})
|
|
748
|
+
})
|
|
749
|
+
})), y = setTimeout(x, Math.max(0, a - i));
|
|
750
|
+
};
|
|
751
|
+
return e.on(a.PanoTextLabel, s), () => {
|
|
752
|
+
e.off(a.PanoTextLabel, s), o(), i(), n.current = void 0;
|
|
753
|
+
};
|
|
754
|
+
}, [e]), /* @__PURE__ */ D(E, {});
|
|
755
|
+
}
|
|
756
|
+
// resources/Player/modules/keyframes/Prompter/index.tsx
|
|
757
|
+
function je() {
|
|
758
|
+
let [e, t] = l.useState(""), [n, r] = l.useState(!0), i = l.useRef(null), o = F();
|
|
759
|
+
return l.useEffect(() => {
|
|
760
|
+
if (o.configs?.keyframeMap.Prompter === !1) return;
|
|
761
|
+
let e = () => {
|
|
762
|
+
i.current !== null && clearTimeout(i.current), i.current = null, r(!0), t("");
|
|
763
|
+
}, n = o.playback.add(e), s = (n, a = n.start) => {
|
|
764
|
+
let { end: o, data: s } = n;
|
|
765
|
+
t(s.text), r(!1), i.current &&= (clearTimeout(i.current), null), i.current = setTimeout(e, Math.max(0, o - a));
|
|
766
|
+
};
|
|
767
|
+
return o.on(a.Prompter, s), () => {
|
|
768
|
+
o.off(a.Prompter, s), n(), e();
|
|
769
|
+
};
|
|
770
|
+
}, [o]), /* @__PURE__ */ D("div", {
|
|
771
|
+
className: v("vreo-prompter", {
|
|
772
|
+
"vreo-prompter--hidden": n,
|
|
773
|
+
[`vreo-prompter-left--${o.agentType}`]: !0
|
|
774
|
+
}),
|
|
775
|
+
children: /* @__PURE__ */ D("div", {
|
|
776
|
+
className: "vreo-prompter-text",
|
|
777
|
+
children: /* @__PURE__ */ D("div", {
|
|
778
|
+
className: "vreo-prompter-innerText",
|
|
779
|
+
children: e
|
|
780
|
+
})
|
|
781
|
+
})
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
// resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx
|
|
785
|
+
function Me() {
|
|
786
|
+
let e = F(), t = I(), n = l.useRef(null), r = l.useRef(null), i = l.useCallback(() => {
|
|
787
|
+
if (r.current = null, n.current) {
|
|
788
|
+
let e = _(n.current);
|
|
789
|
+
t.load(e);
|
|
790
|
+
}
|
|
791
|
+
}, []), o = l.useCallback(() => {
|
|
792
|
+
if (n.current) {
|
|
793
|
+
let e = _(n.current);
|
|
794
|
+
Object.assign(window, { $rawWork: e }), t.load(e);
|
|
795
|
+
}
|
|
796
|
+
}, []), s = l.useCallback(() => {
|
|
797
|
+
r.current && t.load(r.current);
|
|
798
|
+
}, []);
|
|
799
|
+
return l.useEffect(() => {
|
|
800
|
+
let c = (e) => {
|
|
801
|
+
!n.current && t.work?.raw?.works && (n.current = t.work.raw.works);
|
|
802
|
+
let i = e.data;
|
|
803
|
+
if (i.work) {
|
|
804
|
+
r.current = _(i.work), t.load(r.current);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
let a = t.work?.raw?.works?.[0];
|
|
808
|
+
if (!a) console.warn("UpdateVRPanorama: 没有可用的 work 数据");
|
|
809
|
+
else {
|
|
810
|
+
if (i.dynamic_scene && !i.panorama) {
|
|
811
|
+
let e = JSON.parse(a).panorama, t = i.dynamic_scene.images.index;
|
|
812
|
+
e.list[t] = i.dynamic_scene.images, i.panorama = e, delete i.dynamic_scene;
|
|
813
|
+
}
|
|
814
|
+
Object.assign(window, {
|
|
815
|
+
$work1: JSON.parse(a),
|
|
816
|
+
$work2: i,
|
|
817
|
+
parseWork: _
|
|
818
|
+
}), r.current = _([a, i]), t.load(r.current);
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
return e.on(a.UpdateVRPanorama, c), e.on(a.Exit, i), e.on("loaded", i), e.on("paused", o), e.on("playing", s), () => {
|
|
822
|
+
e.off(a.UpdateVRPanorama, c), e.off(a.Exit, i), e.off("loaded", i), e.off("paused", o), e.off("playing", s);
|
|
823
|
+
};
|
|
824
|
+
}, []), /* @__PURE__ */ D(E, {});
|
|
825
|
+
}
|
|
826
|
+
// resources/Player/modules/keyframes/VideoEffect/index.tsx
|
|
827
|
+
var G = Math.PI * 2;
|
|
828
|
+
function Ne() {
|
|
829
|
+
let e = l.useRef(null), t = l.useRef(null), n = F(), r = l.useRef(null), [i, o] = l.useState(!1), s = I();
|
|
830
|
+
return l.useEffect(() => {
|
|
831
|
+
let e, i = 0, c, l = async (a) => {
|
|
832
|
+
let { start: l, end: d } = a, { videoSrc: f, fov: p, direction: m, panoIndex: h, vector: g } = a.data, [_, v] = (() => {
|
|
833
|
+
if (g) return [g.longitude, g.latitude];
|
|
834
|
+
if (!m) return [0, 0];
|
|
835
|
+
let e = -Math.atan2(m.x, -m.z);
|
|
836
|
+
e = (e % G + G) % G;
|
|
837
|
+
let t = -Math.asin(m.y / 1);
|
|
838
|
+
return [e, t];
|
|
839
|
+
})();
|
|
840
|
+
u();
|
|
841
|
+
let y = i;
|
|
842
|
+
s.setState({
|
|
843
|
+
fov: p,
|
|
844
|
+
panoIndex: h,
|
|
845
|
+
longitude: _,
|
|
846
|
+
latitude: v
|
|
847
|
+
}, !0), c?.();
|
|
848
|
+
let b = n.playback.capture(), x = () => !!b?.valid(), S = () => y === i && x(), C = t.current;
|
|
849
|
+
if (!C || !S()) return;
|
|
850
|
+
let w = e = b.bind(C);
|
|
851
|
+
w.muted = !0, w.src = f;
|
|
852
|
+
let T = () => {
|
|
853
|
+
c?.(), S() && (w.muted = !1, w.play().catch((e) => {
|
|
854
|
+
S() && (n.playback.cancel(), console.error(e));
|
|
855
|
+
}));
|
|
856
|
+
};
|
|
857
|
+
c = () => C.removeEventListener("canplaythrough", T), C.addEventListener("canplaythrough", T), w.load(), o(!0), r.current = setTimeout(u, Math.max(0, d - l));
|
|
858
|
+
};
|
|
859
|
+
n.on(a.VideoEffect, l);
|
|
860
|
+
let u = () => {
|
|
861
|
+
++i, r.current && clearTimeout(r.current), c?.(), e && (e.muted = !0, e.pause(), e.src = ""), e = void 0, o(!1);
|
|
862
|
+
}, d = n.playback.add(u);
|
|
863
|
+
return () => {
|
|
864
|
+
u(), d(), n.off(a.VideoEffect, l), r.current && clearTimeout(r.current);
|
|
865
|
+
};
|
|
866
|
+
}, [n]), l.useEffect(() => {
|
|
867
|
+
if (!e.current) return;
|
|
868
|
+
let r = n.configs?.videos?.videoEffect || document.createElement("video");
|
|
869
|
+
return r.setAttribute("playsinline", "true"), r.setAttribute("webkit-playsinline", "true"), r.autoplay = !1, r.muted = !0, r.setAttribute("key", "VideoEffect-video"), r.setAttribute("class", "VideoEffect-video"), t.current = r, e.current.append(t.current), () => {
|
|
870
|
+
r.muted = !0, r.pause(), r.remove();
|
|
871
|
+
};
|
|
872
|
+
}, []), /* @__PURE__ */ D("div", {
|
|
873
|
+
ref: e,
|
|
874
|
+
className: v("VideoEffect", { "VideoEffect--visible": i })
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
// resources/shared-utils/Preloader.ts
|
|
878
|
+
var Pe = { blob: (e) => {
|
|
879
|
+
let t = () => null;
|
|
880
|
+
return new Promise((n, r) => {
|
|
881
|
+
let i = new XMLHttpRequest(), a = () => {
|
|
882
|
+
i.ontimeout = t, i.onreadystatechange = t, i.onprogress = t, i.onabort = t;
|
|
883
|
+
};
|
|
884
|
+
i.ontimeout = () => {
|
|
885
|
+
r(/* @__PURE__ */ Error("timeout")), a();
|
|
886
|
+
}, i.onreadystatechange = () => {
|
|
887
|
+
i.readyState === 4 && (i.status !== 0 || i.response) && (i.status === 200 || i.status === 0 ? (n(i.response), a()) : (r(/* @__PURE__ */ Error("status:" + i.status)), a()));
|
|
888
|
+
}, i.open("GET", e, !0), i.responseType = "blob", i.send(null);
|
|
889
|
+
});
|
|
890
|
+
} }, Fe = class extends g {
|
|
891
|
+
$timestamp = null;
|
|
892
|
+
$currentTime = 0;
|
|
893
|
+
$duration = 0;
|
|
894
|
+
stopInterval;
|
|
895
|
+
muted = !1;
|
|
896
|
+
src = "";
|
|
897
|
+
setAttribute(e, t) {}
|
|
898
|
+
constructor({ duration: e } = {}) {
|
|
899
|
+
super(), e && (this.$duration = e);
|
|
900
|
+
}
|
|
901
|
+
play() {
|
|
902
|
+
this.stopInterval || (this.$currentTime === this.$duration && (this.$currentTime = 0), this.$timestamp === null && (this.$timestamp = performance.now()), this.stopInterval = e(() => this.requestAnimationFrameLoop()), this.emit("play"));
|
|
903
|
+
}
|
|
904
|
+
pause() {
|
|
905
|
+
this.stopInterval &&= (this.stopInterval(), this.emit("pause"), void 0), this.$timestamp = null;
|
|
906
|
+
}
|
|
907
|
+
requestAnimationFrameLoop() {
|
|
908
|
+
if (this.$timestamp === null) return;
|
|
909
|
+
let e = performance.now();
|
|
910
|
+
this.$currentTime += e - this.$timestamp, this.$timestamp = e, this.emit("timeupdate"), this.$currentTime >= this.$duration - 10 && (this.$currentTime = this.$duration, this.pause(), this.emit("ended"));
|
|
911
|
+
}
|
|
912
|
+
get currentTime() {
|
|
913
|
+
return this.$currentTime / 1e3;
|
|
914
|
+
}
|
|
915
|
+
set currentTime(e) {
|
|
916
|
+
this.$currentTime = e * 1e3;
|
|
917
|
+
}
|
|
918
|
+
get duration() {
|
|
919
|
+
return this.$duration;
|
|
920
|
+
}
|
|
921
|
+
set duration(e) {
|
|
922
|
+
this.$duration = e;
|
|
923
|
+
}
|
|
924
|
+
get ended() {
|
|
925
|
+
return this.$currentTime === this.$duration;
|
|
926
|
+
}
|
|
927
|
+
get paused() {
|
|
928
|
+
return !this.stopInterval;
|
|
929
|
+
}
|
|
930
|
+
addEventListener(e, t, n = !1) {
|
|
931
|
+
this.on(e, t);
|
|
932
|
+
}
|
|
933
|
+
removeEventListener(e, t, n = !1) {
|
|
934
|
+
this.off(e, t);
|
|
935
|
+
}
|
|
936
|
+
}, Ie = class extends k.Mesh {
|
|
937
|
+
videoTexture;
|
|
938
|
+
enableNode;
|
|
939
|
+
options;
|
|
940
|
+
videoUrl;
|
|
941
|
+
freeze;
|
|
942
|
+
paused;
|
|
943
|
+
outputs = /* @__PURE__ */ new Map();
|
|
944
|
+
operations(e, t) {
|
|
945
|
+
let n = e ? e.bind(t) : t;
|
|
946
|
+
return this.outputs.set(t, n), n;
|
|
947
|
+
}
|
|
948
|
+
ownsVideo = !1;
|
|
949
|
+
ownsAudio = !1;
|
|
950
|
+
generation = 0;
|
|
951
|
+
removeStart;
|
|
952
|
+
objectURL;
|
|
953
|
+
audioInstance;
|
|
954
|
+
audioLikeInstance;
|
|
955
|
+
$removeEventListener;
|
|
956
|
+
get mediaInstance() {
|
|
957
|
+
return this.videoUrl ? N(this.videoUrl) === "audio" ? this.audioInstance : this.videoTexture.image : this.audioLikeInstance;
|
|
958
|
+
}
|
|
959
|
+
constructor(e, t, n, r, i = { preload: !0 }) {
|
|
960
|
+
let a = !i.videoInstance;
|
|
961
|
+
if (!i.videoInstance) {
|
|
962
|
+
let e = document.createElement("video");
|
|
963
|
+
e.style.display = "none", e.playsInline = !0, e.muted = !0, document.body.append(e), i.videoInstance = e;
|
|
964
|
+
}
|
|
965
|
+
let o = new k.PlaneGeometry(e, t, n, r), s = new k.VideoTexture(i.videoInstance);
|
|
966
|
+
s.colorSpace = k.SRGBColorSpace;
|
|
967
|
+
let c = fe(0), l = de(s).sample(pe()), u = ce(1).sub(ue(.1, .3, l.g.sub(le(l.r, l.b)).add(.1))), d = new k.MeshBasicNodeMaterial({ transparent: !0 });
|
|
968
|
+
d.colorNode = l.rgb, d.opacityNode = u.mul(c), super(o, d), this.videoTexture = s, this.enableNode = c, this.ownsVideo = a, this.ownsAudio = !i.audioInstance, this.options = i, this.freeze = !1, this.paused = !0, i.audioInstance ? this.audioInstance = i.audioInstance : (this.audioInstance = document.createElement("audio"), this.audioInstance.crossOrigin = "", this.audioInstance.muted = !0, this.audioInstance.autoplay = !1), this.audioLikeInstance = new Fe(), x(this, {
|
|
969
|
+
paused: S,
|
|
970
|
+
videoUrl: C
|
|
971
|
+
});
|
|
972
|
+
let f = (e) => T(() => this.paused = e), p = () => f(!0), m = () => f(!1);
|
|
973
|
+
this.audioInstance.addEventListener("pause", p), this.audioInstance.addEventListener("play", m), this.options.videoInstance?.addEventListener("pause", p), this.options.videoInstance?.addEventListener("play", m), this.audioLikeInstance.addEventListener("pause", p), this.audioLikeInstance.addEventListener("play", m), this.$removeEventListener = () => {
|
|
974
|
+
this.audioInstance.removeEventListener("pause", p), this.audioInstance.removeEventListener("play", m), this.options.videoInstance?.removeEventListener("pause", p), this.options.videoInstance?.removeEventListener("play", m), this.audioLikeInstance.removeEventListener("pause", p), this.audioLikeInstance.removeEventListener("play", m);
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
async update(e, t, n) {
|
|
978
|
+
if (this.videoUrl === e) return;
|
|
979
|
+
this.stop(), this.freeze = !0;
|
|
980
|
+
let r = N(e) === "audio" ? this.audioInstance : this.options.videoInstance, i = this.operations(n, r);
|
|
981
|
+
i.muted = !0;
|
|
982
|
+
let a = this.options.preload !== !1 || N(e) === "video" ? URL.createObjectURL(await Pe.blob(e)) : e;
|
|
983
|
+
if (!t()) {
|
|
984
|
+
a !== e && URL.revokeObjectURL(a);
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
T(() => {
|
|
988
|
+
this.videoUrl = e;
|
|
989
|
+
}), this.objectURL && URL.revokeObjectURL(this.objectURL), this.objectURL = a === e ? void 0 : a, i.src = a, r.setAttribute("data-src", e);
|
|
990
|
+
let o = () => {
|
|
991
|
+
t() && i.currentTime !== 0 && (this.freeze = !1, i.muted = !1, this.enableNode.value = +!!N(e), this.removeStart?.());
|
|
992
|
+
};
|
|
993
|
+
this.removeStart = () => r.removeEventListener("timeupdate", o), r.addEventListener("timeupdate", o);
|
|
994
|
+
}
|
|
995
|
+
async play(e = "", t = 0, n) {
|
|
996
|
+
let r = this.options.getPlayback?.();
|
|
997
|
+
if (this.options.getPlayback && !r?.valid()) return !1;
|
|
998
|
+
e && e !== this.videoUrl && this.stop();
|
|
999
|
+
let i = this.generation, a = () => i === this.generation && (!this.options.getPlayback || !!r?.valid());
|
|
1000
|
+
if (e && e !== this.videoUrl && (i++, await this.update(e, a, r)), !a()) return !1;
|
|
1001
|
+
n && !e && (T(() => {
|
|
1002
|
+
this.videoUrl = "";
|
|
1003
|
+
}), this.audioLikeInstance.duration = n);
|
|
1004
|
+
let o = this.videoUrl ? this.operations(r, this.mediaInstance) : this.audioLikeInstance;
|
|
1005
|
+
return (e || n) && (o.currentTime = t), o.muted = !0, await o.play(), a() ? (o.muted = !1, !0) : !1;
|
|
1006
|
+
}
|
|
1007
|
+
get mediaOperations() {
|
|
1008
|
+
let e = this.options.getPlayback?.();
|
|
1009
|
+
if (!this.options.getPlayback || e?.valid()) return this.videoUrl ? this.operations(e, this.mediaInstance) : this.audioLikeInstance;
|
|
1010
|
+
}
|
|
1011
|
+
stop() {
|
|
1012
|
+
++this.generation, this.removeStart?.(), this.removeStart = void 0;
|
|
1013
|
+
for (let e of this.outputs.values()) e.muted = !0, e.pause();
|
|
1014
|
+
this.outputs.clear(), this.audioLikeInstance.pause();
|
|
1015
|
+
}
|
|
1016
|
+
get currentTime() {
|
|
1017
|
+
return this.mediaInstance.currentTime * 1e3;
|
|
1018
|
+
}
|
|
1019
|
+
dispose() {
|
|
1020
|
+
this.stop(), this.$removeEventListener(), this.ownsVideo && this.options.videoInstance?.remove(), this.ownsAudio && this.audioInstance.remove(), this.objectURL && URL.revokeObjectURL(this.objectURL), this.geometry.dispose(), this.videoTexture.dispose(), this.material.dispose();
|
|
1021
|
+
}
|
|
1022
|
+
}, Le = class {
|
|
1023
|
+
videoAgentMesh;
|
|
1024
|
+
scene = new re();
|
|
1025
|
+
camera = new ee(-240, 240, 135, -135);
|
|
1026
|
+
renderer;
|
|
1027
|
+
frame;
|
|
1028
|
+
disposed = !1;
|
|
1029
|
+
disposers = [];
|
|
1030
|
+
constructor(e, t, n = !1) {
|
|
1031
|
+
if (this.renderer = new ie({
|
|
1032
|
+
alpha: !0,
|
|
1033
|
+
forceWebGL: n
|
|
1034
|
+
}), this.videoAgentMesh = new Ie(480, 270, 1, 1, t), !e) return;
|
|
1035
|
+
this.camera.position.set(0, 0, 10), this.camera.lookAt(0, 0, 0);
|
|
1036
|
+
let r = this.renderer.domElement;
|
|
1037
|
+
r.classList.add("VideoAgent-canvas");
|
|
1038
|
+
let i = B(e, (e, t) => {
|
|
1039
|
+
this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(e, t, !1), r.style.width = `${e}px`, r.style.height = `${t}px`;
|
|
1040
|
+
});
|
|
1041
|
+
this.disposers.push(i), e.append(r), this.scene.add(this.videoAgentMesh), this.renderer.init().then(() => {
|
|
1042
|
+
if (this.disposed) return;
|
|
1043
|
+
let e = this.renderer.backend;
|
|
1044
|
+
if (!e.isWebGPUBackend && !e.isWebGLBackend) throw Error("VideoAgent renderer initialized with an unsupported backend");
|
|
1045
|
+
this.run();
|
|
1046
|
+
}).catch(this.fail);
|
|
1047
|
+
}
|
|
1048
|
+
fail = (e) => {
|
|
1049
|
+
this.disposed || (this.dispose(), console.error("VideoAgent renderer initialization failed", e));
|
|
1050
|
+
};
|
|
1051
|
+
run = () => {
|
|
1052
|
+
this.disposed || (!(this.videoAgentMesh.paused || this.videoAgentMesh.freeze) && this.videoAgentMesh.currentTime > 1e3 && this.renderer.render(this.scene, this.camera), this.frame = requestAnimationFrame(this.run));
|
|
1053
|
+
};
|
|
1054
|
+
dispose = () => {
|
|
1055
|
+
this.disposed || (this.disposed = !0, this.frame !== void 0 && cancelAnimationFrame(this.frame), this.frame = void 0, this.disposers.splice(0).forEach((e) => e()), this.videoAgentMesh.dispose(), this.renderer.dispose(), this.renderer.domElement.remove());
|
|
1056
|
+
};
|
|
1057
|
+
}, Re = y(function(e) {
|
|
1058
|
+
let t = l.useRef(null), n = F(), r = n.avatar?.url && n.avatar.force === !0, i = !r && n.videoAgentScene?.videoAgentMesh.mediaInstance instanceof HTMLVideoElement;
|
|
1059
|
+
return l.useEffect(() => {
|
|
1060
|
+
if (!t.current) throw Error("React 渲染异常,请稍后重试 ...");
|
|
1061
|
+
if (n.videoAgentScene) {
|
|
1062
|
+
console.warn("VideoAgentScene\" 重复初始化,已被过滤");
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
let r = n.five.renderer?.backend?.isWebGLBackend === !0, i = new Le(t.current, {
|
|
1066
|
+
...e.options,
|
|
1067
|
+
getPlayback: () => n.playback.capture()
|
|
1068
|
+
}, r);
|
|
1069
|
+
return T(() => {
|
|
1070
|
+
n.videoAgentScene = i;
|
|
1071
|
+
}), () => {
|
|
1072
|
+
i.dispose(), n.videoAgentScene === i && T(() => {
|
|
1073
|
+
n.videoAgentScene = void 0;
|
|
1074
|
+
});
|
|
1075
|
+
};
|
|
1076
|
+
}, [n]), /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
|
|
1077
|
+
className: "Avatar",
|
|
1078
|
+
style: { display: r ? "block" : "none" },
|
|
1079
|
+
children: /* @__PURE__ */ D("div", {
|
|
1080
|
+
className: "Avatar-wrapper ratio-1-1",
|
|
1081
|
+
children: /* @__PURE__ */ D("img", {
|
|
1082
|
+
className: "Avatar-img",
|
|
1083
|
+
src: n.avatar?.url,
|
|
1084
|
+
onClick: () => e.onClick?.()
|
|
1085
|
+
})
|
|
1086
|
+
})
|
|
1087
|
+
}), /* @__PURE__ */ D("div", {
|
|
1088
|
+
className: v("VideoAgent", { hide: !i }),
|
|
1089
|
+
children: /* @__PURE__ */ D("div", {
|
|
1090
|
+
className: "VideoAgent-container",
|
|
1091
|
+
children: /* @__PURE__ */ D("div", {
|
|
1092
|
+
className: "VideoAgent-wrapper ratio-16-9",
|
|
1093
|
+
children: /* @__PURE__ */ D("div", {
|
|
1094
|
+
className: "VideoAgent-inner",
|
|
1095
|
+
ref: t,
|
|
1096
|
+
children: /* @__PURE__ */ D("div", {
|
|
1097
|
+
className: "VideoAgent-play",
|
|
1098
|
+
onClick: () => e.onClick?.()
|
|
1099
|
+
})
|
|
1100
|
+
})
|
|
1101
|
+
})
|
|
1102
|
+
})
|
|
1103
|
+
})] });
|
|
1104
|
+
}), K = "data:audio/mpeg;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAADAAAGhgBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr///////////////////////////////////////////8AAAA5TEFNRTMuOThyAc0AAAAAAAAAABSAJAiqQgAAgAAABobxtI73AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//uQxAACFEII9ACZ/sJZwWEoEb8w/////N//////JcxjHjf+7/v/H2PzCCFAiDtGeyBCIx7bJJ1mmEEMy6g8mm2c8nrGABB4h2Mkmn//4z/73u773R5qHHu/j/w7Kxkzh5lWRWdsifCkNAnY9Zc1HvDAhjhSHdFkHFzLmabt/AQxSg2wwzLhHIJOBnAWwVY4zrhIYhhc2kvhYDfQ4hDi2Gmh5KyFn8EcGIrHAngNgIwVIEMf5bzbAiTRoAD///8z/KVhkkWEle6IX+d/z4fvH3BShK1e5kmjkCMoxVmXhd4ROlTKo3iipasvTilY21q19ta30/v/0/idPX1v8PNxJL6ramnOVsdvMv2akO0iSYIzdJFirtzWXCZicS9vHqvSKyqm5XJBdqBwPxyfJdykhWTZ0G0ZyTZGpLKxsNwwoRhsx3tZfhwmeOBVISm3impAC/IT/8hP/EKEM1KMdVdVKM2rHV4x7HVXZvbVVKN/qq8CiV9VL9jjH/6l6qf7MBCjZmOqsAibjcP+qqqv0oxqpa/NVW286hPo1nz2L/h8+jXt//uSxCmDU2IK/ECN98KKtE5IYzNoCfbw+u9i5r8PoadUMFPKqWL4LK3T/LCraMSHGkW4bpLXR/E6LlHOVQxmslKVJ8IULktMN06N0FKCpHCoYsjC4F+Z0NVqdNFoGSTjSiyjzLdnZ2fNqTi2eHKONONKLMPMKLONKLMPQRJGlFxZRoKcJFAYEeIFiRQkUWUeYfef//Ko04soswso40UJAgMw8wosososy0EalnZyjQUGBRQGIFggOWUacWUeYmuadrZziQKKEgQsQLAhQkUJAgMQDghltLO1onp0cpkNInSFMqlYeSEJ5AHsqFdOwy1DA2sRmRJKxdKRfLhfLw5BzUxBTUUzLjk4LjJVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjk4LjJVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7ksRRA8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=", q = [], ze = typeof Audio > "u" ? class {} : Audio;
|
|
1105
|
+
function Be(e) {
|
|
1106
|
+
let t = q.find((e) => !e.realSrc || e.realSrc === K);
|
|
1107
|
+
return t || (t = new J(K), q.push(t)), e && (t.src = e), t;
|
|
1108
|
+
}
|
|
1109
|
+
async function Ve(e = 100, t = 2e3) {
|
|
1110
|
+
console.log("waitForBlankAudioGenerated, needGenerate: ", q.some((e) => !e.ended && e.src === K));
|
|
1111
|
+
let n = Date.now(), r = !1;
|
|
1112
|
+
for (; q.some((e) => !e.ended && e.src === K) && !r;) {
|
|
1113
|
+
if (Date.now() - n > t) return r = !0, Promise.resolve();
|
|
1114
|
+
await new Promise((t) => setTimeout(t, e));
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
function He(e) {
|
|
1118
|
+
let t = e - q.length;
|
|
1119
|
+
if (!(t <= 0)) for (let e = 0; e < t; e++) q.push(new J(K));
|
|
1120
|
+
}
|
|
1121
|
+
function Ue(e) {
|
|
1122
|
+
e.inited || (e.src && (e.inited = !0, e.removeDocumentEventListener()), e.src === K && e.play());
|
|
1123
|
+
}
|
|
1124
|
+
var J = class extends ze {
|
|
1125
|
+
preload = "auto";
|
|
1126
|
+
get src() {
|
|
1127
|
+
return this.getAttribute("src") || "";
|
|
1128
|
+
}
|
|
1129
|
+
set src(e) {
|
|
1130
|
+
this.muted = !0, e === "" ? (this.removeAttribute("src"), this.realSrc = "", this.load()) : (this.setAttribute("src", e), this.realSrc = e);
|
|
1131
|
+
}
|
|
1132
|
+
realSrc = "";
|
|
1133
|
+
inited = !1;
|
|
1134
|
+
removeDocumentEventListener;
|
|
1135
|
+
constructor(e) {
|
|
1136
|
+
super(e), this.realSrc = e ?? "", this.muted = !0, super.addEventListener("ended", () => {
|
|
1137
|
+
this.src === K && (this.src = "");
|
|
1138
|
+
});
|
|
1139
|
+
let t = () => Ue(this);
|
|
1140
|
+
document.addEventListener("click", t), document.addEventListener("touchend", t), this.removeDocumentEventListener = () => {
|
|
1141
|
+
document.removeEventListener("click", t), document.removeEventListener("touchend", t);
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
// resources/Player/modules/keyframes/BgMusic/index.tsx
|
|
1146
|
+
function We() {
|
|
1147
|
+
let e = F();
|
|
1148
|
+
return l.useEffect(() => {
|
|
1149
|
+
let t = /* @__PURE__ */ new Set(), n = (n, r) => {
|
|
1150
|
+
let i = e.playback.capture(), a = () => !!i?.valid();
|
|
1151
|
+
if (!a()) return;
|
|
1152
|
+
let o = Be(), s = i.bind(o), c = !1, l = () => {
|
|
1153
|
+
c || (c = !0, o.removeEventListener("canplay", d), o.removeEventListener("ended", l), s.muted = !0, s.pause(), s.src = "", u(), t.delete(l), e.setWaitingForBgMusic(!1));
|
|
1154
|
+
}, u = e.playback.add(l);
|
|
1155
|
+
t.add(l);
|
|
1156
|
+
let d = () => {
|
|
1157
|
+
o.removeEventListener("canplay", d), a() && !c && (s.muted = !1, s.play().catch((t) => {
|
|
1158
|
+
a() && !c && (l(), e.playback.cancel(), console.error(t));
|
|
1159
|
+
}), e.setWaitingForBgMusic(!1));
|
|
1160
|
+
};
|
|
1161
|
+
s.muted = !0, s.src = n.data.url, s.currentTime = Math.max(0, (r - n.start) / 1e3), o.addEventListener("ended", l), e.configs.waitForBgMusicLoaded && o.readyState < 3 ? (e.setWaitingForBgMusic(!0), o.addEventListener("canplay", d)) : d();
|
|
1162
|
+
};
|
|
1163
|
+
return e.on(a.BgMusic, n), () => {
|
|
1164
|
+
e.off(a.BgMusic, n);
|
|
1165
|
+
for (let e of [...t]) e();
|
|
1166
|
+
};
|
|
1167
|
+
}, [e]), /* @__PURE__ */ D(E, {});
|
|
1168
|
+
}
|
|
1169
|
+
// resources/Player/modules/Wave/index.tsx
|
|
1170
|
+
var Y = "https://vr-public.realsee-cdn.cn/release/static/image/release/", Ge = {
|
|
1171
|
+
single: {
|
|
1172
|
+
width: 766,
|
|
1173
|
+
height: 60,
|
|
1174
|
+
frames: 20,
|
|
1175
|
+
hevc: "vapor/static/wave-single.140d197f4838c130b69e87dfd0705479.mov",
|
|
1176
|
+
vp9: "vapor/static/wave-single.eda65de390a830193fff40d1f1255555.webm",
|
|
1177
|
+
png: "vapor/static/wave-single.f51aade2a6e1c59211698a1a24e6135f.png"
|
|
1178
|
+
},
|
|
1179
|
+
double: {
|
|
1180
|
+
width: 766,
|
|
1181
|
+
height: 60,
|
|
1182
|
+
frames: 16,
|
|
1183
|
+
hevc: "vapor/static/wave-double.3e6d73050ee6958cc3060b107ebe5f39.mov",
|
|
1184
|
+
vp9: "/vapor/static/wave-double.77dfe8548ebcb3f3d336785d4fe9c7b2.webm",
|
|
1185
|
+
png: "/vapor/static/wave-double.ab4fe7d8a70395109ca4f759af7bd53f.png"
|
|
1186
|
+
},
|
|
1187
|
+
solid: {
|
|
1188
|
+
width: 1126,
|
|
1189
|
+
height: 90,
|
|
1190
|
+
frames: 48,
|
|
1191
|
+
hevc: "vapor/static/wave-solid.cf68912a93275d07aa6b5097ea11fdda.mov",
|
|
1192
|
+
vp9: "vapor/static/wave-solid.64438b63cbb346906d066bb7b8dc3e20.webm",
|
|
1193
|
+
png: "vapor/static/wave-solid.6969d7f3f2f44f7ac1ade30e65660cb1.png"
|
|
1194
|
+
},
|
|
1195
|
+
swap: {
|
|
1196
|
+
width: 2250,
|
|
1197
|
+
height: 180,
|
|
1198
|
+
frames: 41,
|
|
1199
|
+
hevc: "vapor/static/wave-swap.b38f22e2cf84ee21e9be35f7f56c9cfc.mov",
|
|
1200
|
+
vp9: "vapor/static/wave-swap.c02e4b94cf05aecf6e7a0023bc7bb90f.webm",
|
|
1201
|
+
png: "vapor/static/wave-swap.772ba526a7210dcc01567062c6319545.png"
|
|
1202
|
+
},
|
|
1203
|
+
expand: {
|
|
1204
|
+
width: 2250,
|
|
1205
|
+
height: 180,
|
|
1206
|
+
frames: 45,
|
|
1207
|
+
hevc: "vapor/static/wave-expand.9529956c5954740cd4c9d07d51e32822.mov",
|
|
1208
|
+
vp9: "vapor/static/wave-expand.a0d2a0074001cd3d4fea56818c6d3c38.webm",
|
|
1209
|
+
png: "vapor/static/wave-expand.62fcf27b445533e6eb1b17bab5eafa0d.png"
|
|
1210
|
+
}
|
|
1211
|
+
}, X = typeof navigator < "u" ? navigator.userAgent : "", Ke = /(iPhone|iPad|iPod)/i.test(X), qe = /safari/i.test(X) && !/chrome/i.test(X) && /version/i.test(X), Je = /microMessenger/i.test(X), Ye = Ke || qe, Xe = typeof MediaSource < "u" && MediaSource.isTypeSupported("video/webm; codecs=vp9");
|
|
1212
|
+
function Ze(e) {
|
|
1213
|
+
let t = u.useMemo(() => Ge[e?.appearance ?? "solid"], [e?.appearance]), n = u.useMemo(() => t.height / t.width, [t]), r = null;
|
|
1214
|
+
return r = Je ? /* @__PURE__ */ D(Q, {
|
|
1215
|
+
wave: t,
|
|
1216
|
+
prefix: e?.staticPrefix
|
|
1217
|
+
}) : Ye ? /* @__PURE__ */ D(Z, {
|
|
1218
|
+
format: "hevc",
|
|
1219
|
+
wave: t,
|
|
1220
|
+
prefix: e?.staticPrefix
|
|
1221
|
+
}) : Xe ? /* @__PURE__ */ D(Z, {
|
|
1222
|
+
format: "vp9",
|
|
1223
|
+
wave: t,
|
|
1224
|
+
prefix: e?.staticPrefix
|
|
1225
|
+
}) : /* @__PURE__ */ D(Q, {
|
|
1226
|
+
wave: t,
|
|
1227
|
+
prefix: e?.staticPrefix
|
|
1228
|
+
}), /* @__PURE__ */ D("div", {
|
|
1229
|
+
className: "vreo-wave",
|
|
1230
|
+
onClick: e?.onClick,
|
|
1231
|
+
children: /* @__PURE__ */ D("div", {
|
|
1232
|
+
style: {
|
|
1233
|
+
position: "relative",
|
|
1234
|
+
width: "100%",
|
|
1235
|
+
paddingTop: `${n * 100}%`
|
|
1236
|
+
},
|
|
1237
|
+
children: /* @__PURE__ */ D("div", {
|
|
1238
|
+
style: {
|
|
1239
|
+
position: "absolute",
|
|
1240
|
+
width: "100%",
|
|
1241
|
+
height: "100%",
|
|
1242
|
+
left: 0,
|
|
1243
|
+
top: 0
|
|
1244
|
+
},
|
|
1245
|
+
children: r
|
|
1246
|
+
})
|
|
1247
|
+
})
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
var Z = ({ wave: e, format: t, prefix: n = Y }) => {
|
|
1251
|
+
let r = p(null), [i, a] = m(!1), [o, s] = m(!1), c = n + e[t];
|
|
1252
|
+
f(() => {
|
|
1253
|
+
a(!1);
|
|
1254
|
+
}, [c]);
|
|
1255
|
+
let l = d(() => {
|
|
1256
|
+
r.current && r.current.play(), a(!0);
|
|
1257
|
+
}, []), u = d(() => {
|
|
1258
|
+
s(!0);
|
|
1259
|
+
}, []);
|
|
1260
|
+
return o ? /* @__PURE__ */ D(Q, {
|
|
1261
|
+
wave: e,
|
|
1262
|
+
prefix: n
|
|
1263
|
+
}) : /* @__PURE__ */ D("video", {
|
|
1264
|
+
style: { opacity: +!!i },
|
|
1265
|
+
preload: "auto",
|
|
1266
|
+
ref: r,
|
|
1267
|
+
width: "100%",
|
|
1268
|
+
height: "100%",
|
|
1269
|
+
playsInline: !0,
|
|
1270
|
+
autoPlay: !0,
|
|
1271
|
+
onCanPlay: l,
|
|
1272
|
+
onError: u,
|
|
1273
|
+
muted: !0,
|
|
1274
|
+
loop: !0,
|
|
1275
|
+
src: c
|
|
1276
|
+
});
|
|
1277
|
+
}, Q = ({ wave: e, prefix: t = Y }) => {
|
|
1278
|
+
let n = t + e.png;
|
|
1279
|
+
return /* @__PURE__ */ D("div", { style: {
|
|
1280
|
+
width: "100%",
|
|
1281
|
+
height: "100%",
|
|
1282
|
+
backgroundImage: `url(${n})`,
|
|
1283
|
+
backgroundSize: "100%",
|
|
1284
|
+
animationName: "vreo-wave-keyframes",
|
|
1285
|
+
animationTimingFunction: `steps(${e.frames - 1})`,
|
|
1286
|
+
animationDuration: `${e.frames / 25}s`,
|
|
1287
|
+
animationIterationCount: "infinite"
|
|
1288
|
+
} });
|
|
1289
|
+
}, Qe = y(({ controller: e }) => /* @__PURE__ */ D("div", {
|
|
1290
|
+
className: v("vreo-panel", { "vreo-panel--hidden": !e.visible }),
|
|
1291
|
+
children: /* @__PURE__ */ O("div", {
|
|
1292
|
+
className: "vreo-panel-inner",
|
|
1293
|
+
children: [
|
|
1294
|
+
/* @__PURE__ */ D(Ze, {
|
|
1295
|
+
onClick: e.configs?.onWaveClick,
|
|
1296
|
+
appearance: e.waveAppearance ?? "single",
|
|
1297
|
+
staticPrefix: e.configs.waveStaticPrefix
|
|
1298
|
+
}),
|
|
1299
|
+
/* @__PURE__ */ D(Re, {
|
|
1300
|
+
onClick: () => {
|
|
1301
|
+
e.configs?.onAvatarClick ? e.configs.onAvatarClick() : e.playing ? e.playback.cancel() : e.playback.begin(!0) && e.setPlaying(!0);
|
|
1302
|
+
},
|
|
1303
|
+
options: e.configs?.videoAgentMeshOptions || {}
|
|
1304
|
+
}),
|
|
1305
|
+
/* @__PURE__ */ D(je, {}),
|
|
1306
|
+
e.configs?.customPanelChildren
|
|
1307
|
+
]
|
|
1308
|
+
})
|
|
1309
|
+
}));
|
|
1310
|
+
function $e() {
|
|
1311
|
+
let e = F();
|
|
1312
|
+
return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O(E, { children: [
|
|
1313
|
+
/* @__PURE__ */ D(xe, {}),
|
|
1314
|
+
/* @__PURE__ */ D(ye, {}),
|
|
1315
|
+
/* @__PURE__ */ D(we, {}),
|
|
1316
|
+
/* @__PURE__ */ D(Me, {}),
|
|
1317
|
+
/* @__PURE__ */ D(Ne, {}),
|
|
1318
|
+
/* @__PURE__ */ D(Oe, {}),
|
|
1319
|
+
/* @__PURE__ */ D(Ae, {}),
|
|
1320
|
+
/* @__PURE__ */ D(Se, {}),
|
|
1321
|
+
/* @__PURE__ */ D(De, {}),
|
|
1322
|
+
/* @__PURE__ */ D(We, {})
|
|
1323
|
+
] }), /* @__PURE__ */ D(Qe, { controller: e })] });
|
|
1324
|
+
}
|
|
1325
|
+
// resources/Player/modules/Drawer/index.tsx
|
|
1326
|
+
var et = y(({ controller: e }) => {
|
|
1327
|
+
let t = (() => {
|
|
1328
|
+
let t = e.drawerConfig?.height;
|
|
1329
|
+
return t ? typeof t == "number" ? t + "px" : t : "max-content";
|
|
1330
|
+
})();
|
|
1331
|
+
return /* @__PURE__ */ D("div", {
|
|
1332
|
+
className: v("vreo-drawer", { "vreo-drawer-visible": e.drawerConfig && e.drawerConfig.content }),
|
|
1333
|
+
onClick: () => e.openDrawer(!1),
|
|
1334
|
+
children: /* @__PURE__ */ D("div", {
|
|
1335
|
+
className: "vreo-drawer-inner",
|
|
1336
|
+
style: {
|
|
1337
|
+
height: t,
|
|
1338
|
+
maxHeight: "400px"
|
|
1339
|
+
},
|
|
1340
|
+
children: e.drawerConfig?.content || ""
|
|
1341
|
+
})
|
|
1342
|
+
});
|
|
1343
|
+
});
|
|
1344
|
+
function tt() {
|
|
1345
|
+
let e = F();
|
|
1346
|
+
return /* @__PURE__ */ D(et, { controller: e });
|
|
1347
|
+
}
|
|
1348
|
+
// resources/Player/modules/PopUp/index.tsx
|
|
1349
|
+
var nt = y(({ controller: e }) => /* @__PURE__ */ D("div", {
|
|
1350
|
+
className: v("vreo-PopUp", { "vreo-PopUp-visible": e.popUp }),
|
|
1351
|
+
onClick: () => e.openPopUp(!1),
|
|
1352
|
+
children: /* @__PURE__ */ D("div", {
|
|
1353
|
+
className: "vreo-PopUp-inner",
|
|
1354
|
+
children: e.popUp || ""
|
|
1355
|
+
})
|
|
1356
|
+
}));
|
|
1357
|
+
function rt() {
|
|
1358
|
+
let e = F();
|
|
1359
|
+
return /* @__PURE__ */ D(nt, { controller: e });
|
|
1360
|
+
}
|
|
1361
|
+
// resources/Player/custom/SpatialScenePanel/index.tsx
|
|
1362
|
+
var it = ({ five: e, dom: t }) => {
|
|
1363
|
+
let n = new A();
|
|
1364
|
+
e.camera.getWorldDirection(n);
|
|
1365
|
+
let r = e.camera.position, [i] = e.model.intersectRaycaster(new ne(r, n)), a = e.project2d(i.point), o = window.innerWidth > 560, s = t.clientHeight;
|
|
1366
|
+
t.style.left = a.x + "px", t.style.top = a.y - s / 2 + "px";
|
|
1367
|
+
let { left: c, top: l, bottom: u, right: d } = t.getBoundingClientRect(), f = new A(c, u), p = new A(c, l), m = new A(d, l), h = new A(d, u);
|
|
1368
|
+
return {
|
|
1369
|
+
points: [
|
|
1370
|
+
f,
|
|
1371
|
+
h,
|
|
1372
|
+
m,
|
|
1373
|
+
p
|
|
1374
|
+
].map((t) => (t.setX(t.x / window.innerWidth * 2 - (o ? 1.25 : 1.75)), t.setY(-(t.y / window.innerHeight) * 2 + (o ? 1.35 : 1.125)), t.setZ(.5), t.unproject(e.camera).addScaledVector(n, .2))),
|
|
1375
|
+
ratio: f.distanceTo(h) / (o ? 150 : 120)
|
|
1376
|
+
};
|
|
1377
|
+
};
|
|
1378
|
+
function at(e) {
|
|
1379
|
+
let t = l.useRef(null), n = l.useRef(null), r = l.useRef(null), i = l.useRef(c(e.five));
|
|
1380
|
+
return l.useEffect(() => {
|
|
1381
|
+
if (!n.current) return;
|
|
1382
|
+
let o = (a) => {
|
|
1383
|
+
if (a.data.customType !== "SpatialScenePanel") return;
|
|
1384
|
+
let o = a.data, { points: s, ratio: c } = it({
|
|
1385
|
+
five: e.five,
|
|
1386
|
+
dom: n.current
|
|
1387
|
+
}), { container: l, dispose: u, css3DObject: d, render: f } = i.current.create3DDomContainer(s, {
|
|
1388
|
+
ratio: c,
|
|
1389
|
+
autoRender: !1
|
|
1390
|
+
}) || {};
|
|
1391
|
+
if (Object.assign(window, { $css3DObject: d }), !l) return;
|
|
1392
|
+
h(l).render(/* @__PURE__ */ D(st, {
|
|
1393
|
+
ref: (e) => {
|
|
1394
|
+
r.current = e;
|
|
1395
|
+
},
|
|
1396
|
+
data: o
|
|
1397
|
+
}));
|
|
1398
|
+
let p = -(Math.PI * 2) / 9, m = 0;
|
|
1399
|
+
W(1e3).onUpdate(({ progress: e }) => {
|
|
1400
|
+
let t = Math.PI / 90 * 11 * e, n = t - m;
|
|
1401
|
+
d?.rotateY(n), m = t;
|
|
1402
|
+
}).onStart(() => {
|
|
1403
|
+
d?.rotateY(p), f();
|
|
1404
|
+
}).onDispose(() => {
|
|
1405
|
+
r.current?.classList.add("show");
|
|
1406
|
+
}).play();
|
|
1407
|
+
let { start: g, end: _ } = a;
|
|
1408
|
+
t.current = setTimeout(() => {
|
|
1409
|
+
r.current?.classList.add("hide"), t.current = setTimeout(() => {
|
|
1410
|
+
u?.(), t.current = null;
|
|
1411
|
+
}, 1500);
|
|
1412
|
+
}, _ - g);
|
|
1413
|
+
};
|
|
1414
|
+
return Object.assign(window, { $callback: o }), e.subscribe.on(a.Custom, o), () => {
|
|
1415
|
+
e.subscribe.off(a.Custom, o), t.current && clearTimeout(t.current);
|
|
1416
|
+
};
|
|
1417
|
+
}, []), /* @__PURE__ */ D("div", {
|
|
1418
|
+
className: "vreo-SpatialScenePanel",
|
|
1419
|
+
ref: n
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
function ot() {
|
|
1423
|
+
let e = l.useRef(null), t = l.useRef(null);
|
|
1424
|
+
return l.useEffect(() => {
|
|
1425
|
+
if (!e.current) return;
|
|
1426
|
+
let n = () => {
|
|
1427
|
+
e.current?.setAttribute("class", "SpatialScenePanel-bg"), t.current = setTimeout(() => {
|
|
1428
|
+
e.current?.setAttribute("class", "SpatialScenePanel-bg SpatialScenePanel-bg--animation"), t.current = null;
|
|
1429
|
+
}, 3e3);
|
|
1430
|
+
};
|
|
1431
|
+
return e.current.addEventListener("animationend", n), () => {
|
|
1432
|
+
e.current && e.current.removeEventListener("animationend", n), t.current && clearTimeout(t.current);
|
|
1433
|
+
};
|
|
1434
|
+
}, []), /* @__PURE__ */ D("div", {
|
|
1435
|
+
ref: e,
|
|
1436
|
+
className: "SpatialScenePanel-bg SpatialScenePanel-bg--animation"
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
var st = l.forwardRef((e, t) => /* @__PURE__ */ O("div", {
|
|
1440
|
+
className: "SpatialScenePanel",
|
|
1441
|
+
ref: t,
|
|
1442
|
+
children: [/* @__PURE__ */ O("div", {
|
|
1443
|
+
className: "SpatialScenePanel-show-area",
|
|
1444
|
+
children: [
|
|
1445
|
+
/* @__PURE__ */ D(ot, {}),
|
|
1446
|
+
/* @__PURE__ */ O("div", {
|
|
1447
|
+
className: "SpatialScenePanel-header",
|
|
1448
|
+
children: [/* @__PURE__ */ D("div", {
|
|
1449
|
+
className: "SpatialScenePanel-title",
|
|
1450
|
+
children: e.data?.title
|
|
1451
|
+
}), /* @__PURE__ */ O("div", {
|
|
1452
|
+
className: "SpatialScenePanel-temperature",
|
|
1453
|
+
children: [e.data?.temperature, "℃"]
|
|
1454
|
+
})]
|
|
1455
|
+
}),
|
|
1456
|
+
/* @__PURE__ */ D("div", {
|
|
1457
|
+
className: "SpatialScenePanel-body",
|
|
1458
|
+
children: e.data?.stateList?.map((e, t) => /* @__PURE__ */ O("div", {
|
|
1459
|
+
className: `SpatialScenePanel-item index_${t}`,
|
|
1460
|
+
children: [
|
|
1461
|
+
/* @__PURE__ */ D("img", {
|
|
1462
|
+
className: "SpatialScenePanel-icon",
|
|
1463
|
+
src: e.icon,
|
|
1464
|
+
alt: `${e.text}`
|
|
1465
|
+
}),
|
|
1466
|
+
/* @__PURE__ */ D("div", {
|
|
1467
|
+
className: "SpatialScenePanel-text",
|
|
1468
|
+
children: e.text
|
|
1469
|
+
}),
|
|
1470
|
+
/* @__PURE__ */ D("div", { className: "SpatialScenePanel-dot" })
|
|
1471
|
+
]
|
|
1472
|
+
}, `scene-${e.text}`))
|
|
1473
|
+
})
|
|
1474
|
+
]
|
|
1475
|
+
}), /* @__PURE__ */ D("div", { className: "SpatialScenePanel-disappear-area" })]
|
|
1476
|
+
})), ct = 3, $ = "vreo-app-dhjskadhksahdjskahdjksa";
|
|
1477
|
+
function lt() {
|
|
1478
|
+
return typeof location > "u" ? ct : Number(location.search.match(/audio_cache=(\d+)/)?.[1] ?? ct);
|
|
1479
|
+
}
|
|
1480
|
+
var ut = class extends g {
|
|
1481
|
+
$five;
|
|
1482
|
+
controller;
|
|
1483
|
+
root;
|
|
1484
|
+
disposers = [];
|
|
1485
|
+
loadGeneration = 0;
|
|
1486
|
+
disposed = !1;
|
|
1487
|
+
getMediaManager() {
|
|
1488
|
+
return this.controller.playback.capture()?.mediaManager;
|
|
1489
|
+
}
|
|
1490
|
+
configs;
|
|
1491
|
+
constructor(e, t = {}) {
|
|
1492
|
+
if (super(), this.$five = e, He(lt()), t.container ||= t.containter, !t.container) {
|
|
1493
|
+
let n = document.getElementById($);
|
|
1494
|
+
n && n.remove();
|
|
1495
|
+
let r = document.createElement("div");
|
|
1496
|
+
r.id = $, t.container = r;
|
|
1497
|
+
let i = e.getElement()?.parentNode;
|
|
1498
|
+
i ? i.append(r) : document.body.append(r);
|
|
1499
|
+
}
|
|
1500
|
+
t.container.classList.contains("vreo-app") || t.container.classList.add("vreo-app"), this.configs = Object.freeze(Object.assign({ keyframeMap: {} }, t)), this.controller = new _e({
|
|
1501
|
+
five: e,
|
|
1502
|
+
container: t.container,
|
|
1503
|
+
configs: this.configs
|
|
1504
|
+
}), this.root = h(t.container), this.root.render(/* @__PURE__ */ O(P.Provider, {
|
|
1505
|
+
value: this.controller,
|
|
1506
|
+
children: [
|
|
1507
|
+
/* @__PURE__ */ D($e, {}),
|
|
1508
|
+
/* @__PURE__ */ D(tt, {}),
|
|
1509
|
+
/* @__PURE__ */ D(rt, {}),
|
|
1510
|
+
this.configs.customKeyframes && this.configs.customKeyframes.map((t, n) => /* @__PURE__ */ D(t, {
|
|
1511
|
+
subscribe: {
|
|
1512
|
+
on: (e, t) => this.on(e, t),
|
|
1513
|
+
once: (e, t) => this.once(e, t),
|
|
1514
|
+
off: (e, t) => this.off(e, t)
|
|
1515
|
+
},
|
|
1516
|
+
five: e,
|
|
1517
|
+
getMediaManager: () => this.getMediaManager()
|
|
1518
|
+
}, n))
|
|
1519
|
+
]
|
|
1520
|
+
})), this.disposers.push(w(() => this.controller.ended, (e) => {
|
|
1521
|
+
e && this.emit("paused", !0);
|
|
1522
|
+
})), this.disposers.push(w(() => this.controller.playing, (e) => {
|
|
1523
|
+
this.controller.ended || this.emit(e ? "playing" : "paused");
|
|
1524
|
+
}));
|
|
1525
|
+
}
|
|
1526
|
+
async load(e, t = 0, n = !1, r = !1, i = !1) {
|
|
1527
|
+
let o = ++this.loadGeneration;
|
|
1528
|
+
if (this.controller.playback.cancel(), this.disposed || !this.controller.playback.begin(i)) return !1;
|
|
1529
|
+
let s = this.controller.playback.capture(), c = () => s.valid();
|
|
1530
|
+
try {
|
|
1531
|
+
if (this.controller.clear(), this.controller.setLoading(!0), r && (e = JSON.parse(JSON.stringify(e))), this.controller.stopInterval && (this.controller.stopInterval(), this.controller.stopInterval = void 0), this.controller.vreoUnit = e, this.controller.loadTimeline(e.keyframes), this.controller.videoAgentScene?.videoAgentMesh.mediaOperations?.pause(), this.$five.imageOptions.size && this.configs.imageOptions?.size && this.$five.imageOptions.size > this.configs.imageOptions.size && (this.$five.imageOptions.size = this.configs.imageOptions.size), n || n === void 0 && this.configs.autoPreload) {
|
|
1532
|
+
let t = e.keyframes.filter((e) => e.type === a.CameraMovement && e.data.panoIndex !== void 0).reduce((e, t) => {
|
|
1533
|
+
let n = t.data.panoIndex;
|
|
1534
|
+
return e[n] || (e[n] = !0), e;
|
|
1535
|
+
}, {}), n = Object.keys(t);
|
|
1536
|
+
for (let e = 0; e < n.length; e++) if (await this.$five.preloadPano(Number(n[e])), !c() || o !== this.loadGeneration) return !1;
|
|
1537
|
+
}
|
|
1538
|
+
return this.emit("loaded", e), this.controller.emit("loaded", e), !c() || o !== this.loadGeneration || (this.controller.videoAgentScene?.videoAgentMesh.mediaOperations && (this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = t / 1e3), this.controller.setAvatar(e.video.avatar), await Ve(), !c() || o !== this.loadGeneration) || (await this.controller.videoAgentScene?.videoAgentMesh.play(e.video.url, t / 1e3, e.video.duration), !c() || o !== this.loadGeneration) ? !1 : (this.controller.setEnded(!1), this.play(void 0, i), this.controller.run((e, t) => this.emit(e, t, this.controller.currentTime)), this.controller.setLoading(!1), !0);
|
|
1539
|
+
} catch (e) {
|
|
1540
|
+
if (!c()) return !1;
|
|
1541
|
+
throw this.controller.playback.cancel(), e;
|
|
1542
|
+
} finally {
|
|
1543
|
+
o === this.loadGeneration && this.controller.setLoading(!1);
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
get paused() {
|
|
1547
|
+
return !this.controller.playing;
|
|
1548
|
+
}
|
|
1549
|
+
play(e, t = !1) {
|
|
1550
|
+
if (this.disposed || !this.controller.playback.begin(t)) return !1;
|
|
1551
|
+
if (e !== void 0) {
|
|
1552
|
+
let t = this.controller.videoAgentScene?.videoAgentMesh.mediaOperations;
|
|
1553
|
+
t && (t.currentTime = e / 1e3), this.controller.seekTimeline(e);
|
|
1554
|
+
}
|
|
1555
|
+
return this.controller.playing || (typeof window < "u" && Object.assign(window, { $vreoController: this.controller }), this.controller.setEnded(!1), this.controller.setPlaying(!0), this.controller.vreoUnit?.keyframes.forEach((e) => {
|
|
1556
|
+
e.type === a.BgMusic && this.controller.resetTimeline(a.BgMusic);
|
|
1557
|
+
})), !0;
|
|
1558
|
+
}
|
|
1559
|
+
setAppearance(e) {
|
|
1560
|
+
this.controller.setAppearance(e);
|
|
1561
|
+
}
|
|
1562
|
+
pause() {
|
|
1563
|
+
++this.loadGeneration, this.controller.playback.cancel(), this.controller.setLoading(!1);
|
|
1564
|
+
}
|
|
1565
|
+
show() {
|
|
1566
|
+
this.controller.setVisible(!0);
|
|
1567
|
+
}
|
|
1568
|
+
hide() {
|
|
1569
|
+
this.controller.setVisible(!1);
|
|
1570
|
+
}
|
|
1571
|
+
getCurrentTime() {
|
|
1572
|
+
return this.controller.currentTime;
|
|
1573
|
+
}
|
|
1574
|
+
dispose() {
|
|
1575
|
+
this.disposed || (this.disposed = !0, ++this.loadGeneration, this.disposers.splice(0).forEach((e) => e()), this.controller.dispose(), queueMicrotask(() => this.root.unmount()));
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
console.log("\n ┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━\n ┃┏━┓┃━━━━━━━━━┃┃━━━━━━━━━━━━━\n ┃┗━┛┃┏━━┓┏━━┓━┃┃━┏━━┓┏━━┓┏━━┓\n ┃┏┓┏┛┃┏┓┃┗━┓┃━┃┃━┃━━┫┃┏┓┃┃┏┓┃\n ┃┃┃┗┓┃┃━┫┃┗┛┗┓┃┗┓┣━━┃┃┃━┫┃┃━┫\n ┗┛┗━┛┗━━┛┗━━━┛┗━┛┗━━┛┗━━┛┗━━┛\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n");
|
|
1579
|
+
export { at as n, ut as t };
|
|
1580
|
+
|
|
1581
|
+
//# sourceMappingURL=Player-BzRqdH4q.js.map
|