import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qw="clpp.yospace.YospacePlugin",tw=class extends _.Pv{constructor(){super();this.a=null;this.g=new _.S(qw)}bg(){return this.a}onContentWillLoad(a,b){const c=this;return _.x(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.Ce)throw new _.I(_.G,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||rw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case rw:d=YospaceAdManagement.SessionVOD.create(e);
break a;case sw:d=YospaceAdManagement.SessionLive.create(e);break a;default:d=YospaceAdManagement.SessionDVRLive.create(e)}}d=yield d;e=d.getSessionState();if(e!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",e,"URL",b.url),new _.I(_.G,9,7003,"Yospace session failed to initialize.");a.trigger(new _.F(_.Kg,{detail:d}));b.url=d.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=d}})}onPlayerWillRelease(a){if(this.a){this.g.info("Shutting down Yospace session.");
const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.F(_.Jg,{detail:b}))}}id(){return"yospace"}};_.z(qw,tw);tw.prototype.getSession=tw.prototype.bg;tw.Id="yospace";_.Ir(new class{create(){return new tw}});var rw=_.Cb,sw="LIVE";_.z("clpp.yospace.StreamType",{VOD:rw,LIVE:sw,DVR:"DVR"});};f.call(g, window);