var init=!1,FileWidget={getOption:function($container){var initValue;try{try{initValue=JSON.parse($container.attr("data-file-widget"))}catch(e){initValue=eval("initValue = "+$container.attr("data-file-widget"))}}catch(i){initValue={}}return $.extend({emptyFile:"[请选择文件]",category:"file"},initValue)},init:function(){if(!init&&(init=!0,"callback"in window&&"fileWidgetSelectFile"in window.callback)){$(document).on("click","[data-file-widget] .add",function(){var i=$(this).closest("[data-file-widget]"),e=FileWidget.getOption(i);return window.callback.fileWidgetSelectFile(function(e){i.find("[data-file]").val(e[0]),i.find(".file").html(e[0]),i.trigger("file-widget.change",[e[0]])},e),!1}),$(document).on("click","[data-file-widget] .delete",function(){var i=$(this).closest("[data-file-widget]"),e=FileWidget.getOption(i);return i.find("[data-file]").val(""),i.find(".file").html(e.emptyFile),i.trigger("file-widget.change",[null]),!1});var i=function(i){var e=$(i);this.init=function(){this.val(e.find("[data-file]").val())},this.val=function(i){if(void 0==i)return e.find("[data-file]").val();if(i)e.find("[data-file]").val(i),e.find(".file").html(i),e.trigger("file-widget.change",[i]);else{var t=FileWidget.getOption(e);e.find("[data-file]").val(""),e.find(".file").html(t.emptyFile),e.trigger("file-widget.change",[null])}}};$.fn.extend({fileWidget:function(){return new i(this)}}),$(function(){$("[data-file-widget]").fileWidget().init()})}}};module.exports=FileWidget;