/*!
* artplayer-plugin-playlist.js v3.1.7
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2019 Harvey Zack
* Released under the MIT License.
*/
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).artplayerPluginPlaylist=n()}(this,function(){"use strict";return function(h){return function(e){var t=e.constructor.utils,n=t.append,i=t.errorHandle,r=t.sleep,l=t.inverseClass,a=e.player,u=e.events.proxy,o=e.template,c=o.$player,s=o.$video,y=n(c,'\n
\n ');i(Array.isArray(h),"Playlist is not an array type"),i(0').concat(t.title,"")}).join(""),u(d,"click",function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=f.length-1&&p(n)}),u(y,"click",function(t){t.target===y&&(y.style.display="none")}),e.on("video:ended",function(){v().then(function(){r(1e3).then(a.play)})}),e.on("afterAttachUrl",function(){var t=f.findIndex(function(t){return t.url===s.src}),n=Array.from(d.children)[t];-1!==t&&n&&l(n,"active")}),{name:"artplayerPluginPlaylist",show:function(){y.style.display="flex"},hide:function(){y.style.display="none"},next:function(){v()},prev:function(){!function(){var t=f.findIndex(function(t){return t.url===s.src});i(-1!==t,"Can't find Playlist item"),1===f.length?p(0):p(t-1==-1?f.length-1:t-1)}()}}}}});