viral-viewer-2 6.7.3 → 6.7.5

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.
Files changed (34) hide show
  1. package/LICENSE +7 -4
  2. package/README.md +0 -0
  3. package/dist/components/camera/viral-camera.d.ts +8 -3
  4. package/dist/components/compress/viral-compress.processor.d.ts +2 -1
  5. package/dist/components/custom-objects/viral-instanced-mesh.d.ts +6 -1
  6. package/dist/components/custom-objects/viral-main.model.d.ts +12 -0
  7. package/dist/components/custom-objects/viral-merged-mesh.d.ts +78 -8
  8. package/dist/components/custom-objects/viral-merged-model.d.ts +29 -2
  9. package/dist/components/custom-objects/viral-mesh.abstract.d.ts +3 -0
  10. package/dist/components/custom-objects/viral-mesh.d.ts +8 -2
  11. package/dist/components/custom-objects/{viral-model.d.ts → viral-seperate-model.d.ts} +5 -3
  12. package/dist/components/data-manager/viral-data-manager.d.ts +20 -4
  13. package/dist/components/event-handler/viral-centralized-event-handler.d.ts +4 -0
  14. package/dist/components/event-handler/viral-lifecycle-event-handler.d.ts +4 -3
  15. package/dist/components/handler/geometry.handler.d.ts +1 -0
  16. package/dist/components/loader/viral-revit.loader.d.ts +0 -1
  17. package/dist/components/material/viral-material-manager.d.ts +4 -6
  18. package/dist/components/post-processing/post-processing-renderer.d.ts +6 -0
  19. package/dist/components/renderer/viral-renderer.d.ts +2 -0
  20. package/dist/components/scene/viral-scene.d.ts +7 -5
  21. package/dist/components/section-box/viral-section-box.d.ts +32 -0
  22. package/dist/components/visibility-manager/viral-visibility-manager.d.ts +42 -1
  23. package/dist/components/worker/build-tree-node.worker.d.ts +12 -0
  24. package/dist/components/worker/load-element-standalone.worker.d.ts +7 -2
  25. package/dist/components/worker-script/build-tree-node.script.d.ts +1 -0
  26. package/dist/gui/draggable-modal/viral-draggable-modal.d.ts +1 -1
  27. package/dist/gui/navigation-cube/viral-navigation-cube.d.ts +0 -2
  28. package/dist/index.mjs +13250 -11903
  29. package/dist/lil-gui.esm-BtfdsiIY.mjs +1274 -0
  30. package/dist/types.d.ts +48 -2
  31. package/dist/utils/log.d.ts +1 -0
  32. package/dist/utils/threejs.d.ts +8 -1
  33. package/dist/viral-viewer-api.d.ts +3 -2
  34. package/package.json +4 -3
