}vari=[];for(varainn.ffz_commands)n.ffz_commands.hasOwnProperty(a)&&i.push(a);return"The available commands are: "+i.join(", ")},n.ffz_commands.help.help="Usage: /ffz help [command]\nList available commands, or show help for a specific command.",n.prototype.add_room=function(e,t){returnthis.rooms[e]?this.log("Tried to add existing room: "+e):(this.log("Adding Room: "+e),this.rooms[e]={id:e,room:t,menu_sets:[],sets:[],css:null},this.ws_send("sub",e),voidthis._legacy_add_room(e))},n.prototype.remove_room=function(e){vart=this.rooms[e];if(t){this.log("Removing Room: "+e),(t.css||t.moderator_badge)&&r.update_css(this._room_style,e,null),this.ws_send("unsub",e),deletethis.rooms[e];for(varn=0;n<t.sets.length;n++){varo=t.sets[n],i=this.emote_sets[o];i&&(i.users.removeObject(e),i.global||i.users.length||this.unload_set(o))}}},n.prototype.load_room=function(e,t){returnthis._legacy_load_room(e,t)},n.prototype._load_room_json=function(e,t,n){this.rooms[e]&&(n.room=this.rooms[e].room),this.rooms[e]=n,(n.css||n.moderator_badge)&&r.update_css(this._room_style,e,l(n)+(n.css||""));for(varo=0;o<n.sets.length;o++){vari=n.sets[o];this.emote_sets.hasOwnProperty(i)||this.load_set(i)}this.update_ui_link(),t&&t(!0,n)},n.prototype._modify_room=function(e){vart=this;e.reopen({init:function(){this._super();try{t.add_room(this.id,this)}catch(e){t.error("add_room: "+e)}},willDestroy:function(){this._super();try{t.remove_room(this.id)}catch(e){t.error("remove_room: "+e)}},getSuggestions:function(){vare=this._super();try{t.settings.capitalize&&(e=_.map(e,n.get_capitalization))}catch(o){t.error("get_suggestions: "+o)}returne},send:function(e){try{varn=e.split(" ",1)[0].toLowerCase();if("/ffz"===n)returnthis.set("messageToSend",""),voidt.run_ffz_command(e.substr(5),this.get("id"));if("/"===n.charAt(0)&&t.run_command(e,this.get("id")))returnvoidthis.set("messageToSend","")}catch(o){t.error("send: "+o)}returnthis._super(e)}})},n.prototype._legacy_add_room=function(e,t,n){jQuery.ajax(s.SERVER+"channel/"+e+".css",{cache:!1,context:this}).done(function(n){this._legacy_load_room_css(e,t,n)}).fail(function(o){return404==o.status?this._legacy_load_room_css(e,t,null):(n=n||0,n++,10>n?this._legacy_add_room(e,t,n):void0)})},n.prototype._legacy_load_room_css=function(e,t,n){vars=e,r=s.match(a);r&&r[1]&&(s=r[1]);varl={id:e,menu_sets:[s],sets:[s],moderator_badge:null,css:null};returnn&&(n=n.replace(o,"").trim()),n&&(n=n.replace(i,function(e,t){returnl.moderator_badge||"modicon.png"!==t.substr(-11)?e:(l.moderator_badge=t,"")})),l.css=n||null,this._load_room_json(e,t,l)}},{"../constants":3,"../utils":27}],9:[function(){vart=e.FrankerFaceZ;t.prototype.setup_viewers=function(){this.log("Hooking the Ember Viewers controller.");vare=App.__container__.resolve("controller:viewers");this._modify_viewers(e)},t.prototype._modify_viewers=function(e){varn=this;e.reopen({lines:function(){vare=this._super();try{varo=[],i={},a=null,s=App.__container__.lookup("controller:channel"),r=this.get("parentController.model.id"),l=s&&s.get("id");if(l){varc=s.get("display_name");c&&(t.capitalization[l]=[c,Date.now()])}r!=l&&(l=null);for(varu=0;u<e.length;u++){vard=e[u];if(d.category)a=d.category,o.push(a),i[a]=[];else{varh=d.chatter.toLowerCase();if(!h)continue;h==l?(o.unshift("Broadcaster"),i.Broadcaster=[h]):i.hasOwnProperty(a)&&i[a].push(h)}}e=[];for(varu=0;u<o.length;u++){varm=o[u],_=i[m];if(_&&_.length)for(e.push({category:m}),e.push({chatter:""}),_.sort();_.length;){varh=_.shift();h=t.get_capitalization(h),e.push({chatter:h})}}}catch(p){n.error("ViewersController lines: "+p)}returne}.property("content.chatters")})}},{}],10:[function(t){varn=e.FrankerFaceZ,o=/\.([\w\-_]+)\s*?\{content:\s*?"([^"]+)";\s*?background-image:\s*?url\("([^"]+)"\);\s*?height:\s*?(\d+)px;\s*?width:\s*?(\d+)px;\s*?margin:([^;}]+);?([^}]*)\}/gm,i=/[^\n}]*\.badges\s+\.moderator\s*{\s*background-image:\s*url\(\s*['"]([^'"]+)['"][^}]+(?:}|$)/,a=t("./constants"),s=t("./utils"),r=function(e,t,n){t&&(n.global=!0,this.global_sets.push(e))},l=function(e,t){varn=e.split(/ +/);retu
returna=a.split(",").removeObject("0"),e.settings.global_emotes_in_menu&&(a.push("0"),r=_.union(r,e.global_sets)),[a,r]};n.settings_info.global_emotes_in_menu={type:"boolean",value:!1,name:"Display Global Emotes in My Emotes",help:"Display the global Twitch emotes in the My Emoticons menu."},n.prototype.setup_my_emotes=function(){if(this._twitch_emote_sets={},this._twitch_set_to_channel={},localStorage.ffzTwitchSets)try{this._twitch_set_to_channel=JSON.parse(localStorage.ffzTwitchSets)}catch(e){}this._twitch_set_to_channel[0]="twitch_global"},n.menu_pages.my_emotes={name:"My Emoticons",icon:o.EMOTE,visible:function(){vare=r(this);returne[0].length>0||e[1].length>0},render:function(e,t){varo=r(this),l=this;newRSVP.Promise(function(e){for(vart=[],i=0;i<o[0].length;i++){varr=o[0][i];l._twitch_emote_sets[r]||t.push(r)}RSVP.all([newRSVP.Promise(function(e){returnt.length?voidTwitch.api.get("chat/emoticon_images",{emotesets:t.join(",")},{version:3}).done(function(t){if(t.emoticon_sets)for(varnint.emoticon_sets)if(t.emoticon_sets.hasOwnProperty(n)){varo=l._twitch_emote_sets[n]=l._twitch_emote_sets[n]||{},i=t.emoticon_sets[n];i.sort(function(e,t){vare=(s[e.code]?"000"+s[e.code]:e.code).toLowerCase(),t=(s[t.code]?"000"+s[t.code]:t.code).toLowerCase();return"000grayface"==e&&(e="grayface"),"000grayface"==t&&(t="grayface"),t>e?-1:e>t?1:0}),o.emotes=i,o.source="Twitch"}e()}).fail(function(){e()}):e()}),newRSVP.Promise(function(e){if(!t.length)returne();varo=[],i=t,s=function(e,t){vari=l._twitch_emote_sets[e]=l._twitch_emote_sets[e]||{};if(t&&!a[t]){if("twitch_global"==t)returnn.capitalization["global emoticons"]=["Global Emoticons",Date.now()],i.channel="Global Emoticons",void(i.badge="//cdn.frankerfacez.com/channel/global/twitch_logo.png");if("turbo"==t)returni.channel="Twitch Turbo",void(i.badge="//cdn.frankerfacez.com/script/turbo_badge.png");o.push(newRSVP.Promise(function(e,t,n){Twitch.api.get("chat/"+t+"/badges",null,{version:3}).done(function(t){t.subscriber&&t.subscriber.image&&(e.badge=t.subscriber.image),n()}).fail(n)}.bind(this,i,t)));vars=t.toLowerCase(),r=n.capitalization[s];returnr&&Date.now()-r[1]<36e5?void(i.channel=r[0]):voido.push(newRSVP.Promise(function(e,t,o,i){l.ws_send("get_display_name",t,function(a,s){varr=a?s:o;n.capitalization[t]=[r,Date.now()],e.channel=r,i()})||(e.channel=o,i()),setTimeout(function(e,t,n){e.channel||(e.channel=t),n()}.bind(this,e,o,i),2e3)}.bind(this,i,s,t)))}},r=function(){o.length?RSVP.all(o).then(e,e):e()};t=[];for(varc=0;c<i.length;c++){varu=i[c];l._twitch_set_to_channel[u]?s(u,l._twitch_set_to_channel[u]):t.push(u)}t.length>0?(l.ws_send("twitch_sets",t,function(e,n){if(t=[],e){for(varoinn)n.hasOwnProperty(o)&&(l._twitch_set_to_channel[o]=n[o],s(o,n[o]));localStorage.ffzTwitchSets=JSON.stringify(l._twitch_set_to_channel)}r()}),setTimeout(function(){t.length&&r()},2e3)):r()})]).then(function(){for(vart={},n=0;n<o[0].length;n++){vari=o[0][n];l._twitch_emote_sets[i]&&(t[i]=l._twitch_emote_sets[i])}e(t)},function(){e({})})}).then(function(a){try{if("my_emotes"!=t.getAttribute("data-page"))return;t.innerHTML="";varr=o[1],c=[];for(varuina)if(a.hasOwnProperty(u)){vard=a[u];d.channel&&d.emotes&&d.emotes.length&&c.push([1,d.channel,d])}for(varh=0;h<r.length;h++){varu=r[h],d=l.emote_sets[u];l.feature_friday&&u==l.feature_friday.set||d.count>0&&c.push([2,d.id,d])}c.sort(function(e,t){if(e[0]<t[0])return-1;if(e[0]>t[0])return1;varn=e[1].toLowerCase(),o=t[1].toLowerCase();return("twitch turbo"===n||"global emoticons"===n)&&(n="zzz"+n),("twitch turbo"===o||"global emoticons"===o)&&(o="zzz"+o),o>n?-1:n>o?1:0});for(varh=0;h<c.length;h++){varm,_,p,f=2===c[h][0],d=c[h][2],g=document.createElement("div"),v=document.createElement("div"),b=f?"FrankerFaceZ":d.source;if(f){p=[];for(varyind.emotes){varw=d.emotes[y];w.hidden||p.push({code:w.name,url:w.url,width:w.width,height:w.height})}_="global"===d.id?"Global Emoticons":d.title||d.id,m=d.icon||"http://cdn.frankerfacez.com/channel/global/devicon.png"}elsep=d.emotes,_=n.get_capitalization(d.channel),m=d.bad