®~D˜«d¹ë.'; var gdpr_compliant_recaptcha_nonce = null; var gdpr_compliant_recaptcha = { stampLoaded : false, // Create an array to store override functions originalFetches : [], originalXhrOpens : [], originalXhrSends : [], originalFetch : window.fetch, abortController : new AbortController(), originalXhrOpen : XMLHttpRequest.prototype.open, originalXhrSend : XMLHttpRequest.prototype.send, // Function to check if a string is a valid JSON isValidJson : function( str ) { try { JSON.parse( str ); return true; } catch ( error ) { return false; } }, // Function to handle fetch response handleFetchResponse: function (input, init) { // Store method and URL var method = (init && init.method) ? init.method.toUpperCase() : 'GET'; var url = input; gdpr_compliant_recaptcha.originalFetches.forEach(overrideFunction => { overrideFunction.apply(this, arguments); }); // Bind the original fetch function to the window object var originalFetchBound = gdpr_compliant_recaptcha.originalFetch.bind(window); try{ // Call the original fetch method //return gdpr_compliant_recaptcha.originalFetch.apply(this, arguments).then(function (response) { return originalFetchBound(input, init).then(function (response) { var clonedResponse = response.clone(); // Check for an error response if (response.ok && method === 'POST') { // Parse the response JSON return response.text().then(function (responseData) { var data = responseData; if (gdpr_compliant_recaptcha.isValidJson(responseData)) { data = JSON.parse(responseData); } // Check if the gdpr_error_message parameter is present if (data.data && data.data.gdpr_error_message) { gdpr_compliant_recaptcha.displayErrorMessage(data.data.gdpr_error_message); gdpr_compliant_recaptcha.abortController.abort(); return Promise.reject(new Error('Request aborted')); } // Return the original response for non-error cases return clonedResponse; }); } return clonedResponse; }); } catch (error) { // Return a resolved promise in case of an error return Promise.resolve(); } }, // Full implementation of SHA265 hashing algorithm. sha256 : function( ascii ) { function rightRotate( value, amount ) { return ( value>>>amount ) | ( value<<(32 - amount ) ); } var mathPow = Math.pow; var maxWord = mathPow( 2, 32 ); var lengthProperty = 'length'; // Used as a counter across the whole file var i, j; var result = ''; var words = []; var asciiBitLength = ascii[ lengthProperty ] * 8; // Caching results is optional - remove/add slash from front of this line to toggle. // Initial hash value: first 32 bits of the fractiontion get_block_wrapper_attributes( $extra_attributes = array() ) { $new_attributes = WP_Block_Supports::get_instance()->apply_block_supports(); if ( empty( $new_attributes ) && empty( $extra_attributes ) ) { return ''; } // This is hardcoded on purpose. // We only support a fixed list of attributes. $attributes_to_merge = array( 'style', 'class', 'id' ); $attributes = array(); foreach ( $attributes_to_merge as $attribute_name ) { if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) { continue; } if ( empty( $new_attributes[ $attribute_name ] ) ) { $attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ]; continue; } if ( empty( $extra_attributes[ $attribute_name ] ) ) { $attributes[ $attribute_name ] = $new_attributes[ $attribute_name ]; continue; } $attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ] . ' ' . $new_attributes[ $attribute_name ]; } foreach ( $extra_attributes as $attribute_name => $value ) { if ( ! in_array( $attribute_name, $attributes_to_merge, true ) ) { $attributes[ $attribute_name ] = $value; } } if ( empty( $attributes ) ) { return ''; } $normalized_attributes = array(); foreach ( $attributes as $key => $value ) { $normalized_attributes[] = $key . '="' . esc_attr( $value ) . '"'; } return implode( ' ', $normalized_attributes ); }