jQuery(function(h){
var v={
states: null,
init: function(){
void 0!==window.wcv_countries_states.countries &&
(this.states=h.parseJSON(window.wcv_countries_states.countries.replace(/&quot;/g, '"')
)),
h('.js_field-country')
.select2()
.change(this.change_country),
h('.js_field-country').trigger('change', [!0]),
h(document.body).on('change', '.js_field-state', this.change_state);
},
change_country: function(t, e){
var a, s, o, n, i, c, r, p, l, d, u;
void 0===e&&(e = !1),
null!==v.states &&
((s=(a=h(this)).val()),
(n=(o=a
.parents('.tabs-content')
.find(':input.js_field-state')).parent()),
(i=o.attr('name')),
(c=o.attr('id')),
(r=a.data((r='woocommerce.stickState-' + s))
? a.data(r)
: o.val()),
(p=o.attr('placeholder')),
(l=o.prop('required')),
e&&a.data('woocommerce.stickState-' + s, r),
n
.show()
.find('.select2-container')
.remove(),
h.isEmptyObject(v.states[s])
? ((u=h('<input type="text" />')
.prop('id', c)
.prop('name', i)
.prop('placeholder', p)
.addClass('js_field-state regular-text')
.val(r)),
o.replaceWith(u),
l&&u.prop('required', !0))
: ((d=v.states[s]),
(e=h('<option value=""></option>').text(wcv_countries_states.i18n_select_state_text
)),
(u=h('<select style="100%;"></select>')
.prop('id', c)
.prop('name', i)
.prop('placeholder', p)
.addClass('js_field-state')
.append(e)),
h.each(d, function(t){
t=h('<option></option>')
.prop('value', t)
.text(d[t]);
u.append(t);
}),
u.val(r),
o.replaceWith(u),
l&&u.prop('required', !0),
u
.show()
.select2({ width: 'resolve' })
.hide()
.change()),
h(document.body).trigger('wcv-country-change', [
s,
h(this).closest('div')
]));
},
change_state: function(){
var t=h(this),
e=t.val(),
t=t.parents('.form-table').find(':input.js_field-country'),
a=t.val();
t.data('woocommerce.stickState-' + a, e);
}};
v.init();
});