(()=>{"use strict";const{applyFilters:t}=JetPlugins.hooks,e=function(e){var n;if(e.parent)return;const o=e.getInput("_captcha_token"),r=e.getSubmit().getFormId(),s=o?.nodes?.[0]?.parentElement;let i=null!==(n=window?.JetFormBuilderCaptchaConfig?.[r])&&void 0!==n&&n;if(!s||!i)return;o.isVisible=()=>!0,i.callback=t=>{o?.nodes?.length&&o.nodes.forEach(e=>{e&&"_captcha_token"===e.name&&(e.value=t)}),o.value.current=t},i=t("jet.fb.turnstile.options",i,e);const a=window.turnstile.render(s,i);e.getSubmit().submitter?.status?.watch?.(()=>{window.turnstile.reset(a),o?.nodes?.length&&o.nodes.forEach(t=>{t&&"_captcha_token"===t.name&&(t.value="")}),o.onClear()})};window.jfbTurnstileOnLoad=function(){const{addAction:t}=JetPlugins.hooks;for(const t of Object.values(window.JetFormBuilder))t.hasOwnProperty("isObserved")&&e(t);t("jet.fb.observe.after","jet-form-builder/turnstile",e)}})();