Переглянути джерело

[add] colorfulNames display a beautiful background below usernames
[bugfix] items in setting menu not managed bu language
[add] link to channel and users when sending a message
[bugfix] when noEmoji is selected, do not parse custom emojis

B Thibault 8 роки тому
батько
коміт
a27ccbc683

+ 11 - 0
cli/config.js

@@ -12,6 +12,8 @@ function Config(configData) {
     this.emojiProvider;
     /** @type{boolean|undefined} */
     this.displayAvatar;
+    /** @type{boolean|undefined} */
+    this.colorfulNames;
 
     // Load global configurations
     for (var i =0, nbConfig = configData.length; i < nbConfig; i++)
@@ -28,6 +30,8 @@ Config.prototype.mergeConfig = function(configData) {
         this.emojiProvider = configData["emojiProvider"];
     if (configData["displayAvatar"] !== undefined)
         this.displayAvatar = configData["displayAvatar"];
+    if (configData["colorfulNames"] !== undefined)
+        this.colorfulNames = configData["colorfulNames"];
 };
 
 /** @return {string|undefined} */
@@ -39,6 +43,10 @@ Config.prototype.isDisplayAvatars = function() {
     return this.displayAvatar !== false;
 };
 
+Config.prototype.isColorfulNames = function() {
+    return this.colorfulNames === true;
+};
+
 Config.prototype.commitNewSettings = function(newSettings) {
     for (var i in newSettings) {
         // Just to check not empty object
@@ -60,6 +68,9 @@ Config.prototype.compileCSS = function() {
         rules[".chatsystem-content .chatmsg-authorGroup .chatmsg-author"] = ["position:initial", "vertical-align:top", "min-width:75px"];
         rules[".chatsystem-content .chatmsg-authorGroup .chatmsg-author-messages"] = ["padding-top:0", "padding-left:0", "display:inline-block", "margin-top:-4px", "flex:1"];
     }
+    if (!this.isColorfulNames()) {
+        rules[".chatsystem-content .chatmsg-authorGroup .chatmsg-author .chatmsg-author-name"] = ["background-color: transparent !important;"];
+    }
     for (var i in rules) {
         css += i +'{';
         rules[i].forEach(function(rule) {

+ 38 - 7
cli/dom.js

@@ -128,11 +128,14 @@ function tryGetCustomEmoji(emoji) {
 }
 
 function makeEmojiDom(emojiCode) {
-    var emoji = tryGetCustomEmoji(emojiCode);
+    if ("makeEmoji" in window) {
+        var emoji = tryGetCustomEmoji(emojiCode);
 
-    if (typeof emoji === "string" && "makeEmoji" in window)
-        emoji = window['makeEmoji'](emoji);
-    return typeof emoji === "string" ? null : emoji;
+        if (typeof emoji === "string")
+            emoji = window["makeEmoji"](emoji);
+        return typeof emoji === "string" ? null : emoji;
+    }
+    return null;
 }
 
 /**
@@ -267,8 +270,36 @@ function doCreateMessageDom(msg) {
     return dom;
 }
 
-function makeUserColor(userName) {
-    return "black";
+function makeUserColor(username) {
+    if (!username.length) {
+        return "black";
+    }
+
+    var hue = 0,
+        saturation = 0,
+        charCodes = [],
+        sumCodes = 0,
+        deviation = 0,
+        maxDev = 0,
+        avgCodes;
+
+    for (var i =0, nbChars = username.length; i < nbChars; i++) {
+        charCodes[i] = username.charCodeAt(i);
+        sumCodes += charCodes[i];
+    }
+    avgCodes = sumCodes / username.length;
+    charCodes.forEach(function(i) {
+        var dev = Math.abs(avgCodes - i);
+        deviation += dev;
+        maxDev = Math.max(dev, maxDev);
+
+        hue = i + ((hue << 5) - hue);
+    });
+    deviation /= username.length;
+
+    hue = 360 * (Math.abs(hue - 60) % 199) / 199;
+    saturation = maxDev === 0 ? 100 : Math.round(Math.min(100, Math.max(75, (deviation / maxDev) * 25 + 75)));
+    return "hsl(" +hue +", 100%, " +saturation +"%)";
 }
 
 /**
@@ -289,7 +320,7 @@ function createMessageGroupDom(user, userName) {
     authorName.href = "#" +user.id;
     if (user) {
         authorName.textContent = user.getName();
-        authorName.style.color = makeUserColor(user.getName());
+        authorName.style.backgroundColor = makeUserColor(user.getName());
         authorImg.src = user.getSmallIcon();
     } else {
         authorName.textContent = userName || "?";

+ 5 - 1
cli/lang/en.js

@@ -61,7 +61,11 @@ lang["en"] = {
 
         "settings-serviceAddButton": "Add a service",
         "settings-serviceListEmpty": "You don't have any service yet. Please add a service to continue.",
-        "settings-serviceAddConfirm": "Next"
+        "settings-serviceAddConfirm": "Next",
+
+        "settings-displayEmojiProviderLbl": "Emoji provider",
+        "settings-displayDisplayAvatarLbl": "Display avatars",
+        "settings-displayColorfulNamesLbl": "Colorful names"
     }
 };
 

+ 5 - 1
cli/lang/fr.js

@@ -61,7 +61,11 @@ lang["fr"] = {
 
         "settings-serviceAddButton": "Ajouter un service",
         "settings-serviceListEmpty": "Vous n'avez pas encore ajouté de service. Ajouter un service pour continuer.",
-        "settings-serviceAddConfirm": "Suivant"
+        "settings-serviceAddConfirm": "Suivant",
+
+        "settings-displayEmojiProviderLbl": "Gestionnaire d'emojis",
+        "settings-displayDisplayAvatarLbl": "Afficher les avatars",
+        "settings-displayColorfulNamesLbl": "Afficher les nomes en couleur"
     }
 };
 

+ 1 - 1
cli/msgFormatter

@@ -1 +1 @@
-Subproject commit a5bd5a053d9bf661791a480c41c81a44510cd6f1
+Subproject commit 69d5c09843df62b28e24bd57fb7634dc1cfed14c

+ 2 - 1
cli/resources.js

@@ -49,7 +49,8 @@ var R = {
             },
             display: {
                 emojiProvider: "settings-displayEmojiProvider",
-                displayAvatar: "settings-displayDisplayAvatar"
+                displayAvatar: "settings-displayDisplayAvatar",
+                colorfulNames: "settings-displayColorfulNames"
             }
         },
         favicon: "linkFavicon"

+ 7 - 0
cli/uiMessage.js

@@ -81,6 +81,8 @@ var AbstractUiMessage = (function() {
         var sep = str.indexOf('|'),
             link,
             text,
+            style,
+            classes,
             isInternal = false;
 
         if (sep === -1) {
@@ -98,6 +100,8 @@ var AbstractUiMessage = (function() {
                 isInternal = true;
                 link = '#' +user.privateRoom.id;
                 text = '@' +user.getName();
+                style = "background-color:" +makeUserColor(user.getName());
+                classes = [ "userLink" ]; // FIXME R.
             } else {
                 return null;
             }
@@ -109,6 +113,7 @@ var AbstractUiMessage = (function() {
                 isInternal = true;
                 link = '#' +newLink;
                 text = '#' +chan.name;
+                classes = [ "chanLink" ]; // FIXME R.
             } else {
                 return null;
             }
@@ -120,6 +125,8 @@ var AbstractUiMessage = (function() {
         return {
             link: link,
             text: text || link,
+            style: style,
+            classes: classes,
             isInternal: isInternal
         };
     },

+ 5 - 0
cli/uiSettings.js

@@ -57,6 +57,7 @@ var Settings = (function() {
         emojiList.appendChild(emojiFrag);
 
         document.getElementById(R.id.settings.display.displayAvatar).checked = CONFIG.isDisplayAvatars();
+        document.getElementById(R.id.settings.display.colorfulNames).checked = CONFIG.isColorfulNames();
 
         displayed = true;
     },
@@ -116,6 +117,10 @@ var Settings = (function() {
         if (displayAvatar !== CONFIG.isDisplayAvatars()) {
             newSettings["displayAvatar"] = displayAvatar;
         }
+        var isColorfulNames = !!document.getElementById(R.id.settings.display.colorfulNames).checked;
+        if (isColorfulNames !== CONFIG.isColorfulNames()) {
+            newSettings["colorfulNames"] = isColorfulNames;
+        }
         CONFIG.commitNewSettings(newSettings);
         close();
     });

+ 106 - 104
srv/public/mimouchat.min.js

@@ -1,135 +1,137 @@
 "use strict";(function(){
-var q;function aa(a){this.id=a;this.version=0}aa.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);this.version=Math.max(this.version,b)};function ba(a){this.mb=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.V=a.category}function ca(){this.a={};this.B=[];this.version=0}
+var q;function aa(a){this.id=a;this.version=0}aa.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);this.version=Math.max(this.version,b)};function ba(a){this.nb=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.V=a.category}function ca(){this.a={};this.B=[];this.version=0}
 ca.prototype.update=function(a,b){a.emoji_use&&(this.a=JSON.parse(a.emoji_use));a.highlight_words?this.B=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.B=a.highlights);this.version=Math.max(this.version,b)};function da(){this.a=null;this.l={};this.i={};this.self=null;this.b={version:0,data:{}};this.h={version:0,data:{}};this.u={};this.$={};this.m=0}function ea(a,b){return b.pv?new u(b.id,a.i[b.user]):new v(b.id)}
 function fa(a,b,c){var d=d||"";b.team&&(a.a||(a.a=new aa(b.team.id)),a.a.update(b.team,c));if(b.users)for(var e=0,f=b.users.length;e<f;e++){var h=a.i[d+b.users[e].id];h||(h=a.i[d+b.users[e].id]=new ga(b.users[e].id));h.update(b.users[e],c)}if(b.channels)for(e=0,f=b.channels.length;e<f;e++)(h=a.l[d+b.channels[e].id])||(h=a.l[d+b.channels[e].id]=ea(a,b.channels[e])),h.update(b.channels[e],a,c,d);b.emojis&&(a.b.data=b.emojis,a.b.version=c);if(void 0!==b.commands){a.h.data={};for(e in b.commands)a.h.data[e]=
-new ba(b.commands[e]);a.h.version=c}b.self&&(a.self=a.i[d+b.self.id]||null,a.self.S||(a.self.S=new ca),b.self.prefs&&a.self.S.update(b.self.prefs,c));b.capacities&&(a.$={},b.capacities.forEach(function(a){this.$[a]=!0},a));a.m=Math.max(a.m,c)}"undefined"!==typeof module&&(module.J.Bb=da,module.J.Cb=aa,module.J.Eb=ba);function v(a){this.id=a;this.A=!1;this.C=0;this.i={};this.version=0}function ha(a,b,c){if(!a.I||a.I<b)a.I=b,a.version=c}
+new ba(b.commands[e]);a.h.version=c}b.self&&(a.self=a.i[d+b.self.id]||null,a.self.S||(a.self.S=new ca),b.self.prefs&&a.self.S.update(b.self.prefs,c));b.capacities&&(a.$={},b.capacities.forEach(function(a){this.$[a]=!0},a));a.m=Math.max(a.m,c)}"undefined"!==typeof module&&(module.J.Cb=da,module.J.Db=aa,module.J.Fb=ba);function v(a){this.id=a;this.A=!1;this.C=0;this.i={};this.version=0}function ha(a,b,c){if(!a.I||a.I<b)a.I=b,a.version=c}
 v.prototype.update=function(a,b,c,d){d=d||"";void 0!==a.name&&(this.name=a.name);void 0!==a.is_archived&&(this.fa=a.is_archived);void 0!==a.is_member&&(this.ba=a.is_member);void 0!==a.last_read&&(this.C=Math.max(parseFloat(a.last_read),this.C));void 0!==a.last_msg&&(this.I=parseFloat(a.last_msg));void 0!==a.is_private&&(this.h=a.is_private);void 0!==a.pins&&(this.b=a.pins);this.A=!!a.is_starred;if(a.members&&(this.i={},a.members))for(var e=0,f=a.members.length;e<f;e++){var h=b.i[d+a.members[e]];this.i[h.id]=
 h;h.l[this.id]=this}a.topic&&(this.qa=a.topic.value,this.G=b.i[d+a.topic.creator],this.ea=a.topic.last_set);a.purpose&&(this.na=a.purpose.value,this.m=b.i[d+a.purpose.creator],this.da=a.purpose.last_set);this.version=Math.max(this.version,c)};function ia(a,b){var c=ja;return{name:c.ia(b,a.name),la:c.ia(b,Object.values(a.i),function(a){return a?a.getName():null}),qa:c.ia(b,a.qa),na:c.ia(b,a.na)}}function u(a,b){v.call(this,a);this.a=b;this.name=b.getName();this.h=!0;b.W=this}u.prototype=Object.create(v.prototype);
-u.prototype.constructor=u;"undefined"!==typeof module&&(module.J.Kb=v,module.J.Jb=u);function y(a,b){this.O=a.user;this.username=a.username;this.id=a.id||a.ts;this.o=parseFloat(a.ts);this.text="";this.s=[];this.A=a.is_starred||!1;this.h=this.F=!1;this.D={};this.version=b;this.update(a,b)}function A(a,b){y.call(this,a,b)}function B(a,b){y.call(this,a,b)}
-y.prototype.update=function(a,b){if(a){if(this.text=a.text||"",a.attachments&&(this.s=a.attachments),this.A=!!a.is_starred,this.F=void 0===a.edited?!1:a.edited,this.h=!!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.D=c}}else this.h=!0;this.version=b};function ka(a,b,c,d,e){this.id="string"===typeof a?a:a.id;this.a=[];this.h=c;this.ib=0;this.m=b;d&&la(this,d,e)}
+u.prototype.constructor=u;"undefined"!==typeof module&&(module.J.Lb=v,module.J.Kb=u);function y(a,b){this.O=a.user;this.username=a.username;this.id=a.id||a.ts;this.o=parseFloat(a.ts);this.text="";this.s=[];this.A=a.is_starred||!1;this.h=this.F=!1;this.D={};this.version=b;this.update(a,b)}function A(a,b){y.call(this,a,b)}function B(a,b){y.call(this,a,b)}
+y.prototype.update=function(a,b){if(a){if(this.text=a.text||"",a.attachments&&(this.s=a.attachments),this.A=!!a.is_starred,this.F=void 0===a.edited?!1:a.edited,this.h=!!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.D=c}}else this.h=!0;this.version=b};function ka(a,b,c,d,e){this.id="string"===typeof a?a:a.id;this.a=[];this.h=c;this.jb=0;this.m=b;d&&la(this,d,e)}
 function la(a,b,c){var d=0;b.forEach(function(a){d=Math.max(this.push(a,c),d)}.bind(a));ma(a);return d}ka.prototype.b=function(a,b){return!0===a.isMeMessage?new A(a,b):!0===a.isNotice?new B(a,b):new y(a,b)};
 ka.prototype.push=function(a,b){for(var c,d=!1,e,f=0,h=this.a.length;f<h;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.m;)this.a.shift();if(this.h)for(a=0;a<this.a.length;a++)this.a[a].version<b-this.h&&this.a.splice(a--,1);return e||0};function oa(a){return a.a[a.a.length-1]}function pa(a,b){for(var c=0,d=a.a.length;c<d;c++)if(a.a[c].id==b)return a.a[c];return null}
-function ma(a){a.a.sort(function(a,c){return a.o-c.o})}A.prototype=Object.create(y.prototype);A.prototype.constructor=A;B.prototype=Object.create(y.prototype);B.prototype.constructor=B;"undefined"!==typeof module&&(module.J={Gb:y,Fb:A,Ib:B,Lb:ka});function ga(a){this.id=a;this.l={};this.W=this.S=null;this.version=0}
-ga.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.Sa=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.ob=a.goal);void 0!==a.phone&&(this.wb=a.phone);void 0!==a.first_name&&(this.Ua=a.first_name);void 0!==a.last_name&&(this.Xa=a.last_name);void 0!==a.real_name&&(this.fb=a.real_name);void 0!==a.isPresent&&(this.M=a.isPresent);a.isBot&&(this.sb=a.isBot);this.version=Math.max(this.version,b)};
-function qa(a){return"api/avatar?user="+a.id}ga.prototype.getName=function(){return this.name||this.fb||this.Ua||this.Xa};"undefined"!==typeof module&&(module.J.Db=ga);function ra(){this.a=[]}ra.prototype.push=function(a){this.a.push(a)};function sa(a,b){for(var c=0,d=a.a.length;c<d;c++)if(b===ta(a.a[c]))return a.a[c];return null}function ua(a,b){for(var c=0,d=a.a.length;c<d;c++){var e=a.a[c],f;for(f in e.l)if(!0===b(e.l[f],f))return}}function va(a){for(var b=C.context,c=0,d=b.a.length;c<d&&!0!==a(b.a[c]);c++);}function D(a,b){for(var c=0,d=a.a.length;c<d;c++)if(a.a[c].l[b])return a.a[c];return null}
-function wa(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].l[a];if(e)return e}return null}function xa(a){for(var b=C.context,c=[],d=0,e=b.a.length;d<e;d++){var f=b.a[d].l,h;for(h in f)a&&!a(f[h],b.a[d],h)||c.push(h)}return c}function F(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].i[a];if(e)return e}return null}"undefined"!==typeof module&&(module.J.Hb=ra);var ja=function(){function a(b,c,d){if(Array.isArray(c)){for(var e=0,f=0,h=c.length;f<h;f++){var n=a(b,c[f],d);if(1===n)return 1;e=Math.max(n,e)}return e}return(c=d?d(c):c)&&void 0!==b&&null!==b?b.length?-1===c.indexOf(b)?0:b.length/c.length:1:0}return{ia:a}}();"undefined"!==typeof module&&(module.J.Mb=ja);var G={},J,ya=[];function za(){if(!c){for(var a=0,b=navigator.languages.length;a<b;a++)if(G.hasOwnProperty(navigator.languages[a])){var c=navigator.languages[a];break}c||(c="en")}J=G[c];console.log("Loading language pack: "+c);if(J.c)for(var d in J.c)if(c=document.getElementById(d))c.textContent=J.c[d];ya.forEach(function(a){a()})};G.fr={Ab:"Utilisateur inconnu",zb:"Channel inconnu",Za:"Nouveau message",message:"Message",Ya:"Reseau",$a:"(visible seulement par vous)",A:"Favoris",l:"Discutions",la:"Membres",eb:"Discutions priv\u00e9es",gb:"Partage sa position GPS",ok:"Ok",Ta:"Annuler",P: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()?"hier, "+
+function ma(a){a.a.sort(function(a,c){return a.o-c.o})}A.prototype=Object.create(y.prototype);A.prototype.constructor=A;B.prototype=Object.create(y.prototype);B.prototype.constructor=B;"undefined"!==typeof module&&(module.J={Hb:y,Gb:A,Jb:B,Mb:ka});function ga(a){this.id=a;this.l={};this.W=this.S=null;this.version=0}
+ga.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.Ta=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.pb=a.goal);void 0!==a.phone&&(this.xb=a.phone);void 0!==a.first_name&&(this.Va=a.first_name);void 0!==a.last_name&&(this.Ya=a.last_name);void 0!==a.real_name&&(this.gb=a.real_name);void 0!==a.isPresent&&(this.M=a.isPresent);a.isBot&&(this.tb=a.isBot);this.version=Math.max(this.version,b)};
+function qa(a){return"api/avatar?user="+a.id}ga.prototype.getName=function(){return this.name||this.gb||this.Va||this.Ya};"undefined"!==typeof module&&(module.J.Eb=ga);function ra(){this.a=[]}ra.prototype.push=function(a){this.a.push(a)};function sa(a,b){for(var c=0,d=a.a.length;c<d;c++)if(b===ta(a.a[c]))return a.a[c];return null}function ua(a,b){for(var c=0,d=a.a.length;c<d;c++){var e=a.a[c],f;for(f in e.l)if(!0===b(e.l[f],f))return}}function va(a){for(var b=C.context,c=0,d=b.a.length;c<d&&!0!==a(b.a[c]);c++);}function D(a,b){for(var c=0,d=a.a.length;c<d;c++)if(a.a[c].l[b])return a.a[c];return null}
+function wa(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].l[a];if(e)return e}return null}function xa(a){for(var b=C.context,c=[],d=0,e=b.a.length;d<e;d++){var f=b.a[d].l,h;for(h in f)a&&!a(f[h],b.a[d],h)||c.push(h)}return c}function F(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].i[a];if(e)return e}return null}"undefined"!==typeof module&&(module.J.Ib=ra);var ja=function(){function a(b,c,d){if(Array.isArray(c)){for(var e=0,f=0,h=c.length;f<h;f++){var k=a(b,c[f],d);if(1===k)return 1;e=Math.max(k,e)}return e}return(c=d?d(c):c)&&void 0!==b&&null!==b?b.length?-1===c.indexOf(b)?0:b.length/c.length:1:0}return{ia:a}}();"undefined"!==typeof module&&(module.J.Nb=ja);var G={},J,ya=[];function za(){if(!c){for(var a=0,b=navigator.languages.length;a<b;a++)if(G.hasOwnProperty(navigator.languages[a])){var c=navigator.languages[a];break}c||(c="en")}J=G[c];console.log("Loading language pack: "+c);if(J.c)for(var d in J.c)if(c=document.getElementById(d))c.textContent=J.c[d];ya.forEach(function(a){a()})};G.fr={Bb:"Utilisateur inconnu",Ab:"Channel inconnu",$a:"Nouveau message",message:"Message",Za:"Reseau",ab:"(visible seulement par vous)",A:"Favoris",l:"Discutions",la:"Membres",fb:"Discutions priv\u00e9es",hb:"Partage sa position GPS",ok:"Ok",Ua:"Annuler",P: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()?"hier, "+
 a.toLocaleTimeString():a.toLocaleString()},ya:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Annuler",neterror:"Impossible de se connecter au chat !",ctxMenuSettings:"Configuration",ctxMenuLogout:"D\u00e9connexion",settingTitle:"Configuration","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",settingCommit:"Appliquer",
-"settings-serviceAddButton":"Ajouter un service","settings-serviceListEmpty":"Vous n'avez pas encore ajout\u00e9 de service. Ajouter un service pour continuer.","settings-serviceAddConfirm":"Suivant"}};G.fr.ab=function(a){return 0===a?"Pas de message \u00e9pingl\u00e9":a+(1===a?" message \u00e9pingl\u00e9":" messages \u00e9pingl\u00e9s")};G.fr.hb=function(a){return 0===a?"Pas de chatteur":a+(1===a?" chatteur":" chatteurs")};G.fr.F=function(a){return"(edit&eacute; "+G.fr.P(a)+")"};
-G.fr.Ea=function(a,b){return"par "+a.getName()+" le "+G.fr.P(b)};G.en={Ab:"Unknown member",zb:"Unknown channel",Za:"New message",message:"Message",Ya:"Network",$a:"(only visible to you)",A:"Starred",l:"Channels",la:"Members",eb:"Direct messages",gb:"Share your GPS location",ok:"Ok",Ta:"Cancel",P: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():
+"settings-serviceAddButton":"Ajouter un service","settings-serviceListEmpty":"Vous n'avez pas encore ajout\u00e9 de service. Ajouter un service pour continuer.","settings-serviceAddConfirm":"Suivant","settings-displayEmojiProviderLbl":"Gestionnaire d'emojis","settings-displayDisplayAvatarLbl":"Afficher les avatars","settings-displayColorfulNamesLbl":"Afficher les nomes en couleur"}};G.fr.bb=function(a){return 0===a?"Pas de message \u00e9pingl\u00e9":a+(1===a?" message \u00e9pingl\u00e9":" messages \u00e9pingl\u00e9s")};
+G.fr.ib=function(a){return 0===a?"Pas de chatteur":a+(1===a?" chatteur":" chatteurs")};G.fr.F=function(a){return"(edit&eacute; "+G.fr.P(a)+")"};G.fr.Ea=function(a,b){return"par "+a.getName()+" le "+G.fr.P(b)};G.en={Bb:"Unknown member",Ab:"Unknown channel",$a:"New message",message:"Message",Za:"Network",ab:"(only visible to you)",A:"Starred",l:"Channels",la:"Members",fb:"Direct messages",hb:"Share your GPS location",ok:"Ok",Ua:"Cancel",P: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()},ya:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Cancel",neterror:"Cannot connect to chat !",ctxMenuSettings:"Settings",ctxMenuLogout:"Logout",settingTitle:"Settings","setting-menu-services":"Services","settings-services-title":"Services","setting-menu-display":"Display","settings-display-title":"Display","setting-menu-privacy":"Privacy","settings-privacy-title":"Privacy",settingCommit:"Apply","settings-serviceAddButton":"Add a service","settings-serviceListEmpty":"You don't have any service yet. Please add a service to continue.",
-"settings-serviceAddConfirm":"Next"}};G.en.ab=function(a){return 0===a?"No pinned messages":a+(1===a?" pinned message":" pinned messages")};G.en.hb=function(a){return 0===a?"No users in this room":a+(1===a?" user":" users")};G.en.F=function(a){return"(edited "+G.en.P(a)+")"};G.en.Ea=function(a,b){return"by "+a.getName()+" on "+G.en.P(b)};var Aa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.Y=c;this.f=null;this.j=[];this.a=d||"";this.ta="<"===this.a;this.Ca="*"===this.a;this.sa="_"===this.a;this.ua="~"===this.a||"-"===this.a;this.h=">"===this.a||"&gt;"===this.a;this.G=":"===this.a;this.Fa="`"===this.a;this.Qa="```"===this.a;this.Ga="\n"===this.a;this.ra=void 0!==d&&-1!==p.B.indexOf(d);this.g=b;this.va=null;this.b=this.Ga||this.ra?c+d.length-1:!1;this.ra&&(this.f=new a(this),this.j.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||k;for(var c=0,e=a.j.length;c<e;c++){var f=
-a.j[c];if(f instanceof b)if(f.b){if(f=d(f))return f}else return f}return null}function e(a,c){a.g instanceof b&&(a.g.j.splice(a.g.j.indexOf(a)+(c?1:0)),a.g.f=a.g.j[a.g.j.length-1],e(a.g,!0))}function f(a){return a.replace("<","&lt;")}function h(a){return a}function n(a){return{link:a,text:a,Wa:!1}}var g,k,p={B:[],aa:h,pa:h,ka:n};b.prototype.Ia=function(){return this.Ca&&!!this.b||this.g instanceof b&&this.g.Ia()};b.prototype.La=function(){return this.sa&&!!this.b||this.g instanceof b&&this.g.La()};
+"settings-serviceAddConfirm":"Next","settings-displayEmojiProviderLbl":"Emoji provider","settings-displayDisplayAvatarLbl":"Display avatars","settings-displayColorfulNamesLbl":"Colorful names"}};G.en.bb=function(a){return 0===a?"No pinned messages":a+(1===a?" pinned message":" pinned messages")};G.en.ib=function(a){return 0===a?"No users in this room":a+(1===a?" user":" users")};G.en.F=function(a){return"(edited "+G.en.P(a)+")"};G.en.Ea=function(a,b){return"by "+a.getName()+" on "+G.en.P(b)};var Aa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.Y=c;this.f=null;this.j=[];this.a=d||"";this.ta="<"===this.a;this.Ca="*"===this.a;this.sa="_"===this.a;this.ua="~"===this.a||"-"===this.a;this.h=">"===this.a||"&gt;"===this.a;this.G=":"===this.a;this.Fa="`"===this.a;this.Qa="```"===this.a;this.Ga="\n"===this.a;this.ra=void 0!==d&&-1!==p.B.indexOf(d);this.g=b;this.va=null;this.b=this.Ga||this.ra?c+d.length-1:!1;this.ra&&(this.f=new a(this),this.j.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||n;for(var c=0,e=a.j.length;c<e;c++){var f=
+a.j[c];if(f instanceof b)if(f.b){if(f=d(f))return f}else return f}return null}function e(a,c){a.g instanceof b&&(a.g.j.splice(a.g.j.indexOf(a)+(c?1:0)),a.g.f=a.g.j[a.g.j.length-1],e(a.g,!0))}function f(a){return a.replace("<","&lt;")}function h(a){return a}function k(a){return{link:a,text:a,Xa:!1}}var g,n,p={B:[],aa:h,pa:h,ka:k};b.prototype.Ia=function(){return this.Ca&&!!this.b||this.g instanceof b&&this.g.Ia()};b.prototype.La=function(){return this.sa&&!!this.b||this.g instanceof b&&this.g.La()};
 b.prototype.Ma=function(){return this.ua&&!!this.b||this.g instanceof b&&this.g.Ma()};b.prototype.ea=function(){return this.G&&!!this.b||this.g instanceof b&&this.g.ea()};b.prototype.Ka=function(){return this.ra&&!!this.b||this.g instanceof b&&this.g.Ka()};b.prototype.Ja=function(){return this.Fa&&!!this.b||this.g instanceof b&&this.g.Ja()};b.prototype.da=function(){return this.Qa&&!!this.b||this.g instanceof b&&this.g.da()};b.prototype.Na=function(){for(var a=0,c=this.j.length;a<c;a++)if(this.j[a]instanceof
-b&&(!this.j[a].b||this.j[a].Na()))return!0;return!1};b.prototype.Oa=function(a){if("<"===this.a&&">"===g[a])return!0;var b=c(g[a-1]);if(!this.h&&g.substr(a,this.a.length)===this.a){if(!b&&(this.Ca||this.sa||this.ua))return!1;if(this.f&&this.Na())return this.f.Ra();if(this.jb())return!0}return"\n"===g[a]&&this.h?!0:!1};b.prototype.jb=function(){for(var a=this;a;){for(var c=0,d=a.j.length;c<d;c++)if(a.j[c]instanceof b||a.j[c].text.length)return!0;a=a.va}return!1};b.prototype.Ra=function(){var a=new b(this.g,
-this.Y,this.a);a.va=this;this.f&&this.f instanceof b&&(a.f=this.f.Ra(),a.j=[a.f]);return a};b.prototype.kb=function(a){return this.G&&(" "===g[a]||"\t"===g[a])||(this.G||this.ta||this.Ca||this.sa||this.ua||this.Fa)&&"\n"===g[a]?!1:!0};b.prototype.lb=function(b){if(this.Fa||this.G||this.Qa||this.ta)return null;if(!this.f||this.f.b||this.f instanceof a){var d=c(g[b-1]),e=c(g[b+1]);if("```"===g.substr(b,3))return"```";var f=k.Ba();if(void 0===f||f){if("&gt;"===g.substr(b,4))return"&gt;";if(">"===g[b])return g[b]}if("`"===
+b&&(!this.j[a].b||this.j[a].Na()))return!0;return!1};b.prototype.Oa=function(a){if("<"===this.a&&">"===g[a])return!0;var b=c(g[a-1]);if(!this.h&&g.substr(a,this.a.length)===this.a){if(!b&&(this.Ca||this.sa||this.ua))return!1;if(this.f&&this.Na())return this.f.Ra();if(this.kb())return!0}return"\n"===g[a]&&this.h?!0:!1};b.prototype.kb=function(){for(var a=this;a;){for(var c=0,d=a.j.length;c<d;c++)if(a.j[c]instanceof b||a.j[c].text.length)return!0;a=a.va}return!1};b.prototype.Ra=function(){var a=new b(this.g,
+this.Y,this.a);a.va=this;this.f&&this.f instanceof b&&(a.f=this.f.Ra(),a.j=[a.f]);return a};b.prototype.lb=function(a){return this.G&&(" "===g[a]||"\t"===g[a])||(this.G||this.ta||this.Ca||this.sa||this.ua||this.Fa)&&"\n"===g[a]?!1:!0};b.prototype.mb=function(b){if(this.Fa||this.G||this.Qa||this.ta)return null;if(!this.f||this.f.b||this.f instanceof a){var d=c(g[b-1]),e=c(g[b+1]);if("```"===g.substr(b,3))return"```";var f=n.Ba();if(void 0===f||f){if("&gt;"===g.substr(b,4))return"&gt;";if(">"===g[b])return g[b]}if("`"===
 g[b]&&!d||"\n"===g[b]||!(-1===["*","~","-","_"].indexOf(g[b])||!e&&void 0!==g[b+1]&&-1==="*~-_<&".split("").indexOf(g[b+1])||d&&void 0!==g[b-1]&&-1==="*~-_<&".split("").indexOf(g[b-1]))||-1!==[":"].indexOf(g[b])&&e||-1!==["<"].indexOf(g[b]))return g[b];d=0;for(e=p.B.length;d<e;d++)if(f=p.B[d],g.substr(b,f.length)===f)return f}return null};a.prototype.Ba=function(){if(""!==this.text.trim())return!1};b.prototype.Ba=function(){for(var a=this.j.length-1;0<=a;a--){var b=this.j[a].Ba();if(void 0!==b)return b}if(this.Ga||
-this.h)return!0};a.prototype.m=function(a){this.text+=g[a];return 1};b.prototype.m=function(c){var d=this.f&&!this.f.b&&this.f.Oa?this.f.Oa(c):null;if(d){var e=this.f.a.length;this.f.Ha(c);d instanceof b&&(this.f=d,this.j.push(d));return e}if(!this.f||this.f.b||this.f instanceof a||this.f.kb(c)){if(d=this.lb(c))return this.f=new b(this,c,d),this.j.push(this.f),this.f.a.length;if(!this.f||this.f.b)this.f=new a(this),this.j.push(this.f);return this.f.m(c)}d=this.f.Y+1;k.ba(this.f.Y);this.f=new a(this);
+this.h)return!0};a.prototype.m=function(a){this.text+=g[a];return 1};b.prototype.m=function(c){var d=this.f&&!this.f.b&&this.f.Oa?this.f.Oa(c):null;if(d){var e=this.f.a.length;this.f.Ha(c);d instanceof b&&(this.f=d,this.j.push(d));return e}if(!this.f||this.f.b||this.f instanceof a||this.f.lb(c)){if(d=this.mb(c))return this.f=new b(this,c,d),this.j.push(this.f),this.f.a.length;if(!this.f||this.f.b)this.f=new a(this),this.j.push(this.f);return this.f.m(c)}d=this.f.Y+1;n.ba(this.f.Y);this.f=new a(this);
 this.f.m(d-1);this.j.pop();this.j.push(this.f);return d-c};b.prototype.Ha=function(a){for(var b=this;b;)b.b=a,b=b.va};b.prototype.ba=function(a){this.b&&this.b>=a&&(this.b=!1);this.j.forEach(function(c){c instanceof b&&c.ba(a)})};a.prototype.innerHTML=function(){if(this.g.ea()){for(var a=this.g;a&&!a.G;)a=a.g;if(a){var a=a.a+this.text+a.a,b=p.aa(a);return b?b:a}return(a=p.aa(this.text))?a:this.text}if(this.g.da()){if("undefined"!==typeof hljs)try{return a=this.text.match(/^\w+/),hljs.configure({useBR:!0,
 tabReplace:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}),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(t){console.error(t)}return this.text.replace(/\n/g,"<br/>")}return p.pa(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.g.da()){a="pre";b.push("codeblock");var d=this.innerHTML()}else this.g.Ja()?(b.push("code"),d=this.innerHTML()):(this.g.ta&&(d=p.ka(this.text))?
-(a="a",c=' href="'+d.link+'"',d.Wa||(c+=' target="_blank"'),d=p.pa(d.text)):d=this.innerHTML(),this.g.Ia()&&b.push("bold"),this.g.La()&&b.push("italic"),this.g.Ma()&&b.push("strike"),this.g.ea()&&b.push("emoji"),this.g.Ka()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+">"};b.prototype.outerHTML=function(){var a="";this.h&&(a+='<span class="quote">');this.Ga&&(a+="<br/>");this.j.forEach(function(b){a+=b.outerHTML()});this.h&&(a+="</span>");return a};b.prototype.Pa=
-function(a){this.h&&!this.b&&this.Ha(a);this.j.forEach(function(c){c instanceof b&&c.Pa(a)})};return function(c,m){m||(m={});p.B=m.B||[];p.aa=m.aa||h;p.pa=m.pa||f;p.ka=m.ka||n;g=c;k=new b(this,0);m=0;c=g.length;do{for(;m<c;)m+=k.m(m);k.Pa(g.length);if(m=d()){e(m,!1);k.ba(m.Y);var l=new a(m.g);l.m(m.Y);m.g.j.push(l);m.g.f=l;m=m.Y+1}else m=void 0}while(void 0!==m);return k.outerHTML()}}();"undefined"!==typeof module&&(module.J.w=Aa);function M(a,b){this.a=new XMLHttpRequest;this.G=b||a;this.method=b?a:"GET";this.a.onreadystatechange=function(){4===this.a.readyState&&(2===Math.floor(this.a.status/100)?Ba(this.m,this.a.status,this.a.statusText,this.a.response):Ba(this.h,this.a.status,this.a.statusText,this.a.response),Ba(this.b,this.a.status,this.a.statusText,this.a.response))}.bind(this)}function Ba(a,b,c,d){a&&a.forEach(function(a){a(b,c,d)})}function Ca(a,b){a.b||(a.b=[]);a.b.push(b);return a}
+(a="a",c=' href="'+d.link+'"',d.style&&(c+=' style="'+d.style+'"'),d.Xa||(c+=' target="_blank"'),d.Sa&&d.Sa.forEach(function(a){b.push(a)}),d=p.pa(d.text)):d=this.innerHTML(),this.g.Ia()&&b.push("bold"),this.g.La()&&b.push("italic"),this.g.Ma()&&b.push("strike"),this.g.ea()&&b.push("emoji"),this.g.Ka()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+">"};b.prototype.outerHTML=function(){var a="";this.h&&(a+='<span class="quote">');this.Ga&&(a+="<br/>");this.j.forEach(function(b){a+=
+b.outerHTML()});this.h&&(a+="</span>");return a};b.prototype.Pa=function(a){this.h&&!this.b&&this.Ha(a);this.j.forEach(function(c){c instanceof b&&c.Pa(a)})};return function(c,m){m||(m={});p.B=m.B||[];p.aa=m.aa||h;p.pa=m.pa||f;p.ka=m.ka||k;g=c;n=new b(this,0);m=0;c=g.length;do{for(;m<c;)m+=n.m(m);n.Pa(g.length);if(m=d()){e(m,!1);n.ba(m.Y);var l=new a(m.g);l.m(m.Y);m.g.j.push(l);m.g.f=l;m=m.Y+1}else m=void 0}while(void 0!==m);return n.outerHTML()}}();"undefined"!==typeof module&&(module.J.w=Aa);function K(a,b){this.a=new XMLHttpRequest;this.G=b||a;this.method=b?a:"GET";this.a.onreadystatechange=function(){4===this.a.readyState&&(2===Math.floor(this.a.status/100)?Ba(this.m,this.a.status,this.a.statusText,this.a.response):Ba(this.h,this.a.status,this.a.statusText,this.a.response),Ba(this.b,this.a.status,this.a.statusText,this.a.response))}.bind(this)}function Ba(a,b,c,d){a&&a.forEach(function(a){a(b,c,d)})}function Ca(a,b){a.b||(a.b=[]);a.b.push(b);return a}
 function Da(a,b){a.m||(a.m=[]);a.m.push(b);return a}function Ea(a,b){a.h||(a.h=[]);a.h.push(b);return a}function Fa(a){a.a.timeout=6E4;return a}function Ga(a,b){a.a.responseType=b;return a}function N(a,b){a.a.open(a.method,a.G,!0);a.a.send(b)};function Ha(a,b){this.title=a;this.content=b;this.c=Ia(this);this.b=Ja(this);this.a=[];this.h=[]}
 function Ia(a){var b=document.createElement("div"),c=document.createElement("header"),d=document.createElement("span"),e=document.createElement("span"),f=document.createElement("div"),h=document.createElement("footer");b.a=document.createElement("span");b.b=document.createElement("span");d.textContent=a.title;"string"==typeof a.content?f.innerHTML=a.content:f.appendChild(a.content);c.className=Ka;d.className=La;e.className=Ma;e.textContent="x";c.appendChild(d);c.appendChild(e);b.appendChild(c);f.className=
-Na;b.appendChild(f);b.b.className=Oa;b.b.textContent=J.Ta;b.b.addEventListener("click",function(){Pa(a,!1)});e.addEventListener("click",function(){Pa(a,!1)});b.a.addEventListener("click",function(){Pa(a,!0)});h.appendChild(b.b);b.a.className=Oa;b.a.textContent=J.ok;h.appendChild(b.a);h.className=Qa+" "+Ra;b.appendChild(h);b.className=Sa;return b}function Pa(a,b){(b?a.a:a.h).forEach(function(a){a()});a.close()}
+Na;b.appendChild(f);b.b.className=Oa;b.b.textContent=J.Ua;b.b.addEventListener("click",function(){Pa(a,!1)});e.addEventListener("click",function(){Pa(a,!1)});b.a.addEventListener("click",function(){Pa(a,!0)});h.appendChild(b.b);b.a.className=Oa;b.a.textContent=J.ok;h.appendChild(b.a);h.className=Qa+" "+Ra;b.appendChild(h);b.className=Sa;return b}function Pa(a,b){(b?a.a:a.h).forEach(function(a){a()});a.close()}
 function Ja(a){var b=document.createElement("div");b.className=Ta;b.addEventListener("click",function(){Pa(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.oa=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 Oa="button",Qa="button-container",Sa="dialog",Ta="dialog-overlay",Ka="dialog-title",La="dialog-title-label",Ma="dialog-title-close",Na="dialog-body",Ra="dialog-footer";function Wa(a){var b=document.createElement("lh");b.textContent=a;b.className="chat-command-header";return b}
-function Xa(a,b){var c=document.createElement("li"),d=document.createElement("span");d.className="chat-command-name";if("string"===typeof a)b&&c.appendChild(b),d.textContent=a,c.appendChild(d);else{b=document.createElement("span");var e=document.createElement("span");d.textContent=a.name;b.textContent=a.usage;e.textContent=a.mb;b.className="chat-command-usage";e.className="chat-command-desc";c.appendChild(d);c.appendChild(b);c.appendChild(e)}c.dataset.input=d.textContent;c.className="chat-command-item";
+function Xa(a,b){var c=document.createElement("li"),d=document.createElement("span");d.className="chat-command-name";if("string"===typeof a)b&&c.appendChild(b),d.textContent=a,c.appendChild(d);else{b=document.createElement("span");var e=document.createElement("span");d.textContent=a.name;b.textContent=a.usage;e.textContent=a.nb;b.className="chat-command-usage";e.className="chat-command-desc";c.appendChild(d);c.appendChild(b);c.appendChild(e)}c.dataset.input=d.textContent;c.className="chat-command-item";
 return c}
-function Ya(a){var b,c=document.getElementById("slashList");c.dataset.cursor&&delete c.dataset.cursor;var d=[],e=a.value;if(a.selectionStart===a.selectionEnd&&a.selectionStart){for(var f=a.selectionStart,h=a.selectionEnd;f&&" "!==e[f-1];f--);for(b=e.length;h<b&&" "!==e[h];h++);if(f!==h&&0<h-f-1){if("#"===e[f]){var n=O.l;b=e.substr(f+1,h-f-1);for(var g in n)n[g].name.length>=b.length&&n[g].name.substr(0,b.length)===b&&d.push(n[g])}else if("@"===e[f])for(g in n=P instanceof u?O.i:P.i,b=e.substr(f+1,
-h-f-1),n){var k=n[g].getName();k.length>=b.length&&k.substr(0,b.length)===b&&d.push(n[g])}else if(":"===e[f]&&window.searchEmojis){b=e.substr(f+1,h-f-1);k=window.searchEmojis(b);for(n in k){var k=window.makeEmoji(n,!1),p=document.createElement("span");p.appendChild(k);p.className="emoji-small";d.push({name:":"+n+":",za:p,ma:Za.name})}for(g in O.b.data)g.length>=b.length&&g.substr(0,b.length)===b&&(n=document.createElement("span"),n.className="emoji-small",n.appendChild($a(g)),d.push({name:":"+g+":",
-za:n,ma:"custom"}))}d.length&&(c.dataset.cursor=JSON.stringify([f,h]))}}if(!d.length&&"/"===e[0]){g=e.indexOf(" ");f=-1!==g;g=-1===g?e.length:g;b=e.substr(0,g);f?(a=ab.Va(b))&&d.push(a):(d=ab.nb(b),c.dataset.cursor=JSON.stringify([0,a.selectionEnd]));a=O?O.h.data:{};for(var l in a)e=a[l],(!f&&e.name.substr(0,g)===b||f&&e.name===b)&&d.push(e);d.sort(function(a,b){return a.V.localeCompare(b.V)||a.name.localeCompare(b.name)})}c.textContent="";if(d.length){l=document.createDocumentFragment();g=0;for(a=
+function Ya(a){var b,c=document.getElementById("slashList");c.dataset.cursor&&delete c.dataset.cursor;var d=[],e=a.value;if(a.selectionStart===a.selectionEnd&&a.selectionStart){for(var f=a.selectionStart,h=a.selectionEnd;f&&" "!==e[f-1];f--);for(b=e.length;h<b&&" "!==e[h];h++);if(f!==h&&0<h-f-1){if("#"===e[f]){var k=O.l;b=e.substr(f+1,h-f-1);for(var g in k)k[g].name.length>=b.length&&k[g].name.substr(0,b.length)===b&&d.push(k[g])}else if("@"===e[f])for(g in k=P instanceof u?O.i:P.i,b=e.substr(f+1,
+h-f-1),k){var n=k[g].getName();n.length>=b.length&&n.substr(0,b.length)===b&&d.push(k[g])}else if(":"===e[f]&&window.searchEmojis){b=e.substr(f+1,h-f-1);n=window.searchEmojis(b);for(k in n){var n=window.makeEmoji(k,!1),p=document.createElement("span");p.appendChild(n);p.className="emoji-small";d.push({name:":"+k+":",za:p,ma:Za.name})}for(g in O.b.data)g.length>=b.length&&g.substr(0,b.length)===b&&(k=document.createElement("span"),k.className="emoji-small",k.appendChild($a(g)),d.push({name:":"+g+":",
+za:k,ma:"custom"}))}d.length&&(c.dataset.cursor=JSON.stringify([f,h]))}}if(!d.length&&"/"===e[0]){g=e.indexOf(" ");f=-1!==g;g=-1===g?e.length:g;b=e.substr(0,g);f?(a=ab.Wa(b))&&d.push(a):(d=ab.ob(b),c.dataset.cursor=JSON.stringify([0,a.selectionEnd]));a=O?O.h.data:{};for(var l in a)e=a[l],(!f&&e.name.substr(0,g)===b||f&&e.name===b)&&d.push(e);d.sort(function(a,b){return a.V.localeCompare(b.V)||a.name.localeCompare(b.name)})}c.textContent="";if(d.length){l=document.createDocumentFragment();g=0;for(a=
 d.length;g<a;g++)if(e=d[g],e instanceof ga){if(!m){var m=!0;l.appendChild(Wa(J.la))}b=document.createElement("span");b.className="chat-command-userIcon";b.style.backgroundImage='url("'+qa(e)+'")';l.appendChild(Xa("@"+e.getName(),b))}else e instanceof v?(m||(m=!0,l.appendChild(Wa(J.l))),l.appendChild(Xa("#"+e.name))):e.za?(m!==e.ma&&(m=e.ma,l.appendChild(Wa(e.ma))),l.appendChild(Xa(e.name,e.za))):(m!==e.V&&(m=e.V,l.appendChild(Wa(e.V))),l.appendChild(Xa(e)));c.appendChild(l)}}
-function bb(a){if(Q)return N(new M("PUT","api/msg?room="+P.id+"&ts="+Q.id+"&text="+encodeURIComponent(a))),!0;if("/"===a[0]){var b=a.indexOf(" "),c=a.substr(0,-1===b?void 0:b);a=-1===b?"":a.substr(b);var b=O,d=ab.Va(c);return d?(d.exec(b,P,a.trim()),!0):b&&(c=b.h.data[c])?(N(new M("POST","api/cmd?room="+P.id+"&cmd="+encodeURIComponent(c.name.substr(1))+"&args="+encodeURIComponent(a.trim()))),!0):!1}cb(P,a,R);return!0}function S(){document.getElementById("msgInput").focus()}
-function db(){function a(a){for(var b=1,c=0,d=a.value.length;c<d;c++)"\n"===a.value[c]&&b++;a.rows=Math.min(5,b)}var b=0,c=document.getElementById("msgInput");c.addEventListener("input",function(){if(P){var c=Date.now();b+3E3<c&&(O.self.M||P instanceof u)&&(N(new M("POST","api/typing?room="+P.id)),b=c);Ya(this);a(this)}});c.addEventListener("keydown",function(b){if(9===b.keyCode)return b.preventDefault(),!1;if(13===b.keyCode)return b.preventDefault(),b.shiftKey||b.altKey||b.ctrlKey?(this.value+="\n",
+function bb(a){if(Q)return N(new K("PUT","api/msg?room="+P.id+"&ts="+Q.id+"&text="+encodeURIComponent(a))),!0;if("/"===a[0]){var b=a.indexOf(" "),c=a.substr(0,-1===b?void 0:b);a=-1===b?"":a.substr(b);var b=O,d=ab.Wa(c);return d?(d.exec(b,P,a.trim()),!0):b&&(c=b.h.data[c])?(N(new K("POST","api/cmd?room="+P.id+"&cmd="+encodeURIComponent(c.name.substr(1))+"&args="+encodeURIComponent(a.trim()))),!0):!1}cb(P,a,R);return!0}function S(){document.getElementById("msgInput").focus()}
+function db(){function a(a){for(var b=1,c=0,d=a.value.length;c<d;c++)"\n"===a.value[c]&&b++;a.rows=Math.min(5,b)}var b=0,c=document.getElementById("msgInput");c.addEventListener("input",function(){if(P){var c=Date.now();b+3E3<c&&(O.self.M||P instanceof u)&&(N(new K("POST","api/typing?room="+P.id)),b=c);Ya(this);a(this)}});c.addEventListener("keydown",function(b){if(9===b.keyCode)return b.preventDefault(),!1;if(13===b.keyCode)return b.preventDefault(),b.shiftKey||b.altKey||b.ctrlKey?(this.value+="\n",
 a(this)):eb(),!1});document.getElementById("slashList").addEventListener("click",function(a){if(P){var b=a.target;if(a=this.dataset.cursor)for(a=JSON.parse(a);b&&b!==this;){if(b.dataset.input){var c=document.getElementById("msgInput"),b=b.dataset.input;c.value.length<=a[1]&&(b+=" ");c.value=c.value.substr(0,a[0])+b+c.value.substr(a[1]);c.selectionStart=c.selectionEnd=a[0]+b.length;Ya(c);c.focus();break}b=b.parentElement}}})};var fb=[],gb=0;
-function hb(){var a=document.createDocumentFragment(),b=xa(function(a){return!a.fa&&!1!==a.ba}),c=[],d=[],e=[],f=[],h={};b.sort(function(a,b){if(a[0]!==b[0])return a[0]-b[0];var c=D(C.context,a),d=D(C.context,b);a=c.l[a];b=d.l[b];return a.name===b.name?(h[a.id]=J.ya(c.a.name,a.name),h[b.id]=J.ya(d.a.name,b.name),c.a.name.localeCompare(d.a.name)):a.name.localeCompare(b.name)});b.forEach(function(a){a=wa(a);if(a instanceof u){var b;if(b=!a.a.Sa){var n=h[a.id];b=document.createElement("li");var p=document.createElement("a");
-b.id="room_"+a.id;p.href="#"+a.id;b.className="chat-context-room chat-ims presence-indicator";p.textContent=n||a.a.getName();b.appendChild(ib());b.appendChild(p);a.a.M||b.classList.add("presence-away");P===a&&b.classList.add("selected");a.I!==a.C&&void 0!==a.I&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=n=b}b&&(a.A?c.push(n):f.push(n))}else if(n=h[a.id],b=document.createElement("li"),p=document.createElement("a"),b.id="room_"+a.id,p.href="#"+a.id,a.h?(b.className="chat-context-room chat-group",
-b.dataset.count=Object.keys(a.i||{}).length):b.className="chat-context-room chat-channel",P===a&&b.classList.add("selected"),p.textContent=n||a.name,b.appendChild(ib()),b.appendChild(p),a.I!==a.C&&void 0!==a.I&&(b.classList.add("unread"),0<=T.indexOf(a)&&b.classList.add("unreadHi")),n=b)a.A?c.push(n):a.h?e.push(n):d.push(n)});c.length&&a.appendChild(jb(J.A));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(jb(J.l));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});
-f.length&&a.appendChild(jb(J.eb));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);kb.apply(document.getElementById("chanSearch"));lb();mb();O&&nb(O.a.id,O.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"})}
+function hb(){var a=document.createDocumentFragment(),b=xa(function(a){return!a.fa&&!1!==a.ba}),c=[],d=[],e=[],f=[],h={};b.sort(function(a,b){if(a[0]!==b[0])return a[0]-b[0];var c=D(C.context,a),d=D(C.context,b);a=c.l[a];b=d.l[b];return a.name===b.name?(h[a.id]=J.ya(c.a.name,a.name),h[b.id]=J.ya(d.a.name,b.name),c.a.name.localeCompare(d.a.name)):a.name.localeCompare(b.name)});b.forEach(function(a){a=wa(a);if(a instanceof u){var b;if(b=!a.a.Ta){var k=h[a.id];b=document.createElement("li");var p=document.createElement("a");
+b.id="room_"+a.id;p.href="#"+a.id;b.className="chat-context-room chat-ims presence-indicator";p.textContent=k||a.a.getName();b.appendChild(ib());b.appendChild(p);a.a.M||b.classList.add("presence-away");P===a&&b.classList.add("selected");a.I!==a.C&&void 0!==a.I&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=k=b}b&&(a.A?c.push(k):f.push(k))}else if(k=h[a.id],b=document.createElement("li"),p=document.createElement("a"),b.id="room_"+a.id,p.href="#"+a.id,a.h?(b.className="chat-context-room chat-group",
+b.dataset.count=Object.keys(a.i||{}).length):b.className="chat-context-room chat-channel",P===a&&b.classList.add("selected"),p.textContent=k||a.name,b.appendChild(ib()),b.appendChild(p),a.I!==a.C&&void 0!==a.I&&(b.classList.add("unread"),0<=T.indexOf(a)&&b.classList.add("unreadHi")),k=b)a.A?c.push(k):a.h?e.push(k):d.push(k)});c.length&&a.appendChild(jb(J.A));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(jb(J.l));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});
+f.length&&a.appendChild(jb(J.fb));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);kb.apply(document.getElementById("chanSearch"));lb();mb();O&&nb(O.a.id,O.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"})}
 function ob(){va(function(a){var b=a.u,c;for(c in a.self.l)if(!a.self.l[c].fa){var d=document.getElementById("room_"+c);b[c]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing")}for(var e in a.i)(c=a.i[e].W)&&!c.fa&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing"))});pb()}
 function pb(){var a;document.getElementById("whoistyping").textContent="";if(O&&P&&(a=O.u[P.id])){var b=document.createDocumentFragment(),c=!1,d;for(d in a)(a=F(d))?b.appendChild(qb(a)):c=!0;c&&(C.b=0);document.getElementById("whoistyping").appendChild(b)}}function rb(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");mb()}
 function sb(){var a=P.name||(P.a?P.a.getName():void 0);if(!a){console.error("No name provided for ",P);var a=[],b;for(b in P.i)a.push(P.i[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;tb();S();document.getElementById("fileUploadContainer").classList.add("hidden");ub();R&&(R=null,U());Q&&(Q=null,U());mb();pb()}
 function U(){if(R){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){R=null;U()});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="";S()}
 function vb(){if(Q){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){Q=null;vb()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(Q.K());document.getElementById("msgInput").value=Q.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";S()}
-window.toggleReaction=function(a,b,c){var d=C.a[a],e,f;(d=C.a[a])&&(e=pa(d,b))&&(f=D(C.context,a))&&(e.D[c]&&-1!==e.D[c].indexOf(f.self.id)?N(new M("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c))):wb(a,b,c))};function xb(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
-function mb(){var a=T.length,b="";if(V)b="!"+J.Ya+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",xb(a,a);else{var c=0;ua(C.context,function(a){a.I>a.C&&c++});c&&(b="("+c+")");xb(0,c)}!b.length&&P&&(b=P.name);document.title=b.length?b:"Mimouchat"}
-function yb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(gb+3E4<a){var b=new Notification(J.Za);gb=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
+window.toggleReaction=function(a,b,c){var d=C.a[a],e,f;(d=C.a[a])&&(e=pa(d,b))&&(f=D(C.context,a))&&(e.D[c]&&-1!==e.D[c].indexOf(f.self.id)?N(new K("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c))):wb(a,b,c))};function xb(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
+function mb(){var a=T.length,b="";if(V)b="!"+J.Za+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",xb(a,a);else{var c=0;ua(C.context,function(a){a.I>a.C&&c++});c&&(b="("+c+")");xb(0,c)}!b.length&&P&&(b=P.name);document.title=b.length?b:"Mimouchat"}
+function yb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(gb+3E4<a){var b=new Notification(J.$a);gb=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
 function tb(){var a=document.createDocumentFragment(),b=P.id,c=null,d=0,e=null,f;P.A?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");fb=[];C.a[b]&&C.a[b].a.forEach(function(b){if(b.h)b.X();else{var h=b.L(),g=!1;c&&c.O===b.O&&b.O?30>Math.abs(d-b.o)&&!(b instanceof A)?e.classList.add("chatmsg-same-ts"):d=b.o:(d=b.o,g=!0);(!c||c.o<=P.C)&&b.o>P.C?h.classList.add("chatmsg-first-unread"):h.classList.remove("chatmsg-first-unread");
-if(b instanceof A)e=c=null,d=0,a.appendChild(h),f=null;else{if(g||!f){var g=F(b.O),k=b.username,p=document.createElement("div"),l=document.createElement("div"),m=document.createElement("a"),t=document.createElement("img");p.ga=document.createElement("span");p.ga.className="chatmsg-author-img-wrapper";t.className="chatmsg-author-img";m.className="chatmsg-author-name";m.href="#"+g.id;g?(m.textContent=g.getName(),m.style.color="black",t.src=qa(g)):(m.textContent=k||"?",t.src="");p.ga.appendChild(t);
-l.appendChild(p.ga);l.appendChild(m);l.className="chatmsg-author";p.className="chatmsg-authorGroup";p.appendChild(l);p.content=document.createElement("div");p.content.className="chatmsg-author-messages";p.appendChild(p.content);f=p;fb.push(f);a.appendChild(f)}c=b;e=h;f.content.appendChild(h)}}});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;zb();window.hasFocus&&ub()}
-function Ab(a,b){if(a.classList.contains("chatmsg-hover-reply"))Q&&(Q=null,vb()),R!==b&&(R=b,U());else if(a.classList.contains("chatmsg-hover-reaction")){var c=P.id,d=b.id;Bb.oa(document.body,O,function(a){a&&wb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(R&&(R=null,U()),Q!==b&&(Q=b,vb())):a.classList.contains("chatmsg-hover-star")?b.A?N(new M("DELETE","api/starMsg?room="+P.id+"&msgId="+b.id)):N(new M("POST","api/starMsg?room="+P.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-pin")?
-b.pinned?Cb(P,b):N(new M("POST","api/pinMsg?room="+P.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-remove")&&(R&&(R=null,U()),Q&&(Q=null,vb()),N(new M("DELETE","api/msg?room="+P.id+"&ts="+b.id)))}
-function Db(a){function b(a,b){for(b=b||a.target;b!==a.currentTarget&&b;){if(b.id&&b.classList.contains("chatmsg-item"))return b.id;b=b.parentElement}}for(var c=a.target;c!==a.currentTarget&&c&&!c.classList.contains("chatmsg-hover");){var d;if(c.parentElement&&c.classList.contains("chatmsg-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=pa(C.a[P.id],d))&&a.s[e]&&a.s[e].actions&&a.s[e].actions[f]&&
-Eb(a,a.s[e],a.s[e].actions[f]);break}}if(c.parentElement&&c.parentElement.classList.contains("chatmsg-hover")){if(d=b(a,c))d=d.substr(d.lastIndexOf("_")+1),(a=pa(C.a[P.id],d))&&Ab(c,a);break}c=c.parentElement}}
-function Eb(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},h=new M("POST","api/attachmentAction?serviceId="+a.O);N(h,JSON.stringify(d))}var e=P.id;c.confirm?Va(Ua(new Ha(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).oa():d()}
-function zb(){if(!1!==W.a){var a=document.getElementById("chatWindow").getBoundingClientRect().top;fb.forEach(function(b){var c=b.ga,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px"})}}
-document.addEventListener("DOMContentLoaded",function(){za();Fb();db();var a=document.getElementById("chanSearch");a.addEventListener("input",kb);a.addEventListener("blur",kb);document.getElementById("chatWindow").addEventListener("click",Db);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&lb()});document.addEventListener("mouseover",function(a){a=a.target;if(X.tb(a))X.Z();else{for(;a&&a!==this;){if("A"===a.nodeName){var b=a.href,d=b.indexOf("#");
-if(0<=d){b=b.substr(d+1);if(d=D(C.context,b)){X.bb(d,d.l[b]).show(a);return}a:{for(var d=C.context,e=0,f=d.a.length;e<f;e++)if(d.a[e].i[b]){d=d.a[e];break a}d=null}if(d&&(b=d.i[b].W)){X.bb(d,b).show(a);return}}}a=a.parentElement}X.qb()}});document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();P&&(P.A?N(new M("POST","api/unstarChannel?room="+P.id)):N(new M("POST","api/starChannel?room="+P.id)));return!1});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("ctxMenuLogout").addEventListener("click",Gb);document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();Hb.display()});document.getElementById("fileUploadForm").addEventListener("submit",function(a){a.preventDefault();
-a=document.getElementById("fileUploadInput");var b=a.value;b&&(b=b.substr(b.lastIndexOf("\\")+1),Ib(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();P&&document.getElementById("fileUploadContainer").classList.remove("hidden");
-return!1});document.getElementById("msgFormSubmit").addEventListener("click",function(a){a.preventDefault();eb();return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();eb();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;gb=0;P&&ub();S()});document.getElementById("chatWindow").addEventListener("scroll",zb);window.hasFocus=!0;document.getElementById("emojiButton").addEventListener("click",
-function(){O&&Bb.oa(document.body,O,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");S()})});Jb()});function eb(){var a=document.getElementById("msgInput");P&&a.value&&bb(a.value)&&(a.value="",R&&(R=null,U()),Q&&(Q=null,U()),document.getElementById("slashList").textContent="");S()};var Hb=function(){function a(){document.getElementById("settings").classList.add("hidden");c=!1}function b(a){d&&(document.getElementById("settings").classList.remove("display-"+d),document.getElementById("setting-menu-"+d).classList.remove("selected"),document.getElementById("settings-serviceAddSection").classList.add("hidden"));document.getElementById("settings").classList.add("display-"+a);document.getElementById("setting-menu-"+a).classList.add("selected");d=a}var c=!1,d=null,e={T:"services",
-display:"display",Nb:"privacy"};document.getElementById("settingMenuItems").addEventListener("click",function(a){for(var c=a.target;a.currentTarget!==c&&c;c=c.parentNode)if(c.dataset&&c.dataset.target)for(var d in e)if(e[d]===c.dataset.target){b(e[d]);return}});document.getElementById("settingDiscardClose").addEventListener("click",a);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});document.getElementById("settingCommit").addEventListener("click",function(){var b={};document.getElementById("settings-displayEmojiProvider").value!==W.b&&(b.emojiProvider=document.getElementById("settings-displayEmojiProvider").value);var c=!!document.getElementById("settings-displayDisplayAvatar").checked;
-c!==(!1!==W.a)&&(b.displayAvatar=c);var c=W,d;for(d in b){Kb(c,b);Lb();N(new M("POST","api/settings?service=null&device=null"),JSON.stringify(b));break}a()});return{display:function(a){if(!c){document.getElementById("settings").classList.remove("hidden");var d=document.createDocumentFragment(),f=!1,g;for(g in W.T){var k=W.T[g];for(m in k){var f=document.createElement("li"),p=document.createElement("span"),l=document.createElement("span");p.textContent=g;l.textContent=k[m];f.className="settings-service-list-item";
-p.className="settings-service-list-item-provider";l.className="settings-service-list-item-service";f.appendChild(p);f.appendChild(l);d.appendChild(f);f=!0}}k=document.getElementById("settings-serviceList");k.textContent="";f?(document.getElementById("settings-serviceListEmpty").classList.remove("hidden"),k.appendChild(d)):document.getElementById("settings-serviceListEmpty").classList.add("hidden");d=document.createDocumentFragment();k=document.getElementById("settings-displayEmojiProvider");for(g in Mb){var m=
-document.createElement("option");m.value=g;m.textContent=Mb[g].name;Mb[g]===Za&&(m.selected=!0);d.appendChild(m)}k.textContent="";k.appendChild(d);document.getElementById("settings-displayDisplayAvatar").checked=!1!==W.a;c=!0}b(a||e.T);return this},yb:function(){return this},vb:e}}();function Nb(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.R=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"),h=e.getContext("2d"),n=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)))},g=function(a,d,e,g){h.fillStyle="#808080";h.fillRect(0,0,300,300);f.fillStyle="#808080";f.fillRect(0,0,300,300);var p=Math.pow(2,a),m=(e+180)/360*p,l=(1-Math.log(Math.tan(d*Math.PI/180)+1/Math.cos(d*Math.PI/180))/Math.PI)/2*p,k=Math.floor(m),K=Math.floor(l),
-na=g?100*g/n(180/Math.PI*Math.atan(.5*(Math.exp(Math.PI-2*Math.PI*K/p)-Math.exp(-(Math.PI-2*Math.PI*K/p)))),k/p*360-180,(k+1)/p*360-180):0;d=b;for(e=0;3>e;e++)for(g=0;3>g;g++)c(a,k+e-1,K+g-1,{rb:e,ub:g,ib:d}).then(function(a){if(a.ib===b){h.drawImage(a.R,100*a.rb,100*a.ub,100,100);a=m-k;var c=l-K;a=100*a+100;c=100*c+100;f.putImageData(h.getImageData(0,0,300,300),0,0);void 0!==na&&(f.beginPath(),f.arc(a,c,Math.max(na,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===na||25<na)f.strokeStyle="rgba(244, 146, 66, 1)",f.beginPath(),f.moveTo(a-5,c-5),f.lineTo(a+5,c+5),f.stroke(),f.moveTo(a+5,c-5),f.lineTo(a-5,c+5),f.stroke()}})},k,p=function(c){c=Math.max(4,Math.min(19,c));k!==c&&(b++,k=c,g(k,Number(a.latitude),Number(a.longitude),Number(a.accuracy)))};p(12);var e=document.createElement("div"),l=document.createElement("div"),m=document.createElement("button"),t=document.createElement("button");e.className=
-"OSM-wrapper";d.className="OSM-canvas";l.className="OSM-controls";t.className="OSM-controls-zoomMin";m.className="OSM-controls-zoomPlus";t.addEventListener("click",function(){p(k-1)});m.addEventListener("click",function(){p(k+1)});l.appendChild(t);l.appendChild(m);e.appendChild(d);e.appendChild(l);return e}};function ib(){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 jb=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
-function Ob(a){var b={},c=a;if(O)for(var d=O;!b[a];){var e=d.b.data[a];if(e)if("alias:"==e.substr(0,6))b[a]=!0,a=e.substr(6);else return a=document.createElement("span"),a.className="emoji-custom emoji",a.style.backgroundImage="url('"+e+"')",a.textContent=":"+c+":",a.title=c,a;else return a}return c}function $a(a){a=Ob(a);"string"===typeof a&&"makeEmoji"in window&&(a=window.makeEmoji(a));return"string"===typeof a?null:a}
-function Pb(a){var b=a.b,c=document.createElement("div"),d=document.createElement("div");c.ca=document.createElement("ul");c.s=document.createElement("ul");c.D=document.createElement("ul");c.o=document.createElement("div");c.Da=document.createElement("div");c.xa=document.createElement("span");c.id=b+"_"+a.id;c.className="chatmsg-item";c.o.className="chatmsg-ts";c.Da.className="chatmsg-msg";c.xa.className="chatmsg-author-name";var b=c.ca,e=a.context.$;a:{for(var f=C.context,h=0,n=f.a.length;h<n;h++)if(f.a[h].self.id===
+if(b instanceof A)e=c=null,d=0,a.appendChild(h),f=null;else{if(g||!f){var g=F(b.O),n=b.username,p=document.createElement("div"),l=document.createElement("div"),m=document.createElement("a"),t=document.createElement("img");p.ga=document.createElement("span");p.ga.className="chatmsg-author-img-wrapper";t.className="chatmsg-author-img";m.className="chatmsg-author-name";m.href="#"+g.id;g?(m.textContent=g.getName(),m.style.backgroundColor=zb(g.getName()),t.src=qa(g)):(m.textContent=n||"?",t.src="");p.ga.appendChild(t);
+l.appendChild(p.ga);l.appendChild(m);l.className="chatmsg-author";p.className="chatmsg-authorGroup";p.appendChild(l);p.content=document.createElement("div");p.content.className="chatmsg-author-messages";p.appendChild(p.content);f=p;fb.push(f);a.appendChild(f)}c=b;e=h;f.content.appendChild(h)}}});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;Ab();window.hasFocus&&ub()}
+function Bb(a,b){if(a.classList.contains("chatmsg-hover-reply"))Q&&(Q=null,vb()),R!==b&&(R=b,U());else if(a.classList.contains("chatmsg-hover-reaction")){var c=P.id,d=b.id;Cb.oa(document.body,O,function(a){a&&wb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(R&&(R=null,U()),Q!==b&&(Q=b,vb())):a.classList.contains("chatmsg-hover-star")?b.A?N(new K("DELETE","api/starMsg?room="+P.id+"&msgId="+b.id)):N(new K("POST","api/starMsg?room="+P.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-pin")?
+b.pinned?Db(P,b):N(new K("POST","api/pinMsg?room="+P.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-remove")&&(R&&(R=null,U()),Q&&(Q=null,vb()),N(new K("DELETE","api/msg?room="+P.id+"&ts="+b.id)))}
+function Eb(a){function b(a,b){for(b=b||a.target;b!==a.currentTarget&&b;){if(b.id&&b.classList.contains("chatmsg-item"))return b.id;b=b.parentElement}}for(var c=a.target;c!==a.currentTarget&&c&&!c.classList.contains("chatmsg-hover");){var d;if(c.parentElement&&c.classList.contains("chatmsg-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=pa(C.a[P.id],d))&&a.s[e]&&a.s[e].actions&&a.s[e].actions[f]&&
+Fb(a,a.s[e],a.s[e].actions[f]);break}}if(c.parentElement&&c.parentElement.classList.contains("chatmsg-hover")){if(d=b(a,c))d=d.substr(d.lastIndexOf("_")+1),(a=pa(C.a[P.id],d))&&Bb(c,a);break}c=c.parentElement}}
+function Fb(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},h=new K("POST","api/attachmentAction?serviceId="+a.O);N(h,JSON.stringify(d))}var e=P.id;c.confirm?Va(Ua(new Ha(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).oa():d()}
+function Ab(){if(!1!==W.a){var a=document.getElementById("chatWindow").getBoundingClientRect().top;fb.forEach(function(b){var c=b.ga,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px"})}}
+document.addEventListener("DOMContentLoaded",function(){za();Gb();db();var a=document.getElementById("chanSearch");a.addEventListener("input",kb);a.addEventListener("blur",kb);document.getElementById("chatWindow").addEventListener("click",Eb);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&lb()});document.addEventListener("mouseover",function(a){a=a.target;if(X.ub(a))X.Z();else{for(;a&&a!==this;){if("A"===a.nodeName){var b=a.href,d=b.indexOf("#");
+if(0<=d){b=b.substr(d+1);if(d=D(C.context,b)){X.cb(d,d.l[b]).show(a);return}a:{for(var d=C.context,e=0,f=d.a.length;e<f;e++)if(d.a[e].i[b]){d=d.a[e];break a}d=null}if(d&&(b=d.i[b].W)){X.cb(d,b).show(a);return}}}a=a.parentElement}X.rb()}});document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();P&&(P.A?N(new K("POST","api/unstarChannel?room="+P.id)):N(new K("POST","api/starChannel?room="+P.id)));return!1});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("ctxMenuLogout").addEventListener("click",Hb);document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();Ib.display()});document.getElementById("fileUploadForm").addEventListener("submit",function(a){a.preventDefault();
+a=document.getElementById("fileUploadInput");var b=a.value;b&&(b=b.substr(b.lastIndexOf("\\")+1),Jb(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();P&&document.getElementById("fileUploadContainer").classList.remove("hidden");
+return!1});document.getElementById("msgFormSubmit").addEventListener("click",function(a){a.preventDefault();eb();return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();eb();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;gb=0;P&&ub();S()});document.getElementById("chatWindow").addEventListener("scroll",Ab);window.hasFocus=!0;document.getElementById("emojiButton").addEventListener("click",
+function(){O&&Cb.oa(document.body,O,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");S()})});Kb()});function eb(){var a=document.getElementById("msgInput");P&&a.value&&bb(a.value)&&(a.value="",R&&(R=null,U()),Q&&(Q=null,U()),document.getElementById("slashList").textContent="");S()};var Ib=function(){function a(){document.getElementById("settings").classList.add("hidden");c=!1}function b(a){d&&(document.getElementById("settings").classList.remove("display-"+d),document.getElementById("setting-menu-"+d).classList.remove("selected"),document.getElementById("settings-serviceAddSection").classList.add("hidden"));document.getElementById("settings").classList.add("display-"+a);document.getElementById("setting-menu-"+a).classList.add("selected");d=a}var c=!1,d=null,e={T:"services",
+display:"display",Ob:"privacy"};document.getElementById("settingMenuItems").addEventListener("click",function(a){for(var c=a.target;a.currentTarget!==c&&c;c=c.parentNode)if(c.dataset&&c.dataset.target)for(var d in e)if(e[d]===c.dataset.target){b(e[d]);return}});document.getElementById("settingDiscardClose").addEventListener("click",a);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});document.getElementById("settingCommit").addEventListener("click",function(){var b={};document.getElementById("settings-displayEmojiProvider").value!==W.h&&(b.emojiProvider=document.getElementById("settings-displayEmojiProvider").value);var c=!!document.getElementById("settings-displayDisplayAvatar").checked;
+c!==(!1!==W.a)&&(b.displayAvatar=c);c=!!document.getElementById("settings-displayColorfulNames").checked;c!==(!0===W.b)&&(b.colorfulNames=c);var c=W,d;for(d in b){Lb(c,b);Mb();N(new K("POST","api/settings?service=null&device=null"),JSON.stringify(b));break}a()});return{display:function(a){if(!c){document.getElementById("settings").classList.remove("hidden");var d=document.createDocumentFragment(),f=!1,g;for(g in W.T){var n=W.T[g];for(m in n){var f=document.createElement("li"),p=document.createElement("span"),
+l=document.createElement("span");p.textContent=g;l.textContent=n[m];f.className="settings-service-list-item";p.className="settings-service-list-item-provider";l.className="settings-service-list-item-service";f.appendChild(p);f.appendChild(l);d.appendChild(f);f=!0}}n=document.getElementById("settings-serviceList");n.textContent="";f?(document.getElementById("settings-serviceListEmpty").classList.remove("hidden"),n.appendChild(d)):document.getElementById("settings-serviceListEmpty").classList.add("hidden");
+d=document.createDocumentFragment();n=document.getElementById("settings-displayEmojiProvider");for(g in Nb){var m=document.createElement("option");m.value=g;m.textContent=Nb[g].name;Nb[g]===Za&&(m.selected=!0);d.appendChild(m)}n.textContent="";n.appendChild(d);document.getElementById("settings-displayDisplayAvatar").checked=!1!==W.a;document.getElementById("settings-displayColorfulNames").checked=!0===W.b;c=!0}b(a||e.T);return this},zb:function(){return this},wb:e}}();function Ob(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.R=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"),h=e.getContext("2d"),k=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)))},g=function(a,d,e,g){h.fillStyle="#808080";h.fillRect(0,0,300,300);f.fillStyle="#808080";f.fillRect(0,0,300,300);var p=Math.pow(2,a),m=(e+180)/360*p,n=(1-Math.log(Math.tan(d*Math.PI/180)+1/Math.cos(d*Math.PI/180))/Math.PI)/2*p,l=Math.floor(m),L=Math.floor(n),
+na=g?100*g/k(180/Math.PI*Math.atan(.5*(Math.exp(Math.PI-2*Math.PI*L/p)-Math.exp(-(Math.PI-2*Math.PI*L/p)))),l/p*360-180,(l+1)/p*360-180):0;d=b;for(e=0;3>e;e++)for(g=0;3>g;g++)c(a,l+e-1,L+g-1,{sb:e,vb:g,jb:d}).then(function(a){if(a.jb===b){h.drawImage(a.R,100*a.sb,100*a.vb,100,100);a=m-l;var c=n-L;a=100*a+100;c=100*c+100;f.putImageData(h.getImageData(0,0,300,300),0,0);void 0!==na&&(f.beginPath(),f.arc(a,c,Math.max(na,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===na||25<na)f.strokeStyle="rgba(244, 146, 66, 1)",f.beginPath(),f.moveTo(a-5,c-5),f.lineTo(a+5,c+5),f.stroke(),f.moveTo(a+5,c-5),f.lineTo(a-5,c+5),f.stroke()}})},n,p=function(c){c=Math.max(4,Math.min(19,c));n!==c&&(b++,n=c,g(n,Number(a.latitude),Number(a.longitude),Number(a.accuracy)))};p(12);var e=document.createElement("div"),l=document.createElement("div"),m=document.createElement("button"),t=document.createElement("button");e.className=
+"OSM-wrapper";d.className="OSM-canvas";l.className="OSM-controls";t.className="OSM-controls-zoomMin";m.className="OSM-controls-zoomPlus";t.addEventListener("click",function(){p(n-1)});m.addEventListener("click",function(){p(n+1)});l.appendChild(t);l.appendChild(m);e.appendChild(d);e.appendChild(l);return e}};function ib(){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 jb=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
+function Pb(a){var b={},c=a;if(O)for(var d=O;!b[a];){var e=d.b.data[a];if(e)if("alias:"==e.substr(0,6))b[a]=!0,a=e.substr(6);else return a=document.createElement("span"),a.className="emoji-custom emoji",a.style.backgroundImage="url('"+e+"')",a.textContent=":"+c+":",a.title=c,a;else return a}return c}function $a(a){return"makeEmoji"in window?(a=Pb(a),"string"===typeof a&&(a=window.makeEmoji(a)),"string"===typeof a?null:a):null}
+function Qb(a){var b=a.b,c=document.createElement("div"),d=document.createElement("div");c.ca=document.createElement("ul");c.s=document.createElement("ul");c.D=document.createElement("ul");c.o=document.createElement("div");c.Da=document.createElement("div");c.xa=document.createElement("span");c.id=b+"_"+a.id;c.className="chatmsg-item";c.o.className="chatmsg-ts";c.Da.className="chatmsg-msg";c.xa.className="chatmsg-author-name";var b=c.ca,e=a.context.$;a:{for(var f=C.context,h=0,k=f.a.length;h<k;h++)if(f.a[h].self.id===
 a.O){a=!0;break a}a=!1}e.replyToMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-reply",f.style.backgroundImage='url("repl.svg")',b.appendChild(f));e.reactMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-reaction",f.style.backgroundImage='url("smile.svg")',b.appendChild(f));if(a&&e.editMsg||e.editOtherMsg)f=document.createElement("li"),f.className="chatmsg-hover-edit",f.style.backgroundImage='url("edit.svg")',b.appendChild(f);e.starMsg&&(b.ja=document.createElement("li"),
 b.ja.className="chatmsg-hover-star",b.appendChild(b.ja));e.pinMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-pin",b.appendChild(f),f.style.backgroundImage='url("pin.svg")');if(a&&e.removeMsg||e.moderate)e=document.createElement("li"),e.className="chatmsg-hover-remove",e.style.backgroundImage='url("remove.svg")',b.appendChild(e);c.ca.className="chatmsg-hover";d.appendChild(c.xa);d.appendChild(c.Da);d.appendChild(c.o);d.appendChild(c.s);c.F=document.createElement("div");c.F.className=
-"chatmsg-edited";d.appendChild(c.F);d.appendChild(c.D);d.className="chatmsg-content";c.s.className="chatmsg-attachments";c.D.className="chatmsg-reactions";c.appendChild(d);c.appendChild(c.ca);return c}function Qb(a){var b={good:"#2fa44f",warning:"#de9e31",danger:"#d50200"};if(a){if("#"===a[0])return a;if(b[a])return b[a]}return"#e3e4e6"}
-function Rb(a,b,c){var d=document.createElement("li"),e=document.createElement("div"),f=document.createElement("div"),h=document.createElement("a"),n=document.createElement("div"),g=document.createElement("img"),k=document.createElement("a"),p=document.createElement("div"),l=document.createElement("div"),m=document.createElement("div"),t=document.createElement("img"),z=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=Qb(b.color||"");e.className="chatmsg-attachment-block";
-f.className="chatmsg-attachment-pretext";b.pretext?f.innerHTML=a.w(b.pretext):f.classList.add("hidden");h.target="_blank";b.title?(h.innerHTML=a.w(b.title),b.title_link&&(h.href=b.title_link),h.className="chatmsg-attachment-title"):h.className="hidden chatmsg-attachment-title";k.target="_blank";n.className="chatmsg-author";b.author_name&&(k.innerHTML=a.w(b.author_name),k.href=b.author_link||"",k.className="chatmsg-author-name",g.className="chatmsg-author-img",b.author_icon&&(g.src=b.author_icon,n.appendChild(g)),
-n.appendChild(k));m.className="chatmsg-attachment-thumb";b.thumb_url?(g=document.createElement("img"),g.src=b.thumb_url,m.appendChild(g),e.classList.add("has-thumb"),b.video_html&&(m.dataset.video=b.video_html)):m.classList.add("hidden");p.className="chatmsg-attachment-content";g=a.w(b.text||"");l.className="chatmsg-attachment-text";g&&""!=g?l.innerHTML=g:l.classList.add("hidden");p.appendChild(m);p.appendChild(l);b.geo&&(l=Nb(b.geo))&&p.appendChild(l);t.className="chatmsg-attachment-img";b.image_url?
-t.src=b.image_url:t.classList.add("hidden");z.className="chatmsg-attachment-footer";b.footer&&(l=document.createElement("span"),l.className="chatmsg-attachment-footer-text",l.innerHTML=a.w(b.footer),b.footer_icon&&(m=document.createElement("img"),m.src=b.footer_icon,m.className="chatmsg-attachment-footer-icon",z.appendChild(m)),z.appendChild(l));b.ts&&(l=document.createElement("span"),l.className="chatmsg-ts",l.innerHTML=J.P(b.ts),z.appendChild(l));e.appendChild(h);e.appendChild(n);e.appendChild(p);
+"chatmsg-edited";d.appendChild(c.F);d.appendChild(c.D);d.className="chatmsg-content";c.s.className="chatmsg-attachments";c.D.className="chatmsg-reactions";c.appendChild(d);c.appendChild(c.ca);return c}
+function zb(a){if(!a.length)return"black";for(var b=0,c=0,c=[],d=0,e=0,f=0,h,k=0,g=a.length;k<g;k++)c[k]=a.charCodeAt(k),d+=c[k];h=d/a.length;c.forEach(function(a){var c=Math.abs(h-a);e+=c;f=Math.max(c,f);b=a+((b<<5)-b)});e/=a.length;b=Math.abs(b-60)%199*360/199;c=f?Math.round(Math.min(100,Math.max(75,e/f*25+75))):100;return"hsl("+b+", 100%, "+c+"%)"}function Rb(a){var b={good:"#2fa44f",warning:"#de9e31",danger:"#d50200"};if(a){if("#"===a[0])return a;if(b[a])return b[a]}return"#e3e4e6"}
+function Sb(a,b,c){var d=document.createElement("li"),e=document.createElement("div"),f=document.createElement("div"),h=document.createElement("a"),k=document.createElement("div"),g=document.createElement("img"),n=document.createElement("a"),p=document.createElement("div"),l=document.createElement("div"),m=document.createElement("div"),t=document.createElement("img"),z=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=Rb(b.color||"");e.className="chatmsg-attachment-block";
+f.className="chatmsg-attachment-pretext";b.pretext?f.innerHTML=a.w(b.pretext):f.classList.add("hidden");h.target="_blank";b.title?(h.innerHTML=a.w(b.title),b.title_link&&(h.href=b.title_link),h.className="chatmsg-attachment-title"):h.className="hidden chatmsg-attachment-title";n.target="_blank";k.className="chatmsg-author";b.author_name&&(n.innerHTML=a.w(b.author_name),n.href=b.author_link||"",n.className="chatmsg-author-name",g.className="chatmsg-author-img",b.author_icon&&(g.src=b.author_icon,k.appendChild(g)),
+k.appendChild(n));m.className="chatmsg-attachment-thumb";b.thumb_url?(g=document.createElement("img"),g.src=b.thumb_url,m.appendChild(g),e.classList.add("has-thumb"),b.video_html&&(m.dataset.video=b.video_html)):m.classList.add("hidden");p.className="chatmsg-attachment-content";g=a.w(b.text||"");l.className="chatmsg-attachment-text";g&&""!=g?l.innerHTML=g:l.classList.add("hidden");p.appendChild(m);p.appendChild(l);b.geo&&(l=Ob(b.geo))&&p.appendChild(l);t.className="chatmsg-attachment-img";b.image_url?
+t.src=b.image_url:t.classList.add("hidden");z.className="chatmsg-attachment-footer";b.footer&&(l=document.createElement("span"),l.className="chatmsg-attachment-footer-text",l.innerHTML=a.w(b.footer),b.footer_icon&&(m=document.createElement("img"),m.src=b.footer_icon,m.className="chatmsg-attachment-footer-icon",z.appendChild(m)),z.appendChild(l));b.ts&&(l=document.createElement("span"),l.className="chatmsg-ts",l.innerHTML=J.P(b.ts),z.appendChild(l));e.appendChild(h);e.appendChild(k);e.appendChild(p);
 e.appendChild(t);if(b.fields&&b.fields.length){var w=document.createElement("ul");e.appendChild(w);w.className="chatmsg-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"),g=document.createElement("div");e.className="field";b||e.classList.add("field-long");f.className="field-title";f.textContent=c;g.className="field-text";g.innerHTML=a.w(d);e.appendChild(f);e.appendChild(g);e&&w.appendChild(e)})}if(b.actions&&
-b.actions.length)for(h=document.createElement("ul"),h.className="chatmsg-attachment-actions "+Qa,e.appendChild(h),n=0,p=b.actions.length;n<p;n++)(t=b.actions[n])&&(t=Sb(c,n,t))&&h.appendChild(t);e.appendChild(z);d.appendChild(f);d.appendChild(e);return d}
-function Sb(a,b,c){var d=document.createElement("li"),e=Qb(c.style);d.textContent=c.text;e!==Qb()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Oa;return d}function qb(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(ib());b.appendChild(c);return b};var Bb=function(){function a(a,b){for(a=a.target;a!==k&&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(){w={};l.textContent="";window.emojiProviderHeader&&(l.appendChild(n(window.emojiProviderHeader)),m.textContent="",l.appendChild(m));l.appendChild(n("emojicustom.png"));l.appendChild(t)}function c(){if(!d())return!1;r&&r(null);return!0}function d(){return k.parentElement?(k.parentElement.removeChild(p),k.parentElement.removeChild(k),
-!0):!1}function e(a){var b=0;a=void 0===a?z.value:a;if(g()){var c=0,d=window.searchEmojis(a),e=f(d,I?I.self.S.a:[]),p;for(n in w)w[n].visible&&(w[n].visible=!1,m.removeChild(w[n].c));var n=0;for(p=e.length;n<p;n++){var k=e[n].name,l=w[k];if(!l){var l=w,K=k;var r=k;var k=window.makeEmoji(d[k]),H=document.createElement("span");H.appendChild(k);H.className="emoji-medium";r=h(r,H);l=l[K]=r}l.visible||(l.visible=!0,m.appendChild(l.c));c++}b+=c}n=b;c=0;for(E in x)x[E].visible&&(x[E].visible=!1,t.removeChild(x[E].c));
-if(I){d=f(I.b.data,I?I.self.S.a:[]);var E=0;for(b=d.length;E<b;E++)K=d[E].name,""!==a&&K.substr(0,a.length)!==a||"alias:"===I.b.data[K].substr(0,6)||(e=x[K],e||(e=x,l=p=K,K=I.b.data[K],r=document.createElement("span"),k=document.createElement("span"),r.className="emoji emoji-custom",r.style.backgroundImage='url("'+K+'")',r.textContent=":"+l+":",r.title=l,k.appendChild(r),k.className="emoji-medium",l=h(l,k),e=e[p]=l),e.visible||(e.visible=!0,t.appendChild(e.c)),c++);E=c}else E=0;return n+E}function f(a,
-b){var c=[],d;for(d in a){var e={name:d,cb:0,count:0};if(a[d].names)for(var f=0,g=a[d].names.length;f<g;f++)e.count+=b[a[d].names[f]]||0;c.push(e)}return c=c.sort(function(a,b){var c=b.count-a.count;return c?c:a.cb-b.cb})}function h(a,b){var c=document.createElement("li");c.appendChild(b);c.className="emojibar-list-item";c.id="emojibar-"+a;return{visible:!1,c:c}}function n(a){var b=document.createElement("img"),c=document.createElement("div");b.src=a;c.appendChild(b);c.className="emojibar-header";
-return c}function g(){return"searchEmojis"in window}var k=document.createElement("div"),p=document.createElement("div"),l=document.createElement("div"),m=document.createElement("ul"),t=document.createElement("ul"),z=document.createElement("input"),w={},x={},L=document.createElement("div"),H=document.createElement("span"),E=document.createElement("span"),r,I;p.addEventListener("click",function(a){var b=k.getBoundingClientRect();(a.screenY<b.top||a.screenY>b.bottom||a.screenX<b.left||a.screenX>b.right)&&
-c()});p.className="emojibar-overlay";k.className="emojibar";l.className="emojibar-emojis";m.className=t.className="emojibar-list";z.className="emojibar-search";L.className="emojibar-detail";H.className="emojibar-detail-img";E.className="emojibar-detail-name";L.appendChild(H);L.appendChild(E);b();k.appendChild(l);k.appendChild(L);k.appendChild(z);z.addEventListener("keyup",function(){e()});k.addEventListener("mousemove",function(b){a(b,function(a){var b=a?w[a]||x[a]:null;b?(H.innerHTML=b.c.outerHTML,
-E.textContent=":"+a+":"):(H.textContent="",E.textContent="")})});k.addEventListener("click",function(b){a(b,function(a){a&&d()&&r&&r(a)})});return{isSupported:g,oa:function(a,b,c){return g()?(I=b,r=c,a.appendChild(p),a.appendChild(k),z.value="",e(),z.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var C,T=[];function Tb(){da.call(this)}Tb.prototype=Object.create(da.prototype);Tb.prototype.constructor=Tb;function ta(a){return a.a?a.a.id:null}function Ub(){this.b=0;this.context=new ra;this.a={}}
-Ub.prototype.update=function(a){var b=Date.now();a.v&&(this.b=a.v);if(a["static"])for(g in a["static"]){var c=sa(this.context,g);c||(c=new Tb,this.context.push(c));var d={};a["static"][g].channels&&a["static"][g].channels.forEach(function(a){a.pins&&(d[a.id]=a.pins,a.pins=void 0)});fa(c,a["static"][g],b);for(var e in d){var f=[],h=this.a[e];h||(h=this.a[e]=new Y(e,250,null,b));d[e].forEach(function(a){f.push(h.b(a,b))});c.l[e].b=f}}ua(this.context,function(a){a.I===a.C&&(a=T.indexOf(a),-1!==a&&T.splice(a,
-1))});if(a.live){for(g in a.live)(c=this.a[g])?la(c,a.live[g],b):c=this.a[g]=new Y(g,250,a.live[g],b);for(var n in a.live){var g=D(this.context,n);(c=g.l[n])?(this.a[n].a.length&&ha(c,oa(this.a[n]).o,b),c.fa||(Vb(g,c,a.live[n]),P&&a.live[P.id]&&tb())):C.b=0}}a["static"]&&hb();var k=!1;a.typing&&this.context.a.forEach(function(c){var d=k,e=a.typing,f=!1;if(c.u)for(var g in c.u)e[g]||(delete c.u[g],f=!0);if(e)for(g in e)if(c.l[g]){c.u[g]||(c.u[g]={});for(var h in e[g])c.u[g][h]||(f=!0),c.u[g][h]=b}k=
-d|f},this);(a["static"]||k)&&ob();a.config&&(W=new Wb(a.config),Lb());if(O&&P&&a["static"]&&a["static"][O.a.id]&&a["static"][O.a.id].channels&&a["static"][O.a.id].channels)for(n=a["static"][O.a.id].channels,g=0,c=n.length;g<c;g++)if(n[g].id===P.id){tb();break}};setInterval(function(){var a=!1,b=Date.now();va(function(c){var d=!1,e;for(e in c.u){var f=!0,h;for(h in c.u[e])c.u[e][h]+3E3<b?(delete c.u[e][h],d=!0):f=!1;f&&(delete c.u[e],d=!0)}d&&(a=!0)});a&&ob()},1E3);
-function Vb(a,b,c){if(b!==P||!window.hasFocus){var d=new RegExp("<@"+a.self.id),e=!1,f=!1,h=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.C)&&c.user!==a.self.id){f=!0;var g;if(!(g=b instanceof u)&&(g=c.text)&&!(g=c.text.match(d)))a:{g=a.self.S.B;for(var k=0,n=g.length;k<n;k++)if(-1!==c.text.indexOf(g[k])){g=!0;break a}g=!1}g&&(-1===T.indexOf(b)&&(h=!0,T.push(b)),e=!0)}});if(f){mb();if(c=document.getElementById("room_"+b.id))c.classList.add("unread"),e&&c.classList.add("unreadHi");h&&!window.hasFocus&&
-yb()}}}function ub(){var a=P,b=T.indexOf(a);if(a.I>a.C){var c=C.a[a.id];c&&(c=c.a[c.a.length-1])&&(N(new M("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.o)),a.C=c.o)}0<=b&&(T.splice(b,1),mb());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}C=new Ub;var nb=function(){function a(a,c){c.sort(function(){return Math.random()-.5});for(var d=0,e=20;e<k-40;e+=l)for(var f=0;f+l<=p;f+=l)h(a,c[d],e,f),d++,d===c.length&&(c.sort(b),d=0)}function b(a,b){return a.R?b.R?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].R){d(a[e].src,function(d){a[e].R=d;c(a,b)});return}var g=[];a.forEach(function(a){a.R&&g.push(a.R)});b(g)}function d(a,b){N(Ga(Ea(Da(new M(a),function(a,c,d){if(d){var e=new Image;e.onload=function(){var a=
+b.actions.length)for(h=document.createElement("ul"),h.className="chatmsg-attachment-actions "+Qa,e.appendChild(h),k=0,p=b.actions.length;k<p;k++)(t=b.actions[k])&&(t=Tb(c,k,t))&&h.appendChild(t);e.appendChild(z);d.appendChild(f);d.appendChild(e);return d}
+function Tb(a,b,c){var d=document.createElement("li"),e=Rb(c.style);d.textContent=c.text;e!==Rb()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Oa;return d}function qb(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(ib());b.appendChild(c);return b};var Cb=function(){function a(a,b){for(a=a.target;a!==n&&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(){w={};l.textContent="";window.emojiProviderHeader&&(l.appendChild(k(window.emojiProviderHeader)),m.textContent="",l.appendChild(m));l.appendChild(k("emojicustom.png"));l.appendChild(t)}function c(){if(!d())return!1;r&&r(null);return!0}function d(){return n.parentElement?(n.parentElement.removeChild(p),n.parentElement.removeChild(n),
+!0):!1}function e(a){var b=0;a=void 0===a?z.value:a;if(g()){var c=0,d=window.searchEmojis(a),e=f(d,I?I.self.S.a:[]),p;for(k in w)w[k].visible&&(w[k].visible=!1,m.removeChild(w[k].c));var k=0;for(p=e.length;k<p;k++){var l=e[k].name,n=w[l];if(!n){var n=w,L=l;var r=l;var l=window.makeEmoji(d[l]),H=document.createElement("span");H.appendChild(l);H.className="emoji-medium";r=h(r,H);n=n[L]=r}n.visible||(n.visible=!0,m.appendChild(n.c));c++}b+=c}k=b;c=0;for(E in x)x[E].visible&&(x[E].visible=!1,t.removeChild(x[E].c));
+if(I){d=f(I.b.data,I?I.self.S.a:[]);var E=0;for(b=d.length;E<b;E++)L=d[E].name,""!==a&&L.substr(0,a.length)!==a||"alias:"===I.b.data[L].substr(0,6)||(e=x[L],e||(e=x,n=p=L,L=I.b.data[L],r=document.createElement("span"),l=document.createElement("span"),r.className="emoji emoji-custom",r.style.backgroundImage='url("'+L+'")',r.textContent=":"+n+":",r.title=n,l.appendChild(r),l.className="emoji-medium",n=h(n,l),e=e[p]=n),e.visible||(e.visible=!0,t.appendChild(e.c)),c++);E=c}else E=0;return k+E}function f(a,
+b){var c=[],d;for(d in a){var e={name:d,eb:0,count:0};if(a[d].names)for(var f=0,g=a[d].names.length;f<g;f++)e.count+=b[a[d].names[f]]||0;c.push(e)}return c=c.sort(function(a,b){var c=b.count-a.count;return c?c:a.eb-b.eb})}function h(a,b){var c=document.createElement("li");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 g(){return"searchEmojis"in window}var n=document.createElement("div"),p=document.createElement("div"),l=document.createElement("div"),m=document.createElement("ul"),t=document.createElement("ul"),z=document.createElement("input"),w={},x={},M=document.createElement("div"),H=document.createElement("span"),E=document.createElement("span"),r,I;p.addEventListener("click",function(a){var b=n.getBoundingClientRect();(a.screenY<b.top||a.screenY>b.bottom||a.screenX<b.left||a.screenX>b.right)&&
+c()});p.className="emojibar-overlay";n.className="emojibar";l.className="emojibar-emojis";m.className=t.className="emojibar-list";z.className="emojibar-search";M.className="emojibar-detail";H.className="emojibar-detail-img";E.className="emojibar-detail-name";M.appendChild(H);M.appendChild(E);b();n.appendChild(l);n.appendChild(M);n.appendChild(z);z.addEventListener("keyup",function(){e()});n.addEventListener("mousemove",function(b){a(b,function(a){var b=a?w[a]||x[a]:null;b?(H.innerHTML=b.c.outerHTML,
+E.textContent=":"+a+":"):(H.textContent="",E.textContent="")})});n.addEventListener("click",function(b){a(b,function(a){a&&d()&&r&&r(a)})});return{isSupported:g,oa:function(a,b,c){return g()?(I=b,r=c,a.appendChild(p),a.appendChild(n),z.value="",e(),z.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var C,T=[];function Ub(){da.call(this)}Ub.prototype=Object.create(da.prototype);Ub.prototype.constructor=Ub;function ta(a){return a.a?a.a.id:null}function Vb(){this.b=0;this.context=new ra;this.a={}}
+Vb.prototype.update=function(a){var b=Date.now();a.v&&(this.b=a.v);if(a["static"])for(g in a["static"]){var c=sa(this.context,g);c||(c=new Ub,this.context.push(c));var d={};a["static"][g].channels&&a["static"][g].channels.forEach(function(a){a.pins&&(d[a.id]=a.pins,a.pins=void 0)});fa(c,a["static"][g],b);for(var e in d){var f=[],h=this.a[e];h||(h=this.a[e]=new Y(e,250,null,b));d[e].forEach(function(a){f.push(h.b(a,b))});c.l[e].b=f}}ua(this.context,function(a){a.I===a.C&&(a=T.indexOf(a),-1!==a&&T.splice(a,
+1))});if(a.live){for(g in a.live)(c=this.a[g])?la(c,a.live[g],b):c=this.a[g]=new Y(g,250,a.live[g],b);for(var k in a.live){var g=D(this.context,k);(c=g.l[k])?(this.a[k].a.length&&ha(c,oa(this.a[k]).o,b),c.fa||(Wb(g,c,a.live[k]),P&&a.live[P.id]&&tb())):C.b=0}}a["static"]&&hb();var n=!1;a.typing&&this.context.a.forEach(function(c){var d=n,e=a.typing,f=!1;if(c.u)for(var g in c.u)e[g]||(delete c.u[g],f=!0);if(e)for(g in e)if(c.l[g]){c.u[g]||(c.u[g]={});for(var h in e[g])c.u[g][h]||(f=!0),c.u[g][h]=b}n=
+d|f},this);(a["static"]||n)&&ob();a.config&&(W=new Xb(a.config),Mb());if(O&&P&&a["static"]&&a["static"][O.a.id]&&a["static"][O.a.id].channels&&a["static"][O.a.id].channels)for(k=a["static"][O.a.id].channels,g=0,c=k.length;g<c;g++)if(k[g].id===P.id){tb();break}};setInterval(function(){var a=!1,b=Date.now();va(function(c){var d=!1,e;for(e in c.u){var f=!0,h;for(h in c.u[e])c.u[e][h]+3E3<b?(delete c.u[e][h],d=!0):f=!1;f&&(delete c.u[e],d=!0)}d&&(a=!0)});a&&ob()},1E3);
+function Wb(a,b,c){if(b!==P||!window.hasFocus){var d=new RegExp("<@"+a.self.id),e=!1,f=!1,h=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.C)&&c.user!==a.self.id){f=!0;var g;if(!(g=b instanceof u)&&(g=c.text)&&!(g=c.text.match(d)))a:{g=a.self.S.B;for(var k=0,p=g.length;k<p;k++)if(-1!==c.text.indexOf(g[k])){g=!0;break a}g=!1}g&&(-1===T.indexOf(b)&&(h=!0,T.push(b)),e=!0)}});if(f){mb();if(c=document.getElementById("room_"+b.id))c.classList.add("unread"),e&&c.classList.add("unreadHi");h&&!window.hasFocus&&
+yb()}}}function ub(){var a=P,b=T.indexOf(a);if(a.I>a.C){var c=C.a[a.id];c&&(c=c.a[c.a.length-1])&&(N(new K("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.o)),a.C=c.o)}0<=b&&(T.splice(b,1),mb());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}C=new Vb;var nb=function(){function a(a,c){c.sort(function(){return Math.random()-.5});for(var d=0,e=20;e<n-40;e+=l)for(var f=0;f+l<=p;f+=l)h(a,c[d],e,f),d++,d===c.length&&(c.sort(b),d=0)}function b(a,b){return a.R?b.R?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].R){d(a[e].src,function(d){a[e].R=d;c(a,b)});return}var g=[];a.forEach(function(a){a.R&&g.push(a.R)});b(g)}function d(a,b){N(Ga(Ea(Da(new K(a),function(a,c,d){if(d){var e=new Image;e.onload=function(){var a=
 document.createElement("canvas");a.height=a.width=z;a=a.getContext("2d");a.drawImage(e,0,0,z,z);var a=a.getImageData(0,0,z,z),c=0,d;for(d=0;d<a.width*a.height*4;d+=4)a.data[d]=a.data[d+1]=a.data[d+2]=(a.data[d]+a.data[d+1]+a.data[d+2])/3,a.data[d+3]=50,c+=a.data[d];if(50>c/(a.height*a.width))for(d=0;d<a.width*a.height*4;d+=4)a.data[d]=a.data[d+1]=a.data[d+2]=255-a.data[d];b(a)};e.onerror=function(){b(null)};e.src=window.URL.createObjectURL(d)}else b(null)}),function(){b(null)}),"blob"))}function e(){var a=
-g.createLinearGradient(0,0,0,p);a.addColorStop(0,"#4D394B");a.addColorStop(1,"#201820");g.fillStyle=a;g.fillRect(0,0,k,p);return g.getImageData(0,0,k,p)}function f(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 h(a,b,c,d){var e=Math.floor(d);a=[a.data[e*k*4+0],a.data[e*k*4+1],a.data[e*k*4+2]];g.fillStyle="#"+(1.1*a[0]<<16|1.1*a[1]<<8|1.1*a[2]).toString(16);
-g.beginPath();g.moveTo(c+l/2,d+m);g.lineTo(c-m+l,d+l/2);g.lineTo(c+l/2,d-m+l);g.lineTo(c+m,d+l/2);g.closePath();g.fill();g.putImageData(f(g.getImageData(c+m,d+m,t,t),b),c+m,d+m)}var n=document.createElement("canvas"),g=n.getContext("2d"),k=n.width=250,p=n.height=290,l=(k-40)/3,m=.1*l,t=Math.floor(l-2*m),z=.5*t,w={},x={},L={};return function(b,d,f){if(w[b])f(w[b]);else if(L[b])x[b]?x[b].push(f):x[b]=[f];else{var g=e(),h=[];L[b]=!0;x[b]?x[b].push(f):x[b]=[f];for(var k in d)d[k].Sa||d[k].sb||h.push({src:qa(d[k])});
-c(h,function(c){a(g,c);w[b]=n.toDataURL();x[b].forEach(function(a){a(w[b])})})}}}();var V=0,P=null,O=null,R=null,Q=null;function Fb(){N(Fa(Ea(Da(new M("highlight.pack.js"),function(a,b,c){a=document.createElement("script");b=document.createElement("link");a.innerHTML=c;a.language="text/javascript";b.href="hljs-androidstudio.css";b.rel="stylesheet";document.head.appendChild(b);document.body.appendChild(a)}),function(){console.error("Failure loading hljs required files")})))}
-function Xb(){var a=P;N(Ca(Da(Ga(new M("api/hist?room="+a.id),"json"),function(b,c,d){d&&((b=C.a[a.id])?b=!!la(b,d,Date.now()):(C.a[a.id]=new Y(a,100,d,Date.now()),b=!0),b&&(Vb(D(C.context,a.id),a,d),a===P&&tb()))}),function(){}))}function Lb(){a:{var a=W.T;for(var b in a)if(a.hasOwnProperty(b)){a=!1;break a}a=!0}a&&Hb.yb(!1).display(Hb.vb.T);a=W.b;Yb(a&&Mb[a]?Mb[a]:Zb);document.getElementById("customsheet").innerHTML=$b()}
-function Jb(){var a=ac;N(Fa(Ga(Ca(new M("api?v="+C.b),function(b,c,d){(b=2===Math.floor(b/100))?V&&(V=0,rb(!0)):V?(V+=Math.floor((V||5)/2),V=Math.min(60,V)):(V=5,rb(!1));a(b,d)}),"json")))}function ac(a,b){a?(b&&C.update(b),Jb()):setTimeout(bc,1E3*V)}function bc(){Jb()}
-function cc(a){P&&(document.getElementById("room_"+P.id).classList.remove("selected"),document.getElementById("chatSystemContainer").classList.add("no-room-selected"));document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");P=a;O=D(C.context,a.id);sb();X.pb();nb(O.a.id,O.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"});(!C.a[P.id]||100>C.a[P.id].a.length)&&Xb();document.getElementById("chatSystemContainer").classList.remove("no-room-selected")}
-function lb(){var a=document.location.hash.substr(1),b=wa(a);b&&b!==P?cc(b):(a=F(a))&&a.W&&cc(a.W)}function Ib(a,b,c){var d=P;new FileReader;var e=new FormData;e.append("file",b);e.append("filename",a);N(Ea(Da(new M("POST","api/file?room="+d.id),function(){c(null)}),function(a,b){c(b)}),e)}
-function cb(a,b,c){b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);c&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:c.text,author_name:F(c.O).getName(),text:c.text,footer:a.h?J.message:a.name,ts:c.o}])));N(new M("POST",b))}function Cb(a,b){N(new M("DELETE","api/pinMsg?room="+a.id+"&msgId="+b.id))}function wb(a,b,c){N(new M("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c)))}
-function Gb(){N(new M("POST","api/logout"));document.cookie="sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";document.location.reload()}function kb(){var a={},b=[],c=this.value;ua(C.context,function(b){a[b.id]=ia(b,c)});for(var d in a){var e=document.getElementById("room_"+d);e&&(a[d].name+a[d].la+a[d].qa+a[d].na?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var Mb={noemoji:{Aa:"noemoji.js",ha:null,name:"None"},emojione_v2_3:{Aa:"emojione_v2.3.sprites.js",ha:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{Aa:"emojione_v3.sprites.js",ha:"emojione_v3.sprites.css",name:"Emojione v3"}},Zb=Mb.emojione_v2_3,Za;
-function Yb(a){Za!==a&&(console.log("Loading emoji pack "+a.name),N(Fa(Da(new M(a.Aa),function(b,c,d){b=document.createElement("script");b.innerHTML=d;b.language="text/javascript";document.body.appendChild(b);a.ha&&(d=document.createElement("link"),d.href=a.ha,d.rel="stylesheet",document.head.appendChild(d));d=document.getElementById("emojiButton");for(var e in C.a)dc(C.a[e]);P&&tb();Bb.reset();"makeEmoji"in window?(d.style.backgroundImage='url("smile.svg")',d.classList.remove("hidden")):d.classList.add("hidden")}))),
-Za=a)};var X=function(){function a(){c();r instanceof u?(f.style.backgroundImage="url(api/avatar?size=l&user="+r.a.id+")",k.textContent=(r.a.fb||(r.a.Ua||"")+" "+r.a.Xa).trim(),h.classList.add("presence-indicator"),r.a.M?h.classList.remove("presence-away"):h.classList.add("presence-away"),g.classList.remove("hidden"),l.classList.remove("hidden"),l.textContent=r.a.wb||"",t.textContent=r.a.ob||"",m.classList.remove("hidden"),e.classList.remove("roominfo-channel"),e.classList.add("roominfo-user")):b()}function b(){var a=
-E;a.$.topic?(g.classList.remove("hidden"),k.textContent=r.qa||"",p.textContent=r.G?J.Ea(r.G,r.ea):""):g.classList.add("hidden");a.$.purpose?(m.classList.remove("hidden"),t.textContent=r.na||"",z.textContent=r.m?J.Ea(r.m,r.da):""):m.classList.add("hidden");f.style.backgroundImage="";h.classList.remove("presence-indicator");L.textContent=J.hb(r.i?Object.keys(r.i).length:0);a=[];if(r.i)for(var b in r.i)a.push(r.i[b]);a.sort(function(a,b){return a.M&&!b.M?-1:b.M&&!a.M?1:a.getName().localeCompare(b.getName())});
-var c=document.createDocumentFragment();a.forEach(function(a){var b=document.createElement("li"),d=document.createElement("a");d.href="#"+a.id;d.textContent=a.getName();b.appendChild(d);b.classList.add("presence-indicator");a.M||b.classList.add("presence-away");c.appendChild(b)});H.textContent="";H.appendChild(c);e.classList.add("roominfo-channel");e.classList.remove("roominfo-user")}function c(){h.textContent=r.name;if(r.b){w.textContent=J.ab(r.b.length);w.classList.remove("hidden");x.classList.remove("hidden");
-var a=document.createDocumentFragment();r.b.forEach(function(b){var c=document.createElement("li"),e=document.createElement("a");e.href="javascript:void(0)";e.dataset.msgId=b.id;e.addEventListener("click",d);e.className=Oa+" roominfo-unpin";c.className="roominfo-pinlist-item";c.appendChild(b.K());c.appendChild(e);a.appendChild(c)});x.textContent="";x.appendChild(a)}else w.classList.add("hidden"),x.classList.add("hidden")}function d(){if(r.b)for(var a=0,b=r.b.length;a<b;a++)if(r.b[a].id===this.dataset.msgId){Cb(r,
-r.b[a]);break}}var e=document.createElement("div"),f=document.createElement("header"),h=document.createElement("h3"),n=document.createElement("div"),g=document.createElement("div"),k=document.createElement("span"),p=document.createElement("span"),l=document.createElement("div"),m=document.createElement("div"),t=document.createElement("span"),z=document.createElement("span"),w=document.createElement("div"),x=document.createElement("ul"),L=document.createElement("div"),H=document.createElement("ul"),
-E,r;e.className="chat-context-roominfo";f.className="roominfo-title";g.className="roominfo-topic";m.className="roominfo-purpose";l.className="roominfo-phone";w.className="roominfo-pincount";x.className="roominfo-pinlist";L.className="roominfo-usercount";H.className="roominfo-userlist";z.className=p.className="roominfo-author";f.appendChild(h);e.appendChild(f);e.appendChild(n);g.appendChild(k);g.appendChild(p);m.appendChild(t);m.appendChild(z);n.appendChild(g);n.appendChild(l);n.appendChild(m);n.appendChild(w);
-n.appendChild(x);n.appendChild(L);n.appendChild(H);var I=null;return{bb:function(b,c){this.Z();E=b;r=c;a();return this},update:function(){this.Z();a();return this},show:function(a){this.Z();a.appendChild(e);e.classList.remove("hidden");return this},pb:function(){this.Z();e.classList.add("hidden");return this},Z:function(){I&&clearTimeout(I);I=null;return this},qb:function(){I||(I=setTimeout(function(){e.classList.add("hidden");I=null},300));return this},tb:function(a){for(;a;){if(a===e)return!0;a=
-a.parentNode}return!1}}}();function Y(a,b,c,d){ka.call(this,a,b,0,c,d)}Y.prototype=Object.create(ka.prototype);Y.prototype.constructor=Y;Y.prototype.b=function(a,b){return!0===a.isMeMessage?new ec(this.id,a,b):!0===a.isNotice?new fc(this.id,a,b):new gc(this.id,a,b)};function dc(a){a.a.forEach(function(a){a.H()})}
-var Z=function(){function a(a,d){return Aa(d,{B:a.context.self.S.B,aa: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},ka: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 h=b.substr(c+1)}if("@"===d[0])if(d=ta(a.context)+"|"+d.substr(1),h=F(d))a=!0,d="#"+h.W.id,h="@"+h.getName();else return null;
-else if("#"===d[0])if(d=ta(a.context)+"|"+d.substr(1),h=wa(d))a=!0,d="#"+d,h="#"+h.name;else return null;else{if(!d.match(/^(https?|mailto):\/\//i))return null;a=!1}return{link:d,text:h||d,Wa:a}}return{H:function(a){a.U=!0;return a},X:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},L:function(a){a.c?a.U&&(a.U=!1,a.N()):a.wa().N();return a.c},N:function(b){var c=F(b.O);b.c.o.innerHTML=J.P(b.o);b.c.Da.innerHTML=a(b,b.text);b.c.xa.textContent=c?c.getName():b.username||"?";for(var c=
-document.createDocumentFragment(),e=0,f=b.s.length;e<f;e++){var h=b.s[e];h&&(h=Rb(b,h,e))&&c.appendChild(h)}b.c.s.textContent="";b.c.s.appendChild(c);c=b.b;e=document.createDocumentFragment();if(b.D)for(var n in b.D){var f=c,h=b.id,g=n,k=b.D[n],p=$a(g);if(p){for(var l=document.createElement("li"),m=document.createElement("a"),t=document.createElement("span"),z=document.createElement("span"),w=[],x=0,L=k.length;x<L;x++){var H=F(k[x]);H&&w.push(H.getName())}w.sort();z.textContent=w.join(", ");t.appendChild(p);
-t.className="emoji-small";m.href="javascript:toggleReaction('"+f+"', '"+h+"', '"+g+"')";m.appendChild(t);m.appendChild(z);l.className="chatmsg-reaction-item";l.appendChild(m);f=l}else console.warn("Reaction id not found: "+g),f=null;f&&e.appendChild(f)}b.c.D.textContent="";b.c.D.appendChild(e);b.c.ca.ja&&(b.c.ca.ja.style.backgroundImage=b.A?'url("star_full.png")':'url("star_empty.png")');b.F&&(b.c.F.innerHTML=J.F(b.F),b.c.classList.add("edited"));return b},K:function(a){return a.L().cloneNode(!0)},
-w:function(b,d){return a(b,d)}}}();function ec(a,b,c){y.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.U=Z.U}ec.prototype=Object.create(A.prototype);q=ec.prototype;q.constructor=ec;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.X=function(){return Z.X(this)};q.L=function(){return Z.L(this)};q.wa=function(){this.c=Pb(this);this.c.classList.add("chatmsg-me_message");return this};q.K=function(){return Z.K(this)};q.N=function(){Z.N(this);return this};
-q.update=function(a,b){A.prototype.update.call(this,a,b);this.H()};function gc(a,b,c){y.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.U=Z.U}gc.prototype=Object.create(y.prototype);q=gc.prototype;q.constructor=gc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.X=function(){return Z.X(this)};q.L=function(){return Z.L(this)};q.wa=function(){this.c=Pb(this);return this};q.K=function(){return Z.K(this)};q.N=function(){Z.N(this);return this};
+g.createLinearGradient(0,0,0,p);a.addColorStop(0,"#4D394B");a.addColorStop(1,"#201820");g.fillStyle=a;g.fillRect(0,0,n,p);return g.getImageData(0,0,n,p)}function f(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 h(a,b,c,d){var e=Math.floor(d);a=[a.data[e*n*4+0],a.data[e*n*4+1],a.data[e*n*4+2]];g.fillStyle="#"+(1.1*a[0]<<16|1.1*a[1]<<8|1.1*a[2]).toString(16);
+g.beginPath();g.moveTo(c+l/2,d+m);g.lineTo(c-m+l,d+l/2);g.lineTo(c+l/2,d-m+l);g.lineTo(c+m,d+l/2);g.closePath();g.fill();g.putImageData(f(g.getImageData(c+m,d+m,t,t),b),c+m,d+m)}var k=document.createElement("canvas"),g=k.getContext("2d"),n=k.width=250,p=k.height=290,l=(n-40)/3,m=.1*l,t=Math.floor(l-2*m),z=.5*t,w={},x={},M={};return function(b,d,f){if(w[b])f(w[b]);else if(M[b])x[b]?x[b].push(f):x[b]=[f];else{var g=e(),h=[];M[b]=!0;x[b]?x[b].push(f):x[b]=[f];for(var l in d)d[l].Ta||d[l].tb||h.push({src:qa(d[l])});
+c(h,function(c){a(g,c);w[b]=k.toDataURL();x[b].forEach(function(a){a(w[b])})})}}}();var V=0,P=null,O=null,R=null,Q=null;function Gb(){N(Fa(Ea(Da(new K("highlight.pack.js"),function(a,b,c){a=document.createElement("script");b=document.createElement("link");a.innerHTML=c;a.language="text/javascript";b.href="hljs-androidstudio.css";b.rel="stylesheet";document.head.appendChild(b);document.body.appendChild(a)}),function(){console.error("Failure loading hljs required files")})))}
+function Yb(){var a=P;N(Ca(Da(Ga(new K("api/hist?room="+a.id),"json"),function(b,c,d){d&&((b=C.a[a.id])?b=!!la(b,d,Date.now()):(C.a[a.id]=new Y(a,100,d,Date.now()),b=!0),b&&(Wb(D(C.context,a.id),a,d),a===P&&tb()))}),function(){}))}function Mb(){a:{var a=W.T;for(var b in a)if(a.hasOwnProperty(b)){a=!1;break a}a=!0}a&&Ib.zb(!1).display(Ib.wb.T);a=W.h;Zb(a&&Nb[a]?Nb[a]:$b);document.getElementById("customsheet").innerHTML=ac()}
+function Kb(){var a=bc;N(Fa(Ga(Ca(new K("api?v="+C.b),function(b,c,d){(b=2===Math.floor(b/100))?V&&(V=0,rb(!0)):V?(V+=Math.floor((V||5)/2),V=Math.min(60,V)):(V=5,rb(!1));a(b,d)}),"json")))}function bc(a,b){a?(b&&C.update(b),Kb()):setTimeout(cc,1E3*V)}function cc(){Kb()}
+function dc(a){P&&(document.getElementById("room_"+P.id).classList.remove("selected"),document.getElementById("chatSystemContainer").classList.add("no-room-selected"));document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");P=a;O=D(C.context,a.id);sb();X.qb();nb(O.a.id,O.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"});(!C.a[P.id]||100>C.a[P.id].a.length)&&Yb();document.getElementById("chatSystemContainer").classList.remove("no-room-selected")}
+function lb(){var a=document.location.hash.substr(1),b=wa(a);b&&b!==P?dc(b):(a=F(a))&&a.W&&dc(a.W)}function Jb(a,b,c){var d=P;new FileReader;var e=new FormData;e.append("file",b);e.append("filename",a);N(Ea(Da(new K("POST","api/file?room="+d.id),function(){c(null)}),function(a,b){c(b)}),e)}
+function cb(a,b,c){b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);c&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:c.text,author_name:F(c.O).getName(),text:c.text,footer:a.h?J.message:a.name,ts:c.o}])));N(new K("POST",b))}function Db(a,b){N(new K("DELETE","api/pinMsg?room="+a.id+"&msgId="+b.id))}function wb(a,b,c){N(new K("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c)))}
+function Hb(){N(new K("POST","api/logout"));document.cookie="sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";document.location.reload()}function kb(){var a={},b=[],c=this.value;ua(C.context,function(b){a[b.id]=ia(b,c)});for(var d in a){var e=document.getElementById("room_"+d);e&&(a[d].name+a[d].la+a[d].qa+a[d].na?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var Nb={noemoji:{Aa:"noemoji.js",ha:null,name:"None"},emojione_v2_3:{Aa:"emojione_v2.3.sprites.js",ha:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{Aa:"emojione_v3.sprites.js",ha:"emojione_v3.sprites.css",name:"Emojione v3"}},$b=Nb.emojione_v2_3,Za;
+function Zb(a){Za!==a&&(console.log("Loading emoji pack "+a.name),N(Fa(Da(new K(a.Aa),function(b,c,d){b=document.createElement("script");b.innerHTML=d;b.language="text/javascript";document.body.appendChild(b);a.ha&&(d=document.createElement("link"),d.href=a.ha,d.rel="stylesheet",document.head.appendChild(d));d=document.getElementById("emojiButton");for(var e in C.a)ec(C.a[e]);P&&tb();Cb.reset();"makeEmoji"in window?(d.style.backgroundImage='url("smile.svg")',d.classList.remove("hidden")):d.classList.add("hidden")}))),
+Za=a)};var X=function(){function a(){c();r instanceof u?(f.style.backgroundImage="url(api/avatar?size=l&user="+r.a.id+")",n.textContent=(r.a.gb||(r.a.Va||"")+" "+r.a.Ya).trim(),h.classList.add("presence-indicator"),r.a.M?h.classList.remove("presence-away"):h.classList.add("presence-away"),g.classList.remove("hidden"),l.classList.remove("hidden"),l.textContent=r.a.xb||"",t.textContent=r.a.pb||"",m.classList.remove("hidden"),e.classList.remove("roominfo-channel"),e.classList.add("roominfo-user")):b()}function b(){var a=
+E;a.$.topic?(g.classList.remove("hidden"),n.textContent=r.qa||"",p.textContent=r.G?J.Ea(r.G,r.ea):""):g.classList.add("hidden");a.$.purpose?(m.classList.remove("hidden"),t.textContent=r.na||"",z.textContent=r.m?J.Ea(r.m,r.da):""):m.classList.add("hidden");f.style.backgroundImage="";h.classList.remove("presence-indicator");M.textContent=J.ib(r.i?Object.keys(r.i).length:0);a=[];if(r.i)for(var b in r.i)a.push(r.i[b]);a.sort(function(a,b){return a.M&&!b.M?-1:b.M&&!a.M?1:a.getName().localeCompare(b.getName())});
+var c=document.createDocumentFragment();a.forEach(function(a){var b=document.createElement("li"),d=document.createElement("a");d.href="#"+a.id;d.textContent=a.getName();b.appendChild(d);b.classList.add("presence-indicator");a.M||b.classList.add("presence-away");c.appendChild(b)});H.textContent="";H.appendChild(c);e.classList.add("roominfo-channel");e.classList.remove("roominfo-user")}function c(){h.textContent=r.name;if(r.b){w.textContent=J.bb(r.b.length);w.classList.remove("hidden");x.classList.remove("hidden");
+var a=document.createDocumentFragment();r.b.forEach(function(b){var c=document.createElement("li"),e=document.createElement("a");e.href="javascript:void(0)";e.dataset.msgId=b.id;e.addEventListener("click",d);e.className=Oa+" roominfo-unpin";c.className="roominfo-pinlist-item";c.appendChild(b.K());c.appendChild(e);a.appendChild(c)});x.textContent="";x.appendChild(a)}else w.classList.add("hidden"),x.classList.add("hidden")}function d(){if(r.b)for(var a=0,b=r.b.length;a<b;a++)if(r.b[a].id===this.dataset.msgId){Db(r,
+r.b[a]);break}}var e=document.createElement("div"),f=document.createElement("header"),h=document.createElement("h3"),k=document.createElement("div"),g=document.createElement("div"),n=document.createElement("span"),p=document.createElement("span"),l=document.createElement("div"),m=document.createElement("div"),t=document.createElement("span"),z=document.createElement("span"),w=document.createElement("div"),x=document.createElement("ul"),M=document.createElement("div"),H=document.createElement("ul"),
+E,r;e.className="chat-context-roominfo";f.className="roominfo-title";g.className="roominfo-topic";m.className="roominfo-purpose";l.className="roominfo-phone";w.className="roominfo-pincount";x.className="roominfo-pinlist";M.className="roominfo-usercount";H.className="roominfo-userlist";z.className=p.className="roominfo-author";f.appendChild(h);e.appendChild(f);e.appendChild(k);g.appendChild(n);g.appendChild(p);m.appendChild(t);m.appendChild(z);k.appendChild(g);k.appendChild(l);k.appendChild(m);k.appendChild(w);
+k.appendChild(x);k.appendChild(M);k.appendChild(H);var I=null;return{cb:function(b,c){this.Z();E=b;r=c;a();return this},update:function(){this.Z();a();return this},show:function(a){this.Z();a.appendChild(e);e.classList.remove("hidden");return this},qb:function(){this.Z();e.classList.add("hidden");return this},Z:function(){I&&clearTimeout(I);I=null;return this},rb:function(){I||(I=setTimeout(function(){e.classList.add("hidden");I=null},300));return this},ub:function(a){for(;a;){if(a===e)return!0;a=
+a.parentNode}return!1}}}();function Y(a,b,c,d){ka.call(this,a,b,0,c,d)}Y.prototype=Object.create(ka.prototype);Y.prototype.constructor=Y;Y.prototype.b=function(a,b){return!0===a.isMeMessage?new fc(this.id,a,b):!0===a.isNotice?new gc(this.id,a,b):new hc(this.id,a,b)};function ec(a){a.a.forEach(function(a){a.H()})}
+var Z=function(){function a(a,d){return Aa(d,{B:a.context.self.S.B,aa: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},ka:function(c){return b(a,c)}})}function b(a,b){var c=b.indexOf("|"),d;if(-1===c)var h=b;else{h=b.substr(0,c);var k=b.substr(c+1)}if("@"===h[0])if(h=ta(a.context)+"|"+h.substr(1),d=F(h)){a=!0;h="#"+d.W.id;k="@"+d.getName();d="background-color:"+
+zb(d.getName());var g=["userLink"]}else return null;else if("#"===h[0])if(h=ta(a.context)+"|"+h.substr(1),k=wa(h))a=!0,h="#"+h,k="#"+k.name,g=["chanLink"];else return null;else{if(!h.match(/^(https?|mailto):\/\//i))return null;a=!1}return{link:h,text:k||h,style:d,Sa:g,Xa:a}}return{H:function(a){a.U=!0;return a},X:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},L:function(a){a.c?a.U&&(a.U=!1,a.N()):a.wa().N();return a.c},N:function(b){var c=F(b.O);b.c.o.innerHTML=J.P(b.o);b.c.Da.innerHTML=
+a(b,b.text);b.c.xa.textContent=c?c.getName():b.username||"?";for(var c=document.createDocumentFragment(),e=0,f=b.s.length;e<f;e++){var h=b.s[e];h&&(h=Sb(b,h,e))&&c.appendChild(h)}b.c.s.textContent="";b.c.s.appendChild(c);c=b.b;e=document.createDocumentFragment();if(b.D)for(var k in b.D){var f=c,h=b.id,g=k,n=b.D[k],p=$a(g);if(p){for(var l=document.createElement("li"),m=document.createElement("a"),t=document.createElement("span"),z=document.createElement("span"),w=[],x=0,M=n.length;x<M;x++){var H=F(n[x]);
+H&&w.push(H.getName())}w.sort();z.textContent=w.join(", ");t.appendChild(p);t.className="emoji-small";m.href="javascript:toggleReaction('"+f+"', '"+h+"', '"+g+"')";m.appendChild(t);m.appendChild(z);l.className="chatmsg-reaction-item";l.appendChild(m);f=l}else console.warn("Reaction id not found: "+g),f=null;f&&e.appendChild(f)}b.c.D.textContent="";b.c.D.appendChild(e);b.c.ca.ja&&(b.c.ca.ja.style.backgroundImage=b.A?'url("star_full.png")':'url("star_empty.png")');b.F&&(b.c.F.innerHTML=J.F(b.F),b.c.classList.add("edited"));
+return b},K:function(a){return a.L().cloneNode(!0)},w:function(b,d){return a(b,d)}}}();function fc(a,b,c){y.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.U=Z.U}fc.prototype=Object.create(A.prototype);q=fc.prototype;q.constructor=fc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.X=function(){return Z.X(this)};q.L=function(){return Z.L(this)};q.wa=function(){this.c=Qb(this);this.c.classList.add("chatmsg-me_message");return this};q.K=function(){return Z.K(this)};
+q.N=function(){Z.N(this);return this};q.update=function(a,b){A.prototype.update.call(this,a,b);this.H()};function hc(a,b,c){y.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.U=Z.U}hc.prototype=Object.create(y.prototype);q=hc.prototype;q.constructor=hc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.X=function(){return Z.X(this)};q.L=function(){return Z.L(this)};q.wa=function(){this.c=Qb(this);return this};q.K=function(){return Z.K(this)};
+q.N=function(){Z.N(this);return this};
 q.update=function(a,b){y.prototype.update.call(this,a,b);this.H();if(a=this.text.match(/^<?https:\/\/www\.openstreetmap\.org\/\?mlat=(-?[0-9\.]+)(&amp;|&)mlon=(-?[0-9\.]+)(&amp;|&)macc=([0-9\.]+)[^\s]*/))this.text=this.text.substr(0,a.index)+this.text.substr(a.index+a[0].length).trim(),this.s.unshift({color:"#008000",text:a[0],footer:"Open Street Map",footer_icon:"https://www.openstreetmap.org/assets/favicon-32x32-36d06d8a01933075bc7093c9631cffd02d49b03b659f767340f256bb6839d990.png",geo:{latitude:a[1],
-longitude:a[3],accuracy:a[5]}})};function fc(a,b,c){y.call(this,b,c);this.context=D(C.context,a);this.b=a;this.a=null;this.U=!0}fc.prototype=Object.create(B.prototype);q=fc.prototype;q.constructor=fc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.X=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.L=function(){Z.L(this);return this.a};q.K=function(){return this.a.cloneNode(!0)};
-q.wa=function(){this.c=Pb(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=J.$a;this.a.appendChild(this.c);return this};q.N=function(){Z.N(this);return this};q.update=function(a,b){B.prototype.update.call(this,a,b);this.H()};var W;function Wb(a){this.T={};for(var b=0,c=a.length;b<c;b++)null===a[b].service&&null===a[b].device&&Kb(this,JSON.parse(a[b].config))}function Kb(a,b){if(b.services)for(var c in b.services)a.T[c]=b.services[c];void 0!==b.emojiProvider&&(a.b=b.emojiProvider);void 0!==b.displayAvatar&&(a.a=b.displayAvatar)}
-function $b(){var a={},b="";!1===W.a&&(a[".chatsystem-content .chatmsg-authorGroup .chatmsg-author-img-wrapper"]=["display: none"],a[".chatsystem-content .chatmsg-authorGroup"]=["display: flex"],a[".chatsystem-content .chatmsg-authorGroup .chatmsg-author"]=["position:initial","vertical-align:top","min-width:75px"],a[".chatsystem-content .chatmsg-authorGroup .chatmsg-author-messages"]=["padding-top:0","padding-left:0","display:inline-block","margin-top:-4px","flex:1"]);for(var c in a)b+=c+"{",a[c].forEach(function(a){b+=
-a+";"}),b+="}";return b}W=new Wb([]);var ab=function(){var a=[];return{Va:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},nb:function(b){var c=[];a.forEach(function(a){for(var d=0,f=a.names.length;d<f;d++)if(a.names[d].substr(0,b.length)===b){c.push(a);break}});return c},xb:function(b){b.V="client";b.exec=b.exec.bind(b);a.push(b)}}}();function hc(){return new Promise(function(a,b){"geolocation"in window.navigator?navigator.geolocation.getCurrentPosition(function(c){c?a(c):b("denied")}):b("geolocation not available")})}
-ya.push(function(){ab.xb({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:J.gb,exec:function(a,b){hc().then(function(a){var c=a.coords.latitude,e=a.coords.longitude;cb(b,"https://www.openstreetmap.org/?mlat="+c+"&mlon="+e+"&macc="+a.coords.accuracy+"#map=17/"+c+"/"+e)}).catch(function(a){console.error("Error: ",a)})}})});
+longitude:a[3],accuracy:a[5]}})};function gc(a,b,c){y.call(this,b,c);this.context=D(C.context,a);this.b=a;this.a=null;this.U=!0}gc.prototype=Object.create(B.prototype);q=gc.prototype;q.constructor=gc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.X=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.L=function(){Z.L(this);return this.a};q.K=function(){return this.a.cloneNode(!0)};
+q.wa=function(){this.c=Qb(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=J.ab;this.a.appendChild(this.c);return this};q.N=function(){Z.N(this);return this};q.update=function(a,b){B.prototype.update.call(this,a,b);this.H()};var W;function Xb(a){this.T={};for(var b=0,c=a.length;b<c;b++)null===a[b].service&&null===a[b].device&&Lb(this,JSON.parse(a[b].config))}function Lb(a,b){if(b.services)for(var c in b.services)a.T[c]=b.services[c];void 0!==b.emojiProvider&&(a.h=b.emojiProvider);void 0!==b.displayAvatar&&(a.a=b.displayAvatar);void 0!==b.colorfulNames&&(a.b=b.colorfulNames)}
+function ac(){var a=W,b={},c="";!1===a.a&&(b[".chatsystem-content .chatmsg-authorGroup .chatmsg-author-img-wrapper"]=["display: none"],b[".chatsystem-content .chatmsg-authorGroup"]=["display: flex"],b[".chatsystem-content .chatmsg-authorGroup .chatmsg-author"]=["position:initial","vertical-align:top","min-width:75px"],b[".chatsystem-content .chatmsg-authorGroup .chatmsg-author-messages"]=["padding-top:0","padding-left:0","display:inline-block","margin-top:-4px","flex:1"]);!0===a.b||(b[".chatsystem-content .chatmsg-authorGroup .chatmsg-author .chatmsg-author-name"]=
+["background-color: transparent !important;"]);for(var d in b)c+=d+"{",b[d].forEach(function(a){c+=a+";"}),c+="}";return c}W=new Xb([]);var ab=function(){var a=[];return{Wa:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},ob:function(b){var c=[];a.forEach(function(a){for(var d=0,f=a.names.length;d<f;d++)if(a.names[d].substr(0,b.length)===b){c.push(a);break}});return c},yb:function(b){b.V="client";b.exec=b.exec.bind(b);a.push(b)}}}();function ic(){return new Promise(function(a,b){"geolocation"in window.navigator?navigator.geolocation.getCurrentPosition(function(c){c?a(c):b("denied")}):b("geolocation not available")})}
+ya.push(function(){ab.yb({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:J.hb,exec:function(a,b){ic().then(function(a){var c=a.coords.latitude,e=a.coords.longitude;cb(b,"https://www.openstreetmap.org/?mlat="+c+"&mlon="+e+"&macc="+a.coords.accuracy+"#map=17/"+c+"/"+e)}).catch(function(a){console.error("Error: ",a)})}})});
 })();

