stockbot-buyvm/tests/data/stock_files/order.min.js
2023-12-02 14:49:13 -05:00

2 lines
49 KiB
JavaScript

function hasProductDomainLookupEnded(e,t){domainLookupCallCount++,domainLookupCallCount==e&&(t.removeAttr("disabled").removeClass("disabled"),jQuery('input[name="domainoption"]').iCheck("enable"))}function hasDomainLookupEnded(){domainLookupCallCount++,3==domainLookupCallCount&&jQuery("#btnCheckAvailability").removeAttr("disabled").removeClass("disabled")}function recalctotals(){jQuery("#orderSummaryLoader").is(":visible")||jQuery("#orderSummaryLoader").fadeIn("fast"),jQuery("#orderSummaryLoaderMob").is(":visible")||jQuery("#orderSummaryLoaderMob").fadeIn("fast");var e=Math.floor(1e6*Math.random()+1);window.lastSliderUpdateRequestId=e;var t=WHMCS.http.jqClient.post("cart.php","ajax=1&a=confproduct&calctotal=true&"+jQuery("#frmConfigureProduct").serialize());t.done(function(t){e==window.lastSliderUpdateRequestId&&(jQuery("#producttotal").html(t),jQuery("#producttotalmob").html(t))}),t.always(function(){jQuery("#orderSummaryLoader").delay(500).fadeOut("slow"),jQuery("#orderSummaryLoaderMob").delay(500).fadeOut("slow"),$("#sticky-sidebar").stickySidebar("updateSticky")})}function recalculateRenewalTotals(){jQuery("#orderSummaryLoader").is(":visible")||jQuery("#orderSummaryLoader").fadeIn("fast");var e=Math.floor(1e6*Math.random()+1);window.lastSliderUpdateRequestId=e,jQuery.get(WHMCS.utils.getRouteUrl("/cart/domain/renew/calculate")).done(function(t){e===window.lastSliderUpdateRequestId&&(jQuery("#producttotal").html(t.body),jQuery("#producttotalmob").html(t.body))}).always(function(){jQuery("#orderSummaryLoader").delay(500).fadeOut("slow"),jQuery("#orderSummaryLoaderMob").delay(500).fadeOut("slow")})}function removeItem(e,t){jQuery("#inputRemoveItemType").val(e),jQuery("#inputRemoveItemRef").val(t),jQuery("#modalRemoveItem").modal("show")}function selectDomainPeriodInCart(e,t,a,n){var i=jQuery("#orderSummaryLoader"),r=jQuery("#orderSummaryLoaderMob");i.fadeIn("fast"),r.fadeIn("fast"),console.log(n),jQuery("[name='"+e+"Pricing']").html(t+"/"+a+n+' <span class="caret"></span>'),jQuery("[name='"+e+"Price']").html(t);var o=jQuery.post(window.location.pathname,{domain:e,period:a,a:"updateDomainPeriod",token:csrfToken});o.done(function(e){e.domains.forEach(function(e){jQuery("[name='"+e.domain+"Price']").parent("div").find(".renewal-price").html(e.renewprice+e.shortYearsLanguage).end()}),jQuery("#subtotal").html(e.subtotal),e.promotype&&jQuery("#discount").html(e.discount),e.taxrate&&jQuery("#taxTotal1").html(e.taxtotal),e.taxrate2&&jQuery("#taxTotal2").html(e.taxtotal2);var t=jQuery("#recurring"),a=jQuery("#recurringMob");t.find("li").not(".faded").hide().end(),a.find("li").not(".faded").hide().end(),e.totalrecurringannually&&(jQuery("#recurringAnnually").show().find(".item-value").html(e.totalrecurringannually),jQuery("#recurringMobAnnually").show().find(".item-value").html(e.totalrecurringannually)),e.totalrecurringbiennially&&(jQuery("#recurringBiennially").show().find(".item-value").html(e.totalrecurringbiennially),jQuery("#recurringMobBiennially").show().find(".item-value").html(e.totalrecurringbiennially)),e.totalrecurringmonthly&&(jQuery("#recurringMonthly").show().find(".item-value").html(e.totalrecurringmonthly),jQuery("#recurringMobMonthly").show().find(".item-value").html(e.totalrecurringmonthly)),e.totalrecurringquarterly&&(jQuery("#recurringQuarterly").show().find(".item-value").html(e.totalrecurringquarterly),jQuery("#recurringMobQuarterly").show().find(".item-value").html(e.totalrecurringquarterly)),e.totalrecurringsemiannually&&(jQuery("#recurringSemiAnnually").show().find(".item-value").html(e.totalrecurringsemiannually),jQuery("#recurringMobSemiAnnually").show().find(".item-value").html(e.totalrecurringsemiannually)),e.totalrecurringtriennially&&(jQuery("#recurringTriennially").show().find(".item-value").html(e.totalrecurringtriennially),jQuery("#recurringMobTriennially").show().find(".item-value").html(e.totalrecurringtriennially)),jQuery("#totalDueToday").html(e.total),jQuery("#totalDueTodayMob").html(e.total)}),o.always(function(){i.delay(500).fadeOut("slow"),r.delay(500).fadeOut("slow")})}function validate_captcha(e){var t=jQuery("#g-recaptcha-response"),a=jQuery("#divDynamicRecaptcha"),n=jQuery("#inputCaptcha");if(t.length&&!t.val())return a.tooltip("show"),!1;if(n.length&&!n.val())return n.tooltip("show"),!1;var i=jQuery.post(e.attr("action"),e.serialize()+"&a=validateCaptcha","json");i.done(function(t){t.error?(jQuery("#inputCaptcha").attr("data-original-title",t.error).tooltip("show"),n.length&&jQuery("#inputCaptchaImage").replaceWith('<img id="inputCaptchaImage" src="includes/verifyimage.php" align="middle" />')):(jQuery("#captchaContainer").remove(),e.trigger("submit"))})}function loadMoreSuggestions(){var e,t=jQuery("#domainSuggestions");for(e=1;e<=10;e++){if(!(furtherSuggestions>0))return void jQuery("div.more-suggestions").find("a").addClass("hidden").end().find("span.no-more").removeClass("hidden");t.find("li.domain-suggestion.hidden.clone:first").not().hide().removeClass("hidden").slideDown(),furtherSuggestions=t.find("li.domain-suggestion.clone.hidden").length}}function validateCheckoutCreditCardInput(e){var t=jQuery('input[name="ccinfo"]:checked').val(),a=(checkoutForm.find('*[type="submit"]'),null),n=!0,i=checkoutForm.find('input[name="paymentmethod"]:checked'),r=i.hasClass("is-credit-card"),o="RemoteCreditCard"===i.data("payment-type"),d=jQuery("#inputCardNumber");if(checkoutForm.find(".form-group").removeClass("has-error"),checkoutForm.find(".field-error-msg").hide(),r&&!o){var s=checkoutForm.find("#inputCardCVV2");if("new"===t){if(s=checkoutForm.find("#inputCardCVV"),a=jQuery.payment.cardType(checkoutForm.find("#inputCardNumber").val()),!jQuery.payment.validateCardNumber(checkoutForm.find("#inputCardNumber").val())||d.hasClass("unsupported")){var l=d.data("message-invalid");d.hasClass("unsupported")&&(l=d.data("message-unsupported")),checkoutForm.find("#inputCardNumber").setInputError(l).showInputError(),n=!1}jQuery.payment.validateCardExpiry(checkoutForm.find("#inputCardExpiry").payment("cardExpiryVal"))||(checkoutForm.find("#inputCardExpiry").showInputError(),n=!1)}jQuery.payment.validateCardCVC(s.val(),a)||(s.showInputError(),n=!1),n||(e.preventDefault(),setTimeout(function(){$("#checkout .loader").addClass("hidden"),$("#checkout span").removeClass("invisible hidden"),$("#checkout2 .loader").addClass("hidden"),$("#checkout2 span").removeClass("invisible hidden")},500))}}(function(e){WHMCS.hasModule("authn")||WHMCS.loadModule("authn",e)})({provider:function(){var e=!1;return this.feedbackContainer=function(){return jQuery(".providerLinkingFeedback")},this.btnContainer=function(){return jQuery(".providerPreLinking")},this.feedbackMessage=function(e){void 0===e&&(e="complete_sign_in");var t=jQuery("p.providerLinkingMsg-preLink-"+e);return t.length?t.first().html():""},this.showProgressMessage=function(t){this.feedbackContainer().fadeIn("fast",function(){"function"!=typeof t||e||(e=!0,t())})},this.preLinkInit=function(e){var t='<i class="fas fa-fw fa-spinner fa-spin"></i> ';this.feedbackContainer().removeClass("alert-danger alert-success").addClass("alert alert-info").html(t+this.feedbackMessage()).hide();var a=this.btnContainer();if(a.length)if(a.data("hideOnPrelink")){var n=this;a.fadeOut("false",function(){n.showProgressMessage(e)})}else a.data("disableOnPrelink")?(a.find(".btn").addClass("disabled"),this.showProgressMessage(e)):this.showProgressMessage(e);else this.showProgressMessage(e)},this.displayError=function(e,t,a){jQuery("#providerLinkingMessages .provider-name").html(e);var n=this.feedbackMessage("connect_error");if(t){var i=this.feedbackMessage(t);i&&(n=i)}a&&$(".btn-logged-in-admin").length>0&&(n+=" Error: "+a),this.feedbackContainer().removeClass("alert-info alert-success").addClass("alert alert-danger").html(n).slideDown()},this.displaySuccess=function(e,t,a){var n=a.icon,i=t.htmlTarget,r=t.targetLogin,o=t.targetRegister,d=a.name,s="";switch(e.result){case"logged_in":case"2fa_needed":s=this.feedbackMessage("2fa_needed"),this.feedbackContainer().removeClass("alert-danger alert-warning alert-success").addClass("alert alert-info").html(s),window.location=e.redirect_url?decodeURIComponent(e.redirect_url):decodeURIComponent(t.redirectUrl);break;case"linking_complete":var l="";l=e.remote_account.email?e.remote_account.email:e.remote_account.firstname+" "+e.remote_account.lastname,l=l.trim(),s=this.feedbackMessage("linking_complete").trim().replace(":displayName",d),l&&(s=s.replace(/\.$/," ("+l+").")),this.feedbackContainer().removeClass("alert-danger alert-warning alert-info").addClass("alert alert-success").html(n+s);break;case"login_to_link":if(i===r)s=this.feedbackMessage("login_to_link-signin-required"),this.feedbackContainer().removeClass("alert-danger alert-success alert-info").addClass("alert alert-warning").html(n+s);else{var u=jQuery("input[name=email]"),c=jQuery("input[name=firstname]"),h=jQuery("input[name=lastname]");if(""===u.val()&&u.val(e.remote_account.email),""===c.val()&&c.val(e.remote_account.firstname),""===h.val()&&h.val(e.remote_account.lastname),i===o)"object"==typeof WHMCS.client.registration&&WHMCS.client.registration.prefillPassword(),s=this.feedbackMessage("login_to_link-registration-required"),this.feedbackContainer().fadeOut("slow",function(){$(this).removeClass("alert-danger alert-success alert-info").addClass("alert alert-warning").html(n+s).fadeIn("fast")});else{"object"==typeof WHMCS.client.registration&&WHMCS.client.registration.prefillPassword();var m=this;this.feedbackContainer().each(function(e,t){var a=$(t),i=a.siblings("div .providerPreLinking").data("linkContext");a.fadeOut("slow",function(){s="checkout-new"===i?m.feedbackMessage("checkout-new"):m.feedbackMessage("login_to_link-signin-required"),a.removeClass("alert-danger alert-success alert-info").addClass("alert alert-warning").html(n+s).fadeIn("fast")})})}}break;case"other_user_exists":s=this.feedbackMessage("other_user_exists"),this.feedbackContainer().removeClass("alert-info alert-success").addClass("alert alert-danger").html(n+s).slideDown();break;case"already_linked":s=this.feedbackMessage("already_linked"),this.feedbackContainer().removeClass("alert-info alert-success").addClass("alert alert-danger").html(n+s).slideDown();break;default:s=this.feedbackMessage("default"),this.feedbackContainer().removeClass("alert-info alert-success").addClass("alert alert-danger").html(n+s).slideDown()}},this.signIn=function(e,t,a,n,i){jQuery.ajax(e).done(function(e){n(),WHMCS.authn.provider.displaySuccess(e,t,a);var i=jQuery("#tableLinkedAccounts");i.length&&WHMCS.ui.dataTable.getTableById("tableLinkedAccounts").ajax.reload()}).error(function(){i(),WHMCS.authn.provider.displayError()})},this}}),function(e){WHMCS.hasModule("client")||WHMCS.loadModule("client",e)}({registration:function(){return this.prefillPassword=function(e){if(e=e||{},void 0===e.hideContainer){var t=jQuery("#inputSecurityQId").attr("id")?"#containerPassword":"#containerNewUserSecurity";e.hideContainer=jQuery(t),e.hideInputs=!0}else"string"==typeof e.hideContainer&&e.hideContainer.length&&(e.hideContainer=jQuery(e.hideContainer));void 0===e.form&&(e.form={password:[{id:"inputNewPassword1"},{id:"inputNewPassword2"}]});var a=function(){for(var t=WHMCS.utils.simpleRNG(),a=0,n=e.form.password.length;a<n;a++)jQuery("#"+e.form.password[a].id).val(t).trigger("keyup")};e.hideInputs?e.hideContainer.slideUp("fast",a):a()},this}}),function(e){WHMCS.hasModule("http")||WHMCS.loadModule("http",e)}({jqClient:function(){return _getSettings=function(e,t,a,n){return"object"==typeof e?e:("function"==typeof t&&(a=t,t=null),{url:e,data:t,success:a,dataType:n})},this.get=function(e,t,a,n){return WHMCS.http.client.request(jQuery.extend(_getSettings(e,t,a,n),{type:"GET"}))},this.post=function(e,t,a,n){return WHMCS.http.client.request(jQuery.extend(_getSettings(e,t,a,n),{type:"POST"}))},this.jsonPost=function(e){e=e||{},this.post(e.url,e.data,function(t){t.warning?(console.log("[WHMCS] Warning: "+t.warning),"function"==typeof e.warning&&e.warning(t.warning)):t.error?(console.log("[WHMCS] Error: "+t.error),"function"==typeof e.error&&e.error(t.error)):"function"==typeof e.success&&e.success(t)},"json").error(function(t,a){console.log("[WHMCS] Error: "+a),"function"==typeof e.fail&&e.fail(a)}).always(function(){"function"==typeof e.always&&e.always()})},this},client:function(){var e=["get","post","put","delete"],t=this;return _beforeRequest=function(e){return void 0===e.type&&(e.type="GET"),e},this.request=function(e){return e=_beforeRequest(e||{}),jQuery.ajax(e)},jQuery.each(e,function(e,a){t[a]=function(e,t){return function(a){return a=a||{},a.type=e.toUpperCase(),t.request(a)}}(a,t)}),this}}),function(e){WHMCS.hasModule("ui")||WHMCS.loadModule("ui",e)}({confirmation:function(){var e=[];return this.register=function(t){return void 0===t&&(t="[data-toggle=confirmation]"),e.indexOf(t)<0&&e.push(t),jQuery(t).confirmation({rootSelector:t}),e},this},dataTable:function(){return this.tables={},this.register=function(){var e=this;jQuery("table.data-driven").each(function(t,a){e.getTableById(a.id,void 0)})},this.getTableById=function(e,t){var a=this,n=jQuery("#"+e);if(void 0===a.tables[e]){void 0===t&&(t={dom:'<"listtable"ift>pl',paging:!1,lengthChange:!1,searching:!1,ordering:!0,info:!1,autoWidth:!0,language:{emptyTable:n.data("lang-empty-table")?n.data("lang-empty-table"):"No records found"}});var i=n.data("ajax-url");void 0!==i&&(t.ajax={url:i});var r=n.data("dom");void 0!==r&&(t.dom=r);var o=n.data("searching");void 0!==o&&(t.searching=o);var d=n.data("responsive");void 0!==d&&(t.responsive=d);var s=n.data("ordering");void 0!==s&&(t.ordering=s);var l=n.data("order");void 0!==l&&l&&(t.order=l);var u=n.data("columns");void 0!==u&&u&&(t.columns=u);var c=n.data("auto-width");void 0!==c&&(t.autoWidth=c);var h=n.data("paging");void 0!==h&&(t.paging=h);var m=n.data("length-change");void 0!==m&&(t.lengthChange=m);var f=n.data("page-length");void 0!==f&&(t.pageLength=f),a.tables[e]=a.initTable(n,t)}else if(void 0!==t){var p=a.tables[e],y=p.init(),g=jQuery.extend(y,t);p.destroy(),a.tables[e]=a.initTable(n,g)}return a.tables[e]},this.initTable=function(e,t){var a=e.DataTable(t),n=this;return e.data("on-draw")?a.on("draw.dt",function(t,a){var n=e.data("on-draw");"function"==typeof window[n]&&window[n](t,a)}):e.data("on-draw-rebind-confirmation")&&a.on("draw.dt",function(e){n.rebindConfirmation(e)}),a},this.rebindConfirmation=function(e){for(var t=this,a=e.target.id,n=WHMCS.ui.confirmation.register(),i=0,r=n.length;i<r;i++)jQuery(n[i]).on("confirmed.bs.confirmation",function(e){e.preventDefault(),WHMCS.http.jqClient.post(jQuery(e.target).data("target-url"),{token:csrfToken}).done(function(e){"success"!==e.status&&"okay"!==e.status||t.getTableById(a,void 0).ajax.reload()})})},this},clipboard:function(){return this.copy=function(e){e.preventDefault();var t=$(e.currentTarget),a=$(t).data("clipboard-target"),n=$(a).parent();try{var i=$("<textarea>").css("position","fixed").css("opacity","0").css("width","1px").css("height","1px").val($(a).val());n.append(i),i.focus().select(),document.execCommand("copy")}finally{i.remove()}t.tooltip({trigger:"click",placement:"bottom"}),WHMCS.ui.toolTip.setTip(t,"Copied!"),WHMCS.ui.toolTip.hideTip(t)},this},toolTip:function(){this.setTip=function(e,t){var a=e.data("bs.tooltip");return"in"!==a.hoverState&&(a.hoverState="in"),e.attr("data-original-title",t),a.show(),a},this.hideTip=function(e){return setTimeout(function(){e.data("bs.tooltip").hide()},2e3)}},jsonForm:function(){return this.managedElements="input,textarea,select",this.initFields=function(e){var t=this;$(e).find(t.managedElements).each(function(){var e=this;$(e).on("keypress change",function(){t.fieldHasError(e)&&t.clearFieldError(e)})})},this.init=function(e){var t=this;t.initFields(e),$(e).on("submit",function(a){a.preventDefault(),a.stopPropagation(),t.clearErrors(e);var n=$(e).parents('.modal[role="dialog"]').first();$(n).length&&($(n).on("show.bs.modal hidden.bs.modal",function(){t.clearErrors(e)}),$(n).on("show.bs.modal",function(){$(e)[0].reset()})),WHMCS.http.client.post({url:$(e).attr("action"),data:$(e).serializeArray()}).done(function(a){t.onSuccess(e,a)}).fail(function(a){t.onError(e,a)}).always(function(a){t.onRequestComplete(e,a)})})},this.initAll=function(){var e=this;$('form[data-role="json-form"]').each(function(){var t=this;e.init(t)})},this.markFieldErrors=function(e,t){var a,n,i=this,r=null;for(var o in t)t.hasOwnProperty(o)&&(r=t[o]),n=i.managedElements.split(",").map(function(e){return e+'[name="'+o+'"]'}).join(","),a=$(e).find(n),r&&($(a).parents(".form-group").addClass("has-error"),$(a).attr("title",r),$(a).tooltip());$(e).find(".form-group.has-error input[title]").first().tooltip("show")},this.fieldHasError=function(e){return $(e).parents(".form-group").hasClass("has-error")},this.clearFieldError=function(e){$(e).tooltip("destroy"),$(e).parents(".form-group").removeClass("has-error")},this.onSuccess=function(e,t){var a=$(e).data("on-success");"function"==typeof a&&a(t.data)},this.onError=function(e,t){t.responseJSON&&t.responseJSON.fields&&"object"==typeof t.responseJSON.fields?this.markFieldErrors(e,t.responseJSON.fields):console.log("Unknown error - please try again later.");var a=$(e).data("on-error");"function"==typeof a&&a(t)},this.clearErrors=function(e){var t=this;$(e).find(t.managedElements).each(function(){t.clearFieldError(this)})},this.onRequestComplete=function(e,t){},this},effects:function(){this.errorShake=function(e){t=t||{};var t=$.extend({direction:"left",distance:8,times:3,speed:90},t);return e.each(function(){var e=$(this),a={position:e.css("position"),top:e.css("top"),bottom:e.css("bottom"),left:e.css("left"),right:e.css("right")};e.css("position","relative");var n="up"===t.direction||"down"===t.direction?"top":"left",i="up"===t.direction||"left"===t.direction?"pos":"neg",r={},o={},d={};r[n]=("pos"===i?"-=":"+=")+t.distance,o[n]=("pos"===i?"+=":"-=")+2*t.distance,d[n]=("pos"===i?"-=":"+=")+2*t.distance,e.animate(r,t.speed);for(var s=1;s<t.times;s++)e.animate(o,t.speed).animate(d,t.speed);e.animate(o,t.speed).animate(r,t.speed/2,function(){e.css(a)})})}}}),function(e){WHMCS.hasModule("form")||WHMCS.loadModule("form",e)}(function(){return this.checkAllBound=!1,this.register=function(){this.checkAllBound||(this.bindCheckAll(),this.checkAllBound=!0)},this.bindCheckAll=function(){var e=".btn-check-all";jQuery(e).click(function(e){var t=jQuery(e.target),a=jQuery("#"+t.data("checkbox-container")+' input[type="checkbox"]');if(t.data("btn-check-toggle")){var n="Deselect All",i="Select All";t.data("label-text-deselect")&&(n=t.data("label-text-deselect")),t.data("label-text-select")&&(i=t.data("label-text-select")),t.hasClass("toggle-active")?(a.prop("checked",!1),t.text(i),t.removeClass("toggle-active")):(a.prop("checked",!0),t.text(n),t.addClass("toggle-active"))}else t.data("btn-toggle-on")?a.prop("checked",!0):a.prop("checked",!1)})},this});var domainLookupCallCount,furtherSuggestions,recaptchaLoadComplete=!1;(function(e){WHMCS.hasModule("recaptcha")||WHMCS.loadModule("recaptcha",e)})(function(){return this.register=function(){if(!recaptchaLoadComplete){var e=[],t=jQuery(".btn-recaptcha").parents("form");if(t.each(function(t,a){if("undefined"!=typeof recaptchaSiteKey){var n=jQuery(a),i=n.find(".btn-recaptcha"),r=i.hasClass("btn-recaptcha-invisible"),o="undefined"!=typeof requiredText?requiredText:"Required",d=n.find("#divDynamicRecaptcha .g-recaptcha"),s=n.find(".recaptcha-container"),l=n;s.length&&(l=s),d.length||(l.append('<div id="divDynamicRecaptcha" class="g-recaptcha" data-toggle="tooltip" data-placement="bottom" data-trigger="manual" title="'+o+'"></div>'),d=l.find("#divDynamicRecaptcha")),r?"invisible"!==d.data("size")&&d.attr("data-size","invisible"):d.hide(),d.attr("data-sitekey",recaptchaSiteKey);var u=n.find("input[name='submit']");if(u.length){var c=n.prop("action");n.prop("action",c+"&submit=1"),u.remove()}var h="recaptchaCallback"+t;window[h]=function(){r&&n.submit()},d.attr("data-callback",h),r?i.on("click",function(e){grecaptcha.getResponse().trim()||(e.preventDefault(),grecaptcha.execute())}):(e.push(function(){d.slideDown("fast",function(){d.find(":first").addClass("center-block")})}),e.push(function(){d.find(":first").addClass("center-block")}))}else console.log("Recaptcha site key not defined")}),t.length){var a="https://www.google.com/recaptcha/api.js";jQuery.getScript(a,function(){for(var t=e.length-1;t>=0;t--)e[t]()})}recaptchaLoadComplete=!0}},this}),function(e){WHMCS.hasModule("utils")||WHMCS.loadModule("utils",e)}(function(){return this.simpleRNG=function(){for(var e="./$_-#!,^*()|",t=0,a=0;t<3;a++)t+=Math.floor(10*Math.random()/2);t=Math.floor(t);for(var n="",i=0;i<t;i++)v=(Math.random()+1).toString(24).split(".")[1],Math.random()>.5?n+=btoa(v).substr(0,4):n+=v,Math.random()>.5&&(n+=e.substr(Math.floor(13*Math.random()),1));return n},this.getRouteUrl=function(e){return whmcsBaseUrl+"/index.php?rp="+e},this.validateBaseUrl=function(){void 0===window.whmcsBaseUrl?(console.log("Warning: The WHMCS Base URL definition is missing from your active template. Please refer to https://docs.whmcs.com/WHMCS_Base_URL_Template_Variable for more information and details of how to resolve this warning."),window.whmcsBaseUrl=this.autoDetermineBaseUrl(),window.whmcsBaseUrlAutoSet=!0):""===window.whmcsBaseUrl&&void 0!==window.whmcsBaseUrlAutoSet&&!0===window.whmcsBaseUrlAutoSet&&(window.whmcsBaseUrl=this.autoDetermineBaseUrl())},this.autoDetermineBaseUrl=function(){var e=window.location.href,t=-1;if(void 0!==e&&(t=e.indexOf(".php")),-1===t&&(e=jQuery("#Primary_Navbar-Home a").attr("href"),void 0!==e&&(t=e.indexOf(".php"))),-1!==t){e=e.substring(0,t);var a=e.lastIndexOf("/");if(!1!==a)return e.substring(0,a)}return""},this.normaliseStringValue=function(e){return e?e.toLowerCase().replace(/\s/g,"-"):""},this.generatePassword=function(e){for(var t=this.getPasswordCharacterSet(),a="",n=0;e>n;n++)a+=t[this.randomInt(t.length)];return a},this.getPasswordCharacterSet=function(){for(var e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%()*+,-.:;=@_|{ldelim}{rdelim}~",t=[],a=0;e.length>a;a++){var n=e.charCodeAt(a);if(!(55296>n||n>=57344)){if(56320>n&&e.length>a+1){var i=e.charCodeAt(a+1);if(i>=56320&&57344>i){r=e.substring(a,a+2);a++,-1==t.indexOf(r)&&t.push(r);continue}}throw"Invalid UTF-16"}var r=e.charAt(a);-1==t.indexOf(r)&&t.push(r)}return t},this.randomInt=function(e){var t=this.randomIntMathRandom(e);return t=(t+this.randomIntBrowserCrypto(e))%e,t},this.randomIntMathRandom=function(e){var t=Math.floor(Math.random()*e);if(0>t||t>=e)throw"Arithmetic exception";return t},this.randomIntBrowserCrypto=function(e){var t=null;if("crypto"in window)t=crypto;else{if(!("msCrypto"in window))return 0;t=msCrypto}if("getRandomValues"in t&&"Uint32Array"in window&&"function"==typeof Uint32Array||(t=null),null==t)return 0;var a=new Uint32Array(1);do{t.getRandomValues(a)}while(a[0]-a[0]%e>4294967296-e);return a[0]%e},this}),WHMCS.utils.validateBaseUrl(),"undefined"==typeof localTrans&&(localTrans=function(e,t){return"undefined"!=typeof _localLang&&void 0!==_localLang[e]&&_localLang[e].length>0?_localLang[e]:t}),jQuery(document).ready(function(){$('[data-toggle="tooltip"]').tooltip();var t=jQuery("#inputCardNumber"),a=jQuery("#inputCardCVV2");if(t.length&&(t.payment("formatCardNumber"),jQuery("#inputCardCVV").payment("formatCardCVC"),jQuery("#inputCardStart").payment("formatCardExpiry"),jQuery("#inputCardExpiry").payment("formatCardExpiry")),a.length&&a.payment("formatCardCVC"),0==jQuery(".panel-domain-option input:checked").length){var n=jQuery(".panel-domain-option input:first");jQuery(n).iCheck("check")}jQuery("#domain"+jQuery(".panel-domain-option input:checked").val()).removeClass("hidden"),jQuery(".panel-domain-option input").on("ifChecked",function(e){jQuery(".inline-form").addClass("hidden"),jQuery("#domain"+jQuery(this).val()).removeClass("hidden")}),jQuery("#frmProductDomain").submit(function(e){e.preventDefault();var t=jQuery(this).find('button[type="submit"]'),a=(jQuery("#DomainSearchResults"),jQuery("#spotlightTlds")),n=jQuery("#domainSuggestions"),i=jQuery("#btnDomainContinue"),r=jQuery(".panel-domain-option input:checked").val(),o=jQuery("#"+r+"sld"),d=o.val(),s="",l=jQuery("#frmProductDomainPid").val(),u="";if("incart"==r)o=jQuery("#"+r+"sld option:selected"),d=o.text();else if("subdomain"==r)u=jQuery("#"+r+"tld option:selected"),s=u.text();else{if(u=jQuery("#"+r+"tld"),s=u.val(),d&&!s)return u.tooltip("show"),u.focus(),!1;"."!=s.substr(0,1)&&(s="."+s)}if(!d)return o.tooltip("show"),o.focus(),!1;if(o.tooltip("hide"),u.length&&u.tooltip("hide"),jQuery('input[name="domainoption"]').iCheck("disable"),domainLookupCallCount=0,t.attr("disabled","disabled").addClass("disabled"),jQuery(".domain-lookup-loader").removeClass("hidden"),jQuery("html, body").animate({scrollTop:$(".domain-lookup-loader").offset().top-150},500),jQuery("#DomainSearchResults").addClass("hidden"),jQuery("#primaryLookupResult > div").hide(),n.find("li").addClass("hidden").end().find(".clone").remove().end(),jQuery("div.panel-footer.more-suggestions").addClass("hidden").find("a").removeClass("hidden").end().find("span.no-more").addClass("hidden"),jQuery(".btn-add-to-cart").removeAttr("disabled").find("span").hide().end().find("span.to-add").show(),i.addClass("hidden").attr("disabled","disabled"),"register"!=r&&(a.hide(),jQuery(".suggested-domains").hide()),"register"==r){jQuery("#resultDomainOption").val(r);var c=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),{token:csrfToken,type:"domain",domain:d+s,sld:d,tld:s,source:"cartAddDomain"},"json"),h=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),{token:csrfToken,type:"spotlight",domain:d+s,sld:d,tld:s,source:"cartAddDomain"},"json"),m=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),{token:csrfToken,type:"suggestions",domain:d+s,sld:d,tld:s,source:"cartAddDomain"},"json");c.done(function(e){jQuery.each(e.result,function(t,a){var n=null,r=jQuery("#primaryLookupResult"),o=r.find(".domain-available"),d=r.find(".domain-price"),s=r.find(".domain-unavailable"),l=r.find(".domain-invalid"),u=r.find(".domain-contact-support"),c=jQuery("#resultDomain"),h=jQuery("#resultDomainPricingTerm");if(error=r.find(".domain-error"),r.removeClass("hidden").show(),!e.result.error&&a.isValidDomain)error.hide(),n=a.pricing,a.isAvailable&&"string"!=typeof n?(a.preferredTLDNotAvailable&&s.show().find("strong").html(a.originalUnavailableDomain),u.hide(),o.show().find("strong").html(a.domainName),d.show().find(".price").html(n[Object.keys(n)[0]].register).end().find("button").attr("data-domain",a.idnDomainName),c.val(a.domainName),h.val(Object.keys(n)[0]).attr("name","domainsregperiod["+a.domainName+"]"),i.removeAttr("disabled"),$("body").addClass("is-actions")):(s.show().find("strong").html(a.domainName),u.hide(),"string"==typeof n&&"ContactUs"==n&&u.show());else{var m=l.find("span.domain-length-restrictions"),f=!1;m.hide(),error.hide(),a.minLength>0&&a.maxLength>0?(m.find(".min-length").html(a.minLength).end().find(".max-length").html(a.maxLength).end(),m.show()):e.result.error&&(error.html(e.result.error),error.show(),f=!0),f||l.show()}})}).always(function(){hasProductDomainLookupEnded(3,t)}),h.done(function(e){"object"!=typeof e||0==e.result.length||e.result.error?jQuery(".domain-lookup-spotlight-loader").hide():jQuery.each(e.result,function(e,t){var a=t.tldNoDots,n=t.pricing,i=jQuery("#spotlight"+a+" .domain-lookup-result");jQuery(".domain-lookup-spotlight-loader").hide(),i.find("button").addClass("hidden").end(),t.isValidDomain?t.isAvailable&&"string"!=typeof n?i.find("span.available").html(n[Object.keys(n)[0]].register).removeClass("hidden").end().find("button.btn-add-to-cart").attr("data-domain",t.idnDomainName).removeClass("hidden"):"string"==typeof n?(""==n?i.find("button.unavailable").removeClass("hidden").end():i.find("button.domain-contact-support").removeClass("hidden").end(),i.find("span.available").addClass("hidden").end()):(i.find("button.unavailable").removeClass("hidden").end(),i.find("span.available").addClass("hidden").end()):i.find("button.invalid.hidden").removeClass("hidden").end().find("span.available").addClass("hidden").end().find("button").not("button.invalid").addClass("hidden"),i.removeClass("hidden")})}).always(function(){hasProductDomainLookupEnded(3,t)}),m.done(function(e){if("object"!=typeof e||0==e.result.length||e.result.error)jQuery(".suggested-domains").fadeOut("fast",function(){jQuery(this).addClass("hidden")});else{jQuery(".suggested-domains").removeClass("hidden");var t=1;jQuery.each(e.result,function(e,a){var i=a.tld,r=a.pricing;n.find("li:first").clone(!0,!0).appendTo(n);var o=n.find("li.domain-suggestion").last();o.addClass("clone").find("span.domain").html(a.sld).end().find("span.extension").html("."+i).end(),"string"==typeof r?(o.find("button.btn-add-to-cart").remove(),""!=r?o.find("button.domain-contact-support").removeClass("hidden").end().find("span.price").hide():o.remove()):o.find("button.btn-add-to-cart").attr("data-domain",a.idnDomainName).end().find("span.price").html(r[Object.keys(r)[0]].register).end(),t<=10&&o.removeClass("hidden"),t++,a.group&&(o.find("span.promo").addClass(a.group).removeClass("hidden").end(),o.find("span.sales-group-"+a.group).removeClass("hidden").end()),furtherSuggestions=n.find("li.domain-suggestion.clone.hidden").length,furtherSuggestions>0&&jQuery("div.more-suggestions").removeClass("hidden")}),jQuery(".domain-lookup-suggestions-loader").hide(),jQuery("#domainSuggestions").removeClass("hidden")}}).always(function(){hasProductDomainLookupEnded(3,t),jQuery(".domain-lookup-loader").addClass("hidden"),jQuery("#DomainSearchResults").removeClass("hidden")})}else if("transfer"==r){jQuery("#resultDomainOption").val(r);var f=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),{token:csrfToken,type:"transfer",domain:d+s,sld:d,tld:s,source:"cartAddDomain"},"json");f.done(function(e){if("object"==typeof e&&0!=e.result.length){var t=jQuery("#primaryLookupResult"),a=t.find(".transfer-eligible"),n=t.find(".domain-price"),r=t.find(".transfer-not-eligible"),o=jQuery("#resultDomain"),d=jQuery("#resultDomainPricingTerm");0===Object.keys(e.result).length&&(jQuery(".domain-lookup-loader").addClass("hidden"),t.removeClass("hidden").show(),r.show()),jQuery.each(e.result,function(e,s){var l=s.pricing;jQuery(".domain-lookup-loader").addClass("hidden"),t.removeClass("hidden").show(),s.isRegistered?(a.show(),n.show().find(".register-price-label").hide().end().find(".transfer-price-label").removeClass("hidden").show().end().find(".price").html(l[Object.keys(l)[0]].transfer).end().find("button").attr("data-domain",s.idnDomainName),o.val(s.domainName),d.val(Object.keys(l)[0]).attr("name","domainsregperiod["+s.domainName+"]"),i.removeAttr("disabled")):r.show()})}else jQuery(".domain-lookup-loader").addClass("hidden")}).always(function(){hasProductDomainLookupEnded(1,t),jQuery(".domain-lookup-loader").addClass("hidden"),jQuery("#DomainSearchResults").removeClass("hidden")})}else if("owndomain"==r||"subdomain"==r||"incart"==r){var p=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),{token:csrfToken,type:r,pid:l,domain:d+s,sld:d,tld:s,source:"cartAddDomain"},"json");p.done(function(e){"object"==typeof e&&0!=e.result.length?jQuery.each(e.result,function(e,t){!0===t.status?window.location="cart.php?a=confproduct&i="+t.num:(jQuery(".domain-lookup-loader").addClass("hidden"),jQuery("#primaryLookupResult").removeClass("hidden").show().find(".domain-invalid").show())}):jQuery(".domain-lookup-subdomain-loader").hide()}).always(function(){hasProductDomainLookupEnded(1,t),jQuery(".domain-lookup-loader").addClass("hidden"),jQuery("#DomainSearchResults").removeClass("hidden")})}i.removeClass("hidden")}),jQuery(".btn-add-to-cart").on("click",function(){if(jQuery(this).hasClass("checkout"))window.location="cart.php?a=confdomains";else{
var e=jQuery(this).attr("data-domain"),t=jQuery('button[data-domain="'+e+'"]'),a=jQuery(this).attr("data-whois"),n=jQuery(this).hasClass("product-domain"),i=jQuery("#btnDomainContinue"),r=jQuery("#resultDomain"),o=jQuery("#resultDomainPricingTerm");t.attr("disabled","disabled").each(function(){jQuery(this).css("width",jQuery(this).outerWidth())});var d=jQuery(this).parents(".spotlight-tlds").length>0||jQuery(this).parents(".suggested-domains").length>0?1:0;jQuery.post(window.location.pathname,{a:"addToCart",domain:e,token:csrfToken,whois:a,sideorder:d},"json").done(function(a){if(t.find("span.to-add").hide(),"added"==a.result){t.find("span.added").show().parent().removeClass("btn-info").addClass("btn-primary").end(),$("body").addClass("is-actions"),n||t.removeAttr("disabled").addClass("checkout").closest(".list-group-item").addClass("added"),r.length&&!r.val()&&(r.val(e),o.val(a.period).attr("name","domainsregperiod["+e+"]"),i.length>0&&i.is(":disabled")&&i.removeAttr("disabled"));var d=parseInt(jQuery("#cartItemCount").text()),s=d+1;jQuery("#cartItemCount").html(s).addClass("badge--primary")}else t.find("span.unavailable").show()})}}),$("#frmProductDomainSelections").on("submit",function(){var e=parseInt(jQuery("#cartItemCount").text()),t=e+1;jQuery("#cartItemCount").html(t).addClass("badge--primary")}),jQuery("#frmDomainChecker").submit(function(e){e.preventDefault(),jQuery("#DomainSearchResults").addClass("hidden"),jQuery(".domain-pricing").hide();var t=jQuery("#frmDomainChecker"),a=jQuery("#inputDomain"),n=jQuery("#domainSuggestions"),i=jQuery("#divDynamicRecaptcha"),r=jQuery("#inputCaptcha");if(domainLookupCallCount=0,!a.val())return a.tooltip("show"),void a.focus();if(a.tooltip("hide"),jQuery("#captchaContainer").length)validate_captcha(t);else{i.tooltip("hide"),r.tooltip("hide"),jQuery("#btnCheckAvailability").attr("disabled","disabled").addClass("disabled"),jQuery(".domain-lookup-result").addClass("hidden"),jQuery(".domain-lookup-loader").removeClass("hidden"),jQuery("html, body").animate({scrollTop:$(".domain-lookup-loader").offset().top-150},500),n.find("li").addClass("hidden").end(),n.find(".clone").remove().end(),jQuery("div.panel-footer.more-suggestions").addClass("hidden").find("a").removeClass("hidden").end().find("span.no-more").addClass("hidden"),jQuery(".btn-add-to-cart").removeAttr("disabled").find("span").hide().end().find("span.to-add").show(),jQuery(".suggested-domains").removeClass("hidden");var o=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),t.serialize()+"&type=domain","json"),d=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),t.serialize()+"&type=spotlight","json"),s=jQuery.post(WHMCS.utils.getRouteUrl("/domain/check"),t.serialize()+"&type=suggestions","json");o.done(function(e){"object"==typeof e&&0!=e.result.length&&jQuery.each(e.result,function(t,a){var n=null,i=jQuery("#primaryLookupResult"),r=i.find(".domain-available"),o=i.find(".domain-price"),d=i.find(".domain-contact-support"),s=i.find(".domain-unavailable"),l=i.find(".domain-invalid"),u=i.find(".domain-error");if(i.find(".btn-add-to-cart").removeClass("checkout"),i.removeClass("hidden").show(),!e.result.error&&a.isValidDomain)n=a.pricing,s.hide(),d.hide(),l.hide(),u.hide(),a.isAvailable&&"string"!=typeof n?(a.preferredTLDNotAvailable&&s.show().find("strong").html(a.originalUnavailableDomain),r.show().find("strong").html(a.domainName),o.show().find(".price").html(n[Object.keys(n)[0]].register).end().find("button").attr("data-domain",a.idnDomainName)):(r.hide(),o.hide(),d.hide(),s.show().find("strong").html(a.domainName),"string"==typeof n&&"ContactUs"==n&&d.show());else{r.hide(),o.hide(),s.hide(),d.hide(),l.hide(),u.hide();var c=l.find("span.domain-length-restrictions"),h=!1;c.hide(),a.minLength>0&&a.maxLength>0?(c.find(".min-length").html(a.minLength).end().find(".max-length").html(a.maxLength).end(),c.show()):e.result.error&&(u.find(".message-text").html(e.result.error),u.show(),h=!0),h||l.show()}})}).always(function(){hasDomainLookupEnded()}),d.done(function(e){"object"!=typeof e||0==e.result.length||e.result.error?jQuery(".domain-lookup-spotlight-loader").hide():jQuery.each(e.result,function(e,t){var a=t.tldNoDots,n=t.pricing,i=jQuery("#spotlight"+a+" .domain-lookup-result");jQuery(".domain-lookup-spotlight-loader").hide(),i.find("button").addClass("hidden").end(),t.isValidDomain?t.isAvailable&&"string"!=typeof n?i.find("button.unavailable").addClass("hidden").end().find("button.invalid").addClass("hidden").end().find("span.available").html(n[Object.keys(n)[0]].register).removeClass("hidden").end().find("button").not("button.unavailable").not("button.invalid").attr("data-domain",t.idnDomainName).removeClass("hidden"):"string"==typeof n?(""==n?i.find("button.unavailable").removeClass("hidden").end():i.find("button.domain-contact-support").removeClass("hidden").end(),i.find("button.invalid").addClass("hidden").end(),i.find("span.available").addClass("hidden").end()):(i.find("button.invalid").addClass("hidden").end().find("button.unavailable").removeClass("hidden").end().find("span.available").addClass("hidden").end(),i.closest(".spotlight-tld").addClass("unavailable")):i.find("button.invalid.hidden").removeClass("hidden").end().find("span.available").addClass("hidden").end().find("button").not("button.invalid").addClass("hidden"),i.removeClass("hidden")})}).always(function(){hasDomainLookupEnded()}),s.done(function(e){if("object"!=typeof e||0==e.result.length||e.result.error)jQuery(".suggested-domains").fadeOut("fast",function(){jQuery(this).addClass("hidden")});else{jQuery(".suggested-domains").removeClass("hidden");var t=1;jQuery.each(e.result,function(e,a){var i=a.tld,r=a.pricing;n.find("li:first").clone(!0,!0).appendTo(n);var o=n.find("li.domain-suggestion").last();o.addClass("clone").find("span.domain").html(a.sld).end().find("span.extension").html("."+i).end(),"string"==typeof r?(o.find("button.btn-add-to-cart").remove(),""!=r?o.find("button.domain-contact-support").removeClass("hidden").end().find("span.price").hide():o.remove()):o.find("button.btn-add-to-cart").attr("data-domain",a.idnDomainName).end().find("span.price").html(r[Object.keys(r)[0]].register).end(),t<=10&&o.removeClass("hidden"),t++,a.group&&(o.find("span.promo").addClass(a.group).removeClass("hidden").end(),o.find("span.sales-group-"+a.group).removeClass("hidden").end()),furtherSuggestions=n.find("li.domain-suggestion.clone.hidden").length,furtherSuggestions>0&&jQuery("div.more-suggestions").removeClass("hidden")}),jQuery(".domain-lookup-suggestions-loader").hide(),jQuery("#domainSuggestions").removeClass("hidden")}}).always(function(){hasDomainLookupEnded(),jQuery(".domain-lookup-loader").addClass("hidden"),jQuery("#DomainSearchResults").removeClass("hidden")})}}),jQuery("#frmDomainTransfer").submit(function(e){e.preventDefault();var t=jQuery("#frmDomainTransfer"),a=jQuery("#btnTransferDomain"),n=jQuery("#inputTransferDomain"),i=jQuery("#inputAuthCode"),r=n.val(),o=i.val(),d=!1,s=jQuery("#divDynamicRecaptcha"),l=jQuery("#inputCaptcha");if(!r)return n.tooltip("show"),n.focus(),!1;n.tooltip("hide"),jQuery("#captchaContainer").length?validate_captcha(t):(s.tooltip("hide"),l.tooltip("hide"),a.attr("disabled","disabled").addClass("disabled").find("span").hide().removeClass("hidden").end().find(".loader").show(),jQuery.post(t.attr("action"),t.serialize(),"json").done(function(e){if("object"!=typeof e)return a.find("span").hide().end().find("#addToCart").show().end().removeAttr("disabled").removeClass("disabled"),!1;var t=e.result;"added"==t?(window.location="cart.php?a=confdomains",d=!0):1==t.isRegistered?1!=t.epp||o||(i.tooltip("show"),i.focus()):jQuery("#transferUnavailable").html(t.unavailable).hide().removeClass("hidden").fadeIn("fast",function(){setTimeout(function(e){e.fadeOut("fast")},1e4,jQuery(this))})}).always(function(){0==d&&a.find("span").hide().end().find("#addToCart").show().end().removeAttr("disabled").removeClass("disabled")}))}),$("#frmConfigureProduct").on("change","select",function(){recalctotals()}),jQuery("#frmConfigureProduct .section").not("#sectionCycles").on("ifChecked","input",function(){recalctotals()}),jQuery("#frmConfigureProduct .section").not("#sectionCycles").on("ifUnchecked",'input[type="checkbox"]',function(){recalctotals()}),$("[data-change-billingcycle]").on("ifChecked","input",function(){setTimeout(function(){recalctotals()},150)}),$("[data-update-config]").on("ifChecked","input",function(){$("#productConfigurableOptions").addClass("hidden"),$("#productConfigurableOptionsLoader").removeClass("hidden"),jQuery("#orderSummaryLoader").is(":visible")||jQuery("#orderSummaryLoader").fadeIn("fast"),jQuery("#orderSummaryLoaderMob").is(":visible")||jQuery("#orderSummaryLoaderMob").fadeIn("fast");var e=$(this).closest("label").data("config-i"),t=$(this).closest("label").data("config-val");console.log(e),WHMCS.http.jqClient.post("cart.php","a=cyclechange&ajax=1&i="+e+"&billingcycle="+t,function(e){$("#productConfigurableOptions").html($(e).find("#productConfigurableOptions").html()).promise().done(function(){var e=$("#productConfigurableOptions").find("input:not(.icheck-input):not(.switch__checkbox)");e.iCheck({checkboxClass:"checkbox-styled",radioClass:"radio-styled",increaseArea:"40%"}),reloadConfigOptions("#productConfigurableOptions"),$("#productConfigurableOptions").removeClass("hidden"),$("#productConfigurableOptionsLoader").addClass("hidden")})}),setTimeout(function(){recalctotals()},150)}),jQuery("#frmConfigureProduct").submit(function(e){e.preventDefault();var t=jQuery("#btnCompleteProductConfig, #btnCompleteProductConfigMob"),a=jQuery(t).html();jQuery(t).find(".loader").removeClass("hidden"),jQuery(t).find("span").addClass("invisible"),jQuery.post("cart.php","ajax=1&a=confproduct&"+jQuery("#frmConfigureProduct").serialize(),function(e){e?(jQuery("#btnCompleteProductConfig").html(a),jQuery("#btnCompleteProductConfigMob").html(a),jQuery("#containerProductValidationErrorsList").html(e),jQuery("#containerProductValidationErrors").removeClass("hidden").show(),jQuery(t).find(".loader").addClass("hidden"),jQuery(t).find("span").removeClass("invisible"),jQuery(window).scrollTop()>jQuery("#containerProductValidationErrors").offset().top&&jQuery("html, body").scrollTop(jQuery("#containerProductValidationErrors").offset().top-150)):window.location="cart.php?a=confdomains"})}),jQuery(".btn-add-renewal-to-cart").on("click",function(){var t=jQuery(this),a=t.data("domain-id"),n=jQuery("#renewalPricing"+a).val();t.hasClass("checkout")?window.location="cart.php?a=view":$(this).closest(".panel").hasClass("domain-renewal-added")?e.preventDefault():jQuery.post(WHMCS.utils.getRouteUrl("/cart/domain/renew/add"),{domainId:a,period:n,token:csrfToken},"json").done(function(e){t.find("span.to-add").hide(),t.find(".loader").css("display","flex").show(),"added"===e.result&&setTimeout(function(){t.find(".loader").hide().end().find("span.added").css("display","flex"),t.closest(".panel").addClass("border-primary domain-renewal-added"),t.removeClass("btn-info").addClass("btn-primary")},500),recalculateRenewalTotals()})}),jQuery(document).on("submit","#removeRenewalForm",function(e){e.preventDefault(),jQuery.post(whmcsBaseUrl+"/cart.php",jQuery(this).serialize()+"&ajax=1").done(function(e){var t=e.i,a=jQuery("#renewDomain"+t);a.attr("disabled","disabled").each(function(){jQuery(this).find("span.added").hide().end().removeClass("checkout").find("span.to-add").show().end().removeAttr("disabled"),jQuery(this).css("width",jQuery(this).outerWidth()),jQuery(this).closest(".panel").removeClass("border-primary domain-renewal-added"),jQuery(this).removeClass("btn-primary").addClass("btn-info")})}).always(function(){jQuery("#modalRemoveItem").modal("hide"),recalculateRenewalTotals()})}),jQuery(".select-renewal-pricing").on("change",function(){var e=$(this).data("domain-id"),t=$(this).val();$(this).closest(".panel").hasClass("domain-renewal-added")&&jQuery.post(WHMCS.utils.getRouteUrl("/cart/domain/renew/add"),{domainId:e,period:t,token:csrfToken},"json").done(function(e){recalculateRenewalTotals()})}),jQuery("#domainRenewalFilter").on("keyup",function(){var e=jQuery(this).val().toLowerCase();jQuery("#domainRenewals").find("div.domain-renewal").filter(function(){jQuery(this).toggle(jQuery(this).data("domain").toLowerCase().indexOf(e)>-1),0==jQuery("div.domain-renewal :visible").size()?jQuery(".no-renew").removeClass("hidden"):jQuery(".no-renew").addClass("hidden")})}),jQuery("#btnEmptyCart").click(function(){jQuery("#modalEmptyCart").modal("show")});var i=jQuery("#useFullCreditOnCheckout"),r=jQuery("#skipCreditOnCheckout");i.on("ifChecked",function(){var e=jQuery("#useFullCreditOnCheckout"),t=jQuery('input[name="paymentmethod"]:checked'),a=t.hasClass("is-credit-card"),n=jQuery('input[name="paymentmethod"]').not(jQuery('input.is-credit-card[name="paymentmethod"]')).first();e.prop("checked")&&(a&&n.length?($("#paymentGatewaysContainer .panel.checked").removeClass("checked"),$("#paymentGatewaysContainer .collapse.in").removeClass("in"),n.iCheck("check").closest(".panel").addClass("checked")):a&&jQuery("#creditCardInputFields").slideUp(),jQuery("#paymentGatewaysContainer").slideUp())}),r.on("ifChecked",function(){var e=jQuery('input[name="paymentmethod"]:checked'),t=e.hasClass("is-credit-card"),a=jQuery("#paymentGatewaysContainer");a.is(":visible")||(a.slideDown(),t&&jQuery("#creditCardInputFields").slideDown())}),1===jQuery("#applyCreditContainer").data("apply-credit")&&i.length&&(r.iCheck("check"),i.iCheck("check"));var o=jQuery(".existing-card"),d=(jQuery("#cvv-field-container"),jQuery("#existingCardsContainer"),jQuery("#newCardInfo")),s=jQuery("#existingCardInfo"),l=jQuery("#new");jQuery("#creditCardInputFields");o.length||s.find("input").attr("disabled","disabled"),jQuery("[data-paymethod-id]").on("click",function(){jQuery(this).hasClass("disabled")||(jQuery("[data-paymethod-id]").removeClass("active"),jQuery(this).addClass("active"),jQuery(this).find("input[type=radio]").iCheck("check"))}),jQuery("#creditCardInputFields [data-radio-tab]").on("click",function(e){e.preventDefault();var t=jQuery(this).attr("href");jQuery(this).closest(".nav-tabs").find(".active").removeClass("active"),jQuery(this).parent().addClass("active"),jQuery(this).closest(".cc-input-container").find(".tab-content").find(".active").removeClass("active"),jQuery(this).closest(".cc-input-container").find(".tab-content").find(t).addClass("active");var a=jQuery(this).find("input[type=radio]"),n=jQuery(this);setTimeout(function(){if(a.is(":checked")){if("stripe"===jQuery(".payment-methods:checked").val())return;n.closest(".cc-input-container").find(".tab-content").find("#newCardInfo").show()}},500)}),o.on("ifChecked",function(e){"stripe"!==jQuery(".payment-methods:checked").val()&&(d.find("input").attr("disabled","disabled"),s.find("input").removeAttr("disabled"))}),l.on("ifChecked",function(e){"stripe"!==jQuery(".payment-methods:checked").val()&&(d.slideDown().find("input").removeAttr("disabled"),s.find("input").attr("disabled","disabled"))}),o.length||s.find("input").attr("disabled","disabled"),jQuery(".payment-methods").on("ifChecked",function(e){if(reloadConfigOptions("#paymentGatewaysDetails"),jQuery(this).hasClass("is-credit-card")){"stripe"===jQuery(".payment-methods:checked").val()?jQuery(this).closest(".panel").find("#existingCardInfo").addClass("hidden"):(jQuery(this).closest(".panel").find("#existingCardInfo").removeClass("hidden").show(),jQuery(this).closest(".panel").find("#existingCardsContainer").addClass("active"));var t=jQuery(this).data("payment-type"),a=jQuery(this).val(),n=jQuery(this).data("show-local"),i=[];o.each(function(e){var r=jQuery(this).data("payment-type"),o=jQuery(this).data("payment-gateway"),d=jQuery(this).val(),s=r===t,l=!1;"RemoteCreditCard"===t?l=o===a:"CreditCard"===t&&(l=!0),n&&"CreditCard"===r&&(s=!0,l=!0);var u=jQuery('[data-paymethod-id="'+d+'"]');s&&l?(jQuery(u).show(),i.push(this)):jQuery(u).hide()});var r=i.filter(function(e){return!jQuery(e).attr("disabled")});if(r.length>0){var d=null;jQuery.each(r,function(e,t){var a=jQuery(t),n=parseInt(a.data("order-preference"),10);(null===d||n<d)&&(d=a.val())}),null===d&&(d="new"),jQuery.each(r,function(e,t){var a=jQuery(t);if(a.val()===d)return a.iCheck("check"),a.closest(".cc-item").addClass("active"),!1})}}}),jQuery(".payment-methods:checked").trigger("ifChecked"),jQuery(".cc-input-container .paymethod-info").click(function(){var e=$(this).data("paymethod-id"),t=jQuery('input[name="ccinfo"][value='+e+"]:not(:disabled)");t.length>0&&t.iCheck("check")}),$("button.btn-checkout").on("click",function(){$("#submit-checkout").trigger("click"),$(".gateway-errors").length>0&&setTimeout(function(){var e=$(".gateway-errors");$(e).hasClass("hidden")||($("#checkout .loader").addClass("hidden"),$("#checkout span").removeClass("invisible hidden"),$("#checkout2 .loader").addClass("hidden"),$("#checkout2 span").removeClass("invisible hidden"))},1500)}),jQuery("#inputDomainContact").on("change",function(){"addingnew"==this.value?jQuery("#domainRegistrantInputFields").hide().removeClass("hidden").slideDown():jQuery("#domainRegistrantInputFields").slideUp()}),jQuery(".mc-promo .btn-add").click(function(e){var t=jQuery(this);t.attr("disabled","disabled").find("span.arrow i").removeClass("fa-chevron-right").addClass("fa-spinner fa-spin"),WHMCS.http.jqClient.post(window.location.pathname,{a:"addUpSell",product_key:t.data("product-key"),token:csrfToken},function(e){void 0===e.modal?window.location.reload(!0):openModal(e.modal,"",e.modalTitle,"","",e.modalSubmit,e.modelSubmitId)},"json")}),jQuery(document).on("click","#btnAddUpSell",function(e){needRefresh=!0}),jQuery(".mc-promo .header").on("click",function(e){e.preventDefault(),jQuery(e.target).is(".btn, .btn span,.btn .ls")||(jQuery(this).parent().find(".rotate").hasClass("lm-plus")?jQuery(this).parent().find(".rotate").removeClass("lm-plus").addClass("lm-minus"):jQuery(this).parent().find(".rotate").removeClass("lm-minus").addClass("lm-plus"),jQuery(this).parent().find(".body").slideToggle("fast"))}),jQuery(".mc-promos.viewcart .mc-promo:first-child .header").click(),checkoutForm=jQuery("#frmCheckout"),checkoutForm.length&&checkoutForm.on("submit",validateCheckoutCreditCardInput)});