@cutoff/audio-ui-react 1.0.0-preview.20260123.1125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/LICENSE.md +690 -0
  2. package/README.md +228 -0
  3. package/dist/components/defaults/controls/Button.d.ts +51 -0
  4. package/dist/components/defaults/controls/Button.d.ts.map +1 -0
  5. package/dist/components/defaults/controls/ButtonView.d.ts +20 -0
  6. package/dist/components/defaults/controls/ButtonView.d.ts.map +1 -0
  7. package/dist/components/defaults/controls/CycleButton.d.ts +82 -0
  8. package/dist/components/defaults/controls/CycleButton.d.ts.map +1 -0
  9. package/dist/components/defaults/controls/Knob.d.ts +82 -0
  10. package/dist/components/defaults/controls/Knob.d.ts.map +1 -0
  11. package/dist/components/defaults/controls/KnobView.d.ts +43 -0
  12. package/dist/components/defaults/controls/KnobView.d.ts.map +1 -0
  13. package/dist/components/defaults/controls/Slider.d.ts +79 -0
  14. package/dist/components/defaults/controls/Slider.d.ts.map +1 -0
  15. package/dist/components/defaults/controls/SliderView.d.ts +90 -0
  16. package/dist/components/defaults/controls/SliderView.d.ts.map +1 -0
  17. package/dist/components/defaults/devices/Keys.d.ts +104 -0
  18. package/dist/components/defaults/devices/Keys.d.ts.map +1 -0
  19. package/dist/components/generic/controls/FilmStripBooleanControl.d.ts +58 -0
  20. package/dist/components/generic/controls/FilmStripBooleanControl.d.ts.map +1 -0
  21. package/dist/components/generic/controls/FilmStripContinuousControl.d.ts +82 -0
  22. package/dist/components/generic/controls/FilmStripContinuousControl.d.ts.map +1 -0
  23. package/dist/components/generic/controls/FilmStripDiscreteControl.d.ts +55 -0
  24. package/dist/components/generic/controls/FilmStripDiscreteControl.d.ts.map +1 -0
  25. package/dist/components/generic/controls/FilmstripView.d.ts +36 -0
  26. package/dist/components/generic/controls/FilmstripView.d.ts.map +1 -0
  27. package/dist/components/generic/controls/ImageKnob.d.ts +74 -0
  28. package/dist/components/generic/controls/ImageKnob.d.ts.map +1 -0
  29. package/dist/components/generic/controls/ImageKnobView.d.ts +38 -0
  30. package/dist/components/generic/controls/ImageKnobView.d.ts.map +1 -0
  31. package/dist/components/generic/controls/ImageRotarySwitch.d.ts +54 -0
  32. package/dist/components/generic/controls/ImageRotarySwitch.d.ts.map +1 -0
  33. package/dist/components/generic/controls/ImageSwitch.d.ts +62 -0
  34. package/dist/components/generic/controls/ImageSwitch.d.ts.map +1 -0
  35. package/dist/components/generic/controls/ImageSwitchView.d.ts +26 -0
  36. package/dist/components/generic/controls/ImageSwitchView.d.ts.map +1 -0
  37. package/dist/components/primitives/AdaptiveBox.d.ts +127 -0
  38. package/dist/components/primitives/AdaptiveBox.d.ts.map +1 -0
  39. package/dist/components/primitives/controls/BooleanControl.d.ts +66 -0
  40. package/dist/components/primitives/controls/BooleanControl.d.ts.map +1 -0
  41. package/dist/components/primitives/controls/ContinuousControl.d.ts +46 -0
  42. package/dist/components/primitives/controls/ContinuousControl.d.ts.map +1 -0
  43. package/dist/components/primitives/controls/DiscreteControl.d.ts +70 -0
  44. package/dist/components/primitives/controls/DiscreteControl.d.ts.map +1 -0
  45. package/dist/components/primitives/controls/OptionView.d.ts +12 -0
  46. package/dist/components/primitives/controls/OptionView.d.ts.map +1 -0
  47. package/dist/components/primitives/svg/FilmstripImage.d.ts +60 -0
  48. package/dist/components/primitives/svg/FilmstripImage.d.ts.map +1 -0
  49. package/dist/components/primitives/svg/Image.d.ts +50 -0
  50. package/dist/components/primitives/svg/Image.d.ts.map +1 -0
  51. package/dist/components/primitives/svg/LabelRing.d.ts +42 -0
  52. package/dist/components/primitives/svg/LabelRing.d.ts.map +1 -0
  53. package/dist/components/primitives/svg/LinearCursor.d.ts +72 -0
  54. package/dist/components/primitives/svg/LinearCursor.d.ts.map +1 -0
  55. package/dist/components/primitives/svg/LinearStrip.d.ts +49 -0
  56. package/dist/components/primitives/svg/LinearStrip.d.ts.map +1 -0
  57. package/dist/components/primitives/svg/RadialHtmlOverlay.d.ts +29 -0
  58. package/dist/components/primitives/svg/RadialHtmlOverlay.d.ts.map +1 -0
  59. package/dist/components/primitives/svg/RadialImage.d.ts +36 -0
  60. package/dist/components/primitives/svg/RadialImage.d.ts.map +1 -0
  61. package/dist/components/primitives/svg/RevealingPath.d.ts +37 -0
  62. package/dist/components/primitives/svg/RevealingPath.d.ts.map +1 -0
  63. package/dist/components/primitives/svg/RingArc.d.ts +21 -0
  64. package/dist/components/primitives/svg/RingArc.d.ts.map +1 -0
  65. package/dist/components/primitives/svg/RotaryImage.d.ts +43 -0
  66. package/dist/components/primitives/svg/RotaryImage.d.ts.map +1 -0
  67. package/dist/components/primitives/svg/TickRing.d.ts +53 -0
  68. package/dist/components/primitives/svg/TickRing.d.ts.map +1 -0
  69. package/dist/components/primitives/svg/ValueRing.d.ts +38 -0
  70. package/dist/components/primitives/svg/ValueRing.d.ts.map +1 -0
  71. package/dist/components/primitives/svg/ValueStrip.d.ts +59 -0
  72. package/dist/components/primitives/svg/ValueStrip.d.ts.map +1 -0
  73. package/dist/components/types.d.ts +451 -0
  74. package/dist/components/types.d.ts.map +1 -0
  75. package/dist/hooks/useAdaptiveSize.d.ts +32 -0
  76. package/dist/hooks/useAdaptiveSize.d.ts.map +1 -0
  77. package/dist/hooks/useArcAngle.d.ts +23 -0
  78. package/dist/hooks/useArcAngle.d.ts.map +1 -0
  79. package/dist/hooks/useAudioParameter.d.ts +89 -0
  80. package/dist/hooks/useAudioParameter.d.ts.map +1 -0
  81. package/dist/hooks/useBooleanInteraction.d.ts +106 -0
  82. package/dist/hooks/useBooleanInteraction.d.ts.map +1 -0
  83. package/dist/hooks/useBooleanParameterResolution.d.ts +54 -0
  84. package/dist/hooks/useBooleanParameterResolution.d.ts.map +1 -0
  85. package/dist/hooks/useContinuousInteraction.d.ts +94 -0
  86. package/dist/hooks/useContinuousInteraction.d.ts.map +1 -0
  87. package/dist/hooks/useContinuousParameterResolution.d.ts +75 -0
  88. package/dist/hooks/useContinuousParameterResolution.d.ts.map +1 -0
  89. package/dist/hooks/useDiscreteInteraction.d.ts +70 -0
  90. package/dist/hooks/useDiscreteInteraction.d.ts.map +1 -0
  91. package/dist/hooks/useDiscreteParameterResolution.d.ts +120 -0
  92. package/dist/hooks/useDiscreteParameterResolution.d.ts.map +1 -0
  93. package/dist/hooks/useNoteInteraction.d.ts +84 -0
  94. package/dist/hooks/useNoteInteraction.d.ts.map +1 -0
  95. package/dist/hooks/useThemableProps.d.ts +68 -0
  96. package/dist/hooks/useThemableProps.d.ts.map +1 -0
  97. package/dist/index.d.ts +77 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +3197 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/stats.html +4949 -0
  102. package/dist/style.css +1 -0
  103. package/dist/utils/textUtils.d.ts +15 -0
  104. package/dist/utils/textUtils.d.ts.map +1 -0
  105. package/dist/utils/theme.d.ts +88 -0
  106. package/dist/utils/theme.d.ts.map +1 -0
  107. package/package.json +78 -0
