ecplayer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2607 @@
1
+ import xt, { forwardRef as gt, createElement as rt, useState as v, useRef as C, useEffect as L } from "react";
2
+ var nt = { exports: {} }, Je = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var ut;
13
+ function $t() {
14
+ if (ut) return Je;
15
+ ut = 1;
16
+ var o = xt, u = Symbol.for("react.element"), g = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, _ = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
17
+ function k(y, N, q) {
18
+ var M, O = {}, S = null, V = null;
19
+ q !== void 0 && (S = "" + q), N.key !== void 0 && (S = "" + N.key), N.ref !== void 0 && (V = N.ref);
20
+ for (M in N) m.call(N, M) && !p.hasOwnProperty(M) && (O[M] = N[M]);
21
+ if (y && y.defaultProps) for (M in N = y.defaultProps, N) O[M] === void 0 && (O[M] = N[M]);
22
+ return { $$typeof: u, type: y, key: S, ref: V, props: O, _owner: _.current };
23
+ }
24
+ return Je.Fragment = g, Je.jsx = k, Je.jsxs = k, Je;
25
+ }
26
+ var Xe = {};
27
+ /**
28
+ * @license React
29
+ * react-jsx-runtime.development.js
30
+ *
31
+ * Copyright (c) Facebook, Inc. and its affiliates.
32
+ *
33
+ * This source code is licensed under the MIT license found in the
34
+ * LICENSE file in the root directory of this source tree.
35
+ */
36
+ var dt;
37
+ function Et() {
38
+ return dt || (dt = 1, process.env.NODE_ENV !== "production" && function() {
39
+ var o = xt, u = Symbol.for("react.element"), g = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), y = Symbol.for("react.context"), N = Symbol.for("react.forward_ref"), q = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), O = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), V = Symbol.for("react.offscreen"), U = Symbol.iterator, Y = "@@iterator";
40
+ function K(t) {
41
+ if (t === null || typeof t != "object")
42
+ return null;
43
+ var n = U && t[U] || t[Y];
44
+ return typeof n == "function" ? n : null;
45
+ }
46
+ var $ = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
47
+ function b(t) {
48
+ {
49
+ for (var n = arguments.length, c = new Array(n > 1 ? n - 1 : 0), h = 1; h < n; h++)
50
+ c[h - 1] = arguments[h];
51
+ we("error", t, c);
52
+ }
53
+ }
54
+ function we(t, n, c) {
55
+ {
56
+ var h = $.ReactDebugCurrentFrame, D = h.getStackAddendum();
57
+ D !== "" && (n += "%s", c = c.concat([D]));
58
+ var W = c.map(function(A) {
59
+ return String(A);
60
+ });
61
+ W.unshift("Warning: " + n), Function.prototype.apply.call(console[t], console, W);
62
+ }
63
+ }
64
+ var me = !1, $e = !1, se = !1, ce = !1, ye = !1, he;
65
+ he = Symbol.for("react.module.reference");
66
+ function X(t) {
67
+ return !!(typeof t == "string" || typeof t == "function" || t === m || t === p || ye || t === _ || t === q || t === M || ce || t === V || me || $e || se || typeof t == "object" && t !== null && (t.$$typeof === S || t.$$typeof === O || t.$$typeof === k || t.$$typeof === y || t.$$typeof === N || // This needs to include all possible module reference object
68
+ // types supported by any Flight configuration anywhere since
69
+ // we don't know which Flight build this will end up being used
70
+ // with.
71
+ t.$$typeof === he || t.getModuleId !== void 0));
72
+ }
73
+ function ke(t, n, c) {
74
+ var h = t.displayName;
75
+ if (h)
76
+ return h;
77
+ var D = n.displayName || n.name || "";
78
+ return D !== "" ? c + "(" + D + ")" : c;
79
+ }
80
+ function H(t) {
81
+ return t.displayName || "Context";
82
+ }
83
+ function F(t) {
84
+ if (t == null)
85
+ return null;
86
+ if (typeof t.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
87
+ return t.displayName || t.name || null;
88
+ if (typeof t == "string")
89
+ return t;
90
+ switch (t) {
91
+ case m:
92
+ return "Fragment";
93
+ case g:
94
+ return "Portal";
95
+ case p:
96
+ return "Profiler";
97
+ case _:
98
+ return "StrictMode";
99
+ case q:
100
+ return "Suspense";
101
+ case M:
102
+ return "SuspenseList";
103
+ }
104
+ if (typeof t == "object")
105
+ switch (t.$$typeof) {
106
+ case y:
107
+ var n = t;
108
+ return H(n) + ".Consumer";
109
+ case k:
110
+ var c = t;
111
+ return H(c._context) + ".Provider";
112
+ case N:
113
+ return ke(t, t.render, "ForwardRef");
114
+ case O:
115
+ var h = t.displayName || null;
116
+ return h !== null ? h : F(t.type) || "Memo";
117
+ case S: {
118
+ var D = t, W = D._payload, A = D._init;
119
+ try {
120
+ return F(A(W));
121
+ } catch {
122
+ return null;
123
+ }
124
+ }
125
+ }
126
+ return null;
127
+ }
128
+ var z = Object.assign, fe = 0, be, ue, le, R, f, B, ie;
129
+ function Ne() {
130
+ }
131
+ Ne.__reactDisabledLog = !0;
132
+ function Q() {
133
+ {
134
+ if (fe === 0) {
135
+ be = console.log, ue = console.info, le = console.warn, R = console.error, f = console.group, B = console.groupCollapsed, ie = console.groupEnd;
136
+ var t = {
137
+ configurable: !0,
138
+ enumerable: !0,
139
+ value: Ne,
140
+ writable: !0
141
+ };
142
+ Object.defineProperties(console, {
143
+ info: t,
144
+ log: t,
145
+ warn: t,
146
+ error: t,
147
+ group: t,
148
+ groupCollapsed: t,
149
+ groupEnd: t
150
+ });
151
+ }
152
+ fe++;
153
+ }
154
+ }
155
+ function xe() {
156
+ {
157
+ if (fe--, fe === 0) {
158
+ var t = {
159
+ configurable: !0,
160
+ enumerable: !0,
161
+ writable: !0
162
+ };
163
+ Object.defineProperties(console, {
164
+ log: z({}, t, {
165
+ value: be
166
+ }),
167
+ info: z({}, t, {
168
+ value: ue
169
+ }),
170
+ warn: z({}, t, {
171
+ value: le
172
+ }),
173
+ error: z({}, t, {
174
+ value: R
175
+ }),
176
+ group: z({}, t, {
177
+ value: f
178
+ }),
179
+ groupCollapsed: z({}, t, {
180
+ value: B
181
+ }),
182
+ groupEnd: z({}, t, {
183
+ value: ie
184
+ })
185
+ });
186
+ }
187
+ fe < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
188
+ }
189
+ }
190
+ var ne = $.ReactCurrentDispatcher, T;
191
+ function oe(t, n, c) {
192
+ {
193
+ if (T === void 0)
194
+ try {
195
+ throw Error();
196
+ } catch (D) {
197
+ var h = D.stack.trim().match(/\n( *(at )?)/);
198
+ T = h && h[1] || "";
199
+ }
200
+ return `
201
+ ` + T + t;
202
+ }
203
+ }
204
+ var ae = !1, s;
205
+ {
206
+ var x = typeof WeakMap == "function" ? WeakMap : Map;
207
+ s = new x();
208
+ }
209
+ function E(t, n) {
210
+ if (!t || ae)
211
+ return "";
212
+ {
213
+ var c = s.get(t);
214
+ if (c !== void 0)
215
+ return c;
216
+ }
217
+ var h;
218
+ ae = !0;
219
+ var D = Error.prepareStackTrace;
220
+ Error.prepareStackTrace = void 0;
221
+ var W;
222
+ W = ne.current, ne.current = null, Q();
223
+ try {
224
+ if (n) {
225
+ var A = function() {
226
+ throw Error();
227
+ };
228
+ if (Object.defineProperty(A.prototype, "props", {
229
+ set: function() {
230
+ throw Error();
231
+ }
232
+ }), typeof Reflect == "object" && Reflect.construct) {
233
+ try {
234
+ Reflect.construct(A, []);
235
+ } catch (pe) {
236
+ h = pe;
237
+ }
238
+ Reflect.construct(t, [], A);
239
+ } else {
240
+ try {
241
+ A.call();
242
+ } catch (pe) {
243
+ h = pe;
244
+ }
245
+ t.call(A.prototype);
246
+ }
247
+ } else {
248
+ try {
249
+ throw Error();
250
+ } catch (pe) {
251
+ h = pe;
252
+ }
253
+ t();
254
+ }
255
+ } catch (pe) {
256
+ if (pe && h && typeof pe.stack == "string") {
257
+ for (var P = pe.stack.split(`
258
+ `), ge = h.stack.split(`
259
+ `), ee = P.length - 1, re = ge.length - 1; ee >= 1 && re >= 0 && P[ee] !== ge[re]; )
260
+ re--;
261
+ for (; ee >= 1 && re >= 0; ee--, re--)
262
+ if (P[ee] !== ge[re]) {
263
+ if (ee !== 1 || re !== 1)
264
+ do
265
+ if (ee--, re--, re < 0 || P[ee] !== ge[re]) {
266
+ var je = `
267
+ ` + P[ee].replace(" at new ", " at ");
268
+ return t.displayName && je.includes("<anonymous>") && (je = je.replace("<anonymous>", t.displayName)), typeof t == "function" && s.set(t, je), je;
269
+ }
270
+ while (ee >= 1 && re >= 0);
271
+ break;
272
+ }
273
+ }
274
+ } finally {
275
+ ae = !1, ne.current = W, xe(), Error.prepareStackTrace = D;
276
+ }
277
+ var Ye = t ? t.displayName || t.name : "", Be = Ye ? oe(Ye) : "";
278
+ return typeof t == "function" && s.set(t, Be), Be;
279
+ }
280
+ function G(t, n, c) {
281
+ return E(t, !1);
282
+ }
283
+ function J(t) {
284
+ var n = t.prototype;
285
+ return !!(n && n.isReactComponent);
286
+ }
287
+ function te(t, n, c) {
288
+ if (t == null)
289
+ return "";
290
+ if (typeof t == "function")
291
+ return E(t, J(t));
292
+ if (typeof t == "string")
293
+ return oe(t);
294
+ switch (t) {
295
+ case q:
296
+ return oe("Suspense");
297
+ case M:
298
+ return oe("SuspenseList");
299
+ }
300
+ if (typeof t == "object")
301
+ switch (t.$$typeof) {
302
+ case N:
303
+ return G(t.render);
304
+ case O:
305
+ return te(t.type, n, c);
306
+ case S: {
307
+ var h = t, D = h._payload, W = h._init;
308
+ try {
309
+ return te(W(D), n, c);
310
+ } catch {
311
+ }
312
+ }
313
+ }
314
+ return "";
315
+ }
316
+ var d = Object.prototype.hasOwnProperty, j = {}, ve = $.ReactDebugCurrentFrame;
317
+ function qe(t) {
318
+ if (t) {
319
+ var n = t._owner, c = te(t.type, t._source, n ? n.type : null);
320
+ ve.setExtraStackFrame(c);
321
+ } else
322
+ ve.setExtraStackFrame(null);
323
+ }
324
+ function Fe(t, n, c, h, D) {
325
+ {
326
+ var W = Function.call.bind(d);
327
+ for (var A in t)
328
+ if (W(t, A)) {
329
+ var P = void 0;
330
+ try {
331
+ if (typeof t[A] != "function") {
332
+ var ge = Error((h || "React class") + ": " + c + " type `" + A + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[A] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
333
+ throw ge.name = "Invariant Violation", ge;
334
+ }
335
+ P = t[A](n, A, h, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
336
+ } catch (ee) {
337
+ P = ee;
338
+ }
339
+ P && !(P instanceof Error) && (qe(D), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", h || "React class", c, A, typeof P), qe(null)), P instanceof Error && !(P.message in j) && (j[P.message] = !0, qe(D), b("Failed %s type: %s", c, P.message), qe(null));
340
+ }
341
+ }
342
+ }
343
+ var Ee = Array.isArray;
344
+ function _e(t) {
345
+ return Ee(t);
346
+ }
347
+ function Ce(t) {
348
+ {
349
+ var n = typeof Symbol == "function" && Symbol.toStringTag, c = n && t[Symbol.toStringTag] || t.constructor.name || "Object";
350
+ return c;
351
+ }
352
+ }
353
+ function He(t) {
354
+ try {
355
+ return Le(t), !1;
356
+ } catch {
357
+ return !0;
358
+ }
359
+ }
360
+ function Le(t) {
361
+ return "" + t;
362
+ }
363
+ function Me(t) {
364
+ if (He(t))
365
+ return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ce(t)), Le(t);
366
+ }
367
+ var Oe = $.ReactCurrentOwner, We = {
368
+ key: !0,
369
+ ref: !0,
370
+ __self: !0,
371
+ __source: !0
372
+ }, Ve, Ue;
373
+ function ze(t) {
374
+ if (d.call(t, "ref")) {
375
+ var n = Object.getOwnPropertyDescriptor(t, "ref").get;
376
+ if (n && n.isReactWarning)
377
+ return !1;
378
+ }
379
+ return t.ref !== void 0;
380
+ }
381
+ function Ke(t) {
382
+ if (d.call(t, "key")) {
383
+ var n = Object.getOwnPropertyDescriptor(t, "key").get;
384
+ if (n && n.isReactWarning)
385
+ return !1;
386
+ }
387
+ return t.key !== void 0;
388
+ }
389
+ function Se(t, n) {
390
+ typeof t.ref == "string" && Oe.current;
391
+ }
392
+ function Re(t, n) {
393
+ {
394
+ var c = function() {
395
+ Ve || (Ve = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
396
+ };
397
+ c.isReactWarning = !0, Object.defineProperty(t, "key", {
398
+ get: c,
399
+ configurable: !0
400
+ });
401
+ }
402
+ }
403
+ function Ie(t, n) {
404
+ {
405
+ var c = function() {
406
+ Ue || (Ue = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
407
+ };
408
+ c.isReactWarning = !0, Object.defineProperty(t, "ref", {
409
+ get: c,
410
+ configurable: !0
411
+ });
412
+ }
413
+ }
414
+ var r = function(t, n, c, h, D, W, A) {
415
+ var P = {
416
+ // This tag allows us to uniquely identify this as a React Element
417
+ $$typeof: u,
418
+ // Built-in properties that belong on the element
419
+ type: t,
420
+ key: n,
421
+ ref: c,
422
+ props: A,
423
+ // Record the component responsible for creating this element.
424
+ _owner: W
425
+ };
426
+ return P._store = {}, Object.defineProperty(P._store, "validated", {
427
+ configurable: !1,
428
+ enumerable: !1,
429
+ writable: !0,
430
+ value: !1
431
+ }), Object.defineProperty(P, "_self", {
432
+ configurable: !1,
433
+ enumerable: !1,
434
+ writable: !1,
435
+ value: h
436
+ }), Object.defineProperty(P, "_source", {
437
+ configurable: !1,
438
+ enumerable: !1,
439
+ writable: !1,
440
+ value: D
441
+ }), Object.freeze && (Object.freeze(P.props), Object.freeze(P)), P;
442
+ };
443
+ function a(t, n, c, h, D) {
444
+ {
445
+ var W, A = {}, P = null, ge = null;
446
+ c !== void 0 && (Me(c), P = "" + c), Ke(n) && (Me(n.key), P = "" + n.key), ze(n) && (ge = n.ref, Se(n, D));
447
+ for (W in n)
448
+ d.call(n, W) && !We.hasOwnProperty(W) && (A[W] = n[W]);
449
+ if (t && t.defaultProps) {
450
+ var ee = t.defaultProps;
451
+ for (W in ee)
452
+ A[W] === void 0 && (A[W] = ee[W]);
453
+ }
454
+ if (P || ge) {
455
+ var re = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
456
+ P && Re(A, re), ge && Ie(A, re);
457
+ }
458
+ return r(t, P, ge, D, h, Oe.current, A);
459
+ }
460
+ }
461
+ var l = $.ReactCurrentOwner, i = $.ReactDebugCurrentFrame;
462
+ function w(t) {
463
+ if (t) {
464
+ var n = t._owner, c = te(t.type, t._source, n ? n.type : null);
465
+ i.setExtraStackFrame(c);
466
+ } else
467
+ i.setExtraStackFrame(null);
468
+ }
469
+ var I;
470
+ I = !1;
471
+ function de(t) {
472
+ return typeof t == "object" && t !== null && t.$$typeof === u;
473
+ }
474
+ function Te() {
475
+ {
476
+ if (l.current) {
477
+ var t = F(l.current.type);
478
+ if (t)
479
+ return `
480
+
481
+ Check the render method of \`` + t + "`.";
482
+ }
483
+ return "";
484
+ }
485
+ }
486
+ function De(t) {
487
+ return "";
488
+ }
489
+ var Z = {};
490
+ function Ge(t) {
491
+ {
492
+ var n = Te();
493
+ if (!n) {
494
+ var c = typeof t == "string" ? t : t.displayName || t.name;
495
+ c && (n = `
496
+
497
+ Check the top-level render call using <` + c + ">.");
498
+ }
499
+ return n;
500
+ }
501
+ }
502
+ function lt(t, n) {
503
+ {
504
+ if (!t._store || t._store.validated || t.key != null)
505
+ return;
506
+ t._store.validated = !0;
507
+ var c = Ge(n);
508
+ if (Z[c])
509
+ return;
510
+ Z[c] = !0;
511
+ var h = "";
512
+ t && t._owner && t._owner !== l.current && (h = " It was passed a child from " + F(t._owner.type) + "."), w(t), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, h), w(null);
513
+ }
514
+ }
515
+ function it(t, n) {
516
+ {
517
+ if (typeof t != "object")
518
+ return;
519
+ if (_e(t))
520
+ for (var c = 0; c < t.length; c++) {
521
+ var h = t[c];
522
+ de(h) && lt(h, n);
523
+ }
524
+ else if (de(t))
525
+ t._store && (t._store.validated = !0);
526
+ else if (t) {
527
+ var D = K(t);
528
+ if (typeof D == "function" && D !== t.entries)
529
+ for (var W = D.call(t), A; !(A = W.next()).done; )
530
+ de(A.value) && lt(A.value, n);
531
+ }
532
+ }
533
+ }
534
+ function ht(t) {
535
+ {
536
+ var n = t.type;
537
+ if (n == null || typeof n == "string")
538
+ return;
539
+ var c;
540
+ if (typeof n == "function")
541
+ c = n.propTypes;
542
+ else if (typeof n == "object" && (n.$$typeof === N || // Note: Memo only checks outer props here.
543
+ // Inner props are checked in the reconciler.
544
+ n.$$typeof === O))
545
+ c = n.propTypes;
546
+ else
547
+ return;
548
+ if (c) {
549
+ var h = F(n);
550
+ Fe(c, t.props, "prop", h, t);
551
+ } else if (n.PropTypes !== void 0 && !I) {
552
+ I = !0;
553
+ var D = F(n);
554
+ b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", D || "Unknown");
555
+ }
556
+ typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
557
+ }
558
+ }
559
+ function yt(t) {
560
+ {
561
+ for (var n = Object.keys(t.props), c = 0; c < n.length; c++) {
562
+ var h = n[c];
563
+ if (h !== "children" && h !== "key") {
564
+ w(t), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), w(null);
565
+ break;
566
+ }
567
+ }
568
+ t.ref !== null && (w(t), b("Invalid attribute `ref` supplied to `React.Fragment`."), w(null));
569
+ }
570
+ }
571
+ var ot = {};
572
+ function ct(t, n, c, h, D, W) {
573
+ {
574
+ var A = X(t);
575
+ if (!A) {
576
+ var P = "";
577
+ (t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (P += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
578
+ var ge = De();
579
+ ge ? P += ge : P += Te();
580
+ var ee;
581
+ t === null ? ee = "null" : _e(t) ? ee = "array" : t !== void 0 && t.$$typeof === u ? (ee = "<" + (F(t.type) || "Unknown") + " />", P = " Did you accidentally export a JSX literal instead of a component?") : ee = typeof t, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ee, P);
582
+ }
583
+ var re = a(t, n, c, D, W);
584
+ if (re == null)
585
+ return re;
586
+ if (A) {
587
+ var je = n.children;
588
+ if (je !== void 0)
589
+ if (h)
590
+ if (_e(je)) {
591
+ for (var Ye = 0; Ye < je.length; Ye++)
592
+ it(je[Ye], t);
593
+ Object.freeze && Object.freeze(je);
594
+ } else
595
+ b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
596
+ else
597
+ it(je, t);
598
+ }
599
+ if (d.call(n, "key")) {
600
+ var Be = F(t), pe = Object.keys(n).filter(function(Nt) {
601
+ return Nt !== "key";
602
+ }), tt = pe.length > 0 ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}";
603
+ if (!ot[Be + tt]) {
604
+ var kt = pe.length > 0 ? "{" + pe.join(": ..., ") + ": ...}" : "{}";
605
+ b(`A props object containing a "key" prop is being spread into JSX:
606
+ let props = %s;
607
+ <%s {...props} />
608
+ React keys must be passed directly to JSX without using spread:
609
+ let props = %s;
610
+ <%s key={someKey} {...props} />`, tt, Be, kt, Be), ot[Be + tt] = !0;
611
+ }
612
+ }
613
+ return t === m ? yt(re) : ht(re), re;
614
+ }
615
+ }
616
+ function bt(t, n, c) {
617
+ return ct(t, n, c, !0);
618
+ }
619
+ function vt(t, n, c) {
620
+ return ct(t, n, c, !1);
621
+ }
622
+ var jt = vt, wt = bt;
623
+ Xe.Fragment = m, Xe.jsx = jt, Xe.jsxs = wt;
624
+ }()), Xe;
625
+ }
626
+ process.env.NODE_ENV === "production" ? nt.exports = $t() : nt.exports = Et();
627
+ var e = nt.exports;
628
+ /**
629
+ * @license lucide-react v0.540.0 - ISC
630
+ *
631
+ * This source code is licensed under the ISC license.
632
+ * See the LICENSE file in the root directory of this source tree.
633
+ */
634
+ const Ct = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Rt = (o) => o.replace(
635
+ /^([A-Z])|[\s-_]+(\w)/g,
636
+ (u, g, m) => m ? m.toUpperCase() : g.toLowerCase()
637
+ ), ft = (o) => {
638
+ const u = Rt(o);
639
+ return u.charAt(0).toUpperCase() + u.slice(1);
640
+ }, pt = (...o) => o.filter((u, g, m) => !!u && u.trim() !== "" && m.indexOf(u) === g).join(" ").trim(), Tt = (o) => {
641
+ for (const u in o)
642
+ if (u.startsWith("aria-") || u === "role" || u === "title")
643
+ return !0;
644
+ };
645
+ /**
646
+ * @license lucide-react v0.540.0 - ISC
647
+ *
648
+ * This source code is licensed under the ISC license.
649
+ * See the LICENSE file in the root directory of this source tree.
650
+ */
651
+ var Pt = {
652
+ xmlns: "http://www.w3.org/2000/svg",
653
+ width: 24,
654
+ height: 24,
655
+ viewBox: "0 0 24 24",
656
+ fill: "none",
657
+ stroke: "currentColor",
658
+ strokeWidth: 2,
659
+ strokeLinecap: "round",
660
+ strokeLinejoin: "round"
661
+ };
662
+ /**
663
+ * @license lucide-react v0.540.0 - ISC
664
+ *
665
+ * This source code is licensed under the ISC license.
666
+ * See the LICENSE file in the root directory of this source tree.
667
+ */
668
+ const qt = gt(
669
+ ({
670
+ color: o = "currentColor",
671
+ size: u = 24,
672
+ strokeWidth: g = 2,
673
+ absoluteStrokeWidth: m,
674
+ className: _ = "",
675
+ children: p,
676
+ iconNode: k,
677
+ ...y
678
+ }, N) => rt(
679
+ "svg",
680
+ {
681
+ ref: N,
682
+ ...Pt,
683
+ width: u,
684
+ height: u,
685
+ stroke: o,
686
+ strokeWidth: m ? Number(g) * 24 / Number(u) : g,
687
+ className: pt("lucide", _),
688
+ ...!p && !Tt(y) && { "aria-hidden": "true" },
689
+ ...y
690
+ },
691
+ [
692
+ ...k.map(([q, M]) => rt(q, M)),
693
+ ...Array.isArray(p) ? p : [p]
694
+ ]
695
+ )
696
+ );
697
+ /**
698
+ * @license lucide-react v0.540.0 - ISC
699
+ *
700
+ * This source code is licensed under the ISC license.
701
+ * See the LICENSE file in the root directory of this source tree.
702
+ */
703
+ const Pe = (o, u) => {
704
+ const g = gt(
705
+ ({ className: m, ..._ }, p) => rt(qt, {
706
+ ref: p,
707
+ iconNode: u,
708
+ className: pt(
709
+ `lucide-${Ct(ft(o))}`,
710
+ `lucide-${o}`,
711
+ m
712
+ ),
713
+ ..._
714
+ })
715
+ );
716
+ return g.displayName = ft(o), g;
717
+ };
718
+ /**
719
+ * @license lucide-react v0.540.0 - ISC
720
+ *
721
+ * This source code is licensed under the ISC license.
722
+ * See the LICENSE file in the root directory of this source tree.
723
+ */
724
+ const _t = [
725
+ ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
726
+ ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
727
+ ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
728
+ ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
729
+ ], St = Pe("maximize", _t);
730
+ /**
731
+ * @license lucide-react v0.540.0 - ISC
732
+ *
733
+ * This source code is licensed under the ISC license.
734
+ * See the LICENSE file in the root directory of this source tree.
735
+ */
736
+ const At = [
737
+ ["path", { d: "M8 3v3a2 2 0 0 1-2 2H3", key: "hohbtr" }],
738
+ ["path", { d: "M21 8h-3a2 2 0 0 1-2-2V3", key: "5jw1f3" }],
739
+ ["path", { d: "M3 16h3a2 2 0 0 1 2 2v3", key: "198tvr" }],
740
+ ["path", { d: "M16 21v-3a2 2 0 0 1 2-2h3", key: "ph8mxp" }]
741
+ ], Ft = Pe("minimize", At);
742
+ /**
743
+ * @license lucide-react v0.540.0 - ISC
744
+ *
745
+ * This source code is licensed under the ISC license.
746
+ * See the LICENSE file in the root directory of this source tree.
747
+ */
748
+ const Lt = [
749
+ ["rect", { x: "14", y: "3", width: "5", height: "18", rx: "1", key: "kaeet6" }],
750
+ ["rect", { x: "5", y: "3", width: "5", height: "18", rx: "1", key: "1wsw3u" }]
751
+ ], Ze = Pe("pause", Lt);
752
+ /**
753
+ * @license lucide-react v0.540.0 - ISC
754
+ *
755
+ * This source code is licensed under the ISC license.
756
+ * See the LICENSE file in the root directory of this source tree.
757
+ */
758
+ const Mt = [
759
+ [
760
+ "path",
761
+ {
762
+ d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
763
+ key: "10ikf1"
764
+ }
765
+ ]
766
+ ], et = Pe("play", Mt);
767
+ /**
768
+ * @license lucide-react v0.540.0 - ISC
769
+ *
770
+ * This source code is licensed under the ISC license.
771
+ * See the LICENSE file in the root directory of this source tree.
772
+ */
773
+ const Ot = [
774
+ ["path", { d: "m17 2 4 4-4 4", key: "nntrym" }],
775
+ ["path", { d: "M3 11v-1a4 4 0 0 1 4-4h14", key: "84bu3i" }],
776
+ ["path", { d: "m7 22-4-4 4-4", key: "1wqhfi" }],
777
+ ["path", { d: "M21 13v1a4 4 0 0 1-4 4H3", key: "1rx37r" }]
778
+ ], zt = Pe("repeat", Ot);
779
+ /**
780
+ * @license lucide-react v0.540.0 - ISC
781
+ *
782
+ * This source code is licensed under the ISC license.
783
+ * See the LICENSE file in the root directory of this source tree.
784
+ */
785
+ const It = [
786
+ ["line", { x1: "4", x2: "4", y1: "21", y2: "14", key: "1p332r" }],
787
+ ["line", { x1: "4", x2: "4", y1: "10", y2: "3", key: "gb41h5" }],
788
+ ["line", { x1: "12", x2: "12", y1: "21", y2: "12", key: "hf2csr" }],
789
+ ["line", { x1: "12", x2: "12", y1: "8", y2: "3", key: "1kfi7u" }],
790
+ ["line", { x1: "20", x2: "20", y1: "21", y2: "16", key: "1lhrwl" }],
791
+ ["line", { x1: "20", x2: "20", y1: "12", y2: "3", key: "16vvfq" }],
792
+ ["line", { x1: "2", x2: "6", y1: "14", y2: "14", key: "1uebub" }],
793
+ ["line", { x1: "10", x2: "14", y1: "8", y2: "8", key: "1yglbp" }],
794
+ ["line", { x1: "18", x2: "22", y1: "16", y2: "16", key: "1jxqpz" }]
795
+ ], Qe = Pe("sliders-vertical", It);
796
+ /**
797
+ * @license lucide-react v0.540.0 - ISC
798
+ *
799
+ * This source code is licensed under the ISC license.
800
+ * See the LICENSE file in the root directory of this source tree.
801
+ */
802
+ const Dt = [
803
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
804
+ ], mt = Pe("square", Dt);
805
+ /**
806
+ * @license lucide-react v0.540.0 - ISC
807
+ *
808
+ * This source code is licensed under the ISC license.
809
+ * See the LICENSE file in the root directory of this source tree.
810
+ */
811
+ const Bt = [
812
+ ["path", { d: "M12 3v12", key: "1x0j5s" }],
813
+ ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
814
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
815
+ ], Ht = Pe("upload", Bt);
816
+ /**
817
+ * @license lucide-react v0.540.0 - ISC
818
+ *
819
+ * This source code is licensed under the ISC license.
820
+ * See the LICENSE file in the root directory of this source tree.
821
+ */
822
+ const Wt = [
823
+ [
824
+ "path",
825
+ {
826
+ d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
827
+ key: "uqj9uw"
828
+ }
829
+ ],
830
+ ["path", { d: "M16 9a5 5 0 0 1 0 6", key: "1q6k2b" }],
831
+ ["path", { d: "M19.364 18.364a9 9 0 0 0 0-12.728", key: "ijwkga" }]
832
+ ], at = Pe("volume-2", Wt);
833
+ /**
834
+ * @license lucide-react v0.540.0 - ISC
835
+ *
836
+ * This source code is licensed under the ISC license.
837
+ * See the LICENSE file in the root directory of this source tree.
838
+ */
839
+ const Vt = [
840
+ [
841
+ "path",
842
+ {
843
+ d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
844
+ key: "uqj9uw"
845
+ }
846
+ ],
847
+ ["line", { x1: "22", x2: "16", y1: "9", y2: "15", key: "1ewh16" }],
848
+ ["line", { x1: "16", x2: "22", y1: "9", y2: "15", key: "5ykzw1" }]
849
+ ], st = Pe("volume-x", Vt), Ae = {
850
+ rainbow: {
851
+ name: "Rainbow",
852
+ bg: "linear-gradient(135deg, #ef444422 0%, #f9731622 15%, #f59e0b22 30%, #10b98122 45%, #06b6d422 60%, #3b82f622 75%, #6366f122 85%, #a855f722 92%, #ec489922 100%)",
853
+ bars: [
854
+ "#ef4444",
855
+ "#f97316",
856
+ "#f59e0b",
857
+ "#eab308",
858
+ "#84cc16",
859
+ "#22c55e",
860
+ "#10b981",
861
+ "#06b6d4",
862
+ "#0ea5e9",
863
+ "#3b82f6",
864
+ "#6366f1",
865
+ "#8b5cf6",
866
+ "#a855f7",
867
+ "#d946ef",
868
+ "#ec4899",
869
+ "#f43f5e"
870
+ ],
871
+ peak: "#a0a0a0ff",
872
+ button: "#ec4899",
873
+ buttonHover: "#d946ef",
874
+ slider: "#ec4899"
875
+ },
876
+ ocean: {
877
+ name: "Ocean Blue",
878
+ bg: "linear-gradient(135deg, #667eea43 0%, #764ba243 100%)",
879
+ bars: ["#0ea5e9", "#38bdf8", "#06b6d4", "#22d3ee"],
880
+ peak: "#0369a1",
881
+ button: "#0ea5e9",
882
+ buttonHover: "#0284c7",
883
+ slider: "#0ea5e9"
884
+ },
885
+ sunset: {
886
+ name: "Sunset",
887
+ bg: "linear-gradient(135deg, #f093fb43 0%, #f5576c43 100%)",
888
+ bars: ["#f43f5e", "#fb7185", "#fda4af", "#fecdd3"],
889
+ peak: "#be123c",
890
+ button: "#f43f5e",
891
+ buttonHover: "#e11d48",
892
+ slider: "#f43f5e"
893
+ },
894
+ forest: {
895
+ name: "Forest Green",
896
+ bg: "linear-gradient(135deg, #0ba36043 0%, #3cba9243 100%)",
897
+ bars: ["#10b981", "#34d399", "#6ee7b7", "#a7f3d0"],
898
+ peak: "#047857",
899
+ button: "#10b981",
900
+ buttonHover: "#059669",
901
+ slider: "#10b981"
902
+ },
903
+ midnight: {
904
+ name: "Midnight",
905
+ bg: "linear-gradient(135deg, #2c3e5043 0%, #3498db43 100%)",
906
+ bars: ["#3b82f6", "#60a5fa", "#93c5fd", "#bfdbfe"],
907
+ peak: "#1e40af",
908
+ button: "#3b82f6",
909
+ buttonHover: "#2563eb",
910
+ slider: "#3b82f6"
911
+ },
912
+ neon: {
913
+ name: "Neon Cyan",
914
+ bg: "linear-gradient(135deg, #13547a43 0%, #80d0c743 100%)",
915
+ bars: ["#06b6d4", "#22d3ee", "#67e8f9", "#a5f3fc"],
916
+ peak: "#0e7490",
917
+ button: "#06b6d4",
918
+ buttonHover: "#0891b2",
919
+ slider: "#06b6d4"
920
+ },
921
+ purple: {
922
+ name: "Royal Purple",
923
+ bg: "linear-gradient(135deg, #2f1c5622 0%, #764ba243 100%)",
924
+ bars: ["#8b5cf6", "#a78bfa", "#baabf9ff", "#ddd6fe"],
925
+ peak: "#6d28d9",
926
+ button: "#8b5cf6",
927
+ buttonHover: "#7c3aed",
928
+ slider: "#8b5cf6"
929
+ },
930
+ amber: {
931
+ name: "Amber Gold",
932
+ bg: "linear-gradient(135deg, #f59e0b43 0%, #d9770643 100%)",
933
+ bars: ["#f59e0b", "#fbbf24", "#fcd34d", "#fde68a"],
934
+ peak: "#b45309",
935
+ button: "#f59e0b",
936
+ buttonHover: "#d97706",
937
+ slider: "#f59e0b"
938
+ },
939
+ rose: {
940
+ name: "Rose Pink",
941
+ bg: "linear-gradient(135deg, #ec489943 0%, #be185d43 100%)",
942
+ bars: ["#ec4899", "#f472b6", "#f9a8d4", "#fbcfe8"],
943
+ peak: "#9f1239",
944
+ button: "#ec4899",
945
+ buttonHover: "#db2777",
946
+ slider: "#ec4899"
947
+ }
948
+ };
949
+ function Ut({ theme: o, setTheme: u, close: g }) {
950
+ const m = Object.keys(Ae).map((_) => ({
951
+ key: _,
952
+ name: Ae[_].name,
953
+ colors: Ae[_].bars
954
+ }));
955
+ return /* @__PURE__ */ e.jsxs("div", { className: "container-glass rounded-xl p-6 mb-6", children: [
956
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center mb-4", children: [
957
+ /* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold text-gray-800", children: "Choose Color Palette" }),
958
+ /* @__PURE__ */ e.jsx(
959
+ "button",
960
+ {
961
+ onClick: () => g(),
962
+ className: "text-gray-500 hover:text-gray-700 text-sm font-medium",
963
+ children: "Close"
964
+ }
965
+ )
966
+ ] }),
967
+ /* @__PURE__ */ e.jsx("div", { className: "theme-selector grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3", children: m.map((_) => /* @__PURE__ */ e.jsxs(
968
+ "div",
969
+ {
970
+ className: `theme-card bg-white p-4 rounded-lg cursor-pointer border-2 transition-all ${o === _.key ? "border-current shadow-lg" : "border-transparent"}`,
971
+ onClick: () => u(_.key),
972
+ children: [
973
+ /* @__PURE__ */ e.jsx("div", { className: "color-preview h-10 rounded mb-2", style: { background: `linear-gradient(to right, ${_.colors.join(", ")})` } }),
974
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium text-gray-700", children: _.name })
975
+ ]
976
+ },
977
+ _.key
978
+ )) })
979
+ ] });
980
+ }
981
+ function Yt({
982
+ audio: o,
983
+ name: u = "No track loaded",
984
+ author: g,
985
+ theme: m = "rainbow",
986
+ volume: _ = 100,
987
+ thumbnail: p = null,
988
+ controls: k = {
989
+ play: !0,
990
+ pause: !0,
991
+ stop: !0,
992
+ seekbar: !0,
993
+ volume: !0,
994
+ loop: !0,
995
+ trackName: !0,
996
+ equalizer: !0,
997
+ speed: !0
998
+ },
999
+ mode: y = "light",
1000
+ bands: N = null,
1001
+ transparent: q = !1,
1002
+ autoPlay: M = !1,
1003
+ equalizer: O = {
1004
+ bass: 0,
1005
+ mid: 0,
1006
+ treble: 0
1007
+ }
1008
+ }) {
1009
+ const [S, V] = v(!1), [U, Y] = v(0), [K, $] = v(0), [b, we] = v(_ || 100), [me, $e] = v(!1), [se, ce] = v(!1), [ye, he] = v(!1), [X, ke] = v([]), [H, F] = v(!1), [z, fe] = v({
1010
+ bass: O.bass || 0,
1011
+ mid: O.mid || 0,
1012
+ treble: O.treble || 0
1013
+ }), [be, ue] = v(1), [le, R] = v(0), f = C(null), B = C(null), ie = C(null), Ne = C(null), Q = C(null), xe = C(null), ne = C(null), T = C(null), oe = C(null), ae = C(null);
1014
+ L(() => {
1015
+ const r = ae.current;
1016
+ if (!r) return;
1017
+ const a = new ResizeObserver((l) => {
1018
+ for (let i of l)
1019
+ R(i.contentRect.width);
1020
+ });
1021
+ return a.observe(r), () => a.disconnect();
1022
+ }, []), L(() => {
1023
+ const r = [];
1024
+ if (o && typeof o != "string" && r.push(["TypeError", "audio must be a string (URL or path)"]), u && typeof u != "string" && r.push(["TypeError", "name must be a string"]), m && typeof m != "string" && typeof m != "object")
1025
+ r.push(["TypeError", "theme must be a string or a valid theme object"]);
1026
+ else if (typeof m == "object") {
1027
+ const a = ["name", "bg", "bars", "peak", "button", "buttonHover", "slider"];
1028
+ for (const l of a)
1029
+ l in m || r.push(["ThemeError", `theme object missing key: ${l}`]);
1030
+ }
1031
+ (typeof _ != "number" || _ < 0 || _ > 100) && r.push(["TypeError", "volume must be a number between 0 and 100"]), typeof k != "object" || Array.isArray(k) ? r.push(["TypeError", "controls must be an object"]) : ["play", "pause", "stop", "seekbar", "volume", "loop", "trackName", "equalizer"].forEach((l) => {
1032
+ k && l in k && typeof k[l] != "boolean" && r.push(["TypeError", `controls.${l} must be a boolean`]);
1033
+ }), N && (Array.isArray(N) ? N.length === 0 ? r.push(["ValueError", "bands array cannot be empty"]) : N.forEach((a, l) => {
1034
+ typeof a.freq != "number" && r.push(["TypeError", `bands[${l}].freq must be a number`]);
1035
+ }) : r.push(["TypeError", "bands must be an array"])), r.length > 0 ? (ke(r), console.group("%cVisualizePlayer: Prop validation failed", "color:red"), r.forEach((a) => console.error(`${a[0]}: ${a[1]}`)), console.groupEnd()) : ke([]);
1036
+ }, [o, u, m, _, k, y, N]);
1037
+ const s = N || [
1038
+ { freq: 0 },
1039
+ { freq: 10 },
1040
+ { freq: 20 },
1041
+ { freq: 25 },
1042
+ { freq: 31.5 },
1043
+ { freq: 40 },
1044
+ { freq: 50 },
1045
+ { freq: 63 },
1046
+ { freq: 80 },
1047
+ { freq: 100 },
1048
+ { freq: 125 },
1049
+ { freq: 160 },
1050
+ { freq: 200 },
1051
+ { freq: 250 },
1052
+ { freq: 315 },
1053
+ { freq: 400 },
1054
+ { freq: 500 },
1055
+ { freq: 630 },
1056
+ { freq: 800 },
1057
+ { freq: 1e3 },
1058
+ { freq: 1250 },
1059
+ { freq: 1600 },
1060
+ { freq: 2e3 },
1061
+ { freq: 2500 },
1062
+ { freq: 3150 },
1063
+ { freq: 4e3 },
1064
+ { freq: 5e3 },
1065
+ { freq: 6300 },
1066
+ { freq: 8e3 },
1067
+ { freq: 1e4 },
1068
+ { freq: 12500 }
1069
+ ], x = C(s.map(() => 0)), E = C(s.map(() => 0)), G = C(s.map(() => 0)), J = C(!1), te = C(typeof m == "string" ? m : "purple");
1070
+ let d = typeof m == "string" ? Ae[m] || Ae.purple : typeof m == "object" ? m : Ae.purple;
1071
+ const j = y === "dark", ve = typeof k == "object" && Object.keys(k).length === 0;
1072
+ L(() => {
1073
+ typeof m == "string" ? te.current = m : te.current = "purple", Ce();
1074
+ }, [m]), L(() => {
1075
+ f.current || (f.current = new Audio());
1076
+ const r = f.current, a = () => {
1077
+ ye || Y(r.currentTime);
1078
+ }, l = () => {
1079
+ $(r.duration);
1080
+ }, i = () => {
1081
+ se || (V(!1), T.current && cancelAnimationFrame(T.current));
1082
+ }, w = () => V(!0), I = () => V(!1);
1083
+ return r.addEventListener("timeupdate", a), r.addEventListener("loadedmetadata", l), r.addEventListener("ended", i), r.addEventListener("play", w), r.addEventListener("pause", I), () => {
1084
+ r.removeEventListener("timeupdate", a), r.removeEventListener("loadedmetadata", l), r.removeEventListener("ended", i), r.removeEventListener("play", w), r.removeEventListener("pause", I);
1085
+ };
1086
+ }, [ye, se]), L(() => () => {
1087
+ f.current && (f.current.pause(), f.current.src = "", f.current.load()), B.current && B.current.close().catch((r) => console.warn("AudioContext cleanup error:", r)), T.current && cancelAnimationFrame(T.current);
1088
+ }, []), L(() => {
1089
+ if (o) {
1090
+ const r = S, a = b, l = se;
1091
+ if (T.current && (cancelAnimationFrame(T.current), T.current = null), Ne.current) {
1092
+ try {
1093
+ Ne.current.disconnect();
1094
+ } catch (Z) {
1095
+ console.warn("Source disconnect error:", Z);
1096
+ }
1097
+ Ne.current = null;
1098
+ }
1099
+ if (ie.current) {
1100
+ try {
1101
+ ie.current.disconnect();
1102
+ } catch (Z) {
1103
+ console.warn("Analyser disconnect error:", Z);
1104
+ }
1105
+ ie.current = null;
1106
+ }
1107
+ if (Q.current) {
1108
+ try {
1109
+ Q.current.disconnect();
1110
+ } catch (Z) {
1111
+ console.warn("Bass filter disconnect error:", Z);
1112
+ }
1113
+ Q.current = null;
1114
+ }
1115
+ if (xe.current) {
1116
+ try {
1117
+ xe.current.disconnect();
1118
+ } catch (Z) {
1119
+ console.warn("Mid filter disconnect error:", Z);
1120
+ }
1121
+ xe.current = null;
1122
+ }
1123
+ if (ne.current) {
1124
+ try {
1125
+ ne.current.disconnect();
1126
+ } catch (Z) {
1127
+ console.warn("Treble filter disconnect error:", Z);
1128
+ }
1129
+ ne.current = null;
1130
+ }
1131
+ B.current && (B.current.close().catch((Z) => console.warn("AudioContext close error:", Z)), B.current = null), f.current && (f.current.pause(), f.current.src = "", f.current.load()), f.current = new Audio();
1132
+ try {
1133
+ f.current.crossOrigin = "anonymous";
1134
+ } catch (Z) {
1135
+ console.debug("Could not set crossOrigin on audio element", Z);
1136
+ }
1137
+ f.current.src = o, f.current.preload = "auto", f.current.muted = !1, f.current.volume = me ? 0 : a / 100, f.current.loop = l, f.current.load();
1138
+ const i = f.current, w = () => {
1139
+ ye || Y(i.currentTime);
1140
+ }, I = () => {
1141
+ $(i.duration);
1142
+ }, de = () => {
1143
+ se || (V(!1), T.current && cancelAnimationFrame(T.current));
1144
+ }, Te = () => V(!0), De = () => V(!1);
1145
+ i.addEventListener("timeupdate", w), i.addEventListener("loadedmetadata", I), i.addEventListener("ended", de), i.addEventListener("play", Te), i.addEventListener("pause", De), Y(0), V(!1), console.debug("Audio element created", { src: f.current.src, volume: f.current.volume, loop: f.current.loop }), x.current = s.map(() => 0), E.current = s.map(() => 0), G.current = s.map(() => 0), Ce(), r && f.current.play().catch((Z) => console.error("Play failed:", Z));
1146
+ }
1147
+ }, [o]), L(() => {
1148
+ f.current && (f.current.volume = me ? 0 : b / 100);
1149
+ }, [b, me]), L(() => {
1150
+ f.current && (f.current.loop = se);
1151
+ }, [se]), L(() => {
1152
+ f.current && (f.current.playbackRate = be);
1153
+ }, [be]), L(() => {
1154
+ B.current && (Q.current && (Q.current.gain.value = z.bass), xe.current && (xe.current.gain.value = z.mid), ne.current && (ne.current.gain.value = z.treble));
1155
+ }, [z]), L(() => {
1156
+ J.current = S, T.current && (cancelAnimationFrame(T.current), T.current = null), S ? (B.current || qe(), _e()) : Ee();
1157
+ }, [S]);
1158
+ const qe = () => {
1159
+ if (!B.current && f.current)
1160
+ try {
1161
+ const r = window.AudioContext || window.webkitAudioContext;
1162
+ if (r) {
1163
+ const a = new r();
1164
+ B.current = a;
1165
+ const l = a.createBiquadFilter();
1166
+ l.type = "lowshelf", l.frequency.value = 320, l.gain.value = z.bass;
1167
+ const i = a.createBiquadFilter();
1168
+ i.type = "peaking", i.frequency.value = 1e3, i.Q.value = 0.5, i.gain.value = z.mid;
1169
+ const w = a.createBiquadFilter();
1170
+ w.type = "highshelf", w.frequency.value = 3200, w.gain.value = z.treble;
1171
+ const I = a.createAnalyser();
1172
+ I.fftSize = 8192, I.smoothingTimeConstant = 0.7;
1173
+ const de = a.createMediaElementSource(f.current);
1174
+ de.connect(l), l.connect(i), i.connect(w), w.connect(I), I.connect(a.destination), Q.current = l, xe.current = i, ne.current = w, ie.current = I, Ne.current = de;
1175
+ }
1176
+ } catch (r) {
1177
+ console.error("Failed to setup audio context:", r);
1178
+ }
1179
+ }, Fe = (r) => {
1180
+ const a = B.current, l = ie.current;
1181
+ if (!a || !l) return 0;
1182
+ const i = a.sampleRate / 2, w = Math.round(r / i * l.frequencyBinCount);
1183
+ return Math.min(w, l.frequencyBinCount - 1);
1184
+ }, Ee = () => {
1185
+ if (J.current) return;
1186
+ x.current = x.current.map((i) => i * 0.7);
1187
+ const r = Date.now();
1188
+ E.current = E.current.map((i, w) => r - G.current[w] > 1500 ? i * 0.95 : i), Ce();
1189
+ const a = Math.max(...x.current), l = Math.max(...E.current);
1190
+ a > 0.01 || l > 0.01 ? T.current = requestAnimationFrame(Ee) : (J.current || (x.current = s.map(() => 0), E.current = s.map(() => 0), G.current = s.map(() => 0), Ce()), T.current && cancelAnimationFrame(T.current), T.current = null);
1191
+ }, _e = () => {
1192
+ if (!ie.current || !J.current) return;
1193
+ const r = ie.current.frequencyBinCount, a = new Uint8Array(r);
1194
+ ie.current.getByteFrequencyData(a), s.forEach((l, i) => {
1195
+ const w = Fe(l.freq), I = i < s.length - 1 ? Fe(s[i + 1].freq) : a.length;
1196
+ let de = 0, Te = 0;
1197
+ for (let Ge = w; Ge < I; Ge++)
1198
+ de += a[Ge], Te++;
1199
+ let De = Te > 0 ? de / Te / 255 : 0;
1200
+ De = Math.pow(De, 0.6), x.current[i] = x.current[i] * 0.8 + De * 0.2;
1201
+ const Z = Date.now();
1202
+ x.current[i] > E.current[i] ? (E.current[i] = x.current[i], G.current[i] = Z) : Z - G.current[i] > 1500 && (E.current[i] *= 0.95);
1203
+ }), Ce(), T.current = requestAnimationFrame(_e);
1204
+ }, Ce = () => {
1205
+ if (!oe.current) return;
1206
+ const r = Ae[te.current] || Ae.rainbow;
1207
+ let a = "";
1208
+ s.forEach((l, i) => {
1209
+ const w = x.current[i] * 100, I = 100 - E.current[i] * 100, de = Math.floor(i / s.length * r.bars.length), Te = r.bars[Math.min(de, r.bars.length - 1)];
1210
+ a += `
1211
+ <div class="flex-1 h-full relative flex flex-col justify-end">
1212
+ <div class="rounded-t transition-all duration-75" style="height: ${w}%; background: ${Te};">
1213
+ ${E.current[i] > 0.1 ? `<div class="absolute w-full h-0.5 transition-all duration-100" style="top: ${I}%; background: ${r.peak};"></div>` : ""}
1214
+ </div>
1215
+ </div>
1216
+ `;
1217
+ }), oe.current.innerHTML = a;
1218
+ }, He = () => {
1219
+ !f.current || !o || (S ? f.current.pause() : (B.current && B.current.state === "suspended" && B.current.resume(), f.current.play().catch((r) => console.error("Play failed:", r))));
1220
+ }, Le = () => {
1221
+ f.current && (f.current.pause(), f.current.currentTime = 0, V(!1), Y(0), x.current = s.map(() => 0), E.current = s.map(() => 0), G.current = s.map(() => 0), Ce());
1222
+ }, Me = (r) => {
1223
+ const l = parseFloat(r.target.value) / 100 * K;
1224
+ Y(l), f.current && !ye && (f.current.currentTime = l);
1225
+ }, Oe = () => {
1226
+ he(!0);
1227
+ }, We = () => {
1228
+ f.current && (f.current.currentTime = U), he(!1);
1229
+ }, Ve = (r) => {
1230
+ const a = parseInt(r.target.value);
1231
+ we(a), $e(a === 0);
1232
+ }, Ue = () => {
1233
+ $e(!me);
1234
+ }, ze = (r) => {
1235
+ ue(parseFloat(r.target.value));
1236
+ }, Ke = () => {
1237
+ ce(!se);
1238
+ }, Se = (r, a) => {
1239
+ fe((l) => ({
1240
+ ...l,
1241
+ [r]: a
1242
+ }));
1243
+ }, Re = () => {
1244
+ fe({ bass: 0, mid: 0, treble: 0 });
1245
+ };
1246
+ L(() => {
1247
+ ((typeof k == "object" && Object.keys(k).length === 0 || !k) && !S || M) && He();
1248
+ }, [k]);
1249
+ const Ie = (r) => {
1250
+ if (isNaN(r)) return "0:00";
1251
+ const a = Math.floor(r / 60), l = Math.floor(r % 60);
1252
+ return `${a}:${l.toString().padStart(2, "0")}`;
1253
+ };
1254
+ return X && X.length > 0 ? X.map((r, a) => /* @__PURE__ */ e.jsxs("div", { className: "text-red-500 text-sm bg-red-50 p-3 rounded mb-4 border border-red-300", children: [
1255
+ /* @__PURE__ */ e.jsxs("strong", { children: [
1256
+ r[0],
1257
+ ":"
1258
+ ] }),
1259
+ " ",
1260
+ r[1]
1261
+ ] }, a)) : /* @__PURE__ */ e.jsx("div", { ref: ae, className: "w-full rounded-xl overflow-hidden", style: { backgroundColor: ve || q ? void 0 : j ? "#6060606a" : "#ffffffab" }, children: /* @__PURE__ */ e.jsxs("div", { style: { background: ve || q ? void 0 : d.bg }, className: ve || q ? "" : "p-4", children: [
1262
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
1263
+ /* @__PURE__ */ e.jsx("div", { className: `${q && H ? "opacity-30" : ""} ${ve || q ? "" : j ? "bg-black/40" : "bg-white/70"} rounded-lg ${ve ? "" : "mb-6"} ${ve || q ? "" : "p-4"} shadow-sm`, children: /* @__PURE__ */ e.jsx("div", { className: "flex justify-center items-end gap-1 h-64", ref: oe }) }),
1264
+ H && /* @__PURE__ */ e.jsxs("div", { className: `absolute inset-0 flex flex-col w-full justify-center z-10 ${!(ve || q) && (j ? "bg-black/50" : "bg-white/80")} rounded-lg p-4 shadow-sm transition-all duration-300`, children: [
1265
+ /* @__PURE__ */ e.jsx("h3", { className: `text-sm font-medium mb-4 ${j ? "text-gray-200" : "text-gray-700"}`, children: "Equalizer" }),
1266
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
1267
+ /* @__PURE__ */ e.jsxs("div", { children: [
1268
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
1269
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-300" : "text-gray-600"}`, children: "Bass" }),
1270
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${j ? "text-gray-300" : "text-gray-600"}`, children: [
1271
+ z.bass,
1272
+ " dB"
1273
+ ] })
1274
+ ] }),
1275
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1276
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
1277
+ /* @__PURE__ */ e.jsx(
1278
+ "input",
1279
+ {
1280
+ type: "range",
1281
+ min: "-20",
1282
+ max: "20",
1283
+ value: z.bass,
1284
+ onChange: (r) => Se("bass", parseInt(r.target.value)),
1285
+ className: "flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
1286
+ style: {
1287
+ background: `linear-gradient(to right, ${d.slider} ${(z.bass + 20) / 40 * 100}%, ${d.slider + "30"} ${(z.bass + 20) / 40 * 100}%)`
1288
+ }
1289
+ }
1290
+ ),
1291
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
1292
+ ] })
1293
+ ] }),
1294
+ /* @__PURE__ */ e.jsxs("div", { children: [
1295
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
1296
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-300" : "text-gray-600"}`, children: "Mid" }),
1297
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${j ? "text-gray-300" : "text-gray-600"}`, children: [
1298
+ z.mid,
1299
+ " dB"
1300
+ ] })
1301
+ ] }),
1302
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1303
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
1304
+ /* @__PURE__ */ e.jsx(
1305
+ "input",
1306
+ {
1307
+ type: "range",
1308
+ min: "-20",
1309
+ max: "20",
1310
+ value: z.mid,
1311
+ onChange: (r) => Se("mid", parseInt(r.target.value)),
1312
+ className: "flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
1313
+ style: {
1314
+ background: `linear-gradient(to right, ${d.slider} ${(z.mid + 20) / 40 * 100}%, ${d.slider + "30"} ${(z.mid + 20) / 40 * 100}%)`
1315
+ }
1316
+ }
1317
+ ),
1318
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
1319
+ ] })
1320
+ ] }),
1321
+ /* @__PURE__ */ e.jsxs("div", { children: [
1322
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
1323
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-300" : "text-gray-600"}`, children: "Treble" }),
1324
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${j ? "text-gray-300" : "text-gray-600"}`, children: [
1325
+ z.treble,
1326
+ " dB"
1327
+ ] })
1328
+ ] }),
1329
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1330
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
1331
+ /* @__PURE__ */ e.jsx(
1332
+ "input",
1333
+ {
1334
+ type: "range",
1335
+ min: "-20",
1336
+ max: "20",
1337
+ value: z.treble,
1338
+ onChange: (r) => Se("treble", parseInt(r.target.value)),
1339
+ className: "flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
1340
+ style: {
1341
+ background: `linear-gradient(to right, ${d.slider} ${(z.treble + 20) / 40 * 100}%, ${d.slider + "30"} ${(z.treble + 20) / 40 * 100}%)`
1342
+ }
1343
+ }
1344
+ ),
1345
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
1346
+ ] })
1347
+ ] })
1348
+ ] }),
1349
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end mt-4", children: /* @__PURE__ */ e.jsx(
1350
+ "button",
1351
+ {
1352
+ onClick: Re,
1353
+ className: `px-3 py-1 rounded text-xs ${j ? "bg-gray-700 text-gray-200 hover:bg-gray-600" : "bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,
1354
+ children: "Reset"
1355
+ }
1356
+ ) })
1357
+ ] })
1358
+ ] }),
1359
+ k.trackName && /* @__PURE__ */ e.jsxs("div", { className: "mb-6 flex items-center", children: [
1360
+ p && /* @__PURE__ */ e.jsx("div", { className: "mr-2", children: /* @__PURE__ */ e.jsx("img", { src: p, alt: "", className: `${S ? "animation-spin" : ""} h-12 w-12 rounded-full` }) }),
1361
+ /* @__PURE__ */ e.jsxs("div", { children: [
1362
+ /* @__PURE__ */ e.jsx("div", { className: `${j ? "text-gray-100" : "text-gray-700"} font-medium truncate`, children: u }),
1363
+ g && typeof g == "string" && /* @__PURE__ */ e.jsx("div", { className: `${j ? "text-gray-300" : "text-gray-500"} text-xs`, children: g })
1364
+ ] })
1365
+ ] }),
1366
+ k.seekbar && /* @__PURE__ */ e.jsx("div", { className: "mb-6", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center md:gap-1", children: [
1367
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-100" : "text-gray-600"} font-mono w-12`, children: Ie(U) }),
1368
+ /* @__PURE__ */ e.jsx(
1369
+ "input",
1370
+ {
1371
+ type: "range",
1372
+ min: "0",
1373
+ max: "100",
1374
+ value: K > 0 ? U / K * 100 : 0,
1375
+ onChange: Me,
1376
+ onMouseDown: Oe,
1377
+ onMouseUp: We,
1378
+ onTouchStart: Oe,
1379
+ onTouchEnd: We,
1380
+ disabled: !o,
1381
+ className: "flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",
1382
+ style: {
1383
+ background: o && K > 0 ? `linear-gradient(to right, ${d.slider} ${U / K * 100}%, ${d.slider + "30"} ${U / K * 100}%)` : d.slider + "30"
1384
+ }
1385
+ }
1386
+ ),
1387
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${j ? "text-gray-100" : "text-gray-600"} font-mono w-12 text-right`, children: Ie(K) })
1388
+ ] }) }),
1389
+ /* @__PURE__ */ e.jsxs("div", { className: `flex flex-wrap items-center ${le < 330 ? "gap-2" : "gap-3"}`, children: [
1390
+ k.play && /* @__PURE__ */ e.jsxs(
1391
+ "button",
1392
+ {
1393
+ onClick: He,
1394
+ disabled: !o,
1395
+ className: `${le < 350 ? "px-3 py-5" : "px-4 py-2 md:w-24"} rounded-full text-sm font-medium text-white disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all hover:opacity-90`,
1396
+ style: { backgroundColor: d.button },
1397
+ children: [
1398
+ /* @__PURE__ */ e.jsxs("div", { className: "relative w-4 flex items-center", children: [
1399
+ /* @__PURE__ */ e.jsx(Ze, { size: 16, className: `${S ? "" : "scale-0 translate-y-10"} transition-all absolute` }),
1400
+ /* @__PURE__ */ e.jsx(et, { size: 16, className: `${S ? "scale-0 -translate-y-10" : ""} transition-all absolute` })
1401
+ ] }),
1402
+ /* @__PURE__ */ e.jsx("span", { style: { display: le < 350 ? "none" : "block" }, children: S ? "Pause" : "Play" })
1403
+ ]
1404
+ }
1405
+ ),
1406
+ k.stop && /* @__PURE__ */ e.jsxs(
1407
+ "button",
1408
+ {
1409
+ onClick: Le,
1410
+ disabled: !o,
1411
+ className: `${j ? "bg-gray-100 text-black" : "bg-gray-700 text-white"} ${le < 600 ? "px-3 py-3" : "px-4 py-2"} rounded-full text-sm font-medium ${j ? "hover:bg-gray-300" : "hover:bg-gray-800"} disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,
1412
+ children: [
1413
+ /* @__PURE__ */ e.jsx(mt, { size: 16 }),
1414
+ /* @__PURE__ */ e.jsx("span", { style: { display: le < 600 ? "none" : "block" }, children: "Stop" })
1415
+ ]
1416
+ }
1417
+ ),
1418
+ k.equalizer && /* @__PURE__ */ e.jsxs(
1419
+ "button",
1420
+ {
1421
+ onClick: () => F(!H),
1422
+ disabled: !o,
1423
+ className: `${le < 600 ? "px-3 py-3" : "px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${H ? "text-white" : "bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,
1424
+ style: H ? { backgroundColor: d.button } : {},
1425
+ children: [
1426
+ /* @__PURE__ */ e.jsx(Qe, { size: 16 }),
1427
+ /* @__PURE__ */ e.jsx("span", { style: { display: le < 600 ? "none" : "block" }, children: "EQ" })
1428
+ ]
1429
+ }
1430
+ ),
1431
+ k.loop && /* @__PURE__ */ e.jsxs(
1432
+ "button",
1433
+ {
1434
+ onClick: Ke,
1435
+ disabled: !o,
1436
+ className: `${le < 700 ? "px-3 py-3" : "px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${se ? "text-white" : "bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,
1437
+ style: se ? { backgroundColor: d.button } : {},
1438
+ children: [
1439
+ /* @__PURE__ */ e.jsx(zt, { size: 16, className: `${se ? "rotate-180" : ""} transition-all` }),
1440
+ /* @__PURE__ */ e.jsx("span", { style: { display: le < 700 ? "none" : "block" }, children: "Loop" })
1441
+ ]
1442
+ }
1443
+ ),
1444
+ k.speed && /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(
1445
+ "select",
1446
+ {
1447
+ value: be,
1448
+ onChange: ze,
1449
+ className: `rounded-full text-sm font-medium border-none outline-none cursor-pointer transition-all bg-transparent ${j ? "text-gray-200" : "text-gray-800"}`,
1450
+ children: [
1451
+ /* @__PURE__ */ e.jsx("option", { value: "0.5", className: j ? "bg-gray-800 text-gray-100" : "bg-white text-gray-800", children: "0.5x" }),
1452
+ /* @__PURE__ */ e.jsx("option", { value: "0.75", className: j ? "bg-gray-800 text-gray-100" : "bg-white text-gray-800", children: "0.75x" }),
1453
+ /* @__PURE__ */ e.jsx("option", { value: "1", className: j ? "bg-gray-800 text-gray-100" : "bg-white text-gray-800", children: "1x" }),
1454
+ /* @__PURE__ */ e.jsx("option", { value: "1.25", className: j ? "bg-gray-800 text-gray-100" : "bg-white text-gray-800", children: "1.25x" }),
1455
+ /* @__PURE__ */ e.jsx("option", { value: "1.5", className: j ? "bg-gray-800 text-gray-100" : "bg-white text-gray-800", children: "1.5x" }),
1456
+ /* @__PURE__ */ e.jsx("option", { value: "2", className: j ? "bg-gray-800 text-gray-100" : "bg-white text-gray-800", children: "2x" })
1457
+ ]
1458
+ }
1459
+ ) }),
1460
+ k.volume && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 md:gap-3 ml-auto", children: [
1461
+ /* @__PURE__ */ e.jsx(
1462
+ "button",
1463
+ {
1464
+ onClick: Ue,
1465
+ className: "p-2 rounded-full hover:bg-gray-100/50 transition-all",
1466
+ children: me || b === 0 ? /* @__PURE__ */ e.jsx(st, { size: 20, className: j ? "text-gray-100" : "text-gray-600" }) : /* @__PURE__ */ e.jsx(at, { size: 20, className: j ? "text-gray-100" : "text-gray-600" })
1467
+ }
1468
+ ),
1469
+ /* @__PURE__ */ e.jsx(
1470
+ "input",
1471
+ {
1472
+ type: "range",
1473
+ min: "0",
1474
+ max: "100",
1475
+ value: b,
1476
+ onChange: Ve,
1477
+ className: "hide-for-xs w-24 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer",
1478
+ style: {
1479
+ background: `linear-gradient(to right, ${d.slider} ${b}%, ${d.slider + "30"} ${b}%)`,
1480
+ display: le < 460 ? "none" : "block"
1481
+ }
1482
+ }
1483
+ ),
1484
+ /* @__PURE__ */ e.jsxs("span", { style: { display: le < 800 ? "none" : "block" }, className: `hidden sm:block text-xs ${j ? "text-gray-100" : "text-gray-700"} font-mono w-10 text-right`, children: [
1485
+ b,
1486
+ "%"
1487
+ ] })
1488
+ ] })
1489
+ ] }),
1490
+ /* @__PURE__ */ e.jsx("style", { children: `
1491
+ input[type="range"]::-webkit-slider-thumb {
1492
+ -webkit-appearance: none;
1493
+ appearance: none;
1494
+ width: 16px;
1495
+ height: 16px;
1496
+ border-radius: 50%;
1497
+ background: ${d.slider};
1498
+ cursor: pointer;
1499
+ border: 2px solid white;
1500
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
1501
+ }
1502
+
1503
+ input[type="range"]::-moz-range-thumb {
1504
+ width: 16px;
1505
+ height: 16px;
1506
+ border-radius: 50%;
1507
+ background: ${d.slider};
1508
+ cursor: pointer;
1509
+ border: 2px solid white;
1510
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
1511
+ }
1512
+ input[type="range"].eq-slider::-webkit-slider-thumb {
1513
+ -webkit-appearance: none;
1514
+ appearance: none;
1515
+ width: 0;
1516
+ height: 0;
1517
+ background: transparent;
1518
+ border: none;
1519
+ box-shadow: none;
1520
+ }
1521
+ input[type="range"].eq-slider::-moz-range-thumb {
1522
+ width: 0;
1523
+ height: 0;
1524
+ background: transparent;
1525
+ border: none;
1526
+ box-shadow: none;
1527
+ }
1528
+ .hide-for-xs {
1529
+ display: flex;
1530
+ }
1531
+ @media (max-width: 480px) {
1532
+ .hide-for-xs {
1533
+ display: none;
1534
+ }
1535
+ }
1536
+ .animation-spin {
1537
+ animation: spin 15s infinite linear;
1538
+ }
1539
+
1540
+ @keyframes spin {
1541
+ from {
1542
+ transform: rotate(0deg);
1543
+ }
1544
+ to {
1545
+ transform: rotate(360deg)
1546
+ }
1547
+ }
1548
+ ` })
1549
+ ] }) });
1550
+ }
1551
+ function Kt({
1552
+ audio: o,
1553
+ gradient: u = ["#cd7eff", "#ff00f2"],
1554
+ background: g = "#f4e4ffff",
1555
+ autoPlay: m = !1,
1556
+ thumbnail: _ = null,
1557
+ width: p,
1558
+ equalizer: k = {
1559
+ bass: 0,
1560
+ mid: 0,
1561
+ treble: 0
1562
+ },
1563
+ mode: y = "light"
1564
+ }) {
1565
+ const [N, q] = v(!1), [M, O] = v(0), [S, V] = v(0), [U, Y] = v(!1), [K, $] = v(80), [b, we] = v(1), [me, $e] = v([]), [se, ce] = v(null), [ye, he] = v(!1), [X, ke] = v({
1566
+ bass: k.bass || 0,
1567
+ mid: k.mid || 0,
1568
+ treble: k.treble || 0
1569
+ }), H = C(null), F = C(null), z = C(null), fe = C(null), be = C(null), ue = C(null), le = () => {
1570
+ const s = [];
1571
+ for (let x = 0; x < 100; x++) {
1572
+ const E = 20 + Math.random() * 60;
1573
+ s.push(E);
1574
+ }
1575
+ return s;
1576
+ };
1577
+ L(() => {
1578
+ if (!o)
1579
+ return;
1580
+ if (!Array.isArray(u) || u.length < 2) {
1581
+ ce("Gradient must be an array with at least 2 colors");
1582
+ return;
1583
+ }
1584
+ const s = H.current;
1585
+ if (!s) return;
1586
+ const x = () => O(s.currentTime), E = () => {
1587
+ V(s.duration), $e(le());
1588
+ }, G = () => q(!1), J = (te) => {
1589
+ var d, j;
1590
+ ce(`Audio error: ${((j = (d = te.target) == null ? void 0 : d.error) == null ? void 0 : j.message) || "Failed to load audio"}`);
1591
+ };
1592
+ return s.addEventListener("timeupdate", x), s.addEventListener("loadedmetadata", E), s.addEventListener("ended", G), s.addEventListener("error", J), () => {
1593
+ s.removeEventListener("timeupdate", x), s.removeEventListener("loadedmetadata", E), s.removeEventListener("ended", G), s.removeEventListener("error", J);
1594
+ };
1595
+ }, [o, u, y]), L(() => {
1596
+ o && H.current && m && (H.current.play().catch((s) => {
1597
+ console.error("Play failed:", s), q(!1);
1598
+ }), q(!0));
1599
+ }, [o]), L(() => {
1600
+ if (H.current && !F.current && H.current) {
1601
+ const s = window.AudioContext || window.webkitAudioContext;
1602
+ if (s) {
1603
+ const x = new s();
1604
+ F.current = x;
1605
+ const E = x.createMediaElementSource(H.current);
1606
+ z.current = E;
1607
+ const G = x.createBiquadFilter();
1608
+ G.type = "lowshelf", G.frequency.value = 200, fe.current = G;
1609
+ const J = x.createBiquadFilter();
1610
+ J.type = "peaking", J.frequency.value = 1e3, J.Q.value = 1, be.current = J;
1611
+ const te = x.createBiquadFilter();
1612
+ te.type = "highshelf", te.frequency.value = 3e3, ue.current = te, E.connect(G).connect(J).connect(te).connect(x.destination);
1613
+ }
1614
+ }
1615
+ }, [o]), L(() => {
1616
+ H.current && (H.current.volume = U ? 0 : K / 100);
1617
+ }, [K, U]), L(() => {
1618
+ H.current && (H.current.playbackRate = b);
1619
+ }, [b]);
1620
+ const R = () => {
1621
+ H.current && (N ? H.current.pause() : H.current.play().catch((s) => {
1622
+ ce(`Playback failed: ${s instanceof Error ? s.message : String(s)}`);
1623
+ }), q(!N));
1624
+ }, f = () => {
1625
+ Y(!U);
1626
+ }, B = (s) => {
1627
+ $(parseInt(s.target.value)), U && parseInt(s.target.value) > 0 && Y(!1);
1628
+ }, ie = (s) => {
1629
+ we(parseFloat(s.target.value));
1630
+ }, Ne = (s) => {
1631
+ const x = s.currentTarget.getBoundingClientRect(), J = (s.clientX - x.left) / x.width * S;
1632
+ H.current && (H.current.currentTime = J, O(J));
1633
+ }, Q = (s, x) => {
1634
+ ke((E) => ({ ...E, [s]: x })), s === "bass" && fe.current && (fe.current.gain.value = x), s === "mid" && be.current && (be.current.gain.value = x), s === "treble" && ue.current && (ue.current.gain.value = x);
1635
+ }, xe = () => {
1636
+ Q("bass", 0), Q("mid", 0), Q("treble", 0);
1637
+ }, ne = (s) => {
1638
+ if (isNaN(s)) return "0:00";
1639
+ const x = Math.floor(s / 60), E = Math.floor(s % 60);
1640
+ return `${x}:${E.toString().padStart(2, "0")}`;
1641
+ }, T = S > 0 ? M / S * 100 : 0;
1642
+ if (se)
1643
+ return /* @__PURE__ */ e.jsx("div", { className: "w-lg p-6 rounded-xl", style: { background: g }, children: /* @__PURE__ */ e.jsxs("div", { className: `text-center ${y === "dark" ? "text-red-300" : "text-red-600"}`, children: [
1644
+ /* @__PURE__ */ e.jsx("p", { className: "font-medium", children: "Error" }),
1645
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: se })
1646
+ ] }) });
1647
+ if (!o) return null;
1648
+ const oe = y === "dark" ? "text-gray-300" : "text-gray-700", ae = y === "dark" ? "text-gray-400" : "text-gray-500";
1649
+ return /* @__PURE__ */ e.jsxs("div", { className: "w-full max-w-lg relative", style: { width: p + "px" }, children: [
1650
+ /* @__PURE__ */ e.jsx("audio", { ref: H, src: o }),
1651
+ /* @__PURE__ */ e.jsx("div", { className: "rounded-2xl shadow-2xl", children: /* @__PURE__ */ e.jsxs("div", { className: "rounded-2xl p-6 backdrop-blur-xl", style: { background: g }, children: [
1652
+ _ && /* @__PURE__ */ e.jsx("div", { className: "w-full p-4", children: /* @__PURE__ */ e.jsx("img", { src: _, alt: "", className: "w-full aspect-square rounded-xl" }) }),
1653
+ /* @__PURE__ */ e.jsxs(
1654
+ "div",
1655
+ {
1656
+ className: "relative h-20 mb-6 cursor-pointer",
1657
+ onClick: Ne,
1658
+ children: [
1659
+ /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-end justify-center h-full w-full gap-px", children: me.map((s, x) => {
1660
+ const G = x / me.length * 100 <= T;
1661
+ return /* @__PURE__ */ e.jsx(
1662
+ "div",
1663
+ {
1664
+ className: "w-1 rounded-t transition-all duration-150",
1665
+ style: {
1666
+ height: `${s}%`,
1667
+ background: G ? u[0] : u[1],
1668
+ opacity: G ? 1 : 0.4
1669
+ }
1670
+ },
1671
+ x
1672
+ );
1673
+ }) }),
1674
+ /* @__PURE__ */ e.jsx(
1675
+ "div",
1676
+ {
1677
+ className: "absolute top-0 h-full w-1 bg-white border-r border-black rounded-full transition-all duration-150",
1678
+ style: { left: `${T}%`, transform: "translateX(-50%)" }
1679
+ }
1680
+ )
1681
+ ]
1682
+ }
1683
+ ),
1684
+ /* @__PURE__ */ e.jsxs("div", { className: `flex justify-between text-sm ${ae} mb-6`, children: [
1685
+ /* @__PURE__ */ e.jsx("span", { children: ne(M) }),
1686
+ /* @__PURE__ */ e.jsx("span", { children: ne(S) })
1687
+ ] }),
1688
+ /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center justify-between mb-4", children: [
1689
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1690
+ /* @__PURE__ */ e.jsx(
1691
+ "button",
1692
+ {
1693
+ onClick: f,
1694
+ className: "p-2 rounded-full transition-all",
1695
+ style: {
1696
+ background: `linear-gradient(135deg, ${u[0]}, ${u[1]})`
1697
+ },
1698
+ children: U || K === 0 ? /* @__PURE__ */ e.jsx(st, { className: "w-4 h-4 text-white" }) : /* @__PURE__ */ e.jsx(at, { className: "w-4 h-4 text-white" })
1699
+ }
1700
+ ),
1701
+ /* @__PURE__ */ e.jsx(
1702
+ "input",
1703
+ {
1704
+ type: "range",
1705
+ min: "0",
1706
+ max: "100",
1707
+ value: K,
1708
+ onChange: B,
1709
+ className: `${p ? "" : "hidden sm:block"} w-20 h-1.5 rounded-lg appearance-none cursor-pointer`,
1710
+ style: {
1711
+ background: `linear-gradient(to right, ${u[0]} ${K}%, ${y === "dark" ? "#374151" : "#d1d5db"} ${K}%)`,
1712
+ display: p && p < 400 ? "none" : void 0
1713
+ }
1714
+ }
1715
+ ),
1716
+ p && p < 400 && /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ e.jsx(
1717
+ "button",
1718
+ {
1719
+ onClick: () => he(!ye),
1720
+ className: "p-2 rounded-full transition-all",
1721
+ style: {
1722
+ background: `linear-gradient(135deg, ${u[0]}, ${u[1]})`
1723
+ },
1724
+ children: /* @__PURE__ */ e.jsx(Qe, { className: "w-4 h-4 text-white" })
1725
+ }
1726
+ ) })
1727
+ ] }),
1728
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ e.jsx(
1729
+ "button",
1730
+ {
1731
+ onClick: R,
1732
+ className: "p-4 rounded-full transition-all hover:scale-105 shadow-lg",
1733
+ style: {
1734
+ background: `linear-gradient(135deg, ${u[0]}, ${u[1]})`
1735
+ },
1736
+ children: N ? /* @__PURE__ */ e.jsx(Ze, { className: "w-6 h-6 text-white fill-white" }) : /* @__PURE__ */ e.jsx(et, { className: "w-6 h-6 text-white fill-white" })
1737
+ }
1738
+ ) }),
1739
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1740
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ e.jsxs(
1741
+ "select",
1742
+ {
1743
+ value: b,
1744
+ style: { background: g, color: u[0] },
1745
+ onChange: ie,
1746
+ className: `py-1 px-2 rounded-lg text-sm ${oe} ${y === "dark" ? "bg-gray-800" : "bg-gray-100"}`,
1747
+ children: [
1748
+ /* @__PURE__ */ e.jsx("option", { value: "0.5", children: "0.5x" }),
1749
+ /* @__PURE__ */ e.jsx("option", { value: "0.75", children: "0.75x" }),
1750
+ /* @__PURE__ */ e.jsx("option", { value: "1", children: "1x" }),
1751
+ /* @__PURE__ */ e.jsx("option", { value: "1.25", children: "1.25x" }),
1752
+ /* @__PURE__ */ e.jsx("option", { value: "1.5", children: "1.5x" }),
1753
+ /* @__PURE__ */ e.jsx("option", { value: "2", children: "2x" })
1754
+ ]
1755
+ }
1756
+ ) }),
1757
+ !(p && p < 400) && /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ e.jsx(
1758
+ "button",
1759
+ {
1760
+ onClick: () => he(!ye),
1761
+ className: "p-2 rounded-full transition-all",
1762
+ style: {
1763
+ background: `linear-gradient(135deg, ${u[0]}, ${u[1]})`
1764
+ },
1765
+ children: /* @__PURE__ */ e.jsx(Qe, { className: "w-4 h-4 text-white" })
1766
+ }
1767
+ ) })
1768
+ ] })
1769
+ ] })
1770
+ ] }) }),
1771
+ ye && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 bg-black bg-opacity-20 flex items-center justify-center z-10 rounded-2xl p-4", children: /* @__PURE__ */ e.jsxs("div", { className: `max-w-xs w-full p-4 pt-2 rounded-xl ${y === "dark" ? "bg-gray-800" : "bg-white"}`, children: [
1772
+ /* @__PURE__ */ e.jsx("h3", { className: `text-lg font-medium mb-2 ${y === "dark" ? "text-gray-200" : "text-gray-700"}`, children: "Equalizer" }),
1773
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
1774
+ /* @__PURE__ */ e.jsxs("div", { children: [
1775
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
1776
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Bass" }),
1777
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${y === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
1778
+ X.bass,
1779
+ " dB"
1780
+ ] })
1781
+ ] }),
1782
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1783
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
1784
+ /* @__PURE__ */ e.jsx(
1785
+ "input",
1786
+ {
1787
+ type: "range",
1788
+ min: "-20",
1789
+ max: "20",
1790
+ value: X.bass,
1791
+ onChange: (s) => Q("bass", parseInt(s.target.value)),
1792
+ className: "flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
1793
+ style: {
1794
+ background: `linear-gradient(to right, ${u[0]} ${(X.bass + 20) / 40 * 100}%, ${u[1] + "30"} ${(X.bass + 20) / 40 * 100}%)`
1795
+ }
1796
+ }
1797
+ ),
1798
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
1799
+ ] })
1800
+ ] }),
1801
+ /* @__PURE__ */ e.jsxs("div", { children: [
1802
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
1803
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Mid" }),
1804
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${y === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
1805
+ X.mid,
1806
+ " dB"
1807
+ ] })
1808
+ ] }),
1809
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1810
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
1811
+ /* @__PURE__ */ e.jsx(
1812
+ "input",
1813
+ {
1814
+ type: "range",
1815
+ min: "-20",
1816
+ max: "20",
1817
+ value: X.mid,
1818
+ onChange: (s) => Q("mid", parseInt(s.target.value)),
1819
+ className: "flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
1820
+ style: {
1821
+ background: `linear-gradient(to right, ${u[0]} ${(X.mid + 20) / 40 * 100}%, ${u[1] + "30"} ${(X.mid + 20) / 40 * 100}%)`
1822
+ }
1823
+ }
1824
+ ),
1825
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
1826
+ ] })
1827
+ ] }),
1828
+ /* @__PURE__ */ e.jsxs("div", { children: [
1829
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
1830
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Treble" }),
1831
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${y === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
1832
+ X.treble,
1833
+ " dB"
1834
+ ] })
1835
+ ] }),
1836
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1837
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
1838
+ /* @__PURE__ */ e.jsx(
1839
+ "input",
1840
+ {
1841
+ type: "range",
1842
+ min: "-20",
1843
+ max: "20",
1844
+ value: X.treble,
1845
+ onChange: (s) => Q("treble", parseInt(s.target.value)),
1846
+ className: "flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
1847
+ style: {
1848
+ background: `linear-gradient(to right, ${u[0]} ${(X.treble + 20) / 40 * 100}%, ${u[1] + "30"} ${(X.treble + 20) / 40 * 100}%)`
1849
+ }
1850
+ }
1851
+ ),
1852
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${y === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
1853
+ ] })
1854
+ ] })
1855
+ ] }),
1856
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mt-6", children: [
1857
+ /* @__PURE__ */ e.jsx(
1858
+ "button",
1859
+ {
1860
+ onClick: xe,
1861
+ className: `px-3 py-1 rounded text-xs ${y === "dark" ? "bg-gray-700 text-gray-200 hover:bg-gray-600" : "bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,
1862
+ children: "Reset"
1863
+ }
1864
+ ),
1865
+ /* @__PURE__ */ e.jsx(
1866
+ "button",
1867
+ {
1868
+ onClick: () => he(!1),
1869
+ className: `px-3 py-1 rounded text-xs ${y === "dark" ? "bg-gray-700 text-gray-200 hover:bg-gray-600" : "bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,
1870
+ children: "Close"
1871
+ }
1872
+ )
1873
+ ] })
1874
+ ] }) }),
1875
+ /* @__PURE__ */ e.jsx("style", { children: `
1876
+ input[type="range"].eq-slider::-webkit-slider-thumb {
1877
+ -webkit-appearance: none;
1878
+ appearance: none;
1879
+ width: 0;
1880
+ height: 0;
1881
+ background: transparent;
1882
+ border: none;
1883
+ box-shadow: none;
1884
+ }
1885
+ input[type="range"].eq-slider::-moz-range-thumb {
1886
+ width: 0;
1887
+ height: 0;
1888
+ background: transparent;
1889
+ border: none;
1890
+ box-shadow: none;
1891
+ }
1892
+ ` })
1893
+ ] });
1894
+ }
1895
+ function Gt({ audio: o, thumbnail: u, gradient: g = ["#cd7eff", "#fe59f6"], background: m = "#1f273a", autoPlay: _ = !1 }) {
1896
+ const [p, k] = v(!1), [, y] = v(0), N = C(null), [q, M] = v(0), [O, S] = v(0), [V, U] = v(0);
1897
+ L(() => {
1898
+ const $ = N.current;
1899
+ if (!$) return;
1900
+ const b = () => y($.currentTime);
1901
+ return $.addEventListener("timeupdate", b), () => $.removeEventListener("timeupdate", b);
1902
+ }, []), L(() => {
1903
+ const $ = setInterval(() => {
1904
+ p && M((b) => b + 0.1);
1905
+ }, 100);
1906
+ return () => clearInterval($);
1907
+ }, [p]), L(() => {
1908
+ const $ = setInterval(() => {
1909
+ p && U((b) => b + 0.1);
1910
+ }, 100);
1911
+ return () => clearInterval($);
1912
+ }, [p]), L(() => {
1913
+ o && N.current && _ && (N.current.play().catch(() => k(!1)), k(!0));
1914
+ }, [o]), L(() => {
1915
+ const $ = N.current;
1916
+ if (!$) return;
1917
+ const b = () => {
1918
+ S($.duration), console.log("Audio duration:", $.duration);
1919
+ };
1920
+ return U(0), $.addEventListener("loadedmetadata", b), () => {
1921
+ $.removeEventListener("loadedmetadata", b);
1922
+ };
1923
+ }, [o]);
1924
+ const Y = () => {
1925
+ N.current && (p ? N.current.pause() : N.current.play().catch(($) => console.error("NanoPlayer play failed:", $)), k(!p));
1926
+ };
1927
+ if (!o) return null;
1928
+ const K = {
1929
+ background: `linear-gradient(135deg, ${g[0]}, ${g[1]})`
1930
+ };
1931
+ return /* @__PURE__ */ e.jsxs(
1932
+ "div",
1933
+ {
1934
+ style: { backgroundColor: m },
1935
+ className: `
1936
+ relative overflow-hidden inline-flex flex-col
1937
+ ${u ? "rounded-2xl" : "rounded-full"}
1938
+ px-3 py-2 shadow-lg
1939
+ ${u ? "w-[120px] h-[150px]" : "w-[110px] h-[40px]"}
1940
+ `,
1941
+ children: [
1942
+ /* @__PURE__ */ e.jsx(
1943
+ "audio",
1944
+ {
1945
+ ref: N,
1946
+ src: o,
1947
+ onEnded: () => {
1948
+ k(!1), U(0);
1949
+ }
1950
+ }
1951
+ ),
1952
+ /* @__PURE__ */ e.jsx(
1953
+ "div",
1954
+ {
1955
+ style: {
1956
+ width: `${(O > 0 ? V / O : 0) * 100}%`,
1957
+ backgroundImage: K.background
1958
+ },
1959
+ className: "absolute top-0 left-0 h-full opacity-20"
1960
+ }
1961
+ ),
1962
+ /* @__PURE__ */ e.jsxs("div", { className: "absolute flex flex-col", children: [
1963
+ u && /* @__PURE__ */ e.jsx("div", { className: "w-24 pb-2", children: /* @__PURE__ */ e.jsx("img", { src: u, alt: "", className: "w-24 aspect-square rounded-xl" }) }),
1964
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1965
+ /* @__PURE__ */ e.jsx(
1966
+ "button",
1967
+ {
1968
+ onClick: Y,
1969
+ style: K,
1970
+ className: "p-1.5 rounded-full hover:scale-110 transition-transform flex-shrink-0",
1971
+ children: p ? /* @__PURE__ */ e.jsx(Ze, { fill: m, className: "w-3 h-3 text-transparent" }) : /* @__PURE__ */ e.jsx(et, { fill: m, className: "w-3 h-3 text-transparent" })
1972
+ }
1973
+ ),
1974
+ /* @__PURE__ */ e.jsx("div", { className: "flex w-full min-w-12 items-center gap-0.5 h-6", children: [...Array(12)].map(($, b) => /* @__PURE__ */ e.jsx(
1975
+ "div",
1976
+ {
1977
+ className: "rounded-full transition-all duration-200",
1978
+ style: {
1979
+ width: "100%",
1980
+ background: `linear-gradient(to top, ${g[0]}, ${g[1]})`,
1981
+ height: p ? `${8 + Math.sin((q * 8 + b) * 0.6) * 10}px` : "8px",
1982
+ opacity: p ? 0.8 : 0.4
1983
+ }
1984
+ },
1985
+ b
1986
+ )) })
1987
+ ] })
1988
+ ] })
1989
+ ]
1990
+ }
1991
+ );
1992
+ }
1993
+ function Xt({
1994
+ video: o,
1995
+ name: u = "No video loaded",
1996
+ audioVisual: g = null,
1997
+ volume: m = 100,
1998
+ thumbnail: _ = null,
1999
+ controls: p = {
2000
+ play: !0,
2001
+ pause: !0,
2002
+ stop: !0,
2003
+ seekbar: !0,
2004
+ volume: !0,
2005
+ fullscreen: !0,
2006
+ videoName: !0,
2007
+ equalizer: !0,
2008
+ speed: !0
2009
+ },
2010
+ mode: k = "light",
2011
+ transparent: y = !1,
2012
+ autoPlay: N = !1,
2013
+ color: q = "#3b82f6",
2014
+ equalizer: M = {
2015
+ bass: 0,
2016
+ mid: 0,
2017
+ treble: 0
2018
+ }
2019
+ }) {
2020
+ const [O, S] = v(!1), [V, U] = v(0), [Y, K] = v(0), [$, b] = v(m || 100), [we, me] = v(!1), [$e, se] = v(!1), [ce, ye] = v(!1), [he, X] = v([]), [ke, H] = v(!1), [F, z] = v({
2021
+ bass: M.bass || 0,
2022
+ mid: M.mid || 0,
2023
+ treble: M.treble || 0
2024
+ }), [fe, be] = v(1), [ue, le] = v(0), R = C(null), f = C(null), B = C(null), ie = C(null), Ne = C(null), Q = C(null), xe = C(null), ne = C(null), T = C(null), oe = C(null), ae = C(0), s = C(0), x = C(0), E = C(0), G = C(0), J = C(0), te = C(!1), d = k === "dark" || ce, j = typeof p == "object" && Object.keys(p).length === 0;
2025
+ L(() => {
2026
+ const r = f.current;
2027
+ if (!r) return;
2028
+ const a = new ResizeObserver((l) => {
2029
+ for (let i of l)
2030
+ le(i.contentRect.width);
2031
+ });
2032
+ return a.observe(r), () => a.disconnect();
2033
+ }, []), L(() => {
2034
+ const r = [];
2035
+ o && typeof o != "string" && r.push(["TypeError", "video must be a string (URL or path)"]), u && typeof u != "string" && r.push(["TypeError", "name must be a string"]), (typeof m != "number" || m < 0 || m > 100) && r.push(["TypeError", "volume must be a number between 0 and 100"]), g && typeof g != "object" ? r.push(["TypeError", "audioVisual must be an object"]) : g && (["left", "right", "top", "bottom"].includes(g.side) || r.push(["ValueError", "audioVisual.side must be 'left', 'right', 'top', or 'bottom'"])), r.length > 0 ? (X(r), console.group("%cVideoPlayer: Prop validation failed", "color:red"), r.forEach((a) => console.error(`${a[0]}: ${a[1]}`)), console.groupEnd()) : X([]);
2036
+ }, [o, u, m, g, p, k]), L(() => {
2037
+ if (!R.current) return;
2038
+ const r = R.current, a = () => {
2039
+ $e || U(r.currentTime);
2040
+ }, l = () => {
2041
+ K(r.duration);
2042
+ }, i = () => {
2043
+ S(!1), T.current && cancelAnimationFrame(T.current);
2044
+ }, w = () => S(!0), I = () => S(!1);
2045
+ return r.addEventListener("timeupdate", a), r.addEventListener("loadedmetadata", l), r.addEventListener("ended", i), r.addEventListener("play", w), r.addEventListener("pause", I), () => {
2046
+ r.removeEventListener("timeupdate", a), r.removeEventListener("loadedmetadata", l), r.removeEventListener("ended", i), r.removeEventListener("play", w), r.removeEventListener("pause", I);
2047
+ };
2048
+ }, [$e]), L(() => {
2049
+ if (o) {
2050
+ const r = O, a = $;
2051
+ if (R.current && R.current.pause(), R.current) {
2052
+ R.current.pause(), R.current.src = o, R.current.volume = we ? 0 : a / 100;
2053
+ const l = () => {
2054
+ r && R.current && R.current.play().catch((i) => console.error("Play failed:", i)), R.current && R.current.removeEventListener("canplay", l);
2055
+ };
2056
+ R.current.addEventListener("canplay", l), R.current.load();
2057
+ }
2058
+ U(0), S(!1), ae.current = 0, s.current = 0, x.current = 0, E.current = 0, G.current = 0, J.current = 0, Ee();
2059
+ }
2060
+ }, [o]), L(() => {
2061
+ R.current && (R.current.volume = we ? 0 : $ / 100);
2062
+ }, [$, we]), L(() => {
2063
+ R.current && (R.current.playbackRate = fe);
2064
+ }, [fe]), L(() => {
2065
+ B.current && (Q.current && (Q.current.gain.value = F.bass), xe.current && (xe.current.gain.value = F.mid), ne.current && (ne.current.gain.value = F.treble));
2066
+ }, [F]), L(() => {
2067
+ te.current = O, T.current && (cancelAnimationFrame(T.current), T.current = null), O && g ? (B.current || ve(), Fe()) : !O && g && qe();
2068
+ }, [O, g]), L(() => {
2069
+ const r = () => {
2070
+ ye(!!document.fullscreenElement);
2071
+ };
2072
+ return document.addEventListener("fullscreenchange", r), () => document.removeEventListener("fullscreenchange", r);
2073
+ }, []), L(() => () => {
2074
+ T.current && cancelAnimationFrame(T.current), B.current && B.current.close().catch((r) => console.warn("AudioContext cleanup error:", r));
2075
+ }, []);
2076
+ const ve = () => {
2077
+ if (!B.current && R.current)
2078
+ try {
2079
+ const r = window.AudioContext || window.webkitAudioContext;
2080
+ if (r) {
2081
+ const a = new r();
2082
+ B.current = a;
2083
+ const l = a.createBiquadFilter();
2084
+ l.type = "lowshelf", l.frequency.value = 320, l.gain.value = F.bass;
2085
+ const i = a.createBiquadFilter();
2086
+ i.type = "peaking", i.frequency.value = 1e3, i.Q.value = 0.5, i.gain.value = F.mid;
2087
+ const w = a.createBiquadFilter();
2088
+ w.type = "highshelf", w.frequency.value = 3200, w.gain.value = F.treble;
2089
+ const I = a.createAnalyser();
2090
+ I.fftSize = 2048, I.smoothingTimeConstant = 0.8;
2091
+ const de = a.createMediaElementSource(R.current);
2092
+ de.connect(l), l.connect(i), i.connect(w), w.connect(I), w.connect(a.destination), Q.current = l, xe.current = i, ne.current = w, ie.current = I, Ne.current = de;
2093
+ }
2094
+ } catch (r) {
2095
+ console.error("Failed to setup audio context:", r);
2096
+ }
2097
+ }, qe = () => {
2098
+ if (te.current) return;
2099
+ ae.current *= 0.7, s.current *= 0.7;
2100
+ const r = Date.now();
2101
+ r - G.current > 1500 && (x.current *= 0.95), r - J.current > 1500 && (E.current *= 0.95), Ee();
2102
+ const a = Math.max(ae.current, s.current), l = Math.max(x.current, E.current);
2103
+ a > 0.01 || l > 0.01 ? T.current = requestAnimationFrame(qe) : (te.current || (ae.current = 0, s.current = 0, x.current = 0, E.current = 0, Ee()), T.current && cancelAnimationFrame(T.current), T.current = null);
2104
+ }, Fe = () => {
2105
+ if (!ie.current || !te.current) return;
2106
+ const r = ie.current.frequencyBinCount, a = new Uint8Array(r);
2107
+ ie.current.getByteFrequencyData(a);
2108
+ let l = 0;
2109
+ for (let I = 0; I < r; I++)
2110
+ l += a[I];
2111
+ let i = l / r / 255;
2112
+ i = Math.pow(i, 0.5), ae.current = ae.current * 0.7 + i * 0.3, s.current = s.current * 0.7 + i * 0.3;
2113
+ const w = Date.now();
2114
+ ae.current > x.current ? (x.current = ae.current, G.current = w) : w - G.current > 1500 && (x.current *= 0.95), s.current > E.current ? (E.current = s.current, J.current = w) : w - J.current > 1500 && (E.current *= 0.95), Ee(), T.current = requestAnimationFrame(Fe);
2115
+ }, Ee = () => {
2116
+ if (!oe.current || !g) return;
2117
+ const r = g.color || "#00ff00", a = g.peak || "#ff0000", l = ae.current * 100, i = s.current * 100, w = 100 - x.current * 100, I = 100 - E.current * 100;
2118
+ g.side === "top" || g.side === "bottom" ? oe.current.innerHTML = `
2119
+ <div class="flex flex-col gap-1 h-full justify-center">
2120
+ <div class="flex items-center justify-center gap-2">
2121
+ <div class="text-xs ${d ? "text-gray-100" : "text-gray-900"} opacity-80 w-4 text-center">L</div>
2122
+ <div class="relative flex-1 h-3 bg-black/40 rounded-full overflow-hidden flex justify-end">
2123
+ <div class="h-full rounded-l-full transition-all duration-75" style="width: ${l}%; background: ${r};"></div>
2124
+ ${x.current > 0.1 ? `<div class="absolute top-0 w-1 h-full transition-all duration-100" style="right: ${x.current * 100}%; background: ${a};"></div>` : ""}
2125
+ </div>
2126
+ <div class="w-px h-4 bg-white/20"></div>
2127
+ <div class="relative flex-1 h-3 bg-black/40 rounded-full overflow-hidden flex justify-start">
2128
+ <div class="h-full rounded-r-full transition-all duration-75" style="width: ${i}%; background: ${r};"></div>
2129
+ ${E.current > 0.1 ? `<div class="absolute top-0 w-1 h-full transition-all duration-100" style="left: ${E.current * 100}%; background: ${a};"></div>` : ""}
2130
+ </div>
2131
+ <div class="text-xs ${d ? "text-gray-100" : "text-gray-900"} opacity-80 w-4 text-center">R</div>
2132
+ </div>
2133
+ </div>
2134
+ ` : oe.current.innerHTML = `
2135
+ <div class="flex gap-2 h-full">
2136
+ <div class="flex-1 flex flex-col">
2137
+ <div class="text-xs text-white opacity-70 text-center mb-1">L</div>
2138
+ <div class="flex-1 relative flex flex-col justify-end bg-black/30 rounded-lg overflow-hidden">
2139
+ <div class="rounded-t transition-all duration-75" style="height: ${l}%; background: ${r};">
2140
+ ${x.current > 0.1 ? `<div class="absolute w-full h-1 transition-all duration-100" style="top: ${w}%; background: ${a};"></div>` : ""}
2141
+ </div>
2142
+ </div>
2143
+ </div>
2144
+ <div class="flex-1 flex flex-col">
2145
+ <div class="text-xs text-white opacity-70 text-center mb-1">R</div>
2146
+ <div class="flex-1 relative flex flex-col justify-end bg-black/30 rounded-lg overflow-hidden">
2147
+ <div class="rounded-t transition-all duration-75" style="height: ${i}%; background: ${r};">
2148
+ ${E.current > 0.1 ? `<div class="absolute w-full h-1 transition-all duration-100" style="top: ${I}%; background: ${a};"></div>` : ""}
2149
+ </div>
2150
+ </div>
2151
+ </div>
2152
+ `;
2153
+ }, _e = () => {
2154
+ !R.current || !o || (O ? R.current.pause() : (B.current && B.current.state === "suspended" && B.current.resume(), R.current.play().catch((r) => console.error("Play failed:", r))));
2155
+ }, Ce = () => {
2156
+ R.current && (R.current.pause(), R.current.currentTime = 0, S(!1), U(0), ae.current = 0, s.current = 0, x.current = 0, E.current = 0, Ee());
2157
+ }, He = (r) => {
2158
+ const l = parseFloat(r.target.value) / 100 * Y;
2159
+ U(l), R.current && !$e && (R.current.currentTime = l);
2160
+ }, Le = () => se(!0), Me = () => {
2161
+ R.current && (R.current.currentTime = V), se(!1);
2162
+ }, Oe = (r) => {
2163
+ const a = parseInt(r.target.value);
2164
+ b(a), me(a === 0);
2165
+ }, We = (r) => {
2166
+ be(parseFloat(r.target.value));
2167
+ }, Ve = () => me(!we), Ue = () => {
2168
+ f.current && (document.fullscreenElement ? document.exitFullscreen() : f.current.requestFullscreen().catch((r) => console.error("Fullscreen failed:", r)));
2169
+ }, ze = (r, a) => {
2170
+ z((l) => ({
2171
+ ...l,
2172
+ [r]: a
2173
+ })), B.current && (r === "bass" && Q.current && (Q.current.gain.value = a), r === "mid" && xe.current && (xe.current.gain.value = a), r === "treble" && ne.current && (ne.current.gain.value = a));
2174
+ }, Ke = () => {
2175
+ z({ bass: 0, mid: 0, treble: 0 });
2176
+ }, Se = (r) => {
2177
+ if (isNaN(r)) return "0:00";
2178
+ const a = Math.floor(r / 60), l = Math.floor(r % 60);
2179
+ return `${a}:${l.toString().padStart(2, "0")}`;
2180
+ };
2181
+ if (L(() => {
2182
+ (j && !O || N) && _e();
2183
+ }, [p]), he && he.length > 0)
2184
+ return he.map((r, a) => /* @__PURE__ */ e.jsxs("div", { className: "text-red-500 text-sm bg-red-50 p-3 rounded mb-4 border border-red-300", children: [
2185
+ /* @__PURE__ */ e.jsxs("strong", { children: [
2186
+ r[0],
2187
+ ":"
2188
+ ] }),
2189
+ " ",
2190
+ r[1]
2191
+ ] }, a));
2192
+ const Re = g ? g.side : null, Ie = Re === "top" || Re === "bottom";
2193
+ return /* @__PURE__ */ e.jsx(
2194
+ "div",
2195
+ {
2196
+ ref: f,
2197
+ className: `rounded-xl overflow-hidden transition-all duration-300 ${ce ? "fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black" : "relative"}`,
2198
+ style: { backgroundColor: j || y ? void 0 : d ? "#49494937" : "white" },
2199
+ children: /* @__PURE__ */ e.jsxs("div", { style: { background: j || y ? void 0 : d ? "#1a1a1ab0" : "#f5f5f5", height: ce ? "100%" : "auto" }, className: `${j || y ? "" : "p-4"} ${ce ? "flex flex-col flex-1" : ""}`, children: [
2200
+ p.videoName && !ce && /* @__PURE__ */ e.jsx("div", { className: "mb-4", children: /* @__PURE__ */ e.jsx("div", { className: `${d ? "text-gray-100" : "text-gray-700"} font-medium`, children: u }) }),
2201
+ /* @__PURE__ */ e.jsxs("div", { className: `relative ${Ie ? "flex flex-col gap-3" : "flex gap-3"} ${ce ? "flex-1 min-h-0" : "mb-4"}`, children: [
2202
+ g && Re === "top" && /* @__PURE__ */ e.jsx("div", { className: "w-full h-12", ref: oe }),
2203
+ /* @__PURE__ */ e.jsxs("div", { className: `flex ${!Ie && "flex-1"} gap-3`, children: [
2204
+ g && Re === "left" && /* @__PURE__ */ e.jsx("div", { className: "w-12 bg-black/50 rounded-lg p-1", ref: oe }),
2205
+ /* @__PURE__ */ e.jsxs("div", { className: `flex-1 ${d ? "bg-black/70" : "bg-white/70"} rounded-lg overflow-hidden relative`, children: [
2206
+ /* @__PURE__ */ e.jsxs(
2207
+ "video",
2208
+ {
2209
+ ref: R,
2210
+ className: "w-full h-full object-contain",
2211
+ poster: _ || void 0,
2212
+ children: [
2213
+ o && /* @__PURE__ */ e.jsx("source", { src: o }),
2214
+ "Your browser does not support the video tag."
2215
+ ]
2216
+ }
2217
+ ),
2218
+ ke && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex flex-col w-full justify-center z-10 rounded-lg p-4 shadow-sm transition-all duration-300", children: /* @__PURE__ */ e.jsxs("div", { className: `max-w-[600px] w-full mx-auto flex flex-col justify-center z-10 ${d ? "bg-black/70" : "bg-white/80"} rounded-lg p-4 shadow-sm transition-all duration-300`, children: [
2219
+ /* @__PURE__ */ e.jsx("h3", { className: `text-sm font-medium mb-4 ${d ? "text-gray-200" : "text-gray-700"}`, children: "Equalizer" }),
2220
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2221
+ /* @__PURE__ */ e.jsxs("div", { children: [
2222
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
2223
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-300" : "text-gray-600"}`, children: "Bass" }),
2224
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${d ? "text-gray-300" : "text-gray-600"}`, children: [
2225
+ F.bass,
2226
+ " dB"
2227
+ ] })
2228
+ ] }),
2229
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2230
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
2231
+ /* @__PURE__ */ e.jsx(
2232
+ "input",
2233
+ {
2234
+ type: "range",
2235
+ min: "-20",
2236
+ max: "20",
2237
+ value: F.bass,
2238
+ onChange: (r) => ze("bass", parseInt(r.target.value)),
2239
+ className: "flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
2240
+ style: {
2241
+ background: `linear-gradient(to right, ${q} ${(F.bass + 20) / 40 * 100}%, #e5e7eb ${(F.bass + 20) / 40 * 100}%)`
2242
+ }
2243
+ }
2244
+ ),
2245
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
2246
+ ] })
2247
+ ] }),
2248
+ /* @__PURE__ */ e.jsxs("div", { children: [
2249
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
2250
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-300" : "text-gray-600"}`, children: "Mid" }),
2251
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${d ? "text-gray-300" : "text-gray-600"}`, children: [
2252
+ F.mid,
2253
+ " dB"
2254
+ ] })
2255
+ ] }),
2256
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2257
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
2258
+ /* @__PURE__ */ e.jsx(
2259
+ "input",
2260
+ {
2261
+ type: "range",
2262
+ min: "-20",
2263
+ max: "20",
2264
+ value: F.mid,
2265
+ onChange: (r) => ze("mid", parseInt(r.target.value)),
2266
+ className: "flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
2267
+ style: {
2268
+ background: `linear-gradient(to right, ${q} ${(F.mid + 20) / 40 * 100}%, #e5e7eb ${(F.mid + 20) / 40 * 100}%)`
2269
+ }
2270
+ }
2271
+ ),
2272
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
2273
+ ] })
2274
+ ] }),
2275
+ /* @__PURE__ */ e.jsxs("div", { children: [
2276
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-1", children: [
2277
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-300" : "text-gray-600"}`, children: "Treble" }),
2278
+ /* @__PURE__ */ e.jsxs("span", { className: `text-xs ${d ? "text-gray-300" : "text-gray-600"}`, children: [
2279
+ F.treble,
2280
+ " dB"
2281
+ ] })
2282
+ ] }),
2283
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2284
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-400" : "text-gray-500"}`, children: "-20" }),
2285
+ /* @__PURE__ */ e.jsx(
2286
+ "input",
2287
+ {
2288
+ type: "range",
2289
+ min: "-20",
2290
+ max: "20",
2291
+ value: F.treble,
2292
+ onChange: (r) => ze("treble", parseInt(r.target.value)),
2293
+ className: "flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",
2294
+ style: {
2295
+ background: `linear-gradient(to right, ${q} ${(F.treble + 20) / 40 * 100}%, #e5e7eb ${(F.treble + 20) / 40 * 100}%)`
2296
+ }
2297
+ }
2298
+ ),
2299
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-400" : "text-gray-500"}`, children: "+20" })
2300
+ ] })
2301
+ ] })
2302
+ ] }),
2303
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mt-6", children: [
2304
+ /* @__PURE__ */ e.jsx(
2305
+ "button",
2306
+ {
2307
+ onClick: Ke,
2308
+ className: `px-3 py-1 rounded text-xs ${d ? "bg-gray-700 text-gray-200 hover:bg-gray-600" : "bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,
2309
+ children: "Reset"
2310
+ }
2311
+ ),
2312
+ /* @__PURE__ */ e.jsx(
2313
+ "button",
2314
+ {
2315
+ onClick: () => H(!1),
2316
+ className: `ml-2 px-3 py-1 rounded text-xs ${d ? "bg-gray-700 text-gray-200 hover:bg-gray-600" : "bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,
2317
+ children: "Close"
2318
+ }
2319
+ )
2320
+ ] })
2321
+ ] }) })
2322
+ ] }),
2323
+ g && Re === "right" && /* @__PURE__ */ e.jsx("div", { className: "w-12 bg-black/50 rounded-lg p-1", ref: oe })
2324
+ ] }),
2325
+ g && Re === "bottom" && /* @__PURE__ */ e.jsx("div", { className: "w-full h-12", ref: oe })
2326
+ ] }),
2327
+ p.seekbar && /* @__PURE__ */ e.jsx("div", { className: `mb-4 ${ce ? "mt-3" : ""}`, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2328
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-100" : "text-gray-600"} font-mono w-12`, children: Se(V) }),
2329
+ /* @__PURE__ */ e.jsx(
2330
+ "input",
2331
+ {
2332
+ type: "range",
2333
+ min: "0",
2334
+ max: "100",
2335
+ value: Y > 0 ? V / Y * 100 : 0,
2336
+ onChange: He,
2337
+ onMouseDown: Le,
2338
+ onMouseUp: Me,
2339
+ onTouchStart: Le,
2340
+ onTouchEnd: Me,
2341
+ disabled: !o,
2342
+ className: "flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",
2343
+ style: {
2344
+ background: o && Y > 0 ? `linear-gradient(to right, ${q} ${V / Y * 100}%, #e5e7eb ${V / Y * 100}%)` : "#e5e7eb"
2345
+ }
2346
+ }
2347
+ ),
2348
+ /* @__PURE__ */ e.jsx("span", { className: `text-xs ${d ? "text-gray-100" : "text-gray-600"} font-mono w-12 text-right`, children: Se(Y) })
2349
+ ] }) }),
2350
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
2351
+ p.play && /* @__PURE__ */ e.jsxs(
2352
+ "button",
2353
+ {
2354
+ onClick: _e,
2355
+ disabled: !o,
2356
+ style: { backgroundColor: q },
2357
+ className: `${ue > 400 ? " px-4 py-2" : "px-3 py-5"} rounded-full text-sm font-medium text-white hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,
2358
+ children: [
2359
+ /* @__PURE__ */ e.jsxs("div", { className: "relative w-4 flex items-center", children: [
2360
+ /* @__PURE__ */ e.jsx(Ze, { size: 16, className: `${O ? "" : "scale-0 translate-y-10"} transition-all absolute` }),
2361
+ /* @__PURE__ */ e.jsx(et, { size: 16, className: `${O ? "scale-0 -translate-y-10" : ""} transition-all absolute` })
2362
+ ] }),
2363
+ ue > 400 && (O ? "Pause" : "Play")
2364
+ ]
2365
+ }
2366
+ ),
2367
+ p.stop && /* @__PURE__ */ e.jsx(
2368
+ "button",
2369
+ {
2370
+ onClick: Ce,
2371
+ disabled: !o,
2372
+ className: `${d ? "bg-gray-100 text-black hover:bg-gray-300" : "bg-gray-700 text-white hover:bg-gray-800"} px-3 py-3 rounded-full text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,
2373
+ children: /* @__PURE__ */ e.jsx(mt, { size: 16 })
2374
+ }
2375
+ ),
2376
+ p.fullscreen && /* @__PURE__ */ e.jsxs(
2377
+ "button",
2378
+ {
2379
+ onClick: Ue,
2380
+ className: `${ue < 800 ? "px-3 py-3" : "px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${d ? "bg-gray-100 text-black hover:bg-gray-300" : "bg-gray-700 text-white hover:bg-gray-800"}`,
2381
+ children: [
2382
+ ce ? /* @__PURE__ */ e.jsx(Ft, { size: 16 }) : /* @__PURE__ */ e.jsx(St, { size: 16 }),
2383
+ /* @__PURE__ */ e.jsx("span", { style: { display: ue < 800 ? "none" : "block" }, children: ce ? "Exit" : "Full" })
2384
+ ]
2385
+ }
2386
+ ),
2387
+ p.equalizer && /* @__PURE__ */ e.jsxs(
2388
+ "button",
2389
+ {
2390
+ onClick: () => H(!ke),
2391
+ disabled: !o,
2392
+ className: `${ue < 700 ? "px-3 py-3" : "px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${ke ? "text-white" : "bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,
2393
+ style: ke ? { backgroundColor: q } : {},
2394
+ children: [
2395
+ /* @__PURE__ */ e.jsx(Qe, { size: 16 }),
2396
+ /* @__PURE__ */ e.jsx("span", { style: { display: ue < 700 ? "none" : "block" }, children: "EQ" })
2397
+ ]
2398
+ }
2399
+ ),
2400
+ p.speed && /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(
2401
+ "select",
2402
+ {
2403
+ value: fe,
2404
+ onChange: We,
2405
+ className: `rounded-full text-sm font-medium border-none outline-none cursor-pointer transition-all bg-transparent ${d ? "text-gray-200" : "text-gray-800"}`,
2406
+ children: [
2407
+ /* @__PURE__ */ e.jsx("option", { value: "0.5", className: d ? "bg-gray-800 text-gray-100" : "bg-gray-100 text-gray-800", children: "0.5x" }),
2408
+ /* @__PURE__ */ e.jsx("option", { value: "0.75", className: d ? "bg-gray-800 text-gray-100" : "bg-gray-100 text-gray-800", children: "0.75x" }),
2409
+ /* @__PURE__ */ e.jsx("option", { value: "1", className: d ? "bg-gray-800 text-gray-100" : "bg-gray-100 text-gray-800", children: "1x" }),
2410
+ /* @__PURE__ */ e.jsx("option", { value: "1.25", className: d ? "bg-gray-800 text-gray-100" : "bg-gray-100 text-gray-800", children: "1.25x" }),
2411
+ /* @__PURE__ */ e.jsx("option", { value: "1.5", className: d ? "bg-gray-800 text-gray-100" : "bg-gray-100 text-gray-800", children: "1.5x" }),
2412
+ /* @__PURE__ */ e.jsx("option", { value: "2", className: d ? "bg-gray-800 text-gray-100" : "bg-gray-100 text-gray-800", children: "2x" })
2413
+ ]
2414
+ }
2415
+ ) }),
2416
+ p.volume && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 md:gap-3 ml-auto", children: [
2417
+ /* @__PURE__ */ e.jsx(
2418
+ "button",
2419
+ {
2420
+ onClick: Ve,
2421
+ className: "p-2 rounded-lg hover:bg-gray-100 transition-all",
2422
+ children: we || $ === 0 ? /* @__PURE__ */ e.jsx(st, { size: 20, className: d ? "text-gray-100" : "text-gray-600" }) : /* @__PURE__ */ e.jsx(at, { size: 20, className: d ? "text-gray-100" : "text-gray-600" })
2423
+ }
2424
+ ),
2425
+ /* @__PURE__ */ e.jsx(
2426
+ "input",
2427
+ {
2428
+ type: "range",
2429
+ min: "0",
2430
+ max: "100",
2431
+ value: $,
2432
+ onChange: Oe,
2433
+ className: "hide-for-xs w-24 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer",
2434
+ style: {
2435
+ background: `linear-gradient(to right, ${q} ${$}%, #e5e7eb ${$}%)`,
2436
+ display: ue < 460 ? "none" : "block"
2437
+ }
2438
+ }
2439
+ ),
2440
+ /* @__PURE__ */ e.jsxs("span", { style: { display: ue < 800 ? "none" : "block" }, className: `text-xs ${d ? "text-gray-100" : "text-gray-700"} font-mono w-10 text-right`, children: [
2441
+ $,
2442
+ "%"
2443
+ ] })
2444
+ ] })
2445
+ ] }),
2446
+ /* @__PURE__ */ e.jsx("style", { children: `
2447
+ input[type="range"]::-webkit-slider-thumb {
2448
+ -webkit-appearance: none;
2449
+ appearance: none;
2450
+ width: 16px;
2451
+ height: 16px;
2452
+ border-radius: 50%;
2453
+ background: ${q};
2454
+ cursor: pointer;
2455
+ border: 2px solid white;
2456
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
2457
+ }
2458
+
2459
+ input[type="range"]::-moz-range-thumb {
2460
+ width: 16px;
2461
+ height: 16px;
2462
+ border-radius: 50%;
2463
+ background: ${q};
2464
+ cursor: pointer;
2465
+ border: 2px solid white;
2466
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
2467
+ }
2468
+ input[type="range"].eq-slider::-webkit-slider-thumb {
2469
+ -webkit-appearance: none;
2470
+ appearance: none;
2471
+ width: 0;
2472
+ height: 0;
2473
+ background: transparent;
2474
+ border: none;
2475
+ box-shadow: none;
2476
+ }
2477
+ input[type="range"].eq-slider::-moz-range-thumb {
2478
+ width: 0;
2479
+ height: 0;
2480
+ background: transparent;
2481
+ border: none;
2482
+ box-shadow: none;
2483
+ }
2484
+ .hide-for-xs {
2485
+ display: flex;
2486
+ }
2487
+ @media (max-width: 480px) {
2488
+ .hide-for-xs {
2489
+ display: none;
2490
+ }
2491
+ }
2492
+ ` })
2493
+ ] })
2494
+ }
2495
+ );
2496
+ }
2497
+ function Qt() {
2498
+ const [o, u] = v(null), [g, m] = v("No track loaded"), [_, p] = v("purple"), [k, y] = v(!1), [N, q] = v(!1), [M, O] = v("light"), S = C(null), V = (Y) => {
2499
+ var $;
2500
+ const K = ($ = Y.target.files) == null ? void 0 : $[0];
2501
+ if (K) {
2502
+ const b = URL.createObjectURL(K);
2503
+ u(b), m(K.name);
2504
+ }
2505
+ }, U = () => {
2506
+ var Y;
2507
+ (Y = S.current) == null || Y.click();
2508
+ };
2509
+ return /* @__PURE__ */ e.jsx("div", { className: "min-h-screen flex items-center justify-center p-4 md:p-8", style: { backgroundColor: M === "dark" ? "#222" : "white" }, children: /* @__PURE__ */ e.jsxs("div", { className: "w-full h-full md:h-auto md:max-w-4xl", children: [
2510
+ k && /* @__PURE__ */ e.jsx(Ut, { theme: _, setTheme: p, close: () => y(!1) }),
2511
+ /* @__PURE__ */ e.jsxs("div", { className: "container-glass rounded-xl p-8", children: [
2512
+ /* @__PURE__ */ e.jsxs("div", { className: "mb-6 flex justify-between items-start", children: [
2513
+ /* @__PURE__ */ e.jsxs("div", { children: [
2514
+ /* @__PURE__ */ e.jsx("h1", { className: `text-2xl font-semibold ${M === "dark" ? "text-gray-200" : "text-gray-800"} mb-1`, children: "Audio Visualizer" }),
2515
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-gray-500", children: "Professional frequency analyzer" })
2516
+ ] }),
2517
+ /* @__PURE__ */ e.jsxs(
2518
+ "button",
2519
+ {
2520
+ onClick: () => y(!k),
2521
+ className: "bg-white border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",
2522
+ children: [
2523
+ /* @__PURE__ */ e.jsx("span", { children: "🎨" }),
2524
+ " Themes"
2525
+ ]
2526
+ }
2527
+ )
2528
+ ] }),
2529
+ /* @__PURE__ */ e.jsx(
2530
+ Yt,
2531
+ {
2532
+ audio: o || void 0,
2533
+ name: g || void 0,
2534
+ author: "K.Prabhasha",
2535
+ theme: _,
2536
+ autoPlay: !1,
2537
+ thumbnail: "https://cdn-icons-png.flaticon.com/512/3845/3845874.png",
2538
+ mode: M,
2539
+ transparent: N,
2540
+ volume: 70,
2541
+ controls: {
2542
+ play: !0,
2543
+ pause: !0,
2544
+ stop: !0,
2545
+ seekbar: !0,
2546
+ volume: !0,
2547
+ loop: !0,
2548
+ trackName: !0
2549
+ }
2550
+ }
2551
+ ),
2552
+ /* @__PURE__ */ e.jsx(Kt, { audio: o || "", width: 400, thumbnail: "https://cdn-icons-png.flaticon.com/512/8316/8316619.png", autoPlay: !1, gradient: ["#26ce3aff", "#39eed9ff"], background: "#c0ffefff" }),
2553
+ /* @__PURE__ */ e.jsx(Gt, { audio: o || "", thumbnail: "https://cdn-icons-png.flaticon.com/512/17524/17524837.png", autoPlay: !1, gradient: ["#26ce3aff", "#39eed9ff"], background: "#c0ffefff" }),
2554
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-6 flex flex-wrap items-center gap-3", children: [
2555
+ /* @__PURE__ */ e.jsx(
2556
+ "input",
2557
+ {
2558
+ type: "file",
2559
+ ref: S,
2560
+ onChange: V,
2561
+ accept: "audio/*",
2562
+ className: "hidden"
2563
+ }
2564
+ ),
2565
+ /* @__PURE__ */ e.jsxs(
2566
+ "button",
2567
+ {
2568
+ onClick: U,
2569
+ className: "bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",
2570
+ children: [
2571
+ /* @__PURE__ */ e.jsx(Ht, { size: 16 }),
2572
+ "Load Audio"
2573
+ ]
2574
+ }
2575
+ ),
2576
+ /* @__PURE__ */ e.jsx(
2577
+ "button",
2578
+ {
2579
+ onClick: () => O(M === "dark" ? "light" : "dark"),
2580
+ className: "bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",
2581
+ children: M === "dark" ? "Light" : "Dark"
2582
+ }
2583
+ ),
2584
+ /* @__PURE__ */ e.jsxs(
2585
+ "button",
2586
+ {
2587
+ onClick: () => q(!N),
2588
+ className: "bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",
2589
+ children: [
2590
+ "Transparent: ",
2591
+ String(N)
2592
+ ]
2593
+ }
2594
+ )
2595
+ ] })
2596
+ ] })
2597
+ ] }) });
2598
+ }
2599
+ export {
2600
+ Qt as DemoVisualizePlayer,
2601
+ Gt as NanoAudioPlayer,
2602
+ Ut as ThemeSelector,
2603
+ Xt as VideoPlayer,
2604
+ Yt as VisualizePlayer,
2605
+ Kt as WaveAudioPlayer,
2606
+ Ae as themes
2607
+ };