diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..f02b220c --- /dev/null +++ b/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# +# This file will compile the javascript libraries and +# the Handlebars templates. +# + +# Install Handlebars +if ! type handlebars &> /dev/null; then + sudo npm -g install handlebars +fi + +# Compile the templates +handlebars -e tpl -f client/js/shout.templates.js client/templates/ + +# Uglify the javascript libraries +# See: Gruntfile.js +grunt uglify diff --git a/client/dist/build.js b/client/dist/build.js index d4c0bef2..c5b6c99b 100644 --- a/client/dist/build.js +++ b/client/dist/build.js @@ -6,4 +6,5 @@ n.fn.extend({val:function(a){var b,c,d,e=this[0];if(!arguments.length){if(e){b=n return}g=H(a,c);i[g.key]=i[g.key]||[];u(g.key,g.modifiers,{type:g.action},d,a,e);i[g.key][d?"unshift":"push"]({callback:b,modifiers:g.modifiers,action:g.action,seq:d,level:e,combo:a})}function J(a,b,c){for(var d=0;d-1){return false}return b.tagName=="INPUT"||b.tagName=="SELECT"||b.tagName=="TEXTAREA"||b.isContentEditable},handleKey:z};a.Mousetrap=K;if(typeof define==="function"&&define.amd){define(K)}})(window,document);(function(a){a.fn.sticky=function(){if(this.size()>1){return this.each(function(){a(this).sticky(options)})}var c=false;var d=this;this.unbind(".sticky");this.on("beforeAppend.sticky",function(){c=b.call(d)});this.on("afterAppend.sticky",function(){if(c){d.scrollBottom()}});var e=this.css("overflow-y");if(e=="visible"){e="auto"}this.css({"overflow-y":e});a(window).unbind(".sticky");a(window).on("resize.sticky",function(){d.scrollBottom()});this.scrollBottom();return this};a.fn.scrollBottom=function(){return this.each(function(){a(this).animate({scrollTop:this.scrollHeight},0)})};function b(){if(this.scrollTop()+this.outerHeight()+1>=this.prop("scrollHeight")){return true}else{return false}}var c=a.fn.append;a.fn.append=function(){this.trigger("beforeAppend");c.apply(this,arguments).trigger("afterAppend");return this}})(jQuery);(function(a){var b={backspace:8,tab:9,up:38,down:40};a.tabcomplete={};a.tabcomplete.defaultOptions={after:"",arrowKeys:false,caseSensitive:false,hint:"placeholder",minLength:1};a.fn.tab=a.fn.tabcomplete=function(f,g){if(this.length>1){return this.each(function(){a(this).tabcomplete(f,g)})}var h=this.prop("tagName");if(h!="INPUT"&&h!="TEXTAREA"){return}g=a.extend(a.tabcomplete.defaultOptions,g);this.unbind(".tabcomplete");this.prev(".hint").remove();var i=this;var j=false;var k=-1;var l=[];var m="";var n=a.noop;switch(g.hint){case"placeholder":n=d;break;case"select":n=e;break}this.on("input.tabcomplete",function(){var b=i.val();var d=b.split(/ |\n/).pop();k=-1;m="";l=[];if(i[0].selectionStart==b.length&&d.length){if(typeof f==="function"){l=f(d)}else{l=c(d,f,g.caseSensitive)}if(g.after){l=a.map(l,function(a){return a+g.after})}}i.trigger("match",l.length);if(g.hint){if(!(g.hint=="select"&&j)&&d.length>=g.minLength){n.call(i,l[0])}else{n.call(i,"")}}if(j){j=false}});this.on("keydown.tabcomplete",function(a){var c=a.which;if(c==b.tab||g.arrowKeys&&(c==b.up||c==b.down)){a.preventDefault();if(c!=b.up){k++}else{if(k==-1)return;if(k==0){k=l.length-1}else{k--}}var d=l[k%l.length];if(!d){return}var e=i.val();m=m||e.split(/ |\n/).pop();if(m.length").css({position:"relative",height:c.css("height")}));d=c.clone().attr("tabindex",-1).removeAttr("id name placeholder").addClass("hint").insertBefore(c);d.css({position:"absolute"})}var e="";if(typeof b!=="undefined"){var f=c.val();e=f+b.substr(f.split(/ |\n/).pop().length)}d.val(e)}function e(a){var b=this;var c=b.val();if(a){b.val(c+a.substr(c.split(/ |\n/).pop().length));b[0].selectionStart=c.length}}})(jQuery);(function(a){var b,c="2.7.0",d=typeof global!=="undefined"?global:this,e,f=Math.round,g,h=0,i=1,j=2,k=3,l=4,m=5,n=6,o={},p={_isAMomentObject:null,_i:null,_f:null,_l:null,_strict:null,_tzm:null,_isUTC:null,_offset:null,_pf:null,_lang:null},q=typeof module!=="undefined"&&module.exports,r=/^\/?Date\((\-?\d+)/i,s=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,t=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,u=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,v=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,w=/\d\d?/,x=/\d{1,3}/,y=/\d{1,4}/,z=/[+\-]?\d{1,6}/,A=/\d+/,B=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,C=/Z|[\+\-]\d\d:?\d\d/gi,D=/T/i,E=/[\+\-]?\d+(\.\d{1,3})?/,F=/\d{1,2}/,G=/\d/,H=/\d\d/,I=/\d{3}/,J=/\d{4}/,K=/[+-]?\d{6}/,L=/[+-]?\d+/,M=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,N="YYYY-MM-DDTHH:mm:ssZ",O=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],P=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Q=/([\+\-]|\d\d)/gi,R="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),S={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},T={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},U={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},V={},W={s:45,m:45,h:22,dd:25,dm:45,dy:345},X="DDD w W M D d".split(" "),Y="M D H h m s w W".split(" "),Z={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return kb(this.year()%100,2)},YYYY:function(){return kb(this.year(),4)},YYYYY:function(){return kb(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+kb(Math.abs(a),6)},gg:function(){return kb(this.weekYear()%100,2)},gggg:function(){return kb(this.weekYear(),4)},ggggg:function(){return kb(this.weekYear(),5)},GG:function(){return kb(this.isoWeekYear()%100,2)},GGGG:function(){return kb(this.isoWeekYear(),4)},GGGGG:function(){return kb(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),true)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),false)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return sb(this.milliseconds()/100)},SS:function(){return kb(sb(this.milliseconds()/10),2)},SSS:function(){return kb(this.milliseconds(),3)},SSSS:function(){return kb(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";if(a<0){a=-a;b="-"}return b+kb(sb(a/60),2)+":"+kb(sb(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";if(a<0){a=-a;b="-"}return b+kb(sb(a/60),2)+kb(sb(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},$=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];function _(a,b,c){switch(arguments.length){case 2:return a!=null?a:b;case 3:return a!=null?a:b!=null?b:c;default:throw new Error("Implement me")}}function ab(){return{empty:false,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:false,invalidMonth:null,invalidFormat:false,userInvalidated:false,iso:false}}function bb(a,c){var d=true;function e(){if(b.suppressDeprecationWarnings===false&&typeof console!=="undefined"&&console.warn){console.warn("Deprecation warning: "+a)}}return hb(function(){if(d){e();d=false}return c.apply(this,arguments)},c)}function cb(a,b){return function(c){return kb(a.call(this,c),b)}}function db(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}while(X.length){g=X.pop();Z[g+"o"]=db(Z[g],g)}while(Y.length){g=Y.pop();Z[g+g]=cb(Z[g],2)}Z.DDDD=cb(Z.DDD,3);function eb(){}function fb(a){xb(a);hb(this,a)}function gb(a){var b=qb(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+j*1e3+i*6e4+h*36e5;this._days=+g+f*7;this._months=+e+d*3+c*12;this._data={};this._bubble()}function hb(a,b){for(var c in b){if(b.hasOwnProperty(c)){a[c]=b[c]}}if(b.hasOwnProperty("toString")){a.toString=b.toString}if(b.hasOwnProperty("valueOf")){a.valueOf=b.valueOf}return a}function ib(a){var b={},c;for(c in a){if(a.hasOwnProperty(c)&&p.hasOwnProperty(c)){b[c]=a[c]}}return b}function jb(a){if(a<0){return Math.ceil(a)}else{return Math.floor(a)}}function kb(a,b,c){var d=""+Math.abs(a),e=a>=0;while(d.length=0){c=Math.floor(b)}else{c=Math.ceil(b)}}return c}function tb(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function ub(a,c,d){return _b(b([a,11,31+c-d]),c,d).week}function vb(a){return wb(a)?366:365}function wb(a){return a%4===0&&a%100!==0||a%400===0}function xb(a){var b;if(a._a&&a._pf.overflow===-2){b=a._a[i]<0||a._a[i]>11?i:a._a[j]<1||a._a[j]>tb(a._a[h],a._a[i])?j:a._a[k]<0||a._a[k]>23?k:a._a[l]<0||a._a[l]>59?l:a._a[m]<0||a._a[m]>59?m:a._a[n]<0||a._a[n]>999?n:-1;if(a._pf._overflowDayOfYear&&(bj)){b=j}a._pf.overflow=b}}function yb(a){if(a._isValid==null){a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated;if(a._strict){a._isValid=a._isValid&&a._pf.charsLeftOver===0&&a._pf.unusedTokens.length===0}}return a._isValid}function zb(a){return a?a.toLowerCase().replace("_","-"):a}function Ab(a,c){return c._isUTC?b(a).zone(c._offset||0):b(a).local()}hb(eb.prototype,{set:function(a){var b,c;for(c in a){b=a[c];if(typeof b==="function"){this[c]=b}else{this["_"+c]=b}}},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var c,d,e;if(!this._monthsParse){this._monthsParse=[]}for(c=0;c<12;c++){if(!this._monthsParse[c]){d=b.utc([2e3,c]);e="^"+this.months(d,"")+"|^"+this.monthsShort(d,"");this._monthsParse[c]=new RegExp(e.replace(".",""),"i")}if(this._monthsParse[c].test(a)){return c}}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var c,d,e;if(!this._weekdaysParse){this._weekdaysParse=[]}for(c=0;c<7;c++){if(!this._weekdaysParse[c]){d=b([2e3,1]).day(c);e="^"+this.weekdays(d,"")+"|^"+this.weekdaysShort(d,"")+"|^"+this.weekdaysMin(d,"");this._weekdaysParse[c]=new RegExp(e.replace(".",""),"i")}if(this._weekdaysParse[c].test(a)){return c}}},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];if(!b&&this._longDateFormat[a.toUpperCase()]){b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)});this._longDateFormat[a]=b}return b},isPM:function(a){return(a+"").toLowerCase().charAt(0)==="p"},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){if(a>11){return c?"pm":"PM"}else{return c?"am":"AM"}},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return typeof c==="function"?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return typeof e==="function"?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return typeof c==="function"?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return _b(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}});function Bb(a,b){b.abbr=a;if(!o[a]){o[a]=new eb}o[a].set(b);return o[a]}function Cb(a){delete o[a]}function Db(a){var c=0,d,e,f,g,h=function(a){if(!o[a]&&q){try{require("./lang/"+a)}catch(b){}}return o[a]};if(!a){return b.fn._lang}if(!mb(a)){e=h(a);if(e){return e}a=[a]}while(c0){e=h(g.slice(0,d).join("-"));if(e){return e}if(f&&f.length>=d&&ob(g,f,true)>=d-1){break}d--}c++}return b.fn._lang}function Eb(a){if(a.match(/\[[\s\S]/)){return a.replace(/^\[|\]$/g,"")}return a.replace(/\\/g,"")}function Fb(a){var b=a.match(u),c,d;for(c=0,d=b.length;c=0&&v.test(a)){a=a.replace(v,d);v.lastIndex=0;c-=1}return a}function Ib(a,b){var c,d=b._strict;switch(a){case"Q":return G;case"DDDD":return I;case"YYYY":case"GGGG":case"gggg":return d?J:y;case"Y":case"G":case"g":return L;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?K:z;case"S":if(d){return G}case"SS":if(d){return H}case"SSS":if(d){return I}case"DDD":return x;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return B;case"a":case"A":return Db(b._l)._meridiemParse;case"X":return E;case"Z":case"ZZ":return C;case"T":return D;case"SSSS":return A;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?H:w;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return w;case"Do":return F;default:c=new RegExp(Rb(Qb(a.replace("\\","")),"i"));return c}}function Jb(a){a=a||"";var b=a.match(C)||[],c=b[b.length-1]||[],d=(c+"").match(Q)||["-",0,0],e=+(d[1]*60)+sb(d[2]);return d[0]==="+"?-e:e}function Kb(a,c,d){var e,f=d._a;switch(a){case"Q":if(c!=null){f[i]=(sb(c)-1)*3}break;case"M":case"MM":if(c!=null){f[i]=sb(c)-1}break;case"MMM":case"MMMM":e=Db(d._l).monthsParse(c);if(e!=null){f[i]=e}else{d._pf.invalidMonth=c}break;case"D":case"DD":if(c!=null){f[j]=sb(c)}break;case"Do":if(c!=null){f[j]=sb(parseInt(c,10))}break;case"DDD":case"DDDD":if(c!=null){d._dayOfYear=sb(c)}break;case"YY":f[h]=b.parseTwoDigitYear(c);break;case"YYYY":case"YYYYY":case"YYYYYY":f[h]=sb(c);break;case"a":case"A":d._isPm=Db(d._l).isPM(c);break;case"H":case"HH":case"h":case"hh":f[k]=sb(c);break;case"m":case"mm":f[l]=sb(c);break;case"s":case"ss":f[m]=sb(c);break;case"S":case"SS":case"SSS":case"SSSS":f[n]=sb(("0."+c)*1e3);break;case"X":d._d=new Date(parseFloat(c)*1e3);break;case"Z":case"ZZ":d._useUTC=true;d._tzm=Jb(c);break;case"dd":case"ddd":case"dddd":e=Db(d._l).weekdaysParse(c);if(e!=null){d._w=d._w||{};d._w["d"]=e}else{d._pf.invalidWeekday=c}break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2);if(c){d._w=d._w||{};d._w[a]=sb(c)}break;case"gg":case"GG":d._w=d._w||{};d._w[a]=b.parseTwoDigitYear(c)}}function Lb(a){var c,d,e,f,g,i,j,k;c=a._w;if(c.GG!=null||c.W!=null||c.E!=null){g=1;i=4;d=_(c.GG,a._a[h],_b(b(),1,4).year);e=_(c.W,1);f=_(c.E,1)}else{k=Db(a._l);g=k._week.dow;i=k._week.doy;d=_(c.gg,a._a[h],_b(b(),g,i).year);e=_(c.w,1);if(c.d!=null){f=c.d;if(fvb(f)){a._pf._overflowDayOfYear=true}c=Xb(f,0,a._dayOfYear);a._a[i]=c.getUTCMonth();a._a[j]=c.getUTCDate()}for(b=0;b<3&&a._a[b]==null;++b){a._a[b]=d[b]=e[b]}for(;b<7;b++){a._a[b]=d[b]=a._a[b]==null?b===2?1:0:a._a[b]}a._d=(a._useUTC?Xb:Wb).apply(null,d);if(a._tzm!=null){a._d.setUTCMinutes(a._d.getUTCMinutes()+a._tzm)}}function Nb(a){var b;if(a._d){return}b=qb(a._i);a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond];Mb(a)}function Ob(a){var b=new Date;if(a._useUTC){return[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]}else{return[b.getFullYear(),b.getMonth(),b.getDate()]}}function Pb(a){if(a._f===b.ISO_8601){Tb(a);return}a._a=[];a._pf.empty=true;var c=Db(a._l),d=""+a._i,e,f,g,h,i,j=d.length,l=0;g=Hb(a._f,c).match(u)||[];for(e=0;e0){a._pf.unusedInput.push(i)}d=d.slice(d.indexOf(f)+f.length);l+=f.length}if(Z[h]){if(f){a._pf.empty=false}else{a._pf.unusedTokens.push(h)}Kb(h,f,a)}else if(a._strict&&!f){a._pf.unusedTokens.push(h)}}a._pf.charsLeftOver=j-l;if(d.length>0){a._pf.unusedInput.push(d)}if(a._isPm&&a._a[k]<12){a._a[k]+=12}if(a._isPm===false&&a._a[k]===12){a._a[k]=0}Mb(a);xb(a)}function Qb(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function Rb(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Sb(a){var b,c,d,e,f;if(a._f.length===0){a._pf.invalidFormat=true;a._d=new Date(NaN);return}for(e=0;e0;j[4]=c;return Zb.apply({},j)}function _b(a,c,d){var e=d-c,f=d-a.day(),g;if(f>e){f-=7}if(fd?7:0)-(f0?a:a-1,dayOfYear:h>0?h:vb(a-1)+h}}function bc(c){var d=c._i,e=c._f;if(d===null||e===a&&d===""){return b.invalid({nullInput:true})}if(typeof d==="string"){c._i=d=Db().preparse(d)}if(b.isMoment(d)){c=ib(d);c._d=new Date(+d._d)}else if(e){if(mb(e)){Sb(c)}else{Pb(c)}}else{Vb(c)}return new fb(c)}b=function(b,c,d,e){var f;if(typeof d==="boolean"){e=d;d=a}f={};f._isAMomentObject=true;f._i=b;f._f=c;f._l=d;f._strict=e;f._isUTC=false;f._pf=ab();return bc(f)};b.suppressDeprecationWarnings=false;b.createFromInputFallback=bb("moment construction falls back to js Date. This is "+"discouraged and will be removed in upcoming major "+"release. Please refer to "+"https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i)});function cc(a,c){var d,e;if(c.length===1&&mb(c[0])){c=c[0]}if(!c.length){return b()}d=c[0];for(e=1;e=0;--g){rb($[g])}b.normalizeUnits=function(a){return pb(a)};b.invalid=function(a){var c=b.utc(NaN);if(a!=null){hb(c._pf,a)}else{c._pf.userInvalidated=true}return c};b.parseZone=function(){return b.apply(null,arguments).parseZone()};b.parseTwoDigitYear=function(a){return sb(a)+(sb(a)>68?1900:2e3)};hb(b.fn=fb.prototype,{clone:function(){return b(this)},valueOf:function(){return+this._d+(this._offset||0)*6e4},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=b(this).utc();if(00}return false},parsingFlags:function(){return hb({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){this.zone(0);this._isUTC=false;return this},format:function(a){var c=Gb(this,a||b.defaultFormat);return this.lang().postformat(c)},add:function(a,c){var d;if(typeof a==="string"&&typeof c==="string"){d=b.duration(isNaN(+c)?+a:+c,isNaN(+c)?c:a)}else if(typeof a==="string"){d=b.duration(+c,a)}else{d=b.duration(a,c)}lb(this,d,1);return this},subtract:function(a,c){var d;if(typeof a==="string"&&typeof c==="string"){d=b.duration(isNaN(+c)?+a:+c,isNaN(+c)?c:a)}else if(typeof a==="string"){d=b.duration(+c,a)}else{d=b.duration(a,c)}lb(this,d,-1);return this},diff:function(a,c,d){var e=Ab(a,this),f=(this.zone()-e.zone())*6e4,g,h;c=pb(c);if(c==="year"||c==="month"){g=(this.daysInMonth()+e.daysInMonth())*432e5;h=(this.year()-e.year())*12+(this.month()-e.month());h+=(this-b(this).startOf("month")-(e-b(e).startOf("month")))/g;h-=(this.zone()-b(this).startOf("month").zone()-(e.zone()-b(e).startOf("month").zone()))*6e4/g;if(c==="year"){h=h/12}}else{g=this-e;h=c==="second"?g/1e3:c==="minute"?g/6e4:c==="hour"?g/36e5:c==="day"?(g-f)/864e5:c==="week"?(g-f)/6048e5:g}return d?h:jb(h)},from:function(a,c){return b.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!c)},fromNow:function(a){return this.from(b(),a)},calendar:function(a){var c=a||b(),d=Ab(c,this).startOf("day"),e=this.diff(d,"days",true),f=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(f,this))},isLeapYear:function(){return wb(this.year())},isDST:function(){return this.zone()+b(a).startOf(c)},isBefore:function(a,c){c=typeof c!=="undefined"?c:"millisecond";return+this.clone().startOf(c)<+b(a).startOf(c)},isSame:function(a,b){b=b||"ms";return+this.clone().startOf(b)===+Ab(a,this).startOf(b)},min:bb("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){a=b.apply(null,arguments);return athis?this:a}),zone:function(a,c){var d=this._offset||0;if(a!=null){if(typeof a==="string"){a=Jb(a)}if(Math.abs(a)<16){a=a*60}this._offset=a;this._isUTC=true;if(d!==a){if(!c||this._changeInProgress){lb(this,b.duration(d-a,"m"),1,false)}else if(!this._changeInProgress){this._changeInProgress=true;b.updateOffset(this,true);this._changeInProgress=null}}}else{return this._isUTC?d:this._d.getTimezoneOffset()}return this},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){if(this._tzm){this.zone(this._tzm)}else if(typeof this._i==="string"){this.zone(this._i)}return this},hasAlignedHourOffset:function(a){if(!a){a=0}else{a=b(a).zone()}return(this.zone()-a)%60===0},daysInMonth:function(){return tb(this.year(),this.month())},dayOfYear:function(a){var c=f((b(this).startOf("day")-b(this).startOf("year"))/864e5)+1;return a==null?c:this.add("d",a-c)},quarter:function(a){return a==null?Math.ceil((this.month()+1)/3):this.month((a-1)*3+this.month()%3)},weekYear:function(a){var b=_b(this,this.lang()._week.dow,this.lang()._week.doy).year;return a==null?b:this.add("y",a-b)},isoWeekYear:function(a){var b=_b(this,1,4).year;return a==null?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return a==null?b:this.add("d",(a-b)*7)},isoWeek:function(a){var b=_b(this,1,4).week;return a==null?b:this.add("d",(a-b)*7)},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return a==null?b:this.add("d",a-b)},isoWeekday:function(a){return a==null?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return ub(this.year(),1,4)},weeksInYear:function(){var a=this._lang._week;return ub(this.year(),a.dow,a.doy)},get:function(a){a=pb(a);return this[a]()},set:function(a,b){a=pb(a);if(typeof this[a]==="function"){this[a](b)}return this},lang:function(b){if(b===a){return this._lang}else{this._lang=Db(b);return this}}});function dc(a,b){var c;if(typeof b==="string"){b=a.lang().monthsParse(b);if(typeof b!=="number"){return a}}c=Math.min(a.date(),tb(a.year(),b));a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c);return a}function ec(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function fc(a,b,c){if(b==="Month"){return dc(a,c)}else{return a._d["set"+(a._isUTC?"UTC":"")+b](c)}}function gc(a,c){return function(d){if(d!=null){fc(this,a,d);b.updateOffset(this,c);return this}else{return ec(this,a)}}}b.fn.millisecond=b.fn.milliseconds=gc("Milliseconds",false);b.fn.second=b.fn.seconds=gc("Seconds",false);b.fn.minute=b.fn.minutes=gc("Minutes",false);b.fn.hour=b.fn.hours=gc("Hours",true);b.fn.date=gc("Date",true);b.fn.dates=bb("dates accessor is deprecated. Use date instead.",gc("Date",true));b.fn.year=gc("FullYear",true);b.fn.years=bb("years accessor is deprecated. Use year instead.",gc("FullYear",true));b.fn.days=b.fn.day;b.fn.months=b.fn.month;b.fn.weeks=b.fn.week;b.fn.isoWeeks=b.fn.isoWeek;b.fn.quarters=b.fn.quarter;b.fn.toJSON=b.fn.toISOString;hb(b.duration.fn=gb.prototype,{_bubble:function(){var a=this._milliseconds,b=this._days,c=this._months,d=this._data,e,f,g,h;d.milliseconds=a%1e3;e=jb(a/1e3);d.seconds=e%60;f=jb(e/60);d.minutes=f%60;g=jb(f/60);d.hours=g%24;b+=jb(g/24);d.days=b%30;c+=jb(b/30);d.months=c%12;h=jb(c/12);d.years=h},weeks:function(){return jb(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months%12*2592e6+sb(this._months/12)*31536e6},humanize:function(a){var b=+this,c=$b(b,!a,this.lang());if(a){c=this.lang().pastFuture(b,c)}return this.lang().postformat(c)},add:function(a,c){var d=b.duration(a,c);this._milliseconds+=d._milliseconds;this._days+=d._days;this._months+=d._months;this._bubble();return this},subtract:function(a,c){var d=b.duration(a,c);this._milliseconds-=d._milliseconds;this._days-=d._days;this._months-=d._months;this._bubble();return this},get:function(a){a=pb(a);return this[a.toLowerCase()+"s"]()},as:function(a){a=pb(a); return this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:b.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);if(!this.asSeconds()){return"P0D"}return(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":"")}});function hc(a){b.duration.fn[a]=function(){return this._data[a]}}function ic(a,c){b.duration.fn["as"+a]=function(){return+this/c}}for(g in S){if(S.hasOwnProperty(g)){ic(g,S[g]);hc(g.toLowerCase())}}ic("Weeks",6048e5);b.duration.fn.asMonths=function(){return(+this-this.years()*31536e6)/2592e6+this.years()*12};b.lang("en",{ordinal:function(a){var b=a%10,c=sb(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th";return a+c}});function jc(a){if(typeof ender!=="undefined"){return}e=d.moment;if(a){d.moment=bb("Accessing Moment through the global scope is "+"deprecated, and will be removed in an upcoming "+"release.",b)}else{d.moment=b}}if(q){module.exports=b}else if(typeof define==="function"&&define.amd){define("moment",function(a,c,f){if(f.config&&f.config()&&f.config().noGlobal===true){d.moment=e}return b});jc(true)}else{jc()}}).call(this);!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.io=a():"undefined"!=typeof global?global.io=a():"undefined"!=typeof self&&(self.io=a())}(function(){var a,b,c;return function d(a,b,c){function e(g,h){if(!b[g]){if(!a[g]){var i=typeof require=="function"&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=b[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,d,a,b,c)}return b[g].exports}var f=typeof require=="function"&&require;for(var g=0;g0&&!this.encoding){var a=this.packetBuffer.shift();this.packet(a)}};m.prototype.cleanup=function(){var a;while(a=this.subs.shift())a.destroy();this.packetBuffer=[];this.encoding=false;this.decoder.destroy()};m.prototype.close=m.prototype.disconnect=function(){this.skipReconnect=true;this.engine.close()};m.prototype.onclose=function(a){l("close");this.cleanup();this.readyState="closed";this.emit("close",a);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};m.prototype.reconnect=function(){if(this.reconnecting)return this;var a=this;this.attempts++;if(this.attempts>this._reconnectionAttempts){l("reconnect failed");this.emitAll("reconnect_failed");this.reconnecting=false}else{var b=this.attempts*this.reconnectionDelay();b=Math.min(b,this.reconnectionDelayMax());l("will wait %dms before reconnect attempt",b);this.reconnecting=true;var c=setTimeout(function(){l("attempting reconnect");a.emitAll("reconnect_attempt",a.attempts);a.emitAll("reconnecting",a.attempts);a.open(function(b){if(b){l("reconnect attempt error");a.reconnecting=false;a.reconnect();a.emitAll("reconnect_error",b.data)}else{l("reconnect success");a.onreconnect()}})},b);this.subs.push({destroy:function(){clearTimeout(c)}})}};m.prototype.onreconnect=function(){var a=this.attempts;this.attempts=0;this.reconnecting=false;this.emitAll("reconnect",a)}},{"./on":4,"./socket":5,"./url":6,"component-bind":7,"component-emitter":8,debug:9,"engine.io-client":11,"object-component":37,"socket.io-parser":40}],4:[function(a,b,c){b.exports=d;function d(a,b,c){a.on(b,c);return{destroy:function(){a.removeListener(b,c)}}}},{}],5:[function(a,b,c){var d=a("socket.io-parser");var e=a("component-emitter");var f=a("to-array");var g=a("./on");var h=a("component-bind");var i=a("debug")("socket.io-client:socket");var j=a("has-binary-data");var k=a("indexof");b.exports=c=n;var l={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1};var m=e.prototype.emit;function n(a,b){this.io=a;this.nsp=b;this.json=this;this.ids=0;this.acks={};this.open();this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true;this.subEvents()}e(n.prototype);n.prototype.subEvents=function(){var a=this.io;this.subs=[g(a,"open",h(this,"onopen")),g(a,"packet",h(this,"onpacket")),g(a,"close",h(this,"onclose"))]};n.prototype.open=n.prototype.connect=function(){if(this.connected)return this;this.io.open();if("open"==this.io.readyState)this.onopen();return this};n.prototype.send=function(){var a=f(arguments);a.unshift("message");this.emit.apply(this,a);return this};n.prototype.emit=function(a){if(l.hasOwnProperty(a)){m.apply(this,arguments);return this}var b=f(arguments);var c=d.EVENT;if(j(b)){c=d.BINARY_EVENT}var e={type:c,data:b};if("function"==typeof b[b.length-1]){i("emitting packet with ack id %d",this.ids);this.acks[this.ids]=b.pop();e.id=this.ids++}if(this.connected){this.packet(e)}else{this.sendBuffer.push(e)}return this};n.prototype.packet=function(a){a.nsp=this.nsp;this.io.packet(a)};n.prototype.onopen=function(){i("transport is open - connecting");if("/"!=this.nsp){this.packet({type:d.CONNECT})}};n.prototype.onclose=function(a){i("close (%s)",a);this.connected=false;this.disconnected=true;this.emit("disconnect",a)};n.prototype.onpacket=function(a){if(a.nsp!=this.nsp)return;switch(a.type){case d.CONNECT:this.onconnect();break;case d.EVENT:this.onevent(a);break;case d.BINARY_EVENT:this.onevent(a);break;case d.ACK:this.onack(a);break;case d.BINARY_ACK:this.onack(a);break;case d.DISCONNECT:this.ondisconnect();break;case d.ERROR:this.emit("error",a.data);break}};n.prototype.onevent=function(a){var b=a.data||[];i("emitting event %j",b);if(null!=a.id){i("attaching ack callback to event");b.push(this.ack(a.id))}if(this.connected){m.apply(this,b)}else{this.receiveBuffer.push(b)}};n.prototype.ack=function(a){var b=this;var c=false;return function(){if(c)return;c=true;var e=f(arguments);i("sending ack %j",e);var g=j(e)?d.BINARY_ACK:d.ACK;b.packet({type:g,id:a,data:e})}};n.prototype.onack=function(a){i("calling ack %s with %j",a.id,a.data);var b=this.acks[a.id];b.apply(this,a.data);delete this.acks[a.id]};n.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};n.prototype.emitBuffered=function(){var a;for(a=0;a=d)return(a/d).toFixed(1)+"h";if(a>=c)return(a/c).toFixed(1)+"m";if(a>=b)return(a/b|0)+"s";return a+"ms"};d.enabled=function(a){for(var b=0,c=d.skips.length;b';i=document.createElement(b)}catch(a){i=document.createElement("iframe");i.name=c.iframeId;i.src="javascript:0"}i.id=c.iframeId;c.form.appendChild(i);c.iframe=i}k();a=a.replace(h,"\\\n");this.area.value=a.replace(g,"\\n");try{this.form.submit()}catch(l){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(c.iframe.readyState=="complete"){j()}}}else{this.iframe.onload=j}}},{"./polling":18,"component-inherit":21}],17:[function(a,b,c){var d=typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var e=a("xmlhttprequest");var f=a("./polling");var g=a("component-emitter");var h=a("component-inherit");var i=a("debug")("engine.io-client:polling-xhr");b.exports=k;b.exports.Request=l;function j(){}function k(a){f.call(this,a);if(d.location){var b="https:"==location.protocol;var c=location.port;if(!c){c=b?443:80}this.xd=a.hostname!=d.location.hostname||c!=a.port}}h(k,f);k.prototype.supportsBinary=true;k.prototype.request=function(a){a=a||{};a.uri=this.uri();a.xd=this.xd;a.agent=this.agent||false;a.supportsBinary=this.supportsBinary;return new l(a)};k.prototype.doWrite=function(a,b){var c=typeof a!=="string"&&a!==undefined;var d=this.request({method:"POST",data:a,isBinary:c});var e=this;d.on("success",b);d.on("error",function(a){e.onError("xhr post error",a)});this.sendXhr=d};k.prototype.doPoll=function(){i("xhr poll");var a=this.request();var b=this;a.on("data",function(a){b.onData(a)});a.on("error",function(a){b.onError("xhr poll error",a)});this.pollXhr=a};function l(a){this.method=a.method||"GET";this.uri=a.uri;this.xd=!!a.xd;this.async=false!==a.async;this.data=undefined!=a.data?a.data:null;this.agent=a.agent;this.create(a.isBinary,a.supportsBinary)}g(l.prototype);l.prototype.create=function(a,b){var c=this.xhr=new e({agent:this.agent,xdomain:this.xd});var f=this;try{i("xhr open %s: %s",this.method,this.uri);c.open(this.method,this.uri,this.async);if(b){c.responseType="arraybuffer"}if("POST"==this.method){try{if(a){c.setRequestHeader("Content-type","application/octet-stream")}else{c.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(g){}}if("withCredentials"in c){c.withCredentials=true}c.onreadystatechange=function(){var a;try{if(4!=c.readyState)return;if(200==c.status||1223==c.status){var d=c.getResponseHeader("Content-Type");if(d==="application/octet-stream"){a=c.response}else{if(!b){a=c.responseText}else{a="ok"}}}else{setTimeout(function(){f.onError(c.status)},0)}}catch(e){f.onError(e)}if(null!=a){f.onData(a)}};i("xhr data %s",this.data);c.send(this.data)}catch(g){setTimeout(function(){f.onError(g)},0);return}if(d.document){this.index=l.requestsCount++;l.requests[this.index]=this}};l.prototype.onSuccess=function(){this.emit("success");this.cleanup()};l.prototype.onData=function(a){this.emit("data",a);this.onSuccess()};l.prototype.onError=function(a){this.emit("error",a);this.cleanup()};l.prototype.cleanup=function(){if("undefined"==typeof this.xhr||null===this.xhr){return}this.xhr.onreadystatechange=j;try{this.xhr.abort()}catch(a){}if(d.document){delete l.requests[this.index]}this.xhr=null};l.prototype.abort=function(){this.cleanup()};if(d.document){l.requestsCount=0;l.requests={};if(d.attachEvent){d.attachEvent("onunload",m)}else if(d.addEventListener){d.addEventListener("beforeunload",m)}}function m(){for(var a in l.requests){if(l.requests.hasOwnProperty(a)){l.requests[a].abort()}}}},{"./polling":18,"component-emitter":8,"component-inherit":21,debug:9,xmlhttprequest:20}],18:[function(a,b,c){var d=a("../transport");var e=a("parseqs");var f=a("engine.io-parser");var g=a("component-inherit");var h=a("debug")("engine.io-client:polling");b.exports=j;var i=function(){var b=a("xmlhttprequest");var c=new b({agent:this.agent,xdomain:false});return null!=c.responseType}();function j(a){var b=a&&a.forceBase64;if(!i||b){this.supportsBinary=false}d.call(this,a)}g(j,d);j.prototype.name="polling";j.prototype.doOpen=function(){this.poll()};j.prototype.pause=function(a){var b=0;var c=this;this.readyState="pausing"; function d(){h("paused");c.readyState="paused";a()}if(this.polling||!this.writable){var e=0;if(this.polling){h("we are currently polling - waiting to pause");e++;this.once("pollComplete",function(){h("pre-pause polling complete");--e||d()})}if(!this.writable){h("we are currently writing - waiting to pause");e++;this.once("drain",function(){h("pre-pause writing complete");--e||d()})}}else{d()}};j.prototype.poll=function(){h("polling");this.polling=true;this.doPoll();this.emit("poll")};j.prototype.onData=function(a){var b=this;h("polling got data %s",a);var c=function(a,c,d){if("opening"==b.readyState){b.onOpen()}if("close"==a.type){b.onClose();return false}b.onPacket(a)};f.decodePayload(a,this.socket.binaryType,c);if("closed"!=this.readyState){this.polling=false;this.emit("pollComplete");if("open"==this.readyState){this.poll()}else{h('ignoring poll - transport state "%s"',this.readyState)}}};j.prototype.doClose=function(){var a=this;function b(){h("writing close packet");a.write([{type:"close"}])}if("open"==this.readyState){h("transport open - closing");b()}else{h("transport not open - deferring close");this.once("open",b)}};j.prototype.write=function(a){var b=this;this.writable=false;var c=function(){b.writable=true;b.emit("drain")};var b=this;f.encodePayload(a,this.supportsBinary,function(a){b.doWrite(a,c)})};j.prototype.uri=function(){var a=this.query||{};var b=this.secure?"https":"http";var c="";if(false!==this.timestampRequests){a[this.timestampParam]=+new Date+"-"+d.timestamps++}if(!this.supportsBinary&&!a.sid){a.b64=1}a=e.encode(a);if(this.port&&("https"==b&&this.port!=443||"http"==b&&this.port!=80)){c=":"+this.port}if(a.length){a="?"+a}return b+"://"+this.hostname+c+this.path+a}},{"../transport":14,"component-inherit":21,debug:9,"engine.io-parser":22,parseqs:30,xmlhttprequest:20}],19:[function(a,b,c){var d=a("../transport");var e=a("engine.io-parser");var f=a("parseqs");var g=a("component-inherit");var h=a("debug")("engine.io-client:websocket");var i=a("ws");b.exports=j;function j(a){var b=a&&a.forceBase64;if(b){this.supportsBinary=false}d.call(this,a)}g(j,d);j.prototype.name="websocket";j.prototype.supportsBinary=true;j.prototype.doOpen=function(){if(!this.check()){return}var a=this;var b=this.uri();var c=void 0;var d={agent:this.agent};this.ws=new i(b,c,d);if(this.ws.binaryType===undefined){this.supportsBinary=false}this.ws.binaryType="arraybuffer";this.addEventListeners()};j.prototype.addEventListeners=function(){var a=this;this.ws.onopen=function(){a.onOpen()};this.ws.onclose=function(){a.onClose()};this.ws.onmessage=function(b){a.onData(b.data)};this.ws.onerror=function(b){a.onError("websocket error",b)}};if("undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)){j.prototype.onData=function(a){var b=this;setTimeout(function(){d.prototype.onData.call(b,a)},0)}}j.prototype.write=function(a){var b=this;this.writable=false;for(var c=0,d=a.length;c1){return{type:l[d],data:a.substring(1)}}else{return{type:l[d]}}}var e=new Uint8Array(a);var d=e[0];var g=f(a,1);if(n&&b==="blob"){g=new n([g])}return{type:l[d],data:g}};c.decodeBase64Packet=function(a,b){var c=l[a.charAt(0)];if(!d.ArrayBuffer){return{type:c,data:{base64:true,data:a.substr(1)}}}var e=g.decode(a.substr(1));if(b==="blob"&&n){e=new n([e])}return{type:c,data:e}};c.encodePayload=function(a,b,d){if(typeof b=="function"){d=b;b=null}if(b){if(n&&!j){return c.encodePayloadAsBlob(a,d)}return c.encodePayloadAsArrayBuffer(a,d)}if(!a.length){return d("0:")}function e(a){return a.length+":"+a}function f(a,d){c.encodePacket(a,b,function(a){d(null,e(a))})}r(a,f,function(a,b){return d(b.join(""))})};function r(a,b,c){var d=new Array(a.length);var e=h(a.length,c);var f=function(a,c,e){b(c,function(b,c){d[a]=c;e(b,d)})};for(var g=0;g0){var h=new Uint8Array(e);var i=h[0]===0;var j="";for(var k=1;;k++){if(h[k]==255)break;j+=h[k]}e=f(e,2+j.length);j=parseInt(j);var l=f(e,0,j);if(i){try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(m){var n=new Uint8Array(l);l="";for(var k=0;kd){c=d}if(b>=d||b>=c||d===0){return new ArrayBuffer(0)}var e=new Uint8Array(a);var f=new Uint8Array(c-b);for(var g=b,h=0;g>2];f+=a[(c[d]&3)<<4|c[d+1]>>4];f+=a[(c[d+1]&15)<<2|c[d+2]>>6];f+=a[c[d+2]&63]}if(e%3===2){f=f.substring(0,f.length-1)+"="}else if(e%3===1){f=f.substring(0,f.length-2)+"=="}return f};c.decode=function(b){var c=b.length*.75,d=b.length,e,f=0,g,h,i,j;if(b[b.length-1]==="="){c--;if(b[b.length-2]==="="){c--}}var k=new ArrayBuffer(c),l=new Uint8Array(k);for(e=0;e>4;l[f++]=(h&15)<<4|i>>2;l[f++]=(i&3)<<6|j&63}return k}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],27:[function(a,b,c){var d=typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var e=d.BlobBuilder||d.WebKitBlobBuilder||d.MSBlobBuilder||d.MozBlobBuilder;var f=function(){try{var a=new Blob(["hi"]);return a.size==2}catch(b){return false}}();var g=e&&e.prototype.append&&e.prototype.getBlob;function h(a,b){b=b||{};var c=new e;for(var d=0;d=55296&&e<=56319&&c65535){d-=65536;e+=i(d>>>10&1023|55296);d=56320|d&1023}e+=i(d)}return e}function l(a,b){return i(a>>b&63|128)}function m(a){if((a&4294967168)==0){return i(a)}var b="";if((a&4294965248)==0){b=i(a>>6&31|192)}else if((a&4294901760)==0){b=i(a>>12&15|224);b+=l(a,6)}else if((a&4292870144)==0){b=i(a>>18&7|240);b+=l(a,12);b+=l(a,6)}b+=i(a&63|128);return b}function n(a){var b=j(a);var c=b.length;var d=-1;var e;var f="";while(++d=r){throw Error("Invalid byte index")}var a=q[s]&255;s++;if((a&192)==128){return a&63}throw Error("Invalid continuation byte")}function p(){var a;var b;var c;var d;var e;if(s>r){throw Error("Invalid byte index")}if(s==r){return false}a=q[s]&255;s++;if((a&128)==0){return a}if((a&224)==192){var b=o();e=(a&31)<<6|b;if(e>=128){return e}else{throw Error("Invalid continuation byte")}}if((a&240)==224){b=o();c=o();e=(a&15)<<12|b<<6|c;if(e>=2048){return e}else{throw Error("Invalid continuation byte")}}if((a&248)==240){b=o();c=o();d=o();e=(a&15)<<18|b<<12|c<<6|d;if(e>=65536&&e<=1114111){return e}}throw Error("Invalid UTF-8 detected")}var q;var r;var s;function t(a){q=j(a);r=q.length;s=0;var b=[];var c;while((c=p())!==false){b.push(c)}return k(b)}var u={version:"2.0.0",encode:n,decode:t};if(typeof a=="function"&&typeof a.amd=="object"&&a.amd){a(function(){return u})}else if(f&&!f.nodeType){if(g){g.exports=u}else{var v={};var w=v.hasOwnProperty;for(var x in u){w.call(u,x)&&(f[x]=u[x])}}}else{b.utf8=u}})(this)},{}],29:[function(a,b,c){var d=typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var e=/^[\],:{}\s]*$/;var f=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;var g=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;var h=/(?:^|:|,)(?:\s*\[)+/g;var i=/^\s+/;var j=/\s+$/;b.exports=function k(a){if("string"!=typeof a||!a){return null}a=a.replace(i,"").replace(j,"");if(d.JSON&&JSON.parse){return JSON.parse(a)}if(e.test(a.replace(f,"@").replace(g,"]").replace(h,""))){return new Function("return "+a)()}}},{}],30:[function(a,b,c){c.encode=function(a){var b="";for(var c in a){if(a.hasOwnProperty(c)){if(b.length)b+="&";b+=encodeURIComponent(c)+"="+encodeURIComponent(a[c])}}return b};c.decode=function(a){var b={};var c=a.split("&");for(var d=0,e=c.length;d1)))/4)-u((a-1901+b)/100)+u((a-1601+b)/400)}}if(!(e={}.hasOwnProperty)){e=function(a){var b={},d;if((b.__proto__=null,b.__proto__={toString:1},b).toString!=c){e=function(a){var b=this.__proto__,c=a in(this.__proto__=null,this);this.__proto__=b;return c}}else{d=b.constructor;e=function(a){var b=(this.constructor||d).prototype;return a in this&&!(a in b&&this[a]===b[a])}}b=null;return e.call(this,a)}}var x={"boolean":1,number:1,string:1,undefined:1};var y=function(a,b){var c=typeof a[b];return c=="object"?!!a[b]:!x[c]};f=function(a,b){var d=0,g,h,i;(g=function(){this.valueOf=0}).prototype.valueOf=0;h=new g;for(i in h){if(e.call(h,i)){d++}}g=h=null;if(!d){h=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];f=function(a,b){var d=c.call(a)==n,f,g;var i=!d&&typeof a.constructor!="function"&&y(a,"hasOwnProperty")?a.hasOwnProperty:e;for(f in a){if(!(d&&f=="prototype")&&i.call(a,f)){b(f)}}for(g=h.length;f=h[--g];i.call(a,f)&&b(f));}}else if(d==2){f=function(a,b){var d={},f=c.call(a)==n,g;for(g in a){if(!(f&&g=="prototype")&&!e.call(d,g)&&(d[g]=1)&&e.call(a,g)){b(g)}}}}else{f=function(a,b){var d=c.call(a)==n,f,g;for(f in a){if(!(d&&f=="prototype")&&e.call(a,f)&&!(g=f==="constructor")){b(f)}}if(g||e.call(a,f="constructor")){b(f)}}}return f(a,b)};if(!m("json-stringify")){var z={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var A="000000";var B=function(a,b){return(A+(b||0)).slice(-a)};var C="\\u00";var D=function(a){var b='"',c=0,d=a.length,e=d>10&&t,f;if(e){f=a.split("")}for(;c-1/0&&l<1/0){if(w){v=u(l/864e5);for(n=u(v/365.2425)+1970-1;w(n+1,0)<=v;n++);for(t=u((v-w(n,0))/30.42);w(n,t+1)<=v;t++);v=1+v-w(n,t);x=(l%864e5+864e5)%864e5;y=u(x/36e5)%24;z=u(x/6e4)%60;A=u(x/1e3)%60;C=x%1e3}else{n=l.getUTCFullYear();t=l.getUTCMonth();v=l.getUTCDate();y=l.getUTCHours();z=l.getUTCMinutes();A=l.getUTCSeconds();C=l.getUTCMilliseconds()}l=(n<=0||n>=1e4?(n<0?"-":"+")+B(6,n<0?-n:n):B(4,n))+"-"+B(2,t+1)+"-"+B(2,v)+"T"+B(2,y)+":"+B(2,z)+":"+B(2,A)+"."+B(3,C)+"Z"}else{l=null}}else if(typeof l.toJSON=="function"&&(m!=p&&m!=q&&m!=r||e.call(l,"toJSON"))){l=l.toJSON(a)}}if(d){l=d.call(b,a,l)}if(l===null){return"null"}m=c.call(l);if(m==s){return""+l}else if(m==p){return l>-1/0&&l<1/0?""+l:"null"}else if(m==q){return D(""+l)}if(typeof l=="object"){for(I=k.length;I--;){if(k[I]===l){throw TypeError()}}k.push(l);F=[];J=j;j+=i;if(m==r){for(H=0,I=l.length;H0){for(e="",d>10&&(d=10);e.length=48&&g<=57||g>=97&&g<=102||g>=65&&g<=70)){J()}}c+=F("0x"+a.slice(d,H));break;default:J()}}else{if(g==34){break}g=a.charCodeAt(H);d=H;while(g>=32&&g!=92&&g!=34){g=a.charCodeAt(++H)}c+=a.slice(d,H)}}if(a.charCodeAt(H)==34){H++;return c}J();default:d=H;if(g==45){f=true;g=a.charCodeAt(++H)}if(g>=48&&g<=57){if(g==48&&(g=a.charCodeAt(H+1),g>=48&&g<=57)){J()}f=false;for(;H=48&&g<=57);H++);if(a.charCodeAt(H)==46){e=++H;for(;e=48&&g<=57);e++);if(e==H){J()}H=e}g=a.charCodeAt(H);if(g==101||g==69){g=a.charCodeAt(++H);if(g==43||g==45){H++}for(e=H;e=48&&g<=57);e++);if(e==H){J()}H=e}return+a.slice(d,H)}if(f){J()}if(a.slice(H,H+4)=="true"){H+=4;return true}else if(a.slice(H,H+5)=="false"){H+=5;return false}else if(a.slice(H,H+4)=="null"){H+=4;return null}J()}}return"$"};var L=function(a){var b,c;if(a=="$"){J()}if(typeof a=="string"){if((t?a.charAt(0):a[0])=="@"){return a.slice(1)}if(a=="["){b=[];for(;;c||(c=true)){a=K();if(a=="]"){break}if(c){if(a==","){a=K();if(a=="]"){J()}}else{J()}}if(a==","){J()}b.push(L(a))}return b}else if(a=="{"){b={};for(;;c||(c=true)){a=K();if(a=="}"){break}if(c){if(a==","){a=K();if(a=="}"){J()}}else{J()}}if(a==","||typeof a!="string"||(t?a.charAt(0):a[0])!="@"||K()!=":"){J()}b[a.slice(1)]=L(K())}return b}J()}return a};var M=function(a,b,c){var d=N(a,b,c);if(d===g){delete a[b]}else{a[b]=d}};var N=function(a,b,d){var e=a[b],g;if(typeof e=="object"&&e){if(c.call(e)==r){for(g=e.length;g--;){M(e,g,d)}}else{f(e,function(a){M(e,a,d)})}}return d.call(a,b,e)};j.parse=function(a,b){var d,e;H=0;I=""+a;d=L(K());if(K()!="$"){J()}H=I=null;return b&&c.call(b)==n?N((e={},e[""]=d,e),"",b):d}}}if(h){a(function(){return j})}})(this)},{}],43:[function(a,b,c){b.exports=d;function d(a,b){var c=[];b=b||0;for(var d=b||0;d-1){return true}}return false};(function(a,b){"use strict";if(typeof exports==="object"){module.exports=b(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains"))}else if(typeof define==="function"&&define.amd){define(["./punycode","./IPv6","./SecondLevelDomains"],b)}else{a.URI=b(a.punycode,a.IPv6,a.SecondLevelDomains,a)}})(this,function(a,b,c,d){"use strict";var e=d&&d.URI;function f(a,b){if(!(this instanceof f)){return new f(a,b)}if(a===undefined){if(typeof location!=="undefined"){a=location.href+""}else{a=""}}this.href(a);if(b!==undefined){return this.absoluteTo(b)}return this}f.version="1.13.2";var g=f.prototype;var h=Object.prototype.hasOwnProperty;function i(a){return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function j(a){if(a===undefined){return"Undefined"}return String(Object.prototype.toString.call(a)).slice(8,-1)}function k(a){return j(a)==="Array"}function l(a,b){var c={};var d,e;if(k(b)){for(d=0,e=b.length;d]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi;f.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/};f.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"}; -f.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/;f.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src"};f.getDomAttribute=function(a){if(!a||!a.nodeName){return undefined}var b=a.nodeName.toLowerCase();if(b==="input"&&a.type!=="image"){return undefined}return f.domAttributes[b]};function o(a){return escape(a)}function p(a){return encodeURIComponent(a).replace(/[!'()*]/g,o).replace(/\*/g,"%2A")}f.encode=p;f.decode=decodeURIComponent;f.iso8859=function(){f.encode=escape;f.decode=unescape};f.unicode=function(){f.encode=p;f.decode=decodeURIComponent};f.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}}};f.encodeQuery=function(a,b){var c=f.encode(a+"");if(b===undefined){b=f.escapeQuerySpace}return b?c.replace(/%20/g,"+"):c};f.decodeQuery=function(a,b){a+="";if(b===undefined){b=f.escapeQuerySpace}try{return f.decode(b?a.replace(/\+/g,"%20"):a)}catch(c){return a}};f.recodePath=function(a){var b=(a+"").split("/");for(var c=0,d=b.length;c-1){b.fragment=a.substring(c+1)||null;a=a.substring(0,c)}c=a.indexOf("?");if(c>-1){b.query=a.substring(c+1)||null;a=a.substring(0,c)}if(a.substring(0,2)==="//"){b.protocol=null;a=a.substring(2);a=f.parseAuthority(a,b)}else{c=a.indexOf(":");if(c>-1){b.protocol=a.substring(0,c)||null;if(b.protocol&&!b.protocol.match(f.protocol_expression)){b.protocol=undefined}else if(b.protocol==="file"){a=a.substring(c+3)}else if(a.substring(c+1,c+3)==="//"){a=a.substring(c+3);a=f.parseAuthority(a,b)}else{a=a.substring(c+1);b.urn=true}}}b.path=a;return b};f.parseHost=function(a,b){var c=a.indexOf("/");var d;var e;if(c===-1){c=a.length}if(a.charAt(0)==="["){d=a.indexOf("]");b.hostname=a.substring(1,d)||null;b.port=a.substring(d+2,c)||null;if(b.port==="/"){b.port=null}}else if(a.indexOf(":")!==a.lastIndexOf(":")){b.hostname=a.substring(0,c)||null;b.port=null}else{e=a.substring(0,c).split(":");b.hostname=e[0]||null;b.port=e[1]||null}if(b.hostname&&a.substring(c).charAt(0)!=="/"){c++;a="/"+a}return a.substring(c)||"/"};f.parseAuthority=function(a,b){a=f.parseUserinfo(a,b);return f.parseHost(a,b)};f.parseUserinfo=function(a,b){var c=a.indexOf("/");var d=c>-1?a.lastIndexOf("@",c):a.indexOf("@");var e;if(d>-1&&(c===-1||d768&&e.hasClass("chan")){m.focus()}});c.on("click","#sign-out",function(){location.reload()});c.on("click",".close",function(){var b="/close";var c=$(this).closest(".chan");if(c.hasClass("lobby")){b="/quit";var d=c.clone().remove("span").text().trim();if(!confirm("Disconnect from "+d+"?")){return false}}a.emit("input",{target:c.data("id"),text:b});c.css({transition:"none",opacity:.4});return false});d.on("input",".search",function(){var a=$(this).val();var b=$(this).closest(".users").find(".names");b.find("button").each(function(){var b=$(this);var c=b.text().toLowerCase().replace(/[+%@~]/,"");if(c.indexOf(a)===0){b.show()}else{b.hide()}})});d.on("click",".user",function(){var b=$(this).html().trim().replace(/[+%@~]/,"");if(b.indexOf("#")!==-1){return}var c="/whois "+b;a.emit("input",{target:d.data("id"),text:c})});d.on("msg",".messages",function(a,b,d){var g=c.find(".chan[data-target="+b+"]:not(.active)");var h=g.hasClass("query");var i=d.type;var j=i.contains("highlight");if(j||h){e.play();if(document.hidden||!$(b).hasClass("active")){f.badge("!")}}if(g.length===0){return}var k=["join","part","quit","nick"];if($.inArray(i,k)!==-1){return}var l=g.find(".badge");if(l.length!==0){var m=(parseInt(l.html())||0)+1;l.html(m);if(j||h){l.addClass("highlight")}}});d.on("click",".show-more",function(){var b=$(this);var c=b.data("id");var d=b.next(".messages").children().length;a.emit("showMore",{target:c,count:d})});var p=$("#windows");var q=$("#sign-in, #connect");p.on("show","#sign-in",function(){var a=$(this);var b=a.find("input");b.each(function(){var a=$(this);if(a.val()===""){a.focus();return false}})});p.on("click",".input",function(){$(this).select()});q.on("submit","form",function(b){b.preventDefault();var c="auth";var d=$(this);if(d.closest(".window").attr("id")=="connect"){c="conn";d.find(".btn").attr("disabled",true).end()}var e={};$.each(d.serializeArray(),function(a,b){if(b.value!==""){e[b.name]=b.value}});if(e.user){$.cookie("user",e.user)}a.emit(c,e)});Mousetrap.bind(["command+up","command+down","ctrl+up","ctrl+down"],function(a,b){var d=c.find(".chan");var e=d.index(d.filter(".active"));var f=b.split("+").pop();switch(f){case"up":var g=Math.max(0,e-1);d.eq(g).click();break;case"down":var g=Math.min(d.length,e+1);d.eq(g).click();break}});function r(a){var e=b.slice();var f=d.find(".active").find(".names").children().each(function(){e.push($(this).text().replace(/[+%@~]/,""))});var g=c.find(".channel").each(function(){var a=$(this).clone().remove("span").text().trim();e.push(a)});return $.grep(e,function(b){return!b.toLowerCase().indexOf(a.toLowerCase())})}document.addEventListener("visibilitychange",function(){if(c.find(".highlight").length==0){f.badge("")}})}); \ No newline at end of file +f.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/;f.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src"};f.getDomAttribute=function(a){if(!a||!a.nodeName){return undefined}var b=a.nodeName.toLowerCase();if(b==="input"&&a.type!=="image"){return undefined}return f.domAttributes[b]};function o(a){return escape(a)}function p(a){return encodeURIComponent(a).replace(/[!'()*]/g,o).replace(/\*/g,"%2A")}f.encode=p;f.decode=decodeURIComponent;f.iso8859=function(){f.encode=escape;f.decode=unescape};f.unicode=function(){f.encode=p;f.decode=decodeURIComponent};f.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}}};f.encodeQuery=function(a,b){var c=f.encode(a+"");if(b===undefined){b=f.escapeQuerySpace}return b?c.replace(/%20/g,"+"):c};f.decodeQuery=function(a,b){a+="";if(b===undefined){b=f.escapeQuerySpace}try{return f.decode(b?a.replace(/\+/g,"%20"):a)}catch(c){return a}};f.recodePath=function(a){var b=(a+"").split("/");for(var c=0,d=b.length;c-1){b.fragment=a.substring(c+1)||null;a=a.substring(0,c)}c=a.indexOf("?");if(c>-1){b.query=a.substring(c+1)||null;a=a.substring(0,c)}if(a.substring(0,2)==="//"){b.protocol=null;a=a.substring(2);a=f.parseAuthority(a,b)}else{c=a.indexOf(":");if(c>-1){b.protocol=a.substring(0,c)||null;if(b.protocol&&!b.protocol.match(f.protocol_expression)){b.protocol=undefined}else if(b.protocol==="file"){a=a.substring(c+3)}else if(a.substring(c+1,c+3)==="//"){a=a.substring(c+3);a=f.parseAuthority(a,b)}else{a=a.substring(c+1);b.urn=true}}}b.path=a;return b};f.parseHost=function(a,b){var c=a.indexOf("/");var d;var e;if(c===-1){c=a.length}if(a.charAt(0)==="["){d=a.indexOf("]");b.hostname=a.substring(1,d)||null;b.port=a.substring(d+2,c)||null;if(b.port==="/"){b.port=null}}else if(a.indexOf(":")!==a.lastIndexOf(":")){b.hostname=a.substring(0,c)||null;b.port=null}else{e=a.substring(0,c).split(":");b.hostname=e[0]||null;b.port=e[1]||null}if(b.hostname&&a.substring(c).charAt(0)!=="/"){c++;a="/"+a}return a.substring(c)||"/"};f.parseAuthority=function(a,b){a=f.parseUserinfo(a,b);return f.parseHost(a,b)};f.parseUserinfo=function(a,b){var c=a.indexOf("/");var d=c>-1?a.lastIndexOf("@",c):a.indexOf("@");var e;if(d>-1&&(c===-1||d768&&e.hasClass("chan")){l.focus()}});c.on("click","#sign-out",function(){location.reload()});c.on("click",".close",function(){var b="/close";var c=$(this).closest(".chan");if(c.hasClass("lobby")){b="/quit";var d=c.clone().remove("span").text().trim();if(!confirm("Disconnect from "+d+"?")){return false}}a.emit("input",{target:c.data("id"),text:b});c.css({transition:"none",opacity:.4});return false});d.on("input",".search",function(){var a=$(this).val();var b=$(this).closest(".users").find(".names");b.find("button").each(function(){var b=$(this);var c=b.text().toLowerCase().replace(/[+%@~]/,"");if(c.indexOf(a)===0){b.show()}else{b.hide()}})});d.on("click",".user",function(){var b=$(this).html().trim().replace(/[+%@~]/,"");if(b.indexOf("#")!==-1){return}var c="/whois "+b;a.emit("input",{target:d.data("id"),text:c})});d.on("msg",".messages",function(a,b,d){var g=c.find(".chan[data-target="+b+"]:not(.active)");var h=g.hasClass("query");var i=d.type;var j=i.contains("highlight");if(j||h){e.play();if(document.hidden||!$(b).hasClass("active")){f.badge("!")}}if(g.length===0){return}var k=["join","part","quit","nick"];if($.inArray(i,k)!==-1){return}var l=g.find(".badge");if(l.length!==0){var m=(parseInt(l.html())||0)+1;l.html(m);if(j||h){l.addClass("highlight")}}});d.on("click",".show-more",function(){var b=$(this);var c=b.data("id");var d=b.next(".messages").children().length;a.emit("showMore",{target:c,count:d})});var o=$("#windows");var p=$("#sign-in, #connect");o.on("show","#sign-in",function(){var a=$(this);var b=a.find("input");b.each(function(){var a=$(this);if(a.val()===""){a.focus();return false}})});o.on("click",".input",function(){$(this).select()});p.on("submit","form",function(b){b.preventDefault();var c="auth";var d=$(this);if(d.closest(".window").attr("id")=="connect"){c="conn";d.find(".btn").attr("disabled",true).end()}var e={};$.each(d.serializeArray(),function(a,b){if(b.value!==""){e[b.name]=b.value}});if(e.user){$.cookie("user",e.user)}a.emit(c,e)});Mousetrap.bind(["command+up","command+down","ctrl+up","ctrl+down"],function(a,b){var d=c.find(".chan");var e=d.index(d.filter(".active"));var f=b.split("+").pop();switch(f){case"up":var g=Math.max(0,e-1);d.eq(g).click();break;case"down":var g=Math.min(d.length,e+1);d.eq(g).click();break}});function q(a){var e=b.slice();var f=d.find(".active").find(".names").children().each(function(){e.push($(this).text().replace(/[+%@~]/,""))});var g=c.find(".channel").each(function(){var a=$(this).clone().remove("span").text().trim();e.push(a)});return $.grep(e,function(b){return!b.toLowerCase().indexOf(a.toLowerCase())})}document.addEventListener("visibilitychange",function(){if(c.find(".highlight").length==0){f.badge("")}})});(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b["chan"]=a({1:function(a,b,c,d){var e,f="function",g=this.escapeExpression;return'\n\n"},compiler:[5,">= 2.0.0"],main:function(a,b,c,d){var e,f=""; +e=b.each.call(a,a&&a.channels,{name:"each",hash:{},fn:this.program(1,d),inverse:this.noop,data:d});if(e||e===0){f+=e}return f+"\n"},useData:true});b["chat"]=a({1:function(a,b,c,d){var e,f,g="function",h=this.escapeExpression,i=b.helperMissing,j='\n
\n
\n \n \n '+h((f=b.name||a&&a.name,typeof f===g?f.call(a,{name:"name",hash:{},data:d}):f))+'\n '+h((f=b.type||a&&a.type,typeof f===g?f.call(a,{name:"type",hash:{},data:d}):f))+' \n
\n
\n ';e=(f=b.equal||a&&a.equal||i,f.call(a,100,(e=a&&a.messages,e==null||e===false?e:e.length),{name:"equal",hash:{},fn:this.program(2,d),inverse:this.noop,data:d}));if(e||e===0){j+=e}return j+'\n
\n '+h((f=b.partial||a&&a.partial||i,f.call(a,"msg",{name:"partial",hash:{},data:d})))+'\n
\n
\n \n
\n"},2:function(a,b,c,d){var e,f="function",g=this.escapeExpression;return'\n \n '},compiler:[5,">= 2.0.0"],main:function(a,b,c,d){var e,f="";e=b.each.call(a,a&&a.channels,{name:"each",hash:{},fn:this.program(1,d),inverse:this.noop,data:d});if(e||e===0){f+=e}return f+"\n"},useData:true});b["msg"]=a({1:function(a,b,c,d){var e,f,g="function",h=this.escapeExpression,i=b.helperMissing,j='\n
\n \n '+h((f=b.tz||a&&a.tz||i,f.call(a,a&&a.time,{name:"tz",hash:{},data:d})))+'\n \n \n ';e=b["if"].call(a,a&&a.from,{name:"if",hash:{},fn:this.program(2,d),inverse:this.noop,data:d});if(e||e===0){j+=e}j+='\n \n \n '+h((f=b.type||a&&a.type,typeof f===g?f.call(a,{name:"type",hash:{},data:d}):f))+"\n ";e=(f=b.equal||a&&a.equal||i,f.call(a,a&&a.type,"image",{name:"equal",hash:{},fn:this.program(4,d),inverse:this.program(6,d),data:d}));if(e||e===0){j+=e}return j+"\n \n
\n"},2:function(a,b,c,d){var e,f="function",g=this.escapeExpression;return'\n \n "},4:function(a,b,c,d){var e,f="function",g=this.escapeExpression;return'\n \n '},6:function(a,b,c,d){var e,f,g=b.helperMissing,h="\n ";e=(f=b.uri||a&&a.uri||g,f.call(a,a&&a.text,{name:"uri",hash:{},data:d}));if(e||e===0){h+=e}return h+"\n "},compiler:[5,">= 2.0.0"],main:function(a,b,c,d){var e,f="";e=b.each.call(a,a&&a.messages,{name:"each",hash:{},fn:this.program(1,d),inverse:this.noop,data:d});if(e||e===0){f+=e}return f+"\n"},useData:true});b["network"]=a({1:function(a,b,c,d){var e,f="function",g=this.escapeExpression,h=b.helperMissing;return'\n
\n '+g((e=b.partial||a&&a.partial||h,e.call(a,"chan",{name:"partial",hash:{},data:d})))+"\n
\n"},compiler:[5,">= 2.0.0"],main:function(a,b,c,d){var e,f="";e=b.each.call(a,a&&a.networks,{name:"each",hash:{},fn:this.program(1,d),inverse:this.noop,data:d});if(e||e===0){f+=e}return f+"\n"},useData:true});b["user"]=a({1:function(a,b,c,d){var e,f="function",g=this.escapeExpression;return'\n
\n \n
\n'},3:function(a,b,c,d){var e,f="function",g=this.escapeExpression;return'\n \n "},compiler:[5,">= 2.0.0"],main:function(a,b,c,d){var e,f="";e=b["if"].call(a,(e=a&&a.users,e==null||e===false?e:e.length),{name:"if",hash:{},fn:this.program(1,d),inverse:this.noop,data:d});if(e||e===0){f+=e}f+='\n
\n ';e=b.each.call(a,a&&a.users,{name:"each",hash:{},fn:this.program(3,d),inverse:this.noop,data:d});if(e||e===0){f+=e}return f+"\n
\n"},useData:true})})(); \ No newline at end of file diff --git a/client/index.html b/client/index.html index f08d270d..4e3295a0 100644 --- a/client/index.html +++ b/client/index.html @@ -150,90 +150,6 @@ -
- - - - - - - - - -
- <% if (debug) { %> diff --git a/client/js/shout.js b/client/js/shout.js index ef788d32..7cb573c1 100644 --- a/client/js/shout.js +++ b/client/js/shout.js @@ -41,10 +41,8 @@ $(function() { animation: "none" }); - var tpl = []; function render(name, data) { - tpl[name] = tpl[name] || Handlebars.compile($("#templates ." + name).html()); - return tpl[name](data); + return Handlebars.templates[name](data); } Handlebars.registerHelper( @@ -84,7 +82,7 @@ $(function() { } sidebar.find(".networks").html( - render("networks", { + render("network", { networks: data.networks }) ); @@ -117,7 +115,7 @@ $(function() { var id = data.network; var network = sidebar.find("#network-" + id); network.append( - render("channels", { + render("chan", { channels: [data.chan] }) ); @@ -141,7 +139,7 @@ $(function() { target = "#chan-" + target; chat.find(target) .find(".messages") - .append(render("messages", {messages: [data.msg]})) + .append(render("msg", {messages: [data.msg]})) .trigger("msg", [ target, data.msg @@ -155,14 +153,14 @@ $(function() { .remove() .end() .find(".messages") - .prepend(render("messages", {messages: data.messages})) + .prepend(render("msg", {messages: data.messages})) .end(); }); socket.on("network", function(data) { sidebar.find(".empty").hide(); sidebar.find(".networks").append( - render("networks", { + render("network", { networks: [data.network] }) ); @@ -215,7 +213,7 @@ $(function() { socket.on("users", function(data) { chat.find("#chan-" + data.chan) .find(".users") - .html(render("users", data)); + .html(render("user", data)); }); $("#connect") diff --git a/client/js/shout.templates.js b/client/js/shout.templates.js new file mode 100644 index 00000000..74b5513e --- /dev/null +++ b/client/js/shout.templates.js @@ -0,0 +1,122 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['chan'] = template({"1":function(depth0,helpers,partials,data) { + var helper, functionType="function", escapeExpression=this.escapeExpression; + return "\n\n"; +},"compiler":[5,">= 2.0.0"],"main":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers.each.call(depth0, (depth0 && depth0.channels), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n"; +},"useData":true}); +templates['chat'] = template({"1":function(depth0,helpers,partials,data) { + var stack1, helper, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, buffer = "\n
\n
\n \n \n " + + escapeExpression(((helper = helpers.name || (depth0 && depth0.name)),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper))) + + "\n " + + escapeExpression(((helper = helpers.type || (depth0 && depth0.type)),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper))) + + " \n
\n
\n "; + stack1 = (helper = helpers.equal || (depth0 && depth0.equal) || helperMissing,helper.call(depth0, 100, ((stack1 = (depth0 && depth0.messages)),stack1 == null || stack1 === false ? stack1 : stack1.length), {"name":"equal","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data})); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n
\n " + + escapeExpression((helper = helpers.partial || (depth0 && depth0.partial) || helperMissing,helper.call(depth0, "msg", {"name":"partial","hash":{},"data":data}))) + + "\n
\n
\n \n
\n"; +},"2":function(depth0,helpers,partials,data) { + var helper, functionType="function", escapeExpression=this.escapeExpression; + return "\n \n "; +},"compiler":[5,">= 2.0.0"],"main":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers.each.call(depth0, (depth0 && depth0.channels), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n"; +},"useData":true}); +templates['msg'] = template({"1":function(depth0,helpers,partials,data) { + var stack1, helper, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, buffer = "\n
\n \n " + + escapeExpression((helper = helpers.tz || (depth0 && depth0.tz) || helperMissing,helper.call(depth0, (depth0 && depth0.time), {"name":"tz","hash":{},"data":data}))) + + "\n \n \n "; + stack1 = helpers['if'].call(depth0, (depth0 && depth0.from), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n \n \n " + + escapeExpression(((helper = helpers.type || (depth0 && depth0.type)),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper))) + + "\n "; + stack1 = (helper = helpers.equal || (depth0 && depth0.equal) || helperMissing,helper.call(depth0, (depth0 && depth0.type), "image", {"name":"equal","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data})); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n \n
\n"; +},"2":function(depth0,helpers,partials,data) { + var helper, functionType="function", escapeExpression=this.escapeExpression; + return "\n \n "; +},"4":function(depth0,helpers,partials,data) { + var helper, functionType="function", escapeExpression=this.escapeExpression; + return "\n \n "; +},"6":function(depth0,helpers,partials,data) { + var stack1, helper, helperMissing=helpers.helperMissing, buffer = "\n "; + stack1 = (helper = helpers.uri || (depth0 && depth0.uri) || helperMissing,helper.call(depth0, (depth0 && depth0.text), {"name":"uri","hash":{},"data":data})); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n "; +},"compiler":[5,">= 2.0.0"],"main":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers.each.call(depth0, (depth0 && depth0.messages), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n"; +},"useData":true}); +templates['network'] = template({"1":function(depth0,helpers,partials,data) { + var helper, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing; + return "\n
\n " + + escapeExpression((helper = helpers.partial || (depth0 && depth0.partial) || helperMissing,helper.call(depth0, "chan", {"name":"partial","hash":{},"data":data}))) + + "\n
\n"; +},"compiler":[5,">= 2.0.0"],"main":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers.each.call(depth0, (depth0 && depth0.networks), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n"; +},"useData":true}); +templates['user'] = template({"1":function(depth0,helpers,partials,data) { + var stack1, functionType="function", escapeExpression=this.escapeExpression; + return "\n
\n \n
\n"; +},"3":function(depth0,helpers,partials,data) { + var helper, functionType="function", escapeExpression=this.escapeExpression; + return "\n \n "; +},"compiler":[5,">= 2.0.0"],"main":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.users)),stack1 == null || stack1 === false ? stack1 : stack1.length), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n
\n "; + stack1 = helpers.each.call(depth0, (depth0 && depth0.users), {"name":"each","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer + "\n
\n"; +},"useData":true}); +})(); \ No newline at end of file diff --git a/client/templates/chan.tpl b/client/templates/chan.tpl new file mode 100644 index 00000000..ce7744d7 --- /dev/null +++ b/client/templates/chan.tpl @@ -0,0 +1,7 @@ +{{#each channels}} + +{{/each}} diff --git a/client/templates/chat.tpl b/client/templates/chat.tpl new file mode 100644 index 00000000..39f83e60 --- /dev/null +++ b/client/templates/chat.tpl @@ -0,0 +1,25 @@ +{{#each channels}} +
+
+ + + {{name}} + {{type}} +
+
+ {{#equal 100 messages.length}} + + {{/equal}} +
+ {{partial "msg"}} +
+
+ +
+{{/each}} diff --git a/client/templates/msg.tpl b/client/templates/msg.tpl new file mode 100644 index 00000000..5209e681 --- /dev/null +++ b/client/templates/msg.tpl @@ -0,0 +1,20 @@ +{{#each messages}} +
+ + {{tz time}} + + + {{#if from}} + + {{/if}} + + + {{type}} + {{#equal type "image"}} + + {{else}} + {{{uri text}}} + {{/equal}} + +
+{{/each}} diff --git a/client/templates/network.tpl b/client/templates/network.tpl new file mode 100644 index 00000000..4f542c93 --- /dev/null +++ b/client/templates/network.tpl @@ -0,0 +1,5 @@ +{{#each networks}} +
+ {{partial "chan"}} +
+{{/each}} diff --git a/client/templates/user.tpl b/client/templates/user.tpl new file mode 100644 index 00000000..db177055 --- /dev/null +++ b/client/templates/user.tpl @@ -0,0 +1,10 @@ +{{#if users.length}} +
+ +
+{{/if}} +
+ {{#each users}} + + {{/each}} +
diff --git a/package.json b/package.json index d0b2d0b1..379fd926 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "irc", "server" ], + "license": "MIT", "dependencies": { "commander": "^2.3.0", "connect": "~2.19.6",