@@ -0,0 +1,1274 @@
1
+ /**
2
+ * lil-gui
3
+ * https://lil-gui.georgealways.com
4
+ * @version 0.20.0
5
+ * @author George Michael Brower
6
+ * @license MIT
7
+ */
8
+ class u {
9
+ constructor(t, i, e, l, a = "div") {
10
+ this.parent = t, this.object = i, this.property = e, this._disabled = !1, this._hidden = !1, this.initialValue = this.getValue(), this.domElement = document.createElement(a), this.domElement.classList.add("controller"), this.domElement.classList.add(l), this.$name = document.createElement("div"), this.$name.classList.add("name"), u.nextNameID = u.nextNameID || 0, this.$name.id = `lil-gui-name-${++u.nextNameID}`, this.$widget = document.createElement("div"), this.$widget.classList.add("widget"), this.$disable = this.$widget, this.domElement.appendChild(this.$name), this.domElement.appendChild(this.$widget), this.domElement.addEventListener("keydown", (o) => o.stopPropagation()), this.domElement.addEventListener("keyup", (o) => o.stopPropagation()), this.parent.children.push(this), this.parent.controllers.push(this), this.parent.$children.appendChild(this.domElement), this._listenCallback = this._listenCallback.bind(this), this.name(e);
11
+ }
12
+ /**
13
+ * Sets the name of the controller and its label in the GUI.
14
+ * @param {string} name
15
+ * @returns {this}
16
+ */
17
+ name(t) {
18
+ return this._name = t, this.$name.textContent = t, this;
19
+ }
20
+ /**
21
+ * Pass a function to be called whenever the value is modified by this controller.
22
+ * The function receives the new value as its first parameter. The value of `this` will be the
23
+ * controller.
24
+ *
25
+ * For function controllers, the `onChange` callback will be fired on click, after the function
26
+ * executes.
27
+ * @param {Function} callback
28
+ * @returns {this}
29
+ * @example
30
+ * const controller = gui.add( object, 'property' );
31
+ *
32
+ * controller.onChange( function( v ) {
33
+ * console.log( 'The value is now ' + v );
34
+ * console.assert( this === controller );
35
+ * } );
36
+ */
37
+ onChange(t) {
38
+ return this._onChange = t, this;
39
+ }
40
+ /**
41
+ * Calls the onChange methods of this controller and its parent GUI.
42
+ * @protected
43
+ */
44
+ _callOnChange() {
45
+ this.parent._callOnChange(this), this._onChange !== void 0 && this._onChange.call(this, this.getValue()), this._changed = !0;
46
+ }
47
+ /**
48
+ * Pass a function to be called after this controller has been modified and loses focus.
49
+ * @param {Function} callback
50
+ * @returns {this}
51
+ * @example
52
+ * const controller = gui.add( object, 'property' );
53
+ *
54
+ * controller.onFinishChange( function( v ) {
55
+ * console.log( 'Changes complete: ' + v );
56
+ * console.assert( this === controller );
57
+ * } );
58
+ */
59
+ onFinishChange(t) {
60
+ return this._onFinishChange = t, this;
61
+ }
62
+ /**
63
+ * Should be called by Controller when its widgets lose focus.
64
+ * @protected
65
+ */
66
+ _callOnFinishChange() {
67
+ this._changed && (this.parent._callOnFinishChange(this), this._onFinishChange !== void 0 && this._onFinishChange.call(this, this.getValue())), this._changed = !1;
68
+ }
69
+ /**
70
+ * Sets the controller back to its initial value.
71
+ * @returns {this}
72
+ */
73
+ reset() {
74
+ return this.setValue(this.initialValue), this._callOnFinishChange(), this;
75
+ }
76
+ /**
77
+ * Enables this controller.
78
+ * @param {boolean} enabled
79
+ * @returns {this}
80
+ * @example
81
+ * controller.enable();
82
+ * controller.enable( false ); // disable
83
+ * controller.enable( controller._disabled ); // toggle
84
+ */
85
+ enable(t = !0) {
86
+ return this.disable(!t);
87
+ }
88
+ /**
89
+ * Disables this controller.
90
+ * @param {boolean} disabled
91
+ * @returns {this}
92
+ * @example
93
+ * controller.disable();
94
+ * controller.disable( false ); // enable
95
+ * controller.disable( !controller._disabled ); // toggle
96
+ */
97
+ disable(t = !0) {
98
+ return t === this._disabled ? this : (this._disabled = t, this.domElement.classList.toggle("disabled", t), this.$disable.toggleAttribute("disabled", t), this);
99
+ }
100
+ /**
101
+ * Shows the Controller after it's been hidden.
102
+ * @param {boolean} show
103
+ * @returns {this}
104
+ * @example
105
+ * controller.show();
106
+ * controller.show( false ); // hide
107
+ * controller.show( controller._hidden ); // toggle
108
+ */
109
+ show(t = !0) {
110
+ return this._hidden = !t, this.domElement.style.display = this._hidden ? "none" : "", this;
111
+ }
112
+ /**
113
+ * Hides the Controller.
114
+ * @returns {this}
115
+ */
116
+ hide() {
117
+ return this.show(!1);
118
+ }
119
+ /**
120
+ * Changes this controller into a dropdown of options.
121
+ *
122
+ * Calling this method on an option controller will simply update the options. However, if this
123
+ * controller was not already an option controller, old references to this controller are
124
+ * destroyed, and a new controller is added to the end of the GUI.
125
+ * @example
126
+ * // safe usage
127
+ *
128
+ * gui.add( obj, 'prop1' ).options( [ 'a', 'b', 'c' ] );
129
+ * gui.add( obj, 'prop2' ).options( { Big: 10, Small: 1 } );
130
+ * gui.add( obj, 'prop3' );
131
+ *
132
+ * // danger
133
+ *
134
+ * const ctrl1 = gui.add( obj, 'prop1' );
135
+ * gui.add( obj, 'prop2' );
136
+ *
137
+ * // calling options out of order adds a new controller to the end...
138
+ * const ctrl2 = ctrl1.options( [ 'a', 'b', 'c' ] );
139
+ *
140
+ * // ...and ctrl1 now references a controller that doesn't exist
141
+ * assert( ctrl2 !== ctrl1 )
142
+ * @param {object|Array} options
143
+ * @returns {Controller}
144
+ */
145
+ options(t) {
146
+ const i = this.parent.add(this.object, this.property, t);
147
+ return i.name(this._name), this.destroy(), i;
148
+ }
149
+ /**
150
+ * Sets the minimum value. Only works on number controllers.
151
+ * @param {number} min
152
+ * @returns {this}
153
+ */
154
+ min(t) {
155
+ return this;
156
+ }
157
+ /**
158
+ * Sets the maximum value. Only works on number controllers.
159
+ * @param {number} max
160
+ * @returns {this}
161
+ */
162
+ max(t) {
163
+ return this;
164
+ }
165
+ /**
166
+ * Values set by this controller will be rounded to multiples of `step`. Only works on number
167
+ * controllers.
168
+ * @param {number} step
169
+ * @returns {this}
170
+ */
171
+ step(t) {
172
+ return this;
173
+ }
174
+ /**
175
+ * Rounds the displayed value to a fixed number of decimals, without affecting the actual value
176
+ * like `step()`. Only works on number controllers.
177
+ * @example
178
+ * gui.add( object, 'property' ).listen().decimals( 4 );
179
+ * @param {number} decimals
180
+ * @returns {this}
181
+ */
182
+ decimals(t) {
183
+ return this;
184
+ }
185
+ /**
186
+ * Calls `updateDisplay()` every animation frame. Pass `false` to stop listening.
187
+ * @param {boolean} listen
188
+ * @returns {this}
189
+ */
190
+ listen(t = !0) {
191
+ return this._listening = t, this._listenCallbackID !== void 0 && (cancelAnimationFrame(this._listenCallbackID), this._listenCallbackID = void 0), this._listening && this._listenCallback(), this;
192
+ }
193
+ _listenCallback() {
194
+ this._listenCallbackID = requestAnimationFrame(this._listenCallback);
195
+ const t = this.save();
196
+ t !== this._listenPrevValue && this.updateDisplay(), this._listenPrevValue = t;
197
+ }
198
+ /**
199
+ * Returns `object[ property ]`.
200
+ * @returns {any}
201
+ */
202
+ getValue() {
203
+ return this.object[this.property];
204
+ }
205
+ /**
206
+ * Sets the value of `object[ property ]`, invokes any `onChange` handlers and updates the display.
207
+ * @param {any} value
208
+ * @returns {this}
209
+ */
210
+ setValue(t) {
211
+ return this.getValue() !== t && (this.object[this.property] = t, this._callOnChange(), this.updateDisplay()), this;
212
+ }
213
+ /**
214
+ * Updates the display to keep it in sync with the current value. Useful for updating your
215
+ * controllers when their values have been modified outside of the GUI.
216
+ * @returns {this}
217
+ */
218
+ updateDisplay() {
219
+ return this;
220
+ }
221
+ load(t) {
222
+ return this.setValue(t), this._callOnFinishChange(), this;
223
+ }
224
+ save() {
225
+ return this.getValue();
226
+ }
227
+ /**
228
+ * Destroys this controller and removes it from the parent GUI.
229
+ */
230
+ destroy() {
231
+ this.listen(!1), this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.controllers.splice(this.parent.controllers.indexOf(this), 1), this.parent.$children.removeChild(this.domElement);
232
+ }
233
+ }
234
+ class L extends u {
235
+ constructor(t, i, e) {
236
+ super(t, i, e, "boolean", "label"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "checkbox"), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$widget.appendChild(this.$input), this.$input.addEventListener("change", () => {
237
+ this.setValue(this.$input.checked), this._callOnFinishChange();
238
+ }), this.$disable = this.$input, this.updateDisplay();
239
+ }
240
+ updateDisplay() {
241
+ return this.$input.checked = this.getValue(), this;
242
+ }
243
+ }
244
+ function $(n) {
245
+ let t, i;
246
+ return (t = n.match(/(#|0x)?([a-f0-9]{6})/i)) ? i = t[2] : (t = n.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/)) ? i = parseInt(t[1]).toString(16).padStart(2, 0) + parseInt(t[2]).toString(16).padStart(2, 0) + parseInt(t[3]).toString(16).padStart(2, 0) : (t = n.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i)) && (i = t[1] + t[1] + t[2] + t[2] + t[3] + t[3]), i ? "#" + i : !1;
247
+ }
248
+ const S = {
249
+ isPrimitive: !0,
250
+ match: (n) => typeof n == "string",
251
+ fromHexString: $,
252
+ toHexString: $
253
+ }, v = {
254
+ isPrimitive: !0,
255
+ match: (n) => typeof n == "number",
256
+ fromHexString: (n) => parseInt(n.substring(1), 16),
257
+ toHexString: (n) => "#" + n.toString(16).padStart(6, 0)
258
+ }, F = {
259
+ isPrimitive: !1,
260
+ // The arrow function is here to appease tree shakers like esbuild or webpack.
261
+ // See https://esbuild.github.io/api/#tree-shaking
262
+ match: (n) => Array.isArray(n),
263
+ fromHexString(n, t, i = 1) {
264
+ const e = v.fromHexString(n);
265
+ t[0] = (e >> 16 & 255) / 255 * i, t[1] = (e >> 8 & 255) / 255 * i, t[2] = (e & 255) / 255 * i;
266
+ },
267
+ toHexString([n, t, i], e = 1) {
268
+ e = 255 / e;
269
+ const l = n * e << 16 ^ t * e << 8 ^ i * e << 0;
270
+ return v.toHexString(l);
271
+ }
272
+ }, D = {
273
+ isPrimitive: !1,
274
+ match: (n) => Object(n) === n,
275
+ fromHexString(n, t, i = 1) {
276
+ const e = v.fromHexString(n);
277
+ t.r = (e >> 16 & 255) / 255 * i, t.g = (e >> 8 & 255) / 255 * i, t.b = (e & 255) / 255 * i;
278
+ },
279
+ toHexString({ r: n, g: t, b: i }, e = 1) {
280
+ e = 255 / e;
281
+ const l = n * e << 16 ^ t * e << 8 ^ i * e << 0;
282
+ return v.toHexString(l);
283
+ }
284
+ }, V = [S, v, F, D];
285
+ function M(n) {
286
+ return V.find((t) => t.match(n));
287
+ }
288
+ class O extends u {
289
+ constructor(t, i, e, l) {
290
+ super(t, i, e, "color"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "color"), this.$input.setAttribute("tabindex", -1), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$text = document.createElement("input"), this.$text.setAttribute("type", "text"), this.$text.setAttribute("spellcheck", "false"), this.$text.setAttribute("aria-labelledby", this.$name.id), this.$display = document.createElement("div"), this.$display.classList.add("display"), this.$display.appendChild(this.$input), this.$widget.appendChild(this.$display), this.$widget.appendChild(this.$text), this._format = M(this.initialValue), this._rgbScale = l, this._initialValueHexString = this.save(), this._textFocused = !1, this.$input.addEventListener("input", () => {
291
+ this._setValueFromHexString(this.$input.value);
292
+ }), this.$input.addEventListener("blur", () => {
293
+ this._callOnFinishChange();
294
+ }), this.$text.addEventListener("input", () => {
295
+ const a = $(this.$text.value);
296
+ a && this._setValueFromHexString(a);
297
+ }), this.$text.addEventListener("focus", () => {
298
+ this._textFocused = !0, this.$text.select();
299
+ }), this.$text.addEventListener("blur", () => {
300
+ this._textFocused = !1, this.updateDisplay(), this._callOnFinishChange();
301
+ }), this.$disable = this.$text, this.updateDisplay();
302
+ }
303
+ reset() {
304
+ return this._setValueFromHexString(this._initialValueHexString), this;
305
+ }
306
+ _setValueFromHexString(t) {
307
+ if (this._format.isPrimitive) {
308
+ const i = this._format.fromHexString(t);
309
+ this.setValue(i);
310
+ } else
311
+ this._format.fromHexString(t, this.getValue(), this._rgbScale), this._callOnChange(), this.updateDisplay();
312
+ }
313
+ save() {
314
+ return this._format.toHexString(this.getValue(), this._rgbScale);
315
+ }
316
+ load(t) {
317
+ return this._setValueFromHexString(t), this._callOnFinishChange(), this;
318
+ }
319
+ updateDisplay() {
320
+ return this.$input.value = this._format.toHexString(this.getValue(), this._rgbScale), this._textFocused || (this.$text.value = this.$input.value.substring(1)), this.$display.style.backgroundColor = this.$input.value, this;
321
+ }
322
+ }
323
+ class y extends u {
324
+ constructor(t, i, e) {
325
+ super(t, i, e, "function"), this.$button = document.createElement("button"), this.$button.appendChild(this.$name), this.$widget.appendChild(this.$button), this.$button.addEventListener("click", (l) => {
326
+ l.preventDefault(), this.getValue().call(this.object), this._callOnChange();
327
+ }), this.$button.addEventListener("touchstart", () => {
328
+ }, { passive: !0 }), this.$disable = this.$button;
329
+ }
330
+ }
331
+ class B extends u {
332
+ constructor(t, i, e, l, a, o) {
333
+ super(t, i, e, "number"), this._initInput(), this.min(l), this.max(a);
334
+ const c = o !== void 0;
335
+ this.step(c ? o : this._getImplicitStep(), c), this.updateDisplay();
336
+ }
337
+ decimals(t) {
338
+ return this._decimals = t, this.updateDisplay(), this;
339
+ }
340
+ min(t) {
341
+ return this._min = t, this._onUpdateMinMax(), this;
342
+ }
343
+ max(t) {
344
+ return this._max = t, this._onUpdateMinMax(), this;
345
+ }
346
+ step(t, i = !0) {
347
+ return this._step = t, this._stepExplicit = i, this;
348
+ }
349
+ updateDisplay() {
350
+ const t = this.getValue();
351
+ if (this._hasSlider) {
352
+ let i = (t - this._min) / (this._max - this._min);
353
+ i = Math.max(0, Math.min(i, 1)), this.$fill.style.width = i * 100 + "%";
354
+ }
355
+ return this._inputFocused || (this.$input.value = this._decimals === void 0 ? t : t.toFixed(this._decimals)), this;
356
+ }
357
+ _initInput() {
358
+ this.$input = document.createElement("input"), this.$input.setAttribute("type", "text"), this.$input.setAttribute("aria-labelledby", this.$name.id), window.matchMedia("(pointer: coarse)").matches && (this.$input.setAttribute("type", "number"), this.$input.setAttribute("step", "any")), this.$widget.appendChild(this.$input), this.$disable = this.$input;
359
+ const i = () => {
360
+ let s = parseFloat(this.$input.value);
361
+ isNaN(s) || (this._stepExplicit && (s = this._snap(s)), this.setValue(this._clamp(s)));
362
+ }, e = (s) => {
363
+ const h = parseFloat(this.$input.value);
364
+ isNaN(h) || (this._snapClampSetValue(h + s), this.$input.value = this.getValue());
365
+ }, l = (s) => {
366
+ s.key === "Enter" && this.$input.blur(), s.code === "ArrowUp" && (s.preventDefault(), e(this._step * this._arrowKeyMultiplier(s))), s.code === "ArrowDown" && (s.preventDefault(), e(this._step * this._arrowKeyMultiplier(s) * -1));
367
+ }, a = (s) => {
368
+ this._inputFocused && (s.preventDefault(), e(this._step * this._normalizeMouseWheel(s)));
369
+ };
370
+ let o = !1, c, g, m, p, d;
371
+ const f = 5, _ = (s) => {
372
+ c = s.clientX, g = m = s.clientY, o = !0, p = this.getValue(), d = 0, window.addEventListener("mousemove", b), window.addEventListener("mouseup", A);
373
+ }, b = (s) => {
374
+ if (o) {
375
+ const h = s.clientX - c, w = s.clientY - g;
376
+ Math.abs(w) > f ? (s.preventDefault(), this.$input.blur(), o = !1, this._setDraggingStyle(!0, "vertical")) : Math.abs(h) > f && A();
377
+ }
378
+ if (!o) {
379
+ const h = s.clientY - m;
380
+ d -= h * this._step * this._arrowKeyMultiplier(s), p + d > this._max ? d = this._max - p : p + d < this._min && (d = this._min - p), this._snapClampSetValue(p + d);
381
+ }
382
+ m = s.clientY;
383
+ }, A = () => {
384
+ this._setDraggingStyle(!1, "vertical"), this._callOnFinishChange(), window.removeEventListener("mousemove", b), window.removeEventListener("mouseup", A);
385
+ }, x = () => {
386
+ this._inputFocused = !0;
387
+ }, r = () => {
388
+ this._inputFocused = !1, this.updateDisplay(), this._callOnFinishChange();
389
+ };
390
+ this.$input.addEventListener("input", i), this.$input.addEventListener("keydown", l), this.$input.addEventListener("wheel", a, { passive: !1 }), this.$input.addEventListener("mousedown", _), this.$input.addEventListener("focus", x), this.$input.addEventListener("blur", r);
391
+ }
392
+ _initSlider() {
393
+ this._hasSlider = !0, this.$slider = document.createElement("div"), this.$slider.classList.add("slider"), this.$fill = document.createElement("div"), this.$fill.classList.add("fill"), this.$slider.appendChild(this.$fill), this.$widget.insertBefore(this.$slider, this.$input), this.domElement.classList.add("hasSlider");
394
+ const t = (r, s, h, w, k) => (r - s) / (h - s) * (k - w) + w, i = (r) => {
395
+ const s = this.$slider.getBoundingClientRect();
396
+ let h = t(r, s.left, s.right, this._min, this._max);
397
+ this._snapClampSetValue(h);
398
+ }, e = (r) => {
399
+ this._setDraggingStyle(!0), i(r.clientX), window.addEventListener("mousemove", l), window.addEventListener("mouseup", a);
400
+ }, l = (r) => {
401
+ i(r.clientX);
402
+ }, a = () => {
403
+ this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener("mousemove", l), window.removeEventListener("mouseup", a);
404
+ };
405
+ let o = !1, c, g;
406
+ const m = (r) => {
407
+ r.preventDefault(), this._setDraggingStyle(!0), i(r.touches[0].clientX), o = !1;
408
+ }, p = (r) => {
409
+ r.touches.length > 1 || (this._hasScrollBar ? (c = r.touches[0].clientX, g = r.touches[0].clientY, o = !0) : m(r), window.addEventListener("touchmove", d, { passive: !1 }), window.addEventListener("touchend", f));
410
+ }, d = (r) => {
411
+ if (o) {
412
+ const s = r.touches[0].clientX - c, h = r.touches[0].clientY - g;
413
+ Math.abs(s) > Math.abs(h) ? m(r) : (window.removeEventListener("touchmove", d), window.removeEventListener("touchend", f));
414
+ } else
415
+ r.preventDefault(), i(r.touches[0].clientX);
416
+ }, f = () => {
417
+ this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener("touchmove", d), window.removeEventListener("touchend", f);
418
+ }, _ = this._callOnFinishChange.bind(this), b = 400;
419
+ let A;
420
+ const x = (r) => {
421
+ if (Math.abs(r.deltaX) < Math.abs(r.deltaY) && this._hasScrollBar)
422
+ return;
423
+ r.preventDefault();
424
+ const h = this._normalizeMouseWheel(r) * this._step;
425
+ this._snapClampSetValue(this.getValue() + h), this.$input.value = this.getValue(), clearTimeout(A), A = setTimeout(_, b);
426
+ };
427
+ this.$slider.addEventListener("mousedown", e), this.$slider.addEventListener("touchstart", p, { passive: !1 }), this.$slider.addEventListener("wheel", x, { passive: !1 });
428
+ }
429
+ _setDraggingStyle(t, i = "horizontal") {
430
+ this.$slider && this.$slider.classList.toggle("active", t), document.body.classList.toggle("lil-gui-dragging", t), document.body.classList.toggle(`lil-gui-${i}`, t);
431
+ }
432
+ _getImplicitStep() {
433
+ return this._hasMin && this._hasMax ? (this._max - this._min) / 1e3 : 0.1;
434
+ }
435
+ _onUpdateMinMax() {
436
+ !this._hasSlider && this._hasMin && this._hasMax && (this._stepExplicit || this.step(this._getImplicitStep(), !1), this._initSlider(), this.updateDisplay());
437
+ }
438
+ _normalizeMouseWheel(t) {
439
+ let { deltaX: i, deltaY: e } = t;
440
+ return Math.floor(t.deltaY) !== t.deltaY && t.wheelDelta && (i = 0, e = -t.wheelDelta / 120, e *= this._stepExplicit ? 1 : 10), i + -e;
441
+ }
442
+ _arrowKeyMultiplier(t) {
443
+ let i = this._stepExplicit ? 1 : 10;
444
+ return t.shiftKey ? i *= 10 : t.altKey && (i /= 10), i;
445
+ }
446
+ _snap(t) {
447
+ let i = 0;
448
+ return this._hasMin ? i = this._min : this._hasMax && (i = this._max), t -= i, t = Math.round(t / this._step) * this._step, t += i, t = parseFloat(t.toPrecision(15)), t;
449
+ }
450
+ _clamp(t) {
451
+ return t < this._min && (t = this._min), t > this._max && (t = this._max), t;
452
+ }
453
+ _snapClampSetValue(t) {
454
+ this.setValue(this._clamp(this._snap(t)));
455
+ }
456
+ get _hasScrollBar() {
457
+ const t = this.parent.root.$children;
458
+ return t.scrollHeight > t.clientHeight;
459
+ }
460
+ get _hasMin() {
461
+ return this._min !== void 0;
462
+ }
463
+ get _hasMax() {
464
+ return this._max !== void 0;
465
+ }
466
+ }
467
+ class H extends u {
468
+ constructor(t, i, e, l) {
469
+ super(t, i, e, "option"), this.$select = document.createElement("select"), this.$select.setAttribute("aria-labelledby", this.$name.id), this.$display = document.createElement("div"), this.$display.classList.add("display"), this.$select.addEventListener("change", () => {
470
+ this.setValue(this._values[this.$select.selectedIndex]), this._callOnFinishChange();
471
+ }), this.$select.addEventListener("focus", () => {
472
+ this.$display.classList.add("focus");
473
+ }), this.$select.addEventListener("blur", () => {
474
+ this.$display.classList.remove("focus");
475
+ }), this.$widget.appendChild(this.$select), this.$widget.appendChild(this.$display), this.$disable = this.$select, this.options(l);
476
+ }
477
+ options(t) {
478
+ return this._values = Array.isArray(t) ? t : Object.values(t), this._names = Array.isArray(t) ? t : Object.keys(t), this.$select.replaceChildren(), this._names.forEach((i) => {
479
+ const e = document.createElement("option");
480
+ e.textContent = i, this.$select.appendChild(e);
481
+ }), this.updateDisplay(), this;
482
+ }
483
+ updateDisplay() {
484
+ const t = this.getValue(), i = this._values.indexOf(t);
485
+ return this.$select.selectedIndex = i, this.$display.textContent = i === -1 ? t : this._names[i], this;
486
+ }
487
+ }
488
+ class I extends u {
489
+ constructor(t, i, e) {
490
+ super(t, i, e, "string"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "text"), this.$input.setAttribute("spellcheck", "false"), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$input.addEventListener("input", () => {
491
+ this.setValue(this.$input.value);
492
+ }), this.$input.addEventListener("keydown", (l) => {
493
+ l.code === "Enter" && this.$input.blur();
494
+ }), this.$input.addEventListener("blur", () => {
495
+ this._callOnFinishChange();
496
+ }), this.$widget.appendChild(this.$input), this.$disable = this.$input, this.updateDisplay();
497
+ }
498
+ updateDisplay() {
499
+ return this.$input.value = this.getValue(), this;
500
+ }
501
+ }
502
+ var z = `.lil-gui {
503
+ font-family: var(--font-family);
504
+ font-size: var(--font-size);
505
+ line-height: 1;
506
+ font-weight: normal;
507
+ font-style: normal;
508
+ text-align: left;
509
+ color: var(--text-color);
510
+ user-select: none;
511
+ -webkit-user-select: none;
512
+ touch-action: manipulation;
513
+ --background-color: #1f1f1f;
514
+ --text-color: #ebebeb;
515
+ --title-background-color: #111111;
516
+ --title-text-color: #ebebeb;
517
+ --widget-color: #424242;
518
+ --hover-color: #4f4f4f;
519
+ --focus-color: #595959;
520
+ --number-color: #2cc9ff;
521
+ --string-color: #a2db3c;
522
+ --font-size: 11px;
523
+ --input-font-size: 11px;
524
+ --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
525
+ --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;
526
+ --padding: 4px;
527
+ --spacing: 4px;
528
+ --widget-height: 20px;
529
+ --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);
530
+ --name-width: 45%;
531
+ --slider-knob-width: 2px;
532
+ --slider-input-width: 27%;
533
+ --color-input-width: 27%;
534
+ --slider-input-min-width: 45px;
535
+ --color-input-min-width: 45px;
536
+ --folder-indent: 7px;
537
+ --widget-padding: 0 0 0 3px;
538
+ --widget-border-radius: 2px;
539
+ --checkbox-size: calc(0.75 * var(--widget-height));
540
+ --scrollbar-width: 5px;
541
+ }
542
+ .lil-gui, .lil-gui * {
543
+ box-sizing: border-box;
544
+ margin: 0;
545
+ padding: 0;
546
+ }
547
+ .lil-gui.root {
548
+ width: var(--width, 245px);
549
+ display: flex;
550
+ flex-direction: column;
551
+ background: var(--background-color);
552
+ }
553
+ .lil-gui.root > .title {
554
+ background: var(--title-background-color);
555
+ color: var(--title-text-color);
556
+ }
557
+ .lil-gui.root > .children {
558
+ overflow-x: hidden;
559
+ overflow-y: auto;
560
+ }
561
+ .lil-gui.root > .children::-webkit-scrollbar {
562
+ width: var(--scrollbar-width);
563
+ height: var(--scrollbar-width);
564
+ background: var(--background-color);
565
+ }
566
+ .lil-gui.root > .children::-webkit-scrollbar-thumb {
567
+ border-radius: var(--scrollbar-width);
568
+ background: var(--focus-color);
569
+ }
570
+ @media (pointer: coarse) {
571
+ .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {
572
+ --widget-height: 28px;
573
+ --padding: 6px;
574
+ --spacing: 6px;
575
+ --font-size: 13px;
576
+ --input-font-size: 16px;
577
+ --folder-indent: 10px;
578
+ --scrollbar-width: 7px;
579
+ --slider-input-min-width: 50px;
580
+ --color-input-min-width: 65px;
581
+ }
582
+ }
583
+ .lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {
584
+ --widget-height: 28px;
585
+ --padding: 6px;
586
+ --spacing: 6px;
587
+ --font-size: 13px;
588
+ --input-font-size: 16px;
589
+ --folder-indent: 10px;
590
+ --scrollbar-width: 7px;
591
+ --slider-input-min-width: 50px;
592
+ --color-input-min-width: 65px;
593
+ }
594
+ .lil-gui.autoPlace {
595
+ max-height: 100%;
596
+ position: fixed;
597
+ top: 0;
598
+ right: 15px;
599
+ z-index: 1001;
600
+ }
601
+
602
+ .lil-gui .controller {
603
+ display: flex;
604
+ align-items: center;
605
+ padding: 0 var(--padding);
606
+ margin: var(--spacing) 0;
607
+ }
608
+ .lil-gui .controller.disabled {
609
+ opacity: 0.5;
610
+ }
611
+ .lil-gui .controller.disabled, .lil-gui .controller.disabled * {
612
+ pointer-events: none !important;
613
+ }
614
+ .lil-gui .controller > .name {
615
+ min-width: var(--name-width);
616
+ flex-shrink: 0;
617
+ white-space: pre;
618
+ padding-right: var(--spacing);
619
+ line-height: var(--widget-height);
620
+ }
621
+ .lil-gui .controller .widget {
622
+ position: relative;
623
+ display: flex;
624
+ align-items: center;
625
+ width: 100%;
626
+ min-height: var(--widget-height);
627
+ }
628
+ .lil-gui .controller.string input {
629
+ color: var(--string-color);
630
+ }
631
+ .lil-gui .controller.boolean {
632
+ cursor: pointer;
633
+ }
634
+ .lil-gui .controller.color .display {
635
+ width: 100%;
636
+ height: var(--widget-height);
637
+ border-radius: var(--widget-border-radius);
638
+ position: relative;
639
+ }
640
+ @media (hover: hover) {
641
+ .lil-gui .controller.color .display:hover:before {
642
+ content: " ";
643
+ display: block;
644
+ position: absolute;
645
+ border-radius: var(--widget-border-radius);
646
+ border: 1px solid #fff9;
647
+ top: 0;
648
+ right: 0;
649
+ bottom: 0;
650
+ left: 0;
651
+ }
652
+ }
653
+ .lil-gui .controller.color input[type=color] {
654
+ opacity: 0;
655
+ width: 100%;
656
+ height: 100%;
657
+ cursor: pointer;
658
+ }
659
+ .lil-gui .controller.color input[type=text] {
660
+ margin-left: var(--spacing);
661
+ font-family: var(--font-family-mono);
662
+ min-width: var(--color-input-min-width);
663
+ width: var(--color-input-width);
664
+ flex-shrink: 0;
665
+ }
666
+ .lil-gui .controller.option select {
667
+ opacity: 0;
668
+ position: absolute;
669
+ width: 100%;
670
+ max-width: 100%;
671
+ }
672
+ .lil-gui .controller.option .display {
673
+ position: relative;
674
+ pointer-events: none;
675
+ border-radius: var(--widget-border-radius);
676
+ height: var(--widget-height);
677
+ line-height: var(--widget-height);
678
+ max-width: 100%;
679
+ overflow: hidden;
680
+ word-break: break-all;
681
+ padding-left: 0.55em;
682
+ padding-right: 1.75em;
683
+ background: var(--widget-color);
684
+ }
685
+ @media (hover: hover) {
686
+ .lil-gui .controller.option .display.focus {
687
+ background: var(--focus-color);
688
+ }
689
+ }
690
+ .lil-gui .controller.option .display.active {
691
+ background: var(--focus-color);
692
+ }
693
+ .lil-gui .controller.option .display:after {
694
+ font-family: "lil-gui";
695
+ content: "↕";
696
+ position: absolute;
697
+ top: 0;
698
+ right: 0;
699
+ bottom: 0;
700
+ padding-right: 0.375em;
701
+ }
702
+ .lil-gui .controller.option .widget,
703
+ .lil-gui .controller.option select {
704
+ cursor: pointer;
705
+ }
706
+ @media (hover: hover) {
707
+ .lil-gui .controller.option .widget:hover .display {
708
+ background: var(--hover-color);
709
+ }
710
+ }
711
+ .lil-gui .controller.number input {
712
+ color: var(--number-color);
713
+ }
714
+ .lil-gui .controller.number.hasSlider input {
715
+ margin-left: var(--spacing);
716
+ width: var(--slider-input-width);
717
+ min-width: var(--slider-input-min-width);
718
+ flex-shrink: 0;
719
+ }
720
+ .lil-gui .controller.number .slider {
721
+ width: 100%;
722
+ height: var(--widget-height);
723
+ background: var(--widget-color);
724
+ border-radius: var(--widget-border-radius);
725
+ padding-right: var(--slider-knob-width);
726
+ overflow: hidden;
727
+ cursor: ew-resize;
728
+ touch-action: pan-y;
729
+ }
730
+ @media (hover: hover) {
731
+ .lil-gui .controller.number .slider:hover {
732
+ background: var(--hover-color);
733
+ }
734
+ }
735
+ .lil-gui .controller.number .slider.active {
736
+ background: var(--focus-color);
737
+ }
738
+ .lil-gui .controller.number .slider.active .fill {
739
+ opacity: 0.95;
740
+ }
741
+ .lil-gui .controller.number .fill {
742
+ height: 100%;
743
+ border-right: var(--slider-knob-width) solid var(--number-color);
744
+ box-sizing: content-box;
745
+ }
746
+
747
+ .lil-gui-dragging .lil-gui {
748
+ --hover-color: var(--widget-color);
749
+ }
750
+ .lil-gui-dragging * {
751
+ cursor: ew-resize !important;
752
+ }
753
+
754
+ .lil-gui-dragging.lil-gui-vertical * {
755
+ cursor: ns-resize !important;
756
+ }
757
+
758
+ .lil-gui .title {
759
+ height: var(--title-height);
760
+ font-weight: 600;
761
+ padding: 0 var(--padding);
762
+ width: 100%;
763
+ text-align: left;
764
+ background: none;
765
+ text-decoration-skip: objects;
766
+ }
767
+ .lil-gui .title:before {
768
+ font-family: "lil-gui";
769
+ content: "▾";
770
+ padding-right: 2px;
771
+ display: inline-block;
772
+ }
773
+ .lil-gui .title:active {
774
+ background: var(--title-background-color);
775
+ opacity: 0.75;
776
+ }
777
+ @media (hover: hover) {
778
+ body:not(.lil-gui-dragging) .lil-gui .title:hover {
779
+ background: var(--title-background-color);
780
+ opacity: 0.85;
781
+ }
782
+ .lil-gui .title:focus {
783
+ text-decoration: underline var(--focus-color);
784
+ }
785
+ }
786
+ .lil-gui.root > .title:focus {
787
+ text-decoration: none !important;
788
+ }
789
+ .lil-gui.closed > .title:before {
790
+ content: "▸";
791
+ }
792
+ .lil-gui.closed > .children {
793
+ transform: translateY(-7px);
794
+ opacity: 0;
795
+ }
796
+ .lil-gui.closed:not(.transition) > .children {
797
+ display: none;
798
+ }
799
+ .lil-gui.transition > .children {
800
+ transition-duration: 300ms;
801
+ transition-property: height, opacity, transform;
802
+ transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);
803
+ overflow: hidden;
804
+ pointer-events: none;
805
+ }
806
+ .lil-gui .children:empty:before {
807
+ content: "Empty";
808
+ padding: 0 var(--padding);
809
+ margin: var(--spacing) 0;
810
+ display: block;
811
+ height: var(--widget-height);
812
+ font-style: italic;
813
+ line-height: var(--widget-height);
814
+ opacity: 0.5;
815
+ }
816
+ .lil-gui.root > .children > .lil-gui > .title {
817
+ border: 0 solid var(--widget-color);
818
+ border-width: 1px 0;
819
+ transition: border-color 300ms;
820
+ }
821
+ .lil-gui.root > .children > .lil-gui.closed > .title {
822
+ border-bottom-color: transparent;
823
+ }
824
+ .lil-gui + .controller {
825
+ border-top: 1px solid var(--widget-color);
826
+ margin-top: 0;
827
+ padding-top: var(--spacing);
828
+ }
829
+ .lil-gui .lil-gui .lil-gui > .title {
830
+ border: none;
831
+ }
832
+ .lil-gui .lil-gui .lil-gui > .children {
833
+ border: none;
834
+ margin-left: var(--folder-indent);
835
+ border-left: 2px solid var(--widget-color);
836
+ }
837
+ .lil-gui .lil-gui .controller {
838
+ border: none;
839
+ }
840
+
841
+ .lil-gui label, .lil-gui input, .lil-gui button {
842
+ -webkit-tap-highlight-color: transparent;
843
+ }
844
+ .lil-gui input {
845
+ border: 0;
846
+ outline: none;
847
+ font-family: var(--font-family);
848
+ font-size: var(--input-font-size);
849
+ border-radius: var(--widget-border-radius);
850
+ height: var(--widget-height);
851
+ background: var(--widget-color);
852
+ color: var(--text-color);
853
+ width: 100%;
854
+ }
855
+ @media (hover: hover) {
856
+ .lil-gui input:hover {
857
+ background: var(--hover-color);
858
+ }
859
+ .lil-gui input:active {
860
+ background: var(--focus-color);
861
+ }
862
+ }
863
+ .lil-gui input:disabled {
864
+ opacity: 1;
865
+ }
866
+ .lil-gui input[type=text],
867
+ .lil-gui input[type=number] {
868
+ padding: var(--widget-padding);
869
+ -moz-appearance: textfield;
870
+ }
871
+ .lil-gui input[type=text]:focus,
872
+ .lil-gui input[type=number]:focus {
873
+ background: var(--focus-color);
874
+ }
875
+ .lil-gui input[type=checkbox] {
876
+ appearance: none;
877
+ width: var(--checkbox-size);
878
+ height: var(--checkbox-size);
879
+ border-radius: var(--widget-border-radius);
880
+ text-align: center;
881
+ cursor: pointer;
882
+ }
883
+ .lil-gui input[type=checkbox]:checked:before {
884
+ font-family: "lil-gui";
885
+ content: "✓";
886
+ font-size: var(--checkbox-size);
887
+ line-height: var(--checkbox-size);
888
+ }
889
+ @media (hover: hover) {
890
+ .lil-gui input[type=checkbox]:focus {
891
+ box-shadow: inset 0 0 0 1px var(--focus-color);
892
+ }
893
+ }
894
+ .lil-gui button {
895
+ outline: none;
896
+ cursor: pointer;
897
+ font-family: var(--font-family);
898
+ font-size: var(--font-size);
899
+ color: var(--text-color);
900
+ width: 100%;
901
+ border: none;
902
+ }
903
+ .lil-gui .controller button {
904
+ height: var(--widget-height);
905
+ text-transform: none;
906
+ background: var(--widget-color);
907
+ border-radius: var(--widget-border-radius);
908
+ }
909
+ @media (hover: hover) {
910
+ .lil-gui .controller button:hover {
911
+ background: var(--hover-color);
912
+ }
913
+ .lil-gui .controller button:focus {
914
+ box-shadow: inset 0 0 0 1px var(--focus-color);
915
+ }
916
+ }
917
+ .lil-gui .controller button:active {
918
+ background: var(--focus-color);
919
+ }
920
+
921
+ @font-face {
922
+ font-family: "lil-gui";
923
+ src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff");
924
+ }`;
925
+ function Y(n) {
926
+ const t = document.createElement("style");
927
+ t.innerHTML = n;
928
+ const i = document.querySelector("head link[rel=stylesheet], head style");
929
+ i ? document.head.insertBefore(t, i) : document.head.appendChild(t);
930
+ }
931
+ let E = !1;
932
+ class C {
933
+ /**
934
+ * Creates a panel that holds controllers.
935
+ * @example
936
+ * new GUI();
937
+ * new GUI( { container: document.getElementById( 'custom' ) } );
938
+ *
939
+ * @param {object} [options]
940
+ * @param {boolean} [options.autoPlace=true]
941
+ * Adds the GUI to `document.body` and fixes it to the top right of the page.
942
+ *
943
+ * @param {HTMLElement} [options.container]
944
+ * Adds the GUI to this DOM element. Overrides `autoPlace`.
945
+ *
946
+ * @param {number} [options.width=245]
947
+ * Width of the GUI in pixels, usually set when name labels become too long. Note that you can make
948
+ * name labels wider in CSS with `.lil‑gui { ‑‑name‑width: 55% }`.
949
+ *
950
+ * @param {string} [options.title=Controls]
951
+ * Name to display in the title bar.
952
+ *
953
+ * @param {boolean} [options.closeFolders=false]
954
+ * Pass `true` to close all folders in this GUI by default.
955
+ *
956
+ * @param {boolean} [options.injectStyles=true]
957
+ * Injects the default stylesheet into the page if this is the first GUI.
958
+ * Pass `false` to use your own stylesheet.
959
+ *
960
+ * @param {number} [options.touchStyles=true]
961
+ * Makes controllers larger on touch devices. Pass `false` to disable touch styles.
962
+ *
963
+ * @param {GUI} [options.parent]
964
+ * Adds this GUI as a child in another GUI. Usually this is done for you by `addFolder()`.
965
+ */
966
+ constructor({
967
+ parent: t,
968
+ autoPlace: i = t === void 0,
969
+ container: e,
970
+ width: l,
971
+ title: a = "Controls",
972
+ closeFolders: o = !1,
973
+ injectStyles: c = !0,
974
+ touchStyles: g = !0
975
+ } = {}) {
976
+ if (this.parent = t, this.root = t ? t.root : this, this.children = [], this.controllers = [], this.folders = [], this._closed = !1, this._hidden = !1, this.domElement = document.createElement("div"), this.domElement.classList.add("lil-gui"), this.$title = document.createElement("button"), this.$title.classList.add("title"), this.$title.setAttribute("aria-expanded", !0), this.$title.addEventListener("click", () => this.openAnimated(this._closed)), this.$title.addEventListener("touchstart", () => {
977
+ }, { passive: !0 }), this.$children = document.createElement("div"), this.$children.classList.add("children"), this.domElement.appendChild(this.$title), this.domElement.appendChild(this.$children), this.title(a), this.parent) {
978
+ this.parent.children.push(this), this.parent.folders.push(this), this.parent.$children.appendChild(this.domElement);
979
+ return;
980
+ }
981
+ this.domElement.classList.add("root"), g && this.domElement.classList.add("allow-touch-styles"), !E && c && (Y(z), E = !0), e ? e.appendChild(this.domElement) : i && (this.domElement.classList.add("autoPlace"), document.body.appendChild(this.domElement)), l && this.domElement.style.setProperty("--width", l + "px"), this._closeFolders = o;
982
+ }
983
+ /**
984
+ * Adds a controller to the GUI, inferring controller type using the `typeof` operator.
985
+ * @example
986
+ * gui.add( object, 'property' );
987
+ * gui.add( object, 'number', 0, 100, 1 );
988
+ * gui.add( object, 'options', [ 1, 2, 3 ] );
989
+ *
990
+ * @param {object} object The object the controller will modify.
991
+ * @param {string} property Name of the property to control.
992
+ * @param {number|object|Array} [$1] Minimum value for number controllers, or the set of
993
+ * selectable values for a dropdown.
994
+ * @param {number} [max] Maximum value for number controllers.
995
+ * @param {number} [step] Step value for number controllers.
996
+ * @returns {Controller}
997
+ */
998
+ add(t, i, e, l, a) {
999
+ if (Object(e) === e)
1000
+ return new H(this, t, i, e);
1001
+ const o = t[i];
1002
+ switch (typeof o) {
1003
+ case "number":
1004
+ return new B(this, t, i, e, l, a);
1005
+ case "boolean":
1006
+ return new L(this, t, i);
1007
+ case "string":
1008
+ return new I(this, t, i);
1009
+ case "function":
1010
+ return new y(this, t, i);
1011
+ }
1012
+ console.error(`gui.add failed
1013
+ property:`, i, `
1014
+ object:`, t, `
1015
+ value:`, o);
1016
+ }
1017
+ /**
1018
+ * Adds a color controller to the GUI.
1019
+ * @example
1020
+ * params = {
1021
+ * cssColor: '#ff00ff',
1022
+ * rgbColor: { r: 0, g: 0.2, b: 0.4 },
1023
+ * customRange: [ 0, 127, 255 ],
1024
+ * };
1025
+ *
1026
+ * gui.addColor( params, 'cssColor' );
1027
+ * gui.addColor( params, 'rgbColor' );
1028
+ * gui.addColor( params, 'customRange', 255 );
1029
+ *
1030
+ * @param {object} object The object the controller will modify.
1031
+ * @param {string} property Name of the property to control.
1032
+ * @param {number} rgbScale Maximum value for a color channel when using an RGB color. You may
1033
+ * need to set this to 255 if your colors are too bright.
1034
+ * @returns {Controller}
1035
+ */
1036
+ addColor(t, i, e = 1) {
1037
+ return new O(this, t, i, e);
1038
+ }
1039
+ /**
1040
+ * Adds a folder to the GUI, which is just another GUI. This method returns
1041
+ * the nested GUI so you can add controllers to it.
1042
+ * @example
1043
+ * const folder = gui.addFolder( 'Position' );
1044
+ * folder.add( position, 'x' );
1045
+ * folder.add( position, 'y' );
1046
+ * folder.add( position, 'z' );
1047
+ *
1048
+ * @param {string} title Name to display in the folder's title bar.
1049
+ * @returns {GUI}
1050
+ */
1051
+ addFolder(t) {
1052
+ const i = new C({ parent: this, title: t });
1053
+ return this.root._closeFolders && i.close(), i;
1054
+ }
1055
+ /**
1056
+ * Recalls values that were saved with `gui.save()`.
1057
+ * @param {object} obj
1058
+ * @param {boolean} recursive Pass false to exclude folders descending from this GUI.
1059
+ * @returns {this}
1060
+ */
1061
+ load(t, i = !0) {
1062
+ return t.controllers && this.controllers.forEach((e) => {
1063
+ e instanceof y || e._name in t.controllers && e.load(t.controllers[e._name]);
1064
+ }), i && t.folders && this.folders.forEach((e) => {
1065
+ e._title in t.folders && e.load(t.folders[e._title]);
1066
+ }), this;
1067
+ }
1068
+ /**
1069
+ * Returns an object mapping controller names to values. The object can be passed to `gui.load()` to
1070
+ * recall these values.
1071
+ * @example
1072
+ * {
1073
+ * controllers: {
1074
+ * prop1: 1,
1075
+ * prop2: 'value',
1076
+ * ...
1077
+ * },
1078
+ * folders: {
1079
+ * folderName1: { controllers, folders },
1080
+ * folderName2: { controllers, folders }
1081
+ * ...
1082
+ * }
1083
+ * }
1084
+ *
1085
+ * @param {boolean} recursive Pass false to exclude folders descending from this GUI.
1086
+ * @returns {object}
1087
+ */
1088
+ save(t = !0) {
1089
+ const i = {
1090
+ controllers: {},
1091
+ folders: {}
1092
+ };
1093
+ return this.controllers.forEach((e) => {
1094
+ if (!(e instanceof y)) {
1095
+ if (e._name in i.controllers)
1096
+ throw new Error(`Cannot save GUI with duplicate property "${e._name}"`);
1097
+ i.controllers[e._name] = e.save();
1098
+ }
1099
+ }), t && this.folders.forEach((e) => {
1100
+ if (e._title in i.folders)
1101
+ throw new Error(`Cannot save GUI with duplicate folder "${e._title}"`);
1102
+ i.folders[e._title] = e.save();
1103
+ }), i;
1104
+ }
1105
+ /**
1106
+ * Opens a GUI or folder. GUI and folders are open by default.
1107
+ * @param {boolean} open Pass false to close.
1108
+ * @returns {this}
1109
+ * @example
1110
+ * gui.open(); // open
1111
+ * gui.open( false ); // close
1112
+ * gui.open( gui._closed ); // toggle
1113
+ */
1114
+ open(t = !0) {
1115
+ return this._setClosed(!t), this.$title.setAttribute("aria-expanded", !this._closed), this.domElement.classList.toggle("closed", this._closed), this;
1116
+ }
1117
+ /**
1118
+ * Closes the GUI.
1119
+ * @returns {this}
1120
+ */
1121
+ close() {
1122
+ return this.open(!1);
1123
+ }
1124
+ _setClosed(t) {
1125
+ this._closed !== t && (this._closed = t, this._callOnOpenClose(this));
1126
+ }
1127
+ /**
1128
+ * Shows the GUI after it's been hidden.
1129
+ * @param {boolean} show
1130
+ * @returns {this}
1131
+ * @example
1132
+ * gui.show();
1133
+ * gui.show( false ); // hide
1134
+ * gui.show( gui._hidden ); // toggle
1135
+ */
1136
+ show(t = !0) {
1137
+ return this._hidden = !t, this.domElement.style.display = this._hidden ? "none" : "", this;
1138
+ }
1139
+ /**
1140
+ * Hides the GUI.
1141
+ * @returns {this}
1142
+ */
1143
+ hide() {
1144
+ return this.show(!1);
1145
+ }
1146
+ openAnimated(t = !0) {
1147
+ return this._setClosed(!t), this.$title.setAttribute("aria-expanded", !this._closed), requestAnimationFrame(() => {
1148
+ const i = this.$children.clientHeight;
1149
+ this.$children.style.height = i + "px", this.domElement.classList.add("transition");
1150
+ const e = (a) => {
1151
+ a.target === this.$children && (this.$children.style.height = "", this.domElement.classList.remove("transition"), this.$children.removeEventListener("transitionend", e));
1152
+ };
1153
+ this.$children.addEventListener("transitionend", e);
1154
+ const l = t ? this.$children.scrollHeight : 0;
1155
+ this.domElement.classList.toggle("closed", !t), requestAnimationFrame(() => {
1156
+ this.$children.style.height = l + "px";
1157
+ });
1158
+ }), this;
1159
+ }
1160
+ /**
1161
+ * Change the title of this GUI.
1162
+ * @param {string} title
1163
+ * @returns {this}
1164
+ */
1165
+ title(t) {
1166
+ return this._title = t, this.$title.textContent = t, this;
1167
+ }
1168
+ /**
1169
+ * Resets all controllers to their initial values.
1170
+ * @param {boolean} recursive Pass false to exclude folders descending from this GUI.
1171
+ * @returns {this}
1172
+ */
1173
+ reset(t = !0) {
1174
+ return (t ? this.controllersRecursive() : this.controllers).forEach((e) => e.reset()), this;
1175
+ }
1176
+ /**
1177
+ * Pass a function to be called whenever a controller in this GUI changes.
1178
+ * @param {function({object:object, property:string, value:any, controller:Controller})} callback
1179
+ * @returns {this}
1180
+ * @example
1181
+ * gui.onChange( event => {
1182
+ * event.object // object that was modified
1183
+ * event.property // string, name of property
1184
+ * event.value // new value of controller
1185
+ * event.controller // controller that was modified
1186
+ * } );
1187
+ */
1188
+ onChange(t) {
1189
+ return this._onChange = t, this;
1190
+ }
1191
+ _callOnChange(t) {
1192
+ this.parent && this.parent._callOnChange(t), this._onChange !== void 0 && this._onChange.call(this, {
1193
+ object: t.object,
1194
+ property: t.property,
1195
+ value: t.getValue(),
1196
+ controller: t
1197
+ });
1198
+ }
1199
+ /**
1200
+ * Pass a function to be called whenever a controller in this GUI has finished changing.
1201
+ * @param {function({object:object, property:string, value:any, controller:Controller})} callback
1202
+ * @returns {this}
1203
+ * @example
1204
+ * gui.onFinishChange( event => {
1205
+ * event.object // object that was modified
1206
+ * event.property // string, name of property
1207
+ * event.value // new value of controller
1208
+ * event.controller // controller that was modified
1209
+ * } );
1210
+ */
1211
+ onFinishChange(t) {
1212
+ return this._onFinishChange = t, this;
1213
+ }
1214
+ _callOnFinishChange(t) {
1215
+ this.parent && this.parent._callOnFinishChange(t), this._onFinishChange !== void 0 && this._onFinishChange.call(this, {
1216
+ object: t.object,
1217
+ property: t.property,
1218
+ value: t.getValue(),
1219
+ controller: t
1220
+ });
1221
+ }
1222
+ /**
1223
+ * Pass a function to be called when this GUI or its descendants are opened or closed.
1224
+ * @param {function(GUI)} callback
1225
+ * @returns {this}
1226
+ * @example
1227
+ * gui.onOpenClose( changedGUI => {
1228
+ * console.log( changedGUI._closed );
1229
+ * } );
1230
+ */
1231
+ onOpenClose(t) {
1232
+ return this._onOpenClose = t, this;
1233
+ }
1234
+ _callOnOpenClose(t) {
1235
+ this.parent && this.parent._callOnOpenClose(t), this._onOpenClose !== void 0 && this._onOpenClose.call(this, t);
1236
+ }
1237
+ /**
1238
+ * Destroys all DOM elements and event listeners associated with this GUI.
1239
+ */
1240
+ destroy() {
1241
+ this.parent && (this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.folders.splice(this.parent.folders.indexOf(this), 1)), this.domElement.parentElement && this.domElement.parentElement.removeChild(this.domElement), Array.from(this.children).forEach((t) => t.destroy());
1242
+ }
1243
+ /**
1244
+ * Returns an array of controllers contained by this GUI and its descendents.
1245
+ * @returns {Controller[]}
1246
+ */
1247
+ controllersRecursive() {
1248
+ let t = Array.from(this.controllers);
1249
+ return this.folders.forEach((i) => {
1250
+ t = t.concat(i.controllersRecursive());
1251
+ }), t;
1252
+ }
1253
+ /**
1254
+ * Returns an array of folders contained by this GUI and its descendents.
1255
+ * @returns {GUI[]}
1256
+ */
1257
+ foldersRecursive() {
1258
+ let t = Array.from(this.folders);
1259
+ return this.folders.forEach((i) => {
1260
+ t = t.concat(i.foldersRecursive());
1261
+ }), t;
1262
+ }
1263
+ }
1264
+ export {
1265
+ L as BooleanController,
1266
+ O as ColorController,
1267
+ u as Controller,
1268
+ y as FunctionController,
1269
+ C as GUI,
1270
+ B as NumberController,
1271
+ H as OptionController,
1272
+ I as StringController,
1273
+ C as default
1274
+ };