"use strict";(function(){ var q;function ca(a){this.id=a;this.version=0}ca.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);this.version=Math.max(this.version,b)};function da(a){this.a=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.R=a.category}function ea(){this.a={};this.A=[];this.version=0} ea.prototype.update=function(a,b){a.emoji_use&&(this.a=JSON.parse(a.emoji_use));a.highlight_words?this.A=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.A=a.highlights);this.version=Math.max(this.version,b)};function fa(){this.b=null;this.j={};this.m={};this.self=null;this.a={version:0,data:{}};this.i={version:0,data:{}};this.s={};this.w=0} function ga(a,b,c){var d=d||"";b.team&&(a.b||(a.b=new ca(b.team.id)),a.b.update(b.team,c));if(b.users)for(var e=0,f=b.users.length;ethis.w;)this.a.shift();if(this.b)for(a=0;ab.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?"hier, "+a.toLocaleTimeString(): a.toLocaleString()},ja:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Annuler",neterror:"Impossible de se connecter au chat !","setting-menu-services":"services","settings-services-title":"services","setting-menu-display":"Affichage","settings-display-title":"Affichage","setting-menu-privacy":"Vie priv\u00e9e","settings-privacy-title":"Vie priv\u00e9e","settings-serviceAddButton":"Ajouter un service","settings-serviceListEmpty":"Vous n'avez pas encore ajout\u00e9 de service. Ajouter un service pour continuer.", "settings-serviceAddConfirm":"Suivant"}};J.fr.D=function(a){return"(edité "+J.fr.V(a)+")"};J.en={$a:"Unknown member",Za:"Unknown channel",Ja:"New message",message:"Message",Ia:"Network",Ka:"(only visible to you)",I:"Starred",j:"Channels",Ma:"Direct messages",Na:"Share your GPS location",ok:"Ok",Fa:"Cancel",V:function(a){"string"!==typeof a&&(a=parseFloat(a));var b=new Date,c=new Date;a=new Date(a);b.setHours(0,0,0,0);c.setTime(b.getTime());c.setDate(c.getDate()-1);return a.getTime()>b.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?"yesterday, "+a.toLocaleTimeString():a.toLocaleString()}, ja:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Cancel",neterror:"Cannot connect to chat !","setting-menu-services":"services","settings-services-title":"services","setting-menu-display":"Display","settings-display-title":"Display","setting-menu-privacy":"Privacy","settings-privacy-title":"Privacy","settings-serviceAddButton":"Add a service","settings-serviceListEmpty":"You don't have any service yet. Please add a service to continue.","settings-serviceAddConfirm":"Next"}}; J.en.D=function(a){return"(edited "+J.en.V(a)+")"};var wa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.T=c;this.f=null;this.h=[];this.a=d||"";this.ea="<"===this.a;this.pa="*"===this.a;this.da="_"===this.a;this.fa="~"===this.a||"-"===this.a;this.i=">"===this.a||">"===this.a;this.W=":"===this.a;this.ra="`"===this.a;this.Ca="```"===this.a;this.sa="\n"===this.a;this.ca=void 0!==d&&-1!==n.A.indexOf(d);this.g=b;this.ga=null;this.b=this.sa||this.ca?c+d.length-1:!1;this.ca&&(this.f=new a(this),this.h.push(this.f),this.f.text=d)} function c(a){return"A"<=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||h;for(var c=0,e=a.h.length;c"===l[a])return!0;var b=c(l[a-1]);if(!this.i&&l.substr(a,this.a.length)===this.a){if(!b&&(this.pa||this.da||this.fa))return!1;if(this.f&&this.za())return this.f.Da();if(this.Pa())return!0}return"\n"===l[a]&&this.i?!0:!1};b.prototype.Pa=function(){for(var a=this;a;){for(var c=0,d=a.h.length;c"===l[b])return l[b]}if("`"===l[b]&&!d|| "\n"===l[b]||!(-1===["*","~","-","_"].indexOf(l[b])||!e&&void 0!==l[b+1]&&-1==="*~-_<&".split("").indexOf(l[b+1])||d&&void 0!==l[b-1]&&-1==="*~-_<&".split("").indexOf(l[b-1]))||-1!==[":"].indexOf(l[b])&&e||-1!==["<"].indexOf(l[b]))return l[b];d=0;for(e=n.A.length;d=a&&(this.b=!1);this.h.forEach(function(c){c instanceof b&&c.ka(a)})};a.prototype.innerHTML=function(){if(this.g.ma()){for(var a=this.g;a&&!a.W;)a=a.g;if(a){var a=a.a+this.text+a.a,b=n.U(a);return b?b:a}return(a=n.U(this.text))?a:this.text}if(this.g.la()){if("undefined"!==typeof hljs)try{return a=this.text.match(/^\w+/),hljs.configure({useBR:!0, tabReplace:"      "}),a&&hljs.getLanguage(a[0])?hljs.fixMarkup(hljs.highlight(a[0],this.text.substr(a[0].length)).value):hljs.fixMarkup(hljs.highlightAuto(this.text).value)}catch(p){console.error(p)}return this.text.replace(/\n/g,"
")}return n.ba(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.g.la()){a="pre";b.push("codeblock");var d=this.innerHTML()}else this.g.va()?(b.push("code"),d=this.innerHTML()):(this.g.ea&&(d=n.$(this.text))?(a= "a",c=' href="'+d.link+'"',d.Ha||(c+=' target="_blank"'),d=n.ba(d.text)):d=this.innerHTML(),this.g.ua()&&b.push("bold"),this.g.xa()&&b.push("italic"),this.g.ya()&&b.push("strike"),this.g.ma()&&b.push("emoji"),this.g.wa()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+""};b.prototype.outerHTML=function(){var a="";this.i&&(a+='');this.sa&&(a+="
");this.h.forEach(function(b){a+=b.outerHTML()});this.i&&(a+="
");return a};b.prototype.Ba= function(a){this.i&&!this.b&&this.ta(a);this.h.forEach(function(c){c instanceof b&&c.Ba(a)})};return function(c,m){m||(m={});n.A=m.A||[];n.U=m.U||f;n.ba=m.ba||f;n.$=m.$||g;l=c;h=new b(this,0);m=0;c=l.length;do{for(;ma.B&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=l=b}b&&(a.I?c.push(l):f.push(l))}else if(l=g[a.id],b=document.createElement("li"),k=document.createElement("a"),b.id="room_"+a.id,k.href="#"+a.id,a.b?(b.className="slack-context-room slack-group",b.dataset.count=Object.keys(a.m|| {}).length):b.className="slack-context-room slack-channel",M===a&&b.classList.add("selected"),k.textContent=l||a.name,b.appendChild(Oa()),b.appendChild(k),a.N>a.B&&(b.classList.add("unread"),0<=N.indexOf(a)&&b.classList.add("unreadHi")),l=b)a.I?c.push(l):a.b?e.push(l):d.push(l)});c.length&&a.appendChild(Pa(K.I));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(Pa(K.j));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});f.length&&a.appendChild(Pa(K.Ma)); f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);Qa();O();P&&Ra(P.b.id,P.m,function(a){document.getElementById("slackCtx").style.backgroundImage="url("+a+")"})} function Sa(){qa(function(a){var b=a.s,c;for(c in a.self.j)if(!a.self.j[c].Y){var d=document.getElementById("room_"+c);b[c]?d.classList.add("slack-context-typing"):d.classList.remove("slack-context-typing")}for(var e in a.m)(c=a.m[e].oa)&&!c.Y&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("slack-context-typing"):d.classList.remove("slack-context-typing"))});Ta()} function Ta(){var a;document.getElementById("whoistyping").textContent="";if(P&&M&&(a=P.s[M.id])){var b=document.createDocumentFragment(),c=!1,d;for(d in a)(a=I(d))?b.appendChild(Ua(a)):c=!0;c&&(E.b=0);document.getElementById("whoistyping").appendChild(b)}}function Va(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");O()} function Wa(){var a=M.name||(M.a?M.a.name:void 0);if(!a){var b=[];M.m.forEach(function(a){b.push(a.name)});a=b.join(", ")}document.getElementById("currentRoomTitle").textContent=a;Xa();Q();document.getElementById("fileUploadContainer").classList.add("hidden");Ya();R&&(R=null,T());U&&(U=null,T());Ta()} function T(){if(R){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){R=null;T()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(R.K())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";Q()} function V(){if(U){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){U=null;V()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(U.K());document.getElementById("msgInput").value=U.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";Q()} window.toggleReaction=function(a,b,c){var d=E.a[a],e,f;(d=E.a[a])&&(e=la(d,b))&&(f=H(E.context,a))&&(e.C[c]&&-1!==e.C[c].indexOf(f.self.id)?(d=new XMLHttpRequest,d.open("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0),d.send(null)):Za(a,b,c))}; function $a(a){a:{var b={};if(P){var c;for(c=P;!b[a];){if(c=c.a.data[a])if("alias:"==c.substr(0,6))b[a]=!0,a=c.substr(6);else{a=document.createElement("span");a.className="emoji-custom emoji";a.style.backgroundImage="url('"+c+"')";break a}break}}}"string"===typeof a&&"makeEmoji"in window&&(a=window.makeEmoji(a));return"string"===typeof a?null:a}function ab(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"} function O(){var a=N.length,b="";if(W)b="!"+K.Ia+" - ",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+") - ",ab(a,a);else{var c=0;pa(E.context,function(a){a.N>a.B&&c++});c&&(b="("+c+") - ");ab(0,c)}E.context.b&&(b+=E.context.b.name);document.title=b} function bb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(Ma+3E4Math.abs(d-b.l)&&!(b instanceof z)?e.classList.add("slackmsg-same-ts"):d=b.l:(d=b.l,h=!0);(!c||c.l<=M.B)&&b.l>M.B?g.classList.add("slackmsg-first-unread"):g.classList.remove("slackmsg-first-unread");if(b instanceof z)e=c=null,d=0,a.appendChild(g),f=null;else{if(h||!f){var h=I(b.G),n=b.username,k=document.createElement("div"), m=document.createElement("div"),p=document.createElement("span"),t=document.createElement("img");k.Z=document.createElement("span");k.Z.className="slackmsg-author-img-wrapper";t.className="slackmsg-author-img";p.className="slackmsg-author-name";h?(p.textContent=h.name,t.src="api/avatar?user="+h.id):(p.textContent=n||"?",t.src="");k.Z.appendChild(t);m.appendChild(k.Z);m.appendChild(p);m.className="slackmsg-author";k.className="slackmsg-authorGroup";k.appendChild(m);k.content=document.createElement("div"); k.content.className="slackmsg-author-messages";k.appendChild(k.content);f=k;La.push(f);a.appendChild(f)}c=b;e=g;f.content.appendChild(g)}}});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;cb();window.hasFocus&&Ya()} function db(a,b){if(a.classList.contains("slackmsg-hover-reply"))U&&(U=null,V()),R!==b&&(R=b,T());else if(a.classList.contains("slackmsg-hover-reaction")){var c=M.id,d=b.id;eb.aa(document.body,P,function(a){a&&Za(c,d,a)})}else a.classList.contains("slackmsg-hover-edit")?(R&&(R=null,T()),U!==b&&(U=b,V())):a.classList.contains("slackmsg-hover-remove")&&(R&&(R=null,T()),U&&(U=null,V()),fb(b))} function gb(a){function b(a,b){for(b=b||a.target;b!==a.currentTarget&&b;){if(b.id&&b.classList.contains("slackmsg-item"))return b.id;b=b.parentElement}}for(var c=a.target;c!==a.currentTarget&&c&&!c.classList.contains("slackmsg-hover");){var d;if(c.parentElement&&c.classList.contains("slackmsg-attachment-actions-item")){var e=c.dataset.attachmentIndex,f=c.dataset.actionIndex;if((d=b(a,c))&&void 0!==e&&void 0!==f){d=d.substr(d.lastIndexOf("_")+1);(a=la(E.a[M.id],d))&&a.o[e]&&a.o[e].actions&&a.o[e].actions[f]&& hb(a,a.o[e],a.o[e].actions[f]);break}}if(c.parentElement&&c.parentElement.classList.contains("slackmsg-hover")){if(d=b(a,c))d=d.substr(d.lastIndexOf("_")+1),(a=la(E.a[M.id],d))&&db(c,a);break}c=c.parentElement}} function hb(a,b,c){function d(){var d={actions:[c],attachment_id:b.id,callback_id:b.callback_id,channel_id:e,is_ephemeral:a instanceof B,message_ts:a.id},g=new XMLHttpRequest;g.open("POST","api/attachmentAction?serviceId="+a.G);g.send(JSON.stringify(d))}var e=M.id;c.confirm?Ka(Ja(new xa(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).aa():d()}function Q(){document.getElementById("msgInput").focus()} function Qa(){var a=document.location.hash.substr(1),b=ra(a);b&&b!==M?ib(b):(a=I(a))&&a.b&&ib(a.b)}function cb(){var a=document.getElementById("chatWindow").getBoundingClientRect().top;La.forEach(function(b){var c=b.Z,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px";c.dataset.debugval=a-b.top;c.dataset.debugmax=b.height-d-d/2})} document.addEventListener("DOMContentLoaded",function(){va();jb();document.getElementById("chatWindow").addEventListener("click",gb);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&Qa()});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= "";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),kb(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}); document.getElementById("attachFile").addEventListener("click",function(a){a.preventDefault();M&&document.getElementById("fileUploadContainer").classList.remove("hidden");return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();a=document.getElementById("msgInput");M&&a.value&&lb(a.value)&&(a.value="",R&&(R=null,T()),U&&(U=null,T()),document.getElementById("slashList").textContent="");Q();return!1});window.addEventListener("blur",function(){window.hasFocus= !1});window.addEventListener("focus",function(){window.hasFocus=!0;Ma=0;M&&Ya();Q()});document.getElementById("chatWindow").addEventListener("scroll",cb);var a=0;document.getElementById("msgInput").addEventListener("input",function(){if(M){var b=Date.now();a+3E3"+c.outerHTML+"":a.style.backgroundImage='url("smile.svg")';(c=window.makeEmoji("paperclip"))?document.getElementById("attachFile").innerHTML=""+c.outerHTML+"":document.getElementById("attachFile").style.backgroundImage='url("public/paperclip.svg")';a.addEventListener("click",function(){P&&eb.aa(document.body,P,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");Q()})})}else a.classList.add("hidden")})();pb()});var qb=function(){function a(a){c&&(document.getElementById("settings").classList.remove("display-"+c),document.getElementById("setting-menu-"+c).classList.remove("selected"),document.getElementById("settings-serviceAddSection").classList.remove("hidden"));document.getElementById("settings").classList.add("display-"+a);document.getElementById("setting-menu-"+a).classList.add("selected");c=a}var b=!1,c=null,d={X:"services",display:"display",mb:"privacy"};document.getElementById("settingMenuItems").addEventListener("click", function(b){for(var c=b.target;b.currentTarget!==c&&c;c=c.parentNode)if(c.dataset&&c.dataset.target)for(var e in d)if(d[e]===c.dataset.target){a(d[e]);return}});document.getElementById("settings-serviceAddButton").addEventListener("click",function(a){a.preventDefault();document.getElementById("settings-serviceAddSection").classList.remove("hidden");return!1});document.getElementById("settings-serviceAddConfirm").addEventListener("click",function(a){a.preventDefault();document.location.href=document.getElementById("settings-serviceAddServiceList").value; return!1});return{display:function(c){b||(document.getElementById("settings").classList.remove("hidden"),b=!0);a(c||d.X);return this},Ya:function(){return this},Wa:d}}();function rb(a){if(void 0!==a.latitude&&void 0!==a.longitude&&-90<=a.latitude&&90>=a.latitude&&-180<=a.longitude&&180>=a.longitude){var b=0,c=function(a,b,c,d){return new Promise(function(e,f){var g=new Image;g.addEventListener("load",function(){d.M=g;e(d)});g.addEventListener("error",function(){console.warn("Error loading tile ",{zoom:a,x:b,y:c});f(g)});g.crossOrigin="anonymous";g.src="https://c.tile.openstreetmap.org/"+a+"/"+b+"/"+c+".png"})},d=document.createElement("canvas"),e=document.createElement("canvas"); d.height=d.width=e.height=e.width=300;var f=d.getContext("2d"),g=e.getContext("2d"),l=function(a,b,c){a=a*Math.PI/180;b=b*Math.PI/180;c=c*Math.PI/180;return Math.abs(6371E3*Math.acos(Math.pow(Math.sin(a),2)+Math.pow(Math.cos(a),2)*Math.cos(c-b)))},h=function(a,d,e,h){g.fillStyle="#808080";g.fillRect(0,0,300,300);f.fillStyle="#808080";f.fillRect(0,0,300,300);var m=Math.pow(2,a),k=(e+180)/360*m,n=(1-Math.log(Math.tan(d*Math.PI/180)+1/Math.cos(d*Math.PI/180))/Math.PI)/2*m,F=Math.floor(k),aa=Math.floor(n), ba=h?100*h/l(180/Math.PI*Math.atan(.5*(Math.exp(Math.PI-2*Math.PI*aa/m)-Math.exp(-(Math.PI-2*Math.PI*aa/m)))),F/m*360-180,(F+1)/m*360-180):0;d=b;for(e=0;3>e;e++)for(h=0;3>h;h++)c(a,F+e-1,aa+h-1,{Ta:e,Va:h,Oa:d}).then(function(a){if(a.Oa===b){g.drawImage(a.M,100*a.Ta,100*a.Va,100,100);a=k-F;var c=n-aa;a=100*a+100;c=100*c+100;f.putImageData(g.getImageData(0,0,300,300),0,0);void 0!==ba&&(f.beginPath(),f.arc(a,c,Math.max(ba,10),0,2*Math.PI,!1),f.lineWidth=2,f.fillStyle="rgba(244, 146, 66, 0.4)",f.strokeStyle= "rgba(244, 146, 66, 0.8)",f.stroke(),f.fill());if(void 0===ba||25c.bottom||a.screenXc.right)&&b()});n.className="emojibar-overlay";h.className="emojibar";k.className="emojibar-emojis";x.className="emojibar-detail";C.className="emojibar-detail-img";A.className="emojibar-detail-name";m.className=p.className="emojibar-list";t.className="emojibar-search"; x.appendChild(C);x.appendChild(A);k.appendChild(g(window.emojiProviderHeader));k.appendChild(m);k.appendChild(g("emojicustom.png"));k.appendChild(p);h.appendChild(k);h.appendChild(x);h.appendChild(t);t.addEventListener("keyup",function(){d()});h.addEventListener("mousemove",function(b){a(b,function(a){var b=a?v[a]||w[a]:null;b?(C.innerHTML=b.c.outerHTML,A.textContent=":"+a+":"):(C.textContent="",A.textContent="")})});h.addEventListener("click",function(b){a(b,function(a){a&&c()&&G&&G(a)})});return{isSupported:l, aa:function(a,b,c){return l()?(S=b,G=c,a.appendChild(n),a.appendChild(h),t.value="",d(),t.focus(),!0):!1},search:d,close:b}}();var E,N=[];function wb(){fa.call(this)}wb.prototype=Object.create(fa.prototype);wb.prototype.constructor=wb;function oa(a){return a.b?a.b.id:null}function xb(){this.b=0;this.context=new ma;this.a={}} xb.prototype.update=function(a){var b=Date.now();a.v&&(this.b=a.v);if(a["static"])for(e in a["static"]){var c=na(this.context,e);c||(c=new wb,this.context.push(c));ga(c,a["static"][e],b)}pa(this.context,function(a){a.N===a.B&&(a=N.indexOf(a),-1!==a&&N.splice(a,1))});if(a.live){for(e in a.live)(c=this.a[e])?ia(c,a.live[e],b):c=this.a[e]=new Y(e,250,a.live[e],b);for(var d in a.live){var e=H(this.context,d);(c=e.j[d])?(this.a[d].a.length&&(c.N=Math.max(c.N,ka(this.a[d]).l)),c.Y||(yb(e,c,a.live[d]),M&& a.live[M.id]&&Xa())):E.b=0}}a["static"]&&Na();var f=!1;a.typing&&this.context.a.forEach(function(c){var d=f,e=a.typing,g=!1;if(c.s)for(var k in c.s)e[k]||(delete c.s[k],g=!0);if(e)for(k in e)if(c.j[k]){c.s[k]||(c.s[k]={});for(var m in e[k])c.s[k][m]||(g=!0),c.s[k][m]=b}f=d|g},this);(a["static"]||f)&&Sa();a.config&&(zb=new Ab(a.config),Bb()&&qb.Ya(!1).display(qb.Wa.X))}; setInterval(function(){var a=!1,b=Date.now();qa(function(c){var d=!1,e;for(e in c.s){var f=!0,g;for(g in c.s[e])c.s[e][g]+3E3a.B){var c=E.a[a.id];if(c&&(c=c.a[c.a.length-1])){var d=new XMLHttpRequest;d.open("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.l,!0);d.send(null);a.B=c.l}}0<=b&&(N.splice(b,1),O());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}E=new xb;var Ra=function(){function a(a,c){c.sort(function(){return Math.random()-.5});for(var d=0,e=20;ed/(c.height*c.width))for(e=0;e';document.body.appendChild(b)}};a.open("GET","highlight.pack.js",!0);a.send(null)} function Cb(){var a=M,b=new XMLHttpRequest;b.open("GET","api/hist?room="+a.id,!0);b.onreadystatechange=function(){if(4===b.readyState&&b.response){var c=b.response;try{c=JSON.parse(c)}catch(e){}var d=E.a[a.id];d?d=!!ia(d,c,Date.now()):(E.a[a.id]=new Y(a,100,c,Date.now()),d=!0);d&&(yb(H(E.context,a.id),a,c),a===M&&Xa())}};b.send(null)} function Db(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){W&&(W=0,Va(!0));c=b.response;try{c=JSON.parse(c)}catch(e){c=null}}else W?(W+=Math.floor((W||5)/2),W=Math.min(60,W)):(W=5,Va(!1));a(d,c)}else W&&(W=0,Va(!0)),Db(a)};b.open("GET","api?v="+E.b,!0);b.send(null)}function mb(){var a=new XMLHttpRequest;a.open("POST","api/typing?room="+M.id,!0);a.send(null)} function Eb(a,b){a?(b&&E.update(b),pb()):setTimeout(pb,1E3*W)}function pb(){Db(Eb)}function ib(a){M&&document.getElementById("room_"+M.id).classList.remove("selected");document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");M=a;P=H(E.context,a.id);Wa();Ra(P.b.id,P.m,function(a){document.getElementById("slackCtx").style.backgroundImage="url("+a+")"});(!E.a[M.id]||100>E.a[M.id].a.length)&&Cb()} function kb(a,b,c){var d=M;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)} function Fb(a,b,c){var d=new XMLHttpRequest;b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);c&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:c.text,author_name:I(c.G).name,text:c.text,footer:a.b?K.message:a.name,ts:c.l}])));d.open("POST",b,!0);d.send(null)} function lb(a){if(U){var b=new XMLHttpRequest;b.open("PUT","api/msg?room="+M.id+"&ts="+U.id+"&text="+encodeURIComponent(a),!0);b.send(null);return!0}if("/"===a[0]){var c=a.indexOf(" "),b=a.substr(0,-1===c?void 0:c);a=-1===c?"":a.substr(c);var c=P,d=X.Ga(b);return d?(d.exec(c,M,a.trim()),!0):c&&(b=c.i.data[b])?(c=new XMLHttpRequest,c.open("POST","api/cmd?room="+M.id+"&cmd="+encodeURIComponent(b.name.substr(1))+"&args="+encodeURIComponent(a.trim()),!0),c.send(null),!0):!1}Fb(M,a,R);return!0} function fb(a){var b=new XMLHttpRequest;b.open("DELETE","api/msg?room="+M.id+"&ts="+a.id,!0);b.send(null)}function Za(a,b,c){var d=new XMLHttpRequest;d.open("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0);d.send(null)};function Y(a,b,c,d){D.call(this,a,b,0,c,d)}Y.prototype=Object.create(D.prototype);Y.prototype.constructor=Y;Y.prototype.i=function(a,b){return!0===a.isMeMessage?new Gb(this.id,a,b):!0===a.isNotice?new Hb(this.id,a,b):new Ib(this.id,a,b)}; var Z=function(){function a(a,d){return wa(d,{A:a.context.self.O.A,U:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=$a(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},$:function(c){return b(a,c)}})}function b(a,b){var c=b.indexOf("|");if(-1===c)var d=b;else{d=b.substr(0,c);var g=b.substr(c+1)}if("@"===d[0])if(d=oa(a.context)+"|"+d.substr(1),g=I(d))a=!0,d="#"+g.oa.id,g="@"+g.name;else return null;else if("#"=== d[0])if(d=oa(a.context)+"|"+d.substr(1),g=ra(d))a=!0,d="#"+d,g="#"+g.name;else return null;else{if(!d.match(/^(https?|mailto):\/\//i))return null;a=!1}return{link:d,text:g||d,Ha:a}}return{F:function(a){a.P=!0;return a},S:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},L:function(a){a.c?a.P&&(a.P=!1,a.J()):a.ha().J();return a.c},J:function(b){var c=I(b.G);b.c.l.innerHTML=K.V(b.l);b.c.qa.innerHTML=a(b,b.text);b.c.ia.textContent=c?c.name:b.username||"?";for(var c=document.createDocumentFragment(), e=0,f=b.o.length;e