twist-aplayer 1.5.5 → 1.5.6
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/dist/index.js +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.mjs +5 -4
- package/dist/twist-aplayer.umd.js +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39,4 +39,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the MIT license found in the
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var Le;function wt(){return Le||(Le=1,process.env.NODE_ENV!=="production"&&function(){function e(g,E){return g===E&&(g!==0||1/g===1/E)||g!==g&&E!==E}function t(g,E){b||a.startTransition===void 0||(b=!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 s=E();if(!c){var o=E();l(s,o)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}o=p({inst:{value:s,getSnapshot:E}});var m=o[0].inst,_=o[1];return d(function(){m.value=s,m.getSnapshot=E,r(m)&&_({inst:m})},[g,s,E]),v(function(){return r(m)&&_({inst:m}),g(function(){r(m)&&_({inst:m})})},[g]),h(s),s}function r(g){var E=g.getSnapshot;g=g.value;try{var s=E();return!l(g,s)}catch{return!0}}function n(g,E){return E()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=u,l=typeof Object.is=="function"?Object.is:e,p=a.useState,v=a.useEffect,d=a.useLayoutEffect,h=a.useDebugValue,b=!1,c=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;ve.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ve}var Ce;function _t(){return Ce||(Ce=1,process.env.NODE_ENV==="production"?ue.exports=jt():ue.exports=wt()),ue.exports}var Y=_t();const K=[];function Ot(e){const t=u.useRef(null);return u.useEffect(()=>{if(typeof window<"u"&&!t.current){const r=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(r.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(r.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(r.volume=e.initialVolume),K.includes(r)||K.push(r)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),u.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onError))return r.addEventListener("error",e.onError),()=>{r.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),u.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onEnded))return r.addEventListener("ended",e.onEnded),()=>{r.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),u.useEffect(()=>()=>{const r=t.current;if(r){r.pause(),r.currentTime=0;const n=K.indexOf(r);n!==-1&&K.splice(n,1)}t.current=null},[]),t}function Mt(e){const t=Ot(e),r=u.useCallback(s=>{for(let o=0;o<K.length;o++){const m=K[o];m!==s&&!m.paused&&m.pause()}},[]),n=u.useCallback(async s=>{var m;const o=t.current;if(o){e.mutex&&r(o),o.src!==s&&(o.pause(),o.currentTime=0,o.src=s);try{await((m=t.current)==null?void 0:m.play())}catch{}}},[t,e.mutex,r]),a=u.useCallback(s=>{const o=t.current;o&&(o.paused?n(s):o.pause())},[t,n]),l=u.useCallback(s=>{Number.isFinite(s)&&(t.current.currentTime=s)},[t]),p=u.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),v=u.useCallback(s=>{t.current&&(t.current.volume=s)},[t]),d=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("volumechange",s),()=>{var m;(m=t.current)==null||m.removeEventListener("volumechange",s)}},[t]),()=>{var s;return(s=t.current)==null?void 0:s.volume},()=>{}),h=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("volumechange",s),()=>{var m;(m=t.current)==null||m.removeEventListener("volumechange",s)}},[t]),()=>{var s;return(s=t.current)==null?void 0:s.muted},()=>{}),b=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("timeupdate",s),()=>{var m;(m=t.current)==null||m.removeEventListener("timeupdate",s)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),c=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("durationchange",s),()=>{var m;(m=t.current)==null||m.removeEventListener("durationchange",s)}},[t]),()=>{var s;return(s=t.current)==null?void 0:s.duration},()=>{}),y=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("progress",s),()=>{var m;(m=t.current)==null||m.removeEventListener("progress",s)}},[t]),()=>{const s=t.current;return s&&s.buffered.length>0?s.buffered.end(s.buffered.length-1):0},()=>{}),g=Y.useSyncExternalStore(u.useCallback(s=>{var o,m;return(o=t.current)==null||o.addEventListener("play",s),(m=t.current)==null||m.addEventListener("pause",s),()=>{var _,O;(_=t.current)==null||_.removeEventListener("play",s),(O=t.current)==null||O.removeEventListener("pause",s)}},[t]),()=>{const s=t.current;return s?!s.paused:!1},()=>{}),E=Y.useSyncExternalStore(u.useCallback(s=>{var o,m;return(o=t.current)==null||o.addEventListener("playing",s),(m=t.current)==null||m.addEventListener("waiting",s),()=>{var _,O;(_=t.current)==null||_.removeEventListener("playing",s),(O=t.current)==null||O.removeEventListener("waiting",s)}},[t]),()=>{const s=t.current;return s?s.networkState===s.NETWORK_LOADING:!1},()=>{});return{audio:t.current,playAudio:n,togglePlay:a,seek:l,toggleMuted:p,setVolume:v,volume:d,muted:h,currentTime:b,duration:c,bufferedSeconds:y,isPlaying:g,isLoading:E}}function Rt(e,t){return u.useMemo(()=>{const r={...t};for(const n in e)e[n]!==void 0&&(r[n]=e[n]);return r},[e,t])}function Lt(e){const[t,r]=u.useState(e),[n,a]=u.useState(!1);return u.useEffect(()=>{r(e)},[e]),{mini:t,setMini:r,expanded:n,setExpanded:a,toggleExpanded:()=>a(v=>!v),isMiniCollapsed:t&&!n,isMiniExpanded:t&&n}}function Ct(e){const[t,r]=u.useState(e),[n,a]=u.useState(!1);return u.useEffect(()=>{r(e)},[e]),{superMini:t,setSuperMini:r,expanded:n,setExpanded:a,toggleExpanded:()=>a(v=>!v),isSuperMiniCollapsed:t&&!n,isSuperMiniExpanded:t&&n}}function $e(){const e=u.useRef([]);return u.useEffect(()=>{const r=e.current;return()=>{for(const n of r)clearTimeout(n)}},[]),u.useCallback((r,n)=>{const a=setTimeout(r,n);return e.current.push(a),a},[])}function Nt(){const e=u.useRef(null),[t,r]=u.useState({text:"",style:{opacity:0}}),n=$e(),a=u.useCallback((l,p=2e3)=>{e.current&&clearTimeout(e.current),r({text:l,style:{opacity:1}}),e.current=n(()=>{r({text:l,style:{opacity:0}})},p)},[n]);return[t,a]}function Pt(e){const t=Rt(e,{appearance:"normal",volume:.7,autoPlay:!1,listMaxHeight:250,mini:!1,superMini:!1,mutex:!0,listFolded:!1,theme:"light",border:!1}),{audio:r,appearance:n,initialLoop:a,initialOrder:l,volume:p,autoPlay:v,listMaxHeight:d,listFolded:h,mutex:b,theme:c,border:y,mini:g,superMini:E}=t,s=u.useMemo(()=>Array.isArray(r)?r:[r],[r]),o=$t(s,{initialLoop:a,initialOrder:l}),[m,_]=Nt(),{mini:O,expanded:j,toggleExpanded:D,isMiniCollapsed:B,isMiniExpanded:N}=Lt(g),{superMini:I,expanded:Q,toggleExpanded:Z,isSuperMiniCollapsed:V,isSuperMiniExpanded:U}=Ct(E),W=!I&&O,z=I&&!O,H=$e(),w=u.useRef(null),F=u.useCallback(()=>{w.current&&(clearTimeout(w.current),w.current=null)},[]),G=u.useRef(!1),k=Mt({src:o.currentSong.url,initialVolume:p,autoPlay:v,mutex:b,onError(P){const{error:ce}=P.target;ce&&_("An audio error has occurred, player will skip forward in 2 seconds."),o.hasNextSong&&(w.current=H(()=>{o.next()},2e3))},onEnded(){const{list:P,currentSong:ce,loop:he,prioritize:ye,hasNextSong:qe}=o,{audio:de}=k;if(he==="one"){ye({...ce});return}if(!qe&&he==="none"){G.current=!0,de.currentTime=0,de.pause(),de.src=P[0].url,ye(P[0]);return}o.next()}}),i=o.length>1,x=u.useCallback(()=>{F(),k.togglePlay(o.currentSong.url)},[k,F,o.currentSong.url]),{prioritize:S}=o,R=u.useCallback(P=>{F(),S(P)},[F,S]),[A,C]=u.useState(()=>i&&!h),[ee,te]=u.useState(n!=="fixed"),M=u.useRef(null);u.useEffect(()=>{v&&k.playAudio(o.currentSong.url)},[]);const $=u.useRef(!0),J=u.useRef(o.currentSong);return u.useEffect(()=>{if($.current){$.current=!1;return}if(G.current){G.current=!1;return}o.currentSong&&(o.loop==="one"||o.currentSong!==J.current)&&(J.current=o.currentSong,k.playAudio(o.currentSong.url))},[o.currentSong]),u.useEffect(()=>{if(n==="fixed"&&M.current){const P=M.current;return P.style.width="400px",()=>{P.removeAttribute("style")}}},[n]),{bodyRef:M,appearance:n,volume:p,listMaxHeight:d,theme:c,border:y,notice:m,audioControl:k,audio:s,handlePlayButtonClick:x,handlePlayAudioFromList:R,isPlaylistOpen:A,setPlaylistOpen:C,mini:O,displayLyrics:ee,setDisplayLyrics:te,playlist:o,hasPlaylist:i,superMini:I,showSuperMini:z,superMiniExpanded:Q,toggleSuperMiniExpanded:Z,isSuperMiniCollapsed:V,isSuperMiniExpanded:U,showMini:W,miniExpanded:j,toggleMiniExpanded:D,isMiniCollapsed:B,isMiniExpanded:N}}function At(e){return kt(e.slice())}function kt(e){let t=e.length,r;for(;t!==0;)r=Math.floor(Math.random()*t),t--,[e[t],e[r]]=[e[r],e[t]];return e}function $t(e,t){const{initialLoop:r="all",initialOrder:n="list"}=t,[a,l]=u.useState(r),[p,v]=u.useState(n),d=u.useMemo(()=>p==="list"?e:At(e),[e,p]),[h,b]=u.useState(d[0]),c=u.useCallback(o=>o.url,[]),y=u.useMemo(()=>d.findIndex(m=>c(m)===c(h))<d.length-1||a!=="none",[d,h,a,c]),g=u.useCallback(()=>{b(o=>{const m=d.findIndex(_=>c(_)===c(o));return m<d.length-1?d[m+1]:{...d[0]}})},[a,d,c]),E=u.useCallback(()=>{b(o=>{const m=d.indexOf(o);return m>0?d[m-1]:o})},[d]),s=u.useCallback(o=>{b(o)},[]);return u.useEffect(()=>{const o=d.find(m=>c(m)===c(h));b(o||d[0])},[d,c,h]),{list:d,currentSong:h,hasNextSong:y,next:g,previous:E,prioritize:s,order:p,setOrder:v,loop:a,setLoop:l,length:d.length}}function qt(e){var W,z,H;const t=q("aplayer"),{bodyRef:r,appearance:n,volume:a,listMaxHeight:l,theme:p,border:v,notice:d,audio:h,audioControl:b,handlePlayButtonClick:c,handlePlayAudioFromList:y,isPlaylistOpen:g,setPlaylistOpen:E,displayLyrics:s,setDisplayLyrics:o,playlist:m,hasPlaylist:_,showSuperMini:O,superMiniExpanded:j,toggleSuperMiniExpanded:D,isSuperMiniCollapsed:B,isSuperMiniExpanded:N,showMini:I,toggleMiniExpanded:Q,isMiniCollapsed:Z,isMiniExpanded:V}=Pt(e),U=u.useCallback(w=>w?typeof w=="string"?w:w.url?f.jsx("a",{href:w.url,target:"_blank",rel:"noreferrer",children:w.name??"Audio artist"}):w.name??"Audio artist":"Audio artist",[]);return f.jsxs("div",{className:T(t.b(),{[t.bs(p)]:!0,[t.bs("vars")]:!0,[t.bm(n)]:!0,[t.bm("loading")]:b.isLoading,[t.bm("withlist")]:_,[t.bm("list-collapsed")]:!g,[t.bm("withlrc")]:!!m.currentSong.lrc&&n!=="fixed",[t.bm("border")]:v,[t.bm("mini")]:I,[t.bm("mini-collapsed")]:Z,[t.bm("mini-expanded")]:V,[t.bm("super-mini")]:O,[t.bm("super-mini-collapsed")]:B,[t.bm("super-mini-expanded")]:N}),role:"region","aria-label":"Audio Player",children:[f.jsxs("div",{ref:r,className:t.be("body"),children:[f.jsx("div",{className:t.be("pic"),onClick:c,style:{backgroundImage:`url("${(W=m.currentSong)==null?void 0:W.cover}")`},role:"button","aria-label":b.isPlaying?"Pause audio":"Play audio",children:f.jsx("div",{className:T(t.be("button"),b.isPlaying?t.bm("pause"):t.bm("play")),role:"presentation",children:b.isPlaying?f.jsx(st,{}):f.jsx(yt,{})})}),f.jsxs("div",{className:T(t.be("info")),children:[f.jsxs("div",{className:T(t.be("music")),children:[f.jsx("span",{className:T(t.be("title")),children:((z=m.currentSong)==null?void 0:z.name)??"Audio name"}),f.jsxs("span",{className:T(t.be("author")),children:[" ","-"," ",U((H=m.currentSong)==null?void 0:H.artist)]})]}),n==="fixed"?null:f.jsx(Me,{show:s,lrcText:m.currentSong.lrc,currentTime:b.currentTime??0}),f.jsx(Et,{volume:b.volume??a,onChangeVolume:b.setVolume,muted:b.muted??!1,onToggleMuted:()=>b.toggleMuted(),currentTime:b.currentTime,audioDurationSeconds:b.duration,bufferedSeconds:b.bufferedSeconds,onSeek:w=>b.seek(w),onToggleMenu:()=>E(w=>!w),order:m.order,onOrderChange:m.setOrder,loop:m.loop,onLoopChange:m.setLoop,isPlaying:b.isPlaying??!1,onTogglePlay:c,onSkipForward:()=>{m.hasNextSong&&m.next()},onSkipBack:()=>{m.previous()},showLyrics:s,onToggleLyrics:()=>{o(w=>!w)}})]}),f.jsx("div",{className:t.be("notice"),style:d.style,children:d.text}),f.jsx("div",{className:t.be("miniswitcher"),onClick:Q,children:f.jsx("button",{className:T(t.bs("icon"),t.bs("icon-right")),type:"button",children:f.jsx(_e,{})})}),f.jsx("div",{className:t.be("super-miniswitcher"),onClick:D,children:f.jsx("button",{className:T(t.bs("icon"),t.bs("icon-right")),type:"button",children:f.jsx(_e,{})})})]}),_?f.jsx(St,{open:g,audio:h,playingAudioUrl:m.currentSong.url,onPlayAudio:y,listMaxHeight:l,isMiniExpanded:V,isSuperMiniExpanded:j}):null,f.jsx(Me,{show:s,lrcText:m.currentSong.lrc,currentTime:b.currentTime??0})]})}exports.TwistAPlayer=qt;
|
|
42
|
+
*/var Le;function wt(){return Le||(Le=1,process.env.NODE_ENV!=="production"&&function(){function e(g,E){return g===E&&(g!==0||1/g===1/E)||g!==g&&E!==E}function t(g,E){b||a.startTransition===void 0||(b=!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 s=E();if(!c){var o=E();l(s,o)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}o=p({inst:{value:s,getSnapshot:E}});var m=o[0].inst,_=o[1];return d(function(){m.value=s,m.getSnapshot=E,r(m)&&_({inst:m})},[g,s,E]),v(function(){return r(m)&&_({inst:m}),g(function(){r(m)&&_({inst:m})})},[g]),h(s),s}function r(g){var E=g.getSnapshot;g=g.value;try{var s=E();return!l(g,s)}catch{return!0}}function n(g,E){return E()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=u,l=typeof Object.is=="function"?Object.is:e,p=a.useState,v=a.useEffect,d=a.useLayoutEffect,h=a.useDebugValue,b=!1,c=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;ve.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ve}var Ce;function _t(){return Ce||(Ce=1,process.env.NODE_ENV==="production"?ue.exports=jt():ue.exports=wt()),ue.exports}var Y=_t();const K=[];function Ot(e){const t=u.useRef(null);return u.useEffect(()=>{if(typeof window<"u"&&!t.current){const r=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(r.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(r.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(r.volume=e.initialVolume),K.includes(r)||K.push(r)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),u.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onError))return r.addEventListener("error",e.onError),()=>{r.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),u.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onEnded))return r.addEventListener("ended",e.onEnded),()=>{r.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),u.useEffect(()=>()=>{const r=t.current;if(r){r.pause(),r.currentTime=0;const n=K.indexOf(r);n!==-1&&K.splice(n,1)}t.current=null},[]),t}function Mt(e){const t=Ot(e),r=u.useCallback(s=>{for(let o=0;o<K.length;o++){const m=K[o];m!==s&&!m.paused&&m.pause()}},[]),n=u.useCallback(async s=>{var m;const o=t.current;if(o){e.mutex&&r(o),o.src!==s&&(o.pause(),o.currentTime=0,o.src=s);try{await((m=t.current)==null?void 0:m.play())}catch{}}},[t,e.mutex,r]),a=u.useCallback(s=>{const o=t.current;o&&(o.paused?n(s):o.pause())},[t,n]),l=u.useCallback(s=>{Number.isFinite(s)&&(t.current.currentTime=s)},[t]),p=u.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),v=u.useCallback(s=>{t.current&&(t.current.volume=s)},[t]),d=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("volumechange",s),()=>{var m;(m=t.current)==null||m.removeEventListener("volumechange",s)}},[t]),()=>{var s;return(s=t.current)==null?void 0:s.volume},()=>{}),h=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("volumechange",s),()=>{var m;(m=t.current)==null||m.removeEventListener("volumechange",s)}},[t]),()=>{var s;return(s=t.current)==null?void 0:s.muted},()=>{}),b=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("timeupdate",s),()=>{var m;(m=t.current)==null||m.removeEventListener("timeupdate",s)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),c=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("durationchange",s),()=>{var m;(m=t.current)==null||m.removeEventListener("durationchange",s)}},[t]),()=>{var s;return(s=t.current)==null?void 0:s.duration},()=>{}),y=Y.useSyncExternalStore(u.useCallback(s=>{var o;return(o=t.current)==null||o.addEventListener("progress",s),()=>{var m;(m=t.current)==null||m.removeEventListener("progress",s)}},[t]),()=>{const s=t.current;return s&&s.buffered.length>0?s.buffered.end(s.buffered.length-1):0},()=>{}),g=Y.useSyncExternalStore(u.useCallback(s=>{var o,m;return(o=t.current)==null||o.addEventListener("play",s),(m=t.current)==null||m.addEventListener("pause",s),()=>{var _,O;(_=t.current)==null||_.removeEventListener("play",s),(O=t.current)==null||O.removeEventListener("pause",s)}},[t]),()=>{const s=t.current;return s?!s.paused:!1},()=>{}),E=Y.useSyncExternalStore(u.useCallback(s=>{var o,m;return(o=t.current)==null||o.addEventListener("playing",s),(m=t.current)==null||m.addEventListener("waiting",s),()=>{var _,O;(_=t.current)==null||_.removeEventListener("playing",s),(O=t.current)==null||O.removeEventListener("waiting",s)}},[t]),()=>{const s=t.current;return s?s.networkState===s.NETWORK_LOADING:!1},()=>{});return{audio:t.current,playAudio:n,togglePlay:a,seek:l,toggleMuted:p,setVolume:v,volume:d,muted:h,currentTime:b,duration:c,bufferedSeconds:y,isPlaying:g,isLoading:E}}function Rt(e,t){return u.useMemo(()=>{const r={...t};for(const n in e)e[n]!==void 0&&(r[n]=e[n]);return r},[e,t])}function Lt(e){const[t,r]=u.useState(e),[n,a]=u.useState(!1);return u.useEffect(()=>{r(e)},[e]),{mini:t,setMini:r,expanded:n,setExpanded:a,toggleExpanded:()=>a(v=>!v),isMiniCollapsed:t&&!n,isMiniExpanded:t&&n}}function Ct(e){const[t,r]=u.useState(e),[n,a]=u.useState(!1);return u.useEffect(()=>{r(e)},[e]),{superMini:t,setSuperMini:r,expanded:n,setExpanded:a,toggleExpanded:()=>a(v=>!v),isSuperMiniCollapsed:t&&!n,isSuperMiniExpanded:t&&n}}function $e(){const e=u.useRef([]);return u.useEffect(()=>{const r=e.current;return()=>{for(const n of r)clearTimeout(n)}},[]),u.useCallback((r,n)=>{const a=setTimeout(r,n);return e.current.push(a),a},[])}function Nt(){const e=u.useRef(null),[t,r]=u.useState({text:"",style:{opacity:0}}),n=$e(),a=u.useCallback((l,p=2e3)=>{e.current&&clearTimeout(e.current),r({text:l,style:{opacity:1}}),e.current=n(()=>{r({text:l,style:{opacity:0}})},p)},[n]);return[t,a]}function Pt(e){const t=Rt(e,{appearance:"normal",volume:.7,autoPlay:!1,listMaxHeight:250,mini:!1,superMini:!1,mutex:!0,listFolded:!1,theme:"light",border:!1}),{audio:r,appearance:n,initialLoop:a,initialOrder:l,volume:p,autoPlay:v,listMaxHeight:d,listFolded:h,mutex:b,theme:c,border:y,mini:g,superMini:E}=t,s=u.useMemo(()=>Array.isArray(r)?r:[r],[r]),o=$t(s,{initialLoop:a,initialOrder:l}),[m,_]=Nt(),{mini:O,expanded:j,toggleExpanded:D,isMiniCollapsed:B,isMiniExpanded:N}=Lt(g),{superMini:I,expanded:Q,toggleExpanded:Z,isSuperMiniCollapsed:V,isSuperMiniExpanded:U}=Ct(E),W=!I&&O,z=I&&!O,H=$e(),w=u.useRef(null),F=u.useCallback(()=>{w.current&&(clearTimeout(w.current),w.current=null)},[]),G=u.useRef(!1),k=Mt({src:o.currentSong.url,initialVolume:p,autoPlay:v,mutex:b,onError(P){const{error:ce}=P.target;ce&&_("An audio error has occurred, player will skip forward in 2 seconds."),o.hasNextSong&&(w.current=H(()=>{o.next()},2e3))},onEnded(){const{list:P,currentSong:ce,loop:he,prioritize:ye,hasNextSong:qe}=o,{audio:de}=k;if(he==="one"){ye({...ce});return}if(!qe&&he==="none"){G.current=!0,de.currentTime=0,de.pause(),de.src=P[0].url,ye(P[0]);return}o.next()}}),i=o.length>1,x=u.useCallback(()=>{F(),k.togglePlay(o.currentSong.url)},[k,F,o.currentSong.url]),{prioritize:S}=o,R=u.useCallback(P=>{F(),S(P)},[F,S]),[A,C]=u.useState(()=>i&&!h),[ee,te]=u.useState(n!=="fixed"),M=u.useRef(null);u.useEffect(()=>{v&&k.playAudio(o.currentSong.url)},[]);const $=u.useRef(!0),J=u.useRef(o.currentSong);return u.useEffect(()=>{if($.current){$.current=!1;return}if(G.current){G.current=!1;return}o.currentSong&&(o.loop==="one"||o.currentSong!==J.current)&&(J.current=o.currentSong,k.playAudio(o.currentSong.url))},[o.currentSong]),u.useEffect(()=>{if(n==="fixed"&&M.current){const P=M.current;return P.style.width="400px",()=>{P.removeAttribute("style")}}},[n]),{bodyRef:M,appearance:n,volume:p,listMaxHeight:d,theme:c,border:y,notice:m,audioControl:k,audio:s,handlePlayButtonClick:x,handlePlayAudioFromList:R,isPlaylistOpen:A,setPlaylistOpen:C,mini:O,displayLyrics:ee,setDisplayLyrics:te,playlist:o,hasPlaylist:i,superMini:I,showSuperMini:z,superMiniExpanded:Q,toggleSuperMiniExpanded:Z,isSuperMiniCollapsed:V,isSuperMiniExpanded:U,showMini:W,miniExpanded:j,toggleMiniExpanded:D,isMiniCollapsed:B,isMiniExpanded:N}}function At(e){return kt(e.slice())}function kt(e){let t=e.length,r;for(;t!==0;)r=Math.floor(Math.random()*t),t--,[e[t],e[r]]=[e[r],e[t]];return e}function $t(e,t){const{initialLoop:r="all",initialOrder:n="list"}=t,[a,l]=u.useState(r),[p,v]=u.useState(n),d=u.useMemo(()=>p==="list"?e:At(e),[e,p]),[h,b]=u.useState(d[0]),c=u.useCallback(o=>o.url,[]),y=u.useMemo(()=>d.findIndex(m=>c(m)===c(h))<d.length-1||a!=="none",[d,h,a,c]),g=u.useCallback(()=>{b(o=>{const m=d.findIndex(_=>c(_)===c(o));return m<d.length-1?d[m+1]:{...d[0]}})},[a,d,c]),E=u.useCallback(()=>{b(o=>{const m=d.indexOf(o);return m>0?d[m-1]:o})},[d]),s=u.useCallback(o=>{b(o)},[]);return u.useEffect(()=>{const o=d.find(m=>c(m)===c(h));b(o||d[0])},[d,c,h]),{list:d,currentSong:h,hasNextSong:y,next:g,previous:E,prioritize:s,order:p,setOrder:v,loop:a,setLoop:l,length:d.length}}function qt(e){var W,z,H;const t=q("aplayer"),{bodyRef:r,appearance:n,volume:a,listMaxHeight:l,theme:p,border:v,notice:d,audio:h,audioControl:b,handlePlayButtonClick:c,handlePlayAudioFromList:y,isPlaylistOpen:g,setPlaylistOpen:E,displayLyrics:s,setDisplayLyrics:o,playlist:m,hasPlaylist:_,showSuperMini:O,superMiniExpanded:j,toggleSuperMiniExpanded:D,isSuperMiniCollapsed:B,isSuperMiniExpanded:N,showMini:I,toggleMiniExpanded:Q,isMiniCollapsed:Z,isMiniExpanded:V}=Pt(e),U=u.useCallback(w=>w?typeof w=="string"?w:w.url?f.jsx("a",{href:w.url,target:"_blank",rel:"noreferrer",children:w.name??"Audio artist"}):w.name??"Audio artist":"Audio artist",[]);return f.jsxs("div",{className:T(t.b(),{[t.bs(p)]:!0,[t.bs("vars")]:!0,[t.bm(n)]:!0,[t.bm("loading")]:b.isLoading,[t.bm("withlist")]:_,[t.bm("list-expanded")]:g,[t.bm("list-collapsed")]:!g,[t.bm("withlrc")]:!!m.currentSong.lrc&&n!=="fixed",[t.bm("border")]:v,[t.bm("mini")]:I,[t.bm("mini-collapsed")]:Z,[t.bm("mini-expanded")]:V,[t.bm("super-mini")]:O,[t.bm("super-mini-collapsed")]:B,[t.bm("super-mini-expanded")]:N}),role:"region","aria-label":"Audio Player",children:[f.jsxs("div",{ref:r,className:t.be("body"),children:[f.jsx("div",{className:t.be("pic"),onClick:c,style:{backgroundImage:`url("${(W=m.currentSong)==null?void 0:W.cover}")`},role:"button","aria-label":b.isPlaying?"Pause audio":"Play audio",children:f.jsx("div",{className:T(t.be("button"),b.isPlaying?t.bm("pause"):t.bm("play")),role:"presentation",children:b.isPlaying?f.jsx(st,{}):f.jsx(yt,{})})}),f.jsxs("div",{className:T(t.be("info")),children:[f.jsxs("div",{className:T(t.be("music")),children:[f.jsx("span",{className:T(t.be("title")),children:((z=m.currentSong)==null?void 0:z.name)??"Audio name"}),f.jsxs("span",{className:T(t.be("author")),children:[" ","-"," ",U((H=m.currentSong)==null?void 0:H.artist)]})]}),n!=="fixed"?f.jsx(Me,{show:s,lrcText:m.currentSong.lrc,currentTime:b.currentTime??0}):null,f.jsx(Et,{volume:b.volume??a,onChangeVolume:b.setVolume,muted:b.muted??!1,onToggleMuted:()=>b.toggleMuted(),currentTime:b.currentTime,audioDurationSeconds:b.duration,bufferedSeconds:b.bufferedSeconds,onSeek:w=>b.seek(w),onToggleMenu:()=>E(w=>!w),order:m.order,onOrderChange:m.setOrder,loop:m.loop,onLoopChange:m.setLoop,isPlaying:b.isPlaying??!1,onTogglePlay:c,onSkipForward:()=>{m.hasNextSong&&m.next()},onSkipBack:()=>{m.previous()},showLyrics:s,onToggleLyrics:()=>{o(w=>!w)}})]}),f.jsx("div",{className:t.be("notice"),style:d.style,children:d.text}),f.jsx("div",{className:t.be("miniswitcher"),onClick:Q,children:f.jsx("button",{className:T(t.bs("icon"),t.bs("icon-right")),type:"button",children:f.jsx(_e,{})})}),f.jsx("div",{className:t.be("super-miniswitcher"),onClick:D,children:f.jsx("button",{className:T(t.bs("icon"),t.bs("icon-right")),type:"button",children:f.jsx(_e,{})})})]}),_?f.jsx(St,{open:g,audio:h,playingAudioUrl:m.currentSong.url,onPlayAudio:y,listMaxHeight:l,isMiniExpanded:V,isSuperMiniExpanded:j}):null,n==="fixed"?f.jsx(Me,{show:s,lrcText:m.currentSong.lrc,currentTime:b.currentTime??0}):null]})}exports.TwistAPlayer=qt;
|
package/dist/index.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.twist-aplayer-icon{width:var(--tp-icon-width);height:var(--tp-icon-width);border:none;background-color:transparent;outline:none;cursor:pointer;opacity:.8;vertical-align:middle;padding:0;font-size:var(--tp-icon-font-size);margin:0;display:inline-block}.twist-aplayer-icon path{transition:all var(--tp-icon-transition-timing) var(--tp-icon-transition-function)}.twist-aplayer .twist-aplayer-icon-lrc-inactivity svg{opacity:.4}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-right{display:flex;justify-content:center;align-items:center}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-back,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-forward,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-lrc,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-play{display:inline-block}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-back,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-forward,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-menu,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-play{position:absolute;bottom:27px;width:20px;height:20px;font-size:20px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-back{right:75px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-play{right:50px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-forward{right:25px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-menu{right:0%}.twist-aplayer--withlist .twist-aplayer-icon-order,.twist-aplayer--withlist .twist-aplayer-icon-menu{display:inline}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.twist-aplayer-bar{margin:0 0 0 5px;padding:4px 0;cursor:pointer!important;flex:1;transition:all .2s ease-in-out}.twist-aplayer-bar-vars{--tp-bar-width: 100%;--tp-bar-height: 2px;--tp-bar-background: hsl(var(--tp-primary) / .2);--tp-bar-played-background: hsl(var(--tp-accent-foreground));--tp-bar-loaded-background: hsl(var(--tp-secondary));--tp-bar-loaded-transition-timing: .5s;--tp-bar-loaded-transition-function: ease;--tp-bar-thumb-width: 10px;--tp-bar-thumb-height: 10px;--tp-bar-thumb-margin-top: -4px;--tp-bar-thumb-margin-right: -10px;--tp-bar-thumb-transition-function: ease-in-out;--tp-bar-thumb-transition-timing: .3s;--tp-bar-thumb-hover-scale: 1;--tp-bar-thumb-border-radius: 50%;--tp-bar-thumb-background: hsl(var(--tp-foreground))}.twist-aplayer-bar__inner{position:relative;width:var(--tp-bar-width);height:var(--tp-bar-height);background:var(--tp-bar-background)}.twist-aplayer-bar__loaded{position:absolute;left:0;top:0;bottom:0;height:var(--tp-bar-height);background:var(--tp-bar-loaded-background);transition:all var(--tp-bar-loaded-transition-timing) var(--tp-bar-loaded-transition-function)}.twist-aplayer-bar__played{position:absolute;left:0;top:0;bottom:0;height:var(--tp-bar-height);background-color:var(--tp-bar-played-background)}.twist-aplayer-bar__thumb{position:absolute;top:0;right:5px;margin-top:var(--tp-bar-thumb-margin-top);margin-right:var(--tp-bar-thumb-margin-right);width:var(--tp-bar-thumb-width);height:var(--tp-bar-thumb-height);border-radius:var(--tp-bar-thumb-border-radius);cursor:pointer;background-color:var(--tp-bar-thumb-background);transition:all var(--tp-bar-thumb-transition-timing) var(--tp-bar-thumb-transition-function);transform:scale(0);-webkit-transform:scale(0)}.twist-aplayer-bar:hover .twist-aplayer-bar__thumb{transform:scale(var(--tp-bar-thumb-hover-scale));-webkit-transform:scale(var(--tp-bar-thumb-hover-scale))}.twist-aplayer-volumn{position:relative;display:inline-block;margin-left:3px;cursor:pointer!important}.twist-aplayer-volumn-vars{--tp-volume-bar-background: hsl(var(--tp-primary) / .3);--tp-volume-bar-width: 5px;--tp-volume-bar-height: 35px;--tp-volume-bar-border-radius: 2.5px;--tp-volume-thumb-width: 5px;--tp-volume-thumb-background: hsl(var(--tp-primary));--tp-volume-thumb-transition-function: ease;--tp-volume-bar-wrap-transition-function: ease-in-out;--tp-volume-bar-wrap-timing: .2s;--tp-volume-thumb-timing: .1s}.twist-aplayer-volumn__bar-wrap{position:absolute;bottom:15px;right:-3px;width:25px;height:0;z-index:99;overflow:hidden;transition:all var(--tp-volume-bar-wrap-timing) var(--tp-volume-bar-wrap-transition-function)}.twist-aplayer-volumn:hover .twist-aplayer-volumn__bar-wrap,.twist-aplayer-volumn__bar-wrap--active{height:40px}.twist-aplayer-volumn__bar{position:absolute;bottom:0;right:10px;width:var(--tp-volume-bar-width);height:var(--tp-volume-bar-height);background:var(--tp-volume-bar-background);border-radius:var(--tp-volume-bar-border-radius);overflow:hidden}.twist-aplayer-volumn__thumb{position:absolute;bottom:0;right:0;width:var(--tp-volume-thumb-width);background-color:var(--tp-volume-thumb-background);transition:all var(--tp-volume-thumb-timing) var(--tp-volume-thumb-transition-function)}.twist-aplayer-list{overflow:auto;transition:all .5s ease;will-change:height;display:none;background-color:hsl(var(--tp-background));overflow:hidden}.twist-aplayer-list-vars{--tp-list-scrollbar-thumb-color: #8884;--tp-list-scrollbar-thumb-hover-color: hsl(var(--tp-muted-foreground) / .6)}.twist-aplayer-list--hide{max-height:0!important}.twist-aplayer-list ol{list-style-type:none;margin:0;padding:0;overflow-y:auto}.twist-aplayer-list ol li{position:relative;height:32px;line-height:32px;padding:0 15px;font-size:12px;border-top:1px solid hsl(var(--tp-border));cursor:pointer;transition:all .2s ease;overflow:hidden;margin:0;background-color:hsl(var(--tp-background))}.twist-aplayer-list ol li.twist-aplayer-list--active{background-color:hsl(var(--tp-secondary))}.twist-aplayer-list ol li:first-child{border:none}.twist-aplayer-list ol li:hover{background-color:hsl(var(--tp-secondary)/.8)}.twist-aplayer-list ol::-webkit-scrollbar{width:5px}.twist-aplayer-list ol::-webkit-scrollbar-thumb{border-radius:3px;background-color:var(--tp-list-scrollbar-thumb-color)}.twist-aplayer-list ol::-webkit-scrollbar-thumb:hover{background-color:var(--tp-list-scrollbar-thumb-hover-color)}.twist-aplayer-list__cur{display:none;width:3px;height:22px;position:absolute;left:0;top:5px;cursor:pointer;background-color:hsl(var(--tp-accent-foreground))}.twist-aplayer-list--active .twist-aplayer-list__cur{display:inline-block}.twist-aplayer-list__index{color:hsl(var(--tp-muted-foreground));margin-right:12px;cursor:pointer}.twist-aplayer-list__title{color:hsl(var(--tp-secondary-foreground))}.twist-aplayer-list__author{color:hsl(var(--tp-muted-foreground));float:right;cursor:pointer}.twist-aplayer-lrc{display:none;position:relative;height:30px;text-align:center;overflow:hidden;margin:-10px 0 7px}.twist-aplayer-lrc:after,.twist-aplayer-lrc:before{content:" ";position:absolute;z-index:1;display:block;overflow:hidden;width:100%}.twist-aplayer-lrc:before{top:0;height:10%;background:linear-gradient(180deg,hsl(var(--tp-background)) 0,#fff0);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff",endColorstr="#00ffffff",GradientType=0)}.twist-aplayer-lrc:after{bottom:0;height:33%;background:linear-gradient(180deg,#fff0 0,hsl(var(--tp-background)));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#00ffffff",endColorstr="#ccffffff",GradientType=0)}.twist-aplayer-lrc p{font-size:12px;color:hsl(var(--tp-secondary-foreground));line-height:16px!important;height:16px!important;padding:0!important;margin:0!important;transition:all .5s ease-out;opacity:.4;overflow:hidden;text-shadow:none}.twist-aplayer-lrc__contents{width:100%;transition:all .5s ease-out;-webkit-user-select:text;-moz-user-select:text;user-select:text;cursor:default}.twist-aplayer-lrc p.twist-aplayer-lrc__current{opacity:1;overflow:visible;height:auto!important;min-height:16px}.twist-aplayer-lrc.twist-aplayer-lrc--hide{display:none}.twist-aplayer-light{--tp-background: 0 0% 100%;--tp-foreground: 240 10% 3.9%;--tp-card: 0 0% 100%;--tp-card-foreground: 240 10% 3.9%;--tp-primary: 240 5.9% 10%;--tp-primary-foreground: 0 0% 98%;--tp-secondary: 240 4.8% 95.9%;--tp-secondary-foreground: 240 5.9% 10%;--tp-muted: 240 4.8% 95.9%;--tp-muted-foreground: 240 3.8% 46.1%;--tp-accent: 240 4.8% 95.9%;--tp-accent-foreground: 240 5.9% 10%;--tp-border: 240 5.9% 90%}.twist-aplayer-dark{--tp-background: 240 10% 3.9%;--tp-foreground: 0 0% 98%;--tp-card: 240 10% 3.9%;--tp-card-foreground: 0 0% 98%;--tp-primary: 0 0% 98%;--tp-primary-foreground: 240 5.9% 10%;--tp-secondary: 240 3.7% 15.9%;--tp-secondary-foreground: 0 0% 98%;--tp-muted: 240 3.7% 15.9%;--tp-muted-foreground: 240 5% 64.9%;--tp-accent: 240 3.7% 15.9%;--tp-accent-foreground: 0 0% 98%;--tp-border: 240 3.7% 15.9%}.twist-aplayer-vars{--tp-icon-width: 15px;--tp-icon-height: 15px;--tp-icon-font-size: 15px;--tp-icon-transition-function: ease-in-out;--tp-icon-transition-timing: .2s;--tp-max-width: 400px;--tp-zIndex: 99;--tp-pic-width: 66px;--tp-height: 66px;--tp-mini-switcher-width: 18px;--tp-mini-switcher-height: var(--tp-height);--tp-pic-transition-function: ease;--tp-pic-transition-timing: .3s;--tp-pic-zIndex: 99;--tp-button-background: rgba(0, 0, 0, .2);--tp-box-shadow: 0 0 #0000, 0 0 #0000, 0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tp-user-border: hsl(var(--tp-border) / .3);--tp-mini-switcher-border: 0 2px 2px 0;--tp-lrc-zIndex: 98}.twist-aplayer{font-family:Arial,Helvetica,sans-serif;-webkit-user-select:none;-moz-user-select:none;user-select:none;line-height:normal;border-radius:2px;margin:5px;box-shadow:var(--tp-box-shadow);overflow:hidden}.twist-aplayer *{box-sizing:content-box}.twist-aplayer__body{background-color:hsl(var(--tp-background));overflow:hidden}.twist-aplayer__pic{position:relative;float:left;z-index:var(--tp-pic-zIndex);width:var(--tp-pic-width);height:var(--tp-height);background-size:cover;background-position:50%;transition:all var(--tp-pic-transition-timing) var(--tp-pic-transition-function);cursor:pointer}.twist-aplayer__button{position:absolute;border-radius:50%;opacity:.8;text-shadow:0 1px 1px rgba(0,0,0,.2);box-shadow:0 1px 1px #0003;background:hsl(var(--tp-primary-foreground));transition:all .1s ease}.twist-aplayer--play{width:28px;height:28px;bottom:50%;right:50%;margin:0 -15px -15px 0}.twist-aplayer--play svg{position:absolute;top:4px;left:5px;height:20px;width:20px}.twist-aplayer--pause{font-size:12px;width:18px;height:18px;bottom:4px;right:4px}.twist-aplayer--pause svg{position:absolute;top:3px;left:3px;height:12px;width:12px}.twist-aplayer--play path,.twist-aplayer--pause path{fill:hsl(var(--tp-accent-foreground))}.twist-aplayer__info{margin-left:66px;padding:14px 7px 0 10px;height:var(--tp-height);box-sizing:border-box}.twist-aplayer__music{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0 0 13px 5px;-webkit-user-select:text;-moz-user-select:text;user-select:text;cursor:default;padding-bottom:2px;height:20px}.twist-aplayer__title{color:hsl(var(--tp-secondary-foreground));font-size:14px}.twist-aplayer__author{font-size:12px;color:hsl(var(--tp-muted-foreground))}.twist-aplayer__author>a{color:inherit;text-decoration:none}.twist-aplayer-controller{position:relative;display:flex}.twist-aplayer-controller__time{position:relative;right:0;bottom:4px;height:17px;font-size:11px;padding-left:7px}.twist-aplayer-controller__time-inner{color:hsl(var(--tp-muted-foreground));vertical-align:middle}.twist-aplayer-controller__time .twist-aplayer-icon{cursor:pointer;transition:all .2s ease}.twist-aplayer-controller__time .twist-aplayer-icon path{fill:hsl(var(--tp-muted-foreground))}.twist-aplayer-controller__time .twist-aplayer-icon:hover path{fill:hsl(var(--tp-primary))}.twist-aplayer__notice{opacity:0;position:absolute;top:50%;left:50%;z-index:100;transform:translate(-50%,-50%);font-size:12px;border-radius:4px;padding:5px 10px;transition:all .3s ease-in-out;overflow:hidden;pointer-events:none;background-color:hsl(var(--tp-accent));color:hsl(var(--tp-accent-foreground))}.twist-aplayer__miniswitcher{display:none;position:absolute;top:0;right:0;bottom:0;height:100%;background:hsl(var(--tp-accent));width:18px;border-radius:var(--tp-mini-switcher-border)}.twist-aplayer__miniswitcher .twist-aplayer-icon{height:100%;width:100%;transition:all .3s ease}.twist-aplayer__miniswitcher .twist-aplayer-icon path{fill:hsl(var(--tp-muted-foreground))}.twist-aplayer__super-miniswitcher{display:none;position:fixed;left:0;bottom:0;width:var(--tp-mini-switcher-width);height:var(--tp-mini-switcher-height);background:hsl(var(--tp-accent));border-radius:var(--tp-mini-switcher-border)}.twist-aplayer__super-miniswitcher .twist-aplayer-icon{height:100%;width:100%;transition:all .3s ease}.twist-aplayer__super-miniswitcher .twist-aplayer-icon path{fill:hsl(var(--tp-muted-foreground))}.twist-aplayer-icon-lrc-inactivity svg{opacity:.4}.twist-aplayer-icon-loading{display:none}.twist-aplayer-icon-loading svg{position:absolute;top:1px;left:1px;width:8px;height:8px;animation:rotate 1s linear infinite}.twist-aplayer-icon-loading svg path{fill:hsl(var(--tp-background))}.twist-aplayer-icon-back,.twist-aplayer-icon-forward,.twist-aplayer-icon-lrc,.twist-aplayer-icon-order,.twist-aplayer-icon-play{display:none}.twist-aplayer--border{border:1px solid var(--tp-user-border)}.twist-aplayer.twist-aplayer--fixed{position:fixed;bottom:0;left:0;right:0;margin:0;z-index:var(--tp-zIndex);overflow:visible;max-width:var(--tp-max-width);box-shadow:none;max-width:400px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer__body{position:fixed;bottom:0;left:0;right:0;margin:0;z-index:var(--tp-zIndex);padding-right:18px;transition:all .3s ease;max-width:400px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer__info{transform:scaleX(1);transform-origin:0 0;transition:all .3s ease;border-bottom:none;border-top:1px solid hsl(var(--tp-border))}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-list{margin-bottom:65px;border:1px solid hsl(var(--tp-border));border-bottom:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer__music{width:calc(100% - 105px)}.twist-aplayer.twist-aplayer--fixed .twist-aplayer.twist-aplayer--border.twist-aplayer--list-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed .twist-aplayer--list-collapsed .twist-aplayer__info{border-top:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer--border.twist-aplayer--list-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed .twist-aplayer--list-collapsed .twist-aplayer__info{border-bottom:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc{display:block;position:fixed;bottom:10px;left:0;right:0;margin:0;z-index:var(--tp-lrc-zIndex);pointer-events:none;text-shadow:-1px -1px 0 #fff}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc:after,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc:before{display:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc.twist-aplayer-lrc--hide{display:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-list--hide.twist-aplayer-list{border-top:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini .twist-aplayer__miniswitcher{display:block}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini .twist-aplayer__super-miniswitcher,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer-list{display:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer__body,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer__pic{width:66px!important;height:66px!important}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-expanded .twist-aplayer__miniswitcher .twist-aplayer-icon{transform:rotateY(180deg)}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini .twist-aplayer__miniswitcher{display:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini .twist-aplayer__super-miniswitcher{display:block}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-collapsed .twist-aplayer-list,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-collapsed .twist-aplayer__pic{display:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-expanded .twist-aplayer__super-miniswitcher{position:absolute;top:auto;left:auto;right:0;bottom:0}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-expanded .twist-aplayer__super-miniswitcher .twist-aplayer-icon{height:100%;width:100%;transform:rotateY(180deg)}.twist-aplayer.twist-aplayer--withlist .twist-aplayer-list{display:block}.twist-aplayer.twist-aplayer--withlist .twist-aplayer__info{border-bottom:1px solid hsl(var(--tp-border))}.twist-aplayer.twist-aplayer--withlrc .twist-aplayer__info{margin-left:90px;height:90px;padding:10px 7px 0}.twist-aplayer.twist-aplayer--withlrc .twist-aplayer__pic{width:90px;height:90px}.twist-aplayer--loading .twist-aplayer-icon-loading{display:block}.twist-aplayer--normal.twist-aplayer--border.twist-aplayer--list-collapsed .twist-aplayer__info,.twist-aplayer--withlist.twist-aplayer--list-collapsed .twist-aplayer__info{border-bottom:none}@keyframes slideUp{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}
|
|
1
|
+
.twist-aplayer-icon{width:var(--tp-icon-width);height:var(--tp-icon-width);border:none;background-color:transparent;outline:none;cursor:pointer;opacity:.8;vertical-align:middle;padding:0;font-size:var(--tp-icon-font-size);margin:0;display:inline-block}.twist-aplayer-icon path{transition:all var(--tp-icon-transition-timing) var(--tp-icon-transition-function)}.twist-aplayer .twist-aplayer-icon-lrc-inactivity svg{opacity:.4}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-right{display:flex;justify-content:center;align-items:center}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-back,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-forward,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-lrc,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-play{display:inline-block}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-back,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-forward,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-menu,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-play{position:absolute;bottom:27px;width:20px;height:20px;font-size:20px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-back{right:75px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-play{right:50px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-forward{right:25px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-icon-menu{right:0%}.twist-aplayer--withlist .twist-aplayer-icon-order,.twist-aplayer--withlist .twist-aplayer-icon-menu{display:inline}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.twist-aplayer-bar{margin:0 0 0 5px;padding:4px 0;cursor:pointer!important;flex:1;transition:all .2s ease-in-out}.twist-aplayer-bar-vars{--tp-bar-width: 100%;--tp-bar-height: 2px;--tp-bar-background: hsl(var(--tp-primary) / .2);--tp-bar-played-background: hsl(var(--tp-accent-foreground));--tp-bar-loaded-background: hsl(var(--tp-secondary));--tp-bar-loaded-transition-timing: .5s;--tp-bar-loaded-transition-function: ease;--tp-bar-thumb-width: 10px;--tp-bar-thumb-height: 10px;--tp-bar-thumb-margin-top: -4px;--tp-bar-thumb-margin-right: -10px;--tp-bar-thumb-transition-function: ease-in-out;--tp-bar-thumb-transition-timing: .3s;--tp-bar-thumb-hover-scale: 1;--tp-bar-thumb-border-radius: 50%;--tp-bar-thumb-background: hsl(var(--tp-foreground))}.twist-aplayer-bar__inner{position:relative;width:var(--tp-bar-width);height:var(--tp-bar-height);background:var(--tp-bar-background)}.twist-aplayer-bar__loaded{position:absolute;left:0;top:0;bottom:0;height:var(--tp-bar-height);background:var(--tp-bar-loaded-background);transition:all var(--tp-bar-loaded-transition-timing) var(--tp-bar-loaded-transition-function)}.twist-aplayer-bar__played{position:absolute;left:0;top:0;bottom:0;height:var(--tp-bar-height);background-color:var(--tp-bar-played-background)}.twist-aplayer-bar__thumb{position:absolute;top:0;right:5px;margin-top:var(--tp-bar-thumb-margin-top);margin-right:var(--tp-bar-thumb-margin-right);width:var(--tp-bar-thumb-width);height:var(--tp-bar-thumb-height);border-radius:var(--tp-bar-thumb-border-radius);cursor:pointer;background-color:var(--tp-bar-thumb-background);transition:all var(--tp-bar-thumb-transition-timing) var(--tp-bar-thumb-transition-function);transform:scale(0);-webkit-transform:scale(0)}.twist-aplayer-bar:hover .twist-aplayer-bar__thumb{transform:scale(var(--tp-bar-thumb-hover-scale));-webkit-transform:scale(var(--tp-bar-thumb-hover-scale))}.twist-aplayer-volumn{position:relative;display:inline-block;margin-left:3px;cursor:pointer!important}.twist-aplayer-volumn-vars{--tp-volume-bar-background: hsl(var(--tp-primary) / .3);--tp-volume-bar-width: 5px;--tp-volume-bar-height: 35px;--tp-volume-bar-border-radius: 2.5px;--tp-volume-thumb-width: 5px;--tp-volume-thumb-background: hsl(var(--tp-primary));--tp-volume-thumb-transition-function: ease;--tp-volume-bar-wrap-transition-function: ease-in-out;--tp-volume-bar-wrap-timing: .2s;--tp-volume-thumb-timing: .1s}.twist-aplayer-volumn__bar-wrap{position:absolute;bottom:15px;right:-3px;width:25px;height:0;z-index:99;overflow:hidden;transition:all var(--tp-volume-bar-wrap-timing) var(--tp-volume-bar-wrap-transition-function)}.twist-aplayer-volumn:hover .twist-aplayer-volumn__bar-wrap,.twist-aplayer-volumn__bar-wrap--active{height:40px}.twist-aplayer-volumn__bar{position:absolute;bottom:0;right:10px;width:var(--tp-volume-bar-width);height:var(--tp-volume-bar-height);background:var(--tp-volume-bar-background);border-radius:var(--tp-volume-bar-border-radius);overflow:hidden}.twist-aplayer-volumn__thumb{position:absolute;bottom:0;right:0;width:var(--tp-volume-thumb-width);background-color:var(--tp-volume-thumb-background);transition:all var(--tp-volume-thumb-timing) var(--tp-volume-thumb-transition-function)}.twist-aplayer-list{overflow:auto;transition:all .5s ease;will-change:height;display:none;background-color:hsl(var(--tp-background));overflow:hidden}.twist-aplayer-list-vars{--tp-list-scrollbar-thumb-color: #8884;--tp-list-scrollbar-thumb-hover-color: hsl(var(--tp-muted-foreground) / .6)}.twist-aplayer-list--hide{max-height:0!important}.twist-aplayer-list ol{list-style-type:none;margin:0;padding:0;overflow-y:auto}.twist-aplayer-list ol li{position:relative;height:32px;line-height:32px;padding:0 15px;font-size:12px;border-top:1px solid hsl(var(--tp-border));cursor:pointer;transition:all .2s ease;overflow:hidden;margin:0;background-color:hsl(var(--tp-background))}.twist-aplayer-list ol li.twist-aplayer-list--active{background-color:hsl(var(--tp-secondary))}.twist-aplayer-list ol li:first-child{border:none}.twist-aplayer-list ol li:hover{background-color:hsl(var(--tp-secondary)/.8)}.twist-aplayer-list ol::-webkit-scrollbar{width:5px}.twist-aplayer-list ol::-webkit-scrollbar-thumb{border-radius:3px;background-color:var(--tp-list-scrollbar-thumb-color)}.twist-aplayer-list ol::-webkit-scrollbar-thumb:hover{background-color:var(--tp-list-scrollbar-thumb-hover-color)}.twist-aplayer-list__cur{display:none;width:3px;height:22px;position:absolute;left:0;top:5px;cursor:pointer;background-color:hsl(var(--tp-accent-foreground))}.twist-aplayer-list--active .twist-aplayer-list__cur{display:inline-block}.twist-aplayer-list__index{color:hsl(var(--tp-muted-foreground));margin-right:12px;cursor:pointer}.twist-aplayer-list__title{color:hsl(var(--tp-secondary-foreground))}.twist-aplayer-list__author{color:hsl(var(--tp-muted-foreground));float:right;cursor:pointer}.twist-aplayer-lrc{display:none;position:relative;height:30px;text-align:center;overflow:hidden;margin:-10px 0 7px}.twist-aplayer-lrc:after,.twist-aplayer-lrc:before{content:" ";position:absolute;z-index:1;display:block;overflow:hidden;width:100%}.twist-aplayer-lrc:before{top:0;height:10%;background:linear-gradient(180deg,hsl(var(--tp-background)) 0,#fff0);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff",endColorstr="#00ffffff",GradientType=0)}.twist-aplayer-lrc:after{bottom:0;height:33%;background:linear-gradient(180deg,#fff0 0,hsl(var(--tp-background)));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#00ffffff",endColorstr="#ccffffff",GradientType=0)}.twist-aplayer-lrc p{font-size:12px;color:hsl(var(--tp-secondary-foreground));line-height:16px!important;height:16px!important;padding:0!important;margin:0!important;transition:all .5s ease-out;opacity:.4;overflow:hidden;text-shadow:none}.twist-aplayer-lrc__contents{width:100%;transition:all .5s ease-out;-webkit-user-select:text;-moz-user-select:text;user-select:text;cursor:default}.twist-aplayer-lrc p.twist-aplayer-lrc__current{opacity:1;overflow:visible;height:auto!important;min-height:16px}.twist-aplayer-lrc.twist-aplayer-lrc--hide{display:none}.twist-aplayer-light{--tp-background: 0 0% 100%;--tp-foreground: 240 10% 3.9%;--tp-card: 0 0% 100%;--tp-card-foreground: 240 10% 3.9%;--tp-primary: 240 5.9% 10%;--tp-primary-foreground: 0 0% 98%;--tp-secondary: 240 4.8% 95.9%;--tp-secondary-foreground: 240 5.9% 10%;--tp-muted: 240 4.8% 95.9%;--tp-muted-foreground: 240 3.8% 46.1%;--tp-accent: 240 4.8% 95.9%;--tp-accent-foreground: 240 5.9% 10%;--tp-border: 240 5.9% 90%}.twist-aplayer-dark{--tp-background: 240 10% 3.9%;--tp-foreground: 0 0% 98%;--tp-card: 240 10% 3.9%;--tp-card-foreground: 0 0% 98%;--tp-primary: 0 0% 98%;--tp-primary-foreground: 240 5.9% 10%;--tp-secondary: 240 3.7% 15.9%;--tp-secondary-foreground: 0 0% 98%;--tp-muted: 240 3.7% 15.9%;--tp-muted-foreground: 240 5% 64.9%;--tp-accent: 240 3.7% 15.9%;--tp-accent-foreground: 0 0% 98%;--tp-border: 240 3.7% 15.9%}.twist-aplayer-vars{--tp-icon-width: 15px;--tp-icon-height: 15px;--tp-icon-font-size: 15px;--tp-icon-transition-function: ease-in-out;--tp-icon-transition-timing: .2s;--tp-max-width: 400px;--tp-zIndex: 99;--tp-pic-width: 66px;--tp-height: 66px;--tp-mini-switcher-width: 18px;--tp-mini-switcher-height: var(--tp-height);--tp-pic-transition-function: ease;--tp-pic-transition-timing: .3s;--tp-pic-zIndex: 99;--tp-button-background: rgba(0, 0, 0, .2);--tp-box-shadow: 0 0 #0000, 0 0 #0000, 0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tp-user-border: hsl(var(--tp-border) / .3);--tp-mini-switcher-border: 0 2px 2px 0;--tp-lrc-zIndex: 98}.twist-aplayer{font-family:Arial,Helvetica,sans-serif;-webkit-user-select:none;-moz-user-select:none;user-select:none;line-height:normal;border-radius:2px;margin:5px;box-shadow:var(--tp-box-shadow);overflow:hidden}.twist-aplayer *{box-sizing:content-box}.twist-aplayer__body{background-color:hsl(var(--tp-background));overflow:hidden}.twist-aplayer__pic{position:relative;float:left;z-index:var(--tp-pic-zIndex);width:var(--tp-pic-width);height:var(--tp-height);background-size:cover;background-position:50%;transition:all var(--tp-pic-transition-timing) var(--tp-pic-transition-function);cursor:pointer}.twist-aplayer__button{position:absolute;border-radius:50%;opacity:.8;text-shadow:0 1px 1px rgba(0,0,0,.2);box-shadow:0 1px 1px #0003;background:hsl(var(--tp-primary-foreground));transition:all .1s ease}.twist-aplayer--play{width:28px;height:28px;bottom:50%;right:50%;margin:0 -15px -15px 0}.twist-aplayer--play svg{position:absolute;top:4px;left:5px;height:20px;width:20px}.twist-aplayer--pause{font-size:12px;width:18px;height:18px;bottom:4px;right:4px}.twist-aplayer--pause svg{position:absolute;top:3px;left:3px;height:12px;width:12px}.twist-aplayer--play path,.twist-aplayer--pause path{fill:hsl(var(--tp-accent-foreground))}.twist-aplayer__info{margin-left:66px;padding:14px 7px 0 10px;height:var(--tp-height);box-sizing:border-box}.twist-aplayer__music{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0 0 13px 5px;-webkit-user-select:text;-moz-user-select:text;user-select:text;cursor:default;padding-bottom:2px;height:20px}.twist-aplayer__title{color:hsl(var(--tp-secondary-foreground));font-size:14px}.twist-aplayer__author{font-size:12px;color:hsl(var(--tp-muted-foreground))}.twist-aplayer__author>a{color:inherit;text-decoration:none}.twist-aplayer-controller{position:relative;display:flex}.twist-aplayer-controller__time{position:relative;right:0;bottom:4px;height:17px;font-size:11px;padding-left:7px}.twist-aplayer-controller__time-inner{color:hsl(var(--tp-muted-foreground));vertical-align:middle}.twist-aplayer-controller__time .twist-aplayer-icon{cursor:pointer;transition:all .2s ease}.twist-aplayer-controller__time .twist-aplayer-icon path{fill:hsl(var(--tp-muted-foreground))}.twist-aplayer-controller__time .twist-aplayer-icon:hover path{fill:hsl(var(--tp-primary))}.twist-aplayer__notice{opacity:0;position:absolute;top:50%;left:50%;z-index:100;transform:translate(-50%,-50%);font-size:12px;border-radius:4px;padding:5px 10px;transition:all .3s ease-in-out;overflow:hidden;pointer-events:none;background-color:hsl(var(--tp-accent));color:hsl(var(--tp-accent-foreground))}.twist-aplayer__miniswitcher{display:none;position:absolute;top:0;right:0;bottom:0;height:100%;background:hsl(var(--tp-accent));width:18px;border-radius:var(--tp-mini-switcher-border)}.twist-aplayer__miniswitcher .twist-aplayer-icon{height:100%;width:100%;transition:all .3s ease}.twist-aplayer__miniswitcher .twist-aplayer-icon path{fill:hsl(var(--tp-muted-foreground))}.twist-aplayer__super-miniswitcher{display:none;position:fixed;left:0;bottom:0;width:var(--tp-mini-switcher-width);height:var(--tp-mini-switcher-height);background:hsl(var(--tp-accent));border-radius:var(--tp-mini-switcher-border)}.twist-aplayer__super-miniswitcher .twist-aplayer-icon{height:100%;width:100%;transition:all .3s ease}.twist-aplayer__super-miniswitcher .twist-aplayer-icon path{fill:hsl(var(--tp-muted-foreground))}.twist-aplayer-icon-lrc-inactivity svg{opacity:.4}.twist-aplayer-icon-loading{display:none}.twist-aplayer-icon-loading svg{position:absolute;top:1px;left:1px;width:8px;height:8px;animation:rotate 1s linear infinite}.twist-aplayer-icon-loading svg path{fill:hsl(var(--tp-background))}.twist-aplayer-icon-back,.twist-aplayer-icon-forward,.twist-aplayer-icon-lrc,.twist-aplayer-icon-order,.twist-aplayer-icon-play{display:none}.twist-aplayer--border{border:1px solid var(--tp-user-border)}.twist-aplayer.twist-aplayer--fixed{position:fixed;bottom:0;left:0;right:0;margin:0;z-index:var(--tp-zIndex);overflow:visible;max-width:var(--tp-max-width);box-shadow:none;max-width:400px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer__body{position:fixed;bottom:0;left:0;right:0;margin:0;z-index:var(--tp-zIndex);padding-right:18px;transition:all .3s ease;max-width:400px}.twist-aplayer.twist-aplayer--fixed .twist-aplayer--list-expanded .twist-aplayer__info{transform:scaleX(1);transform-origin:0 0;transition:all .3s ease;border-bottom:none;border-top:1px solid hsl(var(--tp-border))}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-list{margin-bottom:65px;border:1px solid hsl(var(--tp-border));border-bottom:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer__music{width:calc(100% - 105px)}.twist-aplayer.twist-aplayer--fixed .twist-aplayer.twist-aplayer--border.twist-aplayer--list-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed .twist-aplayer--list-collapsed .twist-aplayer__info{border-top:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer--border.twist-aplayer--list-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed .twist-aplayer--list-collapsed .twist-aplayer__info{border-bottom:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc{display:block;position:fixed;bottom:10px;left:0;right:0;margin:0;z-index:var(--tp-lrc-zIndex);pointer-events:none;text-shadow:-1px -1px 0 #fff}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc:after,.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc:before{display:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-lrc.twist-aplayer-lrc--hide{display:none}.twist-aplayer.twist-aplayer--fixed .twist-aplayer-list--hide.twist-aplayer-list{border-top:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini .twist-aplayer__miniswitcher{display:block}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini .twist-aplayer__super-miniswitcher,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer-list{display:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer__body,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-collapsed .twist-aplayer__pic{width:66px!important;height:66px!important}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--mini-expanded .twist-aplayer__miniswitcher .twist-aplayer-icon{transform:rotateY(180deg)}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini .twist-aplayer__miniswitcher{display:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini .twist-aplayer__super-miniswitcher{display:block}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-collapsed .twist-aplayer__info,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-collapsed .twist-aplayer-list,.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-collapsed .twist-aplayer__pic{display:none}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-expanded .twist-aplayer__super-miniswitcher{position:absolute;top:auto;left:auto;right:0;bottom:0}.twist-aplayer.twist-aplayer--fixed.twist-aplayer--super-mini-expanded .twist-aplayer__super-miniswitcher .twist-aplayer-icon{height:100%;width:100%;transform:rotateY(180deg)}.twist-aplayer.twist-aplayer--withlist .twist-aplayer-list{display:block}.twist-aplayer.twist-aplayer--withlist .twist-aplayer__info{border-bottom:1px solid hsl(var(--tp-border))}.twist-aplayer.twist-aplayer--withlrc .twist-aplayer__info{margin-left:90px;height:90px;padding:10px 7px 0}.twist-aplayer.twist-aplayer--withlrc .twist-aplayer__pic{width:90px;height:90px}.twist-aplayer.twist-aplayer--withlrc .twist-aplayer-lrc,.twist-aplayer--loading .twist-aplayer-icon-loading{display:block}.twist-aplayer--normal.twist-aplayer--border.twist-aplayer--list-collapsed .twist-aplayer__info,.twist-aplayer--withlist.twist-aplayer--list-collapsed .twist-aplayer__info{border-bottom:none}@keyframes slideUp{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}
|
package/dist/index.mjs
CHANGED
|
@@ -1614,6 +1614,7 @@ function Bt(e) {
|
|
|
1614
1614
|
[t.bm(n)]: !0,
|
|
1615
1615
|
[t.bm("loading")]: v.isLoading,
|
|
1616
1616
|
[t.bm("withlist")]: _,
|
|
1617
|
+
[t.bm("list-expanded")]: b,
|
|
1617
1618
|
[t.bm("list-collapsed")]: !b,
|
|
1618
1619
|
[t.bm("withlrc")]: !!f.currentSong.lrc && n !== "fixed",
|
|
1619
1620
|
[t.bm("border")]: p,
|
|
@@ -1666,14 +1667,14 @@ function Bt(e) {
|
|
|
1666
1667
|
K((W = f.currentSong) == null ? void 0 : W.artist)
|
|
1667
1668
|
] })
|
|
1668
1669
|
] }),
|
|
1669
|
-
n
|
|
1670
|
+
n !== "fixed" ? /* @__PURE__ */ d.jsx(
|
|
1670
1671
|
Pe,
|
|
1671
1672
|
{
|
|
1672
1673
|
show: i,
|
|
1673
1674
|
lrcText: f.currentSong.lrc,
|
|
1674
1675
|
currentTime: v.currentTime ?? 0
|
|
1675
1676
|
}
|
|
1676
|
-
),
|
|
1677
|
+
) : null,
|
|
1677
1678
|
/* @__PURE__ */ d.jsx(
|
|
1678
1679
|
wt,
|
|
1679
1680
|
{
|
|
@@ -1737,14 +1738,14 @@ function Bt(e) {
|
|
|
1737
1738
|
isSuperMiniExpanded: j
|
|
1738
1739
|
}
|
|
1739
1740
|
) : null,
|
|
1740
|
-
/* @__PURE__ */ d.jsx(
|
|
1741
|
+
n === "fixed" ? /* @__PURE__ */ d.jsx(
|
|
1741
1742
|
Pe,
|
|
1742
1743
|
{
|
|
1743
1744
|
show: i,
|
|
1744
1745
|
lrcText: f.currentSong.lrc,
|
|
1745
1746
|
currentTime: v.currentTime ?? 0
|
|
1746
1747
|
}
|
|
1747
|
-
)
|
|
1748
|
+
) : null
|
|
1748
1749
|
]
|
|
1749
1750
|
}
|
|
1750
1751
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(z,
|
|
1
|
+
(function(z,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("./styles/main.scss")):typeof define=="function"&&define.amd?define(["exports","react","./styles/main.scss"],o):(z=typeof globalThis<"u"?globalThis:z||self,o(z.TwistAPlayer={},z.React))})(this,function(z,o){"use strict";function Ve(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const G=Ve(o);var oe={exports:{}},ee={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -14,16 +14,16 @@
|
|
|
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
|
-
*/return e.NODE_ENV!=="production"&&function(){function t(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===X?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case
|
|
17
|
+
*/return e.NODE_ENV!=="production"&&function(){function t(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===X?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case u:return"Fragment";case T:return"Profiler";case p:return"StrictMode";case B:return"Suspense";case A:return"SuspenseList";case se:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case i:return"Portal";case w:return(a.displayName||"Context")+".Provider";case j:return(a._context.displayName||"Context")+".Consumer";case R:var g=a.render;return a=a.displayName,a||(a=g.displayName||g.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case H:return g=a.displayName||null,g!==null?g:t(a.type)||"Memo";case K:g=a._payload,a=a._init;try{return t(a(g))}catch{}}return null}function r(a){return""+a}function n(a){try{r(a);var g=!1}catch{g=!0}if(g){g=console;var _=g.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return _.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),r(a)}}function s(a){if(a===u)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===K)return"<...>";try{var g=t(a);return g?"<"+g+">":"<...>"}catch{return"<...>"}}function l(){var a=F.A;return a===null?null:a.getOwner()}function m(){return Error("react-stack-top-frame")}function v(a){if(Y.call(a,"key")){var g=Object.getOwnPropertyDescriptor(a,"key").get;if(g&&g.isReactWarning)return!1}return a.key!==void 0}function f(a,g){function _(){O||(O=!0,console.error("%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://react.dev/link/special-props)",g))}_.isReactWarning=!0,Object.defineProperty(a,"key",{get:_,configurable:!0})}function h(){var a=t(this.type);return U[a]||(U[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function b(a,g,_,C,$,N,ae,W){return _=N.ref,a={$$typeof:E,type:a,key:g,props:N,_owner:$},(_!==void 0?_:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:h}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ae}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function c(a,g,_,C,$,N,ae,W){var M=g.children;if(M!==void 0)if(C)if(Q(M)){for(C=0;C<M.length;C++)y(M[C]);Object.freeze&&Object.freeze(M)}else console.error("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 y(M);if(Y.call(g,"key")){M=t(a);var I=Object.keys(g).filter(function(ue){return ue!=="key"});C=0<I.length?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}",ie[M+C]||(I=0<I.length?"{"+I.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,C,M,I,M),ie[M+C]=!0)}if(M=null,_!==void 0&&(n(_),M=""+_),v(g)&&(n(g.key),M=""+g.key),"key"in g){_={};for(var P in g)P!=="key"&&(_[P]=g[P])}else _=g;return M&&f(_,typeof a=="function"?a.displayName||a.name||"Unknown":a),b(a,M,N,$,l(),_,ae,W)}function y(a){typeof a=="object"&&a!==null&&a.$$typeof===
|
|
22
|
+
<%s key={someKey} {...props} />`,C,M,I,M),ie[M+C]=!0)}if(M=null,_!==void 0&&(n(_),M=""+_),v(g)&&(n(g.key),M=""+g.key),"key"in g){_={};for(var P in g)P!=="key"&&(_[P]=g[P])}else _=g;return M&&f(_,typeof a=="function"?a.displayName||a.name||"Unknown":a),b(a,M,N,$,l(),_,ae,W)}function y(a){typeof a=="object"&&a!==null&&a.$$typeof===E&&a._store&&(a._store.validated=1)}var x=o,E=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),w=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),X=Symbol.for("react.client.reference"),F=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,Q=Array.isArray,V=console.createTask?console.createTask:function(){return null};x={"react-stack-bottom-frame":function(a){return a()}};var O,U={},Z=x["react-stack-bottom-frame"].bind(x,m)(),q=V(s(m)),ie={};te.Fragment=u,te.jsx=function(a,g,_,C,$){var N=1e4>F.recentlyCreatedOwnerStacks++;return c(a,g,_,!1,C,$,N?Error("react-stack-top-frame"):Z,N?V(s(a)):q)},te.jsxs=function(a,g,_,C,$){var N=1e4>F.recentlyCreatedOwnerStacks++;return c(a,g,_,!0,C,$,N?Error("react-stack-top-frame"):Z,N?V(s(a)):q)}}(),te}var xe;function Re(){if(xe)return oe.exports;xe=1;var e={};return e.NODE_ENV==="production"?oe.exports=ze():oe.exports=De(),oe.exports}var d=Re(),le=e=>`--${e}`,Ee=e=>`var(--${e})`,Se=(e,t)=>`--${e}: ${t};`;function Be(e,t){const r=n=>t;return{b:()=>`${r()}-${e}`,be:n=>`${r()}-${e}__${n}`,bm:n=>`${r()}-${e}--${n}`,bem:(n,s)=>`${r()}-${e}__${n}--${s}`,bs:n=>`${r()}-${e}-${n}`,ns:n=>`${r()}-${n}`,cb:()=>`.${r()}-${e}`,cbe:n=>`.${r()}-${e}__${n}`,cbm:n=>`.${r()}-${e}--${n}`,cbem:(n,s)=>`.${r()}-${e}__${n}--${s}`,cbs:n=>`.${r()}-${e}-${n}`,cns:n=>`.${r()}-${n}`,cv:n=>le(`${r()}-${e}-${n}`),cvm:(n,s={})=>{const l=r();for(const m of Object.keys(n))s[le(`${l}-${e}-${m}`)]=n[m];return s},gcv:n=>Ee(`${r()}-${e}-${n}`),scv:(n,s)=>Se(`${r()}-${e}-${n}`,s),nv:n=>le(`${r()}-${n}`),nvm:(n,s={})=>{const l=r();for(const m of Object.keys(n))s[le(`${l}-${m}`)]=n[m];return s},gnv:n=>Ee(`${r()}-${n}`),snv:(n,s)=>Se(`${r()}-${n}`,s)}}function k(e){return o.useMemo(()=>Be(e,"twist"),[e])}var Te={color:void 0,size:void 0,className:void 0,style:void 0,attrs:void 0},fe=G.createContext(Te);fe.Provider;function re(e){"@babel/helpers - typeof";return re=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},re(e)}var He=["attrs","size","title","spin","rotate","color"];function Fe(e,t){return We(e)||Ue(e,t)||_e(e,t)||Ye()}function Ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
23
23
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ue(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,l,m,v=[],f=!0,h=!1;try{if(l=(r=r.call(e)).next,t!==0)for(;!(f=(n=l.call(r)).done)&&(v.push(n.value),v.length!==t);f=!0);}catch(b){h=!0,s=b}finally{try{if(!f&&r.return!=null&&(m=r.return(),Object(m)!==m))return}finally{if(h)throw s}}return v}}function We(e){if(Array.isArray(e))return e}function Ge(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_e(e))||t){r&&(e=r);var n=0,s=function(){};return{s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(h){throw h},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,m=!0,v=!1;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return m=h.done,h},e:function(h){v=!0,l=h},f:function(){try{m||r.return==null||r.return()}finally{if(v)throw l}}}}function _e(e,t){if(e){if(typeof e=="string")return je(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?je(e,t):void 0}}function je(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ce.apply(null,arguments)}function we(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?we(Object(r),!0).forEach(function(n){Je(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Je(e,t,r){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ke(e){var t=Xe(e,"string");return re(t)=="symbol"?t:t+""}function Xe(e,t){if(re(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(re(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qe(e,t){if(e==null)return{};var r,n,s=Ze(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Ze(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}function et(e){var t=e.attrs,r=e.size,n=e.title,s=e.spin,l=e.rotate,m=e.color,v=Qe(e,He),f=function(b){var c=r||b.size||"1em",y,E="",x="";return b.className&&(y=b.className),e.className&&(y=y?"".concat(y," ").concat(e.className):e.className),s&&(y?y+=" twist-icon-loading":y="twist-icon-loading"),l&&(E="rotate(".concat(l,"deg)"),x="rotate(".concat(l,"deg)")),G.createElement("svg",ce({xmlns:"http://www.w3.org/2000/svg"},b.attrs,t,v,{className:y,style:ne(ne({color:m||b.color,msTransform:E,transform:x},b.style),e.style),width:c,height:c}),n&&G.createElement("title",null,n),e.children)};return fe!==void 0?G.createElement(fe.Consumer,null,function(h){return f(h)}):f(Te)}function tt(e){var t={},r=e.split(";"),n=Ge(r),s;try{for(n.s();!(s=n.n()).done;){var l=s.value,m=l.split(":"),v=Fe(m,2),f=v[0],h=v[1];if(f&&h){var b=f.trim().replace(/-./g,function(c){return c.charAt(1).toUpperCase()});t[b]=h.trim()}}}catch(c){n.e(c)}finally{n.f()}return t}function Oe(e){return e&&e.map(function(t,r){return G.createElement(t.tag,ne(ne({},t.attrs),{},{key:r,style:t.attrs.style?tt(t.attrs.style):null}),Oe(t.children))})}function L(e){return function(t){return G.createElement(et,ce({attrs:ne({},e.attrs)},t),Oe(e.children))}}function rt(e){return L({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 nt(e){return L({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 st(e){return L({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M512 1024c-69.1 0-136.2-13.5-199.3-40.2C251.7 958 197 921 150 874S66 772.3 40.2 711.3C13.5 648.2 0 581.1 0 512c0-19.9 16.1-36 36-36s36 16.1 36 36c0 59.4 11.6 117 34.6 171.3c22.2 52.4 53.9 99.5 94.3 139.9s87.5 72.2 139.9 94.3C395 940.4 452.6 952 512 952s117-11.6 171.3-34.6c52.4-22.2 99.5-53.9 139.9-94.3s72.2-87.5 94.3-139.9C940.4 629 952 571.4 952 512s-11.6-117-34.6-171.3a440.5 440.5 0 0 0-94.3-139.9a437.7 437.7 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.2C772.3 66 827 103 874 150s83.9 101.8 109.7 162.7c26.7 63.1 40.2 130.2 40.2 199.3s-13.5 136.2-40.2 199.3C958 772.3 921 827 874 874s-101.8 83.9-162.7 109.7c-63.1 26.8-130.2 40.3-199.3 40.3"}}]})(e)}function Me(e){return L({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 it(e){return L({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(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"}}]})(e)}function ot(e){return L({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 ut(e){return L({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 lt(e){return L({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 ct(e){return L({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 dt(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14 19V5h4v14zm-8 0V5h4v14z"}}]})(e)}function ft(e){return L({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 mt(e){return L({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 pt(e){return L({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 vt(e){return L({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 bt(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7 15V9h4l5-5v16l-5-5z"}}]})(e)}function ht(e){return L({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 yt(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M18.25 12L8.5 17.629V6.37z"}}]})(e)}function me(e,t){if(!t.current)return 0;let r=(e.clientX-t.current.getBoundingClientRect().left)/t.current.clientWidth;return r=Math.max(r,0),r=Math.min(r,1),r=Math.floor(r*100)/100,r}function pe(e,t){if(!t.current)return 0;let r=1-(e.clientY-t.current.getBoundingClientRect().top)/t.current.clientHeight;return r=Math.max(r,0),r=Math.min(r,1),r=Math.floor(r*100)/100,r}function Le(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Le(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function S(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Le(e))&&(n&&(n+=" "),n+=t);return n}function gt({bufferedPercentage:e,playedPercentage:t,onSeek:r}){const n=k("aplayer-bar"),s=k("aplayer-icon"),l=u.useRef(null),[m,v]=u.useState(t),f=u.useRef(!1);u.useEffect(()=>{f.current||v(t)},[t]);const h=u.useCallback(b=>{f.current=!0;const c=me(b,l);v(c);const y=x=>{const i=me(x,l);v(i)},E=x=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",E);const i=me(x,l);v(i),r==null||r(i),f.current=!1};document.addEventListener("mousemove",y),document.addEventListener("mouseup",E)},[r]);return d.jsx("div",{ref:l,className:S(n.b(),n.bs("vars")),onMouseDown:h,role:"slider","aria-label":"Audio progress","aria-valuenow":m?m*100:0,"aria-valuemin":0,"aria-valuemax":100,"aria-live":"polite",children:d.jsxs("div",{className:n.be("inner"),children:[typeof e<"u"?d.jsx("div",{className:n.be("loaded"),style:{width:`${e*100}%`}}):null,typeof m<"u"?d.jsx("div",{className:n.be("played"),style:{width:`${m*100}%`},children:d.jsx("span",{className:n.be("thumb"),children:d.jsx("span",{className:S(s.bs("loading")),children:d.jsx(st,{})})})}):null]})})}function xt({volume:e,muted:t,onToggleMuted:r,onChangeVolume:n}){const s=k("aplayer-volumn"),l=k("aplayer-icon"),m=u.useRef(null),[v,f]=u.useState(!1),h=u.useCallback(b=>{n(pe(b,m)),f(!0);const c=E=>{n(pe(E,m))},y=E=>{document.removeEventListener("mouseup",y),document.removeEventListener("mousemove",c),f(!1),n(pe(E,m))};document.addEventListener("mousemove",c),document.addEventListener("mouseup",y)},[n]);return d.jsxs("div",{className:S(s.b(),s.bs("vars")),children:[d.jsx("button",{type:"button",className:S(l.b(),l.bs("volume-down")),onClick:()=>r(),"aria-label":t||!e?"Muted":"unMuted",children:t||!e?d.jsx(bt,{}):e>=1?d.jsx(ht,{}):d.jsx(vt,{})}),d.jsx("div",{className:S(s.be("bar-wrap"),{[s.bem("bar-wrap","active")]:v}),ref:m,onMouseDown:h,children:d.jsx("div",{className:s.be("bar"),children:d.jsx("div",{className:s.be("thumb"),style:{height:t?0:`${e*100}%`}})})})]})}function Ce(e){if(typeof e>"u")return"--:--";if(Number.isNaN(e))return"00:00";const t=m=>m<10?`0${m}`:`${m}`,r=Math.trunc(e/60),n=Math.trunc(e-r*60),s=Math.trunc(r/60),l=Math.trunc(e/60-60*Math.trunc(e/60/60));return e>=3600?`${t(s)}:${t(l)}:${t(n)}`:`${t(r)}:${t(n)}`}function Et({volume:e,onChangeVolume:t,muted:r,currentTime:n,audioDurationSeconds:s,bufferedSeconds:l,onToggleMenu:m,onToggleMuted:v,order:f,onOrderChange:h,loop:b,onLoopChange:c,onSeek:y,isPlaying:E,onTogglePlay:x,onSkipForward:i,onSkipBack:o,showLyrics:p=!0,onToggleLyrics:T}){const j=k("aplayer-controller"),w=k("aplayer-icon"),R=u.useCallback(()=>{const A={list:"random",random:"list"}[f];h(A)},[f,h]),B=u.useCallback(()=>{const A={all:"one",one:"none",none:"all"}[b];c(A)},[b,c]);return d.jsxs("div",{className:S(j.b(),j.bs("vars")),role:"group","aria-label":"Audio Controls",children:[d.jsx(gt,{playedPercentage:typeof n>"u"||typeof s>"u"?void 0:n/s,bufferedPercentage:typeof l>"u"||typeof s>"u"?void 0:l/s,onSeek:A=>y==null?void 0:y(A*s)}),d.jsxs("div",{className:j.be("time"),children:[d.jsxs("span",{className:j.be("time-inner"),"aria-live":"polite",children:[d.jsx("span",{className:j.be("ptime"),children:Ce(n)})," / ",d.jsx("span",{className:j.be("dtime"),children:Ce(s)})]}),d.jsx("button",{className:S(w.b(),w.bs("back")),onClick:o,type:"button","aria-label":"Previous track",children:d.jsx(rt,{})}),d.jsx("button",{className:S(w.b(),w.bs("play")),onClick:x,type:"button","aria-label":E?"Pause audio":"Play audio",children:E?d.jsx(dt,{}):d.jsx(ft,{})}),d.jsx("button",{className:S(w.b(),w.bs("forward")),onClick:i,type:"button","aria-label":"Next track",children:d.jsx(nt,{})}),d.jsx(xt,{volume:e,muted:r,onToggleMuted:v,onChangeVolume:t}),d.jsx("button",{className:S(w.b(),w.bs("order")),onClick:R,type:"button","aria-label":`Playback order: ${f}`,children:{list:d.jsx(lt,{}),random:d.jsx(ut,{})}[f]}),d.jsx("button",{className:S(w.b(),w.bs("order")),onClick:B,type:"button","aria-label":`Loop mode: ${b}`,children:{all:d.jsx(pt,{}),one:d.jsx(mt,{}),none:d.jsx(ot,{})}[b]}),d.jsx("button",{type:"button",className:S(w.b(),w.bs("menu")),onClick:()=>m==null?void 0:m(),"aria-label":"Toggle playlist menu",children:d.jsx(at,{})}),d.jsx("button",{type:"button",className:S(w.b(),w.bs("lrc"),{[w.ns("lrc-inactivity")]:!p}),onClick:T,"aria-label":p?"Hide lyrics":"Show lyrics","aria-pressed":p,children:d.jsx(ct,{})})]})]})}function St({open:e,audio:t,playingAudioUrl:r,onPlayAudio:n,listMaxHeight:s,isMiniExpanded:l,isSuperMiniExpanded:m}){const v=k("aplayer-list"),f=s?{maxHeight:s}:void 0,h=u.useCallback(c=>c?typeof c=="string"?c:c.name??"Audio artist":"Audio artist",[]),b=u.useRef(null);return u.useEffect(()=>{if(b.current){const c=b.current;return c.style.maxHeight=`${Math.min(c.scrollHeight,s??1/0)}px`,()=>{c.removeAttribute("style")}}},[s,l,m]),d.jsx("div",{ref:b,className:S(v.b(),{[v.bm("hide")]:!e,[v.bs("vars")]:!0}),"aria-label":"Audio playlist","aria-live":"polite",children:d.jsx("ol",{style:f,children:t.map((c,y)=>d.jsxs("li",{className:S({[v.bm("active")]:c.url===r}),onClick:()=>{c.url!==r&&(n==null||n(c))},role:"button","aria-label":`${c.name??"Audio name"} by ${h(c.artist)}}`,children:[d.jsx("span",{className:v.be("cur")}),d.jsx("span",{className:v.be("index"),children:y+1}),d.jsx("span",{className:v.be("title"),children:c.name??"Audio name"}),d.jsx("span",{className:v.be("author"),children:h(c.artist)})]},c.name||y))})})}function Pe({show:e,lrcText:t,currentTime:r}){const n=k("aplayer-lrc"),s=u.useMemo(()=>Tt(t),[t]),l=u.useMemo(()=>{for(let v=0;v<s.length;v++){const f=s[v],h=s[v+1];if(r>=f[0]&&(!h||r<h[0]))return v}return 0},[r,s]),m=u.useMemo(()=>({transform:`translateY(${-l*16}px)`,WebkitTransform:`translateY(${-l*16}px)`}),[l]);return d.jsx("div",{className:S(n.b(),{[n.bm("hide")]:!e}),children:t?d.jsx("div",{className:n.be("contents"),style:m,children:s.map(([,v],f)=>d.jsx("p",{className:S({[n.be("current")]:f===l}),children:v},f))}):null})}function Tt(e){if(e){e=e.replace(/([^\]^\n])\[/g,(s,l)=>`${l}
|
|
24
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,m=!0,v=!1;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return m=h.done,h},e:function(h){v=!0,l=h},f:function(){try{m||r.return==null||r.return()}finally{if(v)throw l}}}}function _e(e,t){if(e){if(typeof e=="string")return je(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?je(e,t):void 0}}function je(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ce.apply(null,arguments)}function we(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?we(Object(r),!0).forEach(function(n){Je(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Je(e,t,r){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ke(e){var t=Xe(e,"string");return re(t)=="symbol"?t:t+""}function Xe(e,t){if(re(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(re(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qe(e,t){if(e==null)return{};var r,n,s=Ze(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Ze(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}function et(e){var t=e.attrs,r=e.size,n=e.title,s=e.spin,l=e.rotate,m=e.color,v=Qe(e,He),f=function(b){var c=r||b.size||"1em",y,x="",E="";return b.className&&(y=b.className),e.className&&(y=y?"".concat(y," ").concat(e.className):e.className),s&&(y?y+=" twist-icon-loading":y="twist-icon-loading"),l&&(x="rotate(".concat(l,"deg)"),E="rotate(".concat(l,"deg)")),G.createElement("svg",ce({xmlns:"http://www.w3.org/2000/svg"},b.attrs,t,v,{className:y,style:ne(ne({color:m||b.color,msTransform:x,transform:E},b.style),e.style),width:c,height:c}),n&&G.createElement("title",null,n),e.children)};return fe!==void 0?G.createElement(fe.Consumer,null,function(h){return f(h)}):f(Te)}function tt(e){var t={},r=e.split(";"),n=Ge(r),s;try{for(n.s();!(s=n.n()).done;){var l=s.value,m=l.split(":"),v=Fe(m,2),f=v[0],h=v[1];if(f&&h){var b=f.trim().replace(/-./g,function(c){return c.charAt(1).toUpperCase()});t[b]=h.trim()}}}catch(c){n.e(c)}finally{n.f()}return t}function Oe(e){return e&&e.map(function(t,r){return G.createElement(t.tag,ne(ne({},t.attrs),{},{key:r,style:t.attrs.style?tt(t.attrs.style):null}),Oe(t.children))})}function L(e){return function(t){return G.createElement(et,ce({attrs:ne({},e.attrs)},t),Oe(e.children))}}function rt(e){return L({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 nt(e){return L({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 st(e){return L({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M512 1024c-69.1 0-136.2-13.5-199.3-40.2C251.7 958 197 921 150 874S66 772.3 40.2 711.3C13.5 648.2 0 581.1 0 512c0-19.9 16.1-36 36-36s36 16.1 36 36c0 59.4 11.6 117 34.6 171.3c22.2 52.4 53.9 99.5 94.3 139.9s87.5 72.2 139.9 94.3C395 940.4 452.6 952 512 952s117-11.6 171.3-34.6c52.4-22.2 99.5-53.9 139.9-94.3s72.2-87.5 94.3-139.9C940.4 629 952 571.4 952 512s-11.6-117-34.6-171.3a440.5 440.5 0 0 0-94.3-139.9a437.7 437.7 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.2C772.3 66 827 103 874 150s83.9 101.8 109.7 162.7c26.7 63.1 40.2 130.2 40.2 199.3s-13.5 136.2-40.2 199.3C958 772.3 921 827 874 874s-101.8 83.9-162.7 109.7c-63.1 26.8-130.2 40.3-199.3 40.3"}}]})(e)}function Me(e){return L({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 it(e){return L({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(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"}}]})(e)}function ut(e){return L({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 ot(e){return L({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 lt(e){return L({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 ct(e){return L({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 dt(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14 19V5h4v14zm-8 0V5h4v14z"}}]})(e)}function ft(e){return L({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 mt(e){return L({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 pt(e){return L({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 vt(e){return L({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 bt(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7 15V9h4l5-5v16l-5-5z"}}]})(e)}function ht(e){return L({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 yt(e){return L({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M18.25 12L8.5 17.629V6.37z"}}]})(e)}function me(e,t){if(!t.current)return 0;let r=(e.clientX-t.current.getBoundingClientRect().left)/t.current.clientWidth;return r=Math.max(r,0),r=Math.min(r,1),r=Math.floor(r*100)/100,r}function pe(e,t){if(!t.current)return 0;let r=1-(e.clientY-t.current.getBoundingClientRect().top)/t.current.clientHeight;return r=Math.max(r,0),r=Math.min(r,1),r=Math.floor(r*100)/100,r}function Le(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Le(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function S(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Le(e))&&(n&&(n+=" "),n+=t);return n}function gt({bufferedPercentage:e,playedPercentage:t,onSeek:r}){const n=k("aplayer-bar"),s=k("aplayer-icon"),l=o.useRef(null),[m,v]=o.useState(t),f=o.useRef(!1);o.useEffect(()=>{f.current||v(t)},[t]);const h=o.useCallback(b=>{f.current=!0;const c=me(b,l);v(c);const y=E=>{const i=me(E,l);v(i)},x=E=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x);const i=me(E,l);v(i),r==null||r(i),f.current=!1};document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},[r]);return d.jsx("div",{ref:l,className:S(n.b(),n.bs("vars")),onMouseDown:h,role:"slider","aria-label":"Audio progress","aria-valuenow":m?m*100:0,"aria-valuemin":0,"aria-valuemax":100,"aria-live":"polite",children:d.jsxs("div",{className:n.be("inner"),children:[typeof e<"u"?d.jsx("div",{className:n.be("loaded"),style:{width:`${e*100}%`}}):null,typeof m<"u"?d.jsx("div",{className:n.be("played"),style:{width:`${m*100}%`},children:d.jsx("span",{className:n.be("thumb"),children:d.jsx("span",{className:S(s.bs("loading")),children:d.jsx(st,{})})})}):null]})})}function xt({volume:e,muted:t,onToggleMuted:r,onChangeVolume:n}){const s=k("aplayer-volumn"),l=k("aplayer-icon"),m=o.useRef(null),[v,f]=o.useState(!1),h=o.useCallback(b=>{n(pe(b,m)),f(!0);const c=x=>{n(pe(x,m))},y=x=>{document.removeEventListener("mouseup",y),document.removeEventListener("mousemove",c),f(!1),n(pe(x,m))};document.addEventListener("mousemove",c),document.addEventListener("mouseup",y)},[n]);return d.jsxs("div",{className:S(s.b(),s.bs("vars")),children:[d.jsx("button",{type:"button",className:S(l.b(),l.bs("volume-down")),onClick:()=>r(),"aria-label":t||!e?"Muted":"unMuted",children:t||!e?d.jsx(bt,{}):e>=1?d.jsx(ht,{}):d.jsx(vt,{})}),d.jsx("div",{className:S(s.be("bar-wrap"),{[s.bem("bar-wrap","active")]:v}),ref:m,onMouseDown:h,children:d.jsx("div",{className:s.be("bar"),children:d.jsx("div",{className:s.be("thumb"),style:{height:t?0:`${e*100}%`}})})})]})}function Ce(e){if(typeof e>"u")return"--:--";if(Number.isNaN(e))return"00:00";const t=m=>m<10?`0${m}`:`${m}`,r=Math.trunc(e/60),n=Math.trunc(e-r*60),s=Math.trunc(r/60),l=Math.trunc(e/60-60*Math.trunc(e/60/60));return e>=3600?`${t(s)}:${t(l)}:${t(n)}`:`${t(r)}:${t(n)}`}function Et({volume:e,onChangeVolume:t,muted:r,currentTime:n,audioDurationSeconds:s,bufferedSeconds:l,onToggleMenu:m,onToggleMuted:v,order:f,onOrderChange:h,loop:b,onLoopChange:c,onSeek:y,isPlaying:x,onTogglePlay:E,onSkipForward:i,onSkipBack:u,showLyrics:p=!0,onToggleLyrics:T}){const j=k("aplayer-controller"),w=k("aplayer-icon"),R=o.useCallback(()=>{const A={list:"random",random:"list"}[f];h(A)},[f,h]),B=o.useCallback(()=>{const A={all:"one",one:"none",none:"all"}[b];c(A)},[b,c]);return d.jsxs("div",{className:S(j.b(),j.bs("vars")),role:"group","aria-label":"Audio Controls",children:[d.jsx(gt,{playedPercentage:typeof n>"u"||typeof s>"u"?void 0:n/s,bufferedPercentage:typeof l>"u"||typeof s>"u"?void 0:l/s,onSeek:A=>y==null?void 0:y(A*s)}),d.jsxs("div",{className:j.be("time"),children:[d.jsxs("span",{className:j.be("time-inner"),"aria-live":"polite",children:[d.jsx("span",{className:j.be("ptime"),children:Ce(n)})," / ",d.jsx("span",{className:j.be("dtime"),children:Ce(s)})]}),d.jsx("button",{className:S(w.b(),w.bs("back")),onClick:u,type:"button","aria-label":"Previous track",children:d.jsx(rt,{})}),d.jsx("button",{className:S(w.b(),w.bs("play")),onClick:E,type:"button","aria-label":x?"Pause audio":"Play audio",children:x?d.jsx(dt,{}):d.jsx(ft,{})}),d.jsx("button",{className:S(w.b(),w.bs("forward")),onClick:i,type:"button","aria-label":"Next track",children:d.jsx(nt,{})}),d.jsx(xt,{volume:e,muted:r,onToggleMuted:v,onChangeVolume:t}),d.jsx("button",{className:S(w.b(),w.bs("order")),onClick:R,type:"button","aria-label":`Playback order: ${f}`,children:{list:d.jsx(lt,{}),random:d.jsx(ot,{})}[f]}),d.jsx("button",{className:S(w.b(),w.bs("order")),onClick:B,type:"button","aria-label":`Loop mode: ${b}`,children:{all:d.jsx(pt,{}),one:d.jsx(mt,{}),none:d.jsx(ut,{})}[b]}),d.jsx("button",{type:"button",className:S(w.b(),w.bs("menu")),onClick:()=>m==null?void 0:m(),"aria-label":"Toggle playlist menu",children:d.jsx(at,{})}),d.jsx("button",{type:"button",className:S(w.b(),w.bs("lrc"),{[w.ns("lrc-inactivity")]:!p}),onClick:T,"aria-label":p?"Hide lyrics":"Show lyrics","aria-pressed":p,children:d.jsx(ct,{})})]})]})}function St({open:e,audio:t,playingAudioUrl:r,onPlayAudio:n,listMaxHeight:s,isMiniExpanded:l,isSuperMiniExpanded:m}){const v=k("aplayer-list"),f=s?{maxHeight:s}:void 0,h=o.useCallback(c=>c?typeof c=="string"?c:c.name??"Audio artist":"Audio artist",[]),b=o.useRef(null);return o.useEffect(()=>{if(b.current){const c=b.current;return c.style.maxHeight=`${Math.min(c.scrollHeight,s??1/0)}px`,()=>{c.removeAttribute("style")}}},[s,l,m]),d.jsx("div",{ref:b,className:S(v.b(),{[v.bm("hide")]:!e,[v.bs("vars")]:!0}),"aria-label":"Audio playlist","aria-live":"polite",children:d.jsx("ol",{style:f,children:t.map((c,y)=>d.jsxs("li",{className:S({[v.bm("active")]:c.url===r}),onClick:()=>{c.url!==r&&(n==null||n(c))},role:"button","aria-label":`${c.name??"Audio name"} by ${h(c.artist)}}`,children:[d.jsx("span",{className:v.be("cur")}),d.jsx("span",{className:v.be("index"),children:y+1}),d.jsx("span",{className:v.be("title"),children:c.name??"Audio name"}),d.jsx("span",{className:v.be("author"),children:h(c.artist)})]},c.name||y))})})}function Pe({show:e,lrcText:t,currentTime:r}){const n=k("aplayer-lrc"),s=o.useMemo(()=>Tt(t),[t]),l=o.useMemo(()=>{for(let v=0;v<s.length;v++){const f=s[v],h=s[v+1];if(r>=f[0]&&(!h||r<h[0]))return v}return 0},[r,s]),m=o.useMemo(()=>({transform:`translateY(${-l*16}px)`,WebkitTransform:`translateY(${-l*16}px)`}),[l]);return d.jsx("div",{className:S(n.b(),{[n.bm("hide")]:!e}),children:t?d.jsx("div",{className:n.be("contents"),style:m,children:s.map(([,v],f)=>d.jsx("p",{className:S({[n.be("current")]:f===l}),children:v},f))}):null})}function Tt(e){if(e){e=e.replace(/([^\]^\n])\[/g,(s,l)=>`${l}
|
|
25
25
|
[`);const t=e.split(`
|
|
26
|
-
`),r=[],n=t.length;for(let s=0;s<n;s++){const l=t[s].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g),m=t[s].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g,"").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g,"").replace(/^\s+|\s+$/g,"");if(l){const v=l.length;for(let f=0;f<v;f++){const h=/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/.exec(l[f]),b=h[1]*60,c=Number.parseInt(h[2]),y=h[4]?Number.parseInt(h[4])/(`${h[4]}`.length===2?100:1e3):0,
|
|
26
|
+
`),r=[],n=t.length;for(let s=0;s<n;s++){const l=t[s].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g),m=t[s].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g,"").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g,"").replace(/^\s+|\s+$/g,"");if(l){const v=l.length;for(let f=0;f<v;f++){const h=/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/.exec(l[f]),b=h[1]*60,c=Number.parseInt(h[2]),y=h[4]?Number.parseInt(h[4])/(`${h[4]}`.length===2?100:1e3):0,x=b+c+y;r.push([x,m])}}}return r.sort((s,l)=>s[0]-l[0]),r}else return[]}var de={exports:{}},ve={};/**
|
|
27
27
|
* @license React
|
|
28
28
|
* use-sync-external-store-shim.production.js
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var Ne;function _t(){if(Ne)return ve;Ne=1;var e=
|
|
34
|
+
*/var Ne;function _t(){if(Ne)return ve;Ne=1;var e=o;function t(c,y){return c===y&&(c!==0||1/c===1/y)||c!==c&&y!==y}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,l=e.useLayoutEffect,m=e.useDebugValue;function v(c,y){var x=y(),E=n({inst:{value:x,getSnapshot:y}}),i=E[0].inst,u=E[1];return l(function(){i.value=x,i.getSnapshot=y,f(i)&&u({inst:i})},[c,x,y]),s(function(){return f(i)&&u({inst:i}),c(function(){f(i)&&u({inst:i})})},[c]),m(x),x}function f(c){var y=c.getSnapshot;c=c.value;try{var x=y();return!r(c,x)}catch{return!0}}function h(c,y){return y()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:v;return ve.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,ve}var be={},Ae;function jt(){if(Ae)return be;Ae=1;var e={};/**
|
|
35
35
|
* @license React
|
|
36
36
|
* use-sync-external-store-shim.development.js
|
|
37
37
|
*
|
|
@@ -39,4 +39,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the MIT license found in the
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/return e.NODE_ENV!=="production"&&function(){function t(x,i){return x===i&&(x!==0||1/x===1/i)||x!==x&&i!==i}function r(x,i){c||l.startTransition===void 0||(c=!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 o=i();if(!y){var p=i();m(o,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),y=!0)}p=v({inst:{value:o,getSnapshot:i}});var T=p[0].inst,j=p[1];return h(function(){T.value=o,T.getSnapshot=i,n(T)&&j({inst:T})},[x,o,i]),f(function(){return n(T)&&j({inst:T}),x(function(){n(T)&&j({inst:T})})},[x]),b(o),o}function n(x){var i=x.getSnapshot;x=x.value;try{var o=i();return!m(x,o)}catch{return!0}}function s(x,i){return i()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var l=u,m=typeof Object.is=="function"?Object.is:t,v=l.useState,f=l.useEffect,h=l.useLayoutEffect,b=l.useDebugValue,c=!1,y=!1,E=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:r;be.useSyncExternalStore=l.useSyncExternalStore!==void 0?l.useSyncExternalStore:E,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}(),be}var $e;function wt(){if($e)return de.exports;$e=1;var e={};return e.NODE_ENV==="production"?de.exports=_t():de.exports=jt(),de.exports}var D=wt();const J=[];function Ot(e){const t=u.useRef(null);return u.useEffect(()=>{if(typeof window<"u"&&!t.current){const r=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(r.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(r.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(r.volume=e.initialVolume),J.includes(r)||J.push(r)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),u.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onError))return r.addEventListener("error",e.onError),()=>{r.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),u.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onEnded))return r.addEventListener("ended",e.onEnded),()=>{r.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),u.useEffect(()=>()=>{const r=t.current;if(r){r.pause(),r.currentTime=0;const n=J.indexOf(r);n!==-1&&J.splice(n,1)}t.current=null},[]),t}function Mt(e){const t=Ot(e),r=u.useCallback(i=>{for(let o=0;o<J.length;o++){const p=J[o];p!==i&&!p.paused&&p.pause()}},[]),n=u.useCallback(async i=>{var p;const o=t.current;if(o){e.mutex&&r(o),o.src!==i&&(o.pause(),o.currentTime=0,o.src=i);try{await((p=t.current)==null?void 0:p.play())}catch{}}},[t,e.mutex,r]),s=u.useCallback(i=>{const o=t.current;o&&(o.paused?n(i):o.pause())},[t,n]),l=u.useCallback(i=>{Number.isFinite(i)&&(t.current.currentTime=i)},[t]),m=u.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),v=u.useCallback(i=>{t.current&&(t.current.volume=i)},[t]),f=D.useSyncExternalStore(u.useCallback(i=>{var o;return(o=t.current)==null||o.addEventListener("volumechange",i),()=>{var p;(p=t.current)==null||p.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.volume},()=>{}),h=D.useSyncExternalStore(u.useCallback(i=>{var o;return(o=t.current)==null||o.addEventListener("volumechange",i),()=>{var p;(p=t.current)==null||p.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.muted},()=>{}),b=D.useSyncExternalStore(u.useCallback(i=>{var o;return(o=t.current)==null||o.addEventListener("timeupdate",i),()=>{var p;(p=t.current)==null||p.removeEventListener("timeupdate",i)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),c=D.useSyncExternalStore(u.useCallback(i=>{var o;return(o=t.current)==null||o.addEventListener("durationchange",i),()=>{var p;(p=t.current)==null||p.removeEventListener("durationchange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.duration},()=>{}),y=D.useSyncExternalStore(u.useCallback(i=>{var o;return(o=t.current)==null||o.addEventListener("progress",i),()=>{var p;(p=t.current)==null||p.removeEventListener("progress",i)}},[t]),()=>{const i=t.current;return i&&i.buffered.length>0?i.buffered.end(i.buffered.length-1):0},()=>{}),E=D.useSyncExternalStore(u.useCallback(i=>{var o,p;return(o=t.current)==null||o.addEventListener("play",i),(p=t.current)==null||p.addEventListener("pause",i),()=>{var T,j;(T=t.current)==null||T.removeEventListener("play",i),(j=t.current)==null||j.removeEventListener("pause",i)}},[t]),()=>{const i=t.current;return i?!i.paused:!1},()=>{}),x=D.useSyncExternalStore(u.useCallback(i=>{var o,p;return(o=t.current)==null||o.addEventListener("playing",i),(p=t.current)==null||p.addEventListener("waiting",i),()=>{var T,j;(T=t.current)==null||T.removeEventListener("playing",i),(j=t.current)==null||j.removeEventListener("waiting",i)}},[t]),()=>{const i=t.current;return i?i.networkState===i.NETWORK_LOADING:!1},()=>{});return{audio:t.current,playAudio:n,togglePlay:s,seek:l,toggleMuted:m,setVolume:v,volume:f,muted:h,currentTime:b,duration:c,bufferedSeconds:y,isPlaying:E,isLoading:x}}function Lt(e,t){return u.useMemo(()=>{const r={...t};for(const n in e)e[n]!==void 0&&(r[n]=e[n]);return r},[e,t])}function Ct(e){const[t,r]=u.useState(e),[n,s]=u.useState(!1);return u.useEffect(()=>{r(e)},[e]),{mini:t,setMini:r,expanded:n,setExpanded:s,toggleExpanded:()=>s(v=>!v),isMiniCollapsed:t&&!n,isMiniExpanded:t&&n}}function Pt(e){const[t,r]=u.useState(e),[n,s]=u.useState(!1);return u.useEffect(()=>{r(e)},[e]),{superMini:t,setSuperMini:r,expanded:n,setExpanded:s,toggleExpanded:()=>s(v=>!v),isSuperMiniCollapsed:t&&!n,isSuperMiniExpanded:t&&n}}function ke(){const e=u.useRef([]);return u.useEffect(()=>{const r=e.current;return()=>{for(const n of r)clearTimeout(n)}},[]),u.useCallback((r,n)=>{const s=setTimeout(r,n);return e.current.push(s),s},[])}function Nt(){const e=u.useRef(null),[t,r]=u.useState({text:"",style:{opacity:0}}),n=ke(),s=u.useCallback((l,m=2e3)=>{e.current&&clearTimeout(e.current),r({text:l,style:{opacity:1}}),e.current=n(()=>{r({text:l,style:{opacity:0}})},m)},[n]);return[t,s]}function At(e){const t=Lt(e,{appearance:"normal",volume:.7,autoPlay:!1,listMaxHeight:250,mini:!1,superMini:!1,mutex:!0,listFolded:!1,theme:"light",border:!1}),{audio:r,appearance:n,initialLoop:s,initialOrder:l,volume:m,autoPlay:v,listMaxHeight:f,listFolded:h,mutex:b,theme:c,border:y,mini:E,superMini:x}=t,i=u.useMemo(()=>Array.isArray(r)?r:[r],[r]),o=qt(i,{initialLoop:s,initialOrder:l}),[p,T]=Nt(),{mini:j,expanded:w,toggleExpanded:R,isMiniCollapsed:B,isMiniExpanded:A}=Ct(E),{superMini:H,expanded:K,toggleExpanded:se,isSuperMiniCollapsed:X,isSuperMiniExpanded:F}=Pt(x),Y=!H&&j,Q=H&&!j,V=ke(),O=u.useRef(null),U=u.useCallback(()=>{O.current&&(clearTimeout(O.current),O.current=null)},[]),Z=u.useRef(!1),q=Mt({src:o.currentSong.url,initialVolume:m,autoPlay:v,mutex:b,onError(P){const{error:oe}=P.target;oe&&T("An audio error has occurred, player will skip forward in 2 seconds."),o.hasNextSong&&(O.current=V(()=>{o.next()},2e3))},onEnded(){const{list:P,currentSong:oe,loop:qe,prioritize:Ie,hasNextSong:Vt}=o,{audio:he}=q;if(qe==="one"){Ie({...oe});return}if(!Vt&&qe==="none"){Z.current=!0,he.currentTime=0,he.pause(),he.src=P[0].url,Ie(P[0]);return}o.next()}}),ie=o.length>1,a=u.useCallback(()=>{U(),q.togglePlay(o.currentSong.url)},[q,U,o.currentSong.url]),{prioritize:g}=o,_=u.useCallback(P=>{U(),g(P)},[U,g]),[C,$]=u.useState(()=>ie&&!h),[N,ae]=u.useState(n!=="fixed"),W=u.useRef(null);u.useEffect(()=>{v&&q.playAudio(o.currentSong.url)},[]);const M=u.useRef(!0),I=u.useRef(o.currentSong);return u.useEffect(()=>{if(M.current){M.current=!1;return}if(Z.current){Z.current=!1;return}o.currentSong&&(o.loop==="one"||o.currentSong!==I.current)&&(I.current=o.currentSong,q.playAudio(o.currentSong.url))},[o.currentSong]),u.useEffect(()=>{if(n==="fixed"&&W.current){const P=W.current;return P.style.width="400px",()=>{P.removeAttribute("style")}}},[n]),{bodyRef:W,appearance:n,volume:m,listMaxHeight:f,theme:c,border:y,notice:p,audioControl:q,audio:i,handlePlayButtonClick:a,handlePlayAudioFromList:_,isPlaylistOpen:C,setPlaylistOpen:$,mini:j,displayLyrics:N,setDisplayLyrics:ae,playlist:o,hasPlaylist:ie,superMini:H,showSuperMini:Q,superMiniExpanded:K,toggleSuperMiniExpanded:se,isSuperMiniCollapsed:X,isSuperMiniExpanded:F,showMini:Y,miniExpanded:w,toggleMiniExpanded:R,isMiniCollapsed:B,isMiniExpanded:A}}function $t(e){return kt(e.slice())}function kt(e){let t=e.length,r;for(;t!==0;)r=Math.floor(Math.random()*t),t--,[e[t],e[r]]=[e[r],e[t]];return e}function qt(e,t){const{initialLoop:r="all",initialOrder:n="list"}=t,[s,l]=u.useState(r),[m,v]=u.useState(n),f=u.useMemo(()=>m==="list"?e:$t(e),[e,m]),[h,b]=u.useState(f[0]),c=u.useCallback(o=>o.url,[]),y=u.useMemo(()=>f.findIndex(p=>c(p)===c(h))<f.length-1||s!=="none",[f,h,s,c]),E=u.useCallback(()=>{b(o=>{const p=f.findIndex(T=>c(T)===c(o));return p<f.length-1?f[p+1]:{...f[0]}})},[s,f,c]),x=u.useCallback(()=>{b(o=>{const p=f.indexOf(o);return p>0?f[p-1]:o})},[f]),i=u.useCallback(o=>{b(o)},[]);return u.useEffect(()=>{const o=f.find(p=>c(p)===c(h));b(o||f[0])},[f,c,h]),{list:f,currentSong:h,hasNextSong:y,next:E,previous:x,prioritize:i,order:m,setOrder:v,loop:s,setLoop:l,length:f.length}}function It(e){var Y,Q,V;const t=k("aplayer"),{bodyRef:r,appearance:n,volume:s,listMaxHeight:l,theme:m,border:v,notice:f,audio:h,audioControl:b,handlePlayButtonClick:c,handlePlayAudioFromList:y,isPlaylistOpen:E,setPlaylistOpen:x,displayLyrics:i,setDisplayLyrics:o,playlist:p,hasPlaylist:T,showSuperMini:j,superMiniExpanded:w,toggleSuperMiniExpanded:R,isSuperMiniCollapsed:B,isSuperMiniExpanded:A,showMini:H,toggleMiniExpanded:K,isMiniCollapsed:se,isMiniExpanded:X}=At(e),F=u.useCallback(O=>O?typeof O=="string"?O:O.url?d.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer",children:O.name??"Audio artist"}):O.name??"Audio artist":"Audio artist",[]);return d.jsxs("div",{className:S(t.b(),{[t.bs(m)]:!0,[t.bs("vars")]:!0,[t.bm(n)]:!0,[t.bm("loading")]:b.isLoading,[t.bm("withlist")]:T,[t.bm("list-collapsed")]:!E,[t.bm("withlrc")]:!!p.currentSong.lrc&&n!=="fixed",[t.bm("border")]:v,[t.bm("mini")]:H,[t.bm("mini-collapsed")]:se,[t.bm("mini-expanded")]:X,[t.bm("super-mini")]:j,[t.bm("super-mini-collapsed")]:B,[t.bm("super-mini-expanded")]:A}),role:"region","aria-label":"Audio Player",children:[d.jsxs("div",{ref:r,className:t.be("body"),children:[d.jsx("div",{className:t.be("pic"),onClick:c,style:{backgroundImage:`url("${(Y=p.currentSong)==null?void 0:Y.cover}")`},role:"button","aria-label":b.isPlaying?"Pause audio":"Play audio",children:d.jsx("div",{className:S(t.be("button"),b.isPlaying?t.bm("pause"):t.bm("play")),role:"presentation",children:b.isPlaying?d.jsx(it,{}):d.jsx(yt,{})})}),d.jsxs("div",{className:S(t.be("info")),children:[d.jsxs("div",{className:S(t.be("music")),children:[d.jsx("span",{className:S(t.be("title")),children:((Q=p.currentSong)==null?void 0:Q.name)??"Audio name"}),d.jsxs("span",{className:S(t.be("author")),children:[" ","-"," ",F((V=p.currentSong)==null?void 0:V.artist)]})]}),n==="fixed"?null:d.jsx(Pe,{show:i,lrcText:p.currentSong.lrc,currentTime:b.currentTime??0}),d.jsx(Et,{volume:b.volume??s,onChangeVolume:b.setVolume,muted:b.muted??!1,onToggleMuted:()=>b.toggleMuted(),currentTime:b.currentTime,audioDurationSeconds:b.duration,bufferedSeconds:b.bufferedSeconds,onSeek:O=>b.seek(O),onToggleMenu:()=>x(O=>!O),order:p.order,onOrderChange:p.setOrder,loop:p.loop,onLoopChange:p.setLoop,isPlaying:b.isPlaying??!1,onTogglePlay:c,onSkipForward:()=>{p.hasNextSong&&p.next()},onSkipBack:()=>{p.previous()},showLyrics:i,onToggleLyrics:()=>{o(O=>!O)}})]}),d.jsx("div",{className:t.be("notice"),style:f.style,children:f.text}),d.jsx("div",{className:t.be("miniswitcher"),onClick:K,children:d.jsx("button",{className:S(t.bs("icon"),t.bs("icon-right")),type:"button",children:d.jsx(Me,{})})}),d.jsx("div",{className:t.be("super-miniswitcher"),onClick:R,children:d.jsx("button",{className:S(t.bs("icon"),t.bs("icon-right")),type:"button",children:d.jsx(Me,{})})})]}),T?d.jsx(St,{open:E,audio:h,playingAudioUrl:p.currentSong.url,onPlayAudio:y,listMaxHeight:l,isMiniExpanded:X,isSuperMiniExpanded:w}):null,d.jsx(Pe,{show:i,lrcText:p.currentSong.lrc,currentTime:b.currentTime??0})]})}z.TwistAPlayer=It,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
|
|
42
|
+
*/return e.NODE_ENV!=="production"&&function(){function t(E,i){return E===i&&(E!==0||1/E===1/i)||E!==E&&i!==i}function r(E,i){c||l.startTransition===void 0||(c=!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=i();if(!y){var p=i();m(u,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),y=!0)}p=v({inst:{value:u,getSnapshot:i}});var T=p[0].inst,j=p[1];return h(function(){T.value=u,T.getSnapshot=i,n(T)&&j({inst:T})},[E,u,i]),f(function(){return n(T)&&j({inst:T}),E(function(){n(T)&&j({inst:T})})},[E]),b(u),u}function n(E){var i=E.getSnapshot;E=E.value;try{var u=i();return!m(E,u)}catch{return!0}}function s(E,i){return i()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var l=o,m=typeof Object.is=="function"?Object.is:t,v=l.useState,f=l.useEffect,h=l.useLayoutEffect,b=l.useDebugValue,c=!1,y=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:r;be.useSyncExternalStore=l.useSyncExternalStore!==void 0?l.useSyncExternalStore:x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}(),be}var $e;function wt(){if($e)return de.exports;$e=1;var e={};return e.NODE_ENV==="production"?de.exports=_t():de.exports=jt(),de.exports}var D=wt();const J=[];function Ot(e){const t=o.useRef(null);return o.useEffect(()=>{if(typeof window<"u"&&!t.current){const r=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(r.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(r.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(r.volume=e.initialVolume),J.includes(r)||J.push(r)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),o.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onError))return r.addEventListener("error",e.onError),()=>{r.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),o.useEffect(()=>{if(typeof window>"u")return;const r=t.current;if(r&&(e!=null&&e.onEnded))return r.addEventListener("ended",e.onEnded),()=>{r.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),o.useEffect(()=>()=>{const r=t.current;if(r){r.pause(),r.currentTime=0;const n=J.indexOf(r);n!==-1&&J.splice(n,1)}t.current=null},[]),t}function Mt(e){const t=Ot(e),r=o.useCallback(i=>{for(let u=0;u<J.length;u++){const p=J[u];p!==i&&!p.paused&&p.pause()}},[]),n=o.useCallback(async i=>{var p;const u=t.current;if(u){e.mutex&&r(u),u.src!==i&&(u.pause(),u.currentTime=0,u.src=i);try{await((p=t.current)==null?void 0:p.play())}catch{}}},[t,e.mutex,r]),s=o.useCallback(i=>{const u=t.current;u&&(u.paused?n(i):u.pause())},[t,n]),l=o.useCallback(i=>{Number.isFinite(i)&&(t.current.currentTime=i)},[t]),m=o.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),v=o.useCallback(i=>{t.current&&(t.current.volume=i)},[t]),f=D.useSyncExternalStore(o.useCallback(i=>{var u;return(u=t.current)==null||u.addEventListener("volumechange",i),()=>{var p;(p=t.current)==null||p.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.volume},()=>{}),h=D.useSyncExternalStore(o.useCallback(i=>{var u;return(u=t.current)==null||u.addEventListener("volumechange",i),()=>{var p;(p=t.current)==null||p.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.muted},()=>{}),b=D.useSyncExternalStore(o.useCallback(i=>{var u;return(u=t.current)==null||u.addEventListener("timeupdate",i),()=>{var p;(p=t.current)==null||p.removeEventListener("timeupdate",i)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),c=D.useSyncExternalStore(o.useCallback(i=>{var u;return(u=t.current)==null||u.addEventListener("durationchange",i),()=>{var p;(p=t.current)==null||p.removeEventListener("durationchange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.duration},()=>{}),y=D.useSyncExternalStore(o.useCallback(i=>{var u;return(u=t.current)==null||u.addEventListener("progress",i),()=>{var p;(p=t.current)==null||p.removeEventListener("progress",i)}},[t]),()=>{const i=t.current;return i&&i.buffered.length>0?i.buffered.end(i.buffered.length-1):0},()=>{}),x=D.useSyncExternalStore(o.useCallback(i=>{var u,p;return(u=t.current)==null||u.addEventListener("play",i),(p=t.current)==null||p.addEventListener("pause",i),()=>{var T,j;(T=t.current)==null||T.removeEventListener("play",i),(j=t.current)==null||j.removeEventListener("pause",i)}},[t]),()=>{const i=t.current;return i?!i.paused:!1},()=>{}),E=D.useSyncExternalStore(o.useCallback(i=>{var u,p;return(u=t.current)==null||u.addEventListener("playing",i),(p=t.current)==null||p.addEventListener("waiting",i),()=>{var T,j;(T=t.current)==null||T.removeEventListener("playing",i),(j=t.current)==null||j.removeEventListener("waiting",i)}},[t]),()=>{const i=t.current;return i?i.networkState===i.NETWORK_LOADING:!1},()=>{});return{audio:t.current,playAudio:n,togglePlay:s,seek:l,toggleMuted:m,setVolume:v,volume:f,muted:h,currentTime:b,duration:c,bufferedSeconds:y,isPlaying:x,isLoading:E}}function Lt(e,t){return o.useMemo(()=>{const r={...t};for(const n in e)e[n]!==void 0&&(r[n]=e[n]);return r},[e,t])}function Ct(e){const[t,r]=o.useState(e),[n,s]=o.useState(!1);return o.useEffect(()=>{r(e)},[e]),{mini:t,setMini:r,expanded:n,setExpanded:s,toggleExpanded:()=>s(v=>!v),isMiniCollapsed:t&&!n,isMiniExpanded:t&&n}}function Pt(e){const[t,r]=o.useState(e),[n,s]=o.useState(!1);return o.useEffect(()=>{r(e)},[e]),{superMini:t,setSuperMini:r,expanded:n,setExpanded:s,toggleExpanded:()=>s(v=>!v),isSuperMiniCollapsed:t&&!n,isSuperMiniExpanded:t&&n}}function ke(){const e=o.useRef([]);return o.useEffect(()=>{const r=e.current;return()=>{for(const n of r)clearTimeout(n)}},[]),o.useCallback((r,n)=>{const s=setTimeout(r,n);return e.current.push(s),s},[])}function Nt(){const e=o.useRef(null),[t,r]=o.useState({text:"",style:{opacity:0}}),n=ke(),s=o.useCallback((l,m=2e3)=>{e.current&&clearTimeout(e.current),r({text:l,style:{opacity:1}}),e.current=n(()=>{r({text:l,style:{opacity:0}})},m)},[n]);return[t,s]}function At(e){const t=Lt(e,{appearance:"normal",volume:.7,autoPlay:!1,listMaxHeight:250,mini:!1,superMini:!1,mutex:!0,listFolded:!1,theme:"light",border:!1}),{audio:r,appearance:n,initialLoop:s,initialOrder:l,volume:m,autoPlay:v,listMaxHeight:f,listFolded:h,mutex:b,theme:c,border:y,mini:x,superMini:E}=t,i=o.useMemo(()=>Array.isArray(r)?r:[r],[r]),u=qt(i,{initialLoop:s,initialOrder:l}),[p,T]=Nt(),{mini:j,expanded:w,toggleExpanded:R,isMiniCollapsed:B,isMiniExpanded:A}=Ct(x),{superMini:H,expanded:K,toggleExpanded:se,isSuperMiniCollapsed:X,isSuperMiniExpanded:F}=Pt(E),Y=!H&&j,Q=H&&!j,V=ke(),O=o.useRef(null),U=o.useCallback(()=>{O.current&&(clearTimeout(O.current),O.current=null)},[]),Z=o.useRef(!1),q=Mt({src:u.currentSong.url,initialVolume:m,autoPlay:v,mutex:b,onError(P){const{error:ue}=P.target;ue&&T("An audio error has occurred, player will skip forward in 2 seconds."),u.hasNextSong&&(O.current=V(()=>{u.next()},2e3))},onEnded(){const{list:P,currentSong:ue,loop:qe,prioritize:Ie,hasNextSong:Vt}=u,{audio:he}=q;if(qe==="one"){Ie({...ue});return}if(!Vt&&qe==="none"){Z.current=!0,he.currentTime=0,he.pause(),he.src=P[0].url,Ie(P[0]);return}u.next()}}),ie=u.length>1,a=o.useCallback(()=>{U(),q.togglePlay(u.currentSong.url)},[q,U,u.currentSong.url]),{prioritize:g}=u,_=o.useCallback(P=>{U(),g(P)},[U,g]),[C,$]=o.useState(()=>ie&&!h),[N,ae]=o.useState(n!=="fixed"),W=o.useRef(null);o.useEffect(()=>{v&&q.playAudio(u.currentSong.url)},[]);const M=o.useRef(!0),I=o.useRef(u.currentSong);return o.useEffect(()=>{if(M.current){M.current=!1;return}if(Z.current){Z.current=!1;return}u.currentSong&&(u.loop==="one"||u.currentSong!==I.current)&&(I.current=u.currentSong,q.playAudio(u.currentSong.url))},[u.currentSong]),o.useEffect(()=>{if(n==="fixed"&&W.current){const P=W.current;return P.style.width="400px",()=>{P.removeAttribute("style")}}},[n]),{bodyRef:W,appearance:n,volume:m,listMaxHeight:f,theme:c,border:y,notice:p,audioControl:q,audio:i,handlePlayButtonClick:a,handlePlayAudioFromList:_,isPlaylistOpen:C,setPlaylistOpen:$,mini:j,displayLyrics:N,setDisplayLyrics:ae,playlist:u,hasPlaylist:ie,superMini:H,showSuperMini:Q,superMiniExpanded:K,toggleSuperMiniExpanded:se,isSuperMiniCollapsed:X,isSuperMiniExpanded:F,showMini:Y,miniExpanded:w,toggleMiniExpanded:R,isMiniCollapsed:B,isMiniExpanded:A}}function $t(e){return kt(e.slice())}function kt(e){let t=e.length,r;for(;t!==0;)r=Math.floor(Math.random()*t),t--,[e[t],e[r]]=[e[r],e[t]];return e}function qt(e,t){const{initialLoop:r="all",initialOrder:n="list"}=t,[s,l]=o.useState(r),[m,v]=o.useState(n),f=o.useMemo(()=>m==="list"?e:$t(e),[e,m]),[h,b]=o.useState(f[0]),c=o.useCallback(u=>u.url,[]),y=o.useMemo(()=>f.findIndex(p=>c(p)===c(h))<f.length-1||s!=="none",[f,h,s,c]),x=o.useCallback(()=>{b(u=>{const p=f.findIndex(T=>c(T)===c(u));return p<f.length-1?f[p+1]:{...f[0]}})},[s,f,c]),E=o.useCallback(()=>{b(u=>{const p=f.indexOf(u);return p>0?f[p-1]:u})},[f]),i=o.useCallback(u=>{b(u)},[]);return o.useEffect(()=>{const u=f.find(p=>c(p)===c(h));b(u||f[0])},[f,c,h]),{list:f,currentSong:h,hasNextSong:y,next:x,previous:E,prioritize:i,order:m,setOrder:v,loop:s,setLoop:l,length:f.length}}function It(e){var Y,Q,V;const t=k("aplayer"),{bodyRef:r,appearance:n,volume:s,listMaxHeight:l,theme:m,border:v,notice:f,audio:h,audioControl:b,handlePlayButtonClick:c,handlePlayAudioFromList:y,isPlaylistOpen:x,setPlaylistOpen:E,displayLyrics:i,setDisplayLyrics:u,playlist:p,hasPlaylist:T,showSuperMini:j,superMiniExpanded:w,toggleSuperMiniExpanded:R,isSuperMiniCollapsed:B,isSuperMiniExpanded:A,showMini:H,toggleMiniExpanded:K,isMiniCollapsed:se,isMiniExpanded:X}=At(e),F=o.useCallback(O=>O?typeof O=="string"?O:O.url?d.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer",children:O.name??"Audio artist"}):O.name??"Audio artist":"Audio artist",[]);return d.jsxs("div",{className:S(t.b(),{[t.bs(m)]:!0,[t.bs("vars")]:!0,[t.bm(n)]:!0,[t.bm("loading")]:b.isLoading,[t.bm("withlist")]:T,[t.bm("list-expanded")]:x,[t.bm("list-collapsed")]:!x,[t.bm("withlrc")]:!!p.currentSong.lrc&&n!=="fixed",[t.bm("border")]:v,[t.bm("mini")]:H,[t.bm("mini-collapsed")]:se,[t.bm("mini-expanded")]:X,[t.bm("super-mini")]:j,[t.bm("super-mini-collapsed")]:B,[t.bm("super-mini-expanded")]:A}),role:"region","aria-label":"Audio Player",children:[d.jsxs("div",{ref:r,className:t.be("body"),children:[d.jsx("div",{className:t.be("pic"),onClick:c,style:{backgroundImage:`url("${(Y=p.currentSong)==null?void 0:Y.cover}")`},role:"button","aria-label":b.isPlaying?"Pause audio":"Play audio",children:d.jsx("div",{className:S(t.be("button"),b.isPlaying?t.bm("pause"):t.bm("play")),role:"presentation",children:b.isPlaying?d.jsx(it,{}):d.jsx(yt,{})})}),d.jsxs("div",{className:S(t.be("info")),children:[d.jsxs("div",{className:S(t.be("music")),children:[d.jsx("span",{className:S(t.be("title")),children:((Q=p.currentSong)==null?void 0:Q.name)??"Audio name"}),d.jsxs("span",{className:S(t.be("author")),children:[" ","-"," ",F((V=p.currentSong)==null?void 0:V.artist)]})]}),n!=="fixed"?d.jsx(Pe,{show:i,lrcText:p.currentSong.lrc,currentTime:b.currentTime??0}):null,d.jsx(Et,{volume:b.volume??s,onChangeVolume:b.setVolume,muted:b.muted??!1,onToggleMuted:()=>b.toggleMuted(),currentTime:b.currentTime,audioDurationSeconds:b.duration,bufferedSeconds:b.bufferedSeconds,onSeek:O=>b.seek(O),onToggleMenu:()=>E(O=>!O),order:p.order,onOrderChange:p.setOrder,loop:p.loop,onLoopChange:p.setLoop,isPlaying:b.isPlaying??!1,onTogglePlay:c,onSkipForward:()=>{p.hasNextSong&&p.next()},onSkipBack:()=>{p.previous()},showLyrics:i,onToggleLyrics:()=>{u(O=>!O)}})]}),d.jsx("div",{className:t.be("notice"),style:f.style,children:f.text}),d.jsx("div",{className:t.be("miniswitcher"),onClick:K,children:d.jsx("button",{className:S(t.bs("icon"),t.bs("icon-right")),type:"button",children:d.jsx(Me,{})})}),d.jsx("div",{className:t.be("super-miniswitcher"),onClick:R,children:d.jsx("button",{className:S(t.bs("icon"),t.bs("icon-right")),type:"button",children:d.jsx(Me,{})})})]}),T?d.jsx(St,{open:x,audio:h,playingAudioUrl:p.currentSong.url,onPlayAudio:y,listMaxHeight:l,isMiniExpanded:X,isSuperMiniExpanded:w}):null,n==="fixed"?d.jsx(Pe,{show:i,lrcText:p.currentSong.lrc,currentTime:b.currentTime??0}):null]})}z.TwistAPlayer=It,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
|