window.onPackValidityInput=function(i){var e=parseFloat(i.value),n=document.getElementById("_pack_validity_desc"),o=i.getAttribute("data-msg-invalid"),d=i.getAttribute("data-msg-default");""!==i.value&&"-"!==i.value&&0===e?(i.style.borderColor="red",i.style.boxShadow="0 0 0 1px red",n.innerHTML=o,n.style.color="red",i.dataset.invalid="1"):(i.style.borderColor="",i.style.boxShadow="",n.innerHTML=d,n.style.color="#666",i.dataset.invalid="0")},function(i){const e=i("#woocommerce-product-data");e.length&&e.find(".pricing").addClass("show_if_product_pack").end().find(".inventory_tab").addClass("hide_if_product_pack").end().find(".shipping_tab").addClass("hide_if_product_pack").end().find(".linked_product_tab").addClass("hide_if_product_pack").end().find(".attributes_tab").addClass("hide_if_product_pack").end().find("._no_of_product_field").hide().end().find("._pack_validity_field").hide().end().find("#_tax_status").parent().parent().addClass("show_if_product_pack").end(),"product_pack"===i("#product-type").val()&&setTimeout(function(){i(".inventory_tab").hide()},500),i("body").on("woocommerce-product-type-change",function(e,n){i("._no_of_product_field").hide(),i("._pack_validity_field").hide(),i("._enable_recurring_payment_field").hide(),i(".dokan_subscription_pricing").hide(),i("._sale_price_field").show(),i(".dokan_subscription_trial_period").hide(),"product_pack"==n&&(i("._no_of_product_field").show(),i("._pack_validity_field").show(),i("._enable_recurring_payment_field").show(),i("._sale_price_field").hide(),i("#dokan_subscription_enable_trial").is(":checked")&&i(".dokan_subscription_trial_period").show(),i("#_enable_recurring_payment").is(":checked")&&(i(".dokan_subscription_pricing").show(),i("._pack_validity_field").hide(),i("._exclusive_for_admin_only_field").prop("checked",!1)))}),i(".woocommerce_options_panel").on("change","#dokan_subscription_enable_trial",function(){i(".dokan_subscription_trial_period").hide(),i(this).is(":checked")&&i(".dokan_subscription_trial_period").fadeIn()}),i(".woocommerce_options_panel").on("change","#_enable_recurring_payment",function(){i(".dokan_subscription_pricing").hide(),i("._pack_validity_field").show(),i(this).is(":checked")&&(i(".dokan_subscription_pricing").fadeIn(),i("._pack_validity_field").hide(),i("#_exclusive_for_admin_only").prop("checked",!1))}),i(".woocommerce_options_panel").on("change","#_exclusive_for_admin_only",function(){const e=i("#_enable_recurring_payment");i(this).is(":checked")&&e.is(":checked")&&(i(this).prop("checked",!1),alert(dokanSubscription.exclusiveForAdminOnly))}),i("#woocommerce-product-data").on("change",'[name^="_dokan_subscription_period"], [name^="_dokan_subscription_period_interval"]',function(){i('[name^="_dokan_subscription_length"]').each(function(){let e,n=i(this),o=n.val(),d=!1;e="#_dokan_subscription_period",billingInterval=parseInt(i("#_dokan_subscription_period_interval").val()),n.empty(),i.each(dokanSubscription.subscriptionLengths[i("#_dokan_subscription_period").val()],function(e,o){0!=parseInt(e)&&0!=parseInt(e)%billingInterval||n.append(i("<option></option>").attr("value",e).text(o))}),n.children("option").each(function(){if(this.value==o)return d=!0,!1}),d?n.val(o):n.val(0)})})}(jQuery);