moodle/message/amd/build/message_drawer_view_conversation.min.js

3 lines
19 KiB
JavaScript

function _typeof(e){if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(e){return typeof e}}else{_typeof=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(e)}define ("core_message/message_drawer_view_conversation",["jquery","core/auto_rows","core/backoff_timer","core/custom_interaction_events","core/notification","core/pubsub","core/str","core_message/message_repository","core_message/message_drawer_events","core_message/message_drawer_view_conversation_constants","core_message/message_drawer_view_conversation_patcher","core_message/message_drawer_view_conversation_renderer","core_message/message_drawer_view_conversation_state_manager","core_message/message_drawer_router","core_message/message_drawer_routes","core/emoji/picker"],function(s,e,t,n,a,d,i,r,o,g,l,m,c,E,I,C){var _={},u=null,T=!1,A=0,f=null,h=!1,O=[],M=!0,N=!1,p=[],v=null,S=[],b=g.NEWEST_MESSAGES_FIRST,U=g.LOAD_MESSAGE_LIMIT,R=g.MILLISECONDS_IN_SEC,L=g.SELECTORS,D=g.CONVERSATION_TYPES,y=function(){if(!u||u.type==D.PUBLIC){return null}var e=u.loggedInUserId;if(u.type==D.SELF){return e}var s=Object.keys(u.members).filter(function(s){return e!=s});return s.length?s[0]:null},P=function(e){return Object.keys(_).reduce(function(s,t){if(!s){var n=_[t].state;if(n.type!=D.PUBLIC){if(e in n.members){s=n.id}}}return s},null)},B=function(e){return{id:parseInt(e.attr("data-user-id"),10),fullname:null,profileimageurl:null,profileimageurlsmall:null,isonline:null,showonlinestatus:null,isblocked:null,iscontact:null,isdeleted:null,canmessage:null,canmessageevenifblocked:null,requirescontact:null,contactrequests:[]}},F=function(){return A},k=function(e){A=e;_[u.id].messagesOffset=e},V=function(){return T},w=function(e){T=e;_[u.id].loadedAllMessages=e},x=function(e){return e.find(L.MESSAGES_CONTAINER)},G=function(e){return{id:e.id,name:e.name,subname:e.subname,imageUrl:e.imageUrl,isFavourite:e.isFavourite,isMuted:e.isMuted,type:e.type,totalMemberCount:e.totalMemberCount,loggedInUserId:e.loggedInUserId,messages:e.messages.map(function(e){return s.extend({},e)}),members:Object.keys(e.members).map(function(t){var n=s.extend({},e.members[t]);n.contactrequests=e.members[t].contactrequests.map(function(e){return s.extend({},e)});return n})}},q=function(e,s){var t=e.id,n=t==s?D.SELF:D.PRIVATE,d=c.setLoadingMembers(u,!0);d=c.setLoadingMessages(d,!0);v(d);return r.getMemberInfo(t,[s],!0,!0).then(function(e){if(e.length){return e[0]}else{throw new Error("Unable to load other user profile")}}).then(function(s){var t=n==D.SELF?[s]:[s,e],a=c.addMembers(u,t);a=c.setLoadingMembers(a,!1);a=c.setLoadingMessages(a,!1);a=c.setName(a,s.fullname);a=c.setType(a,n);a=c.setImageUrl(a,s.profileimageurl);a=c.setTotalMemberCount(a,t.length);v(a);return s}).catch(function(e){var s=c.setLoadingMembers(u,!1);v(s);a.exception(e)})},Q=function(e,s){var t=null;if(e.type==D.PRIVATE){var n=e.members.filter(function(e){return e.id!=s});t=n.length?n[0]:null}else if(e.type==D.SELF){t=e.members[0]}var a=e.name,d=e.imageurl;if(e.type!=D.PUBLIC){a=a||t?t.fullname:"";d=d||t?t.profileimageurl:""}var i=c.addMembers(u,e.members);i=c.setName(i,a);i=c.setSubname(i,e.subname);i=c.setType(i,e.type);i=c.setImageUrl(i,d);i=c.setTotalMemberCount(i,e.membercount);i=c.setIsFavourite(i,e.isfavourite);i=c.setIsMuted(i,e.ismuted);i=c.addMessages(i,e.messages);i=c.setCanDeleteMessagesForAllUsers(i,e.candeletemessagesforallusers);return i},K=function(e,s,t,n,d){var i=s.id,o=c.setLoadingMembers(u,!0);o=c.setLoadingMessages(o,!0);v(o);return r.getConversation(i,e,!0,!0,0,0,t+1,n,d).then(function(e){if(e.messages.length>t){e.messages=e.messages.slice(1)}else{w(!0)}k(n+t);return e}).then(function(e){var t=e.members.filter(function(e){return e.id==s.id});if(1>t.length){e.members=e.members.concat([s])}var n=Q(e,s.id);n=c.setLoadingMembers(n,!1);n=c.setLoadingMessages(n,!1);return v(n).then(function(){return e})}).then(function(){return X(e)}).catch(function(e){var s=c.setLoadingMembers(u,!1);s=c.setLoadingMessages(s,!1);v(s);a.exception(e)})},j=function(e,s,t,n){var d=e.members.filter(function(e){return e.id==s.id});if(1>d.length){e.members=e.members.concat([s])}var i=e.messages.length,r=i>=t,o=Q(e,s.id);o=c.setLoadingMembers(o,!1);o=c.setLoadingMessages(o,!r);var g=v(o);return g.then(function(){if(!r){return W(e.id,t,i,n,[])}else{return{messages:e.messages}}}).then(function(){var e=u.messages;k(e.length);X(u.id);return e}).catch(a.exception)},W=function(e,s,t,n,a,d){return r.getMessages(u.loggedInUserId,e,s?s+1:s,t,n,d).then(function(e){if(e.messages.length&&a.length){e.messages=e.messages.filter(function(e){return 0>a.indexOf(parseInt(e.id,10))})}return e}).then(function(e){if(!s){return e}else if(e.messages.length>s){e.messages=e.messages.slice(0,-1)}else{w(!0)}return e}).then(function(e){var s=e.members.filter(function(e){return!(e.id in u.members)}),t=c.addMembers(u,s);t=c.addMessages(t,e.messages);t=c.setLoadingMessages(t,!1);return v(t).then(function(){return e})}).catch(function(e){var s=c.setLoadingMessages(u,!1);v(s);throw e})},J=function(e,t){return function(){var n=u.messages,a=n.length?n[n.length-1]:null,r=a?a.timeCreated:null;if(r&&!M&&!N){for(var g=[],l=n.length-1,m;0<=l;l--){m=n[l];if(m.timeCreated===r){g.push(m.id)}else{break}}return W(e,0,0,t,g,r).then(function(s){if(s.messages.length){f.restart();var t=G(u);d.publish(o.CONVERSATION_NEW_LAST_MESSAGE,t);return X(e)}else{return s}})}return s.Deferred().resolve().promise()}},X=function(e){var s=u.loggedInUserId;return r.markAllConversationMessagesAsRead(s,e).then(function(){var s=c.markMessagesAsRead(u,u.messages);d.publish(o.CONVERSATION_READ,e);return v(s)})},Y=function(e){me(e);var s=c.addPendingBlockUsersById(u,[e]);v(s)},H=function(e){var s=c.setLoadingConfirmAction(u,!0);v(s);return r.blockUser(u.loggedInUserId,e).then(function(s){var t=c.addMembers(u,[s]);t=c.removePendingBlockUsersById(t,[e]);t=c.setLoadingConfirmAction(t,!1);d.publish(o.CONTACT_BLOCKED,e);return v(t)})},z=function(e){me(e);var s=c.addPendingUnblockUsersById(u,[e]);v(s)},Z=function(e){var s=c.setLoadingConfirmAction(u,!0);v(s);return r.unblockUser(u.loggedInUserId,e).then(function(s){var t=c.addMembers(u,[s]);t=c.removePendingUnblockUsersById(t,[e]);t=c.setLoadingConfirmAction(t,!1);d.publish(o.CONTACT_UNBLOCKED,e);return v(t)})},$=function(e){me(e);var s=c.addPendingRemoveContactsById(u,[e]);v(s)},ee=function(e){var s=c.setLoadingConfirmAction(u,!0);v(s);return r.deleteContacts(u.loggedInUserId,[e]).then(function(s){var t=c.addMembers(u,s);t=c.removePendingRemoveContactsById(t,[e]);t=c.setLoadingConfirmAction(t,!1);d.publish(o.CONTACT_REMOVED,e);return v(t)})},se=function(e){me(e);var s=c.addPendingAddContactsById(u,[e]);v(s)},te=function(e){var s=c.setLoadingConfirmAction(u,!0);v(s);return r.createContactRequest(u.loggedInUserId,e).then(function(e){if(!e.request){throw new Error(e.warnings[0].message)}return e.request}).then(function(s){var t=c.removePendingAddContactsById(u,[e]);t=c.addContactRequests(t,[s]);t=c.setLoadingConfirmAction(t,!1);return v(t)})},ne=function(){var e=u.loggedInUserId,s=u.id;return r.setFavouriteConversations(e,[s]).then(function(){var e=c.setIsFavourite(u,!0);return v(e)}).then(function(){return d.publish(o.CONVERSATION_SET_FAVOURITE,G(u))})},ae=function(){var e=u.loggedInUserId,s=u.id;return r.unsetFavouriteConversations(e,[s]).then(function(){var e=c.setIsFavourite(u,!1);return v(e)}).then(function(){return d.publish(o.CONVERSATION_UNSET_FAVOURITE,G(u))})},de=function(){var e=u.loggedInUserId,s=u.id;return r.setMutedConversations(e,[s]).then(function(){var e=c.setIsMuted(u,!0);return v(e)}).then(function(){return d.publish(o.CONVERSATION_SET_MUTED,G(u))})},ie=function(){var e=u.loggedInUserId,s=u.id;return r.unsetMutedConversations(e,[s]).then(function(){var e=c.setIsMuted(u,!1);return v(e)}).then(function(){return d.publish(o.CONVERSATION_UNSET_MUTED,G(u))})},re=function(e){var s=u.selectedMessageIds;me(e);var t=c.addPendingDeleteMessagesById(u,s);v(t)},oe=function(){var e=u.pendingDeleteMessageIds,t=u.messages.filter(function(s){return 0<=e.indexOf(s.id)&&("sent"==s.sendState||null===s.sendState)}),n=c.setLoadingConfirmAction(u,!0);v(n);var i=s.Deferred().resolve().promise();if(t.length){var g=t.map(function(e){return e.id});if(n.deleteMessagesForAllUsers){i=r.deleteMessagesForAllUsers(u.loggedInUserId,g)}else{i=r.deleteMessages(u.loggedInUserId,g)}}return i.then(function(){var s=c.removeMessagesById(u,e);s=c.removePendingDeleteMessagesById(s,e);s=c.removeSelectedMessagesById(s,e);s=c.setLoadingConfirmAction(s,!1);s=c.setDeleteMessagesForAllUsers(s,!1);var t=u.messages[u.messages.length-1],n=s.messages.length?s.messages[s.messages.length-1]:null;if(n&&n.id!=t.id){var a=G(s);d.publish(o.CONVERSATION_NEW_LAST_MESSAGE,a)}else if(!s.messages.length){d.publish(o.CONVERSATION_DELETED,s.id)}return v(s)}).catch(a.exception)},ge=function(e){me(e);var s=c.setPendingDeleteConversation(u,!0);v(s)},le=function(){var e=c.setLoadingConfirmAction(u,!0);v(e);return r.deleteConversation(u.loggedInUserId,u.id).then(function(){var e=c.removeMessages(u,u.messages);e=c.removeSelectedMessagesById(e,u.selectedMessageIds);e=c.setPendingDeleteConversation(e,!1);e=c.setLoadingConfirmAction(e,!1);d.publish(o.CONVERSATION_DELETED,e.id);return v(e)})},me=function(e){var s=u.pendingDeleteMessageIds,t=c.removePendingAddContactsById(u,[e]);t=c.removePendingRemoveContactsById(t,[e]);t=c.removePendingUnblockUsersById(t,[e]);t=c.removePendingBlockUsersById(t,[e]);t=c.removePendingDeleteMessagesById(t,s);t=c.setPendingDeleteConversation(t,!1);t=c.setDeleteMessagesForAllUsers(t,!1);v(t)},ce=function(e){var s=u.loggedInUserId,t=u.members[e].contactrequests.filter(function(e){return e.requesteduserid==s}),n=t[0],a=c.setLoadingConfirmAction(u,!0);v(a);return r.acceptContactRequest(e,s).then(function(e){var s=c.removeContactRequests(u,[n]);s=c.addMembers(u,[e]);s=c.setLoadingConfirmAction(s,!1);return v(s)}).then(function(){d.publish(o.CONTACT_ADDED,u.members[e]);d.publish(o.CONTACT_REQUEST_ACCEPTED,n)})},Ee=function(e){var s=u.loggedInUserId,t=u.members[e].contactrequests.filter(function(e){return e.requesteduserid==s}),n=t[0],a=c.setLoadingConfirmAction(u,!0);v(a);return r.declineContactRequest(e,s).then(function(e){var s=c.removeContactRequests(u,[n]);s=c.addMembers(u,[e]);s=c.setLoadingConfirmAction(s,!1);return v(s)}).then(function(){d.publish(o.CONTACT_REQUEST_DECLINED,n)})},Ie=function(){if(N){return}if(!p.length){return}N=!0;var e=p.slice();p=[];var t=u.id,n=null,a=e.map(function(e){return e.text}),g=e.map(function(e){return e.id}),l=null,m=null;if(!t&&u.type!=D.PUBLIC){var E=y();l=r.sendMessagesToUser(E,a).then(function(e){if(e.length){n=parseInt(e[0].conversationid,10);m=e[0].candeletemessagesforallusers}return e})}else{l=r.sendMessagesToConversation(t,a)}l.then(function(s){var t=s.map(function(e){return e.id}),a=[],i=[],r=[];e.forEach(function(e,t){var n=s[t];a.push([e,n]);if(0<=u.selectedMessageIds.indexOf(e.id)){i.push(e.id);r.push(n.id)}});var g=c.updateMessages(u,a);g=c.setMessagesSendSuccessById(g,t);if(i.length){g=c.removeSelectedMessagesById(g,i)}if(r.length){g=c.addSelectedMessagesById(g,r)}var l=G(g);if(!g.id){g=c.setId(g,n);l.id=n;Fe(n);d.publish(o.CONVERSATION_CREATED,l);g=c.setCanDeleteMessagesForAllUsers(g,m)}v(g);N=!1;Ie();d.publish(o.CONVERSATION_NEW_LAST_MESSAGE,l)}).catch(function(t){if(t.message){var e=s.Deferred().resolve(t.message).promise()}else{var e=i.get_string("unknownerror","core")}var n=function(e){var s=c.setMessagesSendFailById(u,g,e);v(s);N=!1;Ie()};e.then(n).catch(function(s){var e=s.message||"Something went wrong!";n(e)})})},Ce=function(e){var s="temp"+Date.now(),t={id:s,useridfrom:u.loggedInUserId,text:e,timecreated:null},n=c.addMessages(u,[t]);v(n);p.push(t);Ie()},_e=function(e){var s=c.setMessagesSendPendingById(u,[e.id]);v(s);p.push(e);Ie()},ue=function(e){var s=u;if(-1<u.selectedMessageIds.indexOf(e)){s=c.removeSelectedMessagesById(u,[e])}else{s=c.addSelectedMessagesById(u,[e])}v(s)},Te=function(){me(y());var e=c.removeSelectedMessagesById(u,u.selectedMessageIds);v(e)},Ae=function(e,t,n){if(h){return}if(!O.length){return}h=!0;var d=O.shift(),i=S.map(function(e){return e(d.patch)});s.when.apply(null,i).then(function(){h=!1;d.deferred.resolve(!0);Ae(e,t,n)}).catch(function(e){h=!1;d.deferred.reject(e);a.exception(e)})},fe=function(e,t,n,a){var d=function(s){return m.render(e,t,n,s)};if(!a){var i=c.buildInitialState(u.midnight,u.loggedInUserId,u.id),r=l.buildPatch(i,u);d(r)}S.push(d);return function(a){var d=l.buildPatch(u,a),i=s.Deferred();if(Object.keys(d).length){O.push({patch:d,deferred:i})}else{i.resolve(!0)}u=a;if(a.id){_[a.id]={state:a,messagesOffset:F(),loadedAllMessages:V()}}Ae(e,t,n);return i.promise()}},he=function(e){return function(s,t){if(!u.loadingConfirmAction){e(y());var n=c.setLoadingConfirmAction(u,!1);v(n)}t.originalEvent.preventDefault()}},Oe=function(t,e){var n=s(t.target),a=n.closest(L.FOOTER_CONTAINER),d=a.find(L.MESSAGE_TEXT_AREA),i=d.val().trim();if(""!==i){Ce(i);d.val("");d.focus()}e.originalEvent.preventDefault()},Me=function(t,e){var n=window.getSelection(),a=s(t.target);if(""!=n.toString()){return}if(a.is("a")){return}var d=a.closest(L.MESSAGE),i=d.attr("data-message-id");ue(i);e.originalEvent.preventDefault()},Ne=function(t,e){var n=s(t.target),a=n.closest(L.MESSAGE),d=a.attr("data-message-id"),i=u.messages.filter(function(e){return e.id==d}),r=i.length?i[0]:null;if(r){_e(r)}e.originalEvent.preventDefault();e.originalEvent.stopPropagation();t.stopPropagation()},pe=function(s,e){Te();e.originalEvent.preventDefault()},ve=function(s){return function(t,e){var n=y(),a=u.members[n];E.go(s,I.VIEW_CONTACT,a);e.originalEvent.preventDefault()}},Se=function(s,e){ne().catch(a.exception);e.originalEvent.preventDefault()},be=function(s,e){ae().catch(a.exception);e.originalEvent.preventDefault()},Ue=function(s,e){de().catch(a.exception);e.originalEvent.preventDefault()},Re=function(s,e){ie().catch(a.exception);e.originalEvent.preventDefault()},Le=function(t){var e=s(t.target).prop("checked"),n=c.setDeleteMessagesForAllUsers(u,e);v(n)},De=function(s){return function(t,e){E.go(s,I.VIEW_GROUP_INFO,{id:u.id,name:u.name,subname:u.subname,imageUrl:u.imageUrl,totalMemberCount:u.totalMemberCount},u.loggedInUserId);e.originalEvent.preventDefault()}},ye=function(s,e){var t=c.setShowEmojiPicker(u,!u.showEmojiPicker);v(t);e.originalEvent.preventDefault()},Pe=function(t){var e=s(t.target);if(u.showEmojiPicker&&!e.closest(L.EMOJI_PICKER_CONTAINER).length&&!e.closest(L.TOGGLE_EMOJI_PICKER_BUTTON).length){var n=c.setShowEmojiPicker(u,!1);v(n)}},Be=function(t,i,r,g){var l=!1,m=x(r),E=g.find(L.EMOJI_PICKER),_=g.find(L.MESSAGE_TEXT_AREA),T=[[L.ACTION_REQUEST_BLOCK,he(Y)],[L.ACTION_REQUEST_UNBLOCK,he(z)],[L.ACTION_REQUEST_ADD_CONTACT,he(se)],[L.ACTION_REQUEST_REMOVE_CONTACT,he($)],[L.ACTION_REQUEST_DELETE_CONVERSATION,he(ge)],[L.ACTION_CANCEL_EDIT_MODE,pe],[L.ACTION_VIEW_CONTACT,ve(t)],[L.ACTION_VIEW_GROUP_INFO,De(t)],[L.ACTION_CONFIRM_FAVOURITE,Se],[L.ACTION_CONFIRM_MUTE,Ue],[L.ACTION_CONFIRM_UNFAVOURITE,be],[L.ACTION_CONFIRM_UNMUTE,Re]],A=[[L.ACTION_CANCEL_CONFIRM,he(me)],[L.ACTION_CONFIRM_BLOCK,he(H)],[L.ACTION_CONFIRM_UNBLOCK,he(Z)],[L.ACTION_CONFIRM_ADD_CONTACT,he(te)],[L.ACTION_CONFIRM_REMOVE_CONTACT,he(ee)],[L.ACTION_CONFIRM_DELETE_SELECTED_MESSAGES,he(oe)],[L.ACTION_CONFIRM_DELETE_CONVERSATION,he(le)],[L.ACTION_OKAY_CONFIRM,he(me)],[L.ACTION_REQUEST_ADD_CONTACT,he(se)],[L.ACTION_ACCEPT_CONTACT_REQUEST,he(ce)],[L.ACTION_DECLINE_CONTACT_REQUEST,he(Ee)],[L.MESSAGE,Me],[L.DELETE_MESSAGES_FOR_ALL_USERS_TOGGLE,Le],[L.RETRY_SEND,Ne]],h=[[L.SEND_MESSAGE_BUTTON,Oe],[L.TOGGLE_EMOJI_PICKER_BUTTON,ye],[L.ACTION_REQUEST_DELETE_SELECTED_MESSAGES,he(re)],[L.ACTION_REQUEST_ADD_CONTACT,he(se)],[L.ACTION_REQUEST_UNBLOCK,he(z)]];e.init(g);C(E[0],function(e){var s=c.setShowEmojiPicker(u,!u.showEmojiPicker);v(s);_.focus();var t=_.prop("selectionStart"),n=_.val(),a=n.substring(0,t),d=n.substring(t,n.length);_.val(a+e+d);_.prop("selectionStart",t+e.length);_.prop("selectionEnd",t+e.length)});n.define(i,[n.events.activate]);n.define(r,[n.events.activate]);n.define(g,[n.events.activate,n.events.enter,n.events.escape]);n.define(m,[n.events.scrollTop,n.events.scrollLock]);m.on(n.events.scrollTop,function(s,e){var t=1<Object.keys(u.members).length;if(!M&&!l&&!V()&&t){l=!0;var n=c.setLoadingMessages(u,!0);v(n);W(u.id,U,F(),b,[]).then(function(){l=!1;k(F()+U)}).catch(function(e){l=!1;a.exception(e)})}e.originalEvent.preventDefault()});T.forEach(function(e){var s=e[0],t=e[1];i.on(n.events.activate,s,t)});A.forEach(function(e){var s=e[0],t=e[1];r.on(n.events.activate,s,t)});h.forEach(function(e){var s=e[0],t=e[1];g.on(n.events.activate,s,t)});g.on(n.events.enter,L.MESSAGE_TEXT_AREA,function(s,e){var t=g.attr("data-enter-to-send");if(t&&"false"!=t&&"0"!=t){Oe(s,e)}});g.on(n.events.escape,L.EMOJI_PICKER_CONTAINER,ye);s(document.body).on("click",Pe);d.subscribe(o.ROUTE_CHANGED,function(e){if(f){if(e.route!=I.VIEW_CONVERSATION){f.stop()}}})},Fe=function(e){if(f){f.stop()}f=new t(J(e,b),t.getIncrementalCallback(u.messagePollMin*R,R,u.messagePollMax*R,u.messagePollAfterMax*R));f.start()},ke=function(e,s,t){T=!1;A=0;f=null;h=!1;O=[];M=!0;N=!1;p=[];var n=t.id,a=parseInt(e.attr("data-midnight"),10),d=parseInt(e.attr("data-message-poll-min"),10),i=parseInt(e.attr("data-message-poll-max"),10),r=parseInt(e.attr("data-message-poll-after-max"),10),o=c.buildInitialState(a,n,s,d,i,r);if(!u){u=o}if(f){f.stop()}v(o)},Ve=function(e,s,t){ke(e,null,s);var n=null;if(s.id!=t){n=r.getConversationBetweenUsers(s.id,t,!0,!0,0,0,U,0,b)}else{n=r.getSelfConversation(s.id,U,0,b)}return n.then(function(t){return xe(e,t,s)}).catch(function(){return q(s,t)})},we=function(e,t,n){var a=null;if(t in _){a=_[t]}ke(e,t,n);var d=s.Deferred().resolve({}).promise();if(a){var i=a.state;i=c.setLoadingMessages(i,!1);i=c.setLoadingMembers(i,!1);k(a.messagesOffset);w(a.loadedAllMessages);v(i)}else{d=K(t,n,U,0,b)}return d.then(function(){return Fe(t)})},xe=function(e,t,n){var a=null;if(t.id in _){a=_[t.id]}ke(e,t.id,n);var d=s.Deferred().resolve({}).promise();if(a){var i=a.state;i=c.setLoadingMessages(i,!1);i=c.setLoadingMembers(i,!1);k(a.messagesOffset);w(a.loadedAllMessages);v(i)}else{d=j(t,n,U,b)}return d.then(function(){return Fe(t.id)})},Ge=function(e,t,n,d,i,r,o){var l=null,m=null;if(i&&null!==i&&"object"==_typeof(i)){l=i;m=parseInt(l.id,10)}else{l=null;m=parseInt(i,10);m=isNaN(m)?null:m}if(!m&&r&&o){m=P(o)}var c=!u||u.id!=m||o&&o!=y();if(!n.attr("data-init")){v=fe(t,n,d,c);Be(e,t,n,d);n.attr("data-init",!0)}if(c){var E=null,I=B(n);if(l){E=xe(n,l,I,o)}else if(m){E=we(n,m,I,o)}else{E=Ve(n,I,o)}return E.then(function(){M=!1;t.find(g.SELECTORS.CAN_RECEIVE_FOCUS).first().focus()}).catch(function(e){M=!1;a.exception(e)})}Fe(m);if(u.type==D.PRIVATE&&r){var C=y();switch(r){case"block":return Y(C);case"unblock":return z(C);case"add-contact":return se(C);case"remove-contact":return $(C);}}return s.Deferred().resolve().promise()},qe=function(){return i.get_string("messagedrawerviewconversation","core_message",u.name)};return{show:Ge,description:qe}});
//# sourceMappingURL=message_drawer_view_conversation.min.js.map