(function(a,b){function c(a,b,c){return"
\n "+b+"\n "+c+"\n \n
"}function d(b,c,d,e="",f="",g="",h="",i=""){return a.ajax({url:apUser.ajaxUrl,type:"post",dataType:"json",data:{action:"ap_execute_user_ajax_operations",operation:b,channel:e,nonce:c,username:d,otp:f,channelValue:g,referrer:window.location.href},beforeSend:h,success:i})}function e(b,c,d,e="",f="",g,i="",j=""){a.ajax({url:apUser.ajaxUrl,type:"post",dataType:"json",data:{action:"ap_execute_login_ajax_operations",operation:b,channel:e,nonce:c,username:d,otp:f,remember:g,postId:h.postId,formId:h.formId,referrer:window.location.href},beforeSend:i,success:j})}function f(b,c,d,e="",f="",g="",i=""){a.ajax({url:apUser.ajaxUrl,type:"post",dataType:"json",data:{action:"ap_execute_reset_pass_ajax_operations",operation:b,channel:e,nonce:c,username:d,otp:f,postId:h.postId,formId:h.formId,referrer:window.location.href},beforeSend:g,success:i})}function g(b){let c,d,e=b.text().split(":"),f=60*e[0]+1*e[1],g=f,h=setInterval(function(){c=parseInt(g/60,10),d=parseInt(g%60,10),c=10>c?"0"+c:c,d=10>d?"0"+d:d,b.text(c+":"+d),0>--g&&(clearInterval(h),a(".ap-otp-heading p").text(m("Try Again Now!!!")))},1e3)}let h,i=a(document),j={},l={};const{__:m}=b.i18n;i.ajaxSuccess(function(b,g,i,j){if(j.data&&j.data.data){if(j.data.data.apRegistrationSuccess){if(h=j.data.data.apRegistrationSuccess,h.verifyChannels){let b=ap_generate_otp_modal(h.username,h.verifyChannels,h.notifyChannels,h.updateChannels);a("[data-id=\""+h.formId+"\"]").append(b)}let b;h.notifyChannels&&a.each(h.notifyChannels,function(a){b=d("notify_"+a,h.notifyChannels[a].nonce,h.username,a,"","","","")});let c;if(h.updateFields&&(c=d("update_fields",h.updateFields.nonce,h.username,"")),h.redirectTo){if(h.verifyChannels)return;a("[data-id=\""+h.formId+"\"] .ap-otp-box").append("

 "+m("Redirecting...","actions-pack")+"

"),a.when(b,c).done(function(){location.href=h.redirectTo})}}if(j.data.data.apLoginViaOtp){h=j.data.data.apLoginViaOtp;let b=ap_generate_otp_modal_login(h.username,h.nonce,h.otpLength,h.notifyChannels,h.remember,"login");a(".ap-otp-container").remove(),a("[data-id=\""+h.formId+"\"]").append(b),a.each(h.notifyChannels,function(a){e("notify_"+a,h.notifyChannels[a].nonce,h.username,a,"","","","")})}if(j.data.data.apResetPass){if(h=j.data.data.apResetPass,h.otpLength){let b=ap_generate_otp_modal_login(h.username,h.nonce,h.otpLength,h.notifyChannels,!1,"reset");a(".ap-otp-container").remove(),a("[data-id=\""+h.formId+"\"]").append(b)}a.each(h.notifyChannels,function(a){f("notify_"+a,h.notifyChannels[a].nonce,h.username,a,"","","")})}if(j.data.data.apProfileChanges){h=j.data.data.apProfileChanges;let b=a("[data-id=\""+h.form_id+"\"]");if(b.find(".elementor-alert").remove(),h.user_pending_message||h.admin_pending_message){let d=b.find("form");h.user_pending_message&&d.before(c("warning","",h.user_pending_message)),h.admin_pending_message&&d.before(c("warning","",h.admin_pending_message)),a.ajax({url:apUser.ajaxUrl,type:"post",dataType:"json",data:{action:"ap_notify_data_changes",nonce:h.nonce,username:h.username,post_id:h.post_id,form_id:h.form_id,referrer:window.location.href}})}}}!a.isEmptyObject(l)&&Object.keys(l).every(a=>l[a])&&(h&&h.redirectTo?(a("[data-id=\""+h.formId+"\"] .ap-otp-box").append("

 "+m("Redirecting...","actions-pack")+"

"),location.href=h.redirectTo):a("body").hasClass("wp-core-ui")&&(a(".ap-otp-box").append("

 "+m("Redirecting...","actions-pack")+"

"),location.reload()))}),i.on("click",".ap-otp-modal-trigger",function(){if(0===a("body").find(".ap-otp-container").length){let b=JSON.parse(decodeURIComponent(a(this).data("ajax")));console.log(b);let c=ap_generate_otp_modal(b.username,b.verifyChannels,b.notifyChannels,b.updateChannels);a(this).closest("div").after(c)}}),i.on("click",".ap-otp-resend-code",function(){let b=a(this),c=b.data("username"),e=b.data("nonce"),f=b.data("channel");d("notify_"+f,e,c,f,"","",function(){b.prop("disabled",!0),b.html(" "+m("Sending...","actions-pack"))},function(a){!0===a.success?b.html(" "+a.data):b.html(" "+a.data)})}),i.on("click",".ap-otp-change-channel",function(){let b=a(this),c=b.parents(".ap-otp-actions").next();if(c.toggleClass("ap-active"),"email"!==b.prev().data("channel")&&0===c.find("select").length){let a={countries:[{code:"+7 840",name:"Abkhazia"},{code:"+93",name:"Afghanistan"},{code:"+355",name:"Albania"},{code:"+213",name:"Algeria"},{code:"+1 684",name:"American Samoa"},{code:"+376",name:"Andorra"},{code:"+244",name:"Angola"},{code:"+1 264",name:"Anguilla"},{code:"+1 268",name:"Antigua and Barbuda"},{code:"+54",name:"Argentina"},{code:"+374",name:"Armenia"},{code:"+297",name:"Aruba"},{code:"+247",name:"Ascension"},{code:"+61",name:"Australia"},{code:"+672",name:"Australian External Territories"},{code:"+43",name:"Austria"},{code:"+994",name:"Azerbaijan"},{code:"+1 242",name:"Bahamas"},{code:"+973",name:"Bahrain"},{code:"+880",name:"Bangladesh"},{code:"+1 246",name:"Barbados"},{code:"+1 268",name:"Barbuda"},{code:"+375",name:"Belarus"},{code:"+32",name:"Belgium"},{code:"+501",name:"Belize"},{code:"+229",name:"Benin"},{code:"+1 441",name:"Bermuda"},{code:"+975",name:"Bhutan"},{code:"+591",name:"Bolivia"},{code:"+387",name:"Bosnia and Herzegovina"},{code:"+267",name:"Botswana"},{code:"+55",name:"Brazil"},{code:"+246",name:"British Indian Ocean Territory"},{code:"+1 284",name:"British Virgin Islands"},{code:"+673",name:"Brunei"},{code:"+359",name:"Bulgaria"},{code:"+226",name:"Burkina Faso"},{code:"+257",name:"Burundi"},{code:"+855",name:"Cambodia"},{code:"+237",name:"Cameroon"},{code:"+1",name:"Canada"},{code:"+238",name:"Cape Verde"},{code:"+ 345",name:"Cayman Islands"},{code:"+236",name:"Central African Republic"},{code:"+235",name:"Chad"},{code:"+56",name:"Chile"},{code:"+86",name:"China"},{code:"+61",name:"Christmas Island"},{code:"+61",name:"Cocos-Keeling Islands"},{code:"+57",name:"Colombia"},{code:"+269",name:"Comoros"},{code:"+242",name:"Congo"},{code:"+243",name:"Congo, Dem. Rep. of (Zaire)"},{code:"+682",name:"Cook Islands"},{code:"+506",name:"Costa Rica"},{code:"+385",name:"Croatia"},{code:"+53",name:"Cuba"},{code:"+599",name:"Curacao"},{code:"+537",name:"Cyprus"},{code:"+420",name:"Czech Republic"},{code:"+45",name:"Denmark"},{code:"+246",name:"Diego Garcia"},{code:"+253",name:"Djibouti"},{code:"+1 767",name:"Dominica"},{code:"+1 809",name:"Dominican Republic"},{code:"+670",name:"East Timor"},{code:"+56",name:"Easter Island"},{code:"+593",name:"Ecuador"},{code:"+20",name:"Egypt"},{code:"+503",name:"El Salvador"},{code:"+240",name:"Equatorial Guinea"},{code:"+291",name:"Eritrea"},{code:"+372",name:"Estonia"},{code:"+251",name:"Ethiopia"},{code:"+500",name:"Falkland Islands"},{code:"+298",name:"Faroe Islands"},{code:"+679",name:"Fiji"},{code:"+358",name:"Finland"},{code:"+33",name:"France"},{code:"+596",name:"French Antilles"},{code:"+594",name:"French Guiana"},{code:"+689",name:"French Polynesia"},{code:"+241",name:"Gabon"},{code:"+220",name:"Gambia"},{code:"+995",name:"Georgia"},{code:"+49",name:"Germany"},{code:"+233",name:"Ghana"},{code:"+350",name:"Gibraltar"},{code:"+30",name:"Greece"},{code:"+299",name:"Greenland"},{code:"+1 473",name:"Grenada"},{code:"+590",name:"Guadeloupe"},{code:"+1 671",name:"Guam"},{code:"+502",name:"Guatemala"},{code:"+224",name:"Guinea"},{code:"+245",name:"Guinea-Bissau"},{code:"+595",name:"Guyana"},{code:"+509",name:"Haiti"},{code:"+504",name:"Honduras"},{code:"+852",name:"Hong Kong SAR China"},{code:"+36",name:"Hungary"},{code:"+354",name:"Iceland"},{code:"+91",name:"India"},{code:"+62",name:"Indonesia"},{code:"+98",name:"Iran"},{code:"+964",name:"Iraq"},{code:"+353",name:"Ireland"},{code:"+972",name:"Israel"},{code:"+39",name:"Italy"},{code:"+225",name:"Ivory Coast"},{code:"+1 876",name:"Jamaica"},{code:"+81",name:"Japan"},{code:"+962",name:"Jordan"},{code:"+7 7",name:"Kazakhstan"},{code:"+254",name:"Kenya"},{code:"+686",name:"Kiribati"},{code:"+965",name:"Kuwait"},{code:"+996",name:"Kyrgyzstan"},{code:"+856",name:"Laos"},{code:"+371",name:"Latvia"},{code:"+961",name:"Lebanon"},{code:"+266",name:"Lesotho"},{code:"+231",name:"Liberia"},{code:"+218",name:"Libya"},{code:"+423",name:"Liechtenstein"},{code:"+370",name:"Lithuania"},{code:"+352",name:"Luxembourg"},{code:"+853",name:"Macau SAR China"},{code:"+389",name:"Macedonia"},{code:"+261",name:"Madagascar"},{code:"+265",name:"Malawi"},{code:"+60",name:"Malaysia"},{code:"+960",name:"Maldives"},{code:"+223",name:"Mali"},{code:"+356",name:"Malta"},{code:"+692",name:"Marshall Islands"},{code:"+596",name:"Martinique"},{code:"+222",name:"Mauritania"},{code:"+230",name:"Mauritius"},{code:"+262",name:"Mayotte"},{code:"+52",name:"Mexico"},{code:"+691",name:"Micronesia"},{code:"+1 808",name:"Midway Island"},{code:"+373",name:"Moldova"},{code:"+377",name:"Monaco"},{code:"+976",name:"Mongolia"},{code:"+382",name:"Montenegro"},{code:"+1664",name:"Montserrat"},{code:"+212",name:"Morocco"},{code:"+95",name:"Myanmar"},{code:"+264",name:"Namibia"},{code:"+674",name:"Nauru"},{code:"+977",name:"Nepal"},{code:"+31",name:"Netherlands"},{code:"+599",name:"Netherlands Antilles"},{code:"+1 869",name:"Nevis"},{code:"+687",name:"New Caledonia"},{code:"+64",name:"New Zealand"},{code:"+505",name:"Nicaragua"},{code:"+227",name:"Niger"},{code:"+234",name:"Nigeria"},{code:"+683",name:"Niue"},{code:"+672",name:"Norfolk Island"},{code:"+850",name:"North Korea"},{code:"+1 670",name:"Northern Mariana Islands"},{code:"+47",name:"Norway"},{code:"+968",name:"Oman"},{code:"+92",name:"Pakistan"},{code:"+680",name:"Palau"},{code:"+970",name:"Palestinian Territory"},{code:"+507",name:"Panama"},{code:"+675",name:"Papua New Guinea"},{code:"+595",name:"Paraguay"},{code:"+51",name:"Peru"},{code:"+63",name:"Philippines"},{code:"+48",name:"Poland"},{code:"+351",name:"Portugal"},{code:"+1 787",name:"Puerto Rico"},{code:"+974",name:"Qatar"},{code:"+262",name:"Reunion"},{code:"+40",name:"Romania"},{code:"+7",name:"Russia"},{code:"+250",name:"Rwanda"},{code:"+685",name:"Samoa"},{code:"+378",name:"San Marino"},{code:"+966",name:"Saudi Arabia"},{code:"+221",name:"Senegal"},{code:"+381",name:"Serbia"},{code:"+248",name:"Seychelles"},{code:"+232",name:"Sierra Leone"},{code:"+65",name:"Singapore"},{code:"+421",name:"Slovakia"},{code:"+386",name:"Slovenia"},{code:"+677",name:"Solomon Islands"},{code:"+27",name:"South Africa"},{code:"+500",name:"South Georgia and the South Sandwich Islands"},{code:"+82",name:"South Korea"},{code:"+34",name:"Spain"},{code:"+94",name:"Sri Lanka"},{code:"+249",name:"Sudan"},{code:"+597",name:"Suriname"},{code:"+268",name:"Swaziland"},{code:"+46",name:"Sweden"},{code:"+41",name:"Switzerland"},{code:"+963",name:"Syria"},{code:"+886",name:"Taiwan"},{code:"+992",name:"Tajikistan"},{code:"+255",name:"Tanzania"},{code:"+66",name:"Thailand"},{code:"+670",name:"Timor Leste"},{code:"+228",name:"Togo"},{code:"+690",name:"Tokelau"},{code:"+676",name:"Tonga"},{code:"+1 868",name:"Trinidad and Tobago"},{code:"+216",name:"Tunisia"},{code:"+90",name:"Turkey"},{code:"+993",name:"Turkmenistan"},{code:"+1 649",name:"Turks and Caicos Islands"},{code:"+688",name:"Tuvalu"},{code:"+1 340",name:"U.S. Virgin Islands"},{code:"+256",name:"Uganda"},{code:"+380",name:"Ukraine"},{code:"+971",name:"United Arab Emirates"},{code:"+44",name:"United Kingdom"},{code:"+1",name:"United States"},{code:"+598",name:"Uruguay"},{code:"+998",name:"Uzbekistan"},{code:"+678",name:"Vanuatu"},{code:"+58",name:"Venezuela"},{code:"+84",name:"Vietnam"},{code:"+1 808",name:"Wake Island"},{code:"+681",name:"Wallis and Futuna"},{code:"+967",name:"Yemen"},{code:"+260",name:"Zambia"},{code:"+255",name:"Zanzibar"},{code:"+263",name:"Zimbabwe"}]},b="";for(let c=0;c"+a.countries[c].name+" ("+a.countries[c].code+")";c.prepend("")}}),i.on("click",".ap-otp-update-channel button",function(){let b=a(this),c=b.data("channel"),e=b.data("username"),f=b.data("nonce"),g=b.prev().val();if("phone"===c){let a=b.prev().prev().find(":selected").val();g=a+g}g=g.replace(/ /g,""),d("update_"+c,f,e,c,"",g,function(){b.prop("disabled",!0),b.html(" "+m("Updating","actions-pack"))},function(a){!0===a.success?(b.html(" "+a.data),b.prev().prop("disabled",!0),setTimeout(function(){b.parents(".ap-otp-update-channel").removeClass("ap-active")},500)):(b.html(" Try Again"),b.prev().val(a.data),b.prop("disabled",!1))})}),window.ap_generate_otp_modal=function(b,c,d,e){let f="
";return a.each(c,function(a){f+="
",f+="
",f+="

"+m("Enter the ","actions-pack")+c[a].length+m(" digits code sent to your ","actions-pack")+""+a+"

",f+="
";for(let b=0;b";f+="
",f+="",f+="
",f+="
",l[a]=!1}),f+="
",f},window.ap_generate_otp_modal_login=function(b,c,d,e,f,g){let h="
";h+="
",h+="
";let j=[],k=0;a.each(e,function(a){j[k]=a,k++}),h+="

"+m("Enter the ","actions-pack")+d+m(" digits code sent to your ","actions-pack")+j.join(" & ")+"

",h+="
";for(let a=0;a";return h+="
",h+="
",l.otp=!1,h+="
",h},i.on("keyup",".ap-otp-inputs input",function(b){let c=a(this),h=c.closest(".ap-otp-inputs");8===b.keyCode||37===b.keyCode?c.prev(":input").focus():c.next(":input").focus();let i=h.data("channel");j[i]||(j[i]=[]),""!==c.val()&&(j[i][c.data("index")]=c.val());let k=h.data("length");if(j[i].length===k){let b=h.data("username"),c=h.data("nonce"),k=function(){h.find("input").prop("disabled",!0),h.prev().find("p").html(" "+m("Verifying your ","actions-pack")+""+i+"")},n=function(b){!0===b.success?(h.prev().find("p").html(" "+b.data),h.hide(),h.next().hide(),l[i]=!0):(h.prev().find("p").html(" "+b.data),h.find("input").prop("disabled",!1).val(""),h.find("input:first").focus(),g(a(".apCountDown")))};if("login"===h.data("form"))e("verify_otp",c,b,"otp",j[i].join(""),h.data("remember"),k,n);else if("reset"===h.data("form")){f("verify_otp",c,b,"otp",j[i].join(""),k,function(b){!0===b.success?(h.prev().find("p").html(" "+b.data.message),h.hide(),h.next().hide(),l[i]=!0):(h.prev().find("p").html(" "+b.data),h.find("input").prop("disabled",!1).val(""),h.find("input:first").focus(),g(a(".apCountDown")))})}else d("verify_"+i,c,b,i,j[i].join(""),"",k,n);delete j[i]}})})(jQuery,wp);