!function(e){"use strict";function r(){1==e("#_wopb_preorder_simple").prop("checked")?(e("#wopb-woocommerce-preorder-field-group").show(),e("#wopb-woocommerce-preorder-field-group").find(".wopb_required").attr("required","required"),e("#wopb-preorder-select-instruction").hide()):(e("#wopb-woocommerce-preorder-field-group").hide(),e("#wopb-woocommerce-preorder-field-group").find(".wopb_required").removeAttr("required"),e("#wopb-preorder-select-instruction").show())}function o(e){const r=e.parent("p").parent().find(".wopb_preorder_manage_price_depend_required");1==e.prop("checked")?(r.parent("p").show(),r.attr("required","required")):(r.parent("p").hide(),r.removeAttr("required"))}r(),e("._wopb_preorder_price_manage").each((function(){o(e(this))})),e(document).on("click","._wopb_preorder_price_manage",(function(){o(e(this))})),e("#_wopb_preorder_simple").change((function(){1==e(this).prop("checked")&&e("ul.product_data_tabs .productx_options a").trigger("click"),r()})),e(document).on("woocommerce_variations_loaded",(function(){e("._wopb_preorder_variable").each((function(){let r=e(this).closest("div.woocommerce_variable_attributes").find(".wopb-woocommerce-variable-preorder-field-group");1==e(this).prop("checked")?(r.show(),r.find(".wopb_required").attr("required","required")):(r.hide(),r.find(".wopb_required").removeAttr("required"))})),e("._wopb_preorder_price_manage").each((function(){o(e(this))}))})),e(document).on("click","._wopb_preorder_variable",(function(){let r=e(this).closest("div.woocommerce_variable_attributes").find(".wopb-woocommerce-variable-preorder-field-group");1==e(this).prop("checked")?(r.show(),r.find(".wopb_required").attr("required","required")):(r.hide(),r.find(".wopb_required").removeAttr("required"))})),e("form.variations_form").each((function(){let r=e(this),o=r.find(".single_add_to_cart_button").text();e(r).on("show_variation",(function(r,t){let i=e(this).find(".woocommerce-variation-description").find(".wopb-single-variation-pre-order-text").val();e(".single_add_to_cart_button").text(i||o)})).on("hide_variation",(function(r){e(".single_add_to_cart_button").text(o)}))}));const t=e(".wopb-singlepage-preorder-countdown"),i=new Date(t.data("pre-order-date"));setInterval((function(){!function(){const e=Date.now(),r=i-e,o=Math.floor(r/864e5),n=Math.floor(r%864e5/36e5),d=Math.floor(r%36e5/6e4),p=Math.floor(r%6e4/1e3);t.find(".wopb-count-days").text(String(o).padStart(2,"0")),t.find(".wopb-count-hours").text(String(n).padStart(2,"0")),t.find(".wopb-count-minutes").text(String(d).padStart(2,"0")),t.find(".wopb-count-seconds").text(String(p).padStart(2,"0"))}()}),1e3)}(jQuery);