فهرست منبع

[add] native menu

B Thibault 8 سال پیش
والد
کامیت
955e6b0768
11فایلهای تغییر یافته به همراه194 افزوده شده و 132 حذف شده
  1. 1 0
      Makefile
  2. 6 4
      cli/externs/native.js
  3. 1 1
      cli/msgFormatter
  4. 39 0
      cli/native.js
  5. 1 0
      cli/resources.js
  6. 17 19
      cli/ui.js
  7. 10 1
      cli/workflow.js
  8. 82 83
      srv/public/mimouchat.min.js
  9. 4 0
      srv/public/styleResponsive.css
  10. 1 1
      srv/src/httpServ.js
  11. 32 23
      srv/src/template/login.js

+ 1 - 0
Makefile

@@ -29,6 +29,7 @@ SRC=		srv/src/context.js			\
 			cli/uiMessage.js			\
 			cli/utils.js				\
 			cli/config.js				\
+			cli/native.js				\
 			\
 			cli/commands/core.js		\
 			cli/commands/sherlock.js

+ 6 - 4
cli/externs/native.js

@@ -2,14 +2,16 @@
 var __native = {
     /** @type {function()} */
     logout: function() {},
-    /** @type {function(string)} */
-    readSmsPermission: function(onResult) {},
+    /** @type {function()} */
+    readSmsPermission: function() {},
     /** @type {function():string} */
     getSms: function() {},
     /** @type {function():string} */
-    getSmsConversations: function() {},
-    /** @type {function():string} */
     getStatic: function() {},
+    /** @type {function(string)} */
+    setCurrentChannel: function(chanId) {},
+    /** @type {function(string, boolean, boolean)} */
+    setTitle: function(title, favEnabled, isFavorite) {}
 };
 /** @type {boolean} */
 var IS_LOCAL;

+ 1 - 1
cli/msgFormatter

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

+ 39 - 0
cli/native.js

@@ -0,0 +1,39 @@
+
+window["displayMenu"] = function() {
+    document.getElementById(R.id.context).classList.add(R.klass.opened);
+};
+
+window["hideMenu"] = function() {
+    document.getElementById(R.id.context).classList.remove(R.klass.opened);
+};
+
+window["toggleMenu"] = function() {
+    toggleMenu();
+};
+
+window["setChannelFavorite"] = function(chanId, val) {
+    var channel = DATA.context.getChannel(chanId);
+    if (channel) {
+        if (val)
+            starChannel(channel);
+        else
+            unstarChannel(channel);
+    } else {
+        console.error("Channel " +chanId +" not found");
+    }
+};
+
+window["onSmsPermissionUpdated"] = function(enabled) {
+    if ("__native" in window && enabled) {
+        var response = JSON.parse(__native.getStatic());
+        if (response) {
+            DATA.update(response);
+        }
+    }
+};
+
+/** @return {boolean} */
+function isNative() {
+    return !!("__native" in window);
+}
+

+ 1 - 0
cli/resources.js

