import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";const prestoPlaylistOverlayCss=":host{display:block;cursor:pointer}.playlist__overlay{color:#fff;position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.7);z-index:999}.playlist__overlay h2,.playlist__overlay p{margin:0;padding:0;line-height:1}.playlist__overlay h2{margin-bottom:0.4em}.playlist__overlay .playlist__overlay-wrap{top:0;position:absolute;padding:25px;left:0;display:grid;gap:1em}.playlist__overlay .playlist__overlay-buttons{display:flex;gap:13px}.playlist__overlay .playlist__overlay-buttons button{background:rgba(255, 255, 255, 0.8);border-radius:5px;padding:10px 12px;border:1px solid #ffffff;font-weight:500;font-size:13px;line-height:15px;display:flex;justify-content:space-between;align-items:center;gap:16px;cursor:pointer}.playlist__overlay .playlist__overlay-buttons button.previous{background-color:transparent;border:1px solid #ffffff;margin-right:10px;color:#ffffff}.playlist__overlay .playlist__overlay-buttons button.next{background:linear-gradient(to right, rgb(255, 255, 255) 50%, rgba(255, 255, 255, 0.8) 50%);background-size:200% 100%;background-position:right bottom}.playlist__overlay .playlist__overlay-buttons button.next.fill-button{transition:all var(--playlist-transition-duration, 5s) ease-out;background-position:left bottom}.playlist__overlay .playlist__overlay-buttons button.next.disabled{background-color:transparent;border:1px solid #ffffff;color:#ffffff;background:none}",PrestoPlaylistOverlay=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.rewatch=createEvent(this,"rewatch",7),this.next=createEvent(this,"next",7),this.transitionDuration=5,this.isLastItem=!1,this.animating=!1,this.show=!1}handleShow(){this.show&&!this.isLastItem?(setTimeout(()=>{this.animating=!0},200),this.timeout=setTimeout(()=>{this.show&&this.handleNext()},1e3*(this.transitionDuration||5)+200)):this.animating=!1}handleRewatch(){this.rewatch.emit()}handleNext(){this.next.emit()}disconnectedCallback(){clearTimeout(this.timeout)}handleAnimatingChange(t){t||clearTimeout(this.timeout)}render(){var t,i,e,o,l,n,a,s;if(!this.show)return h(Host,null,h("div",{style:{display:"none"}}));const r=(null===(i=null===(t=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===t?void 0:t.i18n)||void 0===i?void 0:i.upNext)||"Up Next",d=(null===(o=null===(e=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===e?void 0:e.i18n)||void 0===o?void 0:o.startOver)||"Start Over",p=(null===(n=null===(l=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===l?void 0:l.i18n)||void 0===n?void 0:n.rewatch)||"Rewatch",u=(null===(s=null===(a=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===a?void 0:a.i18n)||void 0===s?void 0:s.next)||"Next";return h("div",{class:"playlist__overlay",onClick:t=>{t.preventDefault(),t.stopImmediatePropagation(),this.animating=!1}},h("div",{class:"playlist__overlay-wrap"},this.isLastItem?h("p",null,d,":"):h("p",null,r,":"),h("h2",{style:{overflowX:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%",lineHeight:"1.3"}},this.nextItemTitle),h("div",{class:"playlist__overlay-buttons"},h("button",{class:"previous",onClick:()=>this.handleRewatch()},h("svg",{width:"15",height:"9",viewBox:"0 0 15 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{d:"M15 0V9L8 4.5L15 0Z",fill:"white"}),h("path",{d:"M7 0V9L0 4.5L7 0Z",fill:"white"})),p),h("button",{class:{next:!0,"fill-button":this.animating},onClick:t=>{t.preventDefault(),t.stopImmediatePropagation(),this.handleNext()}},h("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{d:"M0 0V12L9.5 6L0 0Z",fill:"black"})),this.isLastItem?d:u+" "+((null==this?void 0:this.nextItemString)||"Video")))))}static get watchers(){return{show:["handleShow"],animating:["handleAnimatingChange"]}}static get style(){return prestoPlaylistOverlayCss}},[257,"presto-playlist-overlay",{nextItemTitle:[1,"next-item-title"],nextItemString:[1,"next-item-string"],transitionDuration:[2,"transition-duration"],isLastItem:[4,"is-last-item"],show:[4],animating:[32]},void 0,{show:["handleShow"],animating:["handleAnimatingChange"]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["presto-playlist-overlay"].forEach(t=>{"presto-playlist-overlay"===t&&(customElements.get(t)||customElements.define(t,PrestoPlaylistOverlay))})}export{PrestoPlaylistOverlay as P,defineCustomElement as d};