twist-aplayer 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +20 -20
- package/README.md +139 -139
- package/dist/index.js +11 -11
- package/dist/index.min.css +1 -0
- package/dist/index.mjs +275 -271
- package/dist/twist-aplayer.umd.js +11 -11
- package/package.json +75 -75
- package/dist/index.css +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright © 2025-present razzh (https://github.com/razzh7)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025-present razzh (https://github.com/razzh7)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE
|
package/README.md
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
# twist-aplayer
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="https://assets.razzh.cn/aplayer/aplayer.svg" alt="twist aplayer" width="100">
|
|
5
|
-
</p>
|
|
6
|
-
<h1 align="center">Twist APlayer</h1>
|
|
7
|
-
|
|
8
|
-
> A shadcn ui theme aplayer for your React application.
|
|
9
|
-
|
|
10
|
-

|
|
11
|
-
|
|
12
|
-

|
|
13
|
-
|
|
14
|
-
## Features
|
|
15
|
-
|
|
16
|
-
Twist Aplayer supports:
|
|
17
|
-
- Mini mode
|
|
18
|
-
- Playlist - Lyrics
|
|
19
|
-
- Light or dark theme switch
|
|
20
|
-
- Custom theme color with component-level variables
|
|
21
|
-
- SSR compatibility
|
|
22
|
-
- Accessible friendly
|
|
23
|
-
|
|
24
|
-
Twist Aplayer icons powered by [twist-icons](https://github.com/twist-space/twist-icons) !
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm i twist-aplayer
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Import TwistAPlayer component from twist-aplayer package, and import stylesheet.
|
|
33
|
-
|
|
34
|
-
```tsx
|
|
35
|
-
import { TwistAPlayer } from 'twist-aplayer';
|
|
36
|
-
import 'twist-aplayer/dist/index.css';
|
|
37
|
-
|
|
38
|
-
render(
|
|
39
|
-
<
|
|
40
|
-
audio={{
|
|
41
|
-
name: 'ヘリオス',
|
|
42
|
-
artist: 'Helios',
|
|
43
|
-
url: 'https://music.163.com/#/song?id=1919555788&userid=122967305',
|
|
44
|
-
}}
|
|
45
|
-
theme="dark"
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Interface
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
export interface AudioInfo {
|
|
54
|
-
name?: string;
|
|
55
|
-
artist?: string | ArtistInfo;
|
|
56
|
-
url: string;
|
|
57
|
-
cover?: string;
|
|
58
|
-
lrc?: string;
|
|
59
|
-
theme?: string;
|
|
60
|
-
type?: 'auto' | 'hls' | 'normal';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface ArtistInfo {
|
|
64
|
-
name?: string;
|
|
65
|
-
url?: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface APlayerProps {
|
|
69
|
-
/**
|
|
70
|
-
* @description audio info, should be an object or object array
|
|
71
|
-
*/
|
|
72
|
-
audio: AudioInfo | readonly AudioInfo[];
|
|
73
|
-
/**
|
|
74
|
-
* Initial volume
|
|
75
|
-
* @description default volume
|
|
76
|
-
* @default 0.7
|
|
77
|
-
*/
|
|
78
|
-
volume?: number;
|
|
79
|
-
/**
|
|
80
|
-
* @description values: 'normal', 'fixed'
|
|
81
|
-
* @default "normal"
|
|
82
|
-
*/
|
|
83
|
-
appearance?: 'normal' | 'fixed';
|
|
84
|
-
/**
|
|
85
|
-
* @description values: 'all' | 'one' | 'none'
|
|
86
|
-
* @default "all"
|
|
87
|
-
*/
|
|
88
|
-
initialLoop?: PlaylistLoop;
|
|
89
|
-
/**
|
|
90
|
-
* @description values: 'list' | 'random'
|
|
91
|
-
* @default "list"
|
|
92
|
-
*/
|
|
93
|
-
initialOrder?: PlaylistOrder;
|
|
94
|
-
/**
|
|
95
|
-
* @description audio autoplay
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
autoPlay?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* @description list max height
|
|
101
|
-
* @default 250
|
|
102
|
-
*/
|
|
103
|
-
listMaxHeight?: number;
|
|
104
|
-
/**
|
|
105
|
-
* @description enable mini mode
|
|
106
|
-
* @default false
|
|
107
|
-
*/
|
|
108
|
-
mini?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* @default prevent to play multiple player at the same time, pause other players when this player start play
|
|
111
|
-
* @default true
|
|
112
|
-
*/
|
|
113
|
-
mutex?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* @description indicate whether list should folded at first
|
|
116
|
-
* @default false
|
|
117
|
-
*/
|
|
118
|
-
listFolded?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* @description player theme, values: light, dark
|
|
121
|
-
* @default light
|
|
122
|
-
*/
|
|
123
|
-
theme?: 'light' | 'dark';
|
|
124
|
-
/**
|
|
125
|
-
* @description user border, it can accent border if use dark mode.
|
|
126
|
-
* @default false
|
|
127
|
-
*/
|
|
128
|
-
border?: boolean;
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## How to make LRC?
|
|
133
|
-
I recommand [LRC generator site](https://www.lrcgenerator.com/), it can easy to make LRC!
|
|
134
|
-
|
|
135
|
-
## Credits
|
|
136
|
-
|
|
137
|
-
The implementation of this project is inspired by the following prior art project:
|
|
138
|
-
- [aplayer-react](https://github.com/SevenOutman/aplayer-react)
|
|
139
|
-
- [aplayer](https://github.com/DIYgod/APlayer)
|
|
1
|
+
# twist-aplayer
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://assets.razzh.cn/aplayer/aplayer.svg" alt="twist aplayer" width="100">
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">Twist APlayer</h1>
|
|
7
|
+
|
|
8
|
+
> A shadcn ui theme aplayer for your React application.
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
Twist Aplayer supports:
|
|
17
|
+
- Mini mode
|
|
18
|
+
- Playlist - Lyrics
|
|
19
|
+
- Light or dark theme switch
|
|
20
|
+
- Custom theme color with component-level variables
|
|
21
|
+
- SSR compatibility
|
|
22
|
+
- Accessible friendly
|
|
23
|
+
|
|
24
|
+
Twist Aplayer icons powered by [twist-icons](https://github.com/twist-space/twist-icons) !
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm i twist-aplayer
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Import TwistAPlayer component from twist-aplayer package, and import stylesheet.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { TwistAPlayer } from 'twist-aplayer';
|
|
36
|
+
import 'twist-aplayer/dist/index.min.css';
|
|
37
|
+
|
|
38
|
+
render(
|
|
39
|
+
<TwistAPlayer
|
|
40
|
+
audio={{
|
|
41
|
+
name: 'ヘリオス',
|
|
42
|
+
artist: 'Helios',
|
|
43
|
+
url: 'https://music.163.com/#/song?id=1919555788&userid=122967305',
|
|
44
|
+
}}
|
|
45
|
+
theme="dark"
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Interface
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
export interface AudioInfo {
|
|
54
|
+
name?: string;
|
|
55
|
+
artist?: string | ArtistInfo;
|
|
56
|
+
url: string;
|
|
57
|
+
cover?: string;
|
|
58
|
+
lrc?: string;
|
|
59
|
+
theme?: string;
|
|
60
|
+
type?: 'auto' | 'hls' | 'normal';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ArtistInfo {
|
|
64
|
+
name?: string;
|
|
65
|
+
url?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface APlayerProps {
|
|
69
|
+
/**
|
|
70
|
+
* @description audio info, should be an object or object array
|
|
71
|
+
*/
|
|
72
|
+
audio: AudioInfo | readonly AudioInfo[];
|
|
73
|
+
/**
|
|
74
|
+
* Initial volume
|
|
75
|
+
* @description default volume
|
|
76
|
+
* @default 0.7
|
|
77
|
+
*/
|
|
78
|
+
volume?: number;
|
|
79
|
+
/**
|
|
80
|
+
* @description values: 'normal', 'fixed'
|
|
81
|
+
* @default "normal"
|
|
82
|
+
*/
|
|
83
|
+
appearance?: 'normal' | 'fixed';
|
|
84
|
+
/**
|
|
85
|
+
* @description values: 'all' | 'one' | 'none'
|
|
86
|
+
* @default "all"
|
|
87
|
+
*/
|
|
88
|
+
initialLoop?: PlaylistLoop;
|
|
89
|
+
/**
|
|
90
|
+
* @description values: 'list' | 'random'
|
|
91
|
+
* @default "list"
|
|
92
|
+
*/
|
|
93
|
+
initialOrder?: PlaylistOrder;
|
|
94
|
+
/**
|
|
95
|
+
* @description audio autoplay
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
autoPlay?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @description list max height
|
|
101
|
+
* @default 250
|
|
102
|
+
*/
|
|
103
|
+
listMaxHeight?: number;
|
|
104
|
+
/**
|
|
105
|
+
* @description enable mini mode
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
mini?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* @default prevent to play multiple player at the same time, pause other players when this player start play
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
mutex?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* @description indicate whether list should folded at first
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
listFolded?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* @description player theme, values: light, dark
|
|
121
|
+
* @default light
|
|
122
|
+
*/
|
|
123
|
+
theme?: 'light' | 'dark';
|
|
124
|
+
/**
|
|
125
|
+
* @description user border, it can accent border if use dark mode.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
border?: boolean;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## How to make LRC?
|
|
133
|
+
I recommand [LRC generator site](https://www.lrcgenerator.com/), it can easy to make LRC!
|
|
134
|
+
|
|
135
|
+
## Credits
|
|
136
|
+
|
|
137
|
+
The implementation of this project is inspired by the following prior art project:
|
|
138
|
+
- [aplayer-react](https://github.com/SevenOutman/aplayer-react)
|
|
139
|
+
- [aplayer](https://github.com/DIYgod/APlayer)
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react");function qr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react");function qr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const X=qr(v);var be={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ke;function Dr(){if(Ke)return
|
|
9
|
+
*/var Ke;function Dr(){if(Ke)return ne;Ke=1;var e=v,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function y(g,s,d){var E,p={},f=null,l=null;d!==void 0&&(f=""+d),s.key!==void 0&&(f=""+s.key),s.ref!==void 0&&(l=s.ref);for(E in s)a.call(s,E)&&!c.hasOwnProperty(E)&&(p[E]=s[E]);if(g&&g.defaultProps)for(E in s=g.defaultProps,s)p[E]===void 0&&(p[E]=s[E]);return{$$typeof:t,type:g,key:f,ref:l,props:p,_owner:i.current}}return ne.Fragment=n,ne.jsx=y,ne.jsxs=y,ne}var ae={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Je;function Vr(){return Je||(Je=1,process.env.NODE_ENV!=="production"&&function(){var e=v,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),g=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),l=Symbol.for("react.offscreen"),_=Symbol.iterator,u="@@iterator";function b(r){if(r===null||typeof r!="object")return null;var o=_&&r[_]||r[u];return typeof o=="function"?o:null}var x=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function
|
|
18
|
-
`+
|
|
17
|
+
*/var Je;function Vr(){return Je||(Je=1,process.env.NODE_ENV!=="production"&&function(){var e=v,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),g=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),l=Symbol.for("react.offscreen"),_=Symbol.iterator,u="@@iterator";function b(r){if(r===null||typeof r!="object")return null;var o=_&&r[_]||r[u];return typeof o=="function"?o:null}var x=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(r){{for(var o=arguments.length,h=new Array(o>1?o-1:0),S=1;S<o;S++)h[S-1]=arguments[S];w("error",r,h)}}function w(r,o,h){{var S=x.ReactDebugCurrentFrame,C=S.getStackAddendum();C!==""&&(o+="%s",h=h.concat([C]));var P=h.map(function(j){return String(j)});P.unshift("Warning: "+o),Function.prototype.apply.call(console[r],console,P)}}var A=!1,Q=!1,z=!1,I=!1,oe=!1,se;se=Symbol.for("react.module.reference");function le(r){return!!(typeof r=="string"||typeof r=="function"||r===a||r===c||oe||r===i||r===d||r===E||I||r===l||A||Q||z||typeof r=="object"&&r!==null&&(r.$$typeof===f||r.$$typeof===p||r.$$typeof===y||r.$$typeof===g||r.$$typeof===s||r.$$typeof===se||r.getModuleId!==void 0))}function xe(r,o,h){var S=r.displayName;if(S)return S;var C=o.displayName||o.name||"";return C!==""?h+"("+C+")":h}function ce(r){return r.displayName||"Context"}function V(r){if(r==null)return null;if(typeof r.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case a:return"Fragment";case n:return"Portal";case c:return"Profiler";case i:return"StrictMode";case d:return"Suspense";case E:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case g:var o=r;return ce(o)+".Consumer";case y:var h=r;return ce(h._context)+".Provider";case s:return xe(r,r.render,"ForwardRef");case p:var S=r.displayName||null;return S!==null?S:V(r.type)||"Memo";case f:{var C=r,P=C._payload,j=C._init;try{return V(j(P))}catch{return null}}}return null}var D=Object.assign,H=0,W,Y,Z,ee,re,te,O;function fe(){}fe.__reactDisabledLog=!0;function dr(){{if(H===0){W=console.log,Y=console.info,Z=console.warn,ee=console.error,re=console.group,te=console.groupCollapsed,O=console.groupEnd;var r={configurable:!0,enumerable:!0,value:fe,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}H++}}function vr(){{if(H--,H===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},r,{value:W}),info:D({},r,{value:Y}),warn:D({},r,{value:Z}),error:D({},r,{value:ee}),group:D({},r,{value:re}),groupCollapsed:D({},r,{value:te}),groupEnd:D({},r,{value:O})})}H<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Se=x.ReactCurrentDispatcher,_e;function de(r,o,h){{if(_e===void 0)try{throw Error()}catch(C){var S=C.stack.trim().match(/\n( *(at )?)/);_e=S&&S[1]||""}return`
|
|
18
|
+
`+_e+r}}var Te=!1,ve;{var mr=typeof WeakMap=="function"?WeakMap:Map;ve=new mr}function Me(r,o){if(!r||Te)return"";{var h=ve.get(r);if(h!==void 0)return h}var S;Te=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=Se.current,Se.current=null,dr();try{if(o){var j=function(){throw Error()};if(Object.defineProperty(j.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(j,[])}catch(F){S=F}Reflect.construct(r,[],j)}else{try{j.call()}catch(F){S=F}r.call(j.prototype)}}else{try{throw Error()}catch(F){S=F}r()}}catch(F){if(F&&S&&typeof F.stack=="string"){for(var T=F.stack.split(`
|
|
19
19
|
`),N=S.stack.split(`
|
|
20
20
|
`),$=T.length-1,M=N.length-1;$>=1&&M>=0&&T[$]!==N[M];)M--;for(;$>=1&&M>=0;$--,M--)if(T[$]!==N[M]){if($!==1||M!==1)do if($--,M--,M<0||T[$]!==N[M]){var q=`
|
|
21
|
-
`+T[$].replace(" at new "," at ");return r.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",r.displayName)),typeof r=="function"&&
|
|
21
|
+
`+T[$].replace(" at new "," at ");return r.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",r.displayName)),typeof r=="function"&&ve.set(r,q),q}while($>=1&&M>=0);break}}}finally{Te=!1,Se.current=P,vr(),Error.prepareStackTrace=C}var K=r?r.displayName||r.name:"",Ge=K?de(K):"";return typeof r=="function"&&ve.set(r,Ge),Ge}function hr(r,o,h){return Me(r,!1)}function yr(r){var o=r.prototype;return!!(o&&o.isReactComponent)}function me(r,o,h){if(r==null)return"";if(typeof r=="function")return Me(r,yr(r));if(typeof r=="string")return de(r);switch(r){case d:return de("Suspense");case E:return de("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case s:return hr(r.render);case p:return me(r.type,o,h);case f:{var S=r,C=S._payload,P=S._init;try{return me(P(C),o,h)}catch{}}}return""}var he=Object.prototype.hasOwnProperty,ke={},Ne=x.ReactDebugCurrentFrame;function ye(r){if(r){var o=r._owner,h=me(r.type,r._source,o?o.type:null);Ne.setExtraStackFrame(h)}else Ne.setExtraStackFrame(null)}function br(r,o,h,S,C){{var P=Function.call.bind(he);for(var j in r)if(P(r,j)){var T=void 0;try{if(typeof r[j]!="function"){var N=Error((S||"React class")+": "+h+" type `"+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[j]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw N.name="Invariant Violation",N}T=r[j](o,j,S,h,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($){T=$}T&&!(T instanceof Error)&&(ye(C),R("%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).",S||"React class",h,j,typeof T),ye(null)),T instanceof Error&&!(T.message in ke)&&(ke[T.message]=!0,ye(C),R("Failed %s type: %s",h,T.message),ye(null))}}}var pr=Array.isArray;function we(r){return pr(r)}function gr(r){{var o=typeof Symbol=="function"&&Symbol.toStringTag,h=o&&r[Symbol.toStringTag]||r.constructor.name||"Object";return h}}function Er(r){try{return qe(r),!1}catch{return!0}}function qe(r){return""+r}function De(r){if(Er(r))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",gr(r)),qe(r)}var Ve=x.ReactCurrentOwner,xr={key:!0,ref:!0,__self:!0,__source:!0},Ie,Fe;function Sr(r){if(he.call(r,"ref")){var o=Object.getOwnPropertyDescriptor(r,"ref").get;if(o&&o.isReactWarning)return!1}return r.ref!==void 0}function _r(r){if(he.call(r,"key")){var o=Object.getOwnPropertyDescriptor(r,"key").get;if(o&&o.isReactWarning)return!1}return r.key!==void 0}function Tr(r,o){typeof r.ref=="string"&&Ve.current}function wr(r,o){{var h=function(){Ie||(Ie=!0,R("%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)",o))};h.isReactWarning=!0,Object.defineProperty(r,"key",{get:h,configurable:!0})}}function jr(r,o){{var h=function(){Fe||(Fe=!0,R("%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)",o))};h.isReactWarning=!0,Object.defineProperty(r,"ref",{get:h,configurable:!0})}}var Or=function(r,o,h,S,C,P,j){var T={$$typeof:t,type:r,key:o,ref:h,props:j,_owner:P};return T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(T,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(T,"_source",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T};function Rr(r,o,h,S,C){{var P,j={},T=null,N=null;h!==void 0&&(De(h),T=""+h),_r(o)&&(De(o.key),T=""+o.key),Sr(o)&&(N=o.ref,Tr(o,C));for(P in o)he.call(o,P)&&!xr.hasOwnProperty(P)&&(j[P]=o[P]);if(r&&r.defaultProps){var $=r.defaultProps;for(P in $)j[P]===void 0&&(j[P]=$[P])}if(T||N){var M=typeof r=="function"?r.displayName||r.name||"Unknown":r;T&&wr(j,M),N&&jr(j,M)}return Or(r,T,N,C,S,Ve.current,j)}}var je=x.ReactCurrentOwner,Be=x.ReactDebugCurrentFrame;function G(r){if(r){var o=r._owner,h=me(r.type,r._source,o?o.type:null);Be.setExtraStackFrame(h)}else Be.setExtraStackFrame(null)}var Oe;Oe=!1;function Re(r){return typeof r=="object"&&r!==null&&r.$$typeof===t}function ze(){{if(je.current){var r=V(je.current.type);if(r)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+r+"`."}return""}}function Cr(r){return""}var He={};function Pr(r){{var o=ze();if(!o){var h=typeof r=="string"?r:r.displayName||r.name;h&&(o=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+h+">.")}return o}}function
|
|
26
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
27
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var c,y=!0,g=!1;return{s:function(){n=n.call(e)},n:function(){var d=n.next();return y=d.done,d},e:function(d){g=!0,c=d},f:function(){try{y||n.return==null||n.return()}finally{if(g)throw c}}}}function sr(e,t){if(e){if(typeof e=="string")return er(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}function er(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function pe(){return pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},pe.apply(null,arguments)}function rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,a)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rr(Object(n),!0).forEach(function(a){Gr(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rr(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function Gr(e,t,n){return(t=Kr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kr(e){var t=Jr(e,"string");return ae(t)=="symbol"?t:t+""}function Jr(e,t){if(ae(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(ae(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Xr(e,t){if(e==null)return{};var n,a,i=Qr(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)n=c[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Qr(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function Zr(e){var t=e.attrs,n=e.size,a=e.title,i=e.spin,c=e.rotate,y=e.color,g=Xr(e,Br),s=function(E){var p=n||E.size||"1em",f,l="",_="";return E.className&&(f=E.className),e.className&&(f=f?"".concat(f," ").concat(e.className):e.className),i&&(f?f+=" twist-icon-loading":f="twist-icon-loading"),c&&(l="rotate(".concat(c,"deg)"),_="rotate(".concat(c,"deg)")),J.createElement("svg",pe({xmlns:"http://www.w3.org/2000/svg"},E.attrs,t,g,{className:f,style:ie(ie({color:y||E.color,msTransform:l,transform:_},E.style),e.style),width:p,height:p}),a&&J.createElement("title",null,a),e.children)};return $e!==void 0?J.createElement($e.Consumer,null,function(d){return s(d)}):s(or)}function et(e){var t={},n=e.split(";"),a=Yr(n),i;try{for(a.s();!(i=a.n()).done;){var c=i.value,y=c.split(":"),g=zr(y,2),s=g[0],d=g[1];if(s&&d){var E=s.trim().replace(/-./g,function(p){return p.charAt(1).toUpperCase()});t[E]=d.trim()}}}catch(p){a.e(p)}finally{a.f()}return t}function lr(e){return e&&e.map(function(t,n){return J.createElement(t.tag,ie(ie({},t.attrs),{},{key:n,style:t.attrs.style?et(t.attrs.style):null}),lr(t.children))})}function k(e){return function(t){return J.createElement(Zr,pe({attrs:ie({},e.attrs)},t),lr(e.children))}}function rt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 2.25c-5.384 0-9.75 4.366-9.75 9.75s4.366 9.75 9.75 9.75v-2.437A7.312 7.312 0 1 1 19.313 12h2.437c0-5.384-4.366-9.75-9.75-9.75"}}]})(e)}function tt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M18.25 12L8.5 17.629V6.37z"}}]})(e)}function cr(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=cr(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function L(){for(var e,t,n=0,a="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=cr(e))&&(a&&(a+=" "),a+=t);return a}function nt({bufferedPercentage:e,playedPercentage:t,onSeek:n}){const a=z("aplayer-bar"),i=z("aplayer-icon"),c=v.useRef(null),[y,g]=v.useState(t),s=v.useRef(!1);v.useEffect(()=>{s.current||g(t)},[t]);const d=v.useCallback(E=>{s.current=!0;const p=Re(E,c);g(p);const f=_=>{const u=Re(_,c);g(u)},l=_=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",l);const u=Re(_,c);g(u),n==null||n(u),s.current=!1};document.addEventListener("mousemove",f),document.addEventListener("mouseup",l)},[n]);return m.jsx("div",{ref:c,className:L(a.b(),a.bs("vars")),onMouseDown:d,role:"slider","aria-label":"Audio progress","aria-valuenow":y?y*100:0,"aria-valuemin":0,"aria-valuemax":100,"aria-live":"polite",children:m.jsxs("div",{className:a.be("inner"),children:[typeof e<"u"?m.jsx("div",{className:a.be("loaded"),style:{width:`${e*100}%`}}):null,typeof y<"u"?m.jsx("div",{className:a.be("played"),style:{width:`${y*100}%`},children:m.jsx("span",{className:a.be("thumb"),children:m.jsx("span",{className:L(i.bs("loading")),children:m.jsx(rt,{})})})}):null]})})}function at(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M16.15 13H5q-.425 0-.712-.288T4 12t.288-.712T5 11h11.15L13.3 8.15q-.3-.3-.288-.7t.288-.7q.3-.3.713-.312t.712.287L19.3 11.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-4.575 4.575q-.3.3-.712.288t-.713-.313q-.275-.3-.288-.7t.288-.7z"}}]})(e)}function it(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.5 17q1.05 0 1.775-.725T13 14.5V9h3V7h-4v5.5q-.325-.225-.7-.363T10.5 12q-1.05 0-1.775.725T8 14.5t.725 1.775T10.5 17M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20z"}}]})(e)}function ut(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14 19V5h4v14zm-8 0V5h4v14z"}}]})(e)}function ot(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"}}]})(e)}function st(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.5 10.5h-.75q-.325 0-.537-.213T10 9.75t.213-.537T10.75 9H12q.425 0 .713.288T13 10v4.25q0 .325-.213.538T12.25 15t-.537-.213t-.213-.537zM6.85 19l.85.85q.3.3.288.7t-.288.7q-.3.3-.712.313t-.713-.288L3.7 18.7q-.15-.15-.213-.325T3.426 18t.063-.375t.212-.325l2.575-2.575q.3-.3.713-.287t.712.312q.275.3.288.7t-.288.7l-.85.85H17v-3q0-.425.288-.712T18 13t.713.288T19 14v3q0 .825-.587 1.413T17 19zm10.3-12H7v3q0 .425-.288.713T6 11t-.712-.288T5 10V7q0-.825.588-1.412T7 5h10.15l-.85-.85q-.3-.3-.288-.7t.288-.7q.3-.3.712-.312t.713.287L20.3 5.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-2.575 2.575q-.3.3-.712.288T16.3 9.25q-.275-.3-.288-.7t.288-.7z"}}]})(e)}function lt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"m6.85 19l.85.85q.3.3.288.7t-.288.7q-.3.3-.712.313t-.713-.288L3.7 18.7q-.15-.15-.213-.325T3.426 18t.063-.375t.212-.325l2.575-2.575q.3-.3.713-.287t.712.312q.275.3.288.7t-.288.7l-.85.85H17v-3q0-.425.288-.712T18 13t.713.288T19 14v3q0 .825-.587 1.413T17 19zm10.3-12H7v3q0 .425-.288.713T6 11t-.712-.288T5 10V7q0-.825.588-1.412T7 5h10.15l-.85-.85q-.3-.3-.288-.7t.288-.7q.3-.3.712-.312t.713.287L20.3 5.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-2.575 2.575q-.3.3-.712.288T16.3 9.25q-.275-.3-.288-.7t.288-.7z"}}]})(e)}function ct(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9 15H6q-.425 0-.712-.288T5 14v-4q0-.425.288-.712T6 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T12.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.512.013T16 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function ft(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7 15V9h4l5-5v16l-5-5z"}}]})(e)}function dt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M19 11.975q0-2.075-1.1-3.787t-2.95-2.563q-.375-.175-.55-.537t-.05-.738q.15-.4.538-.575t.787 0Q18.1 4.85 19.55 7.063T21 11.974t-1.45 4.913t-3.875 3.287q-.4.175-.788 0t-.537-.575q-.125-.375.05-.737t.55-.538q1.85-.85 2.95-2.562t1.1-3.788M7 15H4q-.425 0-.712-.288T3 14v-4q0-.425.288-.712T4 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T10.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.513.013T14 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function vt({volume:e,muted:t,onToggleMuted:n,onChangeVolume:a}){const i=z("aplayer-volumn"),c=z("aplayer-icon"),y=v.useRef(null),[g,s]=v.useState(!1),d=v.useCallback(E=>{a(Ce(E,y)),s(!0);const p=l=>{a(Ce(l,y))},f=l=>{document.removeEventListener("mouseup",f),document.removeEventListener("mousemove",p),s(!1),a(Ce(l,y))};document.addEventListener("mousemove",p),document.addEventListener("mouseup",f)},[a]);return m.jsxs("div",{className:L(i.b(),i.bs("vars")),children:[m.jsx("button",{type:"button",className:L(c.b(),c.bs("volume-down")),onClick:()=>n(),"aria-label":t||!e?"Muted":"unMuted",children:t||!e?m.jsx(ft,{}):e>=1?m.jsx(dt,{}):m.jsx(ct,{})}),m.jsx("div",{className:L(i.be("bar-wrap"),{[i.bem("bar-wrap","active")]:g}),ref:y,onMouseDown:d,children:m.jsx("div",{className:i.be("bar"),children:m.jsx("div",{className:i.be("thumb"),style:{height:t?0:`${e*100}%`}})})})]})}function tr(e){if(typeof e>"u")return"--:--";if(Number.isNaN(e))return"00:00";const t=y=>y<10?`0${y}`:`${y}`,n=Math.trunc(e/60),a=Math.trunc(e-n*60),i=Math.trunc(n/60),c=Math.trunc(e/60-60*Math.trunc(e/60/60));return e>=3600?`${t(i)}:${t(c)}:${t(a)}`:`${t(n)}:${t(a)}`}function mt(e){return k({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M485.6 249.9L198.2 498c-8.3 7.1-8.3 20.8 0 27.9l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9m320 0L518.2 498a18.6 18.6 0 0 0-6.2 14c0 5.2 2.1 10.4 6.2 14l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9"}}]})(e)}function ht(e){return k({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M825.8 498L538.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L825.8 526c8.3-7.2 8.3-20.8 0-28m-320 0L218.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L505.8 526c4.1-3.6 6.2-8.8 6.2-14s-2.1-10.4-6.2-14"}}]})(e)}function yt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"}}]})(e)}function bt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2 5.27L3.28 4L20 20.72L18.73 22l-3-3H7v3l-4-4l4-4v3h6.73L7 10.27V11H5V8.27zM17 13h2v4.18l-2-2zm0-8V2l4 4l-4 4V7H8.82l-2-2z"}}]})(e)}function pt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"m17 3l5.25 4.5L17 12l5.25 4.5L17 21v-3h-2.74l-2.82-2.82l2.12-2.12L15.5 15H17V9h-1.5l-9 9H2v-3h3.26l9-9H17zM2 6h4.5l2.82 2.82l-2.12 2.12L5.26 9H2z"}}]})(e)}function gt({volume:e,onChangeVolume:t,muted:n,currentTime:a,audioDurationSeconds:i,bufferedSeconds:c,onToggleMenu:y,onToggleMuted:g,order:s,onOrderChange:d,loop:E,onLoopChange:p,onSeek:f,isPlaying:l,onTogglePlay:_,onSkipForward:u,onSkipBack:b,showLyrics:x=!0,onToggleLyrics:O}){const w=z("aplayer-controller"),A=z("aplayer-icon"),W=v.useCallback(()=>{const D={list:"random",random:"list"}[s];d(D)},[s,d]),X=v.useCallback(()=>{const D={all:"one",one:"none",none:"all"}[E];p(D)},[E,p]);return m.jsxs("div",{className:L(w.b(),w.bs("vars")),role:"group","aria-label":"Audio Controls",children:[m.jsx(nt,{playedPercentage:typeof a>"u"||typeof i>"u"?void 0:a/i,bufferedPercentage:typeof c>"u"||typeof i>"u"?void 0:c/i,onSeek:D=>f==null?void 0:f(D*i)}),m.jsxs("div",{className:w.be("time"),children:[m.jsxs("span",{className:w.be("time-inner"),"aria-live":"polite",children:[m.jsx("span",{className:w.be("ptime"),children:tr(a)})," / ",m.jsx("span",{className:w.be("dtime"),children:tr(i)})]}),m.jsx("button",{className:L(A.b(),A.bs("back")),onClick:b,type:"button","aria-label":"Previous track",children:m.jsx(mt,{})}),m.jsx("button",{className:L(A.b(),A.bs("play")),onClick:_,type:"button","aria-label":l?"Pause audio":"Play audio",children:l?m.jsx(ut,{}):m.jsx(ot,{})}),m.jsx("button",{className:L(A.b(),A.bs("forward")),onClick:u,type:"button","aria-label":"Next track",children:m.jsx(ht,{})}),m.jsx(vt,{volume:e,muted:n,onToggleMuted:g,onChangeVolume:t}),m.jsx("button",{className:L(A.b(),A.bs("order")),onClick:W,type:"button","aria-label":`Playback order: ${s}`,children:{list:m.jsx(at,{}),random:m.jsx(pt,{})}[s]}),m.jsx("button",{className:L(A.b(),A.bs("order")),onClick:X,type:"button","aria-label":`Loop mode: ${E}`,children:{all:m.jsx(lt,{}),one:m.jsx(st,{}),none:m.jsx(bt,{})}[E]}),m.jsx("button",{type:"button",className:L(A.b(),A.bs("menu")),onClick:()=>y==null?void 0:y(),"aria-label":"Toggle playlist menu",children:m.jsx(yt,{})}),m.jsx("button",{type:"button",className:L(A.b(),A.bs("lrc"),{[A.ns("lrc-inactivity")]:!x}),onClick:O,"aria-label":x?"Hide lyrics":"Show lyrics","aria-pressed":x,children:m.jsx(it,{})})]})]})}function Et({open:e,audio:t,playingAudioUrl:n,onPlayAudio:a,listMaxHeight:i}){const c=z("aplayer-list"),y=i?{maxHeight:i}:void 0,g=v.useCallback(d=>d?typeof d=="string"?d:d.name??"Audio artist":"Audio artist",[]),s=v.useRef(null);return v.useEffect(()=>{if(s.current){const d=s.current;return d.style.maxHeight=`${Math.min(d.scrollHeight,i??1/0)}px`,()=>{d.removeAttribute("style")}}},[i]),m.jsx("div",{ref:s,className:L(c.b(),{[c.bm("hide")]:!e}),"aria-label":"Audio playlist","aria-live":"polite",children:m.jsx("ol",{style:y,children:t.map((d,E)=>m.jsxs("li",{className:L({[c.bm("active")]:d.url===n}),onClick:()=>{d.url!==n&&(a==null||a(d))},role:"button","aria-label":`${d.name??"Audio name"} by ${g(d.artist)}}`,children:[m.jsx("span",{className:c.be("cur")}),m.jsx("span",{className:c.be("index"),children:E+1}),m.jsx("span",{className:c.be("title"),children:d.name??"Audio name"}),m.jsx("span",{className:c.be("author"),children:g(d.artist)})]},d.name||E))})})}function nr({show:e,lrcText:t,currentTime:n}){const a=z("aplayer-lrc"),i=v.useMemo(()=>xt(t),[t]),c=v.useMemo(()=>{for(let g=0;g<i.length;g++){const s=i[g],d=i[g+1];if(n>=s[0]&&(!d||n<d[0]))return g}return 0},[n,i]),y=v.useMemo(()=>({transform:`translateY(${-c*16}px)`,WebkitTransform:`translateY(${-c*16}px)`}),[c]);return m.jsx("div",{className:L(a.b(),{[a.bm("hide")]:!e}),children:t?m.jsx("div",{className:a.be("contents"),style:y,children:i.map(([,g],s)=>m.jsx("p",{className:L({[a.be("current")]:s===c}),children:g},s))}):null})}function xt(e){if(e){e=e.replace(/([^\]^\n])\[/g,(i,c)=>`${c}
|
|
25
|
+
Check the top-level render call using <`+h+">.")}return o}}function Ue(r,o){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var h=Pr(o);if(He[h])return;He[h]=!0;var S="";r&&r._owner&&r._owner!==je.current&&(S=" It was passed a child from "+V(r._owner.type)+"."),G(r),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',h,S),G(null)}}function We(r,o){{if(typeof r!="object")return;if(we(r))for(var h=0;h<r.length;h++){var S=r[h];Re(S)&&Ue(S,o)}else if(Re(r))r._store&&(r._store.validated=!0);else if(r){var C=b(r);if(typeof C=="function"&&C!==r.entries)for(var P=C.call(r),j;!(j=P.next()).done;)Re(j.value)&&Ue(j.value,o)}}}function Lr(r){{var o=r.type;if(o==null||typeof o=="string")return;var h;if(typeof o=="function")h=o.propTypes;else if(typeof o=="object"&&(o.$$typeof===s||o.$$typeof===p))h=o.propTypes;else return;if(h){var S=V(o);br(h,r.props,"prop",S,r)}else if(o.PropTypes!==void 0&&!Oe){Oe=!0;var C=V(o);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",C||"Unknown")}typeof o.getDefaultProps=="function"&&!o.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function $r(r){{for(var o=Object.keys(r.props),h=0;h<o.length;h++){var S=o[h];if(S!=="children"&&S!=="key"){G(r),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),G(null);break}}r.ref!==null&&(G(r),R("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}function Ye(r,o,h,S,C,P){{var j=le(r);if(!j){var T="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(T+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var N=Cr();N?T+=N:T+=ze();var $;r===null?$="null":we(r)?$="array":r!==void 0&&r.$$typeof===t?($="<"+(V(r.type)||"Unknown")+" />",T=" Did you accidentally export a JSX literal instead of a component?"):$=typeof r,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",$,T)}var M=Rr(r,o,h,C,P);if(M==null)return M;if(j){var q=o.children;if(q!==void 0)if(S)if(we(q)){for(var K=0;K<q.length;K++)We(q[K],r);Object.freeze&&Object.freeze(q)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else We(q,r)}return r===a?$r(M):Lr(M),M}}function Ar(r,o,h){return Ye(r,o,h,!0)}function Mr(r,o,h){return Ye(r,o,h,!1)}var kr=Mr,Nr=Ar;ae.Fragment=a,ae.jsx=kr,ae.jsxs=Nr}()),ae}var Xe;function Ir(){return Xe||(Xe=1,process.env.NODE_ENV==="production"?be.exports=Dr():be.exports=Vr()),be.exports}var m=Ir(),pe=e=>`--${e}`,Qe=e=>`var(--${e})`,Ze=(e,t)=>`--${e}: ${t};`;function Fr(e,t){const n=a=>t;return{b:()=>`${n()}-${e}`,be:a=>`${n()}-${e}__${a}`,bm:a=>`${n()}-${e}--${a}`,bem:(a,i)=>`${n()}-${e}__${a}--${i}`,bs:a=>`${n()}-${e}-${a}`,ns:a=>`${n()}-${a}`,cb:()=>`.${n()}-${e}`,cbe:a=>`.${n()}-${e}__${a}`,cbm:a=>`.${n()}-${e}--${a}`,cbem:(a,i)=>`.${n()}-${e}__${a}--${i}`,cbs:a=>`.${n()}-${e}-${a}`,cns:a=>`.${n()}-${a}`,cv:a=>pe(`${n()}-${e}-${a}`),cvm:(a,i={})=>{const c=n();for(const y of Object.keys(a))i[pe(`${c}-${e}-${y}`)]=a[y];return i},gcv:a=>Qe(`${n()}-${e}-${a}`),scv:(a,i)=>Ze(`${n()}-${e}-${a}`,i),nv:a=>pe(`${n()}-${a}`),nvm:(a,i={})=>{const c=n();for(const y of Object.keys(a))i[pe(`${c}-${y}`)]=a[y];return i},gnv:a=>Qe(`${n()}-${a}`),snv:(a,i)=>Ze(`${n()}-${a}`,i)}}function B(e){return v.useMemo(()=>Fr(e,"twist"),[e])}function Ce(e,t){if(!t.current)return 0;let n=(e.clientX-t.current.getBoundingClientRect().left)/t.current.clientWidth;return n=Math.max(n,0),n=Math.min(n,1),n=Math.floor(n*100)/100,n}function Pe(e,t){if(!t.current)return 0;let n=1-(e.clientY-t.current.getBoundingClientRect().top)/t.current.clientHeight;return n=Math.max(n,0),n=Math.min(n,1),n=Math.floor(n*100)/100,n}var or={color:void 0,size:void 0,className:void 0,style:void 0,attrs:void 0},Ae=X.createContext(or);Ae.Provider;function ie(e){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ie(e)}var Br=["attrs","size","title","spin","rotate","color"];function zr(e,t){return Wr(e)||Ur(e,t)||sr(e,t)||Hr()}function Hr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
26
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ur(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a,i,c,y,g=[],s=!0,d=!1;try{if(c=(n=n.call(e)).next,t!==0)for(;!(s=(a=c.call(n)).done)&&(g.push(a.value),g.length!==t);s=!0);}catch(E){d=!0,i=E}finally{try{if(!s&&n.return!=null&&(y=n.return(),Object(y)!==y))return}finally{if(d)throw i}}return g}}function Wr(e){if(Array.isArray(e))return e}function Yr(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=sr(e))||t){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(d){throw d},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
27
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var c,y=!0,g=!1;return{s:function(){n=n.call(e)},n:function(){var d=n.next();return y=d.done,d},e:function(d){g=!0,c=d},f:function(){try{y||n.return==null||n.return()}finally{if(g)throw c}}}}function sr(e,t){if(e){if(typeof e=="string")return er(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}function er(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function Ee(){return Ee=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Ee.apply(null,arguments)}function rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,a)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rr(Object(n),!0).forEach(function(a){Gr(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rr(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function Gr(e,t,n){return(t=Kr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kr(e){var t=Jr(e,"string");return ie(t)=="symbol"?t:t+""}function Jr(e,t){if(ie(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(ie(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Xr(e,t){if(e==null)return{};var n,a,i=Qr(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)n=c[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Qr(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function Zr(e){var t=e.attrs,n=e.size,a=e.title,i=e.spin,c=e.rotate,y=e.color,g=Xr(e,Br),s=function(E){var p=n||E.size||"1em",f,l="",_="";return E.className&&(f=E.className),e.className&&(f=f?"".concat(f," ").concat(e.className):e.className),i&&(f?f+=" twist-icon-loading":f="twist-icon-loading"),c&&(l="rotate(".concat(c,"deg)"),_="rotate(".concat(c,"deg)")),X.createElement("svg",Ee({xmlns:"http://www.w3.org/2000/svg"},E.attrs,t,g,{className:f,style:ue(ue({color:y||E.color,msTransform:l,transform:_},E.style),e.style),width:p,height:p}),a&&X.createElement("title",null,a),e.children)};return Ae!==void 0?X.createElement(Ae.Consumer,null,function(d){return s(d)}):s(or)}function et(e){var t={},n=e.split(";"),a=Yr(n),i;try{for(a.s();!(i=a.n()).done;){var c=i.value,y=c.split(":"),g=zr(y,2),s=g[0],d=g[1];if(s&&d){var E=s.trim().replace(/-./g,function(p){return p.charAt(1).toUpperCase()});t[E]=d.trim()}}}catch(p){a.e(p)}finally{a.f()}return t}function lr(e){return e&&e.map(function(t,n){return X.createElement(t.tag,ue(ue({},t.attrs),{},{key:n,style:t.attrs.style?et(t.attrs.style):null}),lr(t.children))})}function k(e){return function(t){return X.createElement(Zr,Ee({attrs:ue({},e.attrs)},t),lr(e.children))}}function rt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 2.25c-5.384 0-9.75 4.366-9.75 9.75s4.366 9.75 9.75 9.75v-2.437A7.312 7.312 0 1 1 19.313 12h2.437c0-5.384-4.366-9.75-9.75-9.75"}}]})(e)}function tt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M18.25 12L8.5 17.629V6.37z"}}]})(e)}function cr(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=cr(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function L(){for(var e,t,n=0,a="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=cr(e))&&(a&&(a+=" "),a+=t);return a}function nt({bufferedPercentage:e,playedPercentage:t,onSeek:n}){const a=B("aplayer-bar"),i=B("aplayer-icon"),c=v.useRef(null),[y,g]=v.useState(t),s=v.useRef(!1);v.useEffect(()=>{s.current||g(t)},[t]);const d=v.useCallback(E=>{s.current=!0;const p=Ce(E,c);g(p);const f=_=>{const u=Ce(_,c);g(u)},l=_=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",l);const u=Ce(_,c);g(u),n==null||n(u),s.current=!1};document.addEventListener("mousemove",f),document.addEventListener("mouseup",l)},[n]);return m.jsx("div",{ref:c,className:L(a.b(),a.bs("vars")),onMouseDown:d,role:"slider","aria-label":"Audio progress","aria-valuenow":y?y*100:0,"aria-valuemin":0,"aria-valuemax":100,"aria-live":"polite",children:m.jsxs("div",{className:a.be("inner"),children:[typeof e<"u"?m.jsx("div",{className:a.be("loaded"),style:{width:`${e*100}%`}}):null,typeof y<"u"?m.jsx("div",{className:a.be("played"),style:{width:`${y*100}%`},children:m.jsx("span",{className:a.be("thumb"),children:m.jsx("span",{className:L(i.bs("loading")),children:m.jsx(rt,{})})})}):null]})})}function at(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M16.15 13H5q-.425 0-.712-.288T4 12t.288-.712T5 11h11.15L13.3 8.15q-.3-.3-.288-.7t.288-.7q.3-.3.713-.312t.712.287L19.3 11.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-4.575 4.575q-.3.3-.712.288t-.713-.313q-.275-.3-.288-.7t.288-.7z"}}]})(e)}function it(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.5 17q1.05 0 1.775-.725T13 14.5V9h3V7h-4v5.5q-.325-.225-.7-.363T10.5 12q-1.05 0-1.775.725T8 14.5t.725 1.775T10.5 17M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20z"}}]})(e)}function ut(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14 19V5h4v14zm-8 0V5h4v14z"}}]})(e)}function ot(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"}}]})(e)}function st(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.5 10.5h-.75q-.325 0-.537-.213T10 9.75t.213-.537T10.75 9H12q.425 0 .713.288T13 10v4.25q0 .325-.213.538T12.25 15t-.537-.213t-.213-.537zM6.85 19l.85.85q.3.3.288.7t-.288.7q-.3.3-.712.313t-.713-.288L3.7 18.7q-.15-.15-.213-.325T3.426 18t.063-.375t.212-.325l2.575-2.575q.3-.3.713-.287t.712.312q.275.3.288.7t-.288.7l-.85.85H17v-3q0-.425.288-.712T18 13t.713.288T19 14v3q0 .825-.587 1.413T17 19zm10.3-12H7v3q0 .425-.288.713T6 11t-.712-.288T5 10V7q0-.825.588-1.412T7 5h10.15l-.85-.85q-.3-.3-.288-.7t.288-.7q.3-.3.712-.312t.713.287L20.3 5.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-2.575 2.575q-.3.3-.712.288T16.3 9.25q-.275-.3-.288-.7t.288-.7z"}}]})(e)}function lt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"m6.85 19l.85.85q.3.3.288.7t-.288.7q-.3.3-.712.313t-.713-.288L3.7 18.7q-.15-.15-.213-.325T3.426 18t.063-.375t.212-.325l2.575-2.575q.3-.3.713-.287t.712.312q.275.3.288.7t-.288.7l-.85.85H17v-3q0-.425.288-.712T18 13t.713.288T19 14v3q0 .825-.587 1.413T17 19zm10.3-12H7v3q0 .425-.288.713T6 11t-.712-.288T5 10V7q0-.825.588-1.412T7 5h10.15l-.85-.85q-.3-.3-.288-.7t.288-.7q.3-.3.712-.312t.713.287L20.3 5.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-2.575 2.575q-.3.3-.712.288T16.3 9.25q-.275-.3-.288-.7t.288-.7z"}}]})(e)}function ct(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9 15H6q-.425 0-.712-.288T5 14v-4q0-.425.288-.712T6 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T12.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.512.013T16 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function ft(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7 15V9h4l5-5v16l-5-5z"}}]})(e)}function dt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M19 11.975q0-2.075-1.1-3.787t-2.95-2.563q-.375-.175-.55-.537t-.05-.738q.15-.4.538-.575t.787 0Q18.1 4.85 19.55 7.063T21 11.974t-1.45 4.913t-3.875 3.287q-.4.175-.788 0t-.537-.575q-.125-.375.05-.737t.55-.538q1.85-.85 2.95-2.562t1.1-3.788M7 15H4q-.425 0-.712-.288T3 14v-4q0-.425.288-.712T4 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T10.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.513.013T14 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function vt({volume:e,muted:t,onToggleMuted:n,onChangeVolume:a}){const i=B("aplayer-volumn"),c=B("aplayer-icon"),y=v.useRef(null),[g,s]=v.useState(!1),d=v.useCallback(E=>{a(Pe(E,y)),s(!0);const p=l=>{a(Pe(l,y))},f=l=>{document.removeEventListener("mouseup",f),document.removeEventListener("mousemove",p),s(!1),a(Pe(l,y))};document.addEventListener("mousemove",p),document.addEventListener("mouseup",f)},[a]);return m.jsxs("div",{className:L(i.b(),i.bs("vars")),children:[m.jsx("button",{type:"button",className:L(c.b(),c.bs("volume-down")),onClick:()=>n(),"aria-label":t||!e?"Muted":"unMuted",children:t||!e?m.jsx(ft,{}):e>=1?m.jsx(dt,{}):m.jsx(ct,{})}),m.jsx("div",{className:L(i.be("bar-wrap"),{[i.bem("bar-wrap","active")]:g}),ref:y,onMouseDown:d,children:m.jsx("div",{className:i.be("bar"),children:m.jsx("div",{className:i.be("thumb"),style:{height:t?0:`${e*100}%`}})})})]})}function tr(e){if(typeof e>"u")return"--:--";if(Number.isNaN(e))return"00:00";const t=y=>y<10?`0${y}`:`${y}`,n=Math.trunc(e/60),a=Math.trunc(e-n*60),i=Math.trunc(n/60),c=Math.trunc(e/60-60*Math.trunc(e/60/60));return e>=3600?`${t(i)}:${t(c)}:${t(a)}`:`${t(n)}:${t(a)}`}function mt(e){return k({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M485.6 249.9L198.2 498c-8.3 7.1-8.3 20.8 0 27.9l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9m320 0L518.2 498a18.6 18.6 0 0 0-6.2 14c0 5.2 2.1 10.4 6.2 14l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9"}}]})(e)}function ht(e){return k({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M825.8 498L538.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L825.8 526c8.3-7.2 8.3-20.8 0-28m-320 0L218.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L505.8 526c4.1-3.6 6.2-8.8 6.2-14s-2.1-10.4-6.2-14"}}]})(e)}function yt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"}}]})(e)}function bt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2 5.27L3.28 4L20 20.72L18.73 22l-3-3H7v3l-4-4l4-4v3h6.73L7 10.27V11H5V8.27zM17 13h2v4.18l-2-2zm0-8V2l4 4l-4 4V7H8.82l-2-2z"}}]})(e)}function pt(e){return k({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"m17 3l5.25 4.5L17 12l5.25 4.5L17 21v-3h-2.74l-2.82-2.82l2.12-2.12L15.5 15H17V9h-1.5l-9 9H2v-3h3.26l9-9H17zM2 6h4.5l2.82 2.82l-2.12 2.12L5.26 9H2z"}}]})(e)}function gt({volume:e,onChangeVolume:t,muted:n,currentTime:a,audioDurationSeconds:i,bufferedSeconds:c,onToggleMenu:y,onToggleMuted:g,order:s,onOrderChange:d,loop:E,onLoopChange:p,onSeek:f,isPlaying:l,onTogglePlay:_,onSkipForward:u,onSkipBack:b,showLyrics:x=!0,onToggleLyrics:R}){const w=B("aplayer-controller"),A=B("aplayer-icon"),Q=v.useCallback(()=>{const I={list:"random",random:"list"}[s];d(I)},[s,d]),z=v.useCallback(()=>{const I={all:"one",one:"none",none:"all"}[E];p(I)},[E,p]);return m.jsxs("div",{className:L(w.b(),w.bs("vars")),role:"group","aria-label":"Audio Controls",children:[m.jsx(nt,{playedPercentage:typeof a>"u"||typeof i>"u"?void 0:a/i,bufferedPercentage:typeof c>"u"||typeof i>"u"?void 0:c/i,onSeek:I=>f==null?void 0:f(I*i)}),m.jsxs("div",{className:w.be("time"),children:[m.jsxs("span",{className:w.be("time-inner"),"aria-live":"polite",children:[m.jsx("span",{className:w.be("ptime"),children:tr(a)})," / ",m.jsx("span",{className:w.be("dtime"),children:tr(i)})]}),m.jsx("button",{className:L(A.b(),A.bs("back")),onClick:b,type:"button","aria-label":"Previous track",children:m.jsx(mt,{})}),m.jsx("button",{className:L(A.b(),A.bs("play")),onClick:_,type:"button","aria-label":l?"Pause audio":"Play audio",children:l?m.jsx(ut,{}):m.jsx(ot,{})}),m.jsx("button",{className:L(A.b(),A.bs("forward")),onClick:u,type:"button","aria-label":"Next track",children:m.jsx(ht,{})}),m.jsx(vt,{volume:e,muted:n,onToggleMuted:g,onChangeVolume:t}),m.jsx("button",{className:L(A.b(),A.bs("order")),onClick:Q,type:"button","aria-label":`Playback order: ${s}`,children:{list:m.jsx(at,{}),random:m.jsx(pt,{})}[s]}),m.jsx("button",{className:L(A.b(),A.bs("order")),onClick:z,type:"button","aria-label":`Loop mode: ${E}`,children:{all:m.jsx(lt,{}),one:m.jsx(st,{}),none:m.jsx(bt,{})}[E]}),m.jsx("button",{type:"button",className:L(A.b(),A.bs("menu")),onClick:()=>y==null?void 0:y(),"aria-label":"Toggle playlist menu",children:m.jsx(yt,{})}),m.jsx("button",{type:"button",className:L(A.b(),A.bs("lrc"),{[A.ns("lrc-inactivity")]:!x}),onClick:R,"aria-label":x?"Hide lyrics":"Show lyrics","aria-pressed":x,children:m.jsx(it,{})})]})]})}function Et({open:e,audio:t,playingAudioUrl:n,onPlayAudio:a,listMaxHeight:i}){const c=B("aplayer-list"),y=i?{maxHeight:i}:void 0,g=v.useCallback(d=>d?typeof d=="string"?d:d.name??"Audio artist":"Audio artist",[]),s=v.useRef(null);return v.useEffect(()=>{if(s.current){const d=s.current;return d.style.maxHeight=`${Math.min(d.scrollHeight,i??1/0)}px`,()=>{d.removeAttribute("style")}}},[i]),m.jsx("div",{ref:s,className:L(c.b(),{[c.bm("hide")]:!e}),"aria-label":"Audio playlist","aria-live":"polite",children:m.jsx("ol",{style:y,children:t.map((d,E)=>m.jsxs("li",{className:L({[c.bm("active")]:d.url===n}),onClick:()=>{d.url!==n&&(a==null||a(d))},role:"button","aria-label":`${d.name??"Audio name"} by ${g(d.artist)}}`,children:[m.jsx("span",{className:c.be("cur")}),m.jsx("span",{className:c.be("index"),children:E+1}),m.jsx("span",{className:c.be("title"),children:d.name??"Audio name"}),m.jsx("span",{className:c.be("author"),children:g(d.artist)})]},d.name||E))})})}function nr({show:e,lrcText:t,currentTime:n}){const a=B("aplayer-lrc"),i=v.useMemo(()=>xt(t),[t]),c=v.useMemo(()=>{for(let g=0;g<i.length;g++){const s=i[g],d=i[g+1];if(n>=s[0]&&(!d||n<d[0]))return g}return 0},[n,i]),y=v.useMemo(()=>({transform:`translateY(${-c*16}px)`,WebkitTransform:`translateY(${-c*16}px)`}),[c]);return m.jsx("div",{className:L(a.b(),{[a.bm("hide")]:!e}),children:t?m.jsx("div",{className:a.be("contents"),style:y,children:i.map(([,g],s)=>m.jsx("p",{className:L({[a.be("current")]:s===c}),children:g},s))}):null})}function xt(e){if(e){e=e.replace(/([^\]^\n])\[/g,(i,c)=>`${c}
|
|
28
28
|
[`);const t=e.split(`
|
|
29
|
-
`),n=[],a=t.length;for(let i=0;i<a;i++){const c=t[i].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g),y=t[i].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g,"").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g,"").replace(/^\s+|\s+$/g,"");if(c){const g=c.length;for(let s=0;s<g;s++){const d=/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/.exec(c[s]),E=d[1]*60,p=Number.parseInt(d[2]),f=d[4]?Number.parseInt(d[4])/(`${d[4]}`.length===2?100:1e3):0,l=E+p+f;n.push([l,y])}}}return n.sort((i,c)=>i[0]-c[0]),n}else return[]}var
|
|
29
|
+
`),n=[],a=t.length;for(let i=0;i<a;i++){const c=t[i].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g),y=t[i].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g,"").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g,"").replace(/^\s+|\s+$/g,"");if(c){const g=c.length;for(let s=0;s<g;s++){const d=/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/.exec(c[s]),E=d[1]*60,p=Number.parseInt(d[2]),f=d[4]?Number.parseInt(d[4])/(`${d[4]}`.length===2?100:1e3):0,l=E+p+f;n.push([l,y])}}}return n.sort((i,c)=>i[0]-c[0]),n}else return[]}var ge={exports:{}},Le={};/**
|
|
30
30
|
* @license React
|
|
31
31
|
* use-sync-external-store-shim.production.js
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var ar;function St(){if(ar)return
|
|
37
|
+
*/var ar;function St(){if(ar)return Le;ar=1;var e=v;function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,i=e.useEffect,c=e.useLayoutEffect,y=e.useDebugValue;function g(p,f){var l=f(),_=a({inst:{value:l,getSnapshot:f}}),u=_[0].inst,b=_[1];return c(function(){u.value=l,u.getSnapshot=f,s(u)&&b({inst:u})},[p,l,f]),i(function(){return s(u)&&b({inst:u}),p(function(){s(u)&&b({inst:u})})},[p]),y(l),l}function s(p){var f=p.getSnapshot;p=p.value;try{var l=f();return!n(p,l)}catch{return!0}}function d(p,f){return f()}var E=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:g;return Le.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:E,Le}var $e={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* use-sync-external-store-shim.development.js
|
|
40
40
|
*
|
|
@@ -42,4 +42,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var ir;function _t(){return ir||(ir=1,process.env.NODE_ENV!=="production"&&function(){function e(l,_){return l===_&&(l!==0||1/l===1/_)||l!==l&&_!==_}function t(l,_){E||i.startTransition===void 0||(E=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=_();if(!p){var b=_();c(u,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}b=y({inst:{value:u,getSnapshot:_}});var x=b[0].inst,O=b[1];return s(function(){x.value=u,x.getSnapshot=_,n(x)&&O({inst:x})},[l,u,_]),g(function(){return n(x)&&O({inst:x}),l(function(){n(x)&&O({inst:x})})},[l]),d(u),u}function n(l){var _=l.getSnapshot;l=l.value;try{var u=_();return!c(l,u)}catch{return!0}}function a(l,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=v,c=typeof Object.is=="function"?Object.is:e,y=i.useState,g=i.useEffect,s=i.useLayoutEffect,d=i.useDebugValue,E=!1,p=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:t;Le.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Le}var ur;function Tt(){return ur||(ur=1,process.env.NODE_ENV==="production"?be.exports=St():be.exports=_t()),be.exports}var H=Tt();const K=[];function wt(e){const t=v.useRef();return v.useEffect(()=>{if(typeof window<"u"&&!t.current){const n=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(n.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(n.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(n.volume=e.initialVolume),K.includes(n)||K.push(n)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),v.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onError))return n.addEventListener("error",e.onError),()=>{n.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),v.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onEnded))return n.addEventListener("ended",e.onEnded),()=>{n.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),v.useEffect(()=>()=>{const n=t.current;if(n){n.pause(),n.currentTime=0;const a=K.indexOf(n);a!==-1&&K.splice(a,1)}t.current=void 0},[]),t}function jt(e){const t=wt(e),n=v.useCallback(u=>{for(let b=0;b<K.length;b++){const x=K[b];x!==u&&!x.paused&&x.pause()}},[]),a=v.useCallback(async u=>{var x;const b=t.current;if(b){e.mutex&&n(b),b.src!==u&&(b.pause(),b.currentTime=0,b.src=u);try{await((x=t.current)==null?void 0:x.play())}catch{}}},[t,e.mutex,n]),i=v.useCallback(u=>{const b=t.current;b&&(b.paused?a(u):b.pause())},[t,a]),c=v.useCallback(u=>{t.current.currentTime=u},[t]),y=v.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),g=v.useCallback(u=>{t.current&&(t.current.volume=u)},[t]),s=H.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("volumechange",u),()=>{var x;(x=t.current)==null||x.removeEventListener("volumechange",u)}},[t]),()=>{var u;return(u=t.current)==null?void 0:u.volume},()=>{}),d=H.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("volumechange",u),()=>{var x;(x=t.current)==null||x.removeEventListener("volumechange",u)}},[t]),()=>{var u;return(u=t.current)==null?void 0:u.muted},()=>{}),E=H.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("timeupdate",u),()=>{var x;(x=t.current)==null||x.removeEventListener("timeupdate",u)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),p=H.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("durationchange",u),()=>{var x;(x=t.current)==null||x.removeEventListener("durationchange",u)}},[t]),()=>{var u;return(u=t.current)==null?void 0:u.duration},()=>{}),f=H.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("progress",u),()=>{var x;(x=t.current)==null||x.removeEventListener("progress",u)}},[t]),()=>{const u=t.current;return u&&u.buffered.length>0?u.buffered.end(u.buffered.length-1):0},()=>{}),l=H.useSyncExternalStore(v.useCallback(u=>{var b,x;return(b=t.current)==null||b.addEventListener("play",u),(x=t.current)==null||x.addEventListener("pause",u),()=>{var O,w;(O=t.current)==null||O.removeEventListener("play",u),(w=t.current)==null||w.removeEventListener("pause",u)}},[t]),()=>{const u=t.current;return u?!u.paused:!1},()=>{}),_=H.useSyncExternalStore(v.useCallback(u=>{var b,x;return(b=t.current)==null||b.addEventListener("playing",u),(x=t.current)==null||x.addEventListener("waiting",u),()=>{var O,w;(O=t.current)==null||O.removeEventListener("playing",u),(w=t.current)==null||w.removeEventListener("waiting",u)}},[t]),()=>{const u=t.current;return u?u.networkState===u.NETWORK_LOADING:!1},()=>{});return{playAudio:a,togglePlay:i,seek:c,toggleMuted:y,setVolume:g,volume:s,muted:d,currentTime:E,duration:p,bufferedSeconds:f,isPlaying:l,isLoading:_}}function fr(){const e=v.useRef([]);return v.useEffect(()=>{const n=e.current;return()=>{for(const a of n)clearTimeout(a)}},[]),v.useCallback((n,a)=>{const i=setTimeout(n,a);return e.current.push(i),i},[])}function Ot(){const e=v.useRef(),[t,n]=v.useState({text:"",style:{opacity:0}}),a=fr(),i=v.useCallback((c,y=2e3)=>{e.current&&clearTimeout(e.current),n({text:c,style:{opacity:1}}),e.current=a(()=>{n({text:c,style:{opacity:0}})},y)},[a]);return[t,i]}function Rt(e){return Ct(e.slice())}function Ct(e){let t=e.length,n;for(;t!==0;)n=Math.floor(Math.random()*t),t--,[e[t],e[n]]=[e[n],e[t]];return e}function Pt(e,{initialLoop:t="all",initialOrder:n="list",getSongId:a}){const[i,c]=v.useState(t),[y,g]=v.useState(n),s=v.useMemo(()=>y==="list"?e:Rt(e),[e,y]),[d,E]=v.useState(s[0]);v.useEffect(()=>{const u=s.find(b=>a(b)===a(d));E(u||s[0])},[s,a,d]);const p=v.useMemo(()=>{if(i==="one")return{...d};const u=s.indexOf(d);if(u<s.length-1)return s[u+1];if(i!=="none")return s[0]},[s,d,i]),f=v.useCallback(()=>{p&&E(p)},[p,i]),l=v.useCallback(()=>{E(u=>{const b=s.indexOf(u);return b>0?s[b-1]:u})},[s]),_=v.useCallback(u=>{E(u)},[]);return{currentSong:d,hasNextSong:typeof p<"u",next:f,previous:l,prioritize:_,order:y,setOrder:g,loop:i,setLoop:c,length:s.length}}function Lt(e){return k({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{d:"M294.1 256L167 129c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.3 34 0L345 239c9.1 9.1 9.3 23.7.7 33.1L201.1 417c-4.7 4.7-10.9 7-17 7s-12.3-2.3-17-7c-9.4-9.4-9.4-24.6 0-33.9l127-127.1z",fill:"currentColor"}}]})(e)}function $t(e){return k({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M208 432h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16m144 0h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16"}}]})(e)}function At({audio:e,appearance:t="normal",volume:n=.7,initialLoop:a,initialOrder:i,autoPlay:c=!1,listMaxHeight:y=250,mini:g=!1,mutex:s=!0,listFolded:d=!1,theme:E="light",border:p=!1}){var Z,ee,re;const f=z("aplayer"),l=Pt(Array.isArray(e)?e:[e],{initialLoop:a,initialOrder:i,getSongId:C=>C.url}),[_,u]=Ot(),b=fr(),x=v.useRef(),O=v.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=void 0)},[]),w=jt({src:l.currentSong.url,initialVolume:n,autoPlay:c,mutex:s,onError(C){const{error:le}=C.target;le&&u("An audio error has occurred, player will skip forward in 2 seconds."),l.hasNextSong&&(x.current=b(()=>{l.next()},2e3))},onEnded(){l.hasNextSong&&l.next()}});v.useEffect(()=>{c&&w.playAudio(l.currentSong.url)},[]);const A=v.useRef(!0);v.useEffect(()=>{A.current?A.current=!1:l.currentSong&&w.playAudio(l.currentSong.url)},[l.currentSong,w.playAudio]);const W=v.useCallback(()=>{O(),w.togglePlay(l.currentSong.url)},[w,O,l.currentSong.url]),X=v.useCallback(C=>C?typeof C=="string"?C:C.url?m.jsx("a",{href:C.url,target:"_blank",rel:"noreferrer",children:C.name??"Audio artist"}):C.name??"Audio artist":"Audio artist",[]),D=l.length>1,ge=v.useMemo(()=>Array.isArray(e)?e:[e],[e]),{prioritize:Q}=l,Ee=v.useCallback(C=>{O(),Q(C)},[O,Q]),[ue,oe]=v.useState(()=>D&&!d),[I,V]=v.useState(g),[F,se]=v.useState(!0),U=v.useRef(null);return v.useEffect(()=>{V(g)},[g]),v.useEffect(()=>{if(t==="fixed"&&U.current){const C=U.current;return C.style.width=`${C.offsetWidth-18}px`,()=>{C.removeAttribute("style")}}},[t]),m.jsxs("div",{className:L(f.b(),{[f.bs(E)]:!0,[f.bs("vars")]:!0,[f.bm(t)]:!0,[f.bm("loading")]:w.isLoading,[f.bm("withlist")]:D,[f.bm("list-folded")]:!ue,[f.bm("withlrc")]:!!l.currentSong.lrc&&t!=="fixed",[f.bm("narrow")]:I,[f.bm("border")]:p}),role:"region","aria-label":"Audio Player",children:[m.jsxs("div",{ref:U,className:f.be("body"),children:[m.jsx("div",{className:f.be("pic"),onClick:W,style:{backgroundImage:`url("${(Z=l.currentSong)==null?void 0:Z.cover}")`},role:"button","aria-label":w.isPlaying?"Pause audio":"Play audio",children:m.jsx("div",{className:L(f.be("button"),w.isPlaying?f.bm("pause"):f.bm("play")),role:"presentation",children:w.isPlaying?m.jsx($t,{}):m.jsx(tt,{})})}),m.jsxs("div",{className:L(f.be("info")),children:[m.jsxs("div",{className:L(f.be("music")),children:[m.jsx("span",{className:L(f.be("title")),children:((ee=l.currentSong)==null?void 0:ee.name)??"Audio name"}),m.jsxs("span",{className:L(f.be("author")),children:[" ","-"," ",X((re=l.currentSong)==null?void 0:re.artist)]})]}),t==="fixed"?null:m.jsx(nr,{show:F,lrcText:l.currentSong.lrc,currentTime:w.currentTime??0}),m.jsx(gt,{volume:w.volume??n,onChangeVolume:w.setVolume,muted:w.muted??!1,onToggleMuted:()=>w.toggleMuted(),currentTime:w.currentTime,audioDurationSeconds:w.duration,bufferedSeconds:w.bufferedSeconds,onSeek:C=>w.seek(C),onToggleMenu:()=>oe(C=>!C),order:l.order,onOrderChange:l.setOrder,loop:l.loop,onLoopChange:l.setLoop,isPlaying:w.isPlaying??!1,onTogglePlay:W,onSkipForward:()=>{l.hasNextSong&&l.next()},onSkipBack:()=>{l.previous()},showLyrics:F,onToggleLyrics:()=>{se(C=>!C)}})]}),m.jsx("div",{className:f.be("notice"),style:_.style,children:_.text}),m.jsx("div",{className:f.be("miniswitcher"),onClick:()=>V(C=>!C),children:m.jsx("button",{className:L(f.bs("icon"),f.bs("icon-right")),type:"button",children:m.jsx(Lt,{})})})]}),D?m.jsx(Et,{open:ue,audio:ge,playingAudioUrl:l.currentSong.url,onPlayAudio:Ee,listMaxHeight:y}):null,t==="fixed"&&m.jsx(nr,{show:F,lrcText:l.currentSong.lrc,currentTime:w.currentTime??0})]})}exports.TwistAPlayer=At;
|
|
45
|
+
*/var ir;function _t(){return ir||(ir=1,process.env.NODE_ENV!=="production"&&function(){function e(l,_){return l===_&&(l!==0||1/l===1/_)||l!==l&&_!==_}function t(l,_){E||i.startTransition===void 0||(E=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=_();if(!p){var b=_();c(u,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}b=y({inst:{value:u,getSnapshot:_}});var x=b[0].inst,R=b[1];return s(function(){x.value=u,x.getSnapshot=_,n(x)&&R({inst:x})},[l,u,_]),g(function(){return n(x)&&R({inst:x}),l(function(){n(x)&&R({inst:x})})},[l]),d(u),u}function n(l){var _=l.getSnapshot;l=l.value;try{var u=_();return!c(l,u)}catch{return!0}}function a(l,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=v,c=typeof Object.is=="function"?Object.is:e,y=i.useState,g=i.useEffect,s=i.useLayoutEffect,d=i.useDebugValue,E=!1,p=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:t;$e.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),$e}var ur;function Tt(){return ur||(ur=1,process.env.NODE_ENV==="production"?ge.exports=St():ge.exports=_t()),ge.exports}var U=Tt();const J=[];function wt(e){const t=v.useRef();return v.useEffect(()=>{if(typeof window<"u"&&!t.current){const n=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(n.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(n.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(n.volume=e.initialVolume),J.includes(n)||J.push(n)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),v.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onError))return n.addEventListener("error",e.onError),()=>{n.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),v.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onEnded))return n.addEventListener("ended",e.onEnded),()=>{n.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),v.useEffect(()=>()=>{const n=t.current;if(n){n.pause(),n.currentTime=0;const a=J.indexOf(n);a!==-1&&J.splice(a,1)}t.current=void 0},[]),t}function jt(e){const t=wt(e),n=v.useCallback(u=>{for(let b=0;b<J.length;b++){const x=J[b];x!==u&&!x.paused&&x.pause()}},[]),a=v.useCallback(async u=>{var x;const b=t.current;if(b){e.mutex&&n(b),b.src!==u&&(b.pause(),b.currentTime=0,b.src=u);try{await((x=t.current)==null?void 0:x.play())}catch{}}},[t,e.mutex,n]),i=v.useCallback(u=>{const b=t.current;b&&(b.paused?a(u):b.pause())},[t,a]),c=v.useCallback(u=>{t.current.currentTime=u},[t]),y=v.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),g=v.useCallback(u=>{t.current&&(t.current.volume=u)},[t]),s=U.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("volumechange",u),()=>{var x;(x=t.current)==null||x.removeEventListener("volumechange",u)}},[t]),()=>{var u;return(u=t.current)==null?void 0:u.volume},()=>{}),d=U.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("volumechange",u),()=>{var x;(x=t.current)==null||x.removeEventListener("volumechange",u)}},[t]),()=>{var u;return(u=t.current)==null?void 0:u.muted},()=>{}),E=U.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("timeupdate",u),()=>{var x;(x=t.current)==null||x.removeEventListener("timeupdate",u)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),p=U.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("durationchange",u),()=>{var x;(x=t.current)==null||x.removeEventListener("durationchange",u)}},[t]),()=>{var u;return(u=t.current)==null?void 0:u.duration},()=>{}),f=U.useSyncExternalStore(v.useCallback(u=>{var b;return(b=t.current)==null||b.addEventListener("progress",u),()=>{var x;(x=t.current)==null||x.removeEventListener("progress",u)}},[t]),()=>{const u=t.current;return u&&u.buffered.length>0?u.buffered.end(u.buffered.length-1):0},()=>{}),l=U.useSyncExternalStore(v.useCallback(u=>{var b,x;return(b=t.current)==null||b.addEventListener("play",u),(x=t.current)==null||x.addEventListener("pause",u),()=>{var R,w;(R=t.current)==null||R.removeEventListener("play",u),(w=t.current)==null||w.removeEventListener("pause",u)}},[t]),()=>{const u=t.current;return u?!u.paused:!1},()=>{}),_=U.useSyncExternalStore(v.useCallback(u=>{var b,x;return(b=t.current)==null||b.addEventListener("playing",u),(x=t.current)==null||x.addEventListener("waiting",u),()=>{var R,w;(R=t.current)==null||R.removeEventListener("playing",u),(w=t.current)==null||w.removeEventListener("waiting",u)}},[t]),()=>{const u=t.current;return u?u.networkState===u.NETWORK_LOADING:!1},()=>{});return{playAudio:a,togglePlay:i,seek:c,toggleMuted:y,setVolume:g,volume:s,muted:d,currentTime:E,duration:p,bufferedSeconds:f,isPlaying:l,isLoading:_}}function fr(){const e=v.useRef([]);return v.useEffect(()=>{const n=e.current;return()=>{for(const a of n)clearTimeout(a)}},[]),v.useCallback((n,a)=>{const i=setTimeout(n,a);return e.current.push(i),i},[])}function Ot(){const e=v.useRef(),[t,n]=v.useState({text:"",style:{opacity:0}}),a=fr(),i=v.useCallback((c,y=2e3)=>{e.current&&clearTimeout(e.current),n({text:c,style:{opacity:1}}),e.current=a(()=>{n({text:c,style:{opacity:0}})},y)},[a]);return[t,i]}function Rt(e){return Ct(e.slice())}function Ct(e){let t=e.length,n;for(;t!==0;)n=Math.floor(Math.random()*t),t--,[e[t],e[n]]=[e[n],e[t]];return e}function Pt(e,{initialLoop:t="all",initialOrder:n="list",getSongId:a}){const[i,c]=v.useState(t),[y,g]=v.useState(n),s=v.useMemo(()=>y==="list"?e:Rt(e),[e,y]),[d,E]=v.useState(s[0]);v.useEffect(()=>{const u=s.find(b=>a(b)===a(d));E(u||s[0])},[s,a,d]);const p=v.useMemo(()=>{if(i==="one")return{...d};const u=s.indexOf(d);if(u<s.length-1)return s[u+1];if(i!=="none")return s[0]},[s,d,i]),f=v.useCallback(()=>{p&&E(p)},[p]),l=v.useCallback(()=>{E(u=>{const b=s.indexOf(u);return b>0?s[b-1]:u})},[s]),_=v.useCallback(u=>{E(u)},[]);return{currentSong:d,hasNextSong:typeof p<"u",next:f,previous:l,prioritize:_,order:y,setOrder:g,loop:i,setLoop:c,length:s.length}}function Lt(e){return k({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{d:"M294.1 256L167 129c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.3 34 0L345 239c9.1 9.1 9.3 23.7.7 33.1L201.1 417c-4.7 4.7-10.9 7-17 7s-12.3-2.3-17-7c-9.4-9.4-9.4-24.6 0-33.9l127-127.1z",fill:"currentColor"}}]})(e)}function $t(e){return k({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M208 432h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16m144 0h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16"}}]})(e)}function At({audio:e,appearance:t="normal",volume:n=.7,initialLoop:a,initialOrder:i,autoPlay:c=!1,listMaxHeight:y=250,mini:g=!1,mutex:s=!0,listFolded:d=!1,theme:E="light",border:p=!1}){var ee,re,te;const f=B("aplayer"),l=Pt(Array.isArray(e)?e:[e],{initialLoop:a,initialOrder:i,getSongId:O=>O.url}),[_,u]=Ot(),b=fr(),x=v.useRef(),R=v.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=void 0)},[]),w=jt({src:l.currentSong.url,initialVolume:n,autoPlay:c,mutex:s,onError(O){const{error:fe}=O.target;fe&&u("An audio error has occurred, player will skip forward in 2 seconds."),l.hasNextSong&&(x.current=b(()=>{l.next()},2e3))},onEnded(){l.hasNextSong&&l.next()}}),A=v.useCallback(()=>{R(),w.togglePlay(l.currentSong.url)},[w,R,l.currentSong.url]),Q=v.useCallback(O=>O?typeof O=="string"?O:O.url?m.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer",children:O.name??"Audio artist"}):O.name??"Audio artist":"Audio artist",[]),z=l.length>1,I=v.useMemo(()=>Array.isArray(e)?e:[e],[e]),{prioritize:oe}=l,se=v.useCallback(O=>{R(),oe(O)},[R,oe]),[le,xe]=v.useState(()=>z&&!d),[ce,V]=v.useState(g),[D,H]=v.useState(!0),W=v.useRef(null);v.useEffect(()=>{V(g)},[g]),v.useEffect(()=>{c&&w.playAudio(l.currentSong.url)},[]);const Y=v.useRef(null),Z=v.useRef(!0);return v.useEffect(()=>{if(!l.currentSong)return;const O=l.currentSong.url;if(Z.current){Z.current=!1,Y.current=O;return}(l.loop==="one"||O!==Y.current)&&(w.playAudio(O),Y.current=O)},[l.currentSong,l.loop]),v.useEffect(()=>{if(t==="fixed"&&W.current){const O=W.current;return O.style.width=`${O.offsetWidth-18}px`,()=>{O.removeAttribute("style")}}},[t]),m.jsxs("div",{className:L(f.b(),{[f.bs(E)]:!0,[f.bs("vars")]:!0,[f.bm(t)]:!0,[f.bm("loading")]:w.isLoading,[f.bm("withlist")]:z,[f.bm("list-folded")]:!le,[f.bm("withlrc")]:!!l.currentSong.lrc&&t!=="fixed",[f.bm("narrow")]:ce,[f.bm("border")]:p}),role:"region","aria-label":"Audio Player",children:[m.jsxs("div",{ref:W,className:f.be("body"),children:[m.jsx("div",{className:f.be("pic"),onClick:A,style:{backgroundImage:`url("${(ee=l.currentSong)==null?void 0:ee.cover}")`},role:"button","aria-label":w.isPlaying?"Pause audio":"Play audio",children:m.jsx("div",{className:L(f.be("button"),w.isPlaying?f.bm("pause"):f.bm("play")),role:"presentation",children:w.isPlaying?m.jsx($t,{}):m.jsx(tt,{})})}),m.jsxs("div",{className:L(f.be("info")),children:[m.jsxs("div",{className:L(f.be("music")),children:[m.jsx("span",{className:L(f.be("title")),children:((re=l.currentSong)==null?void 0:re.name)??"Audio name"}),m.jsxs("span",{className:L(f.be("author")),children:[" ","-"," ",Q((te=l.currentSong)==null?void 0:te.artist)]})]}),t==="fixed"?null:m.jsx(nr,{show:D,lrcText:l.currentSong.lrc,currentTime:w.currentTime??0}),m.jsx(gt,{volume:w.volume??n,onChangeVolume:w.setVolume,muted:w.muted??!1,onToggleMuted:()=>w.toggleMuted(),currentTime:w.currentTime,audioDurationSeconds:w.duration,bufferedSeconds:w.bufferedSeconds,onSeek:O=>w.seek(O),onToggleMenu:()=>xe(O=>!O),order:l.order,onOrderChange:l.setOrder,loop:l.loop,onLoopChange:l.setLoop,isPlaying:w.isPlaying??!1,onTogglePlay:A,onSkipForward:()=>{l.hasNextSong&&l.next()},onSkipBack:()=>{l.previous()},showLyrics:D,onToggleLyrics:()=>{H(O=>!O)}})]}),m.jsx("div",{className:f.be("notice"),style:_.style,children:_.text}),m.jsx("div",{className:f.be("miniswitcher"),onClick:()=>V(O=>!O),children:m.jsx("button",{className:L(f.bs("icon"),f.bs("icon-right")),type:"button",children:m.jsx(Lt,{})})})]}),z?m.jsx(Et,{open:le,audio:I,playingAudioUrl:l.currentSong.url,onPlayAudio:se,listMaxHeight:y}):null,t==="fixed"&&m.jsx(nr,{show:D,lrcText:l.currentSong.lrc,currentTime:w.currentTime??0})]})}exports.TwistAPlayer=At;
|