(function(a){window.GdprUser=function(){this.dispatch=function(){gdprDebugMode&&a("form input[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 r="";"undefined"!==typeof gdprCustomFormsUserprofileButtons&&a.each(gdprCustomFormsUserprofileButtons,function(a,b){r+=" ,input[name='task'][value='"+
b+"']"});var b=a("input[name='task'][value='profile.save']"+r).parents("form");b.length||"undefined"===typeof gdprCustomComponentsViewUserprofileButtonsSelector||(b=a(gdprCustomComponentsViewUserprofileButtonsSelector));if(b.length&&0<parseInt(gdprCurrentUserId)){var d='<div class="controls"><button class="btn btn-default button" data-role="deleter_btn">'+COM_GDPR_DELETE_PROFILE+'</button> <button class="btn btn-default button" data-role="exportcsv_btn">'+COM_GDPR_EXPORT_CSV_PROFILE+'</button> <button class="btn btn-default button" data-role="exportxls_btn">'+
COM_GDPR_EXPORT_XLS_PROFILE+"</button>";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){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 e=a("*[id^=jform_com_fields][disabled]");e.length&&e.removeAttr("disabled");var k=a(b).attr("action");"base"==gdprFormActionWorkingmode?a(b).attr("action",gdpr_livesite):a(b).removeAttr("action");a(b).trigger("submit");
k&&setTimeout(function(){a(b).attr("action",k)},100);setTimeout(function(){a("input[name=option]",b).val(c);a("input[name=task]",b).val(d);a("input[data-role=gdpr_hiddens]").remove();e.length&&e.attr("disabled","disabled")},100);return!1})}var p="";"undefined"!==typeof gdprCustomFormsTaskCheckbox&&a.each(gdprCustomFormsTaskCheckbox,function(a,b){p+=" ,input[name='task'][value='"+b+"']"});"undefined"!==typeof gdprCurrentPrivacyConsentStatus&&(p+=" ,input[name='task'][value='profile.save'],#cbcheckedadminForm input[name=cbsecuritym3]");
"com_comprofiler"===gdprCurrentOption&&"userdetails"===gdprCurrentView&&"undefined"===typeof gdprCurrentPrivacyConsentStatus&&"#cbcheckedadminForm"===gdprCustomComponentsViewFormCheckboxSelector&&(gdprCustomComponentsViewFormCheckboxSelector=void 0);d=a("input[name='task'][value='registration.register'], input[name='task'][value='contact.submit']"+p).parents("form");d.length||"undefined"===typeof gdprCustomComponentsViewFormCheckboxSelector||(d=a(gdprCustomComponentsViewFormCheckboxSelector));if(d.length&&
gdprPrivacyPolicyCheckbox&&!gdprDisallowPrivacyPolicy){var f=gdprCheckboxControlsClass?' class="'+gdprCheckboxControlsClassList+'"':"",m=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>";f=gdprPrivacyPolicyLabelTemplate.replace("{label}",'<a data-role="gdpr_privacy_policy" href="'+gdprPrivacyPolicyCheckboxLink+'" target="_blank"><label title="'+gdprPrivacyPolicyCheckboxLinkTitle+'" >'+gdprPrivacyPolicyCheckboxLinkText+
"<span>&nbsp;*</span></label></a>");m=gdprPrivacyPolicyCheckboxTemplate.replace("{checkbox}",m);if("right"==gdprPrivacyPolicyCheckboxOrder)var e=f+m;else"left"==gdprPrivacyPolicyCheckboxOrder&&(e=m+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),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&&(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"));var q=function(b,c){try{if(typeof ff_validate_submit===typeof Function){a(".bfErrorMessage").html("").css("display","none");var l=ff_validation(0);l?bfShowErrors(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")}}catch(k){}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").get(0),!0)}catch(k){}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)}}catch(k){}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)return 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"}),!1;a("a[data-role=gdpr_privacy_policy]").removeAttr("style");a("#privacy_policy_required").remove();return!0};if("form"==gdprFormSubmissionMethod)a(d).on("submit",function(a){return q(a,this)});else if("button"==gdprFormSubmissionMethod)a("input[type=submit],button[type=submit]",d).on("click",function(b){return q(b,a(this).parents("form"))});else if("custom"==gdprFormSubmissionMethod)a(gdprCustomSubmissionMethodSelector,
d).on("click",function(b){return q(b,a(this).parents("form"))});"undefined"!==typeof gdprUseFancyboxCheckbox&&a("a[data-role=gdpr_privacy_policy]").gdprfancybox({type:"iframe",iframe:{css:{width:gdprFancyboxCheckboxWidth,height:gdprFancyboxCheckboxHeight}},buttons:["close"],beforeLoad:function(a){"undefined"!==typeof gdpr_ajaxendpoint_checkbox_policy?(a.opts.type="ajax",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 n=a("input[name=gdpr_privacy_policy_checkbox]"),g=n.parents("form"),t=!!(1<g.length),h={url:a(location).attr("href"),formid:g.attr("id"),formname:g.attr("name"),formfields:{}};t||a.ajax({type:"POST",url:gdpr_livesite+
"index.php?option=com_gdpr&task=user.getConsent&format=raw",data:h}).done(function(b,c,d){0<parseInt(b)&&n.prop("checked",!0);c=n.get(0);""===b&&c&&"radio"==c.type&&"gdprcountrylaw"!=n.data("setby")&&a("input[name=gdpr_privacy_policy_checkbox][value=0]").prop("checked",!0)});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()});t&&(g=a(b.target).parents("form"),
h.formid=g.attr("id"),h.formname=g.attr("name"),h.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+"]",g);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();h.formfields[b]=c})});a.ajax({type:"POST",url:gdpr_livesite+"index.php?option=com_gdpr&task=user.storeConsent&format=raw",
data:h})}else a.ajax({type:"POST",url:gdpr_livesite+"index.php?option=com_gdpr&task=user.deleteConsent&format=raw",data:h})})}}}};a(function(){(new GdprUser).dispatch()})})(jQuery);
