(function(){var g={}; var _ = _ || {}
var f=function(window){var VB=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.mm.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Fa.bind(this)},WB=function(a){a.trigger(new _.K(_.tf))},XB=function(a,b){return 0<=b&&b<a.a.length};_.w(VB,_.mm);_.r=VB.prototype;_.r.on=function(a,b,c){return _.mm.prototype.on.call(this,a,b,c)};_.r.one=function(a,b,c){return _.mm.prototype.one.call(this,a,b,c)};_.r.off=function(a,b){return _.mm.prototype.off.call(this,a,b)};_.r.getPosition=function(){return this.f};
_.r.am=function(){return this.a};_.r.ge=function(){return 0<this.a.length&&XB(this,this.f)?this.a[this.f]:null};_.r.cm=function(){var a=this.f+1;return 0<this.a.length&&XB(this,a)?this.a[a]:null};_.r.vm=function(){return this.h};_.r.start=function(){this.h||(this.h=!0,this.m.on(_.he,this.j),this.cf(this.f,!0))};_.r.stop=function(){this.h=!1;this.m.off(_.he,this.j)};_.r.Fa=function(){this.next()};
_.r.next=function(){var a=this,b;return _.H(function(c){b=Math.min(a.a.length-1,a.f+1);return _.x(c,a.cf(b),0)})};_.r.Zn=function(){var a=this,b;return _.H(function(c){b=Math.max(0,a.f-1);return _.x(c,a.cf(b),0)})};_.r.cf=function(a,b){b=void 0===b?!1:b;var c=this,d;return _.H(function(e){if(1==e.a){if(!(0<c.a.length&&XB(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.ge())?_.x(e,c.l(d),3):e.D(0)}if(4!=e.a)return _.x(e,c.m.load(d.configuration),4);c.trigger(new _.K(_.sf,{item:d}));_.y(e)})};
_.r.append=function(a){this.a.push(a);WB(this)};_.r.pm=function(a,b){if(0<=b&&b<=this.a.length){var c=this.ge();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));WB(this)}};_.r.remove=function(a){if(0<this.a.length&&XB(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);WB(this)}};_.r.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;WB(this)};_.I("clpp.Playlist",VB);VB.prototype.clear=VB.prototype.clear;VB.prototype.remove=VB.prototype.remove;
VB.prototype.insert=VB.prototype.pm;VB.prototype.append=VB.prototype.append;VB.prototype.goTo=VB.prototype.cf;VB.prototype.previous=VB.prototype.Zn;VB.prototype.next=VB.prototype.next;VB.prototype.onEnded=VB.prototype.Fa;VB.prototype.stop=VB.prototype.stop;VB.prototype.start=VB.prototype.start;VB.prototype.isStarted=VB.prototype.vm;VB.prototype.getUpcoming=VB.prototype.cm;VB.prototype.getCurrent=VB.prototype.ge;VB.prototype.getQueue=VB.prototype.am;VB.prototype.getPosition=VB.prototype.getPosition;
VB.prototype.off=VB.prototype.off;VB.prototype.one=VB.prototype.one;VB.prototype.on=VB.prototype.on;};
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
else{_=this.clpp._;(f.call(g,this));}
})();