import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var oX=class extends _.Pv{constructor(){super();this.a=this.m=null;this.l=this.f=this.j=!1;this.o=new _.Ht(()=>{this.m.play().catch(()=>{})});this.h=new _.Nt}onPlayerCreated(a){this.m=a;this.a=a.getSurface().getMedia()}onContentWillLoad(){this.a&&(this.h.on(this.a,"webkitplaybacktargetavailabilitychanged",this.w.bind(this)),this.h.on(this.a,"webkitcurrentplaybacktargetiswirelesschanged",this.A.bind(this)))}onPlayerWillRelease(){this.o.stop();this.h.release()}id(){return"airplay"}w(a){switch(a.availability){case "available":this.f=
!0;break;case "not-available":this.f=!1}this.m.trigger(new _.F(_.rc,{canCast:this.f}))}A(){const a=(this.j=this.a.webkitCurrentPlaybackTargetIsWireless)?_.qc:_.pc;if(this.l||!this.m.isPaused()||this.m.getState()===_.Wo)this.l?this.m.play().catch(()=>{}):this.o.ka(.01);this.m.trigger(new _.F(a))}Mb(){return this.j}we(){return this.f}Ci(){this.f&&(this.l=!this.m.isPaused(),this.a.webkitShowPlaybackTargetPicker())}};_.z("clpp.airplay.AirPlayPlugin",oX);oX.prototype.showCastMenu=oX.prototype.Ci;
oX.prototype.canCast=oX.prototype.we;oX.prototype.isCasting=oX.prototype.Mb;oX.Id="airplay";_.Ir(new class{create(){return new oX}});};f.call(g, window);