function wwlcGetRecaptchaWidgetId(containerSelector){
var allWidgets=document.querySelectorAll(".g-recaptcha");
var widget=document.querySelector(containerSelector + " .g-recaptcha");
if(!widget) return 0;
var index=Array.prototype.indexOf.call(allWidgets, widget);
return index >=0 ? index:0;
}
function wwlcExecuteRecaptchaV3(siteKey, action){
return new Promise(function (resolve, reject){
if(typeof grecaptcha==='undefined'||typeof grecaptcha.ready!=='function'){
reject(new Error('grecaptcha is not available'));
return;
}
grecaptcha.ready(function (){
try {
grecaptcha.execute(siteKey, { action: action }).then(resolve, reject);
} catch (e){
reject(e);
}});
});
};