Changeset 3434984
- Timestamp:
- 01/08/2026 09:24:27 AM (3 months ago)
- Location:
- hcaptcha-for-forms-and-more
- Files:
-
- 18 edited
- 1 copied
-
tags/4.21.1 (copied) (copied from hcaptcha-for-forms-and-more/trunk)
-
tags/4.21.1/assets/js/apps/hcaptcha.js (modified) (1 diff)
-
tags/4.21.1/assets/js/hcaptcha-cf7.js (modified) (1 diff)
-
tags/4.21.1/assets/js/hcaptcha-cf7.min.js (modified) (1 diff)
-
tags/4.21.1/changelog.txt (modified) (1 diff)
-
tags/4.21.1/hcaptcha.php (modified) (2 diffs)
-
tags/4.21.1/readme.txt (modified) (2 diffs)
-
tags/4.21.1/src/php/CF7/Admin.php (modified) (2 diffs)
-
tags/4.21.1/src/php/CF7/CF7.php (modified) (2 diffs)
-
tags/4.21.1/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/assets/js/apps/hcaptcha.js (modified) (1 diff)
-
trunk/assets/js/hcaptcha-cf7.js (modified) (1 diff)
-
trunk/assets/js/hcaptcha-cf7.min.js (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/hcaptcha.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/php/CF7/Admin.php (modified) (2 diffs)
-
trunk/src/php/CF7/CF7.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hcaptcha-for-forms-and-more/tags/4.21.1/assets/js/apps/hcaptcha.js
r3433317 r3434984 1 (()=>{"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,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||r(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 r(t,e){if(t){if("string"==typeof t)return o(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,a(r.key),r)}}function a(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}var u=function(){return r=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.foundForms=[],this.params=null,this.observingDarkMode=!1,this.observingPasswordManagers=!1,this.darkElement=null,this.darkClass=null,this.callback=this.callback.bind(this),this.validate=this.validate.bind(this)},o=[{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){var e;return null!==(e=this.foundForms.filter(function(e){return t===e.hCaptchaId})[0])&&void 0!==e?e:null}},{key:"getWidgetId",value:function(t){var e,n,r;if(void 0===t)return"";var o=null!==(e=null===(n=t.closest(this.formSelector))||void 0===n||null===(n=n.dataset)||void 0===n?void 0:n.hCaptchaId)&&void 0!==e?e:"";if(!o)return"";var i=this.getFoundFormById(o);return null!==(r=null==i?void 0:i.widgetId)&&void 0!==r?r:""}},{key:"reset",value:function(t){var e=this.getWidgetId(t);e&&hcaptcha.reset(e)}},{key:"isSameOrDescendant",value:function(t,e){for(var n=e;n;){if(n===t)return!0;n=n.parentElement}return!1}},{key:"getCurrentForm",value:function(t){var e,n=t.currentTarget.closest(this.formSelector),r=this.getFoundFormById(null==n||null===(e=n.dataset)||void 0===e?void 0:e.hCaptchaId),o=null==r?void 0:r.submitButtonElement,i=null==r?void 0:r.widgetId;if(i&&this.isSameOrDescendant(o,t.target))return t.preventDefault(),t.stopPropagation(),{formElement:n,submitButtonElement:o,widgetId:i}}},{key:"validate",value:function(t){if(this.currentForm=this.getCurrentForm(t),this.currentForm){var e=this.currentForm,n=e.formElement,r=e.widgetId,o=n.querySelector(this.responseSelector),i=o?o.value:"";""===i?hcaptcha.execute(r,{async:!1}):this.callback(i)}}},{key:"isValidated",value:function(){return void 0!==this.currentForm}},{key:"getForms",value:function(){return n(document.querySelectorAll(this.formSelector))}},{key:"getParams",value:function(){if(null!==this.params)return this.params;var t;try{var e,n;t=JSON.parse(wp.hooks.applyFilters("hcaptcha.params",null!==(e=null===(n=HCaptchaMainObject)||void 0===n?void 0:n.params)&&void 0!==e?e:""))}catch(e){t={}}return t.callback=this.callback,t}},{key:"setParams",value:function(t){this.params=t}},{key:"setDarkData",value:function(){var t={"twenty-twenty-one":{darkStyleId:"twenty-twenty-one-style-css",darkElement:document.body,darkClass:"is-dark-theme"},"wp-dark-mode":{darkStyleId:"wp-dark-mode-frontend-css",darkElement:document.documentElement,darkClass:"wp-dark-mode-active"},"droit-dark-mode":{darkStyleId:"dtdr-public-inline-css",darkElement:document.documentElement,darkClass:"drdt-dark-mode"}};t=wp.hooks.applyFilters("hcaptcha.darkData",t);for(var e=0,n=Object.values(t);e<n.length;e++){var r=n[e];if(document.getElementById(r.darkStyleId))return this.darkElement=r.darkElement,void(this.darkClass=r.darkClass)}}},{key:"observeDarkMode",value:function(){var t=this,n=!1;this.observingDarkMode||(this.observingDarkMode=!0,"auto"!==this.getParams().theme)||(this.setDarkData(),this.darkElement&&this.darkClass&&new MutationObserver(function(r){var o,i=!1,a=e(r);try{var u=function(){var e=o.value.oldValue,n=t.darkElement.getAttribute("class");e=e?e.split(" "):[],(n=n?n.split(" "):[]).filter(function(t){return!e.includes(t)}).concat(e.filter(function(t){return!n.includes(t)})).includes(t.darkClass)&&(i=!0)};for(a.s();!(o=a.n()).done;)u()}catch(t){a.e(t)}finally{a.f()}i&&!n&&(n=!0,requestAnimationFrame(function(){t.bindEvents(),n=!1}))}).observe(this.darkElement,{attributes:!0,attributeOldValue:!0}))}},{key:"observePasswordManagers",value:function(){var t=this;if(!this.observingPasswordManagers){this.observingPasswordManagers=!0;var n=!1,r=new MutationObserver(function(o){n||(n=!0,requestAnimationFrame(function(){var i,a=e(o);try{for(a.s();!(i=a.n()).done;)if("childList"===i.value.type){var u=document.querySelector("com-1password-button"),c=document.querySelector("div[data-lastpass-icon-root]");if(u||c){r.disconnect(),t.foundForms.map(function(e){var n=e.hCaptchaId,r=e.submitButtonElement;if(!r)return e;var o=document.querySelector('[data-h-captcha-id="'.concat(n,'"]')).querySelector(".h-captcha"),i=o.dataset;return"invisible"===i.size||"true"===i.force||(o.dataset.force="true",r.addEventListener("click",t.validate,!0)),e});break}}}catch(t){a.e(t)}finally{a.f()}n=!1}))});r.observe(document.body,{childList:!0,subtree:!0})}}},{key:"getWidgetByToken",value:function(t){var e=n(document.querySelectorAll(this.responseSelector)).find(function(e){return e.value===t});return e?e.closest(".h-captcha"):null}},{key:"callback",value:function(t){document.dispatchEvent(new CustomEvent("hCaptchaSubmitted",{detail:{token:t}}));var e=this.getParams(),n=this.getWidgetByToken(t),r=n?n.dataset.force:null;("invisible"===e.size||"true"===r&&this.isValidated())&&this.submit()}},{key:"applyAutoTheme",value:function(t){if("auto"!==t.theme)return t;var e;if(t.theme="light",!this.darkElement)return t.theme=null!==(e=window)&&void 0!==e&&e.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",t;var n=this.darkElement.getAttribute("class");return(n=n||"").includes(this.darkClass)&&(t.theme="dark"),t}},{key:"render",value:function(e){this.observeDarkMode(),this.observePasswordManagers();var n,r,o=this.getParams();return"object"===t(o.theme)?null!==(n=null===(r=o)||void 0===r||null===(r=r.theme)||void 0===r||null===(r=r.component)||void 0===r||null===(r=r.checkbox)||void 0===r||null===(r=r.main)||void 0===r?void 0:r.fill)&&void 0!==n&&n&&(e.dataset.theme="custom"):o.theme=e.dataset.theme,o.size=e.dataset.size,o=this.applyAutoTheme(o),hcaptcha.render(e,o)}},{key:"moveHP",value:function(t){var e,r;if(t&&"1"!==(null==t||null===(e=t.dataset)||void 0===e?void 0:e.hpMoved)){t.dataset.hpMoved="1";var o=t.querySelector('input[id^="hcap_hp_"]');if(o){var i=n(t.querySelectorAll("input,select,textarea,button")).filter(function(t){return t!==o&&"hidden"!==t.type&&!t.closest(".h-captcha")});if(i.length){var a=i[Math.floor(Math.random()*i.length)];if(a&&a.parentNode){var u=null!==(r=o.getAttribute("id"))&&void 0!==r?r:"",c=u?t.querySelector('label[for="'.concat(u,'"]')):null,s=document.createDocumentFragment();c&&c.isConnected&&s.appendChild(c),s.appendChild(o),a.parentNode.insertBefore(s,a)}}}}}},{key:"addFSTToken",value:function(t){if(t){var e="hcap_fst_token",n=t.querySelector('input[type="hidden"][name="'.concat(e,'"]'));n||((n=document.createElement("input")).type="hidden",n.name=e),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}},{key:"bindEvents",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.formSelector=wp.hooks.applyFilters("hcaptcha.formSelector","form, section.cwginstock-subscribe-form, div.sdm_download_item, .gform_editor, #nf-builder, .wpforms-captcha-preview"),this.submitButtonSelector=wp.hooks.applyFilters("hcaptcha.submitButtonSelector",'*[type="submit"]:not(.quform-default-submit), #check_config, button[type="button"].ff-btn, a.et_pb_newsletter_button.et_pb_button, .forminator-button-submit, .frm_button_submit, a.sdm_download, .uagb-forms-main-submit-button'),this.responseSelector='textarea[name="h-captcha-response"]',this.getForms().map(function(n){var r=n.querySelector(".h-captcha");if( e&&e!==r)return n;if(null===r)return n;if(r.classList.contains("hcaptcha-widget-id"))return n;t.moveHP(n),t.addFSTToken(n),r.innerHTML="";var o=t.generateID(),i=n.querySelectorAll(t.submitButtonSelector)[0],a=t.render(r);if(n.dataset.hCaptchaId=o,t.foundForms.push({hCaptchaId:o,submitButtonElement:i,widgetId:a}),!i)return n;var u=r.dataset;return"invisible"!==u.size&&"true"!==u.force||i.addEventListener("click",t.validate,!0),n},this)}},{key:"isAjaxSubmitButton",value:function(t){var e=t.getAttribute("type"),n="submit"!==(e=e?e.toLowerCase():"");return wp.hooks.applyFilters("hcaptcha.ajaxSubmitButton",n,t)}},{key:"submit",value:function(){if(this.currentForm){var t=this.currentForm,e=t.formElement,n=t.submitButtonElement;if("form"!==e.tagName.toLowerCase()||this.isAjaxSubmitButton(n))return n.removeEventListener("click",this.validate,!0),void n.click();e.requestSubmit?e.requestSubmit(n):e.submit()}}}],o&&i(r.prototype,o),a&&i(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,a}();window.HCaptchaMainObject=window.HCaptchaMainObject||{};const c=u;function s(t){return s="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},s(t)}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function d(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:e+""}function f(t,e,n){return e=v(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,m()?Reflect.construct(e,n||[],v(t).constructor):e.apply(t,n))}function h(t){var e="function"==typeof Map?new Map:void 0;return h=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&p(o,n.prototype),o}(t,arguments,v(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,t)},h(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}const y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),n=e,(r=[{key:"connectedCallback",value:function(){window.hCaptchaBindEvents(this)}}])&&l(n.prototype,r),o&&l(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(h(HTMLElement));function b(t){return b="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},b(t)}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,k(r.key),r)}}function k(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}const g=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._domReady="loading"!==document.readyState,this._hcaptchaReady="undefined"!=typeof hcaptcha,this._resolve=null,this._readyPromise=new Promise(function(t){e._resolve=t}),this._onDom=this._onDom.bind(this),this._onHCaptcha=this._onHCaptcha.bind(this),document.addEventListener("DOMContentLoaded",this._onDom,{once:!0}),document.addEventListener("hCaptchaOnLoad",this._onHCaptcha,{once:!0}),this._tryResolve()},(e=[{key:"_onDom",value:function(){this._domReady=!0,this._tryResolve()}},{key:"_onHCaptcha",value:function(){this._hcaptchaReady=!0,this._tryResolve()}},{key:"_tryResolve",value:function(){this._domReady&&this._hcaptchaReady&&this._resolve()}},{key:"ready",value:function(){return this._readyPromise}},{key:"runWhenReady",value:function(t){return this.ready().then(function(){return t()})}}])&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();var S=new c,E=new g;window.hCaptcha=S,window.hCaptchaGetWidgetId=function(t){S.getWidgetId(t)},window.hCaptchaReset=function(t){S.reset(t)},window.hCaptchaBindEvents=function(t){E.runWhenReady(function(){document.dispatchEvent(new CustomEvent("hCaptchaBeforeBindEvents")),S.bindEvents(t),document.dispatchEvent(new CustomEvent("hCaptchaAfterBindEvents"))})},window.hCaptchaSubmit=function(){S.submit()},window.hCaptchaOnLoad=function(){document.dispatchEvent(new CustomEvent("hCaptchaOnLoad")),document.addEventListener("hCaptchaAfterBindEvents",function(){document.dispatchEvent(new CustomEvent("hCaptchaLoaded",{cancelable:!0}))})},window.customElements.define("h-captcha",y),document.dispatchEvent(new CustomEvent("hCaptchaBeforeAPI"))})();1 (()=>{"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,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||r(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 r(t,e){if(t){if("string"==typeof t)return o(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,a(r.key),r)}}function a(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}var u=function(){return r=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.foundForms=[],this.params=null,this.observingDarkMode=!1,this.observingPasswordManagers=!1,this.darkElement=null,this.darkClass=null,this.callback=this.callback.bind(this),this.validate=this.validate.bind(this)},o=[{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){var e;return null!==(e=this.foundForms.filter(function(e){return t===e.hCaptchaId})[0])&&void 0!==e?e:null}},{key:"getWidgetId",value:function(t){var e,n,r;if(void 0===t)return"";var o=null!==(e=null===(n=t.closest(this.formSelector))||void 0===n||null===(n=n.dataset)||void 0===n?void 0:n.hCaptchaId)&&void 0!==e?e:"";if(!o)return"";var i=this.getFoundFormById(o);return null!==(r=null==i?void 0:i.widgetId)&&void 0!==r?r:""}},{key:"reset",value:function(t){var e=this.getWidgetId(t);e&&hcaptcha.reset(e)}},{key:"isSameOrDescendant",value:function(t,e){for(var n=e;n;){if(n===t)return!0;n=n.parentElement}return!1}},{key:"getCurrentForm",value:function(t){var e,n=t.currentTarget.closest(this.formSelector),r=this.getFoundFormById(null==n||null===(e=n.dataset)||void 0===e?void 0:e.hCaptchaId),o=null==r?void 0:r.submitButtonElement,i=null==r?void 0:r.widgetId;if(i&&this.isSameOrDescendant(o,t.target))return t.preventDefault(),t.stopPropagation(),{formElement:n,submitButtonElement:o,widgetId:i}}},{key:"validate",value:function(t){if(this.currentForm=this.getCurrentForm(t),this.currentForm){var e=this.currentForm,n=e.formElement,r=e.widgetId,o=n.querySelector(this.responseSelector),i=o?o.value:"";""===i?hcaptcha.execute(r,{async:!1}):this.callback(i)}}},{key:"isValidated",value:function(){return void 0!==this.currentForm}},{key:"getForms",value:function(){return n(document.querySelectorAll(this.formSelector))}},{key:"getParams",value:function(){if(null!==this.params)return this.params;var t;try{var e,n;t=JSON.parse(wp.hooks.applyFilters("hcaptcha.params",null!==(e=null===(n=HCaptchaMainObject)||void 0===n?void 0:n.params)&&void 0!==e?e:""))}catch(e){t={}}return t.callback=this.callback,t}},{key:"setParams",value:function(t){this.params=t}},{key:"setDarkData",value:function(){var t={"twenty-twenty-one":{darkStyleId:"twenty-twenty-one-style-css",darkElement:document.body,darkClass:"is-dark-theme"},"wp-dark-mode":{darkStyleId:"wp-dark-mode-frontend-css",darkElement:document.documentElement,darkClass:"wp-dark-mode-active"},"droit-dark-mode":{darkStyleId:"dtdr-public-inline-css",darkElement:document.documentElement,darkClass:"drdt-dark-mode"}};t=wp.hooks.applyFilters("hcaptcha.darkData",t);for(var e=0,n=Object.values(t);e<n.length;e++){var r=n[e];if(document.getElementById(r.darkStyleId))return this.darkElement=r.darkElement,void(this.darkClass=r.darkClass)}}},{key:"observeDarkMode",value:function(){var t=this,n=!1;this.observingDarkMode||(this.observingDarkMode=!0,"auto"!==this.getParams().theme)||(this.setDarkData(),this.darkElement&&this.darkClass&&new MutationObserver(function(r){var o,i=!1,a=e(r);try{var u=function(){var e=o.value.oldValue,n=t.darkElement.getAttribute("class");e=e?e.split(" "):[],(n=n?n.split(" "):[]).filter(function(t){return!e.includes(t)}).concat(e.filter(function(t){return!n.includes(t)})).includes(t.darkClass)&&(i=!0)};for(a.s();!(o=a.n()).done;)u()}catch(t){a.e(t)}finally{a.f()}i&&!n&&(n=!0,requestAnimationFrame(function(){t.bindEvents(),n=!1}))}).observe(this.darkElement,{attributes:!0,attributeOldValue:!0}))}},{key:"observePasswordManagers",value:function(){var t=this;if(!this.observingPasswordManagers){this.observingPasswordManagers=!0;var n=!1,r=new MutationObserver(function(o){n||(n=!0,requestAnimationFrame(function(){var i,a=e(o);try{for(a.s();!(i=a.n()).done;)if("childList"===i.value.type){var u=document.querySelector("com-1password-button"),c=document.querySelector("div[data-lastpass-icon-root]");if(u||c){r.disconnect(),t.foundForms.map(function(e){var n=e.hCaptchaId,r=e.submitButtonElement;if(!r)return e;var o=document.querySelector('[data-h-captcha-id="'.concat(n,'"]')).querySelector(".h-captcha"),i=o.dataset;return"invisible"===i.size||"true"===i.force||(o.dataset.force="true",r.addEventListener("click",t.validate,!0)),e});break}}}catch(t){a.e(t)}finally{a.f()}n=!1}))});r.observe(document.body,{childList:!0,subtree:!0})}}},{key:"getWidgetByToken",value:function(t){var e=n(document.querySelectorAll(this.responseSelector)).find(function(e){return e.value===t});return e?e.closest(".h-captcha"):null}},{key:"callback",value:function(t){document.dispatchEvent(new CustomEvent("hCaptchaSubmitted",{detail:{token:t}}));var e=this.getParams(),n=this.getWidgetByToken(t),r=n?n.dataset.force:null;("invisible"===e.size||"true"===r&&this.isValidated())&&this.submit()}},{key:"applyAutoTheme",value:function(t){if("auto"!==t.theme)return t;var e;if(t.theme="light",!this.darkElement)return t.theme=null!==(e=window)&&void 0!==e&&e.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",t;var n=this.darkElement.getAttribute("class");return(n=n||"").includes(this.darkClass)&&(t.theme="dark"),t}},{key:"render",value:function(e){this.observeDarkMode(),this.observePasswordManagers();var n,r,o=this.getParams();return"object"===t(o.theme)?null!==(n=null===(r=o)||void 0===r||null===(r=r.theme)||void 0===r||null===(r=r.component)||void 0===r||null===(r=r.checkbox)||void 0===r||null===(r=r.main)||void 0===r?void 0:r.fill)&&void 0!==n&&n&&(e.dataset.theme="custom"):o.theme=e.dataset.theme,o.size=e.dataset.size,o=this.applyAutoTheme(o),hcaptcha.render(e,o)}},{key:"moveHP",value:function(t){var e,r;if(t&&"1"!==(null==t||null===(e=t.dataset)||void 0===e?void 0:e.hpMoved)){t.dataset.hpMoved="1";var o=t.querySelector('input[id^="hcap_hp_"]');if(o){var i=n(t.querySelectorAll("input,select,textarea,button")).filter(function(t){return t!==o&&"hidden"!==t.type&&!t.closest(".h-captcha")});if(i.length){var a=i[Math.floor(Math.random()*i.length)];if(a&&a.parentNode){var u=null!==(r=o.getAttribute("id"))&&void 0!==r?r:"",c=u?t.querySelector('label[for="'.concat(u,'"]')):null,s=document.createDocumentFragment();c&&c.isConnected&&s.appendChild(c),s.appendChild(o),a.parentNode.insertBefore(s,a)}}}}}},{key:"addFSTToken",value:function(t){if(t){var e="hcap_fst_token",n=t.querySelector('input[type="hidden"][name="'.concat(e,'"]'));n||((n=document.createElement("input")).type="hidden",n.name=e),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}},{key:"bindEvents",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.formSelector=wp.hooks.applyFilters("hcaptcha.formSelector","form, section.cwginstock-subscribe-form, div.sdm_download_item, .gform_editor, #nf-builder, .wpforms-captcha-preview"),this.submitButtonSelector=wp.hooks.applyFilters("hcaptcha.submitButtonSelector",'*[type="submit"]:not(.quform-default-submit), #check_config, button[type="button"].ff-btn, a.et_pb_newsletter_button.et_pb_button, .forminator-button-submit, .frm_button_submit, a.sdm_download, .uagb-forms-main-submit-button'),this.responseSelector='textarea[name="h-captcha-response"]',this.getForms().map(function(n){var r=n.querySelector(".h-captcha");if(null===r)return n;if(e instanceof HTMLElement&&e!==r)return n;if(r.classList.contains("hcaptcha-widget-id"))return n;t.moveHP(n),t.addFSTToken(n),r.innerHTML="";var o=t.generateID(),i=n.querySelectorAll(t.submitButtonSelector)[0],a=t.render(r);if(n.dataset.hCaptchaId=o,t.foundForms.push({hCaptchaId:o,submitButtonElement:i,widgetId:a}),!i)return n;var u=r.dataset;return"invisible"!==u.size&&"true"!==u.force||i.addEventListener("click",t.validate,!0),n},this)}},{key:"isAjaxSubmitButton",value:function(t){var e=t.getAttribute("type"),n="submit"!==(e=e?e.toLowerCase():"");return wp.hooks.applyFilters("hcaptcha.ajaxSubmitButton",n,t)}},{key:"submit",value:function(){if(this.currentForm){var t=this.currentForm,e=t.formElement,n=t.submitButtonElement;if("form"!==e.tagName.toLowerCase()||this.isAjaxSubmitButton(n))return n.removeEventListener("click",this.validate,!0),void n.click();e.requestSubmit?e.requestSubmit(n):e.submit()}}}],o&&i(r.prototype,o),a&&i(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,a}();window.HCaptchaMainObject=window.HCaptchaMainObject||{};const c=u;function s(t){return s="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},s(t)}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function d(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:e+""}function f(t,e,n){return e=v(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,m()?Reflect.construct(e,n||[],v(t).constructor):e.apply(t,n))}function h(t){var e="function"==typeof Map?new Map:void 0;return h=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&p(o,n.prototype),o}(t,arguments,v(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,t)},h(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}const y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),n=e,(r=[{key:"connectedCallback",value:function(){window.hCaptchaBindEvents(this)}}])&&l(n.prototype,r),o&&l(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(h(HTMLElement));function b(t){return b="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},b(t)}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,k(r.key),r)}}function k(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}const g=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._domReady="loading"!==document.readyState,this._hcaptchaReady="undefined"!=typeof hcaptcha,this._resolve=null,this._readyPromise=new Promise(function(t){e._resolve=t}),this._onDom=this._onDom.bind(this),this._onHCaptcha=this._onHCaptcha.bind(this),document.addEventListener("DOMContentLoaded",this._onDom,{once:!0}),document.addEventListener("hCaptchaOnLoad",this._onHCaptcha,{once:!0}),this._tryResolve()},(e=[{key:"_onDom",value:function(){this._domReady=!0,this._tryResolve()}},{key:"_onHCaptcha",value:function(){this._hcaptchaReady=!0,this._tryResolve()}},{key:"_tryResolve",value:function(){this._domReady&&this._hcaptchaReady&&this._resolve()}},{key:"ready",value:function(){return this._readyPromise}},{key:"runWhenReady",value:function(t){return this.ready().then(function(){return t()})}}])&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();var S=new c,E=new g;window.hCaptcha=S,window.hCaptchaGetWidgetId=function(t){S.getWidgetId(t)},window.hCaptchaReset=function(t){S.reset(t)},window.hCaptchaBindEvents=function(t){E.runWhenReady(function(){document.dispatchEvent(new CustomEvent("hCaptchaBeforeBindEvents")),S.bindEvents(t),document.dispatchEvent(new CustomEvent("hCaptchaAfterBindEvents"))})},window.hCaptchaSubmit=function(){S.submit()},window.hCaptchaOnLoad=function(){document.dispatchEvent(new CustomEvent("hCaptchaOnLoad")),document.addEventListener("hCaptchaAfterBindEvents",function(){document.dispatchEvent(new CustomEvent("hCaptchaLoaded",{cancelable:!0}))})},window.customElements.define("h-captcha",y),document.dispatchEvent(new CustomEvent("hCaptchaBeforeAPI"))})(); -
hcaptcha-for-forms-and-more/tags/4.21.1/assets/js/hcaptcha-cf7.js
r3265103 r3434984 12 12 } ); 13 13 } ); 14 15 document.addEventListener( 'DOMContentLoaded', hCaptchaBindEvents ); -
hcaptcha-for-forms-and-more/tags/4.21.1/assets/js/hcaptcha-cf7.min.js
r3339595 r3434984 1 (()=>{function t(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){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(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,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}document.addEventListener("DOMContentLoaded",function(){t(document.querySelectorAll(".wpcf7")).map(function(t){return t.addEventListener("wpcf7invalid",hCaptchaBindEvents,!1),t.addEventListener("wpcf7spam",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailsent",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailfailed",hCaptchaBindEvents,!1),t.addEventListener("wpcf7submit",hCaptchaBindEvents,!1),t})}) })();1 (()=>{function t(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){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(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,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}document.addEventListener("DOMContentLoaded",function(){t(document.querySelectorAll(".wpcf7")).map(function(t){return t.addEventListener("wpcf7invalid",hCaptchaBindEvents,!1),t.addEventListener("wpcf7spam",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailsent",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailfailed",hCaptchaBindEvents,!1),t.addEventListener("wpcf7submit",hCaptchaBindEvents,!1),t})}),document.addEventListener("DOMContentLoaded",hCaptchaBindEvents)})(); -
hcaptcha-for-forms-and-more/tags/4.21.1/changelog.txt
r3433317 r3434984 1 = 4.21.1 = 2 * Fixed hCaptcha not loading on Contact Form 7. 3 1 4 = 4.21.0 = 2 5 * Added AI-ready security actions via the WordPress Abilities API, enabling automated threat inspection and response. -
hcaptcha-for-forms-and-more/tags/4.21.1/hcaptcha.php
r3433317 r3434984 11 11 * Plugin URI: https://www.hcaptcha.com/ 12 12 * Description: hCaptcha keeps out bots and spam while putting privacy first. It is a drop-in replacement for reCAPTCHA. 13 * Version: 4.21. 013 * Version: 4.21.1 14 14 * Requires at least: 5.3 15 15 * Requires PHP: 7.2 … … 40 40 * Plugin version. 41 41 */ 42 const HCAPTCHA_VERSION = '4.21. 0';42 const HCAPTCHA_VERSION = '4.21.1'; 43 43 44 44 /** -
hcaptcha-for-forms-and-more/tags/4.21.1/readme.txt
r3433317 r3434984 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.2 7 Stable tag: 4.21. 07 Stable tag: 4.21.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 853 853 == Changelog == 854 854 855 = 4.21.1 = 856 * Fixed hCaptcha not loading on Contact Form 7. 857 855 858 = 4.21.0 = 856 859 * Added AI-ready security actions via the WordPress Abilities API, enabling automated threat inspection and response. -
hcaptcha-for-forms-and-more/tags/4.21.1/src/php/CF7/Admin.php
r3373103 r3434984 12 12 13 13 use HCaptcha\Helpers\Pages; 14 use HCaptcha\Main; 14 15 use WPCF7_ContactForm; 15 16 use WPCF7_TagGenerator; … … 308 309 self::HANDLE, 309 310 HCAPTCHA_URL . "/assets/js/hcaptcha-cf7$min.js", 310 [ ],311 [ Main::HANDLE ], 311 312 HCAPTCHA_VERSION, 312 313 true -
hcaptcha-for-forms-and-more/tags/4.21.1/src/php/CF7/CF7.php
r3406329 r3434984 13 13 use HCaptcha\Helpers\API; 14 14 use HCaptcha\Helpers\HCaptcha; 15 use HCaptcha\Main; 15 16 use WPCF7_FormTag; 16 17 use WPCF7_Submission; … … 310 311 self::HANDLE, 311 312 HCAPTCHA_URL . "/assets/js/hcaptcha-cf7$min.js", 312 [ ],313 [ Main::HANDLE ], 313 314 HCAPTCHA_VERSION, 314 315 true -
hcaptcha-for-forms-and-more/tags/4.21.1/vendor/composer/installed.php
r3433317 r3434984 2 2 'root' => array( 3 3 'name' => 'hcaptcha/hcaptcha-wordpress-plugin', 4 'pretty_version' => '4.21. 0',5 'version' => '4.21. 0.0',6 'reference' => ' 02af3b9c6401ca31e90085fb6f7aa1e173e58cfe',4 'pretty_version' => '4.21.1', 5 'version' => '4.21.1.0', 6 'reference' => 'ea504aa72984888a16b86759b9087f22192f44f6', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'hcaptcha/hcaptcha-wordpress-plugin' => array( 14 'pretty_version' => '4.21. 0',15 'version' => '4.21. 0.0',16 'reference' => ' 02af3b9c6401ca31e90085fb6f7aa1e173e58cfe',14 'pretty_version' => '4.21.1', 15 'version' => '4.21.1.0', 16 'reference' => 'ea504aa72984888a16b86759b9087f22192f44f6', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
hcaptcha-for-forms-and-more/trunk/assets/js/apps/hcaptcha.js
r3433317 r3434984 1 (()=>{"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,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||r(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 r(t,e){if(t){if("string"==typeof t)return o(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,a(r.key),r)}}function a(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}var u=function(){return r=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.foundForms=[],this.params=null,this.observingDarkMode=!1,this.observingPasswordManagers=!1,this.darkElement=null,this.darkClass=null,this.callback=this.callback.bind(this),this.validate=this.validate.bind(this)},o=[{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){var e;return null!==(e=this.foundForms.filter(function(e){return t===e.hCaptchaId})[0])&&void 0!==e?e:null}},{key:"getWidgetId",value:function(t){var e,n,r;if(void 0===t)return"";var o=null!==(e=null===(n=t.closest(this.formSelector))||void 0===n||null===(n=n.dataset)||void 0===n?void 0:n.hCaptchaId)&&void 0!==e?e:"";if(!o)return"";var i=this.getFoundFormById(o);return null!==(r=null==i?void 0:i.widgetId)&&void 0!==r?r:""}},{key:"reset",value:function(t){var e=this.getWidgetId(t);e&&hcaptcha.reset(e)}},{key:"isSameOrDescendant",value:function(t,e){for(var n=e;n;){if(n===t)return!0;n=n.parentElement}return!1}},{key:"getCurrentForm",value:function(t){var e,n=t.currentTarget.closest(this.formSelector),r=this.getFoundFormById(null==n||null===(e=n.dataset)||void 0===e?void 0:e.hCaptchaId),o=null==r?void 0:r.submitButtonElement,i=null==r?void 0:r.widgetId;if(i&&this.isSameOrDescendant(o,t.target))return t.preventDefault(),t.stopPropagation(),{formElement:n,submitButtonElement:o,widgetId:i}}},{key:"validate",value:function(t){if(this.currentForm=this.getCurrentForm(t),this.currentForm){var e=this.currentForm,n=e.formElement,r=e.widgetId,o=n.querySelector(this.responseSelector),i=o?o.value:"";""===i?hcaptcha.execute(r,{async:!1}):this.callback(i)}}},{key:"isValidated",value:function(){return void 0!==this.currentForm}},{key:"getForms",value:function(){return n(document.querySelectorAll(this.formSelector))}},{key:"getParams",value:function(){if(null!==this.params)return this.params;var t;try{var e,n;t=JSON.parse(wp.hooks.applyFilters("hcaptcha.params",null!==(e=null===(n=HCaptchaMainObject)||void 0===n?void 0:n.params)&&void 0!==e?e:""))}catch(e){t={}}return t.callback=this.callback,t}},{key:"setParams",value:function(t){this.params=t}},{key:"setDarkData",value:function(){var t={"twenty-twenty-one":{darkStyleId:"twenty-twenty-one-style-css",darkElement:document.body,darkClass:"is-dark-theme"},"wp-dark-mode":{darkStyleId:"wp-dark-mode-frontend-css",darkElement:document.documentElement,darkClass:"wp-dark-mode-active"},"droit-dark-mode":{darkStyleId:"dtdr-public-inline-css",darkElement:document.documentElement,darkClass:"drdt-dark-mode"}};t=wp.hooks.applyFilters("hcaptcha.darkData",t);for(var e=0,n=Object.values(t);e<n.length;e++){var r=n[e];if(document.getElementById(r.darkStyleId))return this.darkElement=r.darkElement,void(this.darkClass=r.darkClass)}}},{key:"observeDarkMode",value:function(){var t=this,n=!1;this.observingDarkMode||(this.observingDarkMode=!0,"auto"!==this.getParams().theme)||(this.setDarkData(),this.darkElement&&this.darkClass&&new MutationObserver(function(r){var o,i=!1,a=e(r);try{var u=function(){var e=o.value.oldValue,n=t.darkElement.getAttribute("class");e=e?e.split(" "):[],(n=n?n.split(" "):[]).filter(function(t){return!e.includes(t)}).concat(e.filter(function(t){return!n.includes(t)})).includes(t.darkClass)&&(i=!0)};for(a.s();!(o=a.n()).done;)u()}catch(t){a.e(t)}finally{a.f()}i&&!n&&(n=!0,requestAnimationFrame(function(){t.bindEvents(),n=!1}))}).observe(this.darkElement,{attributes:!0,attributeOldValue:!0}))}},{key:"observePasswordManagers",value:function(){var t=this;if(!this.observingPasswordManagers){this.observingPasswordManagers=!0;var n=!1,r=new MutationObserver(function(o){n||(n=!0,requestAnimationFrame(function(){var i,a=e(o);try{for(a.s();!(i=a.n()).done;)if("childList"===i.value.type){var u=document.querySelector("com-1password-button"),c=document.querySelector("div[data-lastpass-icon-root]");if(u||c){r.disconnect(),t.foundForms.map(function(e){var n=e.hCaptchaId,r=e.submitButtonElement;if(!r)return e;var o=document.querySelector('[data-h-captcha-id="'.concat(n,'"]')).querySelector(".h-captcha"),i=o.dataset;return"invisible"===i.size||"true"===i.force||(o.dataset.force="true",r.addEventListener("click",t.validate,!0)),e});break}}}catch(t){a.e(t)}finally{a.f()}n=!1}))});r.observe(document.body,{childList:!0,subtree:!0})}}},{key:"getWidgetByToken",value:function(t){var e=n(document.querySelectorAll(this.responseSelector)).find(function(e){return e.value===t});return e?e.closest(".h-captcha"):null}},{key:"callback",value:function(t){document.dispatchEvent(new CustomEvent("hCaptchaSubmitted",{detail:{token:t}}));var e=this.getParams(),n=this.getWidgetByToken(t),r=n?n.dataset.force:null;("invisible"===e.size||"true"===r&&this.isValidated())&&this.submit()}},{key:"applyAutoTheme",value:function(t){if("auto"!==t.theme)return t;var e;if(t.theme="light",!this.darkElement)return t.theme=null!==(e=window)&&void 0!==e&&e.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",t;var n=this.darkElement.getAttribute("class");return(n=n||"").includes(this.darkClass)&&(t.theme="dark"),t}},{key:"render",value:function(e){this.observeDarkMode(),this.observePasswordManagers();var n,r,o=this.getParams();return"object"===t(o.theme)?null!==(n=null===(r=o)||void 0===r||null===(r=r.theme)||void 0===r||null===(r=r.component)||void 0===r||null===(r=r.checkbox)||void 0===r||null===(r=r.main)||void 0===r?void 0:r.fill)&&void 0!==n&&n&&(e.dataset.theme="custom"):o.theme=e.dataset.theme,o.size=e.dataset.size,o=this.applyAutoTheme(o),hcaptcha.render(e,o)}},{key:"moveHP",value:function(t){var e,r;if(t&&"1"!==(null==t||null===(e=t.dataset)||void 0===e?void 0:e.hpMoved)){t.dataset.hpMoved="1";var o=t.querySelector('input[id^="hcap_hp_"]');if(o){var i=n(t.querySelectorAll("input,select,textarea,button")).filter(function(t){return t!==o&&"hidden"!==t.type&&!t.closest(".h-captcha")});if(i.length){var a=i[Math.floor(Math.random()*i.length)];if(a&&a.parentNode){var u=null!==(r=o.getAttribute("id"))&&void 0!==r?r:"",c=u?t.querySelector('label[for="'.concat(u,'"]')):null,s=document.createDocumentFragment();c&&c.isConnected&&s.appendChild(c),s.appendChild(o),a.parentNode.insertBefore(s,a)}}}}}},{key:"addFSTToken",value:function(t){if(t){var e="hcap_fst_token",n=t.querySelector('input[type="hidden"][name="'.concat(e,'"]'));n||((n=document.createElement("input")).type="hidden",n.name=e),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}},{key:"bindEvents",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.formSelector=wp.hooks.applyFilters("hcaptcha.formSelector","form, section.cwginstock-subscribe-form, div.sdm_download_item, .gform_editor, #nf-builder, .wpforms-captcha-preview"),this.submitButtonSelector=wp.hooks.applyFilters("hcaptcha.submitButtonSelector",'*[type="submit"]:not(.quform-default-submit), #check_config, button[type="button"].ff-btn, a.et_pb_newsletter_button.et_pb_button, .forminator-button-submit, .frm_button_submit, a.sdm_download, .uagb-forms-main-submit-button'),this.responseSelector='textarea[name="h-captcha-response"]',this.getForms().map(function(n){var r=n.querySelector(".h-captcha");if( e&&e!==r)return n;if(null===r)return n;if(r.classList.contains("hcaptcha-widget-id"))return n;t.moveHP(n),t.addFSTToken(n),r.innerHTML="";var o=t.generateID(),i=n.querySelectorAll(t.submitButtonSelector)[0],a=t.render(r);if(n.dataset.hCaptchaId=o,t.foundForms.push({hCaptchaId:o,submitButtonElement:i,widgetId:a}),!i)return n;var u=r.dataset;return"invisible"!==u.size&&"true"!==u.force||i.addEventListener("click",t.validate,!0),n},this)}},{key:"isAjaxSubmitButton",value:function(t){var e=t.getAttribute("type"),n="submit"!==(e=e?e.toLowerCase():"");return wp.hooks.applyFilters("hcaptcha.ajaxSubmitButton",n,t)}},{key:"submit",value:function(){if(this.currentForm){var t=this.currentForm,e=t.formElement,n=t.submitButtonElement;if("form"!==e.tagName.toLowerCase()||this.isAjaxSubmitButton(n))return n.removeEventListener("click",this.validate,!0),void n.click();e.requestSubmit?e.requestSubmit(n):e.submit()}}}],o&&i(r.prototype,o),a&&i(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,a}();window.HCaptchaMainObject=window.HCaptchaMainObject||{};const c=u;function s(t){return s="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},s(t)}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function d(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:e+""}function f(t,e,n){return e=v(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,m()?Reflect.construct(e,n||[],v(t).constructor):e.apply(t,n))}function h(t){var e="function"==typeof Map?new Map:void 0;return h=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&p(o,n.prototype),o}(t,arguments,v(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,t)},h(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}const y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),n=e,(r=[{key:"connectedCallback",value:function(){window.hCaptchaBindEvents(this)}}])&&l(n.prototype,r),o&&l(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(h(HTMLElement));function b(t){return b="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},b(t)}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,k(r.key),r)}}function k(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}const g=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._domReady="loading"!==document.readyState,this._hcaptchaReady="undefined"!=typeof hcaptcha,this._resolve=null,this._readyPromise=new Promise(function(t){e._resolve=t}),this._onDom=this._onDom.bind(this),this._onHCaptcha=this._onHCaptcha.bind(this),document.addEventListener("DOMContentLoaded",this._onDom,{once:!0}),document.addEventListener("hCaptchaOnLoad",this._onHCaptcha,{once:!0}),this._tryResolve()},(e=[{key:"_onDom",value:function(){this._domReady=!0,this._tryResolve()}},{key:"_onHCaptcha",value:function(){this._hcaptchaReady=!0,this._tryResolve()}},{key:"_tryResolve",value:function(){this._domReady&&this._hcaptchaReady&&this._resolve()}},{key:"ready",value:function(){return this._readyPromise}},{key:"runWhenReady",value:function(t){return this.ready().then(function(){return t()})}}])&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();var S=new c,E=new g;window.hCaptcha=S,window.hCaptchaGetWidgetId=function(t){S.getWidgetId(t)},window.hCaptchaReset=function(t){S.reset(t)},window.hCaptchaBindEvents=function(t){E.runWhenReady(function(){document.dispatchEvent(new CustomEvent("hCaptchaBeforeBindEvents")),S.bindEvents(t),document.dispatchEvent(new CustomEvent("hCaptchaAfterBindEvents"))})},window.hCaptchaSubmit=function(){S.submit()},window.hCaptchaOnLoad=function(){document.dispatchEvent(new CustomEvent("hCaptchaOnLoad")),document.addEventListener("hCaptchaAfterBindEvents",function(){document.dispatchEvent(new CustomEvent("hCaptchaLoaded",{cancelable:!0}))})},window.customElements.define("h-captcha",y),document.dispatchEvent(new CustomEvent("hCaptchaBeforeAPI"))})();1 (()=>{"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,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||r(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 r(t,e){if(t){if("string"==typeof t)return o(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,a(r.key),r)}}function a(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}var u=function(){return r=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.foundForms=[],this.params=null,this.observingDarkMode=!1,this.observingPasswordManagers=!1,this.darkElement=null,this.darkClass=null,this.callback=this.callback.bind(this),this.validate=this.validate.bind(this)},o=[{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){var e;return null!==(e=this.foundForms.filter(function(e){return t===e.hCaptchaId})[0])&&void 0!==e?e:null}},{key:"getWidgetId",value:function(t){var e,n,r;if(void 0===t)return"";var o=null!==(e=null===(n=t.closest(this.formSelector))||void 0===n||null===(n=n.dataset)||void 0===n?void 0:n.hCaptchaId)&&void 0!==e?e:"";if(!o)return"";var i=this.getFoundFormById(o);return null!==(r=null==i?void 0:i.widgetId)&&void 0!==r?r:""}},{key:"reset",value:function(t){var e=this.getWidgetId(t);e&&hcaptcha.reset(e)}},{key:"isSameOrDescendant",value:function(t,e){for(var n=e;n;){if(n===t)return!0;n=n.parentElement}return!1}},{key:"getCurrentForm",value:function(t){var e,n=t.currentTarget.closest(this.formSelector),r=this.getFoundFormById(null==n||null===(e=n.dataset)||void 0===e?void 0:e.hCaptchaId),o=null==r?void 0:r.submitButtonElement,i=null==r?void 0:r.widgetId;if(i&&this.isSameOrDescendant(o,t.target))return t.preventDefault(),t.stopPropagation(),{formElement:n,submitButtonElement:o,widgetId:i}}},{key:"validate",value:function(t){if(this.currentForm=this.getCurrentForm(t),this.currentForm){var e=this.currentForm,n=e.formElement,r=e.widgetId,o=n.querySelector(this.responseSelector),i=o?o.value:"";""===i?hcaptcha.execute(r,{async:!1}):this.callback(i)}}},{key:"isValidated",value:function(){return void 0!==this.currentForm}},{key:"getForms",value:function(){return n(document.querySelectorAll(this.formSelector))}},{key:"getParams",value:function(){if(null!==this.params)return this.params;var t;try{var e,n;t=JSON.parse(wp.hooks.applyFilters("hcaptcha.params",null!==(e=null===(n=HCaptchaMainObject)||void 0===n?void 0:n.params)&&void 0!==e?e:""))}catch(e){t={}}return t.callback=this.callback,t}},{key:"setParams",value:function(t){this.params=t}},{key:"setDarkData",value:function(){var t={"twenty-twenty-one":{darkStyleId:"twenty-twenty-one-style-css",darkElement:document.body,darkClass:"is-dark-theme"},"wp-dark-mode":{darkStyleId:"wp-dark-mode-frontend-css",darkElement:document.documentElement,darkClass:"wp-dark-mode-active"},"droit-dark-mode":{darkStyleId:"dtdr-public-inline-css",darkElement:document.documentElement,darkClass:"drdt-dark-mode"}};t=wp.hooks.applyFilters("hcaptcha.darkData",t);for(var e=0,n=Object.values(t);e<n.length;e++){var r=n[e];if(document.getElementById(r.darkStyleId))return this.darkElement=r.darkElement,void(this.darkClass=r.darkClass)}}},{key:"observeDarkMode",value:function(){var t=this,n=!1;this.observingDarkMode||(this.observingDarkMode=!0,"auto"!==this.getParams().theme)||(this.setDarkData(),this.darkElement&&this.darkClass&&new MutationObserver(function(r){var o,i=!1,a=e(r);try{var u=function(){var e=o.value.oldValue,n=t.darkElement.getAttribute("class");e=e?e.split(" "):[],(n=n?n.split(" "):[]).filter(function(t){return!e.includes(t)}).concat(e.filter(function(t){return!n.includes(t)})).includes(t.darkClass)&&(i=!0)};for(a.s();!(o=a.n()).done;)u()}catch(t){a.e(t)}finally{a.f()}i&&!n&&(n=!0,requestAnimationFrame(function(){t.bindEvents(),n=!1}))}).observe(this.darkElement,{attributes:!0,attributeOldValue:!0}))}},{key:"observePasswordManagers",value:function(){var t=this;if(!this.observingPasswordManagers){this.observingPasswordManagers=!0;var n=!1,r=new MutationObserver(function(o){n||(n=!0,requestAnimationFrame(function(){var i,a=e(o);try{for(a.s();!(i=a.n()).done;)if("childList"===i.value.type){var u=document.querySelector("com-1password-button"),c=document.querySelector("div[data-lastpass-icon-root]");if(u||c){r.disconnect(),t.foundForms.map(function(e){var n=e.hCaptchaId,r=e.submitButtonElement;if(!r)return e;var o=document.querySelector('[data-h-captcha-id="'.concat(n,'"]')).querySelector(".h-captcha"),i=o.dataset;return"invisible"===i.size||"true"===i.force||(o.dataset.force="true",r.addEventListener("click",t.validate,!0)),e});break}}}catch(t){a.e(t)}finally{a.f()}n=!1}))});r.observe(document.body,{childList:!0,subtree:!0})}}},{key:"getWidgetByToken",value:function(t){var e=n(document.querySelectorAll(this.responseSelector)).find(function(e){return e.value===t});return e?e.closest(".h-captcha"):null}},{key:"callback",value:function(t){document.dispatchEvent(new CustomEvent("hCaptchaSubmitted",{detail:{token:t}}));var e=this.getParams(),n=this.getWidgetByToken(t),r=n?n.dataset.force:null;("invisible"===e.size||"true"===r&&this.isValidated())&&this.submit()}},{key:"applyAutoTheme",value:function(t){if("auto"!==t.theme)return t;var e;if(t.theme="light",!this.darkElement)return t.theme=null!==(e=window)&&void 0!==e&&e.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",t;var n=this.darkElement.getAttribute("class");return(n=n||"").includes(this.darkClass)&&(t.theme="dark"),t}},{key:"render",value:function(e){this.observeDarkMode(),this.observePasswordManagers();var n,r,o=this.getParams();return"object"===t(o.theme)?null!==(n=null===(r=o)||void 0===r||null===(r=r.theme)||void 0===r||null===(r=r.component)||void 0===r||null===(r=r.checkbox)||void 0===r||null===(r=r.main)||void 0===r?void 0:r.fill)&&void 0!==n&&n&&(e.dataset.theme="custom"):o.theme=e.dataset.theme,o.size=e.dataset.size,o=this.applyAutoTheme(o),hcaptcha.render(e,o)}},{key:"moveHP",value:function(t){var e,r;if(t&&"1"!==(null==t||null===(e=t.dataset)||void 0===e?void 0:e.hpMoved)){t.dataset.hpMoved="1";var o=t.querySelector('input[id^="hcap_hp_"]');if(o){var i=n(t.querySelectorAll("input,select,textarea,button")).filter(function(t){return t!==o&&"hidden"!==t.type&&!t.closest(".h-captcha")});if(i.length){var a=i[Math.floor(Math.random()*i.length)];if(a&&a.parentNode){var u=null!==(r=o.getAttribute("id"))&&void 0!==r?r:"",c=u?t.querySelector('label[for="'.concat(u,'"]')):null,s=document.createDocumentFragment();c&&c.isConnected&&s.appendChild(c),s.appendChild(o),a.parentNode.insertBefore(s,a)}}}}}},{key:"addFSTToken",value:function(t){if(t){var e="hcap_fst_token",n=t.querySelector('input[type="hidden"][name="'.concat(e,'"]'));n||((n=document.createElement("input")).type="hidden",n.name=e),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}},{key:"bindEvents",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.formSelector=wp.hooks.applyFilters("hcaptcha.formSelector","form, section.cwginstock-subscribe-form, div.sdm_download_item, .gform_editor, #nf-builder, .wpforms-captcha-preview"),this.submitButtonSelector=wp.hooks.applyFilters("hcaptcha.submitButtonSelector",'*[type="submit"]:not(.quform-default-submit), #check_config, button[type="button"].ff-btn, a.et_pb_newsletter_button.et_pb_button, .forminator-button-submit, .frm_button_submit, a.sdm_download, .uagb-forms-main-submit-button'),this.responseSelector='textarea[name="h-captcha-response"]',this.getForms().map(function(n){var r=n.querySelector(".h-captcha");if(null===r)return n;if(e instanceof HTMLElement&&e!==r)return n;if(r.classList.contains("hcaptcha-widget-id"))return n;t.moveHP(n),t.addFSTToken(n),r.innerHTML="";var o=t.generateID(),i=n.querySelectorAll(t.submitButtonSelector)[0],a=t.render(r);if(n.dataset.hCaptchaId=o,t.foundForms.push({hCaptchaId:o,submitButtonElement:i,widgetId:a}),!i)return n;var u=r.dataset;return"invisible"!==u.size&&"true"!==u.force||i.addEventListener("click",t.validate,!0),n},this)}},{key:"isAjaxSubmitButton",value:function(t){var e=t.getAttribute("type"),n="submit"!==(e=e?e.toLowerCase():"");return wp.hooks.applyFilters("hcaptcha.ajaxSubmitButton",n,t)}},{key:"submit",value:function(){if(this.currentForm){var t=this.currentForm,e=t.formElement,n=t.submitButtonElement;if("form"!==e.tagName.toLowerCase()||this.isAjaxSubmitButton(n))return n.removeEventListener("click",this.validate,!0),void n.click();e.requestSubmit?e.requestSubmit(n):e.submit()}}}],o&&i(r.prototype,o),a&&i(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,a}();window.HCaptchaMainObject=window.HCaptchaMainObject||{};const c=u;function s(t){return s="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},s(t)}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function d(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:e+""}function f(t,e,n){return e=v(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,m()?Reflect.construct(e,n||[],v(t).constructor):e.apply(t,n))}function h(t){var e="function"==typeof Map?new Map:void 0;return h=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&p(o,n.prototype),o}(t,arguments,v(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,t)},h(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}const y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),n=e,(r=[{key:"connectedCallback",value:function(){window.hCaptchaBindEvents(this)}}])&&l(n.prototype,r),o&&l(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(h(HTMLElement));function b(t){return b="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},b(t)}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,k(r.key),r)}}function k(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}const g=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._domReady="loading"!==document.readyState,this._hcaptchaReady="undefined"!=typeof hcaptcha,this._resolve=null,this._readyPromise=new Promise(function(t){e._resolve=t}),this._onDom=this._onDom.bind(this),this._onHCaptcha=this._onHCaptcha.bind(this),document.addEventListener("DOMContentLoaded",this._onDom,{once:!0}),document.addEventListener("hCaptchaOnLoad",this._onHCaptcha,{once:!0}),this._tryResolve()},(e=[{key:"_onDom",value:function(){this._domReady=!0,this._tryResolve()}},{key:"_onHCaptcha",value:function(){this._hcaptchaReady=!0,this._tryResolve()}},{key:"_tryResolve",value:function(){this._domReady&&this._hcaptchaReady&&this._resolve()}},{key:"ready",value:function(){return this._readyPromise}},{key:"runWhenReady",value:function(t){return this.ready().then(function(){return t()})}}])&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();var S=new c,E=new g;window.hCaptcha=S,window.hCaptchaGetWidgetId=function(t){S.getWidgetId(t)},window.hCaptchaReset=function(t){S.reset(t)},window.hCaptchaBindEvents=function(t){E.runWhenReady(function(){document.dispatchEvent(new CustomEvent("hCaptchaBeforeBindEvents")),S.bindEvents(t),document.dispatchEvent(new CustomEvent("hCaptchaAfterBindEvents"))})},window.hCaptchaSubmit=function(){S.submit()},window.hCaptchaOnLoad=function(){document.dispatchEvent(new CustomEvent("hCaptchaOnLoad")),document.addEventListener("hCaptchaAfterBindEvents",function(){document.dispatchEvent(new CustomEvent("hCaptchaLoaded",{cancelable:!0}))})},window.customElements.define("h-captcha",y),document.dispatchEvent(new CustomEvent("hCaptchaBeforeAPI"))})(); -
hcaptcha-for-forms-and-more/trunk/assets/js/hcaptcha-cf7.js
r3265103 r3434984 12 12 } ); 13 13 } ); 14 15 document.addEventListener( 'DOMContentLoaded', hCaptchaBindEvents ); -
hcaptcha-for-forms-and-more/trunk/assets/js/hcaptcha-cf7.min.js
r3339595 r3434984 1 (()=>{function t(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){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(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,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}document.addEventListener("DOMContentLoaded",function(){t(document.querySelectorAll(".wpcf7")).map(function(t){return t.addEventListener("wpcf7invalid",hCaptchaBindEvents,!1),t.addEventListener("wpcf7spam",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailsent",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailfailed",hCaptchaBindEvents,!1),t.addEventListener("wpcf7submit",hCaptchaBindEvents,!1),t})}) })();1 (()=>{function t(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){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(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,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}document.addEventListener("DOMContentLoaded",function(){t(document.querySelectorAll(".wpcf7")).map(function(t){return t.addEventListener("wpcf7invalid",hCaptchaBindEvents,!1),t.addEventListener("wpcf7spam",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailsent",hCaptchaBindEvents,!1),t.addEventListener("wpcf7mailfailed",hCaptchaBindEvents,!1),t.addEventListener("wpcf7submit",hCaptchaBindEvents,!1),t})}),document.addEventListener("DOMContentLoaded",hCaptchaBindEvents)})(); -
hcaptcha-for-forms-and-more/trunk/changelog.txt
r3433317 r3434984 1 = 4.21.1 = 2 * Fixed hCaptcha not loading on Contact Form 7. 3 1 4 = 4.21.0 = 2 5 * Added AI-ready security actions via the WordPress Abilities API, enabling automated threat inspection and response. -
hcaptcha-for-forms-and-more/trunk/hcaptcha.php
r3433317 r3434984 11 11 * Plugin URI: https://www.hcaptcha.com/ 12 12 * Description: hCaptcha keeps out bots and spam while putting privacy first. It is a drop-in replacement for reCAPTCHA. 13 * Version: 4.21. 013 * Version: 4.21.1 14 14 * Requires at least: 5.3 15 15 * Requires PHP: 7.2 … … 40 40 * Plugin version. 41 41 */ 42 const HCAPTCHA_VERSION = '4.21. 0';42 const HCAPTCHA_VERSION = '4.21.1'; 43 43 44 44 /** -
hcaptcha-for-forms-and-more/trunk/readme.txt
r3433317 r3434984 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.2 7 Stable tag: 4.21. 07 Stable tag: 4.21.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 853 853 == Changelog == 854 854 855 = 4.21.1 = 856 * Fixed hCaptcha not loading on Contact Form 7. 857 855 858 = 4.21.0 = 856 859 * Added AI-ready security actions via the WordPress Abilities API, enabling automated threat inspection and response. -
hcaptcha-for-forms-and-more/trunk/src/php/CF7/Admin.php
r3373103 r3434984 12 12 13 13 use HCaptcha\Helpers\Pages; 14 use HCaptcha\Main; 14 15 use WPCF7_ContactForm; 15 16 use WPCF7_TagGenerator; … … 308 309 self::HANDLE, 309 310 HCAPTCHA_URL . "/assets/js/hcaptcha-cf7$min.js", 310 [ ],311 [ Main::HANDLE ], 311 312 HCAPTCHA_VERSION, 312 313 true -
hcaptcha-for-forms-and-more/trunk/src/php/CF7/CF7.php
r3406329 r3434984 13 13 use HCaptcha\Helpers\API; 14 14 use HCaptcha\Helpers\HCaptcha; 15 use HCaptcha\Main; 15 16 use WPCF7_FormTag; 16 17 use WPCF7_Submission; … … 310 311 self::HANDLE, 311 312 HCAPTCHA_URL . "/assets/js/hcaptcha-cf7$min.js", 312 [ ],313 [ Main::HANDLE ], 313 314 HCAPTCHA_VERSION, 314 315 true -
hcaptcha-for-forms-and-more/trunk/vendor/composer/installed.php
r3433317 r3434984 2 2 'root' => array( 3 3 'name' => 'hcaptcha/hcaptcha-wordpress-plugin', 4 'pretty_version' => '4.21. 0',5 'version' => '4.21. 0.0',6 'reference' => ' 02af3b9c6401ca31e90085fb6f7aa1e173e58cfe',4 'pretty_version' => '4.21.1', 5 'version' => '4.21.1.0', 6 'reference' => 'ea504aa72984888a16b86759b9087f22192f44f6', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'hcaptcha/hcaptcha-wordpress-plugin' => array( 14 'pretty_version' => '4.21. 0',15 'version' => '4.21. 0.0',16 'reference' => ' 02af3b9c6401ca31e90085fb6f7aa1e173e58cfe',14 'pretty_version' => '4.21.1', 15 'version' => '4.21.1.0', 16 'reference' => 'ea504aa72984888a16b86759b9087f22192f44f6', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.