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