!function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.Couppy=t(e)}("undefined"!=typeof global?global:this.window||this.global,function(e){"use strict";const t={},n=!!document.querySelector&&!!e.addEventListener;let a,r;const s=`js-${"Couppy".toLowerCase()}`,i={initClass:"js-Couppy",state:{active:!0,open:!1,cardActive:0,cardActiveDefault:0,submitTimeout:null,popupTriggerActive:!0,timerActive:!1,timerSuspended:!1,timerInterval:null},appearance:{style:1,popupTrigger:{classList:[]},main:{classList:[]},overlay:{classList:[]},popupContainer:{classList:[]},popup:{classList:["animated","lightSpeedIn"]},card:[{classList:["animated","emerge"]},{classList:["animated","emerge"]}],logo:{url:"",alt:""},pwdBy:{url:"",img:{url:"",alt:""}},images:{title:{title:"",url:""}}},data:{api:{url:"https://jsonplaceholder.typicode.com/posts",method:"get",params:{key:""},data:{}},promo:{value:5,suffix:"%",coupon:"couponcode"},timer:{value:300}},text:{popupTrigger:{first:"Coupon",second:"for you"},title:"Halloween sale",promo:"off",subtext:"use the code above during the checkout",link:{text:"Browse collection",target:"#"},inputs:{invalid:"Input value is invalid"},btn:{default:'<i class="far fa-envelope"></i>',sending:'<i class="fas fa-spinner"></i>',success:'<i class="fas fa-check"></i>'},footerText:{btn:{more:"More details",less:"Less details"},short:"Lorem ipsum",long:"Lorem ipsum dolor"},thankYou:{top:'<i class="fas fa-check"></i> Success',bottom:"We'll be in touch to provide you with the promo details."},timer:{title:"Our offer will be valid for 5 minutes only!"},api:{error:"API error"},paragraphs:[]},inputs:{templates:{field:{attributes:{},regex:""},agreement:{attributes:{}}},fields:[],agreements:[]},refs:{overlay:null,popupContainer:null,popup:null,card:[],img:{logo:null,pwdBy:null},btn:{close:null,submit:null,readmore:{open:null,close:null}},inputs:{fields:[],agreements:[]},errors:[],readmore:{short:null,long:null},timer:null,pwdBy:null},callbackOnInit:function(){},callbackBefore:function(){},callbackAfter:function(){},callbackOnOpen:function(){},callbackOnClose:function(){},callbackOnSubmit:function(){},callbackOnSendSuccess:function(){},callbackOnSendError:function(){},callbackOnSend:function(){},callbackOnTimerTick:function(){},callbackOnTimerUp:function(){}};t.Helpers=require("./modules/helpers.js");const o=function(e){const n=e.target;t.Helpers.getClosest(n,"[data-some-selector]")},c=function(e){t.open()},l=function(e){t.close()},d=function(e){e.stopPropagation()},p=function(e){if(e=e||window.event,a.state.open){let n=!1;(n="key"in e?"Escape"===e.key||"Esc"===e.key:27===e.keyCode)&&t.close()}},u=function(e){t.Helpers.copyToClipboard(a.data.promo.coupon),console.log("Copied "+a.data.promo.coupon+" to clipboard")},f=function(e){if(a.state.active){e.pageY<document.documentElement.scrollTop+10&&(console.log("Mouse out of document bounds (top)"),t.open())}},m=function(e){const t=a.inputs.fields[e.target.dataset.couppyFieldId];e.target.classList.remove(T("wrong")),w(t)},g=function(e){const t=a.inputs.fields[e.target.dataset.couppyFieldId];w(t),H(e.target.value,t.regex).valid?M(!0,e.target):M(!1,e.target)},v=function(e){const t=a.inputs.agreements[e.target.dataset.couppyAgreementId];e.target.classList.remove(T("wrong")),w(t,!0)},h=function(e){e.preventDefault(),"function"==typeof a.callbackOnSubmit&&a.callbackOnSubmit.call(this);let n={valid:!0,invalidElements:[]},r={valid:!0,invalidElements:[]};if(a.inputs.fields.forEach(function(e,t){if(e.attributes.required){const t=a.refs.inputs.fields[e.refId];H(t.input.value,e.regex,!1).valid||(n.valid=!1,n.invalidElements.push(e))}}),a.inputs.agreements.forEach(function(e,t){if(e.attributes.required){const t=a.refs.inputs.agreements[e.refId];H(t.input.checked,null,!0).valid||(r.valid=!1,r.invalidElements.push(e))}}),n.valid?console.log("%c Validation successful (fields)","color: #00ff00"):console.log("%c Validation failed (fields)","color: #ff0000"),r.valid?console.log("%c Validation successful (agreements)","color: #00ff00"):console.log("%c Validation failed (agreements)","color: #ff0000"),$(),n.valid&&r.valid){a.refs.btn.submit.innerHTML=a.text.btn.sending;let e={},n={},r={};for(const[e,t]of new FormData(a.refs.form).entries()){let n=t.replace(/-|\s/g,"");r[e]=n}switch(a.data.api.method.toLowerCase()){case"get":e=t.Helpers.mergeDeep(r,a.data.api.params);break;case"post":n=t.Helpers.mergeDeep(r,a.data.api.data)}Axios({url:a.data.api.url,method:a.data.api.method,params:e,data:n,headers:{"Content-type":"application/x-www-form-urlencoded"}}).then(function(e){if(console.log(e),200!==e.status||200!==e.data.code)return C(null,a.text.api.error),Promise.reject(a.text.api.error);switch(a.refs.form.reset(),a.appearance.style){case 2:t.cardToggle(1),a.refs.btn.submit.innerHTML=a.text.btn.success}clearTimeout(a.state.submitTimeout),a.state.submitTimeout=setTimeout(function(){t.reset({suspendTimer:!0,closePopup:!0})},5e3),"function"==typeof a.callbackOnSendSuccess&&a.callbackOnSendSuccess.call(this)}).catch(function(e){console.log(e),t.reset({preserveInput:!0}),"function"==typeof a.callbackOnSendError&&a.callbackOnSendError.call(this)}).then(function(){"function"==typeof a.callbackOnSend&&a.callbackOnSend.call(this)})}else a.refs.errors=[],n.invalidElements.forEach(function(e){C(e,void 0,!1)}),r.invalidElements.forEach(function(e){C(e,void 0,!0)})},b=function(e){a.refs.readmore.long.classList.remove("hidden"),a.refs.readmore.short.classList.add("hidden")},L=function(e){a.refs.readmore.long.classList.add("hidden"),a.refs.readmore.short.classList.remove("hidden")},y=function(e){a.refs.inputs.agreements[e.currentTarget.dataset.couppyAgreementId].div.classList.remove("hidden")},E=function(e){a.refs.inputs.agreements[e.currentTarget.dataset.couppyAgreementId].div.classList.add("hidden")},T=function(e){return e instanceof Array?(e.forEach(function(t,n){e[n]=`${s}__${e[n]}`}),console.log(e),k(e)):"string"==typeof e?`${s}__${e}`:""},k=function(e){if(e instanceof Array){let t="";return e.forEach(function(n,a){t+=n,t+=a<e.length-1?" ":""}),t}return"string"==typeof e?e:""},x=function(e){let t="";switch(e){case"promo":t=`${a.data.promo.value}${a.data.promo.suffix} ${a.text.promo}`}return t},$=function(){a.refs.inputs.fields.forEach(function(e){e.input.classList.remove(T("wrong"),T("right")),e.error&&e.error.remove()}),a.refs.inputs.agreements.forEach(function(e){e.input.classList.remove(T("wrong"),T("right")),e.error&&e.error.remove()}),a.refs.errors.forEach(function(e){e.remove()}),a.refs.errors=[]},C=function(e,t,n){const r=document.createElement("p");if(r.classList.add(T("tx-error"),"animated","appear"),r.innerHTML=void 0===t?e.text.invalid:t,null!=e){let t;(t=void 0!==n&&!0===n?a.refs.inputs.agreements[e.refId]:a.refs.inputs.fields[e.refId]).input.classList.add(T("wrong")),t.container.appendChild(r),t.error=r}else a.refs.form.appendChild(r);a.refs.errors.push(r)},w=function(e,t){if(null!=e){let n;(n=void 0!==t&&!0===t?a.refs.inputs.agreements[e.refId]:a.refs.inputs.fields[e.refId]).error&&n.error.remove()}};const H=function(e,t,n){let a={valid:!0};if(void 0!==n&&!0===n)a.valid=e;else if("string"==typeof t)try{new RegExp(t).test(e)?a.valid=!0:a.valid=!1}catch(e){console.log("%c Regex invalid","color: #ff0000")}else t instanceof Array&&(a.valid=!0,t.forEach(function(t,n){new RegExp(t).test(e)||(a.valid=!1)}));return a},M=function(e,t){switch(e){case!0:t.classList.remove(T("wrong"));break;case!1:t.classList.add(T("wrong"))}};return t.init=function(e){if(n){switch(t.destroy(),a=t.Helpers.mergeDeep(i,e||{}),t.initFieldTemplates(),document.documentElement.classList.add(a.initClass),t.renderHtml(a.appearance.style),a.state.open?t.open({callCallback:!1}):t.close({callCallback:!1}),t.popupTriggerToggle(a.state.popupTriggerActive),a.refs.overlay.addEventListener("click",l,!1),a.refs.popup.addEventListener("click",d,!1),a.refs.btn.close.addEventListener("click",l,!1),document.addEventListener("keydown",p,!1),document.addEventListener("mouseout",f,!1),a.appearance.style){case 1:a.refs.btn.copy.addEventListener("click",u,!1);break;case 2:a.refs.inputs.fields.forEach(function(e){e.input.addEventListener("blur",m,!1),e.input.addEventListener("input",g,!1),e.input.addEventListener("keypress",g,!1),e.input.addEventListener("keyup",g,!1),e.input.addEventListener("paste",g,!1)}),a.refs.inputs.agreements.forEach(function(e){e.input.addEventListener("change",v,!1)}),a.refs.form.addEventListener("submit",h,!1),a.refs.btn.readmore.open.addEventListener("click",b,!1),a.refs.btn.readmore.close.addEventListener("click",L,!1),a.refs.inputs.agreements.forEach(function(e,t){e.btn_readmore.addEventListener("click",y,!1),e.btn_readless.addEventListener("click",E,!1)}),t.timerToggle(a.state.timerActive)}a.refs.popupTrigger.addEventListener("click",c,!1),void 0!==window.Formatter&&a.inputs.fields.forEach(function(e){void 0!==e.pattern&&new Formatter(a.refs.inputs.fields[e.refId].input,{pattern:e.pattern,patterns:e.patterns,persistent:!1})}),console.log(a),"function"==typeof a.callbackOnInit&&a.callbackOnInit.call(this)}},t.destroy=function(){if(a){switch(document.documentElement.classList.remove(a.initClass),a.refs.overlay.removeEventListener("click",o,!1),a.refs.popup.removeEventListener("click",l,!1),a.refs.btn.close.removeEventListener("click",d,!1),document.removeEventListener("keydown",p,!1),document.removeEventListener("mouseout",f,!1),a.appearance.style){case 1:a.refs.btn.copy.removeEventListener("click",u,!1);break;case 2:a.refs.inputs.fields.forEach(function(e){e.input.removeEventListener("blur",m,!1),e.input.removeEventListener("input",g,!1),e.input.removeEventListener("keypress",g,!1),e.input.removeEventListener("keyup",g,!1),e.input.removeEventListener("paste",g,!1)}),a.refs.inputs.agreements.forEach(function(e){e.input.removeEventListener("change",v,!1)}),a.refs.form.removeEventListener("submit",h,!1),a.refs.btn.readmore.open.removeEventListener("click",b,!1),a.refs.btn.readmore.close.removeEventListener("click",L,!1),a.refs.inputs.agreements.forEach(function(e,t){e.btn_readmore.removeEventListener("click",y,!1),e.btn_readless.removeEventListener("click",E,!1)}),t.timerToggle(!1)}a.refs.popupTrigger.removeEventListener("click",c,!1),a.refs.main.remove(),a=null,r=null}},t.open=function(e){const n=t.Helpers.mergeDeep({callCallback:!0},e||{});document.documentElement.classList.add(T("overlay-hidden")),a.refs.overlay.classList.remove("hidden"),a.state.open=!0,clearTimeout(a.state.submitTimeout),t.reset({clearErrors:!0}),n.callCallback&&"function"==typeof a.callbackOnOpen&&a.callbackOnOpen.call(this)},t.close=function(e){const n=t.Helpers.mergeDeep({callCallback:!0},e||{});document.documentElement.classList.remove(T("overlay-hidden")),a.refs.overlay.classList.add("hidden"),a.state.open=!1,n.callCallback&&"function"==typeof a.callbackOnClose&&a.callbackOnClose.call(this)},t.cardToggle=function(e){a.refs.card.forEach(function(e,t){a.refs.card[t].classList.add(T("card--hidden"))}),void 0!==a.refs.card[e]&&a.refs.card[e].classList.remove(T("card--hidden"))},t.popupTriggerToggle=function(e){e?(a.state.popupTriggerActive=!0,a.refs.popupTrigger.classList.remove("hidden")):(a.state.popupTriggerActive=!1,a.refs.popupTrigger.classList.add("hidden"))},t.activeToggle=function(e,n){const r=t.Helpers.mergeDeep({autoClose:!0},n||{});e?a.state.active=!0:(a.state.active=!1,r.autoClose&&t.close())},t.reset=function(e){const n=t.Helpers.mergeDeep({preserveInput:!1,clearErrors:!1,suspendTimer:!1,closePopup:!1},e||{});switch(t.cardToggle(a.state.cardActiveDefault),a.appearance.style){case 2:a.refs.btn.submit.innerHTML=a.text.btn.default,L(),n.preserveInput||a.refs.form.reset(),n.clearErrors&&$(),n.suspendTimer&&t.timerSuspend(!0),n.closePopup&&t.close()}},t.refreshTimerHTML=function(){const e=Math.floor(a.data.timer.value/60),t=a.data.timer.value-60*e;let n=0,r=0;if(0!==t){const e=Math.floor(Math.log10(t));if(0===e)n=0,r=Math.floor(t/Math.pow(10,e));else{n=Math.floor(t/Math.pow(10,e));const a=Math.pow(10,Math.floor(Math.log(t)/Math.log(10))-1),s=Math.floor(t/a);r=s-10*Math.floor(s/10)}}const s=`\n        <span class="${T("tx-timer-box")}">${e}</span>:<span class="${T("tx-timer-box")}">${n}</span><span class="${T("tx-timer-box")}">${r}</span>\n        `;return"function"==typeof a.callbackOnTimerTick&&a.callbackOnTimerTick.call(this),s},t.timerToggle=function(e){if(a.state.timerSuspended)return;const n=!!e;n?a.state.timerActive||(a.state.timerInterval=setInterval(function(){a.data.timer.value>0?a.data.timer.value--:(clearInterval(a.state.timerInterval),"function"==typeof a.callbackOnTimerUp&&a.callbackOnTimerUp.call(this)),a.refs.timer.innerHTML=t.refreshTimerHTML()},1e3)):clearInterval(a.state.timerInterval),a.state.timerActive=n},t.timerSuspend=function(e){const n=!!e;n&&t.timerToggle(!1),a.state.timerSuspended=n},t.timerValue=function(){return void 0!==a?a.data.timer.value:null},t.setCookie=function(e,t,n){!function(e,t,n){let a="";if(n){const e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),a="; expires="+e.toUTCString()}document.cookie=e+"="+(t||"")+a+"; path=/"}(e,t,n)},t.getCookie=function(e){return function(e){const t=e+"=",n=document.cookie.split(";");for(let e=0;e<n.length;e++){const a=n[e];for(;" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t))return a.substring(t.length,a.length)}return null}(e)},t.eraseCookie=function(e){!function(e,t,n){document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(n?"; domain="+n:"")+(t?"; path="+t:"")}(e)},t.initFieldTemplates=function(){a.inputs.fields.forEach(function(e,n){a.inputs.fields[n]=t.Helpers.mergeDeep({attributes:{id:T(`field-${n}`),name:T(`field-${n}`),type:"text",value:"",placeholder:"000-000-000",title:"Input field",required:!0},regex:["(?<!\\w)(\\(?(\\+|00)?48\\)?)?[ -]?\\d{3}[ -]?\\d{3}[ -]?\\d{3}(?!\\w)"],text:{invalid:a.text.inputs.invalid}},a.inputs.fields[n]||{})}),a.inputs.agreements.forEach(function(e,n){a.inputs.agreements[n]=t.Helpers.mergeDeep({attributes:{id:T(`agreement-${n}`),name:T(`agreement-${n}`),type:"checkbox",value:1,title:"Agreement",required:!1},text:{short:"Agreement label",long:"",readmore:"",readless:"",invalid:a.text.inputs.invalid}},a.inputs.agreements[n]||{})})},t.renderHtml=function(e){switch(e){case 1:t.renderHtml_Style1();break;case 2:t.renderHtml_Style2();break;case 3:t.renderHtml_Style3()}t.renderHtml_TriggerButton(),t.cardToggle(a.state.cardActive)},t.renderHtml_TriggerButton=function(){const e=document.createElement("div");e.classList.add(...[T("popup-trigger")].concat(a.appearance.popupTrigger.classList)),a.refs.popupTrigger=a.refs.main.appendChild(e);e.innerHTML=`\n            <div class="${T("popup-trigger__body")}">\n                <div class="${T("popup-trigger__body__section")}">\n                    <p>${a.text.popupTrigger.first}</p>\n                </div>\n                <div class="${T("popup-trigger__body__section")}">\n                    <p>${a.text.popupTrigger.second}</p>\n                </div>\n            </div>\n            `},t.renderHtml_Style1=function(){const e=document.body,t=document.createElement("div");t.classList.add(...[s,`couppy-${a.appearance.style}`].concat(a.appearance.main.classList)),a.refs.main=e.appendChild(t);const n=document.createElement("div");n.classList.add(...[T("overlay")].concat(a.appearance.overlay.classList)),n.innerHTML="\n            ",a.refs.overlay=t.appendChild(n);const r=document.createElement("div");r.classList.add(...[T("popup-container")].concat(a.appearance.popupContainer.classList)),r.innerHTML="\n            ",a.refs.popupContainer=n.appendChild(r);const i=document.createElement("div");i.classList.add(...[T("popup")].concat(a.appearance.popup.classList)),i.innerHTML="\n            ",a.refs.popup=r.appendChild(i);const o=document.createElement("span");o.classList.add(T("btn-close")),o.setAttribute("role","button"),o.innerHTML='\n            <i class="fas fa-times"></i>\n            ',a.refs.btn.close=i.appendChild(o);const c=document.createElement("div");c.classList.add(...[T("card")].concat(a.appearance.card[0].classList)),c.innerHTML=`\n            <div class="${T("c-body")}">\n                <h1 class="${k([T("tx-title"),T("sp-bold")])}">${a.text.title}</h1>\n                <p class="${T("tx-title")}"><span class="${k([T("sp-super"),T("sp-highlight")])}">${x("promo")}</span></p>\n                <p class="${T("tx-code")}">${a.data.promo.coupon}</p>\n                <p class="${T("tx-subtext")}"><span class="${T("btn-copy")}" role="button"><i class="far fa-copy"></i></span>${a.text.subtext}</p>\n            </div>\n            \n            <div class="${T("c-footer")}">\n                <p><a href="${a.text.link.target}" class="${T("tx-link")}">${a.text.link.text} <i class="fas fa-arrow-right"></i></a></p>\n            </div>\n           `,a.refs.card[0]=i.appendChild(c),a.refs.btn.copy=c.querySelector("."+T("btn-copy"))},t.renderHtml_Style2=function(){const e=document.body,n=document.createElement("div");n.classList.add(...[s,`couppy-${a.appearance.style}`].concat(a.appearance.main.classList)),a.refs.main=e.appendChild(n);const r=document.createElement("div");r.classList.add(...[T("overlay")].concat(a.appearance.overlay.classList)),r.innerHTML="\n            ",a.refs.overlay=n.appendChild(r);const i=document.createElement("div");i.classList.add(...[T("popup-container")].concat(a.appearance.popupContainer.classList)),i.innerHTML="\n            ",a.refs.popupContainer=r.appendChild(i);const o=document.createElement("div");o.classList.add(...[T("popup")].concat(a.appearance.popup.classList)),o.innerHTML="\n            ",a.refs.popup=i.appendChild(o);const c=document.createElement("span");c.classList.add(T("btn-close")),c.setAttribute("role","button"),c.innerHTML='\n            <i class="fas fa-times"></i>\n            ',a.refs.btn.close=o.appendChild(c);const l=document.createElement("img");l.classList.add(T("img-logo")),l.setAttribute("src",a.appearance.logo.url),l.setAttribute("alt",a.appearance.logo.alt),a.refs.img.logo=o.appendChild(l);const d=document.createElement("div");d.classList.add(...[T("card")].concat(a.appearance.card[0].classList)),d.innerHTML=function(){let e="";a.text.title&&(e=`\n                <h1 class="${k([T("tx-title"),T("sp-bold")])}">${a.text.title}</h1>\n                `);let n="";a.text.promo&&(n=`\n                <p class="${T("tx-title")}"><span class="${k([T("sp-super"),T("sp-highlight")])}">${x("promo")}</span></p>\n                `);let r="";return a.appearance.timer&&(r=`\n                <p class="${k([T("sp-bold")])}">${a.text.timer.title}</p>\n                <p class="${T("tx-timer")}">${t.refreshTimerHTML()}</p>\n                `),`\n            <div class="${T("c-body")}">\n                ${e}\n                ${n}\n                ${r}\n                <form class="${T("form")}" novalidate></form>\n            </div>\n            \n            <div class="${T("c-footer")}">\n                <div class="${k([T("readmore"),"animated","emerge","hidden"])}">\n                    <p>${a.text.footerText.long} <a class="${T("btn-readmore--close")}" href="javascript:void(0)">${a.text.footerText.btn.less}</a></p>\n                </div>\n                <p class="${k([T("tx-footer-txt"),"animated","emerge"])}">${a.text.footerText.short} <a class="${T("btn-readmore")}" href="javascript:void(0)">${a.text.footerText.btn.more}</a></p>\n            </div>\n           `}(),a.refs.card[0]=o.appendChild(d);const p=document.createElement("div");p.classList.add(...[T("card")].concat(a.appearance.card[1].classList)),p.innerHTML=`\n            <div class="${T("c-body")}">\n                <p class="${k([T("tx-title"),T("sp-highlight"),T("sp-bold")])}">${a.text.thankYou.top}</p>\n                <p class="${T("tx-title")}">${a.text.thankYou.bottom}</p>\n            </div>\n           `,a.refs.card[1]=o.appendChild(p),a.refs.form=d.querySelector("."+T("form")),a.inputs.fields.forEach(function(e,t){const n=document.createElement("div");n.classList.add(T("fld"),T("fld--field"));const r=document.createElement("input");r.classList.add(T("in"),T("in--block")),r.setAttribute("data-couppy-field-id",t.toString());for(const t in e.attributes)e.attributes.hasOwnProperty(t)&&r.setAttribute(t,e.attributes[t]);n.appendChild(r),a.refs.form.appendChild(n),a.refs.inputs.fields.push({container:n,input:r,error:null}),a.inputs.fields[t].refId=a.refs.inputs.fields.length-1}),a.inputs.agreements.forEach(function(e,t){const n=document.createElement("div");n.classList.add(T("fld"),T("fld--agreement"));const r=document.createElement("label");r.classList.add(T("label"),T("label--chk")),r.setAttribute("for",T(`agreement-${t.toString()}`));const s=document.createElement("input");s.classList.add(T("chk")),s.setAttribute("data-couppy-agreement-id",t.toString());for(const t in e.attributes)e.attributes.hasOwnProperty(t)&&s.setAttribute(t,e.attributes[t]);n.appendChild(s),n.appendChild(r);let i={container:n,input:s,error:null};if(e.text.long.length){const a=document.createElement("a");a.setAttribute("href","javascript:void(0)"),a.setAttribute("class",T("btn-agreement-readmore")),a.setAttribute("data-couppy-agreement-id",t.toString()),a.innerHTML=e.text.readmore,r.innerHTML=e.text.short,r.appendChild(a);const s=document.createElement("a");s.setAttribute("href","javascript:void(0)"),s.setAttribute("class",T("btn-agreement-readmore--close")),s.setAttribute("data-couppy-agreement-id",t.toString()),s.innerHTML=e.text.readless;const o=document.createElement("div");o.classList.add(T("agreement-div"),"animated","emerge","hidden");const c=document.createElement("p");c.innerHTML=e.text.long,c.appendChild(s),o.appendChild(c),n.appendChild(o),i.div=o,i.btn_readmore=a,i.btn_readless=s}else r.innerHTML=e.text.short;a.refs.form.appendChild(n),a.refs.inputs.agreements.push(i),a.inputs.agreements[t].refId=a.refs.inputs.agreements.length-1});const u=document.createElement("button");u.classList.add(T("btn-submit"),T("btn-submit--block")),u.setAttribute("type","submit"),u.innerHTML=`\n            ${a.text.btn.default}\n            `,a.refs.btn.submit=a.refs.form.appendChild(u),a.refs.btn.readmore.open=d.querySelector("."+T("btn-readmore")),a.refs.btn.readmore.close=d.querySelector("."+T("btn-readmore--close")),a.refs.readmore.short=d.querySelector("."+T("tx-footer-txt")),a.refs.readmore.long=d.querySelector("."+T("readmore")),a.refs.timer=d.querySelector("."+T("tx-timer"));const f=document.createElement("div");f.classList.add(T("pwd-by")),f.innerHTML=`\n            <p class="${T("tx-pwd-by")}">Powered by</p>\n            <a href="${a.appearance.pwdBy.url}" target="_blank" rel="nofollow"><img src="${a.appearance.pwdBy.img.url}" class="${T("img-pwd-by")}" alt="${a.appearance.pwdBy.img.alt}" /></a>\n           `,a.refs.pwdBy=i.appendChild(f),a.refs.img.pwdBy=f.querySelector("."+T("img-pwd-by"))},t.renderHtml_Style3=function(){const e=document.body,n=document.createElement("div");n.classList.add(...[s,`couppy-${a.appearance.style}`].concat(a.appearance.main.classList)),a.refs.main=e.appendChild(n);const r=document.createElement("div");r.classList.add(...[T("overlay")].concat(a.appearance.overlay.classList)),r.innerHTML="\n            ",a.refs.overlay=n.appendChild(r);const i=document.createElement("div");i.classList.add(...[T("popup-container")].concat(a.appearance.popupContainer.classList)),i.innerHTML="\n            ",a.refs.popupContainer=r.appendChild(i);const o=document.createElement("div");o.classList.add(...[T("popup")].concat(a.appearance.popup.classList)),o.innerHTML="\n            ",a.refs.popup=i.appendChild(o);const c=document.createElement("span");c.classList.add(T("btn-close")),c.setAttribute("role","button"),c.innerHTML='\n            <i class="fas fa-times"></i>\n            ',a.refs.btn.close=o.appendChild(c);const l=document.createElement("div");l.classList.add(...[T("card")].concat(a.appearance.card[0].classList)),l.innerHTML=function(){let e=`\n            <img class="${k([T("img-title")])}" src="${a.appearance.images.title.url}" alt="${a.appearance.images.title.alt}" />\n            `,n="";a.text.title&&(n=`\n                <h1 class="${k([T("tx-title")])}">${a.text.title}</h1>\n                `);let r="";return a.text.paragraphs&&t.Helpers.forEach(a.text.paragraphs,function(e,t){r+=`\n                    <p class="${k([T("tx-p")])}">${e}</p>\n                    `}),`\n            <div class="${T("c-body")}">\n                ${e}\n                ${n}\n                ${r}\n            </div>\n            \n            <div class="${T("c-footer")}">\n                \n            </div>\n           `}(),a.refs.card[0]=o.appendChild(l);const d=document.createElement("div");d.classList.add(T("pwd-by")),d.innerHTML=`\n            <p class="${T("tx-pwd-by")}">${a.appearance.pwdBy.text}</p>\n            <a href="${a.appearance.pwdBy.url}" target="_blank" rel="nofollow"><img src="${a.appearance.pwdBy.img.url}" class="${T("img-pwd-by")}" alt="${a.appearance.pwdBy.img.alt}" /></a>\n           `,a.refs.pwdBy=i.appendChild(d),a.refs.img.pwdBy=d.querySelector("."+T("img-pwd-by"))},t});