@gui-chat-plugin/present3d 0.0.3 → 0.1.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/dist/vue.js CHANGED
@@ -1,714 +1,632 @@
1
- import { C as yt, V as w, M as x, T as O, Q as X, S as G, a as y, R as wt, P as Pt, b as Et, c as $, d as J, e as tt, W as et, A as it, D as st, G as Dt, p as z, f as Y, s as St, g as Tt } from "./index-B8W7aPbA.js";
2
- import { h as pe, i as de } from "./index-B8W7aPbA.js";
3
- import { defineComponent as ot, ref as M, computed as at, onMounted as nt, nextTick as q, onUnmounted as rt, watch as R, createElementBlock as Z, openBlock as K, createElementVNode as _, createCommentVNode as vt, toDisplayString as C, createTextVNode as k, withDirectives as Mt, vModelText as Rt } from "vue";
4
- const B = { type: "change" }, F = { type: "start" }, ht = { type: "end" }, j = new wt(), Q = new Pt(), Ot = Math.cos(70 * Et.DEG2RAD), d = new w(), f = 2 * Math.PI, h = {
5
- NONE: -1,
6
- ROTATE: 0,
7
- DOLLY: 1,
8
- PAN: 2,
9
- TOUCH_ROTATE: 3,
10
- TOUCH_PAN: 4,
11
- TOUCH_DOLLY_PAN: 5,
12
- TOUCH_DOLLY_ROTATE: 6
13
- }, U = 1e-6;
14
- class xt extends yt {
15
- /**
16
- * Constructs a new controls instance.
17
- *
18
- * @param {Object3D} object - The object that is managed by the controls.
19
- * @param {?HTMLElement} domElement - The HTML element used for event listeners.
20
- */
21
- constructor(t, e = null) {
22
- super(t, e), this.state = h.NONE, this.target = new w(), this.cursor = new w(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: x.ROTATE, MIDDLE: x.DOLLY, RIGHT: x.PAN }, this.touches = { ONE: O.ROTATE, TWO: O.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new w(), this._lastQuaternion = new X(), this._lastTargetPosition = new w(), this._quat = new X().setFromUnitVectors(t.up, new w(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new G(), this._sphericalDelta = new G(), this._scale = 1, this._panOffset = new w(), this._rotateStart = new y(), this._rotateEnd = new y(), this._rotateDelta = new y(), this._panStart = new y(), this._panEnd = new y(), this._panDelta = new y(), this._dollyStart = new y(), this._dollyEnd = new y(), this._dollyDelta = new y(), this._dollyDirection = new w(), this._mouse = new y(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Lt.bind(this), this._onPointerDown = Ct.bind(this), this._onPointerUp = At.bind(this), this._onContextMenu = Yt.bind(this), this._onMouseWheel = zt.bind(this), this._onKeyDown = Nt.bind(this), this._onTouchStart = It.bind(this), this._onTouchMove = Ut.bind(this), this._onMouseDown = kt.bind(this), this._onMouseMove = jt.bind(this), this._interceptControlDown = Zt.bind(this), this._interceptControlUp = Kt.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
23
- }
24
- connect(t) {
25
- super.connect(t), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
26
- }
27
- disconnect() {
28
- this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.getRootNode().removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.style.touchAction = "auto";
29
- }
30
- dispose() {
31
- this.disconnect();
32
- }
33
- /**
34
- * Get the current vertical rotation, in radians.
35
- *
36
- * @return {number} The current vertical rotation, in radians.
37
- */
38
- getPolarAngle() {
39
- return this._spherical.phi;
40
- }
41
- /**
42
- * Get the current horizontal rotation, in radians.
43
- *
44
- * @return {number} The current horizontal rotation, in radians.
45
- */
46
- getAzimuthalAngle() {
47
- return this._spherical.theta;
48
- }
49
- /**
50
- * Returns the distance from the camera to the target.
51
- *
52
- * @return {number} The distance from the camera to the target.
53
- */
54
- getDistance() {
55
- return this.object.position.distanceTo(this.target);
56
- }
57
- /**
58
- * Adds key event listeners to the given DOM element.
59
- * `window` is a recommended argument for using this method.
60
- *
61
- * @param {HTMLElement} domElement - The DOM element
62
- */
63
- listenToKeyEvents(t) {
64
- t.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = t;
65
- }
66
- /**
67
- * Removes the key event listener previously defined with `listenToKeyEvents()`.
68
- */
69
- stopListenToKeyEvents() {
70
- this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
71
- }
72
- /**
73
- * Save the current state of the controls. This can later be recovered with `reset()`.
74
- */
75
- saveState() {
76
- this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
77
- }
78
- /**
79
- * Reset the controls to their state from either the last time the `saveState()`
80
- * was called, or the initial state.
81
- */
82
- reset() {
83
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(B), this.update(), this.state = h.NONE;
84
- }
85
- update(t = null) {
86
- const e = this.object.position;
87
- d.copy(e).sub(this.target), d.applyQuaternion(this._quat), this._spherical.setFromVector3(d), this.autoRotate && this.state === h.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
88
- let s = this.minAzimuthAngle, o = this.maxAzimuthAngle;
89
- isFinite(s) && isFinite(o) && (s < -Math.PI ? s += f : s > Math.PI && (s -= f), o < -Math.PI ? o += f : o > Math.PI && (o -= f), s <= o ? this._spherical.theta = Math.max(s, Math.min(o, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + o) / 2 ? Math.max(s, this._spherical.theta) : Math.min(o, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
90
- let n = !1;
91
- if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
92
- this._spherical.radius = this._clampDistance(this._spherical.radius);
93
- else {
94
- const l = this._spherical.radius;
95
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), n = l != this._spherical.radius;
96
- }
97
- if (d.setFromSpherical(this._spherical), d.applyQuaternion(this._quatInverse), e.copy(this.target).add(d), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
98
- let l = null;
99
- if (this.object.isPerspectiveCamera) {
100
- const p = d.length();
101
- l = this._clampDistance(p * this._scale);
102
- const u = p - l;
103
- this.object.position.addScaledVector(this._dollyDirection, u), this.object.updateMatrixWorld(), n = !!u;
104
- } else if (this.object.isOrthographicCamera) {
105
- const p = new w(this._mouse.x, this._mouse.y, 0);
106
- p.unproject(this.object);
107
- const u = this.object.zoom;
108
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), n = u !== this.object.zoom;
109
- const S = new w(this._mouse.x, this._mouse.y, 0);
110
- S.unproject(this.object), this.object.position.sub(S).add(p), this.object.updateMatrixWorld(), l = d.length();
111
- } else
112
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
113
- l !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(l).add(this.object.position) : (j.origin.copy(this.object.position), j.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(j.direction)) < Ot ? this.object.lookAt(this.target) : (Q.setFromNormalAndCoplanarPoint(this.object.up, this.target), j.intersectPlane(Q, this.target))));
114
- } else if (this.object.isOrthographicCamera) {
115
- const l = this.object.zoom;
116
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), l !== this.object.zoom && (this.object.updateProjectionMatrix(), n = !0);
117
- }
118
- return this._scale = 1, this._performCursorZoom = !1, n || this._lastPosition.distanceToSquared(this.object.position) > U || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > U || this._lastTargetPosition.distanceToSquared(this.target) > U ? (this.dispatchEvent(B), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
119
- }
120
- _getAutoRotationAngle(t) {
121
- return t !== null ? f / 60 * this.autoRotateSpeed * t : f / 60 / 60 * this.autoRotateSpeed;
122
- }
123
- _getZoomScale(t) {
124
- const e = Math.abs(t * 0.01);
125
- return Math.pow(0.95, this.zoomSpeed * e);
126
- }
127
- _rotateLeft(t) {
128
- this._sphericalDelta.theta -= t;
129
- }
130
- _rotateUp(t) {
131
- this._sphericalDelta.phi -= t;
132
- }
133
- _panLeft(t, e) {
134
- d.setFromMatrixColumn(e, 0), d.multiplyScalar(-t), this._panOffset.add(d);
135
- }
136
- _panUp(t, e) {
137
- this.screenSpacePanning === !0 ? d.setFromMatrixColumn(e, 1) : (d.setFromMatrixColumn(e, 0), d.crossVectors(this.object.up, d)), d.multiplyScalar(t), this._panOffset.add(d);
138
- }
139
- // deltaX and deltaY are in pixels; right and down are positive
140
- _pan(t, e) {
141
- const s = this.domElement;
142
- if (this.object.isPerspectiveCamera) {
143
- const o = this.object.position;
144
- d.copy(o).sub(this.target);
145
- let n = d.length();
146
- n *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * n / s.clientHeight, this.object.matrix), this._panUp(2 * e * n / s.clientHeight, this.object.matrix);
147
- } else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth, this.object.matrix), this._panUp(e * (this.object.top - this.object.bottom) / this.object.zoom / s.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
148
- }
149
- _dollyOut(t) {
150
- this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
151
- }
152
- _dollyIn(t) {
153
- this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
154
- }
155
- _updateZoomParameters(t, e) {
156
- if (!this.zoomToCursor)
157
- return;
158
- this._performCursorZoom = !0;
159
- const s = this.domElement.getBoundingClientRect(), o = t - s.left, n = e - s.top, l = s.width, p = s.height;
160
- this._mouse.x = o / l * 2 - 1, this._mouse.y = -(n / p) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
161
- }
162
- _clampDistance(t) {
163
- return Math.max(this.minDistance, Math.min(this.maxDistance, t));
164
- }
165
- //
166
- // event callbacks - update the object state
167
- //
168
- _handleMouseDownRotate(t) {
169
- this._rotateStart.set(t.clientX, t.clientY);
170
- }
171
- _handleMouseDownDolly(t) {
172
- this._updateZoomParameters(t.clientX, t.clientX), this._dollyStart.set(t.clientX, t.clientY);
173
- }
174
- _handleMouseDownPan(t) {
175
- this._panStart.set(t.clientX, t.clientY);
176
- }
177
- _handleMouseMoveRotate(t) {
178
- this._rotateEnd.set(t.clientX, t.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
179
- const e = this.domElement;
180
- this._rotateLeft(f * this._rotateDelta.x / e.clientHeight), this._rotateUp(f * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
181
- }
182
- _handleMouseMoveDolly(t) {
183
- this._dollyEnd.set(t.clientX, t.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
184
- }
185
- _handleMouseMovePan(t) {
186
- this._panEnd.set(t.clientX, t.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
187
- }
188
- _handleMouseWheel(t) {
189
- this._updateZoomParameters(t.clientX, t.clientY), t.deltaY < 0 ? this._dollyIn(this._getZoomScale(t.deltaY)) : t.deltaY > 0 && this._dollyOut(this._getZoomScale(t.deltaY)), this.update();
190
- }
191
- _handleKeyDown(t) {
192
- let e = !1;
193
- switch (t.code) {
194
- case this.keys.UP:
195
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(f * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), e = !0;
196
- break;
197
- case this.keys.BOTTOM:
198
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(-f * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), e = !0;
199
- break;
200
- case this.keys.LEFT:
201
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(f * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), e = !0;
202
- break;
203
- case this.keys.RIGHT:
204
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(-f * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), e = !0;
205
- break;
206
- }
207
- e && (t.preventDefault(), this.update());
208
- }
209
- _handleTouchStartRotate(t) {
210
- if (this._pointers.length === 1)
211
- this._rotateStart.set(t.pageX, t.pageY);
212
- else {
213
- const e = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + e.x), o = 0.5 * (t.pageY + e.y);
214
- this._rotateStart.set(s, o);
215
- }
216
- }
217
- _handleTouchStartPan(t) {
218
- if (this._pointers.length === 1)
219
- this._panStart.set(t.pageX, t.pageY);
220
- else {
221
- const e = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + e.x), o = 0.5 * (t.pageY + e.y);
222
- this._panStart.set(s, o);
223
- }
224
- }
225
- _handleTouchStartDolly(t) {
226
- const e = this._getSecondPointerPosition(t), s = t.pageX - e.x, o = t.pageY - e.y, n = Math.sqrt(s * s + o * o);
227
- this._dollyStart.set(0, n);
228
- }
229
- _handleTouchStartDollyPan(t) {
230
- this.enableZoom && this._handleTouchStartDolly(t), this.enablePan && this._handleTouchStartPan(t);
231
- }
232
- _handleTouchStartDollyRotate(t) {
233
- this.enableZoom && this._handleTouchStartDolly(t), this.enableRotate && this._handleTouchStartRotate(t);
234
- }
235
- _handleTouchMoveRotate(t) {
236
- if (this._pointers.length == 1)
237
- this._rotateEnd.set(t.pageX, t.pageY);
238
- else {
239
- const s = this._getSecondPointerPosition(t), o = 0.5 * (t.pageX + s.x), n = 0.5 * (t.pageY + s.y);
240
- this._rotateEnd.set(o, n);
241
- }
242
- this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
243
- const e = this.domElement;
244
- this._rotateLeft(f * this._rotateDelta.x / e.clientHeight), this._rotateUp(f * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd);
245
- }
246
- _handleTouchMovePan(t) {
247
- if (this._pointers.length === 1)
248
- this._panEnd.set(t.pageX, t.pageY);
249
- else {
250
- const e = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + e.x), o = 0.5 * (t.pageY + e.y);
251
- this._panEnd.set(s, o);
252
- }
253
- this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
254
- }
255
- _handleTouchMoveDolly(t) {
256
- const e = this._getSecondPointerPosition(t), s = t.pageX - e.x, o = t.pageY - e.y, n = Math.sqrt(s * s + o * o);
257
- this._dollyEnd.set(0, n), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
258
- const l = (t.pageX + e.x) * 0.5, p = (t.pageY + e.y) * 0.5;
259
- this._updateZoomParameters(l, p);
260
- }
261
- _handleTouchMoveDollyPan(t) {
262
- this.enableZoom && this._handleTouchMoveDolly(t), this.enablePan && this._handleTouchMovePan(t);
263
- }
264
- _handleTouchMoveDollyRotate(t) {
265
- this.enableZoom && this._handleTouchMoveDolly(t), this.enableRotate && this._handleTouchMoveRotate(t);
266
- }
267
- // pointers
268
- _addPointer(t) {
269
- this._pointers.push(t.pointerId);
270
- }
271
- _removePointer(t) {
272
- delete this._pointerPositions[t.pointerId];
273
- for (let e = 0; e < this._pointers.length; e++)
274
- if (this._pointers[e] == t.pointerId) {
275
- this._pointers.splice(e, 1);
276
- return;
277
- }
278
- }
279
- _isTrackingPointer(t) {
280
- for (let e = 0; e < this._pointers.length; e++)
281
- if (this._pointers[e] == t.pointerId) return !0;
282
- return !1;
283
- }
284
- _trackPointer(t) {
285
- let e = this._pointerPositions[t.pointerId];
286
- e === void 0 && (e = new y(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
287
- }
288
- _getSecondPointerPosition(t) {
289
- const e = t.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
290
- return this._pointerPositions[e];
291
- }
292
- //
293
- _customWheelEvent(t) {
294
- const e = t.deltaMode, s = {
295
- clientX: t.clientX,
296
- clientY: t.clientY,
297
- deltaY: t.deltaY
298
- };
299
- switch (e) {
300
- case 1:
301
- s.deltaY *= 16;
302
- break;
303
- case 2:
304
- s.deltaY *= 100;
305
- break;
306
- }
307
- return t.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
308
- }
309
- }
310
- function Ct(i) {
311
- this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(i.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(i) && (this._addPointer(i), i.pointerType === "touch" ? this._onTouchStart(i) : this._onMouseDown(i)));
1
+ import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, w as b, x, y as S } from "./toThreeJS-Cmz9VcXY.js";
2
+ import { computed as C, createCommentVNode as ee, createElementBlock as w, createElementVNode as T, createTextVNode as E, defineComponent as D, nextTick as O, onMounted as k, onUnmounted as A, openBlock as j, ref as M, toDisplayString as N, vModelText as te, watch as P, withDirectives as ne } from "vue";
3
+ //#region node_modules/three/examples/jsm/controls/OrbitControls.js
4
+ var F = { type: "change" }, I = { type: "start" }, L = { type: "end" }, R = new m(), z = new a(), B = Math.cos(70 * u.DEG2RAD), V = new y(), H = 2 * Math.PI, U = {
5
+ NONE: -1,
6
+ ROTATE: 0,
7
+ DOLLY: 1,
8
+ PAN: 2,
9
+ TOUCH_ROTATE: 3,
10
+ TOUCH_PAN: 4,
11
+ TOUCH_DOLLY_PAN: 5,
12
+ TOUCH_DOLLY_ROTATE: 6
13
+ }, W = 1e-6, re = class extends n {
14
+ constructor(e, n = null) {
15
+ super(e, n), this.state = U.NONE, this.target = new y(), this.cursor = new y(), this.minDistance = 0, this.maxDistance = Infinity, this.minZoom = 0, this.maxZoom = Infinity, this.minTargetRadius = 0, this.maxTargetRadius = Infinity, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -Infinity, this.maxAzimuthAngle = Infinity, this.enableDamping = !1, this.dampingFactor = .05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = {
16
+ LEFT: "ArrowLeft",
17
+ UP: "ArrowUp",
18
+ RIGHT: "ArrowRight",
19
+ BOTTOM: "ArrowDown"
20
+ }, this.mouseButtons = {
21
+ LEFT: i.ROTATE,
22
+ MIDDLE: i.DOLLY,
23
+ RIGHT: i.PAN
24
+ }, this.touches = {
25
+ ONE: s.ROTATE,
26
+ TWO: s.DOLLY_PAN
27
+ }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new y(), this._lastQuaternion = new o(), this._lastTargetPosition = new y(), this._quat = new o().setFromUnitVectors(e.up, new y(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new c(), this._sphericalDelta = new c(), this._scale = 1, this._panOffset = new y(), this._rotateStart = new t(), this._rotateEnd = new t(), this._rotateDelta = new t(), this._panStart = new t(), this._panEnd = new t(), this._panDelta = new t(), this._dollyStart = new t(), this._dollyEnd = new t(), this._dollyDelta = new t(), this._dollyDirection = new y(), this._mouse = new t(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = K.bind(this), this._onPointerDown = G.bind(this), this._onPointerUp = q.bind(this), this._onContextMenu = oe.bind(this), this._onMouseWheel = X.bind(this), this._onKeyDown = Z.bind(this), this._onTouchStart = ie.bind(this), this._onTouchMove = ae.bind(this), this._onMouseDown = J.bind(this), this._onMouseMove = Y.bind(this), this._interceptControlDown = se.bind(this), this._interceptControlUp = ce.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
28
+ }
29
+ connect(e) {
30
+ super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, {
31
+ passive: !0,
32
+ capture: !0
33
+ }), this.domElement.style.touchAction = "none";
34
+ }
35
+ disconnect() {
36
+ this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.getRootNode().removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.style.touchAction = "auto";
37
+ }
38
+ dispose() {
39
+ this.disconnect();
40
+ }
41
+ getPolarAngle() {
42
+ return this._spherical.phi;
43
+ }
44
+ getAzimuthalAngle() {
45
+ return this._spherical.theta;
46
+ }
47
+ getDistance() {
48
+ return this.object.position.distanceTo(this.target);
49
+ }
50
+ listenToKeyEvents(e) {
51
+ e.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = e;
52
+ }
53
+ stopListenToKeyEvents() {
54
+ this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
55
+ }
56
+ saveState() {
57
+ this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
58
+ }
59
+ reset() {
60
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(F), this.update(), this.state = U.NONE;
61
+ }
62
+ update(e = null) {
63
+ let t = this.object.position;
64
+ V.copy(t).sub(this.target), V.applyQuaternion(this._quat), this._spherical.setFromVector3(V), this.autoRotate && this.state === U.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
65
+ let n = this.minAzimuthAngle, r = this.maxAzimuthAngle;
66
+ isFinite(n) && isFinite(r) && (n < -Math.PI ? n += H : n > Math.PI && (n -= H), r < -Math.PI ? r += H : r > Math.PI && (r -= H), n <= r ? this._spherical.theta = Math.max(n, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + r) / 2 ? Math.max(n, this._spherical.theta) : Math.min(r, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
67
+ let i = !1;
68
+ if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) this._spherical.radius = this._clampDistance(this._spherical.radius);
69
+ else {
70
+ let e = this._spherical.radius;
71
+ this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), i = e != this._spherical.radius;
72
+ }
73
+ if (V.setFromSpherical(this._spherical), V.applyQuaternion(this._quatInverse), t.copy(this.target).add(V), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
74
+ let e = null;
75
+ if (this.object.isPerspectiveCamera) {
76
+ let t = V.length();
77
+ e = this._clampDistance(t * this._scale);
78
+ let n = t - e;
79
+ this.object.position.addScaledVector(this._dollyDirection, n), this.object.updateMatrixWorld(), i = !!n;
80
+ } else if (this.object.isOrthographicCamera) {
81
+ let t = new y(this._mouse.x, this._mouse.y, 0);
82
+ t.unproject(this.object);
83
+ let n = this.object.zoom;
84
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i = n !== this.object.zoom;
85
+ let r = new y(this._mouse.x, this._mouse.y, 0);
86
+ r.unproject(this.object), this.object.position.sub(r).add(t), this.object.updateMatrixWorld(), e = V.length();
87
+ } else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
88
+ e !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position) : (R.origin.copy(this.object.position), R.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(R.direction)) < B ? this.object.lookAt(this.target) : (z.setFromNormalAndCoplanarPoint(this.object.up, this.target), R.intersectPlane(z, this.target))));
89
+ } else if (this.object.isOrthographicCamera) {
90
+ let e = this.object.zoom;
91
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), e !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
92
+ }
93
+ return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > W || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > W || this._lastTargetPosition.distanceToSquared(this.target) > W ? (this.dispatchEvent(F), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
94
+ }
95
+ _getAutoRotationAngle(e) {
96
+ return e === null ? H / 60 / 60 * this.autoRotateSpeed : H / 60 * this.autoRotateSpeed * e;
97
+ }
98
+ _getZoomScale(e) {
99
+ let t = Math.abs(e * .01);
100
+ return .95 ** (this.zoomSpeed * t);
101
+ }
102
+ _rotateLeft(e) {
103
+ this._sphericalDelta.theta -= e;
104
+ }
105
+ _rotateUp(e) {
106
+ this._sphericalDelta.phi -= e;
107
+ }
108
+ _panLeft(e, t) {
109
+ V.setFromMatrixColumn(t, 0), V.multiplyScalar(-e), this._panOffset.add(V);
110
+ }
111
+ _panUp(e, t) {
112
+ this.screenSpacePanning === !0 ? V.setFromMatrixColumn(t, 1) : (V.setFromMatrixColumn(t, 0), V.crossVectors(this.object.up, V)), V.multiplyScalar(e), this._panOffset.add(V);
113
+ }
114
+ _pan(e, t) {
115
+ let n = this.domElement;
116
+ if (this.object.isPerspectiveCamera) {
117
+ let r = this.object.position;
118
+ V.copy(r).sub(this.target);
119
+ let i = V.length();
120
+ i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / n.clientHeight, this.object.matrix), this._panUp(2 * t * i / n.clientHeight, this.object.matrix);
121
+ } else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
122
+ }
123
+ _dollyOut(e) {
124
+ this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
125
+ }
126
+ _dollyIn(e) {
127
+ this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
128
+ }
129
+ _updateZoomParameters(e, t) {
130
+ if (!this.zoomToCursor) return;
131
+ this._performCursorZoom = !0;
132
+ let n = this.domElement.getBoundingClientRect(), r = e - n.left, i = t - n.top, a = n.width, o = n.height;
133
+ this._mouse.x = r / a * 2 - 1, this._mouse.y = -(i / o) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
134
+ }
135
+ _clampDistance(e) {
136
+ return Math.max(this.minDistance, Math.min(this.maxDistance, e));
137
+ }
138
+ _handleMouseDownRotate(e) {
139
+ this._rotateStart.set(e.clientX, e.clientY);
140
+ }
141
+ _handleMouseDownDolly(e) {
142
+ this._updateZoomParameters(e.clientX, e.clientX), this._dollyStart.set(e.clientX, e.clientY);
143
+ }
144
+ _handleMouseDownPan(e) {
145
+ this._panStart.set(e.clientX, e.clientY);
146
+ }
147
+ _handleMouseMoveRotate(e) {
148
+ this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
149
+ let t = this.domElement;
150
+ this._rotateLeft(H * this._rotateDelta.x / t.clientHeight), this._rotateUp(H * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
151
+ }
152
+ _handleMouseMoveDolly(e) {
153
+ this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
154
+ }
155
+ _handleMouseMovePan(e) {
156
+ this._panEnd.set(e.clientX, e.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
157
+ }
158
+ _handleMouseWheel(e) {
159
+ this._updateZoomParameters(e.clientX, e.clientY), e.deltaY < 0 ? this._dollyIn(this._getZoomScale(e.deltaY)) : e.deltaY > 0 && this._dollyOut(this._getZoomScale(e.deltaY)), this.update();
160
+ }
161
+ _handleKeyDown(e) {
162
+ let t = !1;
163
+ switch (e.code) {
164
+ case this.keys.UP:
165
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
166
+ break;
167
+ case this.keys.BOTTOM:
168
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
169
+ break;
170
+ case this.keys.LEFT:
171
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
172
+ break;
173
+ case this.keys.RIGHT:
174
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
175
+ break;
176
+ }
177
+ t && (e.preventDefault(), this.update());
178
+ }
179
+ _handleTouchStartRotate(e) {
180
+ if (this._pointers.length === 1) this._rotateStart.set(e.pageX, e.pageY);
181
+ else {
182
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
183
+ this._rotateStart.set(n, r);
184
+ }
185
+ }
186
+ _handleTouchStartPan(e) {
187
+ if (this._pointers.length === 1) this._panStart.set(e.pageX, e.pageY);
188
+ else {
189
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
190
+ this._panStart.set(n, r);
191
+ }
192
+ }
193
+ _handleTouchStartDolly(e) {
194
+ let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
195
+ this._dollyStart.set(0, i);
196
+ }
197
+ _handleTouchStartDollyPan(e) {
198
+ this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
199
+ }
200
+ _handleTouchStartDollyRotate(e) {
201
+ this.enableZoom && this._handleTouchStartDolly(e), this.enableRotate && this._handleTouchStartRotate(e);
202
+ }
203
+ _handleTouchMoveRotate(e) {
204
+ if (this._pointers.length == 1) this._rotateEnd.set(e.pageX, e.pageY);
205
+ else {
206
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
207
+ this._rotateEnd.set(n, r);
208
+ }
209
+ this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
210
+ let t = this.domElement;
211
+ this._rotateLeft(H * this._rotateDelta.x / t.clientHeight), this._rotateUp(H * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
212
+ }
213
+ _handleTouchMovePan(e) {
214
+ if (this._pointers.length === 1) this._panEnd.set(e.pageX, e.pageY);
215
+ else {
216
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
217
+ this._panEnd.set(n, r);
218
+ }
219
+ this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
220
+ }
221
+ _handleTouchMoveDolly(e) {
222
+ let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
223
+ this._dollyEnd.set(0, i), this._dollyDelta.set(0, (this._dollyEnd.y / this._dollyStart.y) ** +this.zoomSpeed), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
224
+ let a = (e.pageX + t.x) * .5, o = (e.pageY + t.y) * .5;
225
+ this._updateZoomParameters(a, o);
226
+ }
227
+ _handleTouchMoveDollyPan(e) {
228
+ this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
229
+ }
230
+ _handleTouchMoveDollyRotate(e) {
231
+ this.enableZoom && this._handleTouchMoveDolly(e), this.enableRotate && this._handleTouchMoveRotate(e);
232
+ }
233
+ _addPointer(e) {
234
+ this._pointers.push(e.pointerId);
235
+ }
236
+ _removePointer(e) {
237
+ delete this._pointerPositions[e.pointerId];
238
+ for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) {
239
+ this._pointers.splice(t, 1);
240
+ return;
241
+ }
242
+ }
243
+ _isTrackingPointer(e) {
244
+ for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) return !0;
245
+ return !1;
246
+ }
247
+ _trackPointer(e) {
248
+ let n = this._pointerPositions[e.pointerId];
249
+ n === void 0 && (n = new t(), this._pointerPositions[e.pointerId] = n), n.set(e.pageX, e.pageY);
250
+ }
251
+ _getSecondPointerPosition(e) {
252
+ let t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
253
+ return this._pointerPositions[t];
254
+ }
255
+ _customWheelEvent(e) {
256
+ let t = e.deltaMode, n = {
257
+ clientX: e.clientX,
258
+ clientY: e.clientY,
259
+ deltaY: e.deltaY
260
+ };
261
+ switch (t) {
262
+ case 1:
263
+ n.deltaY *= 16;
264
+ break;
265
+ case 2:
266
+ n.deltaY *= 100;
267
+ break;
268
+ }
269
+ return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
270
+ }
271
+ };
272
+ function G(e) {
273
+ this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(e) && (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e)));
312
274
  }
313
- function Lt(i) {
314
- this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
275
+ function K(e) {
276
+ this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
315
277
  }
316
- function At(i) {
317
- switch (this._removePointer(i), this._pointers.length) {
318
- case 0:
319
- this.domElement.releasePointerCapture(i.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ht), this.state = h.NONE;
320
- break;
321
- case 1:
322
- const t = this._pointers[0], e = this._pointerPositions[t];
323
- this._onTouchStart({ pointerId: t, pageX: e.x, pageY: e.y });
324
- break;
325
- }
278
+ function q(e) {
279
+ switch (this._removePointer(e), this._pointers.length) {
280
+ case 0:
281
+ this.domElement.releasePointerCapture(e.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(L), this.state = U.NONE;
282
+ break;
283
+ case 1:
284
+ let t = this._pointers[0], n = this._pointerPositions[t];
285
+ this._onTouchStart({
286
+ pointerId: t,
287
+ pageX: n.x,
288
+ pageY: n.y
289
+ });
290
+ break;
291
+ }
326
292
  }
327
- function kt(i) {
328
- let t;
329
- switch (i.button) {
330
- case 0:
331
- t = this.mouseButtons.LEFT;
332
- break;
333
- case 1:
334
- t = this.mouseButtons.MIDDLE;
335
- break;
336
- case 2:
337
- t = this.mouseButtons.RIGHT;
338
- break;
339
- default:
340
- t = -1;
341
- }
342
- switch (t) {
343
- case x.DOLLY:
344
- if (this.enableZoom === !1) return;
345
- this._handleMouseDownDolly(i), this.state = h.DOLLY;
346
- break;
347
- case x.ROTATE:
348
- if (i.ctrlKey || i.metaKey || i.shiftKey) {
349
- if (this.enablePan === !1) return;
350
- this._handleMouseDownPan(i), this.state = h.PAN;
351
- } else {
352
- if (this.enableRotate === !1) return;
353
- this._handleMouseDownRotate(i), this.state = h.ROTATE;
354
- }
355
- break;
356
- case x.PAN:
357
- if (i.ctrlKey || i.metaKey || i.shiftKey) {
358
- if (this.enableRotate === !1) return;
359
- this._handleMouseDownRotate(i), this.state = h.ROTATE;
360
- } else {
361
- if (this.enablePan === !1) return;
362
- this._handleMouseDownPan(i), this.state = h.PAN;
363
- }
364
- break;
365
- default:
366
- this.state = h.NONE;
367
- }
368
- this.state !== h.NONE && this.dispatchEvent(F);
293
+ function J(e) {
294
+ let t;
295
+ switch (e.button) {
296
+ case 0:
297
+ t = this.mouseButtons.LEFT;
298
+ break;
299
+ case 1:
300
+ t = this.mouseButtons.MIDDLE;
301
+ break;
302
+ case 2:
303
+ t = this.mouseButtons.RIGHT;
304
+ break;
305
+ default: t = -1;
306
+ }
307
+ switch (t) {
308
+ case i.DOLLY:
309
+ if (this.enableZoom === !1) return;
310
+ this._handleMouseDownDolly(e), this.state = U.DOLLY;
311
+ break;
312
+ case i.ROTATE:
313
+ if (e.ctrlKey || e.metaKey || e.shiftKey) {
314
+ if (this.enablePan === !1) return;
315
+ this._handleMouseDownPan(e), this.state = U.PAN;
316
+ } else {
317
+ if (this.enableRotate === !1) return;
318
+ this._handleMouseDownRotate(e), this.state = U.ROTATE;
319
+ }
320
+ break;
321
+ case i.PAN:
322
+ if (e.ctrlKey || e.metaKey || e.shiftKey) {
323
+ if (this.enableRotate === !1) return;
324
+ this._handleMouseDownRotate(e), this.state = U.ROTATE;
325
+ } else {
326
+ if (this.enablePan === !1) return;
327
+ this._handleMouseDownPan(e), this.state = U.PAN;
328
+ }
329
+ break;
330
+ default: this.state = U.NONE;
331
+ }
332
+ this.state !== U.NONE && this.dispatchEvent(I);
369
333
  }
370
- function jt(i) {
371
- switch (this.state) {
372
- case h.ROTATE:
373
- if (this.enableRotate === !1) return;
374
- this._handleMouseMoveRotate(i);
375
- break;
376
- case h.DOLLY:
377
- if (this.enableZoom === !1) return;
378
- this._handleMouseMoveDolly(i);
379
- break;
380
- case h.PAN:
381
- if (this.enablePan === !1) return;
382
- this._handleMouseMovePan(i);
383
- break;
384
- }
334
+ function Y(e) {
335
+ switch (this.state) {
336
+ case U.ROTATE:
337
+ if (this.enableRotate === !1) return;
338
+ this._handleMouseMoveRotate(e);
339
+ break;
340
+ case U.DOLLY:
341
+ if (this.enableZoom === !1) return;
342
+ this._handleMouseMoveDolly(e);
343
+ break;
344
+ case U.PAN:
345
+ if (this.enablePan === !1) return;
346
+ this._handleMouseMovePan(e);
347
+ break;
348
+ }
385
349
  }
386
- function zt(i) {
387
- this.enabled === !1 || this.enableZoom === !1 || this.state !== h.NONE || (i.preventDefault(), this.dispatchEvent(F), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(ht));
350
+ function X(e) {
351
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== U.NONE || (e.preventDefault(), this.dispatchEvent(I), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(L));
388
352
  }
389
- function Nt(i) {
390
- this.enabled !== !1 && this._handleKeyDown(i);
353
+ function Z(e) {
354
+ this.enabled !== !1 && this._handleKeyDown(e);
391
355
  }
392
- function It(i) {
393
- switch (this._trackPointer(i), this._pointers.length) {
394
- case 1:
395
- switch (this.touches.ONE) {
396
- case O.ROTATE:
397
- if (this.enableRotate === !1) return;
398
- this._handleTouchStartRotate(i), this.state = h.TOUCH_ROTATE;
399
- break;
400
- case O.PAN:
401
- if (this.enablePan === !1) return;
402
- this._handleTouchStartPan(i), this.state = h.TOUCH_PAN;
403
- break;
404
- default:
405
- this.state = h.NONE;
406
- }
407
- break;
408
- case 2:
409
- switch (this.touches.TWO) {
410
- case O.DOLLY_PAN:
411
- if (this.enableZoom === !1 && this.enablePan === !1) return;
412
- this._handleTouchStartDollyPan(i), this.state = h.TOUCH_DOLLY_PAN;
413
- break;
414
- case O.DOLLY_ROTATE:
415
- if (this.enableZoom === !1 && this.enableRotate === !1) return;
416
- this._handleTouchStartDollyRotate(i), this.state = h.TOUCH_DOLLY_ROTATE;
417
- break;
418
- default:
419
- this.state = h.NONE;
420
- }
421
- break;
422
- default:
423
- this.state = h.NONE;
424
- }
425
- this.state !== h.NONE && this.dispatchEvent(F);
356
+ function ie(e) {
357
+ switch (this._trackPointer(e), this._pointers.length) {
358
+ case 1:
359
+ switch (this.touches.ONE) {
360
+ case s.ROTATE:
361
+ if (this.enableRotate === !1) return;
362
+ this._handleTouchStartRotate(e), this.state = U.TOUCH_ROTATE;
363
+ break;
364
+ case s.PAN:
365
+ if (this.enablePan === !1) return;
366
+ this._handleTouchStartPan(e), this.state = U.TOUCH_PAN;
367
+ break;
368
+ default: this.state = U.NONE;
369
+ }
370
+ break;
371
+ case 2:
372
+ switch (this.touches.TWO) {
373
+ case s.DOLLY_PAN:
374
+ if (this.enableZoom === !1 && this.enablePan === !1) return;
375
+ this._handleTouchStartDollyPan(e), this.state = U.TOUCH_DOLLY_PAN;
376
+ break;
377
+ case s.DOLLY_ROTATE:
378
+ if (this.enableZoom === !1 && this.enableRotate === !1) return;
379
+ this._handleTouchStartDollyRotate(e), this.state = U.TOUCH_DOLLY_ROTATE;
380
+ break;
381
+ default: this.state = U.NONE;
382
+ }
383
+ break;
384
+ default: this.state = U.NONE;
385
+ }
386
+ this.state !== U.NONE && this.dispatchEvent(I);
426
387
  }
427
- function Ut(i) {
428
- switch (this._trackPointer(i), this.state) {
429
- case h.TOUCH_ROTATE:
430
- if (this.enableRotate === !1) return;
431
- this._handleTouchMoveRotate(i), this.update();
432
- break;
433
- case h.TOUCH_PAN:
434
- if (this.enablePan === !1) return;
435
- this._handleTouchMovePan(i), this.update();
436
- break;
437
- case h.TOUCH_DOLLY_PAN:
438
- if (this.enableZoom === !1 && this.enablePan === !1) return;
439
- this._handleTouchMoveDollyPan(i), this.update();
440
- break;
441
- case h.TOUCH_DOLLY_ROTATE:
442
- if (this.enableZoom === !1 && this.enableRotate === !1) return;
443
- this._handleTouchMoveDollyRotate(i), this.update();
444
- break;
445
- default:
446
- this.state = h.NONE;
447
- }
388
+ function ae(e) {
389
+ switch (this._trackPointer(e), this.state) {
390
+ case U.TOUCH_ROTATE:
391
+ if (this.enableRotate === !1) return;
392
+ this._handleTouchMoveRotate(e), this.update();
393
+ break;
394
+ case U.TOUCH_PAN:
395
+ if (this.enablePan === !1) return;
396
+ this._handleTouchMovePan(e), this.update();
397
+ break;
398
+ case U.TOUCH_DOLLY_PAN:
399
+ if (this.enableZoom === !1 && this.enablePan === !1) return;
400
+ this._handleTouchMoveDollyPan(e), this.update();
401
+ break;
402
+ case U.TOUCH_DOLLY_ROTATE:
403
+ if (this.enableZoom === !1 && this.enableRotate === !1) return;
404
+ this._handleTouchMoveDollyRotate(e), this.update();
405
+ break;
406
+ default: this.state = U.NONE;
407
+ }
448
408
  }
449
- function Yt(i) {
450
- this.enabled !== !1 && i.preventDefault();
409
+ function oe(e) {
410
+ this.enabled !== !1 && e.preventDefault();
451
411
  }
452
- function Zt(i) {
453
- i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
412
+ function se(e) {
413
+ e.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, {
414
+ passive: !0,
415
+ capture: !0
416
+ }));
454
417
  }
455
- function Kt(i) {
456
- i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
418
+ function ce(e) {
419
+ e.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, {
420
+ passive: !0,
421
+ capture: !0
422
+ }));
457
423
  }
458
- const Ft = { class: "present3d-container" }, Ht = { class: "header" }, Vt = { class: "controls" }, Wt = { class: "material-icons" }, Xt = { class: "material-icons" }, Gt = {
459
- key: 0,
460
- class: "error"
461
- }, qt = { class: "script-source" }, Bt = ["disabled"], Qt = /* @__PURE__ */ ot({
462
- __name: "View",
463
- props: {
464
- selectedResult: {}
465
- },
466
- emits: ["updateResult"],
467
- setup(i, { emit: t }) {
468
- const e = i, s = t, o = M(e.selectedResult.data?.script ?? ""), n = M(null), l = M(null), p = M(!1), u = M(!0), S = at(() => o.value !== e.selectedResult.data?.script);
469
- let b, m, g, r, P, E, T = [], D = null, L = null;
470
- nt(() => {
471
- ct(), I(), H(), q(() => {
472
- V();
473
- });
474
- }), rt(() => {
475
- ft();
476
- }), R(
477
- () => e.selectedResult.data?.script,
478
- () => {
479
- I();
480
- }
481
- ), R(p, () => {
482
- I();
483
- }), R(u, (a) => {
484
- E && (E.visible = a);
485
- });
486
- function ct() {
487
- if (!n.value) return;
488
- b = new $(), b.background = new J(1710618);
489
- const a = n.value.clientWidth, c = n.value.clientHeight;
490
- m = new tt(50, a / c, 0.1, 1e3), m.position.set(5, 5, 10), m.lookAt(0, 0, 0), g = new et({ antialias: !0 }), g.setSize(a, c), g.setPixelRatio(window.devicePixelRatio), n.value.appendChild(g.domElement), r = new xt(m, g.domElement), r.enableDamping = !0, r.dampingFactor = 0.05, r.addEventListener("change", W);
491
- const v = new it(16777215, 0.6);
492
- b.add(v);
493
- const A = new st(16777215, 0.8);
494
- A.position.set(10, 10, 10), b.add(A), E = new Dt(20, 20, 4473924, 2236962), E.visible = u.value, b.add(E), window.addEventListener("resize", N), L = new ResizeObserver(() => {
495
- N();
496
- }), L.observe(n.value);
497
- }
498
- function N() {
499
- if (!n.value) return;
500
- const a = n.value.clientWidth, c = n.value.clientHeight;
501
- m.aspect = a / c, m.updateProjectionMatrix(), g.setSize(a, c);
502
- }
503
- function I() {
504
- try {
505
- T.forEach((A) => b.remove(A)), T = [];
506
- const a = e.selectedResult.data?.script;
507
- if (!a) return;
508
- const c = z(a), v = Y(c, { wireframe: p.value });
509
- b.add(v), T.push(v), l.value = null;
510
- } catch (a) {
511
- l.value = a instanceof Error ? a.message : "Unknown error", console.error("ShapeScript parse error:", a);
512
- }
513
- }
514
- function H() {
515
- P = requestAnimationFrame(H), r.update(), g.render(b, m);
516
- }
517
- function pt() {
518
- m.position.set(5, 5, 10), m.lookAt(0, 0, 0), r.reset();
519
- }
520
- function V() {
521
- if (!m || !r || !e.selectedResult?.viewState?.cameraState)
522
- return;
523
- const a = e.selectedResult.viewState.cameraState;
524
- a.position && m.position.set(a.position.x, a.position.y, a.position.z), a.target && r.target.set(a.target.x, a.target.y, a.target.z), m.updateProjectionMatrix(), r.update();
525
- }
526
- function dt() {
527
- return {
528
- position: {
529
- x: m.position.x,
530
- y: m.position.y,
531
- z: m.position.z
532
- },
533
- target: {
534
- x: r.target.x,
535
- y: r.target.y,
536
- z: r.target.z
537
- }
538
- };
539
- }
540
- function W() {
541
- D !== null && clearTimeout(D), D = window.setTimeout(() => {
542
- ut();
543
- }, 500);
544
- }
545
- function ut() {
546
- const a = {
547
- ...e.selectedResult,
548
- viewState: {
549
- cameraState: dt()
550
- }
551
- };
552
- s("updateResult", a);
553
- }
554
- function mt() {
555
- p.value = !p.value;
556
- }
557
- function _t() {
558
- u.value = !u.value;
559
- }
560
- function ft() {
561
- D !== null && clearTimeout(D), P && cancelAnimationFrame(P), g && g.dispose(), r && (r.removeEventListener("change", W), r.dispose()), L && L.disconnect(), window.removeEventListener("resize", N);
562
- }
563
- function bt() {
564
- }
565
- function gt() {
566
- try {
567
- z(o.value);
568
- const a = {
569
- ...e.selectedResult,
570
- data: {
571
- script: o.value
572
- }
573
- };
574
- s("updateResult", a);
575
- } catch (a) {
576
- l.value = a instanceof Error ? a.message : "Invalid ShapeScript", console.error("Script validation failed:", a);
577
- }
578
- }
579
- return R(
580
- () => e.selectedResult.data?.script,
581
- (a) => {
582
- a && (o.value = a);
583
- }
584
- ), R(
585
- () => e.selectedResult,
586
- () => {
587
- q(() => {
588
- V();
589
- });
590
- }
591
- ), (a, c) => (K(), Z("div", Ft, [
592
- _("div", Ht, [
593
- _("h1", null, C(i.selectedResult.title || "3D Visualization"), 1),
594
- _("div", Vt, [
595
- _("button", {
596
- onClick: pt,
597
- class: "control-btn"
598
- }, [...c[1] || (c[1] = [
599
- _("span", { class: "material-icons" }, "refresh", -1),
600
- k(" Reset Camera ", -1)
601
- ])]),
602
- _("button", {
603
- onClick: mt,
604
- class: "control-btn"
605
- }, [
606
- _("span", Wt, C(p.value ? "grid_off" : "grid_on"), 1),
607
- c[2] || (c[2] = k(" Wireframe ", -1))
608
- ]),
609
- _("button", {
610
- onClick: _t,
611
- class: "control-btn"
612
- }, [
613
- _("span", Xt, C(u.value ? "visibility_off" : "visibility"), 1),
614
- c[3] || (c[3] = k(" Grid ", -1))
615
- ])
616
- ])
617
- ]),
618
- l.value ? (K(), Z("div", Gt, [
619
- c[4] || (c[4] = _("strong", null, "Parse Error:", -1)),
620
- k(" " + C(l.value), 1)
621
- ])) : vt("", !0),
622
- _("div", {
623
- class: "viewport",
624
- ref_key: "viewport",
625
- ref: n
626
- }, null, 512),
627
- _("details", qt, [
628
- c[5] || (c[5] = _("summary", null, "Edit ShapeScript Source", -1)),
629
- Mt(_("textarea", {
630
- "onUpdate:modelValue": c[0] || (c[0] = (v) => o.value = v),
631
- onInput: bt,
632
- class: "script-editor",
633
- spellcheck: "false"
634
- }, null, 544), [
635
- [Rt, o.value]
636
- ]),
637
- _("button", {
638
- onClick: gt,
639
- class: "apply-btn",
640
- disabled: !S.value
641
- }, " Apply Changes ", 8, Bt)
642
- ])
643
- ]));
644
- }
645
- }), lt = (i, t) => {
646
- const e = i.__vccOpts || i;
647
- for (const [s, o] of t)
648
- e[s] = o;
649
- return e;
650
- }, $t = /* @__PURE__ */ lt(Qt, [["__scopeId", "data-v-daa337a0"]]), Jt = { class: "preview-container" }, te = { class: "preview-title" }, ee = /* @__PURE__ */ ot({
651
- __name: "Preview",
652
- props: {
653
- result: {}
654
- },
655
- setup(i) {
656
- const t = i, e = at(() => t.result.title || "3D Visualization"), s = M(null);
657
- let o, n, l, p, u = null;
658
- nt(() => {
659
- S();
660
- }), rt(() => {
661
- g();
662
- }), R(
663
- () => t.result.data?.script,
664
- () => {
665
- m();
666
- }
667
- );
668
- function S() {
669
- if (s.value)
670
- try {
671
- o = new $(), o.background = new J(2763322);
672
- const r = s.value.clientWidth || 200, P = s.value.clientHeight || 150;
673
- n = new tt(50, r / P, 0.1, 1e3), n.position.set(4, 4, 8), n.lookAt(0, 0, 0), l = new et({ antialias: !0, alpha: !1 }), l.setSize(r, P), l.setPixelRatio(Math.min(window.devicePixelRatio, 2)), s.value.appendChild(l.domElement);
674
- const E = new it(16777215, 0.6);
675
- o.add(E);
676
- const T = new st(16777215, 0.8);
677
- if (T.position.set(5, 5, 5), o.add(T), !t.result.data?.script) return;
678
- const D = z(t.result.data.script);
679
- u = Y(D, { wireframe: !1 }), o.add(u), b();
680
- } catch (r) {
681
- console.error("Preview render error:", r);
682
- }
683
- }
684
- function b() {
685
- p = requestAnimationFrame(b);
686
- const r = Date.now() * 5e-4;
687
- n.position.x = Math.cos(r) * 8, n.position.z = Math.sin(r) * 8, n.lookAt(0, 0, 0), l.render(o, n);
688
- }
689
- function m() {
690
- if (!(!o || !t.result.data?.script))
691
- try {
692
- u && o.remove(u);
693
- const r = z(t.result.data.script);
694
- u = Y(r, { wireframe: !1 }), o.add(u);
695
- } catch (r) {
696
- console.error("Preview reload error:", r);
697
- }
698
- }
699
- function g() {
700
- p && cancelAnimationFrame(p), l && l.dispose();
701
- }
702
- return (r, P) => (K(), Z("div", Jt, [
703
- _("div", {
704
- ref_key: "previewViewport",
705
- ref: s,
706
- class: "preview-viewport"
707
- }, null, 512),
708
- _("div", te, C(e.value), 1)
709
- ]));
710
- }
711
- }), ie = /* @__PURE__ */ lt(ee, [["__scopeId", "data-v-75941188"]]), se = "present3D", oe = `Use the ${se} tool to create interactive 3D visualizations when the user requests:
424
+ //#endregion
425
+ //#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
426
+ var le = { class: "present3d-container" }, ue = { class: "header" }, de = { class: "controls" }, fe = { class: "material-icons" }, pe = { class: "material-icons" }, me = {
427
+ key: 0,
428
+ class: "error"
429
+ }, he = { class: "script-source" }, ge = ["disabled"], _e = /* @__PURE__ */ D({
430
+ __name: "View",
431
+ props: { selectedResult: {} },
432
+ emits: ["updateResult"],
433
+ setup(e, { emit: t }) {
434
+ let n = e, r = t, i = M(n.selectedResult.data?.script ?? ""), a = M(null), o = M(null), s = M(!1), c = M(!0), u = C(() => i.value !== n.selectedResult.data?.script), m, y, b, x, D, F, I = [], L = null, R = null;
435
+ k(() => {
436
+ z(), V(), H(), O(() => {
437
+ W();
438
+ });
439
+ }), A(() => {
440
+ X();
441
+ }), P(() => n.selectedResult.data?.script, () => {
442
+ V();
443
+ }), P(s, () => {
444
+ V();
445
+ }), P(c, (e) => {
446
+ F && (F.visible = e);
447
+ });
448
+ function z() {
449
+ if (!a.value) return;
450
+ m = new d(), m.background = new l(1710618);
451
+ let e = a.value.clientWidth, t = a.value.clientHeight;
452
+ y = new v(50, e / t, .1, 1e3), y.position.set(5, 5, 10), y.lookAt(0, 0, 0), b = new f({ antialias: !0 }), b.setSize(e, t), b.setPixelRatio(window.devicePixelRatio), a.value.appendChild(b.domElement), x = new re(y, b.domElement), x.enableDamping = !0, x.dampingFactor = .05, x.addEventListener("change", K);
453
+ let n = new h(16777215, .6);
454
+ m.add(n);
455
+ let r = new p(16777215, .8);
456
+ r.position.set(10, 10, 10), m.add(r), F = new g(20, 20, 4473924, 2236962), F.visible = c.value, m.add(F), window.addEventListener("resize", B), R = new ResizeObserver(() => {
457
+ B();
458
+ }), R.observe(a.value);
459
+ }
460
+ function B() {
461
+ if (!a.value) return;
462
+ let e = a.value.clientWidth, t = a.value.clientHeight;
463
+ y.aspect = e / t, y.updateProjectionMatrix(), b.setSize(e, t);
464
+ }
465
+ function V() {
466
+ try {
467
+ I.forEach((e) => m.remove(e)), I = [];
468
+ let e = n.selectedResult.data?.script;
469
+ if (!e) return;
470
+ let t = _(S(e), { wireframe: s.value });
471
+ m.add(t), I.push(t), o.value = null;
472
+ } catch (e) {
473
+ o.value = e instanceof Error ? e.message : "Unknown error", console.error("ShapeScript parse error:", e);
474
+ }
475
+ }
476
+ function H() {
477
+ D = requestAnimationFrame(H), x.update(), b.render(m, y);
478
+ }
479
+ function U() {
480
+ y.position.set(5, 5, 10), y.lookAt(0, 0, 0), x.reset();
481
+ }
482
+ function W() {
483
+ if (!y || !x || !n.selectedResult?.viewState?.cameraState) return;
484
+ let e = n.selectedResult.viewState.cameraState;
485
+ e.position && y.position.set(e.position.x, e.position.y, e.position.z), e.target && x.target.set(e.target.x, e.target.y, e.target.z), y.updateProjectionMatrix(), x.update();
486
+ }
487
+ function G() {
488
+ return {
489
+ position: {
490
+ x: y.position.x,
491
+ y: y.position.y,
492
+ z: y.position.z
493
+ },
494
+ target: {
495
+ x: x.target.x,
496
+ y: x.target.y,
497
+ z: x.target.z
498
+ }
499
+ };
500
+ }
501
+ function K() {
502
+ L !== null && clearTimeout(L), L = window.setTimeout(() => {
503
+ q();
504
+ }, 500);
505
+ }
506
+ function q() {
507
+ r("updateResult", {
508
+ ...n.selectedResult,
509
+ viewState: { cameraState: G() }
510
+ });
511
+ }
512
+ function J() {
513
+ s.value = !s.value;
514
+ }
515
+ function Y() {
516
+ c.value = !c.value;
517
+ }
518
+ function X() {
519
+ L !== null && clearTimeout(L), D && cancelAnimationFrame(D), b && b.dispose(), x && (x.removeEventListener("change", K), x.dispose()), R && R.disconnect(), window.removeEventListener("resize", B);
520
+ }
521
+ function Z() {}
522
+ function ie() {
523
+ try {
524
+ S(i.value), r("updateResult", {
525
+ ...n.selectedResult,
526
+ data: { script: i.value }
527
+ });
528
+ } catch (e) {
529
+ o.value = e instanceof Error ? e.message : "Invalid ShapeScript", console.error("Script validation failed:", e);
530
+ }
531
+ }
532
+ return P(() => n.selectedResult.data?.script, (e) => {
533
+ e && (i.value = e);
534
+ }), P(() => n.selectedResult, () => {
535
+ O(() => {
536
+ W();
537
+ });
538
+ }), (t, n) => (j(), w("div", le, [
539
+ T("div", ue, [T("h1", null, N(e.selectedResult.title || "3D Visualization"), 1), T("div", de, [
540
+ T("button", {
541
+ onClick: U,
542
+ class: "control-btn"
543
+ }, [...n[1] ||= [T("span", { class: "material-icons" }, "refresh", -1), E(" Reset Camera ", -1)]]),
544
+ T("button", {
545
+ onClick: J,
546
+ class: "control-btn"
547
+ }, [T("span", fe, N(s.value ? "grid_off" : "grid_on"), 1), n[2] ||= E(" Wireframe ", -1)]),
548
+ T("button", {
549
+ onClick: Y,
550
+ class: "control-btn"
551
+ }, [T("span", pe, N(c.value ? "visibility_off" : "visibility"), 1), n[3] ||= E(" Grid ", -1)])
552
+ ])]),
553
+ o.value ? (j(), w("div", me, [n[4] ||= T("strong", null, "Parse Error:", -1), E(" " + N(o.value), 1)])) : ee("", !0),
554
+ T("div", {
555
+ class: "viewport",
556
+ ref_key: "viewport",
557
+ ref: a
558
+ }, null, 512),
559
+ T("details", he, [
560
+ n[5] ||= T("summary", null, "Edit ShapeScript Source", -1),
561
+ ne(T("textarea", {
562
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
563
+ onInput: Z,
564
+ class: "script-editor",
565
+ spellcheck: "false"
566
+ }, null, 544), [[te, i.value]]),
567
+ T("button", {
568
+ onClick: ie,
569
+ class: "apply-btn",
570
+ disabled: !u.value
571
+ }, " Apply Changes ", 8, ge)
572
+ ])
573
+ ]));
574
+ }
575
+ }), Q = (e, t) => {
576
+ let n = e.__vccOpts || e;
577
+ for (let [e, r] of t) n[e] = r;
578
+ return n;
579
+ }, ve = /* @__PURE__ */ Q(_e, [["__scopeId", "data-v-daa337a0"]]), ye = { class: "preview-container" }, be = { class: "preview-title" }, xe = /* @__PURE__ */ Q(/* @__PURE__ */ D({
580
+ __name: "Preview",
581
+ props: { result: {} },
582
+ setup(e) {
583
+ let t = e, n = C(() => t.result.title || "3D Visualization"), r = M(null), i, a, o, s, c = null;
584
+ k(() => {
585
+ u();
586
+ }), A(() => {
587
+ y();
588
+ }), P(() => t.result.data?.script, () => {
589
+ g();
590
+ });
591
+ function u() {
592
+ if (r.value) try {
593
+ i = new d(), i.background = new l(2763322);
594
+ let e = r.value.clientWidth || 200, n = r.value.clientHeight || 150;
595
+ a = new v(50, e / n, .1, 1e3), a.position.set(4, 4, 8), a.lookAt(0, 0, 0), o = new f({
596
+ antialias: !0,
597
+ alpha: !1
598
+ }), o.setSize(e, n), o.setPixelRatio(Math.min(window.devicePixelRatio, 2)), r.value.appendChild(o.domElement);
599
+ let s = new h(16777215, .6);
600
+ i.add(s);
601
+ let u = new p(16777215, .8);
602
+ if (u.position.set(5, 5, 5), i.add(u), !t.result.data?.script) return;
603
+ c = _(S(t.result.data.script), { wireframe: !1 }), i.add(c), m();
604
+ } catch (e) {
605
+ console.error("Preview render error:", e);
606
+ }
607
+ }
608
+ function m() {
609
+ s = requestAnimationFrame(m);
610
+ let e = Date.now() * 5e-4;
611
+ a.position.x = Math.cos(e) * 8, a.position.z = Math.sin(e) * 8, a.lookAt(0, 0, 0), o.render(i, a);
612
+ }
613
+ function g() {
614
+ if (!(!i || !t.result.data?.script)) try {
615
+ c && i.remove(c), c = _(S(t.result.data.script), { wireframe: !1 }), i.add(c);
616
+ } catch (e) {
617
+ console.error("Preview reload error:", e);
618
+ }
619
+ }
620
+ function y() {
621
+ s && cancelAnimationFrame(s), o && o.dispose();
622
+ }
623
+ return (e, t) => (j(), w("div", ye, [T("div", {
624
+ ref_key: "previewViewport",
625
+ ref: r,
626
+ class: "preview-viewport"
627
+ }, null, 512), T("div", be, N(n.value), 1)]));
628
+ }
629
+ }), [["__scopeId", "data-v-75941188"]]), Se = "present3D", Ce = `Use the ${Se} tool to create interactive 3D visualizations when the user requests:
712
630
  - 3D models or shapes
713
631
  - Mathematical visualizations (surfaces, functions, geometric patterns)
714
632
  - Molecular or atomic structures
@@ -789,24 +707,12 @@ Shapes: cube, sphere, cylinder, cone, torus
789
707
  CSG: union, difference, intersection, xor, stencil
790
708
  Properties: position, rotation, size, color, opacity
791
709
 
792
- Keep visualizations clear, well-organized, and leverage the full power of expressions and control flow.`, ae = {
793
- ...Tt,
794
- viewComponent: $t,
795
- previewComponent: ie,
796
- samples: St,
797
- systemPrompt: oe
798
- }, he = { plugin: ae };
799
- export {
800
- ie as Preview,
801
- oe as SYSTEM_PROMPT,
802
- pe as TOOL_DEFINITION,
803
- se as TOOL_NAME,
804
- $t as View,
805
- Y as astToThreeJS,
806
- he as default,
807
- de as executePresent3D,
808
- z as parseShapeScript,
809
- ae as plugin,
810
- Tt as pluginCore,
811
- St as samples
812
- };
710
+ Keep visualizations clear, well-organized, and leverage the full power of expressions and control flow.`, $ = {
711
+ ...e,
712
+ viewComponent: ve,
713
+ previewComponent: xe,
714
+ samples: r,
715
+ systemPrompt: Ce
716
+ }, we = { plugin: $ };
717
+ //#endregion
718
+ export { xe as Preview, Ce as SYSTEM_PROMPT, b as TOOL_DEFINITION, Se as TOOL_NAME, ve as View, _ as astToThreeJS, we as default, x as executePresent3D, S as parseShapeScript, $ as plugin, e as pluginCore, r as samples };