jQuery(function(e){var t={states:null,init:function(){"undefined"!=typeof wc_users_params.countries&&(this.states=JSON.parse(wc_users_params.countries.replace(/&quot;/g,'"'))),e(".js_field-country").selectWoo().on("change",this.change_country),e(".js_field-country").trigger("change",[!0]),e(document.body).on("change","select.js_field-state",this.change_state),e(document.body).on("click","button.js_copy-billing",this.copy_billing)},change_country:function(a,n){if(void 0===n&&(n=!1),null!==t.states){var o,i=e(this),c=i.val(),s=i.parents(".form-table").find(":input.js_field-state"),r=s.parent(),l=s.attr("name"),p=s.attr("id"),d="woocommerce.stickState-"+c,u=i.data(d)?i.data(d):s.val(),h=s.attr("placeholder");if(n&&i.data("woocommerce.stickState-"+c,u),r.show().find(".select2-container").remove(),e.isEmptyObject(t.states[c]))o=e('<input type="text" />').prop("id",p).prop("name",l).prop("placeholder",h).addClass("js_field-state regular-text").val(u),s.replaceWith(o);else{var g=t.states[c],f=e('<option value=""></option>').text(t.i18n_select_state_text);o=e('<select style="width: 25em;"></select>').prop("id",p).prop("name",l).prop("placeholder",h).addClass("js_field-state").append(f),e.each(g,function(t){var a=e("<option></option>").prop("value",t).text(g[t]);o.append(a)}),o.val(u),s.replaceWith(o),o.show().selectWoo().hide().trigger("change")}e(document.body).trigger("contry-change.woocommerce",[c,e(this).closest("div")]),e(document.body).trigger("country-change.woocommerce",[c,e(this).closest("div")])}},change_state:function(){var t=e(this),a=t.val(),n=t.parents(".form-table").find(":input.js_field-country"),o=n.val();n.data("woocommerce.stickState-"+o,a)},copy_billing:function(t){t.preventDefault(),e("#fieldset-billing").find("input, select").each(function(t,a){var n=a.name.replace(/^billing_/,"shipping_"),o=e('[name="'+n+'"]');o.length&&o.val(a.value).trigger("change")})}};t.init()});