((t,i,e)=>{"use strict";function s(s){const a=s.tfClass("themify_captcha_field")[0];if(s.tfOn("submit",(async n=>{if(n.preventDefault(),!s.classList.contains("tb_waiting")){const c=s.querySelector('button[name="tb_submit"]'),o=s.tfClass("tb_signup_errors")[0],r=s.tfClass("tb_signup_success")[0],l=async()=>{const a=new FormData(s);a.append("action","tb_signup_process");const n=await t.fetch(a);if(!n.success)throw Error(n.data);if(r&&(r.style.display="block"),s.dataset.redirect!==e){const t=new URL(""===s.dataset.redirect?i.location.href:s.dataset.redirect);t.searchParams.set("user_id",n.data.user_id),i.location.href=""+t}};c.disabled=!0,o.replaceChildren(),r&&(r.style.display="none"),s.classList.add("tb_waiting");try{if("v3"===a?.dataset.ver&&i.grecaptcha!==e){const t=await new Promise(((t,e)=>{i.grecaptcha.ready((()=>{i.grecaptcha.execute(a.dataset.sitekey,{action:"captcha"}).then(t).catch(e)}))})),e=document.createElement("input");e.type="hidden",e.name="g-recaptcha-response",e.value=t,s.prepend(e)}await l()}catch(n){o.innerHTML=n.message||s.dataset.genericError}c.disabled=!1,s.classList.remove("tb_waiting")}})),a)if(a.classList.contains("h-captcha"))i.hcaptcha===e&&t.loadJs("https://js.hcaptcha.com/1/api.js?recaptchacompat=off",null,!1);else if(a.classList.contains("turnstile"))i.turnstile===e&&t.loadJs("https://challenges.cloudflare.com/turnstile/v0/api.js",null,!1).then((()=>{turnstile.render(a,{sitekey:a.dataset.sitekey})}));else if(i.grecaptcha===e){let i="https://www.google.com/recaptcha/api.js";"v3"===a.dataset.ver&&(i+="?render="+a.dataset.sitekey),t.loadJs(i,null,!1)}}t.on("builder_load_module_partial",((i,e)=>{if(!0!==e||i.classList.contains("module-signup-form"))for(let e=t.selectWithParent("tb_signup_form",i),a=e.length-1;a>-1;--a)s(e[a])}))})(Themify,window,void 0);