relly-ui 0.0.0-stage → 1.0.1

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.
@@ -0,0 +1,2609 @@
1
+ var pe = Object.defineProperty;
2
+ var ue = (y, i, e) => i in y ? pe(y, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : y[i] = e;
3
+ var a = (y, i, e) => ue(y, typeof i != "symbol" ? i + "" : i, e);
4
+ class C {
5
+ constructor(i, e, t, n, s) {
6
+ a(this, "element");
7
+ a(this, "labelEl");
8
+ a(this, "controlEl");
9
+ a(this, "label");
10
+ a(this, "tooltipText");
11
+ a(this, "tooltipEl");
12
+ a(this, "conditionPredicate");
13
+ a(this, "targetObject");
14
+ a(this, "property");
15
+ a(this, "initialValue");
16
+ a(this, "prevValue");
17
+ a(this, "onChangeCallback");
18
+ a(this, "isListening", !1);
19
+ a(this, "contextMenuItems");
20
+ a(this, "disabled", !1);
21
+ if (this.bindingEngine = n, this.presetManager = s, this.label = i, this.targetObject = e, this.property = t, this.targetObject && this.property) {
22
+ this.prevValue = this.targetObject[this.property];
23
+ try {
24
+ this.initialValue = JSON.parse(JSON.stringify(this.prevValue));
25
+ } catch {
26
+ this.initialValue = this.prevValue;
27
+ }
28
+ }
29
+ this.element = document.createElement("div"), this.element.className = "relly-row", this.element.__rellyComponent = this, this.labelEl = document.createElement("div"), this.labelEl.className = "relly-row-label", this.labelEl.textContent = i, this.element.appendChild(this.labelEl), this.controlEl = document.createElement("div"), this.controlEl.className = "relly-row-control", this.element.appendChild(this.controlEl), this.presetManager && this.getSerializableKey() && this.presetManager.register(this);
30
+ }
31
+ setLabel(i) {
32
+ return this.label = i, this.labelEl.textContent = i, this;
33
+ }
34
+ getLabel() {
35
+ return this.label;
36
+ }
37
+ setTooltip(i) {
38
+ return this.tooltipText = i, this.tooltipEl || (this.tooltipEl = document.createElement("div"), this.tooltipEl.className = "relly-tooltip", this.element.appendChild(this.tooltipEl)), this.tooltipEl.textContent = i, this;
39
+ }
40
+ getTooltip() {
41
+ return this.tooltipText;
42
+ }
43
+ showIf(i) {
44
+ return this.conditionPredicate = i, this.checkVisibility(), this.bindingEngine && !this.isListening && this.bindingEngine.register(this), this;
45
+ }
46
+ checkVisibility() {
47
+ if (!this.conditionPredicate) return !0;
48
+ const i = this.conditionPredicate();
49
+ return this.element.style.display = i ? "" : "none", i;
50
+ }
51
+ setContextMenu(i) {
52
+ return this.contextMenuItems = i, this;
53
+ }
54
+ getContextMenu() {
55
+ return this.contextMenuItems;
56
+ }
57
+ reset() {
58
+ if (this.initialValue !== void 0)
59
+ try {
60
+ this.setValue(JSON.parse(JSON.stringify(this.initialValue)));
61
+ } catch {
62
+ this.setValue(this.initialValue);
63
+ }
64
+ return this;
65
+ }
66
+ onChange(i) {
67
+ return this.onChangeCallback = i, this;
68
+ }
69
+ listen() {
70
+ return !this.isListening && this.bindingEngine && this.targetObject && this.property && (this.isListening = !0, this.bindingEngine.register(this)), this;
71
+ }
72
+ getValue() {
73
+ return this.targetObject && this.property ? this.targetObject[this.property] : this.prevValue;
74
+ }
75
+ setValue(i) {
76
+ var t;
77
+ const e = this.getValue();
78
+ return this.targetObject && this.property && (this.targetObject[this.property] = i), this.prevValue = i, this.update(), e !== i && (this.triggerChange(i, e), (t = this.presetManager) == null || t.notifyChange()), this;
79
+ }
80
+ setDisabled(i) {
81
+ return this.disabled = i, this.disabled ? (this.element.classList.add("relly-disabled"), this.element.querySelectorAll("input, button, select").forEach((t) => t.disabled = !0)) : (this.element.classList.remove("relly-disabled"), this.element.querySelectorAll("input, button, select").forEach((t) => t.disabled = !1)), this;
82
+ }
83
+ isDisabled() {
84
+ return this.disabled;
85
+ }
86
+ checkDirty() {
87
+ if (this.checkVisibility(), !this.targetObject || !this.property) return;
88
+ const i = this.targetObject[this.property];
89
+ if (i !== this.prevValue) {
90
+ const e = this.prevValue;
91
+ this.prevValue = i, this.update(), this.triggerChange(i, e);
92
+ }
93
+ }
94
+ triggerChange(i, e) {
95
+ this.onChangeCallback && this.onChangeCallback(i, e);
96
+ }
97
+ getSerializableKey() {
98
+ return this.property ? this.property : this.label || null;
99
+ }
100
+ destroy() {
101
+ this.isListening && this.bindingEngine && (this.bindingEngine.unregister(this), this.isListening = !1), this.presetManager && this.presetManager.unregister(this), this.element.remove();
102
+ }
103
+ }
104
+ class L extends C {
105
+ constructor(e, t, n, s, r, l) {
106
+ super(e, t, n, s, r);
107
+ a(this, "wrapperEl");
108
+ a(this, "boxEl");
109
+ a(this, "soundEngine");
110
+ this.soundEngine = l, this.wrapperEl = document.createElement("div"), this.wrapperEl.className = "relly-checkbox-wrapper", this.wrapperEl.setAttribute("role", "checkbox"), this.wrapperEl.setAttribute("tabindex", "0"), this.boxEl = document.createElement("div"), this.boxEl.className = "relly-checkbox-box", this.boxEl.innerHTML = `
111
+ <svg class="relly-checkbox-icon" viewBox="0 0 12 10">
112
+ <polyline points="1.5 5 4.5 8.5 10.5 1.5"></polyline>
113
+ </svg>
114
+ `, this.wrapperEl.appendChild(this.boxEl), this.controlEl.appendChild(this.wrapperEl), this.wrapperEl.addEventListener("click", () => {
115
+ var h;
116
+ const o = !this.getValue();
117
+ (h = this.soundEngine) == null || h.playToggle(o), this.setValue(o);
118
+ }), this.wrapperEl.addEventListener("keydown", (o) => {
119
+ var h;
120
+ if (o.key === " " || o.key === "Enter") {
121
+ o.preventDefault();
122
+ const c = !this.getValue();
123
+ (h = this.soundEngine) == null || h.playToggle(c), this.setValue(c);
124
+ }
125
+ }), this.update();
126
+ }
127
+ setSoundEngine(e) {
128
+ return this.soundEngine = e, this;
129
+ }
130
+ update() {
131
+ if (!this.wrapperEl) return this;
132
+ const e = !!this.getValue();
133
+ return this.wrapperEl.setAttribute("aria-checked", e ? "true" : "false"), e ? this.wrapperEl.classList.add("relly-checked") : this.wrapperEl.classList.remove("relly-checked"), this;
134
+ }
135
+ }
136
+ class V extends C {
137
+ constructor(e, t, n, s, r, l) {
138
+ super(e, t, n, s, r);
139
+ a(this, "containerEl");
140
+ a(this, "rangeInput");
141
+ a(this, "numberInput");
142
+ a(this, "soundEngine");
143
+ a(this, "lastSoundTime", 0);
144
+ a(this, "min", 0);
145
+ a(this, "max", 100);
146
+ a(this, "step", 1);
147
+ this.soundEngine = l, this.containerEl = document.createElement("div"), this.containerEl.className = "relly-slider-container", this.rangeInput = document.createElement("input"), this.rangeInput.type = "range", this.rangeInput.className = "relly-slider-range", this.numberInput = document.createElement("input"), this.numberInput.type = "number", this.numberInput.className = "relly-slider-number", this.numberInput.title = "Drag horizontally to scrub value, or type directly", this.containerEl.appendChild(this.rangeInput), this.containerEl.appendChild(this.numberInput), this.controlEl.appendChild(this.containerEl), this.applyConstraints(), this.rangeInput.addEventListener("input", () => {
148
+ const o = parseFloat(this.rangeInput.value);
149
+ this.triggerSound(), this.setValue(o);
150
+ }), this.numberInput.addEventListener("change", () => {
151
+ let o = parseFloat(this.numberInput.value);
152
+ isNaN(o) && (o = this.min), o = Math.max(this.min, Math.min(this.max, o)), this.triggerSound(), this.setValue(o);
153
+ }), this.setupJogScrubbing(), this.update();
154
+ }
155
+ setupJogScrubbing() {
156
+ let e = !1, t = 0, n = 0;
157
+ const s = (l) => {
158
+ const o = l.clientX - t;
159
+ if (!e && Math.abs(o) > 3 && (e = !0, typeof document < "u" && document.body.classList.add("relly-jog-scrubbing")), e) {
160
+ const h = l.shiftKey ? 10 : l.altKey ? 0.1 : 1, c = this.step * h, u = o * c;
161
+ let p = n + u;
162
+ p = Math.max(this.min, Math.min(this.max, p));
163
+ const d = (this.step.toString().split(".")[1] || "").length;
164
+ p = parseFloat(p.toFixed(Math.max(d, 2))), this.triggerSound(), this.setValue(p), l.preventDefault();
165
+ }
166
+ }, r = () => {
167
+ e && typeof document < "u" && document.body.classList.remove("relly-jog-scrubbing"), typeof window < "u" && (window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", r));
168
+ };
169
+ this.numberInput.addEventListener("mousedown", (l) => {
170
+ t = l.clientX, n = parseFloat(this.numberInput.value) || 0, e = !1, typeof window < "u" && (window.addEventListener("mousemove", s), window.addEventListener("mouseup", r));
171
+ });
172
+ }
173
+ triggerSound() {
174
+ var t;
175
+ const e = Date.now();
176
+ e - this.lastSoundTime > 35 && (this.lastSoundTime = e, (t = this.soundEngine) == null || t.playTick());
177
+ }
178
+ setSoundEngine(e) {
179
+ return this.soundEngine = e, this;
180
+ }
181
+ setMin(e) {
182
+ return this.min = e, this.applyConstraints(), this;
183
+ }
184
+ setMax(e) {
185
+ return this.max = e, this.applyConstraints(), this;
186
+ }
187
+ setStep(e) {
188
+ return this.step = e, this.applyConstraints(), this;
189
+ }
190
+ applyConstraints() {
191
+ this.rangeInput.min = this.min.toString(), this.rangeInput.max = this.max.toString(), this.rangeInput.step = this.step.toString(), this.numberInput.min = this.min.toString(), this.numberInput.max = this.max.toString(), this.numberInput.step = this.step.toString();
192
+ }
193
+ update() {
194
+ if (!this.rangeInput || !this.numberInput) return this;
195
+ const e = Number(this.getValue()) || 0;
196
+ return this.rangeInput.value = e.toString(), this.numberInput.value = e.toString(), this;
197
+ }
198
+ }
199
+ class A extends C {
200
+ constructor(e, t, n) {
201
+ super(e);
202
+ a(this, "buttonEl");
203
+ a(this, "clickHandler");
204
+ a(this, "soundEngine");
205
+ this.soundEngine = n, this.labelEl.style.display = "none", this.controlEl.style.flex = "1", this.buttonEl = document.createElement("button"), this.buttonEl.className = "relly-btn", this.buttonEl.textContent = e, this.controlEl.appendChild(this.buttonEl), t && this.onClick(t), this.buttonEl.addEventListener("click", (s) => {
206
+ var r;
207
+ (r = this.soundEngine) == null || r.playClick(), this.clickHandler && this.clickHandler(s);
208
+ });
209
+ }
210
+ setSoundEngine(e) {
211
+ return this.soundEngine = e, this;
212
+ }
213
+ setLabel(e) {
214
+ return super.setLabel(e), this.buttonEl.textContent = e, this;
215
+ }
216
+ onClick(e) {
217
+ return this.clickHandler = e, this;
218
+ }
219
+ update() {
220
+ return this;
221
+ }
222
+ }
223
+ class z extends C {
224
+ constructor(e, t, n, s, r, l) {
225
+ super(e, t, n, r, l);
226
+ a(this, "selectEl");
227
+ a(this, "optionsMap", /* @__PURE__ */ new Map());
228
+ this.selectEl = document.createElement("select"), this.selectEl.className = "relly-select-input", this.controlEl.appendChild(this.selectEl), s && this.setOptions(s), this.selectEl.addEventListener("change", () => {
229
+ const o = this.selectEl.value, h = this.optionsMap.has(o) ? this.optionsMap.get(o) : o;
230
+ this.setValue(h);
231
+ }), this.update();
232
+ }
233
+ setOptions(e) {
234
+ if (this.selectEl.innerHTML = "", this.optionsMap.clear(), Array.isArray(e))
235
+ for (const t of e) {
236
+ const n = String(t);
237
+ this.optionsMap.set(n, t);
238
+ const s = document.createElement("option");
239
+ s.value = n, s.textContent = n, this.selectEl.appendChild(s);
240
+ }
241
+ else if (typeof e == "object" && e !== null)
242
+ for (const [t, n] of Object.entries(e)) {
243
+ this.optionsMap.set(t, n);
244
+ const s = document.createElement("option");
245
+ s.value = t, s.textContent = t, this.selectEl.appendChild(s);
246
+ }
247
+ return this.update(), this;
248
+ }
249
+ update() {
250
+ if (!this.selectEl) return this;
251
+ const e = this.getValue();
252
+ for (const [t, n] of this.optionsMap.entries())
253
+ if (n === e || String(n) === String(e))
254
+ return this.selectEl.value = t, this;
255
+ return this.selectEl.value = String(e), this;
256
+ }
257
+ }
258
+ class B extends C {
259
+ constructor(e, t, n, s) {
260
+ super(e, t, n, s);
261
+ a(this, "valueBadge");
262
+ a(this, "formatter", (e) => String(e ?? ""));
263
+ this.valueBadge = document.createElement("span"), this.valueBadge.className = "relly-dynamic-value", this.controlEl.appendChild(this.valueBadge), this.update();
264
+ }
265
+ setFormat(e) {
266
+ return this.formatter = e, this.update(), this;
267
+ }
268
+ update() {
269
+ const e = this.getValue();
270
+ return this.valueBadge.textContent = this.formatter(e), this;
271
+ }
272
+ }
273
+ class N extends C {
274
+ constructor(e, t, n, s, r) {
275
+ super(e, t, n, s);
276
+ a(this, "canvasContainer");
277
+ a(this, "canvas");
278
+ a(this, "ctx", null);
279
+ a(this, "statsEl");
280
+ a(this, "graphTooltipEl");
281
+ a(this, "legendEl");
282
+ a(this, "primarySeries");
283
+ a(this, "seriesList", []);
284
+ a(this, "seriesMap", /* @__PURE__ */ new Map());
285
+ a(this, "bufferSize", 60);
286
+ a(this, "min", 0);
287
+ a(this, "max", 100);
288
+ a(this, "autoRange", !0);
289
+ a(this, "smoothCurves", !0);
290
+ a(this, "isPaused", !1);
291
+ a(this, "formatter", (e) => typeof e == "number" && !isNaN(e) ? e.toFixed(1) : "0");
292
+ a(this, "cssWidth", 280);
293
+ a(this, "cssHeight", 90);
294
+ a(this, "sampleInterval", 50);
295
+ a(this, "lastSampleTime", 0);
296
+ a(this, "hoverIndex", null);
297
+ a(this, "resizeObserver", null);
298
+ a(this, "mediaQueryList", null);
299
+ a(this, "soundEngine");
300
+ a(this, "onResolutionChange", () => {
301
+ this.updateDPRListener(), this.resizeCanvas(), this.draw();
302
+ });
303
+ a(this, "onMouseMove", (e) => {
304
+ const t = this.canvas.getBoundingClientRect(), n = e.clientX - t.left, s = this.cssWidth;
305
+ if (s <= 0) return;
306
+ const r = s / Math.max(1, this.bufferSize - 1), l = Math.round(n / r), o = Math.max(0, Math.min(this.bufferSize - 1, l));
307
+ o !== this.hoverIndex && (this.hoverIndex = o, this.updateTooltip(n), this.draw());
308
+ });
309
+ a(this, "onMouseLeave", () => {
310
+ this.hoverIndex = null, this.graphTooltipEl.classList.remove("relly-tooltip-show"), this.draw();
311
+ });
312
+ a(this, "onCanvasClick", () => {
313
+ var e;
314
+ (e = this.soundEngine) == null || e.playClick(), this.isPaused = !this.isPaused, this.isPaused ? this.canvasContainer.classList.add("relly-graph-paused") : this.canvasContainer.classList.remove("relly-graph-paused"), this.updateStats(), this.draw();
315
+ });
316
+ this.soundEngine = r, this.element.className = "relly-graph-row", this.element.innerHTML = "";
317
+ const l = document.createElement("div");
318
+ l.className = "relly-graph-header", this.labelEl = document.createElement("span"), this.labelEl.className = "relly-graph-label", this.labelEl.textContent = e, this.statsEl = document.createElement("div"), this.statsEl.className = "relly-graph-stats", this.statsEl.innerHTML = '<span class="relly-graph-val">0</span>', l.appendChild(this.labelEl), l.appendChild(this.statsEl), this.element.appendChild(l), this.legendEl = document.createElement("div"), this.legendEl.className = "relly-graph-legend", this.element.appendChild(this.legendEl), this.canvasContainer = document.createElement("div"), this.canvasContainer.className = "relly-graph-canvas-container", this.canvasContainer.title = "Click to pause/freeze data stream for inspection", this.canvas = document.createElement("canvas"), this.canvas.className = "relly-graph-canvas", this.canvasContainer.appendChild(this.canvas), this.graphTooltipEl = document.createElement("div"), this.graphTooltipEl.className = "relly-graph-tooltip", this.canvasContainer.appendChild(this.graphTooltipEl), this.element.appendChild(this.canvasContainer), this.ctx = this.canvas.getContext("2d"), this.primarySeries = {
319
+ id: "default",
320
+ label: e,
321
+ color: "#38bdf8",
322
+ fillColor: "rgba(56, 189, 248, 0.25)",
323
+ buffer: []
324
+ }, this.seriesList.push(this.primarySeries), this.seriesMap.set("default", this.primarySeries), this.initCanvasSize(), this.setupListeners(), this.update(), this.bindingEngine && this.targetObject && this.property && this.listen();
325
+ }
326
+ setupListeners() {
327
+ typeof window > "u" || (typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => {
328
+ this.resizeCanvas(), this.draw();
329
+ }), this.resizeObserver.observe(this.canvasContainer)), this.updateDPRListener(), this.canvas.addEventListener("mousemove", this.onMouseMove), this.canvas.addEventListener("mouseleave", this.onMouseLeave), this.canvas.addEventListener("click", this.onCanvasClick));
330
+ }
331
+ updateDPRListener() {
332
+ var t;
333
+ if (typeof window > "u" || !window.matchMedia) return;
334
+ const e = window.devicePixelRatio || 1;
335
+ (t = this.mediaQueryList) == null || t.removeEventListener("change", this.onResolutionChange), this.mediaQueryList = window.matchMedia(`(resolution: ${e}dppx)`), this.mediaQueryList.addEventListener("change", this.onResolutionChange);
336
+ }
337
+ initCanvasSize() {
338
+ this.resizeCanvas();
339
+ }
340
+ resizeCanvas() {
341
+ if (!this.canvas || !this.canvasContainer) return;
342
+ const e = this.canvasContainer.getBoundingClientRect(), t = typeof window < "u" && window.devicePixelRatio || 1, n = Math.max(10, Math.floor(e.width || 280)), s = Math.max(10, Math.floor(e.height || 80));
343
+ this.cssWidth = n, this.cssHeight = s, this.canvas.width = Math.round(n * t), this.canvas.height = Math.round(s * t), this.ctx && (typeof this.ctx.resetTransform == "function" ? this.ctx.resetTransform() : this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.scale(t, t));
344
+ }
345
+ updateTooltip(e) {
346
+ if (this.hoverIndex === null) return;
347
+ let t = "";
348
+ for (const r of this.seriesList) {
349
+ const l = this.bufferSize - r.buffer.length, o = this.hoverIndex - l;
350
+ if (o >= 0 && o < r.buffer.length) {
351
+ const h = r.buffer[o];
352
+ t += `<div><span style="display:inline-block;width:6px;height:6px;border-radius:50%;background:${r.color};margin-right:4px;"></span>${r.label}: <b>${this.formatter(h)}</b></div>`;
353
+ }
354
+ }
355
+ if (!t) {
356
+ this.graphTooltipEl.classList.remove("relly-tooltip-show");
357
+ return;
358
+ }
359
+ this.graphTooltipEl.innerHTML = t, this.graphTooltipEl.classList.add("relly-tooltip-show");
360
+ const n = this.graphTooltipEl.offsetWidth || 80;
361
+ let s = e;
362
+ s - n / 2 < 4 ? s = 4 + n / 2 : s + n / 2 > this.cssWidth - 4 && (s = this.cssWidth - 4 - n / 2), this.graphTooltipEl.style.left = `${s}px`, this.graphTooltipEl.style.top = "14px";
363
+ }
364
+ setSoundEngine(e) {
365
+ return this.soundEngine = e, this;
366
+ }
367
+ togglePause() {
368
+ return this.onCanvasClick(), this;
369
+ }
370
+ setPaused(e) {
371
+ return this.isPaused !== e && this.onCanvasClick(), this;
372
+ }
373
+ isGraphPaused() {
374
+ return this.isPaused;
375
+ }
376
+ setSampleInterval(e) {
377
+ return this.sampleInterval = Math.max(10, e), this;
378
+ }
379
+ getSampleInterval() {
380
+ return this.sampleInterval;
381
+ }
382
+ checkDirty() {
383
+ if (this.checkVisibility(), !this.targetObject || !this.property || this.isPaused) return;
384
+ const e = this.targetObject[this.property], t = typeof performance < "u" ? performance.now() : Date.now();
385
+ (t - this.lastSampleTime >= this.sampleInterval || e !== this.prevValue) && (this.lastSampleTime = t, this.prevValue = e, this.update(), this.triggerChange(e, this.prevValue));
386
+ }
387
+ setSmooth(e) {
388
+ return this.smoothCurves = e, this.draw(), this;
389
+ }
390
+ setFormat(e) {
391
+ return this.formatter = e, this.updateStats(), this;
392
+ }
393
+ setRange(e, t) {
394
+ return this.min = e, this.max = t, this.autoRange = !1, this.draw(), this;
395
+ }
396
+ setAutoRange(e) {
397
+ return this.autoRange = e, this.draw(), this;
398
+ }
399
+ setColor(e, t) {
400
+ return this.primarySeries.color = e, this.primarySeries.fillColor = t || `${e}33`, this.draw(), this;
401
+ }
402
+ setBufferSize(e) {
403
+ this.bufferSize = Math.max(10, e);
404
+ for (const t of this.seriesList)
405
+ for (; t.buffer.length > this.bufferSize; )
406
+ t.buffer.shift();
407
+ return this.draw(), this;
408
+ }
409
+ setHeight(e) {
410
+ return this.cssHeight = e, this.canvasContainer.style.height = `${e}px`, this.resizeCanvas(), this.draw(), this;
411
+ }
412
+ addSeries(e, t) {
413
+ const n = {
414
+ id: e,
415
+ label: t.label || e,
416
+ color: t.color,
417
+ fillColor: t.fillColor || `${t.color}33`,
418
+ buffer: []
419
+ };
420
+ return this.seriesList.push(n), this.seriesMap.set(e, n), this.updateLegend(), this.draw(), this;
421
+ }
422
+ updateLegend() {
423
+ if (this.seriesList.length <= 1) {
424
+ this.legendEl.style.display = "none";
425
+ return;
426
+ }
427
+ this.legendEl.style.display = "flex", this.legendEl.innerHTML = "";
428
+ for (const e of this.seriesList) {
429
+ const t = document.createElement("div");
430
+ t.className = "relly-graph-legend-item", t.innerHTML = `
431
+ <span class="relly-graph-legend-dot" style="background-color: ${e.color}"></span>
432
+ <span class="relly-graph-legend-label">${e.label}</span>
433
+ `, this.legendEl.appendChild(t);
434
+ }
435
+ }
436
+ push(e) {
437
+ if (this.isPaused) return this;
438
+ if (typeof e == "number") {
439
+ if (isNaN(e) || !isFinite(e)) return this;
440
+ this.primarySeries.buffer.push(e), this.primarySeries.buffer.length > this.bufferSize && this.primarySeries.buffer.shift();
441
+ } else if (typeof e == "object" && e !== null)
442
+ for (const [t, n] of Object.entries(e))
443
+ typeof n == "number" && !isNaN(n) && isFinite(n) && this.pushSeries(t, n);
444
+ return this.updateStats(), this.draw(), this;
445
+ }
446
+ pushSeries(e, t) {
447
+ if (this.isPaused) return this;
448
+ if (typeof t != "number" || isNaN(t) || !isFinite(t)) return this;
449
+ const n = this.seriesMap.get(e);
450
+ return n ? (n.buffer.push(t), n.buffer.length > this.bufferSize && n.buffer.shift(), this) : (this.addSeries(e, { color: "#ec4899", label: e }), this.pushSeries(e, t));
451
+ }
452
+ updateStats() {
453
+ const e = this.primarySeries.buffer.length > 0 ? this.primarySeries.buffer[this.primarySeries.buffer.length - 1] : 0;
454
+ let t = this.min, n = this.max, s = [];
455
+ for (const l of this.seriesList)
456
+ s = s.concat(l.buffer);
457
+ s.length > 0 && (t = Math.min(...s), n = Math.max(...s));
458
+ const r = this.isPaused ? '<span class="relly-graph-badge relly-graph-badge--paused">PAUSED</span>' : "";
459
+ this.statsEl.innerHTML = `
460
+ ${r}
461
+ <span class="relly-graph-badge relly-graph-badge--min">min: ${this.formatter(t)}</span>
462
+ <span class="relly-graph-badge relly-graph-badge--max">max: ${this.formatter(n)}</span>
463
+ <span class="relly-graph-val">${this.formatter(e)}</span>
464
+ `;
465
+ }
466
+ update() {
467
+ const e = this.getValue();
468
+ if (typeof e == "number" ? this.push(e) : typeof e == "object" && e !== null && this.push(e), this.targetObject)
469
+ for (const t of this.seriesList)
470
+ t.id !== "default" && typeof this.targetObject[t.id] == "number" && this.pushSeries(t.id, this.targetObject[t.id]);
471
+ return this;
472
+ }
473
+ draw() {
474
+ if (!this.ctx) return;
475
+ const e = this.ctx, t = this.cssWidth, n = this.cssHeight;
476
+ e.clearRect(0, 0, t, n), e.save(), e.setLineDash([2, 4]), e.strokeStyle = "rgba(255, 255, 255, 0.08)", e.lineWidth = 1;
477
+ for (let d of [0.25, 0.5, 0.75]) {
478
+ const f = Math.round(n * d);
479
+ e.beginPath(), e.moveTo(0, f), e.lineTo(t, f), e.stroke();
480
+ }
481
+ e.restore();
482
+ let s = [];
483
+ for (const d of this.seriesList)
484
+ s = s.concat(d.buffer);
485
+ if (s.length === 0) return;
486
+ const r = Math.min(...s), l = Math.max(...s);
487
+ let o = this.autoRange ? r : this.min, h = this.autoRange ? l : this.max;
488
+ l > h && (h = l), r < o && (o = r), o === h && (o -= 1, h += 1);
489
+ const c = (h - o) * 0.16 || 1;
490
+ o -= c, h += c;
491
+ const u = h - o || 1, p = t / Math.max(1, this.bufferSize - 1);
492
+ for (const d of this.seriesList) {
493
+ if (d.buffer.length === 0) continue;
494
+ const f = d.buffer.length === 1 ? [d.buffer[0], d.buffer[0]] : d.buffer, b = this.bufferSize - f.length, m = [];
495
+ for (let g = 0; g < f.length; g++) {
496
+ const x = (b + g) * p, w = Math.max(0, Math.min(1, (f[g] - o) / u)), M = Math.max(4, Math.min(n - 4, n - 6 - w * (n - 12)));
497
+ m.push({ x, y: M });
498
+ }
499
+ if (e.beginPath(), e.moveTo(m[0].x, n), e.lineTo(m[0].x, m[0].y), this.smoothCurves && m.length > 2)
500
+ for (let g = 0; g < m.length - 1; g++) {
501
+ const x = m[g], w = m[g + 1], M = (x.x + w.x) / 2;
502
+ e.bezierCurveTo(M, x.y, M, w.y, w.x, w.y);
503
+ }
504
+ else
505
+ for (let g = 1; g < m.length; g++)
506
+ e.lineTo(m[g].x, m[g].y);
507
+ e.lineTo(m[m.length - 1].x, n), e.closePath();
508
+ const v = e.createLinearGradient(0, 0, 0, n);
509
+ if (v.addColorStop(0, d.fillColor || `${d.color}40`), v.addColorStop(1, "rgba(0, 0, 0, 0)"), e.fillStyle = v, e.fill(), e.beginPath(), e.moveTo(m[0].x, m[0].y), this.smoothCurves && m.length > 2)
510
+ for (let g = 0; g < m.length - 1; g++) {
511
+ const x = m[g], w = m[g + 1], M = (x.x + w.x) / 2;
512
+ e.bezierCurveTo(M, x.y, M, w.y, w.x, w.y);
513
+ }
514
+ else
515
+ for (let g = 1; g < m.length; g++)
516
+ e.lineTo(m[g].x, m[g].y);
517
+ e.save(), e.strokeStyle = d.color, e.lineWidth = 2, e.shadowColor = d.color, e.shadowBlur = 5, e.stroke(), e.restore();
518
+ const E = m[m.length - 1];
519
+ E && (e.beginPath(), e.arc(E.x, E.y, 4, 0, Math.PI * 2), e.fillStyle = d.color, e.globalAlpha = 0.35, e.fill(), e.globalAlpha = 1, e.beginPath(), e.arc(E.x, E.y, 2, 0, Math.PI * 2), e.fillStyle = "#ffffff", e.fill());
520
+ }
521
+ if (this.hoverIndex !== null) {
522
+ const d = Math.round(this.hoverIndex * p);
523
+ e.save(), e.setLineDash([3, 3]), e.strokeStyle = "rgba(255, 255, 255, 0.45)", e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, n), e.stroke(), e.restore();
524
+ for (const f of this.seriesList) {
525
+ const b = this.bufferSize - f.buffer.length, m = this.hoverIndex - b;
526
+ if (m >= 0 && m < f.buffer.length) {
527
+ const v = f.buffer[m], E = Math.max(0, Math.min(1, (v - o) / u)), g = Math.max(4, Math.min(n - 4, n - 6 - E * (n - 12)));
528
+ e.beginPath(), e.arc(d, g, 4.5, 0, Math.PI * 2), e.fillStyle = f.color, e.fill(), e.beginPath(), e.arc(d, g, 2, 0, Math.PI * 2), e.fillStyle = "#ffffff", e.fill();
529
+ }
530
+ }
531
+ }
532
+ }
533
+ destroy() {
534
+ this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.mediaQueryList && (this.mediaQueryList.removeEventListener("change", this.onResolutionChange), this.mediaQueryList = null), this.canvas.removeEventListener("mousemove", this.onMouseMove), this.canvas.removeEventListener("mouseleave", this.onMouseLeave), this.canvas.removeEventListener("click", this.onCanvasClick), super.destroy();
535
+ }
536
+ }
537
+ class R extends C {
538
+ constructor(e, t, n, s, r, l) {
539
+ super(e, t, n, s, r);
540
+ a(this, "wrapperEl");
541
+ a(this, "previewEl");
542
+ a(this, "hexTextEl");
543
+ a(this, "nativeColorInput");
544
+ a(this, "eyeDropperBtn");
545
+ a(this, "swatchesContainer");
546
+ a(this, "swatches", []);
547
+ a(this, "swatchButtons", /* @__PURE__ */ new Map());
548
+ a(this, "soundEngine");
549
+ this.soundEngine = l, this.wrapperEl = document.createElement("div"), this.wrapperEl.className = "relly-color-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "relly-color-preview", this.previewEl.title = "Click to open color palette", this.hexTextEl = document.createElement("span"), this.hexTextEl.className = "relly-color-text", this.nativeColorInput = document.createElement("input"), this.nativeColorInput.type = "color", this.nativeColorInput.className = "relly-color-native", this.wrapperEl.appendChild(this.previewEl), this.wrapperEl.appendChild(this.hexTextEl), this.wrapperEl.appendChild(this.nativeColorInput), typeof window < "u" && "EyeDropper" in window && (this.eyeDropperBtn = document.createElement("button"), this.eyeDropperBtn.type = "button", this.eyeDropperBtn.className = "relly-eyedropper-btn", this.eyeDropperBtn.title = "Pick color from screen", this.eyeDropperBtn.innerHTML = `
550
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
551
+ <path d="m14 7 3 3m-1-5a2.83 2.83 0 0 1 4 4L7 22H3v-4L16 5Z"></path>
552
+ </svg>
553
+ `, this.eyeDropperBtn.addEventListener("click", async () => {
554
+ try {
555
+ const h = await new window.EyeDropper().open();
556
+ h && h.sRGBHex && this.setValue(h.sRGBHex);
557
+ } catch {
558
+ }
559
+ }), this.wrapperEl.appendChild(this.eyeDropperBtn)), this.controlEl.appendChild(this.wrapperEl), this.previewEl.addEventListener("click", () => {
560
+ this.nativeColorInput.click();
561
+ }), this.nativeColorInput.addEventListener("input", () => {
562
+ const o = this.nativeColorInput.value;
563
+ this.setValue(o);
564
+ }), this.update();
565
+ }
566
+ setSoundEngine(e) {
567
+ return this.soundEngine = e, this;
568
+ }
569
+ setSwatches(e) {
570
+ this.swatches = e, this.swatchesContainer || (this.swatchesContainer = document.createElement("div"), this.swatchesContainer.className = "relly-color-swatches", this.wrapperEl.insertBefore(this.swatchesContainer, this.previewEl)), this.swatchesContainer.innerHTML = "", this.swatchButtons.clear();
571
+ for (const t of this.swatches) {
572
+ const n = document.createElement("button");
573
+ n.type = "button", n.className = "relly-color-swatch", n.style.backgroundColor = t, n.title = t.toUpperCase(), n.addEventListener("click", () => {
574
+ var s;
575
+ this.setValue(t), (s = this.soundEngine) == null || s.playClick();
576
+ }), this.swatchesContainer.appendChild(n), this.swatchButtons.set(t.toLowerCase(), n);
577
+ }
578
+ return this.update(), this;
579
+ }
580
+ getSwatches() {
581
+ return [...this.swatches];
582
+ }
583
+ update() {
584
+ if (!this.previewEl || !this.hexTextEl) return this;
585
+ const e = String(this.getValue() || "#000000");
586
+ this.previewEl.style.backgroundColor = e, this.hexTextEl.textContent = e.toUpperCase(), e.startsWith("#") && (e.length === 7 || e.length === 4) && (this.nativeColorInput.value = e.length === 4 ? `#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}` : e);
587
+ const t = e.toLowerCase();
588
+ for (const [n, s] of this.swatchButtons.entries())
589
+ n === t ? s.classList.add("relly-swatch-active") : s.classList.remove("relly-swatch-active");
590
+ return this;
591
+ }
592
+ }
593
+ class P extends C {
594
+ constructor(e, t, n, s, r) {
595
+ super(e, t, n, s, r);
596
+ a(this, "containerEl");
597
+ a(this, "xInput");
598
+ a(this, "yInput");
599
+ a(this, "min");
600
+ a(this, "max");
601
+ a(this, "step", 0.1);
602
+ this.containerEl = document.createElement("div"), this.containerEl.className = "relly-point2d-container";
603
+ const l = document.createElement("div");
604
+ l.className = "relly-point2d-item";
605
+ const o = document.createElement("span");
606
+ o.className = "relly-point2d-tag", o.textContent = "X", this.xInput = document.createElement("input"), this.xInput.type = "number", this.xInput.className = "relly-point2d-input", this.xInput.step = String(this.step), l.appendChild(o), l.appendChild(this.xInput);
607
+ const h = document.createElement("div");
608
+ h.className = "relly-point2d-item";
609
+ const c = document.createElement("span");
610
+ c.className = "relly-point2d-tag", c.textContent = "Y", this.yInput = document.createElement("input"), this.yInput.type = "number", this.yInput.className = "relly-point2d-input", this.yInput.step = String(this.step), h.appendChild(c), h.appendChild(this.yInput), this.containerEl.appendChild(l), this.containerEl.appendChild(h), this.controlEl.appendChild(this.containerEl), this.xInput.addEventListener("change", () => this.handleInputChange()), this.yInput.addEventListener("change", () => this.handleInputChange()), this.setupInputScrubbing(this.xInput, "x"), this.setupInputScrubbing(this.yInput, "y"), this.update();
611
+ }
612
+ setupInputScrubbing(e, t) {
613
+ let n = !1, s = 0, r = 0;
614
+ const l = (h) => {
615
+ const c = h.clientX - s;
616
+ if (!n && Math.abs(c) > 3 && (n = !0, typeof document < "u" && document.body.classList.add("relly-jog-scrubbing")), n) {
617
+ const u = h.shiftKey ? 10 : h.altKey ? 0.1 : 1, p = this.step * u;
618
+ let d = r + c * p;
619
+ this.min !== void 0 && (d = Math.max(this.min, d)), this.max !== void 0 && (d = Math.min(this.max, d));
620
+ const f = (this.step.toString().split(".")[1] || "").length;
621
+ d = parseFloat(d.toFixed(Math.max(f, 2)));
622
+ const b = this.getValue();
623
+ if (Array.isArray(b)) {
624
+ const m = [b[0], b[1]];
625
+ m[t === "x" ? 0 : 1] = d, this.setValue(m);
626
+ } else
627
+ this.setValue({ ...b, [t]: d });
628
+ h.preventDefault();
629
+ }
630
+ }, o = () => {
631
+ n && typeof document < "u" && document.body.classList.remove("relly-jog-scrubbing"), typeof window < "u" && (window.removeEventListener("mousemove", l), window.removeEventListener("mouseup", o));
632
+ };
633
+ e.addEventListener("mousedown", (h) => {
634
+ s = h.clientX, r = parseFloat(e.value) || 0, n = !1, typeof window < "u" && (window.addEventListener("mousemove", l), window.addEventListener("mouseup", o));
635
+ });
636
+ }
637
+ setMin(e) {
638
+ return this.min = e, this.xInput.min = String(e), this.yInput.min = String(e), this;
639
+ }
640
+ setMax(e) {
641
+ return this.max = e, this.xInput.max = String(e), this.yInput.max = String(e), this;
642
+ }
643
+ setStep(e) {
644
+ return this.step = e, this.xInput.step = String(e), this.yInput.step = String(e), this;
645
+ }
646
+ getValue() {
647
+ return this.targetObject && this.property && this.targetObject[this.property] !== void 0 ? this.targetObject[this.property] : this.targetObject && "x" in this.targetObject && "y" in this.targetObject ? this.targetObject : this.prevValue || { x: 0, y: 0 };
648
+ }
649
+ setValue(e) {
650
+ const t = this.getValue(), n = Array.isArray(t) ? [...t] : typeof t == "object" && t !== null ? { ...t } : t;
651
+ return this.targetObject && this.property && this.targetObject[this.property] !== void 0 ? this.targetObject[this.property] = e : this.targetObject && "x" in this.targetObject && "y" in this.targetObject && typeof e == "object" && !Array.isArray(e) && (this.targetObject.x = e.x, this.targetObject.y = e.y), this.prevValue = e, this.update(), this.triggerChange(e, n), this;
652
+ }
653
+ handleInputChange() {
654
+ let e = parseFloat(this.xInput.value) || 0, t = parseFloat(this.yInput.value) || 0;
655
+ this.min !== void 0 && (e = Math.max(this.min, e), t = Math.max(this.min, t)), this.max !== void 0 && (e = Math.min(this.max, e), t = Math.min(this.max, t));
656
+ const n = this.getValue();
657
+ Array.isArray(n) ? this.setValue([e, t]) : this.setValue({ ...n, x: e, y: t });
658
+ }
659
+ update() {
660
+ if (!this.xInput || !this.yInput) return this;
661
+ const e = this.getValue();
662
+ let t = 0, n = 0;
663
+ return Array.isArray(e) ? (t = e[0] || 0, n = e[1] || 0) : typeof e == "object" && e !== null && (t = e.x || 0, n = e.y || 0), this.xInput.value = String(t), this.yInput.value = String(n), this;
664
+ }
665
+ }
666
+ class D extends C {
667
+ constructor(e, t, n, s, r) {
668
+ super(e, t, n, s, r);
669
+ a(this, "containerEl");
670
+ a(this, "xInput");
671
+ a(this, "yInput");
672
+ a(this, "zInput");
673
+ a(this, "min");
674
+ a(this, "max");
675
+ a(this, "step", 0.1);
676
+ this.containerEl = document.createElement("div"), this.containerEl.className = "relly-point3d-container";
677
+ const l = document.createElement("div");
678
+ l.className = "relly-point3d-item";
679
+ const o = document.createElement("span");
680
+ o.className = "relly-point3d-tag relly-point3d-tag--x", o.textContent = "X", this.xInput = document.createElement("input"), this.xInput.type = "number", this.xInput.className = "relly-point3d-input", this.xInput.step = String(this.step), l.appendChild(o), l.appendChild(this.xInput);
681
+ const h = document.createElement("div");
682
+ h.className = "relly-point3d-item";
683
+ const c = document.createElement("span");
684
+ c.className = "relly-point3d-tag relly-point3d-tag--y", c.textContent = "Y", this.yInput = document.createElement("input"), this.yInput.type = "number", this.yInput.className = "relly-point3d-input", this.yInput.step = String(this.step), h.appendChild(c), h.appendChild(this.yInput);
685
+ const u = document.createElement("div");
686
+ u.className = "relly-point3d-item";
687
+ const p = document.createElement("span");
688
+ p.className = "relly-point3d-tag relly-point3d-tag--z", p.textContent = "Z", this.zInput = document.createElement("input"), this.zInput.type = "number", this.zInput.className = "relly-point3d-input", this.zInput.step = String(this.step), u.appendChild(p), u.appendChild(this.zInput), this.containerEl.appendChild(l), this.containerEl.appendChild(h), this.containerEl.appendChild(u), this.controlEl.appendChild(this.containerEl), this.xInput.addEventListener("change", () => this.handleInputChange()), this.yInput.addEventListener("change", () => this.handleInputChange()), this.zInput.addEventListener("change", () => this.handleInputChange()), this.setupInputScrubbing(this.xInput, "x"), this.setupInputScrubbing(this.yInput, "y"), this.setupInputScrubbing(this.zInput, "z"), this.update();
689
+ }
690
+ setupInputScrubbing(e, t) {
691
+ let n = !1, s = 0, r = 0;
692
+ const l = (h) => {
693
+ const c = h.clientX - s;
694
+ if (!n && Math.abs(c) > 3 && (n = !0, typeof document < "u" && document.body.classList.add("relly-jog-scrubbing")), n) {
695
+ const u = h.shiftKey ? 10 : h.altKey ? 0.1 : 1, p = this.step * u;
696
+ let d = r + c * p;
697
+ this.min !== void 0 && (d = Math.max(this.min, d)), this.max !== void 0 && (d = Math.min(this.max, d));
698
+ const f = (this.step.toString().split(".")[1] || "").length;
699
+ d = parseFloat(d.toFixed(Math.max(f, 2)));
700
+ const b = this.getValue();
701
+ if (Array.isArray(b)) {
702
+ const m = [
703
+ b[0] ?? 0,
704
+ b[1] ?? 0,
705
+ b[2] ?? 0
706
+ ], v = t === "x" ? 0 : t === "y" ? 1 : 2;
707
+ m[v] = d, this.setValue(m);
708
+ } else
709
+ this.setValue({ ...b, [t]: d });
710
+ h.preventDefault();
711
+ }
712
+ }, o = () => {
713
+ window.removeEventListener("mousemove", l), window.removeEventListener("mouseup", o), n && (n = !1, typeof document < "u" && document.body.classList.remove("relly-jog-scrubbing"));
714
+ };
715
+ e.addEventListener("mousedown", (h) => {
716
+ h.button === 0 && (s = h.clientX, r = parseFloat(e.value) || 0, window.addEventListener("mousemove", l), window.addEventListener("mouseup", o));
717
+ });
718
+ }
719
+ handleInputChange() {
720
+ const e = parseFloat(this.xInput.value) || 0, t = parseFloat(this.yInput.value) || 0, n = parseFloat(this.zInput.value) || 0, s = this.getValue();
721
+ Array.isArray(s) ? this.setValue([e, t, n]) : this.setValue({
722
+ ...typeof s == "object" && s !== null ? s : {},
723
+ x: e,
724
+ y: t,
725
+ z: n
726
+ });
727
+ }
728
+ setMin(e) {
729
+ return this.min = e, e !== void 0 ? (this.xInput.min = e.toString(), this.yInput.min = e.toString(), this.zInput.min = e.toString()) : (this.xInput.removeAttribute("min"), this.yInput.removeAttribute("min"), this.zInput.removeAttribute("min")), this;
730
+ }
731
+ setMax(e) {
732
+ return this.max = e, e !== void 0 ? (this.xInput.max = e.toString(), this.yInput.max = e.toString(), this.zInput.max = e.toString()) : (this.xInput.removeAttribute("max"), this.yInput.removeAttribute("max"), this.zInput.removeAttribute("max")), this;
733
+ }
734
+ setStep(e) {
735
+ return this.step = e, this.xInput.step = e.toString(), this.yInput.step = e.toString(), this.zInput.step = e.toString(), this;
736
+ }
737
+ update() {
738
+ if (!this.xInput || !this.yInput || !this.zInput) return this;
739
+ const e = this.getValue();
740
+ let t = 0, n = 0, s = 0;
741
+ return Array.isArray(e) ? (t = e[0] || 0, n = e[1] || 0, s = e[2] || 0) : typeof e == "object" && e !== null && (t = e.x || 0, n = e.y || 0, s = e.z || 0), this.xInput.value = String(t), this.yInput.value = String(n), this.zInput.value = String(s), this;
742
+ }
743
+ }
744
+ class H extends C {
745
+ constructor(e, t, n, s, r, l) {
746
+ super(e, t, n, s, r);
747
+ a(this, "wrapperEl");
748
+ a(this, "trackEl");
749
+ a(this, "barEl");
750
+ a(this, "thumbMin");
751
+ a(this, "thumbMax");
752
+ a(this, "inputMin");
753
+ a(this, "inputMax");
754
+ a(this, "min", 0);
755
+ a(this, "max", 100);
756
+ a(this, "step", 1);
757
+ a(this, "soundEngine");
758
+ a(this, "formatter", (e, t) => `[${e.toFixed(1)}, ${t.toFixed(1)}]`);
759
+ this.soundEngine = l, this.wrapperEl = document.createElement("div"), this.wrapperEl.className = "relly-range-wrapper", this.inputMin = document.createElement("input"), this.inputMin.type = "number", this.inputMin.className = "relly-range-input relly-range-input--min", this.trackEl = document.createElement("div"), this.trackEl.className = "relly-range-track", this.barEl = document.createElement("div"), this.barEl.className = "relly-range-bar", this.thumbMin = document.createElement("div"), this.thumbMin.className = "relly-range-thumb relly-range-thumb--min", this.thumbMin.title = "Drag min", this.thumbMax = document.createElement("div"), this.thumbMax.className = "relly-range-thumb relly-range-thumb--max", this.thumbMax.title = "Drag max", this.trackEl.appendChild(this.barEl), this.trackEl.appendChild(this.thumbMin), this.trackEl.appendChild(this.thumbMax), this.inputMax = document.createElement("input"), this.inputMax.type = "number", this.inputMax.className = "relly-range-input relly-range-input--max", this.wrapperEl.appendChild(this.inputMin), this.wrapperEl.appendChild(this.trackEl), this.wrapperEl.appendChild(this.inputMax), this.controlEl.appendChild(this.wrapperEl), this.setupListeners(), this.update();
760
+ }
761
+ setupListeners() {
762
+ this.inputMin.addEventListener("change", () => {
763
+ const e = parseFloat(this.inputMin.value) || this.min, [t, n] = this.getCurrentRange();
764
+ this.setRangeValue(Math.min(e, n), n);
765
+ }), this.inputMax.addEventListener("change", () => {
766
+ const e = parseFloat(this.inputMax.value) || this.max, [t, n] = this.getCurrentRange();
767
+ this.setRangeValue(t, Math.max(e, t));
768
+ }), this.setupThumbDrag(this.thumbMin, "min"), this.setupThumbDrag(this.thumbMax, "max"), this.setupBarDrag();
769
+ }
770
+ setupThumbDrag(e, t) {
771
+ let n = !1;
772
+ const s = (l) => {
773
+ var f, b;
774
+ if (!n) return;
775
+ const o = this.trackEl.getBoundingClientRect(), h = Math.max(0, Math.min(1, (l.clientX - o.left) / o.width)), c = this.min + h * (this.max - this.min), u = this.applyStep(c), [p, d] = this.getCurrentRange();
776
+ if (t === "min") {
777
+ const m = Math.min(u, d);
778
+ m !== p && ((f = this.soundEngine) == null || f.playTick(), this.setRangeValue(m, d));
779
+ } else {
780
+ const m = Math.max(u, p);
781
+ m !== d && ((b = this.soundEngine) == null || b.playTick(), this.setRangeValue(p, m));
782
+ }
783
+ }, r = () => {
784
+ n && (n = !1, window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", r));
785
+ };
786
+ e.addEventListener("mousedown", (l) => {
787
+ l.button === 0 && (l.preventDefault(), l.stopPropagation(), n = !0, window.addEventListener("mousemove", s), window.addEventListener("mouseup", r));
788
+ });
789
+ }
790
+ setupBarDrag() {
791
+ let e = !1, t = 0, n = 0, s = 0;
792
+ const r = (o) => {
793
+ var v;
794
+ if (!e) return;
795
+ const h = this.trackEl.getBoundingClientRect(), u = (o.clientX - t) / h.width * (this.max - this.min), p = s - n;
796
+ let d = Math.max(this.min, Math.min(this.max - p, n + u));
797
+ d = this.applyStep(d);
798
+ const f = this.applyStep(d + p), [b, m] = this.getCurrentRange();
799
+ (d !== b || f !== m) && ((v = this.soundEngine) == null || v.playTick(), this.setRangeValue(d, f));
800
+ }, l = () => {
801
+ e && (e = !1, window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", l));
802
+ };
803
+ this.barEl.addEventListener("mousedown", (o) => {
804
+ if (o.button !== 0) return;
805
+ o.preventDefault(), o.stopPropagation(), e = !0, t = o.clientX;
806
+ const [h, c] = this.getCurrentRange();
807
+ n = h, s = c, window.addEventListener("mousemove", r), window.addEventListener("mouseup", l);
808
+ });
809
+ }
810
+ applyStep(e) {
811
+ const t = Math.round(e / this.step) * this.step, n = (this.step.toString().split(".")[1] || "").length;
812
+ return parseFloat(t.toFixed(n));
813
+ }
814
+ getCurrentRange() {
815
+ const e = this.getValue();
816
+ return Array.isArray(e) ? [e[0] ?? this.min, e[1] ?? this.max] : typeof e == "object" && e !== null ? [e.min ?? this.min, e.max ?? this.max] : [this.min, this.max];
817
+ }
818
+ setRangeValue(e, t) {
819
+ const n = Math.max(this.min, Math.min(e, this.max)), s = Math.max(this.min, Math.min(t, this.max)), r = this.getValue();
820
+ Array.isArray(r) ? this.setValue([n, s]) : this.setValue({
821
+ ...typeof r == "object" && r !== null ? r : {},
822
+ min: n,
823
+ max: s
824
+ });
825
+ }
826
+ setMin(e) {
827
+ return this.min = e, this.update(), this;
828
+ }
829
+ setMax(e) {
830
+ return this.max = e, this.update(), this;
831
+ }
832
+ setStep(e) {
833
+ return this.step = e, this.inputMin.step = e.toString(), this.inputMax.step = e.toString(), this;
834
+ }
835
+ setFormat(e) {
836
+ return this.formatter = e, this.update(), this;
837
+ }
838
+ setSoundEngine(e) {
839
+ return this.soundEngine = e, this;
840
+ }
841
+ update() {
842
+ if (!this.trackEl || !this.thumbMin || !this.thumbMax) return this;
843
+ const [e, t] = this.getCurrentRange(), n = this.max - this.min || 1, s = Math.max(0, Math.min(100, (e - this.min) / n * 100)), r = Math.max(0, Math.min(100, (t - this.min) / n * 100));
844
+ return this.thumbMin.style.left = `${s}%`, this.thumbMax.style.left = `${r}%`, this.barEl.style.left = `${s}%`, this.barEl.style.width = `${Math.max(0, r - s)}%`, this.barEl.title = this.formatter(e, t), this.inputMin.value = String(e), this.inputMax.value = String(t), this;
845
+ }
846
+ }
847
+ class j extends C {
848
+ constructor(e, t, n, s = [], r, l, o) {
849
+ super(e, t, n, r, l);
850
+ a(this, "containerEl");
851
+ a(this, "gliderEl");
852
+ a(this, "buttons", /* @__PURE__ */ new Map());
853
+ a(this, "optionsMap", /* @__PURE__ */ new Map());
854
+ a(this, "soundEngine");
855
+ this.soundEngine = o, this.containerEl = document.createElement("div"), this.containerEl.className = "relly-segmented-container", this.gliderEl = document.createElement("div"), this.gliderEl.className = "relly-segmented-glider", this.containerEl.appendChild(this.gliderEl), this.controlEl.appendChild(this.containerEl), this.setOptions(s);
856
+ }
857
+ setOptions(e) {
858
+ if (this.optionsMap.clear(), this.buttons.clear(), this.containerEl.innerHTML = "", this.containerEl.appendChild(this.gliderEl), Array.isArray(e))
859
+ for (const t of e) {
860
+ const n = String(t);
861
+ this.optionsMap.set(n, t), this.createButton(n, n, t);
862
+ }
863
+ else if (typeof e == "object" && e !== null)
864
+ for (const [t, n] of Object.entries(e))
865
+ this.optionsMap.set(t, n), this.createButton(t, t, n);
866
+ return this.update(), this;
867
+ }
868
+ createButton(e, t, n) {
869
+ const s = document.createElement("button");
870
+ s.type = "button", s.className = "relly-segmented-btn", s.textContent = t, s.addEventListener("click", () => {
871
+ var r;
872
+ (r = this.soundEngine) == null || r.playClick(), this.setValue(n);
873
+ }), this.containerEl.appendChild(s), this.buttons.set(e, s);
874
+ }
875
+ setSoundEngine(e) {
876
+ return this.soundEngine = e, this;
877
+ }
878
+ update() {
879
+ if (!this.containerEl || this.buttons.size === 0) return this;
880
+ const e = this.getValue();
881
+ let t = null;
882
+ for (const [n, s] of this.optionsMap.entries()) {
883
+ const r = this.buttons.get(n);
884
+ r && (s === e || String(s) === String(e) ? (r.classList.add("relly-segmented-btn--active"), t = r) : r.classList.remove("relly-segmented-btn--active"));
885
+ }
886
+ if (t) {
887
+ const n = t.offsetLeft, s = t.offsetWidth;
888
+ this.gliderEl.style.transform = `translateX(${n}px)`, this.gliderEl.style.width = `${s}px`, this.gliderEl.style.opacity = "1";
889
+ } else
890
+ this.gliderEl.style.opacity = "0";
891
+ return this;
892
+ }
893
+ }
894
+ class F extends C {
895
+ constructor(e, t, n, s) {
896
+ super(e, t, n, s);
897
+ a(this, "wrapperEl");
898
+ a(this, "ledEl");
899
+ a(this, "badgeEl");
900
+ a(this, "detailEl");
901
+ a(this, "currentStatus", "online");
902
+ a(this, "customBadge");
903
+ a(this, "customDetail");
904
+ this.wrapperEl = document.createElement("div"), this.wrapperEl.className = "relly-status-wrapper", this.ledEl = document.createElement("div"), this.ledEl.className = "relly-status-led relly-status-led--online", this.ledEl.innerHTML = `
905
+ <span class="relly-status-pulse-ring"></span>
906
+ <span class="relly-status-led-core"></span>
907
+ `, this.badgeEl = document.createElement("span"), this.badgeEl.className = "relly-status-badge relly-status-badge--online", this.badgeEl.textContent = "ONLINE", this.detailEl = document.createElement("span"), this.detailEl.className = "relly-status-detail", this.wrapperEl.appendChild(this.ledEl), this.wrapperEl.appendChild(this.badgeEl), this.wrapperEl.appendChild(this.detailEl), this.controlEl.appendChild(this.wrapperEl), this.update();
908
+ }
909
+ setStatus(e, t, n) {
910
+ return this.currentStatus = e, t !== void 0 && (this.customBadge = t), n !== void 0 && (this.customDetail = n), this.targetObject && this.property && (this.targetObject[this.property] = e), this.update(), this;
911
+ }
912
+ setBadge(e) {
913
+ return this.customBadge = e, this.update(), this;
914
+ }
915
+ setDetail(e) {
916
+ return this.customDetail = e, this.update(), this;
917
+ }
918
+ update() {
919
+ if (!this.wrapperEl || !this.ledEl) return this;
920
+ const e = this.getValue();
921
+ let t = this.currentStatus;
922
+ if (typeof e == "string" && e) {
923
+ const n = e.toLowerCase();
924
+ ["online", "busy", "offline", "info", "ready"].includes(n) && (t = n);
925
+ }
926
+ return this.ledEl.className = `relly-status-led relly-status-led--${t}`, this.badgeEl.className = `relly-status-badge relly-status-badge--${t}`, this.badgeEl.textContent = this.customBadge || t.toUpperCase(), this.customDetail ? (this.detailEl.textContent = this.customDetail, this.detailEl.style.display = "inline-block") : this.detailEl.style.display = "none", this;
927
+ }
928
+ }
929
+ class T {
930
+ constructor(i, e, t, n) {
931
+ a(this, "children", []);
932
+ a(this, "accordion", !1);
933
+ this.contentEl = i, this.bindingEngine = e, this.presetManager = t, this.soundEngine = n;
934
+ }
935
+ setAccordion(i) {
936
+ return this.accordion = i, this;
937
+ }
938
+ isAccordion() {
939
+ return this.accordion;
940
+ }
941
+ onSectionExpanded(i) {
942
+ if (this.accordion)
943
+ for (const e of this.children)
944
+ e instanceof q && e !== i && e.setCollapsed(!0);
945
+ }
946
+ addCheckbox(i, e) {
947
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
948
+ const s = i, r = s.label || s.property.charAt(0).toUpperCase() + s.property.slice(1), l = new L(
949
+ r,
950
+ s.object,
951
+ s.property,
952
+ this.bindingEngine,
953
+ this.presetManager,
954
+ this.soundEngine
955
+ );
956
+ return s.tooltip && l.setTooltip(s.tooltip), (s.onChange || s.onToggle) && l.onChange(s.onChange || s.onToggle), s.listen && l.listen(), s.showIf && l.showIf(s.showIf), this.contentEl.appendChild(l.element), this.children.push(l), l;
957
+ }
958
+ const t = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", n = new L(
959
+ t,
960
+ i,
961
+ e,
962
+ this.bindingEngine,
963
+ this.presetManager,
964
+ this.soundEngine
965
+ );
966
+ return this.contentEl.appendChild(n.element), this.children.push(n), n;
967
+ }
968
+ createCheckbox(i, e) {
969
+ return this.addCheckbox(i, e);
970
+ }
971
+ addSlider(i, e) {
972
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
973
+ const s = i, r = s.label || s.property.charAt(0).toUpperCase() + s.property.slice(1), l = new V(
974
+ r,
975
+ s.object,
976
+ s.property,
977
+ this.bindingEngine,
978
+ this.presetManager,
979
+ this.soundEngine
980
+ );
981
+ return s.min !== void 0 && l.setMin(s.min), s.max !== void 0 && l.setMax(s.max), s.step !== void 0 && l.setStep(s.step), s.tooltip && l.setTooltip(s.tooltip), s.onChange && l.onChange(s.onChange), s.listen && l.listen(), s.showIf && l.showIf(s.showIf), this.contentEl.appendChild(l.element), this.children.push(l), l;
982
+ }
983
+ const t = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", n = new V(
984
+ t,
985
+ i,
986
+ e,
987
+ this.bindingEngine,
988
+ this.presetManager,
989
+ this.soundEngine
990
+ );
991
+ return this.contentEl.appendChild(n.element), this.children.push(n), n;
992
+ }
993
+ createSlider(i, e) {
994
+ return this.addSlider(i, e);
995
+ }
996
+ addButton(i, e) {
997
+ if (typeof i == "object" && i !== null) {
998
+ const n = i, s = n.label || "Button", r = new A(s, n.onClick || e, this.soundEngine);
999
+ return n.tooltip && r.setTooltip(n.tooltip), n.showIf && r.showIf(n.showIf), this.contentEl.appendChild(r.element), this.children.push(r), r;
1000
+ }
1001
+ const t = new A(i, e, this.soundEngine);
1002
+ return this.contentEl.appendChild(t.element), this.children.push(t), t;
1003
+ }
1004
+ createButton(i, e) {
1005
+ return this.addButton(i, e);
1006
+ }
1007
+ addSelect(i, e, t) {
1008
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1009
+ const r = i, l = r.label || r.property.charAt(0).toUpperCase() + r.property.slice(1), o = new z(l, r.object, r.property, r.options, this.bindingEngine, this.presetManager);
1010
+ return r.tooltip && o.setTooltip(r.tooltip), r.onChange && o.onChange(r.onChange), r.listen && o.listen(), r.showIf && o.showIf(r.showIf), this.contentEl.appendChild(o.element), this.children.push(o), o;
1011
+ }
1012
+ const n = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", s = new z(
1013
+ n,
1014
+ i,
1015
+ e,
1016
+ t,
1017
+ this.bindingEngine,
1018
+ this.presetManager
1019
+ );
1020
+ return this.contentEl.appendChild(s.element), this.children.push(s), s;
1021
+ }
1022
+ createSelect(i, e, t) {
1023
+ return this.addSelect(i, e, t);
1024
+ }
1025
+ addDynamicLabel(i, e) {
1026
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1027
+ const s = i, r = s.label || s.property.charAt(0).toUpperCase() + s.property.slice(1), l = new B(r, s.object, s.property, this.bindingEngine);
1028
+ return s.format && l.setFormat(s.format), s.tooltip && l.setTooltip(s.tooltip), s.showIf && l.showIf(s.showIf), this.contentEl.appendChild(l.element), this.children.push(l), l;
1029
+ }
1030
+ const t = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", n = new B(t, i, e, this.bindingEngine);
1031
+ return this.contentEl.appendChild(n.element), this.children.push(n), n;
1032
+ }
1033
+ createDynamicLabel(i, e) {
1034
+ return this.addDynamicLabel(i, e);
1035
+ }
1036
+ addGraph(i, e) {
1037
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1038
+ const s = i, r = s.label || s.property.charAt(0).toUpperCase() + s.property.slice(1), l = new N(r, s.object, s.property, this.bindingEngine, this.soundEngine);
1039
+ return s.range && l.setRange(s.range[0], s.range[1]), s.color && l.setColor(s.color, s.fillColor), s.bufferSize && l.setBufferSize(s.bufferSize), s.smooth !== void 0 && l.setSmooth(s.smooth), s.height && l.setHeight(s.height), s.format && l.setFormat(s.format), s.tooltip && l.setTooltip(s.tooltip), s.showIf && l.showIf(s.showIf), this.contentEl.appendChild(l.element), this.children.push(l), l;
1040
+ }
1041
+ const t = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", n = new N(t, i, e, this.bindingEngine, this.soundEngine);
1042
+ return this.contentEl.appendChild(n.element), this.children.push(n), n;
1043
+ }
1044
+ createGraph(i, e) {
1045
+ return this.addGraph(i, e);
1046
+ }
1047
+ addFPSGraph(i = "FPS") {
1048
+ const e = { fps: 60 };
1049
+ let t = 0, n = typeof performance < "u" ? performance.now() : Date.now(), s;
1050
+ const r = (h) => {
1051
+ t++, h >= n + 1e3 && (e.fps = Math.round(t * 1e3 / (h - n)), t = 0, n = h), s = requestAnimationFrame(r);
1052
+ };
1053
+ typeof requestAnimationFrame < "u" && (s = requestAnimationFrame(r));
1054
+ const l = this.addGraph(e, "fps").setLabel(i).setRange(0, 120).setColor("#22c55e", "rgba(34, 197, 94, 0.25)").setFormat((h) => `${Math.round(h)} FPS`), o = l.destroy.bind(l);
1055
+ return l.destroy = () => {
1056
+ typeof cancelAnimationFrame < "u" && s && cancelAnimationFrame(s), o();
1057
+ }, l;
1058
+ }
1059
+ createFPSGraph(i = "FPS") {
1060
+ return this.addFPSGraph(i);
1061
+ }
1062
+ addMemoryGraph(i = "Memory") {
1063
+ const e = { mem: 0 };
1064
+ let t;
1065
+ const n = () => {
1066
+ if (typeof performance < "u" && performance.memory) {
1067
+ const l = performance.memory.usedJSHeapSize / 1048576;
1068
+ e.mem = Number(l.toFixed(1));
1069
+ } else
1070
+ e.mem = Number((Math.sin(Date.now() / 2500) * 8 + 48).toFixed(1));
1071
+ };
1072
+ n(), typeof setInterval < "u" && (t = setInterval(n, 1e3));
1073
+ const s = this.addGraph(e, "mem").setLabel(i).setAutoRange(!0).setColor("#a855f7", "rgba(168, 85, 247, 0.25)").setFormat((l) => `${l.toFixed(1)} MB`), r = s.destroy.bind(s);
1074
+ return s.destroy = () => {
1075
+ t && clearInterval(t), r();
1076
+ }, s;
1077
+ }
1078
+ createMemoryGraph(i = "Memory") {
1079
+ return this.addMemoryGraph(i);
1080
+ }
1081
+ addColor(i, e) {
1082
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1083
+ const s = i, r = s.label || s.property.charAt(0).toUpperCase() + s.property.slice(1), l = new R(
1084
+ r,
1085
+ s.object,
1086
+ s.property,
1087
+ this.bindingEngine,
1088
+ this.presetManager,
1089
+ this.soundEngine
1090
+ );
1091
+ return s.tooltip && l.setTooltip(s.tooltip), s.swatches && l.setSwatches(s.swatches), s.onChange && l.onChange(s.onChange), s.listen && l.listen(), s.showIf && l.showIf(s.showIf), this.contentEl.appendChild(l.element), this.children.push(l), l;
1092
+ }
1093
+ const t = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", n = new R(
1094
+ t,
1095
+ i,
1096
+ e,
1097
+ this.bindingEngine,
1098
+ this.presetManager,
1099
+ this.soundEngine
1100
+ );
1101
+ return this.contentEl.appendChild(n.element), this.children.push(n), n;
1102
+ }
1103
+ createColor(i, e) {
1104
+ return this.addColor(i, e);
1105
+ }
1106
+ addPoint2D(i, e, t) {
1107
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1108
+ const r = i, l = r.label || r.property.charAt(0).toUpperCase() + r.property.slice(1), o = new P(l, r.object, r.property, this.bindingEngine, this.presetManager);
1109
+ return r.min !== void 0 && o.setMin(r.min), r.max !== void 0 && o.setMax(r.max), r.step !== void 0 && o.setStep(r.step), r.tooltip && o.setTooltip(r.tooltip), r.onChange && o.onChange(r.onChange), r.listen && o.listen(), r.showIf && o.showIf(r.showIf), this.contentEl.appendChild(o.element), this.children.push(o), o;
1110
+ }
1111
+ const n = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", s = new P(n, i, e, this.bindingEngine, this.presetManager);
1112
+ return (t == null ? void 0 : t.min) !== void 0 && s.setMin(t.min), (t == null ? void 0 : t.max) !== void 0 && s.setMax(t.max), (t == null ? void 0 : t.step) !== void 0 && s.setStep(t.step), this.contentEl.appendChild(s.element), this.children.push(s), s;
1113
+ }
1114
+ createPoint2D(i, e, t) {
1115
+ return this.addPoint2D(i, e, t);
1116
+ }
1117
+ addPoint3D(i, e, t) {
1118
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1119
+ const r = i, l = r.label || r.property.charAt(0).toUpperCase() + r.property.slice(1), o = new D(l, r.object, r.property, this.bindingEngine, this.presetManager);
1120
+ return r.min !== void 0 && o.setMin(r.min), r.max !== void 0 && o.setMax(r.max), r.step !== void 0 && o.setStep(r.step), r.tooltip && o.setTooltip(r.tooltip), r.contextMenu && o.setContextMenu(r.contextMenu), r.onChange && o.onChange(r.onChange), r.listen && o.listen(), r.showIf && o.showIf(r.showIf), this.contentEl.appendChild(o.element), this.children.push(o), o;
1121
+ }
1122
+ const n = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", s = new D(n, i, e, this.bindingEngine, this.presetManager);
1123
+ return (t == null ? void 0 : t.min) !== void 0 && s.setMin(t.min), (t == null ? void 0 : t.max) !== void 0 && s.setMax(t.max), (t == null ? void 0 : t.step) !== void 0 && s.setStep(t.step), this.contentEl.appendChild(s.element), this.children.push(s), s;
1124
+ }
1125
+ createPoint3D(i, e, t) {
1126
+ return this.addPoint3D(i, e, t);
1127
+ }
1128
+ addVector3(i, e, t) {
1129
+ return this.addPoint3D(i, e, t);
1130
+ }
1131
+ createVector3(i, e, t) {
1132
+ return this.addPoint3D(i, e, t);
1133
+ }
1134
+ addRange(i, e, t) {
1135
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1136
+ const r = i, l = r.label || r.property.charAt(0).toUpperCase() + r.property.slice(1), o = new H(
1137
+ l,
1138
+ r.object,
1139
+ r.property,
1140
+ this.bindingEngine,
1141
+ this.presetManager,
1142
+ this.soundEngine
1143
+ );
1144
+ return r.min !== void 0 && o.setMin(r.min), r.max !== void 0 && o.setMax(r.max), r.step !== void 0 && o.setStep(r.step), r.tooltip && o.setTooltip(r.tooltip), r.contextMenu && o.setContextMenu(r.contextMenu), r.onChange && o.onChange(r.onChange), r.listen && o.listen(), r.showIf && o.showIf(r.showIf), this.contentEl.appendChild(o.element), this.children.push(o), o;
1145
+ }
1146
+ const n = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", s = new H(
1147
+ n,
1148
+ i,
1149
+ e,
1150
+ this.bindingEngine,
1151
+ this.presetManager,
1152
+ this.soundEngine
1153
+ );
1154
+ return (t == null ? void 0 : t.min) !== void 0 && s.setMin(t.min), (t == null ? void 0 : t.max) !== void 0 && s.setMax(t.max), (t == null ? void 0 : t.step) !== void 0 && s.setStep(t.step), this.contentEl.appendChild(s.element), this.children.push(s), s;
1155
+ }
1156
+ createRange(i, e, t) {
1157
+ return this.addRange(i, e, t);
1158
+ }
1159
+ addSegmented(i, e, t) {
1160
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1161
+ const r = i, l = r.label || r.property.charAt(0).toUpperCase() + r.property.slice(1), o = new j(
1162
+ l,
1163
+ r.object,
1164
+ r.property,
1165
+ r.options || [],
1166
+ this.bindingEngine,
1167
+ this.presetManager,
1168
+ this.soundEngine
1169
+ );
1170
+ return r.tooltip && o.setTooltip(r.tooltip), r.contextMenu && o.setContextMenu(r.contextMenu), r.onChange && o.onChange(r.onChange), r.listen && o.listen(), r.showIf && o.showIf(r.showIf), this.contentEl.appendChild(o.element), this.children.push(o), o;
1171
+ }
1172
+ const n = e ? e.charAt(0).toUpperCase() + e.slice(1) : "", s = new j(
1173
+ n,
1174
+ i,
1175
+ e,
1176
+ t || [],
1177
+ this.bindingEngine,
1178
+ this.presetManager,
1179
+ this.soundEngine
1180
+ );
1181
+ return this.contentEl.appendChild(s.element), this.children.push(s), s;
1182
+ }
1183
+ createSegmented(i, e, t) {
1184
+ return this.addSegmented(i, e, t);
1185
+ }
1186
+ addStatus(i, e, t = "online", n, s) {
1187
+ if (typeof i == "object" && i !== null && e === void 0 && "object" in i && "property" in i) {
1188
+ const c = i, u = c.label || c.property.charAt(0).toUpperCase() + c.property.slice(1), p = new F(
1189
+ u,
1190
+ c.object,
1191
+ c.property,
1192
+ this.bindingEngine
1193
+ );
1194
+ return c.status && p.setStatus(c.status, c.badge, c.detail), c.badge && p.setBadge(c.badge), c.detail && p.setDetail(c.detail), c.tooltip && p.setTooltip(c.tooltip), c.contextMenu && p.setContextMenu(c.contextMenu), c.listen && p.listen(), c.showIf && p.showIf(c.showIf), this.contentEl.appendChild(p.element), this.children.push(p), p;
1195
+ }
1196
+ const r = e ? e.charAt(0).toUpperCase() + e.slice(1) : typeof i == "string" ? i : "Status", l = typeof i == "string" ? void 0 : i, o = typeof i == "string" ? void 0 : e, h = new F(
1197
+ r,
1198
+ l,
1199
+ o,
1200
+ this.bindingEngine
1201
+ );
1202
+ return h.setStatus(t, n, s), this.contentEl.appendChild(h.element), this.children.push(h), h;
1203
+ }
1204
+ createStatus(i, e, t = "online", n, s) {
1205
+ return this.addStatus(i, e, t, n, s);
1206
+ }
1207
+ addRow() {
1208
+ const i = new K(this.bindingEngine, this.presetManager, this.soundEngine);
1209
+ return this.contentEl.appendChild(i.element), this.children.push(i), i;
1210
+ }
1211
+ createRow() {
1212
+ return this.addRow();
1213
+ }
1214
+ addSection(i = "Section", e = !1) {
1215
+ let t = "", n = e;
1216
+ typeof i == "object" && i !== null ? (t = i.label || i.title || "Section", i.collapsed !== void 0 && (n = i.collapsed)) : t = i || "Section";
1217
+ const s = new q(t, this.bindingEngine, this.presetManager, n, this.soundEngine);
1218
+ return s.setParentContainer(this), this.contentEl.appendChild(s.element), this.children.push(s), s;
1219
+ }
1220
+ addFolder(i = "Folder", e = !1) {
1221
+ return this.addSection(i, e);
1222
+ }
1223
+ createSection(i = "Section", e = !1) {
1224
+ return this.addSection(i, e);
1225
+ }
1226
+ createFolder(i = "Folder", e = !1) {
1227
+ return this.addSection(i, e);
1228
+ }
1229
+ createComponent(i) {
1230
+ let e;
1231
+ const t = i.label || (i.property ? i.property : i.type);
1232
+ switch (i.type) {
1233
+ case "checkbox":
1234
+ e = this.addCheckbox(i.object, i.property);
1235
+ break;
1236
+ case "slider": {
1237
+ const n = this.addSlider(i.object, i.property);
1238
+ i.min !== void 0 && n.setMin(i.min), i.max !== void 0 && n.setMax(i.max), i.step !== void 0 && n.setStep(i.step), e = n;
1239
+ break;
1240
+ }
1241
+ case "button":
1242
+ e = this.addButton(t, i.onClick);
1243
+ break;
1244
+ case "select":
1245
+ e = this.addSelect(i.object, i.property, i.options);
1246
+ break;
1247
+ case "dynamicLabel": {
1248
+ const n = this.addDynamicLabel(i.object, i.property);
1249
+ i.format && n.setFormat(i.format), e = n;
1250
+ break;
1251
+ }
1252
+ case "graph": {
1253
+ const n = this.addGraph(i.object, i.property);
1254
+ i.range && n.setRange(i.range[0], i.range[1]), i.color && n.setColor(i.color, i.fillColor), i.bufferSize && n.setBufferSize(i.bufferSize), e = n;
1255
+ break;
1256
+ }
1257
+ case "color": {
1258
+ const n = this.addColor(i.object, i.property);
1259
+ i.swatches && n.setSwatches(i.swatches), e = n;
1260
+ break;
1261
+ }
1262
+ case "point2d": {
1263
+ const n = this.addPoint2D(i.object, i.property);
1264
+ i.min !== void 0 && n.setMin(i.min), i.max !== void 0 && n.setMax(i.max), i.step !== void 0 && n.setStep(i.step), e = n;
1265
+ break;
1266
+ }
1267
+ case "point3d":
1268
+ case "vector3": {
1269
+ const n = this.addPoint3D(i.object, i.property);
1270
+ i.min !== void 0 && n.setMin(i.min), i.max !== void 0 && n.setMax(i.max), i.step !== void 0 && n.setStep(i.step), e = n;
1271
+ break;
1272
+ }
1273
+ case "range": {
1274
+ const n = this.addRange(i.object, i.property);
1275
+ i.min !== void 0 && n.setMin(i.min), i.max !== void 0 && n.setMax(i.max), i.step !== void 0 && n.setStep(i.step), e = n;
1276
+ break;
1277
+ }
1278
+ case "segmented": {
1279
+ e = this.addSegmented(i.object, i.property, i.options);
1280
+ break;
1281
+ }
1282
+ case "status": {
1283
+ e = this.addStatus(i.object, i.property, i.status, i.badge, i.detail);
1284
+ break;
1285
+ }
1286
+ case "section":
1287
+ case "folder": {
1288
+ e = this.addSection(t, i.collapsed || !1);
1289
+ break;
1290
+ }
1291
+ default:
1292
+ throw new Error(`[RellyUI] Unknown component type: ${i.type}`);
1293
+ }
1294
+ return t && e.setLabel && e.setLabel(t), i.tooltip && e.setTooltip && e.setTooltip(i.tooltip), i.contextMenu && e.setContextMenu && e.setContextMenu(i.contextMenu), (i.onChange || i.onToggle) && e.onChange && e.onChange(i.onChange || i.onToggle), i.listen && e.listen && e.listen(), i.showIf && e.showIf && e.showIf(i.showIf), i.disabled && e.setDisabled && e.setDisabled(!0), e;
1295
+ }
1296
+ destroyChildren() {
1297
+ for (const i of this.children)
1298
+ i.destroy();
1299
+ this.children = [];
1300
+ }
1301
+ }
1302
+ class K extends T {
1303
+ constructor(e, t, n) {
1304
+ const s = document.createElement("div");
1305
+ s.className = "relly-multi-row";
1306
+ super(s, e, t, n);
1307
+ a(this, "element");
1308
+ a(this, "disabled", !1);
1309
+ this.element = s;
1310
+ }
1311
+ setDisabled(e) {
1312
+ return this.disabled = e, this.disabled ? this.element.classList.add("relly-disabled") : this.element.classList.remove("relly-disabled"), this;
1313
+ }
1314
+ isDisabled() {
1315
+ return this.disabled;
1316
+ }
1317
+ destroy() {
1318
+ this.destroyChildren(), this.element.remove();
1319
+ }
1320
+ }
1321
+ class q extends T {
1322
+ constructor(e, t, n, s = !1, r) {
1323
+ const l = document.createElement("div");
1324
+ l.className = "relly-section-content";
1325
+ super(l, t, n, r);
1326
+ a(this, "element");
1327
+ a(this, "headerEl");
1328
+ a(this, "titleEl");
1329
+ a(this, "arrowEl");
1330
+ a(this, "isCollapsed", !1);
1331
+ a(this, "conditionPredicate");
1332
+ a(this, "parentContainer");
1333
+ a(this, "disabled", !1);
1334
+ this.label = e, this.element = document.createElement("div"), this.element.className = "relly-section", this.headerEl = document.createElement("div"), this.headerEl.className = "relly-section-header";
1335
+ const o = document.createElement("div");
1336
+ o.className = "relly-section-title-wrap", this.arrowEl = document.createElement("span"), this.arrowEl.innerHTML = `
1337
+ <svg class="relly-section-arrow" viewBox="0 0 10 10">
1338
+ <polygon points="2,1 8,5 2,9"></polygon>
1339
+ </svg>
1340
+ `, this.titleEl = document.createElement("span"), this.titleEl.textContent = e, o.appendChild(this.arrowEl), o.appendChild(this.titleEl), this.headerEl.appendChild(o), this.element.appendChild(this.headerEl), this.element.appendChild(this.contentEl), this.headerEl.addEventListener("click", () => {
1341
+ var h;
1342
+ this.disabled || ((h = this.soundEngine) == null || h.playClick(), this.toggle());
1343
+ }), s && this.setCollapsed(!0);
1344
+ }
1345
+ setParentContainer(e) {
1346
+ return this.parentContainer = e, this;
1347
+ }
1348
+ setDisabled(e) {
1349
+ return this.disabled = e, this.disabled ? this.element.classList.add("relly-disabled") : this.element.classList.remove("relly-disabled"), this;
1350
+ }
1351
+ isDisabled() {
1352
+ return this.disabled;
1353
+ }
1354
+ setLabel(e) {
1355
+ return this.label = e, this.titleEl.textContent = e, this;
1356
+ }
1357
+ getLabel() {
1358
+ return this.label;
1359
+ }
1360
+ toggle() {
1361
+ return this.setCollapsed(!this.isCollapsed);
1362
+ }
1363
+ setCollapsed(e) {
1364
+ return this.isCollapsed = e, this.isCollapsed ? this.element.classList.add("relly-section--collapsed") : (this.element.classList.remove("relly-section--collapsed"), this.parentContainer && this.parentContainer.onSectionExpanded(this)), this;
1365
+ }
1366
+ showIf(e) {
1367
+ return this.conditionPredicate = e, this.checkVisibility(), this.bindingEngine.register(this), this;
1368
+ }
1369
+ checkVisibility() {
1370
+ if (!this.conditionPredicate) return !0;
1371
+ const e = this.conditionPredicate();
1372
+ return this.element.style.display = e ? "" : "none", e;
1373
+ }
1374
+ checkDirty() {
1375
+ this.checkVisibility();
1376
+ }
1377
+ destroy() {
1378
+ this.conditionPredicate && this.bindingEngine.unregister(this), this.destroyChildren(), this.element.remove();
1379
+ }
1380
+ }
1381
+ class G {
1382
+ constructor() {
1383
+ a(this, "listeners", /* @__PURE__ */ new Set());
1384
+ a(this, "rafId", null);
1385
+ a(this, "isRunning", !1);
1386
+ a(this, "isPaused", !1);
1387
+ }
1388
+ register(i) {
1389
+ this.listeners.add(i), !this.isRunning && !this.isPaused && this.start();
1390
+ }
1391
+ unregister(i) {
1392
+ this.listeners.delete(i), this.listeners.size === 0 && this.stop();
1393
+ }
1394
+ pause() {
1395
+ this.isPaused = !0, this.stop();
1396
+ }
1397
+ resume() {
1398
+ this.isPaused = !1, this.listeners.size > 0 && !this.isRunning && this.start();
1399
+ }
1400
+ start() {
1401
+ if (typeof window > "u") return;
1402
+ this.isRunning = !0;
1403
+ const i = () => {
1404
+ if (this.isRunning) {
1405
+ for (const e of this.listeners)
1406
+ e.checkDirty();
1407
+ this.rafId = requestAnimationFrame(i);
1408
+ }
1409
+ };
1410
+ this.rafId = requestAnimationFrame(i);
1411
+ }
1412
+ stop() {
1413
+ this.isRunning = !1, this.rafId !== null && typeof window < "u" && (cancelAnimationFrame(this.rafId), this.rafId = null);
1414
+ }
1415
+ destroy() {
1416
+ this.stop(), this.listeners.clear();
1417
+ }
1418
+ }
1419
+ class W {
1420
+ constructor() {
1421
+ a(this, "components", /* @__PURE__ */ new Set());
1422
+ a(this, "pendingValues", {});
1423
+ a(this, "changeCallback");
1424
+ }
1425
+ setOnChange(i) {
1426
+ this.changeCallback = i;
1427
+ }
1428
+ notifyChange() {
1429
+ var i;
1430
+ (i = this.changeCallback) == null || i.call(this);
1431
+ }
1432
+ register(i) {
1433
+ this.components.add(i);
1434
+ const e = i.getSerializableKey();
1435
+ e && e in this.pendingValues && i.setValue(this.pendingValues[e]);
1436
+ }
1437
+ setPendingValues(i) {
1438
+ this.pendingValues = { ...this.pendingValues, ...i };
1439
+ for (const e of this.components) {
1440
+ const t = e.getSerializableKey();
1441
+ t && t in this.pendingValues && e.setValue(this.pendingValues[t]);
1442
+ }
1443
+ }
1444
+ getPendingValues() {
1445
+ return { ...this.pendingValues };
1446
+ }
1447
+ unregister(i) {
1448
+ this.components.delete(i);
1449
+ }
1450
+ export() {
1451
+ const i = { ...this.pendingValues };
1452
+ for (const e of this.components) {
1453
+ const t = e.getSerializableKey();
1454
+ t && (i[t] = e.getValue());
1455
+ }
1456
+ return i;
1457
+ }
1458
+ import(i) {
1459
+ !i || typeof i != "object" || this.setPendingValues(i);
1460
+ }
1461
+ save(i = "relly-ui-preset") {
1462
+ if (!(typeof window > "u" || !window.localStorage))
1463
+ try {
1464
+ const e = this.export();
1465
+ window.localStorage.setItem(i, JSON.stringify(e));
1466
+ } catch (e) {
1467
+ console.warn("[RellyUI] Failed to save preset to localStorage", e);
1468
+ }
1469
+ }
1470
+ load(i = "relly-ui-preset") {
1471
+ if (!(typeof window > "u" || !window.localStorage))
1472
+ try {
1473
+ const e = window.localStorage.getItem(i);
1474
+ if (e) {
1475
+ const t = JSON.parse(e);
1476
+ this.import(t);
1477
+ }
1478
+ } catch (e) {
1479
+ console.warn("[RellyUI] Failed to load preset from localStorage", e);
1480
+ }
1481
+ }
1482
+ clear() {
1483
+ this.components.clear(), this.pendingValues = {};
1484
+ }
1485
+ }
1486
+ const U = {
1487
+ bg: "#1c1d22",
1488
+ fg: "#d1d5db",
1489
+ headerBg: "#141518",
1490
+ headerFg: "#f3f4f6",
1491
+ accent: "#6366f1",
1492
+ accentHover: "#4f46e5",
1493
+ border: "rgba(255, 255, 255, 0.08)",
1494
+ inputBg: "#26272e",
1495
+ inputHover: "#2f3039",
1496
+ radius: "6px",
1497
+ font: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
1498
+ fontSize: "11px",
1499
+ rowHeight: "26px"
1500
+ }, X = {
1501
+ bg: "#ffffff",
1502
+ fg: "#374151",
1503
+ headerBg: "#f3f4f6",
1504
+ headerFg: "#111827",
1505
+ accent: "#4f46e5",
1506
+ accentHover: "#4338ca",
1507
+ border: "#e5e7eb",
1508
+ inputBg: "#f9fafb",
1509
+ inputHover: "#f3f4f6",
1510
+ radius: "6px",
1511
+ font: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
1512
+ fontSize: "11px",
1513
+ rowHeight: "26px"
1514
+ }, J = {
1515
+ bg: "#0f051d",
1516
+ fg: "#e0f2fe",
1517
+ headerBg: "#180a33",
1518
+ headerFg: "#00f0ff",
1519
+ accent: "#00f0ff",
1520
+ accentHover: "#ff007f",
1521
+ border: "rgba(0, 240, 255, 0.25)",
1522
+ inputBg: "#1e0d3d",
1523
+ inputHover: "#2d145c",
1524
+ radius: "4px",
1525
+ font: '"JetBrains Mono", Consolas, monospace',
1526
+ fontSize: "11px",
1527
+ rowHeight: "26px"
1528
+ }, Y = {
1529
+ bg: "#2e3440",
1530
+ fg: "#d8dee9",
1531
+ headerBg: "#242933",
1532
+ headerFg: "#eceff4",
1533
+ accent: "#88c0d0",
1534
+ accentHover: "#81a1c1",
1535
+ border: "#3b4252",
1536
+ inputBg: "#3b4252",
1537
+ inputHover: "#434c5e",
1538
+ radius: "6px",
1539
+ font: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1540
+ fontSize: "11px",
1541
+ rowHeight: "26px"
1542
+ }, _ = {
1543
+ bg: "#282a36",
1544
+ fg: "#f8f8f2",
1545
+ headerBg: "#1e1f29",
1546
+ headerFg: "#bd93f9",
1547
+ accent: "#bd93f9",
1548
+ accentHover: "#ff79c6",
1549
+ border: "#44475a",
1550
+ inputBg: "#44475a",
1551
+ inputHover: "#6272a4",
1552
+ radius: "6px",
1553
+ font: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1554
+ fontSize: "11px",
1555
+ rowHeight: "26px"
1556
+ }, Q = {
1557
+ bg: "#1a1b26",
1558
+ fg: "#a9b1d6",
1559
+ headerBg: "#16161e",
1560
+ headerFg: "#7aa2f7",
1561
+ accent: "#7aa2f7",
1562
+ accentHover: "#bb9af7",
1563
+ border: "rgba(122, 162, 247, 0.18)",
1564
+ inputBg: "#24283b",
1565
+ inputHover: "#2f3549",
1566
+ radius: "6px",
1567
+ font: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1568
+ fontSize: "11px",
1569
+ rowHeight: "26px"
1570
+ }, Z = {
1571
+ bg: "#0a0f0d",
1572
+ fg: "#00ff66",
1573
+ headerBg: "#050a08",
1574
+ headerFg: "#00ff66",
1575
+ accent: "#00ff66",
1576
+ accentHover: "#33ff88",
1577
+ border: "rgba(0, 255, 102, 0.25)",
1578
+ inputBg: "#0d1812",
1579
+ inputHover: "#13241b",
1580
+ radius: "3px",
1581
+ font: '"JetBrains Mono", Consolas, monospace',
1582
+ fontSize: "11px",
1583
+ rowHeight: "26px"
1584
+ }, O = {
1585
+ bg: "#241b2f",
1586
+ fg: "#f8f8f2",
1587
+ headerBg: "#191322",
1588
+ headerFg: "#ff71ce",
1589
+ accent: "#ff71ce",
1590
+ accentHover: "#01cdfe",
1591
+ border: "rgba(255, 113, 206, 0.25)",
1592
+ inputBg: "#2f233f",
1593
+ inputHover: "#3c2c51",
1594
+ radius: "6px",
1595
+ font: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1596
+ fontSize: "11px",
1597
+ rowHeight: "26px"
1598
+ };
1599
+ class ee {
1600
+ constructor(i, e) {
1601
+ a(this, "currentTheme");
1602
+ a(this, "currentThemeName");
1603
+ this.panelElement = i, this.currentTheme = { ...U }, this.currentThemeName = "dark", e ? this.applyTheme(e) : this.applyToDOM(this.currentTheme);
1604
+ }
1605
+ applyTheme(i) {
1606
+ typeof i == "string" && (this.currentThemeName = i), i === "light" ? this.currentTheme = { ...X } : i === "dark" ? this.currentTheme = { ...U } : i === "cyberpunk" ? this.currentTheme = { ...J } : i === "nord" ? this.currentTheme = { ...Y } : i === "dracula" ? this.currentTheme = { ..._ } : i === "tokyo-night" ? this.currentTheme = { ...Q } : i === "matrix" ? this.currentTheme = { ...Z } : i === "synthwave" ? this.currentTheme = { ...O } : typeof i == "object" && (this.currentTheme = { ...this.currentTheme, ...i }, this.currentThemeName = "custom"), this.applyToDOM(this.currentTheme);
1607
+ }
1608
+ getCurrentThemeName() {
1609
+ return this.currentThemeName;
1610
+ }
1611
+ applyToDOM(i) {
1612
+ const e = this.panelElement;
1613
+ e.style.setProperty("--relly-bg", i.bg), e.style.setProperty("--relly-fg", i.fg), e.style.setProperty("--relly-header-bg", i.headerBg), e.style.setProperty("--relly-header-fg", i.headerFg), e.style.setProperty("--relly-accent", i.accent), e.style.setProperty("--relly-accent-hover", i.accentHover), e.style.setProperty("--relly-border", i.border), e.style.setProperty("--relly-input-bg", i.inputBg), e.style.setProperty("--relly-input-hover", i.inputHover), e.style.setProperty("--relly-radius", i.radius), e.style.setProperty("--relly-font", i.font), e.style.setProperty("--relly-font-size", i.fontSize), e.style.setProperty("--relly-row-height", i.rowHeight);
1614
+ }
1615
+ getTheme() {
1616
+ return { ...this.currentTheme };
1617
+ }
1618
+ }
1619
+ class te {
1620
+ constructor(i, e, t) {
1621
+ a(this, "isDragging", !1);
1622
+ a(this, "startX", 0);
1623
+ a(this, "startY", 0);
1624
+ a(this, "initialLeft", 0);
1625
+ a(this, "initialTop", 0);
1626
+ a(this, "wasSnapped", !1);
1627
+ a(this, "snapThreshold", 18);
1628
+ a(this, "magneticSnap", !0);
1629
+ a(this, "onMouseDownBound");
1630
+ a(this, "onMouseMoveBound");
1631
+ a(this, "onMouseUpBound");
1632
+ a(this, "onResizeBound");
1633
+ this.handle = i, this.panel = e, this.soundEngine = t, this.onMouseDownBound = this.onMouseDown.bind(this), this.onMouseMoveBound = this.onMouseMove.bind(this), this.onMouseUpBound = this.onMouseUp.bind(this), this.onResizeBound = this.onResize.bind(this), this.handle.addEventListener("mousedown", this.onMouseDownBound), typeof window < "u" && window.addEventListener("resize", this.onResizeBound);
1634
+ }
1635
+ clampToViewport() {
1636
+ if (typeof window > "u") return;
1637
+ const i = this.panel.getBoundingClientRect(), e = i.width, t = i.height, n = Math.max(0, window.innerWidth - e), s = Math.max(0, window.innerHeight - t);
1638
+ let r = i.left, l = i.top;
1639
+ r > n && (r = n), r < 0 && (r = 0), l > s && (l = s), l < 0 && (l = 0), this.panel.style.left = `${Math.round(r)}px`, this.panel.style.top = `${Math.round(l)}px`, this.panel.style.right = "auto", this.panel.style.bottom = "auto";
1640
+ }
1641
+ onResize() {
1642
+ this.clampToViewport();
1643
+ }
1644
+ onMouseDown(i) {
1645
+ if (i.button !== 0 || i.target.closest(".relly-header-btn")) return;
1646
+ this.isDragging = !0, this.startX = i.clientX, this.startY = i.clientY;
1647
+ const e = this.panel.getBoundingClientRect();
1648
+ this.initialLeft = e.left, this.initialTop = e.top, this.panel.style.right = "auto", this.panel.style.bottom = "auto", this.panel.style.left = `${this.initialLeft}px`, this.panel.style.top = `${this.initialTop}px`, window.addEventListener("mousemove", this.onMouseMoveBound), window.addEventListener("mouseup", this.onMouseUpBound), i.preventDefault();
1649
+ }
1650
+ onMouseMove(i) {
1651
+ var p;
1652
+ if (!this.isDragging) return;
1653
+ const e = i.clientX - this.startX, t = i.clientY - this.startY;
1654
+ let n = this.initialLeft + e, s = this.initialTop + t;
1655
+ const r = this.panel.getBoundingClientRect(), l = r.width, o = r.height, h = Math.max(0, window.innerWidth - l), c = Math.max(0, window.innerHeight - o);
1656
+ let u = !1;
1657
+ this.magneticSnap && (Math.abs(n) < this.snapThreshold ? (n = 0, u = !0) : Math.abs(n - h) < this.snapThreshold && (n = h, u = !0), Math.abs(s) < this.snapThreshold ? (s = 0, u = !0) : Math.abs(s - c) < this.snapThreshold && (s = c, u = !0), u && !this.wasSnapped && ((p = this.soundEngine) == null || p.playSnap()), this.wasSnapped = u), n = Math.max(0, Math.min(n, h)), s = Math.max(0, Math.min(s, c)), this.panel.style.left = `${n}px`, this.panel.style.top = `${s}px`;
1658
+ }
1659
+ onMouseUp() {
1660
+ this.isDragging = !1, this.wasSnapped = !1, window.removeEventListener("mousemove", this.onMouseMoveBound), window.removeEventListener("mouseup", this.onMouseUpBound);
1661
+ }
1662
+ destroy() {
1663
+ this.handle.removeEventListener("mousedown", this.onMouseDownBound), typeof window < "u" && (window.removeEventListener("mousemove", this.onMouseMoveBound), window.removeEventListener("mouseup", this.onMouseUpBound), window.removeEventListener("resize", this.onResizeBound));
1664
+ }
1665
+ }
1666
+ class ie {
1667
+ constructor(i, e = 240, t = 120) {
1668
+ a(this, "handleEl");
1669
+ a(this, "isResizing", !1);
1670
+ a(this, "startX", 0);
1671
+ a(this, "startY", 0);
1672
+ a(this, "initialWidth", 0);
1673
+ a(this, "initialHeight", 0);
1674
+ a(this, "onMouseDownBound");
1675
+ a(this, "onMouseMoveBound");
1676
+ a(this, "onMouseUpBound");
1677
+ a(this, "onResizeBound");
1678
+ this.panel = i, this.minWidth = e, this.minHeight = t, this.handleEl = document.createElement("div"), this.handleEl.className = "relly-resize-handle", this.handleEl.title = "Drag to resize panel", this.handleEl.innerHTML = `
1679
+ <svg viewBox="0 0 10 10">
1680
+ <line x1="8" y1="2" x2="2" y2="8"></line>
1681
+ <line x1="8" y1="5" x2="5" y2="8"></line>
1682
+ <line x1="8" y1="8" x2="8" y2="8"></line>
1683
+ </svg>
1684
+ `, this.panel.appendChild(this.handleEl), this.onMouseDownBound = this.onMouseDown.bind(this), this.onMouseMoveBound = this.onMouseMove.bind(this), this.onMouseUpBound = this.onMouseUp.bind(this), this.onResizeBound = this.onWindowResize.bind(this), this.handleEl.addEventListener("mousedown", this.onMouseDownBound), typeof window < "u" && window.addEventListener("resize", this.onResizeBound);
1685
+ }
1686
+ clampToViewport() {
1687
+ if (typeof window > "u") return;
1688
+ const i = this.panel.getBoundingClientRect(), e = Math.max(this.minWidth, window.innerWidth - 16), t = Math.max(this.minHeight, window.innerHeight - 16);
1689
+ let n = i.width, s = i.height;
1690
+ n > e && (n = e, this.panel.style.width = `${Math.round(n)}px`), s > t && (s = t, this.panel.style.height = `${Math.round(s)}px`);
1691
+ }
1692
+ onWindowResize() {
1693
+ this.clampToViewport();
1694
+ }
1695
+ onMouseDown(i) {
1696
+ if (i.button !== 0) return;
1697
+ this.isResizing = !0, this.startX = i.clientX, this.startY = i.clientY;
1698
+ const e = this.panel.getBoundingClientRect();
1699
+ this.initialWidth = e.width, this.initialHeight = e.height, window.addEventListener("mousemove", this.onMouseMoveBound), window.addEventListener("mouseup", this.onMouseUpBound), i.preventDefault(), i.stopPropagation();
1700
+ }
1701
+ onMouseMove(i) {
1702
+ if (!this.isResizing) return;
1703
+ const e = i.clientX - this.startX, t = i.clientY - this.startY, n = this.panel.getBoundingClientRect(), s = Math.max(this.minWidth, window.innerWidth - n.left - 8), r = Math.max(this.minHeight, window.innerHeight - n.top - 8), l = Math.max(this.minWidth, Math.min(s, this.initialWidth + e)), o = Math.max(
1704
+ this.minHeight,
1705
+ Math.min(r, this.initialHeight + t)
1706
+ );
1707
+ this.panel.style.width = `${Math.round(l)}px`, this.panel.style.height = `${Math.round(o)}px`;
1708
+ const h = this.panel.querySelector(".relly-body");
1709
+ h && (h.style.maxHeight = "none", h.style.flex = "1");
1710
+ }
1711
+ onMouseUp() {
1712
+ this.isResizing = !1, window.removeEventListener("mousemove", this.onMouseMoveBound), window.removeEventListener("mouseup", this.onMouseUpBound);
1713
+ }
1714
+ destroy() {
1715
+ this.handleEl.removeEventListener("mousedown", this.onMouseDownBound), typeof window < "u" && (window.removeEventListener("mousemove", this.onMouseMoveBound), window.removeEventListener("mouseup", this.onMouseUpBound), window.removeEventListener("resize", this.onResizeBound)), this.handleEl.remove();
1716
+ }
1717
+ }
1718
+ class ne {
1719
+ constructor(i, e) {
1720
+ a(this, "onKeyDownBound");
1721
+ this.hotkey = i, this.onToggle = e, this.onKeyDownBound = this.onKeyDown.bind(this), this.hotkey && typeof window < "u" && window.addEventListener("keydown", this.onKeyDownBound);
1722
+ }
1723
+ onKeyDown(i) {
1724
+ var n;
1725
+ if (!this.hotkey) return;
1726
+ const e = typeof i.composedPath == "function" ? i.composedPath() : [];
1727
+ for (const s of e)
1728
+ if (s instanceof HTMLElement) {
1729
+ const r = s.tagName;
1730
+ if (r === "INPUT" || r === "TEXTAREA" || r === "SELECT" || s.isContentEditable || s.classList.contains("relly-search-input"))
1731
+ return;
1732
+ }
1733
+ let t = document.activeElement;
1734
+ for (; t && t.shadowRoot && t.shadowRoot.activeElement; )
1735
+ t = t.shadowRoot.activeElement;
1736
+ t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable || (n = t == null ? void 0 : t.classList) != null && n.contains("relly-search-input")) || (i.code === this.hotkey || i.key.toLowerCase() === this.hotkey.toLowerCase()) && (i.preventDefault(), this.onToggle());
1737
+ }
1738
+ setHotkey(i) {
1739
+ this.hotkey = i;
1740
+ }
1741
+ destroy() {
1742
+ typeof window < "u" && window.removeEventListener("keydown", this.onKeyDownBound);
1743
+ }
1744
+ }
1745
+ class se {
1746
+ constructor(i, e = {}) {
1747
+ a(this, "element");
1748
+ a(this, "inputEl");
1749
+ a(this, "clearBtn");
1750
+ a(this, "ignoreCase");
1751
+ a(this, "onGlobalKeyDownBound");
1752
+ this.bodyEl = i, this.ignoreCase = e.ignoreCase !== !1, this.element = document.createElement("div"), this.element.className = "relly-search-bar", this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "relly-search-input", this.inputEl.placeholder = e.placeholder || 'Filter settings... (Press "/" to focus)', this.clearBtn = document.createElement("button"), this.clearBtn.className = "relly-search-clear", this.clearBtn.textContent = "✕", this.clearBtn.title = "Clear search", this.clearBtn.style.display = "none", this.element.appendChild(this.inputEl), this.element.appendChild(this.clearBtn), this.inputEl.addEventListener("input", () => {
1753
+ this.filter(this.inputEl.value);
1754
+ }), this.inputEl.addEventListener("keydown", (t) => {
1755
+ t.stopPropagation(), t.key === "Escape" && (this.clear(), this.inputEl.blur());
1756
+ }), this.inputEl.addEventListener("keyup", (t) => {
1757
+ t.stopPropagation();
1758
+ }), this.inputEl.addEventListener("keypress", (t) => {
1759
+ t.stopPropagation();
1760
+ }), this.clearBtn.addEventListener("click", () => {
1761
+ this.clear(), this.inputEl.focus();
1762
+ }), this.onGlobalKeyDownBound = this.onGlobalKeyDown.bind(this), typeof window < "u" && window.addEventListener("keydown", this.onGlobalKeyDownBound);
1763
+ }
1764
+ onGlobalKeyDown(i) {
1765
+ var e;
1766
+ if (i.key === "/") {
1767
+ const t = typeof i.composedPath == "function" ? i.composedPath() : [];
1768
+ for (const r of t)
1769
+ if (r instanceof HTMLElement) {
1770
+ const l = r.tagName;
1771
+ if (l === "INPUT" || l === "TEXTAREA" || l === "SELECT" || r.isContentEditable || r.classList.contains("relly-search-input"))
1772
+ return;
1773
+ }
1774
+ let n = document.activeElement;
1775
+ for (; n && n.shadowRoot && n.shadowRoot.activeElement; )
1776
+ n = n.shadowRoot.activeElement;
1777
+ n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement || (n == null ? void 0 : n.isContentEditable) || ((e = n == null ? void 0 : n.classList) == null ? void 0 : e.contains("relly-search-input")) || (i.preventDefault(), this.focus());
1778
+ }
1779
+ }
1780
+ focus() {
1781
+ return this.inputEl.focus(), this.inputEl.select(), this;
1782
+ }
1783
+ getInput() {
1784
+ return this.inputEl;
1785
+ }
1786
+ filter(i) {
1787
+ const e = i.trim();
1788
+ if (!e) {
1789
+ this.clearBtn.style.display = "none", this.resetFilter();
1790
+ return;
1791
+ }
1792
+ this.clearBtn.style.display = "block";
1793
+ const t = this.ignoreCase ? e.toLowerCase() : e;
1794
+ this.bodyEl.querySelectorAll(".relly-row, .relly-graph-row").forEach((r) => {
1795
+ const l = r.querySelector(".relly-row-label, .relly-graph-header span"), o = (l == null ? void 0 : l.textContent) || "";
1796
+ if ((this.ignoreCase ? o.toLowerCase() : o).includes(t)) {
1797
+ r.classList.remove("relly-search-hidden");
1798
+ const u = r.closest(".relly-section");
1799
+ u && (u.classList.remove("relly-section--collapsed"), u.classList.remove("relly-search-hidden"));
1800
+ } else
1801
+ r.classList.add("relly-search-hidden");
1802
+ }), this.bodyEl.querySelectorAll(".relly-section").forEach((r) => {
1803
+ const l = r.querySelector(".relly-section-title-wrap span:last-child"), o = (l == null ? void 0 : l.textContent) || "";
1804
+ (this.ignoreCase ? o.toLowerCase() : o).includes(t) ? (r.classList.remove("relly-search-hidden"), r.classList.remove("relly-section--collapsed"), r.querySelectorAll(".relly-row, .relly-graph-row").forEach((c) => {
1805
+ c.classList.remove("relly-search-hidden");
1806
+ })) : r.querySelectorAll(
1807
+ ".relly-row:not(.relly-search-hidden), .relly-graph-row:not(.relly-search-hidden)"
1808
+ ).length === 0 && r.classList.add("relly-search-hidden");
1809
+ });
1810
+ }
1811
+ clear() {
1812
+ this.inputEl.value = "", this.clearBtn.style.display = "none", this.resetFilter();
1813
+ }
1814
+ resetFilter() {
1815
+ this.bodyEl.querySelectorAll(".relly-search-hidden").forEach((e) => {
1816
+ e.classList.remove("relly-search-hidden");
1817
+ });
1818
+ }
1819
+ destroy() {
1820
+ typeof window < "u" && window.removeEventListener("keydown", this.onGlobalKeyDownBound), this.element.remove();
1821
+ }
1822
+ }
1823
+ class re {
1824
+ constructor(i = !0, e = "synth") {
1825
+ a(this, "ctx", null);
1826
+ a(this, "enabled", !0);
1827
+ a(this, "volume", 1);
1828
+ a(this, "soundPack", "synth");
1829
+ this.enabled = i, this.soundPack = e;
1830
+ }
1831
+ setEnabled(i) {
1832
+ this.enabled = i;
1833
+ }
1834
+ isEnabled() {
1835
+ return this.enabled;
1836
+ }
1837
+ setVolume(i) {
1838
+ this.volume = Math.max(0, Math.min(1, i));
1839
+ }
1840
+ getVolume() {
1841
+ return this.volume;
1842
+ }
1843
+ setSoundPack(i) {
1844
+ return this.soundPack = i, this;
1845
+ }
1846
+ getSoundPack() {
1847
+ return this.soundPack;
1848
+ }
1849
+ initCtx() {
1850
+ if (!this.enabled || this.volume <= 0 || typeof window > "u") return null;
1851
+ if (!this.ctx) {
1852
+ const i = window.AudioContext || window.webkitAudioContext;
1853
+ i && (this.ctx = new i());
1854
+ }
1855
+ return this.ctx && this.ctx.state === "suspended" && this.ctx.resume().catch(() => {
1856
+ }), this.ctx;
1857
+ }
1858
+ playClick() {
1859
+ const i = this.initCtx();
1860
+ if (i)
1861
+ try {
1862
+ const e = i.currentTime, t = i.createOscillator(), n = i.createGain();
1863
+ this.soundPack === "mechanical" ? (t.type = "triangle", t.frequency.setValueAtTime(2400, e), t.frequency.exponentialRampToValueAtTime(450, e + 0.012), n.gain.setValueAtTime(0.06 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.012), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.013)) : this.soundPack === "bubble" ? (t.type = "sine", t.frequency.setValueAtTime(320, e), t.frequency.exponentialRampToValueAtTime(1250, e + 0.022), n.gain.setValueAtTime(0.045 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.022), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.024)) : this.soundPack === "arcade" ? (t.type = "square", t.frequency.setValueAtTime(987.77, e), t.frequency.setValueAtTime(1318.51, e + 0.01), n.gain.setValueAtTime(0.028 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.02), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.022)) : (t.type = "sine", t.frequency.setValueAtTime(800, e), t.frequency.exponentialRampToValueAtTime(350, e + 0.015), n.gain.setValueAtTime(0.04 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.015), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.016));
1864
+ } catch {
1865
+ }
1866
+ }
1867
+ playToggle(i) {
1868
+ const e = this.initCtx();
1869
+ if (e)
1870
+ try {
1871
+ const t = e.currentTime, n = e.createOscillator(), s = e.createGain();
1872
+ if (this.soundPack === "mechanical") {
1873
+ n.type = "triangle";
1874
+ const r = i ? 2800 : 1800, l = i ? 900 : 400;
1875
+ n.frequency.setValueAtTime(r, t), n.frequency.exponentialRampToValueAtTime(l, t + 0.018), s.gain.setValueAtTime(0.055 * this.volume, t), s.gain.exponentialRampToValueAtTime(1e-4, t + 0.018), n.connect(s), s.connect(e.destination), n.start(t), n.stop(t + 0.02);
1876
+ } else if (this.soundPack === "bubble") {
1877
+ n.type = "sine";
1878
+ const r = i ? 380 : 900, l = i ? 1100 : 280;
1879
+ n.frequency.setValueAtTime(r, t), n.frequency.exponentialRampToValueAtTime(l, t + 0.028), s.gain.setValueAtTime(0.045 * this.volume, t), s.gain.exponentialRampToValueAtTime(1e-4, t + 0.028), n.connect(s), s.connect(e.destination), n.start(t), n.stop(t + 0.03);
1880
+ } else if (this.soundPack === "arcade") {
1881
+ n.type = "square";
1882
+ const r = i ? 523.25 : 659.25, l = i ? 783.99 : 392;
1883
+ n.frequency.setValueAtTime(r, t), n.frequency.setValueAtTime(l, t + 0.015), s.gain.setValueAtTime(0.025 * this.volume, t), s.gain.exponentialRampToValueAtTime(1e-4, t + 0.03), n.connect(s), s.connect(e.destination), n.start(t), n.stop(t + 0.032);
1884
+ } else {
1885
+ n.type = "triangle";
1886
+ const r = i ? 650 : 450;
1887
+ n.frequency.setValueAtTime(r, t), n.frequency.exponentialRampToValueAtTime(r * 1.1, t + 0.025), s.gain.setValueAtTime(0.035 * this.volume, t), s.gain.exponentialRampToValueAtTime(1e-4, t + 0.025), n.connect(s), s.connect(e.destination), n.start(t), n.stop(t + 0.026);
1888
+ }
1889
+ } catch {
1890
+ }
1891
+ }
1892
+ playNotify() {
1893
+ const i = this.initCtx();
1894
+ if (i)
1895
+ try {
1896
+ const e = i.currentTime;
1897
+ if (this.soundPack === "arcade") {
1898
+ const t = i.createOscillator(), n = i.createGain();
1899
+ t.type = "square", t.frequency.setValueAtTime(523.25, e), t.frequency.setValueAtTime(659.25, e + 0.04), t.frequency.setValueAtTime(783.99, e + 0.08), t.frequency.setValueAtTime(1046.5, e + 0.12), n.gain.setValueAtTime(0.03 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.18), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.19);
1900
+ } else if (this.soundPack === "bubble") {
1901
+ const t = i.createOscillator(), n = i.createGain();
1902
+ t.type = "sine", t.frequency.setValueAtTime(400, e), t.frequency.exponentialRampToValueAtTime(950, e + 0.05), n.gain.setValueAtTime(0.04 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.05), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.06);
1903
+ const s = i.createOscillator(), r = i.createGain();
1904
+ s.type = "sine", s.frequency.setValueAtTime(550, e + 0.05), s.frequency.exponentialRampToValueAtTime(1400, e + 0.11), r.gain.setValueAtTime(0.04 * this.volume, e + 0.05), r.gain.exponentialRampToValueAtTime(1e-4, e + 0.11), s.connect(r), r.connect(i.destination), s.start(e + 0.05), s.stop(e + 0.12);
1905
+ } else {
1906
+ const t = i.createOscillator(), n = i.createGain();
1907
+ t.type = this.soundPack === "mechanical" ? "triangle" : "sine", t.frequency.setValueAtTime(523.25, e), n.gain.setValueAtTime(0.04 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.06), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.07);
1908
+ const s = i.createOscillator(), r = i.createGain();
1909
+ s.type = this.soundPack === "mechanical" ? "triangle" : "sine", s.frequency.setValueAtTime(783.99, e + 0.05), r.gain.setValueAtTime(0.04 * this.volume, e + 0.05), r.gain.exponentialRampToValueAtTime(1e-4, e + 0.12), s.connect(r), r.connect(i.destination), s.start(e + 0.05), s.stop(e + 0.13);
1910
+ }
1911
+ } catch {
1912
+ }
1913
+ }
1914
+ playSnap() {
1915
+ const i = this.initCtx();
1916
+ if (i)
1917
+ try {
1918
+ const e = i.currentTime, t = i.createOscillator(), n = i.createGain();
1919
+ this.soundPack === "mechanical" ? (t.type = "triangle", t.frequency.setValueAtTime(450, e), t.frequency.exponentialRampToValueAtTime(120, e + 0.025), n.gain.setValueAtTime(0.06 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.025)) : this.soundPack === "bubble" ? (t.type = "sine", t.frequency.setValueAtTime(260, e), t.frequency.exponentialRampToValueAtTime(650, e + 0.035), n.gain.setValueAtTime(0.05 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.035)) : this.soundPack === "arcade" ? (t.type = "square", t.frequency.setValueAtTime(220, e), t.frequency.setValueAtTime(110, e + 0.015), n.gain.setValueAtTime(0.035 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.035)) : (t.type = "sine", t.frequency.setValueAtTime(260, e), t.frequency.exponentialRampToValueAtTime(80, e + 0.03), n.gain.setValueAtTime(0.04 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.03)), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.038);
1920
+ } catch {
1921
+ }
1922
+ }
1923
+ playMiniHud(i = !0) {
1924
+ const e = this.initCtx();
1925
+ if (e)
1926
+ try {
1927
+ const t = e.currentTime, n = e.createOscillator(), s = e.createGain();
1928
+ n.type = this.soundPack === "arcade" ? "square" : "sine";
1929
+ const r = i ? 380 : 640, l = i ? 680 : 340;
1930
+ n.frequency.setValueAtTime(r, t), n.frequency.exponentialRampToValueAtTime(l, t + 0.05), s.gain.setValueAtTime(0.03 * this.volume, t), s.gain.exponentialRampToValueAtTime(1e-4, t + 0.05), n.connect(s), s.connect(e.destination), n.start(t), n.stop(t + 0.055);
1931
+ } catch {
1932
+ }
1933
+ }
1934
+ playTick() {
1935
+ const i = this.initCtx();
1936
+ if (i)
1937
+ try {
1938
+ const e = i.currentTime, t = i.createOscillator(), n = i.createGain();
1939
+ this.soundPack === "mechanical" ? (t.type = "triangle", t.frequency.setValueAtTime(3200, e), t.frequency.exponentialRampToValueAtTime(800, e + 6e-3), n.gain.setValueAtTime(0.03 * this.volume, e)) : this.soundPack === "bubble" ? (t.type = "sine", t.frequency.setValueAtTime(850, e), t.frequency.exponentialRampToValueAtTime(1350, e + 0.01), n.gain.setValueAtTime(0.02 * this.volume, e)) : this.soundPack === "arcade" ? (t.type = "square", t.frequency.setValueAtTime(1174.66, e), n.gain.setValueAtTime(0.018 * this.volume, e)) : (t.type = "sine", t.frequency.setValueAtTime(1800, e), t.frequency.exponentialRampToValueAtTime(800, e + 8e-3), n.gain.setValueAtTime(0.015 * this.volume, e)), n.gain.exponentialRampToValueAtTime(1e-4, e + 9e-3), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.01);
1940
+ } catch {
1941
+ }
1942
+ }
1943
+ playTab() {
1944
+ const i = this.initCtx();
1945
+ if (i)
1946
+ try {
1947
+ const e = i.currentTime, t = i.createOscillator(), n = i.createGain();
1948
+ this.soundPack === "mechanical" ? (t.type = "triangle", t.frequency.setValueAtTime(1900, e), t.frequency.exponentialRampToValueAtTime(600, e + 0.014), n.gain.setValueAtTime(0.045 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.014), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.016)) : this.soundPack === "bubble" ? (t.type = "sine", t.frequency.setValueAtTime(450, e), t.frequency.exponentialRampToValueAtTime(1100, e + 0.02), n.gain.setValueAtTime(0.04 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.02), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.022)) : this.soundPack === "arcade" ? (t.type = "square", t.frequency.setValueAtTime(659.25, e), n.gain.setValueAtTime(0.025 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.018), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.02)) : (t.type = "triangle", t.frequency.setValueAtTime(700, e), t.frequency.exponentialRampToValueAtTime(500, e + 0.018), n.gain.setValueAtTime(0.03 * this.volume, e), n.gain.exponentialRampToValueAtTime(1e-4, e + 0.018), t.connect(n), n.connect(i.destination), t.start(e), t.stop(e + 0.02));
1949
+ } catch {
1950
+ }
1951
+ }
1952
+ }
1953
+ class ae {
1954
+ constructor(i, e) {
1955
+ a(this, "element");
1956
+ a(this, "textareaEl");
1957
+ a(this, "errorEl");
1958
+ a(this, "dropzoneEl");
1959
+ a(this, "fileInput");
1960
+ this.parentEl = i, this.onApply = e, this.element = document.createElement("div"), this.element.className = "relly-modal-backdrop";
1961
+ const t = document.createElement("div");
1962
+ t.className = "relly-modal";
1963
+ const n = document.createElement("div");
1964
+ n.className = "relly-modal-header";
1965
+ const s = document.createElement("span");
1966
+ s.className = "relly-modal-title", s.textContent = "Import JSON Config";
1967
+ const r = document.createElement("button");
1968
+ r.className = "relly-header-btn", r.textContent = "✕", r.addEventListener("click", () => this.hide()), n.appendChild(s), n.appendChild(r), t.appendChild(n), this.dropzoneEl = document.createElement("div"), this.dropzoneEl.className = "relly-dropzone", this.dropzoneEl.innerHTML = `
1969
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1970
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
1971
+ <polyline points="17 8 12 3 7 8"></polyline>
1972
+ <line x1="12" y1="3" x2="12" y2="15"></line>
1973
+ </svg>
1974
+ <span>Drag & drop a <strong>.json</strong> file here, or click to browse</span>
1975
+ `, this.fileInput = document.createElement("input"), this.fileInput.type = "file", this.fileInput.accept = ".json,application/json", this.fileInput.style.display = "none", this.dropzoneEl.addEventListener("click", () => this.fileInput.click()), this.fileInput.addEventListener("change", (c) => this.handleFileSelect(c)), this.dropzoneEl.addEventListener("dragover", (c) => {
1976
+ c.preventDefault(), this.dropzoneEl.classList.add("relly-dropzone-drag");
1977
+ }), this.dropzoneEl.addEventListener("dragleave", () => {
1978
+ this.dropzoneEl.classList.remove("relly-dropzone-drag");
1979
+ }), this.dropzoneEl.addEventListener("drop", (c) => {
1980
+ c.preventDefault(), this.dropzoneEl.classList.remove("relly-dropzone-drag"), c.dataTransfer && c.dataTransfer.files.length > 0 && this.readFile(c.dataTransfer.files[0]);
1981
+ }), t.appendChild(this.dropzoneEl), t.appendChild(this.fileInput), this.textareaEl = document.createElement("textarea"), this.textareaEl.className = "relly-import-textarea", this.textareaEl.placeholder = "Paste JSON configuration here...", t.appendChild(this.textareaEl), this.errorEl = document.createElement("div"), this.errorEl.className = "relly-import-error", t.appendChild(this.errorEl);
1982
+ const l = document.createElement("div");
1983
+ l.className = "relly-modal-actions";
1984
+ const o = document.createElement("button");
1985
+ o.className = "relly-btn", o.textContent = "Cancel", o.style.flex = "1", o.addEventListener("click", () => this.hide());
1986
+ const h = document.createElement("button");
1987
+ h.className = "relly-btn relly-btn-primary", h.textContent = "Apply & Load", h.style.flex = "2", h.addEventListener("click", () => this.apply()), l.appendChild(o), l.appendChild(h), t.appendChild(l), this.element.appendChild(t), this.element.addEventListener("click", (c) => {
1988
+ c.target === this.element && this.hide();
1989
+ }), this.parentEl.appendChild(this.element);
1990
+ }
1991
+ handleFileSelect(i) {
1992
+ const e = i.target;
1993
+ e.files && e.files.length > 0 && this.readFile(e.files[0]);
1994
+ }
1995
+ readFile(i) {
1996
+ const e = new FileReader();
1997
+ e.onload = () => {
1998
+ typeof e.result == "string" && (this.textareaEl.value = e.result, this.errorEl.textContent = "");
1999
+ }, e.readAsText(i);
2000
+ }
2001
+ show() {
2002
+ this.errorEl.textContent = "", this.element.classList.add("relly-modal-show"), this.textareaEl.focus();
2003
+ }
2004
+ hide() {
2005
+ this.element.classList.remove("relly-modal-show");
2006
+ }
2007
+ apply() {
2008
+ const i = this.textareaEl.value.trim();
2009
+ if (!i) {
2010
+ this.errorEl.textContent = "Please paste JSON or drop a file.";
2011
+ return;
2012
+ }
2013
+ try {
2014
+ const e = JSON.parse(i);
2015
+ if (typeof e != "object" || e === null)
2016
+ throw new Error("JSON root must be an object.");
2017
+ this.onApply(e), this.hide(), this.textareaEl.value = "", this.errorEl.textContent = "";
2018
+ } catch (e) {
2019
+ this.errorEl.textContent = `Invalid JSON: ${e.message || "Syntax error"}`;
2020
+ }
2021
+ }
2022
+ destroy() {
2023
+ this.element.remove();
2024
+ }
2025
+ }
2026
+ class le {
2027
+ static load(i, e) {
2028
+ const t = e.target, n = (s, r) => {
2029
+ for (const l of r) {
2030
+ const o = l.children || l.controls;
2031
+ if (l.type === "section") {
2032
+ const h = s.addSection(
2033
+ l.label || "Section",
2034
+ l.collapsed
2035
+ );
2036
+ l.showIf && h.showIf && h.showIf(l.showIf), o && Array.isArray(o) && n(h, o);
2037
+ } else if (l.type === "row") {
2038
+ const h = s.addRow();
2039
+ o && Array.isArray(o) && n(h, o);
2040
+ } else {
2041
+ const h = {
2042
+ ...l,
2043
+ object: l.object !== void 0 ? l.object : t
2044
+ };
2045
+ s.createComponent(h);
2046
+ }
2047
+ }
2048
+ };
2049
+ e.controls && Array.isArray(e.controls) && n(i, e.controls);
2050
+ }
2051
+ }
2052
+ class oe {
2053
+ constructor(i, e) {
2054
+ a(this, "containerEl");
2055
+ this.parentEl = i, this.soundEngine = e, this.containerEl = document.createElement("div"), this.containerEl.className = "relly-toast-container", this.parentEl.appendChild(this.containerEl);
2056
+ }
2057
+ notify(i, e = "info", t = 2600) {
2058
+ var h;
2059
+ (h = this.soundEngine) == null || h.playNotify();
2060
+ const n = document.createElement("div");
2061
+ n.className = `relly-toast relly-toast--${e}`;
2062
+ const s = document.createElement("span");
2063
+ s.className = "relly-toast-icon", s.innerHTML = this.getIconSvg(e);
2064
+ const r = document.createElement("span");
2065
+ r.className = "relly-toast-msg", r.textContent = i;
2066
+ const l = document.createElement("button");
2067
+ l.className = "relly-toast-close", l.innerHTML = "✕", l.title = "Dismiss", n.appendChild(s), n.appendChild(r), n.appendChild(l);
2068
+ const o = () => {
2069
+ n.classList.contains("relly-toast-leave") || (n.classList.add("relly-toast-leave"), setTimeout(() => {
2070
+ n.parentElement && n.parentElement.removeChild(n);
2071
+ }, 200));
2072
+ };
2073
+ return l.addEventListener("click", (c) => {
2074
+ c.stopPropagation(), o();
2075
+ }), n.addEventListener("click", o), this.containerEl.appendChild(n), requestAnimationFrame(() => {
2076
+ n.classList.add("relly-toast-enter");
2077
+ }), t > 0 && setTimeout(o, t), n;
2078
+ }
2079
+ getIconSvg(i) {
2080
+ switch (i) {
2081
+ case "success":
2082
+ return '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"></polyline></svg>';
2083
+ case "warning":
2084
+ return '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>';
2085
+ case "error":
2086
+ return '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>';
2087
+ case "info":
2088
+ default:
2089
+ return '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>';
2090
+ }
2091
+ }
2092
+ destroy() {
2093
+ this.containerEl.parentElement && this.containerEl.parentElement.removeChild(this.containerEl);
2094
+ }
2095
+ }
2096
+ class he {
2097
+ constructor(i, e) {
2098
+ a(this, "menuEl");
2099
+ a(this, "currentComponent");
2100
+ a(this, "onDocClickBound");
2101
+ a(this, "onKeyDownBound");
2102
+ a(this, "onContextMenu", (i) => {
2103
+ let e = i.target, t = e == null ? void 0 : e.closest(".relly-row, .relly-graph-row");
2104
+ if (!t) return;
2105
+ const n = t.__rellyComponent, s = n == null ? void 0 : n.getContextMenu();
2106
+ !s || s.length === 0 || (i.preventDefault(), i.stopPropagation(), this.currentComponent = n, this.show(s, i.clientX, i.clientY));
2107
+ });
2108
+ this.panelEl = i, this.soundEngine = e, this.menuEl = document.createElement("div"), this.menuEl.className = "relly-context-menu", this.menuEl.style.display = "none", this.panelEl.appendChild(this.menuEl), this.onDocClickBound = (t) => {
2109
+ this.menuEl.contains(t.target) || this.hide();
2110
+ }, this.onKeyDownBound = (t) => {
2111
+ t.key === "Escape" && this.hide();
2112
+ }, typeof window < "u" && (window.addEventListener("click", this.onDocClickBound), window.addEventListener("keydown", this.onKeyDownBound)), this.panelEl.addEventListener("contextmenu", this.onContextMenu);
2113
+ }
2114
+ show(i, e, t) {
2115
+ this.menuEl.innerHTML = "";
2116
+ for (const h of i) {
2117
+ if (h.separator) {
2118
+ const p = document.createElement("div");
2119
+ p.className = "relly-context-separator", this.menuEl.appendChild(p);
2120
+ continue;
2121
+ }
2122
+ const c = document.createElement("button");
2123
+ c.type = "button", c.className = "relly-context-item", h.danger && c.classList.add("relly-context-item--danger"), h.disabled && (c.disabled = !0);
2124
+ let u = "";
2125
+ h.icon && (u = `<span class="relly-context-icon">${h.icon}</span>`), c.innerHTML = `${u}<span class="relly-context-label">${h.label}</span>`, c.addEventListener("click", (p) => {
2126
+ var f;
2127
+ p.stopPropagation(), (f = this.soundEngine) == null || f.playClick();
2128
+ const d = this.currentComponent;
2129
+ this.hide(), h.action(d);
2130
+ }), this.menuEl.appendChild(c);
2131
+ }
2132
+ this.menuEl.style.display = "flex";
2133
+ const n = this.panelEl.getBoundingClientRect();
2134
+ let s = e - n.left, r = t - n.top;
2135
+ const l = 160, o = this.menuEl.offsetHeight || 120;
2136
+ s + l > n.width && (s = Math.max(4, n.width - l - 4)), r + o > n.height && (r = Math.max(4, n.height - o - 4)), this.menuEl.style.left = `${s}px`, this.menuEl.style.top = `${r}px`;
2137
+ }
2138
+ hide() {
2139
+ this.menuEl.style.display = "none", this.currentComponent = void 0;
2140
+ }
2141
+ destroy() {
2142
+ typeof window < "u" && (window.removeEventListener("click", this.onDocClickBound), window.removeEventListener("keydown", this.onKeyDownBound)), this.panelEl.removeEventListener("contextmenu", this.onContextMenu), this.menuEl.parentElement && this.menuEl.parentElement.removeChild(this.menuEl);
2143
+ }
2144
+ }
2145
+ class ce extends T {
2146
+ constructor(e, t, n, s) {
2147
+ const r = document.createElement("div");
2148
+ r.className = "relly-tab-content";
2149
+ super(r, t, n, s);
2150
+ a(this, "contentEl");
2151
+ a(this, "buttonEl");
2152
+ this.label = e, this.contentEl = r, this.buttonEl = document.createElement("button"), this.buttonEl.className = "relly-tab-btn", this.buttonEl.textContent = e;
2153
+ }
2154
+ getLabel() {
2155
+ return this.label;
2156
+ }
2157
+ setActive(e) {
2158
+ e ? (this.buttonEl.classList.add("relly-tab-active"), this.contentEl.classList.add("relly-tab-content--active")) : (this.buttonEl.classList.remove("relly-tab-active"), this.contentEl.classList.remove("relly-tab-content--active"));
2159
+ }
2160
+ destroy() {
2161
+ this.destroyChildren(), this.buttonEl.remove(), this.contentEl.remove();
2162
+ }
2163
+ }
2164
+ class de {
2165
+ constructor(i, e, t, n, s) {
2166
+ a(this, "barEl");
2167
+ a(this, "bodyEl");
2168
+ a(this, "tabs", []);
2169
+ a(this, "activeTab", null);
2170
+ this.bindingEngine = t, this.presetManager = n, this.soundEngine = s, this.barEl = document.createElement("div"), this.barEl.className = "relly-tabs-bar", this.barEl.style.display = "none", this.bodyEl = e, i.insertAdjacentElement("afterend", this.barEl);
2171
+ }
2172
+ addTab(i) {
2173
+ this.barEl.style.display = "flex";
2174
+ const e = new ce(i, this.bindingEngine, this.presetManager, this.soundEngine);
2175
+ return this.tabs.push(e), this.barEl.appendChild(e.buttonEl), this.bodyEl.appendChild(e.contentEl), e.buttonEl.addEventListener("click", () => {
2176
+ this.switchTab(e);
2177
+ }), this.tabs.length === 1 && this.switchTab(e, !1), e;
2178
+ }
2179
+ switchTab(i, e = !0) {
2180
+ var t;
2181
+ this.activeTab !== i && e && ((t = this.soundEngine) == null || t.playTab()), this.activeTab = i;
2182
+ for (const n of this.tabs)
2183
+ n.setActive(n === i);
2184
+ }
2185
+ getActiveTab() {
2186
+ return this.activeTab;
2187
+ }
2188
+ destroy() {
2189
+ for (const i of this.tabs)
2190
+ i.destroy();
2191
+ this.tabs = [], this.barEl.remove();
2192
+ }
2193
+ }
2194
+ const me = ':root{--relly-bg: #1c1d22;--relly-fg: #d1d5db;--relly-header-bg: #141518;--relly-header-fg: #f3f4f6;--relly-accent: #6366f1;--relly-accent-hover: #4f46e5;--relly-border: rgba(255, 255, 255, .08);--relly-input-bg: #26272e;--relly-input-hover: #2f3039;--relly-radius: 6px;--relly-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--relly-font-size: 11px;--relly-row-height: 26px;--relly-ease: cubic-bezier(.16, 1, .3, 1);--relly-transition: all .2s var(--relly-ease)}.relly-host{position:fixed;z-index:999999;pointer-events:none}.relly-panel{position:fixed;z-index:999999;background-color:var(--relly-bg);color:var(--relly-fg);border:1px solid var(--relly-border);border-radius:var(--relly-radius);box-shadow:0 10px 25px -5px #00000080,0 8px 10px -6px #0006;font-family:var(--relly-font);font-size:var(--relly-font-size);-webkit-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden!important;overflow-x:hidden!important;display:flex;flex-direction:column;pointer-events:auto;opacity:1;transform:scale(1) translateY(0);transition:opacity .22s var(--relly-ease),transform .22s var(--relly-ease);min-width:240px;min-height:120px;max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}.relly-panel.relly-mini-hud{width:auto!important;height:auto!important;min-width:0!important;min-height:0!important;border-radius:9999px!important;box-shadow:0 4px 20px #0006,0 0 0 1px var(--relly-accent)}.relly-panel.relly-mini-hud .relly-header{border-bottom:none;padding:5px 12px;border-radius:9999px;background-color:var(--relly-bg)}.relly-panel.relly-mini-hud .relly-body,.relly-panel.relly-mini-hud .relly-search-bar,.relly-panel.relly-mini-hud .relly-tabs-bar,.relly-panel.relly-mini-hud .relly-resize-handle,.relly-panel.relly-mini-hud .relly-header-btn:not(.relly-minihud-btn){display:none!important}.relly-panel.relly-mini-hud .relly-header-title:before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;background-color:var(--relly-accent);box-shadow:0 0 6px var(--relly-accent);margin-right:6px;animation:relly-pulse 2s infinite ease-in-out}@keyframes relly-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.5;transform:scale(.85)}}.relly-panel *{box-sizing:border-box}.relly-panel,.relly-panel *,.relly-body,.relly-tabs-bar,.relly-search-bar{scrollbar-width:none!important;-ms-overflow-style:none!important}.relly-panel *::-webkit-scrollbar,.relly-panel::-webkit-scrollbar,.relly-body::-webkit-scrollbar,.relly-tabs-bar::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}.relly-panel.relly-hidden{opacity:0!important;transform:scale(.95) translateY(-6px)!important;pointer-events:none!important}.relly-header{display:flex;align-items:center;justify-content:space-between;background-color:var(--relly-header-bg);color:var(--relly-header-fg);padding:6px 10px;font-weight:600;border-bottom:1px solid var(--relly-border);cursor:grab;transition:background-color .2s var(--relly-ease);flex-shrink:0}.relly-header:active{cursor:grabbing}.relly-header-title{display:flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.relly-header-title svg{width:14px;height:14px;color:var(--relly-accent);transition:transform .2s var(--relly-ease)}.relly-header-title:hover svg{transform:rotate(15deg)}.relly-header-actions{display:flex;align-items:center;gap:4px}.relly-header-btn{background:transparent;border:none;color:var(--relly-fg);opacity:.7;padding:2px 6px;border-radius:4px;cursor:pointer;font-family:inherit;font-size:11px;line-height:1;display:flex;align-items:center;justify-content:center;transition:opacity .15s,background-color .15s,transform .1s var(--relly-ease)}.relly-header-btn:hover{opacity:1;background-color:#ffffff1a;transform:scale(1.08)}.relly-header-btn:active{transform:scale(.92)}.relly-resize-handle{position:absolute;bottom:0;right:0;width:14px;height:14px;cursor:se-resize;display:flex;align-items:center;justify-content:center;opacity:.4;transition:opacity .15s var(--relly-ease);z-index:100}.relly-resize-handle svg{width:9px;height:9px;stroke:var(--relly-fg);stroke-width:1.5}.relly-resize-handle:hover{opacity:1}.relly-search-bar{display:flex;align-items:center;padding:4px 8px;background-color:#0003;border-bottom:1px solid var(--relly-border);gap:6px;flex-shrink:0}.relly-search-input{width:100%;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:4px;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:3px 6px;outline:none;transition:border-color .15s var(--relly-ease),background-color .15s}.relly-search-input:focus{border-color:var(--relly-accent);background-color:var(--relly-input-hover)}.relly-search-clear{background:none;border:none;color:var(--relly-fg);cursor:pointer;opacity:.5;font-size:10px;padding:0 4px;transition:opacity .15s}.relly-search-clear:hover{opacity:1}.relly-tabs-bar{display:flex;background-color:var(--relly-header-bg);border-bottom:1px solid var(--relly-border);overflow-x:auto;overflow-y:hidden;flex-shrink:0;scrollbar-width:none!important;-ms-overflow-style:none!important}.relly-tabs-bar::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}.relly-tab-btn{flex:1;background:transparent;border:none;border-bottom:2px solid transparent;color:var(--relly-fg);opacity:.6;padding:5px 8px;font-family:inherit;font-size:11px;cursor:pointer;white-space:nowrap;transition:all .2s var(--relly-ease)}.relly-tab-btn:hover{opacity:.9;background-color:#ffffff08}.relly-tab-btn.relly-tab-active{opacity:1;color:var(--relly-accent);border-bottom-color:var(--relly-accent)}.relly-tab-content{display:none}.relly-tab-content.relly-tab-content--active{display:flex;flex-direction:column}.relly-body{display:flex;flex-direction:column;overflow-y:auto!important;overflow-x:hidden!important;max-height:80vh;flex:1;transition:max-height .25s var(--relly-ease);scrollbar-width:none!important;-ms-overflow-style:none!important}.relly-body::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}.relly-panel.relly-collapsed .relly-body{display:none}.relly-copy-toast{position:absolute;top:36px;right:10px;background:var(--relly-accent);color:#fff;padding:3px 8px;border-radius:4px;font-size:10px;font-weight:600;box-shadow:0 4px 12px #0000004d;pointer-events:none;opacity:0;transform:translateY(-6px);transition:opacity .2s var(--relly-ease),transform .2s var(--relly-ease);z-index:9999999}.relly-copy-toast.relly-toast-show{opacity:1;transform:translateY(0)}.relly-modal-backdrop{position:absolute;top:0;left:0;width:100%;height:100%;background:#000000b3;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:999999;display:flex;align-items:center;justify-content:center;padding:12px;opacity:0;pointer-events:none;transition:opacity .2s var(--relly-ease)}.relly-modal-backdrop.relly-modal-show{opacity:1;pointer-events:auto}.relly-modal{width:100%;max-width:320px;background:var(--relly-bg);border:1px solid var(--relly-border);border-radius:var(--relly-radius);box-shadow:0 12px 30px #0009;padding:12px;display:flex;flex-direction:column;gap:8px;transform:scale(.95);transition:transform .2s var(--relly-ease)}.relly-modal-backdrop.relly-modal-show .relly-modal{transform:scale(1)}.relly-modal-header{display:flex;justify-content:space-between;align-items:center;font-weight:600;color:var(--relly-header-fg);font-size:12px}.relly-dropzone{border:1.5px dashed var(--relly-border);border-radius:4px;padding:12px;text-align:center;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:6px;color:var(--relly-fg);opacity:.8;font-size:11px;background:#00000026;transition:all .2s var(--relly-ease)}.relly-dropzone:hover,.relly-dropzone.relly-dropzone-drag{border-color:var(--relly-accent);opacity:1;background:#6366f114}.relly-import-textarea{width:100%;height:90px;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:4px;color:var(--relly-fg);font-family:monospace;font-size:10px;padding:6px;outline:none;resize:vertical}.relly-import-textarea:focus{border-color:var(--relly-accent)}.relly-import-error{color:#ef4444;font-size:10px;min-height:12px}.relly-modal-actions{display:flex;gap:6px}.relly-btn-primary{background:var(--relly-accent)!important;color:#fff!important;border-color:var(--relly-accent)!important}.relly-btn-primary:hover{background:var(--relly-accent-hover)!important}.relly-toast-container{position:absolute;top:36px;right:8px;display:flex;flex-direction:column;gap:6px;z-index:9999999;pointer-events:none;max-width:240px}.relly-toast{display:flex;align-items:center;gap:6px;padding:6px 8px;background:var(--relly-bg);border:1px solid var(--relly-border);border-radius:4px;color:var(--relly-fg);font-size:11px;box-shadow:0 4px 16px #00000073;pointer-events:auto;opacity:0;transform:translateY(-8px) scale(.96);transition:opacity .2s var(--relly-ease),transform .2s var(--relly-ease);cursor:pointer}.relly-toast.relly-toast-enter{opacity:1;transform:translateY(0) scale(1)}.relly-toast.relly-toast-leave{opacity:0;transform:translateY(-6px) scale(.95)}.relly-toast-icon svg{width:14px;height:14px;display:block}.relly-toast--success{border-left:3px solid #22c55e}.relly-toast--success .relly-toast-icon{color:#22c55e}.relly-toast--warning{border-left:3px solid #f59e0b}.relly-toast--warning .relly-toast-icon{color:#f59e0b}.relly-toast--error{border-left:3px solid #ef4444}.relly-toast--error .relly-toast-icon{color:#ef4444}.relly-toast--info{border-left:3px solid var(--relly-accent)}.relly-toast--info .relly-toast-icon{color:var(--relly-accent)}.relly-toast-msg{flex:1;line-height:1.3;overflow:hidden;text-overflow:ellipsis}.relly-toast-close{background:transparent;border:none;color:var(--relly-fg);opacity:.5;cursor:pointer;padding:0 2px;font-size:11px}.relly-toast-close:hover{opacity:1}.relly-context-menu{position:absolute;background:var(--relly-bg);border:1px solid var(--relly-border);border-radius:var(--relly-radius);box-shadow:0 8px 24px #0000008c;padding:4px;display:flex;flex-direction:column;min-width:140px;z-index:99999999;animation:relly-menu-in .15s var(--relly-ease)}@keyframes relly-menu-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.relly-context-item{display:flex;align-items:center;gap:6px;background:transparent;border:none;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:5px 8px;border-radius:3px;cursor:pointer;text-align:left;transition:background-color .12s var(--relly-ease),color .12s}.relly-context-item:hover:not(:disabled){background-color:var(--relly-accent);color:#fff}.relly-context-item:disabled{opacity:.4;cursor:not-allowed}.relly-context-item--danger:hover:not(:disabled){background-color:#ef4444!important;color:#fff!important}.relly-context-separator{height:1px;background-color:var(--relly-border);margin:3px 0}.relly-row{display:flex;align-items:center;justify-content:space-between;min-height:var(--relly-row-height);padding:3px 10px;border-bottom:1px solid var(--relly-border);position:relative;transition:background-color .15s var(--relly-ease),opacity .2s var(--relly-ease)}.relly-row:hover{background-color:#ffffff08}.relly-row.relly-search-hidden{display:none!important}.relly-row-label{flex:0 0 40%;max-width:40%;color:var(--relly-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--relly-font-size);cursor:default;position:relative}.relly-row-control{flex:1;display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0}.relly-multi-row{display:flex;align-items:stretch;width:100%;border-bottom:1px solid var(--relly-border)}.relly-multi-row .relly-row{flex:1;border-bottom:none;border-right:1px solid var(--relly-border);padding:3px 6px}.relly-multi-row .relly-row:last-child{border-right:none}.relly-multi-row .relly-row-label{flex:0 0 auto;max-width:none;margin-right:4px}.relly-tooltip{position:absolute;bottom:calc(100% + 4px);left:10px;background-color:#111216;color:#f3f4f6;padding:4px 8px;border-radius:4px;font-size:10px;line-height:1.3;white-space:nowrap;box-shadow:0 4px 12px #00000080;border:1px solid var(--relly-border);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity .18s var(--relly-ease),transform .18s var(--relly-ease);z-index:99999999}.relly-row:hover .relly-tooltip{opacity:1;transform:translateY(0)}.relly-checkbox-wrapper{display:flex;align-items:center;cursor:pointer;gap:6px}.relly-checkbox-box{width:16px;height:16px;border-radius:4px;background-color:var(--relly-input-bg);border:1px solid var(--relly-border);display:flex;align-items:center;justify-content:center;transition:background-color .18s var(--relly-ease),border-color .18s var(--relly-ease),transform .15s var(--relly-ease)}.relly-checkbox-wrapper:hover .relly-checkbox-box{border-color:var(--relly-accent);transform:scale(1.05)}.relly-checkbox-wrapper:active .relly-checkbox-box{transform:scale(.95)}.relly-checkbox-wrapper.relly-checked .relly-checkbox-box{background-color:var(--relly-accent);border-color:var(--relly-accent);animation:relly-pop .25s var(--relly-ease)}@keyframes relly-pop{0%{transform:scale(.85)}60%{transform:scale(1.15)}to{transform:scale(1)}}.relly-checkbox-icon{display:none;width:10px;height:10px;stroke:#fff;stroke-width:2.5;fill:none}.relly-checkbox-wrapper.relly-checked .relly-checkbox-icon{display:block}.relly-slider-container{display:flex;align-items:center;gap:8px;width:100%}.relly-slider-range{flex:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:4px;border-radius:2px;background:var(--relly-input-bg);outline:none;cursor:pointer;transition:background-color .15s var(--relly-ease)}.relly-slider-range::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:12px;height:12px;border-radius:50%;background:var(--relly-accent);cursor:pointer;box-shadow:0 1px 3px #0000004d;transition:transform .15s var(--relly-ease),background-color .15s}.relly-slider-range::-webkit-slider-thumb:hover{transform:scale(1.25);background:var(--relly-accent-hover)}.relly-slider-range::-webkit-slider-thumb:active{transform:scale(1.35)}.relly-slider-number{width:50px;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:4px;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:2px 4px;text-align:right;outline:none;transition:border-color .15s var(--relly-ease),background-color .15s}.relly-slider-number:focus{border-color:var(--relly-accent);background:var(--relly-input-hover)}.relly-btn{width:100%;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:4px;color:var(--relly-fg);font-family:inherit;font-size:11px;font-weight:500;padding:4px 10px;cursor:pointer;transition:background-color .15s var(--relly-ease),border-color .15s,color .15s,transform .1s var(--relly-ease);text-align:center}.relly-btn:hover{background-color:var(--relly-input-hover);border-color:var(--relly-accent);color:#fff;transform:translateY(-1px)}.relly-btn:active{transform:translateY(1px) scale(.98)}.relly-select-input{width:100%;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:4px;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:3px 6px;outline:none;cursor:pointer;transition:border-color .15s var(--relly-ease),background-color .15s}.relly-select-input:focus{border-color:var(--relly-accent);background:var(--relly-input-hover)}.relly-dynamic-value{color:var(--relly-accent);font-weight:500;font-family:monospace;font-size:11px;background:#6366f11a;padding:2px 6px;border-radius:4px;border:1px solid rgba(99,102,241,.2);transition:all .2s var(--relly-ease)}.relly-color-wrapper{display:flex;align-items:center;gap:6px;width:100%;justify-content:flex-end}.relly-color-preview{width:20px;height:20px;border-radius:4px;border:1px solid var(--relly-border);cursor:pointer;box-shadow:inset 0 0 2px #0006;transition:transform .15s var(--relly-ease),border-color .15s}.relly-color-preview:hover{transform:scale(1.15);border-color:#fff}.relly-eyedropper-btn{background:transparent;border:none;color:var(--relly-fg);cursor:pointer;opacity:.7;padding:2px 4px;border-radius:4px;display:flex;align-items:center;justify-content:center;transition:opacity .15s var(--relly-ease),transform .1s var(--relly-ease)}.relly-eyedropper-btn svg{width:13px;height:13px}.relly-eyedropper-btn:hover{opacity:1;color:var(--relly-accent);transform:scale(1.15)}.relly-color-native{position:absolute;opacity:0;width:0;height:0;pointer-events:none}.relly-color-text{font-family:monospace;font-size:11px;color:var(--relly-fg)}.relly-color-swatches{display:flex;align-items:center;gap:3px;flex-wrap:wrap;margin-right:4px}.relly-color-swatch{width:14px;height:14px;border-radius:3px;border:1px solid rgba(255,255,255,.2);cursor:pointer;padding:0;box-sizing:border-box;transition:transform .12s var(--relly-ease),border-color .12s;box-shadow:inset 0 0 2px #00000059}.relly-color-swatch:hover{transform:scale(1.25);border-color:#fff;z-index:2}.relly-color-swatch.relly-swatch-active{border:1.5px solid #fff;box-shadow:0 0 4px var(--relly-accent)}.relly-point2d-container{display:flex;align-items:center;gap:4px;width:100%}.relly-point2d-item{display:flex;align-items:center;gap:2px;flex:1}.relly-point2d-tag{font-size:10px;font-weight:600;color:var(--relly-accent);font-family:monospace}.relly-point2d-input{width:100%;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:4px;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:2px 4px;text-align:right;outline:none;transition:border-color .15s var(--relly-ease)}.relly-point2d-input:focus{border-color:var(--relly-accent)}.relly-graph-row{display:flex;flex-direction:column;padding:6px 10px;border-bottom:1px solid var(--relly-border);gap:5px;transition:opacity .2s var(--relly-ease)}.relly-graph-row.relly-search-hidden{display:none!important}.relly-graph-header{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--relly-fg)}.relly-graph-label{font-weight:500;opacity:.85}.relly-graph-stats{display:flex;align-items:center;gap:5px;font-family:monospace;font-size:10px}.relly-graph-badge{opacity:.55;font-size:9px}.relly-graph-badge--paused{opacity:1!important;color:#f59e0b;background:#f59e0b2e;font-weight:700;border-radius:3px;padding:1px 4px;border:1px solid rgba(245,158,11,.4);letter-spacing:.5px}.relly-graph-val{color:var(--relly-accent);font-weight:600;background:#6366f11f;padding:1px 4px;border-radius:3px;border:1px solid rgba(99,102,241,.2)}.relly-graph-legend{display:none;align-items:center;gap:8px;font-size:9px;font-family:monospace;opacity:.75;margin-top:-2px}.relly-graph-legend-item{display:flex;align-items:center;gap:4px}.relly-graph-legend-dot{width:6px;height:6px;border-radius:50%;display:inline-block}.relly-graph-canvas-container{width:100%;height:90px;background:var(--relly-input-bg);border-radius:4px;border:1px solid var(--relly-border);overflow:hidden;position:relative;box-shadow:inset 0 2px 6px #00000040;cursor:crosshair;transition:border-color .2s ease,box-shadow .2s ease}.relly-graph-canvas-container.relly-graph-paused{border-color:#f59e0b;box-shadow:inset 0 2px 6px #00000040,0 0 10px #f59e0b40}.relly-graph-canvas{width:100%;height:100%;display:block}.relly-graph-tooltip{position:absolute;pointer-events:none;background:#0f172aeb;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);border:1px solid var(--relly-border);border-radius:4px;padding:3px 6px;font-size:9px;font-family:monospace;color:#fff;white-space:nowrap;z-index:10;transform:translate(-50%);opacity:0;transition:opacity .12s ease;box-shadow:0 4px 12px #00000080}.relly-graph-tooltip.relly-tooltip-show{opacity:1}.relly-section{display:flex;flex-direction:column;border-bottom:1px solid var(--relly-border);transition:opacity .2s var(--relly-ease)}.relly-section.relly-search-hidden{display:none!important}.relly-section-header{display:flex;align-items:center;justify-content:space-between;padding:5px 10px;background-color:#ffffff05;cursor:pointer;font-weight:600;color:var(--relly-header-fg);transition:background-color .15s var(--relly-ease)}.relly-section-header:hover{background-color:#ffffff0d}.relly-section-title-wrap{display:flex;align-items:center;gap:6px}.relly-section-arrow{width:12px;height:12px;transition:transform .22s var(--relly-ease);fill:currentColor}.relly-section.relly-section--collapsed .relly-section-arrow{transform:rotate(-90deg)}.relly-section-content{display:flex;flex-direction:column;padding-left:6px;border-left:2px solid var(--relly-accent);transition:opacity .2s var(--relly-ease)}.relly-section.relly-section--collapsed .relly-section-content{display:none}.relly-disabled,.relly-component-row.relly-disabled,.relly-section.relly-disabled{opacity:.42!important;pointer-events:none!important;-webkit-user-select:none!important;user-select:none!important;filter:grayscale(.5)}.relly-jog-scrubbing,.relly-jog-scrubbing *{cursor:ew-resize!important;-webkit-user-select:none!important;user-select:none!important}.relly-mini-sparkline{width:48px;height:16px;display:inline-block;vertical-align:middle;margin-left:6px;border-radius:3px;background:#00000040}.relly-point3d-container{display:flex;align-items:center;gap:4px;width:100%}.relly-point3d-item{display:flex;align-items:center;gap:2px;flex:1;min-width:0}.relly-point3d-tag{font-size:9px;font-weight:700;line-height:1;padding:2px 4px;border-radius:3px;text-transform:uppercase}.relly-point3d-tag--x{background-color:#ef444433;color:#ef4444;border:1px solid rgba(239,68,68,.4)}.relly-point3d-tag--y{background-color:#22c55e33;color:#22c55e;border:1px solid rgba(34,197,94,.4)}.relly-point3d-tag--z{background-color:#3b82f633;color:#3b82f6;border:1px solid rgba(59,130,246,.4)}.relly-point3d-input{width:100%;min-width:24px;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:3px;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:2px 4px;text-align:right;cursor:ew-resize}.relly-range-wrapper{display:flex;align-items:center;gap:6px;width:100%}.relly-range-track{flex:1;height:6px;background:var(--relly-input-bg);border-radius:9999px;position:relative;cursor:pointer;box-shadow:inset 0 1px 2px #0000004d}.relly-range-bar{position:absolute;top:0;bottom:0;background:var(--relly-accent);border-radius:9999px;cursor:grab;transition:background-color .15s}.relly-range-bar:active{cursor:grabbing;background:var(--relly-accent-hover)}.relly-range-thumb{position:absolute;top:50%;width:12px;height:12px;border-radius:50%;background:#fff;border:2px solid var(--relly-accent);transform:translate(-50%,-50%);cursor:grab;z-index:2;transition:transform .1s var(--relly-ease),box-shadow .15s;box-shadow:0 1px 4px #0006}.relly-range-thumb:hover{transform:translate(-50%,-50%) scale(1.2);box-shadow:0 0 6px var(--relly-accent)}.relly-range-thumb:active{cursor:grabbing;transform:translate(-50%,-50%) scale(1.25)}.relly-range-input{width:38px;background:var(--relly-input-bg);border:1px solid var(--relly-border);border-radius:3px;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:2px 4px;text-align:right}.relly-segmented-container{display:flex;position:relative;background:var(--relly-input-bg);border-radius:4px;border:1px solid var(--relly-border);padding:2px;width:100%;overflow:hidden}.relly-segmented-glider{position:absolute;top:2px;bottom:2px;background:var(--relly-accent);border-radius:3px;box-shadow:0 1px 4px #00000059;transition:transform .2s var(--relly-ease),width .2s var(--relly-ease),opacity .15s;pointer-events:none;z-index:1}.relly-segmented-btn{flex:1;position:relative;background:transparent;border:none;color:var(--relly-fg);font-family:inherit;font-size:11px;padding:3px 6px;cursor:pointer;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;z-index:2;transition:color .15s var(--relly-ease)}.relly-segmented-btn:hover{color:#fff}.relly-segmented-btn.relly-segmented-btn--active{color:#fff;font-weight:600}.relly-status-wrapper{display:flex;align-items:center;gap:8px;width:100%;justify-content:flex-end}.relly-status-led{position:relative;width:8px;height:8px;display:flex;align-items:center;justify-content:center}.relly-status-led-core{width:7px;height:7px;border-radius:50%;background-color:#22c55e;position:relative;z-index:2}.relly-status-pulse-ring{position:absolute;width:100%;height:100%;border-radius:50%;background-color:inherit;opacity:.75;animation:relly-status-pulse 2s cubic-bezier(.24,0,.38,1) infinite;z-index:1}@keyframes relly-status-pulse{0%{transform:scale(.95);opacity:.8}70%{transform:scale(2.4);opacity:0}to{transform:scale(2.4);opacity:0}}.relly-status-led--online .relly-status-led-core,.relly-status-led--online .relly-status-pulse-ring{background-color:#22c55e}.relly-status-led--busy .relly-status-led-core,.relly-status-led--busy .relly-status-pulse-ring{background-color:#f59e0b}.relly-status-led--offline .relly-status-led-core,.relly-status-led--offline .relly-status-pulse-ring{background-color:#ef4444}.relly-status-led--info .relly-status-led-core,.relly-status-led--info .relly-status-pulse-ring{background-color:#3b82f6}.relly-status-led--ready .relly-status-led-core,.relly-status-led--ready .relly-status-pulse-ring{background-color:#a855f7}.relly-status-badge{font-size:10px;font-weight:700;padding:1px 6px;border-radius:9999px;text-transform:uppercase;letter-spacing:.04em;background:#ffffff14}.relly-status-badge--online{color:#22c55e;background:#22c55e26}.relly-status-badge--busy{color:#f59e0b;background:#f59e0b26}.relly-status-badge--offline{color:#ef4444;background:#ef444426}.relly-status-badge--info{color:#3b82f6;background:#3b82f626}.relly-status-badge--ready{color:#a855f7;background:#a855f726}.relly-status-detail{font-size:10px;color:var(--relly-fg);opacity:.7;font-family:monospace}', I = "relly-ui-stylesheet";
2195
+ function $(y) {
2196
+ const i = y || (typeof document < "u" ? document : null);
2197
+ if (!i || "getElementById" in i && i.getElementById(I) || "querySelector" in i && i.querySelector(`#${I}`)) return;
2198
+ const e = document.createElement("style");
2199
+ e.id = I, e.textContent = me, "head" in i && i.head ? i.head.appendChild(e) : i.appendChild(e);
2200
+ }
2201
+ const S = class S extends T {
2202
+ constructor(e = {}) {
2203
+ const t = e.shadowDOM !== !1, n = new G(), s = new W(), r = new re(e.sound !== !1, e.soundPack || "synth"), l = document.createElement("div");
2204
+ l.className = "relly-panel";
2205
+ const o = e.width ?? 280;
2206
+ if (l.style.width = typeof o == "number" ? `${o}px` : o, e.height) {
2207
+ const x = e.height;
2208
+ l.style.height = typeof x == "number" ? `${x}px` : x;
2209
+ }
2210
+ const h = document.createElement("div");
2211
+ h.className = "relly-header";
2212
+ const c = document.createElement("div");
2213
+ c.className = "relly-header-title", c.innerHTML = `
2214
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
2215
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
2216
+ <line x1="3" y1="9" x2="21" y2="9"></line>
2217
+ <line x1="9" y1="21" x2="9" y2="9"></line>
2218
+ </svg>
2219
+ `;
2220
+ const u = document.createElement("span");
2221
+ u.textContent = e.title || "RellyUI", c.appendChild(u);
2222
+ const p = document.createElement("div");
2223
+ p.className = "relly-header-actions";
2224
+ const d = document.createElement("button");
2225
+ d.className = "relly-header-btn", d.title = "Copy settings as JSON", d.innerHTML = `
2226
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
2227
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
2228
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
2229
+ </svg>
2230
+ `, p.appendChild(d);
2231
+ const f = document.createElement("button");
2232
+ f.className = "relly-header-btn", f.title = "Import settings from JSON", f.innerHTML = `
2233
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
2234
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
2235
+ <polyline points="7 10 12 15 17 10"></polyline>
2236
+ <line x1="12" y1="15" x2="12" y2="3"></line>
2237
+ </svg>
2238
+ `, p.appendChild(f);
2239
+ const b = document.createElement("button");
2240
+ b.className = "relly-header-btn relly-minihud-btn", b.title = "Toggle Mini-HUD pill (or double-click header)", b.textContent = "⤢", p.appendChild(b);
2241
+ const m = document.createElement("button");
2242
+ m.className = "relly-header-btn", m.title = "Collapse/Expand", m.textContent = "_", p.appendChild(m), h.appendChild(c), h.appendChild(p), l.appendChild(h);
2243
+ const v = document.createElement("div");
2244
+ v.className = "relly-copy-toast", v.textContent = "JSON Copied!", l.appendChild(v);
2245
+ const E = document.createElement("div");
2246
+ E.className = "relly-body", e.height && (E.style.maxHeight = "none", E.style.flex = "1"), l.appendChild(E);
2247
+ super(E, n, s, r);
2248
+ a(this, "hostEl");
2249
+ a(this, "shadowRoot", null);
2250
+ a(this, "panelEl");
2251
+ a(this, "headerEl");
2252
+ a(this, "titleEl");
2253
+ a(this, "collapseBtn");
2254
+ a(this, "copyToastEl");
2255
+ a(this, "themeManager");
2256
+ a(this, "soundEngine");
2257
+ a(this, "draggableInstance");
2258
+ a(this, "resizableInstance");
2259
+ a(this, "hotkeyInstance");
2260
+ a(this, "searchBarInstance");
2261
+ a(this, "tabsManagerInstance");
2262
+ a(this, "importModalInstance");
2263
+ a(this, "toastManager");
2264
+ a(this, "contextMenuManager");
2265
+ a(this, "isPanelCollapsed", !1);
2266
+ a(this, "isPanelHidden", !1);
2267
+ a(this, "isMiniHud", !1);
2268
+ a(this, "ghostOnIdle", !1);
2269
+ a(this, "idleOpacity", 0.38);
2270
+ a(this, "onResizeBound");
2271
+ a(this, "autoSave", !1);
2272
+ a(this, "autoSaveKey", "relly-ui-session");
2273
+ a(this, "autoSaveTimeout", null);
2274
+ a(this, "sparklineCtx");
2275
+ a(this, "sparklineData", [12, 14, 15, 18, 16, 20, 22, 21, 24, 25, 28, 30]);
2276
+ a(this, "sparklineAnimId");
2277
+ this.panelEl = l, this.headerEl = h, this.titleEl = u, this.collapseBtn = m, this.copyToastEl = v, this.soundEngine = r, this.onResizeBound = () => this.clampToViewport(), e.searchBar && (this.searchBarInstance = new se(E, e.searchOptions), h.insertAdjacentElement("afterend", this.searchBarInstance.element)), this.themeManager = new ee(this.panelEl, e.theme), this.mount(e, t), e.autoInjectStyles !== !1 && (this.shadowRoot ? $(this.shadowRoot) : $()), e.draggable !== !1 && (this.draggableInstance = new te(this.headerEl, this.panelEl, this.soundEngine)), e.resizable !== !1 && (this.resizableInstance = new ie(this.panelEl)), this.toastManager = new oe(this.panelEl, this.soundEngine), this.contextMenuManager = new he(this.panelEl, this.soundEngine), this.importModalInstance = new ae(this.panelEl, (x) => {
2278
+ this.importJSON(x);
2279
+ });
2280
+ const g = e.hotkey === void 0 ? "KeyH" : e.hotkey;
2281
+ g && (this.hotkeyInstance = new ne(g, () => {
2282
+ this.toggle();
2283
+ })), b.addEventListener("click", (x) => {
2284
+ x.stopPropagation(), this.toggleMiniHud();
2285
+ }), this.headerEl.addEventListener("dblclick", (x) => {
2286
+ x.target.closest(".relly-header-btn") || this.toggleMiniHud();
2287
+ }), this.collapseBtn.addEventListener("click", (x) => {
2288
+ x.stopPropagation(), this.soundEngine.playClick(), this.toggleCollapse();
2289
+ }), d.addEventListener("click", (x) => {
2290
+ x.stopPropagation(), this.soundEngine.playClick(), this.copyJSON();
2291
+ }), f.addEventListener("click", (x) => {
2292
+ var w;
2293
+ x.stopPropagation(), this.soundEngine.playClick(), (w = this.importModalInstance) == null || w.show();
2294
+ }), e.soundVolume !== void 0 && this.soundEngine.setVolume(e.soundVolume), e.accordion && this.setAccordion(!0), e.ghostOnIdle && this.setGhostMode(!0, e.idleOpacity), this.initSparkline(c), this.panelEl.addEventListener("mouseenter", () => {
2295
+ this.ghostOnIdle && (this.panelEl.style.opacity = "1");
2296
+ }), this.panelEl.addEventListener("mouseleave", () => {
2297
+ this.ghostOnIdle && (this.panelEl.style.opacity = `${this.idleOpacity}`);
2298
+ }), e.collapsed && this.setCollapsed(!0), this.autoSave = e.autoSave ?? !1, this.autoSaveKey = e.autoSaveKey ?? "relly-ui-session", this.presetManager.setOnChange(() => {
2299
+ this.autoSave && this.queueAutoSave();
2300
+ }), this.panelEl.addEventListener("mouseup", () => {
2301
+ this.autoSave && this.queueAutoSave();
2302
+ }), this.autoSave && this.loadSession();
2303
+ }
2304
+ mount(e, t) {
2305
+ if (typeof document > "u") return;
2306
+ const n = e.position || {};
2307
+ this.panelEl.style.top = n.top !== void 0 ? `${n.top}px` : "20px", n.left !== void 0 ? this.panelEl.style.left = `${n.left}px` : this.panelEl.style.right = n.right !== void 0 ? `${n.right}px` : "20px", n.bottom !== void 0 && (this.panelEl.style.bottom = `${n.bottom}px`);
2308
+ const s = e.container ? typeof e.container == "string" ? document.querySelector(e.container) : e.container : document.body;
2309
+ if (s) {
2310
+ if (t && typeof s.attachShadow == "function") {
2311
+ const r = document.createElement("div");
2312
+ r.className = "relly-host", this.hostEl = r, this.shadowRoot = r.attachShadow({ mode: "open" }), this.shadowRoot.appendChild(this.panelEl), s.appendChild(r);
2313
+ } else
2314
+ s.appendChild(this.panelEl), e.container && (this.panelEl.style.position = "relative");
2315
+ typeof window < "u" && (window.addEventListener("resize", this.onResizeBound), setTimeout(() => {
2316
+ this.clampToViewport();
2317
+ }, 0));
2318
+ }
2319
+ }
2320
+ addTab(e) {
2321
+ return this.tabsManagerInstance || (this.tabsManagerInstance = new de(
2322
+ this.headerEl,
2323
+ this.contentEl,
2324
+ this.bindingEngine,
2325
+ this.presetManager,
2326
+ this.soundEngine
2327
+ )), this.tabsManagerInstance.addTab(e);
2328
+ }
2329
+ createTab(e) {
2330
+ return this.addTab(e);
2331
+ }
2332
+ copyJSON() {
2333
+ const e = this.export(), t = JSON.stringify(e, null, 2);
2334
+ return typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(t).catch(() => {
2335
+ }), this.copyToastEl.textContent = "JSON Copied!", this.copyToastEl.classList.add("relly-toast-show"), this.soundEngine.playNotify(), setTimeout(() => {
2336
+ this.copyToastEl.classList.remove("relly-toast-show");
2337
+ }, 1500), t;
2338
+ }
2339
+ notify(e, t = "info", n = 2600) {
2340
+ return this.toastManager.notify(e, t, n);
2341
+ }
2342
+ getToastManager() {
2343
+ return this.toastManager;
2344
+ }
2345
+ getContextMenuManager() {
2346
+ return this.contextMenuManager;
2347
+ }
2348
+ importJSON(e) {
2349
+ try {
2350
+ const t = typeof e == "string" ? JSON.parse(e) : e;
2351
+ this.import(t), this.copyToastEl.textContent = "JSON Loaded!", this.copyToastEl.classList.add("relly-toast-show"), this.soundEngine.playNotify(), setTimeout(() => {
2352
+ this.copyToastEl.classList.remove("relly-toast-show");
2353
+ }, 1500);
2354
+ } catch (t) {
2355
+ console.warn("[RellyUI] Failed to import JSON", t);
2356
+ }
2357
+ return this;
2358
+ }
2359
+ loadSchema(e) {
2360
+ return e.title && this.setTitle(e.title), le.load(this, e), this;
2361
+ }
2362
+ setTitle(e) {
2363
+ return this.titleEl.textContent = e, this;
2364
+ }
2365
+ setTheme(e) {
2366
+ return this.themeManager.applyTheme(e), this.autoSave && this.queueAutoSave(), this;
2367
+ }
2368
+ setSoundPack(e) {
2369
+ return this.soundEngine.setSoundPack(e), this;
2370
+ }
2371
+ getSoundPack() {
2372
+ return this.soundEngine.getSoundPack();
2373
+ }
2374
+ getSoundEngine() {
2375
+ return this.soundEngine;
2376
+ }
2377
+ toggleMiniHud() {
2378
+ return this.setMiniHud(!this.isMiniHud);
2379
+ }
2380
+ setMiniHud(e) {
2381
+ return this.isMiniHud = e, this.isMiniHud ? (this.panelEl.classList.add("relly-mini-hud"), this.soundEngine.playMiniHud(!0)) : (this.panelEl.classList.remove("relly-mini-hud"), this.soundEngine.playMiniHud(!1), this.clampToViewport()), this.autoSave && this.queueAutoSave(), this;
2382
+ }
2383
+ isMiniHudMode() {
2384
+ return this.isMiniHud;
2385
+ }
2386
+ setGhostMode(e, t = 0.38) {
2387
+ return this.ghostOnIdle = e, this.idleOpacity = Math.max(0.05, Math.min(1, t)), this.panelEl.style.opacity = e ? `${this.idleOpacity}` : "1", this;
2388
+ }
2389
+ isGhostMode() {
2390
+ return this.ghostOnIdle;
2391
+ }
2392
+ setSoundVolume(e) {
2393
+ return this.soundEngine.setVolume(e), this;
2394
+ }
2395
+ getSoundVolume() {
2396
+ return this.soundEngine.getVolume();
2397
+ }
2398
+ initSparkline(e) {
2399
+ const t = document.createElement("canvas");
2400
+ t.className = "relly-mini-sparkline", t.width = 48, t.height = 16, e.appendChild(t), this.sparklineCtx = t.getContext("2d");
2401
+ const n = () => {
2402
+ this.isMiniHud && this.sparklineCtx && this.drawSparkline(), typeof requestAnimationFrame < "u" && (this.sparklineAnimId = requestAnimationFrame(n));
2403
+ };
2404
+ typeof requestAnimationFrame < "u" && (this.sparklineAnimId = requestAnimationFrame(n));
2405
+ }
2406
+ drawSparkline() {
2407
+ const e = this.sparklineCtx;
2408
+ if (!e) return;
2409
+ const t = 48, n = 16;
2410
+ e.clearRect(0, 0, t, n);
2411
+ const s = this.sparklineData[this.sparklineData.length - 1], r = Math.max(8, Math.min(26, s + (Math.random() - 0.48) * 3));
2412
+ this.sparklineData.push(r), this.sparklineData.length > 14 && this.sparklineData.shift();
2413
+ const l = Math.min(...this.sparklineData) - 1, h = Math.max(...this.sparklineData) + 1 - l || 1, c = t / (this.sparklineData.length - 1);
2414
+ e.beginPath(), e.moveTo(0, n);
2415
+ for (let u = 0; u < this.sparklineData.length; u++) {
2416
+ const p = u * c, d = n - (this.sparklineData[u] - l) / h * (n - 2) - 1;
2417
+ e.lineTo(p, d);
2418
+ }
2419
+ e.lineTo(t, n), e.closePath(), e.fillStyle = "rgba(56, 189, 248, 0.25)", e.fill(), e.beginPath();
2420
+ for (let u = 0; u < this.sparklineData.length; u++) {
2421
+ const p = u * c, d = n - (this.sparklineData[u] - l) / h * (n - 2) - 1;
2422
+ u === 0 ? e.moveTo(p, d) : e.lineTo(p, d);
2423
+ }
2424
+ e.strokeStyle = "#38bdf8", e.lineWidth = 1.4, e.stroke();
2425
+ }
2426
+ clampToViewport() {
2427
+ var e, t;
2428
+ return (e = this.draggableInstance) == null || e.clampToViewport(), (t = this.resizableInstance) == null || t.clampToViewport(), this;
2429
+ }
2430
+ toggleCollapse() {
2431
+ return this.setCollapsed(!this.isPanelCollapsed);
2432
+ }
2433
+ setCollapsed(e) {
2434
+ return this.isPanelCollapsed = e, this.isPanelCollapsed ? (this.panelEl.classList.add("relly-collapsed"), this.collapseBtn.textContent = "+", this.bindingEngine.pause()) : (this.panelEl.classList.remove("relly-collapsed"), this.collapseBtn.textContent = "_", this.bindingEngine.resume()), this.autoSave && this.queueAutoSave(), this;
2435
+ }
2436
+ queueAutoSave() {
2437
+ this.autoSave && (this.autoSaveTimeout && clearTimeout(this.autoSaveTimeout), this.autoSaveTimeout = setTimeout(() => {
2438
+ this.saveSession();
2439
+ }, 250));
2440
+ }
2441
+ saveSession(e) {
2442
+ if (typeof window > "u" || !window.localStorage) return;
2443
+ const t = e || this.autoSaveKey;
2444
+ try {
2445
+ const n = {
2446
+ left: this.panelEl.style.left ? parseFloat(this.panelEl.style.left) : void 0,
2447
+ top: this.panelEl.style.top ? parseFloat(this.panelEl.style.top) : void 0,
2448
+ right: this.panelEl.style.right ? parseFloat(this.panelEl.style.right) : void 0,
2449
+ bottom: this.panelEl.style.bottom ? parseFloat(this.panelEl.style.bottom) : void 0
2450
+ }, s = {
2451
+ version: S.version,
2452
+ timestamp: Date.now(),
2453
+ isCollapsed: this.isPanelCollapsed,
2454
+ isMiniHud: this.isMiniHud,
2455
+ theme: this.themeManager.getCurrentThemeName(),
2456
+ position: n,
2457
+ width: this.panelEl.style.width,
2458
+ height: this.panelEl.style.height,
2459
+ components: this.presetManager.export()
2460
+ };
2461
+ window.localStorage.setItem(t, JSON.stringify(s));
2462
+ } catch (n) {
2463
+ console.warn("[RellyUI] Failed to save session", n);
2464
+ }
2465
+ }
2466
+ loadSession(e) {
2467
+ if (typeof window > "u" || !window.localStorage) return !1;
2468
+ const t = e || this.autoSaveKey;
2469
+ try {
2470
+ const n = window.localStorage.getItem(t);
2471
+ if (!n) return !1;
2472
+ const s = JSON.parse(n);
2473
+ return !s || typeof s != "object" ? !1 : (s.position && (s.position.left !== void 0 ? (this.panelEl.style.left = `${s.position.left}px`, this.panelEl.style.right = "") : s.position.right !== void 0 && (this.panelEl.style.right = `${s.position.right}px`, this.panelEl.style.left = ""), s.position.top !== void 0 ? (this.panelEl.style.top = `${s.position.top}px`, this.panelEl.style.bottom = "") : s.position.bottom !== void 0 && (this.panelEl.style.bottom = `${s.position.bottom}px`, this.panelEl.style.top = "")), s.width && (this.panelEl.style.width = s.width), s.height && (this.panelEl.style.height = s.height), s.theme && s.theme !== "custom" && this.setTheme(s.theme), s.isCollapsed !== void 0 && s.isCollapsed !== this.isPanelCollapsed && this.setCollapsed(s.isCollapsed), s.isMiniHud !== void 0 && s.isMiniHud !== this.isMiniHud && this.setMiniHud(s.isMiniHud), s.components && this.presetManager.import(s.components), !0);
2474
+ } catch (n) {
2475
+ return console.warn("[RellyUI] Failed to load session", n), !1;
2476
+ }
2477
+ }
2478
+ clearSession(e) {
2479
+ if (typeof window > "u" || !window.localStorage) return;
2480
+ const t = e || this.autoSaveKey;
2481
+ try {
2482
+ window.localStorage.removeItem(t);
2483
+ } catch {
2484
+ }
2485
+ }
2486
+ setAutoSave(e, t) {
2487
+ return this.autoSave = e, t && (this.autoSaveKey = t), this.autoSave && this.loadSession(), this;
2488
+ }
2489
+ toggle() {
2490
+ return this.isPanelHidden ? this.show() : this.hide();
2491
+ }
2492
+ show() {
2493
+ return this.isPanelHidden = !1, this.panelEl.classList.remove("relly-hidden"), this.isPanelCollapsed || this.bindingEngine.resume(), this;
2494
+ }
2495
+ hide() {
2496
+ return this.isPanelHidden = !0, this.panelEl.classList.add("relly-hidden"), this.bindingEngine.pause(), this;
2497
+ }
2498
+ save(e) {
2499
+ return this.presetManager.save(e), this;
2500
+ }
2501
+ load(e) {
2502
+ return this.presetManager.load(e), this;
2503
+ }
2504
+ export() {
2505
+ return this.presetManager.export();
2506
+ }
2507
+ import(e) {
2508
+ return this.presetManager.import(e), this;
2509
+ }
2510
+ getElement() {
2511
+ return this.panelEl;
2512
+ }
2513
+ getShadowRoot() {
2514
+ return this.shadowRoot;
2515
+ }
2516
+ getHost() {
2517
+ return this.hostEl || null;
2518
+ }
2519
+ destroy() {
2520
+ typeof window < "u" && (window.removeEventListener("resize", this.onResizeBound), this.sparklineAnimId && cancelAnimationFrame(this.sparklineAnimId)), this.draggableInstance && this.draggableInstance.destroy(), this.resizableInstance && this.resizableInstance.destroy(), this.hotkeyInstance && this.hotkeyInstance.destroy(), this.searchBarInstance && this.searchBarInstance.destroy(), this.tabsManagerInstance && this.tabsManagerInstance.destroy(), this.importModalInstance && this.importModalInstance.destroy(), this.toastManager.destroy(), this.contextMenuManager.destroy(), this.bindingEngine.destroy(), this.destroyChildren(), this.hostEl ? this.hostEl.remove() : this.panelEl.remove();
2521
+ }
2522
+ };
2523
+ a(S, "version", "1.0.0");
2524
+ let k = S;
2525
+ Object.assign(k, {
2526
+ Checkbox: L,
2527
+ Slider: V,
2528
+ Button: A,
2529
+ Select: z,
2530
+ DynamicLabel: B,
2531
+ Graph: N,
2532
+ ColorPicker: R,
2533
+ Point2D: P,
2534
+ Point3D: D,
2535
+ RangeSlider: H,
2536
+ Segmented: j,
2537
+ StatusIndicator: F,
2538
+ Section: q,
2539
+ Row: K,
2540
+ Tab: ce,
2541
+ TabsManager: de,
2542
+ BaseComponent: C,
2543
+ BindingEngine: G,
2544
+ PresetManager: W,
2545
+ ThemeManager: ee,
2546
+ DARK_THEME: U,
2547
+ LIGHT_THEME: X,
2548
+ CYBERPUNK_THEME: J,
2549
+ NORD_THEME: Y,
2550
+ DRACULA_THEME: _,
2551
+ TOKYO_NIGHT_THEME: Q,
2552
+ MATRIX_THEME: Z,
2553
+ SYNTHWAVE_THEME: O,
2554
+ Draggable: te,
2555
+ Resizable: ie,
2556
+ HotkeyManager: ne,
2557
+ SearchBar: se,
2558
+ SoundEngine: re,
2559
+ ImportModal: ae,
2560
+ ToastManager: oe,
2561
+ ContextMenuManager: he,
2562
+ SchemaLoader: le,
2563
+ ContainerHelper: T,
2564
+ RellyUI: k
2565
+ });
2566
+ typeof window < "u" && (window.RellyUI = k);
2567
+ export {
2568
+ C as BaseComponent,
2569
+ G as BindingEngine,
2570
+ A as Button,
2571
+ J as CYBERPUNK_THEME,
2572
+ L as Checkbox,
2573
+ R as ColorPicker,
2574
+ T as ContainerHelper,
2575
+ he as ContextMenuManager,
2576
+ U as DARK_THEME,
2577
+ _ as DRACULA_THEME,
2578
+ te as Draggable,
2579
+ B as DynamicLabel,
2580
+ N as Graph,
2581
+ ne as HotkeyManager,
2582
+ ae as ImportModal,
2583
+ X as LIGHT_THEME,
2584
+ Z as MATRIX_THEME,
2585
+ Y as NORD_THEME,
2586
+ P as Point2D,
2587
+ D as Point3D,
2588
+ W as PresetManager,
2589
+ H as RangeSlider,
2590
+ k as RellyUI,
2591
+ ie as Resizable,
2592
+ K as Row,
2593
+ O as SYNTHWAVE_THEME,
2594
+ le as SchemaLoader,
2595
+ se as SearchBar,
2596
+ q as Section,
2597
+ j as Segmented,
2598
+ z as Select,
2599
+ V as Slider,
2600
+ re as SoundEngine,
2601
+ F as StatusIndicator,
2602
+ Q as TOKYO_NIGHT_THEME,
2603
+ ce as Tab,
2604
+ de as TabsManager,
2605
+ ee as ThemeManager,
2606
+ oe as ToastManager,
2607
+ k as default
2608
+ };
2609
+ //# sourceMappingURL=relly-ui.es.js.map