1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-02 16:08:31 +00:00
FrankerFaceZ/script.min.js
2015-06-05 03:59:28 -04:00

4 lines
No EOL
114 KiB
JavaScript

!function(e){!function t(e,n,s){function i(a,r){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!r&&c)return c(a,!0);if(o)return o(a,!0);throw new Error("Cannot find module '"+a+"'")}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,s)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<s.length;a++)i(s[a]);return i}({1:[function(t){var n=e.FrankerFaceZ,s=t("./constants"),i=t("./utils");n.settings_info.show_badges={type:"boolean",value:!0,category:"Chat",name:"Additional Badges",help:"Show additional badges for bots, FrankerFaceZ donors, and other special users."},n.prototype.setup_badges=function(){this.log("Preparing badge system."),this.badges={},this.log("Creating badge style element.");var e=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()},n.ws_commands.reload_badges=function(){this._legacy_load_bots(),this._legacy_load_donors()},n.ws_commands.set_badge=function(e){var t=e[0],n=e[1],s=e[2],i=this.users[t]=this.users[t]||{},o=i.badges=i.badges||{};void 0===s?delete o[n]:o[n]=s};var o=function(e){return".badges .ffz-badge-"+e.id+" { background-color: "+e.color+'; background-image: url("'+e.image+'"); '+(e.extra_css||"")+"}"};n.prototype.bttv_badges=function(e){if(this.settings.show_badges){var t=e.sender,n=this.users[t],s=[],i=-1,o=BetterTTV.settings.get("alphaTags");if(n&&n.badges){for(var a=0;a<e.badges.length;a++){var r=e.badges[a];if("subscriber"==r.type||"turbo"==r.type){i=a;break}}for(var c in n.badges)if(n.badges.hasOwnProperty(c)){var r=n.badges[c],l=this.badges[r.id]||{},u=r.title||l.title,h="";if(void 0!==l.visible){var d=l.visible;if("function"==typeof d&&(d=d.bind(this)(null,t)),!d)continue}if(l.replaces){for(var _=!1,a=0;a<e.badges.length;a++){var f=e.badges[a];if(f.type==l.replaces){f.type="ffz-badge-replacement "+f.type,f.description+=", "+(r.title||l.title)+'" style="background-image: url(&quot;'+(r.image||l.image)+"&quot;)",_=!0;break}}if(_)continue}r.image&&(h+="background-image: url(&quot;"+r.image+"&quot;); "),r.color&&!o&&(h+="background-color: "+r.color+"; "),r.extra_css&&(h+=r.extra_css),h&&(u+='" style="'+h),s.push([(-1==i?1:-1)*c,{type:"ffz-badge-"+r.id+(o?" alpha":""),name:"",description:u}])}if(s.sort(function(e,t){return e[0]-t[0]}),-1==i)for(;s.length;)e.badges.push(s.shift()[1]);else for(;s.length;)e.badges.insertAt(i,s.shift()[1])}}},n.prototype.render_badge=function(e){if(this.settings.show_badges){var t=e.get("msgObject.from"),n=App.__container__.lookup("controller:chat").get("currentRoom.id"),s=e.$(".badges"),i=this.users[t];if(i&&i.badges){var o=s.find(".badge").filter(function(){var e=this.title.toLowerCase();return"subscriber"==e||"turbo"==e}).first(),a=[],r=!!o.length;for(var c in i.badges)if(i.badges.hasOwnProperty(c)){var l=i.badges[c],u=this.badges[l.id]||{};if(void 0!==u.visible){var h=u.visible;if("function"==typeof h&&(h=h.bind(this)(n,t)),!h)continue}if(u.replaces){var d=s[0].querySelector(".badge."+u.replaces);if(d){d.style.backgroundImage='url("'+(l.image||u.image)+'")',d.classList.add("ffz-badge-replacement"),d.title+=", "+(l.title||u.title);continue}}var d=document.createElement("div");d.className="badge float-left tooltip ffz-badge-"+l.id,d.setAttribute("title",l.title||u.title),l.image&&(d.style.backgroundImage='url("'+l.image+'")'),l.color&&(d.style.backgroundColor=l.color),l.extra_css&&(d.style.cssText+=l.extra_css),a.push([(r?1:-1)*c,d])}if(a.sort(function(e,t){return e[0]-t[0]}),r)for(;a.length;)o.before(a.shift()[1]);else for(;a.length;)s.append(a.shift()[1])}}},n.bttv_known_bots=["nightbot","moobot","sourbot","xanbot","manabot","mtgbot","ackbot","baconrobot","tardisbot","deejbot","valuebot","stahpbot"],n.prototype._legacy_add_donors=function(){this.badges[0]={id:0,title:"FFZ Developer",color:"#FAAF19",image:"//cdn.frankerfacez.com/script/devicon.png"},i.update_css(this._badge_style,0,o(this.badges[0])),this.badges[1]={id:1,title:"FFZ Donor",color:"#755000",image:"//cdn.frankerfacez.com/script/donoricon.png"},i.update_css(this._badge_style,1,o(this.badges[1])),this.badges[2]={id:2,title:"Bot",color:"#595959",image:"//cdn.frankerfacez.com/script/boticon.png",replaces:"moderator",visible:function(e,t){return!(this.has_bttv&&-1!==n.bttv_known_bots.indexOf(t))}},i.update_css(this._badge_style,2,o(this.badges[2]));for(var e=0;e<n.bttv_known_bots.length;e++){var t=n.bttv_known_bots[e],s=this.users[t]=this.users[t]||{},a=s.badges=s.badges||{};a[0]||(a[0]={id:2})}this.users.sirstendec={badges:{1:{id:0}},sets:[4330]},this.users.zenwan={badges:{0:{id:2,image:"//cdn.frankerfacez.com/script/momiglee_badge.png",title:"WAN"}}},this._legacy_load_bots(),this._legacy_load_donors()},n.prototype._legacy_load_bots=function(e){jQuery.ajax(s.SERVER+"script/bots.txt",{cache:!1,context:this}).done(function(e){this._legacy_parse_badges(e,0,2)}).fail(function(t){404!=t.status&&(e=(e||0)+1,10>e&&this._legacy_load_bots(e))})},n.prototype._legacy_load_donors=function(e){jQuery.ajax(s.SERVER+"script/donors.txt",{cache:!1,context:this}).done(function(e){this._legacy_parse_badges(e,1,1)}).fail(function(t){return 404!=t.status?(e=(e||0)+1,10>e?this._legacy_load_donors(e):void 0):void 0})},n.prototype._legacy_parse_badges=function(e,t,n){var s=this.badges[n].title,o=0;if(ds=null,null!=e)for(var a=e.trim().split(/\W+/),r=0;r<a.length;r++){var c=a[r],l=this.users[c]=this.users[c]||{},u=l.badges=l.badges||{},h=l.sets=l.sets||[];null!==ds&&-1===h.indexOf(ds)&&h.push(ds),u[t]||(u[t]={id:n},o+=1)}this.log('Added "'+s+'" badge to '+i.number_commas(o)+" users.")}},{"./constants":3,"./utils":29}],2:[function(){var t=e.FrankerFaceZ;t.ffz_commands.log=function(e){this._pastebin(this._log_data.join("\n"),function(t){return t?void this.room_message(e,"Your FrankerFaceZ log has been pasted to: "+t):this.room_message(e,"There was an error uploading the FrankerFaceZ log.")})},t.ffz_commands.massunmod=function(e,t){if(t=t.join(" ").trim(),!t.length)return"You must provide a list of users to unmod.";t=t.split(/\W*,\W*/);var n=this.get_user();if(!n||!n.login==e.id)return"You must be the broadcaster to use massunmod.";if(t.length>50)return"Each user you unmod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var s=t.length;t.length;){var i=t.shift();e.room.tmiRoom.sendMessage("/unmod "+i)}return"Sent unmod command for "+s+" users."},t.ffz_commands.massunmod.help="Usage: /ffz massunmod <list, of, users>\nBroadcaster only. Unmod all the users in the provided list.",t.ffz_commands.massmod=function(e,t){if(t=t.join(" ").trim(),!t.length)return"You must provide a list of users to mod.";t=t.split(/\W*,\W*/);var n=this.get_user();if(!n||!n.login==e.id)return"You must be the broadcaster to use massmod.";if(t.length>50)return"Each user you mod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var s=t.length;t.length;){var i=t.shift();e.room.tmiRoom.sendMessage("/mod "+i)}return"Sent mod command for "+s+" users."},t.ffz_commands.massmod.help="Usage: /ffz massmod <list, of, users>\nBroadcaster only. Mod all the users in the provided list."},{}],3:[function(e,t){var n='<path d="m120.95 1.74c4.08-0.09 8.33-0.84 12.21 0.82 3.61 1.8 7 4.16 11.01 5.05 2.08 3.61 6.12 5.46 8.19 9.07 3.6 5.67 7.09 11.66 8.28 18.36 1.61 9.51 7.07 17.72 12.69 25.35 3.43 7.74 1.97 16.49 3.6 24.62 2.23 5.11 4.09 10.39 6.76 15.31 1.16 2 4.38 0.63 4.77-1.32 1.2-7.1-2.39-13.94-1.97-21.03 0.38-3.64-0.91-7.48 0.25-10.99 2.74-3.74 4.57-8.05 7.47-11.67 3.55-5.47 10.31-8.34 16.73-7.64 2.26 2.89 5.13 5.21 7.58 7.92 2.88 4.3 6.52 8.01 9.83 11.97 1.89 2.61 3.06 5.64 4.48 8.52 2.81 4.9 4 10.5 6.63 15.49 2.16 6.04 5.56 11.92 5.37 18.5 0.65 1.95 0.78 4 0.98 6.03 1.01 3.95 2.84 8.55 0.63 12.42-2.4 5.23-7.03 8.97-11.55 12.33-6.06 4.66-11.62 10.05-18.37 13.75-4.06 2.65-8.24 5.17-12.71 7.08-3.59 1.57-6.06 4.94-9.85 6.09-2.29 1.71-3.98 4.51-6.97 5.02-4.56 1.35-8.98-3.72-13.5-1.25-2.99 1.83-6.19 3.21-9.39 4.6-8.5 5.61-18.13 9.48-28.06 11.62-8.36-0.2-16.69 0.62-25.05 0.47-3.5-1.87-7.67-1.08-11.22-2.83-6.19-1.52-10.93-6.01-16.62-8.61-2.87-1.39-5.53-3.16-8.11-4.99-2.58-1.88-4.17-4.85-6.98-6.44-3.83-0.11-6.54 3.42-10.24 3.92-2.31 0.28-4.64 0.32-6.96 0.31-3.5-3.65-5.69-8.74-10.59-10.77-5.01-3.68-10.57-6.67-14.84-11.25-2.52-2.55-5.22-4.87-8.24-6.8-4.73-4.07-7.93-9.51-11.41-14.62-3.08-4.41-5.22-9.73-4.6-15.19 0.65-8.01 0.62-16.18 2.55-24.02 4.06-10.46 11.15-19.34 18.05-28.06 3.71-5.31 9.91-10.21 16.8-8.39 3.25 1.61 5.74 4.56 7.14 7.89 1.19 2.7 3.49 4.93 3.87 7.96 0.97 5.85 1.6 11.86 0.74 17.77-1.7 6.12-2.98 12.53-2.32 18.9 0.01 2.92 2.9 5.36 5.78 4.57 3.06-0.68 3.99-4.07 5.32-6.48 1.67-4.06 4.18-7.66 6.69-11.23 3.61-5.28 5.09-11.57 7.63-17.37 2.07-4.56 1.7-9.64 2.56-14.46 0.78-7.65-0.62-15.44 0.7-23.04 1.32-3.78 1.79-7.89 3.8-11.4 3.01-3.66 6.78-6.63 9.85-10.26 1.72-2.12 4.21-3.32 6.55-4.6 7.89-2.71 15.56-6.75 24.06-7z"/>',s="true"==localStorage.ffzDebugMode&&document.body.classList.contains("ffz-dev");t.exports={DEBUG:s,SERVER:s?"//localhost:8000/":"//cdn.frankerfacez.com/",API_SERVER:"//api.frankerfacez.com/",SVGPATH:n,ZREKNARF:'<svg style="padding:1.75px 0" class="svg-glyph_views ffz-svg svg-zreknarf" width="16px" viewBox="0 0 249 195" version="1.1" height="12.5px">'+n+"</svg>",CHAT_BUTTON:'<svg class="svg-emoticons ffz-svg" height="18px" width="24px" viewBox="0 0 249 195" version="1.1">'+n+"</svg>",ROOMS:'<svg class="svg-glyph_views svg-roomlist" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M1,13v-2h14v2H1z M1,5h13v2H1V5z M1,2h10v2H1V2z M12,10H1V8h11V10z" fill-rule="evenodd"></path></svg>',CAMERA:'<svg class="svg-camera" height="16px" version="1.1" viewBox="0 0 36 36" width="16px" x="0px" y="0px"><path fill-rule="evenodd" clip-rule="evenodd" d="M24,20v6H4V10h20v6l8-6v16L24,20z"/></svg>',INVITE:'<svg class="svg-plus" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M15,9h-3v3h-2V9H7V7h3V4h2v3h3V9z M9,6H6v4h2h1v3h4l0,0l0,0v1h-3H4H1v-1l3-3h2L4,8V2h6v1H9V6z" fill-rule="evenodd"></path></svg>',EYE:'<svg class="svg-glyph_views ffz-svg svg-eye" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M11,13H5L1,9V8V7l4-4h6l4,4v1v1L11,13z M8,5C6.344,5,5,6.343,5,8c0,1.656,1.344,3,3,3c1.657,0,3-1.344,3-3C11,6.343,9.657,5,8,5z M8,9C7.447,9,7,8.552,7,8s0.447-1,1-1s1,0.448,1,1S8.553,9,8,9z" fill-rule="evenodd"></path></svg>',CLOCK:'<svg class="svg-glyph_views ffz-svg svg-clock" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path fill-rule="evenodd" clip-rule="evenodd" fill="#888888" d="M8,15c-3.866,0-7-3.134-7-7s3.134-7,7-7s7,3.134,7,7 S11.866,15,8,15z M8,3C5.238,3,3,5.238,3,8s2.238,5,5,5s5-2.238,5-5S10.762,3,8,3z M7.293,8.707L7,8l1-4l0.902,3.607L11,11 L7.293,8.707z"/></svg>',GEAR:'<svg class="svg-gear" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M15,7v2h-2.115c-0.125,0.615-0.354,1.215-0.713,1.758l1.484,1.484l-1.414,1.414l-1.484-1.484C10.215,12.531,9.615,12.76,9,12.885V15H7v-2.12c-0.614-0.126-1.21-0.356-1.751-0.714l-1.491,1.49l-1.414-1.414l1.491-1.49C3.477,10.211,3.247,9.613,3.12,9H1V7h2.116C3.24,6.384,3.469,5.785,3.829,5.242L2.343,3.757l1.414-1.414l1.485,1.485C5.785,3.469,6.384,3.24,7,3.115V1h2v2.12c0.613,0.126,1.211,0.356,1.752,0.714l1.49-1.491l1.414,1.414l-1.49,1.492C12.523,5.79,12.754,6.387,12.88,7H15z M8,6C6.896,6,6,6.896,6,8s0.896,2,2,2s2-0.896,2-2S9.104,6,8,6z" fill-rule="evenodd"></path></svg>',HEART:'<svg class="svg-heart" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M8,13.5L1.5,7V4l2-2h3L8,3.5L9.5,2h3l2,2v3L8,13.5z" fill-rule="evenodd"></path></svg>',EMOTE:'<svg class="svg-emote" height="16px" version="1.1" viewBox="0 0 18 18" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M9,18c-4.971,0-9-4.029-9-9s4.029-9,9-9s9,4.029,9,9S13.971,18,9,18z M14,4.111V4h-0.111C12.627,2.766,10.904,2,9,2C7.095,2,5.373,2.766,4.111,4H4v0.111C2.766,5.373,2,7.096,2,9s0.766,3.627,2,4.889V14l0.05-0.051C5.317,15.217,7.067,16,9,16c1.934,0,3.684-0.783,4.949-2.051L14,14v-0.111c1.234-1.262,2-2.984,2-4.889S15.234,5.373,14,4.111zM11,6h2v4h-2V6z M12.535,12.535C11.631,13.44,10.381,14,9,14s-2.631-0.56-3.536-1.465l0.707-0.707C6.896,12.553,7.896,13,9,13s2.104-0.447,2.828-1.172L12.535,12.535z M5,6h2v4H5V6z" fill-rule="evenodd"></path></svg>',STAR:'<svg class="svg-star" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M15,6l-4.041,2.694L13,14l-5-3.333L3,14l2.041-5.306L1,6h5.077L8,1l1.924,5H15z" fill-rule="evenodd"></path></svg>'}},{}],4:[function(){var t=e.FrankerFaceZ;t.settings_info.developer_mode={type:"boolean",value:!1,storage_key:"ffzDebugMode",visible:function(){return this.settings.developer_mode||Date.now()-parseInt(localStorage.ffzLastDevMode||"0")<6048e5},category:"Debugging",name:"Developer Mode",help:"Load FrankerFaceZ from the local development server instead of the CDN. Please refresh after changing this setting.",on_update:function(){localStorage.ffzLastDevMode=Date.now()}},t.ffz_commands.developer_mode=function(e,t){var n,t=t&&t.length?t[0].toLowerCase():null;return"y"==t||"yes"==t||"true"==t||"on"==t?n=!0:("n"==t||"no"==t||"false"==t||"off"==t)&&(n=!1),void 0===n?"Developer Mode is currently "+(this.settings.developer_mode?"enabled.":"disabled."):(this.settings.set("developer_mode",n),"Developer Mode is now "+(n?"enabled":"disabled")+". Please refresh your browser.")},t.ffz_commands.developer_mode.help="Usage: /ffz developer_mode <on|off>\nEnable or disable Developer Mode. When Developer Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN."},{}],5:[function(t){var n=e.FrankerFaceZ,s=t("../utils"),i=t("../constants");n.prototype.setup_channel=function(){document.body.classList.toggle("ffz-hide-view-count",!this.settings.channel_views),this.log("Creating channel style element.");var e=this._channel_style=document.createElement("style");e.id="ffz-channel-css",document.head.appendChild(e),this.log("Hooking the Ember Channel Index view.");var t=App.__container__.resolve("view:channel/index"),s=this;if(t){this._modify_cindex(t);try{t.create().destroy()}catch(i){}for(var o in Ember.View.views)if(Ember.View.views.hasOwnProperty(o)){var a=Ember.View.views[o];a instanceof t&&(this.log("Manually updating Channel Index view.",a),this._modify_cindex(a),a.ffzInit())}this.log("Hooking the Ember Channel controller."),t=App.__container__.lookup("controller:channel"),t&&t.reopen({ffzUpdateUptime:function(){s._cindex&&s._cindex.ffzUpdateUptime()}.observes("isLive","content.id"),ffzUpdateTitle:function(){var e=this.get("content.name"),t=this.get("content.display_name");t&&(n.capitalization[e]=[t,Date.now()]),s._cindex&&s._cindex.ffzFixTitle()}.observes("content.status","content.id")})}},n.prototype._modify_cindex=function(e){var t=this;e.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(e){t.error("CIndex didInsertElement: "+e)}},willClearRender:function(){try{this.ffzTeardown()}catch(e){t.error("CIndex willClearRender: "+e)}return this._super()},ffzInit:function(){t._cindex=this,this.get("element").setAttribute("data-channel",this.get("controller.id")),this.ffzFixTitle(),this.ffzUpdateUptime(),this.ffzUpdateChatters();var e=this.get("element").querySelector(".svg-glyph_views:not(.ffz-svg)");e&&e.parentNode.classList.add("twitch-channel-views")},ffzFixTitle:function(){if(!t.has_bttv&&t.settings.stream_title){var e=this.get("controller.status"),n=this.get("controller.id");e=t.render_tokens(t.tokenize_line(n,n,e,!0)),this.$(".title span").each(function(t,n){var s=n.querySelectorAll("script");n.innerHTML=s[0].outerHTML+e+s[1].outerHTML})}},ffzUpdateChatters:function(){var e=this.get("controller.id"),n=t.rooms&&t.rooms[e];if(!n||!t.settings.chatter_count){var o=this.get("element").querySelector("#ffz-chatter-display");return o&&o.parentElement.removeChild(o),o=this.get("element").querySelector("#ffz-ffzchatter-display"),void(o&&o.parentElement.removeChild(o))}var a=Object.keys(n.room.get("ffz_chatters")||{}).length,r=n.ffz_chatters||0,o=this.get("element").querySelector("#ffz-chatter-display span");if(!o){var c=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!c)return;var l=document.createElement("span");l.className="ffz stat",l.id="ffz-chatter-display",l.title="Current Chatters",l.innerHTML=i.ROOMS+" ",o=document.createElement("span"),l.appendChild(o);var u=c.querySelector("#ffz-ffzchatter-display");u?c.insertBefore(l,u):c.appendChild(l),jQuery(l).tipsy()}if(o.innerHTML=s.number_commas(a),!r)return o=this.get("element").querySelector("#ffz-ffzchatter-display"),void(o&&o.parentNode.removeChild(o));if(o=this.get("element").querySelector("#ffz-ffzchatter-display span"),!o){var c=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!c)return;var l=document.createElement("span");l.className="ffz stat",l.id="ffz-ffzchatter-display",l.title="Chatters with FrankerFaceZ",l.innerHTML=i.ZREKNARF+" ",o=document.createElement("span"),l.appendChild(o);var u=c.querySelector("#ffz-chatter-display");u?c.insertBefore(l,u.nextSibling):c.appendChild(l),jQuery(l).tipsy()}o.innerHTML=s.number_commas(r)},ffzUpdateUptime:function(){if(this._ffz_update_uptime&&(clearTimeout(this._ffz_update_uptime),delete this._ffz_update_uptime),!t.settings.stream_uptime||!this.get("controller.isLiveAccordingToKraken")){var e=this.get("element").querySelector("#ffz-uptime-display");return void(e&&e.parentElement.removeChild(e))}this._ffz_update_uptime=setTimeout(this.ffzUpdateUptime.bind(this),1e3);var n=this.get("controller.content.stream.created_at");if(n&&(n=s.parse_date(n))){var o=Math.floor((Date.now()-n.getTime())/1e3);if(!(0>o)){var e=this.get("element").querySelector("#ffz-uptime-display span");if(!e){var a=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!a)return;var r=document.createElement("span");r.className="ffz stat",r.id="ffz-uptime-display",r.title="Stream Uptime <nobr>(since "+n.toLocaleString()+")</nobr>",r.innerHTML=i.CLOCK+" ",e=document.createElement("span"),r.appendChild(e);var c=a.querySelector(".live-count");if(c)a.insertBefore(r,c.nextSibling);else try{c=a.querySelector("script:nth-child(0n+2)"),a.insertBefore(r,c.nextSibling)}catch(l){a.insertBefore(r,a.childNodes[0])}jQuery(r).tipsy({html:!0})}e.innerHTML=s.time_to_string(o)}}},ffzTeardown:function(){this.get("element").setAttribute("data-channel",""),t._cindex=void 0,this._ffz_update_uptime&&clearTimeout(this._ffz_update_uptime)}})},n.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(var t in this.rooms)this.rooms.hasOwnProperty(t)&&this.rooms[t].room&&this.rooms[t].room.ffzInitChatterCount()}},n.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)}},n.settings_info.stream_uptime={type:"boolean",value:!1,category:"Channel Metadata",name:"Stream Uptime",help:"Display the stream uptime under a channel by the viewer count.",on_update:function(){this._cindex&&this._cindex.ffzUpdateUptime()}},n.settings_info.stream_title={type:"boolean",value:!0,no_bttv:!0,category:"Channel Metadata",name:"Title Links",help:"Make links in stream titles clickable.",on_update:function(){this._cindex&&this._cindex.ffzFixTitle()}}},{"../constants":3,"../utils":29}],6:[function(t){var n=e.FrankerFaceZ,s=t("../utils"),i=t("../constants"),o=function(e){return 1>e?"":e>=99?"99+":""+e};n.settings_info.group_tabs={type:"boolean",value:!1,no_bttv:!0,category:"Chat",name:"Chat Room Tabs <span>Beta</span>",help:"Enhanced UI for switching the current chat room and noticing new messages.",on_update:function(e){var t=!this.has_bttv&&e;this._chatv&&t!==this._group_tabs_state&&(t?this._chatv.ffzEnableTabs():this._chatv.ffzDisableTabs())}},n.settings_info.pinned_rooms={type:"button",value:[],category:"Chat",visible:!1,name:"Pinned Chat Rooms",help:"Set a list of channels that should always be available in chat."},n.prototype.setup_chatview=function(){this.log("Hooking the Ember Chat controller.");var e=App.__container__.lookup("controller:chat"),t=this;e&&e.reopen({ffzUpdateChannels:function(){t.settings.group_tabs&&t._chatv&&t._chatv.ffzRebuildTabs()}.observes("currentChannelRoom","connectedPrivateGroupRooms")}),this.log("Hooking the Ember Chat view.");var e=App.__container__.resolve("view:chat");this._modify_cview(e);try{e.create().destroy()}catch(n){}for(var s in Ember.View.views)if(Ember.View.views.hasOwnProperty(s)){var i=Ember.View.views[s];if(i instanceof e){this.log("Manually updating existing Chat view.",i);try{i.ffzInit()}catch(n){this.error("setup: build_ui_link: "+n)}}}this.log("Hooking the Ember Layout controller.");var o=App.__container__.lookup("controller:layout");if(o){o.reopen({ffzFixTabs:function(){t.settings.group_tabs&&t._chatv&&t._chatv._ffz_tabs&&setTimeout(function(){t._chatv&&t._chatv.$(".chat-room").css("top",t._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("isRightColumnClosed")}),this.log("Hooking the Ember 'Right Column' controller. Seriously...");var a=App.__container__.lookup("controller:right-column");a&&a.reopen({ffzFixTabs:function(){t.settings.group_tabs&&t._chatv&&t._chatv._ffz_tabs&&setTimeout(function(){t._chatv&&t._chatv.$(".chat-room").css("top",t._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("firstTabSelected")})}},n.prototype._modify_cview=function(e){var t=this;e.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(e){t.error("ChatView didInsertElement: "+e)}},willClearRender:function(){try{this.ffzTeardown()}catch(e){t.error("ChatView willClearRender: "+e)}this._super()},ffzInit:function(){t._chatv=this,this.$(".textarea-contain").append(t.build_ui_link(this)),!t.has_bttv&&t.settings.group_tabs&&this.ffzEnableTabs(),setTimeout(function(){t.settings.group_tabs&&t._chatv._ffz_tabs&&t._chatv.$(".chat-room").css("top",t._chatv._ffz_tabs.offsetHeight+"px");var e=t._chatv.get("controller");e&&e.set("showList",!1)},1e3)},ffzTeardown:function(){t._chatv===this&&(t._chatv=null),this.$(".textarea-contain .ffz-ui-toggle").remove(),t.settings.group_tabs&&this.ffzDisableTabs()},ffzChangeRoom:Ember.observer("controller.currentRoom",function(){try{if(t.update_ui_link(),!t.has_bttv&&t.settings.group_tabs&&this._ffz_tabs){var e=this.get("controller.currentRoom");e&&e.resetUnreadCount();var n=jQuery(this._ffz_tabs);n.children(".ffz-chat-tab").removeClass("active"),e&&n.children('.ffz-chat-tab[data-room="'+e.get("id")+'"]').removeClass("tab-mentioned").addClass("active").children("span").text("");var s=e&&e.get("canInvite");this._ffz_invite&&this._ffz_invite.classList.toggle("hidden",!s),this.set("controller.showInviteUser",s&&this.get("controller.showInviteUser")),this.$(".chat-room").css("top",this._ffz_tabs.offsetHeight+"px")}}catch(i){t.error("ChatView ffzUpdateLink: "+i)}}),ffzEnableTabs:function(){if(!t.has_bttv&&t.settings.group_tabs){this.$(".chat-header").addClass("hidden");var e=this._ffz_tabs=document.createElement("div");e.id="ffz-group-tabs",this.$(".chat-header").after(e),this.ffzRebuildTabs()}},ffzRebuildTabs:function(){if(!t.has_bttv&&t.settings.group_tabs){var e=this._ffz_tabs||this.get("element").querySelector("#ffz-group-tabs");if(e){e.innerHTML="";var n=document.createElement("a"),s=this;n.className="button glyph-only tooltip",n.title="Chat Room Management",n.innerHTML=i.ROOMS,n.addEventListener("click",function(){var e=s.get("controller");e&&e.set("showList",!e.get("showList"))}),e.appendChild(n),n=document.createElement("a"),n.className="button glyph-only tooltip invite",n.title="Invite a User",n.innerHTML=i.INVITE,n.addEventListener("click",function(){var e=s.get("controller");e&&e.set("showInviteUser",e.get("currentRoom.canInvite")&&!e.get("showInviteUser"))}),n.classList.toggle("hidden",!this.get("controller.currentRoom.canInvite")),s._ffz_invite=n,e.appendChild(n);var o,a=this.get("controller.currentChannelRoom");a&&(o=this.ffzBuildTab(s,a,!0),o&&e.appendChild(o));var r=App.__container__.lookup("controller:channel"),c=App.__container__.resolve("model:room");if(target=r&&r.get("hostModeTarget"),target&&c){var l=target.get("id");this._ffz_host!==l&&(this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),this._ffz_host=l,this._ffz_host_room=c.findOne(l))}else this._ffz_host&&(this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),delete this._ffz_host,delete this._ffz_host_room);this._ffz_host_room&&(o=s.ffzBuildTab(s,this._ffz_host_room,!1,!0),o&&e.appendChild(o));for(var u=0;u<t.settings.pinned_rooms.length;u++){var h=t.settings.pinned_rooms[u];if(a&&a.get("id")!==h&&this._ffz_host!==h&&t.rooms[h]&&t.rooms[h].room){var o=s.ffzBuildTab(s,t.rooms[h].room,!1,!1);o&&e.appendChild(o)}}_.each(this.get("controller.connectedPrivateGroupRooms"),function(t){var n=s.ffzBuildTab(s,t);n&&e.appendChild(n)}),this.$(".chat-room").css("top",e.offsetHeight+"px")}}},ffzTabUnread:function(e){if(!t.has_bttv&&t.settings.group_tabs){var n=this._ffz_tabs||this.get("element").querySelector("#ffz-group-tabs"),s=this.get("controller.currentRoom.id");if(n){if(e){var i=n.querySelector('.ffz-chat-tab[data-room="'+e+'"]'),a=t.rooms&&t.rooms[e];if(i&&a){var r=o(e===s?0:a.room.get("unreadCount"));i.querySelector("span").innerHTML=r}return this.$(".chat-room").css("top",n.offsetHeight+"px")}for(var c=n.querySelectorAll(".ffz-chat-tab"),l=0;l<c.length;l++){var i=c[l],e=i.getAttribute("data-room"),a=t.rooms&&t.rooms[e];if(a){var r=o(e===s?0:a.room.get("unreadCount"));i.querySelector("span").innerHTML=r}}this.$(".chat-room").css("top",n.offsetHeight+"px")}}},ffzBuildTab:function(e,t,a,r){var c,l,u=document.createElement("span"),h=t.get("isGroupRoom"),d=t===e.get("controller.currentRoom");return u.setAttribute("data-room",t.id),u.className="ffz-chat-tab tooltip",u.classList.toggle("current-channel",a),u.classList.toggle("host-channel",r),u.classList.toggle("group-chat",h),u.classList.toggle("active",d),c=t.get("tmiRoom.displayName")||(h?t.get("tmiRoom.name"):n.get_capitalization(t.get("id"))),l=o(d?0:t.get("unreadCount")),a?(u.innerHTML=i.CAMERA,u.title="Current Channel"):r?(u.innerHTML=i.EYE,u.title="Hosted Channel"):u.title=h?"Group Chat":"Pinned Channel",u.innerHTML+=s.sanitize(c)+"<span>"+l+"</span>",u.addEventListener("click",function(){e.get("controller").focusRoom(t)}),u},ffzDisableTabs:function(){this._ffz_tabs&&(this._ffz_tabs.parentElement.removeChild(this._ffz_tabs),delete this._ffz_tabs,delete this._ffz_invite),this._ffz_host&&(this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),delete this._ffz_host,delete this._ffz_host_room),this.$(".chat-room").css("top",""),this.$(".chat-header").removeClass("hidden")}})},n.prototype.connect_extra_chat=function(){if(!this.has_bttv){for(var e=0;e<this.settings.pinned_rooms.length;e++)this._join_room(this.settings.pinned_rooms[e],!0);!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs()}},n.prototype._join_room=function(e,t){var n=!1;if(-1===this.settings.pinned_rooms.indexOf(e)&&(this.settings.pinned_rooms.push(e),this.settings.set("pinned_rooms",this.settings.pinned_rooms),n=!0),this.rooms[e]&&this.rooms[e].room)return n;{var s=App.__container__.resolve("model:room");s&&s.findOne(e)}return!t&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),n},n.prototype._leave_room=function(e,t){var n=!1;if(-1!==this.settings.pinned_rooms.indexOf(e)&&(this.settings.pinned_rooms.removeObject(e),this.settings.set("pinned_rooms",this.settings.pinned_rooms),n=!0),!this.rooms[e]||!this.rooms[e].room)return n;var s=App.__container__.lookup("controller:chat"),i=this.rooms[e].room;return!s||s.get("currentChannelRoom.id")===e||this._chatv&&this._chatv._ffz_host===e?n:(s.get("currentRoom.id")===e&&s.blurRoom(),i.destroy(),!t&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),n)},n.chat_commands.join=function(e,t){if(!t||!t.length||t.length>1)return"Join Usage: /join <channel>";var n=t[0].toLowerCase();return"#"===n.charAt(0)&&(n=n.substr(1)),this._join_room(n)?"Joining "+n+". You will always connect to this channel's chat unless you later /part from it.":"You have already joined "+n+'. Please use "/part '+n+'" to leave it.'},n.chat_commands.part=function(e,t){if(!t||!t.length||t.length>1)return"Part Usage: /part <channel>";var n=t[0].toLowerCase();return"#"===n.charAt(0)&&(n=n.substr(1)),this._leave_room(n)?"Leaving "+n+".":this.rooms[n]?"You do not have "+n+" pinned and you cannot leave the current channel or hosted channels via /part.":"You are not in "+n+"."}},{"../constants":3,"../utils":29}],7:[function(t){var n=e.FrankerFaceZ,s=t("../utils"),i="[\\s`~<>!-#%-\\x2A,-/:;\\x3F@\\x5B-\\x5D_\\x7B}\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]",o=new RegExp(i+"*,"+i+"*"),a=function(e){return(e+"").replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},r="http://static-cdn.jtvnw.net/emoticons/v1/",c=function(e){return r+e+"/1.0 1x, "+r+e+"/2.0 2x, "+r+e+"/3.0 4x"},l=function(e){var t=e.set,n=e.set_type,s=e.owner;return void 0===n&&(n="Channel"),t?(("00000turbo"==t||"turbo"==t)&&(t="Twitch Turbo",n=null),"Emoticon: "+e.code+"\n"+(n?n+": ":"")+t+(s?"\nBy: "+s.display_name:"")):e.code},u=function(e){{var t=this._twitch_emotes[e];t?t.set:null}return t?"string"==typeof t?t:t.tooltip?t.tooltip:t.tooltip=l(t):"???"},h=function(e,t,n,s){if(n){t&&(s.code=t),this._twitch_emotes[e]=s;for(var i=u.bind(this)(e),o=document.querySelectorAll('img[emote-id="'+e+'"]'),a=0;a<o.length;a++)o[a].title=i}},d=function(e){var t,n=this._link_data[e];if(!n)return"";if(n.tooltip)return n.tooltip;
if("youtube"==n.type)t="<b>YouTube: "+s.sanitize(n.title)+"</b><hr>",t+="Channel: "+s.sanitize(n.channel)+" | "+s.time_to_string(n.duration)+"<br>",t+=s.number_commas(n.views||0)+" Views | &#128077; "+s.number_commas(n.likes||0)+" &#128078; "+s.number_commas(n.dislikes||0);else if("strawpoll"==n.type){t="<b>Strawpoll: "+s.sanitize(n.title)+"</b><hr><table><tbody>";for(var i in n.items){{var o=n.items[i];Math.floor(o/n.total*100)}t+='<tr><td style="text-align:left">'+s.sanitize(i)+'</td><td style="text-align:right">'+s.number_commas(o)+"</td></tr>"}t+="</tbody></table><hr>Total: "+s.number_commas(n.total);var a=s.parse_date(n.fetched);if(a){var r=Math.floor((a.getTime()-Date.now())/1e3);r>60&&(t+="<br><small>Data was cached "+s.time_to_string(r)+" ago.</small>")}}else if("twitch"==n.type){t="<b>Twitch: "+s.sanitize(n.display_name)+"</b><hr>";var c=s.parse_date(n.since);c&&(t+="Member Since: "+s.date_string(c)+"<br>"),t+="<nobr>Views: "+s.number_commas(n.views)+"</nobr> | <nobr>Followers: "+s.number_commas(n.followers)+"</nobr>"}else if("twitch_vod"==n.type)t="<b>Twitch "+("highlight"==n.broadcast_type?"Highlight":"Broadcast")+": "+s.sanitize(n.title)+"</b><hr>",t+="By: "+s.sanitize(n.display_name)+(n.game?" | Playing: "+s.sanitize(n.game):" | Not Playing")+"<br>",t+="Views: "+s.number_commas(n.views)+" | "+s.time_to_string(n.length);else if("twitter"==n.type)t="<b>Tweet By: "+s.sanitize(n.user)+"</b><hr>",t+=s.sanitize(n.tweet);else if("reputation"==n.type){if(t='<span style="word-wrap: break-word">'+s.sanitize(n.full.toLowerCase())+"</span>",n.trust<50||n.safety<50||n.tags&&n.tags.length>0){t+="<hr>";var l=!1;(n.trust<50||n.safety<50)&&(n.unsafe=!0,t+="<b>Potentially Unsafe Link</b><br>",t+="Trust: "+n.trust+"% | Child Safety: "+n.safety+"%",l=!0),n.tags&&n.tags.length>0&&(t+=(l?"<br>":"")+"Tags: "+n.tags.join(", ")),t+="<br>Data Source: WOT"}}else n.full&&(t='<span style="word-wrap: break-word">'+s.sanitize(n.full.toLowerCase())+"</span>");return t||(t='<span style="word-wrap: break-word">'+s.sanitize(e.toLowerCase())+"</span>"),n.tooltip=t,t},f=function(e,t,n){if(t){this._link_data[e]=n,n.unsafe=!1;var s,i=d.bind(this)(e),o="/"==e.charAt(e.length-1)?e.substr(0,e.length-1):null;if(s=document.querySelectorAll(o?'span.message a[href="'+e+'"], span.message a[href="'+o+'"], span.message a[data-url="'+e+'"], span.message a[data-url="'+o+'"]':'span.message a[href="'+e+'"], span.message a[data-url="'+e+'"]'),this.settings.link_info)for(var a=0;a<s.length;a++)n.unsafe&&s[a].classList.add("unsafe-link"),s[a].classList.contains("deleted-link")||(s[a].title=i)}};n.settings_info.banned_words={type:"button",value:[],category:"Chat",no_bttv:!0,name:"Banned Words",help:"Set a list of words that will be locally removed from chat messages.",method:function(){var e=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&&void 0!==t){t=t.trim().split(o);for(var n=[],s=0;s<t.length;s++)t[s]&&n.push(t[s]);1==n.length&&"disable"==n[0]&&(n=[]),this.settings.set("banned_words",n)}}},n.settings_info.keywords={type:"button",value:[],category:"Chat",no_bttv:!0,name:"Highlight Keywords",help:"Set additional keywords that will be highlighted in chat.",method:function(){var e=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&&void 0!==t){t=t.trim().split(o);for(var n=[],s=0;s<t.length;s++)t[s]&&n.push(t[s]);1==n.length&&"disable"==n[0]&&(n=[]),this.settings.set("keywords",n)}}},n.settings_info.fix_color={type:"boolean",value:!0,category:"Chat",no_bttv:!0,name:"Adjust Username Colors",help:"Ensure that username colors contrast with the background enough to be readable.",on_update:function(e){this.has_bttv||document.body.classList.toggle("ffz-chat-colors",e)}},n.settings_info.link_info={type:"boolean",value:!0,category:"Chat",no_bttv:!0,name:"Link Tooltips <span>Beta</span>",help:"Check links against known bad websites, unshorten URLs, and show YouTube info."},n.settings_info.chat_rows={type:"boolean",value:!1,category:"Chat",no_bttv:!0,name:"Chat Line Backgrounds",help:"Display alternating background colors for lines in chat.",on_update:function(e){this.has_bttv||document.body.classList.toggle("ffz-chat-background",e)}},n.prototype.setup_line=function(){document.body.classList.toggle("ffz-chat-colors",!this.has_bttv&&this.settings.fix_color),document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&this.settings.chat_rows),this._colors={},this._last_row={};var e=this._fix_color_style=document.createElement("style");e.id="ffz-style-username-colors",e.type="text/css",document.head.appendChild(e),this._twitch_emotes={},this._link_data={},this.log("Hooking the Ember Line controller.");var t=App.__container__.resolve("component:message-line"),s=this;t.reopen({tokenizedMessage:function(){var e=this.get("msgObject.cachedTokens");if(e)return e;e=this._super();try{var t=performance.now(),i=s.get_user(),o=i&&this.get("msgObject.from")===i.login;e=s._remove_banned(e),e=s._emoticonize(this,e);var a=this.get("msgObject.tags.display-name");a&&a.length&&(n.capitalization[this.get("msgObject.from")]=[a.trim(),Date.now()]),o||(e=s.tokenize_mentions(e));for(var r=0;r<e.length;r++){var c=e[r];if(!_.isString(c)&&c.mentionedUser&&!c.own){this.set("msgObject.ffz_has_mention",!0);break}}var l=performance.now();l-t>5&&s.log("Tokenizing Message Took Too Long - "+(l-t)+"ms",e,!1,!0)}catch(u){try{s.error("LineController tokenizedMessage: "+u)}catch(u){}}return this.set("msgObject.cachedTokens",e),e}.property("msgObject.message","isChannelLinksDisabled","currentUserNick","msgObject.from","msgObject.tags.emotes"),didInsertElement:function(){this._super();try{var e=performance.now(),t=this.get("element"),n=this.get("msgObject.from"),i=this.get("msgObject.room")||App.__container__.lookup("controller:chat").get("currentRoom.id"),o=this.get("msgObject.color"),a=this.get("msgObject.ffz_alternate");o&&s._handle_color(o),void 0===a&&(a=s._last_row[i]=s._last_row.hasOwnProperty(i)?!s._last_row[i]:!1,this.set("msgObject.ffz_alternate",a)),t.classList.toggle("ffz-alternate",a),t.setAttribute("data-room",i),t.setAttribute("data-sender",n),t.setAttribute("data-deleted",this.get("deleted")||!1),s.render_badge(this),this.get("msgObject.ffz_has_mention")&&t.classList.add("ffz-mentioned");for(var r=t.querySelectorAll("a.deleted-link"),l=0;l<r.length;l++){var u=r[l];u.addEventListener("click",function(e){if(!this.classList.contains("deleted-link"))return!0;var t=this.getAttribute("data-url"),n=t;this.classList.remove("deleted-link"),this.removeAttribute("data-url"),this.removeAttribute("title"),this.removeAttribute("original-title"),t.indexOf("@")>-1&&(-1===t.indexOf("/")||t.indexOf("@")<t.indexOf("/"))?t="mailto:"+t:t.match(/^https?:\/\//)||(t="http://"+t),this.href=t,this.target="_new",this.textContent=n;var i=s._link_data[n];i&&"boolean"!=typeof i&&(this.title=i.tooltip,i.unsafe&&this.classList.add("unsafe-link")),e.preventDefault()}),jQuery(u).tipsy({html:!0})}if(s.settings.link_info){for(var d=t.querySelectorAll("span.message a"),l=0;l<d.length;l++){var u=d[l],_=u.href,m=!1;u.classList.contains("deleted-link")&&(_=u.getAttribute("data-url"),m=!0);var p=s._link_data[_];p?(m||"boolean"==typeof p||(u.title=p.tooltip),p.unsafe&&u.classList.add("unsafe-link")):/^mailto:/.test(_)||(s._link_data[_]=!0,s.ws_send("get_link",_,f.bind(s,_)))}jQuery(d).tipsy({html:!0})}for(var g=t.querySelectorAll("img.emoticon"),l=0;l<g.length;l++){var v=g[l],b=(v.alt,/\/emoticons\/v1\/(\d+)\/1\.0/.exec(v.src)),y=b?parseInt(b[1]):null;if(null!==y){v.setAttribute("srcset",c(y)),v.setAttribute("emote-id",y);var w=s._twitch_emotes[y];w?"string"!=typeof w&&(v.title=w.tooltip):(s._twitch_emotes[y]=v.alt,s.ws_send("twitch_emote",y,h.bind(s,y,v.alt)))}else if(v.getAttribute("data-ffz-emote")){var z=JSON.parse(decodeURIComponent(v.getAttribute("data-ffz-emote"))),y=z&&z[0]||null,k=z&&z[1]||null,F=s.emote_sets[k],C=F?F.emoticons[y]:null;C&&C.srcSet&&v.setAttribute("srcset",C.srcSet),F&&s.feature_friday&&F.id==s.feature_friday.set&&(set_name=s.feature_friday.title+" - "+s.feature_friday.display_name),v.title=s._emote_tooltip(C)}}jQuery(g).tipsy();var E=performance.now()-e;E>5&&s.log("Line Took Too Long - "+E+"ms",t.innerHTML,!1,!0)}catch(T){try{s.error("LineView didInsertElement: "+T)}catch(T){}}}});var i=this.get_user();i&&i.name&&(n.capitalization[i.login]=[i.name,Date.now()])},n.prototype._handle_color=function(e){if(e&&!this._colors[e]){this._colors[e]=!0;var t=parseInt(e.substr(1),16),n=[t>>16,t>>8&255,255&t],i=s.get_luminance(n),o="",a='span[style="color:'+e+'"]',r=!1;if(i>.3){r=!0;for(var c=127,l=n;c--&&(l=s.darken(l),!(s.get_luminance(l)<=.3)););o+=".ffz-chat-colors .ember-chat-container:not(.dark) .chat-line "+a+", .ffz-chat-colors .chat-container:not(.dark) .chat-line "+a+" { color: "+s.rgb_to_css(l)+" !important; }\n"}else o+=".ffz-chat-colors .ember-chat-container:not(.dark) .chat-line "+a+", .ffz-chat-colors .chat-container:not(.dark) .chat-line "+a+" { color: "+e+" !important; }\n";if(.15>i){r=!0;for(var c=127,l=n;c--&&(l=s.brighten(l),!(s.get_luminance(l)>=.15)););o+=".ffz-chat-colors .theatre .chat-container .chat-line "+a+", .ffz-chat-colors .chat-container.dark .chat-line "+a+", .ffz-chat-colors .ember-chat-container.dark .chat-line "+a+" { color: "+s.rgb_to_css(l)+" !important; }\n"}else o+=".ffz-chat-colors .theatre .chat-container .chat-line "+a+", .ffz-chat-colors .chat-container.dark .chat-line "+a+", .ffz-chat-colors .ember-chat-container.dark .chat-line "+a+" { color: "+e+" !important; }\n";r&&(this._fix_color_style.innerHTML+=o)}},n.capitalization={},n._cap_fetching=0,n.get_capitalization=function(t,s){if(e.BetterTTV&&BetterTTV.chat&&BetterTTV.chat.helpers.lookupDisplayName)return BetterTTV.chat.helpers.lookupDisplayName(t);if(!t)return t;if(t=t.toLowerCase(),"jtv"==t||"twitchnotify"==t)return t;var i=n.capitalization[t];return i&&Date.now()-i[1]<36e5?i[0]:(n._cap_fetching<25&&(n._cap_fetching++,n.get().ws_send("get_display_name",t,function(e,i){var o=e?i:t;n.capitalization[t]=[o,Date.now()],n._cap_fetching--,"function"==typeof s&&s(o)})),i?i[0]:t)},n.prototype._remove_banned=function(e){var t=this.settings.banned_words;if(!t||!t.length)return e;"string"==typeof e&&(e=[e]);for(var s=n._words_to_regex(t),i=[],o=0;o<e.length;o++){var r=e[o];i.push(_.isString(r)?r.replace(s,"$1***"):r.emoticonSrc&&s.test(r.altText)?r.altText.replace(s,"$1***"):r.isLink&&s.test(r.href)?{mentionedUser:'</span><a class="deleted-link" title="'+a(r.href.replace(s,"$1***"))+'" data-url="'+a(r.href)+'" href="#">&lt;banned link&gt;</a><span class="mentioning">',own:!0}:r)}return i},n.prototype._emoticonize=function(e,t){var n=e.get("msgObject.room")||App.__container__.lookup("controller:chat").get("currentRoom.id"),s=e.get("msgObject.from");return this.tokenize_emotes(s,n,t)}},{"../utils":29}],8:[function(t){var n=e.FrankerFaceZ,s=t("../utils"),i={ESC:27,P:80,B:66,T:84,U:85},o=[["5m",300],["10m",600],["1hr",3600],["12hr",43200],["24hr",86400]],a='<svg class="svg-messages" height="16px" version="1.1" viewBox="0 0 18 18" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M1,15V3h16v12H1z M15.354,5.354l-0.707-0.707L9,10.293L3.354,4.646L2.646,5.354L6.293,9l-3.646,3.646l0.707,0.707L7,9.707l1.646,1.646h0.707L11,9.707l3.646,3.646l0.707-0.707L11.707,9L15.354,5.354z" fill-rule="evenodd"></path></svg>',r='<svg class="svg-unban" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path fill-rule="evenodd" clip-rule="evenodd" fill="#888888" d="M6.5,12.75L2,8.25l2-2l2.5,2.5l5.5-5.5l2,2L6.5,12.75z"/></svg>';n.settings_info.enhanced_moderation={type:"boolean",value:!1,no_bttv:!0,category:"Chat",name:"Enhanced Moderation",help:"Use /p, /t, /u and /b in chat to moderate chat, or use hotkeys with moderation cards."},n.prototype.setup_mod_card=function(){this.log("Hooking the Ember Moderation Card view.");var t=App.__container__.resolve("component:moderation-card"),n=this;t.reopen({didInsertElement:function(){this._super(),e._card=this;try{if(n.has_bttv||!n.settings.enhanced_moderation)return;var t=this.get("element"),c=this.get("controller");if(t.classList.add("ffz-moderation-card"),c.get("cardInfo.isModeratorOrHigher")){t.classList.add("ffz-is-mod"),t.setAttribute("tabindex",1),t.addEventListener("keyup",function(e){var t=e.keyCode||e.which,n=c.get("cardInfo.user.id"),s=App.__container__.lookup("controller:chat").get("currentRoom");if(t==i.P)s.send("/timeout "+n+" 1");else if(t==i.B)s.send("/ban "+n);else if(t==i.T)s.send("/timeout "+n+" 600");else if(t==i.U)s.send("/unban "+n);else if(t!=i.ESC)return;c.send("hideModOverlay")});var l=document.createElement("div");l.className="interface clearfix";var u=function(e){var t=c.get("cardInfo.user.id"),n=App.__container__.lookup("controller:chat").get("currentRoom");n.send(-1===e?"/unban "+t:"/timeout "+t+" "+e)},h=function(e,t){var n=document.createElement("button");return n.className="button",n.innerHTML=e,n.title="Timeout User for "+s.number_commas(t)+" Second"+(1!=t?"s":""),600===t?n.title="(T)"+n.title.substr(1):1===t&&(n.title="(P)urge - "+n.title),jQuery(n).tipsy(),n.addEventListener("click",u.bind(this,t)),n};l.appendChild(h("Purge",1));var d=document.createElement("span");d.className="right",l.appendChild(d);for(var _=0;_<o.length;_++)d.appendChild(h(o[_][0],o[_][1]));t.appendChild(l);var f=document.createElement("button");f.className="unban button glyph-only light",f.innerHTML=r,f.title="(U)nban User",jQuery(f).tipsy(),f.addEventListener("click",u.bind(this,-1));var m=t.querySelector("button.ban");m.setAttribute("title","(B)an User"),jQuery(m).after(f),this.$("button.timeout").remove()}var p=t.querySelector("button.mod");if(p){var g=c.get("cardInfo.isChannelOwner"),v=ffz.get_user();can_op=g||v&&v.is_admin||v&&v.is_staff,can_op||p.parentElement.removeChild(p)}var b=t.querySelector(".interface > button");b&&b.classList.contains("message-button")&&(b.innerHTML=a,b.classList.add("glyph-only"),b.classList.add("message"),b.title="Message User",jQuery(b).tipsy()),this.$().draggable({start:function(){t.focus()}}),t.focus()}catch(y){try{n.error("ModerationCardView didInsertElement: "+y)}catch(y){}}}})},n.chat_commands.purge=n.chat_commands.p=function(e,t){if(!t||!t.length)return"Purge Usage: /p username [more usernames separated by spaces]";if(t.length>10)return"Please only purge up to 10 users at once.";for(var n=0;n<t.length;n++){var s=t[n];s&&e.room.send("/timeout "+s+" 1")}},n.chat_commands.p.enabled=function(){return this.settings.enhanced_moderation},n.chat_commands.t=function(e,t){return t&&t.length?void e.room.send("/timeout "+t.join(" ")):"Timeout Usage: /t username [duration]"},n.chat_commands.t.enabled=function(){return this.settings.enhanced_moderation},n.chat_commands.b=function(e,t){if(!t||!t.length)return"Ban Usage: /b username [more usernames separated by spaces]";if(t.length>10)return"Please only ban up to 10 users at once.";for(var n=0;n<t.length;n++){var s=t[n];s&&e.room.send("/ban "+s)}},n.chat_commands.b.enabled=function(){return this.settings.enhanced_moderation},n.chat_commands.u=function(e,t){if(!t||!t.length)return"Unban Usage: /u username [more usernames separated by spaces]";if(t.length>10)return"Please only unban up to 10 users at once.";for(var n=0;n<t.length;n++){var s=t[n];s&&e.room.send("/unban "+s)}},n.chat_commands.u.enabled=function(){return this.settings.enhanced_moderation}},{"../utils":29}],9:[function(t){var n=e.FrankerFaceZ,s=t("../constants"),i=t("../utils"),o=function(e){return e.moderator_badge?'.chat-line[data-room="'+e.id+'"] .badges .moderator:not(.ffz-badge-replacement) { background-image:url("'+e.moderator_badge+'") !important; }':""};n.prototype.setup_room=function(){this.rooms={},this.log("Creating room style element.");var e=this._room_style=document.createElement("style");e.id="ffz-room-css",document.head.appendChild(e),this.log("Hooking the Ember Room model.");var t=App.__container__.lookup("controller:room");if(t){var n=t._actions.banUser;t._actions.banUser=function(e){n.bind(this)(e),this.get("model").clearMessages(e.user)}}var s=App.__container__.resolve("model:room");this._modify_room(s);var i=s.instances;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];this.add_room(a.id,a),this._modify_room(a),a.ffzPatchTMI()}},n.chat_commands={},n.ffz_commands={},n.prototype.room_message=function(e,t){var n=t.split("\n");if(this.has_bttv)for(var s=0;s<n.length;s++)BetterTTV.chat.handlers.onPrivmsg(e.id,{style:"admin",date:new Date,from:"jtv",message:n[s]});else for(var s=0;s<n.length;s++)e.room.addMessage({style:"ffz admin",date:new Date,from:"FFZ",message:n[s]})},n.prototype.run_command=function(e,t){var s=this.rooms[t];if(!s||!s.room)return!1;if(e){var i,o=e.split(" "),a=o.shift().substr(1).toLowerCase(),r=n.chat_commands[a];if(!r)return!1;if(r.hasOwnProperty("enabled")){var c=r.enabled;if("function"==typeof c)try{c=r.enabled.bind(this)(s,o)}catch(l){this.error('command "'+a+'" enabled: '+l),c=!1}if(!c)return!1}this.log("Received Command: "+a,o,!0);try{i=r.bind(this)(s,o)}catch(l){this.error('command "'+a+'" runner: '+l),i="There was an error running the command."}return i&&this.room_message(s,i),!0}},n.prototype.run_ffz_command=function(e,t){var s=this.rooms[t];if(s&&s.room){if(!e){var i=document.querySelector("a.ffz-ui-toggle");if(i)return i.click();e="help"}var o=e.split(" "),a=o.shift().toLowerCase();this.log("Received Command: "+a,o,!0);var r,c=n.ffz_commands[a];if(c)try{r=c.bind(this)(s,o)}catch(l){this.log("Error Running Command - "+a+": "+l,s),r="There was an error running the command."}else r='There is no "'+a+'" command.';r&&this.room_message(s,r)}},n.ffz_commands.help=function(e,t){if(t&&t.length){var s=n.ffz_commands[t[0].toLowerCase()];return s?s.help?s.help:'No help is available for the command "'+t[0]+'".':'There is no "'+t[0]+'" command.'}var i=[];for(var o in n.ffz_commands)n.ffz_commands.hasOwnProperty(o)&&i.push(o);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){return this.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),void this.load_room(e))},n.prototype.remove_room=function(e){var t=this.rooms[e];if(t&&(this.log("Removing Room: "+e),(t.css||t.moderator_badge)&&i.update_css(this._room_style,e,null),this.ws_send("unsub",e),delete this.rooms[e],"_"!==e.charAt(0))){var n=this.emote_sets[t.set];n&&(n.users.removeObject(e),this.global_sets.contains(t.set)||n.users.length||this.unload_set(t.set))}},n.prototype.load_room=function(e,t,n){var i=this;jQuery.getJSON(s.API_SERVER+"v1/room/"+e).done(function(n){if(n.sets)for(var s in n.sets)n.sets.hasOwnProperty(s)&&i._load_set_json(s,void 0,n.sets[s]);i._load_room_json(e,t,n)}).fail(function(s){return 404==s.status?"function"==typeof t&&t(!1):(n=(n||0)+1,10>n?i.load_room(e,t,n):"function"==typeof t&&t(!1))})},n.prototype._load_room_json=function(e,t,n){return n&&n.room?(n=n.room,this.rooms[e]&&(n.room=this.rooms[e].room),this.rooms[e]=n,(n.css||n.moderator_badge)&&i.update_css(this._room_style,e,o(n)+(n.css||"")),this.emote_sets.hasOwnProperty(n.set)||this.load_set(n.set),this.update_ui_link(),void(t&&t(!0,n))):"function"==typeof t&&t(!1)},n.prototype._modify_room=function(t){var n=this;t.reopen({init:function(){this._super();try{n.add_room(this.id,this),this.set("ffz_chatters",{})}catch(e){n.error("add_room: "+e)}},willDestroy:function(){this._super();try{n.remove_room(this.id)}catch(e){n.error("remove_room: "+e)}},addMessage:function(e){try{e&&(e.room=this.get("id"),n.tokenize_chat_line(e))}catch(t){n.error("Room addMessage: "+t)}return this._super(e)},setHostMode:function(e){var t=App.__container__.lookup("controller:chat");if(t&&t.get("currentChannelRoom")===this)return this._super(e)},send:function(e){try{var t=e.split(" ",1)[0].toLowerCase();if("/ffz"===t)return this.set("messageToSend",""),void n.run_ffz_command(e.substr(5),this.get("id"));if("/"===t.charAt(0)&&n.run_command(e,this.get("id")))return void this.set("messageToSend","")}catch(s){n.error("send: "+s)}return this._super(e)},ffzUpdateUnread:function(){if(n.settings.group_tabs){var e=App.__container__.lookup("controller:chat");e&&e.get("currentRoom")===this?this.resetUnreadCount():n._chatv&&n._chatv.ffzTabUnread(this.get("id"))}}.observes("unreadCount"),ffzInitChatterCount:function(){if(this.tmiRoom){var e=this;this.tmiRoom.list().done(function(t){var n={};t=t.data.chatters;for(var s=0;s<t.admins.length;s++)n[t.admins[s]]=!0;for(var s=0;s<t.global_mods.length;s++)n[t.global_mods[s]]=!0;for(var s=0;s<t.moderators.length;s++)n[t.moderators[s]]=!0;for(var s=0;s<t.staff.length;s++)n[t.staff[s]]=!0;for(var s=0;s<t.viewers.length;s++)n[t.viewers[s]]=!0;e.set("ffz_chatters",n),e.ffzUpdateChatters()})}},ffzUpdateChatters:function(t,s){var i=this.get("ffz_chatters")||{};t&&(i[t]=!0),s&&i[s]&&delete i[s],n.settings.chatter_count&&(n._cindex&&n._cindex.ffzUpdateChatters(),e.parent&&e.parent.postMessage&&e.parent.postMessage({from_ffz:!0,command:"chatter_count",message:Object.keys(this.get("ffz_chatters")||{}).length},"http://www.twitch.tv/"))},ffzPatchTMI:function(){if(!this.get("ffz_is_patched")&&this.get("tmiRoom")){n.settings.chatter_count&&this.ffzInitChatterCount();var e=this.get("tmiRoom"),t=this;e.ffz_notice_patched||(e.ffz_notice_patched=!0,e._roomConn.off("notice",e._onNotice,e),e._roomConn.on("notice",function(e){var t=e.target||e.params&&e.params[0]||this.ircChannel;t==this.ircChannel&&this._trigger("notice",{msgId:e.tags["msg-id"],message:e.message})},e));var s=e._roomConn._connection;if(!s.ffz_cap_patched){s.ffz_cap_patched=!0,s._send("CAP REQ :twitch.tv/membership"),s.on("opened",function(){this._send("CAP REQ :twitch.tv/membership")},s);var i=s._handleTmiPrivmsg.bind(s);s._handleTmiPrivmsg=function(e){return e.message&&"SPECIALUSER"===e.message.split(" ",1)[0]?void 0:i(e)}}if(e._roomConn._connection.off("message",e._roomConn._onIrcMessage,e._roomConn),e._roomConn._onIrcMessage=function(e){if(e.target==this.ircChannel)switch(e.command){case"JOIN":this._session&&this._session.nickname===e.sender?this._onIrcJoin(e):n.settings.chatter_count&&t.ffzUpdateChatters(e.sender);break;case"PART":this._session&&this._session.nickname===e.sender?(this._resetActiveState(),this._connection._exitedRoomConn(),this._trigger("exited")):n.settings.chatter_count&&t.ffzUpdateChatters(null,e.sender)}},e._roomConn._connection.on("message",e._roomConn._onIrcMessage,e._roomConn),!e.session.ffz_patched){e.session.ffz_patched=!0;{e.session._updateUserState.bind(e.session)}e.session._updateUserState=function(e,t){try{t.color&&this._onUserColorChanged(e,t.color),t["display-name"]&&this._onUserDisplayNameChanged(e,t["display-name"]),t.turbo&&this._onUserSpecialAdded(e,"turbo"),("staff"===t.user_type||"admin"===t.user_type||"global_mod"===t.user_type)&&this._onUserSpecialAdded(e,t["user-type"])}catch(s){n.error("SessionManager _updateUserState: "+s)}}}this.set("ffz_is_patched",!0)}}.observes("tmiRoom")})}},{"../constants":3,"../utils":29}],10:[function(){var t=e.FrankerFaceZ;t.prototype.setup_viewers=function(){this.log("Hooking the Ember Viewers controller.");var e=App.__container__.resolve("controller:viewers");this._modify_viewers(e)},t.prototype._modify_viewers=function(e){var n=this;e.reopen({lines:function(){var e=this._super();try{var s=[],i={},o=null,a=App.__container__.lookup("controller:channel"),r=this.get("parentController.model.id"),c=a&&a.get("id");if(c){var l=a.get("display_name");l&&(t.capitalization[c]=[l,Date.now()])}r!=c&&(c=null);for(var u=0;u<e.length;u++){var h=e[u];if(h.category)o=h.category,s.push(o),i[o]=[];else{var d=h.chatter.toLowerCase();if(!d)continue;d==c?(s.unshift("Broadcaster"),i.Broadcaster=[d]):i.hasOwnProperty(o)&&i[o].push(d)}}e=[];for(var u=0;u<s.length;u++){var _=s[u],f=i[_];if(f&&f.length)for(e.push({category:_}),e.push({chatter:""}),f.sort();f.length;){var d=f.shift();d=t.get_capitalization(d),e.push({chatter:d})}}}catch(m){n.error("ViewersController lines: "+m)}return e}.property("content.chatters")})}},{}],11:[function(t){var n=e.FrankerFaceZ,s=t("./constants"),i=t("./utils"),o=function(e){var t=e.margins,n="";return t||(t=(e.height-18)/-2+"px 0"),(e.urls[2]||e.urls[4])&&(n='url("'+e.urls[1]+'") 1x',e.urls[2]&&(n+=', url("'+e.urls[2]+'") 2x'),e.urls[4]&&(n+=', url("'+e.urls[4]+'") 4x'),n="-webkit-image-set("+n+"); image-set("+n+");"),".ffz-emote-"+e.id+' { background-image: url("'+e.urls[1]+'"); height: '+e.height+"px; width: "+e.width+"px; margin: "+t+(n?"; "+n:"")+(e.css?"; "+e.css:"")+"}\n"},a=function(e){return e.margins||e.css?o(e)+'img[src="'+e.urls[1]+'"] { '+(e.margins?"margin: "+e.margins+";":"")+(e.css||"")+" }\n":o(e)},r=a;n.prototype.setup_emoticons=function(){this.log("Preparing emoticon system."),this.emote_sets={},this.global_sets=[],this.default_sets=[],this._last_emote_id=0,this.emote_usage={},this.log("Creating emoticon style element.");var e=this._emote_style=document.createElement("style");e.id="ffz-emoticon-css",document.head.appendChild(e),this.log("Loading global emote sets."),this.load_global_sets(),this.log("Watching Twitch emoticon parser to ensure it loads."),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)},n.prototype.add_usage=function(e,t,n){var s=this.emote_usage[t]=this.emote_usage[t]||{};s[e]=(s[e]||0)+(n||1),this._emote_report_scheduled||(this._emote_report_scheduled=setTimeout(this._report_emotes.bind(this),3e4))},n.prototype._report_emotes=function(){this._emote_report_scheduled&&delete this._emote_report_scheduled;var e=this.emote_usage;this.emote_usage={},this.ws_send("emoticon_uses",[e],function(){},!0)},n.prototype.check_twitch_emotes=function(){this._twitch_emote_check&&(clearTimeout(this._twitch_emote_check),delete this._twitch_emote_check);var e;if(this.rooms)for(var t in this.rooms)if(this.rooms.hasOwnProperty(t)){e=this.rooms[t];break}if(!e||!e.room||!e.room.tmiSession)return void(this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4));var n=e.room.tmiSession._emotesParser,s=Object.keys(n.emoticonRegexToIds).length;if(!(s>0)){var i=n.emoticonSetIds;n.emoticonSetIds="",n.updateEmoticons(i),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)}},n.prototype.getEmotes=function(e,t){var n=this.users&&this.users[e],s=this.rooms&&this.rooms[t];return _.union(n&&n.sets||[],s&&s.set&&[s.set]||[],this.default_sets)},n.ws_commands.reload_set=function(e){this.emote_sets.hasOwnProperty(e)&&this.load_set(e)},n.ws_commands.load_set=function(e){this.load_set(e)},n.prototype._emote_tooltip=function(e){if(!e)return null;if(e._tooltip)return e._tooltip;var t=this.emote_sets[e.set_id],n=e.owner,s=t&&t.title||"Global";return e._tooltip="Emoticon: "+(e.hidden?"???":e.name)+"\nFFZ "+s+(n?"\nBy: "+n.display_name:""),e._tooltip},n.prototype.load_global_sets=function(e,t){var n=this;jQuery.getJSON(s.API_SERVER+"v1/set/global").done(function(e){n.default_sets=e.default_sets;var t=n.global_sets=[],s=e.sets||{};for(var i in s)if(s.hasOwnProperty(i)){var o=s[i];t.push(i),n._load_set_json(i,void 0,o)}}).fail(function(s){return 404==s.status?"function"==typeof e&&e(!1):(t=t||0,t++,50>t?n.load_global_sets(e,t):"function"==typeof e&&e(!1))})},n.prototype.load_set=function(e,t,n){var i=this;jQuery.getJSON(s.API_SERVER+"v1/set/"+e).done(function(n){i._load_set_json(e,t,n&&n.set)}).fail(function(s){return 404==s.status?"function"==typeof t&&t(!1):(n=n||0,n++,10>n?i.load_set(e,t,n):"function"==typeof t&&t(!1))})},n.prototype.unload_set=function(e){var t=this.emote_sets[e];t&&(this.log("Unloading emoticons for set: "+e),i.update_css(this._emote_style,e,null),delete this.emote_sets[e])},n.prototype._load_set_json=function(e,t,n){if(!n)return"function"==typeof t&&t(!1);this.emote_sets[e]=n,n.users=[],n.count=0;var s="",o=n.emoticons;n.emoticons={};for(var a=0;a<o.length;a++){var c=o[a];c.klass="ffz-emote-"+c.id,c.set_id=e,c.srcSet=c.urls[1]+" 1x",c.urls[2]&&(c.srcSet+=", "+c.urls[2]+" 2x"),c.urls[4]&&(c.srcSet+=", "+c.urls[4]+" 4x"),c.regex="!"===c.name[c.name.length-1]?new RegExp("(^|\\W|\\b)("+c.name+")(?=\\W|$)","g"):new RegExp("(^|\\W|\\b)("+c.name+")\\b","g"),s+=r(c),n.count++,n.emoticons[c.id]=c}i.update_css(this._emote_style,e,s+(n.css||"")),this.log("Updated emoticons for set #"+e+": "+n.title,n),this._cindex&&this._cindex.ffzFixTitle(),this.update_ui_link(),t&&t(!0,n)}},{"./constants":3,"./utils":29}],12:[function(){var t=e.FrankerFaceZ;t.prototype.find_bttv=function(t,n){return this.has_bttv=!1,e.BTTVLOADED?this.setup_bttv(n||0):void(n>=6e4?this.log("BetterTTV was not detected after 60 seconds."):setTimeout(this.find_bttv.bind(this,t,(n||0)+t),t))},t.prototype.setup_bttv=function(e){this.log("BetterTTV was detected after "+e+"ms. Hooking."),this.has_bttv=!0,document.body.classList.remove("ffz-dark"),this._dark_style&&(this._dark_style.parentElement.removeChild(this._dark_style),delete this._dark_style),this.settings.group_tabs&&this._chatv&&this._chatv.ffzDisableTabs(),document.body.classList.remove("ffz-chat-colors"),document.body.classList.remove("ffz-chat-background"),this.is_dashboard&&this._update_subscribers();var t=BetterTTV.chat.helpers.sendMessage,n=this;BetterTTV.chat.helpers.sendMessage=function(e){var s=e.split(" ",1)[0].toLowerCase();return"/ffz"!==s?t(e):void n.run_ffz_command(e.substr(5),BetterTTV.chat.store.currentRoom)};var s,i=BetterTTV.chat.handlers.onPrivmsg;BetterTTV.chat.handlers.onPrivmsg=function(e,t){s=e;var n=i(e,t);return s=null,n};var o=BetterTTV.chat.templates.privmsg;BetterTTV.chat.templates.privmsg=function(e,t,i,a,r){try{return n.bttv_badges(r),'<div class="chat-line'+(e?" highlight":"")+(t?" action":"")+(i?" admin":"")+'" data-sender="'+(r.sender||"").toLowerCase()+'" data-room="'+s+'">'+BetterTTV.chat.templates.timestamp(r.time)+" "+(a?BetterTTV.chat.templates.modicons():"")+" "+BetterTTV.chat.templates.badges(r.badges)+BetterTTV.chat.templates.from(r.nickname,r.color)+BetterTTV.chat.templates.message(r.sender,r.message,r.emotes,t?r.color:!1)+"</div>"}catch(c){return n.log("Error: ",c),o(e,t,i,a,r)}};var a,r=BetterTTV.chat.templates.message;BetterTTV.chat.templates.message=function(e,t,s,i){try{i=i||!1;var o=encodeURIComponent(t);if("jtv"!==e){a=e;var c=BetterTTV.chat.templates.emoticonize(t,s);a=null;for(var l=0;l<c.length;l++)c[l]="string"==typeof c[l]?BetterTTV.chat.templates.bttvMessageTokenize(e,c[l]):c[l][0];t=c.join(" ")}return'<span class="message" '+(i?'style="color: '+i+'" ':"")+'data-raw="'+o+'" data-emotes="'+(s?encodeURIComponent(JSON.stringify(s)):"false")+'">'+t+"</span>"}catch(u){return n.log("Error: ",u),r(e,t,s,i)}};var c=BetterTTV.chat.templates.emoticonize;BetterTTV.chat.templates.emoticonize=function(e,t){var i=c(e,t),o=s||BetterTTV.getChannel(),r=o&&o.toLowerCase(),l=a&&a.toLowerCase(),u=n.getEmotes(l,r),t=[],h=n.get_user(),d=h&&h.login===l;return _.each(u,function(e){var s=n.emote_sets[e];s&&_.each(s.emoticons,function(e){_.any(i,function(t){return _.isString(t)&&t.match(e.regex)})&&t.push(e)})}),t.length?(_.each(t,function(e){var t=n._emote_tooltip(e),s=['<img class="emoticon" srcset="'+(e.srcSet||"")+'" src="'+e.urls[1]+'" alt="'+t+'" title="'+t+'" />'],o=i;if(i=[],!o||!o.length)return i;for(var a=0;a<o.length;a++){var c=o[a];if("string"==typeof c)for(var l=c.split(e.regex);l.length;){var u=l.shift();l.length?(u+=l.shift(),u&&i.push(u),l.shift(),i.push(s),d&&r&&n.add_usage(r,e.id)):i.push(u)}else i.push(c)}}),i):i},this.update_ui_link()}},{}],13:[function(){var t=e.FrankerFaceZ;t.prototype.find_emote_menu=function(t,n){return this.has_emote_menu=!1,e.emoteMenu&&emoteMenu.registerEmoteGetter?this.setup_emote_menu(n||0):void(n>=6e4?this.log("Emote Menu for Twitch was not detected after 60 seconds."):setTimeout(this.find_emote_menu.bind(this,t,(n||0)+t),t))
},t.prototype.setup_emote_menu=function(e){this.log("Emote Menu for Twitch was detected after "+e+"ms. Registering emote enumerator."),emoteMenu.registerEmoteGetter("FrankerFaceZ",this._emote_menu_enumerator.bind(this))},t.prototype._emote_menu_enumerator=function(){for(var e=this.get_user(),n=e?e.login:null,s=App.__container__.lookup("controller:chat"),i=s?s.get("currentRoom.id"):null,o=this.getEmotes(n,i),a=[],r=0;r<o.length;r++){var c=this.emote_sets[o[r]];if(c&&c.emoticons)for(var l in c.emoticons)if(c.emoticons.hasOwnProperty(l)){var u=c.emoticons[l];if(!u.hidden){var h=c.title,d=c.icon||null;h=h?"FrankerFaceZ: "+h:"global"==c.id?"FrankerFaceZ Global Emotes":"globalevent"==c.id?"FrankerFaceZ Event Emotes":this.feature_friday&&c.id==this.feature_friday.set?"FrankerFaceZ "+this.feature_friday.title+": "+this.feature_friday.display_name:"FrankerFaceZ Set: "+t.get_capitalization(c.id),a.push({text:u.name,url:u.urls[1],hidden:!1,channel:h,badge:d})}}}return a}},{}],14:[function(t){var n=e.FrankerFaceZ=function(){n.instance=this,this._log_data=[],this.initialize()};n.get=function(){return n.instance};var s=n.version_info={major:3,minor:4,revision:2,toString:function(){return[s.major,s.minor,s.revision].join(".")+(s.extra||"")}};n.prototype.log=function(e,t,n,s){e="FFZ: "+e+(n?" -- "+JSON.stringify(t):""),this._log_data.push(e+(!n&&s?" -- "+JSON.stringify(t):"")),void 0!==t&&console.groupCollapsed&&console.dir?(console.groupCollapsed(e),-1!==navigator.userAgent.indexOf("Firefox/")?console.log(t):console.dir(t),console.groupEnd(e)):console.log(e)},n.prototype.error=function(e,t,n){e="FFZ Error: "+e+(n?" -- "+JSON.stringify(t):""),this._log_data.push(e),void 0!==t&&console.groupCollapsed&&console.dir?(console.groupCollapsed(e),-1!==navigator.userAgent.indexOf("Firefox/")?console.log(t):console.dir(t),console.groupEnd(e)):console.assert(!1,e)},n.prototype.paste_logs=function(){this._pastebin(this._log_data.join("\n"),function(e){return e?void console.log("FFZ: Your FrankerFaceZ log has been pasted to: "+e):console.log("FFZ Error: Unable to upload log to pastebin.")})},n.prototype._pastebin=function(e,t){jQuery.ajax({url:"http://putco.de/",type:"PUT",data:e,context:this}).success(function(e){t.bind(this)(e.trim()+".log")}).fail(function(){t.bind(this)(null)})},n.prototype.get_user=function(){if(e.PP&&PP.login)return PP;if(e.App){var t=App.__container__.lookup("controller:login");return t?t.get("userData"):void 0}},t("./ui/menu"),t("./settings"),t("./socket"),t("./emoticons"),t("./badges"),t("./tokenize"),t("./ember/channel"),t("./ember/room"),t("./ember/line"),t("./ember/chatview"),t("./ember/viewers"),t("./ember/moderation-card"),t("./debug"),t("./ext/betterttv"),t("./ext/emote_menu"),t("./featurefriday"),t("./ui/styles"),t("./ui/dark"),t("./ui/notifications"),t("./ui/viewer_count"),t("./ui/sub_count"),t("./ui/menu_button"),t("./ui/races"),t("./ui/my_emotes"),t("./ui/about_page"),t("./commands"),n.prototype.initialize=function(t,n){if(/^\/(?:settings|m\/|messages?\/)/.test(location.pathname))return void this.setup_normal(n);if(/\/[A-Za-z_-]+\/dashboard/.test(location.pathname)&&!/bookmarks$/.test(location.pathname))return void this.setup_dashboard(n);var s=void 0!=e.App&&void 0!=App.__container__&&void 0!=App.__container__.resolve("model:room");return s?void this.setup_ember(n):(t=t||10,void(n>=6e4?this.log('Twitch application not detected in "'+location.toString()+'". Aborting.'):setTimeout(this.initialize.bind(this,t,(n||0)+t),t)))},n.prototype.setup_normal=function(t){var s=e.performance&&performance.now?performance.now():Date.now();this.log("Found non-Ember Twitch after "+(t||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+n.version_info),this.users={},this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_notifications(),this.setup_css(),this.setup_menu(),this.find_bttv(10);var i=e.performance&&performance.now?performance.now():Date.now(),o=i-s;this.log("Initialization complete in "+o+"ms")},n.prototype.is_dashboard=!1,n.prototype.setup_dashboard=function(t){var s=e.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch Dashboard after "+(t||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+n.version_info),this.users={},this.is_dashboard=!0,this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_notifications(),this.setup_css(),this._update_subscribers(),this.setup_message_event(),this.find_bttv(10);var i=e.performance&&performance.now?performance.now():Date.now(),o=i-s;this.log("Initialization complete in "+o+"ms")},n.prototype.setup_ember=function(t){var s=e.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch application after "+(t||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+n.version_info),this.users={},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_notifications(),this.setup_css(),this.setup_menu(),this.setup_my_emotes(),this.setup_races(),this.connect_extra_chat(),this.find_bttv(10),this.find_emote_menu(10),this.check_ff();var i=e.performance&&performance.now?performance.now():Date.now(),o=i-s;this.log("Initialization complete in "+o+"ms")},n.prototype.setup_message_event=function(){this.log("Listening for Window Messages."),e.addEventListener("message",this._on_window_message.bind(this),!1)},n.prototype._on_window_message=function(e){if(e.data&&e.data.from_ffz){var t=e.data;this.log("Window Message",t)}}},{"./badges":1,"./commands":2,"./debug":4,"./ember/channel":5,"./ember/chatview":6,"./ember/line":7,"./ember/moderation-card":8,"./ember/room":9,"./ember/viewers":10,"./emoticons":11,"./ext/betterttv":12,"./ext/emote_menu":13,"./featurefriday":15,"./settings":16,"./socket":17,"./tokenize":18,"./ui/about_page":19,"./ui/dark":20,"./ui/menu":21,"./ui/menu_button":22,"./ui/my_emotes":23,"./ui/notifications":24,"./ui/races":25,"./ui/styles":26,"./ui/sub_count":27,"./ui/viewer_count":28}],15:[function(t){var n=e.FrankerFaceZ,s=t("./constants");n.prototype.feature_friday=null,n.prototype.check_ff=function(e){e||this.log("Checking for Feature Friday data..."),jQuery.ajax(s.SERVER+"script/event.json",{cache:!1,dataType:"json",context:this}).done(function(e){return this._load_ff(e)}).fail(function(t){return 404==t.status?this._load_ff(null):(e=e||0,e++,10>e?setTimeout(this.check_ff.bind(this,e),250):this._load_ff(null))})},n.ws_commands.reload_ff=function(){this.check_ff()},n.prototype._feature_friday_ui=function(e,t,n){if(this.feature_friday&&this.feature_friday.channel!=e){this._emotes_for_sets(t,n,[this.feature_friday.set],this.feature_friday.title,this.feature_friday.icon,"FrankerFaceZ");var s=App.__container__.lookup("controller:channel");if(!s||s.get("id")!=this.feature_friday.channel){var i=this.feature_friday,o=document.createElement("div"),a=document.createElement("a");o.className="chat-menu-content",o.style.textAlign="center";var r=i.display_name+(i.live?" is live now!":"");a.className="button primary",a.classList.toggle("live",i.live),a.classList.toggle("blue",this.has_bttv&&BetterTTV.settings.get("showBlueButtons")),a.href="http://www.twitch.tv/"+i.channel,a.title=r,a.target="_new",a.innerHTML="<span>"+r+"</span>",o.appendChild(a),t.appendChild(o)}}},n.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:n.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())},n.prototype._update_ff_live=function(){if(this.feature_friday){var e=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)})}},n.prototype._update_ff_name=function(e){this.feature_friday&&(this.feature_friday.display_name=e)}},{"./constants":3}],16:[function(t){var n=e.FrankerFaceZ,s=t("./constants");make_ls=function(e){return"ffz_setting_"+e},toggle_setting=function(e,t){var n=!this.settings.get(t);this.settings.set(t,n),e.classList.toggle("active",n)},n.settings_info={},n.prototype.load_settings=function(){this.log("Loading settings."),this.settings={};for(var t in n.settings_info)if(n.settings_info.hasOwnProperty(t)){var s=n.settings_info[t],i=s.storage_key||make_ls(t),o=s.hasOwnProperty("value")?s.value:void 0;if(localStorage.hasOwnProperty(i))try{o=JSON.parse(localStorage.getItem(i))}catch(a){this.log('Error loading value for "'+t+'": '+a)}this.settings[t]=o}this.settings.get=this._setting_get.bind(this),this.settings.set=this._setting_set.bind(this),this.settings.del=this._setting_del.bind(this),e.addEventListener("storage",this._setting_update.bind(this),!1)},n.settings_info.replace_twitch_menu={type:"boolean",value:!1,name:"Replace Twitch Emoticon Menu <span>Beta</span>",help:"Completely replace the default Twitch emoticon menu.",on_update:function(e){document.body.classList.toggle("ffz-menu-replace",e)}},n.menu_pages.settings={render:function(e,t){var s={},i=[];for(var o in n.settings_info)if(n.settings_info.hasOwnProperty(o)){var a=n.settings_info[o],r=a.category||"Miscellaneous",c=s[r];if(void 0!==a.visible&&null!==a.visible){var l=a.visible;if("function"==typeof a.visible&&(l=a.visible.bind(this)()),!l)continue}c||(i.push(r),c=s[r]=[]),c.push([o,a])}i.sort(function(e,t){var e=e.toLowerCase(),t=t.toLowerCase();return"debugging"===e&&(e="zzz"+e),"debugging"===t&&(t="zzz"+t),t>e?-1:e>t?1:0});for(var u=0;u<i.length;u++){var h=i[u],d=s[h],_=document.createElement("div"),f=document.createElement("div");f.className="heading",_.className="chat-menu-content",f.innerHTML=h,_.appendChild(f),d.sort(function(e,t){var e=e[1],t=t[1],n=e.type,s=t.type,i=e.name.toLowerCase(),o=t.name.toLowerCase();return s>n?-1:n>s?1:o>i?-1:i>o?1:0});for(var m=0;m<d.length;m++){var o=d[m][0],a=d[m][1],p=document.createElement("p"),g=this.settings.get(o);if(p.className="clearfix",this.has_bttv&&a.no_bttv){var v=document.createElement("span"),b=document.createElement("span");v.className="switch-label",v.innerHTML=a.name,b=document.createElement("span"),b.className="help",b.innerHTML="Disabled due to incompatibility with BetterTTV.",p.classList.add("disabled"),p.appendChild(v),p.appendChild(b)}else{if("boolean"==a.type){var y=document.createElement("a"),v=document.createElement("span");y.className="switch",y.classList.toggle("active",g),y.innerHTML="<span></span>",v.className="switch-label",v.innerHTML=a.name,p.appendChild(y),p.appendChild(v),y.addEventListener("click",toggle_setting.bind(this,y,o))}else{p.classList.add("option");var w=document.createElement("a");w.innerHTML=a.name,w.href="#",p.appendChild(w),w.addEventListener("click",a.method.bind(this))}if(a.help){var b=document.createElement("span");b.className="help",b.innerHTML=a.help,p.appendChild(b)}}_.appendChild(p)}t.appendChild(_)}},name:"Settings",icon:s.GEAR,sort_order:99999,wide:!0},n.prototype._setting_update=function(t){if(t||(t=e.event),t.key&&"ffz_setting_"===t.key.substr(0,12)){var s=t.key,i=s.substr(12),o=void 0,a=n.settings_info[i];if(!a){for(i in n.settings_info)if(n.settings_info.hasOwnProperty(i)&&(a=n.settings_info[i],a.storage_key==s))break;if(a.storage_key!=s)return}this.log("Updated Setting: "+i);try{o=JSON.parse(t.newValue)}catch(r){this.log('Error loading new value for "'+i+'": '+r),o=a.value||void 0}if(this.settings[i]=o,a.on_update)try{a.on_update.bind(this)(o,!1)}catch(r){this.log('Error running updater for setting "'+i+'": '+r)}}},n.prototype._setting_get=function(e){return this.settings[e]},n.prototype._setting_set=function(e,t){var s=n.settings_info[e],i=s.storage_key||make_ls(e),o=JSON.stringify(t);if(this.settings[e]=t,localStorage.setItem(i,o),this.log('Changed Setting "'+e+'" to: '+o),s.on_update)try{s.on_update.bind(this)(t,!0)}catch(a){this.log('Error running updater for setting "'+e+'": '+a)}},n.prototype._setting_del=function(e){var t=n.settings_info[e],s=t.storage_key||make_ls(e),i=void 0;if(localStorage.hasOwnProperty(s)&&localStorage.removeItem(s),delete this.settings[e],t&&(i=this.settings[e]=t.hasOwnProperty("value")?t.value:void 0),t.on_update)try{t.on_update.bind(this)(i,!0)}catch(o){this.log('Error running updater for setting "'+e+'": '+o)}}},{"./constants":3}],17:[function(){var t=e.FrankerFaceZ;t.prototype._ws_open=!1,t.prototype._ws_delay=0,t.ws_commands={},t.ws_on_close=[],t.prototype.ws_create=function(){var n,s=this;this._ws_last_req=0,this._ws_callbacks={},this._ws_pending=this._ws_pending||[];try{n=this._ws_sock=new WebSocket("ws://catbag.frankerfacez.com/")}catch(i){return this._ws_exists=!1,this.log("Error Creating WebSocket: "+i)}this._ws_exists=!0,n.onopen=function(){s._ws_open=!0,s._ws_delay=0,s.log("Socket connected.");var n=e.RequestFileSystem||e.webkitRequestFileSystem;n?n(e.TEMPORARY,100,s.ws_send.bind(s,"hello",["ffz_"+t.version_info,localStorage.ffzClientId],s._ws_on_hello.bind(s)),s.log.bind(s,"Operating in Incognito Mode.")):s.ws_send("hello",["ffz_"+t.version_info,localStorage.ffzClientId],s._ws_on_hello.bind(s));var i=s.get_user();if(i&&s.ws_send("setuser",i.login),s.is_dashboard){var o=location.pathname.match(/\/([^\/]+)/);o&&s.ws_send("sub",o[1])}for(var a in s.rooms)s.rooms.hasOwnProperty(a)&&s.ws_send("sub",a);var r=s._ws_pending;s._ws_pending=[];for(var c=0;c<r.length;c++){var l=r[c];s.ws_send(l[0],l[1],l[2])}},n.onclose=function(e){s.log("Socket closed. (Code: "+e.code+", Reason: "+e.reason+")"),s._ws_open=!1;for(var n=0;n<t.ws_on_close.length;n++)try{t.ws_on_close[n].bind(s)()}catch(i){s.log("Error on Socket Close Callback: "+i)}s._ws_delay<6e4?s._ws_delay+=5e3:s._ws_delay=1e3*(Math.floor(60*Math.random())+30),setTimeout(s.ws_create.bind(s),s._ws_delay)},n.onmessage=function(e){var n,i,o=e.data.indexOf(" "),a=e.data.substr(o+1),r=parseInt(e.data.slice(0,o));if(o=a.indexOf(" "),-1===o&&(o=a.length),n=a.slice(0,o),a=a.substr(o+1),a&&(i=JSON.parse(a)),-1===r){var c=t.ws_commands[n];c?c.bind(s)(i):s.log("Invalid command: "+n,i,!1,!0)}else{var l="True"===n,u=s._ws_callbacks[r];l&&u||s.log("Socket Reply to "+r+" - "+(l?"SUCCESS":"FAIL"),i,!1,!0),u&&(delete s._ws_callbacks[r],u(l,i))}}},t.prototype.ws_send=function(e,t,n,s){if(!this._ws_open){if(s){var i=this._ws_pending=this._ws_pending||[];return i.push([e,t,n]),!0}return!1}var o=++this._ws_last_req;return t=void 0!==t?" "+JSON.stringify(t):"",n&&(this._ws_callbacks[o]=n),this._ws_sock.send(o+" "+e+t),o},t.prototype._ws_on_hello=function(e,n){if(!e)return this.log("Error Saying Hello: "+n);localStorage.ffzClientId=n,this.log("Client ID: "+n);var s={},i=s.settings={};for(var o in t.settings_info)i[o]=this.settings[o];i.keywords=this.settings.keywords.length,i.banned_words=this.settings.banned_words.length,s.bttv=this.has_bttv||!!document.head.querySelector('script[src*="betterttv"]'),s["user-agent"]=navigator.userAgent,s.screen=[screen.width,screen.height],s.language=navigator.language,s.platform=navigator.platform,this.ws_send("survey",[s])},t.ws_commands.do_authorize=function(e){var n;for(var s in this.rooms)if(this.rooms.hasOwnProperty(s)){var i=this.rooms[s];if(i&&i.room&&!i.room.get("roomProperties.eventchat")&&!i.room.get("isGroupRoom")&&i.room.tmiRoom){var o=i.room.tmiRoom._getConnection();if(o.isConnected){n=o;break}}}n?n._send("PRIVMSG #frankerfacezauthorizer :AUTH "+e):setTimeout(t.ws_commands.do_authorize.bind(this,e),5e3)}},{}],18:[function(t){{var n,s=e.FrankerFaceZ,i=t("./utils"),o="http://static-cdn.jtvnw.net/emoticons/v1/",a=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},r="[\\s`~<>!-#%-\\x2A,-/:;\\x3F@\\x5B-\\x5D_\\x7B}\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]";new RegExp(r+"*,"+r+"*")}try{n=e.require&&e.require("ember-twitch-chat/helpers/chat-line-helpers")}catch(c){}s.prototype.tokenize_chat_line=function(t){if(t.cachedTokens)return t.cachedTokens;var i=t.message,o=this.get_user(),a=t.room,r=o&&t.from===o.login,c=t.tags&&t.tags.emotes,l=[i];l=n.linkifyMessage(l),o&&o.login&&(l=n.mentionizeMessage(l,o.login,r)),l=n.emoticonizeMessage(l,c),l=this._remove_banned(l),l=this.tokenize_emotes(t.from,a,l,r);var u=t.tags&&t.tags["display-name"];if(u&&u.length&&(s.capitalization[t.from]=[u.trim(),Date.now()]),!r){l=this.tokenize_mentions(l);for(var h=0;h<l.length;h++){var d=l[h];if(!_.isString(d)&&d.mentionedUser&&!d.own){if(t.ffz_has_mention=!0,!this.has_bttv&&this.settings.group_tabs&&this._chatv&&this._chatv._ffz_tabs){var f=this._chatv._ffz_tabs.querySelector('.ffz-chat-tab[data-room="'+a+'"]');f&&!f.classList.contains("active")&&f.classList.add("tab-mentioned")}if(this._chatv&&this.settings.highlight_notifications&&!document.hasFocus()){var m,p=this.rooms[a]&&this.rooms[a].room;m=p&&p.get("isGroupRoom")?p.get("tmiRoom.displayName"):s.get_capitalization(a),u=u||Twitch.display.capitalize(t.from),i="action"===t.style?"* "+u+" "+i:u+": "+i;this.show_notification(i,"Twitch Chat Mention in "+m,a,6e4,function(){e.focus();var t=App.__container__.lookup("controller:chat");p&&t&&t.focusRoom(p)})}break}}}return t.cachedTokens=l,l},s.prototype.tokenize_line=function(e,t,s,i){if("string"==typeof s&&(s=[s]),n&&n.linkifyMessage&&(s=n.linkifyMessage(s)),n&&n.mentionizeMessage){var o=this.get_user();o&&o.login&&(s=n.mentionizeMessage(s,o.login,e===o.login))}return i||(s=this.tokenize_emotes(e,t,s)),s},s.prototype.render_tokens=function(e,t){return _.map(e,function(e){if(e.emoticonSrc)return'<img class="emoticon tooltip" src="'+e.emoticonSrc+'" alt="'+e.altText+'" title="'+e.altText+'">';if(e.isLink){if(!t&&void 0!==t)return e.href;var n=e.href;if(n.indexOf("@")>-1&&(-1===n.indexOf("/")||n.indexOf("@")<n.indexOf("/")))return'<a href="mailto:'+n+'">'+n+"</a>";var s=(n.match(/^https?:\/\//)?"":"http://")+n;return'<a href="'+s+'" target="_blank">'+n+"</a>"}return e.mentionedUser?'<span class="'+(e.own?"mentioning":"mentioned")+'">'+e.mentionedUser+"</span>":i.sanitize(e.deletedLink?e.text:e)}).join("")},s.prototype.tokenize_title_emotes=function(e){var t=this,n=App.__container__.lookup("controller:channel"),s=n&&n.get("product.emoticons"),i=[];return _.isString(e)&&(e=[e]),_.each(_.union(t.__twitch_global_emotes||[],s),function(t){if(t&&"inactive"!==t.state){var n=new RegExp("\\b"+t.regex+"\\b");_.any(e,function(e){return _.isString(e)&&e.match(n)})&&i.push(t)}}),(void 0===t.__twitch_global_emotes||null===t.__twitch_global_emotes)&&(t.__twitch_global_emotes=!1,Twitch.api.get("chat/emoticon_images",{emotesets:"0,42"}).done(function(e){if(!e||!e.emoticon_sets||!e.emoticon_sets[0])return void(t.__twitch_global_emotes=[]);var n=t.__twitch_global_emotes=[];e=e.emoticon_sets[0];for(var s=0;s<e.length;s++){var i=e[s];n.push({regex:i.code,url:o+i.id+"/1.0"})}t._cindex&&t._cindex.ffzFixTitle()}).fail(function(){setTimeout(function(){t.__twitch_global_emotes=null},5e3)})),i.length?("string"==typeof e&&(e=[e]),_.each(i,function(t){var n={isEmoticon:!0,srcSet:t.url+" 1x",emoticonSrc:t.url,altText:t.regex},s=new RegExp("\\b"+t.regex+"\\b");e=_.compact(_.flatten(_.map(e,function(e){if(_.isObject(e))return e;var t=e.split(s),i=[];return t.forEach(function(e,s){i.push(e),s!==t.length-1&&i.push(n)}),i})))}),e):e},s.prototype.tokenize_emotes=function(e,t,n,s){var i=this,o=this.getEmotes(e,t),a=[];return _.each(o,function(e){var t=i.emote_sets[e];t&&_.each(t.emoticons,function(e){_.any(n,function(t){return _.isString(t)&&t.match(e.regex)})&&a.push(e)})}),a.length?("string"==typeof n&&(n=[n]),_.each(a,function(e){var o={srcSet:e.srcSet,emoticonSrc:e.urls[1]+'" data-ffz-emote="'+encodeURIComponent(JSON.stringify([e.id,e.set_id])),altText:e.hidden?"???":e.name};n=_.compact(_.flatten(_.map(n,function(n){if(_.isObject(n))return n;for(var a=n.split(e.regex),r=[];a.length;){var c=a.shift();a.length?(c+=a.shift(),c&&r.push(c),a.shift(),r.push(o),s&&t&&i.add_usage(t,e.id)):r.push(c)}return r})))}),n):n},s._regex_cache={},s._get_regex=function(e){return s._regex_cache[e]=s._regex_cache[e]||RegExp("\\b"+a(e)+"\\b","ig")},s._words_to_regex=function(e){var t=s._regex_cache[e];if(!t){for(var n="",i=0;i<e.length;i++)e[i]&&(n+=(n?"|":"")+a(e[i]));t=s._regex_cache[e]=new RegExp("(^|.*?"+r+")("+n+")(?=$|"+r+")","ig")}return t},s.prototype.tokenize_mentions=function(e){var t=this.settings.keywords;if(!t||!t.length)return e;"string"==typeof e&&(e=[e]);for(var n=s._words_to_regex(t),i=[],o=0;o<e.length;o++){var a=e[o];_.isString(a)&&a.match(n)?(a=a.replace(n,function(e,t,n){return i.push(t),i.push({mentionedUser:n,own:!1}),""}),a&&i.push(a)):i.push(a)}return i}},{"./utils":29}],19:[function(t){var n=e.FrankerFaceZ,s=t("../constants");n.menu_pages.about={name:"About",icon:s.HEART,sort_order:1e5,render:function(e,t){var s=this.rooms[e.get("context.currentRoom.id")],i=!1,o=this;if(s&&s.set){var a=this.emote_sets[s.set];a&&a.count>0&&(i=!0)}var r=document.createElement("div"),c="";c+="<h1>FrankerFaceZ</h1>",c+='<div class="ffz-about-subheading">new ways to woof</div>',r.className="chat-menu-content center",r.innerHTML=c,t.appendChild(r);var l=0,u=r.querySelector("h1");u&&u.addEventListener("click",function(){if(u.style.cursor="pointer",l++,l>=3){l=0;var e=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");e&&e.classList.toggle("ffz-flip")}setTimeout(function(){l=0,u.style.cursor=""},2e3)});var h=document.createElement("div"),d=document.createElement("a"),_="To use custom emoticons in "+(i?"this channel":"tons of channels")+", get FrankerFaceZ from http://www.frankerfacez.com";d.className="button primary",d.innerHTML="Advertise in Chat",d.addEventListener("click",this._add_emote.bind(this,e,_)),h.appendChild(d);var f=document.createElement("a");f.className="button ffz-donate",f.href="https://www.frankerfacez.com/donate",f.target="_new",f.innerHTML="Donate",h.appendChild(f),h.className="chat-menu-content center",t.appendChild(h);var m=document.createElement("div");c='<table class="ffz-about-table">',c+='<tr><th colspan="4">Developers</th></tr>',c+='<tr><td>Dan Salvato</td><td><a class="twitch" href="http://www.twitch.tv/dansalvato" title="Twitch" target="_new">&nbsp;</a></td><td><a class="twitter" href="https://twitter.com/dansalvato1" title="Twitter" target="_new">&nbsp;</a></td><td><a class="youtube" href="https://www.youtube.com/user/dansalvato1" title="YouTube" target="_new">&nbsp;</a></td></tr>',c+='<tr><td>Stendec</td><td><a class="twitch" href="http://www.twitch.tv/sirstendec" title="Twitch" target="_new">&nbsp;</a></td><td><a class="twitter" href="https://twitter.com/SirStendec" title="Twitter" target="_new">&nbsp;</a></td><td><a class="youtube" href="https://www.youtube.com/channel/UCnxuvmK1DCPCXSJ-mXIh4KQ" title="YouTube" target="_new">&nbsp;</a></td></tr>',c+='<tr class="debug"><td>Version '+n.version_info+'</td><td colspan="3"><a href="#" id="ffz-debug-logs">Logs</a></td></tr>',m.className="chat-menu-content center",m.innerHTML=c;var p=!1;m.querySelector("#ffz-debug-logs").addEventListener("click",function(){p||(p=!0,o._pastebin(o._log_data.join("\n"),function(e){p=!1,e?prompt("Your FrankerFaceZ logs have been uploaded to the URL:",e):alert("There was an error uploading the FrankerFaceZ logs.")}))}),t.appendChild(m)}}},{"../constants":3}],20:[function(t){var n=e.FrankerFaceZ,s=t("../constants");n.settings_info.twitch_chat_dark={type:"boolean",value:!1,visible:!1},n.settings_info.dark_twitch={type:"boolean",value:!1,no_bttv:!0,name:"Dark Twitch",help:"Apply a dark background to channels and other related pages for easier viewing.",on_update:function(t){if(!this.has_bttv){document.body.classList.toggle("ffz-dark",t);var n=e.App?App.__container__.lookup("controller:settings").get("model"):void 0;t?(this._load_dark_css(),n&&this.settings.set("twitch_chat_dark",n.get("darkMode")),n&&n.set("darkMode",!0)):n&&n.set("darkMode",this.settings.twitch_chat_dark)}}},n.prototype.setup_dark=function(){this.has_bttv||(document.body.classList.toggle("ffz-dark",this.settings.dark_twitch),this.settings.dark_twitch&&(e.App&&App.__container__.lookup("controller:settings").set("model.darkMode",!0),this._load_dark_css()))},n.prototype._load_dark_css=function(){if(!this._dark_style){this.log("Injecting FrankerFaceZ Dark Twitch CSS.");var e=this._dark_style=document.createElement("link");e.id="ffz-dark-css",e.setAttribute("rel","stylesheet"),e.setAttribute("href",s.SERVER+"script/dark.css?_="+Date.now()),document.head.appendChild(e)}}},{"../constants":3}],21:[function(t){var n=e.FrankerFaceZ,s=t("../constants"),i=t("../utils"),o="http://static-cdn.jtvnw.net/emoticons/v1/";n.prototype.setup_menu=function(){this.log("Installing mouse-up event to auto-close menus.");var e=this;jQuery(document).mouseup(function(t){var n,s=e._popup;s&&(s=jQuery(s),n=s.parent(),n.is(t.target)||0!==n.has(t.target).length||(s.remove(),delete e._popup,e._popup_kill&&e._popup_kill(),delete e._popup_kill))}),document.body.classList.toggle("ffz-menu-replace",this.settings.replace_twitch_menu)},n.menu_pages={},n.prototype.build_ui_popup=function(e){var t=this._popup;if(t)return t.parentElement.removeChild(t),delete this._popup,this._popup_kill&&this._popup_kill(),void delete this._popup_kill;var i=document.createElement("div"),o=document.createElement("div"),a=document.createElement("ul"),r=this.has_bttv?BetterTTV.settings.get("darkenedMode"):!1;i.className="emoticon-selector chat-menu ffz-ui-popup",o.className="emoticon-selector-box dropmenu",i.appendChild(o),i.classList.toggle("dark",r);var c=document.createElement("div");c.className="ffz-ui-menu-page",o.appendChild(c),a.className="menu clearfix",o.appendChild(a);var l=document.createElement("li");l.className="title",l.innerHTML="<span>"+(s.DEBUG?"[DEV] ":"")+"FrankerFaceZ</span>",a.appendChild(l);var u=[];for(var h in n.menu_pages)if(n.menu_pages.hasOwnProperty(h)){var d=n.menu_pages[h];d&&(!d.hasOwnProperty("visible")||d.visible&&("function"!=typeof d.visible||d.visible.bind(this)()))&&u.push([d.sort_order||0,h,d])}u.sort(function(e,t){if(e[0]<t[0])return 1;if(e[0]>t[0])return-1;var n=e[1].toLowerCase(),s=t[1].toLowerCase();return s>n?1:n>s?-1:0});for(var _=0;_<u.length;_++){var h=u[_][1],d=u[_][2],f=document.createElement("li"),m=document.createElement("a");f.className="item",f.id="ffz-menu-page-"+h,m.title=d.name,m.innerHTML=d.icon,jQuery(m).tipsy(),m.addEventListener("click",this._ui_change_page.bind(this,e,o,a,c,h)),f.appendChild(m),a.appendChild(f)}this._ui_change_page(e,o,a,c,this._last_page||"channel"),this._popup=i,c.style.maxHeight=Math.max(200,e.$().height()-172)+"px",e.$(".chat-interface").append(i)},n.prototype._ui_change_page=function(e,t,s,i,o){this._last_page=o,i.innerHTML="",i.setAttribute("data-page",o);var a=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");t.style.maxWidth=!n.menu_pages[o].wide||"function"==typeof n.menu_pages[o].wide&&!n.menu_pages[o].wide.bind(this)()?"":(a.offsetWidth<640?a.offsetWidth-40:600)+"px";for(var r=s.querySelectorAll("li.active"),c=0;c<r.length;c++)r[c].classList.remove("active");var l=s.querySelector("#ffz-menu-page-"+o);l?l.classList.add("active"):this.log("No matching page: "+o),n.menu_pages[o].render.bind(this)(e,i)},n.menu_pages.channel={render:function(e,t){var n=e.get("controller.currentRoom.id"),s=this.rooms[n],a=!1;if(this.settings.replace_twitch_menu){var r=s.room.get("product");if(r&&!r.get("error")){a=!0;var c=App.__container__.resolve("model:ticket").find("user",{channel:n}),l=c?c.get("content"):!1,u=s.room.get("badgeSet.subscriber.image"),h=document.createElement("div"),d=document.createElement("div"),_=0;l=l&&l.length>0,h.className="emoticon-grid",d.className="heading",u&&(d.style.backgroundImage='url("'+u+'")'),d.innerHTML='<span class="right">Twitch</span>Subscriber Emoticons',h.appendChild(d);for(var f=r.get("emoticons"),m=0;m<f.length;m++){var p=f[m];if("active"===p.state){var g=document.createElement("span"),v=l||!p.subscriber_only,b='image-set(url("'+o+p.id+'/1.0") 1x, url("'+o+p.id+'/2.0") 2x, url("'+o+p.id+'/3.0") 4x)';g.className="emoticon tooltip"+(v?"":" locked"),g.style.backgroundImage='url("'+o+p.id+'/1.0")',g.style.backgroundImage="-webkit-"+b,g.style.backgroundImage="-moz-"+b,g.style.backgroundImage="-ms-"+b,g.style.backgroundImage=b,g.style.width=p.width+"px",g.style.height=p.height+"px",g.title=p.regex,v&&g.addEventListener("click",this._add_emote.bind(this,e,p.regex)),h.appendChild(g),_++}}if(_>0&&t.appendChild(h),l){var y=c.get("content");if(y=y.length>0?y[y.length-1]:void 0,y&&y.purchase_profile&&!y.purchase_profile.will_renew){var w=i.parse_date(y.access_end||"");z=document.createElement("div"),k=document.createElement("div"),F=document.createElement("span"),end_time=w?Math.floor((w.getTime()-Date.now())/1e3):null,z.className="subscribe-message",k.className="non-subscriber-message",z.appendChild(k),F.className="unlock-text",F.innerHTML="Subscription expires in "+i.time_to_string(end_time,!0,!0),k.appendChild(F),t.appendChild(z)}}else{var z=document.createElement("div"),k=document.createElement("div"),F=document.createElement("span"),C=document.createElement("a");z.className="subscribe-message",k.className="non-subscriber-message",z.appendChild(k),F.className="unlock-text",F.innerHTML="Subscribe to unlock Emoticons",k.appendChild(F),C.className="action subscribe-button button primary",C.href=r.get("product_url"),C.innerHTML='<span class="subscribe-text">Subscribe</span><span class="subscribe-price">'+r.get("price")+"</span>",k.appendChild(C),t.appendChild(z)}}}this._emotes_for_sets(t,e,s&&s.set&&[s.set]||[],this.feature_friday||a?"Channel Emoticons":null,"http://cdn.frankerfacez.com/script/devicon.png","FrankerFaceZ"),this._feature_friday_ui(n,t,e)},name:"Channel",icon:s.ZREKNARF},n.prototype._emotes_for_sets=function(e,t,n,s,i,o){var a=document.createElement("div"),r=0;if(a.className="emoticon-grid",null!=s){var c=document.createElement("div");if(c.className="heading",o){var l=document.createElement("span");l.className="right",l.appendChild(document.createTextNode(o)),c.appendChild(l)}c.appendChild(document.createTextNode(s)),i&&(c.style.backgroundImage='url("'+i+'")'),a.appendChild(c)}for(var u=[],h=0;h<n.length;h++){var d=this.emote_sets[n[h]];
if(d&&d.emoticons)for(var _ in d.emoticons)d.emoticons.hasOwnProperty(_)&&!d.emoticons[_].hidden&&u.push(d.emoticons[_])}u.sort(function(e,t){var n=e.name.toLowerCase(),s=t.name.toLowerCase();return s>n?-1:n>s?1:0});for(var h=0;h<u.length;h++){var f=u[h],m=null;(f.urls[2]||f.urls[4])&&(m='url("'+f.urls[1]+'") 1x',f.urls[2]&&(m+=', url("'+f.urls[2]+'") 2x'),f.urls[4]&&(m+=', url("'+f.urls[4]+'") 4x')),r++;var l=document.createElement("span");if(l.className="emoticon tooltip",l.style.backgroundImage='url("'+f.urls[1]+'")',m){var p="image-set("+m+")";l.style.backgroundImage="-webkit-"+p,l.style.backgroundImage="-moz-"+p,l.style.backgroundImage="-ms-"+p,l.style.backgroundImage=p}l.style.width=f.width+"px",l.style.height=f.height+"px",l.title=this._emote_tooltip(f),l.addEventListener("click",this._add_emote.bind(this,t,f.name)),a.appendChild(l)}r||(a.innerHTML+="This channel has no emoticons.",a.className="emoticon-grid ffz-no-emotes center"),e.appendChild(a)},n.prototype._add_emote=function(e,t){var n,s,i;this.has_bttv?(n=e.get("element").querySelector("textarea"),s=n.value):(i=e.get("controller.currentRoom"),s=i.get("messageToSend")||""),s+=(s&&" "!==s.substr(-1)?" ":"")+(t.name||t),n?n.value=s:i.set("messageToSend",s)}},{"../constants":3,"../utils":29}],22:[function(t){var n=e.FrankerFaceZ,s=t("../constants");n.prototype.build_ui_link=function(e){var t=document.createElement("a");return t.className="ffz-ui-toggle",t.innerHTML=s.CHAT_BUTTON,t.addEventListener("click",this.build_ui_popup.bind(this,e)),this.update_ui_link(t),t},n.prototype.update_ui_link=function(t){var n=e.App&&App.__container__.lookup("controller:chat");if(t=t||document.querySelector("a.ffz-ui-toggle"),t&&n){var s=n.get("currentRoom.id"),i=this.rooms[s],o=!1,a=this.has_bttv?BetterTTV.settings.get("darkenedMode"):!1,r=this.has_bttv?BetterTTV.settings.get("showBlueButtons"):!1,c=this.feature_friday&&this.feature_friday.live;if(i&&i.set){var l=this.emote_sets[i.set];l&&l.count>0&&(o=!0)}t.classList.toggle("no-emotes",!o),t.classList.toggle("live",c),t.classList.toggle("dark",a),t.classList.toggle("blue",r)}}},{"../constants":3}],23:[function(t){var n=e.FrankerFaceZ,s=t("../constants"),i=t("../utils"),o="http://static-cdn.jtvnw.net/emoticons/v1/",a={"#-?[\\\\/]":"#-/",":-?(?:7|L)":":-7","\\&lt\\;\\]":"<]","\\:-?(S|s)":":-S","\\:-?\\\\":":-\\","\\:\\&gt\\;":":>","B-?\\)":"B-)","\\:-?[z|Z|\\|]":":-Z","\\:-?\\)":":-)","\\:-?\\(":":-(","\\:-?(p|P)":":-P","\\;-?(p|P)":";-P","\\&lt\\;3":"<3","\\:-?[\\\\/]":":-/","\\;-?\\)":";-)","R-?\\)":"R-)","[o|O](_|\\.)[o|O]":"O.o","\\:-?D":":-D","\\:-?(o|O)":":-O","\\&gt\\;\\(":">(","Gr(a|e)yFace":"GrayFace"},r=function(e){var t=App.__container__.lookup("controller:chat"),n=t.get("currentRoom.id"),s=e.rooms[n],i=s?s.room.tmiSession:null,o=i&&i._emotesParser&&i._emotesParser.emoticonSetIds||"0",a=e.get_user(),r=a&&e.users[a.login]&&e.users[a.login].sets||[];return o=o.split(",").removeObject("0"),e.settings.global_emotes_in_menu&&(o.push("0"),r=_.union(r,e.default_sets)),[o,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_set_to_channel={},this._twitch_badges={},localStorage.ffzTwitchSets)try{this._twitch_set_to_channel=JSON.parse(localStorage.ffzTwitchSets),this._twitch_badges=JSON.parse(localStorage.ffzTwitchBadges)}catch(e){}this._twitch_set_to_channel[0]="global",this._twitch_set_to_channel[33]="tfaces",this._twitch_set_to_channel[42]="tfaces",this._twitch_badges.global="//cdn.frankerfacez.com/script/twitch_logo.png",this._twitch_badges.tfaces=this._twitch_badges.turbo="//cdn.frankerfacez.com/script/turbo_badge.png"},n.menu_pages.my_emotes={name:"My Emoticons",icon:s.EMOTE,visible:function(){var e=r(this);return e[0].length>0||e[1].length>0},render:function(e,t){var s=e.get("controller.currentRoom.tmiSession"),i=(s&&s.getEmotes()||{emoticon_sets:{}}).emoticon_sets,o=[];for(var a in i)i.hasOwnProperty(a)&&!this._twitch_set_to_channel.hasOwnProperty(a)&&o.push(a);return o.length?void(t.innerHTML=JSON.stringify(o)):n.menu_pages.my_emotes.draw_menu.bind(this)(e,t,i)},draw_twitch_set:function(e,t,s){var r,c=document.createElement("div"),l=document.createElement("div"),u=this._twitch_set_to_channel[t];if(r="global"===u?"Global Emoticons":"turbo"===u?"Twitch Turbo":n.get_capitalization(u,function(e){c.innerHTML='<span class="right">Twitch</span>'+i.sanitize(e)}),c.className="heading",c.innerHTML='<span class="right">Twitch</span>'+i.sanitize(r),this._twitch_badges[u])c.style.backgroundImage='url("'+this._twitch_badges[u]+'")';else{var h=this;Twitch.api.get("chat/"+u+"/badges",null,{version:3}).done(function(e){e.subscriber&&e.subscriber.image&&(h._twitch_badges[u]=e.subscriber.image,c.style.backgroundImage='url("'+e.subscriber.image+'")')})}l.className="emoticon-grid",l.appendChild(c);for(var d=0;d<s.length;d++){var _=s[d],f=a[_.code]||_.code,m=document.createElement("span"),p='image-set(url("'+o+_.id+'/1.0") 1x, url("'+o+_.id+'/2.0") 2x, url("'+o+_.id+'/3.0") 4x)';m.className="emoticon tooltip",m.style.backgroundImage='url("'+o+_.id+'/1.0")',m.style.backgroundImage="-webkit-"+p,m.style.backgroundImage="-moz-"+p,m.style.backgroundImage="-ms-"+p,m.style.backgroudnImage=p,m.title=f,m.addEventListener("click",this._add_emote.bind(this,e,f)),l.appendChild(m)}return l},draw_ffz_set:function(e,t){var n=document.createElement("div"),s=document.createElement("div"),i=[];n.className="heading",n.innerHTML='<span class="right">FrankerFaceZ</span>'+t.title,n.style.backgroundImage='url("'+(t.icon||"//cdn.frankerfacez.com/script/devicon.png")+'")',s.className="emoticon-grid",s.appendChild(n);for(var o in t.emoticons)t.emoticons.hasOwnProperty(o)&&!t.emoticons[o].hidden&&i.push(t.emoticons[o]);i.sort(function(e,t){var n=e.name.toLowerCase(),s=t.name.toLowerCase();return s>n?-1:n>s?1:e.id<t.id?-1:e.id>t.id?1:0});for(var a=0;a<i.length;a++){var r=i[a],c=document.createElement("span"),l='image-set(url("'+r.urls[1]+'") 1x';r.urls[2]&&(l+=', url("'+r.urls[2]+'") 2x'),r.urls[4]&&(l+=', url("'+r.urls[4]+'") 4x'),l+=")",c.className="emoticon tooltip",c.style.backgroundImage='url("'+r.urls[1]+'")',c.style.backgroundImage="-webkit-"+l,c.style.backgroundImage="-moz-"+l,c.style.backgroundImage="-ms-"+l,c.style.backgroudnImage=l,r.height&&(c.style.height=r.height+"px"),r.width&&(c.style.width=r.width+"px"),c.title=r.tooltip||r.name,c.addEventListener("click",this._add_emote.bind(this,e,r.name)),s.appendChild(c)}return s},draw_menu:function(e,t,s){if("my_emotes"===t.getAttribute("data-page")){t.innerHTML="";try{var i=this.get_user(),o=this.getEmotes(i&&i.login,null),a=[];for(var r in s)if(s.hasOwnProperty(r)&&(this.settings.global_emotes_in_menu||"0"!==r)){var c=s[r];c.length&&a.push([this._twitch_set_to_channel[r],n.menu_pages.my_emotes.draw_twitch_set.bind(this)(e,r,c)])}for(var l=0;l<o.length;l++){var r=o[l],c=this.emote_sets[r];c&&c.count&&(this.settings.global_emotes_in_menu||-1===this.default_sets.indexOf(r))&&a.push([c.title.toLowerCase(),n.menu_pages.my_emotes.draw_ffz_set.bind(this)(e,c)])}a.sort(function(e,t){var n=e[0],s=t[0];return"turbo"===n||"tfaces"===n?n="zza|"+n:("global"===n||"global emoticons"===n)&&(n="zzz|"+n),"turbo"===s||"tfaces"===s?s="zza|"+s:("global"===s||"global emoticons"===s)&&(s="zzz|"+s),s>n?-1:n>s?1:0});for(var l=0;l<a.length;l++)t.appendChild(a[l][1])}catch(u){this.error("my_emotes draw_menu: "+u),t.innerHTML="";var h=document.createElement("div"),d=document.createElement("div"),_=document.createElement("p");d.className="heading",d.innerHTML="Error Loading Menu",h.appendChild(d),_.className="clearfix",_.textContent=u,h.appendChild(_),h.className="chat-menu-content",t.appendChild(h)}}}}},{"../constants":3,"../utils":29}],24:[function(){var t=e.FrankerFaceZ;t.prototype.setup_notifications=function(){this.log("Adding event handler for window focus."),e.addEventListener("focus",this.clear_notifications.bind(this))},t.settings_info.highlight_notifications={type:"boolean",value:!1,category:"Chat",no_bttv:!0,name:"Highlight Notifications",help:"Display notifications when a highlighted word appears in chat in an unfocused tab.",on_update:function(e,t){if(e&&t){if("denied"===Notification.permission)return this.log("Notifications have been denied by the user."),void this.settings.set("highlight_notifications",!1);if("granted"!==Notification.permission){var n=this;Notification.requestPermission(function(e){"denied"===e&&(n.log("Notifications have been denied by the user."),n.settings.set("highlight_notifications",!1))})}}}},t.ws_commands.message=function(e){this.show_message(e)},t._notifications={},t._last_notification=0,t.prototype.clear_notifications=function(){for(var e in t._notifications){var n=t._notifications[e];if(n)try{n.close()}catch(s){}}t._notifications={},t._last_notification=0},t.prototype.show_notification=function(e,n,s,i,o,a){var r=Notification.permission;if("denied "===r)return!1;if("granted"===r){n=n||"FrankerFaceZ",i=i||1e4;var c={lang:"en-US",dir:"ltr",body:e,tag:s||"FrankerFaceZ",icon:"http://cdn.frankerfacez.com/icon32.png"},l=this,u=new Notification(n,c),h=t._last_notification++;return t._notifications[h]=u,u.addEventListener("click",function(){delete t._notifications[h],o&&o.bind(l)()}),u.addEventListener("close",function(){delete t._notifications[h],a&&a.bind(l)()}),void("number"==typeof i&&u.addEventListener("show",function(){setTimeout(function(){delete t._notifications[h],u.close()},i)}))}var l=this;Notification.requestPermission(function(){l.show_notification(e,n,s)})},t.prototype.show_message=function(t){e.noty({text:t,theme:"ffzTheme",layout:"bottomCenter",closeWith:["button"]}).show()}},{}],25:[function(t){var n=e.FrankerFaceZ,s=t("../utils");n.prototype.setup_races=function(){this.log("Initializing race support."),this.srl_races={}},n.settings_info.srl_races={type:"boolean",value:!0,category:"Channel Metadata",name:"SRL Race Information",help:'Display information about <a href="http://www.speedrunslive.com/" target="_new">SpeedRunsLive</a> races under channels.',on_update:function(){this.rebuild_race_ui()}},n.ws_on_close.push(function(){var t=e.App&&App.__container__.lookup("controller:channel"),n=t&&t.get("id"),s=!1;if(t){for(var i in this.srl_races)delete this.srl_races[i],i==n&&(s=!0);s&&this.rebuild_race_ui()}}),n.ws_commands.srl_race=function(e){for(var t=App.__container__.lookup("controller:channel"),n=t.get("id"),s=!1,i=0;i<e[0].length;i++){var o=e[0][i];this.srl_races[o]=e[1],o==n&&(s=!0)}if(e[1]){var a=e[1],r=a.twitch_entrants={};for(var c in a.entrants)a.entrants.hasOwnProperty(c)&&(a.entrants[c].channel&&(r[a.entrants[c].channel]=c),a.entrants[c].name=c)}s&&this.rebuild_race_ui()},n.prototype.rebuild_race_ui=function(){var e=App.__container__.lookup("controller:channel"),t=e.get("id"),n=this.srl_races[t],s=this.settings.srl_races,i=document.querySelector(".stats-and-actions .channel-actions"),o=i.querySelector("#ffz-ui-race");if(!n||!s)return o&&o.parentElement.removeChild(o),void(this._popup&&"ffz-race-popup"==this._popup.id&&(delete this._popup,this._popup_kill&&this._popup_kill(),delete this._popup_kill));if(o)return this._update_race(!0);o=document.createElement("span"),o.setAttribute("data-channel",t),o.id="ffz-ui-race";var a=document.createElement("span");a.className="button drop action",a.title="SpeedRunsLive Race",a.innerHTML='<span class="logo"><span>',a.addEventListener("click",this.build_race_popup.bind(this)),o.appendChild(a),i.appendChild(o),this._update_race(!0)},n.prototype._race_kill=function(){this._race_timer&&(clearTimeout(this._race_timer),delete this._race_timer),delete this._race_game,delete this._race_goal},n.prototype.build_race_popup=function(){var e=this._popup;if(!e||(e.parentElement.removeChild(e),delete this._popup,this._popup_kill&&this._popup_kill(),delete this._popup_kill,"ffz-race-popup"!=e.id)){var t=document.querySelector("#ffz-ui-race");if(t){var s=t.querySelector(".button"),i=s.offsetLeft+s.offsetWidth,o=t.getAttribute("data-channel"),a=this.srl_races[o],e=document.createElement("div"),r="";e.id="ffz-race-popup",e.className=(i>=300?"right":"left")+" share dropmenu",this._popup_kill=this._race_kill.bind(this),this._popup=e;var c="http://kadgar.net/live",l=!1;for(var u in a.entrants){var h=a.entrants[u].state;a.entrants.hasOwnProperty(u)&&a.entrants[u].channel&&("racing"==h||"entered"==h)&&(c+="/"+a.entrants[u].channel,l=!0)}var d=document.querySelector(".app-main.theatre")?document.body.clientHeight-300:t.parentElement.offsetTop-175,_=App.__container__.lookup("controller:channel"),f=_?_.get("display_name"):n.get_capitalization(o),m=encodeURIComponent("I'm watching "+f+" race "+a.goal+" in "+a.game+" on SpeedRunsLive!");r='<div class="heading"><div></div><span></span></div>',r+='<div class="table" style="max-height:'+d+'px"><table><thead><tr><th>#</th><th>Entrant</th><th>&nbsp;</th><th>Time</th></tr></thead>',r+="<tbody></tbody></table></div>",r+='<div class="divider"></div>',r+='<iframe class="twitter_share_button" style="width:130px; height:25px" src="https://platform.twitter.com/widgets/tweet_button.html?text='+m+"%20Watch%20at&via=Twitch&url=http://www.twitch.tv/"+o+'"></iframe>',r+='<p class="right"><a target="_new" href="http://www.speedrunslive.com/race/?id='+a.id+'">SRL</a>',l&&(r+=' &nbsp; <a target="_new" href="'+c+'">Multitwitch</a>'),r+="</p>",e.innerHTML=r,t.appendChild(e),this._update_race(!0)}}},n.prototype._update_race=function(e){this._race_timer&&e&&(clearTimeout(this._race_timer),delete this._race_timer);var t=document.querySelector("#ffz-ui-race");if(t){var n=t.getAttribute("data-channel"),i=this.srl_races[n];if(!i)return t.parentElement.removeChild(t),this._popup_kill&&this._popup_kill(),void(this._popup&&(delete this._popup,delete this._popup_kill));var o=i.twitch_entrants[n],a=i.entrants[o],r=t.querySelector("#ffz-race-popup"),c=Date.now()/1e3,l=Math.floor(c-i.time);if(t.querySelector(".logo").innerHTML=s.placement(a),r){var u=r.querySelector("tbody"),h=r.querySelector(".heading span"),d=r.querySelector(".heading div");u.innerHTML="";var _=[],f=!0;for(var m in i.entrants)i.entrants.hasOwnProperty(m)&&("racing"==i.entrants[m].state&&(f=!1),_.push(i.entrants[m]));_.sort(function(e,t){var n=e.place||9999,s=t.place||9999,i=e.time||l,o=t.time||l;return("forfeit"==e.state||"dq"==e.state)&&(n=1e4),("forfeit"==t.state||"dq"==t.state)&&(s=1e4),s>n?-1:n>s?1:e.name<t.name?-1:e.name>t.name?1:o>i?-1:i>o?1:void 0});for(var p=0;p<_.length;p++){var m=_[p],g='<a target="_new" href="http://www.speedrunslive.com/profiles/#!/'+s.sanitize(m.name)+'">'+m.display_name+"</a>",v=m.channel?'<a target="_new" class="twitch" href="http://www.twitch.tv/'+s.sanitize(m.channel)+'"></a>':"",b=m.hitbox?'<a target="_new" class="hitbox" href="http://www.hitbox.tv/'+s.sanitize(m.hitbox)+'"></a>':"",y=l?s.time_to_string(m.time||l):"",w=s.place_string(m.place),z=m.comment?s.sanitize(m.comment):"";u.innerHTML+="<tr"+(z?' title="'+z+'"':"")+' class="'+m.state+'"><td>'+w+"</td><td>"+g+"</td><td>"+v+b+'</td><td class="time">'+("forfeit"==m.state?"Forfeit":y)+"</td></tr>"}if(this._race_game!=i.game||this._race_goal!=i.goal){this._race_game=i.game,this._race_goal=i.goal;var k=s.sanitize(i.game),F=s.sanitize(i.goal);d.innerHTML='<h2 title="'+k+'">'+k+"</h2><b>Goal: </b>"+F}l?f?h.innerHTML="Done":(h.innerHTML=s.time_to_string(l),this._race_timer=setTimeout(this._update_race.bind(this),1e3)):h.innerHTML="Entry Open"}}}},{"../utils":29}],26:[function(t){var n=e.FrankerFaceZ,s=t("../constants");n.prototype.setup_css=function(){this.log("Injecting main FrankerFaceZ CSS.");var e=this._main_style=document.createElement("link");e.id="ffz-ui-css",e.setAttribute("rel","stylesheet"),e.setAttribute("href",s.SERVER+"script/style.css?_="+Date.now()),document.head.appendChild(e),jQuery.noty.themes.ffzTheme={name:"ffzTheme",style:function(){this.$bar.removeClass().addClass("noty_bar").addClass("ffz-noty").addClass(this.options.type)},callback:{onShow:function(){},onClose:function(){}}}}},{"../constants":3}],27:[function(t){var n=e.FrankerFaceZ,s=t("../constants"),i=t("../utils");n.prototype._update_subscribers=function(){this._update_subscribers_timer&&(clearTimeout(this._update_subscribers_timer),delete this._update_subscribers_timer);var e=this.get_user(),t=this,n=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0,o=this.is_dashboard&&n&&n[1];if(this.has_bttv||!o||o!==e.login){var a=document.querySelector("#ffz-sub-display");return void(a&&a.parentElement.removeChild(a))}this._update_subscribers_timer=setTimeout(this._update_subscribers.bind(this),6e4),jQuery.ajax({url:"/broadcast/dashboard/partnership"}).done(function(e){try{var n,a=document.createElement("span");a.innerHTML=e,n=a.querySelector("#dash_main");var r=n&&n.textContent.match(/([\d,\.]+) total active subscribers/),c=r&&r[1];if(!c){var l=document.querySelector("#ffz-sub-display");return l&&l.parentElement.removeChild(l),void(t._update_subscribers_timer&&(clearTimeout(t._update_subscribers_timer),delete t._update_subscribers_timer))}var l=document.querySelector("#ffz-sub-display span");if(!l){var u=document.querySelector(t.is_dashboard?"#stats":"#channel .stats-and-actions .channel-stats");if(!u)return;var h=document.createElement("span");h.className="ffz stat",h.id="ffz-sub-display",h.title="Active Channel Subscribers",h.innerHTML=s.STAR+" ",l=document.createElement("span"),h.appendChild(l),Twitch.api.get("chat/"+o+"/badges",null,{version:3}).done(function(e){e.subscriber&&e.subscriber.image&&(h.innerHTML="",h.appendChild(l),h.style.backgroundImage='url("'+e.subscriber.image+'")',h.style.backgroundRepeat="no-repeat",h.style.paddingLeft="23px",h.style.backgroundPosition="0 50%")}),u.appendChild(h),jQuery(h).tipsy(t.is_dashboard?{gravity:"s"}:void 0)}l.innerHTML=i.number_commas(parseInt(c))}catch(d){t.error("_update_subscribers: "+d)}}).fail(function(){var e=document.querySelector("#ffz-sub-display");e&&e.parentElement.removeChild(e)})}},{"../constants":3,"../utils":29}],28:[function(t){var n=e.FrankerFaceZ,s=t("../constants"),i=t("../utils");n.ws_commands.viewers=function(t){var n=t[0],o=t[1],a=e.App&&App.__container__.lookup("controller:channel"),r=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0,c=this.is_dashboard?r&&r[1]:a&&a.get&&a.get("id");if(!this.is_dashboard){var l=this.rooms&&this.rooms[n];return void(l&&(l.ffz_chatters=o,this._cindex&&this._cindex.ffzUpdateChatters()))}if(this.settings.chatter_count&&c===n){var u=document.querySelector("#ffz-ffzchatter-display"),h=s.ZREKNARF+" "+i.number_commas(o);if(u)u.innerHTML=h;else{var d=document.querySelector("#stats");if(!d)return;u=document.createElement("span"),u.id="ffz-ffzchatter-display",u.className="ffz stat",u.title="Chatters with FrankerFaceZ",u.innerHTML=h,d.appendChild(u),jQuery(u).tipsy(this.is_dashboard?{gravity:"s"}:void 0)}}}},{"../constants":3,"../utils":29}],29:[function(t,n){var s=(e.FrankerFaceZ,t("./constants"),{}),i=document.createElement("span"),o=function(e){return 1==e?"1st":2==e?"2nd":3==e?"3rd":null==e?"---":e+"th"},a=function(e,t){t=0===t?0:t||1,t=Math.round(255*-(t/100));var n=Math.max(0,Math.min(255,e[0]-t)),s=Math.max(0,Math.min(255,e[1]-t)),i=Math.max(0,Math.min(255,e[2]-t));return[n,s,i]},r=function(e){return"rgb("+e[0]+", "+e[1]+", "+e[2]+")"},c=function(e,t){return t=0===t?0:t||1,a(e,-t)},l=function(e){e=[e[0]/255,e[1]/255,e[2]/255];for(var t=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]},u=/^(\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){var t=e.match(u);if(!t)return null;var n=Date.UTC(t[1],t[2]-1,t[3],t[4],t[5],t[6],t[7]||0);if(t[9]){var s=6e4*("-"==t[9]?1:-1)*(60*t[10]+1*t[11]);n+=s}return new Date(n)};n.exports={update_css:function(e,t,n){var s=e.innerHTML,i="/*BEGIN "+t+"*/",o="/*END "+t+"*/",a=s.indexOf(i),r=s.indexOf(o),c=-1!==a&&-1!==r&&r>a;(c||n)&&(c&&(s=s.substr(0,a)+s.substr(r+o.length)),n&&(s+=i+n+o),e.innerHTML=s)},get_luminance:l,brighten:a,darken:c,rgb_to_css:r,parse_date:h,number_commas:function(e){var t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")},place_string:o,placement:function(e){return"forfeit"==e.state?"Forfeit":"dq"==e.state?"DQed":e.place?o(e.place):""},sanitize:function(e){var t=s[e];return t||(i.textContent=e,t=s[e]=i.innerHTML,i.innerHTML=""),t},date_string:function(e){return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()},time_to_string:function(e,t,n){var s=e%60,i=Math.floor(e/60),o=Math.floor(i/60),a="";if(i%=60,t){if(a=Math.floor(o/24),o%=24,n&&a>0)return a+" days";a=a>0?a+" days, ":""}return a+(10>o?"0":"")+o+":"+(10>i?"0":"")+i+":"+(10>s?"0":"")+s}}},{"./constants":3}]},{},[14]),e.ffz=new FrankerFaceZ}(window);