(()=>{"use strict";var e,t={6347(){},58(e,t){Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.widgets=new Map}static load(){(new r).init()}init(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>this.setup()):this.setup()}setup(){const e=document.querySelectorAll(".cf-turnstile");if(0!==e.length){if(void 0!==window.turnstile)this.renderAll(e);else{const t=()=>{void 0!==window.turnstile?this.renderAll(e):setTimeout(t,100)};t()}jQuery(document).on("updated_checkout",()=>this.onCheckoutUpdate())}}renderAll(e){e.forEach(e=>{this.renderWidget(e)})}renderWidget(e){if(this.widgets.has(e))return;const t={sitekey:e.dataset.sitekey||"",theme:e.dataset.theme||"light",size:e.dataset.size||"normal",callback:t=>this.onSuccess(t,e),"error-callback":()=>this.onError(e)},r=window.turnstile.render(e,t);this.widgets.set(e,r)}onSuccess(e,t){this.setToken(e,t),this.hideError(t)}onError(e){this.setToken("",e),this.showError(e)}setToken(e,t){const r=t.closest("form")||document.querySelector("form.checkout, form#order_review, form.woocommerce-form");if(!r)return;const o="cf-turnstile-response";let s=r.querySelector(`input[name="${o}"]`);s||(s=document.createElement("input"),s.type="hidden",s.name=o,r.appendChild(s)),s.value=e}showError(e){var t;const r=null===(t=e.parentElement)||void 0===t?void 0:t.querySelector(".cfw-turnstile-error");r&&(r.style.display="block")}hideError(e){var t;const r=null===(t=e.parentElement)||void 0===t?void 0:t.querySelector(".cfw-turnstile-error");r&&(r.style.display="none")}onCheckoutUpdate(){setTimeout(()=>{document.querySelectorAll(".cf-turnstile").forEach(e=>{const t=e;this.widgets.has(t)||this.renderWidget(t)})},100)}reset(){this.widgets.forEach(e=>{window.turnstile.reset(e)})}resetWidget(e){const t=this.widgets.get(e);t&&window.turnstile.reset(t)}}t.default=r},8463(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),o(r(58)).default.load()}},r={};function o(e){var s=r[e];if(void 0!==s)return s.exports;var i=r[e]={exports:{}};return t[e].call(i.exports,i,i.exports,o),i.exports}o.m=t,e=[],o.O=(t,r,s,i)=>{if(!r){var n=1/0;for(u=0;u<e.length;u++){for(var[r,s,i]=e[u],l=!0,c=0;c<r.length;c++)(!1&i||n>=i)&&Object.keys(o.O).every(e=>o.O[e](r[c]))?r.splice(c--,1):(l=!1,i<n&&(n=i));if(l){e.splice(u--,1);var d=s();void 0!==d&&(t=d)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[r,s,i]},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={213:0,704:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var s,i,[n,l,c]=r,d=0;if(n.some(t=>0!==e[t])){for(s in l)o.o(l,s)&&(o.m[s]=l[s]);if(c)var u=c(o)}for(t&&t(r);d<n.length;d++)i=n[d],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(u)},r=globalThis.webpackChunkcheckout_for_woocommerce=globalThis.webpackChunkcheckout_for_woocommerce||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),o.O(void 0,[704],()=>o(8463));var s=o.O(void 0,[704],()=>o(6347));s=o.O(s)})();