import{h}from"@stencil/core";import fitText from"../../../../../library/fittext.js";export class EmailOverlayUI{constructor(){this.headline=void 0,this.bottomText=void 0,this.buttonText=void 0,this.allowSkip=void 0,this.borderRadius=void 0,this.isLoading=void 0,this.errorMessage=void 0,this.direction=void 0,this.i18n=void 0,this.provider=void 0,this.type=void 0,this.email=void 0,this.isAudioProvider=void 0}handleSubmit(e){this.submitForm.emit({email:this.email}),e.preventDefault()}componentDidLoad(){let e=this.type||this.provider;this.isAudioProvider="audio"===e,fitText(this.textInput,3,{maxFontSize:this.isAudioProvider?15:20,minFontSize:8})}handleChange(e){this.email=e.target.value}render(){var e,t,i,r;return h("div",{class:"overlay "+("rtl"===this.direction?"rtl":""),ref:e=>this.textInput=e},h("div",{class:"content"},h("h1",{class:this.isAudioProvider&&"is-small"},this.headline||(null===(e=null==this?void 0:this.i18n)||void 0===e?void 0:e.emailDefaultHeadline)),this.isLoading?h("presto-player-spinner",null):h("form",{onSubmit:e=>this.handleSubmit(e)},h("input",{type:"email",placeholder:null===(t=null==this?void 0:this.i18n)||void 0===t?void 0:t.emailPlaceholder,value:this.email,onInput:e=>this.handleChange(e),required:!0}),h("button",{type:"submit"},this.buttonText||(null===(i=null==this?void 0:this.i18n)||void 0===i?void 0:i.play))),this.errorMessage&&h("p",{class:"error"},this.errorMessage),this.bottomText&&h("p",{innerHTML:this.bottomText,class:this.isAudioProvider&&"is-small"}),!!this.allowSkip&&h("div",{class:"skip",onClick:()=>{this.skip.emit()}},null===(r=null==this?void 0:this.i18n)||void 0===r?void 0:r.skip," →")))}static get is(){return"presto-email-overlay-ui"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["presto-email-overlay-ui.scss"]}}static get styleUrls(){return{$:["presto-email-overlay-ui.css"]}}static get properties(){return{headline:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Props"},attribute:"headline",reflect:!1},bottomText:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"bottom-text",reflect:!1},buttonText:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"button-text",reflect:!1},allowSkip:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"allow-skip",reflect:!1},borderRadius:{type:"number",mutable:!1,complexType:{original:"number",resolved:"number",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"border-radius",reflect:!1},isLoading:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"is-loading",reflect:!1},errorMessage:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"error-message",reflect:!1},direction:{type:"string",mutable:!1,complexType:{original:"'rtl'",resolved:'"rtl"',references:{}},required:!1,optional:!0,docs:{tags:[],text:""},attribute:"direction",reflect:!1},i18n:{type:"unknown",mutable:!1,complexType:{original:"i18nConfig",resolved:"i18nConfig",references:{i18nConfig:{location:"import",path:"../../../../../interfaces"}}},required:!1,optional:!1,docs:{tags:[],text:""}},provider:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"provider",reflect:!1},type:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"type",reflect:!1}}}static get states(){return{email:{},isAudioProvider:{}}}static get events(){return[{method:"submitForm",name:"submitForm",bubbles:!0,cancelable:!0,composed:!0,docs:{tags:[],text:"Events"},complexType:{original:"object",resolved:"object",references:{}}},{method:"skip",name:"skip",bubbles:!0,cancelable:!0,composed:!0,docs:{tags:[],text:""},complexType:{original:"object",resolved:"object",references:{}}}]}}