twist-aplayer 1.0.2 → 1.0.3
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 +12 -12
- package/dist/index.mjs +136 -135
- package/dist/twist-aplayer.umd.js +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");function qr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const J=qr(d);var me={exports:{}},re={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ke;function Dr(){if(Ke)return re;Ke=1;var e=
|
|
9
|
+
*/var Ke;function Dr(){if(Ke)return re;Ke=1;var e=d,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,u=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function p(b,s,v){var g,l={},c=null,x=null;v!==void 0&&(c=""+v),s.key!==void 0&&(c=""+s.key),s.ref!==void 0&&(x=s.ref);for(g in s)a.call(s,g)&&!f.hasOwnProperty(g)&&(l[g]=s[g]);if(b&&b.defaultProps)for(g in s=b.defaultProps,s)l[g]===void 0&&(l[g]=s[g]);return{$$typeof:t,type:b,key:c,ref:x,props:l,_owner:u.current}}return re.Fragment=n,re.jsx=p,re.jsxs=p,re}var te={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Je;function
|
|
18
|
-
`+xe+r}}var Se=!1,le;{var mr=typeof WeakMap=="function"?WeakMap:Map;le=new mr}function Me(r,
|
|
17
|
+
*/var Je;function Vr(){return Je||(Je=1,process.env.NODE_ENV!=="production"&&function(){var e=d,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),b=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),T=Symbol.iterator,i="@@iterator";function y(r){if(r===null||typeof r!="object")return null;var o=T&&r[T]||r[i];return typeof o=="function"?o:null}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(r){{for(var o=arguments.length,h=new Array(o>1?o-1:0),_=1;_<o;_++)h[_-1]=arguments[_];N("error",r,h)}}function N(r,o,h){{var _=E.ReactDebugCurrentFrame,O=_.getStackAddendum();O!==""&&(o+="%s",h=h.concat([O]));var C=h.map(function(j){return String(j)});C.unshift("Warning: "+o),Function.prototype.apply.call(console[r],console,C)}}var $=!1,X=!1,z=!1,I=!1,ue=!1,ie;ie=Symbol.for("react.module.reference");function be(r){return!!(typeof r=="string"||typeof r=="function"||r===a||r===f||ue||r===u||r===v||r===g||I||r===x||$||X||z||typeof r=="object"&&r!==null&&(r.$$typeof===c||r.$$typeof===l||r.$$typeof===p||r.$$typeof===b||r.$$typeof===s||r.$$typeof===ie||r.getModuleId!==void 0))}function ge(r,o,h){var _=r.displayName;if(_)return _;var O=o.displayName||o.name||"";return O!==""?h+"("+O+")":h}function oe(r){return r.displayName||"Context"}function V(r){if(r==null)return null;if(typeof r.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case a:return"Fragment";case n:return"Portal";case f:return"Profiler";case u:return"StrictMode";case v:return"Suspense";case g:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case b:var o=r;return oe(o)+".Consumer";case p:var h=r;return oe(h._context)+".Provider";case s:return ge(r,r.render,"ForwardRef");case l:var _=r.displayName||null;return _!==null?_:V(r.type)||"Memo";case c:{var O=r,C=O._payload,j=O._init;try{return V(j(C))}catch{return null}}}return null}var D=Object.assign,H=0,U,Q,Z,ee,R,se,$e;function Ae(){}Ae.__reactDisabledLog=!0;function dr(){{if(H===0){U=console.log,Q=console.info,Z=console.warn,ee=console.error,R=console.group,se=console.groupCollapsed,$e=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Ae,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}H++}}function vr(){{if(H--,H===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},r,{value:U}),info:D({},r,{value:Q}),warn:D({},r,{value:Z}),error:D({},r,{value:ee}),group:D({},r,{value:R}),groupCollapsed:D({},r,{value:se}),groupEnd:D({},r,{value:$e})})}H<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ee=E.ReactCurrentDispatcher,xe;function ce(r,o,h){{if(xe===void 0)try{throw Error()}catch(O){var _=O.stack.trim().match(/\n( *(at )?)/);xe=_&&_[1]||""}return`
|
|
18
|
+
`+xe+r}}var Se=!1,le;{var mr=typeof WeakMap=="function"?WeakMap:Map;le=new mr}function Me(r,o){if(!r||Se)return"";{var h=le.get(r);if(h!==void 0)return h}var _;Se=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var C;C=Ee.current,Ee.current=null,dr();try{if(o){var j=function(){throw Error()};if(Object.defineProperty(j.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(j,[])}catch(F){_=F}Reflect.construct(r,[],j)}else{try{j.call()}catch(F){_=F}r.call(j.prototype)}}else{try{throw Error()}catch(F){_=F}r()}}catch(F){if(F&&_&&typeof F.stack=="string"){for(var w=F.stack.split(`
|
|
19
19
|
`),k=_.stack.split(`
|
|
20
20
|
`),P=w.length-1,A=k.length-1;P>=1&&A>=0&&w[P]!==k[A];)A--;for(;P>=1&&A>=0;P--,A--)if(w[P]!==k[A]){if(P!==1||A!==1)do if(P--,A--,A<0||w[P]!==k[A]){var q=`
|
|
21
|
-
`+w[P].replace(" at new "," at ");return r.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",r.displayName)),typeof r=="function"&&le.set(r,q),q}while(P>=1&&A>=0);break}}}finally{Se=!1,Ee.current=C,vr(),Error.prepareStackTrace=O}var G=r?r.displayName||r.name:"",Ge=G?ce(G):"";return typeof r=="function"&&le.set(r,Ge),Ge}function hr(r,
|
|
21
|
+
`+w[P].replace(" at new "," at ");return r.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",r.displayName)),typeof r=="function"&&le.set(r,q),q}while(P>=1&&A>=0);break}}}finally{Se=!1,Ee.current=C,vr(),Error.prepareStackTrace=O}var G=r?r.displayName||r.name:"",Ge=G?ce(G):"";return typeof r=="function"&&le.set(r,Ge),Ge}function hr(r,o,h){return Me(r,!1)}function yr(r){var o=r.prototype;return!!(o&&o.isReactComponent)}function fe(r,o,h){if(r==null)return"";if(typeof r=="function")return Me(r,yr(r));if(typeof r=="string")return ce(r);switch(r){case v:return ce("Suspense");case g:return ce("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case s:return hr(r.render);case l:return fe(r.type,o,h);case c:{var _=r,O=_._payload,C=_._init;try{return fe(C(O),o,h)}catch{}}}return""}var de=Object.prototype.hasOwnProperty,Ne={},ke=E.ReactDebugCurrentFrame;function ve(r){if(r){var o=r._owner,h=fe(r.type,r._source,o?o.type:null);ke.setExtraStackFrame(h)}else ke.setExtraStackFrame(null)}function pr(r,o,h,_,O){{var C=Function.call.bind(de);for(var j in r)if(C(r,j)){var w=void 0;try{if(typeof r[j]!="function"){var k=Error((_||"React class")+": "+h+" type `"+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[j]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw k.name="Invariant Violation",k}w=r[j](o,j,_,h,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(P){w=P}w&&!(w instanceof Error)&&(ve(O),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",_||"React class",h,j,typeof w),ve(null)),w instanceof Error&&!(w.message in Ne)&&(Ne[w.message]=!0,ve(O),S("Failed %s type: %s",h,w.message),ve(null))}}}var br=Array.isArray;function _e(r){return br(r)}function gr(r){{var o=typeof Symbol=="function"&&Symbol.toStringTag,h=o&&r[Symbol.toStringTag]||r.constructor.name||"Object";return h}}function Er(r){try{return qe(r),!1}catch{return!0}}function qe(r){return""+r}function De(r){if(Er(r))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",gr(r)),qe(r)}var Ve=E.ReactCurrentOwner,xr={key:!0,ref:!0,__self:!0,__source:!0},Ie,Fe;function Sr(r){if(de.call(r,"ref")){var o=Object.getOwnPropertyDescriptor(r,"ref").get;if(o&&o.isReactWarning)return!1}return r.ref!==void 0}function _r(r){if(de.call(r,"key")){var o=Object.getOwnPropertyDescriptor(r,"key").get;if(o&&o.isReactWarning)return!1}return r.key!==void 0}function Tr(r,o){typeof r.ref=="string"&&Ve.current}function wr(r,o){{var h=function(){Ie||(Ie=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",o))};h.isReactWarning=!0,Object.defineProperty(r,"key",{get:h,configurable:!0})}}function jr(r,o){{var h=function(){Fe||(Fe=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",o))};h.isReactWarning=!0,Object.defineProperty(r,"ref",{get:h,configurable:!0})}}var Or=function(r,o,h,_,O,C,j){var w={$$typeof:t,type:r,key:o,ref:h,props:j,_owner:C};return w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(w,"_self",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.defineProperty(w,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w};function Rr(r,o,h,_,O){{var C,j={},w=null,k=null;h!==void 0&&(De(h),w=""+h),_r(o)&&(De(o.key),w=""+o.key),Sr(o)&&(k=o.ref,Tr(o,O));for(C in o)de.call(o,C)&&!xr.hasOwnProperty(C)&&(j[C]=o[C]);if(r&&r.defaultProps){var P=r.defaultProps;for(C in P)j[C]===void 0&&(j[C]=P[C])}if(w||k){var A=typeof r=="function"?r.displayName||r.name||"Unknown":r;w&&wr(j,A),k&&jr(j,A)}return Or(r,w,k,O,_,Ve.current,j)}}var Te=E.ReactCurrentOwner,Be=E.ReactDebugCurrentFrame;function Y(r){if(r){var o=r._owner,h=fe(r.type,r._source,o?o.type:null);Be.setExtraStackFrame(h)}else Be.setExtraStackFrame(null)}var we;we=!1;function je(r){return typeof r=="object"&&r!==null&&r.$$typeof===t}function ze(){{if(Te.current){var r=V(Te.current.type);if(r)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+r+"`."}return""}}function Cr(r){return""}var He={};function Lr(r){{var
|
|
23
|
+
Check the render method of \``+r+"`."}return""}}function Cr(r){return""}var He={};function Lr(r){{var o=ze();if(!o){var h=typeof r=="string"?r:r.displayName||r.name;h&&(o=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+h+">.")}return
|
|
26
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wr(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a,
|
|
27
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var f,y=!0,b=!1;return{s:function(){n=n.call(e)},n:function(){var d=n.next();return y=d.done,d},e:function(d){b=!0,f=d},f:function(){try{y||n.return==null||n.return()}finally{if(b)throw f}}}}function sr(e,t){if(e){if(typeof e=="string")return er(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}function er(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ye.apply(null,arguments)}function rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function ae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rr(Object(n),!0).forEach(function(a){Gr(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rr(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function Gr(e,t,n){return(t=Kr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kr(e){var t=Jr(e,"string");return ne(t)=="symbol"?t:t+""}function Jr(e,t){if(ne(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(ne(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Xr(e,t){if(e==null)return{};var n,a,o=Qr(e,t);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(a=0;a<f.length;a++)n=f[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Qr(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function Zr(e){var t=e.attrs,n=e.size,a=e.title,o=e.spin,f=e.rotate,y=e.color,b=Xr(e,Br),s=function(g){var l=n||g.size||"1em",c,x="",T="";return g.className&&(c=g.className),e.className&&(c=c?"".concat(c," ").concat(e.className):e.className),o&&(c?c+=" twist-icon-loading":c="twist-icon-loading"),f&&(x="rotate(".concat(f,"deg)"),T="rotate(".concat(f,"deg)")),J.createElement("svg",ye({xmlns:"http://www.w3.org/2000/svg"},g.attrs,t,b,{className:c,style:ae(ae({color:y||g.color,msTransform:x,transform:T},g.style),e.style),width:l,height:l}),a&&J.createElement("title",null,a),e.children)};return Pe!==void 0?J.createElement(Pe.Consumer,null,function(d){return s(d)}):s(ur)}function et(e){var t={},n=e.split(";"),a=Yr(n),o;try{for(a.s();!(o=a.n()).done;){var f=o.value,y=f.split(":"),b=zr(y,2),s=b[0],d=b[1];if(s&&d){var g=s.trim().replace(/-./g,function(l){return l.charAt(1).toUpperCase()});t[g]=d.trim()}}}catch(l){a.e(l)}finally{a.f()}return t}function cr(e){return e&&e.map(function(t,n){return J.createElement(t.tag,ae(ae({},t.attrs),{},{key:n,style:t.attrs.style?et(t.attrs.style):null}),cr(t.children))})}function M(e){return function(t){return J.createElement(Zr,ye({attrs:ae({},e.attrs)},t),cr(e.children))}}function rt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 2.25c-5.384 0-9.75 4.366-9.75 9.75s4.366 9.75 9.75 9.75v-2.437A7.312 7.312 0 1 1 19.313 12h2.437c0-5.384-4.366-9.75-9.75-9.75"}}]})(e)}function tt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M18.25 12L8.5 17.629V6.37z"}}]})(e)}function lr(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=lr(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function L(){for(var e,t,n=0,a="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=lr(e))&&(a&&(a+=" "),a+=t);return a}function nt({bufferedPercentage:e,playedPercentage:t,onSeek:n}){const a=B("aplayer-bar"),o=B("aplayer-icon"),f=m.useRef(null),[y,b]=m.useState(t),s=m.useRef(!1);m.useEffect(()=>{s.current||b(t)},[t]);const d=m.useCallback(g=>{s.current=!0;const l=Oe(g,f);b(l);const c=T=>{const i=Oe(T,f);b(i)},x=T=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",x);const i=Oe(T,f);b(i),n==null||n(i),s.current=!1};document.addEventListener("mousemove",c),document.addEventListener("mouseup",x)},[n]);return v.jsx("div",{ref:f,className:L(a.b(),a.bs("vars")),onMouseDown:d,children:v.jsxs("div",{className:a.be("inner"),children:[typeof e<"u"?v.jsx("div",{className:a.be("loaded"),style:{width:`${e*100}%`}}):null,typeof y<"u"?v.jsx("div",{className:a.be("played"),style:{width:`${y*100}%`},children:v.jsx("span",{className:a.be("thumb"),children:v.jsx("span",{className:L(o.bs("loading")),children:v.jsx(rt,{})})})}):null]})})}function at(e){return M({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 ot(e){return M({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 it(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14 19V5h4v14zm-8 0V5h4v14z"}}]})(e)}function ut(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"}}]})(e)}function st(e){return M({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 ct(e){return M({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 lt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9 15H6q-.425 0-.712-.288T5 14v-4q0-.425.288-.712T6 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T12.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.512.013T16 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function ft(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7 15V9h4l5-5v16l-5-5z"}}]})(e)}function dt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M19 11.975q0-2.075-1.1-3.787t-2.95-2.563q-.375-.175-.55-.537t-.05-.738q.15-.4.538-.575t.787 0Q18.1 4.85 19.55 7.063T21 11.974t-1.45 4.913t-3.875 3.287q-.4.175-.788 0t-.537-.575q-.125-.375.05-.737t.55-.538q1.85-.85 2.95-2.562t1.1-3.788M7 15H4q-.425 0-.712-.288T3 14v-4q0-.425.288-.712T4 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T10.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.513.013T14 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function vt({volume:e,muted:t,onToggleMuted:n,onChangeVolume:a}){const o=B("aplayer-volumn"),f=B("aplayer-icon"),y=m.useRef(null),[b,s]=m.useState(!1),d=m.useCallback(g=>{a(Re(g,y)),s(!0);const l=x=>{a(Re(x,y))},c=x=>{document.removeEventListener("mouseup",c),document.removeEventListener("mousemove",l),s(!1),a(Re(x,y))};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)},[a]);return v.jsxs("div",{className:L(o.b(),o.bs("vars")),children:[v.jsx("button",{type:"button",className:L(f.b(),f.bs("volume-down")),onClick:()=>n(),children:t||!e?v.jsx(ft,{}):e>=1?v.jsx(dt,{}):v.jsx(lt,{})}),v.jsx("div",{className:L(o.be("bar-wrap"),{[o.bem("bar-wrap","active")]:b}),ref:y,onMouseDown:d,children:v.jsx("div",{className:o.be("bar"),children:v.jsx("div",{className:o.be("thumb"),style:{height:t?0:`${e*100}%`}})})})]})}function tr(e){if(typeof e>"u")return"--:--";if(Number.isNaN(e))return"00:00";const t=y=>y<10?`0${y}`:`${y}`,n=Math.trunc(e/60),a=Math.trunc(e-n*60),o=Math.trunc(n/60),f=Math.trunc(e/60-60*Math.trunc(e/60/60));return e>=3600?`${t(o)}:${t(f)}:${t(a)}`:`${t(n)}:${t(a)}`}function mt(e){return M({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M485.6 249.9L198.2 498c-8.3 7.1-8.3 20.8 0 27.9l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9m320 0L518.2 498a18.6 18.6 0 0 0-6.2 14c0 5.2 2.1 10.4 6.2 14l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9"}}]})(e)}function ht(e){return M({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 pt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"}}]})(e)}function yt(e){return M({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 bt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"m17 3l5.25 4.5L17 12l5.25 4.5L17 21v-3h-2.74l-2.82-2.82l2.12-2.12L15.5 15H17V9h-1.5l-9 9H2v-3h3.26l9-9H17zM2 6h4.5l2.82 2.82l-2.12 2.12L5.26 9H2z"}}]})(e)}function gt({volume:e,onChangeVolume:t,muted:n,currentTime:a,audioDurationSeconds:o,bufferedSeconds:f,onToggleMenu:y,onToggleMuted:b,order:s,onOrderChange:d,loop:g,onLoopChange:l,onSeek:c,isPlaying:x,onTogglePlay:T,onSkipForward:i,onSkipBack:p,showLyrics:E=!0,onToggleLyrics:S}){const N=B("aplayer-controller"),$=B("aplayer-icon"),X=m.useCallback(()=>{const V={list:"random",random:"list"}[s];d(V)},[s,d]),z=m.useCallback(()=>{const V={all:"one",one:"none",none:"all"}[g];l(V)},[g,l]);return v.jsxs("div",{className:L(N.b(),N.bs("vars")),children:[v.jsx(nt,{playedPercentage:typeof a>"u"||typeof o>"u"?void 0:a/o,bufferedPercentage:typeof f>"u"||typeof o>"u"?void 0:f/o,onSeek:V=>c==null?void 0:c(V*o)}),v.jsxs("div",{className:N.be("time"),children:[v.jsxs("span",{className:N.be("time-inner"),children:[v.jsx("span",{className:N.be("ptime"),children:tr(a)})," / ",v.jsx("span",{className:N.be("dtime"),children:tr(o)})]}),v.jsx("span",{className:L($.b(),$.bs("back")),onClick:p,children:v.jsx(mt,{})}),v.jsx("span",{className:L($.b(),$.bs("play")),onClick:T,children:x?v.jsx(it,{}):v.jsx(ut,{})}),v.jsx("span",{className:L($.b(),$.bs("forward")),onClick:i,children:v.jsx(ht,{})}),v.jsx(vt,{volume:e,muted:n,onToggleMuted:b,onChangeVolume:t}),v.jsx("button",{className:L($.b(),$.bs("order")),onClick:X,type:"button",children:{list:v.jsx(at,{}),random:v.jsx(bt,{})}[s]}),v.jsx("button",{className:L($.b(),$.bs("order")),onClick:z,type:"button",children:{all:v.jsx(ct,{}),one:v.jsx(st,{}),none:v.jsx(yt,{})}[g]}),v.jsx("button",{type:"button",className:L($.b(),$.bs("menu")),onClick:()=>y==null?void 0:y(),children:v.jsx(pt,{})}),v.jsx("button",{type:"button",className:L($.b(),$.bs("lrc"),{[$.ns("lrc-inactivity")]:!E}),onClick:S,children:v.jsx(ot,{})})]})]})}function Et({open:e,audio:t,playingAudioUrl:n,onPlayAudio:a,listMaxHeight:o}){const f=B("aplayer-list"),y=o?{maxHeight:o}:void 0,b=m.useCallback(d=>d?typeof d=="string"?d:d.name??"Audio artist":"Audio artist",[]),s=m.useRef(null);return m.useEffect(()=>{if(s.current){const d=s.current;return d.style.maxHeight=`${Math.min(d.scrollHeight,o??1/0)}px`,()=>{d.removeAttribute("style")}}},[o]),v.jsx("div",{ref:s,className:L(f.b(),{[f.bm("hide")]:!e}),children:v.jsx("ol",{style:y,children:t.map((d,g)=>v.jsxs("li",{className:L({[f.bm("active")]:d.url===n}),onClick:()=>{d.url!==n&&(a==null||a(d))},children:[v.jsx("span",{className:f.be("cur")}),v.jsx("span",{className:f.be("index"),children:g+1}),v.jsx("span",{className:f.be("title"),children:d.name??"Audio name"}),v.jsx("span",{className:f.be("author"),children:b(d.artist)})]},d.name||g))})})}function nr({show:e,lrcText:t,currentTime:n}){const a=B("aplayer-lrc"),o=m.useMemo(()=>xt(t),[t]),f=m.useMemo(()=>{for(let b=0;b<o.length;b++){const s=o[b],d=o[b+1];if(n>=s[0]&&(!d||n<d[0]))return b}return 0},[n,o]),y=m.useMemo(()=>({transform:`translateY(${-f*16}px)`,WebkitTransform:`translateY(${-f*16}px)`}),[f]);return v.jsx("div",{className:L(a.b(),{[a.bm("hide")]:!e}),children:t?v.jsx("div",{className:a.be("contents"),style:y,children:o.map(([,b],s)=>v.jsx("p",{className:L({[a.be("current")]:s===f}),children:b},s))}):null})}function xt(e){if(e){e=e.replace(/([^\]^\n])\[/g,(o,f)=>`${f}
|
|
25
|
+
Check the top-level render call using <`+h+">.")}return o}}function We(r,o){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var h=Lr(o);if(He[h])return;He[h]=!0;var _="";r&&r._owner&&r._owner!==Te.current&&(_=" It was passed a child from "+V(r._owner.type)+"."),Y(r),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',h,_),Y(null)}}function Ue(r,o){{if(typeof r!="object")return;if(_e(r))for(var h=0;h<r.length;h++){var _=r[h];je(_)&&We(_,o)}else if(je(r))r._store&&(r._store.validated=!0);else if(r){var O=y(r);if(typeof O=="function"&&O!==r.entries)for(var C=O.call(r),j;!(j=C.next()).done;)je(j.value)&&We(j.value,o)}}}function Pr(r){{var o=r.type;if(o==null||typeof o=="string")return;var h;if(typeof o=="function")h=o.propTypes;else if(typeof o=="object"&&(o.$$typeof===s||o.$$typeof===l))h=o.propTypes;else return;if(h){var _=V(o);pr(h,r.props,"prop",_,r)}else if(o.PropTypes!==void 0&&!we){we=!0;var O=V(o);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof o.getDefaultProps=="function"&&!o.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function $r(r){{for(var o=Object.keys(r.props),h=0;h<o.length;h++){var _=o[h];if(_!=="children"&&_!=="key"){Y(r),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),Y(null);break}}r.ref!==null&&(Y(r),S("Invalid attribute `ref` supplied to `React.Fragment`."),Y(null))}}function Ye(r,o,h,_,O,C){{var j=be(r);if(!j){var w="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var k=Cr();k?w+=k:w+=ze();var P;r===null?P="null":_e(r)?P="array":r!==void 0&&r.$$typeof===t?(P="<"+(V(r.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):P=typeof r,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,w)}var A=Rr(r,o,h,O,C);if(A==null)return A;if(j){var q=o.children;if(q!==void 0)if(_)if(_e(q)){for(var G=0;G<q.length;G++)Ue(q[G],r);Object.freeze&&Object.freeze(q)}else S("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 Ue(q,r)}return r===a?$r(A):Pr(A),A}}function Ar(r,o,h){return Ye(r,o,h,!0)}function Mr(r,o,h){return Ye(r,o,h,!1)}var Nr=Mr,kr=Ar;te.Fragment=a,te.jsx=Nr,te.jsxs=kr}()),te}var Xe;function Ir(){return Xe||(Xe=1,process.env.NODE_ENV==="production"?me.exports=Dr():me.exports=Vr()),me.exports}var m=Ir(),he=e=>`--${e}`,Qe=e=>`var(--${e})`,Ze=(e,t)=>`--${e}: ${t};`;function Fr(e,t){const n=a=>t;return{b:()=>`${n()}-${e}`,be:a=>`${n()}-${e}__${a}`,bm:a=>`${n()}-${e}--${a}`,bem:(a,u)=>`${n()}-${e}__${a}--${u}`,bs:a=>`${n()}-${e}-${a}`,ns:a=>`${n()}-${a}`,cb:()=>`.${n()}-${e}`,cbe:a=>`.${n()}-${e}__${a}`,cbm:a=>`.${n()}-${e}--${a}`,cbem:(a,u)=>`.${n()}-${e}__${a}--${u}`,cbs:a=>`.${n()}-${e}-${a}`,cns:a=>`.${n()}-${a}`,cv:a=>he(`${n()}-${e}-${a}`),cvm:(a,u={})=>{const f=n();for(const p of Object.keys(a))u[he(`${f}-${e}-${p}`)]=a[p];return u},gcv:a=>Qe(`${n()}-${e}-${a}`),scv:(a,u)=>Ze(`${n()}-${e}-${a}`,u),nv:a=>he(`${n()}-${a}`),nvm:(a,u={})=>{const f=n();for(const p of Object.keys(a))u[he(`${f}-${p}`)]=a[p];return u},gnv:a=>Qe(`${n()}-${a}`),snv:(a,u)=>Ze(`${n()}-${a}`,u)}}function B(e){return d.useMemo(()=>Fr(e,"twist"),[e])}function Oe(e,t){if(!t.current)return 0;let n=(e.clientX-t.current.getBoundingClientRect().left)/t.current.clientWidth;return n=Math.max(n,0),n=Math.min(n,1),n=Math.floor(n*100)/100,n}function Re(e,t){if(!t.current)return 0;let n=1-(e.clientY-t.current.getBoundingClientRect().top)/t.current.clientHeight;return n=Math.max(n,0),n=Math.min(n,1),n=Math.floor(n*100)/100,n}var or={color:void 0,size:void 0,className:void 0,style:void 0,attrs:void 0},Pe=J.createContext(or);Pe.Provider;function ne(e){"@babel/helpers - typeof";return ne=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},ne(e)}var Br=["attrs","size","title","spin","rotate","color"];function zr(e,t){return Ur(e)||Wr(e,t)||sr(e,t)||Hr()}function Hr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
26
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wr(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a,u,f,p,b=[],s=!0,v=!1;try{if(f=(n=n.call(e)).next,t!==0)for(;!(s=(a=f.call(n)).done)&&(b.push(a.value),b.length!==t);s=!0);}catch(g){v=!0,u=g}finally{try{if(!s&&n.return!=null&&(p=n.return(),Object(p)!==p))return}finally{if(v)throw u}}return b}}function Ur(e){if(Array.isArray(e))return e}function Yr(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=sr(e))||t){n&&(e=n);var a=0,u=function(){};return{s:u,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(v){throw v},f:u}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
27
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var f,p=!0,b=!1;return{s:function(){n=n.call(e)},n:function(){var v=n.next();return p=v.done,v},e:function(v){b=!0,f=v},f:function(){try{p||n.return==null||n.return()}finally{if(b)throw f}}}}function sr(e,t){if(e){if(typeof e=="string")return er(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}function er(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function pe(){return pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},pe.apply(null,arguments)}function rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable})),n.push.apply(n,a)}return n}function ae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rr(Object(n),!0).forEach(function(a){Gr(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rr(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function Gr(e,t,n){return(t=Kr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kr(e){var t=Jr(e,"string");return ne(t)=="symbol"?t:t+""}function Jr(e,t){if(ne(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(ne(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Xr(e,t){if(e==null)return{};var n,a,u=Qr(e,t);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(a=0;a<f.length;a++)n=f[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(u[n]=e[n])}return u}function Qr(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function Zr(e){var t=e.attrs,n=e.size,a=e.title,u=e.spin,f=e.rotate,p=e.color,b=Xr(e,Br),s=function(g){var l=n||g.size||"1em",c,x="",T="";return g.className&&(c=g.className),e.className&&(c=c?"".concat(c," ").concat(e.className):e.className),u&&(c?c+=" twist-icon-loading":c="twist-icon-loading"),f&&(x="rotate(".concat(f,"deg)"),T="rotate(".concat(f,"deg)")),J.createElement("svg",pe({xmlns:"http://www.w3.org/2000/svg"},g.attrs,t,b,{className:c,style:ae(ae({color:p||g.color,msTransform:x,transform:T},g.style),e.style),width:l,height:l}),a&&J.createElement("title",null,a),e.children)};return Pe!==void 0?J.createElement(Pe.Consumer,null,function(v){return s(v)}):s(or)}function et(e){var t={},n=e.split(";"),a=Yr(n),u;try{for(a.s();!(u=a.n()).done;){var f=u.value,p=f.split(":"),b=zr(p,2),s=b[0],v=b[1];if(s&&v){var g=s.trim().replace(/-./g,function(l){return l.charAt(1).toUpperCase()});t[g]=v.trim()}}}catch(l){a.e(l)}finally{a.f()}return t}function cr(e){return e&&e.map(function(t,n){return J.createElement(t.tag,ae(ae({},t.attrs),{},{key:n,style:t.attrs.style?et(t.attrs.style):null}),cr(t.children))})}function M(e){return function(t){return J.createElement(Zr,pe({attrs:ae({},e.attrs)},t),cr(e.children))}}function rt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 2.25c-5.384 0-9.75 4.366-9.75 9.75s4.366 9.75 9.75 9.75v-2.437A7.312 7.312 0 1 1 19.313 12h2.437c0-5.384-4.366-9.75-9.75-9.75"}}]})(e)}function tt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M18.25 12L8.5 17.629V6.37z"}}]})(e)}function lr(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var u=e.length;for(t=0;t<u;t++)e[t]&&(n=lr(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function L(){for(var e,t,n=0,a="",u=arguments.length;n<u;n++)(e=arguments[n])&&(t=lr(e))&&(a&&(a+=" "),a+=t);return a}function nt({bufferedPercentage:e,playedPercentage:t,onSeek:n}){const a=B("aplayer-bar"),u=B("aplayer-icon"),f=d.useRef(null),[p,b]=d.useState(t),s=d.useRef(!1);d.useEffect(()=>{s.current||b(t)},[t]);const v=d.useCallback(g=>{s.current=!0;const l=Oe(g,f);b(l);const c=T=>{const i=Oe(T,f);b(i)},x=T=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",x);const i=Oe(T,f);b(i),n==null||n(i),s.current=!1};document.addEventListener("mousemove",c),document.addEventListener("mouseup",x)},[n]);return m.jsx("div",{ref:f,className:L(a.b(),a.bs("vars")),onMouseDown:v,children:m.jsxs("div",{className:a.be("inner"),children:[typeof e<"u"?m.jsx("div",{className:a.be("loaded"),style:{width:`${e*100}%`}}):null,typeof p<"u"?m.jsx("div",{className:a.be("played"),style:{width:`${p*100}%`},children:m.jsx("span",{className:a.be("thumb"),children:m.jsx("span",{className:L(u.bs("loading")),children:m.jsx(rt,{})})})}):null]})})}function at(e){return M({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 ut(e){return M({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 it(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14 19V5h4v14zm-8 0V5h4v14z"}}]})(e)}function ot(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"}}]})(e)}function st(e){return M({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 ct(e){return M({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 lt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9 15H6q-.425 0-.712-.288T5 14v-4q0-.425.288-.712T6 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T12.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.512.013T16 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function ft(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7 15V9h4l5-5v16l-5-5z"}}]})(e)}function dt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M19 11.975q0-2.075-1.1-3.787t-2.95-2.563q-.375-.175-.55-.537t-.05-.738q.15-.4.538-.575t.787 0Q18.1 4.85 19.55 7.063T21 11.974t-1.45 4.913t-3.875 3.287q-.4.175-.788 0t-.537-.575q-.125-.375.05-.737t.55-.538q1.85-.85 2.95-2.562t1.1-3.788M7 15H4q-.425 0-.712-.288T3 14v-4q0-.425.288-.712T4 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T10.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.513.013T14 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2"}}]})(e)}function vt({volume:e,muted:t,onToggleMuted:n,onChangeVolume:a}){const u=B("aplayer-volumn"),f=B("aplayer-icon"),p=d.useRef(null),[b,s]=d.useState(!1),v=d.useCallback(g=>{a(Re(g,p)),s(!0);const l=x=>{a(Re(x,p))},c=x=>{document.removeEventListener("mouseup",c),document.removeEventListener("mousemove",l),s(!1),a(Re(x,p))};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)},[a]);return m.jsxs("div",{className:L(u.b(),u.bs("vars")),children:[m.jsx("button",{type:"button",className:L(f.b(),f.bs("volume-down")),onClick:()=>n(),children:t||!e?m.jsx(ft,{}):e>=1?m.jsx(dt,{}):m.jsx(lt,{})}),m.jsx("div",{className:L(u.be("bar-wrap"),{[u.bem("bar-wrap","active")]:b}),ref:p,onMouseDown:v,children:m.jsx("div",{className:u.be("bar"),children:m.jsx("div",{className:u.be("thumb"),style:{height:t?0:`${e*100}%`}})})})]})}function tr(e){if(typeof e>"u")return"--:--";if(Number.isNaN(e))return"00:00";const t=p=>p<10?`0${p}`:`${p}`,n=Math.trunc(e/60),a=Math.trunc(e-n*60),u=Math.trunc(n/60),f=Math.trunc(e/60-60*Math.trunc(e/60/60));return e>=3600?`${t(u)}:${t(f)}:${t(a)}`:`${t(n)}:${t(a)}`}function mt(e){return M({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M485.6 249.9L198.2 498c-8.3 7.1-8.3 20.8 0 27.9l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9m320 0L518.2 498a18.6 18.6 0 0 0-6.2 14c0 5.2 2.1 10.4 6.2 14l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9"}}]})(e)}function ht(e){return M({attrs:{viewBox:"0 0 1024 1024"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M825.8 498L538.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L825.8 526c8.3-7.2 8.3-20.8 0-28m-320 0L218.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L505.8 526c4.1-3.6 6.2-8.8 6.2-14s-2.1-10.4-6.2-14"}}]})(e)}function yt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"}}]})(e)}function pt(e){return M({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 bt(e){return M({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"m17 3l5.25 4.5L17 12l5.25 4.5L17 21v-3h-2.74l-2.82-2.82l2.12-2.12L15.5 15H17V9h-1.5l-9 9H2v-3h3.26l9-9H17zM2 6h4.5l2.82 2.82l-2.12 2.12L5.26 9H2z"}}]})(e)}function gt({volume:e,onChangeVolume:t,muted:n,currentTime:a,audioDurationSeconds:u,bufferedSeconds:f,onToggleMenu:p,onToggleMuted:b,order:s,onOrderChange:v,loop:g,onLoopChange:l,onSeek:c,isPlaying:x,onTogglePlay:T,onSkipForward:i,onSkipBack:y,showLyrics:E=!0,onToggleLyrics:S}){const N=B("aplayer-controller"),$=B("aplayer-icon"),X=d.useCallback(()=>{const I={list:"random",random:"list"}[s];v(I)},[s,v]),z=d.useCallback(()=>{const I={all:"one",one:"none",none:"all"}[g];l(I)},[g,l]);return m.jsxs("div",{className:L(N.b(),N.bs("vars")),children:[m.jsx(nt,{playedPercentage:typeof a>"u"||typeof u>"u"?void 0:a/u,bufferedPercentage:typeof f>"u"||typeof u>"u"?void 0:f/u,onSeek:I=>c==null?void 0:c(I*u)}),m.jsxs("div",{className:N.be("time"),children:[m.jsxs("span",{className:N.be("time-inner"),children:[m.jsx("span",{className:N.be("ptime"),children:tr(a)})," / ",m.jsx("span",{className:N.be("dtime"),children:tr(u)})]}),m.jsx("span",{className:L($.b(),$.bs("back")),onClick:y,children:m.jsx(mt,{})}),m.jsx("span",{className:L($.b(),$.bs("play")),onClick:T,children:x?m.jsx(it,{}):m.jsx(ot,{})}),m.jsx("span",{className:L($.b(),$.bs("forward")),onClick:i,children:m.jsx(ht,{})}),m.jsx(vt,{volume:e,muted:n,onToggleMuted:b,onChangeVolume:t}),m.jsx("button",{className:L($.b(),$.bs("order")),onClick:X,type:"button",children:{list:m.jsx(at,{}),random:m.jsx(bt,{})}[s]}),m.jsx("button",{className:L($.b(),$.bs("order")),onClick:z,type:"button",children:{all:m.jsx(ct,{}),one:m.jsx(st,{}),none:m.jsx(pt,{})}[g]}),m.jsx("button",{type:"button",className:L($.b(),$.bs("menu")),onClick:()=>p==null?void 0:p(),children:m.jsx(yt,{})}),m.jsx("button",{type:"button",className:L($.b(),$.bs("lrc"),{[$.ns("lrc-inactivity")]:!E}),onClick:S,children:m.jsx(ut,{})})]})]})}function Et({open:e,audio:t,playingAudioUrl:n,onPlayAudio:a,listMaxHeight:u}){const f=B("aplayer-list"),p=u?{maxHeight:u}:void 0,b=d.useCallback(v=>v?typeof v=="string"?v:v.name??"Audio artist":"Audio artist",[]),s=d.useRef(null);return d.useEffect(()=>{if(s.current){const v=s.current;return v.style.maxHeight=`${Math.min(v.scrollHeight,u??1/0)}px`,()=>{v.removeAttribute("style")}}},[u]),m.jsx("div",{ref:s,className:L(f.b(),{[f.bm("hide")]:!e}),children:m.jsx("ol",{style:p,children:t.map((v,g)=>m.jsxs("li",{className:L({[f.bm("active")]:v.url===n}),onClick:()=>{v.url!==n&&(a==null||a(v))},children:[m.jsx("span",{className:f.be("cur")}),m.jsx("span",{className:f.be("index"),children:g+1}),m.jsx("span",{className:f.be("title"),children:v.name??"Audio name"}),m.jsx("span",{className:f.be("author"),children:b(v.artist)})]},v.name||g))})})}function nr({show:e,lrcText:t,currentTime:n}){const a=B("aplayer-lrc"),u=d.useMemo(()=>xt(t),[t]),f=d.useMemo(()=>{for(let b=0;b<u.length;b++){const s=u[b],v=u[b+1];if(n>=s[0]&&(!v||n<v[0]))return b}return 0},[n,u]),p=d.useMemo(()=>({transform:`translateY(${-f*16}px)`,WebkitTransform:`translateY(${-f*16}px)`}),[f]);return m.jsx("div",{className:L(a.b(),{[a.bm("hide")]:!e}),children:t?m.jsx("div",{className:a.be("contents"),style:p,children:u.map(([,b],s)=>m.jsx("p",{className:L({[a.be("current")]:s===f}),children:b},s))}):null})}function xt(e){if(e){e=e.replace(/([^\]^\n])\[/g,(u,f)=>`${f}
|
|
28
28
|
[`);const t=e.split(`
|
|
29
|
-
`),n=[],a=t.length;for(let
|
|
29
|
+
`),n=[],a=t.length;for(let u=0;u<a;u++){const f=t[u].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g),p=t[u].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g,"").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g,"").replace(/^\s+|\s+$/g,"");if(f){const b=f.length;for(let s=0;s<b;s++){const v=/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/.exec(f[s]),g=v[1]*60,l=Number.parseInt(v[2]),c=v[4]?Number.parseInt(v[4])/(`${v[4]}`.length===2?100:1e3):0,x=g+l+c;n.push([x,p])}}}return n.sort((u,f)=>u[0]-f[0]),n}else return[]}var ye={exports:{}},Ce={};/**
|
|
30
30
|
* @license React
|
|
31
31
|
* use-sync-external-store-shim.production.js
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var ar;function St(){if(ar)return Ce;ar=1;var e=
|
|
37
|
+
*/var ar;function St(){if(ar)return Ce;ar=1;var e=d;function t(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,u=e.useEffect,f=e.useLayoutEffect,p=e.useDebugValue;function b(l,c){var x=c(),T=a({inst:{value:x,getSnapshot:c}}),i=T[0].inst,y=T[1];return f(function(){i.value=x,i.getSnapshot=c,s(i)&&y({inst:i})},[l,x,c]),u(function(){return s(i)&&y({inst:i}),l(function(){s(i)&&y({inst:i})})},[l]),p(x),x}function s(l){var c=l.getSnapshot;l=l.value;try{var x=c();return!n(l,x)}catch{return!0}}function v(l,c){return c()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?v:b;return Ce.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Ce}var Le={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* use-sync-external-store-shim.development.js
|
|
40
40
|
*
|
|
@@ -42,4 +42,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var or;function _t(){return or||(or=1,process.env.NODE_ENV!=="production"&&function(){function e(x,T){return x===T&&(x!==0||1/x===1/T)||x!==x&&T!==T}function t(x,T){g||o.startTransition===void 0||(g=!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 i=T();if(!l){var p=T();f(i,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}p=y({inst:{value:i,getSnapshot:T}});var E=p[0].inst,S=p[1];return s(function(){E.value=i,E.getSnapshot=T,n(E)&&S({inst:E})},[x,i,T]),b(function(){return n(E)&&S({inst:E}),x(function(){n(E)&&S({inst:E})})},[x]),d(i),i}function n(x){var T=x.getSnapshot;x=x.value;try{var i=T();return!f(x,i)}catch{return!0}}function a(x,T){return T()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=m,f=typeof Object.is=="function"?Object.is:e,y=o.useState,b=o.useEffect,s=o.useLayoutEffect,d=o.useDebugValue,g=!1,l=!1,c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:t;Le.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Le}var ir;function Tt(){return ir||(ir=1,process.env.NODE_ENV==="production"?pe.exports=St():pe.exports=_t()),pe.exports}var W=Tt();const K=[];function wt(e){const t=m.useRef();if(typeof window<"u"&&!t.current){const n=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(n.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(n.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(n.volume=e.initialVolume),K.includes(n)||K.push(n)}return m.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onError))return n.addEventListener("error",e.onError),()=>{n.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),m.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onEnded))return n.addEventListener("ended",e.onEnded),()=>{n.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),m.useEffect(()=>()=>{const n=t.current;if(n){n.pause(),n.currentTime=0;const a=K.indexOf(n);a!==-1&&K.splice(a,1)}t.current=void 0},[]),t}function jt(e){const t=wt(e),n=m.useCallback(i=>{for(let p=0;p<K.length;p++){const E=K[p];E!==i&&!E.paused&&E.pause()}},[]),a=m.useCallback(async i=>{var E;const p=t.current;if(p){e.mutex&&n(p),p.src!==i&&(p.pause(),p.currentTime=0,p.src=i);try{await((E=t.current)==null?void 0:E.play())}catch{}}},[t,e.mutex,n]),o=m.useCallback(i=>{const p=t.current;p&&(p.paused?a(i):p.pause())},[t,a]),f=m.useCallback(i=>{t.current.currentTime=i},[t]),y=m.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),b=m.useCallback(i=>{t.current&&(t.current.volume=i)},[t]),s=W.useSyncExternalStore(m.useCallback(i=>{var p;return(p=t.current)==null||p.addEventListener("volumechange",i),()=>{var E;(E=t.current)==null||E.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.volume},()=>{}),d=W.useSyncExternalStore(m.useCallback(i=>{var p;return(p=t.current)==null||p.addEventListener("volumechange",i),()=>{var E;(E=t.current)==null||E.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.muted},()=>{}),g=W.useSyncExternalStore(m.useCallback(i=>{var p;return(p=t.current)==null||p.addEventListener("timeupdate",i),()=>{var E;(E=t.current)==null||E.removeEventListener("timeupdate",i)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),l=W.useSyncExternalStore(m.useCallback(i=>{var p;return(p=t.current)==null||p.addEventListener("durationchange",i),()=>{var E;(E=t.current)==null||E.removeEventListener("durationchange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.duration},()=>{}),c=W.useSyncExternalStore(m.useCallback(i=>{var p;return(p=t.current)==null||p.addEventListener("progress",i),()=>{var E;(E=t.current)==null||E.removeEventListener("progress",i)}},[t]),()=>{const i=t.current;return i&&i.buffered.length>0?i.buffered.end(i.buffered.length-1):0},()=>{}),x=W.useSyncExternalStore(m.useCallback(i=>{var p,E;return(p=t.current)==null||p.addEventListener("play",i),(E=t.current)==null||E.addEventListener("pause",i),()=>{var S,N;(S=t.current)==null||S.removeEventListener("play",i),(N=t.current)==null||N.removeEventListener("pause",i)}},[t]),()=>{const i=t.current;return i?!i.paused:!1},()=>{}),T=W.useSyncExternalStore(m.useCallback(i=>{var p,E;return(p=t.current)==null||p.addEventListener("playing",i),(E=t.current)==null||E.addEventListener("waiting",i),()=>{var S,N;(S=t.current)==null||S.removeEventListener("playing",i),(N=t.current)==null||N.removeEventListener("waiting",i)}},[t]),()=>{const i=t.current;return i?i.networkState===i.NETWORK_LOADING:!1},()=>{});return{playAudio:a,togglePlay:o,seek:f,toggleMuted:y,setVolume:b,volume:s,muted:d,currentTime:g,duration:l,bufferedSeconds:c,isPlaying:x,isLoading:T}}function fr(){const e=m.useRef([]);return m.useEffect(()=>{const n=e.current;return()=>{for(const a of n)clearTimeout(a)}},[]),m.useCallback((n,a)=>{const o=setTimeout(n,a);return e.current.push(o),o},[])}function Ot(){const e=m.useRef(),[t,n]=m.useState({text:"",style:{opacity:0}}),a=fr(),o=m.useCallback((f,y=2e3)=>{e.current&&clearTimeout(e.current),n({text:f,style:{opacity:1}}),e.current=a(()=>{n({text:f,style:{opacity:0}})},y)},[a]);return[t,o]}function Rt(e){return Ct(e.slice())}function Ct(e){let t=e.length,n;for(;t!==0;)n=Math.floor(Math.random()*t),t--,[e[t],e[n]]=[e[n],e[t]];return e}function Lt(e,{initialLoop:t="all",initialOrder:n="list",getSongId:a}){const[o,f]=m.useState(t),[y,b]=m.useState(n),s=m.useMemo(()=>y==="list"?e:Rt(e),[e,y]),[d,g]=m.useState(s[0]);m.useEffect(()=>{const i=s.find(p=>a(p)===a(d));g(i||s[0])},[s,a,d]);const l=m.useMemo(()=>{if(o==="one")return{...d};const i=s.indexOf(d);if(i<s.length-1)return s[i+1];if(o!=="none")return s[0]},[s,d,o]),c=m.useCallback(()=>{l&&g(l)},[l,o]),x=m.useCallback(()=>{g(i=>{const p=s.indexOf(i);return p>0?s[p-1]:i})},[s]),T=m.useCallback(i=>{g(i)},[]);return{currentSong:d,hasNextSong:typeof l<"u",next:c,previous:x,prioritize:T,order:y,setOrder:b,loop:o,setLoop:f,length:s.length}}function Pt(e){return M({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{d:"M294.1 256L167 129c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.3 34 0L345 239c9.1 9.1 9.3 23.7.7 33.1L201.1 417c-4.7 4.7-10.9 7-17 7s-12.3-2.3-17-7c-9.4-9.4-9.4-24.6 0-33.9l127-127.1z",fill:"currentColor"}}]})(e)}function $t(e){return M({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M208 432h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16m144 0h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16"}}]})(e)}function At({audio:e,appearance:t="normal",volume:n=.7,initialLoop:a,initialOrder:o,autoPlay:f=!1,listMaxHeight:y=250,mini:b=!1,mutex:s=!0,listFolded:d=!1,theme:g="light"}){var Q,Z,ee;const l=B("aplayer"),c=Lt(Array.isArray(e)?e:[e],{initialLoop:a,initialOrder:o,getSongId:R=>R.url}),[x,T]=Ot(),i=fr(),p=m.useRef(),E=m.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=void 0)},[]),S=jt({src:c.currentSong.url,initialVolume:n,autoPlay:f,mutex:s,onError(R){const{error:se}=R.target;se&&T("An audio error has occurred, player will skip forward in 2 seconds."),c.hasNextSong&&(p.current=i(()=>{c.next()},2e3))},onEnded(){c.hasNextSong&&c.next()}});m.useEffect(()=>{f&&S.playAudio(c.currentSong.url)},[]);const N=m.useRef(!0);m.useEffect(()=>{N.current?N.current=!1:c.currentSong&&S.playAudio(c.currentSong.url)},[c.currentSong,S.playAudio]);const $=m.useCallback(()=>{E(),S.togglePlay(c.currentSong.url)},[S,E,c.currentSong.url]),X=m.useCallback(R=>R?typeof R=="string"?R:R.url?v.jsx("a",{href:R.url,target:"_blank",rel:"noreferrer",children:R.name??"Audio artist"}):R.name??"Audio artist":"Audio artist",[]),z=c.length>1,V=m.useMemo(()=>Array.isArray(e)?e:[e],[e]),{prioritize:oe}=c,ie=m.useCallback(R=>{E(),oe(R)},[E,oe]),[be,ge]=m.useState(()=>z&&!d),[ue,I]=m.useState(b),[D,H]=m.useState(!0),U=m.useRef(null);return m.useEffect(()=>{I(b)},[b]),m.useEffect(()=>{if(t==="fixed"&&U.current){const R=U.current;return R.style.width=`${R.offsetWidth-18}px`,()=>{R.removeAttribute("style")}}},[t]),v.jsxs("div",{className:L(l.b(),{[l.bs(g)]:!0,[l.bs("vars")]:!0,[l.bm("fixed")]:t==="fixed",[l.bm("loading")]:S.isLoading,[l.bm("withlist")]:z,[l.bm("withlrc")]:!!c.currentSong.lrc&&t!=="fixed",[l.bm("narrow")]:ue}),children:[v.jsxs("div",{ref:U,className:l.be("body"),children:[v.jsx("div",{className:l.be("pic"),onClick:$,style:{backgroundImage:`url("${(Q=c.currentSong)==null?void 0:Q.cover}")`},children:v.jsx("div",{className:L(l.be("button"),S.isPlaying?l.bm("pause"):l.bm("play")),children:S.isPlaying?v.jsx($t,{}):v.jsx(tt,{})})}),v.jsxs("div",{className:L(l.be("info")),children:[v.jsxs("div",{className:L(l.be("music")),children:[v.jsx("span",{className:L(l.be("title")),children:((Z=c.currentSong)==null?void 0:Z.name)??"Audio name"}),v.jsxs("span",{className:L(l.be("author")),children:[" ","-"," ",X((ee=c.currentSong)==null?void 0:ee.artist)]})]}),t==="fixed"?null:v.jsx(nr,{show:D,lrcText:c.currentSong.lrc,currentTime:S.currentTime??0}),v.jsx(gt,{volume:S.volume??n,onChangeVolume:S.setVolume,muted:S.muted??!1,onToggleMuted:()=>S.toggleMuted(),currentTime:S.currentTime,audioDurationSeconds:S.duration,bufferedSeconds:S.bufferedSeconds,onSeek:R=>S.seek(R),onToggleMenu:()=>ge(R=>!R),order:c.order,onOrderChange:c.setOrder,loop:c.loop,onLoopChange:c.setLoop,isPlaying:S.isPlaying??!1,onTogglePlay:$,onSkipForward:()=>{c.hasNextSong&&c.next()},onSkipBack:()=>{c.previous()},showLyrics:D,onToggleLyrics:()=>{H(R=>!R)}})]}),v.jsx("div",{className:l.be("notice"),style:x.style,children:x.text}),v.jsx("div",{className:l.be("miniswitcher"),onClick:()=>I(R=>!R),children:v.jsx("button",{className:l.bs("icon"),type:"button",children:v.jsx(Pt,{})})})]}),z?v.jsx(Et,{open:be,audio:V,playingAudioUrl:c.currentSong.url,onPlayAudio:ie,listMaxHeight:y}):null,t==="fixed"&&v.jsx(nr,{show:D,lrcText:c.currentSong.lrc,currentTime:S.currentTime??0})]})}exports.TwistAPlayer=At;
|
|
45
|
+
*/var ur;function _t(){return ur||(ur=1,process.env.NODE_ENV!=="production"&&function(){function e(x,T){return x===T&&(x!==0||1/x===1/T)||x!==x&&T!==T}function t(x,T){g||u.startTransition===void 0||(g=!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 i=T();if(!l){var y=T();f(i,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}y=p({inst:{value:i,getSnapshot:T}});var E=y[0].inst,S=y[1];return s(function(){E.value=i,E.getSnapshot=T,n(E)&&S({inst:E})},[x,i,T]),b(function(){return n(E)&&S({inst:E}),x(function(){n(E)&&S({inst:E})})},[x]),v(i),i}function n(x){var T=x.getSnapshot;x=x.value;try{var i=T();return!f(x,i)}catch{return!0}}function a(x,T){return T()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var u=d,f=typeof Object.is=="function"?Object.is:e,p=u.useState,b=u.useEffect,s=u.useLayoutEffect,v=u.useDebugValue,g=!1,l=!1,c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:t;Le.useSyncExternalStore=u.useSyncExternalStore!==void 0?u.useSyncExternalStore:c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Le}var ir;function Tt(){return ir||(ir=1,process.env.NODE_ENV==="production"?ye.exports=St():ye.exports=_t()),ye.exports}var W=Tt();const K=[];function wt(e){const t=d.useRef();return d.useEffect(()=>{if(typeof window<"u"&&!t.current){const n=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(n.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(n.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(n.volume=e.initialVolume),K.includes(n)||K.push(n)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),d.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onError))return n.addEventListener("error",e.onError),()=>{n.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),d.useEffect(()=>{if(typeof window>"u")return;const n=t.current;if(n&&(e!=null&&e.onEnded))return n.addEventListener("ended",e.onEnded),()=>{n.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),d.useEffect(()=>()=>{const n=t.current;if(n){n.pause(),n.currentTime=0;const a=K.indexOf(n);a!==-1&&K.splice(a,1)}t.current=void 0},[]),t}function jt(e){const t=wt(e),n=d.useCallback(i=>{for(let y=0;y<K.length;y++){const E=K[y];E!==i&&!E.paused&&E.pause()}},[]),a=d.useCallback(async i=>{var E;const y=t.current;if(y){e.mutex&&n(y),y.src!==i&&(y.pause(),y.currentTime=0,y.src=i);try{await((E=t.current)==null?void 0:E.play())}catch{}}},[t,e.mutex,n]),u=d.useCallback(i=>{const y=t.current;y&&(y.paused?a(i):y.pause())},[t,a]),f=d.useCallback(i=>{t.current.currentTime=i},[t]),p=d.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),b=d.useCallback(i=>{t.current&&(t.current.volume=i)},[t]),s=W.useSyncExternalStore(d.useCallback(i=>{var y;return(y=t.current)==null||y.addEventListener("volumechange",i),()=>{var E;(E=t.current)==null||E.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.volume},()=>{}),v=W.useSyncExternalStore(d.useCallback(i=>{var y;return(y=t.current)==null||y.addEventListener("volumechange",i),()=>{var E;(E=t.current)==null||E.removeEventListener("volumechange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.muted},()=>{}),g=W.useSyncExternalStore(d.useCallback(i=>{var y;return(y=t.current)==null||y.addEventListener("timeupdate",i),()=>{var E;(E=t.current)==null||E.removeEventListener("timeupdate",i)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),l=W.useSyncExternalStore(d.useCallback(i=>{var y;return(y=t.current)==null||y.addEventListener("durationchange",i),()=>{var E;(E=t.current)==null||E.removeEventListener("durationchange",i)}},[t]),()=>{var i;return(i=t.current)==null?void 0:i.duration},()=>{}),c=W.useSyncExternalStore(d.useCallback(i=>{var y;return(y=t.current)==null||y.addEventListener("progress",i),()=>{var E;(E=t.current)==null||E.removeEventListener("progress",i)}},[t]),()=>{const i=t.current;return i&&i.buffered.length>0?i.buffered.end(i.buffered.length-1):0},()=>{}),x=W.useSyncExternalStore(d.useCallback(i=>{var y,E;return(y=t.current)==null||y.addEventListener("play",i),(E=t.current)==null||E.addEventListener("pause",i),()=>{var S,N;(S=t.current)==null||S.removeEventListener("play",i),(N=t.current)==null||N.removeEventListener("pause",i)}},[t]),()=>{const i=t.current;return i?!i.paused:!1},()=>{}),T=W.useSyncExternalStore(d.useCallback(i=>{var y,E;return(y=t.current)==null||y.addEventListener("playing",i),(E=t.current)==null||E.addEventListener("waiting",i),()=>{var S,N;(S=t.current)==null||S.removeEventListener("playing",i),(N=t.current)==null||N.removeEventListener("waiting",i)}},[t]),()=>{const i=t.current;return i?i.networkState===i.NETWORK_LOADING:!1},()=>{});return{playAudio:a,togglePlay:u,seek:f,toggleMuted:p,setVolume:b,volume:s,muted:v,currentTime:g,duration:l,bufferedSeconds:c,isPlaying:x,isLoading:T}}function fr(){const e=d.useRef([]);return d.useEffect(()=>{const n=e.current;return()=>{for(const a of n)clearTimeout(a)}},[]),d.useCallback((n,a)=>{const u=setTimeout(n,a);return e.current.push(u),u},[])}function Ot(){const e=d.useRef(),[t,n]=d.useState({text:"",style:{opacity:0}}),a=fr(),u=d.useCallback((f,p=2e3)=>{e.current&&clearTimeout(e.current),n({text:f,style:{opacity:1}}),e.current=a(()=>{n({text:f,style:{opacity:0}})},p)},[a]);return[t,u]}function Rt(e){return Ct(e.slice())}function Ct(e){let t=e.length,n;for(;t!==0;)n=Math.floor(Math.random()*t),t--,[e[t],e[n]]=[e[n],e[t]];return e}function Lt(e,{initialLoop:t="all",initialOrder:n="list",getSongId:a}){const[u,f]=d.useState(t),[p,b]=d.useState(n),s=d.useMemo(()=>p==="list"?e:Rt(e),[e,p]),[v,g]=d.useState(s[0]);d.useEffect(()=>{const i=s.find(y=>a(y)===a(v));g(i||s[0])},[s,a,v]);const l=d.useMemo(()=>{if(u==="one")return{...v};const i=s.indexOf(v);if(i<s.length-1)return s[i+1];if(u!=="none")return s[0]},[s,v,u]),c=d.useCallback(()=>{l&&g(l)},[l,u]),x=d.useCallback(()=>{g(i=>{const y=s.indexOf(i);return y>0?s[y-1]:i})},[s]),T=d.useCallback(i=>{g(i)},[]);return{currentSong:v,hasNextSong:typeof l<"u",next:c,previous:x,prioritize:T,order:p,setOrder:b,loop:u,setLoop:f,length:s.length}}function Pt(e){return M({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{d:"M294.1 256L167 129c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.3 34 0L345 239c9.1 9.1 9.3 23.7.7 33.1L201.1 417c-4.7 4.7-10.9 7-17 7s-12.3-2.3-17-7c-9.4-9.4-9.4-24.6 0-33.9l127-127.1z",fill:"currentColor"}}]})(e)}function $t(e){return M({attrs:{viewBox:"0 0 512 512"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M208 432h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16m144 0h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16"}}]})(e)}function At({audio:e,appearance:t="normal",volume:n=.7,initialLoop:a,initialOrder:u,autoPlay:f=!1,listMaxHeight:p=250,mini:b=!1,mutex:s=!0,listFolded:v=!1,theme:g="light"}){var Q,Z,ee;const l=B("aplayer"),c=Lt(Array.isArray(e)?e:[e],{initialLoop:a,initialOrder:u,getSongId:R=>R.url}),[x,T]=Ot(),i=fr(),y=d.useRef(),E=d.useCallback(()=>{y.current&&(clearTimeout(y.current),y.current=void 0)},[]),S=jt({src:c.currentSong.url,initialVolume:n,autoPlay:f,mutex:s,onError(R){const{error:se}=R.target;se&&T("An audio error has occurred, player will skip forward in 2 seconds."),c.hasNextSong&&(y.current=i(()=>{c.next()},2e3))},onEnded(){c.hasNextSong&&c.next()}});d.useEffect(()=>{f&&S.playAudio(c.currentSong.url)},[]);const N=d.useRef(!0);d.useEffect(()=>{N.current?N.current=!1:c.currentSong&&S.playAudio(c.currentSong.url)},[c.currentSong,S.playAudio]);const $=d.useCallback(()=>{E(),S.togglePlay(c.currentSong.url)},[S,E,c.currentSong.url]),X=d.useCallback(R=>R?typeof R=="string"?R:R.url?m.jsx("a",{href:R.url,target:"_blank",rel:"noreferrer",children:R.name??"Audio artist"}):R.name??"Audio artist":"Audio artist",[]),z=c.length>1,I=d.useMemo(()=>Array.isArray(e)?e:[e],[e]),{prioritize:ue}=c,ie=d.useCallback(R=>{E(),ue(R)},[E,ue]),[be,ge]=d.useState(()=>z&&!v),[oe,V]=d.useState(b),[D,H]=d.useState(!0),U=d.useRef(null);return d.useEffect(()=>{V(b)},[b]),d.useEffect(()=>{if(t==="fixed"&&U.current){const R=U.current;return R.style.width=`${R.offsetWidth-18}px`,()=>{R.removeAttribute("style")}}},[t]),m.jsxs("div",{className:L(l.b(),{[l.bs(g)]:!0,[l.bs("vars")]:!0,[l.bm("fixed")]:t==="fixed",[l.bm("loading")]:S.isLoading,[l.bm("withlist")]:z,[l.bm("withlrc")]:!!c.currentSong.lrc&&t!=="fixed",[l.bm("narrow")]:oe}),children:[m.jsxs("div",{ref:U,className:l.be("body"),children:[m.jsx("div",{className:l.be("pic"),onClick:$,style:{backgroundImage:`url("${(Q=c.currentSong)==null?void 0:Q.cover}")`},children:m.jsx("div",{className:L(l.be("button"),S.isPlaying?l.bm("pause"):l.bm("play")),children:S.isPlaying?m.jsx($t,{}):m.jsx(tt,{})})}),m.jsxs("div",{className:L(l.be("info")),children:[m.jsxs("div",{className:L(l.be("music")),children:[m.jsx("span",{className:L(l.be("title")),children:((Z=c.currentSong)==null?void 0:Z.name)??"Audio name"}),m.jsxs("span",{className:L(l.be("author")),children:[" ","-"," ",X((ee=c.currentSong)==null?void 0:ee.artist)]})]}),t==="fixed"?null:m.jsx(nr,{show:D,lrcText:c.currentSong.lrc,currentTime:S.currentTime??0}),m.jsx(gt,{volume:S.volume??n,onChangeVolume:S.setVolume,muted:S.muted??!1,onToggleMuted:()=>S.toggleMuted(),currentTime:S.currentTime,audioDurationSeconds:S.duration,bufferedSeconds:S.bufferedSeconds,onSeek:R=>S.seek(R),onToggleMenu:()=>ge(R=>!R),order:c.order,onOrderChange:c.setOrder,loop:c.loop,onLoopChange:c.setLoop,isPlaying:S.isPlaying??!1,onTogglePlay:$,onSkipForward:()=>{c.hasNextSong&&c.next()},onSkipBack:()=>{c.previous()},showLyrics:D,onToggleLyrics:()=>{H(R=>!R)}})]}),m.jsx("div",{className:l.be("notice"),style:x.style,children:x.text}),m.jsx("div",{className:l.be("miniswitcher"),onClick:()=>V(R=>!R),children:m.jsx("button",{className:l.bs("icon"),type:"button",children:m.jsx(Pt,{})})})]}),z?m.jsx(Et,{open:be,audio:I,playingAudioUrl:c.currentSong.url,onPlayAudio:ie,listMaxHeight:p}):null,t==="fixed"&&m.jsx(nr,{show:D,lrcText:c.currentSong.lrc,currentTime:S.currentTime??0})]})}exports.TwistAPlayer=At;
|