OwlCyberSecurity - MANAGER
Edit File: presto-action-bar-controller2.js
import{proxyCustomElement,HTMLElement,createEvent,h}from"@stencil/core/internal/client";import{t as timePassed}from"./util.js";import{d as defineCustomElement$3}from"./presto-action-bar-ui2.js";import{d as defineCustomElement$2}from"./presto-player-button2.js";import{d as defineCustomElement$1}from"./presto-youtube-subscribe-button2.js";const prestoActionBarControllerCss=":host{display:block}",PrestoActionBarControllerStyle0=":host{display:block}",PrestoActionBar=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.actionBarStateChange=createEvent(this,"actionBarStateChange",7),this.ended=void 0,this.config=void 0,this.currentTime=void 0,this.duration=void 0,this.direction=void 0,this.youtube=void 0,this.show=!1,this.youtubeRenderKey=1,this.percentagePassed=0}componentWillLoad(){this.handleDuration()}handleDuration(){this.handleTime()}handleEnded(t){var e;if(t){if(100!==(null===(e=null==this?void 0:this.config)||void 0===e?void 0:e.percentage_start))return;this.show=!0}}handlePercentagePassed(){this.percentagePassed=this.currentTime/this.duration*100}handleTime(){this.checkTime()}checkTime(){var t,e;(null===(t=null===window||void 0===window?void 0:window.wp)||void 0===t?void 0:t.blocks)?this.show=!0:this.show=timePassed({current:this.currentTime,duration:this.duration,showAfter:null===(e=this.config)||void 0===e?void 0:e.percentage_start})}handleButtonCountChange(t,e){(null==t?void 0:t.button_count)!==(null==e?void 0:e.button_count)&&this.youtubeRenderKey++,(null==t?void 0:t.enabled)&&this.handleDuration()}youtubeButton(){var t,e,o,n;if("youtube"===(null===(t=this.config)||void 0===t?void 0:t.button_type)&&(null===(e=this.youtube)||void 0===e?void 0:e.channelId))return h("presto-youtube-subscribe-button",{key:this.youtubeRenderKey,channel:null===(o=this.youtube)||void 0===o?void 0:o.channelId,showCount:null===(n=this.config)||void 0===n?void 0:n.button_count})}customButton(){var t,e,o,n,i,s,r,a,u,d,l;if("custom"===(null===(t=this.config)||void 0===t?void 0:t.button_type))return h("presto-player-button",{type:"primary",size:"small",href:null===(o=null===(e=this.config)||void 0===e?void 0:e.button_link)||void 0===o?void 0:o.url,target:(null===(i=null===(n=this.config)||void 0===n?void 0:n.button_link)||void 0===i?void 0:i.opensInNewTab)?"_blank":"_self",style:Object.assign(Object.assign({"--presto-player-button-border-radius":`${null===(s=this.config)||void 0===s?void 0:s.button_radius}px`},(null===(r=this.config)||void 0===r?void 0:r.button_color)?{"--presto-player-button-color":`${null===(a=this.config)||void 0===a?void 0:a.button_color}`}:{}),(null===(u=this.config)||void 0===u?void 0:u.button_text_color)?{"--presto-player-button-text":`${null===(d=this.config)||void 0===d?void 0:d.button_text_color}`}:{})},null===(l=this.config)||void 0===l?void 0:l.button_text)}handleCtaStateChange(t){this.actionBarStateChange.emit(t)}render(){var t,e;return h("presto-action-bar-ui",{key:"843046d7ae74eb23df6f6bafa018987c12f61df7",open:this.show,style:{"--presto-action-bar-background":(null===(t=this.config)||void 0===t?void 0:t.background_color)||"#1d1d1d"}},null===(e=this.config)||void 0===e?void 0:e.text,h("div",{key:"3dd88ff01aeb1df74303758c5b640d29e48fe1a2",slot:"button"},this.youtubeButton(),this.customButton()))}get el(){return this}static get watchers(){return{duration:["handleDuration","handlePercentagePassed"],ended:["handleEnded"],currentTime:["handlePercentagePassed","handleTime"],config:["handleButtonCountChange"],show:["handleCtaStateChange"]}}static get style(){return":host{display:block}"}},[1,"presto-action-bar-controller",{ended:[4],config:[16],currentTime:[514,"current-time"],duration:[514],direction:[1],youtube:[16],show:[32],youtubeRenderKey:[32],percentagePassed:[32]},void 0,{duration:["handleDuration","handlePercentagePassed"],ended:["handleEnded"],currentTime:["handlePercentagePassed","handleTime"],config:["handleButtonCountChange"],show:["handleCtaStateChange"]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["presto-action-bar-controller","presto-action-bar-ui","presto-player-button","presto-youtube-subscribe-button"].forEach((t=>{switch(t){case"presto-action-bar-controller":customElements.get(t)||customElements.define(t,PrestoActionBar);break;case"presto-action-bar-ui":customElements.get(t)||defineCustomElement$3();break;case"presto-player-button":customElements.get(t)||defineCustomElement$2();break;case"presto-youtube-subscribe-button":customElements.get(t)||defineCustomElement$1()}}))}export{PrestoActionBar as P,defineCustomElement as d};