(function(t){function e(e){for(var i,s,o=e[0],c=e[1],l=e[2],m=0,d=[];m0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;return e||(e={id:"system",displayName:"系统测试",avatar:"http://upload.qqbodys.com/allimg/1710/1035512943-0.jpg"}),{id:y(),status:"succeed",type:"text",sendTime:w(),content:j(),toContactId:t,fromUser:e}},O={name:"app",data:function(){return{hideMenuAvatar:!1,hideMenu:!1,user:{id:"superadmin",displayName:"June",avatar:"https://gss2.bdstatic.com/-fo3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=69e1a1a4b78f8c54e3d3c22902124ac8/060828381f30e9247e29fb7b4f086e061c95f7ef.jpg"}}},mounted:function(){var t=this.$createElement,e={id:"contact-1",displayName:"工作协作群",avatar:"http://upload.qqbodys.com/img/weixin/20170804/ji5qxg1am5ztm.jpg",type:"single",index:"A",unread:0,lastSendTime:1566047865417,lastContent:"2"},n={id:"contact-2",displayName:"自定义内容",avatar:"http://upload.qqbodys.com/img/weixin/20170807/jibfvfd00npin.jpg",type:"single",click:function(t){t()},renderContainer:function(){return t("h1",{style:"text-indent:20px"},["自定义页面"])},lastSendTime:1345209465e3,lastContent:"12312",unread:2},i={id:"contact-3",displayName:"铁牛",avatar:"http://upload.qqbodys.com/img/weixin/20170803/jiq4nzrkrnd0e.jpg",type:"many",index:"C",unread:32,lastSendTime:3,lastContent:"你好123"},a=this.$refs.IMUI,r=[u({},e),u({},n),u({},i)];a.initContacts(r),a.initMenus([{name:"lastMessages"},{name:"contacts"},{name:"custom1",title:"自定义按钮1",unread:0,render:function(e){return t("i",{class:"lemon-icon-attah"})},renderContainer:function(){return t("div",{class:"article"},[t("ul",[t("li",{class:"article-item"},[t("h2",["人民日报谈网红带货:产品真的值得买吗?"])]),t("li",{class:"article-item"},["甘肃夏河县发生5.7级地震 暂未接到人员伤亡报告"]),t("li",{class:"article-item"},["北方多地风力仍强沙尘相伴,东北内蒙古等地迎雨雪"]),t("li",{class:"article-item"},["英货车案:越南警方采集疑死者家属DNA作比对"]),t("li",{class:"article-item"},["知名连锁咖啡店的蛋糕吃出活虫 曝光内幕太震惊"])]),t("lemon-contact",o()([{},{props:{contact:e}},{style:"margin:20px"}])),t("lemon-contact",o()([{},{props:{contact:i}},{style:"margin:20px"}]))])},isBottom:!0},{name:"custom2",title:"自定义按钮2",unread:0,click:function(){alert("拦截导航点击事件")},render:function(e){return t("i",{class:"lemon-icon-group"})},isBottom:!0}]),a.initEmoji([{label:"表情",children:[{name:"1f600",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f600.png"},{name:"1f62c",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f62c.png"},{name:"1f601",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f601.png"},{name:"1f602",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f602.png"},{name:"1f923",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f923.png"},{name:"1f973",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f973.png"},{name:"1f603",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f603.png"},{name:"1f604",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f604.png"},{name:"1f605",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f605.png"},{name:"1f606",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f606.png"},{name:"1f607",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f607.png"},{name:"1f609",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f609.png"},{name:"1f60a",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f60a.png"},{name:"1f642",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f642.png"},{name:"1f643",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f643.png"},{name:"1263a",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/263a.png"},{name:"1f60b",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f60b.png"},{name:"1f60c",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f60c.png"},{name:"1f60d",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f60d.png"},{name:"1f970",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f970.png"},{name:"1f618",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f618.png"},{name:"1f617",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f617.png"},{name:"1f619",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f619.png"},{name:"1f61a",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f61a.png"},{name:"1f61c",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f61c.png"},{name:"1f92a",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f92a.png"},{name:"1f928",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f928.png"},{name:"1f9d0",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f9d0.png"},{name:"1f61d",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f61d.png"},{name:"1f61b",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f61b.png"},{name:"1f911",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f911.png"},{name:"1f913",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f913.png"},{name:"1f60e",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f60e.png"},{name:"1f929",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f929.png"},{name:"1f921",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f921.png"},{name:"1f920",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f920.png"},{name:"1f917",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f917.png"},{name:"1f60f",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f60f.png"},{name:"1f636",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f636.png"},{name:"1f610",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f610.png"},{name:"1f611",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f611.png"},{name:"1f612",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f612.png"},{name:"1f644",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f644.png"},{name:"1f914",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f914.png"},{name:"1f925",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f925.png"},{name:"1f92d",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f92d.png"},{name:"1f92b",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f92b.png"},{name:"1f92c",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f92c.png"},{name:"1f92f",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f92f.png"},{name:"1f633",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f633.png"},{name:"1f61e",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f61e.png"},{name:"1f61f",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f61f.png"},{name:"1f620",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f620.png"},{name:"1f621",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f621.png"}]},{label:"收藏",children:[{name:"1f62c",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f62c.png"},{name:"1f621",title:"微笑",src:"https://twemoji.maxcdn.com/2/72x72/1f621.png"}]}])},methods:{handleMenuAvatarClick:function(){console.log("Event:menu-avatar-click")},handleMessageClick:function(t,e,n){var i=this.$refs.IMUI;"status"==e&&(i.updateMessage(n.id,n.toContactId,{status:"going",content:"正在重新发送消息..."}),setTimeout(function(){i.updateMessage(n.id,n.toContactId,{status:"succeed",content:"发送成功"})},2e3))},changeMenuAvatarVisible:function(){this.hideMenuAvatar=!this.hideMenuAvatar},changeMenuVisible:function(){this.hideMenu=!this.hideMenu},appendMessage:function(){var t=this.$refs.IMUI,e=t.currentContact,n=C();n.fromUser=u({},n.fromUser,{},this.user),t.appendMessage(n),t.updateContact(e.id,{unread:"+1",lastSendTime:w(),lastContent:t.lastContentRender(n)})},updateContact:function(){this.$refs.IMUI.updateContact("contact-3",{unread:10,displayName:j(),lastSendTime:w(),lastContent:"修改昵称为随机字母"})},changeDrawer:function(t){var e=this.$createElement;this.$refs.IMUI.changeDrawer(function(){return e("div",{class:"drawer-content"},[e("p",[e("b",["自定义抽屉"])]),e("p",[t.displayName])])})},handleChangeContact:function(t){console.log("Event:change-contact"),this.$refs.IMUI.updateContact(t.id,{unread:0}),this.$refs.IMUI.closeDrawer()},handleSend:function(t,e,n){console.log(t,e,n),setTimeout(function(){e()},1e3)},handlePullMessages:function(t,e){var n=this.$refs.IMUI,i={id:"hehe",displayName:"I KNOEW",avatar:"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=4085009425,1005454674&fm=26&gp=0.jpg"};console.log("Event:pull-messages");var a=[C(n.currentContactId,this.user),C(n.currentContactId,i),C(n.currentContactId,this.user),C(n.currentContactId,i),C(n.currentContactId,this.user),C(n.currentContactId,this.user),C(n.currentContactId,i),u({},C(n.currentContactId,this.user),{},{status:"failed"})];console.log(a);var r=!1;n.getMessages(n.currentContactId).length>20&&(r=!0),e(a,r)},handleChangeMenu:function(){console.log("Event:change-menu")},openCustomContainer:function(){}}},M=O,k=(n("9c9b"),n("2877")),S=Object(k["a"])(M,a,r,!1,null,null,null),I=S.exports,$=(n("7f7f"),{name:"LemonTabs",props:{activeIndex:String},data:function(){return{active:this.activeIndex}},mounted:function(){this.active||(this.active=this.$slots["tab-pane"][0].data.attrs.index)},render:function(){var t=this,e=arguments[0],n=[],i=[];return this.$slots["tab-pane"].map(function(a){var r=a.data.attrs,s=r.tab,o=r.index;n.push(e("div",{class:"lemon-tabs-content__pane",directives:[{name:"show",value:t.active==o}]},[a])),i.push(e("div",{class:["lemon-tabs-nav__item",t.active==o&&"lemon-tabs-nav__item--active"],on:{click:function(){return t._handleNavClick(o)}}},[s]))}),e("div",{class:"lemon-tabs"},[e("div",{class:"lemon-tabs-content"},[n]),e("div",{class:"lemon-tabs-nav"},[i])])},methods:{_handleNavClick:function(t){this.active=t}}}),D=$,P=(n("3423"),Object(k["a"])(D,m,d,!1,null,null,null)),T=P.exports,E=(n("96cf"),n("3b8d")),L=(n("6762"),n("2fdb"),[]),F=function(){return L.forEach(function(t){return t()})},R={hover:function(t){},focus:function(t){var e=this;t.addEventListener("focus",function(t){e.changeVisible()}),t.addEventListener("blur",function(t){e.changeVisible()})},click:function(t){var e=this;t.addEventListener("click",function(t){t.stopPropagation(),e.changeVisible()})},contextmenu:function(t){var e=this;t.addEventListener("contextmenu",function(t){t.preventDefault(),e.changeVisible()})}},U={name:"LemonPopover",props:{trigger:{type:String,default:"click",validator:function(t){return Object.keys(R).includes(t)}}},data:function(){return{popoverStyle:{},visible:!1}},created:function(){document.addEventListener("click",this._documentClickEvent),L.push(this.close)},mounted:function(){R[this.trigger].call(this,this.$slots.default[0].elm)},render:function(){var t=arguments[0];return t("span",{style:"position:relative"},[t("transition",{attrs:{name:"slide-top"}},[this.visible&&t("div",{class:"lemon-popover",ref:"popover",style:this.popoverStyle,on:{click:function(t){return t.stopPropagation()}}},[t("div",{class:"lemon-popover__title"}),t("div",{class:"lemon-popover__content"},[this.$slots.content]),t("div",{class:"lemon-popover__arrow"})])]),this.$slots.default])},destroyed:function(){document.removeEventListener("click",this._documentClickEvent)},computed:{},watch:{visible:function(){var t=Object(E["a"])(regeneratorRuntime.mark(function t(e){var n,i;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(!e){t.next=6;break}return t.next=3,this.$nextTick();case 3:n=this.$slots.default[0].elm,i=this.$refs.popover,this.popoverStyle={top:"-".concat(i.offsetHeight+10,"px"),left:"".concat(n.offsetWidth/2-i.offsetWidth/2,"px")};case 6:case"end":return t.stop()}},t,this)}));function e(e){return t.apply(this,arguments)}return e}()},methods:{_documentClickEvent:function(t){t.stopPropagation(),this.visible&&this.close()},changeVisible:function(){this.visible?this.close():this.open()},open:function(){F(),this.visible=!0},close:function(){this.visible=!1}}},B=U,A=(n("0e15"),Object(k["a"])(B,f,h,!1,null,null,null)),N=A.exports,V={name:"LemonButton",props:{disabled:Boolean},render:function(){var t=arguments[0];return t("button",{class:"lemon-button",attrs:{disabled:this.disabled,type:"button"},on:{click:this._handleClick}},[this.$slots.default])},methods:{_handleClick:function(t){this.$emit("click",t)}}},H=V,z=(n("1e45"),Object(k["a"])(H,p,g,!1,null,null,null)),q=z.exports,K=(n("c5f6"),{name:"LemonBadge",props:{count:[Number,Boolean],overflowCount:{type:Number,default:99}},render:function(){var t=arguments[0];return t("span",{class:"lemon-badge"},[this.$slots.default,0!==this.count&&void 0!==this.count&&t("span",{class:["lemon-badge__label",this.isDot&&"lemon-badge__label--dot"]},[this.label])])},computed:{isDot:function(){return!0===this.count},label:function(){return this.isDot?"":this.count>this.overflowCount?"".concat(this.overflowCount,"+"):this.count}},methods:{}}),W=K,Y=(n("dbdc"),Object(k["a"])(W,v,b,!1,null,null,null)),G=Y.exports,J={name:"LemonAvatar",props:{src:String,icon:{type:String,default:"lemon-icon-people"},size:{type:Number,default:32}},data:function(){return{imageFinishLoad:!0}},render:function(){var t=this,e=arguments[0];return e("span",{style:this.style,class:"lemon-avatar",on:{click:function(e){return t.$emit("click",e)}}},[this.imageFinishLoad&&e("i",{class:this.icon}),e("img",{attrs:{src:this.src},on:{load:this._handleLoad}})])},computed:{style:function(){var t="".concat(this.size,"px");return{width:t,height:t,lineHeight:t,fontSize:"".concat(this.size/2,"px")}}},methods:{_handleLoad:function(){this.imageFinishLoad=!1}}},Q=J,Z=(n("04f4"),Object(k["a"])(Q,x,_,!1,null,null,null)),X=Z.exports;n("3b2b"),n("8615");function tt(t){return"[object Object]"===Object.prototype.toString.call(t)}function et(t){return"string"==typeof t}function nt(t){return(new Date).getTime()-t<864e5}function it(t){return!t||(!(!Array.isArray(t)||0!=t.length)||!(!tt(t)||0!=Object.values(t).length))}function at(t){return t&&"function"===typeof t}n("a481");function rt(t,e,n){return t?t(n):e}function st(t){return t<10?"0".concat(t):t}function ot(t){var e,n=new Date(t),i=new Date,a=function(t){return t.getFullYear()},r=function(t){return"".concat(t.getMonth()+1,"-").concat(t.getDate())},s=a(n),o=a(i);return e=s!==o?"y年m月d日 h:i":"".concat(s,"-").concat(r(n))==="".concat(o,"-").concat(r(i))?"h:i":"m月d日 h:i",ct(t,e)}function ct(t,e){e||(e="y-m-d h:i:s"),t=t?new Date(t):new Date;for(var n=[t.getFullYear().toString(),st((t.getMonth()+1).toString()),st(t.getDate().toString()),st(t.getHours().toString()),st(t.getMinutes().toString()),st(t.getSeconds().toString())],i="ymdhis",a=0;a]*>/gi,"[!$1]")}function mt(t){if(null==t||""==t)return"0 Bytes";var e=["B","K","M","G","T","P","E","Z","Y"],n=0,i=parseFloat(t);n=Math.floor(Math.log(i)/Math.log(1024));var a=i/Math.pow(1024,n);return a=parseFloat(a.toFixed(2)),a+e[n]}function dt(){var t=(new Date).getTime();window.performance&&"function"===typeof window.performance.now&&(t+=performance.now());var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)});return e}var ft,ht,pt,gt,vt,bt,xt,_t,wt,yt={name:"LemonContact",components:{},data:function(){return{}},props:{contact:Object,simple:Boolean,timeFormat:{type:Function,default:function(t){return ct(t,nt(t)?"h:i":"y/m/d")}}},render:function(){var t=this,e=arguments[0],n=this.contact;return e("div",{class:["lemon-contact",{"lemon-contact--name-center":this.simple}],on:{click:function(e){return t._handleClick(e,n)}}},[e("lemon-badge",{attrs:{count:this.simple?0:n.unread,"native-on-click":function(e){return t._handleBubbleClick(e,n)}},class:"lemon-contact__avatar"},[e("lemon-avatar",{attrs:{size:40,"native-on-click":function(e){return t._handleAvatarClick(e,n)},src:n.avatar}})]),e("div",{class:"lemon-contact__inner"},[e("p",{class:"lemon-contact__label"},[e("span",{class:"lemon-contact__name"},[n.displayName]),!this.simple&&e("span",{class:"lemon-contact__time"},[this.timeFormat(n.lastSendTime)])]),!this.simple&&e("p",{class:"lemon-contact__content"},[et(n.lastContent)?e("span",o()([{},{domProps:{innerHTML:n.lastContent}}])):n.lastContent])])])},created:function(){},mounted:function(){},computed:{},watch:{},methods:{_handleClick:function(t,e){this.$emit("click",e)},_handleAvatarClick:function(t,e){t.stopPropagation(),this.$emit("avatar-click",e)},_handleBubbleClick:function(t,e){t.stopPropagation(),this.$emit("bubble-click",e)}}},jt=yt,Ct=(n("909e"),Object(k["a"])(jt,ft,ht,!1,null,null,null)),Ot=Ct.exports,Mt=(n("5df3"),n("1c4c"),function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"insertHTML";document.execCommand(e,!1,t)}),kt=window.getSelection(),St=[],It={name:"LemonEditor",components:{},props:{},data:function(){return{submitDisabled:!0,accept:""}},created:function(){},mounted:function(){},computed:{},watch:{},render:function(){var t=this,e=arguments[0];return e("div",{class:"lemon-editor"},[e("input",{style:"display:none",attrs:{type:"file",multiple:"multiple",accept:this.accept},ref:"fileInput",on:{change:this._handleChangeFile}}),e("div",{class:"lemon-editor__tool"},[St.length>0&&e("lemon-popover",{class:"lemon-editor__emoji"},[e("template",{slot:"content"},[this._renderEmojiTabs()]),e("div",{class:"lemon-editor__tool-item"},[e("i",{class:"lemon-icon-emoji"})])]),e("div",{class:"lemon-editor__tool-item",on:{click:function(){return t._handleSelectFile("*")}}},[e("i",{class:"lemon-icon-folder"})]),e("div",{class:"lemon-editor__tool-item",on:{click:function(){return t._handleSelectFile("image/*")}}},[e("i",{class:"lemon-icon-image"})])]),e("div",{class:"lemon-editor__inner"},[e("div",{class:"lemon-editor__input",ref:"textarea",attrs:{contenteditable:"true",spellcheck:"false"},on:{keyup:this._handleKeyup,keydown:this._handleKeydown,paste:this._handlePaste,click:this._handleClick,input:this._handleInput}})]),e("div",{class:"lemon-editor__footer"},[e("div",{class:"lemon-editor__tip"},["使用 ctrl + enter 快捷发送消息"]),e("div",{class:"lemon-editor__submit"},[e("lemon-button",{attrs:{disabled:this.submitDisabled},on:{click:this._handleSend}},["发 送"])])])])},methods:{_saveLastRange:function(){pt=kt.getRangeAt(0)},_focusLastRange:function(){this.$refs.textarea.focus(),pt&&(kt.removeAllRanges(),kt.addRange(pt))},_handleClick:function(){this._saveLastRange()},_handleInput:function(){this._checkSubmitDisabled()},_renderEmojiTabs:function(){var t=this,e=this.$createElement,n=function(n){return n.map(function(n){return e("img",{attrs:{src:n.src,title:n.title},class:"lemon-editor__emoji-item",on:{click:function(){return t._handleSelectEmoji(n)}}})})};if(St[0].label){var i=St.map(function(t,i){return e("div",{slot:"tab-pane",attrs:{index:i,tab:t.label}},[n(t.children)])});return e("lemon-tabs",{style:"width: 412px"},[i])}return e("div",{class:"lemon-tabs-content",style:"width:406px"},[n(St)])},_handleSelectEmoji:function(t){this._focusLastRange(),Mt('')),this._saveLastRange()},_handleSelectFile:function(){var t=Object(E["a"])(regeneratorRuntime.mark(function t(e){return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return this.accept=e,t.next=3,this.$nextTick();case 3:this.$refs.fileInput.click();case 4:case"end":return t.stop()}},t,this)}));function e(e){return t.apply(this,arguments)}return e}(),_handlePaste:function(t){t.preventDefault();var e=t.clipboardData,n=e.getData("text");Mt(n,"insertText")},_handleKeyup:function(t){this._saveLastRange()},_handleKeydown:function(t){t.keyCode},getFormatValue:function(){return ut(this.$refs.textarea.innerHTML.replace(/
|<\/br>/,"").replace(/
|

/g,"\r\n").replace(/<\/div>|<\/p>/g,""))},_checkSubmitDisabled:function(){this.submitDisabled=!this.$refs.textarea.innerHTML.trim()},_handleSend:function(t){var e=this.getFormatValue();this.$emit("send",e),this.clear(),this._checkSubmitDisabled()},_handleChangeFile:function(t){var e=this,n=this.$refs.fileInput;Array.from(n.files).forEach(function(t){e.$emit("upload",t)}),n.value=""},clear:function(){this.$refs.textarea.innerHTML=""},initEmoji:function(t){St=t,this.$forceUpdate()}}},$t=It,Dt=(n("49c2"),Object(k["a"])($t,gt,vt,!1,null,null,null)),Pt=Dt.exports,Tt={name:"LemonMessages",components:{},props:{reverseUserId:String,timeRange:{type:Number,default:1},timeFormat:{type:Function,default:function(t){return ot(t)}},messages:{type:Array,default:function(){return[]}}},data:function(){return{_loading:!1,_loadend:!1}},render:function(){var t=this,e=arguments[0];return e("div",{class:"lemon-messages",ref:"wrap",on:{scroll:this._handleScroll}},[e("div",{class:["lemon-messages__load","lemon-messages__load--".concat(this._loadend?"end":"ing")]},[this._loadend?this._renderLoadEnd():this._renderLoading()]),this.messages.map(function(n,i){var a=[],r="lemon-message-".concat(n.type),s=t.messages[i-1];return s&&t.msecRange&&n.sendTime-s.sendTime>t.msecRange&&a.push(e("lemon-message-event",o()([{},{attrs:{message:{id:"__time__",type:"event",content:t.timeFormat(n.sendTime)}}}]))),a.push(e(r,o()([{ref:"message",refInFor:!0},{attrs:{timeFormat:t.msecRange>0?function(){}:t.timeFormat,message:n,reverse:t.reverseUserId==n.fromUser.id,hiddenTitle:!1}}]))),a})])},computed:{msecRange:function(){return 1e3*this.timeRange*60}},watch:{},methods:{_renderLoading:function(){var t=this.$createElement;return t("i",{class:"lemon-icon-loading lemonani-spin"})},_renderLoadEnd:function(){var t=this.$createElement;return t("span",["暂无更多消息"])},loaded:function(){this._loadend=!0},resetLoadState:function(){this._loading=!1,this._loadend=!1},_handleScroll:function(){var t=Object(E["a"])(regeneratorRuntime.mark(function t(e){var n,i,a=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(n=e.target,0!=n.scrollTop||0!=this._loading||0!=this._loadend){t.next=7;break}return this._loading=!0,t.next=5,this.$nextTick();case 5:i=n.scrollHeight,this.$emit("reach-top",function(){var t=Object(E["a"])(regeneratorRuntime.mark(function t(e){return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,a.$nextTick();case 2:n.scrollTop=n.scrollHeight-i,a._loading=!1,a._loadend=!!e;case 5:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}());case 7:case"end":return t.stop()}},t,this)}));function e(e){return t.apply(this,arguments)}return e}(),scrollToBottom:function(){var t=Object(E["a"])(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,this.$nextTick();case 2:e=this.$refs.wrap,e&&(e.scrollTop=e.scrollHeight);case 4:case"end":return t.stop()}},t,this)}));function e(){return t.apply(this,arguments)}return e}()},created:function(){},mounted:function(){}},Et=Tt,Lt=(n("436f"),Object(k["a"])(Et,bt,xt,!1,null,null,null)),Ft=Lt.exports,Rt={name:"lemonMessageBasic",inject:["IMUI"],props:{message:{type:Object,default:function(){return{}}},timeFormat:{type:Function,default:function(){return""}},reverse:Boolean,hiddenTitle:Boolean},data:function(){return{}},render:function(){var t=this,e=arguments[0],n=this.message,i=n.fromUser,a=n.status,r=n.sendTime;return e("div",{class:["lemon-message",{"lemon-message--reverse":this.reverse,"lemon-message--hidden-title":this.hiddenTitle}]},[e("div",{class:"lemon-message__avatar"},[e("lemon-avatar",{attrs:{size:36,shape:"square",src:i.avatar},on:{click:function(e){t._emitClick(e,"avatar")}}})]),e("div",{class:"lemon-message__inner"},[e("div",{class:"lemon-message__title"},[e("span",{on:{click:function(e){t._emitClick(e,"displayName")}}},[i.displayName]),e("span",{class:"lemon-message__time"},[this.timeFormat(r)])]),e("div",{class:"lemon-message__content",on:{click:function(e){t._emitClick(e,"content")}}},[this.useScopedSlots("content",this.message)]),e("div",{class:"lemon-message__status",on:{click:function(e){t._emitClick(e,"status")}}},[this._renderStatue(a)])])])},created:function(){},mounted:function(){},computed:{},watch:{},methods:{_emitClick:function(t,e){this.IMUI.$emit("message-click",t,e,this.message)},_renderStatue:function(t){var e=this.$createElement;return"going"==t?e("i",{class:"lemon-icon-loading lemonani-spin"}):"failed"==t?e("i",{class:"lemon-icon-prompt",attrs:{title:"重发消息"},style:{color:"#ff2525",cursor:"pointer"}}):void 0},useScopedSlots:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this;return i.$scopedSlots[t]?i.$scopedSlots[t](e):n}}},Ut=Rt,Bt=(n("fbd1"),Object(k["a"])(Ut,_t,wt,!1,null,null,null)),At=Bt.exports;function Nt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function Vt(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:this.currentContactId;this._addMessage(t,e,1),this.messageViewToBottom()},_emitSend:function(t,e,n){var i=this;this.$emit("send",t,function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{status:"succeed"};e(),t=Object.assign(t,n),i.forceUpdateMessage(t.id)},n)},_handleSend:function(t){var e=this,n=this._createMessage({content:t});this.appendMessage(n),this._emitSend(n,function(){e.updateContact(n.toContactId,{lastContent:e.lastContentRender(n),lastSendTime:n.sendTime})})},_handleUpload:function(t){var e,n=this,i=["image/gif","image/jpeg","image/png"];e=i.includes(t.type)?{type:"image",content:URL.createObjectURL(t)}:{type:"file",fileSize:t.size,fileName:t.name,content:""};var a=this._createMessage(e);this.appendMessage(a),this._emitSend(a,function(){n.updateContact(a.toContactId,{lastContent:n.lastContentRender(a),lastSendTime:a.sendTime})},t)},_emitPullMessages:function(t){var e=this;this.$emit("pull-messages",this.currentContact,function(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e._addMessage(n,e.currentContactId,0),De.set(e.currentContactId,i),1==i&&e.$refs.messages.loaded(),t(i)})},clearCacheContainer:function(t){Ie.remove(t),$e.remove(t)},_renderWrapper:function(t){var e=this.$createElement;return e("div",{class:["lemon-wrapper",this.drawerVisible&&"lemon-wrapper--drawer-show"]},[t])},_renderMenu:function(){var t=this,e=this.$createElement,n=this._renderMenuItem();return e("div",{class:"lemon-menu",directives:[{name:"show",value:!this.hideMenu}]},[e("lemon-avatar",{directives:[{name:"show",value:!this.hideMenuAvatar}],on:{click:function(e){t.$emit("menu-avatar-click",e)}},class:"lemon-menu__avatar",attrs:{src:this.user.avatar}}),n.top,this.$slots.menu,e("div",{class:"lemon-menu__bottom"},[this.$slots["menu-bottom"],n.bottom])])},_renderMenuAvatar:function(){},_renderMenuItem:function(){var t=this,e=this.$createElement,n=[],i=[];return this.menus.forEach(function(a){var r=a.name,s=a.title,o=a.unread,c=a.render,l=a.click,u=e("div",{class:["lemon-menu__item",{"lemon-menu__item--active":t.activeSidebar==r}],on:{click:function(){lt(l,function(){r&&t.changeMenu(r)})}},attrs:{title:s}},[e("lemon-badge",{attrs:{count:o}},[c(a)])]);!0===a.isBottom?i.push(u):n.push(u)}),{top:n,bottom:i}},_renderSidebarMessage:function(){var t=this;return this._renderSidebar([rt(this.$scopedSlots["message-sidebar"]),this.lastMessages.map(function(e){return t._renderContact({contact:e,timeFormat:t.contactTimeFormat},function(){return t.changeContact(e.id)})})],be)},_renderContact:function(t,e){var n=this,i=this.$createElement,a=t.contact,r=a.click,s=a.renderContainer,c=a.id,l=function(){lt(r,function(){e(),n._customContainerReady(s,Ie,c)})};return i("lemon-contact",o()([{class:{"lemon-contact--active":this.currentContactId==t.contact.id}},{props:t},{on:{click:l}}]))},_renderSidebarContact:function(){var t,e=this,n=this.$createElement;return this._renderSidebar([rt(this.$scopedSlots["contact-sidebar"]),this.contacts.map(function(i){if(i.index){i.index=i.index.replace(/\[[0-9]*\]/,"");var a=[i.index!==t&&n("p",{class:"lemon-sidebar__label"},[i.index]),e._renderContact({contact:i,simple:!0},function(){return e.changeContact(i.id)})];return t=i.index,a}})],xe)},_renderSidebar:function(t,e){var n=this.$createElement;return n("div",{class:"lemon-sidebar",directives:[{name:"show",value:this.activeSidebar==e}]},[t])},_renderDrawer:function(){var t=this.$createElement;return this._menuIsMessages()&&this.currentContactId?t("div",{class:"lemon-drawer"},[Ee(),rt(this.$scopedSlots.drawer,"",this.currentContact)]):""},_isContactContainerCache:function(t){return t.startsWith("contact#")},_renderContainer:function(){var t=this,e=this.$createElement,n=[],i="lemon-container",a=this.currentContact,r=!0;for(var s in Ie.get()){var o=a.id==s&&this.currentIsDefSidebar;r=!o,n.push(e("div",{class:i,directives:[{name:"show",value:o}]},[Ie.get(s)]))}for(var c in $e.get())n.push(e("div",{class:i,directives:[{name:"show",value:this.activeSidebar==c&&!this.currentIsDefSidebar}]},[$e.get(c)]));return n.push(e("div",{class:i,directives:[{name:"show",value:this._menuIsMessages()&&r&&a.id}]},[e("div",{class:"lemon-container__title"},[e("div",{class:"lemon-container__displayname"},[rt(this.$scopedSlots["contact-title"],a.displayName,a)])]),e("lemon-messages",{ref:"messages",attrs:{"time-format":this.messageTimeFormat,"reverse-user-id":this.user.id,messages:this.currentMessages},on:{"reach-top":this._emitPullMessages}}),e("lemon-editor",{ref:"editor",on:{send:this._handleSend,upload:this._handleUpload}})])),n.push(e("div",{class:i,directives:[{name:"show",value:!a.id&&this.currentIsDefSidebar}]},[this.$slots.cover])),n.push(e("div",{class:i,directives:[{name:"show",value:this._menuIsContacts()&&r&&a.id}]},[rt(this.$scopedSlots["contact-info"],e("div",{class:"lemon-contact-info"},[e("lemon-avatar",{attrs:{src:a.avatar,size:90}}),e("h4",[a.displayName]),e("lemon-button",{on:{click:function(){t.changeContact(a.id,be)}}},["发送消息"])]),a)])),n},_addContact:function(t,e){var n={0:"unshift",1:"push"}[e];this.contacts[n](t)},_addMessage:function(t,e,n){var i,a={0:"unshift",1:"push"}[n];Array.isArray(t)||(t=[t]),Pe[e]=Pe[e]||[],(i=Pe[e])[a].apply(i,Object(ve["a"])(t)),this.forceUpdateMessage()},setLastContentRender:function(t,e){we[t]=e},lastContentRender:function(t){return we[t.type].call(this,t)},replaceEmojiName:function(t){return t.replace(/\[!(\w+)\]/gi,function(t,e){var n=e;return Te[n]?''):"[!".concat(e,"]")})},messageViewToBottom:function(){this.$refs.messages.scrollToBottom()},changeContact:function(t,e){var n=this;this.currentContactId==t&&(this.currentContactId=void 0),e&&this.changeMenu(e),this.currentContactId=t,this.$emit("change-contact",this.currentContact),at(this.currentContact.renderContainer)||this._menuIsMessages()&&(De.has(t)||this.$refs.messages.resetLoadState(),Pe[t]?setTimeout(function(){n.messageViewToBottom()},0):this._emitPullMessages(function(t){return n.messageViewToBottom()}))},removeMessage:function(t,e){var n=this.findMessageIndexById(t,e);-1!==n&&(Pe[e].splice(n,1),this.forceUpdateMessage())},updateMessage:function(t,e,n){var i=this.findMessageIndexById(t,e);-1!==i&&(Pe[e][i]=Object.assign(Pe[e][i],n),console.log("--------",Pe[e][i]),this.forceUpdateMessage(t))},forceUpdateMessage:function(t){if(t){var e=this.$refs.messages.$refs.message;if(e){var n=e.find(function(e){return e.$attrs.message.id==t});n&&n.$forceUpdate()}}else this.$refs.messages.$forceUpdate()},_customContainerReady:function(t,e,n){at(t)&&!e.has(n)&&e.set(n,t.call(this))},changeMenu:function(t){this.$emit("change-menu",t),this.activeSidebar=t},initEmoji:function(t){this.$refs.editor.initEmoji(t),t[0].label&&(t=t.flatMap(function(t){return t.children})),t.forEach(function(t){var e=t.name,n=t.src;return Te[e]=n})},initMenus:function(t){var e=this,n=this.$createElement,i=[{name:be,title:"聊天",unread:0,click:null,render:function(t){return n("i",{class:"lemon-icon-message"})},isBottom:!1},{name:xe,title:"通讯录",unread:0,click:null,render:function(t){return n("i",{class:"lemon-icon-addressbook"})},isBottom:!1}],a=[];if(Array.isArray(t)){var r={lastMessages:0,contacts:1},s=Object.keys(r);a=t.map(function(t){return s.includes(t.name)?Me({},i[r[t.name]],{},t,{},{renderContainer:null}):(t.renderContainer&&e._customContainerReady(t.renderContainer,$e,t.name),t)})}else a=i;this.menus=a},initContacts:function(t){var e;(e=this.contacts).push.apply(e,Object(ve["a"])(t)),this.sortContacts()},sortContacts:function(){this.contacts.sort(function(t,e){if(t.index)return t.index.localeCompare(e.index)})},updateContact:function(t,e){delete e.id,delete e.toContactId;var n=this.findContactIndexById(t);if(-1!==n){var i=e.unread;et(i)&&(0!==i.indexOf("+")&&0!==i.indexOf("-")||(e.unread=parseInt(i)+parseInt(this.contacts[n].unread))),this.$set(this.contacts,n,Me({},this.contacts[n],{},e))}},findContactIndexById:function(t){return this.contacts.findIndex(function(e){return e.id==t})},findMessageIndexById:function(t,e){var n=Pe[e];return it(n)?-1:n.findIndex(function(e){return e.id==t})},findMessageById:function(t,e){var n=this.findMessageIndexById(t,e);if(-1!==n)return Pe[e][n]},getContacts:function(){return this.contacts},getMessages:function(t){return(t?Pe[t]:Pe)||[]},openrenderContainer:function(t){},changeDrawer:function(t){this.drawerVisible=!this.drawerVisible,1==this.drawerVisible&&this.openDrawer(t)},openDrawer:function(t){Ee=t||new Function,this.drawerVisible=!0},closeDrawer:function(){this.drawerVisible=!1}}},Fe=Le,Re=(n("9b01"),Object(k["a"])(Fe,ke,Se,!1,null,null,null)),Ue=Re.exports,Be=(n("6a2b"),"0.1"),Ae=[Ue,Ot,Ft,Pt,X,G,q,N,T,At,Yt,ne,de,ge],Ne=function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];Ae.forEach(function(e){t.component(e.name,e)})};"undefined"!==typeof window&&window.Vue&&Ne(window.Vue);var Ve={version:Be,install:Ne};i["a"].use(Ve),i["a"].config.productionTip=!1,new i["a"]({render:function(t){return t(I)}}).$mount("#app")},cfab:function(t,e,n){"use strict";var i=n("15cf"),a=n.n(i);a.a},dbdc:function(t,e,n){"use strict";var i=n("7802"),a=n.n(i);a.a},e86c:function(t,e,n){},ed4b:function(t,e,n){"use strict";var i=n("a215"),a=n.n(i);a.a},fbd1:function(t,e,n){"use strict";var i=n("820e"),a=n.n(i);a.a}});