slack.min.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. "use strict";(function(){
  2. var p;function r(a){this.id=a;this.version=0}r.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);this.version=Math.max(this.version,b)};function aa(a){this.a=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.P=a.category}function ba(){this.a={};this.C=[]}
  3. ba.prototype.update=function(a,b){this.a=JSON.parse(a.emoji_use);a.highlight_words?this.C=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.C=a.highlights);this.version=Math.max(this.version,b)};function ca(){this.s=null;this.m={};this.a={};this.b=null;this.l={version:0,data:{}};this.j={version:0,data:{}};this.f={};this.A=0}"undefined"!==typeof module&&(module.K.Ia=ca,module.K.Ja=r,module.K.La=aa);function t(a){this.id=a;this.G=!1;this.a=this.b=0;this.j={};this.version=0}
  4. t.prototype.update=function(a,b,c){void 0!==a.name&&(this.name=a.name);void 0!==a.is_archived&&(this.l=a.is_archived);void 0!==a.is_member&&(this.A=a.is_member);void 0!==a.last_read&&(this.b=Math.max(parseFloat(a.last_read),this.b));void 0!==a.last_msg&&(this.a=parseFloat(a.last_msg));void 0!==a.is_private&&(this.s=a.is_private);a.latest&&(this.a=parseFloat(a.latest.ts));void 0!==a.is_starred&&(this.G=a.is_starred);if(a.members&&(this.j={},a.members))for(var d=0,e=a.members.length;d<e;d++){var f=
  5. b.a[a.members[d]];this.j[f.id]=f;f.m[this.id]=this}this.version=Math.max(this.version,c)};function v(a,b){t.call(this,a);this.f=b;this.name=this.f.name;this.s=!0;b.l=this}v.prototype=Object.create(t.prototype);v.prototype.constructor=v;"undefined"!==typeof module&&(module.K.Qa=t,module.K.Pa=v);function y(a,b){this.F=a.user;this.username=a.username;this.id=a.id||a.ts;this.o=parseFloat(a.ts);this.text="";this.u=[];this.f=this.R=this.G=!1;this.B={};this.version=b;this.update(a,b)}function z(a,b){y.call(this,a,b)}function A(a,b){y.call(this,a,b)}
  6. y.prototype.update=function(a,b){if(a){if(this.text=a.text||"",a.attachments&&(this.u=a.attachments),this.G=!!a.is_starred,this.R=!!a.edited,this.f=!!a.removed,a.reactions){var c={};a.reactions.forEach(function(a){c[a.name]=[];a.users.forEach(function(b){c[a.name].push(b)})});this.B=c}}else this.f=!0;this.version=b};function C(a,b,c,d){this.id="string"===typeof a?a:a.id;this.a=[];this.f=b;c&&da(this,c,d)}
  7. function da(a,b,c){var d=0;b.forEach(function(a){d=Math.max(this.push(a,c),d)}.bind(a));ea(a)}C.prototype.b=function(a,b){return!0===a.isMeMessage?new z(a,b):!0===a.isNotice?new A(a,b):new y(a,b)};C.prototype.push=function(a,b){for(var c,d=!1,e,f=0,k=this.a.length;f<k;f++)if(c=this.a[f],c.id===a.id){e=c.update(a,b);d=!0;break}d||(c=this.b(a,b),this.a.push(c),e=c.o);for(;this.a.length>this.f;)this.a.shift();return e||0};
  8. function fa(a){for(var b=D.b[G.id],c=0,d=b.a.length;c<d&&a>=b.a[c].o;c++)if(b.a[c].o===a)return b.a[c];return null}function ea(a){a.a.sort(function(a,c){return a.o-c.o})}z.prototype=Object.create(y.prototype);z.prototype.constructor=z;A.prototype=Object.create(y.prototype);A.prototype.constructor=A;"undefined"!==typeof module&&(module.K={Na:y,Ma:z,Oa:A,Ra:C});function H(a){this.id=a;this.b={small:"",Fa:""};this.m={};this.l=this.a=null;this.version=0}H.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.j=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.presence&&(this.f="away"!==a.presence);void 0!==a.isPresent&&(this.f=a.isPresent);a.isBot&&(this.A=a.isBot);a.profile&&(this.b.small=a.profile.icon_small,this.b.Fa=a.profile.icon_large);this.version=Math.max(this.version,b)};
  9. "undefined"!==typeof module&&(module.K.Ka=H);var I={},J;function ga(){if(!c){for(var a=0,b=navigator.languages.length;a<b;a++)if(I.hasOwnProperty(navigator.languages[a])){var c=navigator.languages[a];break}c||(c="en")}J=I[c];console.log("Loading language pack: "+c);if(J.c)for(a in J.c)document.getElementById(a).textContent=J.c[a]};I.fr={Ha:"Utilisateur inconnu",Ga:"Channel inconnu",xa:"Nouveau message",wa:"Reseau",R:"(edit&eacute;)",ya:"(visible seulement par vous)",G:"Favoris",m:"Discutions",Aa:"Discutions priv\u00e9es",ok:"Ok",va:"Annuler",ba:function(a){"string"!==typeof a&&(a=parseFloat(a));var b=new Date,c=new Date;a=new Date(1E3*a);b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);c.setTime(b.getTime());c.setDate(c.getDate()-1);return a.getTime()>b.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?
  10. "hier, "+a.toLocaleTimeString():a.toLocaleString()},c:{fileUploadCancel:"Annuler",neterror:"Impossible de se connecter au chat !"}};I.en={Ha:"Unknown member",Ga:"Unknown channel",xa:"New message",wa:"Network",R:"(edited)",ya:"(only visible to you)",G:"Starred",m:"Channels",Aa:"Direct messages",ok:"Ok",va:"Cancel",ba:function(a){"string"!==typeof a&&(a=parseFloat(a));var b=new Date,c=new Date;a=new Date(1E3*a);b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);c.setTime(b.getTime());c.setDate(c.getDate()-1);return a.getTime()>b.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?"yesterday, "+a.toLocaleTimeString():
  11. a.toLocaleString()},c:{fileUploadCancel:"Cancel",neterror:"Cannot connect to chat !"}};var K=function(){function a(a){this.text="";this.h=a}function b(b,c,d){this.N=c;this.g=null;this.i=[];this.a=d||"";this.X="<"===this.a;this.ea="*"===this.a;this.ja="_"===this.a;this.Y="~"===this.a||"-"===this.a;this.f=">"===this.a||"&gt;"===this.a;this.l=":"===this.a;this.fa="`"===this.a;this.ta="```"===this.a;this.ga="\n"===this.a;this.ia=void 0!==d&&-1!==m.C.indexOf(d);this.h=b;this.Z=null;this.b=this.ga||this.ia?c+d.length-1:!1;this.ia&&(this.g=new a(this),this.i.push(this.g),this.g.text=d)}function c(a){return"A"<=
  12. a&&"Z">=a||"a"<=a&&"z">=a||"0"<=a&&"9">=a||-1!=="\u00e0\u00e8\u00ec\u00f2\u00f9\u00c0\u00c8\u00cc\u00d2\u00d9\u00e1\u00e9\u00ed\u00f3\u00fa\u00fd\u00c1\u00c9\u00cd\u00d3\u00da\u00dd\u00e2\u00ea\u00ee\u00f4\u00fb\u00c2\u00ca\u00ce\u00d4\u00db\u00e3\u00f1\u00f5\u00c3\u00d1\u00d5\u00e4\u00eb\u00ef\u00f6\u00fc\u00ff\u00c4\u00cb\u00cf\u00d6\u00dc\u0178\u00e7\u00c7\u00df\u00d8\u00f8\u00c5\u00e5\u00c6\u00e6\u0153".indexOf(a)}function d(a){a=a||g;for(var c=0,l=a.i.length;c<l;c++){var e=a.i[c];if(e instanceof
  13. b)if(e.b){if(e=d(e))return e}else return e}return null}function e(a,c){a.h instanceof b&&(a.h.i.splice(a.h.i.indexOf(a)+(c?1:0)),a.h.g=a.h.i[a.h.i.length-1],e(a.h,!0))}function f(a){return a}function k(a){return{link:a,text:a,Ea:!1}}var h,g,m={C:[],S:f,W:f,U:k};b.prototype.la=function(){return this.ea&&!!this.b||this.h instanceof b&&this.h.la()};b.prototype.oa=function(){return this.ja&&!!this.b||this.h instanceof b&&this.h.oa()};b.prototype.pa=function(){return this.Y&&!!this.b||this.h instanceof
  14. b&&this.h.pa()};b.prototype.ca=function(){return this.l&&!!this.b||this.h instanceof b&&this.h.ca()};b.prototype.na=function(){return this.ia&&!!this.b||this.h instanceof b&&this.h.na()};b.prototype.ma=function(){return this.fa&&!!this.b||this.h instanceof b&&this.h.ma()};b.prototype.A=function(){return this.ta&&!!this.b||this.h instanceof b&&this.h.A()};b.prototype.qa=function(){for(var a=0,c=this.i.length;a<c;a++)if(this.i[a]instanceof b&&(!this.i[a].b||this.i[a].qa()))return!0;return!1};b.prototype.ra=
  15. function(a){if("<"===this.a&&">"===h[a])return!0;var b=c(h[a-1]);if(!this.f&&h.substr(a,this.a.length)===this.a){if(!b&&(this.ea||this.ja||this.Y))return!1;if(this.g&&this.qa())return this.g.ua();if(this.Ba())return!0}return"\n"===h[a]&&this.f?!0:!1};b.prototype.Ba=function(){for(var a=this;a;){for(var c=0,d=a.i.length;c<d;c++)if(a.i[c]instanceof b||a.i[c].text.length)return!0;a=a.Z}return!1};b.prototype.ua=function(){var a=new b(this.h,this.N,this.a);a.Z=this;this.g&&this.g instanceof b&&(a.g=this.g.ua(),
  16. a.i=[a.g]);return a};b.prototype.Ca=function(a){return this.l&&(" "===h[a]||"\t"===h[a])||(this.l||this.X||this.ea||this.ja||this.Y||this.fa)&&"\n"===h[a]?!1:!0};b.prototype.Da=function(b){if(this.fa||this.l||this.ta||this.X)return null;if(!this.g||this.g.b||this.g instanceof a){var d=c(h[b+1]);if("```"===h.substr(b,3))return"```";var e=g.da();if(void 0===e||e){if("&gt;"===h.substr(b,4))return"&gt;";if(">"===h[b])return h[b]}if(-1!==["`","\n"].indexOf(h[b])||-1!==["*","~","-","_"].indexOf(h[b])&&
  17. (d||-1!=="*~-_<&".split("").indexOf(h[b+1]))||-1!==[":"].indexOf(h[b])&&d||-1!==["<"].indexOf(h[b]))return h[b];d=0;for(e=m.C.length;d<e;d++){var k=m.C[d];if(h.substr(b,k.length)===k)return k}}return null};a.prototype.da=function(){if(""!==this.text.trim())return!1};b.prototype.da=function(){for(var a=this.i.length-1;0<=a;a--){var b=this.i[a].da();if(void 0!==b)return b}if(this.ga||this.f)return!0};a.prototype.j=function(a){this.text+=h[a];return 1};b.prototype.j=function(c){var d=this.g&&!this.g.b&&
  18. this.g.ra?this.g.ra(c):null;if(d){var e=this.g.a.length;this.g.ka(c);d instanceof b&&(this.g=d,this.i.push(d));return e}if(!this.g||this.g.b||this.g instanceof a||this.g.Ca(c)){if(d=this.Da(c))return this.g=new b(this,c,d),this.i.push(this.g),this.g.a.length;if(!this.g||this.g.b)this.g=new a(this),this.i.push(this.g);return this.g.j(c)}d=this.g.N+1;g.s(this.g.N);this.g=new a(this);this.g.j(d-1);this.i.pop();this.i.push(this.g);return d-c};b.prototype.ka=function(a){for(var b=this;b;)b.b=a,b=b.Z};
  19. b.prototype.s=function(a){this.b&&this.b>=a&&(this.b=!1);this.i.forEach(function(c){c instanceof b&&c.s(a)})};a.prototype.innerHTML=function(){if(this.h.ca()){for(var a=this.h;a&&!a.l;)a=a.h;return a?m.S(a.a+this.text+a.a):m.S(this.text)}return this.h.A()?this.text.replace(/\n/g,"<br/>"):m.W(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.h.A()){b.push("codeblock");var d=this.innerHTML()}else this.h.ma()?(b.push("code"),d=this.innerHTML()):(this.h.X?(d=m.U(this.text),a=
  20. "a",c=' href="'+d.link+'"',d.Ta&&(c+=' target="_blank"'),d=m.W(d.text)):d=this.innerHTML(),this.h.la()&&b.push("bold"),this.h.oa()&&b.push("italic"),this.h.pa()&&b.push("strike"),this.h.ca()&&b.push("emoji"),this.h.na()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+">"};b.prototype.outerHTML=function(){var a="";this.f&&(a+='<span class="quote">');this.ga&&(a+="<br/>");this.i.forEach(function(b){a+=b.outerHTML()});this.f&&(a+="</span>");return a};b.prototype.sa=
  21. function(a){this.f&&!this.b&&this.ka(a);this.i.forEach(function(c){c instanceof b&&c.sa(a)})};return function(c,n){n||(n={});m.C=n.C||[];m.S=n.S||f;m.W=n.W||f;m.U=n.U||k;h=c;g=new b(this,0);n=0;c=h.length;do{for(;n<c;)n+=g.j(n);g.sa(h.length);if(n=d()){e(n,!1);g.s(n.N);var l=new a(n.h);l.j(n.N);n.h.i.push(l);n.h.g=l;n=n.N+1}else n=void 0}while(void 0!==n);return g.outerHTML()}}();window._formatText=function(a,b){return K(a,{C:b?b.highlights:void 0})};"undefined"!==typeof module&&(module.K.w=K);function ha(a,b){this.f=a;this.content=b;this.c=ia(this);this.b=ja(this);this.a=[];this.j=[]}
  22. function ia(a){var b=document.createElement("div"),c=document.createElement("header"),d=document.createElement("span"),e=document.createElement("span"),f=document.createElement("div"),k=document.createElement("footer");b.a=document.createElement("span");b.b=document.createElement("span");d.textContent=a.f;"string"==typeof a.content?f.innerHTML=a.content:f.appendChild(a.content);c.className=ka;d.className=ma;e.className=na;e.textContent="x";c.appendChild(d);c.appendChild(e);b.appendChild(c);f.className=
  23. oa;b.appendChild(f);b.b.className=pa;b.b.textContent=J.va;b.b.addEventListener("click",function(){M(a,!1)});e.addEventListener("click",function(){M(a,!1)});b.a.addEventListener("click",function(){M(a,!0)});k.appendChild(b.b);b.a.className=pa;b.a.textContent=J.ok;k.appendChild(b.a);k.className=qa+" "+ra;b.appendChild(k);b.className=sa;return b}function M(a,b){(b?a.a:a.j).forEach(function(a){a()});a.close()}
  24. function ja(a){var b=document.createElement("div");b.className=ta;b.addEventListener("click",function(){M(this,!1)}.bind(a));return b}function ua(a,b,c){a.c.a.textContent=b;a.c.b.textContent=c;return a}ha.prototype.V=function(a){a=a||document.body;a.appendChild(this.b);a.appendChild(this.c);return this};ha.prototype.close=function(){this.c.remove();this.b.remove();return this};function va(a,b){a.a.push(b);return a};var pa="button",qa="button-container",sa="dialog",ta="dialog-overlay",ka="dialog-title",ma="dialog-title-label",na="dialog-title-close",oa="dialog-body",ra="dialog-footer";var wa=[],xa=0;
  25. function ya(){var a=document.createDocumentFragment(),b=Object.keys(D.a.m||{}),c=[],d=[],e=[],f=[];b.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:D.a.m[a].name.localeCompare(D.a.m[b].name)});b.forEach(function(a){a=D.a.m[a];if(!a.l&&!1!==a.A)if(a instanceof v){if(!a.f.j){var b=document.createElement("li");var g=document.createElement("a");b.id="room_"+a.id;g.href="#"+a.id;b.className="slack-context-room slack-ims";g.textContent=a.f.name;b.appendChild(za());b.appendChild(g);a.f.f||b.classList.add("away");
  26. G===a&&b.classList.add("selected");a.a>a.b&&(b.classList.add("unread"),0<=N.indexOf(a)&&b.classList.add("unreadHi"));b&&(a.G?c.push(b):f.push(b))}}else b=document.createElement("li"),g=document.createElement("a"),b.id="room_"+a.id,g.href="#"+a.id,a.s?(b.className="slack-context-room slack-group",b.dataset.count=Object.keys(a.j||{}).length):b.className="slack-context-room slack-channel",G===a&&b.classList.add("selected"),g.textContent=a.name,b.appendChild(za()),b.appendChild(g),a.a>a.b&&(b.classList.add("unread"),
  27. 0<=N.indexOf(a)&&b.classList.add("unreadHi")),b&&(a.G?c.push(b):a.s?e.push(b):d.push(b))});c.length&&a.appendChild(Aa(J.G));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(Aa(J.m));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});f.length&&a.appendChild(Aa(J.Aa));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);Ba();O();Ca(function(a){document.getElementById("slackCtx").style.backgroundImage=
  28. "url("+a+")"})}function Da(){var a=D.a.f,b;for(b in D.a.b.m)if(!D.a.b.m[b].l){var c=document.getElementById("room_"+b);a[b]?c.classList.add("slack-context-typing"):c.classList.remove("slack-context-typing")}for(var d in D.a.a)(b=D.a.a[d].l)&&!b.l&&(c=document.getElementById("room_"+b.id))&&(a[b.id]?c.classList.add("slack-context-typing"):c.classList.remove("slack-context-typing"));Ea()}
  29. function Ea(){var a=D.a.f;document.getElementById("whoistyping").textContent="";if(G&&a[G.id]){var b=document.createDocumentFragment(),c=!1,d;for(d in a[G.id])(a=D.a.a[d])?b.appendChild(Fa(a)):c=!0;c&&(D.f=0);document.getElementById("whoistyping").appendChild(b)}}function Ga(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");O()}
  30. function Ha(){var a=G.name||(G.f?G.f.name:void 0);if(!a){var b=[];G.j.forEach(function(a){b.push(a.name)});a=b.join(", ")}document.getElementById("currentRoomTitle").textContent=a;Ia();P();document.getElementById("fileUploadContainer").classList.add("hidden");Ja();Q&&(Q=null,R());S&&(S=null,R());Ea()}
  31. function R(){if(Q){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){Q=null;R()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(Q.J())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";P()}
  32. function T(){if(S){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){S=null;T()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(S.J());document.getElementById("msgInput").value=S.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";P()}
  33. window.toggleReaction=function(a,b,c){var d=D.b[a];if(d){a:{for(var e=0,f=d.a.length;e<f;e++)if(d.a[e].id==b){d=d.a[e];break a}d=null}d&&(e=D.a.b.id,d.B[c]&&-1!==d.B[c].indexOf(e)?(d=new XMLHttpRequest,d.open("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0),d.send(null)):Ka(a,b,c))}};
  34. function La(a){a:{for(var b=a,c={};!c[b];){if(a=D.a.l.data[b])if("alias:"==a.substr(0,6))c[b]=!0,b=a.substr(6);else{b=document.createElement("span");b.className="emoji-custom emoji";b.style.backgroundImage="url('"+a+"')";a=b;break a}break}a=b}"string"===typeof a&&"makeEmoji"in window&&(a=window.makeEmoji(a));return"string"===typeof a?null:a}function Ma(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
  35. function O(){var a=N.length,b="";if(U)b="!"+J.wa+" - ",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+") - ",Ma(a,a);else{var a=0,c;for(c in D.a.m){var d=D.a.m[c];d.a>d.b&&a++}a&&(b="("+a+") - ");Ma(0,a)}D.a.s&&(b+=D.a.s.name);document.title=b}
  36. function Na(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(xa+3E4<a){var b=new Notification(J.xa);xa=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
  37. function Ia(){var a=document.createDocumentFragment(),b=G.id,c=null,d=0,e=null,f;wa=[];D.b[b]&&D.b[b].a.forEach(function(b){if(b.f)b.M();else{var h=b.L(),g=!1;c&&c.F===b.F&&b.F?30>Math.abs(d-b.o)&&!(b instanceof z)?e.classList.add("slackmsg-same-ts"):d=b.o:(d=b.o,g=!0);(!c||c.o<=G.b)&&b.o>G.b?h.classList.add("slackmsg-first-unread"):h.classList.remove("slackmsg-first-unread");if(b instanceof z)e=c=null,d=0,a.appendChild(h),f=null;else{if(g||!f){var g=D.a.a[b.F],k=b.username,l=document.createElement("div"),
  38. n=document.createElement("div"),q=document.createElement("span");l.O=document.createElement("img");l.O.className="slackmsg-author-img";q.className="slackmsg-author-name";g?(q.textContent=g.name,l.O.src=g.b.small):(q.textContent=k||"?",l.O.src="");n.appendChild(l.O);n.appendChild(q);n.className="slackmsg-author";l.className="slackmsg-authorGroup";l.appendChild(n);l.content=document.createElement("div");l.content.className="slackmsg-author-messages";l.appendChild(l.content);f=l;wa.push(f);a.appendChild(f)}c=
  39. b;e=h;f.content.appendChild(h)}}});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;window.hasFocus&&Ja()}
  40. function Oa(a){function b(a,b){for(b=b||a.target;b!==a.currentTarget&&b;){if(b.classList.contains("slackmsg-item"))return b.id;b=b.parentElement}}for(var c,d,e=a.target;e!==a.currentTarget&&e&&!e.classList.contains("slackmsg-hover");){if(e.parentElement&&e.classList.contains("slackmsg-attachment-actions-item")){d=b(a,e);var f=e.dataset.attachmentIndex,k=e.dataset.actionIndex;d&&void 0!==f&&void 0!==k&&(d=parseFloat(d.split("_")[1]),(c=fa(d))&&c.u[f]&&c.u[f].actions&&c.u[f].actions[k]&&Pa(c,c.u[f],
  41. c.u[f].actions[k]))}else if(e.parentElement&&e.parentElement.classList.contains("slackmsg-hover")){if(d=b(a,e))d=parseFloat(d.split("_")[1]),(c=fa(d))&&e.classList.contains("slackmsg-hover-reply")?(S&&(S=null,T()),Q!==c&&(Q=c,R())):c&&e.classList.contains("slackmsg-hover-reaction")?Qa.V(document.body,function(a){a&&Ka(G.id,c.id,a)}):c&&e.classList.contains("slackmsg-hover-edit")?(Q&&(Q=null,R()),S!==c&&(S=c,T())):c&&e.classList.contains("slackmsg-hover-remove")&&(Q&&(Q=null,R()),S&&(S=null,T()),Ra(c));
  42. break}e=e.parentElement}}function Pa(a,b,c){function d(){var d=JSON.stringify({actions:[c],attachment_id:b.id,callback_id:b.callback_id,channel_id:e,is_ephemeral:a instanceof A,message_ts:a.id}),k=a.F,h=new FormData,g=new XMLHttpRequest;h.append("payload",d);h.append("service_id",k);g.open("POST","api/attachmentAction");g.send(h)}var e=G.id;c.confirm?va(ua(new ha(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).V():d()}
  43. function P(){document.getElementById("msgInput").focus()}function Ba(){var a=document.location.hash.substr(1),b=D.a.m[a];b&&b!==G?Sa(b):(a=D.a.a[a])&&a.s&&Sa(a.s)}function Ta(){var a=document.getElementById("chatWindow").getBoundingClientRect().top;wa.forEach(function(b){var c=b.O,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px"})}
  44. document.addEventListener("DOMContentLoaded",function(){ga();document.getElementById("chatWindow").addEventListener("click",Oa);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&Ba()});document.getElementById("fileUploadCancel").addEventListener("click",function(a){a.preventDefault();document.getElementById("fileUploadError").classList.add("hidden");document.getElementById("fileUploadContainer").classList.add("hidden");document.getElementById("fileUploadInput").value=
  45. "";return!1});document.getElementById("fileUploadForm").addEventListener("submit",function(a){a.preventDefault();a=document.getElementById("fileUploadInput");var b=a.value;b&&(b=b.substr(b.lastIndexOf("\\")+1),Ua(b,a.files[0],function(a){var b=document.getElementById("fileUploadError");a?(b.textContent=a,b.classList.remove("hidden")):(b.classList.add("hidden"),document.getElementById("fileUploadInput").value="",document.getElementById("fileUploadContainer").classList.add("hidden"))}));return!1});
  46. document.getElementById("attachFile").addEventListener("click",function(a){a.preventDefault();G&&document.getElementById("fileUploadContainer").classList.remove("hidden");return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();a=document.getElementById("msgInput");G&&a.value&&Va(a.value)&&(a.value="",Q&&(Q=null,R()),S&&(S=null,R()),document.getElementById("slashList").textContent="");P();return!1});window.addEventListener("blur",function(){window.hasFocus=
  47. !1});window.addEventListener("focus",function(){window.hasFocus=!0;xa=0;G&&Ja();P()});document.getElementById("chatWindow").addEventListener("scroll",Ta);var a=0;document.getElementById("msgInput").addEventListener("input",function(){if(G){var b=Date.now();a+3E3<b&&(D.a.b.f||G instanceof v)&&(Wa(),a=b);var b=[],c=this.value;if("/"===this.value[0]){var d=c.indexOf(" "),e=-1!==d,d=-1===d?c.length:d,c=c.substr(0,d);for(k in D.a.j.data){var f=D.a.j.data[k];(!e&&f.name.substr(0,d)===c||e&&f.name===c)&&
  48. b.push(f)}}b.sort(function(a,b){return a.P.localeCompare(b.P)||a.name.localeCompare(b.name)});var d=document.getElementById("slashList"),e=document.createDocumentFragment();d.textContent="";var k=0;for(c=b.length;k<c;k++){f=b[k];if(h!==f.P){var h=f.P;e.appendChild(Xa(f.P))}e.appendChild(Ya(f))}d.appendChild(e)}});window.hasFocus=!0;(function(){var a=document.getElementById("emojiButton");if("makeEmoji"in window){var c=window.makeEmoji("smile");c?a.innerHTML="<span class='emoji-small'>"+c.outerHTML+
  49. "</span>":a.style.backgroundImage='url("smile.svg")';(c=window.makeEmoji("paperclip"))?document.getElementById("attachFile").innerHTML="<span class='emoji-small'>"+c.outerHTML+"</span>":document.getElementById("attachFile").style.backgroundImage='url("public/paperclip.svg")';a.addEventListener("click",function(){Qa.V(document.body,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");P()})})}else a.classList.add("hidden")})();Za()});function za(){var a=document.createElement("span"),b=document.createElement("span"),c=document.createElement("span"),d=document.createElement("span");a.className="typing-container";b.className="typing-dot1";c.className="typing-dot2";d.className="typing-dot3";b.textContent=c.textContent=d.textContent=".";a.appendChild(b);a.appendChild(c);a.appendChild(d);return a}var Aa=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
  50. function $a(a){var b=a.b,c=document.createElement("div"),d=document.createElement("div"),e=document.createElement("ul"),f=document.createElement("li");c.u=document.createElement("ul");c.B=document.createElement("ul");c.o=document.createElement("div");c.ha=document.createElement("div");c.aa=document.createElement("span");c.id=b+"_"+a.id;c.className="slackmsg-item";c.o.className="slackmsg-ts";c.ha.className="slackmsg-msg";c.aa.className="slackmsg-author-name";e.className="slackmsg-hover";f.className=
  51. "slackmsg-hover-reply";e.appendChild(f);if("makeEmoji"in window){var k=document.createElement("li"),h=window.makeEmoji("arrow_heading_down"),g=window.makeEmoji("smile"),m=window.makeEmoji("pencil2"),b=window.makeEmoji("x");k.className="slackmsg-hover-reaction";g?(k.classList.add("emoji-small"),k.appendChild(g)):k.style.backgroundImage='url("smile.svg")';h?(f.classList.add("emoji-small"),f.appendChild(h)):f.style.backgroundImage='url("repl.svg")';e.appendChild(k);a.F===D.a.b.id&&(a=document.createElement("li"),
  52. a.className="slackmsg-hover-edit",m?a.classList.add("emoji-small"):a.style.backgroundImage='url("edit.svg")',a.appendChild(m),e.appendChild(a),a=document.createElement("li"),a.className="slackmsg-hover-remove",b?a.classList.add("emoji-small"):a.style.backgroundImage='url("remove.svg")',a.appendChild(b),e.appendChild(a))}else f.style.backgroundImage='url("repl.svg")',a.F===D.a.b.id&&(a=document.createElement("li"),a.className="slackmsg-hover-edit",a.style.backgroundImage='url("edit.svg")',e.appendChild(a),
  53. a=document.createElement("li"),a.className="slackmsg-hover-remove",a.style.backgroundImage='url("remove.svg")',e.appendChild(a));d.appendChild(c.aa);d.appendChild(c.ha);d.appendChild(c.o);d.appendChild(c.u);b=document.createElement("div");b.innerHTML=J.R;b.className="slackmsg-edited";d.appendChild(b);d.appendChild(c.B);d.className="slackmsg-content";c.u.className="slackmsg-attachments";c.B.className="slackmsg-reactions";c.appendChild(d);c.appendChild(e);return c}
  54. function ab(a){var b={good:"#2fa44f",warning:"#de9e31",danger:"#d50200"};if(a){if("#"===a[0])return a;if(b[a])return b[a]}return"#e3e4e6"}
  55. function bb(a,b,c){var d=document.createElement("li"),e=document.createElement("div"),f=document.createElement("div"),k=document.createElement("a"),h=document.createElement("div"),g=document.createElement("img"),m=document.createElement("a"),l=document.createElement("div"),n=document.createElement("div"),q=document.createElement("div"),u=document.createElement("img"),w=document.createElement("div");d.className="slackmsg-attachment";e.style.borderColor=ab(b.color||"");e.className="slackmsg-attachment-block";
  56. f.className="slackmsg-attachment-pretext";b.pretext?f.innerHTML=a.w(b.pretext):f.classList.add("hidden");k.target="_blank";b.title?(k.innerHTML=a.w(b.title),b.title_link&&(k.href=b.title_link),k.className="slackmsg-attachment-title"):k.className="hidden slackmsg-attachment-title";m.target="_blank";h.className="slackmsg-author";b.author_name&&(m.innerHTML=a.w(b.author_name),m.href=b.author_link||"",m.className="slackmsg-author-name",g.className="slackmsg-author-img",b.author_icon&&(g.src=b.author_icon,
  57. h.appendChild(g)),h.appendChild(m));q.className="slackmsg-attachment-thumb";b.thumb_url?(g=document.createElement("img"),g.src=b.thumb_url,q.appendChild(g),e.classList.add("has-thumb"),b.video_html&&(q.dataset.video=b.video_html)):q.classList.add("hidden");l.className="slackmsg-attachment-content";g=a.w(b.text||"");n.className="slackmsg-attachment-text";g&&""!=g?n.innerHTML=g:n.classList.add("hidden");u.className="slackmsg-attachment-img";b.image_url?u.src=b.image_url:u.classList.add("hidden");w.className=
  58. "slackmsg-attachment-footer";b.footer&&(g=document.createElement("span"),g.className="slackmsg-attachment-footer-text",g.innerHTML=a.w(b.footer),b.footer_icon&&(m=document.createElement("img"),m.src=b.footer_icon,m.className="slackmsg-attachment-footer-icon",w.appendChild(m)),w.appendChild(g));b.ts&&(g=document.createElement("span"),g.className="slackmsg-ts",g.innerHTML=J.ba(b.ts),w.appendChild(g));l.appendChild(q);l.appendChild(n);e.appendChild(k);e.appendChild(h);e.appendChild(l);e.appendChild(u);
  59. if(b.fields&&b.fields.length){var x=document.createElement("ul");e.appendChild(x);x.className="slackmsg-attachment-fields";b.fields.forEach(function(b){var c=b.title||"",d=b.value||"";b=!!b["short"];var e=document.createElement("li"),f=document.createElement("div"),h=document.createElement("div");e.className="field";b||e.classList.add("field-long");f.className="field-title";f.textContent=c;h.className="field-text";h.innerHTML=a.w(d);e.appendChild(f);e.appendChild(h);e&&x.appendChild(e)})}if(b.actions&&
  60. b.actions.length)for(k=document.createElement("ul"),k.className="slackmsg-attachment-actions "+qa,e.appendChild(k),h=0,l=b.actions.length;h<l;h++)(n=b.actions[h])&&(n=cb(c,h,n))&&k.appendChild(n);e.appendChild(w);d.appendChild(f);d.appendChild(e);return d}
  61. function cb(a,b,c){var d=document.createElement("li"),e=ab(c.style);d.textContent=c.text;e!==ab()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="slackmsg-attachment-actions-item "+pa;return d}function Fa(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.name;b.appendChild(za());b.appendChild(c);return b}
  62. function Xa(a){var b=document.createElement("lh");b.textContent=a;b.className="slack-command-header";return b}
  63. function Ya(a){var b=document.createElement("li"),c=document.createElement("span"),d=document.createElement("span"),e=document.createElement("span");c.textContent=a.name;d.textContent=a.usage;e.textContent=a.a;b.appendChild(c);b.appendChild(d);b.appendChild(e);b.className="slack-command-item";c.className="slack-command-name";d.className="slack-command-usage";e.className="slack-command-desc";return b};var Qa=function(){function a(a,b){for(a=a.target;a!==g&&a&&"LI"!==a.nodeName;)a=a.parentElement;a&&"LI"===a.nodeName&&a.id&&"emojibar-"===a.id.substr(0,9)?b(a.id.substr(9)):b(null)}function b(){if(!c())return!1;B&&B(null);return!0}function c(){return g.parentElement?(g.parentElement.removeChild(m),g.parentElement.removeChild(g),!0):!1}function d(a){var b=0;a=void 0===a?u.value:a;if(h()){var c=window.searchEmojis(a);var d=e(c);for(var g in w)w[g].visible&&(w[g].visible=!1,n.removeChild(w[g].c));g=
  64. 0;for(var k=d.length;g<k;g++){var l=d[g].name;var m=w[l];if(!m){m=w;var la=l,E=l;l=window.makeEmoji(c[l]);var B=document.createElement("span");B.appendChild(l);B.className="emoji-medium";l=f(E,B);m=m[la]=l}m.visible||(m.visible=!0,n.appendChild(m.c));b++}}for(g in x)x[g].visible&&(x[g].visible=!1,q.removeChild(x[g].c));d=e(D.a.l.data);g=0;for(k=d.length;g<k;g++)l=d[g].name,""!==a&&l.substr(0,a.length)!==a||"alias:"===D.a.l.data[l].substr(0,6)||(m=x[l],m||(c=x,la=m=l,l=D.a.l.data[l],E=document.createElement("span"),
  65. B=document.createElement("span"),E.className="emoji emoji-custom",E.style.backgroundImage='url("'+l+'")',B.appendChild(E),B.className="emoji-medium",l=f(la,B),m=c[m]=l),m.visible||(m.visible=!0,q.appendChild(m.c)),b++);return b}function e(a){var b=D.a.b.a.a,c=[],d;for(d in a){var e={name:d,za:0,count:0};a[d].names&&a[d].names.forEach(function(a){e.count+=b[a]||0});c.push(e)}return c=c.sort(function(a,b){var c=b.count-a.count;return c?c:a.za-b.za})}function f(a,b){var c=document.createElement("li");
  66. c.appendChild(b);c.className="emojibar-list-item";c.id="emojibar-"+a;return{visible:!1,c:c}}function k(a){var b=document.createElement("img"),c=document.createElement("div");b.src=a;c.appendChild(b);c.className="emojibar-header";return c}function h(){return"searchEmojis"in window}var g=document.createElement("div"),m=document.createElement("div"),l=document.createElement("div"),n=document.createElement("ul"),q=document.createElement("ul"),u=document.createElement("input"),w={},x={},F=document.createElement("div"),
  67. E=document.createElement("span"),L=document.createElement("span"),B;m.addEventListener("click",function(a){var c=g.getBoundingClientRect();(a.screenY<c.top||a.screenY>c.bottom||a.screenX<c.left||a.screenX>c.right)&&b()});m.className="emojibar-overlay";g.className="emojibar";l.className="emojibar-emojis";F.className="emojibar-detail";E.className="emojibar-detail-img";L.className="emojibar-detail-name";n.className=q.className="emojibar-list";u.className="emojibar-search";F.appendChild(E);F.appendChild(L);
  68. l.appendChild(k(window.emojiProviderHeader));l.appendChild(n);l.appendChild(k("emojicustom.png"));l.appendChild(q);g.appendChild(l);g.appendChild(F);g.appendChild(u);u.addEventListener("keyup",function(){d()});g.addEventListener("mousemove",function(b){a(b,function(a){var b=a?w[a]||x[a]:null;b?(E.innerHTML=b.c.outerHTML,L.textContent=":"+a+":"):(E.textContent="",L.textContent="")})});g.addEventListener("click",function(b){a(b,function(a){a&&c()&&B&&B(a)})});return{isSupported:h,V:function(a,b){return h()?
  69. (B=b,a.appendChild(m),a.appendChild(g),u.value="",d(),u.focus(),!0):!1},search:d,close:b}}();var D,N=[];function db(){this.f=0;this.a=new ca;this.b={}}
  70. db.prototype.update=function(a){var b=Date.now();a.v&&(this.f=a.v);if(a["static"]){var c=this.a,d=a["static"],e=Date.now();if(d.users)for(var f=0,k=d.users.length;f<k;f++){var h=c.a[d.users[f].id];h||(h=c.a[d.users[f].id]=new H(d.users[f].id));h.update(d.users[f],e)}if(d.channels)for(f=0,k=d.channels.length;f<k;f++){h=c.m[d.channels[f].id];if(!h){var h=c.m,g=d.channels[f].id;var m=d.channels[f];m=m.pv?new v(m.id,c.a[m.user]):new t(m.id);h=h[g]=m}h.update(d.channels[f],c,e)}d.emojis&&(c.l.data=d.emojis,
  71. c.l.version=e);if(void 0!==d.commands){c.j.data={};for(f in d.commands)c.j.data[f]=new aa(d.commands[f]);c.j.version=e}d.team&&(c.s||(c.s=new r(d.team.id)),c.s.update(d.team,e));c.A=Math.max(c.A,e);d.self&&(c.b=c.a[d.self.id]||null,c.b?(c.b.a||(c.b.a=new ba),c.b.a.update(d.self.prefs,e)):c.A=0);if(void 0!==d.typing)for(f in c.f={},d.typing){c.f[f]={};for(var l in d.typing[f])c.f[f][l]=e}}for(var n in this.a.m){var q=this.a.m[n];q.a===q.b&&(c=N.indexOf(q),-1!==c&&N.splice(c,1))}if(a.live){for(q in a.live)(n=
  72. this.b[q])?da(n,a.live[q],b):this.b[q]=new V(q,250,a.live[q],b);for(var u in a.live)(q=this.a.m[u])?(this.b[u].a.length&&(b=this.b[u],q.a=Math.max(q.a,b.a[b.a.length-1].o)),q.l||(eb(q,a.live[u]),G&&a.live[G.id]&&Ia())):D.f=0}a["static"]&&(ya(),a["static"].typing&&Da())};setInterval(function(){var a=D.a,b=Date.now(),c=!1,d;for(d in a.f){var e=!0,f;for(f in a.f[d])a.f[d][f]+3E3<b?(delete a.f[d][f],c=!0):e=!1;e&&(delete a.f[d],c=!0)}c&&Da()},1E3);
  73. function eb(a,b){if(a!==G||!window.hasFocus){var c=new RegExp("<@"+D.a.b.id),d=!1,e=!1,f=!1;b.forEach(function(b){if(!(parseFloat(b.ts)<=a.b)){e=!0;var h;if(!(h=a instanceof v)&&(h=b.text)&&!(h=b.text.match(c)))a:{h=D.a.b.a.C;for(var g=0,k=h.length;g<k;g++)if(-1!==b.text.indexOf(h[g])){h=!0;break a}h=!1}h&&(-1===N.indexOf(a)&&(f=!0,N.push(a)),d=!0)}});if(e){O();if(b=document.getElementById("room_"+a.id))b.classList.add("unread"),d&&b.classList.add("unreadHi");f&&!window.hasFocus&&Na()}}}
  74. function Ja(){var a=G,b=N.indexOf(a);if(a.a>a.b){var c=new XMLHttpRequest;c.open("POST","api/markread?room="+a.id+"&ts="+a.a,!0);c.send(null);a.b=a.a}0<=b&&(N.splice(b,1),O());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}D=new db;var Ca=function(){function a(a,b){b.sort(function(){return Math.random()-.5});for(var c=0,d=20;d<g-40;d+=l)for(var e=0;e+l<=m;e+=l)f(a,b[c],d,e),c++,c===b.length&&(b.sort(function(a,b){return a.T?b.T?Math.random()-.5:-1:1}),c=0)}function b(a,d){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].T){c(a[e].src,function(c){a[e].T=c;b(a,d)});return}var g=[];a.forEach(function(a){a.T&&g.push(a.T)});d(g)}function c(a,b){var c=new XMLHttpRequest;c.responseType="blob";c.onreadystatechange=function(){if(4===
  75. c.readyState)if(c.response){var a=new Image;a.onload=function(){var c=document.createElement("canvas");c.height=c.width=u;c=c.getContext("2d");c.drawImage(a,0,0,u,u);for(var c=c.getImageData(0,0,u,u),d=0,e=0;e<c.width*c.height*4;e+=4)c.data[e]=c.data[e+1]=c.data[e+2]=(c.data[e]+c.data[e+1]+c.data[e+2])/3,c.data[e+3]=50,d+=c.data[e];if(50>d/(c.height*c.width))for(e=0;e<c.width*c.height*4;e+=4)c.data[e]=c.data[e+1]=c.data[e+2]=255-c.data[e];b(c)};a.onerror=function(){b(null)};a.src=window.URL.createObjectURL(c.response)}else b(null)};
  76. c.open("GET",a,!0);c.send(null)}function d(){var a=h.createLinearGradient(0,0,0,m);a.addColorStop(0,"#4D394B");a.addColorStop(1,"#201820");h.fillStyle=a;h.fillRect(0,0,g,m);return h.getImageData(0,0,g,m)}function e(a,b){for(var c=(a.height-b.height)/2,d=0;d<b.height;d++)for(var e=0;e<b.width;e++){var f=b.data[4*(d*b.width+e)]/255,g=4*((d+c)*a.width+e+c);a.data[g]*=f;a.data[g+1]*=f;a.data[g+2]*=f}return a}function f(a,b,c,d){var f=Math.floor(d);a=[a.data[f*g*4+0],a.data[f*g*4+1],a.data[f*g*4+2]];h.fillStyle=
  77. "#"+(1.1*a[0]<<16|1.1*a[1]<<8|1.1*a[2]).toString(16);h.beginPath();h.moveTo(c+l/2,d+n);h.lineTo(c-n+l,d+l/2);h.lineTo(c+l/2,d-n+l);h.lineTo(c+n,d+l/2);h.closePath();h.fill();h.putImageData(e(h.getImageData(c+n,d+n,q,q),b),c+n,d+n)}var k=document.createElement("canvas"),h=k.getContext("2d"),g=k.width=250,m=k.height=290,l=(g-40)/3,n=.1*l,q=Math.floor(l-2*n),u=.5*q,w,x=[],F=!1;return function(c){if(w)c(w);else if(F)x.push(c);else{var e=d(),f=[];F=!0;x.push(c);for(var g in D.a.a)D.a.a[g].j||D.a.a[g].A||
  78. f.push({src:"api/avatar?user="+g});b(f,function(b){a(e,b);w=k.toDataURL();x.forEach(function(a){a(w)})})}}}();var U=0,G=null,Q=null,S=null;function fb(a){var b=new XMLHttpRequest;b.timeout=6E4;b.onreadystatechange=function(){if(4===b.readyState)if(b.status){var c=null,d=2===Math.floor(b.status/100);if(d){U&&(U=0,Ga(!0));c=b.response;try{c=JSON.parse(c)}catch(e){c=null}}else U?(U+=Math.floor((U||5)/2),U=Math.min(60,U)):(U=5,Ga(!1));a(d,c)}else U&&(U=0,Ga(!0)),fb(a)};b.open("GET","api?v="+D.f,!0);b.send(null)}function Wa(){var a=new XMLHttpRequest;a.open("POST","api/typing?room="+G.id,!0);a.send(null)}
  79. function gb(a,b){a?(b&&D.update(b),Za()):setTimeout(Za,1E3*U)}function Za(){fb(gb)}function Sa(a){G&&document.getElementById("room_"+G.id).classList.remove("selected");document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");G=a;Ha();G.a&&!D.b[G.id]&&(a=new XMLHttpRequest,a.open("GET","api/hist?room="+G.id,!0),a.send(null))}
  80. function Ua(a,b,c){var d=G;new FileReader;var e=new FormData,f=new XMLHttpRequest;e.append("file",b);e.append("filename",a);f.onreadystatechange=function(){4===f.readyState&&(204===f.status?c(null):c(f.statusText))};f.open("POST","api/file?room="+d.id);f.send(e)}
  81. function Va(a){if(S){var b=new XMLHttpRequest;b.open("PUT","api/msg?room="+G.id+"&ts="+S.id+"&text="+encodeURIComponent(a),!0);b.send(null);return!0}if("/"===a[0]){var c=a.indexOf(" "),b=-1===c?"":a.substr(c);return(a=D.a.j.data[a.substr(0,-1===c?void 0:c)])?(c=new XMLHttpRequest,c.open("POST","api/cmd?room="+G.id+"&cmd="+encodeURIComponent(a.name.substr(1))+"&args="+encodeURIComponent(b.trim()),!0),c.send(null),!0):!1}var b=G,c=Q,d=new XMLHttpRequest;a="api/msg?room="+b.id+"&text="+encodeURIComponent(a);
  82. if(c){var e=D.a.a[c.F],f="Message";"C"===b.id[0]?f="Channel message":"D"===b.id[0]?f="Direct message":"G"===b.id[0]&&(f="Group message");a+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:c.text,author_name:"<@"+e.id+"|"+e.name+">",author_icon:e.b.small,text:c.text,footer:f,ts:c.o}]))}d.open("POST",a,!0);d.send(null);return!0}function Ra(a){var b=new XMLHttpRequest;b.open("DELETE","api/msg?room="+G.id+"&ts="+a.id,!0);b.send(null)}
  83. function Ka(a,b,c){var d=new XMLHttpRequest;d.open("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0);d.send(null)};function V(a,b,c,d){C.call(this,a,b,c,d)}V.prototype=Object.create(C.prototype);V.prototype.constructor=V;V.prototype.b=function(a,b){return!0===a.isMeMessage?new W(this.id,a,b):!0===a.isNotice?new X(this.id,a,b):new Y(this.id,a,b)};
  84. var Z=function(){function a(a){return K(a,{Sa:["fromage"],S:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));var b=La(a);return b?(a=document.createElement("span"),a.className="emoji-small",a.appendChild(b),a.outerHTML):a},U:b})}function b(a){var b=a.indexOf("|");if(-1===b)var c=a;else{c=a.substr(0,b);var f=a.substr(b+1)}return{link:c,text:f||c,Ea:"@"===c[0]?!0:"#"===c[0]?!0:!1}}return{D:function(a){a.H=!0;return a},M:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);
  85. return a},L:function(a){a.c?a.H&&(a.H=!1,a.I()):a.$().I();return a.c},I:function(b){var c=D.a.a[b.F];b.c.o.innerHTML=J.ba(b.o);b.c.ha.innerHTML=a(b.text);b.c.aa.textContent=c?c.name:b.username||"?";for(var c=document.createDocumentFragment(),e=0,f=b.u.length;e<f;e++){var k=b.u[e];k&&(k=bb(b,k,e))&&c.appendChild(k)}b.c.u.textContent="";b.c.u.appendChild(c);c=b.b;e=document.createDocumentFragment();if(b.B)for(var h in b.B){var f=c,k=b.id,g=h,m=b.B[h],l=La(g);if(l){for(var n=document.createElement("li"),
  86. q=document.createElement("a"),u=document.createElement("span"),w=document.createElement("span"),x=[],F=0,E=m.length;F<E;F++){var L=D.a.a[m[F]];L&&x.push(L.name)}x.sort();w.textContent=x.join(", ");u.appendChild(l);u.className="emoji-small";q.href="javascript:toggleReaction('"+f+"', '"+k+"', '"+g+"')";q.appendChild(u);q.appendChild(w);n.className="slackmsg-reaction-item";n.appendChild(q);f=n}else console.warn("Reaction id not found: "+g),f=null;f&&e.appendChild(f)}b.c.B.textContent="";b.c.B.appendChild(e);
  87. b.R&&b.c.classList.add("edited");return b},J:function(a){return a.c.cloneNode(!0)},w:function(b,d){return a(d)}}}();function W(a,b,c){y.call(this,b,c);this.b=a;this.c=Z.c;this.H=Z.H}W.prototype=Object.create(z.prototype);p=W.prototype;p.constructor=W;p.D=function(){return Z.D(this)};p.w=function(a){return Z.w(this,a)};p.M=function(){return Z.M(this)};p.L=function(){return Z.L(this)};p.$=function(){this.c=$a(this);this.c.classList.add("slackmsg-me_message");return this};p.J=function(){return Z.J(this)};
  88. p.I=function(){Z.I(this);return this};p.update=function(a,b){z.prototype.update.call(this,a,b);this.D()};function Y(a,b,c){y.call(this,b,c);this.b=a;this.c=Z.c;this.H=Z.H}Y.prototype=Object.create(y.prototype);p=Y.prototype;p.constructor=Y;p.D=function(){return Z.D(this)};p.w=function(a){return Z.w(this,a)};p.M=function(){return Z.M(this)};p.L=function(){return Z.L(this)};p.$=function(){this.c=$a(this);return this};p.J=function(){return Z.J(this)};p.I=function(){Z.I(this);return this};
  89. p.update=function(a,b){y.prototype.update.call(this,a,b);this.D()};function X(a,b,c){y.call(this,b,c);this.b=a;this.c=Z.c;this.a=null;this.H=Z.H}X.prototype=Object.create(A.prototype);p=X.prototype;p.constructor=X;p.D=function(){return Z.D(this)};p.w=function(a){return Z.w(this,a)};p.M=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};p.L=function(){Z.L(this);return this.a};p.J=function(){return this.a.cloneNode(!0)};
  90. p.$=function(){this.c=$a(this);this.a=document.createElement("span");this.c.classList.add("slackmsg-notice");this.a.className="slackmsg-notice";this.a.textContent=J.ya;return this};p.I=function(){Z.I(this);return this};p.update=function(a,b){A.prototype.update.call(this,a,b);this.D()};
  91. })();