package/dist/index.js ADDED
@@ -0,0 +1,3197 @@
1
+ import { jsx as b, jsxs as re, Fragment as rt } from "react/jsx-runtime";
2
+ import I, { useMemo as C, useState as _e, useCallback as E, createContext as it, useLayoutEffect as Ge, useRef as de, useEffect as he, useContext as lt } from "react";
3
+ import ne from "classnames";
4
+ import { translateButtonRoundness as st, DEFAULT_ROUNDNESS as se, AudioParameterConverter as at, BooleanInteractionController as ct, AudioParameterFactory as qe, CLASSNAMES as ie, getSizeClassForComponent as Fe, getSizeStyleForComponent as We, clampNormalized as Ie, generateTransparencyVariant as Ke, calculateArcAngles as ut, calculateArcPath as dt, translateKnobThickness as ft, translateKnobRoundness as ht, DEFAULT_CONTINUOUS_SENSITIVITY as mt, ContinuousInteractionController as vt, DEFAULT_KEYBOARD_STEP as pt, TARGET_PIXELS_PER_STEP as yt, DiscreteInteractionController as wt, translateSliderRoundness as Be, calculateLinearPosition as Je, translateSliderThickness as gt, CSS_VARS as te, polarToCartesian as Me, NoteInteractionController as bt, WHITE_KEY_NAMES as $e, translateKeysRoundness as St, generateColorVariants as Ct, createNoteNumSet as xt, noteToNoteNum as Mt, DIATONIC_TO_CHROMATIC as He, WHITE_KEY_TO_CHROMATIC as ke, noteNumToNote as Ye, WHITE_KEY_POSITIONS as kt } from "@cutoff/audio-ui-core";
5
+ export * from "@cutoff/audio-ui-core";
6
+ import { DEFAULT_ROUNDNESS as so, DEFAULT_THICKNESS as ao, bipolarFormatter as co, calculateCenterValue as uo, combineFormatters as fo, createNoteNumSet as ho, frequencyFormatter as mo, isNoteOn as vo, midiBipolarFormatter as po, noteNumToNote as yo, noteToNoteNum as wo, percentageFormatter as go, withPrecision as bo, withUnit as So } from "@cutoff/audio-ui-core";
7
+ function zn(e) {
8
+ return null;
9
+ }
10
+ function Tt({
11
+ normalizedValue: e,
12
+ threshold: t = 0.5,
13
+ roundness: n,
14
+ color: r,
15
+ // Prefixed with _ to indicate intentionally unused (kept for API compatibility)
16
+ className: l
17
+ }) {
18
+ const o = C(() => e > t, [e, t]), i = C(() => typeof n == "string" ? n : st(n ?? se), [n]), s = C(
19
+ () => ({
20
+ stroke: o ? "var(--audioui-primary-50)" : "var(--audioui-primary-20)",
21
+ fill: o ? "var(--audioui-primary-color)" : "var(--audioui-primary-50)",
22
+ strokeWidth: "var(--audioui-button-stroke-width, 5px)"
23
+ }),
24
+ [o]
25
+ );
26
+ return /* @__PURE__ */ b(
27
+ "rect",
28
+ {
29
+ className: l,
30
+ style: {
31
+ stroke: s.stroke,
32
+ fill: s.fill,
33
+ strokeWidth: s.strokeWidth,
34
+ rx: i,
35
+ ry: i
36
+ },
37
+ x: 10,
38
+ y: 10,
39
+ width: 80,
40
+ height: 40,
41
+ rx: typeof i == "number" ? i : 0,
42
+ ry: typeof i == "number" ? i : 0
43
+ }
44
+ );
45
+ }
46
+ const Pt = {
47
+ width: 100,
48
+ height: 60
49
+ }, De = I.memo(Tt);
50
+ De.viewBox = Pt;
51
+ De.labelHeightUnits = 20;
52
+ function Nt(e, t = 3) {
53
+ return !e || e.length <= t ? e : e.slice(0, t);
54
+ }
55
+ const Qe = it(null);
56
+ function Le() {
57
+ const e = lt(Qe);
58
+ if (!e) throw new Error("AdaptiveBox subcomponents must be used within <AdaptiveBox>");
59
+ return e;
60
+ }
61
+ function Q({
62
+ className: e,
63
+ style: t,
64
+ displayMode: n = "scaleToFit",
65
+ labelMode: r = "visible",
66
+ labelHeightUnits: l,
67
+ labelOverflow: o = "auto",
68
+ viewBoxWidth: i,
69
+ viewBoxHeight: s,
70
+ minWidth: u,
71
+ minHeight: m,
72
+ debug: c = !1,
73
+ children: h
74
+ }) {
75
+ const [v, a] = _e(null), [d, w] = _e(null), f = E((D) => {
76
+ a((V) => {
77
+ const L = {
78
+ hAlign: D.hAlign,
79
+ vAlign: D.vAlign
80
+ };
81
+ return !V || V.hAlign !== L.hAlign || V.vAlign !== L.vAlign ? { ...L } : V;
82
+ });
83
+ }, []), g = E((D) => {
84
+ w((V) => {
85
+ const L = {
86
+ position: D.position ?? "below",
87
+ align: D.align ?? "center"
88
+ };
89
+ return !V || V.position !== L.position || V.align !== L.align ? { ...L } : V;
90
+ });
91
+ }, []), y = l ?? 15, S = t?.justifySelf ?? "center", p = t?.alignSelf ?? "center", P = v?.hAlign ?? S, k = v?.vAlign ?? p, R = d?.position ?? "below", N = n === "fill", T = r !== "none", M = T && R === "above" ? "2 / 3" : "1 / 2", U = C(
92
+ () => ({
93
+ hasLabel: !!d,
94
+ labelPosition: d?.position ?? "below",
95
+ displayMode: n,
96
+ labelMode: r,
97
+ labelHeightUnits: y,
98
+ labelOverflow: o,
99
+ debug: c,
100
+ viewBoxWidth: i,
101
+ viewBoxHeight: s,
102
+ mainContentGridRow: M,
103
+ registerSvg: f,
104
+ registerLabel: g
105
+ }),
106
+ [
107
+ d,
108
+ n,
109
+ r,
110
+ y,
111
+ o,
112
+ c,
113
+ i,
114
+ s,
115
+ M,
116
+ f,
117
+ g
118
+ ]
119
+ ), B = y, x = T ? s + B : s;
120
+ let O = "1fr";
121
+ if (T) {
122
+ const D = s / x * 100, V = B / x * 100;
123
+ R === "above" ? O = `${V}% ${D}%` : O = `${D}% ${V}%`;
124
+ }
125
+ return /* @__PURE__ */ b(Qe.Provider, { value: U, children: /* @__PURE__ */ b(
126
+ "div",
127
+ {
128
+ "data-name": "Control+Label Wrapper",
129
+ className: e,
130
+ style: {
131
+ width: "100%",
132
+ height: "100%",
133
+ containerType: "size",
134
+ display: "grid",
135
+ justifyItems: "center",
136
+ alignItems: "center",
137
+ overflow: "hidden",
138
+ minWidth: u,
139
+ minHeight: m,
140
+ ...t ?? {}
141
+ },
142
+ children: /* @__PURE__ */ b(
143
+ "div",
144
+ {
145
+ "data-name": "Aspect Scaler",
146
+ style: {
147
+ aspectRatio: `${i} / ${x}`,
148
+ width: N ? "100%" : `min(100%, calc(100cqh * ${i} / ${x}))`,
149
+ height: N ? "100%" : "auto",
150
+ display: "grid",
151
+ gridTemplateRows: O,
152
+ justifyItems: "center",
153
+ alignItems: "center",
154
+ justifySelf: P,
155
+ alignSelf: k,
156
+ minWidth: 0,
157
+ minHeight: 0,
158
+ containerType: "inline-size",
159
+ position: "relative",
160
+ border: c ? "2px solid hsl(41, 96%, 40%)" : void 0
161
+ },
162
+ children: h
163
+ }
164
+ )
165
+ }
166
+ ) });
167
+ }
168
+ function It({ vAlign: e, hAlign: t, className: n, style: r, children: l, onWheel: o, ...i }) {
169
+ const s = Le();
170
+ Ge(() => {
171
+ s.registerSvg({ hAlign: t, vAlign: e });
172
+ }, [t, e]);
173
+ const u = de(null);
174
+ he(() => {
175
+ if (!u.current || !o) return;
176
+ const c = u.current, h = (v) => {
177
+ o(v);
178
+ };
179
+ return c.addEventListener("wheel", h, { passive: !1 }), () => c.removeEventListener("wheel", h);
180
+ }, [o]);
181
+ const m = s.displayMode === "fill" ? "none" : "xMidYMid meet";
182
+ return /* @__PURE__ */ b(
183
+ "svg",
184
+ {
185
+ ref: u,
186
+ "data-name": "Main Component",
187
+ viewBox: `0 0 ${s.viewBoxWidth} ${s.viewBoxHeight}`,
188
+ preserveAspectRatio: m,
189
+ className: n,
190
+ style: {
191
+ display: "block",
192
+ width: "100%",
193
+ height: "100%",
194
+ // Position in main content grid row
195
+ gridRow: s.mainContentGridRow,
196
+ gridColumn: 1,
197
+ backgroundColor: s.debug ? "hsl(0, 100%, 50% / 0.06)" : void 0,
198
+ ...r ?? {}
199
+ },
200
+ ...i,
201
+ children: l
202
+ }
203
+ );
204
+ }
205
+ function Rt({ className: e, style: t, position: n = "below", align: r = "center", children: l }) {
206
+ const o = Le();
207
+ Ge(() => {
208
+ o.registerLabel({ position: n, align: r });
209
+ }, [n, r]);
210
+ const i = C(() => o.labelOverflow === "abbreviate" ? !0 : o.labelOverflow === "ellipsis" ? !1 : o.viewBoxWidth < o.viewBoxHeight, [o.labelOverflow, o.viewBoxWidth, o.viewBoxHeight]), s = C(() => i && typeof l == "string" && l.length > 5 ? Nt(l, 3) : l, [l, i]);
211
+ if (o.labelMode === "none") return null;
212
+ const u = o.labelMode === "hidden" ? "hidden" : "visible", m = o.labelPosition === "above" ? "1 / 2" : "2 / 3";
213
+ return /* @__PURE__ */ b(
214
+ "div",
215
+ {
216
+ "data-name": "Label",
217
+ className: e,
218
+ style: {
219
+ width: "100%",
220
+ gridRow: m,
221
+ visibility: u,
222
+ containerType: "size",
223
+ height: "100%",
224
+ display: "flex",
225
+ alignItems: "center",
226
+ justifyContent: r,
227
+ ...t ?? {}
228
+ },
229
+ children: /* @__PURE__ */ b(
230
+ "span",
231
+ {
232
+ style: {
233
+ fontSize: "75cqh",
234
+ lineHeight: 1,
235
+ whiteSpace: "nowrap",
236
+ overflow: "hidden",
237
+ textOverflow: i ? "clip" : "ellipsis"
238
+ },
239
+ children: s
240
+ }
241
+ )
242
+ }
243
+ );
244
+ }
245
+ function At({ className: e, style: t, pointerEvents: n = "none", children: r }) {
246
+ const l = Le();
247
+ return /* @__PURE__ */ b(
248
+ "div",
249
+ {
250
+ "data-name": "HTML Overlay",
251
+ className: e,
252
+ style: {
253
+ // Same grid cell as Svg - CSS Grid stacks elements in DOM order
254
+ gridRow: l.mainContentGridRow,
255
+ gridColumn: 1,
256
+ // Override parent's centering to fill the entire grid cell
257
+ placeSelf: "stretch",
258
+ // Container query context for cqmin/cqmax units
259
+ containerType: "size",
260
+ // Center content within the overlay
261
+ display: "flex",
262
+ alignItems: "center",
263
+ justifyContent: "center",
264
+ // Pointer events (default: pass through to SVG below)
265
+ pointerEvents: n,
266
+ ...t ?? {}
267
+ },
268
+ children: r
269
+ }
270
+ );
271
+ }
272
+ Q.Svg = It;
273
+ Q.Label = Rt;
274
+ Q.HtmlOverlay = At;
275
+ function Re(e, t, n, r, l, o) {
276
+ const i = C(() => new at(n), [n]), s = C(() => i.normalize(e), [e, i]), u = de(e);
277
+ u.current = e;
278
+ const m = E(
279
+ (f) => {
280
+ if (!t) return;
281
+ const g = i.normalize(f), y = i.toMidi(f);
282
+ t({
283
+ value: f,
284
+ normalizedValue: g,
285
+ midiValue: y,
286
+ parameter: n
287
+ });
288
+ },
289
+ [i, t, n]
290
+ ), c = E(
291
+ (f) => {
292
+ if (!t) return;
293
+ const g = Math.max(0, Math.min(1, f)), y = i.denormalize(g);
294
+ y !== u.current && (u.current = y, m(y));
295
+ },
296
+ [i, t, m]
297
+ ), h = E(
298
+ (f, g = 1e-3) => {
299
+ if (!t) return;
300
+ const y = u.current, S = i.normalize(y), p = Math.max(0, Math.min(1, S + f * g));
301
+ c(p);
302
+ },
303
+ [i, t, c]
304
+ ), v = C(() => {
305
+ if (r) {
306
+ const f = r(e, n);
307
+ if (f !== void 0)
308
+ return f;
309
+ }
310
+ return i.format(e);
311
+ }, [e, i, r, n]), a = C(() => o ? v : l ?? n.name, [o, v, l, n.name]), d = E(() => n.type === "continuous" ? n.defaultValue !== void 0 ? i.normalize(n.defaultValue) : n.bipolar === !0 ? 0.5 : 0 : 0, [i, n]), w = E(() => {
312
+ if (!t) return;
313
+ const f = d();
314
+ c(f);
315
+ }, [t, d, c]);
316
+ return {
317
+ normalizedValue: s,
318
+ formattedValue: v,
319
+ effectiveLabel: a,
320
+ converter: i,
321
+ setNormalizedValue: c,
322
+ adjustValue: h,
323
+ getDefaultNormalizedValue: d,
324
+ resetToDefault: w
325
+ };
326
+ }
327
+ function Et({
328
+ value: e,
329
+ mode: t,
330
+ onValueChange: n,
331
+ disabled: r = !1,
332
+ onMouseDown: l,
333
+ onMouseUp: o,
334
+ onTouchStart: i,
335
+ onTouchEnd: s,
336
+ onKeyDown: u,
337
+ onKeyUp: m
338
+ }) {
339
+ const c = de(null), h = de(null), v = de(!1), a = de(!1);
340
+ c.current || (c.current = new ct({
341
+ value: e,
342
+ mode: t,
343
+ onValueChange: n,
344
+ disabled: r
345
+ })), he(() => {
346
+ c.current?.updateConfig({
347
+ value: e,
348
+ mode: t,
349
+ onValueChange: n,
350
+ disabled: r
351
+ });
352
+ }, [e, t, n, r]);
353
+ const d = E((x) => {
354
+ x.button === 0 && (a.current = !0, c.current?.handleGlobalPointerDown(!1));
355
+ }, []), w = E((x) => {
356
+ a.current = !0, c.current?.handleGlobalPointerDown(!1);
357
+ }, []), f = E(() => {
358
+ a.current = !1, c.current?.handleGlobalPointerUp();
359
+ }, []), g = E(() => {
360
+ a.current = !1, v.current = !1, c.current?.handleGlobalPointerUp();
361
+ }, []), y = E((x) => {
362
+ if (!c.current || !h.current || !a.current) return;
363
+ const O = c.current, D = h.current;
364
+ if (x.touches.length === 0) return;
365
+ const V = x.touches[0], L = document.elementFromPoint(V.clientX, V.clientY), W = L === D || D.contains(L);
366
+ W !== v.current && (v.current = W, W ? O.handleMouseEnter() : O.handleMouseLeave());
367
+ }, []);
368
+ he(() => {
369
+ if (!r)
370
+ return window.addEventListener("mousedown", d), window.addEventListener("mouseup", f), window.addEventListener("touchstart", w, { passive: !0 }), window.addEventListener("touchmove", y, { passive: !1 }), window.addEventListener("touchend", g), () => {
371
+ window.removeEventListener("mousedown", d), window.removeEventListener("mouseup", f), window.removeEventListener("touchstart", w), window.removeEventListener("touchmove", y), window.removeEventListener("touchend", g);
372
+ };
373
+ }, [
374
+ r,
375
+ d,
376
+ f,
377
+ w,
378
+ y,
379
+ g
380
+ ]);
381
+ const S = E(
382
+ (x) => {
383
+ l?.(x), x.defaultPrevented || (h.current = x.currentTarget, a.current = !0, c.current?.handleMouseDown(x.defaultPrevented));
384
+ },
385
+ [l]
386
+ ), p = E(
387
+ (x) => {
388
+ o?.(x), x.defaultPrevented || (a.current = !1, c.current?.handleMouseUp(x.defaultPrevented));
389
+ },
390
+ [o]
391
+ ), P = E((x) => {
392
+ c.current?.handleMouseEnter();
393
+ }, []), k = E((x) => {
394
+ c.current?.handleMouseLeave();
395
+ }, []), R = E((x) => {
396
+ h.current = x;
397
+ }, []), N = E(
398
+ (x) => {
399
+ i?.(x), x.defaultPrevented || (x.preventDefault(), h.current = x.currentTarget, v.current = !0, c.current?.handleMouseDown(!1));
400
+ },
401
+ [i]
402
+ ), T = E(
403
+ (x) => {
404
+ s?.(x), x.defaultPrevented || (x.preventDefault(), c.current?.handleMouseUp(!1), v.current = !1);
405
+ },
406
+ [s]
407
+ ), M = E((x) => {
408
+ x.preventDefault();
409
+ }, []), U = E(
410
+ (x) => {
411
+ x.defaultPrevented || c.current?.handleKeyDown(x.key) && x.preventDefault();
412
+ },
413
+ [u]
414
+ ), B = E(
415
+ (x) => {
416
+ x.defaultPrevented || c.current?.handleKeyUp(x.key) && x.preventDefault();
417
+ },
418
+ [m]
419
+ );
420
+ return {
421
+ handleMouseDown: S,
422
+ handleMouseUp: p,
423
+ handleMouseEnter: P,
424
+ handleMouseLeave: k,
425
+ handleTouchStart: N,
426
+ handleTouchEnd: T,
427
+ handleTouchMove: M,
428
+ setButtonElement: R,
429
+ handleKeyDown: U,
430
+ handleKeyUp: B
431
+ };
432
+ }
433
+ function $t({
434
+ parameter: e,
435
+ paramId: t,
436
+ label: n,
437
+ latch: r,
438
+ midiResolution: l = 7
439
+ }) {
440
+ return C(() => {
441
+ let o;
442
+ return e ? o = e : (o = qe.createSwitch(n || "", r ? "toggle" : "momentary"), t !== void 0 && (o = {
443
+ ...o,
444
+ id: t
445
+ }), l !== void 0 && (o = {
446
+ ...o,
447
+ midiResolution: l
448
+ })), {
449
+ derivedParameter: o
450
+ };
451
+ }, [e, t, n, r, l]);
452
+ }
453
+ function Bt(e) {
454
+ const {
455
+ view: t,
456
+ viewProps: n,
457
+ htmlOverlay: r,
458
+ value: l,
459
+ onChange: o,
460
+ label: i,
461
+ paramId: s,
462
+ parameter: u,
463
+ latch: m,
464
+ displayMode: c,
465
+ labelMode: h,
466
+ labelPosition: v,
467
+ labelAlign: a,
468
+ labelOverflow: d,
469
+ viewBoxWidthUnits: w,
470
+ viewBoxHeightUnits: f,
471
+ labelHeightUnits: g,
472
+ className: y,
473
+ style: S,
474
+ onClick: p,
475
+ onMouseDown: P,
476
+ onMouseUp: k,
477
+ onMouseEnter: R,
478
+ onMouseLeave: N,
479
+ midiResolution: T
480
+ } = e, { derivedParameter: M } = $t({
481
+ parameter: u,
482
+ paramId: s,
483
+ label: i,
484
+ latch: m,
485
+ midiResolution: T
486
+ }), { normalizedValue: U, converter: B } = Re(l, o, M), x = E(
487
+ ($) => {
488
+ if (!o) return;
489
+ const Z = B.normalize($), le = B.toMidi($);
490
+ o({
491
+ value: $,
492
+ normalizedValue: Z,
493
+ midiValue: le,
494
+ parameter: M
495
+ });
496
+ },
497
+ [o, B, M]
498
+ ), {
499
+ handleMouseDown: O,
500
+ handleMouseUp: D,
501
+ handleMouseEnter: V,
502
+ handleMouseLeave: L,
503
+ handleTouchStart: W,
504
+ handleTouchEnd: j,
505
+ handleTouchMove: z,
506
+ setButtonElement: A,
507
+ handleKeyDown: Y,
508
+ handleKeyUp: K
509
+ } = Et({
510
+ value: l,
511
+ mode: M.mode ?? (m ? "toggle" : "momentary"),
512
+ onValueChange: x,
513
+ disabled: !o,
514
+ onMouseDown: P,
515
+ onMouseUp: k,
516
+ onKeyDown: void 0,
517
+ // BooleanControl doesn't have onKeyDown prop, only uses hook handler
518
+ onKeyUp: void 0
519
+ // BooleanControl doesn't have onKeyUp prop, only uses hook handler
520
+ }), X = E(
521
+ ($) => {
522
+ if (!o && p) {
523
+ $.preventDefault();
524
+ const Z = $.changedTouches[0];
525
+ if (Z) {
526
+ const le = {
527
+ ...$,
528
+ clientX: Z.clientX,
529
+ clientY: Z.clientY,
530
+ currentTarget: $.currentTarget,
531
+ type: "click"
532
+ };
533
+ p(le);
534
+ }
535
+ }
536
+ },
537
+ [o, p]
538
+ ), G = E(
539
+ ($) => {
540
+ !o && p && $.preventDefault();
541
+ },
542
+ [o, p]
543
+ ), _ = i ?? M.name, F = C(() => ne(y, ie.root, ie.container), [y]), H = C(() => o || p ? ie.highlight : "", [o, p]), ee = C(
544
+ () => ({
545
+ ...p || o ? { cursor: "var(--audioui-cursor-clickable)" } : {},
546
+ touchAction: "none"
547
+ }),
548
+ [p, o]
549
+ ), J = E(
550
+ ($) => {
551
+ A($.currentTarget), O($);
552
+ },
553
+ [A, O]
554
+ ), oe = E(
555
+ ($) => {
556
+ A($.currentTarget), W($);
557
+ },
558
+ [A, W]
559
+ );
560
+ return /* @__PURE__ */ re(
561
+ Q,
562
+ {
563
+ displayMode: c ?? "scaleToFit",
564
+ labelMode: h,
565
+ labelOverflow: d,
566
+ className: F,
567
+ style: S,
568
+ labelHeightUnits: g ?? t.labelHeightUnits ?? 20,
569
+ viewBoxWidth: w ?? t.viewBox.width,
570
+ viewBoxHeight: f ?? t.viewBox.height,
571
+ children: [
572
+ /* @__PURE__ */ b(
573
+ Q.Svg,
574
+ {
575
+ className: H,
576
+ style: ee,
577
+ onClick: p,
578
+ onMouseDown: o ? J : void 0,
579
+ onMouseUp: o ? D : void 0,
580
+ onMouseEnter: ($) => {
581
+ o && V($), R?.($);
582
+ },
583
+ onMouseLeave: ($) => {
584
+ o && L($), N?.($);
585
+ },
586
+ onTouchStart: o ? oe : p ? G : void 0,
587
+ onTouchEnd: o ? j : p ? X : void 0,
588
+ onTouchMove: o ? z : void 0,
589
+ onKeyDown: o ? Y : void 0,
590
+ onKeyUp: o ? K : void 0,
591
+ tabIndex: o || p ? 0 : void 0,
592
+ role: "button",
593
+ "aria-pressed": l,
594
+ "aria-label": _,
595
+ children: /* @__PURE__ */ b(t, { normalizedValue: U, ...n })
596
+ }
597
+ ),
598
+ r && /* @__PURE__ */ b(Q.HtmlOverlay, { children: r }),
599
+ _ && /* @__PURE__ */ b(Q.Label, { position: v, align: a ?? "center", children: _ })
600
+ ]
601
+ }
602
+ );
603
+ }
604
+ const Ue = I.memo(Bt);
605
+ function ae(e = !1, t = "normal", n, r) {
606
+ return C(() => {
607
+ const l = e ? void 0 : r !== void 0 ? Fe(n, t, r) : Fe(n, t), o = e ? void 0 : r !== void 0 ? We(n, t, r) : We(n, t);
608
+ return {
609
+ sizeClassName: l,
610
+ sizeStyle: o
611
+ };
612
+ }, [e, t, n, r]);
613
+ }
614
+ function xe({ color: e, roundness: t, style: n }) {
615
+ return C(() => {
616
+ const r = {};
617
+ let l;
618
+ return t !== void 0 && (l = Ie(t), r["--audioui-roundness-base"] = l.toString(), r["--audioui-linecap-base"] = l === 0 ? "square" : "round"), e !== void 0 && (r["--audioui-primary-color"] = e, r["--audioui-primary-50"] = Ke(e, 50), r["--audioui-primary-20"] = Ke(e, 20)), {
619
+ style: { ...r, ...n },
620
+ clampedRoundness: l
621
+ };
622
+ }, [e, t, n]);
623
+ }
624
+ function Dt({
625
+ latch: e = !1,
626
+ value: t = !1,
627
+ onChange: n,
628
+ label: r,
629
+ adaptiveSize: l = !1,
630
+ size: o = "normal",
631
+ displayMode: i,
632
+ labelMode: s,
633
+ labelPosition: u,
634
+ labelAlign: m,
635
+ labelOverflow: c,
636
+ labelHeightUnits: h,
637
+ parameter: v,
638
+ paramId: a,
639
+ midiResolution: d,
640
+ color: w,
641
+ roundness: f,
642
+ onClick: g,
643
+ onMouseDown: y,
644
+ onMouseUp: S,
645
+ onMouseEnter: p,
646
+ onMouseLeave: P,
647
+ className: k,
648
+ style: R
649
+ }) {
650
+ const { style: N } = xe({
651
+ color: w,
652
+ roundness: f,
653
+ style: R
654
+ }), { sizeClassName: T, sizeStyle: M } = ae(l, o, "button");
655
+ return /* @__PURE__ */ b(
656
+ Ue,
657
+ {
658
+ value: t,
659
+ onChange: n,
660
+ label: r,
661
+ displayMode: i,
662
+ labelMode: s,
663
+ labelPosition: u,
664
+ labelAlign: m,
665
+ labelOverflow: c,
666
+ labelHeightUnits: h,
667
+ className: ne(T, k),
668
+ style: { ...M, ...N },
669
+ parameter: v,
670
+ paramId: a,
671
+ latch: e,
672
+ midiResolution: d,
673
+ onClick: g,
674
+ onMouseDown: y,
675
+ onMouseUp: S,
676
+ onMouseEnter: p,
677
+ onMouseLeave: P,
678
+ view: De,
679
+ viewProps: {
680
+ threshold: 0.5,
681
+ roundness: f ?? "var(--audioui-roundness-button)",
682
+ color: w ?? "var(--audioui-primary-color)"
683
+ }
684
+ }
685
+ );
686
+ }
687
+ const On = I.memo(Dt);
688
+ function Ze(e, t = 90, n = 0, r = !1, l) {
689
+ return C(() => ut(e, t, n, r, l), [e, t, n, r, l]);
690
+ }
691
+ function Lt({ startAngle: e, endAngle: t, style: n, cx: r, cy: l, radius: o, thickness: i, strokeLinecap: s }) {
692
+ const u = Math.abs(t - e) >= 360, m = C(() => {
693
+ if (!u)
694
+ return dt(r, l, e, t, o, "counter-clockwise");
695
+ }, [u, r, l, e, t, o]);
696
+ return u ? /* @__PURE__ */ b(
697
+ "circle",
698
+ {
699
+ cx: r,
700
+ cy: l,
701
+ r: o,
702
+ fill: "none",
703
+ strokeWidth: i,
704
+ style: {
705
+ ...n,
706
+ // @ts-expect-error - strokeLinecap accepts CSS variables (strings) but React types are strict
707
+ strokeLinecap: s
708
+ }
709
+ }
710
+ ) : m ? /* @__PURE__ */ b(
711
+ "path",
712
+ {
713
+ d: m,
714
+ fill: "none",
715
+ strokeWidth: i,
716
+ style: {
717
+ ...n,
718
+ // @ts-expect-error - strokeLinecap accepts CSS variables (strings) but React types are strict
719
+ strokeLinecap: s
720
+ }
721
+ }
722
+ ) : null;
723
+ }
724
+ const je = I.memo(Lt);
725
+ function Ut({
726
+ cx: e,
727
+ cy: t,
728
+ radius: n,
729
+ normalizedValue: r,
730
+ bipolar: l = !1,
731
+ thickness: o = 6,
732
+ roundness: i,
733
+ openness: s = 90,
734
+ rotation: u = 0,
735
+ positions: m,
736
+ fgArcStyle: c,
737
+ bgArcStyle: h
738
+ }) {
739
+ const { startAngle: v, endAngle: a, valueToAngle: d, valueStartAngle: w } = Ze(
740
+ r,
741
+ s,
742
+ u,
743
+ l,
744
+ m
745
+ ), f = C(() => typeof i == "string" ? i : i ? "round" : "square", [i]), g = C(() => Math.max(0, n - o / 2), [n, o]);
746
+ return /* @__PURE__ */ re(rt, { children: [
747
+ /* @__PURE__ */ b(
748
+ je,
749
+ {
750
+ startAngle: v,
751
+ endAngle: a,
752
+ style: h,
753
+ cx: e,
754
+ cy: t,
755
+ radius: g,
756
+ thickness: o,
757
+ strokeLinecap: f
758
+ }
759
+ ),
760
+ /* @__PURE__ */ b(
761
+ je,
762
+ {
763
+ startAngle: w,
764
+ endAngle: d,
765
+ style: c,
766
+ cx: e,
767
+ cy: t,
768
+ radius: g,
769
+ thickness: o,
770
+ strokeLinecap: f
771
+ }
772
+ )
773
+ ] });
774
+ }
775
+ const Vt = I.memo(Ut);
776
+ function zt({ cx: e, cy: t, radius: n, imageHref: r, children: l, transform: o, className: i, style: s }) {
777
+ return /* @__PURE__ */ re("g", { className: i, style: s, transform: o, children: [
778
+ r && /* @__PURE__ */ b(
779
+ "image",
780
+ {
781
+ href: r,
782
+ x: e - n,
783
+ y: t - n,
784
+ width: n * 2,
785
+ height: n * 2,
786
+ preserveAspectRatio: "xMidYMid meet"
787
+ }
788
+ ),
789
+ l && /* @__PURE__ */ b(
790
+ "svg",
791
+ {
792
+ x: e - n,
793
+ y: t - n,
794
+ width: n * 2,
795
+ height: n * 2,
796
+ viewBox: `0 0 ${n * 2} ${n * 2}`,
797
+ style: { overflow: "visible", ...s?.color ? { color: s.color } : {} },
798
+ children: l
799
+ }
800
+ )
801
+ ] });
802
+ }
803
+ const et = I.memo(zt);
804
+ function Ot({
805
+ cx: e,
806
+ cy: t,
807
+ radius: n,
808
+ normalizedValue: r,
809
+ bipolar: l = !1,
810
+ openness: o = 90,
811
+ imageHref: i,
812
+ children: s,
813
+ rotation: u = 0,
814
+ positions: m,
815
+ pivotX: c,
816
+ pivotY: h,
817
+ className: v,
818
+ style: a
819
+ }) {
820
+ const { valueToAngle: d } = Ze(r, o, u, l, m);
821
+ return /* @__PURE__ */ b(
822
+ et,
823
+ {
824
+ cx: e,
825
+ cy: t,
826
+ radius: n,
827
+ imageHref: i,
828
+ transform: `rotate(${d}, ${c ?? e}, ${h ?? t})`,
829
+ className: v,
830
+ style: { ...a, willChange: "transform" },
831
+ children: s
832
+ }
833
+ );
834
+ }
835
+ const Ne = I.memo(Ot);
836
+ function _t({
837
+ normalizedValue: e,
838
+ bipolar: t = !1,
839
+ variant: n = "abstract",
840
+ thickness: r,
841
+ roundness: l,
842
+ openness: o = 90,
843
+ rotation: i = 0,
844
+ color: s,
845
+ // Prefixed with _ to indicate intentionally unused (kept for API compatibility)
846
+ className: u,
847
+ svgOverlayRotary: m = !1,
848
+ svgOverlay: c
849
+ }) {
850
+ const v = r ?? (n === "abstract" || n === "simplest" ? 0.4 : 0.2), a = C(() => ft(v), [v]), d = C(() => typeof l == "string" ? l === "var(--audioui-roundness-knob)" ? "var(--audioui-linecap-knob)" : "round" : ht(l ?? se) !== 0 ? "round" : "square", [l]), w = /* @__PURE__ */ b(
851
+ Vt,
852
+ {
853
+ cx: 50,
854
+ cy: 50,
855
+ radius: 50,
856
+ normalizedValue: e,
857
+ bipolar: t,
858
+ thickness: a,
859
+ roundness: d,
860
+ openness: o,
861
+ rotation: i,
862
+ fgArcStyle: { stroke: "var(--audioui-primary-color)" },
863
+ bgArcStyle: { stroke: "var(--audioui-primary-50)" }
864
+ }
865
+ ), f = d;
866
+ switch (n) {
867
+ case "plainCap":
868
+ return /* @__PURE__ */ re("g", { className: u, children: [
869
+ w,
870
+ /* @__PURE__ */ re(
871
+ Ne,
872
+ {
873
+ cx: 50,
874
+ cy: 50,
875
+ radius: 50 - a - 6,
876
+ normalizedValue: e,
877
+ openness: o,
878
+ rotation: i,
879
+ children: [
880
+ /* @__PURE__ */ b("circle", { cx: "50%", cy: "50%", r: "50%", fill: "var(--audioui-knob-cap-fill, #4a4d50)" }),
881
+ /* @__PURE__ */ b(
882
+ "line",
883
+ {
884
+ x1: "50%",
885
+ y1: "15%",
886
+ x2: "50%",
887
+ y2: "5%",
888
+ stroke: "var(--audioui-nearwhite)",
889
+ strokeWidth: (50 - a - 6) * 0.1,
890
+ strokeLinecap: f
891
+ }
892
+ )
893
+ ]
894
+ }
895
+ )
896
+ ] });
897
+ case "iconCap": {
898
+ const g = (50 - a - 6) * 0.35, y = c ? m ? /* @__PURE__ */ b(
899
+ Ne,
900
+ {
901
+ cx: 50,
902
+ cy: 50,
903
+ radius: g,
904
+ normalizedValue: e,
905
+ openness: o,
906
+ rotation: i,
907
+ style: { color: "var(--audioui-nearwhite)" },
908
+ children: c
909
+ }
910
+ ) : /* @__PURE__ */ b(et, { cx: 50, cy: 50, radius: g, style: { color: "var(--audioui-nearwhite)" }, children: c }) : null;
911
+ return /* @__PURE__ */ re("g", { className: u, children: [
912
+ w,
913
+ /* @__PURE__ */ re(
914
+ Ne,
915
+ {
916
+ cx: 50,
917
+ cy: 50,
918
+ radius: 50 - a - 6,
919
+ normalizedValue: e,
920
+ openness: o,
921
+ rotation: i,
922
+ children: [
923
+ /* @__PURE__ */ b("circle", { cx: "50%", cy: "50%", r: "50%", fill: "var(--audioui-knob-cap-fill, #4a4d50)" }),
924
+ /* @__PURE__ */ b(
925
+ "line",
926
+ {
927
+ x1: "50%",
928
+ y1: "15%",
929
+ x2: "50%",
930
+ y2: "5%",
931
+ stroke: "var(--audioui-nearwhite)",
932
+ strokeWidth: (50 - a - 6) * 0.1,
933
+ strokeLinecap: f
934
+ }
935
+ )
936
+ ]
937
+ }
938
+ ),
939
+ y
940
+ ] });
941
+ }
942
+ case "abstract":
943
+ case "simplest":
944
+ default:
945
+ return /* @__PURE__ */ b("g", { className: u, children: w });
946
+ }
947
+ }
948
+ const pe = I.memo(_t);
949
+ pe.viewBox = { width: 100, height: 100 };
950
+ pe.labelHeightUnits = 20;
951
+ pe.interaction = { mode: "both", direction: "circular" };
952
+ pe.title = "Knob";
953
+ pe.description = "A rotary knob control with circular arc indicator";
954
+ function Ft({
955
+ adjustValue: e,
956
+ keyboardStep: t = pt,
957
+ interactionMode: n = "both",
958
+ direction: r = "both",
959
+ sensitivity: l,
960
+ wheelSensitivity: o,
961
+ step: i,
962
+ min: s,
963
+ max: u,
964
+ paramStep: m,
965
+ disabled: c = !1,
966
+ editable: h = !0,
967
+ onDragStart: v,
968
+ onDragEnd: a,
969
+ resetToDefault: d,
970
+ onMouseDown: w,
971
+ onTouchStart: f,
972
+ onWheel: g,
973
+ onKeyDown: y,
974
+ onDoubleClick: S
975
+ }) {
976
+ const p = C(() => {
977
+ if (i !== void 0) return i;
978
+ if (m !== void 0 && s !== void 0 && u !== void 0 && u !== s)
979
+ return m / Math.abs(u - s);
980
+ }, [i, s, u, m]), P = C(() => {
981
+ const T = l ?? mt;
982
+ if (p) {
983
+ const M = p / yt;
984
+ return Math.max(T, M);
985
+ }
986
+ return T;
987
+ }, [l, p]), k = de(null);
988
+ return k.current || (k.current = new vt({
989
+ adjustValue: e,
990
+ keyboardStep: t,
991
+ interactionMode: n,
992
+ direction: r,
993
+ sensitivity: P,
994
+ wheelSensitivity: o,
995
+ step: p,
996
+ disabled: c,
997
+ onDragStart: v,
998
+ onDragEnd: a
999
+ })), he(() => {
1000
+ k.current?.updateConfig({
1001
+ adjustValue: e,
1002
+ keyboardStep: t,
1003
+ interactionMode: n,
1004
+ direction: r,
1005
+ sensitivity: P,
1006
+ wheelSensitivity: o,
1007
+ step: p,
1008
+ disabled: c,
1009
+ onDragStart: v,
1010
+ onDragEnd: a
1011
+ });
1012
+ }, [
1013
+ e,
1014
+ t,
1015
+ n,
1016
+ r,
1017
+ P,
1018
+ o,
1019
+ p,
1020
+ c,
1021
+ v,
1022
+ a
1023
+ ]), he(() => () => {
1024
+ k.current?.dispose();
1025
+ }, []), {
1026
+ ...C(() => {
1027
+ const T = k.current;
1028
+ return {
1029
+ onMouseDown: (M) => {
1030
+ w?.(M), M.defaultPrevented || T.handleMouseDown(M.clientX, M.clientY, M.currentTarget);
1031
+ },
1032
+ onTouchStart: (M) => {
1033
+ if (!M.defaultPrevented) {
1034
+ const U = M.touches[0];
1035
+ T.handleTouchStart(U.clientX, U.clientY, M.currentTarget);
1036
+ }
1037
+ },
1038
+ onWheel: (M) => {
1039
+ M.defaultPrevented || T.handleWheel(M);
1040
+ },
1041
+ onKeyDown: (M) => {
1042
+ M.defaultPrevented || T.handleKeyDown(M);
1043
+ },
1044
+ onDoubleClick: (M) => {
1045
+ S?.(M), !M.defaultPrevented && d && h && !c && (M.preventDefault(), d());
1046
+ }
1047
+ };
1048
+ }, [
1049
+ w,
1050
+ f,
1051
+ g,
1052
+ y,
1053
+ S,
1054
+ d,
1055
+ h,
1056
+ c
1057
+ ]),
1058
+ tabIndex: c ? -1 : 0,
1059
+ role: "slider",
1060
+ "aria-disabled": c,
1061
+ style: {
1062
+ cursor: c ? "var(--audioui-cursor-disabled)" : h ? n === "wheel" ? "var(--audioui-cursor-vertical)" : r === "horizontal" ? "var(--audioui-cursor-horizontal)" : r === "vertical" ? "var(--audioui-cursor-vertical)" : r === "both" ? "var(--audioui-cursor-bidirectional)" : r === "circular" ? "var(--audioui-cursor-circular)" : "var(--audioui-cursor-clickable)" : "var(--audioui-cursor-noneditable)",
1063
+ touchAction: "none"
1064
+ }
1065
+ };
1066
+ }
1067
+ function tt({
1068
+ parameter: e,
1069
+ paramId: t,
1070
+ label: n,
1071
+ min: r,
1072
+ max: l,
1073
+ step: o,
1074
+ bipolar: i,
1075
+ unit: s,
1076
+ scale: u,
1077
+ midiResolution: m = 32,
1078
+ defaultValue: c
1079
+ }) {
1080
+ return C(() => {
1081
+ let h;
1082
+ return e ? h = e : h = qe.createControl({
1083
+ id: t ?? "adhoc-continuous",
1084
+ label: n,
1085
+ min: r,
1086
+ max: l,
1087
+ step: o,
1088
+ bipolar: i,
1089
+ unit: s,
1090
+ scale: u,
1091
+ midiResolution: m,
1092
+ defaultValue: c
1093
+ }), {
1094
+ derivedParameter: h
1095
+ };
1096
+ }, [e, t, n, r, l, o, i, s, u, m, c]);
1097
+ }
1098
+ function Wt(e) {
1099
+ const {
1100
+ view: t,
1101
+ viewProps: n,
1102
+ htmlOverlay: r,
1103
+ min: l,
1104
+ max: o,
1105
+ step: i,
1106
+ value: s,
1107
+ label: u,
1108
+ displayMode: m,
1109
+ labelMode: c,
1110
+ labelPosition: h,
1111
+ labelAlign: v,
1112
+ labelOverflow: a,
1113
+ viewBoxWidthUnits: d,
1114
+ viewBoxHeightUnits: w,
1115
+ labelHeightUnits: f,
1116
+ className: g,
1117
+ style: y,
1118
+ onChange: S,
1119
+ paramId: p,
1120
+ onClick: P,
1121
+ onMouseDown: k,
1122
+ onMouseUp: R,
1123
+ onMouseEnter: N,
1124
+ onMouseLeave: T,
1125
+ parameter: M,
1126
+ interactionMode: U,
1127
+ interactionDirection: B,
1128
+ interactionSensitivity: x,
1129
+ unit: O,
1130
+ scale: D,
1131
+ valueFormatter: V,
1132
+ valueAsLabel: L = "labelOnly",
1133
+ midiResolution: W,
1134
+ defaultValue: j
1135
+ } = e, z = e.bipolar ?? !1, { derivedParameter: A } = tt({
1136
+ parameter: M,
1137
+ paramId: p,
1138
+ label: u,
1139
+ min: l,
1140
+ max: o,
1141
+ step: i,
1142
+ bipolar: z,
1143
+ unit: O,
1144
+ scale: D,
1145
+ midiResolution: W,
1146
+ defaultValue: j
1147
+ }), [Y, K] = I.useState(!1), [X, G] = I.useState(!1), _ = I.useRef(void 0), F = I.useCallback(() => {
1148
+ K(!0), G(!0), _.current && window.clearTimeout(_.current);
1149
+ }, []), H = I.useCallback(() => {
1150
+ K(!1), _.current && window.clearTimeout(_.current), _.current = window.setTimeout(() => {
1151
+ G(!1);
1152
+ }, 1e3);
1153
+ }, []), ee = I.useCallback(() => {
1154
+ G(!0), _.current && window.clearTimeout(_.current), Y || (_.current = window.setTimeout(() => {
1155
+ G(!1);
1156
+ }, 1e3));
1157
+ }, [Y]), J = L === "valueOnly" || L === "interactive" && (Y || X), { normalizedValue: oe, adjustValue: $, effectiveLabel: Z, resetToDefault: le } = Re(
1158
+ s,
1159
+ S,
1160
+ A,
1161
+ V,
1162
+ u,
1163
+ J
1164
+ ), ue = I.useCallback(
1165
+ (nt, ot) => {
1166
+ L === "interactive" && S && ee(), $(nt, ot);
1167
+ },
1168
+ [$, L, ee, S]
1169
+ ), fe = U ?? t.interaction.mode ?? "both", ce = B ?? t.interaction.direction ?? "both", q = Ft({
1170
+ adjustValue: ue,
1171
+ interactionMode: fe,
1172
+ direction: ce,
1173
+ sensitivity: x,
1174
+ min: A.min,
1175
+ max: A.max,
1176
+ paramStep: A.step,
1177
+ editable: !!S,
1178
+ resetToDefault: S ? le : void 0,
1179
+ onDragStart: L === "interactive" && S ? F : void 0,
1180
+ onDragEnd: L === "interactive" && S ? H : void 0,
1181
+ onMouseDown: k,
1182
+ onTouchStart: void 0,
1183
+ // ContinuousControl doesn't have onTouchStart prop
1184
+ onWheel: void 0,
1185
+ // ContinuousControl doesn't have onWheel prop
1186
+ onKeyDown: void 0
1187
+ // ContinuousControl doesn't have onKeyDown prop
1188
+ }), ve = C(() => ne(g, ie.root, ie.container), [g]), we = C(() => S || P ? ie.highlight : "", [S, P]), ge = {
1189
+ ...q.style ?? {},
1190
+ // Override cursor for click-only controls
1191
+ ...P && !S ? { cursor: "var(--audioui-cursor-clickable)" } : {}
1192
+ };
1193
+ return /* @__PURE__ */ re(
1194
+ Q,
1195
+ {
1196
+ displayMode: m ?? "scaleToFit",
1197
+ labelMode: c,
1198
+ labelOverflow: a,
1199
+ className: ve,
1200
+ style: y,
1201
+ labelHeightUnits: f ?? t.labelHeightUnits ?? 20,
1202
+ viewBoxWidth: d ?? t.viewBox.width,
1203
+ viewBoxHeight: w ?? t.viewBox.height,
1204
+ children: [
1205
+ /* @__PURE__ */ b(
1206
+ Q.Svg,
1207
+ {
1208
+ className: we,
1209
+ style: ge,
1210
+ onWheel: q.onWheel,
1211
+ onClick: P,
1212
+ onMouseDown: q.onMouseDown,
1213
+ onTouchStart: q.onTouchStart,
1214
+ onKeyDown: q.onKeyDown,
1215
+ onDoubleClick: q.onDoubleClick,
1216
+ onMouseUp: R,
1217
+ onMouseEnter: N,
1218
+ onMouseLeave: T,
1219
+ tabIndex: q.tabIndex,
1220
+ role: q.role,
1221
+ "aria-valuenow": s,
1222
+ "aria-label": Z,
1223
+ children: /* @__PURE__ */ b(t, { normalizedValue: oe, ...n })
1224
+ }
1225
+ ),
1226
+ r && /* @__PURE__ */ b(Q.HtmlOverlay, { children: r }),
1227
+ Z && /* @__PURE__ */ b(Q.Label, { position: h, align: v, children: Z })
1228
+ ]
1229
+ }
1230
+ );
1231
+ }
1232
+ const Ae = I.memo(Wt), Kt = 90, Ht = 0;
1233
+ function Yt({
1234
+ min: e,
1235
+ max: t,
1236
+ step: n,
1237
+ bipolar: r = !1,
1238
+ value: l,
1239
+ onChange: o,
1240
+ valueFormatter: i,
1241
+ label: s,
1242
+ adaptiveSize: u = !1,
1243
+ size: m = "normal",
1244
+ displayMode: c,
1245
+ labelMode: h,
1246
+ labelPosition: v,
1247
+ labelAlign: a,
1248
+ labelOverflow: d,
1249
+ labelHeightUnits: w,
1250
+ color: f,
1251
+ roundness: g,
1252
+ variant: y = "abstract",
1253
+ thickness: S,
1254
+ openness: p = Kt,
1255
+ rotation: P = Ht,
1256
+ parameter: k,
1257
+ unit: R,
1258
+ scale: N,
1259
+ paramId: T,
1260
+ interactionMode: M,
1261
+ interactionDirection: U,
1262
+ interactionSensitivity: B,
1263
+ rotaryOverlay: x = !1,
1264
+ children: O,
1265
+ valueAsLabel: D = "labelOnly",
1266
+ midiResolution: V,
1267
+ defaultValue: L,
1268
+ onClick: W,
1269
+ onMouseDown: j,
1270
+ onMouseUp: z,
1271
+ onMouseEnter: A,
1272
+ onMouseLeave: Y,
1273
+ className: K,
1274
+ style: X
1275
+ }) {
1276
+ const { style: G } = xe({
1277
+ color: f,
1278
+ roundness: g,
1279
+ style: X
1280
+ }), _ = S !== void 0 ? Ie(S) : void 0, { derivedParameter: F } = tt({
1281
+ parameter: k,
1282
+ paramId: T ?? "adhoc-knob",
1283
+ label: s,
1284
+ min: e,
1285
+ max: t,
1286
+ step: n,
1287
+ bipolar: r,
1288
+ unit: R,
1289
+ scale: N,
1290
+ midiResolution: V,
1291
+ defaultValue: L
1292
+ }), { formattedValue: H } = Re(l, o, F, i), { sizeClassName: ee, sizeStyle: J } = ae(u, m, "knob"), oe = y === "abstract" ? /* @__PURE__ */ b(
1293
+ "div",
1294
+ {
1295
+ style: {
1296
+ width: "100%",
1297
+ height: "100%",
1298
+ display: "flex",
1299
+ alignItems: "center",
1300
+ justifyContent: "center",
1301
+ fontSize: "22cqmin",
1302
+ fontWeight: "500",
1303
+ color: "var(--audioui-text-color)",
1304
+ cursor: "inherit"
1305
+ },
1306
+ children: H
1307
+ }
1308
+ ) : void 0;
1309
+ return /* @__PURE__ */ b(
1310
+ Ae,
1311
+ {
1312
+ min: e,
1313
+ max: t,
1314
+ step: n,
1315
+ bipolar: r,
1316
+ value: l,
1317
+ label: s,
1318
+ displayMode: c,
1319
+ labelMode: h,
1320
+ labelPosition: v,
1321
+ labelAlign: a,
1322
+ labelOverflow: d,
1323
+ labelHeightUnits: w,
1324
+ className: ne(ee, K),
1325
+ style: { ...J, ...G },
1326
+ onChange: o,
1327
+ paramId: T,
1328
+ onClick: W,
1329
+ onMouseDown: j,
1330
+ onMouseUp: z,
1331
+ onMouseEnter: A,
1332
+ onMouseLeave: Y,
1333
+ parameter: k,
1334
+ unit: R,
1335
+ scale: N,
1336
+ midiResolution: V,
1337
+ defaultValue: L,
1338
+ interactionMode: M,
1339
+ interactionDirection: U,
1340
+ interactionSensitivity: B,
1341
+ valueFormatter: i,
1342
+ valueAsLabel: D,
1343
+ view: pe,
1344
+ viewProps: {
1345
+ color: f ?? "var(--audioui-primary-color)",
1346
+ variant: y,
1347
+ thickness: _,
1348
+ roundness: g ?? "var(--audioui-roundness-knob)",
1349
+ openness: p,
1350
+ rotation: P,
1351
+ svgOverlayRotary: x,
1352
+ svgOverlay: O,
1353
+ bipolar: r
1354
+ },
1355
+ htmlOverlay: oe
1356
+ }
1357
+ );
1358
+ }
1359
+ const _n = I.memo(Yt);
1360
+ function jt({
1361
+ value: e,
1362
+ options: t,
1363
+ onValueChange: n,
1364
+ disabled: r = !1,
1365
+ onClick: l,
1366
+ onMouseDown: o,
1367
+ onKeyDown: i
1368
+ }) {
1369
+ const s = de(null);
1370
+ s.current || (s.current = new wt({
1371
+ value: e,
1372
+ options: t,
1373
+ onValueChange: n,
1374
+ disabled: r
1375
+ })), he(() => {
1376
+ s.current?.updateConfig({
1377
+ value: e,
1378
+ options: t,
1379
+ onValueChange: n,
1380
+ disabled: r
1381
+ });
1382
+ }, [e, t, n, r]);
1383
+ const u = E(() => s.current?.cycleNext(), []), m = E(() => s.current?.stepNext(), []), c = E(() => s.current?.stepPrev(), []), h = E(
1384
+ (d) => {
1385
+ l?.(d), d.defaultPrevented || s.current?.handleClick(d.defaultPrevented);
1386
+ },
1387
+ [l]
1388
+ ), v = E(
1389
+ (d) => {
1390
+ d.defaultPrevented || s.current?.handleKeyDown(d.key) && d.preventDefault();
1391
+ },
1392
+ [i]
1393
+ );
1394
+ return {
1395
+ handleClick: h,
1396
+ handleKeyDown: v,
1397
+ handleMouseDown: o,
1398
+ cycleNext: u,
1399
+ stepNext: m,
1400
+ stepPrev: c
1401
+ };
1402
+ }
1403
+ function Ve({
1404
+ children: e,
1405
+ options: t,
1406
+ paramId: n,
1407
+ parameter: r,
1408
+ defaultValue: l,
1409
+ label: o,
1410
+ midiResolution: i = 7,
1411
+ midiMapping: s = "spread"
1412
+ }) {
1413
+ return C(() => {
1414
+ const u = I.Children.toArray(e).filter(
1415
+ I.isValidElement
1416
+ ), m = /* @__PURE__ */ new Map();
1417
+ u.forEach((v, a) => {
1418
+ const d = v.props.value !== void 0 ? v.props.value : a;
1419
+ v.props.children && m.set(d, v.props.children);
1420
+ });
1421
+ let c, h;
1422
+ if (r)
1423
+ c = r, h = l !== void 0 ? l : r.defaultValue ?? r.options[0]?.value ?? "";
1424
+ else if (t && t.length > 0)
1425
+ h = l !== void 0 ? l : t[0].value, c = {
1426
+ id: n ?? "adhoc-discrete",
1427
+ type: "discrete",
1428
+ name: o || "",
1429
+ options: t,
1430
+ defaultValue: h,
1431
+ midiResolution: i,
1432
+ midiMapping: s
1433
+ };
1434
+ else {
1435
+ const v = (d, w) => d.props.label ? d.props.label : typeof d.props.children == "string" ? d.props.children : typeof d.props.children == "number" ? String(d.props.children) : String(w), a = u.map((d, w) => {
1436
+ const f = d.props.value !== void 0 ? d.props.value : w;
1437
+ return {
1438
+ value: f,
1439
+ label: v(d, f)
1440
+ };
1441
+ });
1442
+ a.length === 0 && a.push({ value: 0, label: "None" }), h = l !== void 0 ? l : a[0].value, c = {
1443
+ id: n ?? "adhoc-discrete",
1444
+ type: "discrete",
1445
+ name: o || "",
1446
+ options: a,
1447
+ defaultValue: h,
1448
+ midiResolution: i,
1449
+ midiMapping: s
1450
+ };
1451
+ }
1452
+ return {
1453
+ derivedParameter: c,
1454
+ visualContentMap: m,
1455
+ effectiveDefaultValue: h
1456
+ };
1457
+ }, [r, t, e, o, n, l, i, s]);
1458
+ }
1459
+ function Xt(e) {
1460
+ const {
1461
+ view: t,
1462
+ viewProps: n,
1463
+ htmlOverlay: r,
1464
+ value: l,
1465
+ defaultValue: o,
1466
+ onChange: i,
1467
+ children: s,
1468
+ options: u,
1469
+ label: m,
1470
+ paramId: c,
1471
+ parameter: h,
1472
+ displayMode: v,
1473
+ labelMode: a,
1474
+ labelPosition: d,
1475
+ labelAlign: w,
1476
+ labelOverflow: f,
1477
+ viewBoxWidthUnits: g,
1478
+ viewBoxHeightUnits: y,
1479
+ labelHeightUnits: S,
1480
+ className: p,
1481
+ style: P,
1482
+ onClick: k,
1483
+ onMouseDown: R,
1484
+ onMouseUp: N,
1485
+ onMouseEnter: T,
1486
+ onMouseLeave: M,
1487
+ midiResolution: U,
1488
+ midiMapping: B
1489
+ } = e, { derivedParameter: x, effectiveDefaultValue: O } = Ve({
1490
+ children: s,
1491
+ options: u,
1492
+ paramId: c,
1493
+ parameter: h,
1494
+ defaultValue: o,
1495
+ label: m,
1496
+ midiResolution: U,
1497
+ midiMapping: B
1498
+ }), D = l !== void 0 ? l : O, { normalizedValue: V, setNormalizedValue: L, formattedValue: W, converter: j } = Re(
1499
+ D,
1500
+ i,
1501
+ x
1502
+ ), z = E(
1503
+ (H) => {
1504
+ L(j.normalize(H));
1505
+ },
1506
+ [L, j]
1507
+ ), { handleClick: A, handleKeyDown: Y, handleMouseDown: K } = jt({
1508
+ value: D,
1509
+ options: x.options,
1510
+ onValueChange: z,
1511
+ disabled: !i,
1512
+ // Type cast needed because onClick prop expects React.MouseEvent<SVGSVGElement>
1513
+ // but hook accepts React.MouseEvent
1514
+ onClick: k ? (H) => k(H) : void 0,
1515
+ onMouseDown: R,
1516
+ onKeyDown: void 0
1517
+ // DiscreteControl doesn't have onKeyDown prop, only uses hook handler
1518
+ }), X = m ?? x.name, G = C(() => ne(p, ie.root, ie.container), [p]), _ = C(() => i || k ? ie.highlight : "", [i, k]), F = C(
1519
+ () => ({
1520
+ ...k || i ? { cursor: "var(--audioui-cursor-clickable)" } : {}
1521
+ }),
1522
+ [k, i]
1523
+ );
1524
+ return /* @__PURE__ */ re(
1525
+ Q,
1526
+ {
1527
+ displayMode: v ?? "scaleToFit",
1528
+ labelMode: a,
1529
+ labelOverflow: f,
1530
+ className: G,
1531
+ style: P,
1532
+ labelHeightUnits: S ?? t.labelHeightUnits ?? 20,
1533
+ viewBoxWidth: g ?? t.viewBox.width,
1534
+ viewBoxHeight: y ?? t.viewBox.height,
1535
+ children: [
1536
+ /* @__PURE__ */ b(
1537
+ Q.Svg,
1538
+ {
1539
+ className: _,
1540
+ style: F,
1541
+ onClick: A,
1542
+ onMouseDown: K,
1543
+ onKeyDown: Y,
1544
+ onMouseUp: N,
1545
+ onMouseEnter: T,
1546
+ onMouseLeave: M,
1547
+ tabIndex: 0,
1548
+ role: "spinbutton",
1549
+ "aria-valuenow": typeof D == "number" ? D : void 0,
1550
+ "aria-valuetext": W,
1551
+ "aria-label": X,
1552
+ children: /* @__PURE__ */ b(t, { normalizedValue: V, ...n })
1553
+ }
1554
+ ),
1555
+ r && /* @__PURE__ */ b(Q.HtmlOverlay, { children: r }),
1556
+ X && /* @__PURE__ */ b(Q.Label, { position: d, align: w ?? "center", children: X })
1557
+ ]
1558
+ }
1559
+ );
1560
+ }
1561
+ const ze = I.memo(Xt), Gt = 90, qt = 0, Jt = {
1562
+ width: "100%",
1563
+ height: "100%",
1564
+ display: "flex",
1565
+ alignItems: "center",
1566
+ justifyContent: "center",
1567
+ fontSize: "22cqmin",
1568
+ fontWeight: "500",
1569
+ color: "var(--audioui-text-color)",
1570
+ cursor: "inherit"
1571
+ }, Qt = {
1572
+ width: "50cqmin",
1573
+ height: "50cqmin"
1574
+ };
1575
+ function Zt({
1576
+ value: e,
1577
+ defaultValue: t,
1578
+ onChange: n,
1579
+ renderOption: r,
1580
+ label: l,
1581
+ adaptiveSize: o = !1,
1582
+ size: i = "normal",
1583
+ displayMode: s,
1584
+ labelMode: u,
1585
+ labelPosition: m,
1586
+ labelAlign: c,
1587
+ labelOverflow: h,
1588
+ labelHeightUnits: v,
1589
+ color: a,
1590
+ roundness: d,
1591
+ thickness: w = 0.4,
1592
+ openness: f = Gt,
1593
+ rotation: g = qt,
1594
+ parameter: y,
1595
+ paramId: S,
1596
+ options: p,
1597
+ midiResolution: P,
1598
+ midiMapping: k,
1599
+ onClick: R,
1600
+ onMouseDown: N,
1601
+ onMouseUp: T,
1602
+ onMouseEnter: M,
1603
+ onMouseLeave: U,
1604
+ className: B,
1605
+ style: x,
1606
+ children: O
1607
+ }) {
1608
+ const { style: D, clampedRoundness: V } = xe({
1609
+ color: a,
1610
+ roundness: d,
1611
+ style: x
1612
+ }), L = w !== void 0 ? Ie(w) : void 0, { visualContentMap: W, derivedParameter: j, effectiveDefaultValue: z } = Ve({
1613
+ children: O,
1614
+ options: p,
1615
+ paramId: S,
1616
+ parameter: y,
1617
+ defaultValue: t,
1618
+ label: l,
1619
+ midiResolution: P,
1620
+ midiMapping: k
1621
+ }), A = e !== void 0 ? e : z, Y = C(() => j.options.find((F) => F.value === A)?.label ?? String(A), [j.options, A]), K = C(() => {
1622
+ const _ = (F) => typeof F == "string" || typeof F == "number" ? F : /* @__PURE__ */ b("div", { className: ie.iconWrapper, style: Qt, children: F });
1623
+ if (W && W.has(A))
1624
+ return _(W.get(A));
1625
+ if (r) {
1626
+ const F = j.options.find((H) => H.value === A);
1627
+ if (F) return _(r(F));
1628
+ }
1629
+ return Y;
1630
+ }, [W, A, r, j.options, Y]), { sizeClassName: X, sizeStyle: G } = ae(o, i, "knob");
1631
+ return /* @__PURE__ */ b(
1632
+ ze,
1633
+ {
1634
+ value: e,
1635
+ defaultValue: t,
1636
+ onChange: n,
1637
+ label: l,
1638
+ paramId: S,
1639
+ parameter: y,
1640
+ options: p,
1641
+ midiResolution: P,
1642
+ midiMapping: k,
1643
+ displayMode: s,
1644
+ labelMode: u,
1645
+ labelPosition: m,
1646
+ labelAlign: c,
1647
+ labelOverflow: h,
1648
+ labelHeightUnits: v,
1649
+ className: ne(X, B),
1650
+ style: { ...G, ...D },
1651
+ onClick: R,
1652
+ onMouseDown: N,
1653
+ onMouseUp: T,
1654
+ onMouseEnter: M,
1655
+ onMouseLeave: U,
1656
+ view: pe,
1657
+ viewProps: {
1658
+ bipolar: !1,
1659
+ thickness: L,
1660
+ roundness: V ?? se,
1661
+ openness: f,
1662
+ rotation: g,
1663
+ color: a ?? "var(--audioui-primary-color)"
1664
+ },
1665
+ htmlOverlay: /* @__PURE__ */ b("div", { style: Jt, children: K }),
1666
+ children: O
1667
+ }
1668
+ );
1669
+ }
1670
+ const Fn = I.memo(Zt);
1671
+ function en({
1672
+ cx: e,
1673
+ cy: t,
1674
+ length: n,
1675
+ rotation: r = 0,
1676
+ thickness: l,
1677
+ roundness: o = se,
1678
+ className: i,
1679
+ style: s
1680
+ }) {
1681
+ const u = C(() => {
1682
+ if (typeof o == "string")
1683
+ return o;
1684
+ const v = Be(o ?? se);
1685
+ return v === 0 ? 0 : v;
1686
+ }, [o]), m = C(() => e - l / 2, [e, l]), c = C(() => t - n / 2, [t, n]), h = C(() => {
1687
+ if (r !== 0)
1688
+ return `rotate(${-r} ${e} ${t})`;
1689
+ }, [r, e, t]);
1690
+ return /* @__PURE__ */ b(
1691
+ "rect",
1692
+ {
1693
+ style: {
1694
+ ...s,
1695
+ rx: u,
1696
+ ry: u
1697
+ },
1698
+ x: m,
1699
+ y: c,
1700
+ width: l,
1701
+ height: n,
1702
+ rx: typeof u == "number" ? u : 0,
1703
+ ry: typeof u == "number" ? u : 0,
1704
+ transform: h,
1705
+ className: i
1706
+ }
1707
+ );
1708
+ }
1709
+ const tn = I.memo(en);
1710
+ function nn({
1711
+ cx: e,
1712
+ cy: t,
1713
+ length: n,
1714
+ rotation: r = 0,
1715
+ thickness: l,
1716
+ roundness: o = se,
1717
+ normalizedValue: i,
1718
+ bipolar: s = !1,
1719
+ className: u,
1720
+ style: m
1721
+ }) {
1722
+ const c = C(() => {
1723
+ if (typeof o == "string")
1724
+ return o;
1725
+ const a = Be(o ?? se);
1726
+ return a === 0 ? 0 : a;
1727
+ }, [o]), h = C(() => {
1728
+ const a = Je(t, n, i), d = e - l / 2, w = l;
1729
+ let f, g;
1730
+ return s ? (g = Math.abs(t - a), f = Math.min(t, a)) : (g = t + n / 2 - a, f = a), { x: d, y: f, width: w, height: g };
1731
+ }, [e, t, n, l, i, s]), v = C(() => {
1732
+ if (r !== 0)
1733
+ return `rotate(${-r} ${e} ${t})`;
1734
+ }, [r, e, t]);
1735
+ return h.height <= 1e-3 ? null : /* @__PURE__ */ b(
1736
+ "rect",
1737
+ {
1738
+ style: {
1739
+ ...m,
1740
+ rx: c,
1741
+ ry: c
1742
+ },
1743
+ x: h.x,
1744
+ y: h.y,
1745
+ width: h.width,
1746
+ height: h.height,
1747
+ rx: typeof c == "number" ? c : 0,
1748
+ ry: typeof c == "number" ? c : 0,
1749
+ transform: v,
1750
+ className: u
1751
+ }
1752
+ );
1753
+ }
1754
+ const on = I.memo(nn);
1755
+ function rn({
1756
+ cx: e,
1757
+ cy: t,
1758
+ length: n,
1759
+ rotation: r = 0,
1760
+ normalizedValue: l,
1761
+ width: o,
1762
+ aspectRatio: i,
1763
+ imageHref: s,
1764
+ roundness: u = se,
1765
+ className: m,
1766
+ style: c
1767
+ }) {
1768
+ const h = Je(t, n, l), v = C(() => o / i, [o, i]), a = C(() => {
1769
+ if (typeof u == "string")
1770
+ return u;
1771
+ const y = Be(u ?? se);
1772
+ return y === 0 ? 0 : y;
1773
+ }, [u]), d = C(() => typeof u == "string" ? !1 : (u ?? se) >= 1, [u]), w = C(() => e - o / 2, [e, o]), f = h - v / 2, g = C(() => {
1774
+ if (r !== 0)
1775
+ return `rotate(${-r} ${e} ${t})`;
1776
+ }, [r, e, t]);
1777
+ return s ? /* @__PURE__ */ b(
1778
+ "image",
1779
+ {
1780
+ href: s,
1781
+ x: e - o / 2,
1782
+ y: h - o / 2,
1783
+ width: o,
1784
+ height: o,
1785
+ transform: g,
1786
+ className: m,
1787
+ style: c,
1788
+ preserveAspectRatio: "xMidYMid meet"
1789
+ }
1790
+ ) : d ? /* @__PURE__ */ b(
1791
+ "ellipse",
1792
+ {
1793
+ cx: e,
1794
+ cy: h,
1795
+ rx: o / 2,
1796
+ ry: v / 2,
1797
+ transform: g,
1798
+ className: m,
1799
+ style: c
1800
+ }
1801
+ ) : /* @__PURE__ */ b(
1802
+ "rect",
1803
+ {
1804
+ x: w,
1805
+ y: f,
1806
+ width: o,
1807
+ height: v,
1808
+ rx: typeof a == "number" ? a : 0,
1809
+ ry: typeof a == "number" ? a : 0,
1810
+ transform: g,
1811
+ className: m,
1812
+ style: {
1813
+ ...c,
1814
+ rx: a,
1815
+ ry: a
1816
+ }
1817
+ }
1818
+ );
1819
+ }
1820
+ const ln = I.memo(rn), Xe = 30, sn = 30;
1821
+ function Ee({
1822
+ normalizedValue: e,
1823
+ bipolar: t = !1,
1824
+ variant: n = "abstract",
1825
+ orientation: r = "vertical",
1826
+ thickness: l = 0.4,
1827
+ roundness: o = se,
1828
+ cursorSize: i,
1829
+ cursorAspectRatio: s,
1830
+ cursorRoundness: u,
1831
+ cursorImageHref: m,
1832
+ cursorClassName: c,
1833
+ cursorStyle: h,
1834
+ className: v
1835
+ }) {
1836
+ const a = C(() => gt(l), [l]), { cx: d, cy: w, rotation: f } = C(() => r === "vertical" ? {
1837
+ cx: 50,
1838
+ cy: 150,
1839
+ rotation: 0
1840
+ } : {
1841
+ cx: 150,
1842
+ cy: 50,
1843
+ rotation: -90
1844
+ }, [r]), g = C(() => n === "trackfull" ? 25 * l + 5 : 0, [n, l]), y = C(() => {
1845
+ if (i !== "None") {
1846
+ if (i)
1847
+ switch (i) {
1848
+ case "Strip":
1849
+ return n !== "stripless" ? a - g : a;
1850
+ case "Track":
1851
+ return a;
1852
+ case "Tick":
1853
+ return a + Xe;
1854
+ case "Label":
1855
+ return a + Xe + sn;
1856
+ default:
1857
+ return;
1858
+ }
1859
+ return n !== "abstract" ? a - g : void 0;
1860
+ }
1861
+ }, [i, a, g, n]), S = y !== void 0, p = u ?? o, P = C(() => !S || y === void 0 ? 0 : m ? y : y / (s ?? 1), [S, y, s, m]), k = C(() => 260 - P, [P]), R = C(() => 260 - g, [g]), N = C(
1862
+ () => ({
1863
+ fill: n === "abstract" ? `var(${te.primary20})` : `var(${te.sliderTrackColor})`
1864
+ }),
1865
+ [n]
1866
+ ), T = C(
1867
+ () => ({
1868
+ fill: `var(${te.sliderStripColor})`
1869
+ }),
1870
+ []
1871
+ ), M = C(
1872
+ () => ({
1873
+ fill: `var(${te.sliderCursorColor})`,
1874
+ stroke: `var(${te.sliderCursorBorderColor})`,
1875
+ strokeWidth: `var(${te.sliderCursorBorderWidth})`,
1876
+ ...h
1877
+ }),
1878
+ [h]
1879
+ );
1880
+ return /* @__PURE__ */ re("g", { className: v, children: [
1881
+ /* @__PURE__ */ b(
1882
+ tn,
1883
+ {
1884
+ cx: d,
1885
+ cy: w,
1886
+ length: 260,
1887
+ thickness: a,
1888
+ rotation: f,
1889
+ roundness: o,
1890
+ style: N
1891
+ }
1892
+ ),
1893
+ n !== "stripless" ? /* @__PURE__ */ b(
1894
+ on,
1895
+ {
1896
+ cx: d,
1897
+ cy: w,
1898
+ length: R,
1899
+ thickness: a - g,
1900
+ rotation: f,
1901
+ roundness: o,
1902
+ normalizedValue: e,
1903
+ bipolar: t,
1904
+ style: T
1905
+ }
1906
+ ) : void 0,
1907
+ S && y !== void 0 ? /* @__PURE__ */ b(
1908
+ ln,
1909
+ {
1910
+ cx: d,
1911
+ cy: w,
1912
+ length: k,
1913
+ rotation: f,
1914
+ normalizedValue: e,
1915
+ width: y,
1916
+ aspectRatio: s ?? 1,
1917
+ roundness: p,
1918
+ imageHref: m,
1919
+ className: c,
1920
+ style: M
1921
+ }
1922
+ ) : void 0
1923
+ ] });
1924
+ }
1925
+ const Oe = {
1926
+ vertical: {
1927
+ width: 100,
1928
+ height: 300
1929
+ },
1930
+ horizontal: {
1931
+ width: 300,
1932
+ height: 100
1933
+ }
1934
+ };
1935
+ Ee.viewBox = Oe;
1936
+ function an(e) {
1937
+ return /* @__PURE__ */ b(Ee, { ...e, orientation: "vertical" });
1938
+ }
1939
+ const be = I.memo(an);
1940
+ be.viewBox = Oe.vertical;
1941
+ be.labelHeightUnits = 40;
1942
+ be.interaction = {
1943
+ mode: "both",
1944
+ direction: "vertical"
1945
+ };
1946
+ be.title = "Vertical Slider";
1947
+ be.description = "A vertical fader control with linear fill indicator";
1948
+ const cn = be;
1949
+ function un(e) {
1950
+ return /* @__PURE__ */ b(Ee, { ...e, orientation: "horizontal" });
1951
+ }
1952
+ const Se = I.memo(un);
1953
+ Se.viewBox = Oe.horizontal;
1954
+ Se.labelHeightUnits = 40;
1955
+ Se.interaction = {
1956
+ mode: "both",
1957
+ direction: "horizontal"
1958
+ };
1959
+ Se.title = "Horizontal Slider";
1960
+ Se.description = "A horizontal fader control with linear fill indicator";
1961
+ const dn = Se, Wn = I.memo(Ee);
1962
+ function fn({
1963
+ orientation: e = "vertical",
1964
+ min: t,
1965
+ max: n,
1966
+ step: r,
1967
+ bipolar: l = !1,
1968
+ value: o,
1969
+ onChange: i,
1970
+ valueFormatter: s,
1971
+ label: u,
1972
+ adaptiveSize: m = !1,
1973
+ size: c = "normal",
1974
+ displayMode: h,
1975
+ labelMode: v,
1976
+ labelPosition: a,
1977
+ labelAlign: d,
1978
+ labelOverflow: w,
1979
+ labelHeightUnits: f,
1980
+ color: g,
1981
+ roundness: y,
1982
+ variant: S = "abstract",
1983
+ thickness: p = 0.5,
1984
+ parameter: P,
1985
+ unit: k,
1986
+ scale: R,
1987
+ paramId: N,
1988
+ interactionMode: T,
1989
+ interactionDirection: M,
1990
+ interactionSensitivity: U,
1991
+ valueAsLabel: B = "labelOnly",
1992
+ midiResolution: x,
1993
+ defaultValue: O,
1994
+ onClick: D,
1995
+ onMouseDown: V,
1996
+ onMouseUp: L,
1997
+ onMouseEnter: W,
1998
+ onMouseLeave: j,
1999
+ className: z,
2000
+ style: A,
2001
+ cursorSize: Y,
2002
+ cursorAspectRatio: K,
2003
+ cursorRoundness: X,
2004
+ cursorImageHref: G,
2005
+ cursorClassName: _,
2006
+ cursorStyle: F
2007
+ }) {
2008
+ const { style: H } = xe({
2009
+ color: g,
2010
+ roundness: y,
2011
+ style: A
2012
+ }), ee = p !== void 0 ? Ie(p) : void 0, { sizeClassName: J, sizeStyle: oe } = ae(m, c, "slider", e), $ = ne(J, z), Z = e === "vertical" ? cn : dn;
2013
+ return /* @__PURE__ */ b(
2014
+ Ae,
2015
+ {
2016
+ min: t,
2017
+ max: n,
2018
+ step: r,
2019
+ bipolar: l,
2020
+ value: o,
2021
+ label: u,
2022
+ displayMode: h,
2023
+ labelMode: v,
2024
+ labelPosition: a,
2025
+ labelAlign: d,
2026
+ labelOverflow: w,
2027
+ labelHeightUnits: f,
2028
+ className: $,
2029
+ style: { ...oe, ...H },
2030
+ onChange: i,
2031
+ paramId: N,
2032
+ onClick: D,
2033
+ onMouseDown: V,
2034
+ onMouseUp: L,
2035
+ onMouseEnter: W,
2036
+ onMouseLeave: j,
2037
+ parameter: P,
2038
+ unit: k,
2039
+ scale: R,
2040
+ midiResolution: x,
2041
+ defaultValue: O,
2042
+ interactionMode: T,
2043
+ interactionDirection: M,
2044
+ interactionSensitivity: U,
2045
+ valueFormatter: s,
2046
+ valueAsLabel: B,
2047
+ view: Z,
2048
+ viewProps: {
2049
+ color: g ?? "var(--audioui-primary-color)",
2050
+ variant: S,
2051
+ thickness: ee,
2052
+ roundness: y ?? "var(--audioui-roundness-slider)",
2053
+ bipolar: l,
2054
+ cursorSize: Y,
2055
+ cursorAspectRatio: K,
2056
+ cursorRoundness: X,
2057
+ cursorImageHref: G,
2058
+ cursorClassName: _,
2059
+ cursorStyle: F
2060
+ }
2061
+ }
2062
+ );
2063
+ }
2064
+ const Kn = I.memo(fn);
2065
+ function hn({
2066
+ x: e = 0,
2067
+ y: t = 0,
2068
+ frameWidth: n,
2069
+ frameHeight: r,
2070
+ frameCount: l,
2071
+ normalizedValue: o,
2072
+ imageHref: i,
2073
+ orientation: s = "vertical",
2074
+ frameRotation: u = 0,
2075
+ invertValue: m = !1,
2076
+ className: c,
2077
+ style: h
2078
+ }) {
2079
+ const v = m ? 1 - o : o, a = Math.max(0, Math.min(1, v)), d = Math.round(a * (l - 1)), w = s === "horizontal" ? n * l : n, f = s === "vertical" ? r * l : r, g = s === "horizontal" ? d * n : 0, y = s === "vertical" ? d * r : 0, S = e + n / 2, p = t + r / 2;
2080
+ return /* @__PURE__ */ b("g", { className: c, style: h, transform: `rotate(${u}, ${S}, ${p})`, children: /* @__PURE__ */ b(
2081
+ "svg",
2082
+ {
2083
+ x: e,
2084
+ y: t,
2085
+ width: n,
2086
+ height: r,
2087
+ viewBox: `0 0 ${n} ${r}`,
2088
+ preserveAspectRatio: "none",
2089
+ style: { overflow: "hidden" },
2090
+ children: /* @__PURE__ */ b(
2091
+ "image",
2092
+ {
2093
+ href: i,
2094
+ width: w,
2095
+ height: f,
2096
+ preserveAspectRatio: "none",
2097
+ style: {
2098
+ transform: `translate(${-g}px, ${-y}px)`,
2099
+ willChange: "transform"
2100
+ }
2101
+ }
2102
+ )
2103
+ }
2104
+ ) });
2105
+ }
2106
+ const mn = I.memo(hn);
2107
+ function vn({
2108
+ normalizedValue: e,
2109
+ frameWidth: t,
2110
+ frameHeight: n,
2111
+ frameCount: r,
2112
+ imageHref: l,
2113
+ orientation: o = "vertical",
2114
+ frameRotation: i = 0,
2115
+ invertValue: s = !1,
2116
+ className: u
2117
+ }) {
2118
+ return /* @__PURE__ */ b(
2119
+ mn,
2120
+ {
2121
+ x: 0,
2122
+ y: 0,
2123
+ frameWidth: t,
2124
+ frameHeight: n,
2125
+ frameCount: r,
2126
+ normalizedValue: e,
2127
+ imageHref: l,
2128
+ orientation: o,
2129
+ frameRotation: i,
2130
+ invertValue: s,
2131
+ className: u
2132
+ }
2133
+ );
2134
+ }
2135
+ const me = I.memo(vn);
2136
+ me.viewBox = { width: 100, height: 100 };
2137
+ me.labelHeightUnits = 20;
2138
+ me.interaction = {
2139
+ mode: "both",
2140
+ direction: "vertical"
2141
+ };
2142
+ me.title = "Filmstrip";
2143
+ me.description = "A filmstrip control that displays frames from a sprite sheet";
2144
+ function pn({
2145
+ min: e,
2146
+ max: t,
2147
+ step: n,
2148
+ bipolar: r = !1,
2149
+ value: l,
2150
+ onChange: o,
2151
+ valueFormatter: i,
2152
+ label: s,
2153
+ adaptiveSize: u = !1,
2154
+ size: m = "normal",
2155
+ displayMode: c,
2156
+ labelMode: h,
2157
+ labelPosition: v,
2158
+ labelAlign: a,
2159
+ frameWidth: d,
2160
+ frameHeight: w,
2161
+ frameCount: f,
2162
+ imageHref: g,
2163
+ orientation: y = "vertical",
2164
+ frameRotation: S = 0,
2165
+ parameter: p,
2166
+ unit: P,
2167
+ scale: k,
2168
+ paramId: R,
2169
+ interactionMode: N,
2170
+ interactionDirection: T,
2171
+ interactionSensitivity: M,
2172
+ valueAsLabel: U = "labelOnly",
2173
+ midiResolution: B,
2174
+ defaultValue: x,
2175
+ invertValue: O = !1,
2176
+ onClick: D,
2177
+ onMouseDown: V,
2178
+ onMouseUp: L,
2179
+ onMouseEnter: W,
2180
+ onMouseLeave: j,
2181
+ className: z,
2182
+ style: A
2183
+ }) {
2184
+ const { sizeClassName: Y, sizeStyle: K } = ae(u, m, "knob");
2185
+ return /* @__PURE__ */ b(
2186
+ Ae,
2187
+ {
2188
+ min: e,
2189
+ max: t,
2190
+ step: n,
2191
+ bipolar: r,
2192
+ value: l,
2193
+ label: s,
2194
+ displayMode: c,
2195
+ labelMode: h,
2196
+ labelPosition: v,
2197
+ labelAlign: a,
2198
+ className: ne(Y, z),
2199
+ style: { ...K, ...A },
2200
+ onChange: o,
2201
+ paramId: R,
2202
+ onClick: D,
2203
+ onMouseDown: V,
2204
+ onMouseUp: L,
2205
+ onMouseEnter: W,
2206
+ onMouseLeave: j,
2207
+ parameter: p,
2208
+ unit: P,
2209
+ scale: k,
2210
+ midiResolution: B,
2211
+ defaultValue: x,
2212
+ interactionMode: N,
2213
+ interactionDirection: T,
2214
+ interactionSensitivity: M,
2215
+ valueFormatter: i,
2216
+ valueAsLabel: U,
2217
+ viewBoxWidthUnits: d,
2218
+ viewBoxHeightUnits: w,
2219
+ view: me,
2220
+ viewProps: {
2221
+ frameWidth: d,
2222
+ frameHeight: w,
2223
+ frameCount: f,
2224
+ imageHref: g,
2225
+ orientation: y,
2226
+ frameRotation: S,
2227
+ invertValue: O
2228
+ }
2229
+ }
2230
+ );
2231
+ }
2232
+ const Hn = I.memo(pn);
2233
+ function yn({
2234
+ value: e,
2235
+ defaultValue: t,
2236
+ onChange: n,
2237
+ label: r,
2238
+ adaptiveSize: l = !1,
2239
+ size: o = "normal",
2240
+ displayMode: i,
2241
+ labelMode: s,
2242
+ labelPosition: u,
2243
+ labelAlign: m,
2244
+ frameWidth: c,
2245
+ frameHeight: h,
2246
+ frameCount: v,
2247
+ imageHref: a,
2248
+ orientation: d = "vertical",
2249
+ frameRotation: w = 0,
2250
+ parameter: f,
2251
+ paramId: g,
2252
+ options: y,
2253
+ midiResolution: S,
2254
+ midiMapping: p,
2255
+ children: P,
2256
+ onClick: k,
2257
+ onMouseDown: R,
2258
+ onMouseUp: N,
2259
+ onMouseEnter: T,
2260
+ onMouseLeave: M,
2261
+ className: U,
2262
+ style: B
2263
+ }) {
2264
+ const { sizeClassName: x, sizeStyle: O } = ae(l, o, "knob");
2265
+ return /* @__PURE__ */ b(
2266
+ ze,
2267
+ {
2268
+ value: e,
2269
+ defaultValue: t,
2270
+ onChange: n,
2271
+ label: r,
2272
+ paramId: g,
2273
+ parameter: f,
2274
+ options: y,
2275
+ midiResolution: S,
2276
+ midiMapping: p,
2277
+ displayMode: i,
2278
+ labelMode: s,
2279
+ labelPosition: u,
2280
+ labelAlign: m,
2281
+ className: ne(x, U),
2282
+ style: { ...O, ...B },
2283
+ onClick: k,
2284
+ onMouseDown: R,
2285
+ onMouseUp: N,
2286
+ onMouseEnter: T,
2287
+ onMouseLeave: M,
2288
+ viewBoxWidthUnits: c,
2289
+ viewBoxHeightUnits: h,
2290
+ view: me,
2291
+ viewProps: {
2292
+ frameWidth: c,
2293
+ frameHeight: h,
2294
+ frameCount: v,
2295
+ imageHref: a,
2296
+ orientation: d,
2297
+ frameRotation: w
2298
+ },
2299
+ children: P
2300
+ }
2301
+ );
2302
+ }
2303
+ const Yn = I.memo(yn);
2304
+ function wn({
2305
+ latch: e = !1,
2306
+ value: t = !1,
2307
+ onChange: n,
2308
+ label: r,
2309
+ adaptiveSize: l = !1,
2310
+ size: o = "normal",
2311
+ displayMode: i,
2312
+ labelMode: s,
2313
+ labelPosition: u,
2314
+ labelAlign: m,
2315
+ frameWidth: c,
2316
+ frameHeight: h,
2317
+ frameCount: v,
2318
+ imageHref: a,
2319
+ orientation: d = "vertical",
2320
+ frameRotation: w = 0,
2321
+ invertValue: f = !1,
2322
+ parameter: g,
2323
+ paramId: y,
2324
+ midiResolution: S,
2325
+ onClick: p,
2326
+ onMouseDown: P,
2327
+ onMouseUp: k,
2328
+ onMouseEnter: R,
2329
+ onMouseLeave: N,
2330
+ className: T,
2331
+ style: M
2332
+ }) {
2333
+ const { sizeClassName: U, sizeStyle: B } = ae(l, o, "button");
2334
+ return /* @__PURE__ */ b(
2335
+ Ue,
2336
+ {
2337
+ value: t,
2338
+ onChange: n,
2339
+ label: r,
2340
+ displayMode: i,
2341
+ labelMode: s,
2342
+ labelPosition: u,
2343
+ labelAlign: m,
2344
+ className: ne(U, T),
2345
+ style: { ...B, ...M },
2346
+ parameter: g,
2347
+ paramId: y,
2348
+ latch: e,
2349
+ midiResolution: S,
2350
+ onClick: p,
2351
+ onMouseDown: P,
2352
+ onMouseUp: k,
2353
+ onMouseEnter: R,
2354
+ onMouseLeave: N,
2355
+ viewBoxWidthUnits: c,
2356
+ viewBoxHeightUnits: h,
2357
+ view: me,
2358
+ viewProps: {
2359
+ frameWidth: c,
2360
+ frameHeight: h,
2361
+ frameCount: v,
2362
+ imageHref: a,
2363
+ orientation: d,
2364
+ frameRotation: w,
2365
+ invertValue: f
2366
+ }
2367
+ }
2368
+ );
2369
+ }
2370
+ const jn = I.memo(wn);
2371
+ function gn({
2372
+ normalizedValue: e,
2373
+ frameWidth: t,
2374
+ frameHeight: n,
2375
+ imageHref: r,
2376
+ rotation: l = 0,
2377
+ openness: o = 90,
2378
+ bipolar: i = !1,
2379
+ positions: s,
2380
+ className: u
2381
+ }) {
2382
+ const m = t / 2, c = n / 2, h = Math.min(t, n) / 2;
2383
+ return /* @__PURE__ */ b(
2384
+ Ne,
2385
+ {
2386
+ cx: m,
2387
+ cy: c,
2388
+ radius: h,
2389
+ normalizedValue: e,
2390
+ imageHref: r,
2391
+ rotation: l,
2392
+ openness: o,
2393
+ bipolar: i,
2394
+ positions: s,
2395
+ className: u
2396
+ }
2397
+ );
2398
+ }
2399
+ const ye = I.memo(gn);
2400
+ ye.viewBox = { width: 100, height: 100 };
2401
+ ye.labelHeightUnits = 20;
2402
+ ye.interaction = {
2403
+ mode: "both",
2404
+ direction: "circular"
2405
+ };
2406
+ ye.title = "Rotary Image";
2407
+ ye.description = "A rotary control that rotates an image based on value";
2408
+ function bn({
2409
+ min: e,
2410
+ max: t,
2411
+ step: n,
2412
+ bipolar: r = !1,
2413
+ value: l,
2414
+ onChange: o,
2415
+ valueFormatter: i,
2416
+ label: s,
2417
+ adaptiveSize: u = !1,
2418
+ size: m = "normal",
2419
+ displayMode: c,
2420
+ labelMode: h,
2421
+ labelPosition: v,
2422
+ labelAlign: a,
2423
+ frameWidth: d,
2424
+ frameHeight: w,
2425
+ imageHref: f,
2426
+ rotation: g = 0,
2427
+ openness: y = 90,
2428
+ parameter: S,
2429
+ unit: p,
2430
+ scale: P,
2431
+ paramId: k,
2432
+ interactionMode: R,
2433
+ interactionDirection: N,
2434
+ interactionSensitivity: T,
2435
+ valueAsLabel: M = "labelOnly",
2436
+ midiResolution: U,
2437
+ defaultValue: B,
2438
+ onClick: x,
2439
+ onMouseDown: O,
2440
+ onMouseUp: D,
2441
+ onMouseEnter: V,
2442
+ onMouseLeave: L,
2443
+ className: W,
2444
+ style: j
2445
+ }) {
2446
+ const { sizeClassName: z, sizeStyle: A } = ae(u, m, "knob");
2447
+ return /* @__PURE__ */ b(
2448
+ Ae,
2449
+ {
2450
+ min: e,
2451
+ max: t,
2452
+ step: n,
2453
+ bipolar: r,
2454
+ value: l,
2455
+ label: s,
2456
+ displayMode: c,
2457
+ labelMode: h,
2458
+ labelPosition: v,
2459
+ labelAlign: a,
2460
+ className: ne(z, W),
2461
+ style: { ...A, ...j },
2462
+ onChange: o,
2463
+ paramId: k,
2464
+ onClick: x,
2465
+ onMouseDown: O,
2466
+ onMouseUp: D,
2467
+ onMouseEnter: V,
2468
+ onMouseLeave: L,
2469
+ parameter: S,
2470
+ unit: p,
2471
+ scale: P,
2472
+ midiResolution: U,
2473
+ defaultValue: B,
2474
+ interactionMode: R,
2475
+ interactionDirection: N,
2476
+ interactionSensitivity: T,
2477
+ valueFormatter: i,
2478
+ valueAsLabel: M,
2479
+ viewBoxWidthUnits: d,
2480
+ viewBoxHeightUnits: w,
2481
+ view: ye,
2482
+ viewProps: {
2483
+ frameWidth: d,
2484
+ frameHeight: w,
2485
+ imageHref: f,
2486
+ rotation: g,
2487
+ openness: y,
2488
+ bipolar: r
2489
+ }
2490
+ }
2491
+ );
2492
+ }
2493
+ const Xn = I.memo(bn);
2494
+ function Sn({
2495
+ value: e,
2496
+ defaultValue: t,
2497
+ onChange: n,
2498
+ label: r,
2499
+ adaptiveSize: l = !1,
2500
+ size: o = "normal",
2501
+ displayMode: i,
2502
+ labelMode: s,
2503
+ labelPosition: u,
2504
+ labelAlign: m,
2505
+ frameWidth: c,
2506
+ frameHeight: h,
2507
+ imageHref: v,
2508
+ rotation: a = 0,
2509
+ openness: d = 90,
2510
+ parameter: w,
2511
+ paramId: f,
2512
+ options: g,
2513
+ midiResolution: y,
2514
+ midiMapping: S,
2515
+ children: p,
2516
+ onClick: P,
2517
+ onMouseDown: k,
2518
+ onMouseUp: R,
2519
+ onMouseEnter: N,
2520
+ onMouseLeave: T,
2521
+ className: M,
2522
+ style: U
2523
+ }) {
2524
+ const { sizeClassName: B, sizeStyle: x } = ae(l, o, "knob"), { derivedParameter: O } = Ve({
2525
+ children: p,
2526
+ options: g,
2527
+ paramId: f,
2528
+ parameter: w,
2529
+ defaultValue: t,
2530
+ label: r,
2531
+ midiResolution: y,
2532
+ midiMapping: S
2533
+ }), D = C(() => O.options.length, [O.options.length]);
2534
+ return /* @__PURE__ */ b(
2535
+ ze,
2536
+ {
2537
+ value: e,
2538
+ defaultValue: t,
2539
+ onChange: n,
2540
+ label: r,
2541
+ paramId: f,
2542
+ parameter: w,
2543
+ options: g,
2544
+ midiResolution: y,
2545
+ midiMapping: S,
2546
+ displayMode: i,
2547
+ labelMode: s,
2548
+ labelPosition: u,
2549
+ labelAlign: m,
2550
+ className: ne(B, M),
2551
+ style: { ...x, ...U },
2552
+ onClick: P,
2553
+ onMouseDown: k,
2554
+ onMouseUp: R,
2555
+ onMouseEnter: N,
2556
+ onMouseLeave: T,
2557
+ viewBoxWidthUnits: c,
2558
+ viewBoxHeightUnits: h,
2559
+ view: ye,
2560
+ viewProps: {
2561
+ frameWidth: c,
2562
+ frameHeight: h,
2563
+ imageHref: v,
2564
+ rotation: a,
2565
+ openness: d,
2566
+ positions: D
2567
+ },
2568
+ children: p
2569
+ }
2570
+ );
2571
+ }
2572
+ const Gn = I.memo(Sn);
2573
+ function Cn({ x: e = 0, y: t = 0, width: n, height: r, imageHref: l, children: o, transform: i, className: s, style: u }) {
2574
+ return /* @__PURE__ */ re("g", { className: s, style: u, transform: i, children: [
2575
+ l && /* @__PURE__ */ b("image", { href: l, x: e, y: t, width: n, height: r, preserveAspectRatio: "xMidYMid meet" }),
2576
+ o && /* @__PURE__ */ b(
2577
+ "svg",
2578
+ {
2579
+ x: e,
2580
+ y: t,
2581
+ width: n,
2582
+ height: r,
2583
+ viewBox: `0 0 ${n} ${r}`,
2584
+ style: { overflow: "visible", ...u?.color ? { color: u.color } : {} },
2585
+ children: o
2586
+ }
2587
+ )
2588
+ ] });
2589
+ }
2590
+ const xn = I.memo(Cn);
2591
+ function Mn({
2592
+ normalizedValue: e,
2593
+ frameWidth: t,
2594
+ frameHeight: n,
2595
+ imageHrefFalse: r,
2596
+ imageHrefTrue: l,
2597
+ className: o
2598
+ }) {
2599
+ const i = e > 0.5 ? l : r;
2600
+ return /* @__PURE__ */ b(xn, { x: 0, y: 0, width: t, height: n, imageHref: i, className: o });
2601
+ }
2602
+ const Ce = I.memo(Mn);
2603
+ Ce.viewBox = { width: 100, height: 100 };
2604
+ Ce.labelHeightUnits = 20;
2605
+ Ce.interaction = {
2606
+ mode: "both",
2607
+ direction: "vertical"
2608
+ };
2609
+ Ce.title = "Image Switch";
2610
+ Ce.description = "A boolean control that displays one of two images based on value";
2611
+ function kn({
2612
+ latch: e = !1,
2613
+ value: t = !1,
2614
+ onChange: n,
2615
+ label: r,
2616
+ adaptiveSize: l = !1,
2617
+ size: o = "normal",
2618
+ displayMode: i,
2619
+ labelMode: s,
2620
+ labelPosition: u,
2621
+ labelAlign: m,
2622
+ frameWidth: c,
2623
+ frameHeight: h,
2624
+ imageHrefFalse: v,
2625
+ imageHrefTrue: a,
2626
+ parameter: d,
2627
+ paramId: w,
2628
+ midiResolution: f,
2629
+ onClick: g,
2630
+ onMouseDown: y,
2631
+ onMouseUp: S,
2632
+ onMouseEnter: p,
2633
+ onMouseLeave: P,
2634
+ className: k,
2635
+ style: R
2636
+ }) {
2637
+ const { sizeClassName: N, sizeStyle: T } = ae(l, o, "button");
2638
+ return /* @__PURE__ */ b(
2639
+ Ue,
2640
+ {
2641
+ value: t,
2642
+ onChange: n,
2643
+ label: r,
2644
+ displayMode: i,
2645
+ labelMode: s,
2646
+ labelPosition: u,
2647
+ labelAlign: m,
2648
+ className: ne(N, k),
2649
+ style: { ...T, ...R },
2650
+ parameter: d,
2651
+ paramId: w,
2652
+ latch: e,
2653
+ midiResolution: f,
2654
+ onClick: g,
2655
+ onMouseDown: y,
2656
+ onMouseUp: S,
2657
+ onMouseEnter: p,
2658
+ onMouseLeave: P,
2659
+ viewBoxWidthUnits: c,
2660
+ viewBoxHeightUnits: h,
2661
+ view: Ce,
2662
+ viewProps: {
2663
+ frameWidth: c,
2664
+ frameHeight: h,
2665
+ imageHrefFalse: v,
2666
+ imageHrefTrue: a
2667
+ }
2668
+ }
2669
+ );
2670
+ }
2671
+ const qn = I.memo(kn);
2672
+ function Tn({
2673
+ cx: e,
2674
+ cy: t,
2675
+ radius: n,
2676
+ children: r,
2677
+ className: l,
2678
+ style: o,
2679
+ pointerEvents: i = "none"
2680
+ }) {
2681
+ const s = n * 2, u = e - n, m = t - n;
2682
+ return /* @__PURE__ */ b(
2683
+ "foreignObject",
2684
+ {
2685
+ x: u,
2686
+ y: m,
2687
+ width: s,
2688
+ height: s,
2689
+ className: l,
2690
+ style: {
2691
+ pointerEvents: i,
2692
+ ...o
2693
+ },
2694
+ children: /* @__PURE__ */ b(
2695
+ "div",
2696
+ {
2697
+ xmlns: "http://www.w3.org/1999/xhtml",
2698
+ style: {
2699
+ // Use 100% to fill the foreignObject (which is sized in SVG user units)
2700
+ // Do NOT use explicit pixels here, as that breaks SVG scaling (viewBox).
2701
+ width: "100%",
2702
+ height: "100%",
2703
+ display: "flex",
2704
+ alignItems: "center",
2705
+ justifyContent: "center",
2706
+ textAlign: "center"
2707
+ },
2708
+ children: r
2709
+ }
2710
+ )
2711
+ }
2712
+ );
2713
+ }
2714
+ const Jn = I.memo(Tn);
2715
+ function Pn({ normalizedValue: e, resolution: t = 100, className: n, style: r, ...l }) {
2716
+ const o = Math.max(0, Math.min(1, e)), i = Number(t), s = i * (1 - o);
2717
+ return /* @__PURE__ */ b(
2718
+ "path",
2719
+ {
2720
+ ...l,
2721
+ className: n,
2722
+ pathLength: i,
2723
+ strokeDasharray: i,
2724
+ strokeDashoffset: s,
2725
+ style: r
2726
+ }
2727
+ );
2728
+ }
2729
+ const Qn = I.memo(Pn);
2730
+ function Nn({
2731
+ cx: e,
2732
+ cy: t,
2733
+ radius: n,
2734
+ thickness: r = 4,
2735
+ openness: l = 90,
2736
+ rotation: o = 0,
2737
+ count: i,
2738
+ step: s,
2739
+ variant: u = "line",
2740
+ renderTick: m,
2741
+ className: c,
2742
+ style: h
2743
+ }) {
2744
+ const v = C(() => {
2745
+ const w = Math.max(0, Math.min(360, l)), f = 180 + w / 2, g = 540 - w / 2, y = f - o, S = g - f;
2746
+ let p = 0, P = 0;
2747
+ const k = w <= 0.01;
2748
+ if (i !== void 0 && i > 1 ? (p = i, k ? P = 360 / i : P = S / (i - 1)) : s !== void 0 && s > 0 ? (p = Math.floor(S / s) + 1, P = s) : i === 1 && (p = 1, P = 0), p <= 0) return [];
2749
+ const R = [], N = (T) => Math.round(T * 1e4) / 1e4;
2750
+ for (let T = 0; T < p; T++) {
2751
+ const M = y + T * P, U = Me(e, t, n, M);
2752
+ R.push({
2753
+ x: N(U.x),
2754
+ y: N(U.y),
2755
+ angle: N(M),
2756
+ // Keep precise angle for rotation transforms
2757
+ index: T
2758
+ });
2759
+ }
2760
+ return R;
2761
+ }, [e, t, n, l, o, i, s]), a = C(() => {
2762
+ if (m || v.length === 0) return "";
2763
+ const w = [], f = (g) => Math.round(g * 1e4) / 1e4;
2764
+ for (const g of v)
2765
+ if (u === "dot") {
2766
+ const y = Me(e, t, n - r / 2, g.angle), S = r / 2, p = r / 2;
2767
+ w.push(
2768
+ `M ${f(y.x - S)} ${f(y.y)} A ${f(S)} ${f(p)} 0 1 0 ${f(y.x + S)} ${f(y.y)} A ${f(S)} ${f(p)} 0 1 0 ${f(y.x - S)} ${f(y.y)}`
2769
+ );
2770
+ } else {
2771
+ const y = Me(e, t, n, g.angle), S = Me(e, t, n - r, g.angle);
2772
+ w.push(`M ${f(S.x)} ${f(S.y)} L ${f(y.x)} ${f(y.y)}`);
2773
+ }
2774
+ return w.join(" ");
2775
+ }, [v, e, t, n, r, u, m]);
2776
+ return m ? /* @__PURE__ */ b("g", { className: c, style: h, children: v.map((w) => /* @__PURE__ */ b(I.Fragment, { children: m(w) }, w.index)) }) : a ? /* @__PURE__ */ b(
2777
+ "path",
2778
+ {
2779
+ d: a,
2780
+ className: c,
2781
+ style: { ...u === "dot" ? { fill: "currentColor", stroke: "none" } : { fill: "none", stroke: "currentColor", strokeLinecap: u === "pill" ? "round" : "butt" }, ...h },
2782
+ strokeWidth: u === "dot" ? void 0 : h?.strokeWidth || 1
2783
+ }
2784
+ ) : null;
2785
+ }
2786
+ const In = I.memo(Nn);
2787
+ function Rn({
2788
+ cx: e,
2789
+ cy: t,
2790
+ radius: n,
2791
+ labels: r,
2792
+ orientation: l = "upright",
2793
+ openness: o = 90,
2794
+ rotation: i = 0,
2795
+ className: s,
2796
+ style: u,
2797
+ labelClassName: m,
2798
+ labelStyle: c,
2799
+ iconSize: h
2800
+ }) {
2801
+ return /* @__PURE__ */ b(
2802
+ In,
2803
+ {
2804
+ cx: e,
2805
+ cy: t,
2806
+ radius: n,
2807
+ openness: o,
2808
+ rotation: i,
2809
+ count: r.length,
2810
+ className: s,
2811
+ style: u,
2812
+ renderTick: ({ x: v, y: a, angle: d, index: w }) => {
2813
+ const f = r[w];
2814
+ if (f == null) return null;
2815
+ const g = I.isValidElement(f);
2816
+ let y;
2817
+ if (l === "radial") {
2818
+ let S = d + 90;
2819
+ const p = (S % 360 + 360) % 360;
2820
+ p > 90 && p < 270 && (S += 180), y = `rotate(${S}, ${v}, ${a})`;
2821
+ }
2822
+ if (g) {
2823
+ const S = y ? y.match(/rotate\(([-\d.]+)/)?.[1] : 0;
2824
+ let p = 0;
2825
+ if (h !== void 0)
2826
+ p = -h / 2;
2827
+ else {
2828
+ const P = f.props, k = P?.size ?? P?.width ?? P?.height, R = Number(k);
2829
+ !isNaN(R) && R > 0 && (p = -R / 2);
2830
+ }
2831
+ return /* @__PURE__ */ b("g", { transform: `translate(${v}, ${a}) rotate(${S}) translate(${p}, ${p})`, children: f });
2832
+ }
2833
+ return /* @__PURE__ */ b(
2834
+ "text",
2835
+ {
2836
+ x: v,
2837
+ y: a,
2838
+ textAnchor: "middle",
2839
+ dominantBaseline: "middle",
2840
+ className: m,
2841
+ style: c,
2842
+ transform: y,
2843
+ fill: "currentColor",
2844
+ children: f
2845
+ }
2846
+ );
2847
+ }
2848
+ }
2849
+ );
2850
+ }
2851
+ const Zn = I.memo(Rn);
2852
+ function An({
2853
+ onNoteOn: e,
2854
+ onNoteOff: t,
2855
+ disabled: n = !1,
2856
+ onPointerDown: r,
2857
+ onPointerMove: l,
2858
+ onPointerUp: o,
2859
+ onPointerCancel: i
2860
+ }) {
2861
+ const s = de(null);
2862
+ s.current || (s.current = new bt({
2863
+ onNoteOn: (a) => e(a),
2864
+ onNoteOff: (a) => t(a),
2865
+ disabled: n
2866
+ })), he(() => {
2867
+ s.current?.updateConfig({
2868
+ onNoteOn: (a) => e(a),
2869
+ onNoteOff: (a) => t(a),
2870
+ disabled: n
2871
+ });
2872
+ }, [e, t, n]), he(() => () => {
2873
+ s.current?.cancelAll();
2874
+ }, []);
2875
+ const u = E((a) => {
2876
+ const d = document.elementFromPoint(a.clientX, a.clientY);
2877
+ if (!d) return null;
2878
+ const w = d.getAttribute("data-note");
2879
+ return w ? parseInt(w, 10) : null;
2880
+ }, []), m = E(
2881
+ (a) => {
2882
+ if (r?.(a), a.defaultPrevented || n) return;
2883
+ a.currentTarget.setPointerCapture(a.pointerId);
2884
+ const d = u(a);
2885
+ s.current?.handlePointerDown(a.pointerId, d);
2886
+ },
2887
+ [r, n, u]
2888
+ ), c = E(
2889
+ (a) => {
2890
+ if (l?.(a), a.defaultPrevented || n) return;
2891
+ const d = u(a);
2892
+ s.current?.handlePointerMove(a.pointerId, d);
2893
+ },
2894
+ [l, n, u]
2895
+ ), h = E(
2896
+ (a) => {
2897
+ o?.(a), !(a.defaultPrevented || n) && s.current?.handlePointerUp(a.pointerId);
2898
+ },
2899
+ [o, n]
2900
+ ), v = E(
2901
+ (a) => {
2902
+ i?.(a), !(a.defaultPrevented || n) && s.current?.handlePointerUp(a.pointerId);
2903
+ },
2904
+ [i, n]
2905
+ );
2906
+ return {
2907
+ onPointerDown: m,
2908
+ onPointerMove: c,
2909
+ onPointerUp: h,
2910
+ onPointerCancel: v,
2911
+ style: {
2912
+ touchAction: "none"
2913
+ }
2914
+ };
2915
+ }
2916
+ const Te = $e.length, Pe = (e, t) => (e % t + t) % t;
2917
+ function En({
2918
+ nbKeys: e = 61,
2919
+ startKey: t = e === 88 ? "A" : "C",
2920
+ octaveShift: n = 0,
2921
+ notesOn: r = [],
2922
+ adaptiveSize: l = !1,
2923
+ size: o = "normal",
2924
+ displayMode: i,
2925
+ keyStyle: s = "theme",
2926
+ color: u,
2927
+ roundness: m,
2928
+ className: c = "",
2929
+ style: h = {},
2930
+ onChange: v,
2931
+ onClick: a
2932
+ }) {
2933
+ const d = Math.max(1, Math.min(128, e)), {
2934
+ onPointerDown: w,
2935
+ onPointerMove: f,
2936
+ onPointerUp: g,
2937
+ onPointerCancel: y,
2938
+ style: S
2939
+ } = An({
2940
+ onNoteOn: (z) => {
2941
+ v?.({
2942
+ value: { note: z, active: !0 },
2943
+ normalizedValue: z / 127,
2944
+ midiValue: z
2945
+ });
2946
+ },
2947
+ onNoteOff: (z) => {
2948
+ v?.({
2949
+ value: { note: z, active: !1 },
2950
+ normalizedValue: z / 127,
2951
+ midiValue: z
2952
+ });
2953
+ }
2954
+ }), p = C(() => {
2955
+ const z = Math.floor(d / 12), A = d % 12, Y = Math.ceil(A * 7 / 12), K = z * 7 + Y, X = $e.indexOf(t), G = Math.floor((K - 1) / 2), _ = Math.floor(G / 7), F = X >= 5 ? 1 : 0;
2956
+ let H;
2957
+ d <= 12 ? H = 4 - F : d >= 120 ? H = Math.max(0, 4 - _ - F) : H = 4 - _ - F;
2958
+ const ee = 25, J = 150, oe = 13, $ = 18, Z = J / 3 * 2, le = 2, ue = 2, fe = ue / 2, ce = K * ee, q = parseInt(t, 36) - parseInt("C", 36), ve = [Pe(2 + q, 7), Pe(6 + q, 7)];
2959
+ return {
2960
+ nbWhite: K,
2961
+ startKeyIndex: X,
2962
+ startOctave: H,
2963
+ whiteWidth: ee,
2964
+ whiteHeight: J,
2965
+ blackWidth: oe,
2966
+ blackXShift: $,
2967
+ blackHeight: Z,
2968
+ outerStrokeWidth: le,
2969
+ innerStrokeWidth: ue,
2970
+ width: ce,
2971
+ blackPass: ve,
2972
+ halfInnerStrokeWidth: fe
2973
+ };
2974
+ }, [d, t]), { style: P } = xe({
2975
+ color: u,
2976
+ roundness: m,
2977
+ style: h
2978
+ }), k = C(() => typeof m == "string" ? m : m === void 0 ? "var(--audioui-roundness-keys)" : St(m), [m]), R = u ?? "var(--audioui-primary-color)", N = C(() => Ct(R, "luminosity"), [R]), T = C(() => s === "theme" ? null : s === "classic" ? {
2979
+ whiteFill: `var(${te.keysIvory})`,
2980
+ whiteStroke: `var(${te.keysIvoryStroke})`,
2981
+ blackFill: `var(${te.keysEbony})`,
2982
+ blackStroke: `var(${te.keysEbonyStroke})`
2983
+ } : {
2984
+ whiteFill: `var(${te.keysEbony})`,
2985
+ whiteStroke: `var(${te.keysEbonyStroke})`,
2986
+ blackFill: `var(${te.keysIvory})`,
2987
+ blackStroke: `var(${te.keysIvoryStroke})`
2988
+ }, [s]), M = C(() => xt(r || []), [r]), U = C(() => {
2989
+ const z = $e.indexOf(t);
2990
+ return [
2991
+ Pe(2 - z, 7),
2992
+ // E-F gap (no black key after E)
2993
+ Pe(6 - z, 7)
2994
+ // B-C gap (no black key after B)
2995
+ ];
2996
+ }, [t]), B = E(
2997
+ (z) => {
2998
+ const A = Mt(z);
2999
+ return A !== -1 && M.has(A);
3000
+ },
3001
+ [M]
3002
+ ), x = C(() => {
3003
+ const { nbWhite: z, startKeyIndex: A, startOctave: Y, whiteWidth: K, whiteHeight: X, innerStrokeWidth: G, halfInnerStrokeWidth: _ } = p, F = He[t], H = (Y + 1) * 12 + F;
3004
+ return Array.from({ length: z }, (ee, J) => {
3005
+ const oe = (A + J) % Te, $ = Math.floor((A + J) / Te), le = ke[oe] - ke[A] + $ * 12, ue = H + le - n * 12, fe = Ye(ue);
3006
+ let ce, q;
3007
+ return s === "theme" ? (ce = N.primary50, q = B(fe) ? N.primary : "transparent") : T ? (ce = T.whiteStroke, q = B(fe) ? N.primary : T.whiteFill) : (ce = "#000", q = "transparent"), /* @__PURE__ */ b(
3008
+ "rect",
3009
+ {
3010
+ "data-note": ue,
3011
+ style: {
3012
+ stroke: ce,
3013
+ fill: q,
3014
+ rx: k,
3015
+ ry: k
3016
+ },
3017
+ strokeWidth: G,
3018
+ x: J * K + _,
3019
+ y: _,
3020
+ width: K,
3021
+ height: X,
3022
+ rx: typeof k == "number" ? k : 0
3023
+ },
3024
+ `white-${J}-${fe}`
3025
+ );
3026
+ });
3027
+ }, [p, n, B, k, N, T, s, t]), O = C(() => {
3028
+ const {
3029
+ nbWhite: z,
3030
+ startKeyIndex: A,
3031
+ startOctave: Y,
3032
+ whiteWidth: K,
3033
+ blackWidth: X,
3034
+ blackXShift: G,
3035
+ blackHeight: _,
3036
+ innerStrokeWidth: F,
3037
+ halfInnerStrokeWidth: H
3038
+ } = p, ee = He[t], J = (Y + 1) * 12 + ee;
3039
+ return Array.from({ length: z - 1 }, (oe, $) => {
3040
+ const Z = $ % 7;
3041
+ if (U.includes(Z)) return null;
3042
+ const le = (A + $) % Te, ue = Math.floor((A + $) / Te), ce = ke[le] - ke[A] + ue * 12, q = J + ce + 1 - n * 12;
3043
+ if (kt.has(q % 12)) return null;
3044
+ const ve = Ye(q);
3045
+ let we, ge;
3046
+ return s === "theme" ? (we = N.primary50, ge = B(ve) ? N.primary : N.primary50) : T ? (we = T.blackStroke, ge = B(ve) ? N.primary : T.blackFill) : (we = "#000", ge = "#000"), /* @__PURE__ */ b(
3047
+ "rect",
3048
+ {
3049
+ "data-note": q,
3050
+ style: {
3051
+ zIndex: 1,
3052
+ stroke: we,
3053
+ fill: ge,
3054
+ rx: k,
3055
+ ry: k
3056
+ },
3057
+ strokeWidth: F,
3058
+ x: $ * K + G + H,
3059
+ y: H,
3060
+ width: X,
3061
+ height: _,
3062
+ rx: typeof k == "number" ? k : 0
3063
+ },
3064
+ `black-${$}-${ve}`
3065
+ );
3066
+ }).filter(Boolean);
3067
+ }, [
3068
+ p,
3069
+ n,
3070
+ B,
3071
+ U,
3072
+ k,
3073
+ N,
3074
+ T,
3075
+ s,
3076
+ t
3077
+ ]), { sizeClassName: D, sizeStyle: V } = ae(l, o, "keys"), L = C(() => ne(D, ie.root, c), [D, c]), W = C(() => v || a ? ie.highlight : "", [v, a]), j = C(
3078
+ () => ({
3079
+ ...S ?? {},
3080
+ ...a || v ? { cursor: "var(--audioui-cursor-clickable)" } : {}
3081
+ }),
3082
+ [S, a, v]
3083
+ );
3084
+ return /* @__PURE__ */ b(
3085
+ Q,
3086
+ {
3087
+ displayMode: i ?? "scaleToFit",
3088
+ labelMode: "none",
3089
+ className: L,
3090
+ style: { ...V, ...P },
3091
+ viewBoxWidth: p.width + p.innerStrokeWidth,
3092
+ viewBoxHeight: p.whiteHeight + p.innerStrokeWidth,
3093
+ minWidth: 40,
3094
+ minHeight: 40,
3095
+ children: /* @__PURE__ */ re(
3096
+ Q.Svg,
3097
+ {
3098
+ className: W,
3099
+ style: j,
3100
+ onClick: a,
3101
+ onPointerDown: w,
3102
+ onPointerMove: f,
3103
+ onPointerUp: g,
3104
+ onPointerCancel: y,
3105
+ children: [
3106
+ x,
3107
+ O
3108
+ ]
3109
+ }
3110
+ )
3111
+ }
3112
+ );
3113
+ }
3114
+ const eo = I.memo(En);
3115
+ function $n(e) {
3116
+ typeof document < "u" && document.documentElement.style.setProperty("--audioui-primary-color", e);
3117
+ }
3118
+ function Bn(e) {
3119
+ if (typeof document < "u") {
3120
+ document.documentElement.style.setProperty("--audioui-roundness-base", e.toString());
3121
+ const t = e === 0 ? "square" : "round";
3122
+ document.documentElement.style.setProperty("--audioui-linecap-base", t);
3123
+ }
3124
+ }
3125
+ function to(e) {
3126
+ typeof document > "u" || (e.color !== void 0 && $n(e.color), e.roundness !== void 0 && Bn(e.roundness));
3127
+ }
3128
+ function no() {
3129
+ return typeof document > "u" || typeof window > "u" ? null : window.getComputedStyle(document.documentElement).getPropertyValue("--audioui-primary-color").trim() || null;
3130
+ }
3131
+ function oo() {
3132
+ if (typeof document > "u" || typeof window > "u") return null;
3133
+ const e = window.getComputedStyle(document.documentElement).getPropertyValue("--audioui-roundness-base").trim();
3134
+ return e ? parseFloat(e) : null;
3135
+ }
3136
+ export {
3137
+ Q as AdaptiveBox,
3138
+ Ue as BooleanControl,
3139
+ On as Button,
3140
+ De as ButtonView,
3141
+ Ae as ContinuousControl,
3142
+ Fn as CycleButton,
3143
+ so as DEFAULT_ROUNDNESS,
3144
+ ao as DEFAULT_THICKNESS,
3145
+ ze as DiscreteControl,
3146
+ jn as FilmStripBooleanControl,
3147
+ Hn as FilmStripContinuousControl,
3148
+ Yn as FilmStripDiscreteControl,
3149
+ mn as FilmstripImage,
3150
+ dn as HorizontalSliderView,
3151
+ xn as Image,
3152
+ Xn as ImageKnob,
3153
+ Gn as ImageRotarySwitch,
3154
+ qn as ImageSwitch,
3155
+ eo as Keys,
3156
+ _n as Knob,
3157
+ pe as KnobView,
3158
+ Zn as LabelRing,
3159
+ ln as LinearCursor,
3160
+ tn as LinearStrip,
3161
+ zn as OptionView,
3162
+ Jn as RadialHtmlOverlay,
3163
+ et as RadialImage,
3164
+ Qn as RevealingPath,
3165
+ Ne as RotaryImage,
3166
+ Kn as Slider,
3167
+ Wn as SliderView,
3168
+ In as TickRing,
3169
+ Vt as ValueRing,
3170
+ on as ValueStrip,
3171
+ cn as VerticalSliderView,
3172
+ co as bipolarFormatter,
3173
+ uo as calculateCenterValue,
3174
+ fo as combineFormatters,
3175
+ ho as createNoteNumSet,
3176
+ mo as frequencyFormatter,
3177
+ no as getThemeColor,
3178
+ oo as getThemeRoundness,
3179
+ vo as isNoteOn,
3180
+ po as midiBipolarFormatter,
3181
+ yo as noteNumToNote,
3182
+ wo as noteToNoteNum,
3183
+ go as percentageFormatter,
3184
+ to as setTheme,
3185
+ $n as setThemeColor,
3186
+ Bn as setThemeRoundness,
3187
+ ae as useAdaptiveSize,
3188
+ Re as useAudioParameter,
3189
+ $t as useBooleanParameterResolution,
3190
+ tt as useContinuousParameterResolution,
3191
+ Ve as useDiscreteParameterResolution,
3192
+ An as useNoteInteraction,
3193
+ xe as useThemableProps,
3194
+ bo as withPrecision,
3195
+ So as withUnit
3196
+ };
3197
+ //# sourceMappingURL=index.js.map