var astraGetParents=function(e,t){Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),a=t.length;0<=--a&&t.item(a)!==this;);return-1e.offsetHeight+100?t.style.display="block":t.style.display="none":300 #ast-desktop-header .ast-desktop-header-content"),n=document.querySelector(".elementor-editor-active"),a&&(a.style.display="none"),(null!==navigator.userAgent.match(/Android/i)&&"Android"===navigator.userAgent.match(/Android/i)[0]?window.visualViewport.width:window.innerWidth)!==s&&(t&&null===n&&t.click(),document.body.classList.remove("ast-main-header-nav-open","ast-popup-nav-open"),e)&&null==n&&e.click(),h(),AstraToggleSetup())}),document.addEventListener("DOMContentLoaded",function(){if(AstraToggleSetup(),null!==(e=u.classList.contains("ast-header-break-point")?document.getElementById("ast-mobile-header"):document.getElementById("ast-desktop-header"))){var e,t=e.querySelector(".navigation-accessibility");if(t&&e){var a=e.getElementsByTagName("button")[0];if(void 0===a){if(!0===(a=e.getElementsByTagName("a")[0]).classList.contains("astra-search-icon"))return;if(void 0===a)return}var n=t.getElementsByTagName("ul")[0];if(void 0===n)a.style.display="none";else{if(-1===n.className.indexOf("nav-menu")&&(n.className+=" nav-menu"),"off-canvas"===d&&(document.getElementById("menu-toggle-close").onclick=function(){-1!==t.className.indexOf("toggled")?(t.className=t.className.replace(" toggled",""),a.setAttribute("aria-expanded","false"),n.setAttribute("aria-expanded","false")):(t.className+=" toggled",a.setAttribute("aria-expanded","true"),n.setAttribute("aria-expanded","true"))}),a.onclick=function(){-1!==t.className.indexOf("toggled")?(t.className=t.className.replace(" toggled",""),a.setAttribute("aria-expanded","false"),n.setAttribute("aria-expanded","false")):(t.className+=" toggled",a.setAttribute("aria-expanded","true"),n.setAttribute("aria-expanded","true"))},!astra.is_header_footer_builder_active){for(var s=n.getElementsByTagName("a"),o=n.getElementsByTagName("ul"),r=0,l=o.length;r a .ast-header-navigation-arrow"),a=document.querySelectorAll("nav.site-navigation .sub-menu"),n=document.querySelectorAll("nav.site-navigation .menu-item-has-children"),s=document.querySelectorAll(".astra-full-megamenu-wrapper");t&&(t.forEach(e=>{e.addEventListener("keydown",function(a){"Enter"===a.key&&(a.target.closest("li").querySelector(".sub-menu").classList.contains("astra-megamenu")?setTimeout(()=>{var e=a.target.closest("li").querySelector(".sub-menu"),t=a.target.closest("li").querySelector(".astra-full-megamenu-wrapper");e&&e.classList.toggle("astra-megamenu-focus"),t&&t.classList.toggle("astra-megamenu-wrapper-focus"),a.target.closest("li").classList.toggle("ast-menu-hover"),"false"!==a.target.getAttribute("aria-expanded")&&a.target.getAttribute("aria-expanded")?a.target.setAttribute("aria-expanded","false"):a.target.setAttribute("aria-expanded","true")},10):setTimeout(()=>{a.target.closest("li").querySelector(".sub-menu").classList.toggle("toggled-on"),a.target.closest("li").classList.toggle("ast-menu-hover"),"false"!==a.target.getAttribute("aria-expanded")&&a.target.getAttribute("aria-expanded")?a.target.setAttribute("aria-expanded","false"):a.target.setAttribute("aria-expanded","true")},10))})}),(a||n)&&document.addEventListener("click",function(e){b(a,t,n,s)},!1),a||n)&&document.addEventListener("keydown",function(e){"Escape"===e.key&&b(a,t,n,s)},!1);var e=document.querySelectorAll("nav.site-navigation .ast-nav-menu > .menu-item-has-children > a .ast-header-navigation-arrow");e&&e.forEach(e=>{e.addEventListener("keydown",function(e){e.target.closest("li").classList.contains("ast-menu-hover")||"Enter"!==e.key||b(a,t,n,s)},!1)})}()}}}});for(var t,a,o,l,h=function(){var e=u.style.overflow,t=(u.style.overflow="hidden",document.documentElement.clientWidth);if(u.style.overflow=e,astra.break_point .menu-link, ul.main-header-menu .ast-menu-toggle"):t[r].querySelectorAll("ul.main-header-menu .ast-menu-toggle")).length)for(var l=0;l #ast-mobile-header .main-header-bar-navigation"),t=(r=document.querySelectorAll("#masthead > #ast-mobile-header .main-header-menu-toggle"),"0");if(null!==this.closest("#ast-fixed-header")&&(e=document.querySelectorAll("#ast-fixed-header > #ast-mobile-header .main-header-bar-navigation"),r=document.querySelectorAll("#ast-fixed-header .main-header-menu-toggle"),t="0"),void 0===e[t])return!1;for(var a=e[t].querySelectorAll(".menu-item-has-children"),n=0;n{e.classList.remove("astra-megamenu-focus"),e.classList.remove("toggled-on")}),a&&a.forEach(e=>{e.classList.remove("ast-menu-hover")}),n&&n.forEach(e=>{e.classList.remove("astra-megamenu-wrapper-focus")}),t&&t.forEach(e=>{e.setAttribute("aria-expanded","false")})}function L(){var e=this||"";if(e&&!e.classList.contains("astra-search-icon")&&null===e.closest(".ast-builder-menu")&&-1!==new String(e).indexOf("#")){var t=e.parentNode;if(u.classList.contains("ast-header-break-point"))document.querySelector("header.site-header").classList.contains("ast-builder-menu-toggle-link")&&t.classList.contains("menu-item-has-children")||(document.querySelector(".main-header-menu-toggle").classList.remove("toggled"),(t=document.querySelector(".main-header-bar-navigation")).classList.remove("toggle-on"),t.style.display="none",astraTriggerEvent(document.querySelector("body"),"astraMenuHashLinkClicked"));else for(;-1===e.className.indexOf("nav-menu");)"li"===e.tagName.toLowerCase()&&-1!==e.className.indexOf("focus")&&(e.className=e.className.replace(" focus","")),e=e.parentElement}}function k(){for(var e=this;-1===e.className.indexOf("navigation-accessibility");)"li"===e.tagName.toLowerCase()&&e.classList.toggle("focus"),e=e.parentElement}if(u.onclick=function(e){if(void 0!==e.target.classList&&!e.target.classList.contains("ast-search-menu-icon")&&0===astraGetParents(e.target,".ast-search-menu-icon").length&&0===astraGetParents(e.target,".ast-search-icon").length)for(var t=document.getElementsByClassName("ast-search-menu-icon"),a=0;a{t+=e.clientHeight}),a=this.hash)&&(a=document.querySelector(a))&&(a=a.offsetTop-t)&&astraSmoothScroll(e,a)}}astra.is_scroll_to_top&&(o=document.querySelector("#page header"),l=document.getElementById("ast-scroll-top"),astScrollToTopHandler(o,l),window.addEventListener("scroll",function(){astScrollToTopHandler(o,l)}),l.onclick=function(e){astraSmoothScroll(e,0)},l.addEventListener("keydown",function(e){"Enter"===e.key&&astraSmoothScroll(e,0)}))}();; jQuery(document).ready(function($){window.xooEl=window.xooEl||{};function objectifyForm($form){var form=$form instanceof jQuery?$form[0]:$form;var formData=new FormData(form);var result={};formData.forEach(function(value,name){if(value instanceof File)return;if(result.hasOwnProperty(name)){if(!Array.isArray(result[name])){result[name]=[result[name]]} result[name].push(value)}else{result[name]=value}});return result} function parse_notice(message,type){type=(typeof type!=='undefined')?type:'error';return xoo_el_localize.html.notice[type].replace('%s',message)} var classReferral={'xoo-el-login-tgr':'login','xoo-el-reg-tgr':'register',} function getReferral(className){return classReferral[className]?classReferral[className]:''} function getFormsTrigger($container){$container=$container||'';var isSingle=!1;if($container.length&&$container.find('.xoo-el-section[data-section="single"]').length){isSingle=!0} var formsTrigger={'xoo-el-sing-tgr':'single','xoo-el-login-tgr':isSingle?'single':'login','xoo-el-reg-tgr':isSingle?'single':'register','xoo-el-lostpw-tgr':'lostpw','xoo-el-resetpw-tgr':'resetpw','xoo-el-forcereg-tgr':'register','xoo-el-forcelogin-tgr':'login',} return formsTrigger} class Container{constructor($container){this.$container=$container;this.$tabs=$container.find('ul.xoo-el-tabs').length?$container.find('ul.xoo-el-tabs'):null;this.display=$container.hasClass('xoo-el-form-inline')?'inline':'popup';this.formRetries=0;if(this.$container.attr('data-active')){this.toggleForm(this.$container.attr('data-active'))} this.createFormsTriggerHTML();this.eventHandlers()} createFormsTriggerHTML(){var HTML='
';$.each(getFormsTrigger(this.$container),function(triggerClass,type){HTML+=''}) HTML+='
';this.$container.append(HTML)} eventHandlers(){this.$container.on('submit','.xoo-el-action-form',this.submitForm.bind(this));this.$container.on('click','.xoo-el-edit-em',this.emailFieldEditClick.bind(this));$(document.body).on('xoo_el_form_submitted',this.singleFormProcess.bind(this));this.formTriggerEvent()} emailFieldEditClick(e){this.toggleForm('single');this.$container.find('input[name="xoo-el-sing-user"]').val($(e.currentTarget).siblings('input').val()).focus().trigger('keyup')} formTriggerEvent(){var container=this,formsTrigger=getFormsTrigger(container.$container);$.each(formsTrigger,function(triggerClass,formType){$(container.$container).on('click','.'+triggerClass,function(e){e.preventDefault();e.stopImmediatePropagation();container.toggleForm(formType,getReferral(triggerClass))})})} toggleForm(formType,referral){referral=referral||'';this.$container.attr('data-active',formType);var $section=this.$container.find('.xoo-el-section[data-section="'+formType+'"]'),activeClass='xoo-el-active';if($section.length){var $sectionForm=$section.find('form');this.$container.find('.xoo-el-section').removeClass(activeClass);$section.addClass(activeClass);$section.find('.xoo-el-notice').html('').hide();$section.find('.xoo-el-action-form').show();if($sectionForm.length&&referral&&$sectionForm.find('input[name="_xoo_el_referral"]').length){$sectionForm.find('input[name="_xoo_el_referral"]').val(referral)}} if(this.$tabs){this.$tabs.find('li').removeClass(activeClass);if(this.$tabs.find('li[data-tab="'+formType+'"]').length){this.$tabs.find('li[data-tab="'+formType+'"]').addClass(activeClass)}} $(document.body).trigger('xoo_el_form_toggled',[formType,this,referral]);this.$container.triggerHandler('xoo_el_form_toggled',[formType,this,referral])} submitForm(e){e.preventDefault();var $form=$(e.currentTarget),$button=$form.find('button[type="submit"]'),$section=$form.parents('.xoo-el-section'),buttonTxt=$button.text(),$notice=$section.find('.xoo-el-notice'),formType=$section.attr('data-section'),container=this;$notice.html('');$button.html(xoo_el_localize.html.spinner).addClass('xoo-el-processing');var form_data=new FormData($form[0]);form_data.append('action','xoo_el_form_action');form_data.append('display',container.display);$.ajax({url:xoo_el_localize.adminurl,type:'POST',processData:!1,contentType:!1,cache:!1,enctype:'multipart/form-data',data:form_data,complete:function(xhr,status){$button.removeClass('xoo-el-processing').html(buttonTxt);if((status!=='success'||!xhr.responseJSON||xhr.responseJSON.error===undefined)){if(container.formRetries<2){$form.submit();container.formRetries++;return} if(xoo_el_localize.errorLog==='yes'){$notice.html(parse_notice("We could not process your request, please check console or try again later.",'error')).show()}else if(status!=='error'){location.reload()}}},success:function(response){container.formRetries=0;if(response.error===undefined){console.log(response);return} if(response.notice){$notice.html(response.notice).show();if(container.display==='inline'){$('html, body').animate({scrollTop:$notice.offset().top-100},500)}} if(response.error===0){if(response.redirect){setTimeout(function(){window.location=response.redirect},xoo_el_localize.redirectDelay)}else{$form.hide()} $form.trigger('reset');if(formType==='resetpw'&&xoo_el_localize.resetPwPattern==='link'){$form.add('.xoo-el-resetpw-hnotice').remove()}} $(document.body).trigger('xoo_el_form_submitted',[response,$form,container]);$form.triggerHandler('xoo_el_form_submitted',[response,$form,container])}}).fail(function(jqXHR,textStatus,errorThrown){if(container.formRetries<2)return;$('body, .xoo-el-popup-notice').addClass('xoo-el-popup-notice-active');var iframe=$('.xoo-el-notice-wrap iframe').get(0);iframe.contentWindow.document.open();iframe.contentWindow.document.write(jqXHR.responseText);iframe.contentWindow.document.close();var iframeDocument=iframe.contentWindow.document;var style=iframeDocument.createElement("style");style.textContent=$('.xoo-el-notice-iframestyle').text();iframeDocument.head.appendChild(style)})} singleFormProcess(e,response,$form,container){if(this!==container)return;if(response.field){var $field=this.$container.find(response.field);if($field.length){this.toggleForm($field.closest('.xoo-el-section').attr('data-section'));$field.closest('form').show();$field.val(response.fieldValue);$field.closest('.xoo-el-section').find('.xoo-el-notice').html(response.notice).show();var $fieldCont=$field.closest('.xoo-aff-group');if(!$fieldCont.find('.xoo-el-edit-em').length){$fieldCont.addClass('xoo-el-block-edit');$(xoo_el_localize.html.editField).insertAfter($field)}}}}} class Popup{constructor($popup){this.$popup=$popup;this.eventHandlers()} eventHandlers(){if(!xoo_el_localize.preventClosing){this.$popup.on('click','.xoo-el-close, .xoo-el-modal, .xoo-el-opac',this.closeOnClick.bind(this));$(document.body).on('xoo_el_popup_toggled.xooEscEvent',this.onPopupToggled.bind(this))} $(document.body).on('xoo_el_form_submitted',this.onFormSubmitSuccess.bind(this));this.$popup.on('click','.xoo-el-action-btn',this.setScrollBarOnSubmit.bind(this));$(window).on('hashchange load',this.openViaHash.bind(this));this.triggerPopupOnClick();if(xoo_el_localize.checkout&&xoo_el_localize.checkout.loginEnabled==='yes'){$('body').on('click','.wc-block-checkout__login-prompt, .wc-block-must-login-prompt',this.checkoutPageLinkClick.bind(this))}} onPopupToggled(e,type){if($('body').hasClass('xoo-el-popup-active')){$(document).on('keydown.xooEscClose',this.closeOnEscPress.bind(this))}else{$(document).off('keydown.xooEscClose')}} closeOnEscPress(e){if(event.key==="Escape"||event.keyCode===27){popup.toggle('hide')}} checkoutPageLinkClick(e){e.preventDefault();$(e.currentTarget).attr('data-redirect',xoo_el_localize.checkout.loginRedirect).addClass('xoo-el-login-tgr').trigger('click')} triggerPopupOnClick(){$.each(getFormsTrigger(this.$popup),function(triggerClass,formType){$(document.body).on('click','.'+triggerClass,function(e){if($(this).parents('.xoo-el-form-container').length)return!0;e.preventDefault();e.stopImmediatePropagation();popup.toggle('show');if($(this).attr('data-redirect')){popup.$popup.find('input[name="xoo_el_redirect"]').val($(this).attr('data-redirect'))} popup.$popup.find('.'+triggerClass).trigger('click');return!1})})} toggle(type){var $els=this.$popup.add('body'),activeClass='xoo-el-popup-active';if(type==='show'){$els.addClass(activeClass)}else if(type==='hide'){$els.removeClass(activeClass)}else{$els.toggleClass(activeClass)} $(document.body).trigger('xoo_el_popup_toggled',[type])} closeOnClick(e){var elClassList=e.target.classList;if(elClassList.contains('xoo-el-close')||elClassList.contains('xoo-el-modal')||elClassList.contains('xoo-el-opac')){this.toggle('hide')}} setScrollbarPosition(position){this.$popup.find('.xoo-el-srcont').animate({scrollTop:position||0},300);console.log(this.$popup.find('.xoo-el-srcont').scrollTop)} onFormSubmitSuccess(e,response,$form,container){this.setScrollbarPosition()} setScrollBarOnSubmit(e){var invalid_els=$(e.currentTarget).closest('form').find('input:invalid');if(invalid_els.length===0)return;this.setScrollbarPosition(invalid_els.filter(":first").closest('.xoo-aff-group').position().top)} openViaHash(){var hash=$(location).attr('hash');if(hash==='#login'||hash==='#register'){this.toggle('show');var uri=window.location.toString(),clean_uri=uri.substring(0,uri.indexOf("#"));window.history.replaceState({},document.title,clean_uri)} if(hash==='#login'){this.$popup.find('.xoo-el-login-tgr').trigger('click')}else if(hash==='#register'){this.$popup.find('.xoo-el-reg-tgr').trigger('click')}}} class Form{constructor($form){this.$form=$form} eventHandlers(){}} var popup=null;if($('.xoo-el-container').length){popup=new Popup($('.xoo-el-container'))} if(xoo_el_localize.isLoggedIn==="no"&&xoo_el_localize.autoOpenPopup==='yes'&&localStorage.getItem("xoo_el_popup_opened")!=="yes"){if(xoo_el_localize.autoOpenPopupOnce==="yes"){localStorage.setItem("xoo_el_popup_opened","yes")} setTimeout(function(){popup.toggle('show')},xoo_el_localize.aoDelay)} $('.xoo-el-form-container').each(function(key,el){new Container($(el))}) if($('form.xoo-el-form-resetpw').length&&xoo_el_localize.resetPwPattern==="link"){if($('.xoo-el-form-inline').length){$([document.documentElement,document.body]).animate({scrollTop:$(".xoo-el-form-inline").offset().top},500)}else{if(popup){popup.toggle('show')}}} if($('body.woocommerce-checkout').length&&$('.xoo-el-form-inline').length&&$('a.showlogin').length){var $inlineForm=$('.xoo-el-form-inline');$inlineForm.hide();$(document.body).on('click','a.showlogin',function(){$inlineForm.slideToggle();$inlineForm.find('.xoo-el-login-tgr').trigger('click')})} if(popup&&xoo_el_localize.loginClass&&$('.'+xoo_el_localize.loginClass).length){$('body:not(.logged-in) .'+xoo_el_localize.loginClass).on('click',function(e){e.preventDefault();e.stopImmediatePropagation();popup.toggle('show');popup.$popup.find('.xoo-el-login-tgr').trigger('click')})} if(popup&&xoo_el_localize.registerClass&&$('.'+xoo_el_localize.registerClass).length){$('body:not(.logged-in) .'+xoo_el_localize.registerClass).on('click',function(e){e.preventDefault();e.stopImmediatePropagation();popup.toggle('show');popup.$popup.find('.xoo-el-reg-tgr').trigger('click')})} $('.xoo-el-notice-close').on('click',function(){$('body, .xoo-el-popup-notice').removeClass('xoo-el-popup-notice-active')}) class CodeFormHandler{constructor($codeForm){const existing=CodeFormHandler.instances.get($codeForm[0]);if(existing)return existing;this.$codeForm=$codeForm;this.codeFormID=this.$codeForm.data('code');this.$parentForm=this.$codeForm.data('parentform')?$(this.$codeForm.siblings(this.$codeForm.data('parentform')).get(0)):$();this.CodePasted=!1;this.resendData={};this.$noticeCont=this.$codeForm.find('.xoo-el-code-notice');this.$submitBtn=this.$codeForm.find('.xoo-el-code-submit-btn');this.submitBtnTxt=this.$submitBtn.html();this.$inputs=this.$codeForm.find('.xoo-el-code-input');this.$resendLink=this.$codeForm.find('.xoo-el-code-resend-link');this.noticeTimout=this.resendTimer=!1;this.parentFormValues={} this.codesent=!1;this.$container=this.$codeForm.closest('.xoo-el-form-container');this.events();CodeFormHandler.instances.set($codeForm[0],this)} events(){this.$resendLink.on('click',{_thisObj:this},this.resendCode);this.$codeForm.find('.xoo-el-code-no-change').on('click',{_thisObj:this},this.changeParentInput);this.$codeForm.on('submit',{_thisObj:this},this.onSubmit);this.$inputs.on('paste',{_thisObj:this},this.onCodeInputPaste);this.$inputs.on('input',{_thisObj:this},this.onCodeInputChange);this.$inputs.on('keydown ',{_thisObj:this},this.beforeCodeInputChange);this.$container.on('xoo_el_form_toggled',this.onParentFormToggled.bind(this))} onParentFormToggled(e,formType,containerObj,referral){let _thisObj=this;if(_thisObj.codesent){_thisObj.$parentForm.hide();_thisObj.$codeForm.show()}} onCodeInputPaste(event){var _thisObj=event.data._thisObj,_this=$(this);_thisObj.CodePasted=!0;setTimeout(function(){var inputVal=_this.val().trim(),inputValLength=inputVal.length;_thisObj.$inputs.val('');for(var i=0;i1&&!_thisObj.CodePasted){$(this).trigger('paste');return} if(_thisObj.CodePasted||_thisObj.processing){return} _thisObj.processing=!0;var $nextInput=$(this).next('input.xoo-el-code-input'),$prevInput=$(this).prev('input.xoo-el-code-input');if(inputValLength&&$nextInput.length!==0){$nextInput.focus()} _thisObj.processing=!1} beforeCodeInputChange(event){var _thisObj=event.data._thisObj,inputVal=$(this).val(),inputValLength=inputVal.length;var $nextInput=$(this).next('input.xoo-el-code-input'),$prevInput=$(this).prev('input.xoo-el-code-input');if(inputVal.length&&event.keyCode!=8&&event.keyCode!==13){if($nextInput.length&&!$nextInput.val()){$nextInput.focus()}else{$(this).val('')}} if(!inputValLength&&event.keyCode==8&&$prevInput.length!==0){$prevInput.focus()}} onSubmit(event){event.preventDefault();var _thisObj=event.data._thisObj;if(!_thisObj.validateInputs()||!_thisObj.getCodeValue().length)return!1;_thisObj.$submitBtn.html(xoo_el_localize.html.spinner).addClass('xoo-el-processing');_thisObj.verifyCode()} changeParentInput(event){var _thisObj=event.data._thisObj;_thisObj.codesent=!1;_thisObj.$codeForm.hide();_thisObj.$parentForm.show();_thisObj.$inputs.val('')} resendCode(event){event.preventDefault();var _thisObj=event.data._thisObj;_thisObj.startResendTimer();var form_data={action:'xoo_el_resend_code','parentFormData':objectifyForm(_thisObj.$parentForm),} form_data=Object.assign({},form_data,_thisObj.resendData);_thisObj.$resendLink.addClass('xoo-el-processing');$.ajax({url:xoo_el_localize.adminurl,type:'POST',data:form_data,success:function(response){_thisObj.$resendLink.trigger('xoo_el_code_resent',[response,_thisObj]);_thisObj.$resendLink.removeClass('xoo-el-processing');if(response.notice){_thisObj.showNotice(response.notice)}},complete:function(){}})} validateInputs(){var passedValidation=!0;this.$inputs.each(function(index,input){var $input=$(input);if($input.val().trim()===''){$input.focus();passedValidation=!1;return!1}});return passedValidation} onSuccess(response){this.$codeForm.removeAttr('data-processing');this.codesent=!1;this.$codeForm.hide();this.$inputs.val('');if(this.$parentForm.length){if(response.notice){this.$parentForm.closest('.xoo-el-section').find('.xoo-el-notice').html(response.notice).show()} this.$parentForm.show()}} startResendTimer(){var _thisObj=this,$cont=this.$codeForm.find('.xoo-el-code-resend'),$resendLink=$cont.find('.xoo-el-code-resend-link'),$timer=$cont.find('.xoo-el-code-resend-timer'),resendTime=parseInt(xoo_el_localize.resend_wait);if(resendTime===0)return;$resendLink.addClass('xoo-el-disabled');clearInterval(this.resendTimer);this.resendTimer=setInterval(function(){$timer.html('('+resendTime+')');if(resendTime<=0){clearInterval(_thisObj.resendTimer);$resendLink.removeClass('xoo-el-disabled');$timer.html('')} resendTime--},1000)} showNotice(notice){var _thisObj=this;clearTimeout(this.noticeTimout);this.$noticeCont.html(notice).show();this.noticeTimout=setTimeout(function(){_thisObj.$noticeCont.hide()},4000)} onCodeSent(response){var _thisObj=this;if(response.error)return;_thisObj.codesent=!0;_thisObj.$codeForm.show();if(response.code_txt){_thisObj.$codeForm.find('.xoo-el-code-no-txt').html(response.code_txt)} setTimeout(function(){_thisObj.$inputs.first().trigger('click');_thisObj.$inputs.first().focus();_thisObj.$inputs.first().attr('autofocus',!0)},500) _thisObj.startResendTimer();_thisObj.parentFormValues=_thisObj.$parentForm.serialize();_thisObj.$codeForm.attr('data-processing','yes');_thisObj.$parentForm.hide()} verifyCode(data){var _thisObj=this;var form_data=$.extend({'code':_thisObj.getCodeValue(),'action':'xoo_el_code_form_submit','xoo_el_code_ajax':_thisObj.codeFormID,'parentFormData':objectifyForm(_thisObj.$parentForm)},data);$.ajax({url:xoo_el_localize.adminurl,type:'POST',data:form_data,success:function(response){_thisObj.$submitBtn.removeClass('xoo-el-processing').html(_thisObj.submitBtnTxt);if(response.notice){_thisObj.showNotice(response.notice)} if(response.error===0){_thisObj.onSuccess(response);_thisObj.$codeForm.trigger('xoo_el_on_code_success',[response])}}})} validateFormSubmit(){if(this.validateInputs()&&this.getCodeValue().length){this.$submitBtn.html(xoo_el_localize.html.spinner).addClass('xoo-el-processing');return!0}} getCodeValue(){var code='';this.$inputs.each(function(index,input){code+=$(input).val()});return code}} CodeFormHandler.instances=new WeakMap();$('.xoo-el-code-form').each(function(index,codeForm){new CodeFormHandler($(codeForm))});window.xooEl.CodeFormHandler=CodeFormHandler;if(xoo_el_localize.resetPwPattern==="code"){class lostPasswordFormHandler{constructor($form){this.$form=$form;this.$section=this.$form.closest('.xoo-el-section');this.$resetPwSection=this.$section.siblings('[data-section="resetpw"]');this.$resetPwForm=this.$resetPwSection.find('.xoo-el-form-resetpw');this.$container=this.$section.closest('.xoo-el-form-container');this.codeFormHandler=new CodeFormHandler($form.siblings('.xoo-el-code-form'));this.events()} events(){this.$form.on('xoo_el_form_submitted',this.onFormSubmit.bind(this));this.$resetPwForm.on('xoo_el_form_submitted',this.onResetPWFormSubmit.bind(this));this.codeFormHandler.$codeForm.on('xoo_el_on_code_success',this.onCodeVerificationSuccess.bind(this));this.$container.on('xoo_el_form_toggled',this.onLostPasswordFormToggle.bind(this))} onFormSubmit(e,response,$form,container){let _thisObj=this;_thisObj.codeFormHandler.onCodeSent(response);_thisObj.$resetPwSection.removeAttr('data-verified','yes')} onResetPWFormSubmit(e,response,$form,containerObj){let _thisObj=this;_thisObj.$resetPwSection.removeAttr('data-verified','yes');if(response.error){_thisObj.$section.find('.xoo-el-notice').html(response.notice).show();if(response.error_code==='code_reset'){containerObj.toggleForm('lostpw')}}else{containerObj.toggleForm('login');this.$container.find('.xoo-el-section[data-section="login"]').find('.xoo-el-notice').html(response.notice).show()}} onCodeVerificationSuccess(e,response){let _thisObj=this;_thisObj.$container.find('.xoo-el-resetpw-tgr').trigger('click');_thisObj.$resetPwSection.attr('data-verified','yes')} onLostPasswordFormToggle(e,formType,containerObj,referral){let _thisObj=this;if(formType!=='lostpw')return;if(_thisObj.$resetPwSection.attr('data-verified')==="yes"){containerObj.toggleForm('resetpw')}}} $('form.xoo-el-form-lostpw').each(function(index,el){new lostPasswordFormHandler($(el))})} $('body').on('submit','form.xoo-elpof-profile-update',function(e){e.preventDefault();var $form=$(e.currentTarget),$button=$form.find('button[type="submit"]'),buttonTxt=$button.text(),$noticeCont=$form.find('.xoo-elpof-notices');$button.html(xoo_el_localize.html.spinner).addClass('xoo-el-processing');$noticeCont.html('');var form_data=new FormData($form[0]);form_data.append('action','xoo_elpof_update_profile');$.ajax({url:xoo_el_localize.adminurl,type:'POST',processData:!1,contentType:!1,cache:!1,enctype:'multipart/form-data',data:form_data,success:function(response){if(response.notice){$noticeCont.html(response.notice);$('html, body').animate({scrollTop:$noticeCont.offset().top-100},500)} if(response.refreshPage){setTimeout(function(){location.reload()},1000)}},complete:function(xhr,status){$button.removeClass('xoo-el-processing').html(buttonTxt)}})})}); jQuery(document).ready(function($){const $promptInput=$('#fotobid-plugin-prompt');const $goButton=$('#fotobid-plugin-go-btn');$promptInput.on('keyup',function(){$goButton.prop('disabled',$(this).val().length<5)});$goButton.on('click',function(){$(this).prop('disabled',!0);$.ajax({url:fotobid_vars.ajax_url,type:'POST',data:{action:'fotobid_get_image_from_api',prompt:$promptInput.val()},success:function(response){if(typeof response==="string"){try{response=JSON.parse(response)}catch(e){console.error("Error parsing the response:",e)}} if(response){console.log("Response received:",response);if(response.data&&response.data.status==="processing"){const eta=response.data.eta;const fetchUrl=response.data.fetch_result;setTimeout(function(){$.ajax({url:fetchUrl,type:'GET',success:function(fetchResponse){const imageUrl=fetchResponse.output[0];const imageWidth=fetchResponse.meta.W;const imageHeight=fetchResponse.meta.H;const promptText=fetchResponse.meta.prompt;const outputHtml=`

