var Widget=function(e){var a=$(e),i=this;this.value=null,this.val=function(e){if(void 0===e)return i.value;var t=a.find('input[type=radio][value="'+e+'"]');a.find("label").removeClass("select"),a.find("input[type=radio]").prop("checked",!1),t.length?(i.value=t.val(),t.parent().addClass("select"),setTimeout(function(){t.prop("checked",!0),a.trigger("radio-widget.change",[i.val()])},0)):(i.value=null,a.trigger("radio-widget.change",[null]))},a.on("click","label",function(){var e=$(this).find("input[type=radio]");return e.val()==i.val()?i.val(null):i.val(e.val()),!1});var t=a.find("input[type=radio]:checked");t.length?i.val(t.val()):i.val(null)},RadioWidget={init:function(){$("[data-radio-widget]").each(function(e,a){var i=$(a).data("widget");i||(i=new Widget(a),$(a).data("widget",i))})}};module.exports=RadioWidget;