(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(e,n){for(var r=0;r<n.length;r++){var a=n[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(i=a.key,o=void 0,o=function(e,n){if("object"!==t(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,n||"default");if("object"!==t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(i,"string"),"symbol"===t(o)?o:String(o)),a)}var i,o}var a=new(function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.formSelector="form, div.fl-login-form, section.cwginstock-subscribe-form, div.sdm_download_item",this.submitButtonSelector='*[type="submit"]:not(.quform-default-submit), #check_config, a.fl-button span, button[type="button"].ff-btn, a.et_pb_newsletter_button.et_pb_button, .forminator-button-submit, .frm_button_submit, a.sdm_download',this.foundForms=[],this.params=null,this.callback=this.callback.bind(this),this.validate=this.validate.bind(this)}var n,a,i;return n=t,(a=[{key:"generateID",value:function(){var t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return t()+"-"+t()+"-"+t()+"-"+t()}},{key:"getFoundFormById",value:function(t){return this.foundForms.filter((function(e){return t===e.hCaptchaId}))[0]}},{key:"getWidgetId",value:function(t){return t.getElementsByClassName("h-captcha")[0].getElementsByTagName("iframe")[0].dataset.hcaptchaWidgetId}},{key:"reset",value:function(t){hcaptcha.reset(this.getWidgetId(t))}},{key:"isSameOrDescendant",value:function(t,e){for(var n=e;n;){if(n===t)return!0;n=n.parentElement}return!1}},{key:"validate",value:function(t){var e=t.currentTarget.closest(this.formSelector),n=this.getFoundFormById(e.dataset.hCaptchaId).submitButtonElement;this.isSameOrDescendant(n,t.target)&&(t.preventDefault(),t.stopPropagation(),this.currentForm={formElement:e,submitButtonElement:n},hcaptcha.execute(this.getWidgetId(e)))}},{key:"getForms",value:function(){return e(document.querySelectorAll(this.formSelector))}},{key:"getParams",value:function(){if(null!==this.params)return this.params;var t;try{t=JSON.parse(HCaptchaMainObject.params)}catch(e){t={}}return t.callback=this.callback,t}},{key:"setParams",value:function(t){this.params=t}},{key:"callback",value:function(t){document.dispatchEvent(new CustomEvent("hCaptchaSubmitted",{detail:{token:t}})),"invisible"===this.getParams().size&&this.submit()}},{key:"bindEvents",value:function(){var t=this;"undefined"!=typeof hcaptcha&&this.getForms().map((function(e){var n=e.querySelector(".h-captcha");if(null===n)return e;if(null!==n.querySelector("iframe"))return e;if(n.classList.contains("hcaptcha-widget-id"))return e;if(hcaptcha.render(n,t.getParams()),"invisible"!==n.dataset.size)return e;var r=e.querySelectorAll(t.submitButtonSelector)[0];if(!r)return e;var a=t.generateID();return t.foundForms.push({hCaptchaId:a,submitButtonElement:r}),e.dataset.hCaptchaId=a,r.addEventListener("click",t.validate,!0),e}))}},{key:"submit",value:function(){var t=this.currentForm.formElement,e=this.currentForm.submitButtonElement,n=e.getAttribute("type");if(n=n?n.toLowerCase():"","form"!==t.tagName.toLowerCase()||"submit"!==n)return e.removeEventListener("click",this.validate,!0),void e.click();t.requestSubmit?t.requestSubmit(e):t.submit()}}])&&r(n.prototype,a),i&&r(n,i),Object.defineProperty(n,"prototype",{writable:!1}),t}());window.hCaptcha=a,window.hCaptchaGetWidgetId=function(t){a.getWidgetId(t)},window.hCaptchaReset=function(t){a.reset(t)},window.hCaptchaBindEvents=function(){a.bindEvents()},window.hCaptchaSubmit=function(){a.submit()},window.hCaptchaOnLoad=function(){window.hCaptchaBindEvents(),document.dispatchEvent(new CustomEvent("hCaptchaLoaded"))}})();