${promptText}

View Image
${promptText}
`;$('.fotobid-plugin-output-group').append(outputHtml)},error:function(){console.error('Error fetching the processed image.');$goButton.prop('disabled',!1)}})},eta*1000)}else if(response.data.output&&response.data.output.length>0){const imageUrl=response.data.output[0];const imageWidth=response.data.meta.W;const imageHeight=response.data.meta.H;const generationTime=response.data.generationTime;const promptText=response.data.meta.prompt;const outputHtml=`

${promptText}

Time Taken: ${generationTime}s

${promptText}
`;$('.fotobid-plugin-output-group').append(outputHtml)}else{console.error('Unexpected response structure',response)} $goButton.prop('disabled',!1)}},error:function(){console.error('AJAX error occurred.');$goButton.prop('disabled',!1)},timeout:120000})})}); function slideUp(e,t){e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.boxSizing="border-box",e.style.height=e.offsetHeight+"px",e.offsetHeight,e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,window.setTimeout(function(){e.style.display="none",e.style.removeProperty("height"),e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)}function slideDown(e,t){e.style.removeProperty("display");let o=window.getComputedStyle(e).display;"none"===o&&(o="block"),e.style.display=o;var a=e.offsetHeight;e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,e.offsetHeight,e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.height=a+"px",e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),window.setTimeout(function(){e.style.removeProperty("height"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)}function setupFAQ(){const e=new RegExp("^[\\w\\-]+$");var t=window.location.hash.substring(1);const o=document.getElementsByClassName("uagb-faq-expand-first-true"),a=document.getElementsByClassName("uagb-faq-inactive-other-false");if(void 0!==document.getElementById(t)&&null!==document.getElementById(t)&&""!==document.getElementById(t)&&e.test(t)){const i=document.getElementById(t);void 0!==i&&(i.classList.add("uagb-faq-item-active"),i.setAttribute("aria-expanded",!0),(t=i.getElementsByClassName("uagb-faq-content")[0])&&slideDown(t,500))}else for(let t=0;t{return document.querySelector("#wpadminbar")?.offsetHeight||0},p=()=>{"undefined"!=typeof AOS&&e?.UAGAnimationType&&(t.dataset.aos=e?.UAGAnimationType,t.dataset.aosDuration=e?.UAGAnimationTime,t.dataset.aosDelay=e?.UAGAnimationDelay,t.dataset.aosEasing=e?.UAGAnimationEasing,t.dataset.aosOnce=!0,setTimeout(()=>{AOS.refreshHard()},100))};const o=t.getBoundingClientRect(),y=e?.isBlockRootParent?null:t.parentElement,i=((t,e,s)=>{const o=document.createElement("div"),i=(o.style.height=e.height+"px",o.style.boxSizing="border-box",window.getComputedStyle(t));return s?(o.style.width="100%",o.style.maxWidth=i.getPropertyValue("max-width")||e.width+"px",o.style.padding=i.getPropertyValue("padding")||0,o.style.margin=i.getPropertyValue("margin")||0,o.style.border=i.getPropertyValue("border")||0,o.style.borderColor="transparent"):(o.style.width=e.width+"px",o.style.margin=i.getPropertyValue("margin")||0),o})(t,o,y);let n,a,l,r;const c={top:0,bottom:0},d={top:0,right:0,bottom:0,left:0};if(e?.UAGStickyRestricted){r=y.getBoundingClientRect();const g=window.getComputedStyle(y);d.top=parseInt(g.getPropertyValue("padding-top")||0,10),d.bottom=parseInt(g.getPropertyValue("padding-bottom")||0,10),c.top=r.top+(window.pageYOffset||0)+d.top,c.bottom=r.bottom+(window.pageYOffset||0)-d.bottom-o.height-s()-(e?.UAGStickyOffset||0)}"bottom"===e?.UAGStickyLocation?(n=o.top+(window.pageYOffset||0)-window.innerHeight+o.height+(e?.UAGStickyOffset||0),a=`${e?.UAGStickyOffset||0}px`,(l=void 0!==window.pageYOffset?window.pageYOffset:document.body.scrollTop)<=n&&!t.classList.contains("uagb-position__sticky--stuck")&&(t.parentNode.insertBefore(i,t),t.classList.add("uagb-position__sticky--stuck"),t.style.bottom=`calc(${a} - ${window.innerHeight}px)`,t.style.left=o.left+"px",t.style.width=o.width+"px",t.style.zIndex="999",setTimeout(()=>{t.style.bottom=a},50)),p(),window.addEventListener("scroll",()=>{(l=void 0!==window.pageYOffset?window.pageYOffset:document.body.scrollTop)<=n?t.classList.contains("uagb-position__sticky--stuck")||(t.parentNode.insertBefore(i,t),t.classList.add("uagb-position__sticky--stuck"),t.style.bottom=a,t.style.left=o.left+"px",t.style.width=o.width+"px",t.style.zIndex="999"):l>n&&t.classList.contains("uagb-position__sticky--stuck")&&(t.parentNode.removeChild(i),t.classList.remove("uagb-position__sticky--stuck"),t.style.bottom="",t.style.left="",t.style.width="",t.style.zIndex="")})):(n=o.top+(window.pageYOffset||0)-s()-(e?.UAGStickyOffset||0),a=s()+(e?.UAGStickyOffset||0)+"px",(l=void 0!==window.pageYOffset?window.pageYOffset:document.body.scrollTop)>=n&&!t.classList.contains("uagb-position__sticky--stuck")&&(t.parentNode.insertBefore(i,t),t.classList.add("uagb-position__sticky--stuck"),e?.UAGStickyRestricted&&l>=c.bottom?(t.classList.remove("uagb-position__sticky--stuck"),t.classList.add("uagb-position__sticky--restricted"),t.style.top="",t.style.bottom=d.bottom+"px",t.style.left=`${i?.offsetLeft||0}px`):(t.style.top=`calc(${a} - ${window.innerHeight}px)`,t.style.left=o.left+"px",t.style.top=a),t.style.width=o.width+"px",t.style.zIndex="999"),p(),window.addEventListener("scroll",()=>{(l=void 0!==window.pageYOffset?window.pageYOffset:document.body.scrollTop)>=n?t.classList.contains("uagb-position__sticky--stuck")||t.classList.contains("uagb-position__sticky--restricted")?e?.UAGStickyRestricted&&!t.classList.contains("uagb-position__sticky--restricted")&&l>=c.bottom?(t.classList.remove("uagb-position__sticky--stuck"),t.classList.add("uagb-position__sticky--restricted"),t.style.top="",t.style.bottom=d.bottom+"px",t.style.left=`${i?.offsetLeft||0}px`):t.classList.contains("uagb-position__sticky--restricted")&&l{const blockScope=document.querySelector('.uagb-block-0ac2831d');if(!blockScope){return} const anchorElement=blockScope.querySelector('a');if(!anchorElement){return} blockScope.addEventListener('keydown',(event)=>{if(13===event.keyCode||32===event.keyCode){event.preventDefault();anchorElement.click()}})})});