jQuery(function(e){function t(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function a(){e("form.activate-jetpack").submit()}function c(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return a();setTimeout(c,3e3)}).fail(function(){a()})}var i=e.parseJSON(wc_setup_params.locale_info);e('select[name="store_location"]').change(function(){var t=e(this).val().split(":"),a=t[0],c=t[1]||!1,s=i[a],n=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(s){if(e.each(s,function(t,a){e(':input[name="'+t+'"]').val(a).change(),-1!==e.inArray(t,n)&&e(':input[name="'+t+'"]').closest("tr").hide()}),!e.isArray(s.tax_rates)){var o=[];if(c&&s.tax_rates[c]?o=o.concat(s.tax_rates[c]):s.tax_rates[""]&&(o=o.concat(s.tax_rates[""])),(o=o.concat(s.tax_rates["*"]||[])).length){var r=e("table.tax-rates tbody").empty();e.each(o,function(t,a){e("",{html:[e("",{"class":"readonly",text:a.country||""}),e("",{"class":"readonly",text:a.state||"*"}),e("",{"class":"readonly",text:a.rate||""}),e("",{"class":"readonly",text:a.name||""})]}).appendTo(r)}),e(".tax-rates").show()}else e(".tax-rates").hide()}}else e(':input[name="currency_pos"]').closest("tr").show(),e(':input[name="thousand_sep"]').closest("tr").show(),e(':input[name="decimal_sep"]').closest("tr").show(),e(':input[name="num_decimals"]').closest("tr").show(),e(".tax-rates").hide()}).change(),e('input[name="woocommerce_calc_taxes"]').change(function(){e(this).is(":checked")?(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").show(),e("tr.tax-rates").show()):(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").hide(),e("tr.tax-rates").hide())}).change(),e(".button-next").on("click",function(){var a=e(this).parents("form").get(0);return("function"!=typeof a.checkValidity||a.checkValidity())&&t(),!0}),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"):e(this).closest(".wc-wizard-service-toggle").addClass("disabled")}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(t){t.stopPropagation();var a=e(this).find(".wc-wizard-service-toggle input");a.prop("checked",!a.prop("checked")).change()}),e(".wc-wizard-services-list-toggle").on("change",".wc-wizard-service-enable input",function(){e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(t){var a=e(this).parent("div"),c=t.target.value,i=a.find(".shipping-method-description");i.find("p").hide(),i.find("p."+c).show();var s=a.find(".shipping-method-settings");s.find("div").hide(),s.find("div."+c).show()}),e(".button-jetpack-connect").on("click",function(e){if(t(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),c()})});