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