(function(a){window.GdprUser=function(){var v=this;this.dispatch=function(){gdprDebugMode&&a("form input[name='task'],form button[name='task']").each(function(b,c){a("body").prepend('<label style="font-size:14px;background-color:#008d5a;color:#FFF;border-radius:5px;padding:10px;display:inline-block;margin:2px"><span style="font-size:16px;font-weight:bold">Form task: </span>'+a(c).val()+"</label>")});var t="";"undefined"!==typeof gdprCustomFormsUserprofileButtons&&a.each(gdprCustomFormsUserprofileButtons,
function(a,c){t+=" ,input[name='task'][value='"+c+"'],button[name='task'][value='"+c+"']"});var b=a("input[name='task'][value='profile.save'],button[name='task'][value='profile.save']"+t).parents("form");b.length||"undefined"===typeof gdprCustomComponentsViewUserprofileButtonsSelector||(b=a(gdprCustomComponentsViewUserprofileButtonsSelector));if(b.length&&0<parseInt(gdprCurrentUserId)){if(0==gdprUserprofileButtonsWorkingmode)var d='<div class="controls"><button class="btn btn-default btn-secondary button" data-role="deleter_btn">'+
COM_GDPR_DELETE_PROFILE+'</button> <button class="btn btn-default btn-secondary button" data-role="exportcsv_btn">'+COM_GDPR_EXPORT_CSV_PROFILE+'</button> <button class="btn btn-default btn-secondary button" data-role="exportxls_btn">'+COM_GDPR_EXPORT_XLS_PROFILE+"</button></div>";else 1==gdprUserprofileButtonsWorkingmode&&(d='<div class="controls"><button class="btn btn-default btn-secondary button" data-role="deleter_btn">'+COM_GDPR_DELETE_PROFILE+'</button> <button class="btn btn-default btn-secondary button" data-role="exportxls_btn">'+
COM_GDPR_EXPORT_PROFILE_REQUEST+"</button></div>");a(b).append(d);gdprDeleteButton&&!gdprDisallowDeleteProfile||a("button[data-role=deleter_btn]").remove();gdprExportButton&&!gdprDisallowExportProfile||a("button[data-role=exportcsv_btn], button[data-role=exportxls_btn]").remove();a(document).on("click","button[data-role=deleter_btn]",function(l){l.preventDefault();if(!confirm(COM_GDPR_DELETE_PROFILE_CONFIRMATION))return!1;a("input[name=option]",b).length||a(b).append('<input type="hidden" data-role="gdpr_hiddens" name="option" value="com_gdpr"/>');
a("input[name=task]",b).length||a(b).append('<input type="hidden" data-role="gdpr_hiddens" name="task" value="user.deleteEntity"/>');a("input[name=option]",b).val("com_gdpr");a("input[name=task]",b).val("user.deleteEntity");a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_option" value="'+gdprCurrentOption+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_view" value="'+gdprCurrentView+'"/>');a("input[name=task]",
b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_task" value="'+gdprCurrentTask+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_layout" value="'+gdprCurrentLayout+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_userid" value="'+gdprCurrentUserId+'"/>');var c=a(b).attr("action");"base"==gdprFormActionWorkingmode?a(b).attr("action",gdpr_livesite):a(b).removeAttr("action");a(b).trigger("submit");
c&&setTimeout(function(){a(b).attr("action",c)},100)});a(document).on("click","button[data-role=exportcsv_btn], button[data-role=exportxls_btn]",function(l){var c=a("input[name=option]",b).val(),d=a("input[name=task]",b).val();a("input[name=option]",b).length||a(b).append('<input type="hidden" data-role="gdpr_hiddens" name="option" value="com_gdpr"/>');a("input[name=task]",b).length||a(b).append('<input type="hidden" data-role="gdpr_hiddens" name="task" value="user.exportEntity"/>');a("input[name=option]",
b).val("com_gdpr");a("input[name=task]",b).val("user.exportEntity");a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="reportformat" value="'+a(this).data("role")+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_option" value="'+gdprCurrentOption+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_view" value="'+gdprCurrentView+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_task" value="'+
gdprCurrentTask+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_layout" value="'+gdprCurrentLayout+'"/>');a("input[name=task]",b).after('<input type="hidden" data-role="gdpr_hiddens" name="original_userid" value="'+gdprCurrentUserId+'"/>');var p=a("*[id^=jform_com_fields][disabled]");p.length&&p.removeAttr("disabled");var g=a(b).attr("action");"base"==gdprFormActionWorkingmode?a(b).attr("action",gdpr_livesite):a(b).removeAttr("action");a(b).trigger("submit");
g&&setTimeout(function(){a(b).attr("action",g)},100);setTimeout(function(){a("input[name=option]",b).val(c);a("input[name=task]",b).val(d);a("input[data-role=gdpr_hiddens]").remove();p.length&&p.attr("disabled","disabled")},100);return!1})}var q="";"undefined"!==typeof gdprCustomFormsTaskCheckbox&&a.each(gdprCustomFormsTaskCheckbox,function(a,c){q+=" ,input[name='task'][value='"+c+"'],button[name='task'][value='"+c+"']"});"undefined"!==typeof gdprCurrentPrivacyConsentStatus&&(q+=" ,input[name='task'][value='profile.save'],button[name='task'][value='profile.save'],#cbcheckedadminForm input[name=cbsecuritym3]");
"com_comprofiler"===gdprCurrentOption&&"userdetails"===gdprCurrentView&&"undefined"===typeof gdprCurrentPrivacyConsentStatus&&"undefined"!==typeof gdprCustomComponentsViewFormCheckboxSelector&&"#cbcheckedadminForm"===gdprCustomComponentsViewFormCheckboxSelector&&(gdprCustomComponentsViewFormCheckboxSelector=void 0);d=a("input[name='task'][value='registration.register'],button[name='task'][value='registration.register'],input[name='task'][value='contact.submit'],button[name='task'][value='contact.submit']"+
q).parents("form");d.length||"undefined"===typeof gdprCustomComponentsViewFormCheckboxSelector||(d=a(gdprCustomComponentsViewFormCheckboxSelector));if(d.length&&gdprPrivacyPolicyCheckbox&&!gdprDisallowPrivacyPolicy){var f=gdprCheckboxControlsClass?' class="'+gdprCheckboxControlsClassList+'"':"",n=gdprPrivacyPolicyControl?'<input type="checkbox" name="gdpr_privacy_policy_checkbox" id="gdpr_privacy_policy_checkbox" value="1" aria-required="true"'+f+"/>":'<input style="margin:0;padding:0" type="radio" name="gdpr_privacy_policy_checkbox" id="gdpr_r_noaccept" value="0" aria-required="true"'+
f+'><label for="gdpr_r_noaccept" style="margin:0 15px 0 5px;display:inline-block">'+COM_GDPR_PRIVACY_POLICY_NOACCEPT+'</label><input style="margin:0;padding:0" type="radio" name="gdpr_privacy_policy_checkbox" id="gdpr_r_accept" value="1" aria-required="true"'+f+'><label for="gdpr_r_accept" style="margin:0 0 0 5px;display:inline-block">'+COM_GDPR_PRIVACY_POLICY_ACCEPT+"</label>";"undefined"!==typeof gdprCurrentPrivacyPolicyConsentDate&&gdprCurrentPrivacyPolicyConsentDate&&(n+='<label class="gdpr_privacy_policy_consent_date">'+
gdprCurrentPrivacyPolicyConsentDate+"</label>");f=gdprPrivacyPolicyLabelTemplate.replace("{label}",'<a data-role="gdpr_privacy_policy" href="'+gdprPrivacyPolicyCheckboxLink+'" target="_blank"><label title="'+gdprPrivacyPolicyCheckboxLinkTitle+'" >'+gdprPrivacyPolicyCheckboxLinkText+"<span>&nbsp;*</span></label></a>");n=gdprPrivacyPolicyCheckboxTemplate.replace("{checkbox}",n);if("right"==gdprPrivacyPolicyCheckboxOrder)var e=f+n;else"left"==gdprPrivacyPolicyCheckboxOrder&&(e=n+f);e=gdprPrivacyPolicyContainerTemplate.replace("{field}",
e);"undefined"!==typeof gdprPropagateGdprPrivacyRequest&&(e+='<input type="hidden" name="gdprprivacyrequest" value="1"/>');gdprCustomAppendMethod?"parent"==gdprCustomAppendMethodTargetElement?a(gdprCustomAppendMethodSelector,d).filter(function(b){return"helpsite-refresh"==a(this).attr("id")?!1:!0}).parent().before(e):a(gdprCustomAppendMethodSelector,d).filter(function(b){return"helpsite-refresh"==a(this).attr("id")?!1:!0}).before(e):(f=a("fieldset:not(.radio):not(.checkboxes)",d).filter(function(b){return a(this).parent("div.controls").length?
!1:!0}),a(f[f.length-1]).append(e),a("fieldset:not(.radio):not(.checkboxes)",d).length||d.append(e));"undefined"!==typeof gdprCurrentPrivacyConsentStatus?(1==gdprCurrentPrivacyConsentStatus&&a("#gdpr_privacy_policy_checkbox").prop("checked",!0),a("input[type=radio][name=gdpr_privacy_policy_checkbox][value="+gdprCurrentPrivacyConsentStatus+"]").prop("checked",!0)):gdprPrivacyPolicyControl||a("input[name=gdpr_privacy_policy_checkbox][value=0]").prop("checked",!0);gdprRemoveSubmitButtonEvents&&(e=a(gdprCustomSubmissionMethodSelector,
d),e.length&&(a(".mcSignupSubmit").length&&(this.clickEvent=jQuery._data(e.get(0),"events").click[0].handler),f=e.clone(!1),e.after(f),e.remove()));gdprRemoveAttributes&&(a(gdprCustomSubmissionMethodSelector,d).removeAttr("onclick"),a(d).removeAttr("onsubmit"),gdprForceSubmitButton&&!a("input[type=submit],button[type=submit]",d).length&&a("button[type=button],input[type=button]",d).last().attr("type","submit"));"object"===typeof Onepage&&typeof Onepage.checkBinders===typeof Function&&(a("input.buttonopc[id=confirmbtn],#vmMainPageOPC #confirmbtn_button").attr("id",
"opcconfirmbtn"),gdprCustomSubmissionMethodSelector+=",input.buttonopc[id=opcconfirmbtn],input.submitbtn[id=opcconfirmbtn]");"object"===typeof ProOPC&&typeof ProOPC.submitOrder===typeof Function&&(a("#ProOPC #gdpr_privacy_policy_checkbox").length||a("#ProOPC input[type=radio][name=gdpr_privacy_policy_checkbox]").length)&&a("#proopc-order-submit").off();var r=function(b,c){try{if(typeof ff_validate_submit===typeof Function){a(".bfErrorMessage").html("").css("display","none");var l=ff_validation(0);
l?typeof bfShowErrors===typeof Function?bfShowErrors(l):alert(l):(a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",c).val())&&ff_validate_submit(this,"click");setTimeout(function(){a("#bfSubmitButton").removeAttr("data-loading").removeAttr("disabled")},100)}}catch(g){}try{if("object"===typeof Onepage&&typeof Onepage.validateFormOnePage===typeof Function&&(a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",
c).val()))return a("#adminForm").attr("id","opcform"),Onepage.validateFormOnePage(b,a("#confirmbtn, #opcconfirmbtn").get(0),!0);if("object"===typeof ProOPC&&typeof ProOPC.submitOrder===typeof Function&&(a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",c).val()))return ProOPC.submitOrder(b.target)}catch(g){}try{if(typeof submitacymailingform===typeof Function&&(a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",
c).val())){var d=a("div.acymailing_module form").attr("id");if(d==a(c).attr("id"))return submitacymailingform("optin",d)}if(typeof submitAcymForm===typeof Function&&(a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",c).val())&&(d=a("div.acym_module form").attr("id"),d==a(c).attr("id")))return submitAcymForm("subscribe",d)}catch(g){}try{if("object"===typeof crbc_checkout&&typeof crbc_checkout.submit_billing_information===typeof Function&&
(a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",c).val()))return crbc_checkout.submit_billing_information()}catch(g){}try{if(a(".mcSignupSubmit").length&&(a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",c).val())&&!b.isTrigger)return v.clickEvent.bind(b.target)()}catch(g){}if(0!=a("#gdpr_privacy_policy_checkbox:checked",c).length||1==a("input[type=radio][name=gdpr_privacy_policy_checkbox]:checked",
c).val()||"undefined"!==typeof gdprCurrentPrivacyConsentStatus&&"undefined"===typeof gdprRevokablePrivacyPolicyAlwaysMandatory)return a("a[data-role=gdpr_privacy_policy]").removeAttr("style"),a("#privacy_policy_required").remove(),!0;b=a("input[type=radio][name=gdpr_privacy_policy_checkbox]").length?a("input[type=radio][name=gdpr_privacy_policy_checkbox][value=1]",c).next("label"):a("#gdpr_privacy_policy_checkbox",c);a("a[data-role=gdpr_privacy_policy]").removeAttr("style");a("#privacy_policy_required").remove();
b.after('<label id="privacy_policy_required" style="color:#F00;display:inline-block;margin-left:5px">'+COM_GDPR_PRIVACY_POLICY_REQUIRED+"</label>");a("a[data-role=gdpr_privacy_policy]",c).css({color:"#F00","font-weight":"bold"});return!1};if("form"==gdprFormSubmissionMethod)a(d).on("submit",function(a){return r(a,this)});else if("button"==gdprFormSubmissionMethod)a("input[type=submit],button[type=submit]",d).on("click",function(b){return r(b,a(this).parents("form"))});else if("custom"==gdprFormSubmissionMethod)a(gdprCustomSubmissionMethodSelector,
d).on("click",function(b){return r(b,a(this).parents("form"))});"undefined"!==typeof gdprUseFancyboxCheckbox&&(d="undefined"!==typeof jQuery.gdprfancybox?"gdprfancybox":"fancybox",a("a[data-role=gdpr_privacy_policy]")[d]({type:"iframe",iframe:{css:{width:gdprFancyboxCheckboxWidth,height:gdprFancyboxCheckboxHeight}},buttons:["close"],beforeLoad:function(a){"undefined"!==typeof gdpr_ajaxendpoint_checkbox_policy?a.current.src=gdpr_ajaxendpoint_checkbox_policy:-1==a.current.src.indexOf("tmpl=component")&&
(-1==a.current.src.indexOf("?")?a.current.src+="?tmpl=component":a.current.src+="&tmpl=component")},afterLoad:function(b){b=a("div.fancybox-toolbar").clone(!0).end().remove();a("div.fancybox-content").prepend(b)},lang:"all",i18n:{all:{CLOSE:gdprCheckboxCloseText}}}));if("com_users"!=gdprCurrentOption&&"com_comprofiler"!=gdprCurrentOption){var m=a("input[name=gdpr_privacy_policy_checkbox]"),h=m.parents("form"),u=!!(1<h.length),k={url:a(location).attr("href"),formid:h.attr("id"),formname:h.attr("name"),
formfields:{}};gdprConsentRegistryTrackPreviousConsent&&!u&&a.ajax({type:"POST",url:gdpr_livesite+"index.php?option=com_gdpr&task=user.getConsent&format=raw",data:k,dataType:"json"}).done(function(b,c,d){0<parseInt(b.id)&&m.prop("checked",!0);c=m.get(0);!b.id&&c&&"radio"==c.type&&"gdprcountrylaw"!=m.data("setby")&&a("input[name=gdpr_privacy_policy_checkbox][value=0]").prop("checked",!0);gdprPrivacyPolicyCheckboxConsentDate&&b.consent_date&&("radio"==c.type?m.last().next().after('<label class="gdpr_privacy_policy_consent_date">'+
b.consent_date+"</label>"):m.after('<label class="gdpr_privacy_policy_consent_date">'+b.consent_date+"</label>"))});a("input[name=gdpr_privacy_policy_checkbox]").on("change",function(b){if(a(this).is(":checked")&&0<parseInt(a(this).val())){var c=gdprConsentLogsFormfields.split(",");c=c.map(function(a,b){return a.trim()});u&&(h=a(b.target).parents("form"),k.formid=h.attr("id"),k.formname=h.attr("name"),k.formfields={});a.each(c,function(b,c){b=a("input[name*="+c+"]:not(:hidden), input[id*="+c+"]:not(:hidden), textarea[name*="+
c+"], textarea[id*="+c+"]",h);b.length&&a.each(b,function(b,c){(b=a(c).attr("id"))||(b=a(c).attr("name"));b=b.replace(/[-_]/gi," ");b=b.replace(/[\[\]]/gi,"");b=b.replace("jform","");b=b.trim();c=a(c).val();k.formfields[b]=c})});a.ajax({type:"POST",url:gdpr_livesite+"index.php?option=com_gdpr&task=user.storeConsent&format=raw",data:k})}else a.ajax({type:"POST",url:gdpr_livesite+"index.php?option=com_gdpr&task=user.deleteConsent&format=raw",data:k})})}}}};a(function(){(new GdprUser).dispatch()})})(jQuery);
