"use strict";!function(e,t,a){function n(e){return Object.prototype.toString.call(e).toLocaleLowerCase().replace(/[\[\]]/g,"").split(" ")[1]}if(!t)return void console.error("lack jQuery.js");var i={info:function(e){var t=this._getConf(e);return t.icon='',t.background="info",this._make(t)},error:function(e){var t=this._getConf(e);return t.icon='',t.background="error",this._make(t)},success:function(e){var t=this._getConf(e);return t.icon='',t.background="success",this._make(t)},warning:function(e){var t=this._getConf(e);return t.icon='',t.background="warning",this._make(t)},panel:function(e){return"object"!=n(e)&&(e={content:e}),e=Object.assign({},{closable:!0,duration:0,style:{minWidth:320}},e),this._make(this._getConf(e))},_getConf:function(e){var t=Object.assign({},this._config);return e&&"object"==n(e)?Object.assign(t,e):e?Object.assign(t,{content:e}):t},_getId:function(){return"VtMessageId_"+Math.floor(1e7*Math.random())},_config:{duration:2500,background:!1,color:null,content:"",onclose:null,icon:"",animate_duration:500,closable:!1,header:!1,title:!1,footer:!1,confirm:function(e){e()},confirm_text:"确认",cancel:function(e){e()},cancel_text:"取消",area:[],mask:!1,parent:null,remove_parent:!1,offset:"vt-right-top",style:null},_createHeader:function(e,a){if(a.header){var n=t('
");e.prepend(n)}else if(a.title){var i=t('");e.prepend(i)}this._createClose(e,e.find(".vt-message-header"),a)},_createClose:function(e,a,n){var i=this;if(n.closable&&a.length){var s=t('
');a.append(s),s.find("i").bind("click",function(){i.hide(e,n)})}},_createContent:function(e,a){var n=a.header||a.title||!a.icon?"":a.icon;n+=a.content;var i=t(''+n+"
");a.header||a.title||!a.closable||this._createClose(e,i,a),e.append(i)},_createFooter:function(e,a){var i=this;if(a.footer&&"string"==n(a.footer))e.append('');else if((a.cancel||a.confirm)&&a.footer){var s=t('');if(e.append(s),a.cancel){var o=t('");s.append(o),o.on("click",function(){!0===a.cancel(function(){i.hide(e,a)})&&i.hide(e,a)})}if(a.confirm){var r=t('");s.append(r),r.on("click",function(){!0===a.confirm(function(){i.hide(e,a)})&&i.hide(e,a)})}}},_setMask:function(e,t){if(t.mask){var a=Math.floor(1e6*Math.random());e.parent().addClass("vt-message-mask").data("mask",a),e.data("mask",a)}},hide:function(e,t){e.data("mask")&&e.parent().data("mask")&&e.data("mask").toString()==e.parent().data("mask").toString()&&e.parent().removeClass("vt-message-mask").data("mask","0"),e.addClass("vt-remove");var a=function(){t.remove_parent&&e.parent().remove(),e.remove()};t.onclose?t.onclose(a,e,t):setTimeout(a,t.animate_duration)},_make:function(e){var a=this,i=this._getId(),s=t('');return this.getContainer(e).append(s),e.class&&s.addClass(e.class),e.color&&s.css("color",e.color),e.background&&(/^(#|rgb\(|rgba\()/.test(e.background)?s.css("background-color",e.background):s.addClass("vt-background vt-bg-"+e.background)),e.style&&"object"==n(e.style)&&s.css(e.style),this._createHeader(s,e),this._createContent(s,e),this._createFooter(s,e),e.area.length>0&&s.css("width",e.area[0]),e.area.length>1&&s.css("height",e.area[1]),this._setMask(s,e),e.offset&&("string"==n(e.offset)?s.addClass(e.offset):s.css("position","absolute").css(e.offset)),e.duration>0&&setTimeout(function(){a.hide(s,e)},e.duration),s},getContainer:function(e){var a=t(e.parent?e.parent:".vt-message-package");return a.length||(a=t(''),t(document.body).append(a)),a}};a&&(a.Message=i),e.VtMessage=i}(window,window.jQuery,window.ViewT);