OwlCyberSecurity - MANAGER
Edit File: presto-playlist.js
import{proxyCustomElement,HTMLElement,h}from"@stencil/core/internal/client";import{d as defineCustomElement$u}from"./presto-action-bar2.js";import{d as defineCustomElement$t}from"./presto-action-bar-controller2.js";import{d as defineCustomElement$s}from"./presto-action-bar-ui2.js";import{d as defineCustomElement$r}from"./presto-audio2.js";import{d as defineCustomElement$q}from"./presto-bunny2.js";import{d as defineCustomElement$p}from"./presto-business-skin2.js";import{d as defineCustomElement$o}from"./presto-cta-overlay2.js";import{d as defineCustomElement$n}from"./presto-cta-overlay-controller2.js";import{d as defineCustomElement$m}from"./presto-cta-overlay-ui2.js";import{d as defineCustomElement$l}from"./presto-dynamic-overlay-ui2.js";import{d as defineCustomElement$k}from"./presto-dynamic-overlays2.js";import{d as defineCustomElement$j}from"./presto-email-overlay2.js";import{d as defineCustomElement$i}from"./presto-email-overlay-controller2.js";import{d as defineCustomElement$h}from"./presto-email-overlay-ui2.js";import{d as defineCustomElement$g}from"./presto-modern-skin2.js";import{d as defineCustomElement$f}from"./presto-muted-overlay2.js";import{d as defineCustomElement$e}from"./presto-player2.js";import{d as defineCustomElement$d}from"./presto-player-button2.js";import{d as defineCustomElement$c}from"./presto-spinner.js";import{d as defineCustomElement$b}from"./presto-playlist-item2.js";import{d as defineCustomElement$a}from"./presto-playlist-overlay2.js";import{d as defineCustomElement$9}from"./presto-playlist-ui2.js";import{d as defineCustomElement$8}from"./presto-search-bar2.js";import{d as defineCustomElement$7}from"./presto-search-bar-ui2.js";import{d as defineCustomElement$6}from"./presto-stacked-skin2.js";import{d as defineCustomElement$5}from"./presto-video2.js";import{d as defineCustomElement$4}from"./presto-vimeo2.js";import{d as defineCustomElement$3}from"./presto-youtube2.js";import{d as defineCustomElement$2}from"./presto-youtube-subscribe-button2.js";const prestoPlaylistCss=":host{display:block;overflow:hidden}presto-player{opacity:0;visibility:hidden;transition:0.35s opacity, 0.35s visibility}presto-player.ready{opacity:1;visibility:visible}",PrestoPlaylistStyle0=prestoPlaylistCss,PrestoPlaylist$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.items=void 0,this.heading=void 0,this.listTextSingular=void 0,this.listTextPlural=void 0,this.transitionDuration=5,this.currentPlaylistItem=void 0,this.currentPlyr=void 0,this.playing=!1}rewatch(){this.handlePlay()}next(){this.handleNext()}handleCurrentPlay(e,t){var s;e&&(this.addOverlay(),this.currentPlyr.elements.container.getRootNode().host.style=this.currentPlaylistItem.config.styles,void 0!==t&&("youtube"===this.currentPlyr.provider&&!this.currentPlyr.muted&&(null===(s=this.currentPlyr)||void 0===s?void 0:s.embed)&&this.currentPlyr.embed.unMute(),this.currentPlyr.play()))}addOverlay(){var e,t;this.overlay=document.createElement("presto-playlist-overlay"),this.overlay.nextItemTitle=this.getNextItemTitle(),this.overlay.isLastItem=this.isLastItem(),this.overlay.nextItemString=(null==this?void 0:this.listTextSingular)||"Video",this.overlay.transitionDuration=this.transitionDuration,null===(t=null===(e=this.currentPlyr.elements)||void 0===e?void 0:e.container)||void 0===t||t.closest(".presto-player__wrapper").append(this.overlay)}componentWillLoad(){var e;this.currentPlaylistItem=(null===(e=null==this?void 0:this.items)||void 0===e?void 0:e[0])||null}handleItemClick(e){this.overlay&&(this.overlay.show=!1),this.el.style.height=this.el.offsetHeight+"px",this.el.style.width=this.el.offsetWidth+"px",this.currentPlaylistItem=e}handleNext(){this.overlay.show=!1,this.currentPlaylistItem=this.getNextItem()||this.currentPlaylistItem}handlePlay(){this.overlay&&(this.overlay.show=!1),this.currentPlyr.play()}handlePause(){this.overlay.show=!1,this.currentPlyr.pause()}getNextItem(){var e,t,s,i;if(this.isLastItem())return this.items[0];let o;for(let l=0;l<(null===(e=this.items)||void 0===e?void 0:e.length);l++)if((null===(t=this.items[l])||void 0===t?void 0:t.id)===(null===(s=this.currentPlaylistItem)||void 0===s?void 0:s.id)&&(null===(i=this.items)||void 0===i?void 0:i.length)!==l+1){o=this.items[l+1];break}return o}isLastItem(){var e,t,s;const i=(null===(e=this.items)||void 0===e?void 0:e.length)-1;return(null===(t=this.items[i])||void 0===t?void 0:t.id)===(null===(s=this.currentPlaylistItem)||void 0===s?void 0:s.id)}getNextItemTitle(){var e;const t=this.getNextItem();return void 0!==t?(null==t?void 0:t.title)||(null===(e=null==t?void 0:t.config)||void 0===e?void 0:e.title):""}render(){var e,t,s,i,o,l,r,n,a;if(!(null===(e=this.items)||void 0===e?void 0:e.length))return"";const m=this.listTextSingular?this.listTextSingular:"Video",u=this.listTextPlural?this.listTextPlural:"Videos";return h("presto-playlist-ui",null,(null===(t=this.currentPlaylistItem.config)||void 0===t?void 0:t.src)?h("presto-player",Object.assign({slot:"preview",src:null===(s=this.currentPlaylistItem.config)||void 0===s?void 0:s.src},this.currentPlaylistItem.config,{video_id:null===(i=this.currentPlaylistItem.config)||void 0===i?void 0:i.id,id:`presto-player-${null===(o=this.currentPlaylistItem.config)||void 0===o?void 0:o.id}`,"media-title":null===(l=this.currentPlaylistItem.config)||void 0===l?void 0:l.title,class:null===(r=this.currentPlaylistItem.config)||void 0===r?void 0:r.playerClass,key:null===(n=this.currentPlaylistItem.config)||void 0===n?void 0:n.id,provider:null===(a=this.currentPlaylistItem.config)||void 0===a?void 0:a.provider,onPlayerReady:e=>{this.currentPlyr=e.detail,this.el.style.height=null,this.el.style.width=null},onPlayedMedia:()=>this.playing=!0,onPausedMedia:()=>this.playing=!1,onEndedMedia:()=>this.overlay.show=!0})):h("slot",{name:"unauthorized",slot:"preview"}),h("div",{slot:"title"},this.heading||"Playlist"),h("div",{slot:"count"},this.items.length," ",this.items.length>1?u:m),this.items.map((e=>{var t,s,i,o;return h("presto-playlist-item",{slot:"list",onClick:()=>this.handleItemClick(e),active:(null===(t=this.currentPlaylistItem)||void 0===t?void 0:t.id)===(null==e?void 0:e.id),playing:(null===(s=this.currentPlaylistItem)||void 0===s?void 0:s.id)===(null==e?void 0:e.id)&&this.playing,class:(null===(i=this.currentPlaylistItem)||void 0===i?void 0:i.id)===(null==e?void 0:e.id)?"active":"",key:null==e?void 0:e.id,onTriggerPause:()=>this.handlePause(),onTriggerPlay:()=>this.handlePlay()},h("span",{slot:"item-title"},h("span",null,(null==e?void 0:e.title)||(null===(o=null==e?void 0:e.config)||void 0===o?void 0:o.title))),h("span",{slot:"item-duration"},h("span",null,null==e?void 0:e.duration)))})))}get el(){return this}static get watchers(){return{currentPlyr:["handleCurrentPlay"]}}static get style(){return PrestoPlaylistStyle0}},[1,"presto-playlist",{items:[16],heading:[1],listTextSingular:[1,"list-text-singular"],listTextPlural:[1,"list-text-plural"],transitionDuration:[2,"transition-duration"],currentPlaylistItem:[32],currentPlyr:[32],playing:[32]},[[0,"rewatch","rewatch"],[0,"next","next"]],{currentPlyr:["handleCurrentPlay"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["presto-playlist","presto-action-bar","presto-action-bar-controller","presto-action-bar-ui","presto-audio","presto-bunny","presto-business-skin","presto-cta-overlay","presto-cta-overlay-controller","presto-cta-overlay-ui","presto-dynamic-overlay-ui","presto-dynamic-overlays","presto-email-overlay","presto-email-overlay-controller","presto-email-overlay-ui","presto-modern-skin","presto-muted-overlay","presto-player","presto-player-button","presto-player-spinner","presto-playlist-item","presto-playlist-overlay","presto-playlist-ui","presto-search-bar","presto-search-bar-ui","presto-stacked-skin","presto-video","presto-vimeo","presto-youtube","presto-youtube-subscribe-button"].forEach((e=>{switch(e){case"presto-playlist":customElements.get(e)||customElements.define(e,PrestoPlaylist$1);break;case"presto-action-bar":customElements.get(e)||defineCustomElement$u();break;case"presto-action-bar-controller":customElements.get(e)||defineCustomElement$t();break;case"presto-action-bar-ui":customElements.get(e)||defineCustomElement$s();break;case"presto-audio":customElements.get(e)||defineCustomElement$r();break;case"presto-bunny":customElements.get(e)||defineCustomElement$q();break;case"presto-business-skin":customElements.get(e)||defineCustomElement$p();break;case"presto-cta-overlay":customElements.get(e)||defineCustomElement$o();break;case"presto-cta-overlay-controller":customElements.get(e)||defineCustomElement$n();break;case"presto-cta-overlay-ui":customElements.get(e)||defineCustomElement$m();break;case"presto-dynamic-overlay-ui":customElements.get(e)||defineCustomElement$l();break;case"presto-dynamic-overlays":customElements.get(e)||defineCustomElement$k();break;case"presto-email-overlay":customElements.get(e)||defineCustomElement$j();break;case"presto-email-overlay-controller":customElements.get(e)||defineCustomElement$i();break;case"presto-email-overlay-ui":customElements.get(e)||defineCustomElement$h();break;case"presto-modern-skin":customElements.get(e)||defineCustomElement$g();break;case"presto-muted-overlay":customElements.get(e)||defineCustomElement$f();break;case"presto-player":customElements.get(e)||defineCustomElement$e();break;case"presto-player-button":customElements.get(e)||defineCustomElement$d();break;case"presto-player-spinner":customElements.get(e)||defineCustomElement$c();break;case"presto-playlist-item":customElements.get(e)||defineCustomElement$b();break;case"presto-playlist-overlay":customElements.get(e)||defineCustomElement$a();break;case"presto-playlist-ui":customElements.get(e)||defineCustomElement$9();break;case"presto-search-bar":customElements.get(e)||defineCustomElement$8();break;case"presto-search-bar-ui":customElements.get(e)||defineCustomElement$7();break;case"presto-stacked-skin":customElements.get(e)||defineCustomElement$6();break;case"presto-video":customElements.get(e)||defineCustomElement$5();break;case"presto-vimeo":customElements.get(e)||defineCustomElement$4();break;case"presto-youtube":customElements.get(e)||defineCustomElement$3();break;case"presto-youtube-subscribe-button":customElements.get(e)||defineCustomElement$2()}}))}const PrestoPlaylist=PrestoPlaylist$1,defineCustomElement=defineCustomElement$1;export{PrestoPlaylist,defineCustomElement};