var init=!1,InputNumberWidget={init:function(){if(init)return void alert("InputNumberWidget already init");init=!0,$(document).on("click","[data-input-number-widget] [data-add]",function(){var t=$(this).closest("[data-input-number-widget]"),a=t.find("[data-value]"),n=parseInt(a.val());if(n++,a.is("[data-max]")){var i=parseInt(a.attr("data-max"));n>i&&(n=i)}return a.val(n),t.trigger("input-number-widget.change",[t,n]),!1}),$(document).on("click","[data-input-number-widget] [data-minus]",function(){var t=$(this).closest("[data-input-number-widget]"),a=t.find("[data-value]"),n=parseInt(a.val());if(n--,a.is("[data-min]")){var i=parseInt(a.attr("data-min"));n<i&&(n=i)}return a.val(n),t.trigger("input-number-widget.change",[n]),!1}),$(document).on("change","[data-input-number-widget] [data-value]",function(){var t=$(this).closest("[data-input-number-widget]"),a=parseInt($(this).val());t.trigger("input-number-widget.change",[a])});var t=function(t){var a=$(t);this.val=function(t){if(void 0==t)return parseInt(a.find("[data-value]").val());a.find("[data-value]").val(t),a.trigger("input-number-widget.change",[t])},this.setMax=function(t){a.find("[data-value]").attr("data-max",t),a.find("[data-value]").val()>t&&a.find("[data-value]").val(t)},this.clearMax=function(){a.find("[data-value]").removeAttr("data-max")}};$.fn.extend({InputNumberWidget:function(){var a=$(this).data("widget");return a||(a=new t(this),$(this).data("widget",a),a)}})}};module.exports=InputNumberWidget;