| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- "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.zb=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.Z=a.category}function ca(){this.a={};this.H=[];this.version=0}
- ca.prototype.update=function(a,b){a.emoji_use&&(this.a=JSON.parse(a.emoji_use));a.highlight_words?this.H=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.H=a.highlights);this.version=Math.max(this.version,b)};function da(){this.a=null;this.m={};this.l={};this.self=null;this.b={version:0,data:{}};this.i={version:0,data:{}};this.B={};this.Y={};this.s=0}function ea(a,b){return b.pv?new r(b.id,a.l[b.user]):new u(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 k=a.l[d+b.users[e].id];k||(k=a.l[d+b.users[e].id]=new ga(b.users[e].id));k.update(b.users[e],c)}if(b.channels)for(e=0,f=b.channels.length;e<f;e++)(k=a.m[d+b.channels[e].id])||(k=a.m[d+b.channels[e].id]=ea(a,b.channels[e])),k.update(b.channels[e],a,c,d);b.emojis&&(a.b.data=b.emojis,a.b.version=c);if(void 0!==b.commands){a.i.data={};for(e in b.commands)a.i.data[e]=
- new ba(b.commands[e]);a.i.version=c}b.self&&(a.self=a.l[d+b.self.id]||null,a.self.W||(a.self.W=new ca),b.self.prefs&&a.self.W.update(b.self.prefs,c));b.capacities&&(a.Y={},b.capacities.forEach(function(a){this.Y[a]=!0},a));a.s=Math.max(a.s,c)}"undefined"!==typeof module&&(module.M.Rb=da,module.M.Sb=aa,module.M.Ub=ba);function u(a){this.id=a;this.D=!1;this.u=0;this.l={};this.version=0}function ha(a,b,c){if(!a.G||a.G<b)a.G=b,a.version=c}
- u.prototype.update=function(a,b,c,d){d=d||"";void 0!==a.name&&(this.name=a.name);void 0!==a.is_archived&&(this.la=a.is_archived);void 0!==a.is_member&&(this.da=a.is_member);void 0!==a.last_read&&(this.u=Math.max(parseFloat(a.last_read),this.u));void 0!==a.last_msg&&(this.G=parseFloat(a.last_msg));this.G&&(this.u=Math.min(this.u,this.G));void 0!==a.is_private&&(this.i=a.is_private);void 0!==a.pins&&(this.b=a.pins);this.D=!!a.is_starred;if(a.members&&(this.l={},a.members))for(var e=0,f=a.members.length;e<
- f;e++){var k=b.l[d+a.members[e]];this.l[k.id]=k;k.m[this.id]=this}a.topic&&(this.za=a.topic.value,this.A=b.l[d+a.topic.creator],this.ga=a.topic.last_set);a.purpose&&(this.va=a.purpose.value,this.s=b.l[d+a.purpose.creator],this.fa=a.purpose.last_set);this.version=Math.max(this.version,c)};function ia(a,b){var c=ja;return{name:c.oa(b,a.name),sa:c.oa(b,Object.values(a.l),function(a){return a?a.getName():null}),za:c.oa(b,a.za),va:c.oa(b,a.va)}}
- function r(a,b){u.call(this,a);this.a=b;this.name=b.getName();this.i=!0;b.S=this}r.prototype=Object.create(u.prototype);r.prototype.constructor=r;"undefined"!==typeof module&&(module.M.$b=u,module.M.Zb=r);function w(a,b){this.O=a.user;this.username=a.username;this.id=a.id||a.ts;this.f=parseFloat(a.ts);this.text="";this.w=[];this.D=a.is_starred||!1;this.b=this.J=!1;this.I={};this.version=b;this.update(a,b)}function x(a,b){w.call(this,a,b)}function y(a,b){w.call(this,a,b)}
- w.prototype.update=function(a,b){if(a){this.text=a.text||"";a.attachments&&(this.w=a.attachments);this.D=!!a.is_starred;this.J=void 0===a.edited?!1:a.edited;this.b=!!a.removed;if(a.reactions){var c={};a.reactions.forEach(function(a){c[a.name]=[];a.users.forEach(function(b){c[a.name].push(b)})});this.I=c}a.pendingId&&(this.ta=a.pendingId)}else this.b=!0;this.version=b};function ka(a,b,c,d,e){this.id="string"===typeof a?a:a.id;this.j=[];this.b=c;this.tb=0;this.i=b;d&&la(this,d,e)}
- function la(a,b,c){var d=0;b.forEach(function(a){d=Math.max(this.push(a,c),d)}.bind(a));ma(a);return d}ka.prototype.a=function(a,b){return!0===a.isMeMessage?new x(a,b):!0===a.isNotice?new y(a,b):new w(a,b)};
- ka.prototype.push=function(a,b){for(var c,d=!1,e,f=0,k=this.j.length;f<k;f++)if(c=this.j[f],c.id===a.id){e=c.update(a,b);d=!0;break}d||(c=this.a(a,b),this.j.push(c),e=c.f);for(;this.j.length>this.i;)this.j.shift();if(this.b)for(a=0;a<this.j.length;a++)this.j[a].version<b-this.b&&this.j.splice(a--,1);return e||0};function na(a){return a.j[a.j.length-1]}function oa(a,b){for(var c=0,d=a.j.length;c<d;c++)if(a.j[c].id==b)return a.j[c];return null}
- function ma(a){a.j.sort(function(a,c){return a.f-c.f})}x.prototype=Object.create(w.prototype);x.prototype.constructor=x;y.prototype=Object.create(w.prototype);y.prototype.constructor=y;"undefined"!==typeof module&&(module.M={Wb:w,Vb:x,Yb:y,ac:ka});function ga(a){this.id=a;this.m={};this.S=this.W=null;this.version=0}
- ga.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.bb=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.Bb=a.goal);void 0!==a.phone&&(this.Lb=a.phone);void 0!==a.first_name&&(this.eb=a.first_name);void 0!==a.last_name&&(this.ib=a.last_name);void 0!==a.real_name&&(this.qb=a.real_name);void 0!==a.isPresent&&(this.R=a.isPresent);a.isBot&&(this.Fb=a.isBot);this.version=Math.max(this.version,b)};
- function pa(a){return"api/avatar?user="+encodeURIComponent(a.id)}ga.prototype.getName=function(){return this.name||this.qb||this.eb||this.ib};"undefined"!==typeof module&&(module.M.Tb=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 ta(a,b){for(var c=0,d=a.a.length;c<d;c++){var e=a.a[c],f;for(f in e.m)if(!0===b(e.m[f],f))return}}function ua(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].m[b])return a.a[c];return null}
- function va(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].m[a];if(e)return e}return null}function wa(a){for(var b=C.context,c=[],d=0,e=b.a.length;d<e;d++){var f=b.a[d].m,k;for(k in f)a&&!a(f[k],b.a[d],k)||c.push(k)}return c}function E(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].l[a];if(e)return e}return null}qa.prototype.Ia=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.M.Xb=qa);var ja=function(){function a(b,c,d){if(Array.isArray(c)){for(var e=0,f=0,k=c.length;f<k;f++){var h=a(b,c[f],d);if(1===h)return 1;e=Math.max(h,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{oa:a}}();"undefined"!==typeof module&&(module.M.bc=ja);var G={},H,xa=[];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")}H=G[c];console.log("Loading language pack: "+c);if(H.c)for(var d in H.c)if(c=document.getElementById(d))c.textContent=H.c[d];xa.forEach(function(a){a()})};G.fr={Qb:"Utilisateur inconnu",Pb:"Channel inconnu",Ja:"Nouveau message",message:"Message",kb:"Reseau",lb:"(visible seulement par vous)",D:"Favoris",m:"Discutions",sa:"Membres",pb:"Discutions priv\u00e9es",rb:"Partage sa position GPS",ok:"Ok",cb:"Annuler",U: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()},fb:function(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()?"aujourd'hui":a.getTime()>c.getTime()?"hier":a.toLocaleDateString()},Ga: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","settings-displayScrollAvatarsLbl":"Faire d\u00e9filer les avatars lors de la lecture","settings-displayAttachmentContentLbl":"Afficher les pieces jointes ?","settings-displayAttachmentContent-never":"Jamais","settings-displayAttachmentContent-always":"Toujours","settings-displayAttachmentContent-notimg":"Si elles ne contiennent pas d'images"}};
- G.fr.mb=function(a){return 0===a?"Pas de message \u00e9pingl\u00e9":a+(1===a?" message \u00e9pingl\u00e9":" messages \u00e9pingl\u00e9s")};G.fr.sb=function(a){return 0===a?"Pas de chatteur":a+(1===a?" chatteur":" chatteurs")};G.fr.J=function(a){return"(edité "+G.fr.U(a)+")"};G.fr.Na=function(a,b){return"par "+a.getName()+" le "+G.fr.U(b)};G.en={Qb:"Unknown member",Pb:"Unknown channel",Ja:"New message",message:"Message",kb:"Network",lb:"(only visible to you)",D:"Starred",m:"Channels",sa:"Members",pb:"Direct messages",rb:"Share your GPS location",ok:"Ok",cb:"Cancel",U: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()},fb:function(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()?"today":a.getTime()>c.getTime()?"yesterday":a.toLocaleDateString()},Ga: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","settings-displayScrollAvatarsLbl":"Scroll avatars",
- "settings-displayAttachmentContentLbl":"Automaticcaly unwrap attachments ?","settings-displayAttachmentContent-never":"Never","settings-displayAttachmentContent-always":"Always","settings-displayAttachmentContent-notimg":"If they don't contain image"}};G.en.mb=function(a){return 0===a?"No pinned messages":a+(1===a?" pinned message":" pinned messages")};G.en.sb=function(a){return 0===a?"No users in this room":a+(1===a?" user":" users")};G.en.J=function(a){return"(edited "+G.en.U(a)+")"};
- G.en.Na=function(a,b){return"by "+a.getName()+" on "+G.en.U(b)};var Aa=function(){function a(a){this.text="";this.h=a}function b(b,c,d){this.aa=c;this.g=null;this.o=[];this.a=d||"";this.Ca="<"===this.a;this.La="*"===this.a;this.Ba="_"===this.a;this.Da="~"===this.a||"-"===this.a;this.i=">"===this.a||">"===this.a;this.A=":"===this.a;this.Oa="`"===this.a;this.Za="```"===this.a;this.Pa="\n"===this.a;this.Aa=void 0!==d&&-1!==p.H.indexOf(d);this.h=b;this.Ea=null;this.b=this.Pa||this.Aa?c+d.length-1:!1;this.Aa&&(this.g=new a(this),this.o.push(this.g),this.g.text=
- d)}function c(a){return/[A-Za-z0-9\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+]/.test(a)}function d(a){a=a||m;for(var c=0,e=a.o.length;c<e;c++){var h=a.o[c];if(h instanceof b)if(h.b){if(h=
- d(h))return h}else return h}return null}function e(a,c){a.h instanceof b&&(a.h.o.splice(a.h.o.indexOf(a)+(c?1:0)),a.h.g=a.h.o[a.h.o.length-1],e(a.h,!0))}function f(a){return a.replace("<","<")}function k(a){return a}function h(a){return{link:a,text:a,hb:!1}}var g,m,p={H:[],$:k,ya:k,ra:h};b.prototype.Ra=function(){return this.La&&!!this.b||this.h instanceof b&&this.h.Ra()};b.prototype.Ua=function(){return this.Ba&&!!this.b||this.h instanceof b&&this.h.Ua()};b.prototype.Va=function(){return this.Da&&
- !!this.b||this.h instanceof b&&this.h.Va()};b.prototype.ga=function(){return this.A&&!!this.b||this.h instanceof b&&this.h.ga()};b.prototype.Ta=function(){return this.Aa&&!!this.b||this.h instanceof b&&this.h.Ta()};b.prototype.Sa=function(){return this.Oa&&!!this.b||this.h instanceof b&&this.h.Sa()};b.prototype.fa=function(){return this.Za&&!!this.b||this.h instanceof b&&this.h.fa()};b.prototype.Wa=function(){for(var a=0,c=this.o.length;a<c;a++)if(this.o[a]instanceof b&&(!this.o[a].b||this.o[a].Wa()))return!0;
- return!1};b.prototype.Xa=function(a){if("<"===this.a&&">"===g[a])return!0;var b=c(g[a-1]);if(!this.i&&g.substr(a,this.a.length)===this.a){if(!b&&(this.La||this.Ba||this.Da))return!1;if(this.g&&this.Wa())return this.g.$a();if(this.ub())return!0}return"\n"===g[a]&&this.i?!0:!1};b.prototype.ub=function(){for(var a=this;a;){for(var c=0,d=a.o.length;c<d;c++)if(a.o[c]instanceof b||a.o[c].text.length)return!0;a=a.Ea}return!1};b.prototype.$a=function(){var a=new b(this.h,this.aa,this.a);a.Ea=this;this.g&&
- this.g instanceof b&&(a.g=this.g.$a(),a.o=[a.g]);return a};b.prototype.vb=function(a){return this.A&&(" "===g[a]||"\t"===g[a])||(this.A||this.Ca||this.La||this.Ba||this.Da||this.Oa)&&"\n"===g[a]?!1:!0};b.prototype.wb=function(b){if(this.Oa||this.A||this.Za||this.Ca)return null;if(!this.g||this.g.b||this.g instanceof a){var d=c(g[b-1]),e=c(g[b+1]);if("```"===g.substr(b,3))return"```";var h=m.Ka();if(void 0===h||h){if(">"===g.substr(b,4))return">";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.H.length;d<e;d++)if(h=p.H[d],g.substr(b,h.length)===h)return h}return null};a.prototype.Ka=function(){if(""!==this.text.trim())return!1};b.prototype.Ka=function(){for(var a=this.o.length-1;0<=a;a--){var b=this.o[a].Ka();if(void 0!==b)return b}if(this.Pa||
- this.i)return!0};a.prototype.s=function(a){this.text+=g[a];return 1};b.prototype.s=function(c){var d=this.g&&!this.g.b&&this.g.Xa?this.g.Xa(c):null;if(d){var e=this.g.a.length;this.g.Qa(c);d instanceof b&&(this.g=d,this.o.push(d));return e}if(!this.g||this.g.b||this.g instanceof a||this.g.vb(c)){if(d=this.wb(c))return this.g=new b(this,c,d),this.o.push(this.g),this.g.a.length;if(!this.g||this.g.b)this.g=new a(this),this.o.push(this.g);return this.g.s(c)}d=this.g.aa+1;m.da(this.g.aa);this.g=new a(this);
- this.g.s(d-1);this.o.pop();this.o.push(this.g);return d-c};b.prototype.Qa=function(a){for(var b=this;b;)b.b=a,b=b.Ea};b.prototype.da=function(a){this.b&&this.b>=a&&(this.b=!1);this.o.forEach(function(c){c instanceof b&&c.da(a)})};a.prototype.innerHTML=function(){if(this.h.ga()){for(var a=this.h;a&&!a.A;)a=a.h;if(a){var a=a.a+this.text+a.a,b=p.$(a);return b?b:a}return(a=p.$(this.text))?a:this.text}if(this.h.fa()){if("undefined"!==typeof hljs)try{return a=this.text.match(/^\w+/),hljs.configure({useBR:!0,
- tabReplace:" "}),a&&hljs.getLanguage(a[0])?hljs.fixMarkup(hljs.highlight(a[0],this.text.substr(a[0].length)).value):hljs.fixMarkup(hljs.highlightAuto(this.text).value)}catch(v){console.error(v)}return this.text.replace(/\n/g,"<br/>")}return p.ya(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.h.fa()){a="pre";b.push("codeblock");var d=this.innerHTML()}else this.h.Sa()?(b.push("code"),d=this.innerHTML()):(this.h.Ca&&(d=p.ra(this.text))?
- (a="a",c=' href="'+d.link+'"',d.style&&(c+=' style="'+d.style+'"'),d.hb||(c+=' target="_blank"'),d.ab&&d.ab.forEach(function(a){b.push(a)}),d=p.ya(d.text)):d=this.innerHTML(),this.h.Ra()&&b.push("bold"),this.h.Ua()&&b.push("italic"),this.h.Va()&&b.push("strike"),this.h.ga()&&b.push("emoji"),this.h.Ta()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+">"};b.prototype.outerHTML=function(){var a="";this.i&&(a+='<span class="quote">');this.Pa&&(a+="<br/>");this.o.forEach(function(b){a+=
- b.outerHTML()});this.i&&(a+="</span>");return a};b.prototype.Ya=function(a){this.i&&!this.b&&this.Qa(a);this.o.forEach(function(c){c instanceof b&&c.Ya(a)})};return function(c,n){n||(n={});p.H=n.H||[];p.$=n.$||k;p.ya=n.ya||f;p.ra=n.ra||h;g=c;m=new b(this,0);n=0;c=g.length;do{for(;n<c;)n+=m.s(n);m.Ya(g.length);if(n=d()){e(n,!1);m.da(n.aa);var l=new a(n.h);l.s(n.aa);n.h.o.push(l);n.h.g=l;n=n.aa+1}else n=void 0}while(void 0!==n);return m.outerHTML()}}();"undefined"!==typeof module&&(module.M.C=Aa);function Ba(a,b){this.A=b||a;this.method=b?a:"GET"}function K(a,b,c,d){a&&a.forEach(function(a){a(b,c,d)})}function Ca(a,b){a.ia||(a.ia=[]);a.ia.push(b);return a}function Da(a,b){a.ka||(a.ka=[]);a.ka.push(b);return a}function Ea(a,b){a.ja||(a.ja=[]);a.ja.push(b);return a}
- function N(a,b){Ba.call(this,a,b);this.b=new XMLHttpRequest;this.b.onreadystatechange=function(){4===this.b.readyState&&(2===Math.floor(this.b.status/100)?K(this.ka,this.b.status,this.b.statusText,this.b.response):K(this.ja,this.b.status,this.b.statusText,this.b.response),K(this.ia,this.b.status,this.b.statusText,this.b.response))}.bind(this)}N.prototype=Object.create(Ba.prototype);N.prototype.constructor=N;N.prototype.s=function(a){this.b.timeout=a;return this};
- N.prototype.i=function(a){this.b.responseType=a;return this};N.prototype.a=function(a){this.b.open(this.method,this.A,!0);this.b.send(a);return this};function Fa(a,b){Ba.call(this,a,b);this.b=5E3;this.responseType="text"}Fa.prototype=Object.create(Ba.prototype);Fa.prototype.constructor=N;Fa.prototype.s=function(a){this.b=a;return this};Fa.prototype.i=function(a){this.responseType=a;return this};
- function Ga(a){if(!a)return null;if("string"===typeof a)return a;var b={},c;for(c in a)b[c]=a[c];return JSON.stringify(b)}var Ha=function(){var a=document.createElement("a");return function(b){a.href=b;return a.href}}();
- Fa.prototype.a=function(a){__native.sendHttpRequest(this.method,Ha(this.A),this.b,this.responseType,Ga(a),Ia.jb(function(a,c,d){try{var b="text"===this.responseType?d:JSON.parse(d)}catch(f){b=d}__native.isDebug()&&console.log(this,{ec:a,statusText:c,dc:d});2===Math.floor(a/100)?K(this.ka,a,c,b):K(this.ja,a,c,b);K(this.ia,a,c,b)},this));return this};function O(a,b){return Ja()?new Fa(a,b):new N(a,b)};function Ka(a,b){this.title=a;this.content=b;this.c=La(this);this.b=Ma(this);this.a=[];this.i=[]}
- function La(a){var b=document.createElement("div"),c=document.createElement("header"),d=document.createElement("span"),e=document.createElement("span"),f=document.createElement("div"),k=document.createElement("footer");b.a=document.createElement("span");b.b=document.createElement("span");d.textContent=a.title;"string"==typeof a.content?f.innerHTML=a.content:f.appendChild(a.content);c.className=Na;d.className=Oa;e.className=Pa;e.textContent="x";c.appendChild(d);c.appendChild(e);b.appendChild(c);f.className=
- Qa;b.appendChild(f);b.b.className=Ra;b.b.textContent=H.cb;b.b.addEventListener("click",function(){Sa(a,!1)});e.addEventListener("click",function(){Sa(a,!1)});b.a.addEventListener("click",function(){Sa(a,!0)});k.appendChild(b.b);b.a.className=Ra;b.a.textContent=H.ok;k.appendChild(b.a);k.className=Ta+" "+Ua;b.appendChild(k);b.className=Va;return b}function Sa(a,b){(b?a.a:a.i).forEach(function(a){a()});a.close()}
- function Ma(a){var b=document.createElement("div");b.className=Wa;b.addEventListener("click",function(){Sa(this,!1)}.bind(a));return b}function Xa(a,b,c){a.c.a.textContent=b;a.c.b.textContent=c;return a}Ka.prototype.wa=function(a){a=a||document.body;a.appendChild(this.b);a.appendChild(this.c);return this};Ka.prototype.close=function(){this.c.remove();this.b.remove();return this};function Ya(a,b){a.a.push(b);return a};var Ra="button",Ta="button-container",Va="dialog",Wa="dialog-overlay",Na="dialog-title",Oa="dialog-title-label",Pa="dialog-title-close",Qa="dialog-body",Ua="dialog-footer";function Za(a){var b=document.createElement("lh");b.textContent=a;b.className="chat-command-header";return b}
- function $a(a,b){var c=document.createElement("li"),d=document.createElement("span");d.className="chat-command-name";if("string"===typeof a)b&&c.appendChild(b),d.textContent=a,c.appendChild(d);else{b=document.createElement("span");var e=document.createElement("span");d.textContent=a.name;b.textContent=a.usage;e.textContent=a.zb;b.className="chat-command-usage";e.className="chat-command-desc";c.appendChild(d);c.appendChild(b);c.appendChild(e)}c.dataset.input=d.textContent;c.className="chat-command-item";
- return c}
- function ab(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,k=a.selectionEnd;f&&" "!==e[f-1];f--);for(b=e.length;k<b&&" "!==e[k];k++);if(f!==k&&0<k-f-1){if("#"===e[f]){var h=P.m;b=e.substr(f+1,k-f-1);for(var g in h)h[g].name.length>=b.length&&h[g].name.substr(0,b.length)===b&&d.push(h[g])}else if("@"===e[f])for(g in h=Q instanceof r?P.l:Q.l,b=e.substr(f+1,
- k-f-1),h){var m=h[g].getName();m.length>=b.length&&m.substr(0,b.length)===b&&d.push(h[g])}else if(":"===e[f]&&window.searchEmojis){b=e.substr(f+1,k-f-1);m=window.searchEmojis(b);for(h in m){var m=window.makeEmoji(h,!1),p=document.createElement("span");p.appendChild(m);p.className="emoji-small";d.push({name:":"+h+":",Ha:p,ua:bb.name})}for(g in P.b.data)g.length>=b.length&&g.substr(0,b.length)===b&&(h=document.createElement("span"),h.className="emoji-small",h.appendChild(cb(g)),d.push({name:":"+g+":",
- Ha:h,ua:"custom"}))}d.length&&(c.dataset.cursor=JSON.stringify([f,k]))}}if(!d.length&&"/"===e[0]){g=e.indexOf(" ");f=-1!==g;g=-1===g?e.length:g;b=e.substr(0,g);f?(a=db.gb(b))&&d.push(a):(d=db.Ab(b),c.dataset.cursor=JSON.stringify([0,a.selectionEnd]));a=P?P.i.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.Z.localeCompare(b.Z)||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(!n){var n=!0;l.appendChild(Za(H.sa))}b=document.createElement("span");b.className="chat-command-userIcon";b.style.backgroundImage='url("'+pa(e)+'")';l.appendChild($a("@"+e.getName(),b))}else e instanceof u?(n||(n=!0,l.appendChild(Za(H.m))),l.appendChild($a("#"+e.name))):e.Ha?(n!==e.ua&&(n=e.ua,l.appendChild(Za(e.ua))),l.appendChild($a(e.name,e.Ha))):(n!==e.Z&&(n=e.Z,l.appendChild(Za(e.Z))),l.appendChild($a(e)));c.appendChild(l)}}
- function eb(a){if(R)return O("PUT","api/msg?room="+encodeURIComponent(Q.id)+"&ts="+R.id+"&text="+encodeURIComponent(a)).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=db.gb(c);if(d)return a=a.trim(),d.exec(b,Q,a),!0;if(b&&(c=b.i.data[c])){if("/me"===c.name)fb(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,k=[];"#"===f[0]&&(f=f.substr(1));for(var h in d.m)d.m[h].name===f&&k.push(d.m[h]);if(k.length)var g=
- k[0];else{h=[];"@"===e[0]&&(e=e.substr(1));for(g in d.l)d.l[g].getName()===e&&h.push(d.m[g]);if(h.length)for(g=0,d=h.length;g<d;g++)if(h[g].S){g=h[g].S;break a}g=null}}g&&fb(g,b[2],!1)}O("POST","api/cmd?room="+encodeURIComponent(Q.id)+"&cmd="+encodeURIComponent(c.name.substr(1))+"&args="+encodeURIComponent(a)).a();return!0}return!1}g=fb(Q,a,!1);gb(Q,a,g,S);return!0}function hb(){document.getElementById("msgInput").focus()}
- function ib(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++}
- function jb(){var a=0,b=document.getElementById("msgInput");b.addEventListener("input",function(){if(Q){var b=Date.now();a+3E3<b&&(P.self.R||Q instanceof r)&&(O("POST","api/typing?room="+encodeURIComponent(Q.id)).a(),a=b);ab(this);ib(this)}});b.addEventListener("keydown",function(a){if(9===a.keyCode)return a.preventDefault(),!1;if(13===a.keyCode)return a.preventDefault(),a.shiftKey||a.altKey||a.ctrlKey?(a=this.selectionStart,this.value=this.value.substr(0,a)+"\n"+this.value.substr(this.selectionEnd),
- ib(this),this.selectionStart=this.selectionEnd=a+1):kb(),!1});document.getElementById("slashList").addEventListener("click",function(a){if(Q){var b=a.target;if(a=this.dataset.cursor)for(a=JSON.parse(a);b&&b!==this;){if(b.dataset.input){var c=document.getElementById("msgInput"),b=b.dataset.input;c.value.length<=a[1]&&(b+=" ");c.value=c.value.substr(0,a[0])+b+c.value.substr(a[1]);c.selectionStart=c.selectionEnd=a[0]+b.length;ab(c);c.focus();break}b=b.parentElement}}})};var T=[],lb=0;
- function mb(){var a=document.createDocumentFragment(),b=wa(function(a){return!a.la&&!1!==a.da}),c=[],d=[],e=[],f=[],k={};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.m[a];b=d.m[b];return a.name===b.name?(k[a.id]=H.Ga(c.a.name,a.name),k[b.id]=H.Ga(d.a.name,b.name),c.a.name.localeCompare(d.a.name)):a.name.localeCompare(b.name)});b.forEach(function(a){a=va(a);if(a instanceof r){var b;if(b=!a.a.bb){var h=k[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=h||a.a.getName();b.appendChild(nb());b.appendChild(p);a.a.R||b.classList.add("presence-away");Q===a&&b.classList.add("selected");a.G!==a.u&&void 0!==a.G&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=h=b}b&&(a.D?c.push(h):f.push(h))}else if(h=k[a.id],b=document.createElement("li"),p=document.createElement("a"),b.id="room_"+a.id,p.href="#"+a.id,a.i?(b.className="chat-context-room chat-group",
- b.dataset.count=Object.keys(a.l||{}).length):b.className="chat-context-room chat-channel",Q===a&&b.classList.add("selected"),p.textContent=h||a.name,b.appendChild(nb()),b.appendChild(p),a.G!==a.u&&void 0!==a.G&&(b.classList.add("unread"),0<=U.indexOf(a)&&b.classList.add("unreadHi")),h=b)a.D?c.push(h):a.i?e.push(h):d.push(h)});c.length&&a.appendChild(ob(H.D));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(ob(H.m));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});
- f.length&&a.appendChild(ob(H.pb));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);pb.apply(document.getElementById("chanSearch"));qb()?rb(P.a.id,P.l,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"}):Ja()&&(b=__native.getPreviousChannel())&&(document.location.hash=b)}
- function sb(){ua(function(a){var b=a.B,c;for(c in a.self.m)if(!a.self.m[c].la){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.l)(c=a.l[e].S)&&!c.la&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing"))});tb()}
- function tb(){var a;document.getElementById("whoistyping").textContent="";if(P&&Q&&(a=P.B[Q.id])){var b=document.createDocumentFragment(),c=!1,d;for(d in a)(a=E(d))?b.appendChild(ub(a)):c=!0;c&&(C.b=0);document.getElementById("whoistyping").appendChild(b)}}function vb(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");wb()}
- function xb(){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.l)a.push(Q.l[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;document.getElementById("chatWindow").textContent="";T=[];yb();hb();document.getElementById("fileUploadContainer").classList.add("hidden");zb();S&&(S=null,V());R&&(R=null,V());tb()}
- 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.P())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";hb()}
- function Ab(){if(R){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){R=null;Ab()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(R.P());document.getElementById("msgInput").value=R.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";hb()}
- 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.I[c]&&-1!==e.I[c].indexOf(f.self.id)?O("DELETE","api/reaction?room="+encodeURIComponent(a)+"&msg="+b+"&reaction="+encodeURIComponent(c)).a():Bb(a,b,c))};function Cb(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
- function wb(){var a=U.length,b="";if(W)b="!"+H.kb+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",Cb(a,a);else{var c=0;ta(C.context,function(a){a.G>a.u&&c++});c&&(b="("+c+")");Cb(0,c)}!b.length&&Q&&(b=Q.name);b=b.length?b:"Mimouchat";document.title=b;Db(b)}
- function Eb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(lb+3E4<a){var b=new Notification(H.Ja);lb=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}function Fb(a,b){return a&&Gb(b.f,a.f)&&!(b instanceof x)&&!a.Ib&&b.O===a.O}
- function yb(){var a=document.getElementById("chatWindow"),b=null,c=0,d=0,e=0;Q.D?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");C.a[Q.id]&&C.a[Q.id].j.forEach(function(f){var k=!1;if(T[d]){if(e>=T[d].j.length&&!f.b){if(Fb(T[d],f)){var h=f.F();30>Math.abs(c-f.f)&&b&&b.F().classList.add("chatmsg-same-ts");c=f.f;(!b||b.f<=Q.u)&&f.f>Q.u?h.classList.add("chatmsg-first-unread"):h.classList.remove("chatmsg-first-unread");
- T[d].content.appendChild(h);T[d].j.push(f.id);++e;b=f;return}if(f.f<T[d].f){for(;0<d&&f.f<T[d].f;)--d;for(;T[d];)T[d].remove(),T.splice(d,1)}else{for(;T[d].content.children[e];)T[d].content.children[e].remove();T[d].j.splice(e);T[d].j.length?d++:(T[d].remove(),T[d]=null)}e=0;c=f.f}if(Fb(T[d],f)){T[d].j[e]===f.id?(h=T[d].content.children[e],f.b?(h.remove(),T[d].j.splice(e,1)):f.T&&(k=f.F(),T[d].content.replaceChild(h,k),h=k),(!b||b.f<=Q.u)&&f.f>Q.u?h.classList.add("chatmsg-first-unread"):h.classList.remove("chatmsg-first-unread"),
- e++,b=f):f.b||(h=f.F(),T[d].content.insertBefore(h,T[d].content.children[e]),T[d].j.splice(e,0,f.id),(!b||b.f<=Q.u)&&f.f>Q.u?h.classList.add("chatmsg-first-unread"):h.classList.remove("chatmsg-first-unread"),e++,b=f);return}}f.b||(T[d]&&!Fb(T[d],f)&&T.splice(d,0,null),T[d]||(T[d]=Hb(E(f.O),f.username,f instanceof x,f.f),k=!0),h=f.F(),c=f.f,(!b||b.f<=Q.u)&&f.f>Q.u?(h.classList.add("chatmsg-first-unread"),h.insertBefore(Ib,h.firstChild)):h.classList.remove("chatmsg-first-unread"),T[d].content.appendChild(h),
- T[d].j.push(f.id),b=f,k&&(T[d+1]?a.insertBefore(T[d],T[d+1]):a.appendChild(T[d]),e=1))});if(T[d]){for(;T[d].content.children[e];)T[d].content.children[e].remove();T[d].j.splice(e);T[d].j.length||--d;for(var f=d+1;T[f];f++)T[f].remove()}for(var f=0,k=T.length;f<k;++f)T[f-1]&&Gb(T[f-1].f,T[f].f)?T[f].classList.remove("chatmsg-first-daily"):(T[f].classList.add("chatmsg-first-daily"),T[f].dataset.date=T[f].dataset.date||H.fb(T[f].f));d=T.length;Jb.forEach(function(b){b.channel===Q.id&&(T[d]||(T[d]=Hb(P.self,
- P.self.getName(),b instanceof x,b.f),a.appendChild(T[d])),T[d].classList.add("pending"),T[d].content.appendChild(b.c),T[d].j.push(b.id))});f=document.getElementById("chatWindow");f.scrollTop=f.scrollHeight-f.clientHeight;wb();window.hasFocus&&zb()}
- function Kb(a,b){if(a.classList.contains("chatmsg-hover-reply"))R&&(R=null,Ab()),S!==b&&(S=b,V());else if(a.classList.contains("chatmsg-hover-reaction")){var c=Q.id,d=b.id;Lb.wa(document.body,P,function(a){a&&Bb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(S&&(S=null,V()),R!==b&&(R=b,Ab())):a.classList.contains("chatmsg-hover-star")?b.D?O("DELETE","api/starMsg?room="+encodeURIComponent(Q.id)+"&msgId="+b.id).a():O("POST","api/starMsg?room="+encodeURIComponent(Q.id)+"&msgId="+b.id).a():
- a.classList.contains("chatmsg-hover-pin")?b.pinned?Mb(Q,b):O("POST","api/pinMsg?room="+encodeURIComponent(Q.id)+"&msgId="+b.id).a():a.classList.contains("chatmsg-hover-remove")&&(S&&(S=null,V()),R&&(R=null,Ab()),O("DELETE","api/msg?room="+encodeURIComponent(Q.id)+"&ts="+b.id).a())}function fb(a,b,c){b={channel:a.id,text:b.trim(),Ia:c,c:Nb(b,c),f:Date.now(),id:"pending"+a.id+Date.now()};Jb.push(b);a===Q&&yb();return b}
- function Ob(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.w[e]&&a.w[e].actions&&a.w[e].actions[f]&&
- Pb(a,a.w[e],a.w[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))&&Kb(c,a);break}c=c.parentElement}}
- function Pb(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 y,message_ts:a.id};O("POST","api/attachmentAction?serviceId="+encodeURIComponent(a.O)).a(JSON.stringify(d))}var e=Q.id;c.confirm?Ya(Xa(new Ka(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).wa():d()}
- function Qb(){if(!1!==X.b&&!1!==X.i){var a=document.getElementById("chatWindow").getBoundingClientRect().top;T.forEach(function(b){var c=b.ma,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px"})}}function Rb(){var a=document.getElementById("chatCtx");a.classList.contains("opened")?a.classList.remove("opened"):a.classList.add("opened")}
- document.addEventListener("DOMContentLoaded",function(){za();Sb();jb();var a=document.getElementById("chanSearch");a.addEventListener("input",pb);a.addEventListener("blur",pb);document.getElementById("chatWindow").addEventListener("click",Ob);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&qb()});document.addEventListener("mouseover",function(a){a=a.target;if(Tb.Gb(a))Tb.ba();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)){Tb.nb(d,d.m[b]).show(a);return}a:{for(var d=C.context,e=0,f=d.a.length;e<f;e++)if(d.a[e].l[b]){d=d.a[e];break a}d=null}if(d&&(b=d.l[b].S)){Tb.nb(d,b).show(a);return}}}a=a.parentElement}Tb.Db()}});document.getElementById("chatCtxButton").addEventListener("click",Rb);document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();Q&&(Q.D?Ub(Q):Vb(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",Wb);document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();Xb.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),Yb(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();kb();return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();kb();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;lb=0;Q&&zb();hb()});window.hasFocus=!0;document.getElementById("emojiButton").addEventListener("click",function(){P&&Lb.wa(document.body,P,function(a){a&&
- (document.getElementById("msgInput").value+=":"+a+":");hb()})});Ja()&&(__native.readSmsPermission(Ia.jb(function(){var a=JSON.parse(__native.getStatic());a&&C.update(a)})),document.body.classList.add("native"));IS_LOCAL||Zb()});function kb(){var a=document.getElementById("msgInput");Q&&a.value&&eb(a.value)&&(a.value="",S&&(S=null,V()),R&&(R=null,V()),document.getElementById("slashList").textContent="",ib(a));hb()};var Xb=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={X:"services",
- display:"display",cc:"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.A&&(b.emojiProvider=document.getElementById("settings-displayEmojiProvider").value);var c=!!document.getElementById("settings-displayDisplayAvatar").checked;
- c!==(!1!==X.b)&&(b.displayAvatar=c);c=!!document.getElementById("settings-displayColorfulNames").checked;c!==(!0===X.s)&&(b.colorfulNames=c);c=!!document.getElementById("settings-displayScrollAvatars").checked;c!==(!1!==X.i)&&(b.scrollAvatars=c);c=document.getElementById("settings-displayAttachmentContent").value;c!==X.a&&(b.autoExpandAttachments=c);var c=X,d;for(d in b){$b(c,b);ac();O("POST","api/settings?service=null&device=null").a(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.X){var m=X.X[g];for(n in m){var f=document.createElement("li"),p=document.createElement("span"),l=document.createElement("span");p.textContent=g;l.textContent=m[n];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}}m=document.getElementById("settings-serviceList");m.textContent="";f?(document.getElementById("settings-serviceListEmpty").classList.remove("hidden"),
- m.appendChild(d)):document.getElementById("settings-serviceListEmpty").classList.add("hidden");d=document.createDocumentFragment();m=document.getElementById("settings-displayEmojiProvider");for(g in bc){var n=document.createElement("option");n.value=g;n.textContent=bc[g].name;bc[g]===bb&&(n.selected=!0);d.appendChild(n)}m.textContent="";m.appendChild(d);document.getElementById("settings-displayDisplayAvatar").checked=!1!==X.b;document.getElementById("settings-displayColorfulNames").checked=!0===X.s;
- document.getElementById("settings-displayScrollAvatars").checked=!1!==X.i;document.getElementById("settings-displayAttachmentContent").value=void 0!==X.a?X.a:cc;c=!0}b(a||e.X);return this},Nb:function(){return this},Kb:e}}();function dc(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.V=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"),k=e.getContext("2d"),h=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){k.fillStyle="#808080";k.fillRect(0,0,300,300);f.fillStyle="#808080";f.fillRect(0,0,300,300);var p=Math.pow(2,a),n=(e+180)/360*p,m=(1-Math.log(Math.tan(d*Math.PI/180)+1/Math.cos(d*Math.PI/180))/Math.PI)/2*p,l=Math.floor(n),L=Math.floor(m),
- ya=g?100*g/h(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,{Eb:e,Hb:g,tb:d}).then(function(a){if(a.tb===b){k.drawImage(a.V,100*a.Eb,100*a.Hb,100,100);a=n-l;var c=m-L;a=100*a+100;c=100*c+100;f.putImageData(k.getImageData(0,0,300,300),0,0);void 0!==ya&&(f.beginPath(),f.arc(a,c,Math.max(ya,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===ya||25<ya)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()}}).catch(function(){})},m,p=function(c){c=Math.max(4,Math.min(19,c));m!==c&&(b++,m=c,g(m,Number(a.latitude),Number(a.longitude),Number(a.accuracy)))};p(12);var e=document.createElement("div"),l=document.createElement("div"),n=document.createElement("button"),v=document.createElement("button");
- e.className="OSM-wrapper";d.className="OSM-canvas";l.className="OSM-controls";v.className="OSM-controls-zoomMin";n.className="OSM-controls-zoomPlus";v.addEventListener("click",function(){p(m-1)});n.addEventListener("click",function(){p(m+1)});l.appendChild(v);l.appendChild(n);e.appendChild(d);e.appendChild(l);return e}};function nb(){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 ob=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
- function ec(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 cb(a){return"makeEmoji"in window?(a=ec(a),"string"===typeof a&&(a=window.makeEmoji(a)),"string"===typeof a?null:a):null}
- function fc(a,b){var c=b.context.Y;b=C.context.Ia(b.O);if(c.replyToMsg){var d=document.createElement("li");d.className="chatmsg-hover-reply";d.style.backgroundImage='url("repl.svg")';a.appendChild(d)}c.reactMsg&&(d=document.createElement("li"),d.className="chatmsg-hover-reaction",d.style.backgroundImage='url("smile.svg")',a.appendChild(d));if(b&&c.editMsg||c.editOtherMsg)d=document.createElement("li"),d.className="chatmsg-hover-edit",d.style.backgroundImage='url("edit.svg")',a.appendChild(d);c.starMsg&&
- (a.pa=document.createElement("li"),a.pa.className="chatmsg-hover-star",a.appendChild(a.pa));c.pinMsg&&(d=document.createElement("li"),d.className="chatmsg-hover-pin",a.appendChild(d),d.style.backgroundImage='url("pin.svg")');if(b&&c.removeMsg||c.moderate)c=document.createElement("li"),c.className="chatmsg-hover-remove",c.style.backgroundImage='url("remove.svg")',a.appendChild(c)}
- function gc(a){var b=document.createElement("div"),c=document.createElement("div"),d=document.createElement("summary");b.ea=document.createElement("ul");b.w=document.createElement("ul");b.I=document.createElement("ul");b.f=document.createElement("div");b.xa=document.createElement("div");b.na=document.createElement("span");b.L=document.createElement("details");b.L.addEventListener("toggle",function(){this.Ob=!0});b.className="chatmsg-item";b.f.className="chatmsg-ts";b.xa.className="chatmsg-msg";b.na.className=
- "chatmsg-author-name";a&&(b.id=a.i+"_"+a.id,fc(b.ea,a),b.ea.className="chatmsg-hover");c.appendChild(b.na);c.appendChild(b.xa);c.appendChild(b.f);d.textContent="attachment";b.L.appendChild(d);b.L.appendChild(b.w);c.appendChild(b.L);b.J=document.createElement("div");b.J.className="chatmsg-edited";c.appendChild(b.J);c.appendChild(b.I);c.className="chatmsg-content";b.w.className="chatmsg-attachments";b.I.className="chatmsg-reactions";b.appendChild(c);b.appendChild(b.ea);return b}
- function hc(a){if(!a.length)return"black";for(var b=0,c=0,c=[],d=0,e=0,f=0,k,h=0,g=a.length;h<g;h++)c[h]=a.charCodeAt(h),d+=c[h];k=d/a.length;c.forEach(function(a){var c=Math.abs(k-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 Hb(a,b,c,d){var e=document.createElement("div"),f=document.createElement("div"),k=document.createElement("a"),h=document.createElement("img");e.ma=document.createElement("span");e.ma.className="chatmsg-author-img-wrapper";h.className="chatmsg-author-img";k.className="chatmsg-author-name";k.href="#"+a.id;a?(k.textContent=a.getName(),k.style.backgroundColor=hc(a.getName()),h.src=pa(a)):(k.textContent=b||"?",h.src="");e.ma.appendChild(h);f.appendChild(e.ma);f.appendChild(k);f.className="chatmsg-author";
- e.className="chatmsg-authorGroup";c&&e.classList.add("chatmsg-me_message");e.appendChild(f);e.content=document.createElement("div");e.content.className="chatmsg-author-messages";e.j=[];e.appendChild(e.content);e.f=d;e.Ib=c;e.O=a.id;return e}function ic(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 jc(a,b,c){var d=document.createElement("li"),e=document.createElement("div"),f=document.createElement("div"),k=document.createElement("a"),h=document.createElement("div"),g=document.createElement("img"),m=document.createElement("a"),p=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div"),v=document.createElement("img"),B=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=ic(b.color||"");e.className="chatmsg-attachment-block";
- f.className="chatmsg-attachment-pretext";b.pretext?f.innerHTML=a.C(b.pretext):f.classList.add("hidden");k.target="_blank";b.title?(k.innerHTML=a.C(b.title),b.title_link&&(k.href=b.title_link),k.className="chatmsg-attachment-title"):k.className="hidden chatmsg-attachment-title";m.target="_blank";h.className="chatmsg-author";b.author_name&&(m.innerHTML=a.C(b.author_name),m.href=b.author_link||"",m.className="chatmsg-author-name",g.className="chatmsg-author-img",b.author_icon&&(g.src=b.author_icon,h.appendChild(g)),
- h.appendChild(m));n.className="chatmsg-attachment-thumb";b.thumb_url?(g=document.createElement("img"),g.src=b.thumb_url,n.appendChild(g),e.classList.add("has-thumb"),b.video_html&&(n.dataset.video=b.video_html)):n.classList.add("hidden");p.className="chatmsg-attachment-content";g=a.C(b.text||"");l.className="chatmsg-attachment-text";g&&""!=g?l.innerHTML=g:l.classList.add("hidden");p.appendChild(n);p.appendChild(l);b.geo&&(l=dc(b.geo))&&p.appendChild(l);v.className="chatmsg-attachment-img";b.image_url?
- v.src=b.image_url:v.classList.add("hidden");B.className="chatmsg-attachment-footer";b.footer&&(l=document.createElement("span"),l.className="chatmsg-attachment-footer-text",l.innerHTML=a.C(b.footer),b.footer_icon&&(n=document.createElement("img"),n.src=b.footer_icon,n.className="chatmsg-attachment-footer-icon",B.appendChild(n)),B.appendChild(l));b.ts&&(l=document.createElement("span"),l.className="chatmsg-ts",l.innerHTML=H.U(b.ts),B.appendChild(l));e.appendChild(k);e.appendChild(h);e.appendChild(p);
- e.appendChild(v);if(b.fields&&b.fields.length){var z=document.createElement("ul");e.appendChild(z);z.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.C(d);e.appendChild(f);e.appendChild(g);e&&z.appendChild(e)})}if(b.actions&&
- b.actions.length)for(k=document.createElement("ul"),k.className="chatmsg-attachment-actions "+Ta,e.appendChild(k),h=0,p=b.actions.length;h<p;h++)(v=b.actions[h])&&(v=kc(c,h,v))&&k.appendChild(v);e.appendChild(B);d.appendChild(f);d.appendChild(e);return d}
- function kc(a,b,c){var d=document.createElement("li"),e=ic(c.style);d.textContent=c.text;e!==ic()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Ra;return d}function ub(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(nb());b.appendChild(c);return b};var Lb=function(){function a(a,b){for(a=a.target;a!==m&&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(){z={};l.textContent="";window.emojiProviderHeader&&(l.appendChild(h(window.emojiProviderHeader)),n.textContent="",l.appendChild(n));l.appendChild(h("emojicustom.png"));l.appendChild(v)}function c(){if(!d())return!1;t&&t(null);return!0}function d(){return m.parentElement?(m.parentElement.removeChild(p),m.parentElement.removeChild(m),
- !0):!1}function e(a){var b=0;a=void 0===a?B.value:a;if(g()){var c=0,d=window.searchEmojis(a),e=f(d,J?J.self.W.a:[]),h;for(p in z)z[p].visible&&(z[p].visible=!1,n.removeChild(z[p].c));var p=0;for(h=e.length;p<h;p++){var m=e[p].name,l=z[m];if(!l){var l=z,L=m;var t=m;var m=window.makeEmoji(d[m]),I=document.createElement("span");I.appendChild(m);I.className="emoji-medium";t=k(t,I);l=l[L]=t}l.visible||(l.visible=!0,n.appendChild(l.c));c++}b+=c}p=b;c=0;for(F in A)A[F].visible&&(A[F].visible=!1,v.removeChild(A[F].c));
- if(J){d=f(J.b.data,J?J.self.W.a:[]);var F=0;for(b=d.length;F<b;F++)L=d[F].name,""!==a&&L.substr(0,a.length)!==a||"alias:"===J.b.data[L].substr(0,6)||(e=A[L],e||(e=A,l=h=L,L=J.b.data[L],t=document.createElement("span"),m=document.createElement("span"),t.className="emoji emoji-custom",t.style.backgroundImage='url("'+L+'")',t.textContent=":"+l+":",t.title=l,m.appendChild(t),m.className="emoji-medium",l=k(l,m),e=e[h]=l),e.visible||(e.visible=!0,v.appendChild(e.c)),c++);F=c}else F=0;return p+F}function f(a,
- b){var c=[],d;for(d in a){var e={name:d,ob: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.ob-b.ob})}function k(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 h(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 m=document.createElement("div"),p=document.createElement("div"),l=document.createElement("div"),n=document.createElement("ul"),v=document.createElement("ul"),B=document.createElement("input"),z={},A={},M=document.createElement("div"),I=document.createElement("span"),F=document.createElement("span"),t,J;p.addEventListener("click",function(a){var b=m.getBoundingClientRect();(a.screenY<b.top||a.screenY>b.bottom||a.screenX<b.left||a.screenX>b.right)&&
- c()});p.className="emojibar-overlay";m.className="emojibar";l.className="emojibar-emojis";n.className=v.className="emojibar-list";B.className="emojibar-search";M.className="emojibar-detail";I.className="emojibar-detail-img";F.className="emojibar-detail-name";M.appendChild(I);M.appendChild(F);b();m.appendChild(l);m.appendChild(M);m.appendChild(B);B.addEventListener("keyup",function(){e()});m.addEventListener("mousemove",function(b){a(b,function(a){var b=a?z[a]||A[a]:null;b?(I.innerHTML=b.c.outerHTML,
- F.textContent=":"+a+":"):(I.textContent="",F.textContent="")})});m.addEventListener("click",function(b){a(b,function(a){a&&d()&&t&&t(a)})});return{isSupported:g,wa:function(a,b,c){return g()?(J=b,t=c,a.appendChild(p),a.appendChild(m),B.value="",e(),B.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var C,U=[];function lc(){da.call(this)}lc.prototype=Object.create(da.prototype);lc.prototype.constructor=lc;function sa(a){return a.a?a.a.id:null}function mc(){this.b=0;this.context=new qa;this.a={}}
- mc.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 lc,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=[],k=this.a[e];k||(k=this.a[e]=new Y(e,250,null,b));d[e].forEach(function(a){f.push(k.a(a,b))});c.m[e].b=f}}ta(this.context,function(a){a.G===a.u&&(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 h in a.live){var g=D(this.context,h);(c=g.m[h])?(this.a[h].j.length&&ha(c,na(this.a[h]).f,b),c.la||(nc(g,c,a.live[h]),Q&&a.live[Q.id]&&yb())):C.b=0}}a["static"]&&mb();var m=!1;a.typing&&this.context.a.forEach(function(c){var d=m,e=a.typing,f=!1;if(c.B)for(var g in c.B)e&&!e[g]&&(delete c.B[g],f=!0);if(e)for(g in e)if(c.m[g]){c.B[g]||(c.B[g]={});for(var h in e[g])c.B[g][h]||(f=!0),c.B[g][h]=
- b}m=d|f},this);(a["static"]||m)&&sb();a.config&&(X=new oc(a.config),ac());if(P&&Q&&a["static"]&&a["static"][P.a.id]&&a["static"][P.a.id].channels&&a["static"][P.a.id].channels)for(h=a["static"][P.a.id].channels,g=0,c=h.length;g<c;g++)if(h[g].id===Q.id){yb();break}};setInterval(function(){var a=!1,b=Date.now();ua(function(c){var d=!1,e;for(e in c.B){var f=!0,k;for(k in c.B[e])c.B[e][k]+6500<b?(delete c.B[e][k],d=!0):f=!1;f&&(delete c.B[e],d=!0)}d&&(a=!0)});a&&sb()},1E3);
- function nc(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,k=!1,h=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.u)&&c.user!==a.self.id){k=!0;var d;if(!(d=b instanceof r)&&(d=c.text)&&!(d=e&&c.text.match(e)))a:{d=a.self.W.H;for(var g=0,n=d.length;g<n;g++)if(-1!==c.text.indexOf(d[g])){d=!0;break a}d=!1}d&&(-1===U.indexOf(b)&&(h=!0,U.push(b)),f=!0)}});if(k){wb();var g=document.getElementById("room_"+b.id);g&&(g.classList.add("unread"),f&&g.classList.add("unreadHi"));
- h&&!window.hasFocus&&Eb()}}c.forEach(function(a){if(!d||d===a.O)for(var c=0,e=Jb.length;c<e;c++){var f=Jb[c];if(f.channel===b.id&&!!a.isMeMessage===f.Ia&&(a.pendingId===f.ta&&f.ta||!f.ta&&a.text.trim()===f.text)){Jb.splice(c,1);break}}})}
- function zb(){var a=Q,b=U.indexOf(a);if(a.G>a.u){var c=C.a[a.id];c&&(c=na(c))&&(O("POST","api/markread?room="+encodeURIComponent(a.id)+"&id="+c.id+"&ts="+c.f).a(),a.u=c.f)}0<=b&&(U.splice(b,1),wb());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}function pc(){for(var a in C.a)qc(C.a[a]);Q&&yb()}C=new mc;var rb=function(){function a(a,c){c.sort(function(){return Math.random()-.5});for(var d=0,e=20;e<m-40;e+=l)for(var f=0;f+l<=p;f+=l)k(a,c[d],e,f),d++,d===c.length&&(c.sort(b),d=0)}function b(a,b){return a.V?b.V?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].V){d(a[e].src,function(d){a[e].V=d;c(a,b)});return}var g=[];a.forEach(function(a){a.V&&g.push(a.V)});b(g)}function d(a,b){Ea(Da(O(a),function(a,c,d){if(d){var e=new Image;e.onload=function(){var a=document.createElement("canvas");
- a.height=a.width=B;a=a.getContext("2d");a.drawImage(e,0,0,B,B);var a=a.getImageData(0,0,B,B),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)}).i("blob").a()}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,m,p);return g.getImageData(0,0,m,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 k(a,b,c,d){var e=Math.floor(d);a=[a.data[e*m*4+0],a.data[e*m*4+1],a.data[e*m*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+n);g.lineTo(c-n+l,d+l/2);g.lineTo(c+l/2,d-n+l);g.lineTo(c+n,d+l/2);g.closePath();g.fill();g.putImageData(f(g.getImageData(c+n,d+n,v,v),b),c+n,d+n)}var h=document.createElement("canvas"),g=h.getContext("2d"),m=h.width=250,p=h.height=290,l=(m-40)/3,n=.1*l,v=Math.floor(l-2*n),B=.5*v,z={},A={},M={};return function(b,d,f){if(z[b])f(z[b]);else if(M[b])A[b]?A[b].push(f):A[b]=[f];else{var g=e(),k=[];M[b]=!0;A[b]?A[b].push(f):A[b]=[f];for(var l in d)d[l].bb||d[l].Fb||k.push({src:pa(d[l])});
- c(k,function(c){a(g,c);z[b]=h.toDataURL();A[b].forEach(function(a){a(z[b])})})}}}();var W=0,Q=null,Ib=document.createElement("span"),P=null,S=null,R=null,Jb=[];function Sb(){Ea(Da(O("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")}).s(6E4).a()}
- function rc(){var a=Q;Ca(Da(O("api/hist?room="+encodeURIComponent(a.id)).i("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.j.length&&ha(a,na(b).f,e),nc(D(C.context,a.id),a,d),a===Q&&yb())}}),function(){}).a()}
- function ac(){sc()&&Xb.Nb(!1).display(Xb.Kb.X);tc();!1!==X.i?(document.getElementById("chatWindow").addEventListener("scroll",Qb),Qb()):(pc(),document.getElementById("chatWindow").removeEventListener("scroll",Qb));for(var a in C.a)C.a[a].j.forEach(function(a){a.c&&a.N()});document.getElementById("customsheet").innerHTML=uc()}
- function Zb(){var a=vc;IS_LOCAL||Ca(O("api?v="+C.b),function(b,c,d){(b=2===Math.floor(b/100))?W&&(W=0,vb(!0)):W?(W+=Math.floor((W||5)/2),W=Math.min(60,W)):(W=5,vb(!1));a(b,d)}).i("json").s(6E4).a()}function vc(a,b){a?(b&&C.update(b),Zb()):setTimeout(wc,1E3*W)}function wc(){Zb()}function Db(a){if(Ja()){var b=!(!P||!P.Y.starChannel);__native.setTitle(a,b,b?Q.D:!1)}}
- function xc(a){Q&&(document.getElementById("room_"+Q.id).classList.remove("selected"),document.getElementById("chatSystemContainer").classList.add("no-room-selected"),Ib.remove());Ib.className="chatmsg-unread";Ib.textContent=H.Ja;document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");Q=a;P=D(C.context,a.id);Ja()&&__native.setCurrentChannel(a.id);xb();Tb.Cb();rb(P.a.id,P.l,function(a){document.getElementById("chatCtx").style.backgroundImage=
- "url("+a+")"});(!C.a[Q.id]||100>C.a[Q.id].j.length)&&rc();document.getElementById("chatSystemContainer").classList.remove("no-room-selected");document.getElementById("chatCtx").classList.remove("opened")}function qb(){var a=document.location.hash.substr(1),b=va(a);return b&&b!==Q?(xc(b),!0):(a=E(a))&&a.S?(xc(a.S),!0):!1}function Vb(a){O("POST","api/starChannel?room="+encodeURIComponent(a.id)).a()}function Ub(a){O("POST","api/unstarChannel?room="+encodeURIComponent(a.id)).a()}
- function Yb(a,b,c){var d=Q;new FileReader;var e=new FormData;e.append("file",b);e.append("filename",a);Ea(Da(O("POST","api/file?room="+encodeURIComponent(d.id)),function(){c(null)}),function(a,b){c(b)}).a(e)}
- function gb(a,b,c,d){b="api/msg?room="+encodeURIComponent(a.id)+"&text="+encodeURIComponent(b);d&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:d.text,author_name:E(d.O).getName(),text:d.text,footer:a.i?H.message:a.name,ts:d.f}])));Ib.remove();Da(O("POST",b).i("json"),function(a,b,d){d&&void 0!==d.pendingId&&(c.ta=d.pendingId)}).a()}function Mb(a,b){O("DELETE","api/pinMsg?room="+encodeURIComponent(a.id)+"&msgId="+b.id).a()}
- function Bb(a,b,c){O("POST","api/reaction?room="+encodeURIComponent(a)+"&msg="+b+"&reaction="+encodeURIComponent(c)).a()}function Wb(){O("POST","api/logout").a();document.cookie="sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";document.location.reload();Ja()&&__native.logout()}
- function pb(){var a={},b=[],c=this.value;ta(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].sa+a[d].za+a[d].va?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var bc={noemoji:{qa:"noemoji.js",ca:null,name:"None"},emojione_v2_3:{qa:"emojione_v2.3.sprites.js",ca:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{qa:"emojione_v3.sprites.js",ca:"emojione_v3.sprites.css",name:"Emojione v3"},"emojione_v4.5":{qa:"emojione_v4.5.sprites.js",ca:"emojione_v4.5.sprites.css",name:"Emojione v4.5"}},yc=bc.emojione_v2_3,bb;
- function zc(a){bb!==a&&(console.log("Loading emoji pack "+a.name),Da(O(a.qa),function(b,c,d){b=document.createElement("script");b.innerHTML=d;b.language="text/javascript";document.body.appendChild(b);a.ca&&(d=document.createElement("link"),d.href=a.ca,d.rel="stylesheet",document.head.appendChild(d));d=document.getElementById("emojiButton");pc();Lb.reset();"makeEmoji"in window?(d.style.backgroundImage='url("smile.svg")',d.classList.remove("hidden")):d.classList.add("hidden")}).s(6E4).a(),bb=a)}
- function tc(){var a=X.A;zc(a&&bc[a]?bc[a]:yc)};var Tb=function(){function a(){c();t instanceof r?(f.style.backgroundImage="url(api/avatar?size=l&user="+encodeURIComponent(t.a.id)+")",m.textContent=(t.a.qb||(t.a.eb||"")+" "+t.a.ib).trim(),k.classList.add("presence-indicator"),t.a.R?k.classList.remove("presence-away"):k.classList.add("presence-away"),g.classList.remove("hidden"),l.classList.remove("hidden"),l.textContent=t.a.Lb||"",v.textContent=t.a.Bb||"",n.classList.remove("hidden"),e.classList.remove("roominfo-channel"),e.classList.add("roominfo-user")):
- b()}function b(){var a=F;a.Y.topic?(g.classList.remove("hidden"),m.textContent=t.za||"",p.textContent=t.A?H.Na(t.A,t.ga):""):g.classList.add("hidden");a.Y.purpose?(n.classList.remove("hidden"),v.textContent=t.va||"",B.textContent=t.s?H.Na(t.s,t.fa):""):n.classList.add("hidden");f.style.backgroundImage="";k.classList.remove("presence-indicator");M.textContent=H.sb(t.l?Object.keys(t.l).length:0);a=[];if(t.l)for(var b in t.l)a.push(t.l[b]);a.sort(function(a,b){return a.R&&!b.R?-1:b.R&&!a.R?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.R||b.classList.add("presence-away");c.appendChild(b)});I.textContent="";I.appendChild(c);e.classList.add("roominfo-channel");e.classList.remove("roominfo-user")}function c(){k.textContent=t.name;if(t.b){z.textContent=H.mb(t.b.length);z.classList.remove("hidden");A.classList.remove("hidden");
- var a=document.createDocumentFragment();t.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=Ra+" roominfo-unpin";c.className="roominfo-pinlist-item";c.appendChild(b.P());c.appendChild(e);a.appendChild(c)});A.textContent="";A.appendChild(a)}else z.classList.add("hidden"),A.classList.add("hidden")}function d(){if(t.b)for(var a=0,b=t.b.length;a<b;a++)if(t.b[a].id===this.dataset.msgId){Mb(t,
- t.b[a]);break}}var e=document.createElement("div"),f=document.createElement("header"),k=document.createElement("h3"),h=document.createElement("div"),g=document.createElement("div"),m=document.createElement("span"),p=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div"),v=document.createElement("span"),B=document.createElement("span"),z=document.createElement("div"),A=document.createElement("ul"),M=document.createElement("div"),I=document.createElement("ul"),
- F,t;e.className="chat-context-roominfo";f.className="roominfo-title";g.className="roominfo-topic";n.className="roominfo-purpose";l.className="roominfo-phone";z.className="roominfo-pincount";A.className="roominfo-pinlist";M.className="roominfo-usercount";I.className="roominfo-userlist";B.className=p.className="roominfo-author";f.appendChild(k);e.appendChild(f);e.appendChild(h);g.appendChild(m);g.appendChild(p);n.appendChild(v);n.appendChild(B);h.appendChild(g);h.appendChild(l);h.appendChild(n);h.appendChild(z);
- h.appendChild(A);h.appendChild(M);h.appendChild(I);var J=null;return{nb:function(b,c){this.ba();F=b;t=c;a();return this},update:function(){this.ba();a();return this},show:function(a){this.ba();a.appendChild(e);e.classList.remove("hidden");return this},Cb:function(){this.ba();e.classList.add("hidden");return this},ba:function(){J&&clearTimeout(J);J=null;return this},Db:function(){J||(J=setTimeout(function(){e.classList.add("hidden");J=null},300));return this},Gb: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.a=function(a,b){return!0===a.isMeMessage?new Ac(this.id,a,b):!0===a.isNotice?new Bc(this.id,a,b):new Cc(this.id,a,b)};function qc(a){a.j.forEach(function(a){a.K()})}
- var Z=function(){function a(a,d){return Aa(d,{H:a.context.self.W.H,$:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=cb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},ra:function(c){return b(a,c)}})}function b(a,b){var c=b.indexOf("|"),d;if(-1===c)var k=b;else{k=b.substr(0,c);var h=b.substr(c+1)}if("@"===k[0])if(k=sa(a.context)+"|"+k.substr(1),d=E(k))a=!0,k="#"+d.S.id,h="@"+d.getName(),d="background-color:"+
- hc(d.getName()),b=["chatmsg-link-user","chatmsg-link"];else return null;else if("#"===k[0])if(k=sa(a.context)+"|"+k.substr(1),h=va(k))a=!0,k="#"+k,h="#"+h.name,b=["chatmsg-link-chan","chatmsg-link"];else return null;else{if(!k.match(/^(https?|mailto):\/\//i))return null;b=["chatmsg-link"];a=!1}return{link:k,text:h||k,style:d,ab:b,hb:a}}return{K:function(a){a.T=!0;return a},ha:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},F:function(a){a.c?a.T&&(a.T=!1,a.N()):a.Fa().N();return a.c},
- N:function(b){var c=E(b.O);b.c.f.innerHTML=H.U(b.f);b.c.xa.innerHTML=a(b,b.text);b.c.na.textContent=c?c.getName():b.username||"?";for(var e=document.createDocumentFragment(),f=c=!1,k=0,h=b.w.length;k<h;k++){var g=b.w[k];if(g){var m=jc(b,g,k);m&&(e.appendChild(m),c|=!!g.image_url,f=!0)}}b.c.w.textContent="";b.c.w.appendChild(e);f?(b.c.L.classList.remove("hidden"),b.c.L.Ob||(e=X,b.c.L.open=1!==e.a&&(e.a!==cc&&void 0!==e.a||c)?!1:!0)):b.c.L.classList.add("hidden");c=b.i;e=document.createDocumentFragment();
- if(b.I)for(var p in b.I){f=c;k=b.id;h=p;g=b.I[p];if(m=cb(h)){for(var l=document.createElement("li"),n=document.createElement("a"),v=document.createElement("span"),B=document.createElement("span"),z=[],A=0,M=g.length;A<M;A++){var I=E(g[A]);I&&z.push(I.getName())}z.sort();B.textContent=z.join(", ");v.appendChild(m);v.className="emoji-small";n.href="javascript:toggleReaction('"+f+"', '"+k+"', '"+h+"')";n.appendChild(v);n.appendChild(B);l.className="chatmsg-reaction-item";l.appendChild(n);f=l}else console.warn("Reaction id not found: "+
- h),f=null;f&&e.appendChild(f)}b.c.I.textContent="";b.c.I.appendChild(e);b.c.ea.pa&&(b.c.ea.pa.style.backgroundImage=b.D?'url("star_full.png")':'url("star_empty.png")');b.J&&(b.c.J.innerHTML=H.J(b.J),b.c.classList.add("edited"));return b},P:function(a){return a.F().cloneNode(!0)},C:function(b,d){return a(b,d)}}}();function Ac(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.i=a;this.c=Z.c;this.T=Z.T}Ac.prototype=Object.create(x.prototype);q=Ac.prototype;q.constructor=Ac;q.K=function(){return Z.K(this)};
- q.C=function(a){return Z.C(this,a)};q.ha=function(){return Z.ha(this)};q.F=function(){return Z.F(this)};q.Fa=function(){this.c=gc(this);this.c.classList.add("chatmsg-me_message");return this};q.P=function(){return Z.P(this)};q.N=function(){Z.N(this);return this};q.update=function(a,b){x.prototype.update.call(this,a,b);this.K()};function Cc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.i=a;this.c=Z.c;this.T=Z.T}Cc.prototype=Object.create(w.prototype);q=Cc.prototype;q.constructor=Cc;
- q.K=function(){return Z.K(this)};q.C=function(a){return Z.C(this,a)};q.ha=function(){return Z.ha(this)};q.F=function(){return Z.F(this)};q.Fa=function(){this.c=gc(this);return this};q.P=function(){return Z.P(this)};q.N=function(){Z.N(this);return this};
- q.update=function(a,b){w.prototype.update.call(this,a,b);this.K();if(a=this.text.match(/^<?https:\/\/www\.openstreetmap\.org\/\?mlat=(-?[0-9\.]+)(&|&)mlon=(-?[0-9\.]+)(&|&)macc=([0-9\.]+)[^\s]*/))this.text=this.text.substr(0,a.index)+this.text.substr(a.index+a[0].length).trim(),this.w.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 Bc(a,b,c){w.call(this,b,c);this.context=D(C.context,a);this.i=a;this.a=null;this.T=!0}Bc.prototype=Object.create(y.prototype);q=Bc.prototype;q.constructor=Bc;q.K=function(){return Z.K(this)};q.C=function(a){return Z.C(this,a)};q.ha=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.F=function(){Z.F(this);return this.a};q.P=function(){return this.a.cloneNode(!0)};
- q.Fa=function(){this.c=gc(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=H.lb;this.a.appendChild(this.c);return this};q.N=function(){Z.N(this);return this};q.update=function(a,b){y.prototype.update.call(this,a,b);this.K()};
- function Nb(a,b){var c=gc(null);c.classList.add("chatmsg-pending");b&&c.classList.add("chatmsg-me_message");c.xa.innerHTML=Aa(a,{$:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=cb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null}});c.na.textContent=P.self?P.self.getName():"";a=document.createElement("span");a.className="typing-dot1";a.textContent=".";c.f.appendChild(a);a=document.createElement("span");
- a.className="typing-dot2";a.textContent=".";c.f.appendChild(a);a=document.createElement("span");a.className="typing-dot3";a.textContent=".";c.f.appendChild(a);c.f.classList.add("typing-container");c.L.remove();return c};function sc(){var a=X.X,b;for(b in a)if(a.hasOwnProperty(b))return!1;return!0}function Gb(a,b){a=new Date(a);b=new Date(b);a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);return a.getTime()===b.getTime()};var X,cc=2;function oc(a){this.X={};for(var b=0,c=a.length;b<c;b++)null===a[b].service&&null===a[b].device&&$b(this,JSON.parse(a[b].config))}
- function $b(a,b){if(b.services)for(var c in b.services)a.X[c]=b.services[c];void 0!==b.emojiProvider&&(a.A=b.emojiProvider);void 0!==b.displayAvatar&&(a.b=b.displayAvatar);void 0!==b.colorfulNames&&(a.s=b.colorfulNames);void 0!==b.scrollAvatars&&(a.i=b.scrollAvatars);void 0!==b.autoExpandAttachments&&(a.a=b.autoExpandAttachments);"string"===typeof a.a&&(a.a=parseInt(a.a,10))}
- function uc(){var a=X,b={},c="";!1===a.b&&(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.s||(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 oc([]);function Dc(){}Dc.prototype.close=function(){};function Ec(a,b){Dc.apply(this);this.Ma=Fc++;this.xb=a;this.port=b}Ec.prototype=Object.create(Dc);Ec.prototype.constructor=Ec;Ec.prototype.connect=function(){return new Promise(function(){__native.TCPConnect(this.Ma,this.xb,this.port)})};Ec.prototype.write=function(a){__native.TCPWrite(this.Ma,a)};Ec.prototype.close=function(){__native.TCPClose(this.Ma)};var Fc=0;var Ia=function(){var a={},b=0;return{jb:function(c,d){var e=b++;d&&(c.yb=d);a[""+e]=c;return e},Jb:function(){var b=""+Array.prototype.shift.call(arguments);a[b]&&(a[b].apply(a[b].yb,arguments),delete a[b])}}}();window.__CALLBACK={onResult:Ia.Jb};function Ja(){return!!("__native"in window)};window.displayMenu=function(){document.getElementById("chatCtx").classList.add("opened")};window.hideMenu=function(){document.getElementById("chatCtx").classList.remove("opened")};window.toggleMenu=function(){Rb()};window.setChannelFavorite=function(a,b){var c=va(a);c?b?Vb(c):Ub(c):console.error("Channel "+a+" not found")};window.onApplicationPaused=function(){window.hasFocus=!1};window.onApplicationResumed=function(){window.hasFocus=!0};var db=function(){var a=[];return{gb:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},Ab: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},Mb:function(b){b.Z="client";b.exec=b.exec.bind(b);a.push(b)}}}();function Gc(){return new Promise(function(a,b){"geolocation"in window.navigator?navigator.geolocation.getCurrentPosition(function(c){c?a(c):b("denied")}):b("geolocation not available")})}
- xa.push(function(){db.Mb({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:H.rb,exec:function(a,b){Gc().then(function(a){var c=a.coords.latitude,e=a.coords.longitude;gb(b,"https://www.openstreetmap.org/?mlat="+c+"&mlon="+e+"&macc="+a.coords.accuracy+"#map=17/"+c+"/"+e)}).catch(function(a){console.error("Error: ",a)})}})});
- })();
|