!function(e){!functiont(e,s,o){functionn(a,r){if(!s[a]){if(!e[a]){vard="function"==typeofrequire&&require;if(!r&&d)returnd(a,!0);if(i)returni(a,!0);thrownewError("Cannot find module '"+a+"'")}varu=s[a]={exports:{}};e[a][0].call(u.exports,function(t){vars=e[a][1][t];returnn(s?s:t)},u,u.exports,t,e,s,o)}returns[a].exports}for(vari="function"==typeofrequire&&require,a=0;a<o.length;a++)n(o[a]);returnn}({1:[function(t){vars=e.FrankerFaceZ,o=t("./constants"),n=t("./utils");s.settings_info.show_badges={type:"boolean",value:!0,category:"Chat Appearance",name:"Additional Badges",help:"Show additional badges for bots, FrankerFaceZ donors, and other special users."},s.settings_info.transparent_badges={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Transparent Badges",help:"Make chat badges transparent for a nice, clean look. On light chat, non-subscriber badges are inverted to remain visible.",on_update:function(e){this.has_bttv||document.body.classList.toggle("ffz-transparent-badges",e)}},s.prototype.setup_badges=function(){this.has_bttv||document.body.classList.toggle("ffz-transparent-badges",this.settings.transparent_badges),this.log("Preparing badge system."),this.badges={},this.log("Creating badge style element.");vare=this._badge_style=document.createElement("style");e.id="ffz-badge-css",document.head.appendChild(e),this.log("Adding legacy donor badges."),this._legacy_add_donors()},s.ws_commands.reload_badges=function(){this._legacy_load_bots(),this._legacy_load_donors()},s.ws_commands.set_badge=function(e){vart=e[0],s=e[1],o=e[2],n=this.users[t]=this.users[t]||{},i=n.badges=n.badges||{};void0===o||null===o?deletei[s]:i[s]=o};vari=function(e){vart=".badges .ffz-badge-"+e.id+" { background-color: "+e.color+'; background-image: url("'+e.image+'"); '+(e.extra_css||"")+"}";returne.transparent_image&&(t+=".ffz-transparent-badges .badges .ffz-badge-"+e.id+' { background-image: url("'+e.transparent_image+'"); }'),t};s.prototype.bttv_badges=function(e){if(this.settings.show_badges){vart=e.sender,s=this.users[t],o=[],n=-1,i=BetterTTV.settings.get("alphaTags");if(s&&s.badges){e.badges||(e.badges=[]);for(vara=0;a<e.badges.length;a++){varr=e.badges[a];if("subscriber"==r.type||"turbo"==r.type){n=a;break}}for(vardins.badges)if(s.badges.hasOwnProperty(d)){varr=s.badges[d],u=this.badges[r.id]||{},c=r.title||u.title,l="";if(void0!==u.visible){varh=u.visible;if("function"==typeofh&&(h=h.bind(this)(null,t)),!h)continue}if(u.replaces){for(varf=!1,a=0;a<e.badges.length;a++){var_=e.badges[a];if(_.type==u.replaces){_.type="ffz-badge-replacement "+_.type,_.description+=", "+(r.title||u.title)+'" style="background-image: url("'+(r.image||u.image)+"")",f=!0;break}}if(f)continue}r.image&&(l+="background-image: url(""+r.image+""); "),r.color&&!i&&(l+="background-color: "+r.color+"; "),r.extra_css&&(l+=r.extra_css),l&&(c+='" style="'+l),o.push([(-1==n?1:-1)*d,{type:"ffz-badge-"+r.id+(i?" alpha":""),name:"",description:c}])}if(o.sort(function(e,t){returne[0]-t[0]}),-1==n)for(;o.length;)e.badges.push(o.shift()[1]);elsefor(;o.length;)e.badges.insertAt(n,o.shift()[1])}}},s.prototype.render_badge=function(e){if(this.settings.show_badges){vart=e.get("msgObject.from"),s=App.__container__.lookup("controller:chat").get("currentRoom.id"),o=e.$(".badges"),n=this.users[t];if(n&&n.badges){if(!o.length){vari=document.createElement("span"),a=e.$(".from");if(i.className="badges float-left",!a)return;a.before(i),o=$(i)}varr=o.find(".badge").filter(function(){vare=this.title.toLowerCase();return"subscriber"==e||"turbo"==e}).first(),d=[],u=!!r.length;for(varcinn.badges)if(n.badges.hasOwnProperty(c)){varl=n.badges[c],h=this.badges[l.id]||{};if(void0!==h.visible){varf=h.visible;if("function"==typeoff&&(f=f.bind(this)(s,t)),!f)continue}if(h.replaces){var_=o[0].querySelector(".badge."+h.replaces);if(_){_.style.backgroundImage='url("'+(l.image||h.image)+'")',_.classList.add("ffz-badge-replacement"),_.title+=", "+(l.title||h.title);continue}}var_=document.createElement("div");_.className=
}},ffzClickHost:function(e,s){varo=e.get(s?"controller.hostModeTarget.id":"controller.id"),n=t.get_user(),i=n&&t.rooms&&t.rooms[n.login]&&t.rooms[n.login].room,a=i&&i.ffz_host_target;i&&!e.get("ffz_host_updating")&&(this.classList.add("disabled"),this.title="Updating...",e.set("ffz_host_updating",!0),i.send(a===o?"/unhost":"/host "+o))},ffzUpdateChatters:function(){vare=this.get("controller.id"),s=t.rooms&&t.rooms[e];if(!s||!t.settings.chatter_count){vari=this.get("element").querySelector("#ffz-chatter-display");returni&&i.parentElement.removeChild(i),i=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentElement.removeChild(i))}vara=Object.keys(s.room.get("ffz_chatters")||{}).length,r=s.ffz_chatters||0,d=s.ffz_viewers||0,i=this.get("element").querySelector("#ffz-chatter-display span");if(!i){varu=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;varc=document.createElement("span");c.className="ffz stat",c.id="ffz-chatter-display",c.title="Currently in Chat",c.innerHTML=n.ROOMS+" ",i=document.createElement("span"),c.appendChild(i);varl=u.querySelector("#ffz-ffzchatter-display");l?u.insertBefore(c,l):u.appendChild(c),jQuery(c).tipsy()}if(i.innerHTML=o.number_commas(a),!r&&!d)returni=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentNode.removeChild(i));if(i=this.get("element").querySelector("#ffz-ffzchatter-display span"),!i){varu=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;varc=document.createElement("span");c.className="ffz stat",c.id="ffz-ffzchatter-display",c.title="Viewers (In Chat) with FrankerFaceZ",c.innerHTML=n.ZREKNARF+" ",i=document.createElement("span"),c.appendChild(i);varl=u.querySelector("#ffz-chatter-display");l?u.insertBefore(c,l.nextSibling):u.appendChild(c),jQuery(c).tipsy()}i.innerHTML=o.number_commas(d)+" ("+o.number_commas(r)+")"},ffzUpdateUptime:function(){if(this._ffz_update_uptime&&(clearTimeout(this._ffz_update_uptime),deletethis._ffz_update_uptime),!t.settings.stream_uptime||!this.get("controller.isLiveAccordingToKraken")){vare=this.get("element").querySelector("#ffz-uptime-display");returnvoid(e&&e.parentElement.removeChild(e))}this._ffz_update_uptime=setTimeout(this.ffzUpdateUptime.bind(this),1e3);vars=this.get("controller.content.stream.created_at");if(s&&(s=o.parse_date(s))){vari=Math.floor((Date.now()-s.getTime())/1e3);if(!(0>i)){vare=this.get("element").querySelector("#ffz-uptime-display span");if(!e){vara=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!a)return;varr=document.createElement("span");r.className="ffz stat",r.id="ffz-uptime-display",r.title="Stream Uptime <nobr>(since "+s.toLocaleString()+")</nobr>",r.innerHTML=n.CLOCK+" ",e=document.createElement("span"),r.appendChild(e);vard=a.querySelector(".live-count");if(d)a.insertBefore(r,d.nextSibling);elsetry{d=a.querySelector("script:nth-child(0n+2)"),a.insertBefore(r,d.nextSibling)}catch(u){a.insertBefore(r,a.childNodes[0])}jQuery(r).tipsy({html:!0})}e.innerHTML=o.time_to_string(i)}}},ffzTeardown:function(){vare=this.get("controller.id");e&&t.ws_send("unsub_channel",e),this.get("element").setAttribute("data-channel",""),t._cindex=void0,this._ffz_update_uptime&&clearTimeout(this._ffz_update_uptime),o.update_css(t._channel_style,e,null)}})},s.settings_info.chatter_count={type:"boolean",value:!1,category:"Channel Metadata",name:"Chatter Count",help:"Display the current number of users connected to chat beneath the channel.",on_update:function(e){if(this._cindex&&this._cindex.ffzUpdateChatters(),e&&this.rooms)for(vartinthis.rooms)this.rooms.hasOwnProperty(t)&&this.rooms[t].room&&this.rooms[t].room.ffzInitChatterCount()}},s.settings_info.channel_views={type:"boolean",value:!0,category:"Channel Metadata",name:"Channel Views",help:"Display the number of times the channel has been viewed beneath the stream.",on_update:function(e){document.body.classList.toggle("ffz-hide-view-count",!e)}},s.settings_info.hosted_channels={type:"boolean",value:!0,category:"ChannelMe
vart=App.__container__.lookup("controller:chat"),s=t&&t.get("currentRoom.id");for(varointhis.rooms){varn=this.rooms[o];n.room.set("messageBufferSize",e+(this._roomv&&!this._roomv.get("stuckToBottom")&&s===o?150:0))}}}},s.settings_info.banned_words={type:"button",value:[],category:"Chat Filtering",no_bttv:!0,name:"Banned Words",help:"Set a list of words that will be locally removed from chat messages.",method:function(){vare=this.settings.banned_words.join(", "),t=prompt("Banned Words\n\nPlease enter a comma-separated list of words that you would like to be removed from chat messages.",e);if(null!==t&&void0!==t){t=t.trim().split(a);for(vars=[],o=0;o<t.length;o++)t[o]&&s.push(t[o]);1==s.length&&"disable"==s[0]&&(s=[]),this.settings.set("banned_words",s)}}},s.settings_info.keywords={type:"button",value:[],category:"Chat Filtering",no_bttv:!0,name:"Highlight Keywords",help:"Set additional keywords that will be highlighted in chat.",method:function(){vare=this.settings.keywords.join(", "),t=prompt("Highlight Keywords\n\nPlease enter a comma-separated list of words that you would like to be highlighted in chat.",e);if(null!==t&&void0!==t){t=t.trim().split(a);for(vars=[],o=0;o<t.length;o++)t[o]&&s.push(t[o]);1==s.length&&"disable"==s[0]&&(s=[]),this.settings.set("keywords",s)}}},s.settings_info.fix_color={type:"boolean",value:!0,category:"Chat Appearance",no_bttv:!0,name:"Adjust Username Colors",help:"Ensure that username colors contrast with the background enough to be readable.",on_update:function(e){document.body.classList.toggle("ffz-chat-colors",!this.has_bttv&&e)}},s.settings_info.link_info={type:"boolean",value:!0,category:"Chat Appearance",no_bttv:!0,name:"Link Tooltips <span>Beta</span>",help:"Check links against known bad websites, unshorten URLs, and show YouTube info."},s.settings_info.legacy_badges={type:"boolean",value:!1,category:"Chat Appearance",name:"Legacy Badges",help:"Display the old, pre-vector chat badges from Twitch.",on_update:function(e){document.body.classList.toggle("ffz-legacy-badges",e)}},s.settings_info.chat_rows={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Chat Line Backgrounds",help:"Display alternating background colors for lines in chat.",on_update:function(e){document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&e)}},s.settings_info.chat_separators={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Chat Line Separators",help:"Display thin lines between chat messages for further visual separation.",on_update:function(e){document.body.classList.toggle("ffz-chat-separator",!this.has_bttv&&e)}},s.settings_info.chat_padding={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Reduced Chat Line Padding",help:"Reduce the amount of padding around chat messages to fit more on-screen at once.",on_update:function(e){document.body.classList.toggle("ffz-chat-padding",!this.has_bttv&&e)}},s.settings_info.high_contrast_chat={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"High Contrast",help:"Display chat using white and black for maximum contrast. This is suitable for capturing and chroma keying chat to display on stream.",on_update:function(e){document.body.classList.toggle("ffz-high-contrast-chat",!this.has_bttv&&e)}},s.settings_info.chat_font_size={type:"button",value:12,category:"Chat Appearance",no_bttv:!0,name:"Font Size",help:"Make the chat font bigger or smaller.",method:function(){vare=this.settings.chat_font_size,t=prompt("Chat Font Size\n\nPlease enter a new size for the chat font. The default is 12.",e);if(null!==t&&void0!==t){vars=parseInt(t);(0/0===s||1>s)&&(s=12),this.settings.set("chat_font_size",s)}},on_update:function(e){if(!this.has_bttv&&this._chat_style){vart;if(12===e)t="";else{vars=Math.max(20,Math.round(20/12*e)),n=Math.floor((s-20)/2);t=".ember-chat .chat-messages .chat-line { font-size: "+e+"px !important; line-height: "+s+"px !important; }",n&&(t+=".ember-chat .chat-messages .chat-line .mod-icons, .ember-chat .chat-messages .chat-line .badges { padding-top: "+n+"px; }")}o
}},ffzMouseOut:function(){this._ffz_outside=!0;vare=this;setTimeout(function(){e._ffz_outside&&e.ffzUnfreeze()},25)},ffzMouseMove:function(e){this._ffz_last_move=Date.now(),this._ffz_outside=!1,(e.screenX!==this._ffz_last_screenx||e.screenY!==this._ffz_last_screeny)&&(this._ffz_last_screenx=e.screenX,this._ffz_last_screeny=e.screenY,this.ffz_frozen||(this.ffz_frozen=!0,this.get("stuckToBottom")&&(this.set("controller.model.messageBufferSize",t.settings.scrollback_length+150),this.ffzWarnPaused())))},_scrollToBottom:_.throttle(function(){vare=this,t=this._$chatMessagesScroller;Ember.run.next(function(){setTimeout(function(){!e.ffz_frozen&&t&&t.length&&(t.scrollTop(t[0].scrollHeight),e._setStuckToBottom(!0))})})},200),_setStuckToBottom:function(e){this.set("stuckToBottom",e),this.get("controller.model")&&this.set("controller.model.messageBufferSize",t.settings.scrollback_length+(e?0:150)),e||this.ffzUnfreeze()},ffzWarnPaused:function(){vare=this.get("element"),t=e&&e.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");if(e){if(!t){t=document.createElement("div"),t.className="more-messages-indicator ffz-freeze-indicator",t.innerHTML="(Chat Paused Due to Mouse Movement)";vars=e.querySelector(".chat-interface");if(!s)return;s.insertBefore(t,s.childNodes[0])}t.classList.remove("hidden")}},ffzUnwarnPaused:function(){vare=this.get("element"),t=e&&e.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");t&&t.classList.add("hidden")}})},s.chat_commands={},s.ffz_commands={},s.prototype.room_message=function(e,t){vars=t.split("\n");if(this.has_bttv)for(varo=0;o<s.length;o++)BetterTTV.chat.handlers.onPrivmsg(e.id,{style:"admin",date:newDate,from:"jtv",message:s[o]});elsefor(varo=0;o<s.length;o++)e.room.addMessage({style:"ffz admin",date:newDate,from:"FFZ",message:s[o]})},s.prototype.run_command=function(e,t){varo=this.rooms[t];if(!o||!o.room)return!1;if(e){varn,i=e.split(" "),a=i.shift().substr(1).toLowerCase(),r=s.chat_commands[a];if(!r)return!1;if(r.hasOwnProperty("enabled")){vard=r.enabled;if("function"==typeofd)try{d=r.enabled.bind(this)(o,i)}catch(u){this.error('command "'+a+'" enabled: '+u),d=!1}if(!d)return!1}this.log("Received Command: "+a,i,!0);try{n=r.bind(this)(o,i)}catch(u){this.error('command "'+a+'" runner: '+u),n="There was an error running the command."}returnn&&this.room_message(o,n),!0}},s.prototype.run_ffz_command=function(e,t){varo=this.rooms[t];if(o&&o.room){if(!e){varn=document.querySelector("a.ffz-ui-toggle");if(n)returnn.click();e="help"}vari=e.split(" "),a=i.shift().toLowerCase();this.log("Received Command: "+a,i,!0);varr,d=s.ffz_commands[a];if(d)try{r=d.bind(this)(o,i)}catch(u){this.log("Error Running Command - "+a+": "+u,o),r="There was an error running the command."}elser='There is no "'+a+'" command.';r&&this.room_message(o,r)}},s.ffz_commands.help=function(e,t){if(t&&t.length){varo=s.ffz_commands[t[0].toLowerCase()];returno?o.help?o.help:'No help is available for the command "'+t[0]+'".':'There is no "'+t[0]+'" command.'}varn=[];for(variins.ffz_commands)s.ffz_commands.hasOwnProperty(i)&&n.push(i);return"The available commands are: "+n.join(", ")},s.ffz_commands.help.help="Usage: /ffz help [command]\nList available commands, or show help for a specific command.",s.prototype.add_room=function(e,t){if(this.rooms[e])returnthis.log("Tried to add existing room: "+e);this.log("Adding Room: "+e);vars=this.rooms[e]={id:e,room:t,menu_sets:[],sets:[],css:null,needs_history:!1};if(this.follow_sets&&this.follow_sets[e]){s.extra_sets=this.follow_sets[e],deletethis.follow_sets[e];for(varo=0;o<s.extra_sets.length;o++){varn=s.extra_sets[o],i=this.emote_sets&&this.emote_sets[n];i?-1===i.users.indexOf(e)&&i.users.push(e):this.load_set(n,function(t,s){t&&s.users.push(e)})}}this.ws_send("sub",e),!this.has_bttv&&this.settings.chat_history&&t&&(t.get("messages.length")||0)<10&&(this.ws_send("chat_history",[e,25],this._load_history.bind(this,e))||(s.needs_history=!0)),t.set("messageBufferSize",this.settings.scrollback_length+(this._roomv&&!this
try{this.embed_in_dash=e.top!==e&&/\/[^\/]+\/dashboard/.test(e.top.location.pathname)&&!/bookmarks$/.test(e.top.location.pathname)}catch(n){this.embed_in_dash=!1}this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_channel(),this.setup_room(),this.setup_line(),this.setup_chatview(),this.setup_viewers(),this.setup_mod_card(),this.setup_chat_input(),this.setup_notifications(),this.setup_css(),this.setup_menu(),this.setup_my_emotes(),this.setup_following(),this.setup_following_count(!0),this.setup_races(),this.connect_extra_chat(),this.find_bttv(10),this.find_emote_menu(10),this.check_ff();vari=e.performance&&performance.now?performance.now():Date.now(),a=i-o;this.log("Initialization complete in "+a+"ms")},s.prototype.setup_message_event=function(){this.log("Listening for Window Messages."),e.addEventListener("message",this._on_window_message.bind(this),!1)},s.prototype._on_window_message=function(e){if(e.data&&e.data.from_ffz){e.data}}},{"./badges":1,"./commands":2,"./debug":4,"./ember/channel":5,"./ember/chat-input":6,"./ember/chatview":7,"./ember/line":8,"./ember/moderation-card":9,"./ember/room":10,"./ember/viewers":11,"./emoticons":12,"./ext/betterttv":13,"./ext/emote_menu":14,"./featurefriday":16,"./settings":17,"./socket":18,"./tokenize":19,"./ui/about_page":20,"./ui/dark":21,"./ui/following":23,"./ui/following-count":22,"./ui/menu":24,"./ui/menu_button":25,"./ui/my_emotes":26,"./ui/notifications":27,"./ui/races":28,"./ui/styles":29,"./ui/sub_count":30,"./ui/viewer_count":31}],16:[function(t){vars=e.FrankerFaceZ,o=t("./constants");s.prototype.feature_friday=null,s.prototype.check_ff=function(e){e||this.log("Checking for Feature Friday data..."),jQuery.ajax(o.SERVER+"script/event.json",{cache:!1,dataType:"json",context:this}).done(function(e){returnthis._load_ff(e)}).fail(function(t){return404==t.status?this._load_ff(null):(e=e||0,e++,10>e?setTimeout(this.check_ff.bind(this,e),250):this._load_ff(null))})},s.ws_commands.reload_ff=function(){this.check_ff()},s.prototype._feature_friday_ui=function(e,t,s){if(this.feature_friday&&this.feature_friday.channel!=e){this._emotes_for_sets(t,s,[this.feature_friday.set],this.feature_friday.title,this.feature_friday.icon,"FrankerFaceZ");varo=App.__container__.lookup("controller:channel");if(!o||o.get("id")!=this.feature_friday.channel){varn=this.feature_friday,i=document.createElement("div"),a=document.createElement("a");i.className="chat-menu-content",i.style.textAlign="center";varr=n.display_name+(n.live?" is live now!":"");a.className="button primary",a.classList.toggle("live",n.live),a.classList.toggle("blue",this.has_bttv&&BetterTTV.settings.get("showBlueButtons")),a.href="http://www.twitch.tv/"+n.channel,a.title=r,a.target="_new",a.innerHTML="<span>"+r+"</span>",i.appendChild(a),t.appendChild(i)}}},s.prototype._load_ff=function(e){this.feature_friday&&(this.global_sets.removeObject(this.feature_friday.set),this.default_sets.removeObject(this.feature_friday.set),this.feature_friday=null,this.update_ui_link()),e&&e.set&&e.channel&&(this.feature_friday={set:e.set,channel:e.channel,live:!1,title:e.title||"Feature Friday",display_name:s.get_capitalization(e.channel,this._update_ff_name.bind(this))},this.global_sets.push(e.set),this.default_sets.push(e.set),this.load_set(e.set),this._update_ff_live())},s.prototype._update_ff_live=function(){if(this.feature_friday){vare=this;Twitch.api.get("streams/"+this.feature_friday.channel).done(function(t){e.feature_friday.live=null!=t.stream,e.update_ui_link()}).always(function(){e.feature_friday.timer=setTimeout(e._update_ff_live.bind(e),12e4)})}},s.prototype._update_ff_name=function(e){this.feature_friday&&(this.feature_friday.display_name=e)}},{"./constants":3}],17:[function(t){vars=e.FrankerFaceZ,o=t("./constants");make_ls=function(e){return"ffz_setting_"+e},toggle_setting=function(e,t){vars=!this.settings.get(t);this.settings.set(t,s),e.classList.toggle("active",s)},s.settings_info={},s.prototype.load_settings=function(){this.log("Loading settings."),this.settings={};fo
r?-1===r.users.indexOf(s)&&r.users.push(s):this.load_set(a,function(e,t){e&&t.users.push(s)})}}elsethis.follow_sets[s]=e[s]},s.prototype.rebuild_following_ui=function(){vare=App.__container__.lookup("controller:channel"),t=e&&e.get("id"),s=e&&e.get("hostModeTarget.id");if(this._cindex){if(t){varo=this.follow_data&&this.follow_data[t],n=this._cindex.get("element"),i=n&&n.querySelector(".stats-and-actions .channel-actions"),a=i&&i.querySelector("#ffz-ui-following");if(i&&this.settings.follow_buttons&&o&&o.length){if(a)a.innerHTML="";else{a=document.createElement("span"),a.id="ffz-ui-following";varr=i.querySelector(":scope > span");r?i.insertBefore(a,r):i.appendChild(a)}for(vard=0;d<o.length;d++)this._build_following_button(a,o[d])}elsea&&a.parentElement.removeChild(a)}if(s){varo=this.follow_data&&this.follow_data[s],n=this._cindex.get("element"),i=n&&n.querySelector("#hostmode .channel-actions"),a=i&&i.querySelector("#ffz-ui-following");if(i&&this.settings.follow_buttons&&o&&o.length){if(a)a.innerHTML="";else{a=document.createElement("span"),a.id="ffz-ui-following";varr=i.querySelector(":scope > span");r?i.insertBefore(a,r):i.appendChild(a)}for(vard=0;d<o.length;d++)this._build_following_button(a,o[d])}elsea&&a.parentElement.removeChild(a)}}},s.prototype._build_following_button=function(e,t){varo,n=document.createElement("a"),i=this,a=document.createElement("div"),r=document.createElement("a"),d=document.createElement("div"),u=!1,c=!1,l=function(){a.classList.toggle("is-following",u),n.title=(u?"Unf":"F")+"ollow "+o,n.innerHTML=(u?"":"Follow ")+o,d.classList.toggle("hidden",!u)},h=function(){vare=i.get_user();returne&&e.login?voidTwitch.api.get("users/"+e.login+"/follows/channels/"+t).done(function(e){u=!0,c=e.notifications,a.classList.add("is-initialized"),l()}).fail(function(){u=!1,c=!1,a.classList.add("is-initialized"),l()}):(u=!1,notification=!1,a.classList.add("is-initialized"),l())},f=function(e){e!==!1&&(e=!0);vars=i.get_user();returns&&s.login?(c=e,Twitch.api.put("users/:login/follows/channels/"+t,{notifications:c}).fail(h)):null},_=function(e){o=e||t,l()};a.className="ember-follow follow-button",a.appendChild(n),r.className="toggle-notification-menu js-toggle-notification-menu",r.href="#",d.className="notification-controls v2 hidden",d.appendChild(r),n.addEventListener("click",function(){vare=i.get_user();returne&&e.login?(u=!u,l(),i.ws_send("track_follow",[t,u]),u?f():Twitch.api.del("users/:login/follows/channels/"+t).done(h),!1):Ember.$.login({mpSourceAction:"follow-button",follow:t})}),r.addEventListener("click",function(){vare=i._build_following_popup(d,t,c);returne&&e.addEventListener("click",function(){vart=!c;returne.classList.toggle("active",t),f(t),!1}),!1}),o=s.get_capitalization(t,_),l(),h(),e.appendChild(a),e.appendChild(d)},s.prototype._build_following_popup=function(e,t,o){varn=this._popup,i="",a=e.offsetLeft+e.offsetWidth;returnn&&(n.parentElement.removeChild(n),deletethis._popup,this._popup_kill&&this._popup_kill(),deletethis._popup_kill,"ffz-following-popup"==n.id&&n.getAttribute("data-channel")===t)?null:(n=this._popup=document.createElement("div"),n.id="ffz-following-popup",n.setAttribute("data-channel",t),n.className=(a>=300?"right":"left")+" dropmenu notify-menu js-notify",i='<div class="header">You are following '+s.get_capitalization(t)+"</div>",i+='<p class="clearfix">',i+='<a class="switch'+(o?" active":"")+'"><span></span></a>',i+='<span class="switch-label">Notify me when the broadcaster goes live</span>',i+="</p>",n.innerHTML=i,e.appendChild(n),n.querySelector("a.switch"))}},{"../utils":32}],24:[function(t){vars=e.FrankerFaceZ,o=t("../constants"),n=t("../utils"),i="http://static-cdn.jtvnw.net/emoticons/v1/";s.prototype.setup_menu=function(){this.log("Installing mouse-up event to auto-close menus.");vart=this;jQuery(document).mouseup(function(e){vars,o=t._popup;o&&(o=jQuery(o),s=o.parent(),s.is(e.target)||0!==s.has(e.target).length||(o.remove(),deletet._popup,t._popup_kill&&t._popup_kill(),deletet._popup_kill))}),document.body.classList.toggle("ffz-menu-re
if(this.has_bttv||!n||n!==e.login){vari=document.querySelector("#ffz-sub-display");returnvoid(i&&i.parentElement.removeChild(i))}jQuery.ajax({url:"/broadcast/dashboard/partnership"}).done(function(e){try{vars,i=document.createElement("span");i.innerHTML=e,s=i.querySelector("#dash_main");vara=s&&s.textContent.match(/([\d,\.]+) total active subscribers/),r=a&&a[1];if(!r){vard=document.querySelector("#ffz-sub-display");returnd&&d.parentElement.removeChild(d),void(t._update_subscribers_timer&&(clearTimeout(t._update_subscribers_timer),deletet._update_subscribers_timer))}vard=document.querySelector("#ffz-sub-display span");if(!d){varu=document.querySelector(t.is_dashboard?"#stats":"#channel .stats-and-actions .channel-stats");if(!u)return;varc=document.createElement("span");c.className="ffz stat",c.id="ffz-sub-display",c.title="Active Channel Subscribers",c.innerHTML=o.STAR+" ",d=document.createElement("span"),c.appendChild(d),Twitch.api.get("chat/"+n+"/badges",null,{version:3}).done(function(e){e.subscriber&&e.subscriber.image&&(c.innerHTML="",c.appendChild(d),c.style.backgroundImage='url("'+e.subscriber.image+'")',c.style.backgroundRepeat="no-repeat",c.style.paddingLeft="23px",c.style.backgroundPosition="0 50%")}),u.appendChild(c),jQuery(c).tipsy(t.is_dashboard?{gravity:"s"}:void0)}d.innerHTML=r}catch(l){t.error("_update_subscribers: "+l)}}).fail(function(){vare=document.querySelector("#ffz-sub-display");e&&e.parentElement.removeChild(e)})}},{"../constants":3,"../utils":32}],31:[function(t){vars=e.FrankerFaceZ,o=t("../constants"),n=t("../utils");s.ws_commands.chatters=function(t){{vars=t[0],o=t[1],n=e.App&&App.__container__.lookup("controller:channel"),i=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void0;this.is_dashboard?i&&i[1]:n&&n.get&&n.get("id")}if(!this.is_dashboard){vara=this.rooms&&this.rooms[s];returnvoid(a&&(a.ffz_chatters=o,this._cindex&&this._cindex.ffzUpdateChatters()))}this._dash_chatters=o},s.ws_commands.viewers=function(t){vars=t[0],i=t[1],a=e.App&&App.__container__.lookup("controller:channel"),r=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void0,d=this.is_dashboard?r&&r[1]:a&&a.get&&a.get("id");if(!this.is_dashboard){varu=this.rooms&&this.rooms[s];returnvoid(u&&(u.ffz_viewers=i,this._cindex&&this._cindex.ffzUpdateChatters()))}if(this._dash_viewers=i,this.settings.chatter_count&&d===s){varc=document.querySelector("#ffz-ffzchatter-display"),l=o.ZREKNARF+" "+n.number_commas(i)+("number"==typeofthis._dash_chatters?" ("+n.number_commas(this._dash_chatters)+")":"");if(c)c.innerHTML=l;else{varh=document.querySelector("#stats");if(!h)return;c=document.createElement("span"),c.id="ffz-ffzchatter-display",c.className="ffz stat",c.title="Viewers (In Chat) with FrankerFaceZ",c.innerHTML=l,h.appendChild(c),jQuery(c).tipsy(this.is_dashboard?{gravity:"s"}:void0)}}}},{"../constants":3,"../utils":32}],32:[function(t,s){varo=(e.FrankerFaceZ,t("./constants"),{}),n=document.createElement("span"),i=function(e,t,s){returns=s||"s",t=t||"",1===e?t:s},a=function(e){return1==e?"1st":2==e?"2nd":3==e?"3rd":null==e?"---":e+"th"},r=function(e,t){t=0===t?0:t||1,t=Math.round(255*-(t/100));vars=Math.max(0,Math.min(255,e[0]-t)),o=Math.max(0,Math.min(255,e[1]-t)),n=Math.max(0,Math.min(255,e[2]-t));return[s,o,n]},d=function(e){return"rgb("+e[0]+", "+e[1]+", "+e[2]+")"},u=function(e,t){returnt=0===t?0:t||1,r(e,-t)},c=function(e){e=[e[0]/255,e[1]/255,e[2]/255];for(vart=0;t<e.length;t++)e[t]=e[t]<=.03928?e[t]/12.92:Math.pow((e[t]+.055)/1.055,2.4);return.2126*e[0]+.7152*e[1]+.0722*e[2]},l=/^(\d{4}|\+\d{6})(?:-?(\d{2})(?:-?(\d{2})(?:T(\d{2})(?::?(\d{2})(?::?(\d{2})(?:(?:\.|,)(\d{1,}))?)?)?(Z|([\-+])(\d{2})(?::?(\d{2}))?)?)?)?)?$/,h=function(e){vart=e.match(l);if(!t)returnnull;t[7]=t[7]&&t[7].length?t[7].substr(0,3):0;vars=Date.UTC(t[1],t[2]-1,t[3],t[4],t[5],t[6],t[7]);if(t[9]){varo=6e4*("-"==t[9]?1:-1)*(60*t[10]+1*t[11]);s+=o}returnnewDate(s)},f=function(e){e=$.trim(e);vart={raw:e},s=-1;"@"===e.charAt(0)&&(s=e.indexOf(" "),t.tags=e.substr(1,s-1));varo=s+1,n=-1;":"===e.charAt(o)&&(n=e.in