+ 2 - 1
srv/public/style.css

@@ -111,7 +111,7 @@ button, .button { border: 1px solid black; border-radius: 3px; background: rgb(2
 .chatmsg-author { display: inline-block; }
 .chatmsg-author-img-wrapper { height: 36px; width: 36px; margin-right: 10px; }
 .chatmsg-author-img { max-height: 36px; max-width: 36px; border-radius: 3px; }
-.chatsystem-content a.chatmsg-author-name, .chatmsg-author-name { text-decoration: none; display: inline; font-weight: bold; color: #000; }
+.chatsystem-content a.chatmsg-author-name, .chatmsg-author-name { text-decoration: none; display: inline; font-weight: bold; color: #000; padding: 0 4px; border-radius: 3px;}
 .chatmsg-msg { display: block; vertical-align: top; }
 .chatmsg-reactions:empty,.chatmsg-attachments:empty { display: none; }
 .chatmsg-reactions { padding: 0 0 0 24px; margin: 5px 0; list-style: none; }
@@ -249,6 +249,7 @@ button, .button { border: 1px solid black; border-radius: 3px; background: rgb(2
 .settingNav ul { padding: 0; list-style: none; }
 .settingContent { display: inline-block; }
 .settingContent > section { display: none; }
+.settingContent > section > label { display: block; }
 .settingFooter { display: inline-block; line-height: 42px; min-height: 42px; text-align: right; }
 .maci-setting.display-services .settings-services { display: block; }
 .maci-setting.display-display .settings-display { display: block; }

+ 7 - 1
srv/src/models/accountConfig.js

@@ -90,6 +90,10 @@ AccountConfig.prototype.merge = function(configBlob) {
         this.displayAvatar = configBlob["displayAvatar"];
         modified = true;
     }
+    if (configBlob["colorfulNames"] !== undefined && configBlob["colorfulNames"] !== this.colorfulNames) {
+        this.colorfulNames = configBlob["colorfulNames"];
+        modified = true;
+    }
     return modified;
 };
 
@@ -201,7 +205,8 @@ AccountConfig.prototype.toDb = function() {
     return JSON.stringify({
         services: this.services,
         emojiProvider: this.emojiProvider,
-        displayAvatar: this.displayAvatar
+        displayAvatar: this.displayAvatar,
+        colorfulNames: this.colorfulNames
     });
 };
 
@@ -210,6 +215,7 @@ AccountConfig.prototype.fromDb = function(dbObj) {
     this.services = dbObj.services || [];
     this.emojiProvider = dbObj.emojiProvider;
     this.displayAvatar = dbObj.displayAvatar;
+    this.colorfulNames = dbObj.colorfulNames;
 };
 
 module.exports.accountConfigManager = new AccountConfigManager();

+ 20 - 2
srv/src/slack.js

@@ -668,6 +668,24 @@ Slack.prototype.unpinMsg = function(channel, msgId) {
         +"&timestamp=" +msgId);
 };
 
+function idify(data, str) {
+    return str.replace(/(^|\s)@(\S+)/g, function(match, p1, userName) {
+        for (var i in data.users) {
+            if (data.users[i].getName() === userName) {
+                return p1 +"<@" +data.users[i].remoteId +'|' +userName +'>';
+            }
+        }
+        return match;
+    }).replace(/(^|\s)#(\S+)/g, function(match, p1, chanName) {
+        for (var i in data.channels) {
+            if (data.channels[i].name === chanName) {
+                return p1 +"<#" +data.channels[i].remoteId +'|' +chanName +'>';
+            }
+        }
+        return match;
+    });
+}
+
 /**
  * @param {SlackChan|SlackGroup|SlackIms} channel
  * @param {Array.<string>} text
@@ -682,7 +700,7 @@ Slack.prototype.sendMsg = function(channel, text, attachments) {
         httpsRequest(SLACK_ENDPOINT +GETAPI.postMsg
             +"?token=" +this.token
             +"&channel=" +channel.remoteId
-            +"&text=" +text.join("\n")
+            +"&text=" +idify(this.data, text.join("\n"))
             +"&link_names=true"
             + (attachments ? ("&attachments=" +encodeURIComponent(JSON.stringify(attachments))) : "")
             +"&as_user=true");
@@ -691,7 +709,7 @@ Slack.prototype.sendMsg = function(channel, text, attachments) {
         text.forEach(function(i) {
             decodedText.push(decodeURIComponent(i));
         });
-        var fullDecodedText = decodedText.join("\n");
+        var fullDecodedText = idify(this.data, decodedText.join("\n"));
         this.pendingRtm[this.rtmId] = {
             type: 'message',
             channel: channel.remoteId,

+ 3 - 2
srv/src/template/index.js

@@ -62,8 +62,9 @@ module.exports.exec = function(req, res) {
                       </section>
                       <section class="settings-display">
                           <h4 id="settings-display-title"></h4>
-                          <label><span>Emoji provider</span><select id="settings-displayEmojiProvider"></select></label>
-                          <label><span>Display avatars</span><input type="checkbox" value="1" id="settings-displayDisplayAvatar"></label>
+                          <label><span id="settings-displayEmojiProviderLbl"></span><select id="settings-displayEmojiProvider"></select></label>
+                          <label><span id="settings-displayDisplayAvatarLbl"></span><input type="checkbox" value="1" id="settings-displayDisplayAvatar"></label>
+                          <label><span id="settings-displayColorfulNamesLbl"></span><input type="checkbox" value="1" id="settings-displayColorfulNames"></label>
                       </section>
                       <section class="settings-privacy">
                           <h4 id="settings-privacy-title"></h4>