@@ -71,6 +71,7 @@ var R = {
         unreadHi: "unreadHi",
         replyingTo: "replyingTo",
         presenceAway: "presence-away",
+        native: "native",
         typing: {
             container: "typing-container",
             dot1: "typing-dot1",

+ 17 - 19
cli/ui.js

@@ -89,7 +89,6 @@ function onContextUpdated() {
     document.getElementById(R.id.chanList).appendChild(chanListFram);
     filterChanList.apply(document.getElementById(R.id.chanFilter));
     setRoomFromHashBang();
-    updateTitle();
     if (SELECTED_CONTEXT) {
         createContextBackground(SELECTED_CONTEXT.getChatContext().team.id, SELECTED_CONTEXT.getChatContext().users, function(imgData) {
             document.getElementById(R.id.context).style.backgroundImage = 'url(' +imgData +')';
@@ -178,7 +177,6 @@ function onRoomSelected() {
         EDITING = null;
         onReplyingToUpdated();
     }
-    updateTitle();
     updateTypingChat();
 }
 
@@ -283,7 +281,9 @@ function updateTitle() {
     }
     if (!title.length && SELECTED_ROOM)
         title = SELECTED_ROOM.name;
-    document.title = title.length ? title : "Mimouchat";
+    title = title.length ? title : "Mimouchat";
+    document.title = title;
+    setNativeTitle(title);
 }
 
 function spawnNotification() {
@@ -374,6 +374,7 @@ function onRoomUpdated() {
     //TODO scroll lock
     content.scrollTop = content.scrollHeight -content.clientHeight;
     updateAuthorAvatarImsOffset();
+    updateTitle();
     if (window.hasFocus)
         markRoomAsRead(SELECTED_ROOM);
 }
@@ -538,6 +539,14 @@ function onEmojiReady() {
     }
 }
 
+function toggleMenu() {
+    var menu = document.getElementById(R.id.context);
+    if (menu.classList.contains(R.klass.opened))
+        menu.classList.remove(R.klass.opened);
+    else
+        menu.classList.add(R.klass.opened);
+}
+
 document.addEventListener('DOMContentLoaded', function() {
     initLang();
 
@@ -590,11 +599,7 @@ document.addEventListener('DOMContentLoaded', function() {
     });
 
     document.getElementById(R.id.contextButton).addEventListener("click", function(e) {
-        var menu = document.getElementById(R.id.context);
-        if (menu.classList.contains(R.klass.opened))
-            menu.classList.remove(R.klass.opened);
-        else
-            menu.classList.add(R.klass.opened);
+        toggleMenu();
     });
 
     document.getElementById(R.id.currentRoom.starButton).addEventListener("click", function(e) {
@@ -681,21 +686,14 @@ document.addEventListener('DOMContentLoaded', function() {
             });
     });
 
-    if ("__native" in window)
-        __native.readSmsPermission("onSmsPermissionUpdated");
+    if (isNative()) {
+        __native.readSmsPermission();
+        document.body.classList.add(R.klass.native);
+    }
     if (!IS_LOCAL)
         startPolling();
 });
 
-window["onSmsPermissionUpdated"] = function(enabled) {
-    if ("__native" in window && enabled) {
-        var response = JSON.parse(__native.getStatic());
-        if (response) {
-            DATA.update(response);
-        }
-    }
-};
-
 function onMsgFormSubmit() {
     var input = document.getElementById(R.id.message.input);
     if (SELECTED_ROOM && input.value) {

+ 10 - 1
cli/workflow.js

@@ -148,6 +148,13 @@ function startPolling() {
     poll(onPollResponse);
 }
 
+function setNativeTitle(title) {
+    if (isNative()) {
+        var enabled = !!(SELECTED_CONTEXT && SELECTED_CONTEXT.getChatContext().capacities["starChannel"]);
+        __native.setTitle(title, enabled, enabled ? SELECTED_ROOM.starred : false);
+    }
+}
+
 /**
  * @param {Room} room
 **/
@@ -158,6 +165,8 @@ function selectRoom(room) {
     document.body.classList.remove(R.klass.noRoomSelected);
     SELECTED_ROOM = room;
     SELECTED_CONTEXT = /** @type {SimpleChatSystem} */ (DATA.context.getChannelContext(room.id));
+    if (isNative)
+        __native.setCurrentChannel(room.id);
     onRoomSelected();
     roomInfo.hide();
     createContextBackground(SELECTED_CONTEXT.getChatContext().team.id, SELECTED_CONTEXT.getChatContext().users, function(imgData) {
@@ -364,7 +373,7 @@ function logout() {
     new HttpRequest(HttpRequestMethod.POST, "api/logout").send();
     document.cookie = "sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";
     document.location.reload();
-    if ("__native" in window)
+    if (isNative())
         __native.logout();
 }
 

+ 82 - 83
srv/public/mimouchat.min.js

@@ -1,8 +1,8 @@
 "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.pb=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.W=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.j={};this.i={};this.self=null;this.b={version:0,data:{}};this.h={version:0,data:{}};this.u={};this.aa={};this.o=0}function ea(a,b){return b.pv?new t(b.id,a.i[b.user]):new v(b.id)}
+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.pb=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.X=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.j={};this.i={};this.self=null;this.b={version:0,data:{}};this.h={version:0,data:{}};this.u={};this.W={};this.o=0}function ea(a,b){return b.pv?new t(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.j[d+b.channels[e].id])||(h=a.j[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.T||(a.self.T=new ca),b.self.prefs&&a.self.T.update(b.self.prefs,c));b.capacities&&(a.aa={},b.capacities.forEach(function(a){this.aa[a]=!0},a));a.o=Math.max(a.o,c)}"undefined"!==typeof module&&(module.J.Eb=da,module.J.Fb=aa,module.J.Hb=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.T||(a.self.T=new ca),b.self.prefs&&a.self.T.update(b.self.prefs,c));b.capacities&&(a.W={},b.capacities.forEach(function(a){this.W[a]=!0},a));a.o=Math.max(a.o,c)}"undefined"!==typeof module&&(module.J.Eb=da,module.J.Fb=aa,module.J.Hb=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.j[this.id]=this}a.topic&&(this.ta=a.topic.value,this.G=b.i[d+a.topic.creator],this.ea=a.topic.last_set);a.purpose&&(this.pa=a.purpose.value,this.o=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.ja(b,a.name),ma:c.ja(b,Object.values(a.i),function(a){return a?a.getName():null}),ta:c.ja(b,a.ta),pa:c.ja(b,a.pa)}}function t(a,b){v.call(this,a);this.a=b;this.name=b.getName();this.h=!0;b.O=this}t.prototype=Object.create(v.prototype);
 t.prototype.constructor=t;"undefined"!==typeof module&&(module.J.Nb=v,module.J.Mb=t);function w(a,b){this.K=a.user;this.username=a.username;this.id=a.id||a.ts;this.m=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 z(a,b){w.call(this,a,b)}function B(a,b){w.call(this,a,b)}
@@ -11,25 +11,25 @@ function la(a,b,c){var d=0;b.forEach(function(a){d=Math.max(this.push(a,c),d)}.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.m);for(;this.a.length>this.o;)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 na(a){return a.a[a.a.length-1]}function oa(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.m-c.m})}z.prototype=Object.create(w.prototype);z.prototype.constructor=z;B.prototype=Object.create(w.prototype);B.prototype.constructor=B;"undefined"!==typeof module&&(module.J={Jb:w,Ib:z,Lb:B,Ob:ka});function ga(a){this.id=a;this.j={};this.O=this.T=null;this.version=0}
 ga.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.Va=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.rb=a.goal);void 0!==a.phone&&(this.zb=a.phone);void 0!==a.first_name&&(this.Xa=a.first_name);void 0!==a.last_name&&(this.$a=a.last_name);void 0!==a.real_name&&(this.ib=a.real_name);void 0!==a.isPresent&&(this.N=a.isPresent);a.isBot&&(this.vb=a.isBot);this.version=Math.max(this.version,b)};
-function pa(a){return"api/avatar?user="+a.id}ga.prototype.getName=function(){return this.name||this.ib||this.Xa||this.$a};"undefined"!==typeof module&&(module.J.Gb=ga);function qa(){this.a=[]}qa.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.j)if(!0===b(e.j[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].j[b])return a.a[c];return null}
+function pa(a){return"api/avatar?user="+a.id}ga.prototype.getName=function(){return this.name||this.ib||this.Xa||this.$a};"undefined"!==typeof module&&(module.J.Gb=ga);function qa(){this.a=[]}qa.prototype.push=function(a){this.a.push(a)};function ra(a,b){for(var c=0,d=a.a.length;c<d;c++)if(b===sa(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.j)if(!0===b(e.j[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].j[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].j[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].j,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}qa.prototype.Ca=function(a){for(var b=0,c=this.a.length;b<c;b++){var d=this.a[b];if(d.self&&d.self.id===a)return!0}return!1};
 "undefined"!==typeof module&&(module.J.Kb=qa);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{ja:a}}();"undefined"!==typeof module&&(module.J.Pb=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={Db:"Utilisateur inconnu",Cb:"Channel inconnu",bb:"Nouveau message",message:"Message",ab:"Reseau",cb:"(visible seulement par vous)",A:"Favoris",j:"Discutions",ma:"Membres",hb:"Discutions priv\u00e9es",jb:"Partage sa position GPS",ok:"Ok",Wa:"Annuler",R: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()},Aa: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","settings-displayEmojiProviderLbl":"Gestionnaire d'emojis","settings-displayDisplayAvatarLbl":"Afficher les avatars","settings-displayColorfulNamesLbl":"Afficher les nomes en couleur"}};G.fr.eb=function(a){return 0===a?"Pas de message \u00e9pingl\u00e9":a+(1===a?" message \u00e9pingl\u00e9":" messages \u00e9pingl\u00e9s")};
 G.fr.kb=function(a){return 0===a?"Pas de chatteur":a+(1===a?" chatteur":" chatteurs")};G.fr.F=function(a){return"(edit&eacute; "+G.fr.R(a)+")"};G.fr.Ga=function(a,b){return"par "+a.getName()+" le "+G.fr.R(b)};G.en={Db:"Unknown member",Cb:"Unknown channel",bb:"New message",message:"Message",ab:"Network",cb:"(only visible to you)",A:"Starred",j:"Channels",ma:"Members",hb:"Direct messages",jb:"Share your GPS location",ok:"Ok",Wa:"Cancel",R: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()},Aa: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","settings-displayEmojiProviderLbl":"Emoji provider","settings-displayDisplayAvatarLbl":"Display avatars","settings-displayColorfulNamesLbl":"Colorful names"}};G.en.eb=function(a){return 0===a?"No pinned messages":a+(1===a?" pinned message":" pinned messages")};G.en.kb=function(a){return 0===a?"No users in this room":a+(1===a?" user":" users")};G.en.F=function(a){return"(edited "+G.en.R(a)+")"};G.en.Ga=function(a,b){return"by "+a.getName()+" on "+G.en.R(b)};var Aa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.Z=c;this.f=null;this.l=[];this.a=d||"";this.wa="<"===this.a;this.Fa="*"===this.a;this.va="_"===this.a;this.xa="~"===this.a||"-"===this.a;this.h=">"===this.a||"&gt;"===this.a;this.G=":"===this.a;this.Ha="`"===this.a;this.Sa="```"===this.a;this.Ia="\n"===this.a;this.ua=void 0!==d&&-1!==p.B.indexOf(d);this.g=b;this.ya=null;this.b=this.Ia||this.ua?c+d.length-1:!1;this.ua&&(this.f=new a(this),this.l.push(this.f),this.f.text=d)}
+"settings-serviceAddConfirm":"Next","settings-displayEmojiProviderLbl":"Emoji provider","settings-displayDisplayAvatarLbl":"Display avatars","settings-displayColorfulNamesLbl":"Colorful names"}};G.en.eb=function(a){return 0===a?"No pinned messages":a+(1===a?" pinned message":" pinned messages")};G.en.kb=function(a){return 0===a?"No users in this room":a+(1===a?" user":" users")};G.en.F=function(a){return"(edited "+G.en.R(a)+")"};G.en.Ga=function(a,b){return"by "+a.getName()+" on "+G.en.R(b)};var Aa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.$=c;this.f=null;this.l=[];this.a=d||"";this.wa="<"===this.a;this.Fa="*"===this.a;this.va="_"===this.a;this.xa="~"===this.a||"-"===this.a;this.h=">"===this.a||"&gt;"===this.a;this.G=":"===this.a;this.Ha="`"===this.a;this.Sa="```"===this.a;this.Ia="\n"===this.a;this.ua=void 0!==d&&-1!==p.B.indexOf(d);this.g=b;this.ya=null;this.b=this.Ia||this.ua?c+d.length-1:!1;this.ua&&(this.f=new a(this),this.l.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.l.length;c<e;c++){var f=
-a.l[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.l.splice(a.g.l.indexOf(a)+(c?1:0)),a.g.f=a.g.l[a.g.l.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,Za:!1}}var g,n,p={B:[],X:h,sa:h,la:k};b.prototype.Ka=function(){return this.Fa&&!!this.b||this.g instanceof b&&this.g.Ka()};b.prototype.Na=function(){return this.va&&!!this.b||this.g instanceof b&&this.g.Na()};
+a.l[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.l.splice(a.g.l.indexOf(a)+(c?1:0)),a.g.f=a.g.l[a.g.l.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,Za:!1}}var g,n,p={B:[],Y:h,sa:h,la:k};b.prototype.Ka=function(){return this.Fa&&!!this.b||this.g instanceof b&&this.g.Ka()};b.prototype.Na=function(){return this.va&&!!this.b||this.g instanceof b&&this.g.Na()};
 b.prototype.Oa=function(){return this.xa&&!!this.b||this.g instanceof b&&this.g.Oa()};b.prototype.ea=function(){return this.G&&!!this.b||this.g instanceof b&&this.g.ea()};b.prototype.Ma=function(){return this.ua&&!!this.b||this.g instanceof b&&this.g.Ma()};b.prototype.La=function(){return this.Ha&&!!this.b||this.g instanceof b&&this.g.La()};b.prototype.da=function(){return this.Sa&&!!this.b||this.g instanceof b&&this.g.da()};b.prototype.Pa=function(){for(var a=0,c=this.l.length;a<c;a++)if(this.l[a]instanceof
 b&&(!this.l[a].b||this.l[a].Pa()))return!0;return!1};b.prototype.Qa=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.Fa||this.va||this.xa))return!1;if(this.f&&this.Pa())return this.f.Ta();if(this.mb())return!0}return"\n"===g[a]&&this.h?!0:!1};b.prototype.mb=function(){for(var a=this;a;){for(var c=0,d=a.l.length;c<d;c++)if(a.l[c]instanceof b||a.l[c].text.length)return!0;a=a.ya}return!1};b.prototype.Ta=function(){var a=new b(this.g,
-this.Z,this.a);a.ya=this;this.f&&this.f instanceof b&&(a.f=this.f.Ta(),a.l=[a.f]);return a};b.prototype.nb=function(a){return this.G&&(" "===g[a]||"\t"===g[a])||(this.G||this.wa||this.Fa||this.va||this.xa||this.Ha)&&"\n"===g[a]?!1:!0};b.prototype.ob=function(b){if(this.Ha||this.G||this.Sa||this.wa)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.Ea();if(void 0===f||f){if("&gt;"===g.substr(b,4))return"&gt;";if(">"===g[b])return g[b]}if("`"===
+this.$,this.a);a.ya=this;this.f&&this.f instanceof b&&(a.f=this.f.Ta(),a.l=[a.f]);return a};b.prototype.nb=function(a){return this.G&&(" "===g[a]||"\t"===g[a])||(this.G||this.wa||this.Fa||this.va||this.xa||this.Ha)&&"\n"===g[a]?!1:!0};b.prototype.ob=function(b){if(this.Ha||this.G||this.Sa||this.wa)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.Ea();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.Ea=function(){if(""!==this.text.trim())return!1};b.prototype.Ea=function(){for(var a=this.l.length-1;0<=a;a--){var b=this.l[a].Ea();if(void 0!==b)return b}if(this.Ia||
-this.h)return!0};a.prototype.o=function(a){this.text+=g[a];return 1};b.prototype.o=function(c){var d=this.f&&!this.f.b&&this.f.Qa?this.f.Qa(c):null;if(d){var e=this.f.a.length;this.f.Ja(c);d instanceof b&&(this.f=d,this.l.push(d));return e}if(!this.f||this.f.b||this.f instanceof a||this.f.nb(c)){if(d=this.ob(c))return this.f=new b(this,c,d),this.l.push(this.f),this.f.a.length;if(!this.f||this.f.b)this.f=new a(this),this.l.push(this.f);return this.f.o(c)}d=this.f.Z+1;n.ba(this.f.Z);this.f=new a(this);
-this.f.o(d-1);this.l.pop();this.l.push(this.f);return d-c};b.prototype.Ja=function(a){for(var b=this;b;)b.b=a,b=b.ya};b.prototype.ba=function(a){this.b&&this.b>=a&&(this.b=!1);this.l.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.X(a);return b?b:a}return(a=p.X(this.text))?a:this.text}if(this.g.da()){if("undefined"!==typeof hljs)try{return a=this.text.match(/^\w+/),hljs.configure({useBR:!0,
+this.h)return!0};a.prototype.o=function(a){this.text+=g[a];return 1};b.prototype.o=function(c){var d=this.f&&!this.f.b&&this.f.Qa?this.f.Qa(c):null;if(d){var e=this.f.a.length;this.f.Ja(c);d instanceof b&&(this.f=d,this.l.push(d));return e}if(!this.f||this.f.b||this.f instanceof a||this.f.nb(c)){if(d=this.ob(c))return this.f=new b(this,c,d),this.l.push(this.f),this.f.a.length;if(!this.f||this.f.b)this.f=new a(this),this.l.push(this.f);return this.f.o(c)}d=this.f.$+1;n.ba(this.f.$);this.f=new a(this);
+this.f.o(d-1);this.l.pop();this.l.push(this.f);return d-c};b.prototype.Ja=function(a){for(var b=this;b;)b.b=a,b=b.ya};b.prototype.ba=function(a){this.b&&this.b>=a&&(this.b=!1);this.l.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.Y(a);return b?b:a}return(a=p.Y(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(u){console.error(u)}return this.text.replace(/\n/g,"<br/>")}return p.sa(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.La()?(b.push("code"),d=this.innerHTML()):(this.g.wa&&(d=p.la(this.text))?
 (a="a",c=' href="'+d.link+'"',d.style&&(c+=' style="'+d.style+'"'),d.Za||(c+=' target="_blank"'),d.Ua&&d.Ua.forEach(function(a){b.push(a)}),d=p.sa(d.text)):d=this.innerHTML(),this.g.Ka()&&b.push("bold"),this.g.Na()&&b.push("italic"),this.g.Oa()&&b.push("strike"),this.g.ea()&&b.push("emoji"),this.g.Ma()&&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.Ia&&(a+="<br/>");this.l.forEach(function(b){a+=
-b.outerHTML()});this.h&&(a+="</span>");return a};b.prototype.Ra=function(a){this.h&&!this.b&&this.Ja(a);this.l.forEach(function(c){c instanceof b&&c.Ra(a)})};return function(c,m){m||(m={});p.B=m.B||[];p.X=m.X||h;p.sa=m.sa||f;p.la=m.la||k;g=c;n=new b(this,0);m=0;c=g.length;do{for(;m<c;)m+=n.o(m);n.Ra(g.length);if(m=d()){e(m,!1);n.ba(m.Z);var l=new a(m.g);l.o(m.Z);m.g.l.push(l);m.g.f=l;m=m.Z+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.o,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}
+b.outerHTML()});this.h&&(a+="</span>");return a};b.prototype.Ra=function(a){this.h&&!this.b&&this.Ja(a);this.l.forEach(function(c){c instanceof b&&c.Ra(a)})};return function(c,m){m||(m={});p.B=m.B||[];p.Y=m.Y||h;p.sa=m.sa||f;p.la=m.la||k;g=c;n=new b(this,0);m=0;c=g.length;do{for(;m<c;)m+=n.o(m);n.Ra(g.length);if(m=d()){e(m,!1);n.ba(m.$);var l=new a(m.g);l.o(m.$);m.g.l.push(l);m.g.f=l;m=m.$+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.o,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 N(a,b){a.o||(a.o=[]);a.o.push(b);return a}function Da(a,b){a.h||(a.h=[]);a.h.push(b);return a}function Ea(a){a.a.timeout=6E4;return a}function Fa(a,b){a.a.responseType=b;return a}function O(a,b){a.a.open(a.method,a.G,!0);a.a.send(b)};function Ga(a,b){this.title=a;this.content=b;this.c=Ha(this);this.b=Ia(this);this.a=[];this.h=[]}
 function Ha(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=Ja;d.className=Ka;e.className=La;e.textContent="x";c.appendChild(d);c.appendChild(e);b.appendChild(c);f.className=
 Ma;b.appendChild(f);b.b.className=Na;b.b.textContent=J.Wa;b.b.addEventListener("click",function(){Oa(a,!1)});e.addEventListener("click",function(){Oa(a,!1)});b.a.addEventListener("click",function(){Oa(a,!0)});h.appendChild(b.b);b.a.className=Na;b.a.textContent=J.ok;h.appendChild(b.a);h.className=Pa+" "+Qa;b.appendChild(h);b.className=Ra;return b}function Oa(a,b){(b?a.a:a.h).forEach(function(a){a()});a.close()}
@@ -38,8 +38,8 @@ function Wa(a,b){var c=document.createElement("li"),d=document.createElement("sp
 return c}
 function Xa(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=P.j;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=Q instanceof t?P.i:Q.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+":",Ba:p,oa:Ya.name})}for(g in P.b.data)g.length>=b.length&&g.substr(0,b.length)===b&&(k=document.createElement("span"),k.className="emoji-small",k.appendChild(Za(g)),d.push({name:":"+g+":",
-Ba:k,oa:"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=$a.Ya(b))&&d.push(a):(d=$a.qb(b),c.dataset.cursor=JSON.stringify([0,a.selectionEnd]));a=P?P.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.W.localeCompare(b.W)||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(Va(J.ma))}b=document.createElement("span");b.className="chat-command-userIcon";b.style.backgroundImage='url("'+pa(e)+'")';l.appendChild(Wa("@"+e.getName(),b))}else e instanceof v?(m||(m=!0,l.appendChild(Va(J.j))),l.appendChild(Wa("#"+e.name))):e.Ba?(m!==e.oa&&(m=e.oa,l.appendChild(Va(e.oa))),l.appendChild(Wa(e.name,e.Ba))):(m!==e.W&&(m=e.W,l.appendChild(Va(e.W))),l.appendChild(Wa(e)));c.appendChild(l)}}
+Ba:k,oa:"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=$a.Ya(b))&&d.push(a):(d=$a.qb(b),c.dataset.cursor=JSON.stringify([0,a.selectionEnd]));a=P?P.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.X.localeCompare(b.X)||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(Va(J.ma))}b=document.createElement("span");b.className="chat-command-userIcon";b.style.backgroundImage='url("'+pa(e)+'")';l.appendChild(Wa("@"+e.getName(),b))}else e instanceof v?(m||(m=!0,l.appendChild(Va(J.j))),l.appendChild(Wa("#"+e.name))):e.Ba?(m!==e.oa&&(m=e.oa,l.appendChild(Va(e.oa))),l.appendChild(Wa(e.name,e.Ba))):(m!==e.X&&(m=e.X,l.appendChild(Va(e.X))),l.appendChild(Wa(e)));c.appendChild(l)}}
 function ab(a){if(R)return O(new K("PUT","api/msg?room="+Q.id+"&ts="+R.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=P,d=$a.Ya(c);if(d)return a=a.trim(),d.exec(b,Q,a),!0;if(b&&(c=b.h.data[c])){if("/me"===c.name)bb(Q,a,!0);else if("/msg"===c.name){a=a.trim();var b=/(\S+)\s+(.*)/.exec(a);a:{var e=b[1],d=P,f=e,h=[];"#"===f[0]&&(f=f.substr(1));for(var k in d.j)d.j[k].name===f&&h.push(d.j[k]);if(h.length)var g=h[0];
 else{k=[];"@"===e[0]&&(e=e.substr(1));for(g in d.i)d.i[g].getName()===e&&k.push(d.j[g]);if(k.length)for(g=0,d=k.length;g<d;g++)if(k[g].O){g=k[g].O;break a}g=null}}g&&bb(g,b[2],!1)}O(new K("POST","api/cmd?room="+Q.id+"&cmd="+encodeURIComponent(c.name.substr(1))+"&args="+encodeURIComponent(a)));return!0}return!1}g=bb(Q,a,!1);cb(Q,a,g,S);return!0}function T(){document.getElementById("msgInput").focus()}
 function db(a){for(var b=1,c=0,d=a.value.length;c<d;c++)"\n"===a.value[c]&&b++;for(a.rows=Math.min(5,b);5>a.rows&&a.scrollHeight>a.clientHeight;)a.rows++}
@@ -48,99 +48,98 @@ this.selectionEnd=a+1):fb(),!1});document.getElementById("slashList").addEventLi
 function ib(){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.j[a];b=d.j[b];return a.name===b.name?(h[a.id]=J.Aa(c.a.name,a.name),h[b.id]=J.Aa(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 t){var b;if(b=!a.a.Va){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(jb());b.appendChild(p);a.a.N||b.classList.add("presence-away");Q===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",Q===a&&b.classList.add("selected"),p.textContent=k||a.name,b.appendChild(jb()),b.appendChild(p),a.I!==a.C&&void 0!==a.I&&(b.classList.add("unread"),0<=U.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(kb(J.A));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(kb(J.j));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});
-f.length&&a.appendChild(kb(J.hb));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);lb.apply(document.getElementById("chanSearch"));mb();nb();P&&ob(P.a.id,P.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"})}
-function pb(){va(function(a){var b=a.u,c;for(c in a.self.j)if(!a.self.j[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].O)&&!c.fa&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing"))});qb()}
-function qb(){var a;document.getElementById("whoistyping").textContent="";if(P&&Q&&(a=P.u[Q.id])){var b=document.createDocumentFragment(),c=!1,d;for(d in a)(a=F(d))?b.appendChild(rb(a)):c=!0;c&&(C.b=0);document.getElementById("whoistyping").appendChild(b)}}function sb(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");nb()}
-function tb(){var a=Q.name||(Q.a?Q.a.getName():void 0);if(!a){console.error("No name provided for ",Q);var a=[],b;for(b in Q.i)a.push(Q.i[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;ub();T();document.getElementById("fileUploadContainer").classList.add("hidden");vb();S&&(S=null,V());R&&(R=null,V());nb();qb()}
+f.length&&a.appendChild(kb(J.hb));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);lb.apply(document.getElementById("chanSearch"));mb();P&&nb(P.a.id,P.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.j)if(!a.self.j[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].O)&&!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(P&&Q&&(a=P.u[Q.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");sb()}
+function tb(){var a=Q.name||(Q.a?Q.a.getName():void 0);if(!a){console.error("No name provided for ",Q);var a=[],b;for(b in Q.i)a.push(Q.i[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;ub();T();document.getElementById("fileUploadContainer").classList.add("hidden");vb();S&&(S=null,V());R&&(R=null,V());pb()}
 function V(){if(S){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){S=null;V()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(S.L())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";T()}
 function wb(){if(R){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){R=null;wb()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(R.L());document.getElementById("msgInput").value=R.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";T()}
 window.toggleReaction=function(a,b,c){var d=C.a[a],e,f;(d=C.a[a])&&(e=oa(d,b))&&(f=D(C.context,a))&&(e.D[c]&&-1!==e.D[c].indexOf(f.self.id)?O(new K("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c))):xb(a,b,c))};function yb(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
-function nb(){var a=U.length,b="";if(W)b="!"+J.ab+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",yb(a,a);else{var c=0;ua(C.context,function(a){a.I>a.C&&c++});c&&(b="("+c+")");yb(0,c)}!b.length&&Q&&(b=Q.name);document.title=b.length?b:"Mimouchat"}
-function zb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(hb+3E4<a){var b=new Notification(J.bb);hb=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
-function ub(){var a=document.createDocumentFragment(),b=Q.id,c=null,d=0,e=null,f;Q.A?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");gb=[];C.a[b]&&C.a[b].a.forEach(function(b){if(b.h)b.Y();else{var h=b.M(),k=!1;c&&c.K===b.K&&b.K?30>Math.abs(d-b.m)&&!(b instanceof z)?e.classList.add("chatmsg-same-ts"):d=b.m:(d=b.m,k=!0);(!c||c.m<=Q.C)&&b.m>Q.C?h.classList.add("chatmsg-first-unread"):h.classList.remove("chatmsg-first-unread");
-if(b instanceof z)e=c=null,d=0,a.appendChild(h),f=null;else{if(k||!f)f=Ab(F(b.K),b.username),gb.push(f),a.appendChild(f);c=b;e=h;f.content.appendChild(h)}}});var h=!0;Bb.forEach(function(b){b.channel===Q.id&&(h&&(f=Ab(P.self,""),a.appendChild(f),h=!1),f.content.appendChild(b.c))});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;Cb();window.hasFocus&&vb()}
-function Db(a,b){if(a.classList.contains("chatmsg-hover-reply"))R&&(R=null,wb()),S!==b&&(S=b,V());else if(a.classList.contains("chatmsg-hover-reaction")){var c=Q.id,d=b.id;Eb.qa(document.body,P,function(a){a&&xb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(S&&(S=null,V()),R!==b&&(R=b,wb())):a.classList.contains("chatmsg-hover-star")?b.A?O(new K("DELETE","api/starMsg?room="+Q.id+"&msgId="+b.id)):O(new K("POST","api/starMsg?room="+Q.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-pin")?
-b.pinned?Fb(Q,b):O(new K("POST","api/pinMsg?room="+Q.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-remove")&&(S&&(S=null,V()),R&&(R=null,wb()),O(new K("DELETE","api/msg?room="+Q.id+"&ts="+b.id)))}function bb(a,b,c){b={channel:a.id,text:b.trim(),Ca:c,c:Gb(b,c)};Bb.push(b);a===Q&&ub();return b}
-function Hb(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=oa(C.a[Q.id],d))&&a.s[e]&&a.s[e].actions&&a.s[e].actions[f]&&
-Ib(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=oa(C.a[Q.id],d))&&Db(c,a);break}c=c.parentElement}}
-function Ib(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.K);O(h,JSON.stringify(d))}var e=Q.id;c.confirm?Ua(Ta(new Ga(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).qa():d()}
-function Cb(){if(!1!==X.a){var a=document.getElementById("chatWindow").getBoundingClientRect().top;gb.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();Jb();eb();var a=document.getElementById("chanSearch");a.addEventListener("input",lb);a.addEventListener("blur",lb);document.getElementById("chatWindow").addEventListener("click",Hb);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&mb()});document.addEventListener("mouseover",function(a){a=a.target;if(Kb.wb(a))Kb.$();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)){Kb.fb(d,d.j[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].O)){Kb.fb(d,b).show(a);return}}}a=a.parentElement}Kb.tb()}});document.getElementById("chatCtxButton").addEventListener("click",function(){var a=document.getElementById("chatCtx");a.classList.contains("opened")?a.classList.remove("opened"):a.classList.add("opened")});document.getElementById("currentRoomStar").addEventListener("click",
-function(a){a.preventDefault();Q&&(Q.A?O(new K("POST","api/unstarChannel?room="+Q.id)):O(new K("POST","api/starChannel?room="+Q.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",
-Lb);document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();Mb.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),Nb(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();Q&&document.getElementById("fileUploadContainer").classList.remove("hidden");return!1});document.getElementById("msgFormSubmit").addEventListener("click",function(a){a.preventDefault();fb();return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();fb();return!1});window.addEventListener("blur",
-function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;hb=0;Q&&vb();T()});document.getElementById("chatWindow").addEventListener("scroll",Cb);window.hasFocus=!0;document.getElementById("emojiButton").addEventListener("click",function(){P&&Eb.qa(document.body,P,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");T()})});"__native"in window&&__native.readSmsPermission("onSmsPermissionUpdated");IS_LOCAL||Ob()});
-window.onSmsPermissionUpdated=function(a){"__native"in window&&a&&(a=JSON.parse(__native.getStatic()))&&C.update(a)};function fb(){var a=document.getElementById("msgInput");Q&&a.value&&ab(a.value)&&(a.value="",S&&(S=null,V()),R&&(R=null,V()),document.getElementById("slashList").textContent="",db(a));T()};var Mb=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={U:"services",
+function sb(){var a=U.length,b="";if(W)b="!"+J.ab+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",yb(a,a);else{var c=0;ua(C.context,function(a){a.I>a.C&&c++});c&&(b="("+c+")");yb(0,c)}!b.length&&Q&&(b=Q.name);b=b.length?b:"Mimouchat";document.title=b;zb(b)}
+function Ab(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(hb+3E4<a){var b=new Notification(J.bb);hb=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
+function ub(){var a=document.createDocumentFragment(),b=Q.id,c=null,d=0,e=null,f;Q.A?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");gb=[];C.a[b]&&C.a[b].a.forEach(function(b){if(b.h)b.Z();else{var h=b.M(),k=!1;c&&c.K===b.K&&b.K?30>Math.abs(d-b.m)&&!(b instanceof z)?e.classList.add("chatmsg-same-ts"):d=b.m:(d=b.m,k=!0);(!c||c.m<=Q.C)&&b.m>Q.C?h.classList.add("chatmsg-first-unread"):h.classList.remove("chatmsg-first-unread");
+if(b instanceof z)e=c=null,d=0,a.appendChild(h),f=null;else{if(k||!f)f=Bb(F(b.K),b.username),gb.push(f),a.appendChild(f);c=b;e=h;f.content.appendChild(h)}}});var h=!0;Cb.forEach(function(b){b.channel===Q.id&&(h&&(f=Bb(P.self,""),a.appendChild(f),h=!1),f.content.appendChild(b.c))});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;Db();sb();window.hasFocus&&vb()}
+function Eb(a,b){if(a.classList.contains("chatmsg-hover-reply"))R&&(R=null,wb()),S!==b&&(S=b,V());else if(a.classList.contains("chatmsg-hover-reaction")){var c=Q.id,d=b.id;Fb.qa(document.body,P,function(a){a&&xb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(S&&(S=null,V()),R!==b&&(R=b,wb())):a.classList.contains("chatmsg-hover-star")?b.A?O(new K("DELETE","api/starMsg?room="+Q.id+"&msgId="+b.id)):O(new K("POST","api/starMsg?room="+Q.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-pin")?
+b.pinned?Gb(Q,b):O(new K("POST","api/pinMsg?room="+Q.id+"&msgId="+b.id)):a.classList.contains("chatmsg-hover-remove")&&(S&&(S=null,V()),R&&(R=null,wb()),O(new K("DELETE","api/msg?room="+Q.id+"&ts="+b.id)))}function bb(a,b,c){b={channel:a.id,text:b.trim(),Ca:c,c:Hb(b,c)};Cb.push(b);a===Q&&ub();return b}
+function Ib(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=oa(C.a[Q.id],d))&&a.s[e]&&a.s[e].actions&&a.s[e].actions[f]&&
+Jb(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=oa(C.a[Q.id],d))&&Eb(c,a);break}c=c.parentElement}}
+function Jb(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.K);O(h,JSON.stringify(d))}var e=Q.id;c.confirm?Ua(Ta(new Ga(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).qa():d()}
+function Db(){if(!1!==X.a){var a=document.getElementById("chatWindow").getBoundingClientRect().top;gb.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"})}}function Kb(){var a=document.getElementById("chatCtx");a.classList.contains("opened")?a.classList.remove("opened"):a.classList.add("opened")}
+document.addEventListener("DOMContentLoaded",function(){za();Lb();eb();var a=document.getElementById("chanSearch");a.addEventListener("input",lb);a.addEventListener("blur",lb);document.getElementById("chatWindow").addEventListener("click",Ib);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&mb()});document.addEventListener("mouseover",function(a){a=a.target;if(Mb.wb(a))Mb.aa();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)){Mb.fb(d,d.j[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].O)){Mb.fb(d,b).show(a);return}}}a=a.parentElement}Mb.tb()}});document.getElementById("chatCtxButton").addEventListener("click",function(){Kb()});document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();Q&&(Q.A?Nb(Q):Ob(Q));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",Pb);document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();Qb.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),Rb(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();Q&&document.getElementById("fileUploadContainer").classList.remove("hidden");
+return!1});document.getElementById("msgFormSubmit").addEventListener("click",function(a){a.preventDefault();fb();return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();fb();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;hb=0;Q&&vb();T()});document.getElementById("chatWindow").addEventListener("scroll",Db);window.hasFocus=!0;document.getElementById("emojiButton").addEventListener("click",
+function(){P&&Fb.qa(document.body,P,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");T()})});Sb()&&(__native.readSmsPermission("onSmsPermissionUpdated"),document.body.classList.add("native"));IS_LOCAL||Tb()});function fb(){var a=document.getElementById("msgInput");Q&&a.value&&ab(a.value)&&(a.value="",S&&(S=null,V()),R&&(R=null,V()),document.getElementById("slashList").textContent="",db(a));T()};var Qb=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={U:"services",
 display:"display",Qb:"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!==X.h&&(b.emojiProvider=document.getElementById("settings-displayEmojiProvider").value);var c=!!document.getElementById("settings-displayDisplayAvatar").checked;
-c!==(!1!==X.a)&&(b.displayAvatar=c);c=!!document.getElementById("settings-displayColorfulNames").checked;c!==(!0===X.b)&&(b.colorfulNames=c);var c=X,d;for(d in b){Pb(c,b);Qb();O(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 X.U){var n=X.U[g];for(m in n){var f=document.createElement("li"),p=document.createElement("span"),
+c!==(!1!==X.a)&&(b.displayAvatar=c);c=!!document.getElementById("settings-displayColorfulNames").checked;c!==(!0===X.b)&&(b.colorfulNames=c);var c=X,d;for(d in b){Ub(c,b);Vb();O(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 X.U){var n=X.U[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 Rb){var m=document.createElement("option");m.value=g;m.textContent=Rb[g].name;Rb[g]===Ya&&(m.selected=!0);d.appendChild(m)}n.textContent="";n.appendChild(d);document.getElementById("settings-displayDisplayAvatar").checked=!1!==X.a;document.getElementById("settings-displayColorfulNames").checked=!0===X.b;c=!0}b(a||e.U);return this},Bb:function(){return this},yb:e}}();function Sb(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.S=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=document.createDocumentFragment();n=document.getElementById("settings-displayEmojiProvider");for(g in Wb){var m=document.createElement("option");m.value=g;m.textContent=Wb[g].name;Wb[g]===Ya&&(m.selected=!0);d.appendChild(m)}n.textContent="";n.appendChild(d);document.getElementById("settings-displayDisplayAvatar").checked=!1!==X.a;document.getElementById("settings-displayColorfulNames").checked=!0===X.b;c=!0}b(a||e.U);return this},Bb:function(){return this},yb:e}}();function Xb(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.S=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),
-ra=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,{ub:e,xb:g,lb:d}).then(function(a){if(a.lb===b){h.drawImage(a.S,100*a.ub,100*a.xb,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!==ra&&(f.beginPath(),f.arc(a,c,Math.max(ra,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===ra||25<ra)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"),u=document.createElement("button");e.className=
+ta=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,{ub:e,xb:g,lb:d}).then(function(a){if(a.lb===b){h.drawImage(a.S,100*a.ub,100*a.xb,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!==ta&&(f.beginPath(),f.arc(a,c,Math.max(ta,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===ta||25<ta)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"),u=document.createElement("button");e.className=
 "OSM-wrapper";d.className="OSM-canvas";l.className="OSM-controls";u.className="OSM-controls-zoomMin";m.className="OSM-controls-zoomPlus";u.addEventListener("click",function(){p(n-1)});m.addEventListener("click",function(){p(n+1)});l.appendChild(u);l.appendChild(m);e.appendChild(d);e.appendChild(l);return e}};function jb(){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 kb=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
-function Tb(a){var b={},c=a;if(P)for(var d=P;!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 Za(a){return"makeEmoji"in window?(a=Tb(a),"string"===typeof a&&(a=window.makeEmoji(a)),"string"===typeof a?null:a):null}
-function Ub(a){var b=document.createElement("div"),c=document.createElement("div");b.ca=document.createElement("ul");b.s=document.createElement("ul");b.D=document.createElement("ul");b.m=document.createElement("div");b.ra=document.createElement("div");b.ha=document.createElement("span");b.className="chatmsg-item";b.m.className="chatmsg-ts";b.ra.className="chatmsg-msg";b.ha.className="chatmsg-author-name";if(a){b.id=a.b+"_"+a.id;var d=b.ca,e=a.context.aa;a=C.context.Ca(a.K);if(e.replyToMsg){var f=
-document.createElement("li");f.className="chatmsg-hover-reply";f.style.backgroundImage='url("repl.svg")';d.appendChild(f)}e.reactMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-reaction",f.style.backgroundImage='url("smile.svg")',d.appendChild(f));if(a&&e.editMsg||e.editOtherMsg)f=document.createElement("li"),f.className="chatmsg-hover-edit",f.style.backgroundImage='url("edit.svg")',d.appendChild(f);e.starMsg&&(d.ka=document.createElement("li"),d.ka.className="chatmsg-hover-star",
-d.appendChild(d.ka));e.pinMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-pin",d.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")',d.appendChild(e);b.ca.className="chatmsg-hover"}c.appendChild(b.ha);c.appendChild(b.ra);c.appendChild(b.m);c.appendChild(b.s);b.F=document.createElement("div");b.F.className="chatmsg-edited";c.appendChild(b.F);
-c.appendChild(b.D);c.className="chatmsg-content";b.s.className="chatmsg-attachments";b.D.className="chatmsg-reactions";b.appendChild(c);b.appendChild(b.ca);return b}
-function Vb(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 Ab(a,b){var c=document.createElement("div"),d=document.createElement("div"),e=document.createElement("a"),f=document.createElement("img");c.ga=document.createElement("span");c.ga.className="chatmsg-author-img-wrapper";f.className="chatmsg-author-img";e.className="chatmsg-author-name";e.href="#"+a.id;a?(e.textContent=a.getName(),e.style.backgroundColor=Vb(a.getName()),f.src=pa(a)):(e.textContent=b||"?",f.src="");c.ga.appendChild(f);d.appendChild(c.ga);d.appendChild(e);d.className="chatmsg-author";
-c.className="chatmsg-authorGroup";c.appendChild(d);c.content=document.createElement("div");c.content.className="chatmsg-author-messages";c.appendChild(c.content);return c}function Wb(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 Xb(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"),u=document.createElement("img"),A=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=Wb(b.color||"");e.className="chatmsg-attachment-block";
+function Yb(a){var b={},c=a;if(P)for(var d=P;!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 Za(a){return"makeEmoji"in window?(a=Yb(a),"string"===typeof a&&(a=window.makeEmoji(a)),"string"===typeof a?null:a):null}
+function Zb(a){var b=document.createElement("div"),c=document.createElement("div");b.ca=document.createElement("ul");b.s=document.createElement("ul");b.D=document.createElement("ul");b.m=document.createElement("div");b.ra=document.createElement("div");b.ha=document.createElement("span");b.className="chatmsg-item";b.m.className="chatmsg-ts";b.ra.className="chatmsg-msg";b.ha.className="chatmsg-author-name";if(a){b.id=a.b+"_"+a.id;var d=b.ca,e=a.context.W;a=C.context.Ca(a.K);if(e.replyToMsg){var f=document.createElement("li");
+f.className="chatmsg-hover-reply";f.style.backgroundImage='url("repl.svg")';d.appendChild(f)}e.reactMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-reaction",f.style.backgroundImage='url("smile.svg")',d.appendChild(f));if(a&&e.editMsg||e.editOtherMsg)f=document.createElement("li"),f.className="chatmsg-hover-edit",f.style.backgroundImage='url("edit.svg")',d.appendChild(f);e.starMsg&&(d.ka=document.createElement("li"),d.ka.className="chatmsg-hover-star",d.appendChild(d.ka));e.pinMsg&&
+(f=document.createElement("li"),f.className="chatmsg-hover-pin",d.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")',d.appendChild(e);b.ca.className="chatmsg-hover"}c.appendChild(b.ha);c.appendChild(b.ra);c.appendChild(b.m);c.appendChild(b.s);b.F=document.createElement("div");b.F.className="chatmsg-edited";c.appendChild(b.F);c.appendChild(b.D);c.className=
+"chatmsg-content";b.s.className="chatmsg-attachments";b.D.className="chatmsg-reactions";b.appendChild(c);b.appendChild(b.ca);return b}function $b(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 Bb(a,b){var c=document.createElement("div"),d=document.createElement("div"),e=document.createElement("a"),f=document.createElement("img");c.ga=document.createElement("span");c.ga.className="chatmsg-author-img-wrapper";f.className="chatmsg-author-img";e.className="chatmsg-author-name";e.href="#"+a.id;a?(e.textContent=a.getName(),e.style.backgroundColor=$b(a.getName()),f.src=pa(a)):(e.textContent=b||"?",f.src="");c.ga.appendChild(f);d.appendChild(c.ga);d.appendChild(e);d.className="chatmsg-author";
+c.className="chatmsg-authorGroup";c.appendChild(d);c.content=document.createElement("div");c.content.className="chatmsg-author-messages";c.appendChild(c.content);return c}function ac(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 bc(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"),u=document.createElement("img"),A=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=ac(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=Sb(b.geo))&&p.appendChild(l);u.className="chatmsg-attachment-img";b.image_url?
+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=Xb(b.geo))&&p.appendChild(l);u.className="chatmsg-attachment-img";b.image_url?
 u.src=b.image_url:u.classList.add("hidden");A.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",A.appendChild(m)),A.appendChild(l));b.ts&&(l=document.createElement("span"),l.className="chatmsg-ts",l.innerHTML=J.R(b.ts),A.appendChild(l));e.appendChild(h);e.appendChild(k);e.appendChild(p);
 e.appendChild(u);if(b.fields&&b.fields.length){var x=document.createElement("ul");e.appendChild(x);x.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&&x.appendChild(e)})}if(b.actions&&
-b.actions.length)for(h=document.createElement("ul"),h.className="chatmsg-attachment-actions "+Pa,e.appendChild(h),k=0,p=b.actions.length;k<p;k++)(u=b.actions[k])&&(u=Yb(c,k,u))&&h.appendChild(u);e.appendChild(A);d.appendChild(f);d.appendChild(e);return d}
-function Yb(a,b,c){var d=document.createElement("li"),e=Wb(c.style);d.textContent=c.text;e!==Wb()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Na;return d}function rb(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(jb());b.appendChild(c);return b};var Eb=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(){x={};l.textContent="";window.emojiProviderHeader&&(l.appendChild(k(window.emojiProviderHeader)),m.textContent="",l.appendChild(m));l.appendChild(k("emojicustom.png"));l.appendChild(u)}function c(){if(!d())return!1;r&&r(null);return!0}function d(){return n.parentElement?(n.parentElement.removeChild(p),n.parentElement.removeChild(n),
+b.actions.length)for(h=document.createElement("ul"),h.className="chatmsg-attachment-actions "+Pa,e.appendChild(h),k=0,p=b.actions.length;k<p;k++)(u=b.actions[k])&&(u=cc(c,k,u))&&h.appendChild(u);e.appendChild(A);d.appendChild(f);d.appendChild(e);return d}
+function cc(a,b,c){var d=document.createElement("li"),e=ac(c.style);d.textContent=c.text;e!==ac()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Na;return d}function qb(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(jb());b.appendChild(c);return b};var Fb=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(){x={};l.textContent="";window.emojiProviderHeader&&(l.appendChild(k(window.emojiProviderHeader)),m.textContent="",l.appendChild(m));l.appendChild(k("emojicustom.png"));l.appendChild(u)}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?A.value:a;if(g()){var c=0,d=window.searchEmojis(a),e=f(d,I?I.self.T.a:[]),p;for(k in x)x[k].visible&&(x[k].visible=!1,m.removeChild(x[k].c));var k=0;for(p=e.length;k<p;k++){var n=e[k].name,l=x[n];if(!l){var l=x,L=n;var r=n;var n=window.makeEmoji(d[n]),H=document.createElement("span");H.appendChild(n);H.className="emoji-medium";r=h(r,H);l=l[L]=r}l.visible||(l.visible=!0,m.appendChild(l.c));c++}b+=c}k=b;c=0;for(E in y)y[E].visible&&(y[E].visible=!1,u.removeChild(y[E].c));
 if(I){d=f(I.b.data,I?I.self.T.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=y[L],e||(e=y,l=p=L,L=I.b.data[L],r=document.createElement("span"),n=document.createElement("span"),r.className="emoji emoji-custom",r.style.backgroundImage='url("'+L+'")',r.textContent=":"+l+":",r.title=l,n.appendChild(r),n.className="emoji-medium",l=h(l,n),e=e[p]=l),e.visible||(e.visible=!0,u.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,gb: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.gb-b.gb})}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"),u=document.createElement("ul"),A=document.createElement("input"),x={},y={},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=u.className="emojibar-list";A.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(A);A.addEventListener("keyup",function(){e()});n.addEventListener("mousemove",function(b){a(b,function(a){var b=a?x[a]||y[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,qa:function(a,b,c){return g()?(I=b,r=c,a.appendChild(p),a.appendChild(n),A.value="",e(),A.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var C,U=[];function Zb(){da.call(this)}Zb.prototype=Object.create(da.prototype);Zb.prototype.constructor=Zb;function ta(a){return a.a?a.a.id:null}function $b(){this.b=0;this.context=new qa;this.a={}}
-$b.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 Zb,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.j[e].b=f}}ua(this.context,function(a){a.I===a.C&&(a=U.indexOf(a),-1!==a&&U.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.j[k])?(this.a[k].a.length&&ha(c,na(this.a[k]).m,b),c.fa||(ac(g,c,a.live[k]),Q&&a.live[Q.id]&&ub())):C.b=0}}a["static"]&&ib();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&&!e[g]&&(delete c.u[g],f=!0);if(e)for(g in e)if(c.j[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)&&pb();a.config&&(X=new bc(a.config),Qb());if(P&&Q&&a["static"]&&a["static"][P.a.id]&&a["static"][P.a.id].channels&&a["static"][P.a.id].channels)for(k=a["static"][P.a.id].channels,g=0,c=k.length;g<c;g++)if(k[g].id===Q.id){ub();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]+6500<b?(delete c.u[e][h],d=!0):f=!1;f&&(delete c.u[e],d=!0)}d&&(a=!0)});a&&pb()},1E3);
-function ac(a,b,c){var d;if(b!==Q||!window.hasFocus){var e=(d=a.self?a.self.id:null)?new RegExp("<@"+d):null,f=!1,h=!1,k=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.C)&&c.user!==a.self.id){h=!0;var d;if(!(d=b instanceof t)&&(d=c.text)&&!(d=e&&c.text.match(e)))a:{d=a.self.T.B;for(var g=0,m=d.length;g<m;g++)if(-1!==c.text.indexOf(d[g])){d=!0;break a}d=!1}d&&(-1===U.indexOf(b)&&(k=!0,U.push(b)),f=!0)}});if(h){nb();var g=document.getElementById("room_"+b.id);g&&(g.classList.add("unread"),f&&g.classList.add("unreadHi"));
-k&&!window.hasFocus&&zb()}}c.forEach(function(a){if(!d||d===a.K)for(var c=0,e=Bb.length;c<e;c++){var f=Bb[c];if(f.channel===b.id&&!!a.isMeMessage===f.Ca&&(a.pendingId===f.na&&f.na||!f.na&&a.text.trim()===f.text)){Bb.splice(c,1);break}}})}
-function vb(){var a=Q,b=U.indexOf(a);if(a.I>a.C){var c=C.a[a.id];c&&(c=na(c))&&(O(new K("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.m)),a.C=c.m)}0<=b&&(U.splice(b,1),nb());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}C=new $b;var ob=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.S?b.S?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].S){d(a[e].src,function(d){a[e].S=d;c(a,b)});return}var g=[];a.forEach(function(a){a.S&&g.push(a.S)});b(g)}function d(a,b){O(Fa(Da(N(new K(a),function(a,c,d){if(d){var e=new Image;e.onload=function(){var a=
+E.textContent=":"+a+":"):(H.textContent="",E.textContent="")})});n.addEventListener("click",function(b){a(b,function(a){a&&d()&&r&&r(a)})});return{isSupported:g,qa:function(a,b,c){return g()?(I=b,r=c,a.appendChild(p),a.appendChild(n),A.value="",e(),A.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var C,U=[];function dc(){da.call(this)}dc.prototype=Object.create(da.prototype);dc.prototype.constructor=dc;function sa(a){return a.a?a.a.id:null}function ec(){this.b=0;this.context=new qa;this.a={}}
+ec.prototype.update=function(a){var b=Date.now();a.v&&(this.b=a.v);if(a["static"])for(g in a["static"]){var c=ra(this.context,g);c||(c=new dc,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.j[e].b=f}}ua(this.context,function(a){a.I===a.C&&(a=U.indexOf(a),-1!==a&&U.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.j[k])?(this.a[k].a.length&&ha(c,na(this.a[k]).m,b),c.fa||(fc(g,c,a.live[k]),Q&&a.live[Q.id]&&ub())):C.b=0}}a["static"]&&ib();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&&!e[g]&&(delete c.u[g],f=!0);if(e)for(g in e)if(c.j[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&&(X=new gc(a.config),Vb());if(P&&Q&&a["static"]&&a["static"][P.a.id]&&a["static"][P.a.id].channels&&a["static"][P.a.id].channels)for(k=a["static"][P.a.id].channels,g=0,c=k.length;g<c;g++)if(k[g].id===Q.id){ub();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]+6500<b?(delete c.u[e][h],d=!0):f=!1;f&&(delete c.u[e],d=!0)}d&&(a=!0)});a&&ob()},1E3);
+function fc(a,b,c){var d;if(b!==Q||!window.hasFocus){var e=(d=a.self?a.self.id:null)?new RegExp("<@"+d):null,f=!1,h=!1,k=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.C)&&c.user!==a.self.id){h=!0;var d;if(!(d=b instanceof t)&&(d=c.text)&&!(d=e&&c.text.match(e)))a:{d=a.self.T.B;for(var g=0,m=d.length;g<m;g++)if(-1!==c.text.indexOf(d[g])){d=!0;break a}d=!1}d&&(-1===U.indexOf(b)&&(k=!0,U.push(b)),f=!0)}});if(h){sb();var g=document.getElementById("room_"+b.id);g&&(g.classList.add("unread"),f&&g.classList.add("unreadHi"));
+k&&!window.hasFocus&&Ab()}}c.forEach(function(a){if(!d||d===a.K)for(var c=0,e=Cb.length;c<e;c++){var f=Cb[c];if(f.channel===b.id&&!!a.isMeMessage===f.Ca&&(a.pendingId===f.na&&f.na||!f.na&&a.text.trim()===f.text)){Cb.splice(c,1);break}}})}
+function vb(){var a=Q,b=U.indexOf(a);if(a.I>a.C){var c=C.a[a.id];c&&(c=na(c))&&(O(new K("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.m)),a.C=c.m)}0<=b&&(U.splice(b,1),sb());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}C=new ec;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.S?b.S?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].S){d(a[e].src,function(d){a[e].S=d;c(a,b)});return}var g=[];a.forEach(function(a){a.S&&g.push(a.S)});b(g)}function d(a,b){O(Fa(Da(N(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=A;a=a.getContext("2d");a.drawImage(e,0,0,A,A);var a=a.getImageData(0,0,A,A),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,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,u,u),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,u=Math.floor(l-2*m),A=.5*u,x={},y={},M={};return function(b,d,f){if(x[b])f(x[b]);else if(M[b])y[b]?y[b].push(f):y[b]=[f];else{var g=e(),h=[];M[b]=!0;y[b]?y[b].push(f):y[b]=[f];for(var l in d)d[l].Va||d[l].vb||h.push({src:pa(d[l])});
-c(h,function(c){a(g,c);x[b]=k.toDataURL();y[b].forEach(function(a){a(x[b])})})}}}();var W=0,Q=null,P=null,S=null,R=null,Bb=[];function Jb(){O(Ea(Da(N(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 cc(){var a=Q;O(Ca(N(Fa(new K("api/hist?room="+a.id),"json"),function(b,c,d){if(d){b=C.a[a.id];var e=Date.now();b?c=!!la(b,d,e):(b=C.a[a.id]=new Y(a,100,d,e),c=!0);c&&(b.a.length&&ha(a,na(b).m,e),ac(D(C.context,a.id),a,d),a===Q&&ub())}}),function(){}))}function Qb(){a:{var a=X.U;for(var b in a)if(a.hasOwnProperty(b)){a=!1;break a}a=!0}a&&Mb.Bb(!1).display(Mb.yb.U);a=X.h;dc(a&&Rb[a]?Rb[a]:ec);document.getElementById("customsheet").innerHTML=fc()}
-function Ob(){var a=gc;IS_LOCAL||O(Ea(Fa(Ca(new K("api?v="+C.b),function(b,c,d){(b=2===Math.floor(b/100))?W&&(W=0,sb(!0)):W?(W+=Math.floor((W||5)/2),W=Math.min(60,W)):(W=5,sb(!1));a(b,d)}),"json")))}function gc(a,b){a?(b&&C.update(b),Ob()):setTimeout(hc,1E3*W)}function hc(){Ob()}
-function ic(a){Q&&(document.getElementById("room_"+Q.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");Q=a;P=D(C.context,a.id);tb();Kb.sb();ob(P.a.id,P.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"});(!C.a[Q.id]||100>C.a[Q.id].a.length)&&cc();document.getElementById("chatSystemContainer").classList.remove("no-room-selected");
-document.getElementById("chatCtx").classList.remove("opened")}function mb(){var a=document.location.hash.substr(1),b=wa(a);b&&b!==Q?ic(b):(a=F(a))&&a.O&&ic(a.O)}function Nb(a,b,c){var d=Q;new FileReader;var e=new FormData;e.append("file",b);e.append("filename",a);O(Da(N(new K("POST","api/file?room="+d.id),function(){c(null)}),function(a,b){c(b)}),e)}
-function cb(a,b,c,d){b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);d&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:d.text,author_name:F(d.K).getName(),text:d.text,footer:a.h?J.message:a.name,ts:d.m}])));O(N(Fa(new K("POST",b),"json"),function(a,b,d){d&&void 0!==d.pendingId&&(c.na=d.pendingId)}))}function Fb(a,b){O(new K("DELETE","api/pinMsg?room="+a.id+"&msgId="+b.id))}
-function xb(a,b,c){O(new K("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c)))}function Lb(){O(new K("POST","api/logout"));document.cookie="sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";document.location.reload();"__native"in window&&__native.logout()}
-function lb(){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].ma+a[d].ta+a[d].pa?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var Rb={noemoji:{Da:"noemoji.js",ia:null,name:"None"},emojione_v2_3:{Da:"emojione_v2.3.sprites.js",ia:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{Da:"emojione_v3.sprites.js",ia:"emojione_v3.sprites.css",name:"Emojione v3"}},ec=Rb.emojione_v2_3,Ya;
-function dc(a){Ya!==a&&(console.log("Loading emoji pack "+a.name),O(Ea(N(new K(a.Da),function(b,c,d){b=document.createElement("script");b.innerHTML=d;b.language="text/javascript";document.body.appendChild(b);a.ia&&(d=document.createElement("link"),d.href=a.ia,d.rel="stylesheet",document.head.appendChild(d));d=document.getElementById("emojiButton");for(var e in C.a)jc(C.a[e]);Q&&ub();Eb.reset();"makeEmoji"in window?(d.style.backgroundImage='url("smile.svg")',d.classList.remove("hidden")):d.classList.add("hidden")}))),
-Ya=a)};var Kb=function(){function a(){c();r instanceof t?(f.style.backgroundImage="url(api/avatar?size=l&user="+r.a.id+")",n.textContent=(r.a.ib||(r.a.Xa||"")+" "+r.a.$a).trim(),h.classList.add("presence-indicator"),r.a.N?h.classList.remove("presence-away"):h.classList.add("presence-away"),g.classList.remove("hidden"),l.classList.remove("hidden"),l.textContent=r.a.zb||"",u.textContent=r.a.rb||"",m.classList.remove("hidden"),e.classList.remove("roominfo-channel"),e.classList.add("roominfo-user")):b()}function b(){var a=
-E;a.aa.topic?(g.classList.remove("hidden"),n.textContent=r.ta||"",p.textContent=r.G?J.Ga(r.G,r.ea):""):g.classList.add("hidden");a.aa.purpose?(m.classList.remove("hidden"),u.textContent=r.pa||"",A.textContent=r.o?J.Ga(r.o,r.da):""):m.classList.add("hidden");f.style.backgroundImage="";h.classList.remove("presence-indicator");M.textContent=J.kb(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.N&&!b.N?-1:b.N&&!a.N?1:a.getName().localeCompare(b.getName())});
+c(h,function(c){a(g,c);x[b]=k.toDataURL();y[b].forEach(function(a){a(x[b])})})}}}();var W=0,Q=null,P=null,S=null,R=null,Cb=[];function Lb(){O(Ea(Da(N(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 hc(){var a=Q;O(Ca(N(Fa(new K("api/hist?room="+a.id),"json"),function(b,c,d){if(d){b=C.a[a.id];var e=Date.now();b?c=!!la(b,d,e):(b=C.a[a.id]=new Y(a,100,d,e),c=!0);c&&(b.a.length&&ha(a,na(b).m,e),fc(D(C.context,a.id),a,d),a===Q&&ub())}}),function(){}))}function Vb(){a:{var a=X.U;for(var b in a)if(a.hasOwnProperty(b)){a=!1;break a}a=!0}a&&Qb.Bb(!1).display(Qb.yb.U);a=X.h;ic(a&&Wb[a]?Wb[a]:jc);document.getElementById("customsheet").innerHTML=kc()}
+function Tb(){var a=lc;IS_LOCAL||O(Ea(Fa(Ca(new K("api?v="+C.b),function(b,c,d){(b=2===Math.floor(b/100))?W&&(W=0,rb(!0)):W?(W+=Math.floor((W||5)/2),W=Math.min(60,W)):(W=5,rb(!1));a(b,d)}),"json")))}function lc(a,b){a?(b&&C.update(b),Tb()):setTimeout(mc,1E3*W)}function mc(){Tb()}function zb(a){if(Sb()){var b=!(!P||!P.W.starChannel);__native.setTitle(a,b,b?Q.A:!1)}}
+function nc(a){Q&&(document.getElementById("room_"+Q.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");Q=a;P=D(C.context,a.id);Sb&&__native.setCurrentChannel(a.id);tb();Mb.sb();nb(P.a.id,P.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"});(!C.a[Q.id]||100>C.a[Q.id].a.length)&&hc();document.getElementById("chatSystemContainer").classList.remove("no-room-selected");
+document.getElementById("chatCtx").classList.remove("opened")}function Sb(){return!!("__native"in window)}function mb(){var a=document.location.hash.substr(1),b=wa(a);b&&b!==Q?nc(b):(a=F(a))&&a.O&&nc(a.O)}function Ob(a){O(new K("POST","api/starChannel?room="+a.id))}function Nb(a){O(new K("POST","api/unstarChannel?room="+a.id))}
+function Rb(a,b,c){var d=Q;new FileReader;var e=new FormData;e.append("file",b);e.append("filename",a);O(Da(N(new K("POST","api/file?room="+d.id),function(){c(null)}),function(a,b){c(b)}),e)}
+function cb(a,b,c,d){b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);d&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:d.text,author_name:F(d.K).getName(),text:d.text,footer:a.h?J.message:a.name,ts:d.m}])));O(N(Fa(new K("POST",b),"json"),function(a,b,d){d&&void 0!==d.pendingId&&(c.na=d.pendingId)}))}function Gb(a,b){O(new K("DELETE","api/pinMsg?room="+a.id+"&msgId="+b.id))}
+function xb(a,b,c){O(new K("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c)))}function Pb(){O(new K("POST","api/logout"));document.cookie="sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";document.location.reload();Sb()&&__native.logout()}
+function lb(){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].ma+a[d].ta+a[d].pa?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var Wb={noemoji:{Da:"noemoji.js",ia:null,name:"None"},emojione_v2_3:{Da:"emojione_v2.3.sprites.js",ia:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{Da:"emojione_v3.sprites.js",ia:"emojione_v3.sprites.css",name:"Emojione v3"}},jc=Wb.emojione_v2_3,Ya;
+function ic(a){Ya!==a&&(console.log("Loading emoji pack "+a.name),O(Ea(N(new K(a.Da),function(b,c,d){b=document.createElement("script");b.innerHTML=d;b.language="text/javascript";document.body.appendChild(b);a.ia&&(d=document.createElement("link"),d.href=a.ia,d.rel="stylesheet",document.head.appendChild(d));d=document.getElementById("emojiButton");for(var e in C.a)oc(C.a[e]);Q&&ub();Fb.reset();"makeEmoji"in window?(d.style.backgroundImage='url("smile.svg")',d.classList.remove("hidden")):d.classList.add("hidden")}))),
+Ya=a)};var Mb=function(){function a(){c();r instanceof t?(f.style.backgroundImage="url(api/avatar?size=l&user="+r.a.id+")",n.textContent=(r.a.ib||(r.a.Xa||"")+" "+r.a.$a).trim(),h.classList.add("presence-indicator"),r.a.N?h.classList.remove("presence-away"):h.classList.add("presence-away"),g.classList.remove("hidden"),l.classList.remove("hidden"),l.textContent=r.a.zb||"",u.textContent=r.a.rb||"",m.classList.remove("hidden"),e.classList.remove("roominfo-channel"),e.classList.add("roominfo-user")):b()}function b(){var a=
+E;a.W.topic?(g.classList.remove("hidden"),n.textContent=r.ta||"",p.textContent=r.G?J.Ga(r.G,r.ea):""):g.classList.add("hidden");a.W.purpose?(m.classList.remove("hidden"),u.textContent=r.pa||"",A.textContent=r.o?J.Ga(r.o,r.da):""):m.classList.add("hidden");f.style.backgroundImage="";h.classList.remove("presence-indicator");M.textContent=J.kb(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.N&&!b.N?-1:b.N&&!a.N?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.N||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){x.textContent=J.eb(r.b.length);x.classList.remove("hidden");y.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=Na+" roominfo-unpin";c.className="roominfo-pinlist-item";c.appendChild(b.L());c.appendChild(e);a.appendChild(c)});y.textContent="";y.appendChild(a)}else x.classList.add("hidden"),y.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){Fb(r,
+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=Na+" roominfo-unpin";c.className="roominfo-pinlist-item";c.appendChild(b.L());c.appendChild(e);a.appendChild(c)});y.textContent="";y.appendChild(a)}else x.classList.add("hidden"),y.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){Gb(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"),u=document.createElement("span"),A=document.createElement("span"),x=document.createElement("div"),y=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";x.className="roominfo-pincount";y.className="roominfo-pinlist";M.className="roominfo-usercount";H.className="roominfo-userlist";A.className=p.className="roominfo-author";f.appendChild(h);e.appendChild(f);e.appendChild(k);g.appendChild(n);g.appendChild(p);m.appendChild(u);m.appendChild(A);k.appendChild(g);k.appendChild(l);k.appendChild(m);k.appendChild(x);
-k.appendChild(y);k.appendChild(M);k.appendChild(H);var I=null;return{fb:function(b,c){this.$();E=b;r=c;a();return this},update:function(){this.$();a();return this},show:function(a){this.$();a.appendChild(e);e.classList.remove("hidden");return this},sb:function(){this.$();e.classList.add("hidden");return this},$:function(){I&&clearTimeout(I);I=null;return this},tb:function(){I||(I=setTimeout(function(){e.classList.add("hidden");I=null},300));return this},wb: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 kc(this.id,a,b):!0===a.isNotice?new lc(this.id,a,b):new mc(this.id,a,b)};function jc(a){a.a.forEach(function(a){a.H()})}
-var Z=function(){function a(a,d){return Aa(d,{B:a.context.self.T.B,X:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=Za(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},la: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.O.id,k="@"+d.getName(),d="background-color:"+
-Vb(d.getName()),b=["chatmsg-link-user","chatmsg-link"];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,b=["chatmsg-link-chan","chatmsg-link"];else return null;else{if(!h.match(/^(https?|mailto):\/\//i))return null;b=["chatmsg-link"];a=!1}return{link:h,text:k||h,style:d,Ua:b,Za:a}}return{H:function(a){a.V=!0;return a},Y:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},M:function(a){a.c?a.V&&(a.V=!1,a.P()):a.za().P();return a.c},
-P:function(b){var c=F(b.K);b.c.m.innerHTML=J.R(b.m);b.c.ra.innerHTML=a(b,b.text);b.c.ha.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=Xb(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=Za(g);if(p){for(var l=document.createElement("li"),m=document.createElement("a"),u=document.createElement("span"),
+k.appendChild(y);k.appendChild(M);k.appendChild(H);var I=null;return{fb:function(b,c){this.aa();E=b;r=c;a();return this},update:function(){this.aa();a();return this},show:function(a){this.aa();a.appendChild(e);e.classList.remove("hidden");return this},sb:function(){this.aa();e.classList.add("hidden");return this},aa:function(){I&&clearTimeout(I);I=null;return this},tb:function(){I||(I=setTimeout(function(){e.classList.add("hidden");I=null},300));return this},wb: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 pc(this.id,a,b):!0===a.isNotice?new qc(this.id,a,b):new rc(this.id,a,b)};function oc(a){a.a.forEach(function(a){a.H()})}
+var Z=function(){function a(a,d){return Aa(d,{B:a.context.self.T.B,Y:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=Za(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},la: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=sa(a.context)+"|"+h.substr(1),d=F(h))a=!0,h="#"+d.O.id,k="@"+d.getName(),d="background-color:"+
+$b(d.getName()),b=["chatmsg-link-user","chatmsg-link"];else return null;else if("#"===h[0])if(h=sa(a.context)+"|"+h.substr(1),k=wa(h))a=!0,h="#"+h,k="#"+k.name,b=["chatmsg-link-chan","chatmsg-link"];else return null;else{if(!h.match(/^(https?|mailto):\/\//i))return null;b=["chatmsg-link"];a=!1}return{link:h,text:k||h,style:d,Ua:b,Za:a}}return{H:function(a){a.V=!0;return a},Z:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},M:function(a){a.c?a.V&&(a.V=!1,a.P()):a.za().P();return a.c},
+P:function(b){var c=F(b.K);b.c.m.innerHTML=J.R(b.m);b.c.ra.innerHTML=a(b,b.text);b.c.ha.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=bc(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=Za(g);if(p){for(var l=document.createElement("li"),m=document.createElement("a"),u=document.createElement("span"),
 A=document.createElement("span"),x=[],y=0,M=n.length;y<M;y++){var H=F(n[y]);H&&x.push(H.getName())}x.sort();A.textContent=x.join(", ");u.appendChild(p);u.className="emoji-small";m.href="javascript:toggleReaction('"+f+"', '"+h+"', '"+g+"')";m.appendChild(u);m.appendChild(A);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.ka&&(b.c.ca.ka.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},L:function(a){return a.M().cloneNode(!0)},w:function(b,d){return a(b,d)}}}();function kc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.V=Z.V}kc.prototype=Object.create(z.prototype);q=kc.prototype;q.constructor=kc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Y=function(){return Z.Y(this)};q.M=function(){return Z.M(this)};
-q.za=function(){this.c=Ub(this);this.c.classList.add("chatmsg-me_message");return this};q.L=function(){return Z.L(this)};q.P=function(){Z.P(this);return this};q.update=function(a,b){z.prototype.update.call(this,a,b);this.H()};function mc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.V=Z.V}mc.prototype=Object.create(w.prototype);q=mc.prototype;q.constructor=mc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Y=function(){return Z.Y(this)};q.M=function(){return Z.M(this)};
-q.za=function(){this.c=Ub(this);return this};q.L=function(){return Z.L(this)};q.P=function(){Z.P(this);return this};
+'url("star_empty.png")');b.F&&(b.c.F.innerHTML=J.F(b.F),b.c.classList.add("edited"));return b},L:function(a){return a.M().cloneNode(!0)},w:function(b,d){return a(b,d)}}}();function pc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.V=Z.V}pc.prototype=Object.create(z.prototype);q=pc.prototype;q.constructor=pc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Z=function(){return Z.Z(this)};q.M=function(){return Z.M(this)};
+q.za=function(){this.c=Zb(this);this.c.classList.add("chatmsg-me_message");return this};q.L=function(){return Z.L(this)};q.P=function(){Z.P(this);return this};q.update=function(a,b){z.prototype.update.call(this,a,b);this.H()};function rc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.V=Z.V}rc.prototype=Object.create(w.prototype);q=rc.prototype;q.constructor=rc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Z=function(){return Z.Z(this)};q.M=function(){return Z.M(this)};
+q.za=function(){this.c=Zb(this);return this};q.L=function(){return Z.L(this)};q.P=function(){Z.P(this);return this};
 q.update=function(a,b){w.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 lc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.b=a;this.a=null;this.V=!0}lc.prototype=Object.create(B.prototype);q=lc.prototype;q.constructor=lc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Y=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.M=function(){Z.M(this);return this.a};q.L=function(){return this.a.cloneNode(!0)};
-q.za=function(){this.c=Ub(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=J.cb;this.a.appendChild(this.c);return this};q.P=function(){Z.P(this);return this};q.update=function(a,b){B.prototype.update.call(this,a,b);this.H()};
-function Gb(a,b){var c=Ub(null);c.classList.add("chatmsg-pending");b&&c.classList.add("chatmsg-me_message");c.ra.innerHTML=Aa(a,{X:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=Za(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null}});c.ha.textContent=P.self?P.self.getName():"";a=document.createElement("span");a.className="typing-dot1";a.textContent=".";c.m.appendChild(a);a=document.createElement("span");
-a.className="typing-dot2";a.textContent=".";c.m.appendChild(a);a=document.createElement("span");a.className="typing-dot3";a.textContent=".";c.m.appendChild(a);c.m.classList.add("typing-container");return c};var X;function bc(a){this.U={};for(var b=0,c=a.length;b<c;b++)null===a[b].service&&null===a[b].device&&Pb(this,JSON.parse(a[b].config))}function Pb(a,b){if(b.services)for(var c in b.services)a.U[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 fc(){var a=X,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"],b[".chatmsg-author-name::before"]=
-["content:'<'"],b[".chatmsg-author-name::after"]=["content:'>'"]);!0===a.b||(b[".chatmsg-authorGroup .chatmsg-item .chatmsg-link-user, .chatsystem-content a.chatmsg-author-name, .chatmsg-author-name"]=["background-color: transparent !important;"]);for(var d in b)c+=d+"{",b[d].forEach(function(a){c+=a+";"}),c+="}";return c}X=new bc([]);var $a=function(){var a=[];return{Ya:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},qb: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},Ab:function(b){b.W="client";b.exec=b.exec.bind(b);a.push(b)}}}();function nc(){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(){$a.Ab({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:J.jb,exec:function(a,b){nc().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 qc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.b=a;this.a=null;this.V=!0}qc.prototype=Object.create(B.prototype);q=qc.prototype;q.constructor=qc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Z=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.M=function(){Z.M(this);return this.a};q.L=function(){return this.a.cloneNode(!0)};
+q.za=function(){this.c=Zb(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=J.cb;this.a.appendChild(this.c);return this};q.P=function(){Z.P(this);return this};q.update=function(a,b){B.prototype.update.call(this,a,b);this.H()};
+function Hb(a,b){var c=Zb(null);c.classList.add("chatmsg-pending");b&&c.classList.add("chatmsg-me_message");c.ra.innerHTML=Aa(a,{Y:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=Za(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null}});c.ha.textContent=P.self?P.self.getName():"";a=document.createElement("span");a.className="typing-dot1";a.textContent=".";c.m.appendChild(a);a=document.createElement("span");
+a.className="typing-dot2";a.textContent=".";c.m.appendChild(a);a=document.createElement("span");a.className="typing-dot3";a.textContent=".";c.m.appendChild(a);c.m.classList.add("typing-container");return c};var X;function gc(a){this.U={};for(var b=0,c=a.length;b<c;b++)null===a[b].service&&null===a[b].device&&Ub(this,JSON.parse(a[b].config))}function Ub(a,b){if(b.services)for(var c in b.services)a.U[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 kc(){var a=X,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"],b[".chatmsg-author-name::before"]=
+["content:'<'"],b[".chatmsg-author-name::after"]=["content:'>'"]);!0===a.b||(b[".chatmsg-authorGroup .chatmsg-item .chatmsg-link-user, .chatsystem-content a.chatmsg-author-name, .chatmsg-author-name"]=["background-color: transparent !important;"]);for(var d in b)c+=d+"{",b[d].forEach(function(a){c+=a+";"}),c+="}";return c}X=new gc([]);window.displayMenu=function(){document.getElementById("chatCtx").classList.add("opened")};window.hideMenu=function(){document.getElementById("chatCtx").classList.remove("opened")};window.toggleMenu=function(){Kb()};window.setChannelFavorite=function(a,b){var c=wa(a);c?b?Ob(c):Nb(c):console.error("Channel "+a+" not found")};window.onSmsPermissionUpdated=function(a){"__native"in window&&a&&(a=JSON.parse(__native.getStatic()))&&C.update(a)};var $a=function(){var a=[];return{Ya:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},qb: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},Ab:function(b){b.X="client";b.exec=b.exec.bind(b);a.push(b)}}}();function sc(){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(){$a.Ab({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:J.jb,exec:function(a,b){sc().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)})}})});
 })();

+ 4 - 0
srv/public/styleResponsive.css

@@ -57,3 +57,7 @@
     }
 }
 
+body.native .chatsystem-header, body.native .chat-context-menuButton {
+    display: none;
+}
+

+ 1 - 1
srv/src/httpServ.js

@@ -130,7 +130,7 @@ Server.prototype.execRequest = function(req, res) {
         sessionManager.saveSession(req.session);
         return; // async pipe will close when finished
     } else if (!req.account) {
-        res.writeHeader("302", { Location: "login" });
+        res.writeHeader("302", { Location: "/login" });
         res.end();
     } else if (req.urlObj.isTemplate()) {
         return this.execTemplate(req.urlObj.template, req, res);

+ 32 - 23
srv/src/template/login.js

@@ -9,7 +9,7 @@ const config = require("../../config.js")
     ,sessionManager = require("../session.js").SessionManager
     ,templates = require('./_templates.js');
 
-function checkTokens(service, req, cb) {
+function checkTokens(service, req, res, cb) {
     switch (service) {
         case "slack":
             if (req.urlObj.queryTokens.code) {
@@ -92,6 +92,34 @@ function checkTokens(service, req, cb) {
             }
         break;
 
+        case "android":
+            if (req.urlObj.queryTokens.phoneAccess) {
+                var self = this;
+                accountManager.fromPhoneAccess(req.urlObj.queryTokens.phoneAccess, (acc) => {
+                    if (acc) {
+                        req.account = acc;
+                        req.session = sessionManager.lazyForRequest(req);
+                        req.session.setAccountId(req.reqT, acc.id);
+                        res.writeHeader("302", {
+                            Location: config.rootUrl,
+                            "Set-Cookie": "sessID="+req.session.sessId +'; Path=/'
+                        });
+                        sessionManager.saveSession(req.session);
+                    } else {
+                        res.writeHeader("302", {
+                            Location: "/login"
+                        });
+                    }
+                    res.end();
+                });
+            } else {
+                res.writeHeader("302", {
+                    Location: "/login"
+                });
+                res.end();
+            }
+        break;
+
         default:
             cb(null);
         break;
@@ -125,33 +153,14 @@ function makeLoginPage() {
 module.exports.match = function(url) {
     if (url.urlParts.length === 1) {
         return true;
-    } else if (url.urlParts.length === 2 && Object.keys(config.login).indexOf(url.urlParts[1]) >= 0) {
+    } else if (url.urlParts.length === 2 && (Object.keys(config.login).indexOf(url.urlParts[1]) >= 0 || url.urlParts[1] === "android")) {
         return true;
     }
     return false;
 };
 
 module.exports.exec = function(req, res, srv) {
-    if (req.urlObj.queryTokens["phoneAccess"]) {
-        var self = this;
-        accountManager.fromPhoneAccess(req.urlObj.queryTokens["phoneAccess"], (acc) => {
-            if (acc) {
-                req.account = acc;
-                req.session = sessionManager.lazyForRequest(req);
-                req.session.setAccountId(req.reqT, acc.id);
-                res.writeHeader("302", {
-                    Location: config.rootUrl,
-                    "Set-Cookie": "sessID="+req.session.sessId +'; Path=/'
-                });
-                sessionManager.saveSession(req.session);
-            } else {
-                res.writeHeader("302", {
-                    Location: "login"
-                });
-            }
-            res.end();
-        });
-    } else if (!req.urlObj.urlParts[1]) {
+    if (!req.urlObj.urlParts[1]) {
         if (req.urlObj.queryTokens["native"]) {
             req.session = sessionManager.lazyForRequest(req);
             req.session.isNative = true;
@@ -162,7 +171,7 @@ module.exports.exec = function(req, res, srv) {
         }
         res.end(makeLoginPage());
     } else {
-        checkTokens(req.urlObj.urlParts[1], req, (account) => {
+        checkTokens(req.urlObj.urlParts[1], req, res, (account) => {
             if (account) {
                 req.account = account;
                 req.session = sessionManager.lazyForRequest(req);