(()=>{"use strict";const t=class{minField;maxField;constructor(t,n){this.minField=t,this.maxField=n,this.initEvents()}initEvents(){this.minField.on("change",this.validateFields.bind(this)),this.maxField.on("change",this.validateFields.bind(this))}validateFields(){let t=this.parseQuantity(this.minField),n=this.parseQuantity(this.maxField);t=Math.max(0,t),n=Math.max(0,n),n>0&&n<t&&(n=t),this.minField.val(t),this.maxField.val(n)}parseQuantity(t){const n=t.val();return""===n?0:Math.max(0,parseInt(n,10))}};var n;(n=jQuery)(document).ready(function(){const i=dokan_order_min_max||{};n("#the-list").on("click",".editinline",function(){let s=n(this).closest("tr").attr("id");s=s.replace("post-","");const a=n(`#post-${s} .${i.constants.QUICK_EDIT_META_DATA}`).data("min-max-data"),e=n(`#edit-${s} .${i.constants.QUICK_EDIT_MINIMUM_QUANTITY}`),_=n(`#edit-${s} .${i.constants.QUICK_EDIT_MAXIMUM_QUANTITY}`);e.val(a.min_quantity),_.val(a.max_quantity),new t(e,_)}),n("#doaction").on("click",function(){if("edit"===n("#bulk-action-selector-top").val()){const s=n(`.inline-edit-wrapper .${i.constants.QUICK_EDIT_MINIMUM_QUANTITY}`),a=n(`.inline-edit-wrapper .${i.constants.QUICK_EDIT_MAXIMUM_QUANTITY}`);new t(s,a)}}),n(`.${i.constants.SIMPLE_PRODUCT_MIN_MAX_WRAPPER}`).ready(function(){const s=n(`.${i.constants.SIMPLE_PRODUCT_MIN_MAX_WRAPPER} #${i.constants.SIMPLE_PRODUCT_MIN_QUANTITY}`),a=n(`.${i.constants.SIMPLE_PRODUCT_MIN_MAX_WRAPPER} #${i.constants.SIMPLE_PRODUCT_MAX_QUANTITY}`);new t(s,a)}),n(document).on("woocommerce_variations_loaded",function(){n(`.${i.constants.VARIATION_PRODUCT_MIN_MAX_WRAPPER}`).map((s,a)=>{const e=n(a).find(`.${i.constants.VARIATION_PRODUCT_MIN_QUANTITY}`),_=n(a).find(`.${i.constants.VARIATION_PRODUCT_MAX_QUANTITY}`);new t(e,_)})})})})();