(()=>{"use strict";class t{static setCommonConstants(){this.script=document.currentScript,this.loadedCss=[],this.loadedJs=[]}static addCSS(t,e,i=!1,s=null){if(void 0===this.loadedCss&&(this.loadedCss=[]),!t||-1!==this.loadedCss.indexOf(t))return e?e():null;let r=document.createElement("link");return r.type="text/css",r.rel="stylesheet",r.href=t,i&&window!==window.parent&&this.isCrossDomainIframe()?window.parent.document.head.appendChild(r):document.head.appendChild(r),document.head.appendChild(r),"function"==typeof e&&r.addEventListener("load",e),"function"==typeof s&&r.addEventListener("error",s),this.loadedCss.push(t)}static addJS(t,e,i=!1){if(void 0===this.loadedJs&&(this.loadedJs=[]),!t||-1!==this.loadedJs.indexOf(t))return e?e():null;let s=document.createElement("script");return s.type="text/javascript",s.src=t,i&&window!==window.parent&&this.isCrossDomainIframe()?window.parent.document.head.appendChild(s):document.head.appendChild(s),e&&s.addEventListener("load",e),this.loadedJs.push(t)}static openWindow(t){let e=document.createElement("a");return e.href=t,e.target="_blank",e.rel="noopener noreferrer nofollow",e.click()}static getScriptSelector(t){return'[src*=".trustindex."][src*="'+t+'.js"],[data-src*=".trustindex."][data-src*="'+t+'.js"]'}static getScriptKey(t){let e=t.getAttribute("data-src")||t.getAttribute("src"),i=e.replace(/.+\?([^&]+)/,"$1");return i&&i!==e&&-1===i.indexOf("=")?i:null}static getCDNUrl(){if(void 0!==this.cdnUrl&&this.cdnUrl)return this.cdnUrl;let t=sessionStorage.getItem("ti-cdn-url");if(t)return t;let e="https://cdn.trustindex.io/";if(this.script&&this.script.src){let t=this.script.src.split("/");t.pop(),e=t.join("/")+"/"}return-1===e.indexOf("trustindex.")&&(e="https://cdn.trustindex.io/"),this.cdnUrl=e,this.isAdminUrl()||sessionStorage.setItem("ti-cdn-url",e),e}static getWidgetUrl(t){return void 0===t?null:this.getCDNUrl()+"widgets/"+t.substring(0,2)+"/"+t+"/"}static getDecodedHtml(t){let e=document.createElement("textarea");return e.innerHTML=t,e.value}static getRelativeTime(t,e){let i=e.split("|"),s=i.shift(),r=i.shift(),a=[86400,604800,2419200,31536e3],n=(new Date).getTime()/1e3-t;for(let t=a.length-1;t>=0;t--)if(n>=a[t]){let e=Math.floor(n/a[t]),r=2*t;return e>1&&r++,s.replace("%d",e).replace("%s",i[r])}return r}static getDevicePixelRatio(){let t=1;return void 0!==window.screen.systemXDPI&&void 0!==window.screen.logicalXDPI&&window.screen.systemXDPI>window.screen.logicalXDPI?t=window.screen.systemXDPI/window.screen.logicalXDPI:void 0!==window.devicePixelRatio&&(t=window.devicePixelRatio),Math.min(t,2)}static getDefaultAvatarUrl(){let t=Math.floor(10*Math.random())+1;return this.getCDNUrl()+"assets/default-avatar/noprofile-"+(t<10?"0":"")+t+".svg"}static getPageLanguage(){return(document.documentElement.lang||"en").substr(0,2).toLowerCase()}static getUserLanguage(){return(navigator.language||navigator.userLanguage||this.getPageLanguage()).substr(0,2).toLowerCase()}static isAdminUrl(t){let e=t?new URL(t):location;return/(admin|test)\.trustindex/.test(e.hostname)&&-1===e.href.indexOf("test/widget.html")}static isAdminEditUrl(t){return void 0===t&&(t=location.href),-1!==t.indexOf("widget/edit")}static isCrossDomainIframe(){if(window.parent===window)return!1;try{let t=new URL(window.parent.location);return t.protocol!==location.protocol||t.hostname!==location.hostname||t.port!==location.port}catch(t){return null}}static isMobileDevice(){return this.isAdminUrl()&&!this.isAdminEditUrl()?!!document.querySelector(".widget-editor.mobile"):/mobi/i.test(navigator.userAgent||navigator.vendor||window.opera)}static isWebpSupported(t){if(void 0!==this.cacheWebpSupported)return t(this.cacheWebpSupported);let e=e=>(this.cacheWebpSupported=e,t(e)),i=new Image;i.onload=()=>e(i.width>0&&i.height>0),i.onerror=()=>e(!1),i.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}static isDarkMode(){var t,e;return!!(null==(e=null==(t=null==window?void 0:window.matchMedia)?void 0:t.call(window,"(prefers-color-scheme:dark)"))?void 0:e.matches)}static waitForVisibility(t,e,i=0){if(t.offsetWidth>0)return i?setTimeout(e,i):e();new ResizeObserver((function(t){t[0].target.offsetWidth>0&&(e(),this.disconnect())})).observe(t)}static isInLoadTriggerZone(t,e=600){let i=t.getBoundingClientRect();return i.right<=(window.innerWidth||document.documentElement.clientWidth)+e&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)+e}}class e extends t{static setConstants(){this.setCommonConstants(),this.certificateId=74,this.availableLanguages=["af","ar","az","bg","bn","bs","cs","cy","da","de","el","en","es","et","fa","fi","fr","gd","gl","he","hi","hr","hu","hy","id","is","it","ja","ka","kk","ko","lt","mk","ms","nl","no","pl","pt","ro","ru","sk","sl","sq","sr","sv","th","tr","uk","vi","zh"],this.allowOnDomains=["unbounce.com","unbouncepreview.com","trustindex.io","trustindex.test","trustindex.hu"]}static loadWidgetsFromDom(){document.querySelectorAll(this.getScriptSelector("loader-cert")).forEach((t=>{if(t.getAttribute("data-ti-widget-inited"))return;t.setAttribute("data-ti-widget-inited",!0);let e=this.getScriptKey(t);e&&(t.key=e,new TrustindexCertificateWidget(null,t))}))}}class i{constructor(t,e=null){this.classes=[],t&&(this.getWidget(t),(new TrustindexCertificateTranslate).translate(t,(()=>{this.addEvents()}))),e&&this.load(e),window.tiCertWidgetInstances.push(this)}getWidget(t){t.setAttribute("data-trustindex-widget",!0),t.layoutId=t.getAttribute("data-layout-id"),t.layoutCategory=t.getAttribute("data-layout-category"),t.setId=t.getAttribute("data-set-id"),t.pid=t.getAttribute("data-pid")||"wp-widget",t.language=t.getAttribute("data-language")||"en",t.domains=t.domains||{},"page"===t.language?t.language=TrustindexCertificate.getPageLanguage():"user"===t.language&&(t.language=TrustindexCertificate.getUserLanguage()),t.layoutId&&(t.layoutId=parseInt(t.layoutId)),t.insertedElements=[],this.widget=t}load(t){return e=this,i=null,s=function*(){let e=document.createElement("div");t.after(e),t.remove();let i=yield fetch(TrustindexCertificate.getWidgetUrl(t.key)+"content.html");if(!i.ok)return e.innerHTML='Widget not found! Probably it is already deleted or there is typo in its ID. We suggest that you log in to the Trustindex system and follow the widget configuration instructions. Or, if you don\'t have an account, create one for free at www.trustindex.io';let s=yield i.text();if(!s)return e.replaceWith(document.createComment("Trustindex widget ("+t.key+") is empty here."));let r=(new DOMParser).parseFromString(s,"text/html"),a=r.querySelector(".ti-widget"),n=r.querySelector('script[type="application/ld+json"]');if(n){let t=JSON.parse(n.innerHTML);a.domains=t.domains||t}this.getWidget(a),(new TrustindexCertificateTranslate).translate(a,(()=>{if(window!==window.parent&&TrustindexCertificate.isCrossDomainIframe()?(e.remove(),""===window.document.body.innerText.trim()&&(frameElement.style.display="none"),this.isCertificate()?window.parent.document.body.appendChild(a):frameElement.after(a)):this.isCertificate()?(e.remove(),window.parent.document.body.appendChild(a)):e.replaceWith(a),!a.layoutId)return a.innerHTML="Layout id or container not found!";r.body.querySelectorAll("*:not(script)").forEach((t=>{a.after(t),a.insertedElements.push(t)})),a.toggleHide();let t=TrustindexCertificate.getCDNUrl()+"assets/widget-presetted-css/"+a.layoutId+"-"+a.setId+".css";TrustindexCertificate.addCSS(t,(()=>this.show()))}))},new Promise(((t,r)=>{var a=t=>{try{o(s.next(t))}catch(t){r(t)}},n=t=>{try{o(s.throw(t))}catch(t){r(t)}},o=e=>e.done?t(e.value):Promise.resolve(e.value).then(a,n);o((s=s.apply(e,i)).next())}));var e,i,s}show(){if(this.widget.getAttribute("data-is-valid")&&this.widget.getAttribute("data-domain")&&parseInt(this.widget.getAttribute("data-is-valid"))){let t=this.widget.getAttribute("data-validation")?this.widget.getAttribute("data-validation").split(","):[],e=[],i=window;window!==window.parent&&(i=window.parent);let s=!1,r=i.location.href.toLowerCase();-1!==r.indexOf(this.widget.getAttribute("data-domain").toLowerCase().replace("www.",""))&&(s=!0);for(let t in this.widget.domains)if(-1!==r.indexOf(t.toLowerCase().replace("www.",""))){this.widget.querySelectorAll(".ti-field-domain").forEach((e=>e.innerHTML=t)),this.widget.querySelector(".ti-field-phone").innerHTML=this.widget.domains[t].phone,""!==this.widget.domains[t].phone?this.widget.querySelector(".ti-field-phone").closest(".ti-table-row").style.display="":this.widget.querySelector(".ti-field-phone").closest(".ti-table-row").style.display="none",this.widget.querySelector(".ti-field-email").innerHTML=this.widget.domains[t].email,this.widget.querySelector(".ti-field-company-name").innerHTML=this.widget.domains[t].name;let e=this.widget.querySelector(".ti-header-link a");if(e){let i=e.getAttribute("href").replace(/(?:(domain=)\w{2}|(\/domain\/)\w{2})/,"$1$2"+t);i===e.getAttribute("href")&&(-1===i.indexOf("?")?i+="?":i+="&",i+="domain="+t),e.setAttribute("href",i)}break}if(!s)for(let t=0;t{-1!==s.indexOf(t.replace("http://","https://"))&&(e=!0)})),e?this.destroy():setTimeout((()=>{this.widget.toggleShow(),this.setTooltipPosition(),this.addEvents(),this.isCertificate()&&setTimeout((()=>{this.widget.classList.add("ti-widget-appeared"),this.widget.classList.add("ti-widget-appeared-animation"),setTimeout((()=>this.widget.classList.remove("ti-widget-appeared-animation")),3e3)}),1e3*parseInt(this.widget.getAttribute("data-badge-delay"))+10)}),50)}}else this.destroy()}addEvents(){if(this.isCertificate()){this.widget.addEventListener("click",(t=>{if(t.target.matches(".ti-accordion-item .ti-accordion-header")){t.preventDefault();let e=t.target.closest(".ti-accordion-item"),i=e.classList.contains("ti-active");if(e.closest(".ti-accordion").querySelectorAll(".ti-accordion-item").forEach((t=>{t.querySelector(".ti-accordion-body").setAttribute("style",""),t.classList.remove("ti-active")})),!i){let t=e.querySelector(".ti-accordion-body");t.style.transition="unset",t.style.maxHeight="100000px";let i=t.offsetHeight;t.style.maxHeight="0",setTimeout((()=>{t.style.transition="",t.style.maxHeight=i+"px"}),1),e.classList.add("ti-active")}}t.target.matches(".ti-clickable-expand")&&(t.preventDefault(),this.widget.classList.contains("ti-modal-opened")?this.widget.classList.remove("ti-modal-opened"):(this.widget.classList.add("ti-modal-opened"),setTimeout((()=>this.widget.querySelector(".ti-modal-inner").style.height=this.widget.querySelector(".ti-modal-inner").offsetHeight+"px"),100))),(t.target.matches(".ti-modal-close")||t.target.matches(".ti-modal-container"))&&(t.preventDefault(),this.widget.classList.remove("ti-modal-opened"))}),!1);let t=this.widget.querySelector(".ti-sticky-button");if(t&&(t.classList.contains("ti-position-left-vertical")||t.classList.contains("ti-position-right-vertical"))){let t=window.innerWidth-document.documentElement.clientWidth;this.widget.style.setProperty("--ti-scrollbar-width",t+"px"),setInterval((()=>{let e=window.innerWidth-document.documentElement.clientWidth;t!==e&&(t=e,this.widget.style.setProperty("--ti-scrollbar-width",t+"px"))}),300)}}}setTooltipPosition(){let t=this.widget.querySelector(".ti-tooltip");if(t){t.style.display="block";let e=this.widget.querySelector(".ti-trust-badge").getBoundingClientRect(),i=t.getBoundingClientRect();t.style.display="";let s=e.left+window.scrollX,r=e.top+window.scrollY,a=i.height+25,n=(i.width-e.width)/2+25,o=r>a,d=s>n,l=s+e.width+nt.remove())),this.widget.remove()}}class s{constructor(){}translate(t,e){if("en"!==t.language&&"undefined"==typeof TrustindexCertificateTranslations)return TrustindexCertificate.addJS(TrustindexCertificate.getCDNUrl()+"assets/js/cert-translations.js",(()=>this.translate(t,e)));"undefined"!=typeof TrustindexCertificateTranslations&&void 0===TrustindexCertificateTranslations[t.language]&&(t.language="en"),t.querySelectorAll(".ti-to-translate").forEach((e=>{let i=e.innerHTML.trim(),s=this.getTranslation(i,t.language);if(e.getAttribute("data-strip-tags")){let t=document.createElement("div");t.innerHTML=s,s=t.innerText,e.removeAttribute("data-strip-tags")}let r=e.getAttribute("data-params")||"";r&&(r.split(";").forEach((e=>{let i=e.split(":"),r=i[1];void 0!==i[2]&&i[2]&&(r=this.getTranslation(r,t.language)),s=s.replace(new RegExp(i[0],"g"),r)})),e.removeAttribute("data-params")),e.getAttribute("data-ucfirst")&&(s=s[0].toUpperCase()+s.slice(1),e.removeAttribute("data-ucfirst")),e.innerHTML=s,e.classList.remove("ti-to-translate"),e.classList.contains("ti-translate-remove-child")&&e.replaceWith(s),0===e.classList.length&&e.removeAttribute("class")})),e&&e()}getTranslation(t,e){if("undefined"==typeof TrustindexCertificateTranslations)return t;let i=TrustindexCertificateTranslations.en.indexOf(t);return-1===i&&(i=TrustindexCertificateTranslations.en.indexOf(t.replace(/( [^=]+)=""/g,"$1"))),TrustindexCertificateTranslations[e][i]||t}}Element.prototype.toggleShow=function(t){this.style.display=t||""},Element.prototype.toggleHide=function(){this.style.display="none"},void 0===window.TrustindexCertificateWidget&&(window.tiCertWidgetInstances=[],window.TrustindexCertificate=e,window.TrustindexCertificateWidget=i,window.TrustindexCertificateTranslate=s,e.setConstants()),e.loadWidgetsFromDom()})()
;