!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MyLibrary=t():e.MyLibrary=t()}(self,(function(){return function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var c=0,a=Array(t);c<t;c++)a[c]=e[c];return a}function t(t,c){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var c=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=c){var a,n,r,o,i=[],l=!0,u=!1;try{if(r=(c=c.call(e)).next,0===t){if(Object(c)!==c)return;l=!1}else for(;!(l=(a=r.call(c)).done)&&(i.push(a.value),i.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=c.return&&(o=c.return(),Object(o)!==o))return}finally{if(u)throw n}}return i}}(t,c)||function(t,c){if(t){if("string"==typeof t)return e(t,c);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?e(t,c):void 0}}(t,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var c=window.React,a=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"captcha-block/captcha-block","version":"1.0.0","title":"Captcha Block","category":"woocommerce","parent":["woocommerce/checkout-totals-block"],"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"textdomain":"checkout-block-example","editorScript":"file:./build/wcbfc_captcha-block-frontend.js"}'),n=window.wp.i18n,r=window.wp.element,o=window.wc.blocksCheckout;return(0,wc.blocksCheckout.registerCheckoutBlock)({metadata:a,component:function(e){var a=e.checkoutExtensionData,i=t((0,r.useState)(""),2),l=i[0],u=i[1],s=a.setExtensionData,p=t((0,r.useState)(!1),2),f=p[0],d=p[1];return(0,r.useEffect)((function(){var e=wcbfc_captcha_ajax.wcbfc_captcha_key,t=wcbfc_captcha_ajax.wcbfc_recaptcha_status;if(e&&"1"===t){var c=function(){f||(window.grecaptcha.render("recaptcha-container",{sitekey:wcbfc_captcha_ajax.wcbfc_captcha_key,callback:function(e){u(e)},"expired-callback":function(){u("")}}),d(!0))};!function(){if(void 0===window.grecaptcha){var e=document.createElement("script");e.src="https://www.google.com/recaptcha/api.js",e.async=!0,e.onload=c,document.body.appendChild(e)}else c()}()}else console.warn("reCAPTCHA is disabled or site key is missing.")}),[l,f]),(0,r.useEffect)((function(){s("checkout-captcha-block","checkout_captcha",l)}),[l]),(0,c.createElement)("div",null,(0,c.createElement)("div",{id:"recaptcha-container",className:"g-recaptcha",style:{marginBottom:"-15px",marginTop:"15px"}}),(0,c.createElement)(o.ValidatedTextInput,{id:"captcha_check",type:"text",required:!0,value:l?"1":"",onChange:function(e){u(e)},className:"hidden-captcha-input",disabled:!1,style:{display:"none"},errorMessage:(0,n.__)("Please complete the reCAPTCHA.","captcha-block")}))}}),{}}()}));